// Doesn't work with vCloud API 5.5, only vCloud Air
170912
func (v *Vdc) GetVDCOrg() (Org, error) {

	for _, av := range v.Vdc.Link {
		if av.Rel == "up" && av.Type == "application/vnd.vmware.vcloud.org+xml" {
			u, err := url.ParseRequestURI(av.HREF)

			if err != nil {
				return Org{}, fmt.Errorf("error decoding vdc response: %s", err)
			}

			req := v.c.NewRequest(map[string]string{}, "GET", *u, nil)

			resp, err := checkResp(v.c.Http.Do(req))
			if err != nil {
				return Org{}, fmt.Errorf("error retreiving org: %s", err)
			}

			org := NewOrg(v.c)

			if err = decodeBody(resp, org.Org); err != nil {
				return Org{}, fmt.Errorf("error decoding org response: %s", err)
			}

			// The request was successful
			return *org, nil

		}
	}
	return Org{}, fmt.Errorf("can't find VDC Org")
}
1373029
func (c CloudstackClient) DeployVirtualMachine(serviceofferingid string, templateid string, zoneid string, account string, diskofferingid string, displayname string, networkids []string, keypair string, projectid string, userdata string, hypervisor string) (DeployVirtualMachineResponse, error) {
	var resp DeployVirtualMachineResponse

	params := url.Values{}
	params.Set("serviceofferingid", serviceofferingid)
	params.Set("templateid", templateid)
	params.Set("zoneid", zoneid)
	//	params.Set("account", account)
	if diskofferingid != "" {
		params.Set("diskofferingid", diskofferingid)
	}
	params.Set("displayname", displayname)
	params.Set("hypervisor", hypervisor)
	if len(networkids) > 0 {
		params.Set("networkids", strings.Join(networkids, ","))
	}
	params.Set("keypair", keypair)
	//	params.Set("projectid", projectid)
	if userdata != "" {
		params.Set("userdata", base64.StdEncoding.EncodeToString([]byte(userdata)))
	}
	response, err := NewRequest(c, "deployVirtualMachine", params)
	if err != nil {
		return resp, err
	}
	resp = response.(DeployVirtualMachineResponse)
	return resp, nil
}
536126
func (b *BigIP) PatchVirtualAddress(vaddr string, config *VirtualAddress) error {
	return b.patch(config, uriLtm, uriVirtualAddress, vaddr)
}
1325738
func (c *ServicedCli) cmdAddVirtualIP(ctx *cli.Context) {
	args := ctx.Args()
	if len(args) != 4 {
		fmt.Printf("Incorrect Usage.\n\n")
		cli.ShowCommandHelp(ctx, "add-virtual-ip")
		return
	}

	requestVirtualIP := pool.VirtualIP{PoolID: args[0], IP: args[1], Netmask: args[2], BindInterface: args[3]}
	if err := c.driver.AddVirtualIP(requestVirtualIP); err != nil {
		fmt.Fprintln(os.Stderr, err)
		return
	}

	fmt.Println("Added virtual IP:", args[1])
}
1218030
func (service *VboxPortType) IFilegetOpenMode(request *IFilegetOpenMode) (*IFilegetOpenModeResponse, error) {
	response := new(IFilegetOpenModeResponse)
	err := service.client.Call("", request, response)
	if err != nil {
		return nil, err
	}

	return response, nil
}
326581
func (service *VboxPortType) IHostfindHostFloppyDrive(request *IHostfindHostFloppyDrive) (*IHostfindHostFloppyDriveResponse, error) {
	response := new(IHostfindHostFloppyDriveResponse)
	err := service.client.Call("", request, response)
	if err != nil {
		return nil, err
	}

	return response, nil
}
1007046
func (r Product_Package) GetCloudStorageItems(provider *int) (resp []datatypes.Product_Item, err error) {
	params := []interface{}{
		provider,
	}
	err = r.Session.DoRequest("SoftLayer_Product_Package", "getCloudStorageItems", params, &r.Options, &resp)
	return
}
1270174
func (ops *vsphereOps) Attach(diskPath string) (string, error) {
	ctx, cancel := context.WithCancel(context.Background())
	defer cancel()

	vmObj, err := ops.renewVM(ctx, ops.vm)
	if err != nil {
		return "", err
	}

	diskUUID, err := vmObj.AttachDisk(ctx, diskPath, &vclib.VolumeOptions{SCSIControllerType: vclib.PVSCSIControllerType})
	if err != nil {
		logrus.Errorf("Failed to attach vsphere disk: %s for VM: %s. err: +%v", diskPath, vmObj.Name(), err)
		return "", err
	}

	return path.Join(diskByIDPath, diskSCSIPrefix+diskUUID), nil
}
318989
func (r Virtual_Guest) CreateArchiveTransaction(groupName *string, blockDevices []datatypes.Virtual_Guest_Block_Device, note *string) (resp datatypes.Provisioning_Version1_Transaction, err error) {
	params := []interface{}{
		groupName,
		blockDevices,
		note,
	}
	err = r.Session.DoRequest("SoftLayer_Virtual_Guest", "createArchiveTransaction", params, &r.Options, &resp)
	return
}
289333
func (c CloudstackClient) ListVolumes(vmid string) (ListVolumesResponse, error) {
	var resp ListVolumesResponse
	params := url.Values{}
	params.Set("virtualmachineid", vmid)
	params.Set("listall", "true")
	response, err := NewRequest(c, "listVolumes", params)
	if err != nil {
		return resp, err
	}

	resp = response.(ListVolumesResponse)

	return resp, err
}
703813
func UnmarshalCloud(in []byte) (Cloud, error) {
	var internal cloud
	if err := yaml.Unmarshal(in, &internal); err != nil {
		return Cloud{}, errors.Annotate(err, "cannot unmarshal yaml cloud metadata")
	}
	return cloudFromInternal(&internal), nil
}
1230683
func (service *VboxPortType) IAudioAdaptergetAudioController(request *IAudioAdaptergetAudioController) (*IAudioAdaptergetAudioControllerResponse, error) {
	response := new(IAudioAdaptergetAudioControllerResponse)
	err := service.client.Call("", request, response)
	if err != nil {
		return nil, err
	}

	return response, nil
}
1026511
func (s *Server) AddVirtualIP(requestVirtualIP pool.VirtualIP, _ *struct{}) error {
	return s.f.AddVirtualIP(s.context(), requestVirtualIP)
}
292148
func (service *VboxPortType) IAudioAdaptergetEnabled(request *IAudioAdaptergetEnabled) (*IAudioAdaptergetEnabledResponse, error) {
	response := new(IAudioAdaptergetEnabledResponse)
	err := service.client.Call("", request, response)
	if err != nil {
		return nil, err
	}

	return response, nil
}
1284455
func (service *VboxPortType) IFilegetCreationMode(request *IFilegetCreationMode) (*IFilegetCreationModeResponse, error) {
	response := new(IFilegetCreationModeResponse)
	err := service.client.Call("", request, response)
	if err != nil {
		return nil, err
	}

	return response, nil
}
39600
func (v *azureVolumeSource) ReleaseVolumes(ctx context.ProviderCallContext, volumeIds []string) ([]error, error) {
	// Releasing volumes is not supported, see azureStorageProvider.Releasable.
	//
	// When managed disks can be moved between resource groups, we may want to
	// support releasing unmanaged disks. We'll need to create a managed disk
	// from the blob, and then release that.
	return nil, errors.NotSupportedf("ReleaseVolumes")
}
864908
func (m *sioMgr) AttachVolume(volName string, multipleMappings bool) (string, error) {
	client, err := m.getClient()
	if err != nil {
		klog.Error(log("attach volume failed: %v", err))
		return "", err
	}

	klog.V(4).Infoln(log("attaching volume %s", volName))
	iid, err := client.IID()
	if err != nil {
		klog.Error(log("failed to get instanceID"))
		return "", err
	}
	klog.V(4).Info(log("attaching volume %s to host instance %s", volName, iid))

	devs, err := client.Devs()
	if err != nil {
		return "", err
	}

	vol, err := client.FindVolume(volName)
	if err != nil {
		klog.Error(log("failed to find volume %s: %v", volName, err))
		return "", err
	}

	// handle vol if already attached
	if len(vol.MappedSdcInfo) > 0 {
		if m.isSdcMappedToVol(iid, vol) {
			klog.V(4).Info(log("skippping attachment, volume %s already attached to sdc %s", volName, iid))
			return devs[vol.ID], nil
		}
	}

	// attach volume, get deviceName
	if err := client.AttachVolume(sioVolumeID(vol.ID), multipleMappings); err != nil {
		klog.Error(log("attachment for volume %s failed :%v", volName, err))
		return "", err
	}
	device, err := client.WaitForAttachedDevice(vol.ID)
	if err != nil {
		klog.Error(log("failed while waiting for device to attach: %v", err))
		return "", err
	}
	klog.V(4).Info(log("volume %s attached successfully as %s to instance %s", volName, device, iid))
	return device, nil
}