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

Method GetOrganizationSpacesWithLabelSelector

actor/v7action/space.go:217–238  ·  view source on GitHub ↗

GetOrganizationSpacesWithLabelSelector returns a list of spaces in the specified org

(orgGUID string, labelSelector string)

Source from the content-addressed store, hash-verified

215
216// GetOrganizationSpacesWithLabelSelector returns a list of spaces in the specified org
217func (actor Actor) GetOrganizationSpacesWithLabelSelector(orgGUID string, labelSelector string) ([]resources.Space, Warnings, error) {
218
219 queries := []ccv3.Query{
220 ccv3.Query{Key: ccv3.OrganizationGUIDFilter, Values: []string{orgGUID}},
221 ccv3.Query{Key: ccv3.OrderBy, Values: []string{ccv3.NameOrder}},
222 }
223 if len(labelSelector) > 0 {
224 queries = append(queries, ccv3.Query{Key: ccv3.LabelSelectorFilter, Values: []string{labelSelector}})
225 }
226
227 ccv3Spaces, _, warnings, err := actor.CloudControllerClient.GetSpaces(queries...)
228 if err != nil {
229 return []resources.Space{}, Warnings(warnings), err
230 }
231
232 spaces := make([]resources.Space, len(ccv3Spaces))
233 for i, ccv3Space := range ccv3Spaces {
234 spaces[i] = resources.Space(ccv3Space)
235 }
236
237 return spaces, Warnings(warnings), nil
238}
239
240// GetOrganizationSpaces returns a list of spaces in the specified org
241func (actor Actor) GetOrganizationSpaces(orgGUID string) ([]resources.Space, Warnings, error) {

Callers 1

GetOrganizationSpacesMethod · 0.95

Implementers 1

FakeActorcommand/v7/v7fakes/fake_actor.go

Calls 3

SpaceStruct · 0.92
WarningsTypeAlias · 0.70
GetSpacesMethod · 0.65

Tested by

no test coverage detected