github.com/mook-as/cf-cli@v7.0.0-beta.28.0.20200120190804-b91c115fae48+incompatible/cf/api/resources/domains.go (about)

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