Skip to content
Permalink
Browse files
Merge pull request #29 from benjvi/update-cloudstack-43
Generate v4.3 code for getID projects update
  • Loading branch information
Sander van Harmelen committed Jun 12, 2015
2 parents 2362596 + 1f94dc9 commit 4d162c3e1955cd12235a8f0abaa95fe0bbf08c63
Show file tree
Hide file tree
Showing 15 changed files with 180 additions and 0 deletions.
@@ -1731,6 +1731,16 @@ func (s *AccountService) GetProjectAccountID(keyword string, projectid string) (
return "", err
}

if l.Count == 0 {
// If no matches, search all projects
p.p["projectid"] = "-1"

l, err = s.ListProjectAccounts(p)
if err != nil {
return "", err
}
}

if l.Count == 0 {
return "", fmt.Errorf("No match found for %s: %+v", keyword, l)
}
@@ -691,6 +691,16 @@ func (s *ISOService) GetIsoID(name string) (string, error) {
return "", err
}

if l.Count == 0 {
// If no matches, search all projects
p.p["projectid"] = "-1"

l, err = s.ListIsos(p)
if err != nil {
return "", err
}
}

if l.Count == 0 {
return "", fmt.Errorf("No match found for %s: %+v", name, l)
}
@@ -828,6 +828,16 @@ func (s *InternalLBService) GetInternalLoadBalancerVMID(name string) (string, er
return "", err
}

if l.Count == 0 {
// If no matches, search all projects
p.p["projectid"] = "-1"

l, err = s.ListInternalLoadBalancerVMs(p)
if err != nil {
return "", err
}
}

if l.Count == 0 {
return "", fmt.Errorf("No match found for %s: %+v", name, l)
}
@@ -912,6 +912,16 @@ func (s *LoadBalancerService) GetLoadBalancerRuleID(name string) (string, error)
return "", err
}

if l.Count == 0 {
// If no matches, search all projects
p.p["projectid"] = "-1"

l, err = s.ListLoadBalancerRules(p)
if err != nil {
return "", err
}
}

if l.Count == 0 {
return "", fmt.Errorf("No match found for %s: %+v", name, l)
}
@@ -3708,6 +3718,16 @@ func (s *LoadBalancerService) GetGlobalLoadBalancerRuleID(keyword string) (strin
return "", err
}

if l.Count == 0 {
// If no matches, search all projects
p.p["projectid"] = "-1"

l, err = s.ListGlobalLoadBalancerRules(p)
if err != nil {
return "", err
}
}

if l.Count == 0 {
return "", fmt.Errorf("No match found for %s: %+v", keyword, l)
}
@@ -4438,6 +4458,16 @@ func (s *LoadBalancerService) GetLoadBalancerID(name string) (string, error) {
return "", err
}

if l.Count == 0 {
// If no matches, search all projects
p.p["projectid"] = "-1"

l, err = s.ListLoadBalancers(p)
if err != nil {
return "", err
}
}

if l.Count == 0 {
return "", fmt.Errorf("No match found for %s: %+v", name, l)
}
@@ -1215,6 +1215,16 @@ func (s *NetworkACLService) GetNetworkACLListID(name string) (string, error) {
return "", err
}

if l.Count == 0 {
// If no matches, search all projects
p.p["projectid"] = "-1"

l, err = s.ListNetworkACLLists(p)
if err != nil {
return "", err
}
}

if l.Count == 0 {
return "", fmt.Errorf("No match found for %s: %+v", name, l)
}
@@ -935,6 +935,16 @@ func (s *NetworkService) GetNetworkID(keyword string) (string, error) {
return "", err
}

if l.Count == 0 {
// If no matches, search all projects
p.p["projectid"] = "-1"

l, err = s.ListNetworks(p)
if err != nil {
return "", err
}
}

if l.Count == 0 {
return "", fmt.Errorf("No match found for %s: %+v", keyword, l)
}
@@ -931,6 +931,16 @@ func (s *RouterService) GetRouterID(name string) (string, error) {
return "", err
}

