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

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Oci.LoggingService;
using Oci.Common;
using Oci.Common.Auth;

namespace Oci.Sdk.DotNet.Example.Logging
{
    public class UpdateUnifiedAgentConfigurationExample
    {
        public static async Task Main()
        {
            // Create a request and dependent object(s).
			var updateUnifiedAgentConfigurationDetails = new Oci.LoggingService.Models.UpdateUnifiedAgentConfigurationDetails
			{
				DisplayName = "EXAMPLE-displayName-Value",
				IsEnabled = true,
				DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
				{
					{
						"EXAMPLE_KEY_7CEiF", 
						new Dictionary<string, Object>()
						{
							{
								"EXAMPLE_KEY_BYtQH", 
								"EXAMPLE--Value"
							}
						}
					}
				},
				FreeformTags = new Dictionary<string, string>()
				{
					{
						"EXAMPLE_KEY_TAqOy", 
						"EXAMPLE_VALUE_OXOTRqXPxLOk0dItGosH"
					}
				},
				Description = "EXAMPLE-description-Value",
				ServiceConfiguration = new Oci.LoggingService.Models.UnifiedAgentLoggingConfiguration
				{
					Sources = new List<Oci.LoggingService.Models.UnifiedAgentLoggingSource>
					{
						new Oci.LoggingService.Models.UnifiedAgentWindowsEventSource
						{
							Channels = new List<string>
							{
								"EXAMPLE--Value"
							},
							Name = "EXAMPLE-name-Value"
						}
					},
					Filter = new List<Oci.LoggingService.Models.UnifiedAgentLoggingFilter>
					{
						new Oci.LoggingService.Models.UnifiedAgentLoggingRecordTransformerFilter
						{
							RecordList = new List<Oci.LoggingService.Models.RecordTransformerPair>
							{
								new Oci.LoggingService.Models.RecordTransformerPair
								{
									Key = "EXAMPLE-key-Value",
									Value = "EXAMPLE-value-Value"
								}
							},
							IsRubyEnabled = true,
							IsAutoTypecastEnabled = false,
							IsRenewRecordEnabled = false,
							RenewTimeKey = "EXAMPLE-renewTimeKey-Value",
							KeepKeys = new List<string>
							{
								"EXAMPLE--Value"
							},
							RemoveKeys = new List<string>
							{
								"EXAMPLE--Value"
							},
							Name = "EXAMPLE-name-Value"
						}
					},
					Destination = new Oci.LoggingService.Models.UnifiedAgentLoggingDestination
					{
						LogObjectId = "ocid1.test.oc1..<unique_ID>EXAMPLE-logObjectId-Value",
						OperationalMetricsConfiguration = new Oci.LoggingService.Models.OperationalMetricsConfiguration
						{
							Source = new Oci.LoggingService.Models.OperationalMetricsSource
							{
								Type = Oci.LoggingService.Models.OperationalMetricsSource.TypeEnum.UmaMetrics,
								Metrics = new List<string>
								{
									"EXAMPLE--Value"
								},
								RecordInput = new Oci.LoggingService.Models.OperationalMetricsRecordInput
								{
									Namespace = "EXAMPLE-namespace-Value",
									ResourceGroup = "EXAMPLE-resourceGroup-Value"
								}
							},
							Destination = new Oci.LoggingService.Models.OperationalMetricsDestination
							{
								CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"
							}
						}
					}
				},
				GroupAssociation = new Oci.LoggingService.Models.GroupAssociationDetails
				{
					GroupList = new List<string>
					{
						"EXAMPLE--Value"
					}
				}
			};
			var updateUnifiedAgentConfigurationRequest = new Oci.LoggingService.Requests.UpdateUnifiedAgentConfigurationRequest
			{
				UnifiedAgentConfigurationId = "ocid1.test.oc1..<unique_ID>EXAMPLE-unifiedAgentConfigurationId-Value",
				UpdateUnifiedAgentConfigurationDetails = updateUnifiedAgentConfigurationDetails,
				IfMatch = "EXAMPLE-ifMatch-Value",
				OpcRequestId = "EZA4DSPEPYCTE1ELMOS8<unique_ID>"
			};

            // Create a default authentication provider that uses the DEFAULT
            // profile in the configuration file.
            // Refer to <see href="https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File>the public documentation</see> on how to prepare a configuration file. 
            var provider = new ConfigFileAuthenticationDetailsProvider("DEFAULT");
            try
            {
                // Create a service client and send the request.
				using (var client = new LoggingManagementClient(provider, new ClientConfiguration()))
				{
					var response = await client.UpdateUnifiedAgentConfiguration(updateUnifiedAgentConfigurationRequest);
					// Retrieve value from the response.
					var versionValue = response.httpResponseMessage.Version;
				}
            }
            catch (Exception e)
            {
                Console.WriteLine($"UpdateUnifiedAgentConfiguration Failed with {e.Message}");
                throw e;
            }
        }

    }
}