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

namespace Oci.Sdk.DotNet.Example.Fleetsoftwareupdate
{
    public class CreateFsuCycleExample
    {
        public static async Task Main()
        {
            // Create a request and dependent object(s).
			var createFsuCycleDetails = new Oci.FleetsoftwareupdateService.Models.CreateUpgradeFsuCycle
			{
				UpgradeDetails = new Oci.FleetsoftwareupdateService.Models.UpgradeDbCollectionDetails
				{
					IsTimeZoneUpgrade = true,
					IsRecompileInvalidObjects = false,
					MaxDrainTimeoutInSeconds = 581
				},
				DisplayName = "EXAMPLE-displayName-Value",
				CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
				FsuCollectionId = "ocid1.test.oc1..<unique_ID>EXAMPLE-fsuCollectionId-Value",
				GoalVersionDetails = new Oci.FleetsoftwareupdateService.Models.ExadbStackFsuGoalVersionDetails
				{
					Components = new List<Oci.FleetsoftwareupdateService.Models.GoalSoftwareComponentDetails>
					{
						new Oci.FleetsoftwareupdateService.Models.GiGoalSoftwareComponentDetails
						{
							GoalVersionDetails = new Oci.FleetsoftwareupdateService.Models.CustomGiGoalVersionDetails
							{
								GoalSoftwareImageId = "ocid1.test.oc1..<unique_ID>EXAMPLE-goalSoftwareImageId-Value"
							},
							HomePolicy = Oci.FleetsoftwareupdateService.Models.GiGoalSoftwareComponentDetails.HomePolicyEnum.CreateNew,
							NewHomePrefix = "EXAMPLE-newHomePrefix-Value"
						}
					},
					HomePolicy = Oci.FleetsoftwareupdateService.Models.FsuGoalVersionDetails.HomePolicyEnum.UseExisting,
					NewHomePrefix = "EXAMPLE-newHomePrefix-Value"
				},
				BatchingStrategy = new Oci.FleetsoftwareupdateService.Models.CreateServiceAvailabilityFactorBatchingStrategyDetails
				{
					Percentage = 27,
					IsForceRolling = false
				},
				StageActionSchedule = new Oci.FleetsoftwareupdateService.Models.CreateStartTimeScheduleDetails
				{
					TimeToStart = DateTime.Parse("04/22/2043 02:51:55")
				},
				ApplyActionSchedule = new Oci.FleetsoftwareupdateService.Models.CreateStartTimeScheduleDetails
				{
					TimeToStart = DateTime.Parse("02/13/2008 18:41:02")
				},
				DiagnosticsCollection = new Oci.FleetsoftwareupdateService.Models.DiagnosticsCollectionDetails
				{
					LogCollectionMode = Oci.FleetsoftwareupdateService.Models.DataCollectionModes.NoChange
				},
				FreeformTags = new Dictionary<string, string>()
				{
					{
						"EXAMPLE_KEY_8ha9S", 
						"EXAMPLE_VALUE_FmDNubj9zoZ9SVnTHtt3"
					}
				},
				DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
				{
					{
						"EXAMPLE_KEY_8lSQc", 
						new Dictionary<string, Object>()
						{
							{
								"EXAMPLE_KEY_Q6f59", 
								"EXAMPLE--Value"
							}
						}
					}
				}
			};
			var createFsuCycleRequest = new Oci.FleetsoftwareupdateService.Requests.CreateFsuCycleRequest
			{
				CreateFsuCycleDetails = createFsuCycleDetails,
				OpcRetryToken = "EXAMPLE-opcRetryToken-Value",
				OpcRequestId = "6Z99KLW5MNIPVJQQM7TN<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 FleetSoftwareUpdateClient(provider, new ClientConfiguration()))
				{
					var response = await client.CreateFsuCycle(createFsuCycleRequest);
					// Retrieve value from the response.
					var id = response.FsuCycle.Id;
				}
            }
            catch (Exception e)
            {
                Console.WriteLine($"CreateFsuCycle Failed with {e.Message}");
                throw e;
            }
        }

    }
}