if l.Count == 0 {
// If no matches, search all projects
p.p["projectid"] = "-1"

l, err = s.ListRouters(p)
if err != nil {
return "", err
}
}

if l.Count == 0 {
return "", fmt.Errorf("No match found for %s: %+v", name, l)
}
@@ -986,6 +986,16 @@ func (s *SecurityGroupService) GetSecurityGroupID(keyword string) (string, error
return "", err
}

if l.Count == 0 {
// If no matches, search all projects
p.p["projectid"] = "-1"

l, err = s.ListSecurityGroups(p)
if err != nil {
return "", err
}
}

if l.Count == 0 {
return "", fmt.Errorf("No match found for %s: %+v", keyword, l)
}
@@ -375,6 +375,16 @@ func (s *SnapshotService) GetSnapshotID(name string) (string, error) {
return "", err
}

if l.Count == 0 {
// If no matches, search all projects
p.p["projectid"] = "-1"

l, err = s.ListSnapshots(p)
if err != nil {
return "", err
}
}

if l.Count == 0 {
return "", fmt.Errorf("No match found for %s: %+v", name, l)
}
@@ -1113,6 +1123,16 @@ func (s *SnapshotService) GetVMSnapshotID(name string) (string, error) {
return "", err
}

if l.Count == 0 {
// If no matches, search all projects
p.p["projectid"] = "-1"

l, err = s.ListVMSnapshot(p)
if err != nil {
return "", err
}
}

if l.Count == 0 {
return "", fmt.Errorf("No match found for %s: %+v", name, l)
}
@@ -1294,6 +1294,16 @@ func (s *TemplateService) GetTemplateID(name string, templatefilter string, zone
return "", err
}

if l.Count == 0 {
// If no matches, search all projects
p.p["projectid"] = "-1"

l, err = s.ListTemplates(p)
if err != nil {
return "", err
}
}

if l.Count == 0 {
return "", fmt.Errorf("No match found for %s: %+v", name, l)
}
@@ -379,6 +379,16 @@ func (s *VMGroupService) GetInstanceGroupID(name string) (string, error) {
return "", err
}

if l.Count == 0 {
// If no matches, search all projects
p.p["projectid"] = "-1"

l, err = s.ListInstanceGroups(p)
if err != nil {
return "", err
}
}

if l.Count == 0 {
return "", fmt.Errorf("No match found for %s: %+v", name, l)
}
@@ -561,6 +561,16 @@ func (s *VPCService) GetVPCID(name string) (string, error) {
return "", err
}

if l.Count == 0 {
// If no matches, search all projects
p.p["projectid"] = "-1"

l, err = s.ListVPCs(p)
if err != nil {
return "", err
}
}

if l.Count == 0 {
return "", fmt.Errorf("No match found for %s: %+v", name, l)
}
@@ -1953,6 +1953,16 @@ func (s *VPNService) GetVpnCustomerGatewayID(keyword string) (string, error) {
return "", err
}

if l.Count == 0 {
// If no matches, search all projects
p.p["projectid"] = "-1"

l, err = s.ListVpnCustomerGateways(p)
if err != nil {
return "", err
}
}

if l.Count == 0 {
return "", fmt.Errorf("No match found for %s: %+v", keyword, l)
}
@@ -2182,6 +2182,16 @@ func (s *VirtualMachineService) GetVirtualMachineID(name string) (string, error)
return "", err
}

if l.Count == 0 {
// If no matches, search all projects
p.p["projectid"] = "-1"

l, err = s.ListVirtualMachines(p)
if err != nil {
return "", err
}
}

if l.Count == 0 {
return "", fmt.Errorf("No match found for %s: %+v", name, l)
}
@@ -1073,6 +1073,16 @@ func (s *VolumeService) GetVolumeID(name string) (string, error) {
return "", err
}

if l.Count == 0 {
// If no matches, search all projects
p.p["projectid"] = "-1"

l, err = s.ListVolumes(p)
if err != nil {
return "", err
}
}

if l.Count == 0 {
return "", fmt.Errorf("No match found for %s: %+v", name, l)
}

0 comments on commit 4d162c3

Please sign in to comment.