// 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{OpcRequestId: common.String("MHTYKGQQI3JU0UUZSBOR<unique_ID>"),
		OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value"),
		CreateFleetDetails: fleetappsmanagement.CreateFleetDetails{Credentials: []fleetappsmanagement.AssociatedFleetCredentialDetails{fleetappsmanagement.AssociatedFleetCredentialDetails{CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
			DisplayName: common.String("EXAMPLE-displayName-Value"),
			EntitySpecifics: fleetappsmanagement.FleetCredentialEntitySpecificDetails{Variables: []fleetappsmanagement.Variable{fleetappsmanagement.Variable{Name: common.String("EXAMPLE-name-Value"),
				Value: common.String("EXAMPLE-value-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"),
			Details:         fleetappsmanagement.ProductFleetDetails{},
			EnvironmentType: common.String("EXAMPLE-environmentType-Value"),
			NotificationPreferences: []fleetappsmanagement.NotificationPreference{fleetappsmanagement.NotificationPreference{TopicId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-topicId-Value"),
				CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
				Preferences: &fleetappsmanagement.Preferences{OnTaskFailure: common.Bool(true),
					OnTaskPause:            common.Bool(false),
					OnTaskSuccess:          common.Bool(false),
					OnTopologyModification: common.Bool(true),
					UpcomingSchedule: &fleetappsmanagement.UpcomingSchedule{NotifyBefore: common.String("EXAMPLE-notifyBefore-Value"),
						OnUpcomingSchedule: common.Bool(false)},
					OnJobFailure:            common.Bool(false),
					OnResourceNonCompliance: common.Bool(false),
					OnRunbookNewerVersion:   common.Bool(false)}}},
			Products:            []string{"EXAMPLE--Value"},
			DisplayName:         common.String("EXAMPLE-displayName-Value"),
			IsTargetAutoConfirm: common.Bool(false),
			Resources: []fleetappsmanagement.AssociatedFleetResourceDetails{fleetappsmanagement.AssociatedFleetResourceDetails{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"),
				TenancyId:         common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-tenancyId-Value")}},
			CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
			DefinedTags:   map[string]map[string]interface{}{"EXAMPLE_KEY_TZPDQ": map[string]interface{}{"EXAMPLE_KEY_51g82": "EXAMPLE--Value"}},
			ParentFleetId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-parentFleetId-Value"),
			Properties: []fleetappsmanagement.AssociatedFleetPropertyDetails{fleetappsmanagement.AssociatedFleetPropertyDetails{CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
				DisplayName:       common.String("EXAMPLE-displayName-Value"),
				FleetPropertyType: fleetappsmanagement.AssociatedFleetPropertyDetailsFleetPropertyTypeString,
				IsRequired:        common.Bool(true),
				Value:             common.String("EXAMPLE-value-Value")}},
			ResourceSelection: fleetappsmanagement.DynamicResourceSelection{RuleSelectionCriteria: &fleetappsmanagement.SelectionCriteria{MatchCondition: fleetappsmanagement.SelectionCriteriaMatchConditionMatchAll,
				Rules: []fleetappsmanagement.Rule{fleetappsmanagement.Rule{Basis: common.String("EXAMPLE-basis-Value"),
					CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
					Conditions: []fleetappsmanagement.Condition{fleetappsmanagement.Condition{AttrGroup: common.String("EXAMPLE-attrGroup-Value"),
						AttrKey:   common.String("EXAMPLE-attrKey-Value"),
						AttrValue: common.String("EXAMPLE-attrValue-Value")}},
					ResourceCompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-resourceCompartmentId-Value")}}}},
			FreeformTags: map[string]string{"EXAMPLE_KEY_NIMz7": "EXAMPLE_VALUE_R65XurX4PWBjkOxMznMN"}}}

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