forked from cloudfoundry/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
domains.go
25 lines (21 loc) · 783 Bytes
/
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
package resources
import "github.com/cloudfoundry/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"`
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,
}
}