space/spaces.go
func (m *DefaultManager) FindSpace(orgName, spaceName string) (cfclient.Space, error) {
	orgGUID, err := m.OrgMgr.GetOrgGUID(orgName)
	if err != nil {
		return cfclient.Space{}, err
	}
	spaces, err := m.ListSpaces(orgGUID)
	if err != nil {
		return cfclient.Space{}, err
	}
	for _, theSpace := range spaces {
		if theSpace.Name == spaceName {
			return theSpace, nil
		}
	}
	if m.Peek {
		return cfclient.Space{
			Name:             spaceName,
			Guid:             fmt.Sprintf("%s-dry-run-space-guid", spaceName),
			OrganizationGuid: fmt.Sprintf("%s-dry-run-org-guid", orgName),
		}, nil
	}
	return cfclient.Space{}, fmt.Errorf("space [%s] not found in org [%s]", spaceName, orgName)
}
func (m *DefaultManager) FindSpace(orgName, spaceName string) (cfclient.Space, error) {
	orgGUID, err := m.OrgMgr.GetOrgGUID(orgName)
	if err != nil {
		return cfclient.Space{}, err
	}
	spaces, err := m.ListSpaces(orgGUID)
	if err != nil {
		return cfclient.Space{}, err
	}
	for _, theSpace := range spaces {
		if theSpace.Name == spaceName {
			return theSpace, nil
		}
	}
	if m.Peek {
		return cfclient.Space{
			Name:             spaceName,
			Guid:             fmt.Sprintf("%s-dry-run-space-guid", spaceName),
			OrganizationGuid: fmt.Sprintf("%s-dry-run-org-guid", orgName),
		}, nil
	}
	return cfclient.Space{}, fmt.Errorf("space [%s] not found in org [%s]", spaceName, orgName)
}
func ( m * DefaultManager ) FindSpace ( orgName , spaceName string ) ( cfclient . Space , error ) { orgGUID , err := m . OrgMgr . GetOrgGUID ( orgName ) if err != nil { return cfclient . Space { } , err } spaces , err := m . ListSpaces ( orgGUID ) if err != nil { return cfclient . Space { } , err } for _ , theSpace := range spaces { if theSpace . Name == spaceName { return theSpace , nil } } if m . Peek { return cfclient . Space { Name : spaceName , Guid : fmt . Sprintf ( " " , spaceName ) , OrganizationGuid : fmt . Sprintf ( " " , orgName ) , } , nil } return cfclient . Space { } , fmt . Errorf ( " " , spaceName , orgName ) }
//FindSpace -
FindSpace -