Skip to content
v2.277.0

Experimental

@aws-cdk/aws-location-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.

ApiKeyProps Struct ​

Properties for an API Key.

Example ​

ts
new location.ApiKey(this, 'APIKeyAny', {
  // specify allowed actions
  allowMapsActions: [
    location.AllowMapsAction.GET_STATIC_MAP,
  ],
  allowPlacesActions: [
    location.AllowPlacesAction.GET_PLACE,
  ],
  allowRoutesActions: [
    location.AllowRoutesAction.CALCULATE_ISOLINES,
  ],
});
python
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
    ]
)
java
ApiKey.Builder.create(this, "APIKeyAny")
        // specify allowed actions
        .allowMapsActions(List.of(AllowMapsAction.GET_STATIC_MAP))
        .allowPlacesActions(List.of(AllowPlacesAction.GET_PLACE))
        .allowRoutesActions(List.of(AllowRoutesAction.CALCULATE_ISOLINES))
        .build();
csharp
// Install: dotnet add package Amazon.CDK.AWS.Location.Alpha
new ApiKey(this, "APIKeyAny", new ApiKeyProps {
    // specify allowed actions
    AllowMapsActions = new [] { AllowMapsAction.GET_STATIC_MAP },
    AllowPlacesActions = new [] { AllowPlacesAction.GET_PLACE },
    AllowRoutesActions = new [] { AllowRoutesAction.CALCULATE_ISOLINES }
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdklocationalpha/v2
location.NewApiKey(this, jsii.String("APIKeyAny"), &ApiKeyProps{
	// specify allowed actions
	AllowMapsActions: []AllowMapsAction{
		location.AllowMapsAction_GET_STATIC_MAP,
	},
	AllowPlacesActions: []AllowPlacesAction{
		location.AllowPlacesAction_GET_PLACE,
	},
	AllowRoutesActions: []AllowRoutesAction{
		location.AllowRoutesAction_CALCULATE_ISOLINES,
	},
})

Properties ​

allowMapsActionsoptionalAllowMapsAction[]allow_maps_actionsoptionaltyping.List[AllowMapsAction]allowMapsActionsoptionalList<AllowMapsAction>AllowMapsActionsoptionalAllowMapsAction[]AllowMapsActionsoptional*[]AllowMapsAction #
A list of allowed actions for Maps that an API key resource grants permissions to perform.

Default: no actions for Maps are permitted

allowPlacesActionsoptionalAllowPlacesAction[]allow_places_actionsoptionaltyping.List[AllowPlacesAction]allowPlacesActionsoptionalList<AllowPlacesAction>AllowPlacesActionsoptionalAllowPlacesAction[]AllowPlacesActionsoptional*[]AllowPlacesAction #
A list of allowed actions for Places that an API key resource grants permissions to perform.

Default: no actions for Places are permitted

allowReferersoptionalstring[]allow_referersoptionaltyping.List[str]allowReferersoptionalList<String>AllowReferersoptionalstring[]AllowReferersoptional*[]*string #
An optional list of allowed HTTP referers for which requests must originate from.

Default: no Referer

Requests using this API key from other domains will not be allowed.

allowRoutesActionsoptionalAllowRoutesAction[]allow_routes_actionsoptionaltyping.List[AllowRoutesAction]allowRoutesActionsoptionalList<AllowRoutesAction>AllowRoutesActionsoptionalAllowRoutesAction[]AllowRoutesActionsoptional*[]AllowRoutesAction #
A list of allowed actions for Routes that an API key resource grants permissions to perform.

Default: no actions for Routes are permitted

apiKeyNameoptionalstringapi_key_nameoptionalstrapiKeyNameoptionalStringApiKeyNameoptionalstringApiKeyNameoptional*string #
A name for the api key.

Default: A name is automatically generated

Must be between 1 and 100 characters and contain only alphanumeric characters, hyphens, periods and underscores.

Must be a unique API key name.

descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string #
A description for the api key.

Default: no description

expireTimeoptionaldateexpire_timeoptionaldatetimeexpireTimeoptionalInstantExpireTimeoptionalDateTimeExpireTimeoptional*time.Time #
The optional timestamp for when the API key resource will expire.

Default: undefined - The API Key never expires

expireTime must be set when noExpiry is false or undefined. When expireTime is not set, noExpiry must be true.

forceDeleteoptionalbooleanforce_deleteoptionalboolforceDeleteoptionalBooleanForceDeleteoptionalboolForceDeleteoptional*bool #
`forceDelete` bypasses an API key's expiry conditions and deletes the key.

Default: undefined - not force delete

Set the parameter true to delete the key or to false to not preemptively delete the API key.

forceUpdateoptionalbooleanforce_updateoptionalboolforceUpdateoptionalBooleanForceUpdateoptionalboolForceUpdateoptional*bool #
The boolean flag to be included for updating ExpireTime or Restrictions details.

Default: undefined - not force update

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.

noExpiryoptionalbooleanno_expiryoptionalboolnoExpiryoptionalBooleanNoExpiryoptionalboolNoExpiryoptional*bool #
Whether the API key should expire.

Default: undefined - The API Key expires at expireTime

Set to true when expireTime is not set. When you set expireTime, noExpiry must be false or undefined.