# 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
from datetime import datetime
# 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
vault_client = oci.vault.VaultsClient(config)
# Send the request to service, some parameters are not required, see API
# doc for more info
update_secret_response = vault_client.update_secret(
secret_id="ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value",
update_secret_details=oci.vault.models.UpdateSecretDetails(
current_version_number=787,
defined_tags={
'EXAMPLE_KEY_bysp1': {
'EXAMPLE_KEY_5nw10': 'EXAMPLE--Value'}},
description="EXAMPLE-description-Value",
freeform_tags={
'EXAMPLE_KEY_SSFLn': 'EXAMPLE_VALUE_4uqE15E5MSkP7f4azdFw'},
metadata={
'EXAMPLE_KEY_d00kv': 'EXAMPLE--Value'},
secret_content=oci.vault.models.Base64SecretContentDetails(
content_type="BASE64",
name="EXAMPLE-name-Value",
stage="CURRENT",
content="EXAMPLE-content-Value"),
rotation_config=oci.vault.models.RotationConfig(
target_system_details=oci.vault.models.FunctionTargetSystemDetails(
target_system_type="FUNCTION",
function_id="ocid1.test.oc1..<unique_ID>EXAMPLE-functionId-Value"),
rotation_interval="EXAMPLE-rotationInterval-Value",
is_scheduled_rotation_enabled=True),
secret_rules=[
oci.vault.models.SecretExpiryRule(
rule_type="SECRET_EXPIRY_RULE",
secret_version_expiry_interval="EXAMPLE-secretVersionExpiryInterval-Value",
time_of_absolute_expiry=datetime.strptime(
"2000-12-23T03:11:48.212Z",
"%Y-%m-%dT%H:%M:%S.%fZ"),
is_secret_content_retrieval_blocked_on_expiry=False)],
secret_generation_context=oci.vault.models.SshKeyGenerationContext(
generation_type="SSH_KEY",
generation_template="RSA_3072",
secret_template="EXAMPLE-secretTemplate-Value"),
enable_auto_generation=True),
if_match="EXAMPLE-ifMatch-Value",
opc_request_id="07HUPRZNWAOLTCLH4ADK<unique_ID>")
# Get the data from response
print(update_secret_response.data)