Skip to content
v2.277.0

CfnAPIKeyProps Struct ​

Properties for defining a CfnAPIKey.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_location as location } from 'aws-cdk-lib';
const cfnAPIKeyProps: location.CfnAPIKeyProps = {
  keyName: 'keyName',
  restrictions: {
    allowActions: ['allowActions'],
    allowResources: ['allowResources'],

    // the properties below are optional
    allowAndroidApps: [{
      certificateFingerprint: 'certificateFingerprint',
      package: 'package',
    }],
    allowAppleApps: [{
      bundleId: 'bundleId',
    }],
    allowReferers: ['allowReferers'],
  },

  // the properties below are optional
  description: 'description',
  expireTime: 'expireTime',
  forceDelete: false,
  forceUpdate: false,
  noExpiry: false,
  tags: [{
    key: 'key',
    value: 'value',
  }],
};
python
from aws_cdk import CfnTag
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_location as location

cfn_api_key_props = location.CfnAPIKeyProps(
    key_name="keyName",
    restrictions=location.CfnAPIKey.ApiKeyRestrictionsProperty(
        allow_actions=["allowActions"],
        allow_resources=["allowResources"],

        # the properties below are optional
        allow_android_apps=[location.CfnAPIKey.AndroidAppProperty(
            certificate_fingerprint="certificateFingerprint",
            package="package"
        )],
        allow_apple_apps=[location.CfnAPIKey.AppleAppProperty(
            bundle_id="bundleId"
        )],
        allow_referers=["allowReferers"]
    ),

    # the properties below are optional
    description="description",
    expire_time="expireTime",
    force_delete=False,
    force_update=False,
    no_expiry=False,
    tags=[CfnTag(
        key="key",
        value="value"
    )]
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.location.*;

CfnAPIKeyProps cfnAPIKeyProps = CfnAPIKeyProps.builder()
        .keyName("keyName")
        .restrictions(ApiKeyRestrictionsProperty.builder()
                .allowActions(List.of("allowActions"))
                .allowResources(List.of("allowResources"))

                // the properties below are optional
                .allowAndroidApps(List.of(AndroidAppProperty.builder()
                        .certificateFingerprint("certificateFingerprint")
                        .package("package")
                        .build()))
                .allowAppleApps(List.of(AppleAppProperty.builder()
                        .bundleId("bundleId")
                        .build()))
                .allowReferers(List.of("allowReferers"))
                .build())

        // the properties below are optional
        .description("description")
        .expireTime("expireTime")
        .forceDelete(false)
        .forceUpdate(false)
        .noExpiry(false)
        .tags(List.of(CfnTag.builder()
                .key("key")
                .value("value")
                .build()))
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Location;

var cfnAPIKeyProps = new CfnAPIKeyProps {
    KeyName = "keyName",
    Restrictions = new ApiKeyRestrictionsProperty {
        AllowActions = new [] { "allowActions" },
        AllowResources = new [] { "allowResources" },

        // the properties below are optional
        AllowAndroidApps = new [] { new AndroidAppProperty {
            CertificateFingerprint = "certificateFingerprint",
            Package = "package"
        } },
        AllowAppleApps = new [] { new AppleAppProperty {
            BundleId = "bundleId"
        } },
        AllowReferers = new [] { "allowReferers" }
    },

    // the properties below are optional
    Description = "description",
    ExpireTime = "expireTime",
    ForceDelete = false,
    ForceUpdate = false,
    NoExpiry = false,
    Tags = new [] { new CfnTag {
        Key = "key",
        Value = "value"
    } }
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

cfnAPIKeyProps := &CfnAPIKeyProps{
	KeyName: jsii.String("keyName"),
	Restrictions: &ApiKeyRestrictionsProperty{
		AllowActions: []*string{
			jsii.String("allowActions"),
		},
		AllowResources: []*string{
			jsii.String("allowResources"),
		},

		// the properties below are optional
		AllowAndroidApps: []interface{}{
			&AndroidAppProperty{
				CertificateFingerprint: jsii.String("certificateFingerprint"),
				Package: jsii.String("package"),
			},
		},
		AllowAppleApps: []interface{}{
			&AppleAppProperty{
				BundleId: jsii.String("bundleId"),
			},
		},
		AllowReferers: []*string{
			jsii.String("allowReferers"),
		},
	},

	// the properties below are optional
	Description: jsii.String("description"),
	ExpireTime: jsii.String("expireTime"),
	ForceDelete: jsii.Boolean(false),
	ForceUpdate: jsii.Boolean(false),
	NoExpiry: jsii.Boolean(false),
	Tags: []CfnTag{
		&CfnTag{
			Key: jsii.String("key"),
			Value: jsii.String("value"),
		},
	},
}

Properties ​

descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string #
Updates the description for the API key resource.
expireTimeoptionalstringexpire_timeoptionalstrexpireTimeoptionalStringExpireTimeoptionalstringExpireTimeoptional*string #
The optional timestamp for when the API key resource will expire in ISO 8601 format .
forceDeleteoptionalboolean | IResolvableforce_deleteoptionaltyping.Union[bool, IResolvable]forceDeleteoptionalBooleanForceDeleteoptionalboolForceDeleteoptionalinterface{} #
ForceDelete bypasses 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.

Valid values: true , or false .

This action is irreversible. Only use ForceDelete if you are certain the key is no longer in use.

forceUpdateoptionalboolean | IResolvableforce_updateoptionaltyping.Union[bool, IResolvable]forceUpdateoptionalBooleanForceUpdateoptionalboolForceUpdateoptionalinterface{} #
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.

keyNamestringkey_namestrkeyNameStringKeyNamestringKeyName*string required #
A custom name for the API key resource.

Requirements:

  • Contain only alphanumeric characters (A–Z, a–z, 0–9), hyphens (-), periods (.), and underscores (_).
  • Must be a unique API key name.
  • No spaces allowed. For example, ExampleAPIKey .
noExpiryoptionalboolean | IResolvableno_expiryoptionaltyping.Union[bool, IResolvable]noExpiryoptionalBooleanNoExpiryoptionalboolNoExpiryoptionalinterface{} #
Whether the API key should expire.

Set to true to set the API key to have no expiration time.

restrictionsIResolvable | CfnAPIKey.ApiKeyRestrictionsPropertyrestrictionstyping.Union[IResolvable, ApiKeyRestrictionsProperty]restrictionsIResolvableRestrictionsIResolvableRestrictionsinterface{} required #
The API key restrictions for the API key resource.
tagsoptionalCfnTag[]tagsoptionaltyping.List[CfnTag]tagsoptionalList<CfnTag>TagsoptionalCfnTag[]Tagsoptional*[]CfnTag #
Applies one or more tags to the map resource.

A tag is a key-value pair that helps manage, identify, search, and filter your resources by labelling them.