# 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).

require 'date'
require '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::ConfigFileLoader.load_config

# Initialize service client with default config file
vault_client = OCI::Vault::VaultsClient.new(config: config)

# Send the request to service, some parameters are not required, see API doc for more info
update_secret_response =
  vault_client.update_secret(
    'ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value',
    OCI::Vault::Models::UpdateSecretDetails.new(
      current_version_number: 357,
      defined_tags: {
        'EXAMPLE_KEY_79RRV' => { 'EXAMPLE_KEY_DwT5d' => 'EXAMPLE--Value' }
      },
      description: 'EXAMPLE-description-Value',
      freeform_tags: {
        'EXAMPLE_KEY_0MFS8' => 'EXAMPLE_VALUE_JrU7Ui6OouQL6JkUyylv'
      },
      metadata: { 'EXAMPLE_KEY_8wOtG' => 'EXAMPLE--Value' },
      secret_content:
        OCI::Vault::Models::Base64SecretContentDetails.new(
          content_type: 'BASE64',
          name: 'EXAMPLE-name-Value',
          stage: 'PENDING',
          content: 'EXAMPLE-content-Value'
        ),
      replication_config:
        OCI::Vault::Models::ReplicationConfig.new(
          replication_targets: [
            OCI::Vault::Models::ReplicationTarget.new(
              target_key_id:
                'ocid1.test.oc1..<unique_ID>EXAMPLE-targetKeyId-Value',
              target_region: 'EXAMPLE-targetRegion-Value',
              target_vault_id:
                'ocid1.test.oc1..<unique_ID>EXAMPLE-targetVaultId-Value'
            )
          ],
          is_write_forward_enabled: true
        ),
      rotation_config:
        OCI::Vault::Models::RotationConfig.new(
          target_system_details:
            OCI::Vault::Models::AdbTargetSystemDetails.new(
              target_system_type: 'ADB',
              adb_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-adbId-Value'
            ),
          rotation_interval: 'EXAMPLE-rotationInterval-Value',
          is_scheduled_rotation_enabled: true
        ),
      secret_rules: [
        OCI::Vault::Models::SecretExpiryRule.new(
          rule_type: 'SECRET_EXPIRY_RULE',
          secret_version_expiry_interval:
            'EXAMPLE-secretVersionExpiryInterval-Value',
          time_of_absolute_expiry: DateTime.parse('2000-12-25T00:03:21.986Z'),
          is_secret_content_retrieval_blocked_on_expiry: true
        )
      ],
      secret_generation_context:
        OCI::Vault::Models::BytesGenerationContext.new(
          generation_type: 'BYTES',
          generation_template: 'BYTES_1024',
          secret_template: 'EXAMPLE-secretTemplate-Value'
        ),
      enable_auto_generation: true
    )
  )

# Get the data from response
puts "#{update_secret_response.data}"