Class ApiKeyProps
ApiKey Properties.
Inheritance
Namespace: Amazon.CDK.AWS.APIGateway
Assembly: Amazon.CDK.AWS.APIGateway.dll
Syntax (csharp)
public class ApiKeyProps : Object, IApiKeyProps, IApiKeyOptions, IResourceOptions
Syntax (vb)
Public Class ApiKeyProps
Inherits Object
Implements IApiKeyProps, IApiKeyOptions, IResourceOptions
Remarks
ExampleMetadata: fixture=_generated
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"
};
Synopsis
Constructors
ApiKeyProps() |
Properties
ApiKeyName | A name for the API key. |
CustomerId | An AWS Marketplace customer identifier to use when integrating with the AWS SaaS Marketplace. |
DefaultCorsPreflightOptions | Adds a CORS preflight OPTIONS method to this resource and all child resources. |
DefaultIntegration | An integration to use as a default for all methods created within this API unless an integration is specified. |
DefaultMethodOptions | Method options to use as a default for all methods created within this API unless custom options are specified. |
Description | A description of the purpose of the API key. |
Enabled | Indicates whether the API key can be used by clients. |
GenerateDistinctId | Specifies whether the key identifier is distinct from the created API key value. |
Resources | A list of resources this api key is associated with. |
Value | The value of the API key. |
Constructors
ApiKeyProps()
public ApiKeyProps()
Properties
ApiKeyName
A name for the API key.
public string ApiKeyName { get; set; }
Property Value
System.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
CustomerId
An AWS Marketplace customer identifier to use when integrating with the AWS SaaS Marketplace.
public string CustomerId { get; set; }
Property Value
System.String
Remarks
DefaultCorsPreflightOptions
Adds a CORS preflight OPTIONS method to this resource and all child resources.
public ICorsOptions DefaultCorsPreflightOptions { get; set; }
Property Value
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
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
Remarks
Default: - Inherited from parent.
Description
A description of the purpose of the API key.
public string Description { get; set; }
Property Value
System.String
Remarks
Enabled
Indicates whether the API key can be used by clients.
public Nullable<bool> Enabled { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
GenerateDistinctId
Specifies whether the key identifier is distinct from the created API key value.
public Nullable<bool> GenerateDistinctId { get; set; }
Property Value
System.Nullable<System.Boolean>
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
System.String
Remarks
Must be at least 20 characters long.
Default: none