// 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 CreateFleetExample
    {
        public static async Task Main()
        {
            // Create a request and dependent object(s).
			var createFleetDetails = new Oci.FleetappsmanagementService.Models.CreateFleetDetails
			{
				DisplayName = "EXAMPLE-displayName-Value",
				Description = "EXAMPLE-description-Value",
				CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
				Details = new Oci.FleetappsmanagementService.Models.GroupFleetDetails
				{
				},
				Products = new List<string>
				{
					"EXAMPLE--Value"
				},
				EnvironmentType = "EXAMPLE-environmentType-Value",
				ResourceSelection = new Oci.FleetappsmanagementService.Models.ManualResourceSelection
				{
				},
				NotificationPreferences = new List<Oci.FleetappsmanagementService.Models.NotificationPreference>
				{
					new Oci.FleetappsmanagementService.Models.NotificationPreference
					{
						TopicId = "ocid1.test.oc1..<unique_ID>EXAMPLE-topicId-Value",
						CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
						Preferences = new Oci.FleetappsmanagementService.Models.Preferences
						{
							UpcomingSchedule = new Oci.FleetappsmanagementService.Models.UpcomingSchedule
							{
								OnUpcomingSchedule = false,
								NotifyBefore = "EXAMPLE-notifyBefore-Value"
							},
							OnJobFailure = false,
							OnTopologyModification = true,
							OnTaskPause = true,
							OnTaskFailure = false,
							OnTaskSuccess = true,
							OnResourceNonCompliance = true,
							OnRunbookNewerVersion = true,
							OnJobSuccess = true,
							OnJobStart = false,
							OnJobCanceled = true,
							OnJobScheduleChange = true
						}
					}
				},
				Resources = new List<Oci.FleetappsmanagementService.Models.AssociatedFleetResourceDetails>
				{
					new Oci.FleetappsmanagementService.Models.AssociatedFleetResourceDetails
					{
						ResourceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-resourceId-Value",
						FleetResourceType = "EXAMPLE-fleetResourceType-Value",
						CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
						TenancyId = "ocid1.test.oc1..<unique_ID>EXAMPLE-tenancyId-Value"
					}
				},
				Credentials = new List<Oci.FleetappsmanagementService.Models.AssociatedFleetCredentialDetails>
				{
					new Oci.FleetappsmanagementService.Models.AssociatedFleetCredentialDetails
					{
						DisplayName = "EXAMPLE-displayName-Value",
						CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
						EntitySpecifics = new Oci.FleetappsmanagementService.Models.FleetCredentialEntitySpecificDetails
						{
							Variables = new List<Oci.FleetappsmanagementService.Models.Variable>
							{
								new Oci.FleetappsmanagementService.Models.Variable
								{
									Name = "EXAMPLE-name-Value",
									Value = "EXAMPLE-value-Value"
								}
							}
						},
						User = new Oci.FleetappsmanagementService.Models.VaultSecretCredentialDetails
						{
							SecretId = "ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value",
							SecretVersion = "EXAMPLE-secretVersion-Value"
						},
					}
				},
				Properties = new List<Oci.FleetappsmanagementService.Models.AssociatedFleetPropertyDetails>
				{
					new Oci.FleetappsmanagementService.Models.AssociatedFleetPropertyDetails
					{
						CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
						DisplayName = "EXAMPLE-displayName-Value",
						FleetPropertyType = Oci.FleetappsmanagementService.Models.AssociatedFleetPropertyDetails.FleetPropertyTypeEnum.String,
						Value = "EXAMPLE-value-Value",
						IsRequired = true
					}
				},
				ParentFleetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-parentFleetId-Value",
				IsTargetAutoConfirm = true,
				FreeformTags = new Dictionary<string, string>()
				{
					{
						"EXAMPLE_KEY_oxTF5", 
						"EXAMPLE_VALUE_OjkWljO5XfUnKX31rDP1"
					}
				},
				DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
				{
					{
						"EXAMPLE_KEY_kjV63", 
						new Dictionary<string, Object>()
						{
							{
								"EXAMPLE_KEY_6fAMh", 
								"EXAMPLE--Value"
							}
						}
					}
				}
			};
			var createFleetRequest = new Oci.FleetappsmanagementService.Requests.CreateFleetRequest
			{
				CreateFleetDetails = createFleetDetails,
				OpcRetryToken = "EXAMPLE-opcRetryToken-Value",
				OpcRequestId = "HAGCZID8ETSVO9H4I1CX<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 FleetAppsManagementClient(provider, new ClientConfiguration()))
				{
					var response = await client.CreateFleet(createFleetRequest);
					// Retrieve value from the response.
					var id = response.Fleet.Id;
				}
            }
            catch (Exception e)
            {
                Console.WriteLine($"CreateFleet Failed with {e.Message}");
                throw e;
            }
        }

    }
}