// 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{DefinedTags: map[string]map[string]interface{}{"EXAMPLE_KEY_zH0WN": map[string]interface{}{"EXAMPLE_KEY_hgrbV": "EXAMPLE--Value"}},
		Details: fleetappsmanagement.EnvironmentFleetDetails{},
		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.PlainTextCredentialDetails{Value: common.String("EXAMPLE-value-Value")}}},
		Description:         common.String("EXAMPLE-description-Value"),
		DisplayName:         common.String("EXAMPLE-displayName-Value"),
		IsTargetAutoConfirm: common.Bool(false),
		ResourceSelection: fleetappsmanagement.DynamicResourceSelection{RuleSelectionCriteria: &fleetappsmanagement.SelectionCriteria{MatchCondition: fleetappsmanagement.SelectionCriteriaMatchConditionAny,
			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")}}}},
		CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
		NotificationPreferences: []fleetappsmanagement.NotificationPreference{fleetappsmanagement.NotificationPreference{CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
			Preferences: &fleetappsmanagement.Preferences{OnRunbookNewerVersion: common.Bool(false),
				OnTaskFailure:          common.Bool(true),
				OnTaskPause:            common.Bool(false),
				OnTaskSuccess:          common.Bool(true),
				OnTopologyModification: common.Bool(true),
				UpcomingSchedule: &fleetappsmanagement.UpcomingSchedule{NotifyBefore: common.String("EXAMPLE-notifyBefore-Value"),
					OnUpcomingSchedule: common.Bool(false)},
				OnJobFailure:            common.Bool(true),
				OnResourceNonCompliance: common.Bool(false)},
			TopicId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-topicId-Value")}},
		ParentFleetId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-parentFleetId-Value"),
		Products:      []string{"EXAMPLE--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(false),
			Value:             common.String("EXAMPLE-value-Value")}},
		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")}},
		EnvironmentType: common.String("EXAMPLE-environmentType-Value"),
		FreeformTags:    map[string]string{"EXAMPLE_KEY_AczD9": "EXAMPLE_VALUE_fffrajuWcOHfnpn5CvnI"}},
		OpcRequestId:  common.String("AD4BAMWL0KHVPFUX0MQZ<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)
}