// 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_j0SKY": map[string]interface{}{"EXAMPLE_KEY_aHfqY": "EXAMPLE--Value"}},
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")}},
Description: common.String("EXAMPLE-description-Value"),
DisplayName: common.String("EXAMPLE-displayName-Value"),
EnvironmentType: common.String("EXAMPLE-environmentType-Value"),
IsTargetAutoConfirm: common.Bool(false),
NotificationPreferences: []fleetappsmanagement.NotificationPreference{fleetappsmanagement.NotificationPreference{Preferences: &fleetappsmanagement.Preferences{UpcomingSchedule: &fleetappsmanagement.UpcomingSchedule{NotifyBefore: common.String("EXAMPLE-notifyBefore-Value"),
OnUpcomingSchedule: common.Bool(false)},
OnJobFailure: common.Bool(true),
OnResourceNonCompliance: common.Bool(true),
OnRunbookNewerVersion: common.Bool(false),
OnTaskFailure: common.Bool(true),
OnTaskPause: common.Bool(true),
OnTaskSuccess: common.Bool(false),
OnTopologyModification: common.Bool(false)},
TopicId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-topicId-Value"),
CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value")}},
Properties: []fleetappsmanagement.AssociatedFleetPropertyDetails{fleetappsmanagement.AssociatedFleetPropertyDetails{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.AssociatedFleetPropertyDetailsFleetPropertyTypeNumber,
IsRequired: common.Bool(true)}},
Credentials: []fleetappsmanagement.AssociatedFleetCredentialDetails{fleetappsmanagement.AssociatedFleetCredentialDetails{DisplayName: common.String("EXAMPLE-displayName-Value"),
EntitySpecifics: fleetappsmanagement.FleetCredentialEntitySpecificDetails{Variables: []fleetappsmanagement.Variable{fleetappsmanagement.Variable{Value: common.String("EXAMPLE-value-Value"),
Name: common.String("EXAMPLE-name-Value")}}},
User: fleetappsmanagement.PlainTextCredentialDetails{Value: common.String("EXAMPLE-value-Value")},
CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value")}},
FreeformTags: map[string]string{"EXAMPLE_KEY_uMy97": "EXAMPLE_VALUE_xIc2nksMXYwmW4aNq9lR"},
ResourceSelection: fleetappsmanagement.ManualResourceSelection{},
Details: fleetappsmanagement.GroupFleetDetails{},
ParentFleetId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-parentFleetId-Value"),
Products: []string{"EXAMPLE--Value"},
CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value")},
OpcRequestId: common.String("C9RTDIUY01KK78C45Z1N<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)
}