github.com/cloudfoundry-community/cloudfoundry-cli@v6.44.1-0.20240130060226-cda5ed8e89a5+incompatible/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  	// Omit empty to fix errors with user-provided services
    34  	Parameters types.OptionalObject `jsonry:"parameters,omitempty"`
    35  }
    36  
    37  func (s ServiceCredentialBinding) MarshalJSON() ([]byte, error) {
    38  	return jsonry.Marshal(s)
    39  }
    40  
    41  func (s *ServiceCredentialBinding) UnmarshalJSON(data []byte) error {
    42  	return jsonry.Unmarshal(data, s)
    43  }