Creates a new origin access identity. If you're using Amazon S3 for your origin, you can use an origin access identity to require users to access your content using a CloudFront URL instead of the Amazon S3 URL. For more information about how to use origin access identities, see Serving Private Content through CloudFront in the Amazon CloudFront Developer Guide.
Parameters:
Raises:
-
CloudFrontOriginAccessIdentityAlreadyExists
–
If the CallerReference is a value you already sent in a previous request to create an identity but the content of the CloudFrontOriginAccessIdentityConfig is different from the original request, CloudFront returns a CloudFrontOriginAccessIdentityAlreadyExists error.
-
InconsistentQuantities
–
The value of Quantity and the size of Items don't match.
-
InvalidArgument
–
-
MissingBody
–
This operation requires a body. Ensure that the body is present and the Content-Type header is set.
-
TooManyCloudFrontOriginAccessIdentities
–
Processing your request would cause you to exceed the maximum number of origin access identities allowed.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_cloudfront/_services/cloud_front.py
| def create_cloud_front_origin_access_identity(
self,
cloud_front_origin_access_identity_config: "capo_cloudfront.types.cloud_front_origin_access_identity_config.CloudFrontOriginAccessIdentityConfig",
*,
config_overrides: Optional[CloudFrontClientConfig] = None,
) -> "capo_cloudfront.types.create_cloud_front_origin_access_identity_result.CreateCloudFrontOriginAccessIdentityResult":
"""<p>Creates a new origin access identity. If you're using Amazon S3 for your origin, you can use an origin access identity to require users to access your content using a CloudFront URL instead of the Amazon S3 URL. For more information about how to use origin access identities, see <a href="https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html">Serving Private Content through CloudFront</a> in the <i>Amazon CloudFront Developer Guide</i>.</p>
Args:
cloud_front_origin_access_identity_config: <p>The current configuration information for the identity.</p>
Raises:
capo_cloudfront.errors.cloud_front_origin_access_identity_already_exists.CloudFrontOriginAccessIdentityAlreadyExists: <p>If the <code>CallerReference</code> is a value you already sent in a previous request to create an identity but the content of the <code>CloudFrontOriginAccessIdentityConfig</code> is different from the original request, CloudFront returns a <code>CloudFrontOriginAccessIdentityAlreadyExists</code> error. </p>
capo_cloudfront.errors.inconsistent_quantities.InconsistentQuantities: <p>The value of <code>Quantity</code> and the size of <code>Items</code> don't match.</p>
capo_cloudfront.errors.invalid_argument.InvalidArgument: <p>An argument is invalid.</p>
capo_cloudfront.errors.missing_body.MissingBody: <p>This operation requires a body. Ensure that the body is present and the <code>Content-Type</code> header is set.</p>
capo_cloudfront.errors.too_many_cloud_front_origin_access_identities.TooManyCloudFrontOriginAccessIdentities: <p>Processing your request would cause you to exceed the maximum number of origin access identities allowed.</p>
capo_cloudfront.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_cloudfront.types.create_cloud_front_origin_access_identity_request.CreateCloudFrontOriginAccessIdentityRequest]",
) -> OperationResponse[
"capo_cloudfront.types.create_cloud_front_origin_access_identity_result.CreateCloudFrontOriginAccessIdentityResult"
]:
import capo_cloudfront._operations.cloudfront2020_05_31.create_cloud_front_origin_access_identity
output, http_response = (
capo_cloudfront._operations.cloudfront2020_05_31.create_cloud_front_origin_access_identity.create_cloud_front_origin_access_identity(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("CreateCloudFrontOriginAccessIdentity")
)
input_: capo_cloudfront.types.create_cloud_front_origin_access_identity_request.CreateCloudFrontOriginAccessIdentityRequest = {
"cloud_front_origin_access_identity_config": cloud_front_origin_access_identity_config
}
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|