Table of Contents

Class ApiKey

Namespace
Amazon.CDK.AWS.APIGateway
Assembly
Amazon.CDK.AWS.APIGateway.dll

An API Gateway ApiKey.

public class ApiKey : Resource, IApiKey, IResource, IConstruct, IConstruct, IDependable
Inheritance
ApiKey
Implements
IResource
IConstruct
IConstruct
IDependable

Examples

var importedKey = ApiKey.FromApiKeyId(this, "imported-key", "<api-key-id>");

Remarks

An ApiKey can be distributed to API clients that are executing requests for Method resources that require an Api Key.

ExampleMetadata: infused

Constructors

ApiKey(Construct, string, IApiKeyProps?)

public ApiKey(Construct scope, string id, IApiKeyProps? props = null)

Parameters

scope Construct
id string
props IApiKeyProps

Properties

KeyArn

The API key ARN.

public virtual string KeyArn { get; }

Property Value

string

KeyId

The API key ID.

public virtual string KeyId { get; }

Property Value

string

Methods

FromApiKeyId(Construct, string, string)

Import an ApiKey by its Id.

public static IApiKey FromApiKeyId(Construct scope, string id, string apiKeyId)

Parameters

scope Construct
id string
apiKeyId string

Returns

IApiKey

GrantRead(IGrantable)

Permits the IAM principal all read operations through this key.

public virtual Grant GrantRead(IGrantable grantee)

Parameters

grantee IGrantable

The principal to grant access to.

Returns

Grant

GrantReadWrite(IGrantable)

Permits the IAM principal all read and write operations through this key.

public virtual Grant GrantReadWrite(IGrantable grantee)

Parameters

grantee IGrantable

The principal to grant access to.

Returns

Grant

GrantWrite(IGrantable)

Permits the IAM principal all write operations through this key.

public virtual Grant GrantWrite(IGrantable grantee)

Parameters

grantee IGrantable

The principal to grant access to.

Returns

Grant