# 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
vault_client = oci.vault.VaultsClient(config)
# Send the request to service, some parameters are not required, see API
# doc for more info
create_secret_response = vault_client.create_secret(
create_secret_details=oci.vault.models.CreateSecretDetails(
compartment_id="ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
key_id="ocid1.test.oc1..<unique_ID>EXAMPLE-keyId-Value",
secret_name="EXAMPLE-secretName-Value",
vault_id="ocid1.test.oc1..<unique_ID>EXAMPLE-vaultId-Value",
defined_tags={
'EXAMPLE_KEY_RF8Hg': {
'EXAMPLE_KEY_JdBRS': 'EXAMPLE--Value'}},
description="EXAMPLE-description-Value",
freeform_tags={
'EXAMPLE_KEY_hV5k5': 'EXAMPLE_VALUE_87xzdqdG4PZyD9xVIe3G'},
metadata={
'EXAMPLE_KEY_4mm1j': '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.AdbTargetSystemDetails(
target_system_type="ADB",
adb_id="ocid1.test.oc1..<unique_ID>EXAMPLE-adbId-Value"),
rotation_interval="EXAMPLE-rotationInterval-Value",
is_scheduled_rotation_enabled=False),
secret_rules=[
oci.vault.models.SecretReuseRule(
rule_type="SECRET_REUSE_RULE",
is_enforced_on_deleted_secret_versions=False)],
secret_generation_context=oci.vault.models.BytesGenerationContext(
generation_type="BYTES",
generation_template="BYTES_512",
secret_template="EXAMPLE-secretTemplate-Value"),
enable_auto_generation=True),
opc_request_id="ETQD0GHJ9GDLGJFDRFQ6<unique_ID>",
opc_retry_token="EXAMPLE-opcRetryToken-Value")
# Get the data from response
print(create_secret_response.data)