# This is an automatically generated code sample.
# To make this code sample work in your Oracle Cloud tenancy,
# please replace the values for any parameters whose current values do not fit
# your use case (such as resource IDs, strings containing ‘EXAMPLE’ or ‘unique_id’, and
# boolean, number, and enum parameters with values not fitting your use case).
import oci
# Create a default config using DEFAULT profile in default location
# Refer to
# https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File
# for more info
config = oci.config.from_file()
# Initialize service client with default config file
object_storage_client = oci.object_storage.ObjectStorageClient(config)
# Send the request to service, some parameters are not required, see API
# doc for more info
put_object_lifecycle_policy_response = object_storage_client.put_object_lifecycle_policy(
namespace_name="EXAMPLE-namespaceName-Value",
bucket_name="EXAMPLE-bucketName-Value",
put_object_lifecycle_policy_details=oci.object_storage.models.PutObjectLifecyclePolicyDetails(
items=[
oci.object_storage.models.ObjectLifecycleRule(
name="EXAMPLE-name-Value",
action="EXAMPLE-action-Value",
time_amount=991,
time_unit="DAYS",
is_enabled=True,
target="EXAMPLE-target-Value",
object_name_filter=oci.object_storage.models.ObjectNameFilter(
inclusion_prefixes=["EXAMPLE--Value"],
inclusion_patterns=["EXAMPLE--Value"],
exclusion_patterns=["EXAMPLE--Value"]))]),
opc_client_request_id="ocid1.test.oc1..<unique_ID>EXAMPLE-opcClientRequestId-Value",
if_match="EXAMPLE-ifMatch-Value",
if_none_match="9")
# Get the data from response
print(put_object_lifecycle_policy_response.data)