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
-
IResourceIConstructIConstructIDependable
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
Constructid
stringprops
IApiKeyProps
Properties
KeyArn
The API key ARN.
public virtual string KeyArn { get; }
Property Value
KeyId
The API key ID.
public virtual string KeyId { get; }
Property Value
Methods
FromApiKeyId(Construct, string, string)
Import an ApiKey by its Id.
public static IApiKey FromApiKeyId(Construct scope, string id, string apiKeyId)
Parameters
Returns
GrantRead(IGrantable)
Permits the IAM principal all read operations through this key.
public virtual Grant GrantRead(IGrantable grantee)
Parameters
grantee
IGrantableThe 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
IGrantableThe 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
IGrantableThe principal to grant access to.
Returns
- Grant