create_key
async
¶
create_key(
key_name: ResourceName,
restrictions: ApiKeyRestrictions,
*,
config_overrides: Optional[AsyncLocationClientConfig] = None,
description: Optional[ResourceDescription] = None,
expire_time: Optional[Timestamp] = None,
no_expiry: Optional[bool] = None,
tags: Optional[TagMap] = None,
) -> CreateKeyResponse
Creates an API key resource in your Amazon Web Services account, which lets you grant actions for Amazon Location resources to the API key bearer.
For more information, see Use API keys to authenticate in the Amazon Location Service Developer Guide.
Parameters:
-
key_name(ResourceName) –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.
-
-
restrictions(ApiKeyRestrictions) –The API key restrictions for the API key resource.
-
description(Optional[ResourceDescription], default:None) –An optional description for the API key resource.
-
expire_time(Optional[Timestamp], default:None) –The optional timestamp for when the API key resource will expire in ISO 8601 format:
YYYY-MM-DDThh:mm:ss.sssZ. One ofNoExpiryorExpireTimemust be set. -
no_expiry(Optional[bool], default:None) –Optionally set to
trueto set no expiration time for the API key. One ofNoExpiryorExpireTimemust be set. -
tags(Optional[TagMap], default:None) –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.
Format:
"key" : "value"Restrictions:
-
Maximum 50 tags per resource
-
Each resource tag must be unique with a maximum of one value.
-
Maximum key length: 128 Unicode characters in UTF-8
-
Maximum value length: 256 Unicode characters in UTF-8
-
Can use alphanumeric characters (A–Z, a–z, 0–9), and the following characters: + - = . _ : / @.
-
Cannot use "aws:" as a prefix for a key.
-
Raises:
-
AccessDeniedException–The request was denied because of insufficient access or permissions. Check with an administrator to verify your permissions.
-
ConflictException–The request was unsuccessful because of a conflict.
-
InternalServerException–The request has failed to process because of an unknown server error, exception, or failure.
-
ServiceQuotaExceededException–The operation was denied because the request would exceed the maximum quota set for Amazon Location Service.
-
ThrottlingException–The request was denied because of request throttling.
-
ValidationException–The input failed to meet the constraints specified by the AWS service.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_location/_services/async_location.py
367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 | |