_id stringlengths 2 7 | title stringlengths 1 118 | partition stringclasses 3
values | text stringlengths 52 85.5k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q170100 | flattenVmwareDistributedVirtualSwitchPvlanSpec | validation | func flattenVmwareDistributedVirtualSwitchPvlanSpec(d *schema.ResourceData, obj *types.VmwareDistributedVirtualSwitchPvlanSpec) error {
d.Set("port_private_secondary_vlan_id", obj.PvlanId)
return nil
} | go | {
"resource": ""
} |
q170101 | expandBaseVmwareDistributedVirtualSwitchVlanSpec | validation | func expandBaseVmwareDistributedVirtualSwitchVlanSpec(d *schema.ResourceData) types.BaseVmwareDistributedVirtualSwitchVlanSpec {
var obj types.BaseVmwareDistributedVirtualSwitchVlanSpec
_, ide := d.GetOkExists("vlan_id")
_, pvid := d.GetOkExists("port_private_secondary_vlan_id")
vteList, vteOK := d.GetOkExists("vl... | go | {
"resource": ""
} |
q170102 | flattenBaseVmwareDistributedVirtualSwitchVlanSpec | validation | func flattenBaseVmwareDistributedVirtualSwitchVlanSpec(d *schema.ResourceData, obj types.BaseVmwareDistributedVirtualSwitchVlanSpec) error {
if obj == nil {
return nil
}
var err error
switch t := obj.(type) {
case *types.VmwareDistributedVirtualSwitchVlanIdSpec:
err = flattenVmwareDistributedVirtualSwitchVla... | go | {
"resource": ""
} |
q170103 | expandDVSFailureCriteria | validation | func expandDVSFailureCriteria(d *schema.ResourceData) *types.DVSFailureCriteria {
obj := &types.DVSFailureCriteria{
CheckBeacon: structure.GetBoolPolicy(d, "check_beacon"),
}
if structure.AllFieldsEmpty(obj) {
return nil
}
return obj
} | go | {
"resource": ""
} |
q170104 | flattenDVSFailureCriteria | validation | func flattenDVSFailureCriteria(d *schema.ResourceData, obj *types.DVSFailureCriteria) error {
if obj == nil {
return nil
}
structure.SetBoolPolicy(d, "check_beacon", obj.CheckBeacon)
return nil
} | go | {
"resource": ""
} |
q170105 | expandVMwareUplinkPortOrderPolicy | validation | func expandVMwareUplinkPortOrderPolicy(d *schema.ResourceData) *types.VMwareUplinkPortOrderPolicy {
obj := &types.VMwareUplinkPortOrderPolicy{
ActiveUplinkPort: structure.SliceInterfacesToStrings(d.Get("active_uplinks").([]interface{})),
StandbyUplinkPort: structure.SliceInterfacesToStrings(d.Get("standby_uplinks... | go | {
"resource": ""
} |
q170106 | flattenVMwareUplinkPortOrderPolicy | validation | func flattenVMwareUplinkPortOrderPolicy(d *schema.ResourceData, obj *types.VMwareUplinkPortOrderPolicy) error {
if obj == nil {
return nil
}
if err := d.Set("active_uplinks", obj.ActiveUplinkPort); err != nil {
return err
}
if err := d.Set("standby_uplinks", obj.StandbyUplinkPort); err != nil {
return err
... | go | {
"resource": ""
} |
q170107 | expandVmwareUplinkPortTeamingPolicy | validation | func expandVmwareUplinkPortTeamingPolicy(d *schema.ResourceData) *types.VmwareUplinkPortTeamingPolicy {
obj := &types.VmwareUplinkPortTeamingPolicy{
Policy: structure.GetStringPolicy(d, "teaming_policy"),
NotifySwitches: structure.GetBoolPolicy(d, "notify_switches"),
RollingOrder: structure.GetBoolP... | go | {
"resource": ""
} |
q170108 | flattenVmwareUplinkPortTeamingPolicy | validation | func flattenVmwareUplinkPortTeamingPolicy(d *schema.ResourceData, obj *types.VmwareUplinkPortTeamingPolicy) error {
if obj == nil {
return nil
}
structure.SetStringPolicy(d, "teaming_policy", obj.Policy)
structure.SetBoolPolicy(d, "notify_switches", obj.NotifySwitches)
structure.SetBoolPolicyReverse(d, "failbac... | go | {
"resource": ""
} |
q170109 | expandDVSSecurityPolicy | validation | func expandDVSSecurityPolicy(d *schema.ResourceData) *types.DVSSecurityPolicy {
obj := &types.DVSSecurityPolicy{
AllowPromiscuous: structure.GetBoolPolicy(d, "allow_promiscuous"),
MacChanges: structure.GetBoolPolicy(d, "allow_mac_changes"),
ForgedTransmits: structure.GetBoolPolicy(d, "allow_forged_transmi... | go | {
"resource": ""
} |
q170110 | flattenDVSSecurityPolicy | validation | func flattenDVSSecurityPolicy(d *schema.ResourceData, obj *types.DVSSecurityPolicy) error {
if obj == nil {
return nil
}
structure.SetBoolPolicy(d, "allow_promiscuous", obj.AllowPromiscuous)
structure.SetBoolPolicy(d, "allow_mac_changes", obj.MacChanges)
structure.SetBoolPolicy(d, "allow_forged_transmits", obj.... | go | {
"resource": ""
} |
q170111 | expandVMwareUplinkLacpPolicy | validation | func expandVMwareUplinkLacpPolicy(d *schema.ResourceData) *types.VMwareUplinkLacpPolicy {
obj := &types.VMwareUplinkLacpPolicy{
Enable: structure.GetBoolPolicy(d, "lacp_enabled"),
Mode: structure.GetStringPolicy(d, "lacp_mode"),
}
if structure.AllFieldsEmpty(obj) {
return nil
}
return obj
} | go | {
"resource": ""
} |
q170112 | flattenVMwareUplinkLacpPolicy | validation | func flattenVMwareUplinkLacpPolicy(d *schema.ResourceData, obj *types.VMwareUplinkLacpPolicy) error {
if obj == nil {
return nil
}
structure.SetBoolPolicy(d, "lacp_enabled", obj.Enable)
structure.SetStringPolicy(d, "lacp_mode", obj.Mode)
return nil
} | go | {
"resource": ""
} |
q170113 | expandDVSTrafficShapingPolicyIngress | validation | func expandDVSTrafficShapingPolicyIngress(d *schema.ResourceData) *types.DVSTrafficShapingPolicy {
obj := &types.DVSTrafficShapingPolicy{
Enabled: structure.GetBoolPolicy(d, "ingress_shaping_enabled"),
AverageBandwidth: structure.GetLongPolicy(d, "ingress_shaping_average_bandwidth"),
PeakBandwidth: s... | go | {
"resource": ""
} |
q170114 | flattenDVSTrafficShapingPolicyIngress | validation | func flattenDVSTrafficShapingPolicyIngress(d *schema.ResourceData, obj *types.DVSTrafficShapingPolicy) error {
if obj == nil {
return nil
}
structure.SetBoolPolicy(d, "ingress_shaping_enabled", obj.Enabled)
structure.SetLongPolicy(d, "ingress_shaping_average_bandwidth", obj.AverageBandwidth)
structure.SetLongPo... | go | {
"resource": ""
} |
q170115 | expandVMwareDVSPortSetting | validation | func expandVMwareDVSPortSetting(d *schema.ResourceData) *types.VMwareDVSPortSetting {
obj := &types.VMwareDVSPortSetting{
DVPortSetting: types.DVPortSetting{
Blocked: structure.GetBoolPolicy(d, "block_all_ports"),
InShapingPolicy: expandDVSTrafficShapingPolicyIngress(d),
OutShapingPo... | go | {
"resource": ""
} |
q170116 | flattenVMwareDVSPortSetting | validation | func flattenVMwareDVSPortSetting(d *schema.ResourceData, obj *types.VMwareDVSPortSetting) error {
if obj == nil {
return nil
}
structure.SetBoolPolicy(d, "block_all_ports", obj.Blocked)
structure.SetBoolPolicy(d, "netflow_enabled", obj.IpfixEnabled)
structure.SetBoolPolicy(d, "tx_uplink", obj.TxUplink)
structu... | go | {
"resource": ""
} |
q170117 | expandClusterDrsVMConfigInfo | validation | func expandClusterDrsVMConfigInfo(d *schema.ResourceData, vm *object.VirtualMachine) (*types.ClusterDrsVmConfigInfo, error) {
obj := &types.ClusterDrsVmConfigInfo{
Behavior: types.DrsBehavior(d.Get("drs_automation_level").(string)),
Enabled: structure.GetBool(d, "drs_enabled"),
Key: vm.Reference(),
}
re... | go | {
"resource": ""
} |
q170118 | flattenClusterDrsVMConfigInfo | validation | func flattenClusterDrsVMConfigInfo(d *schema.ResourceData, obj *types.ClusterDrsVmConfigInfo) error {
return structure.SetBatch(d, map[string]interface{}{
"drs_automation_level": obj.Behavior,
"drs_enabled": obj.Enabled,
})
} | go | {
"resource": ""
} |
q170119 | resourceVSphereDRSVMOverrideParseID | validation | func resourceVSphereDRSVMOverrideParseID(id string) (string, string, error) {
parts := strings.SplitN(id, ":", 3)
if len(parts) < 2 {
return "", "", fmt.Errorf("bad ID %q", id)
}
return parts[0], parts[1], nil
} | go | {
"resource": ""
} |
q170120 | resourceVSphereDRSVMOverrideFindEntry | validation | func resourceVSphereDRSVMOverrideFindEntry(
cluster *object.ClusterComputeResource,
vm *object.VirtualMachine,
) (*types.ClusterDrsVmConfigInfo, error) {
props, err := clustercomputeresource.Properties(cluster)
if err != nil {
return nil, fmt.Errorf("error fetching cluster properties: %s", err)
}
for _, info :... | go | {
"resource": ""
} |
q170121 | resourceVSphereComputeClusterVMAntiAffinityRuleFlattenID | validation | func resourceVSphereComputeClusterVMAntiAffinityRuleFlattenID(cluster *object.ClusterComputeResource, key int32) (string, error) {
clusterID := cluster.Reference().Value
return strings.Join([]string{clusterID, strconv.Itoa(int(key))}, ":"), nil
} | go | {
"resource": ""
} |
q170122 | schemaDatastoreSummary | validation | func schemaDatastoreSummary() map[string]*schema.Schema {
return map[string]*schema.Schema{
// Note that the following fields are not represented in the schema here:
// * Name (more than likely the ID attribute and will be represented in
// resource schema)
// * Type (redundant attribute as the datastore type ... | go | {
"resource": ""
} |
q170123 | flattenDatastoreSummary | validation | func flattenDatastoreSummary(d *schema.ResourceData, obj *types.DatastoreSummary) error {
d.Set("accessible", obj.Accessible)
d.Set("capacity", structure.ByteToMB(obj.Capacity))
d.Set("free_space", structure.ByteToMB(obj.FreeSpace))
d.Set("maintenance_mode", obj.MaintenanceMode)
d.Set("multiple_host_access", obj.M... | go | {
"resource": ""
} |
q170124 | resourceVSphereDatastoreApplyFolderOrStorageClusterPath | validation | func resourceVSphereDatastoreApplyFolderOrStorageClusterPath(d *schema.ResourceData, meta interface{}) (string, error) {
var path string
fvalue, fok := d.GetOk("folder")
cvalue, cok := d.GetOk("datastore_cluster_id")
switch {
case fok:
path = fvalue.(string)
case cok:
return resourceVSphereDatastoreStorageClu... | go | {
"resource": ""
} |
q170125 | resourceVSphereDatastoreReadFolderOrStorageClusterPath | validation | func resourceVSphereDatastoreReadFolderOrStorageClusterPath(d *schema.ResourceData, ds *object.Datastore) error {
props, err := datastore.Properties(ds)
if err != nil {
return fmt.Errorf("error fetching datastore properties while parsing path: %s", err)
}
switch props.Parent.Type {
case "Folder":
return resour... | go | {
"resource": ""
} |
q170126 | CdromSubresourceSchema | validation | func CdromSubresourceSchema() map[string]*schema.Schema {
s := map[string]*schema.Schema{
// VirtualDeviceFileBackingInfo
"datastore_id": {
Type: schema.TypeString,
Optional: true,
Description: "The datastore ID the ISO is located on.",
},
"path": {
Type: schema.TypeString,
Opti... | go | {
"resource": ""
} |
q170127 | NewCdromSubresource | validation | func NewCdromSubresource(client *govmomi.Client, rdd resourceDataDiff, d, old map[string]interface{}, idx int) *CdromSubresource {
sr := &CdromSubresource{
Subresource: &Subresource{
schema: CdromSubresourceSchema(),
client: client,
srtype: subresourceTypeCdrom,
data: d,
olddata: old,
rdd: ... | go | {
"resource": ""
} |
q170128 | CdromDiffOperation | validation | func CdromDiffOperation(d *schema.ResourceDiff, c *govmomi.Client) error {
log.Printf("[DEBUG] CdromDiffOperation: Beginning diff validation")
cr := d.Get(subresourceTypeCdrom)
for ci, ce := range cr.([]interface{}) {
cm := ce.(map[string]interface{})
r := NewCdromSubresource(c, d, cm, nil, ci)
if err := r.Val... | go | {
"resource": ""
} |
q170129 | ValidateDiff | validation | func (r *CdromSubresource) ValidateDiff() error {
log.Printf("[DEBUG] %s: Beginning CDROM configuration validation", r)
dsID := r.Get("datastore_id").(string)
path := r.Get("path").(string)
clientDevice := r.Get("client_device").(bool)
switch {
case clientDevice && (dsID != "" || path != ""):
return fmt.Errorf(... | go | {
"resource": ""
} |
q170130 | Create | validation | func (r *CdromSubresource) Create(l object.VirtualDeviceList) ([]types.BaseVirtualDeviceConfigSpec, error) {
log.Printf("[DEBUG] %s: Running create", r)
var spec []types.BaseVirtualDeviceConfigSpec
var ctlr types.BaseVirtualController
ctlr, err := r.ControllerForCreateUpdate(l, SubresourceControllerTypeIDE, 0)
if ... | go | {
"resource": ""
} |
q170131 | Read | validation | func (r *CdromSubresource) Read(l object.VirtualDeviceList) error {
log.Printf("[DEBUG] %s: Reading state", r)
d, err := r.FindVirtualDevice(l)
if err != nil {
return fmt.Errorf("cannot find disk device: %s", err)
}
device, ok := d.(*types.VirtualCdrom)
if !ok {
return fmt.Errorf("device at %q is not a virtua... | go | {
"resource": ""
} |
q170132 | Update | validation | func (r *CdromSubresource) Update(l object.VirtualDeviceList) ([]types.BaseVirtualDeviceConfigSpec, error) {
log.Printf("[DEBUG] %s: Beginning update", r)
d, err := r.FindVirtualDevice(l)
if err != nil {
return nil, fmt.Errorf("cannot find disk device: %s", err)
}
device, ok := d.(*types.VirtualCdrom)
if !ok {
... | go | {
"resource": ""
} |
q170133 | Delete | validation | func (r *CdromSubresource) Delete(l object.VirtualDeviceList) ([]types.BaseVirtualDeviceConfigSpec, error) {
log.Printf("[DEBUG] %s: Beginning delete", r)
d, err := r.FindVirtualDevice(l)
if err != nil {
return nil, fmt.Errorf("cannot find disk device: %s", err)
}
device, ok := d.(*types.VirtualCdrom)
if !ok {
... | go | {
"resource": ""
} |
q170134 | mapCdrom | validation | func (r *CdromSubresource) mapCdrom(device *types.VirtualCdrom, l object.VirtualDeviceList) error {
dsID := r.Get("datastore_id").(string)
path := r.Get("path").(string)
clientDevice := r.Get("client_device").(bool)
switch {
case dsID != "" && path != "":
// If the datastore ID and path are both set, the CDROM w... | go | {
"resource": ""
} |
q170135 | VerifyVAppTransport | validation | func VerifyVAppTransport(d *schema.ResourceDiff, c *govmomi.Client) error {
log.Printf("[DEBUG] VAppDiffOperation: Verifying configuration meets requirements for vApp transport")
// Check if there is a client CDROM device configured.
cl := d.Get("cdrom")
for _, c := range cl.([]interface{}) {
if c.(map[string]int... | go | {
"resource": ""
} |
q170136 | verifyVAppCdromIso | validation | func verifyVAppCdromIso(d *schema.ResourceData, device *types.VirtualCdrom, l object.VirtualDeviceList, c *govmomi.Client) (bool, error) {
log.Printf("[DEBUG] IsVAppCdrom: Checking if CDROM is using a vApp ISO")
// If the CDROM is using VirtualCdromIsoBackingInfo and matches the ISO
// naming pattern, it has been us... | go | {
"resource": ""
} |
q170137 | DatastorePathFromString | validation | func DatastorePathFromString(p string) (*object.DatastorePath, bool) {
dp := new(object.DatastorePath)
success := dp.FromString(p)
log.Printf("[DEBUG] DatastorePathFromString: success: %t, path: %q", success, p)
return dp, success
} | go | {
"resource": ""
} |
q170138 | IsVmdkDatastorePath | validation | func IsVmdkDatastorePath(p string) bool {
dp, success := DatastorePathFromString(p)
if !success {
log.Printf("[DEBUG] IsVmdkDatastorePath: %q is not a datastore path", p)
return false
}
isVMDK := dp.IsVMDK()
log.Printf("[DEBUG] IsVmdkDatastorePath: %q %s a datastore path", p, structure.LogCond(isVMDK, "is", "i... | go | {
"resource": ""
} |
q170139 | QueryDiskType | validation | func QueryDiskType(client *govmomi.Client, name string, dc *object.Datacenter) (types.VirtualDiskType, error) {
vdm := object.NewVirtualDiskManager(client.Client)
ctx, cancel := context.WithTimeout(context.Background(), provider.DefaultAPITimeout)
defer cancel()
di, err := vdm.QueryVirtualDiskInfo(ctx, name, dc, fa... | go | {
"resource": ""
} |
q170140 | Delete | validation | func Delete(client *govmomi.Client, name string, dc *object.Datacenter) error {
if dc == nil {
return fmt.Errorf("datacenter cannot be nil")
}
log.Printf("[DEBUG] Deleting virtual disk %q in datacenter %s", name, dc)
vdm := object.NewVirtualDiskManager(client.Client)
ctx, cancel := context.WithTimeout(context.Ba... | go | {
"resource": ""
} |
q170141 | soapFault | validation | func soapFault(err error) (*soap.Fault, bool) {
if soap.IsSoapFault(err) {
return soap.ToSoapFault(err), true
}
return nil, false
} | go | {
"resource": ""
} |
q170142 | vimSoapFault | validation | func vimSoapFault(err error) (types.AnyType, bool) {
if sf, ok := soapFault(err); ok {
return sf.VimFault(), true
}
return nil, false
} | go | {
"resource": ""
} |
q170143 | taskFault | validation | func taskFault(err error) (types.BaseMethodFault, bool) {
if te, ok := err.(task.Error); ok {
return te.Fault(), true
}
return nil, false
} | go | {
"resource": ""
} |
q170144 | IsManagedObjectNotFoundError | validation | func IsManagedObjectNotFoundError(err error) bool {
if f, ok := vimSoapFault(err); ok {
if _, ok := f.(types.ManagedObjectNotFound); ok {
return true
}
}
return false
} | go | {
"resource": ""
} |
q170145 | isNotFoundError | validation | func isNotFoundError(err error) bool {
if f, ok := vimSoapFault(err); ok {
if _, ok := f.(types.NotFound); ok {
return true
}
}
return false
} | go | {
"resource": ""
} |
q170146 | IsAnyNotFoundError | validation | func IsAnyNotFoundError(err error) bool {
switch {
case IsManagedObjectNotFoundError(err):
fallthrough
case isNotFoundError(err):
return true
}
return false
} | go | {
"resource": ""
} |
q170147 | IsResourceInUseError | validation | func IsResourceInUseError(err error) bool {
if f, ok := vimSoapFault(err); ok {
if _, ok := f.(types.ResourceInUse); ok {
return true
}
}
return false
} | go | {
"resource": ""
} |
q170148 | isConcurrentAccessError | validation | func isConcurrentAccessError(err error) bool {
// ConcurrentAccess comes from a task more than it usually does from a direct
// SOAP call, so we need to handle both here.
var f types.AnyType
var ok bool
f, ok = vimSoapFault(err)
if !ok {
f, ok = taskFault(err)
}
if ok {
switch f.(type) {
case types.Concur... | go | {
"resource": ""
} |
q170149 | RenameObject | validation | func RenameObject(client *govmomi.Client, ref types.ManagedObjectReference, new string) error {
req := types.Rename_Task{
This: ref,
NewName: new,
}
rctx, rcancel := context.WithTimeout(context.Background(), provider.DefaultAPITimeout)
defer rcancel()
res, err := methods.Rename_Task(rctx, client.Client, &r... | go | {
"resource": ""
} |
q170150 | VimValidateVirtualCenter | validation | func VimValidateVirtualCenter(c *vim25.Client) error {
if c.ServiceContent.About.ApiType != "VirtualCenter" {
return errors.New(ErrVirtualCenterOnly)
}
return nil
} | go | {
"resource": ""
} |
q170151 | parseVersion | validation | func parseVersion(name, version, build string) (VSphereVersion, error) {
v := VSphereVersion{
Product: name,
}
s := strings.Split(version, ".")
if len(s) > 3 {
return v, fmt.Errorf("version string %q has more than 3 components", version)
}
var err error
v.Major, err = strconv.Atoi(s[0])
if err != nil {
re... | go | {
"resource": ""
} |
q170152 | parseVersionFromAboutInfo | validation | func parseVersionFromAboutInfo(info types.AboutInfo) VSphereVersion {
v, err := parseVersion(info.Name, info.Version, info.Build)
if err != nil {
panic(err)
}
return v
} | go | {
"resource": ""
} |
q170153 | ParseVersionFromClient | validation | func ParseVersionFromClient(client *govmomi.Client) VSphereVersion {
return parseVersionFromAboutInfo(client.Client.ServiceContent.About)
} | go | {
"resource": ""
} |
q170154 | String | validation | func (v VSphereVersion) String() string {
return fmt.Sprintf("%s %d.%d.%d build-%d", v.Product, v.Major, v.Minor, v.Patch, v.Build)
} | go | {
"resource": ""
} |
q170155 | ProductEqual | validation | func (v VSphereVersion) ProductEqual(other VSphereVersion) bool {
return v.Product == other.Product
} | go | {
"resource": ""
} |
q170156 | Older | validation | func (v VSphereVersion) Older(other VSphereVersion) bool {
if !v.ProductEqual(other) {
return false
}
if v.olderVersion(other) {
return true
}
// Double check this version is not actually newer by version number before
// moving on to the build number
if v.newerVersion(other) {
return false
}
if v.Buil... | go | {
"resource": ""
} |
q170157 | Equal | validation | func (v VSphereVersion) Equal(other VSphereVersion) bool {
return v.ProductEqual(other) && !v.Older(other) && !v.Newer(other)
} | go | {
"resource": ""
} |
q170158 | expandClusterVMGroup | validation | func expandClusterVMGroup(d *schema.ResourceData, meta interface{}, name string) (*types.ClusterVmGroup, error) {
client, err := resourceVSphereComputeClusterVMGroupClient(meta)
if err != nil {
return nil, err
}
results, err := virtualmachine.MOIDsForUUIDs(
client,
structure.SliceInterfacesToStrings(d.Get("v... | go | {
"resource": ""
} |
q170159 | flattenClusterVMGroup | validation | func flattenClusterVMGroup(d *schema.ResourceData, meta interface{}, obj *types.ClusterVmGroup) error {
client, err := resourceVSphereComputeClusterVMGroupClient(meta)
if err != nil {
return err
}
results, err := virtualmachine.UUIDsForManagedObjectReferences(
client,
obj.Vm,
)
if err != nil {
return err... | go | {
"resource": ""
} |
q170160 | resourceVSphereComputeClusterVMGroupFindEntry | validation | func resourceVSphereComputeClusterVMGroupFindEntry(
cluster *object.ClusterComputeResource,
name string,
) (*types.ClusterVmGroup, error) {
props, err := clustercomputeresource.Properties(cluster)
if err != nil {
return nil, fmt.Errorf("error fetching cluster properties: %s", err)
}
for _, info := range props.... | go | {
"resource": ""
} |
q170161 | resourceVSphereComputeClusterVMGroupFetchObjects | validation | func resourceVSphereComputeClusterVMGroupFetchObjects(
meta interface{},
clusterID string,
name string,
) (*object.ClusterComputeResource, string, error) {
client, err := resourceVSphereComputeClusterVMGroupClient(meta)
if err != nil {
return nil, "", err
}
cluster, err := clustercomputeresource.FromID(client... | go | {
"resource": ""
} |
q170162 | resourceVSphereResourcePoolApplyTags | validation | func resourceVSphereResourcePoolApplyTags(d *schema.ResourceData, meta interface{}, rp *object.ResourcePool) error {
tagsClient, err := tagsClientIfDefined(d, meta)
if err != nil {
return err
}
// Apply any pending tags now.
if tagsClient == nil {
log.Printf("[DEBUG] %s: Tags unsupported on this connection, s... | go | {
"resource": ""
} |
q170163 | resourceVSphereResourcePoolReadTags | validation | func resourceVSphereResourcePoolReadTags(d *schema.ResourceData, meta interface{}, rp *object.ResourcePool) error {
if tagsClient, _ := meta.(*VSphereClient).TagsClient(); tagsClient != nil {
log.Printf("[DEBUG] %s: Reading tags", resourceVSphereResourcePoolIDString(d))
if err := readTagsForResource(tagsClient, rp... | go | {
"resource": ""
} |
q170164 | expandClusterAffinityRuleSpec | validation | func expandClusterAffinityRuleSpec(d *schema.ResourceData, meta interface{}) (*types.ClusterAffinityRuleSpec, error) {
client, err := resourceVSphereComputeClusterVMGroupClient(meta)
if err != nil {
return nil, err
}
results, err := virtualmachine.MOIDsForUUIDs(
client,
structure.SliceInterfacesToStrings(d.G... | go | {
"resource": ""
} |
q170165 | flattenClusterAffinityRuleSpec | validation | func flattenClusterAffinityRuleSpec(d *schema.ResourceData, meta interface{}, obj *types.ClusterAffinityRuleSpec) error {
client, err := resourceVSphereComputeClusterVMGroupClient(meta)
if err != nil {
return err
}
results, err := virtualmachine.UUIDsForManagedObjectReferences(
client,
obj.Vm,
)
if err != ... | go | {
"resource": ""
} |
q170166 | resourceVSphereComputeClusterVMAffinityRuleFindEntry | validation | func resourceVSphereComputeClusterVMAffinityRuleFindEntry(
cluster *object.ClusterComputeResource,
key int32,
) (*types.ClusterAffinityRuleSpec, error) {
props, err := clustercomputeresource.Properties(cluster)
if err != nil {
return nil, fmt.Errorf("error fetching cluster properties: %s", err)
}
for _, info :... | go | {
"resource": ""
} |
q170167 | ConfigSchema | validation | func ConfigSchema() *schema.Schema {
return &schema.Schema{
Type: schema.TypeMap,
Description: "A list of custom attributes to set on this resource.",
Optional: true,
}
} | go | {
"resource": ""
} |
q170168 | VirtualMachineCloneSchema | validation | func VirtualMachineCloneSchema() map[string]*schema.Schema {
return map[string]*schema.Schema{
"template_uuid": {
Type: schema.TypeString,
Required: true,
Description: "The UUID of the source virtual machine or template.",
},
"linked_clone": {
Type: schema.TypeBool,
Optional: t... | go | {
"resource": ""
} |
q170169 | ValidateVirtualMachineClone | validation | func ValidateVirtualMachineClone(d *schema.ResourceDiff, c *govmomi.Client) error {
tUUID := d.Get("clone.0.template_uuid").(string)
log.Printf("[DEBUG] ValidateVirtualMachineClone: Validating fitness of source VM/template %s", tUUID)
vm, err := virtualmachine.FromUUID(c, tUUID)
if err != nil {
return fmt.Errorf(... | go | {
"resource": ""
} |
q170170 | validateCloneSnapshots | validation | func validateCloneSnapshots(props *mo.VirtualMachine) error {
if props.Snapshot == nil {
return fmt.Errorf("virtual machine or template %s must have a snapshot to be used as a linked clone", props.Config.Uuid)
}
// Root snapshot list can only have a singular element
if len(props.Snapshot.RootSnapshotList) != 1 {
... | go | {
"resource": ""
} |
q170171 | ReferenceProperties | validation | func ReferenceProperties(client *govmomi.Client, net object.NetworkReference) (*mo.Network, error) {
ctx, cancel := context.WithTimeout(context.Background(), provider.DefaultAPITimeout)
defer cancel()
var props mo.Network
nc := object.NewCommon(client.Client, net.Reference())
if err := nc.Properties(ctx, nc.Refere... | go | {
"resource": ""
} |
q170172 | SystemOrDefault | validation | func SystemOrDefault(client *govmomi.Client, name string, dc *object.Datacenter) (*object.HostSystem, error) {
finder := find.NewFinder(client.Client, false)
finder.SetDatacenter(dc)
ctx, cancel := context.WithTimeout(context.Background(), provider.DefaultAPITimeout)
defer cancel()
t := client.ServiceContent.Abou... | go | {
"resource": ""
} |
q170173 | Properties | validation | func Properties(host *object.HostSystem) (*mo.HostSystem, error) {
ctx, cancel := context.WithTimeout(context.Background(), provider.DefaultAPITimeout)
defer cancel()
var props mo.HostSystem
if err := host.Properties(ctx, host.Reference(), nil, &props); err != nil {
return nil, err
}
return &props, nil
} | go | {
"resource": ""
} |
q170174 | ResourcePool | validation | func ResourcePool(host *object.HostSystem) (*object.ResourcePool, error) {
ctx, cancel := context.WithTimeout(context.Background(), provider.DefaultAPITimeout)
defer cancel()
return host.ResourcePool(ctx)
} | go | {
"resource": ""
} |
q170175 | hostSystemNameFromID | validation | func hostSystemNameFromID(client *govmomi.Client, id string) (string, error) {
hs, err := FromID(client, id)
if err != nil {
return "", err
}
return hs.Name(), nil
} | go | {
"resource": ""
} |
q170176 | NameOrID | validation | func NameOrID(client *govmomi.Client, id string) string {
name, err := hostSystemNameFromID(client, id)
if err != nil {
return id
}
return name
} | go | {
"resource": ""
} |
q170177 | EnterMaintenanceMode | validation | func EnterMaintenanceMode(host *object.HostSystem, timeout int, evacuate bool) error {
if err := viapi.VimValidateVirtualCenter(host.Client()); err != nil {
evacuate = false
}
log.Printf("[DEBUG] Host %q is entering maintenance mode (evacuate: %t)", host.Name(), evacuate)
ctx, cancel := context.WithTimeout(cont... | go | {
"resource": ""
} |
q170178 | ExitMaintenanceMode | validation | func ExitMaintenanceMode(host *object.HostSystem, timeout int) error {
log.Printf("[DEBUG] Host %q is exiting maintenance mode", host.Name())
// Add 5 minutes to timeout for the context timeout to allow for any issues
// with the request after.
// TODO: Fix this so that it ultimately uses the provider context.
ct... | go | {
"resource": ""
} |
q170179 | dvsFromUUID | validation | func dvsFromUUID(client *govmomi.Client, uuid string) (*object.VmwareDistributedVirtualSwitch, error) {
dvsm := types.ManagedObjectReference{Type: "DistributedVirtualSwitchManager", Value: "DVSManager"}
req := &types.QueryDvsByUuid{
This: dvsm,
Uuid: uuid,
}
resp, err := methods.QueryDvsByUuid(context.TODO(), c... | go | {
"resource": ""
} |
q170180 | dvsFromPath | validation | func dvsFromPath(client *govmomi.Client, name string, dc *object.Datacenter) (*object.VmwareDistributedVirtualSwitch, error) {
net, err := network.FromPath(client, name, dc)
if err != nil {
return nil, err
}
if net.Reference().Type != "VmwareDistributedVirtualSwitch" {
return nil, fmt.Errorf("network at path %q... | go | {
"resource": ""
} |
q170181 | dvsProperties | validation | func dvsProperties(dvs *object.VmwareDistributedVirtualSwitch) (*mo.VmwareDistributedVirtualSwitch, error) {
ctx, cancel := context.WithTimeout(context.Background(), defaultAPITimeout)
defer cancel()
var props mo.VmwareDistributedVirtualSwitch
if err := dvs.Properties(ctx, dvs.Reference(), nil, &props); err != nil ... | go | {
"resource": ""
} |
q170182 | upgradeDVS | validation | func upgradeDVS(client *govmomi.Client, dvs *object.VmwareDistributedVirtualSwitch, version string) error {
req := &types.PerformDvsProductSpecOperation_Task{
This: dvs.Reference(),
Operation: "upgrade",
ProductSpec: &types.DistributedVirtualSwitchProductSpec{
Version: version,
},
}
ctx, cancel := c... | go | {
"resource": ""
} |
q170183 | enableDVSNetworkResourceManagement | validation | func enableDVSNetworkResourceManagement(client *govmomi.Client, dvs *object.VmwareDistributedVirtualSwitch, enabled bool) error {
req := &types.EnableNetworkResourceManagement{
This: dvs.Reference(),
Enable: enabled,
}
ctx, cancel := context.WithTimeout(context.Background(), defaultAPITimeout)
defer cancel()... | go | {
"resource": ""
} |
q170184 | resourceVSphereDatastoreClusterVMAntiAffinityRuleFlattenID | validation | func resourceVSphereDatastoreClusterVMAntiAffinityRuleFlattenID(pod *object.StoragePod, key int32) (string, error) {
podID := pod.Reference().Value
return strings.Join([]string{podID, strconv.Itoa(int(key))}, ":"), nil
} | go | {
"resource": ""
} |
q170185 | resourceVSphereDatastoreClusterVMAntiAffinityRuleFindEntry | validation | func resourceVSphereDatastoreClusterVMAntiAffinityRuleFindEntry(
pod *object.StoragePod,
key int32,
) (*types.ClusterAntiAffinityRuleSpec, error) {
props, err := storagepod.Properties(pod)
if err != nil {
return nil, fmt.Errorf("error fetching datastore cluster properties: %s", err)
}
for _, info := range prop... | go | {
"resource": ""
} |
q170186 | resourceVSphereDatastoreClusterVMAntiAffinityRuleFindEntryByName | validation | func resourceVSphereDatastoreClusterVMAntiAffinityRuleFindEntryByName(
pod *object.StoragePod,
name string,
) (*types.ClusterAntiAffinityRuleSpec, error) {
props, err := storagepod.Properties(pod)
if err != nil {
return nil, fmt.Errorf("error fetching datastore cluster properties: %s", err)
}
for _, info := ra... | go | {
"resource": ""
} |
q170187 | resourceVSphereDatastoreClusterVMAntiAffinityRuleFetchObjects | validation | func resourceVSphereDatastoreClusterVMAntiAffinityRuleFetchObjects(
meta interface{},
podID string,
key int32,
) (*object.StoragePod, int32, error) {
client, err := resourceVSphereDatastoreClusterVMAntiAffinityRuleClient(meta)
if err != nil {
return nil, 0, err
}
pod, err := storagepod.FromID(client, podID)
... | go | {
"resource": ""
} |
q170188 | controllerTypeToClass | validation | func controllerTypeToClass(c types.BaseVirtualController) (string, error) {
var t string
switch c.(type) {
case *types.VirtualIDEController:
t = SubresourceControllerTypeIDE
case *types.VirtualAHCIController:
t = SubresourceControllerTypeSATA
case *types.VirtualPCIController:
t = SubresourceControllerTypePCI... | go | {
"resource": ""
} |
q170189 | Addr | validation | func (r *Subresource) Addr() string {
return fmt.Sprintf("%s.%d", r.srtype, r.Index)
} | go | {
"resource": ""
} |
q170190 | HasChange | validation | func (r *Subresource) HasChange(key string) bool {
o, n := r.GetChange(key)
return !reflect.DeepEqual(o, n)
} | go | {
"resource": ""
} |
q170191 | GetChange | validation | func (r *Subresource) GetChange(key string) (interface{}, interface{}) {
new := r.data[key]
// No old data means no change, so we use the new value as a placeholder.
old := r.data[key]
if r.olddata != nil {
old = r.olddata[key]
}
return old, new
} | go | {
"resource": ""
} |
q170192 | GetWithRestart | validation | func (r *Subresource) GetWithRestart(key string) interface{} {
if r.HasChange(key) {
r.SetRestart(key)
}
return r.Get(key)
} | go | {
"resource": ""
} |
q170193 | GetWithVeto | validation | func (r *Subresource) GetWithVeto(key string) (interface{}, error) {
if r.HasChange(key) {
old, new := r.GetChange(key)
return r.Get(key), fmt.Errorf("cannot change the value of %q - (old: %v new: %v)", key, old, new)
}
return r.Get(key), nil
} | go | {
"resource": ""
} |
q170194 | SetRestart | validation | func (r *Subresource) SetRestart(key string) {
log.Printf("[DEBUG] %s: Resource argument %q requires a VM restart", r, key)
switch d := r.rdd.(type) {
case *schema.ResourceData:
d.Set("reboot_required", true)
case *schema.ResourceDiff:
d.SetNew("reboot_required", true)
default:
// This should never happen, b... | go | {
"resource": ""
} |
q170195 | Hash | validation | func (r *Subresource) Hash() int {
hf := schema.HashResource(&schema.Resource{Schema: r.schema})
return hf(r.data)
} | go | {
"resource": ""
} |
q170196 | computeDevAddr | validation | func computeDevAddr(device types.BaseVirtualDevice, ctlr types.BaseVirtualController) (string, error) {
vd := device.GetVirtualDevice()
vc := ctlr.GetVirtualController()
ctype, err := controllerTypeToClass(ctlr)
if err != nil {
return "", err
}
parts := []string{
ctype,
strconv.Itoa(int(vc.BusNumber)),
st... | go | {
"resource": ""
} |
q170197 | splitDevAddr | validation | func splitDevAddr(id string) (string, int, int, error) {
parts := strings.Split(id, ":")
if len(parts) < 3 {
return "", 0, 0, fmt.Errorf("invalid ID %q", id)
}
ct, cbs, dus := parts[0], parts[1], parts[2]
cb, cbe := strconv.Atoi(cbs)
du, due := strconv.Atoi(dus)
var found bool
for _, v := range subresourceIDC... | go | {
"resource": ""
} |
q170198 | findVirtualDeviceInListControllerSelectFunc | validation | func findVirtualDeviceInListControllerSelectFunc(ct string, cb int) func(types.BaseVirtualDevice) bool {
return func(device types.BaseVirtualDevice) bool {
switch ct {
case SubresourceControllerTypeIDE:
if _, ok := device.(*types.VirtualIDEController); !ok {
return false
}
case SubresourceControllerTyp... | go | {
"resource": ""
} |
q170199 | findVirtualDeviceInListDeviceSelectFunc | validation | func findVirtualDeviceInListDeviceSelectFunc(ckey int32, du int) func(types.BaseVirtualDevice) bool {
return func(d types.BaseVirtualDevice) bool {
vd := d.GetVirtualDevice()
if vd.ControllerKey == ckey && vd.UnitNumber != nil && *vd.UnitNumber == int32(du) {
return true
}
return false
}
} | go | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.