github.com/LukasHeimann/cloudfoundrycli@v7.1.0+incompatible/api/cloudcontroller/ccv3/relationship.go (about)

     1  package ccv3
     2  
     3  import (
     4  	"code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal"
     5  	"code.cloudfoundry.org/cli/resources"
     6  )
     7  
     8  // DeleteIsolationSegmentOrganization will delete the relationship between
     9  // the isolation segment and the organization provided.
    10  func (client *Client) DeleteIsolationSegmentOrganization(isolationSegmentGUID string, orgGUID string) (Warnings, error) {
    11  	_, warnings, err := client.MakeRequest(RequestParams{
    12  		RequestName: internal.DeleteIsolationSegmentRelationshipOrganizationRequest,
    13  		URIParams:   internal.Params{"isolation_segment_guid": isolationSegmentGUID, "organization_guid": orgGUID},
    14  	})
    15  
    16  	return warnings, err
    17  }
    18  
    19  // DeleteServiceInstanceRelationshipsSharedSpace will delete the sharing relationship
    20  // between the service instance and the shared-to space provided.
    21  func (client *Client) DeleteServiceInstanceRelationshipsSharedSpace(serviceInstanceGUID string, spaceGUID string) (Warnings, error) {
    22  	_, warnings, err := client.MakeRequest(RequestParams{
    23  		RequestName: internal.DeleteServiceInstanceRelationshipsSharedSpaceRequest,
    24  		URIParams:   internal.Params{"service_instance_guid": serviceInstanceGUID, "space_guid": spaceGUID},
    25  	})
    26  
    27  	return warnings, err
    28  }
    29  
    30  // GetOrganizationDefaultIsolationSegment returns the relationship between an
    31  // organization and it's default isolation segment.
    32  func (client *Client) GetOrganizationDefaultIsolationSegment(orgGUID string) (resources.Relationship, Warnings, error) {
    33  	var responseBody resources.Relationship
    34  
    35  	_, warnings, err := client.MakeRequest(RequestParams{
    36  		RequestName:  internal.GetOrganizationRelationshipDefaultIsolationSegmentRequest,
    37  		URIParams:    internal.Params{"organization_guid": orgGUID},
    38  		ResponseBody: &responseBody,
    39  	})
    40  
    41  	return responseBody, warnings, err
    42  }
    43  
    44  // GetSpaceIsolationSegment returns the relationship between a space and it's
    45  // isolation segment.
    46  func (client *Client) GetSpaceIsolationSegment(spaceGUID string) (resources.Relationship, Warnings, error) {
    47  	var responseBody resources.Relationship
    48  
    49  	_, warnings, err := client.MakeRequest(RequestParams{
    50  		RequestName:  internal.GetSpaceRelationshipIsolationSegmentRequest,
    51  		URIParams:    internal.Params{"space_guid": spaceGUID},
    52  		ResponseBody: &responseBody,
    53  	})
    54  
    55  	return responseBody, warnings, err
    56  }
    57  
    58  // SetApplicationDroplet sets the specified droplet on the given application.
    59  func (client *Client) SetApplicationDroplet(appGUID string, dropletGUID string) (resources.Relationship, Warnings, error) {
    60  	var responseBody resources.Relationship
    61  
    62  	_, warnings, err := client.MakeRequest(RequestParams{
    63  		RequestName:  internal.PatchApplicationCurrentDropletRequest,
    64  		URIParams:    internal.Params{"app_guid": appGUID},
    65  		RequestBody:  resources.Relationship{GUID: dropletGUID},
    66  		ResponseBody: &responseBody,
    67  	})
    68  
    69  	return responseBody, warnings, err
    70  }
    71  
    72  // UpdateOrganizationDefaultIsolationSegmentRelationship sets the default isolation segment
    73  // for an organization on the controller.
    74  // If isoSegGuid is empty it will reset the default isolation segment.
    75  func (client *Client) UpdateOrganizationDefaultIsolationSegmentRelationship(orgGUID string, isoSegGUID string) (resources.Relationship, Warnings, error) {
    76  	var responseBody resources.Relationship
    77  
    78  	_, warnings, err := client.MakeRequest(RequestParams{
    79  		RequestName:  internal.PatchOrganizationRelationshipDefaultIsolationSegmentRequest,
    80  		URIParams:    internal.Params{"organization_guid": orgGUID},
    81  		RequestBody:  resources.Relationship{GUID: isoSegGUID},
    82  		ResponseBody: &responseBody,
    83  	})
    84  
    85  	return responseBody, warnings, err
    86  }
    87  
    88  // UpdateSpaceIsolationSegmentRelationship assigns an isolation segment to a space and
    89  // returns the relationship.
    90  func (client *Client) UpdateSpaceIsolationSegmentRelationship(spaceGUID string, isolationSegmentGUID string) (resources.Relationship, Warnings, error) {
    91  	var responseBody resources.Relationship
    92  
    93  	_, warnings, err := client.MakeRequest(RequestParams{
    94  		RequestName:  internal.PatchSpaceRelationshipIsolationSegmentRequest,
    95  		URIParams:    internal.Params{"space_guid": spaceGUID},
    96  		RequestBody:  resources.Relationship{GUID: isolationSegmentGUID},
    97  		ResponseBody: &responseBody,
    98  	})
    99  
   100  	return responseBody, warnings, err
   101  }