GetOrganizationByName returns the organization with the given name.
(name string)
| 33 | |
| 34 | // GetOrganizationByName returns the organization with the given name. |
| 35 | func (actor Actor) GetOrganizationByName(name string) (resources.Organization, Warnings, error) { |
| 36 | orgs, warnings, err := actor.CloudControllerClient.GetOrganizations( |
| 37 | ccv3.Query{Key: ccv3.NameFilter, Values: []string{name}}, |
| 38 | ccv3.Query{Key: ccv3.PerPage, Values: []string{"1"}}, |
| 39 | ccv3.Query{Key: ccv3.Page, Values: []string{"1"}}, |
| 40 | ) |
| 41 | if err != nil { |
| 42 | return resources.Organization{}, Warnings(warnings), err |
| 43 | } |
| 44 | |
| 45 | if len(orgs) == 0 { |
| 46 | return resources.Organization{}, Warnings(warnings), actionerror.OrganizationNotFoundError{Name: name} |
| 47 | } |
| 48 | |
| 49 | return resources.Organization(orgs[0]), Warnings(warnings), nil |
| 50 | } |
| 51 | |
| 52 | // CreateOrganization creates a new organization with the given name |
| 53 | func (actor Actor) CreateOrganization(orgName string) (resources.Organization, Warnings, error) { |
no test coverage detected