github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+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 is the struct representation of a share_from
     9  // object in Cloud Controller.
    10  type ServiceInstanceSharedFrom struct {
    11  	SpaceGUID        string `json:"space_guid"`
    12  	SpaceName        string `json:"space_name"`
    13  	OrganizationName string `json:"organization_name"`
    14  }
    15  
    16  // GetServiceInstanceSharedFrom returns back a ServiceInstanceSharedFrom
    17  // object.
    18  func (client *Client) GetServiceInstanceSharedFrom(serviceInstanceGUID string) (ServiceInstanceSharedFrom, Warnings, error) {
    19  	request, err := client.newHTTPRequest(requestOptions{
    20  		RequestName: internal.GetServiceInstanceSharedFromRequest,
    21  		URIParams:   Params{"service_instance_guid": serviceInstanceGUID},
    22  	})
    23  	if err != nil {
    24  		return ServiceInstanceSharedFrom{}, nil, err
    25  	}
    26  
    27  	var serviceInstanceSharedFrom ServiceInstanceSharedFrom
    28  	response := cloudcontroller.Response{
    29  		Result: &serviceInstanceSharedFrom,
    30  	}
    31  
    32  	err = client.connection.Make(request, &response)
    33  	return serviceInstanceSharedFrom, response.Warnings, err
    34  }