MCPcopy Create free account
hub / github.com/cloudfoundry/cli / GetOrganizationByName

Method GetOrganizationByName

actor/v7action/organization.go:35–50  ·  view source on GitHub ↗

GetOrganizationByName returns the organization with the given name.

(name string)

Source from the content-addressed store, hash-verified

33
34// GetOrganizationByName returns the organization with the given name.
35func (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
53func (actor Actor) CreateOrganization(orgName string) (resources.Organization, Warnings, error) {

Implementers 1

FakeActorcommand/v7/v7fakes/fake_actor.go

Calls 3

OrganizationStruct · 0.92
WarningsTypeAlias · 0.70
GetOrganizationsMethod · 0.65

Tested by

no test coverage detected