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

namespace Oci.Sdk.DotNet.Example.Fleetappsmanagement
{
    public class CreateSchedulerDefinitionExample
    {
        public static async Task Main()
        {
            // Create a request and dependent object(s).
			var createSchedulerDefinitionDetails = new Oci.FleetappsmanagementService.Models.CreateSchedulerDefinitionDetails
			{
				DisplayName = "EXAMPLE-displayName-Value",
				Description = "EXAMPLE-description-Value",
				CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
				Schedule = new Oci.FleetappsmanagementService.Models.CustomSchedule
				{
					Recurrences = "EXAMPLE-recurrences-Value",
					Duration = "EXAMPLE-duration-Value",
					ExecutionStartdate = DateTime.Parse("11/23/2032 18:59:45")
				},
				ActionGroups = new List<Oci.FleetappsmanagementService.Models.ActionGroup>
				{
					new Oci.FleetappsmanagementService.Models.FleetBasedActionGroup
					{
						FleetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-fleetId-Value",
						Sequence = 380,
						RunbookId = "ocid1.test.oc1..<unique_ID>EXAMPLE-runbookId-Value",
						RunbookVersionName = "EXAMPLE-runbookVersionName-Value",
						DisplayName = "EXAMPLE-displayName-Value"
					}
				},
				RunBooks = new List<Oci.FleetappsmanagementService.Models.OperationRunbook>
				{
					new Oci.FleetappsmanagementService.Models.OperationRunbook
					{
						RunbookId = "ocid1.test.oc1..<unique_ID>EXAMPLE-runbookId-Value",
						RunbookVersionName = "EXAMPLE-runbookVersionName-Value",
						InputParameters = new List<Oci.FleetappsmanagementService.Models.InputParameter>
						{
							new Oci.FleetappsmanagementService.Models.InputParameter
							{
								StepName = "EXAMPLE-stepName-Value",
								Arguments = new List<Oci.FleetappsmanagementService.Models.TaskArgument>
								{
									new Oci.FleetappsmanagementService.Models.FileTaskArgument
									{
										Content = new Oci.FleetappsmanagementService.Models.InputFileObjectStorageBucketContentDetails
										{
											NamespaceName = "EXAMPLE-namespaceName-Value",
											BucketName = "EXAMPLE-bucketName-Value",
											ObjectName = "EXAMPLE-objectName-Value",
											Checksum = "EXAMPLE-checksum-Value"
										},
										Name = "EXAMPLE-name-Value"
									}
								}
							}
						}
					}
				},
				FreeformTags = new Dictionary<string, string>()
				{
					{
						"EXAMPLE_KEY_jL1Yw", 
						"EXAMPLE_VALUE_H20I0PXJCVLNXb2jPV7a"
					}
				},
				DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
				{
					{
						"EXAMPLE_KEY_L4wZg", 
						new Dictionary<string, Object>()
						{
							{
								"EXAMPLE_KEY_MoPf7", 
								"EXAMPLE--Value"
							}
						}
					}
				}
			};
			var createSchedulerDefinitionRequest = new Oci.FleetappsmanagementService.Requests.CreateSchedulerDefinitionRequest
			{
				CreateSchedulerDefinitionDetails = createSchedulerDefinitionDetails,
				OpcRetryToken = "EXAMPLE-opcRetryToken-Value",
				OpcRequestId = "EHRXPJO1OTOZERYF3GTC<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 FleetAppsManagementOperationsClient(provider, new ClientConfiguration()))
				{
					var response = await client.CreateSchedulerDefinition(createSchedulerDefinitionRequest);
					// Retrieve value from the response.
					var id = response.SchedulerDefinition.Id;
				}
            }
            catch (Exception e)
            {
                Console.WriteLine($"CreateSchedulerDefinition Failed with {e.Message}");
                throw e;
            }
        }

    }
}