// 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/cloudbridge"
"github.com/oracle/oci-go-sdk/v65/common"
"github.com/oracle/oci-go-sdk/v65/example/helpers"
)
func ExampleCreateAsset() {
// 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 := cloudbridge.NewInventoryClientWithConfigurationProvider(common.DefaultConfigProvider())
helpers.FatalIfError(err)
// Create a request and dependent object(s).
req := cloudbridge.CreateAssetRequest{OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value"),
CreateAssetDetails: cloudbridge.CreateVmwareVmAssetDetails{AssetSourceIds: []string{"EXAMPLE--Value"},
CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
FreeformTags: map[string]string{"EXAMPLE_KEY_6nb4r": "EXAMPLE_VALUE_mMfIqHOfjHYZoq4Fhnpc"},
SourceKey: common.String("EXAMPLE-sourceKey-Value"),
Vm: &cloudbridge.VmProperties{HypervisorHost: common.String("EXAMPLE-hypervisorHost-Value"),
HypervisorVendor: common.String("EXAMPLE-hypervisorVendor-Value"),
HypervisorVersion: common.String("EXAMPLE-hypervisorVersion-Value")},
VmwareVCenter: &cloudbridge.VmwareVCenterProperties{DataCenter: common.String("EXAMPLE-dataCenter-Value"),
VcenterKey: common.String("EXAMPLE-vcenterKey-Value"),
VcenterVersion: common.String("EXAMPLE-vcenterVersion-Value")},
Compute: &cloudbridge.ComputeProperties{DnsName: common.String("EXAMPLE-dnsName-Value"),
HostName: common.String("EXAMPLE-hostName-Value"),
ScsiController: &cloudbridge.ScsiController{UnitNumber: common.Int(728),
Label: common.String("EXAMPLE-label-Value"),
SharedBus: common.String("EXAMPLE-sharedBus-Value")},
CpuModel: common.String("EXAMPLE-cpuModel-Value"),
GuestState: common.String("EXAMPLE-guestState-Value"),
PrimaryIp: common.String("EXAMPLE-primaryIp-Value"),
Disks: []cloudbridge.Disk{cloudbridge.Disk{Uuid: common.String("EXAMPLE-uuid-Value"),
UuidLun: common.String("EXAMPLE-uuidLun-Value"),
BootOrder: common.Int(957),
Location: common.String("EXAMPLE-location-Value"),
Name: common.String("EXAMPLE-name-Value"),
PersistentMode: common.String("EXAMPLE-persistentMode-Value"),
SizeInMBs: common.Int64(976)}},
IsTpmEnabled: common.Bool(false),
OperatingSystemVersion: common.String("EXAMPLE-operatingSystemVersion-Value"),
OperatingSystem: common.String("EXAMPLE-operatingSystem-Value"),
ConnectedNetworks: common.Int(705),
Description: common.String("EXAMPLE-description-Value"),
DisksCount: common.Int(408),
Firmware: common.String("EXAMPLE-firmware-Value"),
HardwareVersion: common.String("EXAMPLE-hardwareVersion-Value"),
LatencySensitivity: common.String("EXAMPLE-latencySensitivity-Value"),
MemoryInMBs: common.Int64(246),
Nics: []cloudbridge.Nic{cloudbridge.Nic{IpAddresses: []string{"EXAMPLE--Value"},
Label: common.String("EXAMPLE-label-Value"),
MacAddress: common.String("EXAMPLE-macAddress-Value"),
MacAddressType: common.String("EXAMPLE-macAddressType-Value"),
NetworkName: common.String("EXAMPLE-networkName-Value"),
SwitchName: common.String("EXAMPLE-switchName-Value")}},
CoresCount: common.Int(435),
GpuDevices: []cloudbridge.GpuDevice{cloudbridge.GpuDevice{Name: common.String("EXAMPLE-name-Value"),
CoresCount: common.Int(750),
Description: common.String("EXAMPLE-description-Value"),
Manufacturer: common.String("EXAMPLE-manufacturer-Value"),
MemoryInMBs: common.Int64(101)}},
IsPmemEnabled: common.Bool(false),
NicsCount: common.Int(509),
NvdimmController: &cloudbridge.NvdimmController{Label: common.String("EXAMPLE-label-Value"),
BusNumber: common.Int(668)},
Nvdimms: []cloudbridge.Nvdimm{cloudbridge.Nvdimm{ControllerKey: common.Int(809),
Label: common.String("EXAMPLE-label-Value"),
UnitNumber: common.Int(210)}},
StorageProvisionedInMBs: common.Int64(597),
ThreadsPerCoreCount: common.Int(11),
GpuDevicesCount: common.Int(923),
PmemInMBs: common.Int64(938),
PowerState: common.String("EXAMPLE-powerState-Value")},
DefinedTags: map[string]map[string]interface{}{"EXAMPLE_KEY_sDDuv": map[string]interface{}{"EXAMPLE_KEY_Eb3Lg": "EXAMPLE--Value"}},
DisplayName: common.String("EXAMPLE-displayName-Value"),
ExternalAssetKey: common.String("EXAMPLE-externalAssetKey-Value"),
InventoryId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-inventoryId-Value"),
VmwareVm: &cloudbridge.VmwareVmProperties{Path: common.String("EXAMPLE-path-Value"),
FaultToleranceBandwidth: common.Int(598),
FaultToleranceSecondaryLatency: common.Int(363),
FaultToleranceState: common.String("EXAMPLE-faultToleranceState-Value"),
InstanceUuid: common.String("EXAMPLE-instanceUuid-Value"),
IsDisksCbtEnabled: common.Bool(true),
IsDisksUuidEnabled: common.Bool(true),
Cluster: common.String("EXAMPLE-cluster-Value"),
CustomerFields: []string{"EXAMPLE--Value"},
CustomerTags: []cloudbridge.CustomerTag{cloudbridge.CustomerTag{Description: common.String("EXAMPLE-description-Value"),
Name: common.String("EXAMPLE-name-Value")}},
VmwareToolsStatus: common.String("EXAMPLE-vmwareToolsStatus-Value")}},
OpcRequestId: common.String("GNGKMSO04WLS06IRDWLY<unique_ID>")}
// Send the request using the service client
resp, err := client.CreateAsset(context.Background(), req)
helpers.FatalIfError(err)
// Retrieve value from the response.
fmt.Println(resp)
}