Creates an access policy for the specified container to restrict the users and clients that can access it. For information about the data that is included in an access policy, see the AWS Identity and Access Management User Guide.
For this release of the REST API, you can create only one policy for a container. If you enter PutContainerPolicy twice, the second command modifies the existing policy.
Parameters:
-
container_name
(ContainerName)
–
The name of the container.
-
policy
(ContainerPolicy)
–
The contents of the policy, which includes the following:
Raises:
Source code in docs_src/capo_mediastore/_services/async_media_store.py
| async def put_container_policy(
self,
container_name: "capo_mediastore.types.container_name.ContainerName",
policy: "capo_mediastore.types.container_policy.ContainerPolicy",
*,
config_overrides: Optional[AsyncMediaStoreClientConfig] = None,
) -> "capo_mediastore.types.put_container_policy_output.PutContainerPolicyOutput":
"""<p>Creates an access policy for the specified container to restrict the users and clients that can access it. For information about the data that is included in an access policy, see the <a href="https://aws.amazon.com/documentation/iam/">AWS Identity and Access Management User Guide</a>.</p> <p>For this release of the REST API, you can create only one policy for a container. If you enter <code>PutContainerPolicy</code> twice, the second command modifies the existing policy. </p>
Args:
container_name: <p>The name of the container.</p>
policy: <p>The contents of the policy, which includes the following: </p> <ul> <li> <p>One <code>Version</code> tag</p> </li> <li> <p>One <code>Statement</code> tag that contains the standard tags for the policy.</p> </li> </ul>
Raises:
capo_mediastore.errors.container_in_use_exception.ContainerInUseException: <p>The container that you specified in the request already exists or is being updated.</p>
capo_mediastore.errors.container_not_found_exception.ContainerNotFoundException: <p>The container that you specified in the request does not exist.</p>
capo_mediastore.errors.internal_server_error.InternalServerError: <p>The service is temporarily unavailable.</p>
capo_mediastore.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_mediastore.types.put_container_policy_input.PutContainerPolicyInput]",
) -> AsyncOperationResponse[
"capo_mediastore.types.put_container_policy_output.PutContainerPolicyOutput"
]:
import capo_mediastore._operations.media_store_20170901.put_container_policy
(
output,
http_response,
) = await capo_mediastore._operations.media_store_20170901.put_container_policy.async_put_container_policy(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("PutContainerPolicy")
)
input_: capo_mediastore.types.put_container_policy_input.PutContainerPolicyInput = {
"container_name": container_name,
"policy": policy,
}
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|