github.com/Thanhphan1147/cloudfoundry-cli@v7.1.0+incompatible/resources/service_plan_visibility_resource.go (about) 1 package resources 2 3 import ( 4 "code.cloudfoundry.org/jsonry" 5 ) 6 7 type ServicePlanVisibilityType string 8 9 const ( 10 ServicePlanVisibilityPublic ServicePlanVisibilityType = "public" 11 ServicePlanVisibilityOrganization ServicePlanVisibilityType = "organization" 12 ServicePlanVisibilitySpace ServicePlanVisibilityType = "space" 13 ServicePlanVisibilityAdmin ServicePlanVisibilityType = "admin" 14 ) 15 16 type ServicePlanVisibilityDetail struct { 17 // Name is the organization name 18 Name string `json:"name,omitempty"` 19 // GUID of the organization 20 GUID string `json:"guid"` 21 } 22 23 func (s ServicePlanVisibilityDetail) OmitJSONry() bool { 24 return s == ServicePlanVisibilityDetail{} 25 } 26 27 // ServicePlanVisibility represents a Cloud Controller V3 Service Plan Visibility. 28 type ServicePlanVisibility struct { 29 // Type is one of 'public', 'organization', 'space' or 'admin' 30 Type ServicePlanVisibilityType `json:"type"` 31 32 // Organizations list of organizations for the service plan 33 Organizations []ServicePlanVisibilityDetail `json:"organizations,omitempty"` 34 35 // Space that the plan is visible in 36 Space ServicePlanVisibilityDetail `json:"space"` 37 } 38 39 func (s *ServicePlanVisibility) UnmarshalJSON(data []byte) error { 40 return jsonry.Unmarshal(data, s) 41 } 42 43 func (s ServicePlanVisibility) MarshalJSON() ([]byte, error) { 44 return jsonry.Marshal(s) 45 }