// 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{ClientNetworkBondingMode: datacc.NetworkBondingModeLacp,
DefinedTags: map[string]map[string]interface{}{"EXAMPLE_KEY_M1AG5": map[string]interface{}{"EXAMPLE_KEY_Brdvp": "EXAMPLE--Value"}},
DisplayName: common.String("EXAMPLE-displayName-Value"),
FreeformTags: map[string]string{"EXAMPLE_KEY_wWfPm": "EXAMPLE_VALUE_bLilN9uMIh7Dv16VNm4E"},
MaintenanceWindow: &datacc.MaintenanceWindow{LeadTimeInWeeks: common.Int(1),
DaysOfWeek: []datacc.MaintenanceWindowDaysOfWeekEnum{datacc.MaintenanceWindowDaysOfWeekSaturday},
IsMonthlyPatchingEnabled: common.Bool(true),
Months: []datacc.MaintenanceWindowMonthsEnum{datacc.MaintenanceWindowMonthsDecember},
PatchingMode: datacc.BasePatchingModeRolling,
Preference: datacc.MaintenancePreferenceNoPreference,
WeeksOfMonth: []int{2},
CustomActionTimeoutInMins: common.Int(277),
HoursOfDay: []int{16},
IsCustomActionTimeoutEnabled: common.Bool(true)},
ClientNetworkBondingInterface: datacc.NetworkBondingInterfaceEnumBtbond6,
CorporateProxy: common.String("EXAMPLE-corporateProxy-Value"),
CpsNetworkBondingMode: datacc.NetworkBondingModeLacp,
DataDiskPercentage: common.Int(68),
Description: common.String("EXAMPLE-description-Value"),
DnsServers: []string{"EXAMPLE--Value"},
Netmask: common.String("EXAMPLE-netmask-Value"),
SystemModel: datacc.SystemModelEnumX11Ha768,
AcfsFileSystemStorageInGbs: common.Float64(3149.0398),
BackupNetworkBondingInterface: datacc.NetworkBondingInterfaceEnumBtbond6,
BackupNetworkBondingMode: datacc.NetworkBondingModeActiveBackup,
CloudControlPlaneServer1: common.String("EXAMPLE-cloudControlPlaneServer1-Value"),
CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-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")}},
CpsNetworkBondingInterface: datacc.NetworkBondingInterfaceEnumBtbond1,
Shape: datacc.ShapeEnumTwentyFourSsds,
AdminNetworkcidr: common.String("EXAMPLE-adminNetworkcidr-Value"),
CloudControlPlaneServer2: common.String("EXAMPLE-cloudControlPlaneServer2-Value"),
Gateway: common.String("EXAMPLE-gateway-Value"),
NtpServers: []string{"EXAMPLE--Value"},
VlanId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vlanId-Value")},
OpcRequestId: common.String("P3CUWLZPEZUW60K9NG1M<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)
}