import * as pulumi from "@pulumi/pulumi";
/**
* Use this data source to retrieve details of an existing New Relic API access key, which can be either an [Ingest (license) key](https://docs.newrelic.com/docs/accounts/install-new-relic/account-setup/license-key) or a [User API key](https://docs.newrelic.com/docs/apis/get-started/intro-apis/types-new-relic-api-keys#user-api-key). A common use case is to fetch the default license key that New Relic creates for every account (for instance, via the `newrelic.AccountManagement` resource) and inject its value into other resources, without having to manage the key itself with the `newrelic.ApiAccessKey` resource.
*
* A key may be looked up in one of two ways: directly by its `keyId`, or by searching with a combination of `accountId`, `keyType`, `ingestType`, `userId` and `name`.
*
* Refer to the New Relic article ['Use NerdGraph to manage license keys and User API keys'](https://docs.newrelic.com/docs/apis/nerdgraph/examples/use-nerdgraph-manage-license-keys-user-keys) for detailed information.
*
* > **WARNING:** If the key being fetched was created for a user other than the one whose API key is being used to run Terraform, the New Relic API returns a truncated key value for security reasons. In such a case, the `key` attribute is not populated in state and a warning is emitted. See the Attributes Reference section below, and the New Relic article ['Use NerdGraph to manage license keys and User API keys'](https://docs.newrelic.com/docs/apis/nerdgraph/examples/use-nerdgraph-manage-license-keys-user-keys/#query-keys) for further details.
*
* ## Example Usage
*
* ### Example: Look up the default license key of an account
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as newrelic from "@pulumi/newrelic";
*
* const _default = newrelic.getApiAccessKey({
* accountId: "1234567",
* keyType: "INGEST",
* ingestType: "LICENSE",
* name: "License Key for ",
* });
* ```
*
* ### Example: Look up a key directly by its ID
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as newrelic from "@pulumi/newrelic";
*
* const byId = newrelic.getApiAccessKey({
* keyId: "131313133A331313130B5F13DF01313FDB13B13133EE5E133D13EAAB3A3C13D3",
* keyType: "INGEST",
* });
* ```
*
* ### Example: Inject a license key into another resource
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as newrelic from "@pulumi/newrelic";
*
* const ingest = newrelic.getApiAccessKey({
* accountId: "1234567",
* keyType: "INGEST",
* ingestType: "LICENSE",
* });
* export const licenseKey = ingest.then(ingest => ingest.key);
* ```
*/
export declare function getApiAccessKey(args: GetApiAccessKeyArgs, opts?: pulumi.InvokeOptions): Promise;
/**
* A collection of arguments for invoking getApiAccessKey.
*/
export interface GetApiAccessKeyArgs {
/**
* The New Relic account ID to search for keys in. Defaults to the `accountId` set in the `provider{}` block (or the `NEW_RELIC_ACCOUNT_ID` environment variable) if not specified.
*/
accountId?: string;
/**
* Filters the search to ingest keys of the given type. Valid options are `LICENSE` or `BROWSER` (case-sensitive). Only applies when `keyType` is `INGEST`.
*/
ingestType?: string;
/**
* The ID of the key to look up. When specified, the key is fetched directly by its ID and all other search arguments are ignored.
*/
keyId?: string;
/**
* The type of the key to look up. Valid options are `INGEST` or `USER` (case-sensitive).
*/
keyType: string;
/**
* Filters the search to keys with the given name.
*
* > **NOTE:** When `keyId` is not specified, the search must resolve to exactly one key. If zero or more than one key matches the given criteria, the data source returns an error. In such a case, provide additional arguments (such as `name`, `ingestType` or `userId`) to identify a unique key, or specify `keyId` directly to bypass the search.
*/
name?: string;
/**
* Filters the search to user keys owned by the given New Relic user ID. Only applies when `keyType` is `USER`.
*/
userId?: string;
}
/**
* A collection of values returned by getApiAccessKey.
*/
export interface GetApiAccessKeyResult {
/**
* The New Relic account ID the key belongs to.
*/
readonly accountId: string;
/**
* The provider-assigned unique ID for this managed resource.
*/
readonly id: string;
/**
* The type of the ingest key (`LICENSE` or `BROWSER`). Populated only when `keyType` is `INGEST`.
*/
readonly ingestType: string;
/**
* The value of the API key. This attribute is marked as **sensitive**.
* - It is important to exercise caution when exporting the value of `key`, as it is sensitive information. Avoid logging or exposing it inappropriately.
* - Not populated when the New Relic API returns a truncated key value; see the warning at the top of this page.
*/
readonly key: string;
/**
* The ID of the API key.
*/
readonly keyId: string;
/**
* The type of the key (`INGEST` or `USER`).
*/
readonly keyType: string;
/**
* The name of the API key.
*/
readonly name: string;
/**
* Any notes attached to the API key.
*/
readonly notes: string;
/**
* The New Relic user ID that owns the key. Populated only when `keyType` is `USER`.
*/
readonly userId: string;
}
/**
* Use this data source to retrieve details of an existing New Relic API access key, which can be either an [Ingest (license) key](https://docs.newrelic.com/docs/accounts/install-new-relic/account-setup/license-key) or a [User API key](https://docs.newrelic.com/docs/apis/get-started/intro-apis/types-new-relic-api-keys#user-api-key). A common use case is to fetch the default license key that New Relic creates for every account (for instance, via the `newrelic.AccountManagement` resource) and inject its value into other resources, without having to manage the key itself with the `newrelic.ApiAccessKey` resource.
*
* A key may be looked up in one of two ways: directly by its `keyId`, or by searching with a combination of `accountId`, `keyType`, `ingestType`, `userId` and `name`.
*
* Refer to the New Relic article ['Use NerdGraph to manage license keys and User API keys'](https://docs.newrelic.com/docs/apis/nerdgraph/examples/use-nerdgraph-manage-license-keys-user-keys) for detailed information.
*
* > **WARNING:** If the key being fetched was created for a user other than the one whose API key is being used to run Terraform, the New Relic API returns a truncated key value for security reasons. In such a case, the `key` attribute is not populated in state and a warning is emitted. See the Attributes Reference section below, and the New Relic article ['Use NerdGraph to manage license keys and User API keys'](https://docs.newrelic.com/docs/apis/nerdgraph/examples/use-nerdgraph-manage-license-keys-user-keys/#query-keys) for further details.
*
* ## Example Usage
*
* ### Example: Look up the default license key of an account
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as newrelic from "@pulumi/newrelic";
*
* const _default = newrelic.getApiAccessKey({
* accountId: "1234567",
* keyType: "INGEST",
* ingestType: "LICENSE",
* name: "License Key for ",
* });
* ```
*
* ### Example: Look up a key directly by its ID
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as newrelic from "@pulumi/newrelic";
*
* const byId = newrelic.getApiAccessKey({
* keyId: "131313133A331313130B5F13DF01313FDB13B13133EE5E133D13EAAB3A3C13D3",
* keyType: "INGEST",
* });
* ```
*
* ### Example: Inject a license key into another resource
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as newrelic from "@pulumi/newrelic";
*
* const ingest = newrelic.getApiAccessKey({
* accountId: "1234567",
* keyType: "INGEST",
* ingestType: "LICENSE",
* });
* export const licenseKey = ingest.then(ingest => ingest.key);
* ```
*/
export declare function getApiAccessKeyOutput(args: GetApiAccessKeyOutputArgs, opts?: pulumi.InvokeOutputOptions): pulumi.Output;
/**
* A collection of arguments for invoking getApiAccessKey.
*/
export interface GetApiAccessKeyOutputArgs {
/**
* The New Relic account ID to search for keys in. Defaults to the `accountId` set in the `provider{}` block (or the `NEW_RELIC_ACCOUNT_ID` environment variable) if not specified.
*/
accountId?: pulumi.Input;
/**
* Filters the search to ingest keys of the given type. Valid options are `LICENSE` or `BROWSER` (case-sensitive). Only applies when `keyType` is `INGEST`.
*/
ingestType?: pulumi.Input;
/**
* The ID of the key to look up. When specified, the key is fetched directly by its ID and all other search arguments are ignored.
*/
keyId?: pulumi.Input;
/**
* The type of the key to look up. Valid options are `INGEST` or `USER` (case-sensitive).
*/
keyType: pulumi.Input;
/**
* Filters the search to keys with the given name.
*
* > **NOTE:** When `keyId` is not specified, the search must resolve to exactly one key. If zero or more than one key matches the given criteria, the data source returns an error. In such a case, provide additional arguments (such as `name`, `ingestType` or `userId`) to identify a unique key, or specify `keyId` directly to bypass the search.
*/
name?: pulumi.Input;
/**
* Filters the search to user keys owned by the given New Relic user ID. Only applies when `keyType` is `USER`.
*/
userId?: pulumi.Input;
}
//# sourceMappingURL=getApiAccessKey.d.ts.map