// 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{Netmask: common.String("EXAMPLE-netmask-Value"),
AcfsFileSystemStorageInGbs: common.Float64(5200.731),
BackupNetworkBondingInterface: datacc.NetworkBondingInterfaceEnumBtbond4,
BackupNetworkBondingMode: datacc.NetworkBondingModeLacp,
ClientNetworkBondingMode: datacc.NetworkBondingModeActiveBackup,
CorporateProxy: common.String("EXAMPLE-corporateProxy-Value"),
NtpServers: []string{"EXAMPLE--Value"},
SystemModel: datacc.SystemModelEnumX11Ha768,
VlanId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vlanId-Value"),
CloudControlPlaneServer1: common.String("EXAMPLE-cloudControlPlaneServer1-Value"),
Contacts: []datacc.InfrastructureContact{datacc.InfrastructureContact{Email: common.String("EXAMPLE-email-Value"),
IsContactMosValidated: common.Bool(true),
IsPrimary: common.Bool(false),
Name: common.String("EXAMPLE-name-Value"),
PhoneNumber: common.String("EXAMPLE-phoneNumber-Value")}},
CpsNetworkBondingMode: datacc.NetworkBondingModeActiveBackup,
DataDiskPercentage: common.Int(58),
DefinedTags: map[string]map[string]interface{}{"EXAMPLE_KEY_rDq1X": map[string]interface{}{"EXAMPLE_KEY_wu40p": "EXAMPLE--Value"}},
Description: common.String("EXAMPLE-description-Value"),
Shape: datacc.ShapeEnumEighteenSsds,
ClientNetworkBondingInterface: datacc.NetworkBondingInterfaceEnumBtbond5,
DnsServers: []string{"EXAMPLE--Value"},
Gateway: common.String("EXAMPLE-gateway-Value"),
AdminNetworkcidr: common.String("EXAMPLE-adminNetworkcidr-Value"),
CloudControlPlaneServer2: common.String("EXAMPLE-cloudControlPlaneServer2-Value"),
CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
CpsNetworkBondingInterface: datacc.NetworkBondingInterfaceEnumBtbond6,
DisplayName: common.String("EXAMPLE-displayName-Value"),
FreeformTags: map[string]string{"EXAMPLE_KEY_vUZHq": "EXAMPLE_VALUE_1xiIBlAyeAgaIzacjvrI"},
MaintenanceWindow: &datacc.MaintenanceWindow{DaysOfWeek: []datacc.MaintenanceWindowDaysOfWeekEnum{datacc.MaintenanceWindowDaysOfWeekFriday},
HoursOfDay: []int{15},
IsMonthlyPatchingEnabled: common.Bool(false),
Months: []datacc.MaintenanceWindowMonthsEnum{datacc.MaintenanceWindowMonthsApril},
Preference: datacc.MaintenancePreferenceNoPreference,
WeeksOfMonth: []int{1},
CustomActionTimeoutInMins: common.Int(307),
IsCustomActionTimeoutEnabled: common.Bool(false),
LeadTimeInWeeks: common.Int(2),
PatchingMode: datacc.BasePatchingModeNonrolling}},
OpcRequestId: common.String("TIJX1BPZTGHN4BGNICJR<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)
}