create_workload_identity_template
async
¶
create_workload_identity_template(
*,
config_overrides: Optional[AsyncIAMClientConfig] = None,
name: Optional[WorkloadIdentityTemplateNameType] = None,
description: Optional[WorkloadIdentityDescriptionType] = None,
resource_scope: Optional[WorkloadIdentityResourceScopeType] = None,
workload_identity_provider_arn: Optional[arnType] = None,
path_prefix: Optional[WorkloadIdentityPathPrefixType] = None,
path_pattern: Optional[WorkloadIdentityTemplatePathPatternType] = None,
attestation_policy: Optional[policyDocumentType] = None,
tags: Optional[tagListType] = None,
template_definition: Optional[WorkloadIdentityTemplateDefinitionType] = None,
) -> CreateWorkloadIdentityTemplateResponse
Creates a workload identity template under a workload identity provider.
The operation accepts two mutually exclusive modes, and the member you supply decides which one you are in. TemplateDefinition puts the request in template definition mode, and PathPattern puts it in direct authoring mode.
Use template definition mode when a service-owned definition already covers the workload you are onboarding. IAM then renders the pattern and the attestation policy for you, so there is less to get wrong. Use direct authoring mode when no definition covers your case, or when you need a pattern or an attestation policy that the available definitions do not offer.
-
Template definition mode – You name a service-owned definition through
TemplateDefinitionand supply only the values that definition leaves open. WorkloadIdentityTemplateDefinitionType carries which values a given definition leaves open and the name it gives each one. IAM rendersPathPatternandAttestationPolicyfrom the definition, so you author neither. In this mode,Tagsis the only other request parameter you can supply. -
Direct authoring mode – You must supply
Name,WorkloadIdentityProviderArnandPathPatternyourself, and you can supplyDescription,PathPrefix,AttestationPolicyandTags.
Because the two modes make different members mandatory, no member of this request is unconditionally required, and every parameter below therefore reads Required: No. The per-mode rules are what govern. TemplateDefinition is required in template definition mode and forbidden in direct authoring mode. Name, WorkloadIdentityProviderArn and PathPattern are required in direct authoring mode and forbidden in template definition mode, where IAM renders all three from the definition.
AttestationPolicy is optional on this operation. A policy supplied here is equivalent to one supplied later by PutWorkloadIdentityTemplateAttestationPolicy, and a template created without one admits nothing until a policy is set.
Parameters:
-
name(Optional[WorkloadIdentityTemplateNameType], default:None) –The name of the template. It is the leaf of the template's own resource ARN and it does not appear in any rendered identifier.
Required in direct authoring mode, and forbidden in template definition mode.
-
description(Optional[WorkloadIdentityDescriptionType], default:None) –A description of the template. If you omit it, the template carries no description and responses omit the
Descriptionelement.Forbidden in template definition mode.
-
resource_scope(Optional[WorkloadIdentityResourceScopeType], default:None) –The scope the template is created at. An
ORGANIZATION-scoped template belongs to your organization. If you do not include this parameter, it defaults toACCOUNT.An
ORGANIZATION-scoped template must reference an organization-scoped provider. AnACCOUNT-scoped template can reference an account-scoped provider in your account or an organization-scoped provider in your organization.Forbidden in template definition mode.
-
workload_identity_provider_arn(Optional[arnType], default:None) –The Amazon Resource Name (ARN) of the workload identity provider to create the template under.
Required in direct authoring mode, and forbidden in template definition mode, where the service renders it from the definition.
-
path_prefix(Optional[WorkloadIdentityPathPrefixType], default:None) –The namespace between the provider's naming root and the rendered pattern. Segments only, with no leading slash, no trailing slash and no empty segment.
Forbidden in template definition mode.
-
path_pattern(Optional[WorkloadIdentityTemplatePathPatternType], default:None) –The pattern that workload identifiers are rendered from. For the pattern grammar, and for the checks the regular expression cannot express, see WorkloadIdentityTemplatePathPatternType.
Required in direct authoring mode, and forbidden in template definition mode, where the service renders it from the definition.
-
attestation_policy(Optional[policyDocumentType], default:None) –The attestation policy that decides which workloads can be attested through the template. A policy supplied here is equivalent to one supplied later by PutWorkloadIdentityTemplateAttestationPolicy.
Forbidden in template definition mode, where the service renders the policy from the definition.
-
tags(Optional[tagListType], default:None) –A list of tags that you want to attach to the new template. Each tag consists of a key name and an associated value. Tag keys are case sensitive, and two tag keys that differ only in case are rejected with
InvalidInputException. For more information about tagging, see Tagging IAM resources in the IAM User Guide.Tagsis accepted in both modes. A template definition never carries tags of its own.If any one of the tags is invalid or if you exceed the allowed maximum number of tags, then the entire request fails and the resource is not created.
-
template_definition(Optional[WorkloadIdentityTemplateDefinitionType], default:None) –The service-owned definition to render the template from, carrying only the values that definition leaves open. For the values a definition leaves open and the name of each, see WorkloadIdentityTemplateDefinitionType.
Supplying this parameter selects template definition mode. It is forbidden in direct authoring mode.
Raises:
-
ConcurrentModificationException–The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.
-
EntityAlreadyExistsException–The request was rejected because it attempted to create a resource that already exists.
-
InvalidInputException–The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
-
LimitExceededException–The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
-
MalformedPolicyDocumentException–The request was rejected because the policy document was malformed. The error message describes the specific error.
-
NoSuchEntityException–The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
-
ServiceFailureException–The request processing has failed because of an unknown error, exception or failure.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_iam/_services/async_iam.py
2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 | |