Creates an access token for a DNS view. Access tokens provide token-based authentication for DNS-over-HTTPS (DoH) and DNS-over-TLS (DoT) connections to the Route 53 Global Resolver.
Route 53 Global Resolver is a global service that supports resolvers in multiple Amazon Web Services Regions but you must specify the US East (Ohio) Region to create, update, or otherwise work with Route 53 Global Resolver resources. That is, for example, specify --region us-east-2 on Amazon Web Services CLI commands.
Parameters:
-
client_token
(Optional[ClientToken], default:
None
)
–
A unique, case-sensitive identifier to ensure idempotency. This means that making the same request multiple times with the same clientToken has the same result every time.
-
dns_view_id
(ResourceId)
–
The ID of the DNS view to associate with this token.
-
expires_at
(Optional[ISO8601TimeString], default:
None
)
–
The date and time when the token expires. Tokens can have a minimum expiration of 30 days and maximum of 365 days from creation.
-
name
(Optional[ResourceNameShort], default:
None
)
–
A descriptive name for the access token.
-
tags
(Optional[Tags], default:
None
)
–
An array of user-defined keys and optional values. These tags can be used for categorization and organization.
Raises:
-
AccessDeniedException
–
You don't have permission to perform this operation. Check your IAM permissions and try again.
-
ConflictException
–
The request conflicts with the current state of the resource. This can occur when trying to modify a resource that is not in a valid state for the requested operation.
-
InternalServerException
–
An internal server error occurred. Try again later.
-
ResourceNotFoundException
–
The specified resource was not found. Verify the resource ID and try again.
-
ServiceQuotaExceededException
–
The request would exceed one or more service quotas. Check your current usage and quotas, then try again.
-
ThrottlingException
–
The request was throttled due to too many requests. Wait a moment and try again.
-
ValidationException
–
The input parameters are invalid. Check the parameter values and try again.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_route53globalresolver/_services/route53_global_resolver.py
| def create_access_token(
self,
dns_view_id: "capo_route53globalresolver.types.resource_id.ResourceId",
*,
config_overrides: Optional[Route53GlobalResolverClientConfig] = None,
client_token: Optional[
"capo_route53globalresolver.types.client_token.ClientToken"
] = None,
expires_at: Optional[
"capo_route53globalresolver.types.iso8601_time_string.ISO8601TimeString"
] = None,
name: Optional[
"capo_route53globalresolver.types.resource_name_short.ResourceNameShort"
] = None,
tags: Optional["capo_route53globalresolver.types.tags.Tags"] = None,
) -> "capo_route53globalresolver.types.create_access_token_output.CreateAccessTokenOutput":
"""<p>Creates an access token for a DNS view. Access tokens provide token-based authentication for DNS-over-HTTPS (DoH) and DNS-over-TLS (DoT) connections to the Route 53 Global Resolver.</p> <important> <p>Route 53 Global Resolver is a global service that supports resolvers in multiple Amazon Web Services Regions but you must specify the US East (Ohio) Region to create, update, or otherwise work with Route 53 Global Resolver resources. That is, for example, specify <code>--region us-east-2</code> on Amazon Web Services CLI commands.</p> </important>
Args:
client_token: <p>A unique, case-sensitive identifier to ensure idempotency. This means that making the same request multiple times with the same <code>clientToken</code> has the same result every time.</p>
dns_view_id: <p>The ID of the DNS view to associate with this token.</p>
expires_at: <p>The date and time when the token expires. Tokens can have a minimum expiration of 30 days and maximum of 365 days from creation.</p>
name: <p>A descriptive name for the access token.</p>
tags: <p>An array of user-defined keys and optional values. These tags can be used for categorization and organization.</p>
Raises:
capo_route53globalresolver.errors.access_denied_exception.AccessDeniedException: <p>You don't have permission to perform this operation. Check your IAM permissions and try again.</p>
capo_route53globalresolver.errors.conflict_exception.ConflictException: <p>The request conflicts with the current state of the resource. This can occur when trying to modify a resource that is not in a valid state for the requested operation.</p>
capo_route53globalresolver.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Try again later.</p>
capo_route53globalresolver.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource was not found. Verify the resource ID and try again.</p>
capo_route53globalresolver.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request would exceed one or more service quotas. Check your current usage and quotas, then try again.</p>
capo_route53globalresolver.errors.throttling_exception.ThrottlingException: <p>The request was throttled due to too many requests. Wait a moment and try again.</p>
capo_route53globalresolver.errors.validation_exception.ValidationException: <p>The input parameters are invalid. Check the parameter values and try again.</p>
capo_route53globalresolver.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_route53globalresolver.types.create_access_token_input.CreateAccessTokenInput]",
) -> OperationResponse[
"capo_route53globalresolver.types.create_access_token_output.CreateAccessTokenOutput"
]:
import capo_route53globalresolver._operations.ec2_dns_global_resolver_customer_api.create_access_token
output, http_response = (
capo_route53globalresolver._operations.ec2_dns_global_resolver_customer_api.create_access_token.create_access_token(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
def _redact_output(
output: "capo_route53globalresolver.types.create_access_token_output.CreateAccessTokenOutput",
) -> dict[str, Any]:
import capo_route53globalresolver.types.create_access_token_output
return capo_route53globalresolver.types.create_access_token_output.redact_sensitive(
output
)
interceptors_, options_ = self.operation_options(
config_overrides,
OperationLogging("CreateAccessToken", redact_output=_redact_output),
)
input_: capo_route53globalresolver.types.create_access_token_input.CreateAccessTokenInput = {
"dns_view_id": dns_view_id
}
if client_token is None:
client_token = str(uuid.uuid4())
input_["client_token"] = client_token
if expires_at is not None:
input_["expires_at"] = expires_at
if name is not None:
input_["name"] = name
if tags is not None:
input_["tags"] = tags
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|