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

namespace Oci.Sdk.DotNet.Example.Monitoring
{
    public class UpdateAlarmExample
    {
        public static async Task Main()
        {
            // Create a request and dependent object(s).
			var updateAlarmDetails = new Oci.MonitoringService.Models.UpdateAlarmDetails
			{
				DisplayName = "EXAMPLE-displayName-Value",
				CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
				MetricCompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-metricCompartmentId-Value",
				MetricCompartmentIdInSubtree = true,
				Namespace = "EXAMPLE-namespace-Value",
				ResourceGroup = "EXAMPLE-resourceGroup-Value",
				Query = "EXAMPLE-query-Value",
				Resolution = "EXAMPLE-resolution-Value",
				PendingDuration = "EXAMPLE-pendingDuration-Value",
				Severity = Oci.MonitoringService.Models.Alarm.SeverityEnum.Error,
				Body = "EXAMPLE-body-Value",
				IsNotificationsPerMetricDimensionEnabled = false,
				MessageFormat = Oci.MonitoringService.Models.UpdateAlarmDetails.MessageFormatEnum.OnsOptimized,
				Destinations = new List<string>
				{
					"EXAMPLE--Value"
				},
				RepeatNotificationDuration = "EXAMPLE-repeatNotificationDuration-Value",
				Suppression = new Oci.MonitoringService.Models.Suppression
				{
					Description = "EXAMPLE-description-Value",
					TimeSuppressFrom = DateTime.Parse("12/12/2022 23:44:10"),
					TimeSuppressUntil = DateTime.Parse("11/14/2022 15:35:23")
				},
				IsEnabled = false,
				FreeformTags = new Dictionary<string, string>()
				{
					{
						"EXAMPLE_KEY_4XH4P", 
						"EXAMPLE_VALUE_ZfsQRB1xHaMFNwDnKXpi"
					}
				},
				DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
				{
					{
						"EXAMPLE_KEY_Iw8QY", 
						new Dictionary<string, Object>()
						{
							{
								"EXAMPLE_KEY_RyxGY", 
								"EXAMPLE--Value"
							}
						}
					}
				},
				Overrides = new List<Oci.MonitoringService.Models.AlarmOverride>
				{
					new Oci.MonitoringService.Models.AlarmOverride
					{
						PendingDuration = "EXAMPLE-pendingDuration-Value",
						Severity = Oci.MonitoringService.Models.Alarm.SeverityEnum.Error,
						Body = "EXAMPLE-body-Value",
						RuleName = "EXAMPLE-ruleName-Value",
						Query = "EXAMPLE-query-Value"
					}
				},
				RuleName = "EXAMPLE-ruleName-Value",
				NotificationVersion = "EXAMPLE-notificationVersion-Value"
			};
			var updateAlarmRequest = new Oci.MonitoringService.Requests.UpdateAlarmRequest
			{
				AlarmId = "ocid1.test.oc1..<unique_ID>EXAMPLE-alarmId-Value",
				UpdateAlarmDetails = updateAlarmDetails,
				IfMatch = "EXAMPLE-ifMatch-Value",
				OpcRequestId = "9Z0RVSYOB9JUZIN0D93X<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 MonitoringClient(provider, new ClientConfiguration()))
				{
					var response = await client.UpdateAlarm(updateAlarmRequest);
					// Retrieve value from the response.
					var id = response.Alarm.Id;
				}
            }
            catch (Exception e)
            {
                Console.WriteLine($"UpdateAlarm Failed with {e.Message}");
                throw e;
            }
        }

    }
}