-
Notifications
You must be signed in to change notification settings - Fork 929
/
domains.go
29 lines (25 loc) · 1.01 KB
/
domains.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package resources
import "code.cloudfoundry.org/cli/cf/models"
type DomainResource struct {
Resource
Entity DomainEntity
}
type DomainEntity struct {
Name string `json:"name"`
OwningOrganizationGUID string `json:"owning_organization_guid,omitempty"`
SharedOrganizationsURL string `json:"shared_organizations_url,omitempty"`
RouterGroupGUID string `json:"router_group_guid,omitempty"`
RouterGroupType string `json:"router_group_type,omitempty"`
Wildcard bool `json:"wildcard"`
}
func (resource DomainResource) ToFields() models.DomainFields {
privateDomain := resource.Entity.SharedOrganizationsURL != "" || resource.Entity.OwningOrganizationGUID != ""
return models.DomainFields{
Name: resource.Entity.Name,
GUID: resource.Metadata.GUID,
OwningOrganizationGUID: resource.Entity.OwningOrganizationGUID,
Shared: !privateDomain,
RouterGroupGUID: resource.Entity.RouterGroupGUID,
RouterGroupType: resource.Entity.RouterGroupType,
}
}