ApiKey
- class aws_cdk.aws_location_alpha.ApiKey(scope, id, *, allow_maps_actions=None, allow_places_actions=None, allow_referers=None, allow_routes_actions=None, api_key_name=None, description=None, expire_time=None, force_delete=None, force_update=None, no_expiry=None)
Bases:
Resource(experimental) An API Key.
- See:
https://docs.aws.amazon.com/location/latest/developerguide/using-apikeys.html
- Stability:
experimental
- ExampleMetadata:
infused
Example:
location.ApiKey(self, "APIKeyAny", # specify allowed actions allow_maps_actions=[location.AllowMapsAction.GET_STATIC_MAP ], allow_places_actions=[location.AllowPlacesAction.GET_PLACE ], allow_routes_actions=[location.AllowRoutesAction.CALCULATE_ISOLINES ] )
- Parameters:
scope (
Construct)id (
str)allow_maps_actions (
Optional[Sequence[AllowMapsAction]]) – (experimental) A list of allowed actions for Maps that an API key resource grants permissions to perform. Default: - no actions for Maps are permittedallow_places_actions (
Optional[Sequence[AllowPlacesAction]]) – (experimental) A list of allowed actions for Places that an API key resource grants permissions to perform. Default: - no actions for Places are permittedallow_referers (
Optional[Sequence[str]]) – (experimental) An optional list of allowed HTTP referers for which requests must originate from. Requests using this API key from other domains will not be allowed. Default: - no Refererallow_routes_actions (
Optional[Sequence[AllowRoutesAction]]) – (experimental) A list of allowed actions for Routes that an API key resource grants permissions to perform. Default: - no actions for Routes are permittedapi_key_name (
Optional[str]) – (experimental) A name for the api key. Must be between 1 and 100 characters and contain only alphanumeric characters, hyphens, periods and underscores. Must be a unique API key name. Default: - A name is automatically generateddescription (
Optional[str]) – (experimental) A description for the api key. Default: - no descriptionexpire_time (
Optional[datetime]) – (experimental) The optional timestamp for when the API key resource will expire.expireTimemust be set whennoExpiryis false or undefined. WhenexpireTimeis not set,noExpirymust betrue. Default: undefined - The API Key never expiresforce_delete (
Optional[bool]) – (experimental)forceDeletebypasses an API key’s expiry conditions and deletes the key. Set the parameter true to delete the key or to false to not preemptively delete the API key. Default: undefined - not force deleteforce_update (
Optional[bool]) – (experimental) The boolean flag to be included for updating ExpireTime or Restrictions details. Must be set to true to update an API key resource that has been used in the past 7 days. False if force update is not preferred. Default: undefined - not force updateno_expiry (
Optional[bool]) – (experimental) Whether the API key should expire. Set totruewhenexpireTimeis not set. When you setexpireTime,noExpirymust befalseorundefined. Default: undefined - The API Key expires atexpireTime
- Stability:
experimental
Methods
- apply_removal_policy(policy)
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.
The resource can be deleted (
RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).- Parameters:
policy (
RemovalPolicy)- Return type:
None
- to_string()
Returns a string representation of this construct.
- Return type:
str
Attributes
- PROPERTY_INJECTION_ID = '@aws-cdk.aws-location-alpha.ApiKey'
- api_key_arn
(experimental) The Amazon Resource Name (ARN) of the api key resource.
- Stability:
experimental
- api_key_create_time
(experimental) The timestamp for when the api key resource was created in ISO 8601 format.
- Stability:
experimental
- Attribute:
true
- api_key_name
(experimental) The name of the api key.
- Stability:
experimental
- api_key_update_time
(experimental) The timestamp for when the api key resource was last updated in ISO 8601 format.
- Stability:
experimental
- Attribute:
true
- env
The environment this resource belongs to.
For resources that are created and managed in a Stack (those created by creating new class instances like
new Role(),new Bucket(), etc.), this is always the same as the environment of the stack they belong to.For referenced resources (those obtained from referencing methods like
Role.fromRoleArn(),Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.
- node
The tree node.
- stack
The stack in which this resource is defined.
Static Methods
- classmethod from_api_key_arn(scope, id, api_key_arn)
(experimental) Use an existing api key by ARN.
- classmethod from_api_key_name(scope, id, api_key_name)
(experimental) Use an existing api key by name.
- classmethod is_construct(x)
Checks if
xis a construct.Use this method instead of
instanceofto properly detectConstructinstances, even when the construct library is symlinked.Explanation: in JavaScript, multiple copies of the
constructslibrary on disk are seen as independent, completely different libraries. As a consequence, the classConstructin each copy of theconstructslibrary is seen as a different class, and an instance of one class will not test asinstanceofthe other class.npm installwill not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of theconstructslibrary can be accidentally installed, andinstanceofwill behave unpredictably. It is safest to avoid usinginstanceof, and using this type-testing method instead.- Parameters:
x (
Any) – Any object.- Return type:
bool- Returns:
true if
xis an object created from a class which extendsConstruct.
- classmethod is_owned_resource(construct)
Returns true if the construct was created by CDK, and false otherwise.
- Parameters:
construct (
IConstruct)- Return type:
bool
- classmethod is_resource(construct)
Check whether the given construct is a Resource.
- Parameters:
construct (
IConstruct)- Return type:
bool