github.com/cloudfoundry-community/cloudfoundry-cli@v6.44.1-0.20240130060226-cda5ed8e89a5+incompatible/resources/service_instance_resource.go (about)

     1  package resources
     2  
     3  import (
     4  	"code.cloudfoundry.org/cli/types"
     5  	"code.cloudfoundry.org/jsonry"
     6  )
     7  
     8  type ServiceInstanceType string
     9  
    10  const (
    11  	UserProvidedServiceInstance ServiceInstanceType = "user-provided"
    12  	ManagedServiceInstance      ServiceInstanceType = "managed"
    13  )
    14  
    15  type ServiceInstance struct {
    16  	// Type is either "user-provided" or "managed"
    17  	Type ServiceInstanceType `jsonry:"type,omitempty"`
    18  	// GUID is a unique service instance identifier.
    19  	GUID string `jsonry:"guid,omitempty"`
    20  	// Name is the name of the service instance.
    21  	Name string `jsonry:"name,omitempty"`
    22  	// SpaceGUID is the space that this service instance relates to
    23  	SpaceGUID string `jsonry:"relationships.space.data.guid,omitempty"`
    24  	// ServicePlanGUID is the service plan that this service instance relates to
    25  	ServicePlanGUID string `jsonry:"relationships.service_plan.data.guid,omitempty"`
    26  	// Tags are used by apps to identify service instances.
    27  	Tags types.OptionalStringSlice `jsonry:"tags"`
    28  	// SyslogDrainURL is where logs are streamed
    29  	SyslogDrainURL types.OptionalString `jsonry:"syslog_drain_url"`
    30  	// RouteServiceURL is where requests for bound routes will be forwarded
    31  	RouteServiceURL types.OptionalString `jsonry:"route_service_url"`
    32  	// DashboardURL is where the service can be monitored
    33  	DashboardURL types.OptionalString `jsonry:"dashboard_url"`
    34  	// Credentials are passed to the app
    35  	Credentials types.OptionalObject `jsonry:"credentials"`
    36  	// UpgradeAvailable says whether the plan is at a higher version
    37  	UpgradeAvailable types.OptionalBoolean `json:"upgrade_available"`
    38  	// MaintenanceInfoVersion is the version this service is at
    39  	MaintenanceInfoVersion string `jsonry:"maintenance_info.version,omitempty"`
    40  	// Parameters are passed to the service broker
    41  	Parameters types.OptionalObject `jsonry:"parameters"`
    42  	// LastOperation is the last operation on the service instance
    43  	LastOperation LastOperation `jsonry:"last_operation"`
    44  
    45  	Metadata *Metadata `json:"metadata,omitempty"`
    46  }
    47  
    48  func (s ServiceInstance) MarshalJSON() ([]byte, error) {
    49  	return jsonry.Marshal(s)
    50  }
    51  
    52  func (s *ServiceInstance) UnmarshalJSON(data []byte) error {
    53  	return jsonry.Unmarshal(data, s)
    54  }