Table of Contents

Class ApiKeyProps

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

ApiKey Properties.

public class ApiKeyProps : IApiKeyProps, IApiKeyOptions, IResourceOptions
Inheritance
ApiKeyProps
Implements
Inherited Members

Examples

// The code below shows an example of how to instantiate this type.
            // The values are placeholders you should change.
            using Amazon.CDK.AWS.APIGateway;
            using Amazon.CDK;

            Authorizer authorizer;
            Integration integration;
            Model model;
            RequestValidator requestValidator;
            RestApi restApi;
            var apiKeyProps = new ApiKeyProps {
                ApiKeyName = "apiKeyName",
                CustomerId = "customerId",
                DefaultCorsPreflightOptions = new CorsOptions {
                    AllowOrigins = new [] { "allowOrigins" },

                    // the properties below are optional
                    AllowCredentials = false,
                    AllowHeaders = new [] { "allowHeaders" },
                    AllowMethods = new [] { "allowMethods" },
                    DisableCache = false,
                    ExposeHeaders = new [] { "exposeHeaders" },
                    MaxAge = Duration.Minutes(30),
                    StatusCode = 123
                },
                DefaultIntegration = integration,
                DefaultMethodOptions = new MethodOptions {
                    ApiKeyRequired = false,
                    AuthorizationScopes = new [] { "authorizationScopes" },
                    AuthorizationType = AuthorizationType.NONE,
                    Authorizer = authorizer,
                    MethodResponses = new [] { new MethodResponse {
                        StatusCode = "statusCode",

                        // the properties below are optional
                        ResponseModels = new Dictionary<string, IModel> {
                            { "responseModelsKey", model }
                        },
                        ResponseParameters = new Dictionary<string, boolean> {
                            { "responseParametersKey", false }
                        }
                    } },
                    OperationName = "operationName",
                    RequestModels = new Dictionary<string, IModel> {
                        { "requestModelsKey", model }
                    },
                    RequestParameters = new Dictionary<string, boolean> {
                        { "requestParametersKey", false }
                    },
                    RequestValidator = requestValidator,
                    RequestValidatorOptions = new RequestValidatorOptions {
                        RequestValidatorName = "requestValidatorName",
                        ValidateRequestBody = false,
                        ValidateRequestParameters = false
                    }
                },
                Description = "description",
                Enabled = false,
                GenerateDistinctId = false,
                Resources = new [] { restApi },
                Value = "value"
            };

Remarks

ExampleMetadata: fixture=_generated

Constructors

ApiKeyProps()

public ApiKeyProps()

Properties

ApiKeyName

A name for the API key.

public string? ApiKeyName { get; set; }

Property Value

string

Remarks

If you don't specify a name, AWS CloudFormation generates a unique physical ID and uses that ID for the API key name.

Default: automically generated name

Link: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-apikey.html#cfn-apigateway-apikey-name

CustomerId

An AWS Marketplace customer identifier to use when integrating with the AWS SaaS Marketplace.

public string? CustomerId { get; set; }

Property Value

string

Remarks

DefaultCorsPreflightOptions

Adds a CORS preflight OPTIONS method to this resource and all child resources.

public ICorsOptions? DefaultCorsPreflightOptions { get; set; }

Property Value

ICorsOptions

Remarks

You can add CORS at the resource-level using addCorsPreflight.

Default: - CORS is disabled

DefaultIntegration

An integration to use as a default for all methods created within this API unless an integration is specified.

public Integration? DefaultIntegration { get; set; }

Property Value

Integration

Remarks

Default: - Inherited from parent.

DefaultMethodOptions

Method options to use as a default for all methods created within this API unless custom options are specified.

public IMethodOptions? DefaultMethodOptions { get; set; }

Property Value

IMethodOptions

Remarks

Default: - Inherited from parent.

Description

A description of the purpose of the API key.

public string? Description { get; set; }

Property Value

string

Remarks

Enabled

Indicates whether the API key can be used by clients.

public bool? Enabled { get; set; }

Property Value

bool?

Remarks

GenerateDistinctId

Specifies whether the key identifier is distinct from the created API key value.

public bool? GenerateDistinctId { get; set; }

Property Value

bool?

Remarks

Resources

A list of resources this api key is associated with.

public IRestApi[]? Resources { get; set; }

Property Value

IRestApi[]

Remarks

Default: none

Value

The value of the API key.

public string? Value { get; set; }

Property Value

string

Remarks