github.com/wanddynosios/cli/v8@v8.7.9-0.20240221182337-1a92e3a7017f/resources/service_credential_binding_resource.go (about)

     1  package resources
     2  
     3  import (
     4  	"code.cloudfoundry.org/cli/types"
     5  	"code.cloudfoundry.org/jsonry"
     6  )
     7  
     8  type ServiceCredentialBindingType string
     9  
    10  const (
    11  	AppBinding ServiceCredentialBindingType = "app"
    12  	KeyBinding ServiceCredentialBindingType = "key"
    13  )
    14  
    15  type ServiceCredentialBinding struct {
    16  	// Type is either "app" or "key"
    17  	Type ServiceCredentialBindingType `jsonry:"type,omitempty"`
    18  	// GUID is a unique service credential binding identifier.
    19  	GUID string `jsonry:"guid,omitempty"`
    20  	// Name is the name of the service credential binding.
    21  	Name string `jsonry:"name,omitempty"`
    22  	// ServiceInstanceGUID is the service instance that this binding originates from
    23  	ServiceInstanceGUID string `jsonry:"relationships.service_instance.data.guid,omitempty"`
    24  	// AppGUID is the application that this binding is attached to
    25  	AppGUID string `jsonry:"relationships.app.data.guid,omitempty"`
    26  	// AppName is the application name. It is not part of the API response, and is here as pragmatic convenience.
    27  	AppName string `jsonry:"-"`
    28  	// AppSpaceGUID is the space guid of the app. It is not part of the API response, and is here as pragmatic convenience.
    29  	AppSpaceGUID string `jsonry:"-"`
    30  	// LastOperation is the last operation on the service credential binding
    31  	LastOperation LastOperation `jsonry:"last_operation"`
    32  	// Parameters can be specified when creating a binding
    33  	Parameters types.OptionalObject `jsonry:"parameters"`
    34  }
    35  
    36  func (s ServiceCredentialBinding) MarshalJSON() ([]byte, error) {
    37  	return jsonry.Marshal(s)
    38  }
    39  
    40  func (s *ServiceCredentialBinding) UnmarshalJSON(data []byte) error {
    41  	return jsonry.Unmarshal(data, s)
    42  }