# 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 '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
logging_client = OCI::Logging::LoggingManagementClient.new(config: config)

# Send the request to service, some parameters are not required, see API doc for more info
update_unified_agent_configuration_response =
  logging_client.update_unified_agent_configuration(
    'ocid1.test.oc1..<unique_ID>EXAMPLE-unifiedAgentConfigurationId-Value',
    OCI::Logging::Models::UpdateUnifiedAgentConfigurationDetails.new(
      display_name: 'EXAMPLE-displayName-Value',
      is_enabled: true,
      service_configuration:
        OCI::Logging::Models::UnifiedAgentMonitoringConfigurationDetails.new(
          configuration_type: 'MONITORING',
          application_configurations: [
            OCI::Logging::Models::UnifiedAgentUrlConfigurationDetails.new(
              source_type: 'URL',
              source:
                OCI::Logging::Models::UnifiedAgentMonitoringUrlSource.new(
                  name: 'EXAMPLE-name-Value',
                  scrape_targets: [
                    OCI::Logging::Models::UnifiedAgentUrlScrapeTarget.new(
                      url: 'EXAMPLE-url-Value', name: 'EXAMPLE-name-Value'
                    )
                  ]
                ),
              destination:
                OCI::Logging::Models::UnifiedAgentMonitoringDestination.new(
                  compartment_id:
                    'ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value',
                  metrics_namespace: 'EXAMPLE-metricsNamespace-Value'
                ),
              filter:
                OCI::Logging::Models::UnifiedAgentUrlFilter.new(
                  filter_type: 'URL_FILTER',
                  name: 'EXAMPLE-name-Value',
                  allow_list: %w[EXAMPLE--Value],
                  deny_list: %w[EXAMPLE--Value]
                )
            )
          ]
        ),
      defined_tags: {
        'EXAMPLE_KEY_f9oh0' => { 'EXAMPLE_KEY_5ITlT' => 'EXAMPLE--Value' }
      },
      freeform_tags: {
        'EXAMPLE_KEY_el2ip' => 'EXAMPLE_VALUE_OBaWB2lZNpxRMjBCKLxo'
      },
      description: 'EXAMPLE-description-Value',
      group_association:
        OCI::Logging::Models::GroupAssociationDetails.new(
          group_list: %w[EXAMPLE--Value]
        )
    )
  )

# Get the data from response
puts "#{update_unified_agent_configuration_response.headers}"

Was this article helpful?