_id
stringlengths
2
7
title
stringlengths
1
118
partition
stringclasses
3 values
text
stringlengths
52
85.5k
language
stringclasses
1 value
meta_information
dict
q170000
wait
validation
func (w *virtualMachineCustomizationWaiter) wait(client *govmomi.Client, vm *object.VirtualMachine, timeout int) error { // A timeout of less than 1 minute (zero or negative value) skips the waiter, // so we return immediately. if timeout < 1 { return nil } // Our listener loop callback. cbErr := make(chan err...
go
{ "resource": "" }
q170001
selectEventsForReference
validation
func selectEventsForReference(client *govmomi.Client, ref types.ManagedObjectReference, eventTypes []string) ([]types.BaseEvent, error) { ctx, cancel := context.WithTimeout(context.Background(), defaultAPITimeout) defer cancel() filter := types.EventFilterSpec{ Entity: &types.EventFilterSpecByEntity{ Entity: ...
go
{ "resource": "" }
q170002
getDatastore
validation
func getDatastore(f *find.Finder, ds string) (*object.Datastore, error) { if ds != "" { dso, err := f.Datastore(context.TODO(), ds) return dso, err } else { dso, err := f.DefaultDatastore(context.TODO()) return dso, err } }
go
{ "resource": "" }
q170003
resourceVSphereVirtualMachineUpdateReconfigureWithSDRS
validation
func resourceVSphereVirtualMachineUpdateReconfigureWithSDRS( d *schema.ResourceData, meta interface{}, vm *object.VirtualMachine, spec types.VirtualMachineConfigSpec, ) error { // Check to see if we have any disk creation operations first, as sending an // update through SDRS without any disk creation operations ...
go
{ "resource": "" }
q170004
resourceVSphereVirtualMachineCreateBareWithSDRS
validation
func resourceVSphereVirtualMachineCreateBareWithSDRS( d *schema.ResourceData, meta interface{}, fo *object.Folder, spec types.VirtualMachineConfigSpec, pool *object.ResourcePool, hs *object.HostSystem, ) (*object.VirtualMachine, error) { client := meta.(*VSphereClient).vimClient if err := viapi.ValidateVirtualC...
go
{ "resource": "" }
q170005
resourceVSphereVirtualMachineCreateBareStandard
validation
func resourceVSphereVirtualMachineCreateBareStandard( d *schema.ResourceData, meta interface{}, fo *object.Folder, spec types.VirtualMachineConfigSpec, pool *object.ResourcePool, hs *object.HostSystem, ) (*object.VirtualMachine, error) { client := meta.(*VSphereClient).vimClient // Set the datastore for the VM...
go
{ "resource": "" }
q170006
resourceVSphereVirtualMachineCreateCloneWithSDRS
validation
func resourceVSphereVirtualMachineCreateCloneWithSDRS( d *schema.ResourceData, meta interface{}, srcVM *object.VirtualMachine, fo *object.Folder, name string, spec types.VirtualMachineCloneSpec, timeout int, ) (*object.VirtualMachine, error) { client := meta.(*VSphereClient).vimClient if err := viapi.ValidateV...
go
{ "resource": "" }
q170007
resourceVSphereVirtualMachineRollbackCreate
validation
func resourceVSphereVirtualMachineRollbackCreate( d *schema.ResourceData, meta interface{}, vm *object.VirtualMachine, origErr error, ) error { defer d.SetId("") // Updates are largely atomic, so more than likely no disks with // keep_on_remove were attached, but just in case, we run this through delete // to m...
go
{ "resource": "" }
q170008
resourceVSphereVirtualMachineUpdateLocationRelocateWithSDRS
validation
func resourceVSphereVirtualMachineUpdateLocationRelocateWithSDRS( d *schema.ResourceData, meta interface{}, vm *object.VirtualMachine, spec types.VirtualMachineRelocateSpec, timeout int, ) error { client := meta.(*VSphereClient).vimClient if err := viapi.ValidateVirtualCenter(client); err != nil { return fmt.E...
go
{ "resource": "" }
q170009
applyVirtualDevices
validation
func applyVirtualDevices(d *schema.ResourceData, c *govmomi.Client, l object.VirtualDeviceList) ([]types.BaseVirtualDeviceConfigSpec, error) { // We filter this device list through each major device class' apply // operation. This will give us a final set of changes that will be our // deviceChange attribute. var s...
go
{ "resource": "" }
q170010
expandClusterDpmHostConfigInfo
validation
func expandClusterDpmHostConfigInfo(d *schema.ResourceData, host *object.HostSystem) (*types.ClusterDpmHostConfigInfo, error) { obj := &types.ClusterDpmHostConfigInfo{ Behavior: types.DpmBehavior(d.Get("dpm_automation_level").(string)), Enabled: structure.GetBool(d, "dpm_enabled"), Key: host.Reference(), ...
go
{ "resource": "" }
q170011
flattenClusterDpmHostConfigInfo
validation
func flattenClusterDpmHostConfigInfo(d *schema.ResourceData, obj *types.ClusterDpmHostConfigInfo) error { return structure.SetBatch(d, map[string]interface{}{ "dpm_automation_level": obj.Behavior, "dpm_enabled": obj.Enabled, }) }
go
{ "resource": "" }
q170012
resourceVSphereDPMHostOverrideFlattenID
validation
func resourceVSphereDPMHostOverrideFlattenID(cluster *object.ClusterComputeResource, host *object.HostSystem) (string, error) { return strings.Join([]string{cluster.Reference().Value, host.Reference().Value}, ":"), nil }
go
{ "resource": "" }
q170013
resourceVSphereDPMHostOverrideFindEntry
validation
func resourceVSphereDPMHostOverrideFindEntry( cluster *object.ClusterComputeResource, host *object.HostSystem, ) (*types.ClusterDpmHostConfigInfo, error) { props, err := clustercomputeresource.Properties(cluster) if err != nil { return nil, fmt.Errorf("error fetching cluster properties: %s", err) } for _, info...
go
{ "resource": "" }
q170014
resourceVSphereVirtualDisk
validation
func resourceVSphereVirtualDisk() *schema.Resource { return &schema.Resource{ Create: resourceVSphereVirtualDiskCreate, Read: resourceVSphereVirtualDiskRead, Delete: resourceVSphereVirtualDiskDelete, Schema: map[string]*schema.Schema{ // Size in GB "size": { Type: schema.TypeInt, Required:...
go
{ "resource": "" }
q170015
createHardDisk
validation
func createHardDisk(client *govmomi.Client, size int, diskPath string, diskType string, adapterType string, dc string) error { var vDiskType string switch diskType { case "thin": vDiskType = "thin" case "eagerZeroedThick": vDiskType = "eagerZeroedThick" case "lazy": vDiskType = "preallocated" } virtualDis...
go
{ "resource": "" }
q170016
searchForDirectory
validation
func searchForDirectory(client *govmomi.Client, datacenter string, datastore string, directoryPath string) error { log.Printf("[DEBUG] Searching for Directory") finder := find.NewFinder(client.Client, true) dc, err := getDatacenter(client, datacenter) if err != nil { return fmt.Errorf("Error finding Datacenter: ...
go
{ "resource": "" }
q170017
processMountOperations
validation
func (p *nasDatastoreMountProcessor) processMountOperations() (*object.Datastore, error) { hosts := p.diffNewOld() if len(hosts) < 1 { // Nothing to do return p.ds, nil } // Validate we are vCenter if we are working with multiple hosts if len(hosts) > 1 { if err := viapi.ValidateVirtualCenter(p.client); err ...
go
{ "resource": "" }
q170018
processUnmountOperations
validation
func (p *nasDatastoreMountProcessor) processUnmountOperations() error { hosts := p.diffOldNew() if len(hosts) < 1 || p.ds == nil { // Nothing to do return nil } for _, hsID := range hosts { dss, err := hostDatastoreSystemFromHostSystemID(p.client, hsID) if err != nil { return fmt.Errorf("host %q: %s", ho...
go
{ "resource": "" }
q170019
isEligibleTagEndpoint
validation
func isEligibleTagEndpoint(client *govmomi.Client) bool { if err := viapi.ValidateVirtualCenter(client); err != nil { return false } clientVer := viapi.ParseVersionFromClient(client) if !clientVer.ProductEqual(tagsMinVersion) || clientVer.Older(tagsMinVersion) { return false } return true }
go
{ "resource": "" }
q170020
tagCategoryByName
validation
func tagCategoryByName(client *tags.RestClient, name string) (string, error) { ctx, cancel := context.WithTimeout(context.Background(), defaultAPITimeout) defer cancel() cats, err := client.GetCategoriesByName(ctx, name) if err != nil { return "", fmt.Errorf("could not get category for name %q: %s", name, err) }...
go
{ "resource": "" }
q170021
tagByName
validation
func tagByName(client *tags.RestClient, name, categoryID string) (string, error) { ctx, cancel := context.WithTimeout(context.Background(), defaultAPITimeout) defer cancel() tags, err := client.GetTagByNameForCategory(ctx, name, categoryID) if err != nil { return "", fmt.Errorf("could not get tag for name %q: %s"...
go
{ "resource": "" }
q170022
tagsSchema
validation
func tagsSchema() *schema.Schema { return &schema.Schema{ Type: schema.TypeSet, Description: "A list of tag IDs to apply to this object.", Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, } }
go
{ "resource": "" }
q170023
tagTypeForObject
validation
func tagTypeForObject(obj object.Reference) (string, error) { switch obj.(type) { case *object.VirtualMachine: return vSphereTagTypeVirtualMachine, nil case *object.Datastore: return vSphereTagTypeDatastore, nil case *object.Network: return vSphereTagTypeNetwork, nil case *object.Folder: return vSphereTagT...
go
{ "resource": "" }
q170024
readTagsForResource
validation
func readTagsForResource(client *tags.RestClient, obj object.Reference, d *schema.ResourceData) error { log.Printf("[DEBUG] Reading tags for object %q", obj.Reference().Value) objID := obj.Reference().Value objType, err := tagTypeForObject(obj) if err != nil { return err } ctx, cancel := context.WithTimeout(con...
go
{ "resource": "" }
q170025
diff
validation
func (p *tagDiffProcessor) diff(a, b []string) []string { var found bool c := make([]string, 0) for _, v1 := range a { for _, v2 := range b { if v1 == v2 { found = true } } if !found { c = append(c, v1) } found = false } return c }
go
{ "resource": "" }
q170026
processAttachOperations
validation
func (p *tagDiffProcessor) processAttachOperations() error { tagIDs := p.diffNewOld() if len(tagIDs) < 1 { // Nothing to do return nil } for _, tagID := range tagIDs { objID := p.subject.Reference().Value objType, err := tagTypeForObject(p.subject) if err != nil { return err } ctx, cancel := contex...
go
{ "resource": "" }
q170027
tagsClientIfDefined
validation
func tagsClientIfDefined(d *schema.ResourceData, meta interface{}) (*tags.RestClient, error) { old, new := d.GetChange(vSphereTagAttributeKey) if len(old.(*schema.Set).List()) > 0 || len(new.(*schema.Set).List()) > 0 { log.Printf("[DEBUG] tagsClientIfDefined: Loading tagging client") client, err := meta.(*VSphere...
go
{ "resource": "" }
q170028
processTagDiff
validation
func processTagDiff(client *tags.RestClient, d *schema.ResourceData, obj object.Reference) error { log.Printf("[DEBUG] Processing tags for object %q", obj.Reference().Value) old, new := d.GetChange(vSphereTagAttributeKey) tdp := &tagDiffProcessor{ client: client, subject: obj, oldTagIDs: structure.SliceIn...
go
{ "resource": "" }
q170029
expandDVSContactInfo
validation
func expandDVSContactInfo(d *schema.ResourceData) *types.DVSContactInfo { obj := &types.DVSContactInfo{ Name: d.Get("contact_name").(string), Contact: d.Get("contact_detail").(string), } return obj }
go
{ "resource": "" }
q170030
flattenDVSContactInfo
validation
func flattenDVSContactInfo(d *schema.ResourceData, obj types.DVSContactInfo) error { d.Set("contact_name", obj.Name) d.Set("conatct_detail", obj.Contact) return nil }
go
{ "resource": "" }
q170031
expandDistributedVirtualSwitchHostMemberConfigSpec
validation
func expandDistributedVirtualSwitchHostMemberConfigSpec(d map[string]interface{}) types.DistributedVirtualSwitchHostMemberConfigSpec { hostRef := &types.ManagedObjectReference{ Type: "HostSystem", Value: d["host_system_id"].(string), } var pnSpecs []types.DistributedVirtualSwitchHostMemberPnicSpec nics := str...
go
{ "resource": "" }
q170032
flattenDistributedVirtualSwitchHostMember
validation
func flattenDistributedVirtualSwitchHostMember(obj types.DistributedVirtualSwitchHostMember) map[string]interface{} { d := make(map[string]interface{}) d["host_system_id"] = obj.Config.Host.Value var devices []string backing := obj.Config.Backing.(*types.DistributedVirtualSwitchHostMemberPnicBacking) for _, spec ...
go
{ "resource": "" }
q170033
expandSliceOfDistributedVirtualSwitchHostMemberConfigSpec
validation
func expandSliceOfDistributedVirtualSwitchHostMemberConfigSpec(d *schema.ResourceData) []types.DistributedVirtualSwitchHostMemberConfigSpec { var specs []types.DistributedVirtualSwitchHostMemberConfigSpec o, n := d.GetChange("host") os := o.(*schema.Set) ns := n.(*schema.Set) // Make an intersection set. These ho...
go
{ "resource": "" }
q170034
flattenSliceOfDistributedVirtualSwitchHostMember
validation
func flattenSliceOfDistributedVirtualSwitchHostMember(d *schema.ResourceData, members []types.DistributedVirtualSwitchHostMember) error { var hosts []map[string]interface{} for _, m := range members { hosts = append(hosts, flattenDistributedVirtualSwitchHostMember(m)) } if err := d.Set("host", hosts); err != nil ...
go
{ "resource": "" }
q170035
expandVMwareIpfixConfig
validation
func expandVMwareIpfixConfig(d *schema.ResourceData) *types.VMwareIpfixConfig { obj := &types.VMwareIpfixConfig{ ActiveFlowTimeout: int32(d.Get("netflow_active_flow_timeout").(int)), CollectorIpAddress: d.Get("netflow_collector_ip_address").(string), CollectorPort: int32(d.Get("netflow_collector_port")....
go
{ "resource": "" }
q170036
flattenVMwareIpfixConfig
validation
func flattenVMwareIpfixConfig(d *schema.ResourceData, obj *types.VMwareIpfixConfig) error { d.Set("netflow_active_flow_timeout", obj.ActiveFlowTimeout) d.Set("netflow_collector_ip_address", obj.CollectorIpAddress) d.Set("netflow_collector_port", obj.CollectorPort) d.Set("netflow_idle_flow_timeout", obj.IdleFlowTime...
go
{ "resource": "" }
q170037
flattenDvsHostInfrastructureTrafficResource
validation
func flattenDvsHostInfrastructureTrafficResource(d *schema.ResourceData, obj types.DvsHostInfrastructureTrafficResource, key string) error { shareLevelKey := fmt.Sprintf("%s_share_level", strings.ToLower(key)) shareCountKey := fmt.Sprintf("%s_share_count", strings.ToLower(key)) maxMbitKey := fmt.Sprintf("%s_maximum_...
go
{ "resource": "" }
q170038
expandDVSNameArrayUplinkPortPolicy
validation
func expandDVSNameArrayUplinkPortPolicy(d *schema.ResourceData) *types.DVSNameArrayUplinkPortPolicy { obj := &types.DVSNameArrayUplinkPortPolicy{ UplinkPortName: structure.SliceInterfacesToStrings(d.Get("uplinks").([]interface{})), } if structure.AllFieldsEmpty(obj) { return nil } return obj }
go
{ "resource": "" }
q170039
flattenDVSNameArrayUplinkPortPolicy
validation
func flattenDVSNameArrayUplinkPortPolicy(d *schema.ResourceData, obj *types.DVSNameArrayUplinkPortPolicy) error { if err := d.Set("uplinks", obj.UplinkPortName); err != nil { return err } return nil }
go
{ "resource": "" }
q170040
expandVMwareDVSConfigSpec
validation
func expandVMwareDVSConfigSpec(d *schema.ResourceData) *types.VMwareDVSConfigSpec { obj := &types.VMwareDVSConfigSpec{ DVSConfigSpec: types.DVSConfigSpec{ Name: d.Get("name").(string), ConfigVersion: d.Get("config_version").(string), DefaultPortConfig: ...
go
{ "resource": "" }
q170041
flattenVMwareDVSConfigInfo
validation
func flattenVMwareDVSConfigInfo(d *schema.ResourceData, obj *types.VMwareDVSConfigInfo) error { d.Set("name", obj.Name) d.Set("config_version", obj.ConfigVersion) d.Set("description", obj.Description) d.Set("ipv4_address", obj.SwitchIpAddress) d.Set("max_mtu", obj.MaxMtu) d.Set("lacp_api_version", obj.LacpApiVers...
go
{ "resource": "" }
q170042
schemaDVSCreateSpec
validation
func schemaDVSCreateSpec() map[string]*schema.Schema { s := map[string]*schema.Schema{ // DistributedVirtualSwitchProductSpec "version": { Type: schema.TypeString, Computed: true, Description: "The version of this virtual switch. Allowed versions are 6.5.0, 6.0.0, 5.5.0, 5.1.0, and 5.0.0.", ...
go
{ "resource": "" }
q170043
expandDVSCreateSpec
validation
func expandDVSCreateSpec(d *schema.ResourceData) types.DVSCreateSpec { // Since we are only working with the version string from the product spec, // we don't have a separate expander/flattener for it. Just do that here. obj := types.DVSCreateSpec{ ProductInfo: &types.DistributedVirtualSwitchProductSpec{ Versio...
go
{ "resource": "" }
q170044
getWithRestart
validation
func getWithRestart(d *schema.ResourceData, key string) interface{} { if d.HasChange(key) { log.Printf("[DEBUG] %s: Resource argument %q requires a VM restart", resourceVSphereVirtualMachineIDString(d), key) d.Set("reboot_required", true) } return d.Get(key) }
go
{ "resource": "" }
q170045
vAppSubresourceSchema
validation
func vAppSubresourceSchema() map[string]*schema.Schema { return map[string]*schema.Schema{ "properties": { Type: schema.TypeMap, Optional: true, Description: "A map of customizable vApp properties and their values. Allows customization of VMs cloned from OVF templates which have customizable vApp ...
go
{ "resource": "" }
q170046
expandVirtualMachineBootOptions
validation
func expandVirtualMachineBootOptions(d *schema.ResourceData, client *govmomi.Client) *types.VirtualMachineBootOptions { obj := &types.VirtualMachineBootOptions{ BootDelay: int64(d.Get("boot_delay").(int)), BootRetryEnabled: structure.GetBool(d, "boot_retry_enabled"), BootRetryDelay: int64(d.Get("boot_re...
go
{ "resource": "" }
q170047
flattenVirtualMachineBootOptions
validation
func flattenVirtualMachineBootOptions(d *schema.ResourceData, obj *types.VirtualMachineBootOptions) error { d.Set("boot_delay", obj.BootDelay) structure.SetBoolPtr(d, "efi_secure_boot_enabled", obj.EfiSecureBootEnabled) structure.SetBoolPtr(d, "boot_retry_enabled", obj.BootRetryEnabled) d.Set("boot_retry_delay", ob...
go
{ "resource": "" }
q170048
expandVirtualMachineFlagInfo
validation
func expandVirtualMachineFlagInfo(d *schema.ResourceData) *types.VirtualMachineFlagInfo { obj := &types.VirtualMachineFlagInfo{ DiskUuidEnabled: getBoolWithRestart(d, "enable_disk_uuid"), VirtualExecUsage: getWithRestart(d, "hv_mode").(string), VirtualMmuUsage: getWithRestart(d, "ept_rvi_mode").(string), Ena...
go
{ "resource": "" }
q170049
flattenVirtualMachineFlagInfo
validation
func flattenVirtualMachineFlagInfo(d *schema.ResourceData, obj *types.VirtualMachineFlagInfo) error { d.Set("enable_disk_uuid", obj.DiskUuidEnabled) d.Set("hv_mode", obj.VirtualExecUsage) d.Set("ept_rvi_mode", obj.VirtualMmuUsage) d.Set("enable_logging", obj.EnableLogging) return nil }
go
{ "resource": "" }
q170050
expandToolsConfigInfo
validation
func expandToolsConfigInfo(d *schema.ResourceData) *types.ToolsConfigInfo { obj := &types.ToolsConfigInfo{ SyncTimeWithHost: structure.GetBool(d, "sync_time_with_host"), AfterPowerOn: getBoolWithRestart(d, "run_tools_scripts_after_power_on"), AfterResume: getBoolWithRestart(d, "run_tools_script...
go
{ "resource": "" }
q170051
flattenToolsConfigInfo
validation
func flattenToolsConfigInfo(d *schema.ResourceData, obj *types.ToolsConfigInfo) error { d.Set("sync_time_with_host", obj.SyncTimeWithHost) d.Set("run_tools_scripts_after_power_on", obj.AfterPowerOn) d.Set("run_tools_scripts_after_resume", obj.AfterResume) d.Set("run_tools_scripts_before_guest_standby", obj.BeforeGu...
go
{ "resource": "" }
q170052
schemaVirtualMachineResourceAllocation
validation
func schemaVirtualMachineResourceAllocation() map[string]*schema.Schema { s := make(map[string]*schema.Schema) shareLevelFmt := "The allocation level for %s resources. Can be one of high, low, normal, or custom." shareCountFmt := "The amount of shares to allocate to %s for a custom share level." limitFmt := "The ma...
go
{ "resource": "" }
q170053
expandVirtualMachineResourceAllocation
validation
func expandVirtualMachineResourceAllocation(d *schema.ResourceData, key string) *types.ResourceAllocationInfo { shareLevelKey := fmt.Sprintf("%s_share_level", key) shareCountKey := fmt.Sprintf("%s_share_count", key) limitKey := fmt.Sprintf("%s_limit", key) reservationKey := fmt.Sprintf("%s_reservation", key) obj ...
go
{ "resource": "" }
q170054
expandLatencySensitivity
validation
func expandLatencySensitivity(d *schema.ResourceData) *types.LatencySensitivity { obj := &types.LatencySensitivity{ Level: types.LatencySensitivitySensitivityLevel(d.Get("latency_sensitivity").(string)), } return obj }
go
{ "resource": "" }
q170055
flattenLatencySensitivity
validation
func flattenLatencySensitivity(d *schema.ResourceData, obj *types.LatencySensitivity) error { if obj == nil { log.Printf("[WARN] Unable to read LatencySensitivity, skipping") return nil } return d.Set("latency_sensitivity", obj.Level) }
go
{ "resource": "" }
q170056
flattenVirtualMachineResourceAllocation
validation
func flattenVirtualMachineResourceAllocation(d *schema.ResourceData, obj *types.ResourceAllocationInfo, key string) error { shareLevelKey := fmt.Sprintf("%s_share_level", key) shareCountKey := fmt.Sprintf("%s_share_count", key) limitKey := fmt.Sprintf("%s_limit", key) reservationKey := fmt.Sprintf("%s_reservation",...
go
{ "resource": "" }
q170057
flattenVAppConfig
validation
func flattenVAppConfig(d *schema.ResourceData, config types.BaseVmConfigInfo) error { if config == nil { d.Set("vapp_transport", []string{}) return nil } // Set `vapp_config here while config is available to avoid extra API calls d.Set("vapp_transport", config.GetVmConfigInfo().OvfEnvironmentTransport) props ...
go
{ "resource": "" }
q170058
expandVirtualMachineConfigSpec
validation
func expandVirtualMachineConfigSpec(d *schema.ResourceData, client *govmomi.Client) (types.VirtualMachineConfigSpec, error) { log.Printf("[DEBUG] %s: Building config spec", resourceVSphereVirtualMachineIDString(d)) vappConfig, err := expandVAppConfig(d, client) if err != nil { return types.VirtualMachineConfigSpec...
go
{ "resource": "" }
q170059
flattenVirtualMachineConfigInfo
validation
func flattenVirtualMachineConfigInfo(d *schema.ResourceData, obj *types.VirtualMachineConfigInfo) error { d.Set("name", obj.Name) d.Set("guest_id", obj.GuestId) d.Set("alternate_guest_name", obj.AlternateGuestName) d.Set("annotation", obj.Annotation) d.Set("num_cpus", obj.Hardware.NumCPU) d.Set("num_cores_per_soc...
go
{ "resource": "" }
q170060
expandVirtualMachineConfigSpecChanged
validation
func expandVirtualMachineConfigSpecChanged(d *schema.ResourceData, client *govmomi.Client, info *types.VirtualMachineConfigInfo) (types.VirtualMachineConfigSpec, bool, error) { // Create the fake ResourceData from the VM resource oldData := resourceVSphereVirtualMachine().Data(&terraform.InstanceState{}) oldData.Set...
go
{ "resource": "" }
q170061
getMemoryReservationLockedToMax
validation
func getMemoryReservationLockedToMax(d *schema.ResourceData) *bool { if d.Get("memory_reservation").(int) != d.Get("memory").(int) { return structure.BoolPtr(false) } return nil }
go
{ "resource": "" }
q170062
FromPathOrDefault
validation
func FromPathOrDefault(client *govmomi.Client, name string, dc *object.Datacenter) (*object.ResourcePool, error) { finder := find.NewFinder(client.Client, false) ctx, cancel := context.WithTimeout(context.Background(), provider.DefaultAPITimeout) defer cancel() t := client.ServiceContent.About.ApiType switch t { ...
go
{ "resource": "" }
q170063
Properties
validation
func Properties(obj *object.ResourcePool) (*mo.ResourcePool, error) { ctx, cancel := context.WithTimeout(context.Background(), provider.DefaultAPITimeout) defer cancel() var props mo.ResourcePool if err := obj.Properties(ctx, obj.Reference(), nil, &props); err != nil { return nil, err } return &props, nil }
go
{ "resource": "" }
q170064
ValidateHost
validation
func ValidateHost(client *govmomi.Client, pool *object.ResourcePool, host *object.HostSystem) error { if host == nil { // Nothing to validate here, move along log.Printf("[DEBUG] ValidateHost: no host supplied, nothing to do") return nil } log.Printf("[DEBUG] Validating that host %q is a member of resource poo...
go
{ "resource": "" }
q170065
OSFamily
validation
func OSFamily(client *govmomi.Client, pool *object.ResourcePool, guest string) (string, error) { log.Printf("[DEBUG] Looking for OS family for guest ID %q", guest) pprops, err := Properties(pool) if err != nil { return "", err } return computeresource.OSFamily(client, pprops.Owner, guest) }
go
{ "resource": "" }
q170066
Create
validation
func Create(rp *object.ResourcePool, name string, spec *types.ResourceConfigSpec) (*object.ResourcePool, error) { log.Printf("[DEBUG] Creating resource pool %q", fmt.Sprintf("%s/%s", rp.InventoryPath, name)) ctx, cancel := context.WithTimeout(context.Background(), provider.DefaultAPITimeout) defer cancel() nrp, err...
go
{ "resource": "" }
q170067
Update
validation
func Update(rp *object.ResourcePool, name string, spec *types.ResourceConfigSpec) error { log.Printf("[DEBUG] Updating resource pool %q", fmt.Sprintf("%s", rp.InventoryPath)) ctx, cancel := context.WithTimeout(context.Background(), provider.DefaultAPITimeout) defer cancel() return rp.UpdateConfig(ctx, name, spec) }
go
{ "resource": "" }
q170068
MoveIntoResourcePool
validation
func MoveIntoResourcePool(p *object.ResourcePool, c types.ManagedObjectReference) error { req := types.MoveIntoResourcePool{ This: p.Reference(), List: []types.ManagedObjectReference{c}, } ctx, cancel := context.WithTimeout(context.Background(), provider.DefaultAPITimeout) defer cancel() _, err := methods.Move...
go
{ "resource": "" }
q170069
expandClusterDasVMConfigInfo
validation
func expandClusterDasVMConfigInfo( d *schema.ResourceData, meta interface{}, vm *object.VirtualMachine, ) (*types.ClusterDasVmConfigInfo, error) { client, err := resourceVSphereHAVMOverrideClient(meta) if err != nil { return nil, err } version := viapi.ParseVersionFromClient(client) obj := &types.ClusterDasV...
go
{ "resource": "" }
q170070
flattenClusterDasVMConfigInfo
validation
func flattenClusterDasVMConfigInfo(d *schema.ResourceData, meta interface{}, obj *types.ClusterDasVmConfigInfo) error { client, err := resourceVSphereHAVMOverrideClient(meta) if err != nil { return err } version := viapi.ParseVersionFromClient(client) // Set ha_vm_monitoring_use_cluster_defaults here as it's no...
go
{ "resource": "" }
q170071
resourceVSphereHAVMOverrideFlattenID
validation
func resourceVSphereHAVMOverrideFlattenID(cluster *object.ClusterComputeResource, vm *object.VirtualMachine) (string, error) { clusterID := cluster.Reference().Value props, err := virtualmachine.Properties(vm) if err != nil { return "", fmt.Errorf("cannot compute ID off of properties of virtual machine: %s", err) ...
go
{ "resource": "" }
q170072
resourceVSphereHAVMOverrideFindEntry
validation
func resourceVSphereHAVMOverrideFindEntry( cluster *object.ClusterComputeResource, vm *object.VirtualMachine, ) (*types.ClusterDasVmConfigInfo, error) { props, err := clustercomputeresource.Properties(cluster) if err != nil { return nil, fmt.Errorf("error fetching cluster properties: %s", err) } for _, info :=...
go
{ "resource": "" }
q170073
schemaHostPortGroupSpec
validation
func schemaHostPortGroupSpec() map[string]*schema.Schema { s := map[string]*schema.Schema{ // HostPortGroupSpec "name": { Type: schema.TypeString, Required: true, Description: "The name of the port group.", ForceNew: true, }, "vlan_id": { Type: schema.TypeInt, Optional: ...
go
{ "resource": "" }
q170074
expandHostPortGroupSpec
validation
func expandHostPortGroupSpec(d *schema.ResourceData) *types.HostPortGroupSpec { obj := &types.HostPortGroupSpec{ Name: d.Get("name").(string), VlanId: int32(d.Get("vlan_id").(int)), VswitchName: d.Get("virtual_switch_name").(string), Policy: *expandHostNetworkPolicy(d), } return obj }
go
{ "resource": "" }
q170075
flattenHostPortGroupSpec
validation
func flattenHostPortGroupSpec(d *schema.ResourceData, obj *types.HostPortGroupSpec) error { d.Set("vlan_id", obj.VlanId) if err := flattenHostNetworkPolicy(d, &obj.Policy); err != nil { return err } return nil }
go
{ "resource": "" }
q170076
calculatePorts
validation
func calculatePorts(ports []types.HostPortGroupPort) *schema.Set { s := make([]interface{}, 0) for _, port := range ports { m := make(map[string]interface{}) m["key"] = port.Key m["mac_addresses"] = structure.SliceStringsToInterfaces(port.Mac) m["type"] = port.Type s = append(s, m) } return schema.NewSet(...
go
{ "resource": "" }
q170077
portGroupPortSchema
validation
func portGroupPortSchema() *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ "key": { Type: schema.TypeString, Description: "The linkable identifier for this port entry.", Computed: true, }, "mac_addresses": { Type: schema.TypeList, Descripti...
go
{ "resource": "" }
q170078
saveHostPortGroupID
validation
func saveHostPortGroupID(d *schema.ResourceData, hsID, name string) { d.SetId(fmt.Sprintf("%s:%s:%s", hostPortGroupIDPrefix, hsID, name)) }
go
{ "resource": "" }
q170079
portGroupIDsFromResourceID
validation
func portGroupIDsFromResourceID(d *schema.ResourceData) (string, string, error) { return splitHostPortGroupID(d.Id()) }
go
{ "resource": "" }
q170080
BaseFromPath
validation
func BaseFromPath(client *govmomi.Client, path string) (BaseComputeResource, error) { finder := find.NewFinder(client.Client, false) ctx, cancel := context.WithTimeout(context.Background(), provider.DefaultAPITimeout) defer cancel() list, err := finder.ManagedObjectList(ctx, path, "ComputeResource", "ClusterComput...
go
{ "resource": "" }
q170081
BaseFromReference
validation
func BaseFromReference(client *govmomi.Client, ref types.ManagedObjectReference) (BaseComputeResource, error) { switch ref.Type { case "ComputeResource": return StandaloneFromID(client, ref.Value) case "ClusterComputeResource": return StandaloneFromID(client, ref.Value) } return nil, fmt.Errorf("unknown object...
go
{ "resource": "" }
q170082
BaseProperties
validation
func BaseProperties(obj BaseComputeResource) (*mo.ComputeResource, error) { ctx, cancel := context.WithTimeout(context.Background(), provider.DefaultAPITimeout) defer cancel() var props mo.ComputeResource if err := obj.Properties(ctx, obj.Reference(), nil, &props); err != nil { return nil, err } return &props, ...
go
{ "resource": "" }
q170083
BasePropertiesFromReference
validation
func BasePropertiesFromReference(client *govmomi.Client, ref types.ManagedObjectReference) (*mo.ComputeResource, error) { obj, err := BaseFromReference(client, ref) if err != nil { return nil, err } return BaseProperties(obj) }
go
{ "resource": "" }
q170084
DefaultDevicesFromReference
validation
func DefaultDevicesFromReference(client *govmomi.Client, ref types.ManagedObjectReference, guest string) (object.VirtualDeviceList, error) { log.Printf("[DEBUG] Fetching default device list for object reference %q for OS type %q", ref.Value, guest) b, err := EnvironmentBrowserFromReference(client, ref) if err != nil...
go
{ "resource": "" }
q170085
OSFamily
validation
func OSFamily(client *govmomi.Client, ref types.ManagedObjectReference, guest string) (string, error) { b, err := EnvironmentBrowserFromReference(client, ref) if err != nil { return "", err } ctx, cancel := context.WithTimeout(context.Background(), provider.DefaultAPITimeout) defer cancel() return b.OSFamily(ct...
go
{ "resource": "" }
q170086
EnvironmentBrowserFromReference
validation
func EnvironmentBrowserFromReference(client *govmomi.Client, ref types.ManagedObjectReference) (*envbrowse.EnvironmentBrowser, error) { cr, err := BaseFromReference(client, ref) if err != nil { return nil, err } props, err := BaseProperties(cr) if err != nil { return nil, err } if props.EnvironmentBrowser ==...
go
{ "resource": "" }
q170087
Properties
validation
func Properties(cluster *object.ClusterComputeResource) (*mo.ClusterComputeResource, error) { ctx, cancel := context.WithTimeout(context.Background(), provider.DefaultAPITimeout) defer cancel() var props mo.ClusterComputeResource if err := cluster.Properties(ctx, cluster.Reference(), nil, &props); err != nil { re...
go
{ "resource": "" }
q170088
Create
validation
func Create(f *object.Folder, name string, spec types.ClusterConfigSpecEx) (*object.ClusterComputeResource, error) { log.Printf("[DEBUG] Creating compute cluster %q", fmt.Sprintf("%s/%s", f.InventoryPath, name)) ctx, cancel := context.WithTimeout(context.Background(), provider.DefaultAPITimeout) defer cancel() clus...
go
{ "resource": "" }
q170089
MoveToFolder
validation
func MoveToFolder(client *govmomi.Client, cluster *object.ClusterComputeResource, relative string) error { f, err := folder.HostFolderFromObject(client, cluster, relative) if err != nil { return err } return folder.MoveObjectTo(cluster.Reference(), f) }
go
{ "resource": "" }
q170090
Reconfigure
validation
func Reconfigure(cluster *object.ClusterComputeResource, spec *types.ClusterConfigSpecEx) error { return computeresource.Reconfigure(cluster, spec) }
go
{ "resource": "" }
q170091
Delete
validation
func Delete(cluster *object.ClusterComputeResource) error { log.Printf("[DEBUG] Deleting compute cluster %q", cluster.InventoryPath) ctx, cancel := context.WithTimeout(context.Background(), provider.DefaultAPITimeout) defer cancel() task, err := cluster.Destroy(ctx) if err != nil { return err } return task.Wai...
go
{ "resource": "" }
q170092
IsMember
validation
func IsMember(cluster *object.ClusterComputeResource, host *object.HostSystem) (bool, error) { hprops, err := hostsystem.Properties(host) if err != nil { return false, fmt.Errorf("error getting properties for cluster %q: %s", host.Name(), err) } if hprops.Parent == nil { return false, nil } if *hprops.Parent ...
go
{ "resource": "" }
q170093
MoveHostsInto
validation
func MoveHostsInto(cluster *object.ClusterComputeResource, hosts []*object.HostSystem) error { var hsNames []string var hsRefs []types.ManagedObjectReference for _, hs := range hosts { hsNames = append(hsNames, hs.Name()) hsRefs = append(hsRefs, hs.Reference()) } log.Printf("[DEBUG] Adding hosts into cluster %...
go
{ "resource": "" }
q170094
MoveHostsOutOf
validation
func MoveHostsOutOf(cluster *object.ClusterComputeResource, hosts []*object.HostSystem, timeout int) error { for _, host := range hosts { if err := moveHostOutOf(cluster, host, timeout); err != nil { return err } } return nil }
go
{ "resource": "" }
q170095
expandVmwareDistributedVirtualSwitchVlanIDSpec
validation
func expandVmwareDistributedVirtualSwitchVlanIDSpec(d *schema.ResourceData) *types.VmwareDistributedVirtualSwitchVlanIdSpec { obj := &types.VmwareDistributedVirtualSwitchVlanIdSpec{ VlanId: int32(d.Get("vlan_id").(int)), } return obj }
go
{ "resource": "" }
q170096
flattenVmwareDistributedVirtualSwitchVlanIDSpec
validation
func flattenVmwareDistributedVirtualSwitchVlanIDSpec(d *schema.ResourceData, obj *types.VmwareDistributedVirtualSwitchVlanIdSpec) error { d.Set("vlan_id", obj.VlanId) return nil }
go
{ "resource": "" }
q170097
expandVmwareDistributedVirtualSwitchTrunkVlanSpec
validation
func expandVmwareDistributedVirtualSwitchTrunkVlanSpec(d *schema.ResourceData) *types.VmwareDistributedVirtualSwitchTrunkVlanSpec { var ranges []types.NumericRange data := d.Get("vlan_range").(*schema.Set).List() for _, v := range data { log.Printf("[DEBUG] processing range: %#v", v) r := v.(map[string]interface...
go
{ "resource": "" }
q170098
flattenVmwareDistributedVirtualSwitchTrunkVlanSpec
validation
func flattenVmwareDistributedVirtualSwitchTrunkVlanSpec(d *schema.ResourceData, obj *types.VmwareDistributedVirtualSwitchTrunkVlanSpec) error { var s []interface{} for _, rng := range obj.VlanId { m := make(map[string]interface{}) m["min_vlan"] = rng.Start m["max_vlan"] = rng.End s = append(s, m) } if err :...
go
{ "resource": "" }
q170099
expandVmwareDistributedVirtualSwitchPvlanSpec
validation
func expandVmwareDistributedVirtualSwitchPvlanSpec(d *schema.ResourceData) *types.VmwareDistributedVirtualSwitchPvlanSpec { obj := &types.VmwareDistributedVirtualSwitchPvlanSpec{ PvlanId: int32(d.Get("port_private_secondary_vlan_id").(int)), } return obj }
go
{ "resource": "" }