// 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).

package main

import (
	"context"
	"fmt"

	"github.com/oracle/oci-go-sdk/v65/common"
	"github.com/oracle/oci-go-sdk/v65/example/helpers"
	"github.com/oracle/oci-go-sdk/v65/fleetappsmanagement"
)

func ExampleCreateFleet() {
	// 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.
	client, err := fleetappsmanagement.NewFleetAppsManagementClientWithConfigurationProvider(common.DefaultConfigProvider())
	helpers.FatalIfError(err)

	// Create a request and dependent object(s).

	req := fleetappsmanagement.CreateFleetRequest{CreateFleetDetails: fleetappsmanagement.CreateFleetDetails{Resources: []fleetappsmanagement.AssociatedFleetResourceDetails{fleetappsmanagement.AssociatedFleetResourceDetails{TenancyId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-tenancyId-Value"),
		CompartmentId:     common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
		FleetResourceType: common.String("EXAMPLE-fleetResourceType-Value"),
		ResourceId:        common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-resourceId-Value")}},
		DefinedTags: map[string]map[string]interface{}{"EXAMPLE_KEY_XxCAn": map[string]interface{}{"EXAMPLE_KEY_DObQZ": "EXAMPLE--Value"}},
		NotificationPreferences: []fleetappsmanagement.NotificationPreference{fleetappsmanagement.NotificationPreference{CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
			Preferences: &fleetappsmanagement.Preferences{OnTaskSuccess: common.Bool(true),
				OnTopologyModification: common.Bool(false),
				OnJobCanceled:          common.Bool(true),
				OnJobScheduleChange:    common.Bool(true),
				OnTaskPause:            common.Bool(true),
				UpcomingSchedule: &fleetappsmanagement.UpcomingSchedule{OnUpcomingSchedule: common.Bool(true),
					NotifyBefore: common.String("EXAMPLE-notifyBefore-Value")},
				OnJobFailure:            common.Bool(false),
				OnJobStart:              common.Bool(true),
				OnJobSuccess:            common.Bool(false),
				OnResourceNonCompliance: common.Bool(false),
				OnRunbookNewerVersion:   common.Bool(true),
				OnTaskFailure:           common.Bool(false)},
			TopicId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-topicId-Value")}},
		Details:  fleetappsmanagement.GroupFleetDetails{},
		Products: []string{"EXAMPLE--Value"},
		Properties: []fleetappsmanagement.AssociatedFleetPropertyDetails{fleetappsmanagement.AssociatedFleetPropertyDetails{IsRequired: common.Bool(false),
			Value:             common.String("EXAMPLE-value-Value"),
			CompartmentId:     common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
			DisplayName:       common.String("EXAMPLE-displayName-Value"),
			FleetPropertyType: fleetappsmanagement.AssociatedFleetPropertyDetailsFleetPropertyTypeString}},
		CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
		Credentials: []fleetappsmanagement.AssociatedFleetCredentialDetails{fleetappsmanagement.AssociatedFleetCredentialDetails{CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
			DisplayName: common.String("EXAMPLE-displayName-Value"),
			EntitySpecifics: fleetappsmanagement.TargetCredentialEntitySpecificDetails{Target: common.String("EXAMPLE-target-Value"),
				ResourceId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-resourceId-Value")},
			User: fleetappsmanagement.VaultSecretCredentialDetails{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value"),
				SecretVersion: common.String("EXAMPLE-secretVersion-Value")}}},
		Description:         common.String("EXAMPLE-description-Value"),
		EnvironmentType:     common.String("EXAMPLE-environmentType-Value"),
		FreeformTags:        map[string]string{"EXAMPLE_KEY_in6bs": "EXAMPLE_VALUE_tL7jIaJvUhqwCpaPDRKh"},
		DisplayName:         common.String("EXAMPLE-displayName-Value"),
		IsTargetAutoConfirm: common.Bool(true),
		ParentFleetId:       common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-parentFleetId-Value"),
		ResourceSelection:   fleetappsmanagement.ManualResourceSelection{}},
		OpcRequestId:  common.String("G6HGVAU2HYM5U2IIDNIL<unique_ID>"),
		OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value")}

	// Send the request using the service client
	resp, err := client.CreateFleet(context.Background(), req)
	helpers.FatalIfError(err)

	// Retrieve value from the response.
	fmt.Println(resp)
}