Bumped github.com/ukcloud/govcloudair vendor version (#14616)

This commit is contained in:
Dominik Schuster 2017-05-18 12:04:02 +02:00 committed by Paul Stack
parent 19d3355ca6
commit 622bc1aec2
3 changed files with 36 additions and 6 deletions

View File

@ -28,6 +28,11 @@ func NewVApp(c *Client) *VApp {
} }
} }
func (v *VCDClient) NewVApp(c *Client) VApp {
newvapp := NewVApp(c)
return *newvapp
}
func (v *VApp) Refresh() error { func (v *VApp) Refresh() error {
if v.VApp.HREF == "" { if v.VApp.HREF == "" {
@ -244,7 +249,7 @@ func (v *VApp) RemoveVM(vm VM) error {
return nil return nil
} }
func (v *VApp) ComposeVApp(orgvdcnetwork OrgVDCNetwork, vapptemplate VAppTemplate, name string, description string) (Task, error) { func (v *VApp) ComposeVApp(orgvdcnetwork OrgVDCNetwork, vapptemplate VAppTemplate, storage_profile_reference *types.Reference, name string, description string) (Task, error) {
if vapptemplate.VAppTemplate.Children == nil || orgvdcnetwork.OrgVDCNetwork == nil { if vapptemplate.VAppTemplate.Children == nil || orgvdcnetwork.OrgVDCNetwork == nil {
return Task{}, fmt.Errorf("can't compose a new vApp, objects passed are not valid") return Task{}, fmt.Errorf("can't compose a new vApp, objects passed are not valid")
@ -298,6 +303,7 @@ func (v *VApp) ComposeVApp(orgvdcnetwork OrgVDCNetwork, vapptemplate VAppTemplat
InnerNetwork: orgvdcnetwork.OrgVDCNetwork.Name, InnerNetwork: orgvdcnetwork.OrgVDCNetwork.Name,
ContainerNetwork: orgvdcnetwork.OrgVDCNetwork.Name, ContainerNetwork: orgvdcnetwork.OrgVDCNetwork.Name,
}, },
StorageProfile: storage_profile_reference,
}, },
} }

View File

@ -105,6 +105,30 @@ func (v *Vdc) FindVDCNetwork(network string) (OrgVDCNetwork, error) {
return OrgVDCNetwork{}, fmt.Errorf("can't find VDC Network: %s", network) return OrgVDCNetwork{}, fmt.Errorf("can't find VDC Network: %s", network)
} }
func (v *Vdc) FindStorageProfile(storage_profile string) (types.Reference, error) {
for _, an := range v.Vdc.VdcStorageProfiles {
for _, n := range an.VdcStorageProfile {
if n.Name == storage_profile {
return *n, nil
}
}
return types.Reference{}, fmt.Errorf("can't find VDC Storage_profile: %s", storage_profile)
}
return types.Reference{}, fmt.Errorf("can't find any VDC Storage_profiles")
}
func (v *Vdc) GetDefaultStorageProfile(storage_profiles *types.QueryResultRecordsType) (types.Reference, error) {
for _, n := range storage_profiles.OrgVdcStorageProfileRecord {
if n.IsDefaultStorageProfile {
storage_profile_reference := types.Reference{HREF: n.HREF, Name: n.Name}
return storage_profile_reference, nil
}
}
return types.Reference{}, fmt.Errorf("can't find Default VDC Storage_profile")
}
// Doesn't work with vCloud API 5.5, only vCloud Air // Doesn't work with vCloud API 5.5, only vCloud Air
func (v *Vdc) GetVDCOrg() (Org, error) { func (v *Vdc) GetVDCOrg() (Org, error) {
@ -281,13 +305,13 @@ func (v *Vdc) FindVAppByID(vappid string) (VApp, error) {
} }
urnslice := strings.SplitAfter(vappid, ":") urnslice := strings.SplitAfter(vappid, ":")
urnid := urnslice[len(urnslice)-1] urnid := urnslice[len(urnslice) - 1]
for _, resents := range v.Vdc.ResourceEntities { for _, resents := range v.Vdc.ResourceEntities {
for _, resent := range resents.ResourceEntity { for _, resent := range resents.ResourceEntity {
hrefslice := strings.SplitAfter(resent.HREF, "/") hrefslice := strings.SplitAfter(resent.HREF, "/")
hrefslice = strings.SplitAfter(hrefslice[len(hrefslice)-1], "-") hrefslice = strings.SplitAfter(hrefslice[len(hrefslice) - 1], "-")
res := strings.Join(hrefslice[1:], "") res := strings.Join(hrefslice[1:], "")
if res == urnid && resent.Type == "application/vnd.vmware.vcloud.vApp+xml" { if res == urnid && resent.Type == "application/vnd.vmware.vcloud.vApp+xml" {

6
vendor/vendor.json vendored
View File

@ -2986,10 +2986,10 @@
"revisionTime": "2016-09-28T01:52:44Z" "revisionTime": "2016-09-28T01:52:44Z"
}, },
{ {
"checksumSHA1": "cm+mGoVXAuESxVeudG1FSIN0lv4=", "checksumSHA1": "YOsTnuSgZn1CUUBNZJDjdPt072E=",
"path": "github.com/ukcloud/govcloudair", "path": "github.com/ukcloud/govcloudair",
"revision": "3c7799ae4b9cd5896a77990514578681c837c7bb", "revision": "81750aa743ea8c1ab671ae615b2277d1835c7eb2",
"revisionTime": "2017-04-12T09:42:31Z" "revisionTime": "2017-04-26T18:57:05Z"
}, },
{ {
"checksumSHA1": "8FHandxT6XIwsawRe0eNupivqho=", "checksumSHA1": "8FHandxT6XIwsawRe0eNupivqho=",