Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CEXT-2009 Add New Relic support to aio CLI #148

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,16 @@ Set Log Forwarding to Splunk HEC
| index | <code>string</code> | index |
| hecToken | <code>string</code> | hec token |

Set Log Forwarding to New Relic

**Kind**: instance method of [<code>LogForwarding</code>](#LogForwarding)
**Returns**: <code>Promise.&lt;(\*\|undefined)&gt;</code> - response from set API

| Param | Type | Description |
| --- | --- | --- |
| baseURI | <code>string</code> | host |
| licenseKey | <code>string</code> | port |

<a name="LogForwarding+getSupportedDestinations"></a>

### logForwarding.getSupportedDestinations() ⇒ <code>Array.&lt;object&gt;</code>
Expand Down
17 changes: 17 additions & 0 deletions src/LogForwarding.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,23 @@ class LogForwarding {
})
}

/**
* Set Log Forwarding to New Relic
*
* @deprecated use `setDestination('new_relic', {...})`
shazron marked this conversation as resolved.
Show resolved Hide resolved
* @param {string} baseURI base URI
* @param {string} licenseKey license key
* @returns {Promise<*|undefined>} response from set API
*/
async setNewRelic (baseURI, licenseKey) {
return await this.set({
new_relic: {
base_uri: baseURI,
license_key: licenseKey
}
})
}

/**
* Get supported destinations
*
Expand Down
14 changes: 14 additions & 0 deletions src/LogForwardingLocalDestinationsProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,20 @@ class LogForwardingLocalDestinationsProvider {
type: 'password'
}
]
},
new_relic: {
name: 'New Relic',
settings: [
{
name: 'base_uri',
message: 'base URI'
},
{
name: 'license_key',
message: 'license key',
type: 'password'
}
]
}
}
}
Expand Down
7 changes: 6 additions & 1 deletion test/LogForwarding.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ const dataFixtures = [
port: 'port1',
index: 'index1',
hec_token: 'token1'
}],
['new_relic', 'setNewRelic', {
shazron marked this conversation as resolved.
Show resolved Hide resolved
base_uri: 'uri1',
licensey_key: 'key1'
}]
]

Expand Down Expand Up @@ -123,7 +127,8 @@ test('get supported destinations', async () => {
[
{ value: 'adobe_io_runtime', name: 'Adobe I/O Runtime' },
{ value: 'azure_log_analytics', name: 'Azure Log Analytics' },
{ value: 'splunk_hec', name: 'Splunk HEC' }
{ value: 'splunk_hec', name: 'Splunk HEC' },
{ value: 'new_relic', name: 'New Relic' }
]
)
resolve()
Expand Down
4 changes: 4 additions & 0 deletions test/LogForwardingUnderscoreNamespace.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ const dataFixtures = [
port: 'port1',
index: 'index1',
hec_token: 'token1'
}],
['new_relic', 'setNewRelic', {
shazron marked this conversation as resolved.
Show resolved Hide resolved
base_uri: 'uri1',
license_key: 'key1'
}]
]

Expand Down
7 changes: 7 additions & 0 deletions types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ declare class LogForwarding {
* @returns response from set API
*/
setSplunkHec(host: string, port: string, index: string, hecToken: string): Promise<any | undefined>;
/**
* Set Log Forwarding to New Relic
* @param baseURI - base URI
* @param licenseKey - license key
* @returns response from set API
*/
setNewRelic(baseURI: string, licenseKey: string): Promise<any | undefined>;
/**
* Get supported destinations
* @returns in format: { value: <value>, name: <name> }
Expand Down