forked from cloudfoundry/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathservice_plan_visibility_resource.go
45 lines (35 loc) · 1.3 KB
/
service_plan_visibility_resource.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package resources
import (
"code.cloudfoundry.org/jsonry"
)
type ServicePlanVisibilityType string
const (
ServicePlanVisibilityPublic ServicePlanVisibilityType = "public"
ServicePlanVisibilityOrganization ServicePlanVisibilityType = "organization"
ServicePlanVisibilitySpace ServicePlanVisibilityType = "space"
ServicePlanVisibilityAdmin ServicePlanVisibilityType = "admin"
)
type ServicePlanVisibilityDetail struct {
// Name is the organization name
Name string `json:"name,omitempty"`
// GUID of the organization
GUID string `json:"guid"`
}
func (s ServicePlanVisibilityDetail) OmitJSONry() bool {
return s == ServicePlanVisibilityDetail{}
}
// ServicePlanVisibility represents a Cloud Controller V3 Service Plan Visibility.
type ServicePlanVisibility struct {
// Type is one of 'public', 'organization', 'space' or 'admin'
Type ServicePlanVisibilityType `json:"type"`
// Organizations list of organizations for the service plan
Organizations []ServicePlanVisibilityDetail `json:"organizations,omitempty"`
// Space that the plan is visible in
Space ServicePlanVisibilityDetail `json:"space"`
}
func (s *ServicePlanVisibility) UnmarshalJSON(data []byte) error {
return jsonry.Unmarshal(data, s)
}
func (s ServicePlanVisibility) MarshalJSON() ([]byte, error) {
return jsonry.Marshal(s)
}