// 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.StackmonitoringService;
using Oci.Common;
using Oci.Common.Auth;

namespace Oci.Sdk.DotNet.Example.Stackmonitoring
{
    public class CreateConfigExample
    {
        public static async Task Main()
        {
            // Create a request and dependent object(s).
			var createConfigDetails = new Oci.StackmonitoringService.Models.CreateOnboardConfigDetails
			{
				Version = "EXAMPLE-version-Value",
				IsManuallyOnboarded = false,
				PolicyNames = new List<string>
				{
					"EXAMPLE--Value"
				},
				DynamicGroups = new List<Oci.StackmonitoringService.Models.DynamicGroupDetails>
				{
					new Oci.StackmonitoringService.Models.DynamicGroupDetails
					{
						Name = "EXAMPLE-name-Value",
						Domain = "EXAMPLE-domain-Value",
						StackMonitoringAssignment = Oci.StackmonitoringService.Models.DynamicGroupDetails.StackMonitoringAssignmentEnum.ManagementAgents
					}
				},
				UserGroups = new List<Oci.StackmonitoringService.Models.GroupDetails>
				{
					new Oci.StackmonitoringService.Models.GroupDetails
					{
						Name = "EXAMPLE-name-Value",
						Domain = "EXAMPLE-domain-Value",
						StackMonitoringRole = "EXAMPLE-stackMonitoringRole-Value"
					}
				},
				AdditionalConfigurations = new Oci.StackmonitoringService.Models.AdditionalConfigurationDetails
				{
					PropertiesMap = new Dictionary<string, string>()
					{
						{
							"EXAMPLE_KEY_LQz6Z", 
							"EXAMPLE_VALUE_0QVcdpf0oYZIJg2oZzdK"
						}
					}
				},
				DisplayName = "EXAMPLE-displayName-Value",
				CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
				FreeformTags = new Dictionary<string, string>()
				{
					{
						"EXAMPLE_KEY_VO7QS", 
						"EXAMPLE_VALUE_Od6FTagb13tgtZoWlny8"
					}
				},
				DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
				{
					{
						"EXAMPLE_KEY_8ryeT", 
						new Dictionary<string, Object>()
						{
							{
								"EXAMPLE_KEY_2aYaf", 
								"EXAMPLE--Value"
							}
						}
					}
				}
			};
			var createConfigRequest = new Oci.StackmonitoringService.Requests.CreateConfigRequest
			{
				CreateConfigDetails = createConfigDetails,
				OpcRetryToken = "EXAMPLE-opcRetryToken-Value",
				OpcRequestId = "Q0T4JNVZF2XC48OYCQL9<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 StackMonitoringClient(provider, new ClientConfiguration()))
				{
					var response = await client.CreateConfig(createConfigRequest);
					// Retrieve value from the response.
					var id = response.Config.Id;
				}
            }
            catch (Exception e)
            {
                Console.WriteLine($"CreateConfig Failed with {e.Message}");
                throw e;
            }
        }

    }
}