github.com/sleungcy-sap/cli@v7.1.0+incompatible/api/cloudcontroller/ccv2/service_instance_shared_from.go (about)

     1  package ccv2
     2  
     3  import (
     4  	"code.cloudfoundry.org/cli/api/cloudcontroller"
     5  	"code.cloudfoundry.org/cli/api/cloudcontroller/ccv2/internal"
     6  )
     7  
     8  // ServiceInstanceSharedFrom represents a Cloud Controller relationship object
     9  // that describes a service instance in another space (and possibly org) that
    10  // this service instance is **shared from**.
    11  type ServiceInstanceSharedFrom struct {
    12  	// SpaceGUID is the unique identifier of the space that this service is
    13  	// shared from.
    14  	SpaceGUID string `json:"space_guid"`
    15  
    16  	// SpaceName is the name of the space that this service is shared from.
    17  	SpaceName string `json:"space_name"`
    18  
    19  	// OrganizationName is the name of the organization that this service is
    20  	// shared from.
    21  	OrganizationName string `json:"organization_name"`
    22  }
    23  
    24  // GetServiceInstanceSharedFrom returns back a ServiceInstanceSharedFrom
    25  // object.
    26  func (client *Client) GetServiceInstanceSharedFrom(serviceInstanceGUID string) (ServiceInstanceSharedFrom, Warnings, error) {
    27  	request, err := client.newHTTPRequest(requestOptions{
    28  		RequestName: internal.GetServiceInstanceSharedFromRequest,
    29  		URIParams:   Params{"service_instance_guid": serviceInstanceGUID},
    30  	})
    31  	if err != nil {
    32  		return ServiceInstanceSharedFrom{}, nil, err
    33  	}
    34  
    35  	var serviceInstanceSharedFrom ServiceInstanceSharedFrom
    36  	response := cloudcontroller.Response{
    37  		DecodeJSONResponseInto: &serviceInstanceSharedFrom,
    38  	}
    39  
    40  	err = client.connection.Make(request, &response)
    41  	return serviceInstanceSharedFrom, response.Warnings, err
    42  }