Creates a new origin access control in CloudFront. After you create an origin access control, you can add it to an origin in a CloudFront distribution so that CloudFront sends authenticated (signed) requests to the origin.
This makes it possible to block public access to the origin, allowing viewers (users) to access the origin's content only through CloudFront.
For more information about using a CloudFront origin access control, see Restricting access to an Amazon Web Services origin in the Amazon CloudFront Developer Guide.
Parameters:
Raises:
Source code in docs_src/capo_cloudfront/_services/async_cloud_front.py
| async def create_origin_access_control(
self,
origin_access_control_config: "capo_cloudfront.types.origin_access_control_config.OriginAccessControlConfig",
*,
config_overrides: Optional[AsyncCloudFrontClientConfig] = None,
) -> "capo_cloudfront.types.create_origin_access_control_result.CreateOriginAccessControlResult":
"""<p>Creates a new origin access control in CloudFront. After you create an origin access control, you can add it to an origin in a CloudFront distribution so that CloudFront sends authenticated (signed) requests to the origin.</p> <p>This makes it possible to block public access to the origin, allowing viewers (users) to access the origin's content only through CloudFront.</p> <p>For more information about using a CloudFront origin access control, see <a href="https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-restricting-access-to-origin.html">Restricting access to an Amazon Web Services origin</a> in the <i>Amazon CloudFront Developer Guide</i>.</p>
Args:
origin_access_control_config: <p>Contains the origin access control.</p>
Raises:
capo_cloudfront.errors.invalid_argument.InvalidArgument: <p>An argument is invalid.</p>
capo_cloudfront.errors.origin_access_control_already_exists.OriginAccessControlAlreadyExists: <p>An origin access control with the specified parameters already exists.</p>
capo_cloudfront.errors.too_many_origin_access_controls.TooManyOriginAccessControls: <p>The number of origin access controls in your Amazon Web Services account exceeds the maximum allowed.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-limits.html">Quotas</a> (formerly known as limits) in the <i>Amazon CloudFront Developer Guide</i>.</p>
capo_cloudfront.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_cloudfront.types.create_origin_access_control_request.CreateOriginAccessControlRequest]",
) -> AsyncOperationResponse[
"capo_cloudfront.types.create_origin_access_control_result.CreateOriginAccessControlResult"
]:
import capo_cloudfront._operations.cloudfront2020_05_31.create_origin_access_control
(
output,
http_response,
) = await capo_cloudfront._operations.cloudfront2020_05_31.create_origin_access_control.async_create_origin_access_control(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("CreateOriginAccessControl")
)
input_: capo_cloudfront.types.create_origin_access_control_request.CreateOriginAccessControlRequest = {
"origin_access_control_config": origin_access_control_config
}
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|