Writes an object lifecycle policy to a container. If the container already has an object lifecycle policy, the service replaces the existing policy with the new policy. It takes up to 20 minutes for the change to take effect.
For information about how to construct an object lifecycle policy, see Components of an Object Lifecycle Policy.
Parameters:
-
container_name
(ContainerName)
–
The name of the container that you want to assign the object lifecycle policy to.
-
lifecycle_policy
(LifecyclePolicy)
–
The object lifecycle policy to apply to the container.
Raises:
Source code in docs_src/capo_mediastore/_services/async_media_store.py
| async def put_lifecycle_policy(
self,
container_name: "capo_mediastore.types.container_name.ContainerName",
lifecycle_policy: "capo_mediastore.types.lifecycle_policy.LifecyclePolicy",
*,
config_overrides: Optional[AsyncMediaStoreClientConfig] = None,
) -> "capo_mediastore.types.put_lifecycle_policy_output.PutLifecyclePolicyOutput":
"""<p>Writes an object lifecycle policy to a container. If the container already has an object lifecycle policy, the service replaces the existing policy with the new policy. It takes up to 20 minutes for the change to take effect.</p> <p>For information about how to construct an object lifecycle policy, see <a href="https://docs.aws.amazon.com/mediastore/latest/ug/policies-object-lifecycle-components.html">Components of an Object Lifecycle Policy</a>.</p>
Args:
container_name: <p>The name of the container that you want to assign the object lifecycle policy to.</p>
lifecycle_policy: <p>The object lifecycle policy to apply to the container.</p>
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_lifecycle_policy_input.PutLifecyclePolicyInput]",
) -> AsyncOperationResponse[
"capo_mediastore.types.put_lifecycle_policy_output.PutLifecyclePolicyOutput"
]:
import capo_mediastore._operations.media_store_20170901.put_lifecycle_policy
(
output,
http_response,
) = await capo_mediastore._operations.media_store_20170901.put_lifecycle_policy.async_put_lifecycle_policy(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("PutLifecyclePolicy")
)
input_: capo_mediastore.types.put_lifecycle_policy_input.PutLifecyclePolicyInput = {
"container_name": container_name,
"lifecycle_policy": lifecycle_policy,
}
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|