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

namespace Oci.Sdk.DotNet.Example.Cloudguard
{
    public class UpdateDetectorRecipeDetectorRuleExample
    {
        public static async Task Main()
        {
            // Create a request and dependent object(s).
			var updateDetectorRecipeDetectorRuleDetails = new Oci.CloudguardService.Models.UpdateDetectorRecipeDetectorRuleDetails
			{
				Details = new Oci.CloudguardService.Models.UpdateDetectorRuleDetails
				{
					IsEnabled = true,
					RiskLevel = Oci.CloudguardService.Models.RiskLevel.High,
					Configurations = new List<Oci.CloudguardService.Models.DetectorConfiguration>
					{
						new Oci.CloudguardService.Models.DetectorConfiguration
						{
							ConfigKey = "EXAMPLE-configKey-Value",
							Name = "EXAMPLE-name-Value",
							Value = "EXAMPLE-value-Value",
							DataType = "EXAMPLE-dataType-Value",
							Values = new List<Oci.CloudguardService.Models.ConfigValue>
							{
								new Oci.CloudguardService.Models.ConfigValue
								{
									ListType = Oci.CloudguardService.Models.ConfigurationListItemType.Managed,
									ManagedListType = "EXAMPLE-managedListType-Value",
									Value = "EXAMPLE-value-Value"
								}
							},
							AllowedValuesDataType = "EXAMPLE-allowedValuesDataType-Value",
							AllowedValues = new List<Oci.CloudguardService.Models.PropertyTuple>
							{
								new Oci.CloudguardService.Models.PropertyTuple
								{
									Key = "EXAMPLE-key-Value",
									Value = "EXAMPLE-value-Value"
								}
							},
							AdditionalProperties = new List<Oci.CloudguardService.Models.AdditionalConfigPropertyDefinition>
							{
								new Oci.CloudguardService.Models.AdditionalConfigPropertyDefinition
								{
									PropertyType = Oci.CloudguardService.Models.AdditionalConfigPropertyDefinition.PropertyTypeEnum.Hint,
									Key = "EXAMPLE-key-Value",
									Value = "EXAMPLE-value-Value"
								}
							}
						}
					},
					Condition = new Oci.CloudguardService.Models.CompositeCondition
					{
						CompositeOperator = Oci.CloudguardService.Models.CompositeCondition.CompositeOperatorEnum.And,
					},
					Labels = new List<string>
					{
						"EXAMPLE--Value"
					},
					Description = "EXAMPLE-description-Value",
					Recommendation = "EXAMPLE-recommendation-Value",
					DataSourceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-dataSourceId-Value",
					EntitiesMappings = new List<Oci.CloudguardService.Models.EntitiesMapping>
					{
						new Oci.CloudguardService.Models.EntitiesMapping
						{
							DisplayName = "EXAMPLE-displayName-Value",
							QueryField = "EXAMPLE-queryField-Value",
							EntityType = Oci.CloudguardService.Models.EntityType.Text
						}
					}
				}
			};
			var updateDetectorRecipeDetectorRuleRequest = new Oci.CloudguardService.Requests.UpdateDetectorRecipeDetectorRuleRequest
			{
				DetectorRecipeId = "ocid1.test.oc1..<unique_ID>EXAMPLE-detectorRecipeId-Value",
				DetectorRuleId = "ocid1.test.oc1..<unique_ID>EXAMPLE-detectorRuleId-Value",
				UpdateDetectorRecipeDetectorRuleDetails = updateDetectorRecipeDetectorRuleDetails,
				IfMatch = "EXAMPLE-ifMatch-Value",
				OpcRequestId = "IVYT0VETJHBZWRFFAWJ6<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 CloudGuardClient(provider, new ClientConfiguration()))
				{
					var response = await client.UpdateDetectorRecipeDetectorRule(updateDetectorRecipeDetectorRuleRequest);
					// Retrieve value from the response.
					var detectorRuleIdValue = response.DetectorRecipeDetectorRule.DetectorRuleId;
				}
            }
            catch (Exception e)
            {
                Console.WriteLine($"UpdateDetectorRecipeDetectorRule Failed with {e.Message}");
                throw e;
            }
        }

    }
}