mirror of
https://github.com/opentffoundation/opentf.git
synced 2026-05-31 19:00:51 -04:00
Update go-cloudstack dependency
This commit is contained in:
47
vendor/github.com/xanzy/go-cloudstack/cloudstack/ProjectService.go
generated
vendored
47
vendor/github.com/xanzy/go-cloudstack/cloudstack/ProjectService.go
generated
vendored
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright 2014, Sander van Harmelen
|
||||
// Copyright 2016, Sander van Harmelen
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
@@ -805,12 +805,18 @@ func (s *ProjectService) NewListProjectsParams() *ListProjectsParams {
|
||||
}
|
||||
|
||||
// This is a courtesy helper function, which in some cases may not work as expected!
|
||||
func (s *ProjectService) GetProjectID(name string) (string, error) {
|
||||
func (s *ProjectService) GetProjectID(name string, opts ...OptionFunc) (string, error) {
|
||||
p := &ListProjectsParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
|
||||
p.p["name"] = name
|
||||
|
||||
for _, fn := range opts {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return "", err
|
||||
}
|
||||
}
|
||||
|
||||
l, err := s.ListProjects(p)
|
||||
if err != nil {
|
||||
return "", err
|
||||
@@ -835,13 +841,13 @@ func (s *ProjectService) GetProjectID(name string) (string, error) {
|
||||
}
|
||||
|
||||
// This is a courtesy helper function, which in some cases may not work as expected!
|
||||
func (s *ProjectService) GetProjectByName(name string) (*Project, int, error) {
|
||||
id, err := s.GetProjectID(name)
|
||||
func (s *ProjectService) GetProjectByName(name string, opts ...OptionFunc) (*Project, int, error) {
|
||||
id, err := s.GetProjectID(name, opts...)
|
||||
if err != nil {
|
||||
return nil, -1, err
|
||||
}
|
||||
|
||||
r, count, err := s.GetProjectByID(id)
|
||||
r, count, err := s.GetProjectByID(id, opts...)
|
||||
if err != nil {
|
||||
return nil, count, err
|
||||
}
|
||||
@@ -849,12 +855,18 @@ func (s *ProjectService) GetProjectByName(name string) (*Project, int, error) {
|
||||
}
|
||||
|
||||
// This is a courtesy helper function, which in some cases may not work as expected!
|
||||
func (s *ProjectService) GetProjectByID(id string) (*Project, int, error) {
|
||||
func (s *ProjectService) GetProjectByID(id string, opts ...OptionFunc) (*Project, int, error) {
|
||||
p := &ListProjectsParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
|
||||
p.p["id"] = id
|
||||
|
||||
for _, fn := range opts {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return nil, -1, err
|
||||
}
|
||||
}
|
||||
|
||||
l, err := s.ListProjects(p)
|
||||
if err != nil {
|
||||
if strings.Contains(err.Error(), fmt.Sprintf(
|
||||
@@ -1098,12 +1110,18 @@ func (s *ProjectService) NewListProjectInvitationsParams() *ListProjectInvitatio
|
||||
}
|
||||
|
||||
// This is a courtesy helper function, which in some cases may not work as expected!
|
||||
func (s *ProjectService) GetProjectInvitationByID(id string) (*ProjectInvitation, int, error) {
|
||||
func (s *ProjectService) GetProjectInvitationByID(id string, opts ...OptionFunc) (*ProjectInvitation, int, error) {
|
||||
p := &ListProjectInvitationsParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
|
||||
p.p["id"] = id
|
||||
|
||||
for _, fn := range opts {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return nil, -1, err
|
||||
}
|
||||
}
|
||||
|
||||
l, err := s.ListProjectInvitations(p)
|
||||
if err != nil {
|
||||
if strings.Contains(err.Error(), fmt.Sprintf(
|
||||
@@ -1114,21 +1132,6 @@ func (s *ProjectService) GetProjectInvitationByID(id string) (*ProjectInvitation
|
||||
return nil, -1, err
|
||||
}
|
||||
|
||||
if l.Count == 0 {
|
||||
// If no matches, search all projects
|
||||
p.p["projectid"] = "-1"
|
||||
|
||||
l, err = s.ListProjectInvitations(p)
|
||||
if err != nil {
|
||||
if strings.Contains(err.Error(), fmt.Sprintf(
|
||||
"Invalid parameter id value=%s due to incorrect long value format, "+
|
||||
"or entity does not exist", id)) {
|
||||
return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l)
|
||||
}
|
||||
return nil, -1, err
|
||||
}
|
||||
}
|
||||
|
||||
if l.Count == 0 {
|
||||
return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user