// 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/datacc"
"github.com/oracle/oci-go-sdk/v65/example/helpers"
)
func ExampleCreateInfrastructure() {
// 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 := datacc.NewBaseinfraClientWithConfigurationProvider(common.DefaultConfigProvider())
helpers.FatalIfError(err)
// Create a request and dependent object(s).
req := datacc.CreateInfrastructureRequest{CreateInfrastructureDetails: datacc.CreateInfrastructureDetails{VlanId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vlanId-Value"),
AdminNetworkcidr: common.String("EXAMPLE-adminNetworkcidr-Value"),
ClientNetworkBondingInterface: datacc.NetworkBondingInterfaceEnumBtbond1,
CpsNetworkBondingMode: datacc.NetworkBondingModeLacp,
DataDiskPercentage: common.Int(77),
DefinedTags: map[string]map[string]interface{}{"EXAMPLE_KEY_YvUZF": map[string]interface{}{"EXAMPLE_KEY_X2vd8": "EXAMPLE--Value"}},
Gateway: common.String("EXAMPLE-gateway-Value"),
BackupNetworkBondingInterface: datacc.NetworkBondingInterfaceEnumBtbond4,
CloudControlPlaneServer2: common.String("EXAMPLE-cloudControlPlaneServer2-Value"),
Contacts: []datacc.InfrastructureContact{datacc.InfrastructureContact{PhoneNumber: common.String("EXAMPLE-phoneNumber-Value"),
Email: common.String("EXAMPLE-email-Value"),
IsContactMosValidated: common.Bool(false),
IsPrimary: common.Bool(true),
Name: common.String("EXAMPLE-name-Value")}},
Description: common.String("EXAMPLE-description-Value"),
DisplayName: common.String("EXAMPLE-displayName-Value"),
MaintenanceWindow: &datacc.MaintenanceWindow{HoursOfDay: []int{1},
IsCustomActionTimeoutEnabled: common.Bool(false),
Months: []datacc.MaintenanceWindowMonthsEnum{datacc.MaintenanceWindowMonthsSeptember},
CustomActionTimeoutInMins: common.Int(443),
DaysOfWeek: []datacc.MaintenanceWindowDaysOfWeekEnum{datacc.MaintenanceWindowDaysOfWeekTuesday},
IsMonthlyPatchingEnabled: common.Bool(false),
LeadTimeInWeeks: common.Int(3),
PatchingMode: datacc.BasePatchingModeRolling,
Preference: datacc.MaintenancePreferenceCustomPreference,
WeeksOfMonth: []int{3}},
NtpServers: []string{"EXAMPLE--Value"},
Shape: datacc.ShapeEnumTwelveSsds,
ClientNetworkBondingMode: datacc.NetworkBondingModeLacp,
CpsNetworkBondingInterface: datacc.NetworkBondingInterfaceEnumBtbond1,
DnsServers: []string{"EXAMPLE--Value"},
Netmask: common.String("EXAMPLE-netmask-Value"),
SystemModel: datacc.SystemModelEnumX11Ha768,
AcfsFileSystemStorageInGbs: common.Float64(5773.756),
BackupNetworkBondingMode: datacc.NetworkBondingModeLacp,
CloudControlPlaneServer1: common.String("EXAMPLE-cloudControlPlaneServer1-Value"),
CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
CorporateProxy: common.String("EXAMPLE-corporateProxy-Value"),
FreeformTags: map[string]string{"EXAMPLE_KEY_uoBvZ": "EXAMPLE_VALUE_ljkrAtxwt1b6FvrYVeL8"}},
OpcRequestId: common.String("C59IGZ032O27TMLNAZIX<unique_ID>"),
OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value")}
// Send the request using the service client
resp, err := client.CreateInfrastructure(context.Background(), req)
helpers.FatalIfError(err)
// Retrieve value from the response.
fmt.Println(resp)
}