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

     1  package ccv3
     2  
     3  import (
     4  	"code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal"
     5  )
     6  
     7  // JobURL is the URL to a given Job.
     8  type JobURL string
     9  
    10  // DeleteApplication deletes the app with the given app GUID. Returns back a
    11  // resulting job URL to poll.
    12  func (client *Client) DeleteApplication(appGUID string) (JobURL, Warnings, error) {
    13  	jobURL, warnings, err := client.MakeRequest(RequestParams{
    14  		RequestName: internal.DeleteApplicationRequest,
    15  		URIParams:   internal.Params{"app_guid": appGUID},
    16  	})
    17  
    18  	return jobURL, warnings, err
    19  }
    20  
    21  // UpdateApplicationApplyManifest applies the manifest to the given
    22  // application. Returns back a resulting job URL to poll.
    23  func (client *Client) UpdateApplicationApplyManifest(appGUID string, rawManifest []byte) (JobURL, Warnings, error) {
    24  	responseLocation, warnings, err := client.MakeRequestSendRaw(
    25  		internal.PostApplicationActionApplyManifest,
    26  		internal.Params{"app_guid": appGUID},
    27  		rawManifest,
    28  		"application/x-yaml",
    29  		nil,
    30  	)
    31  
    32  	return JobURL(responseLocation), warnings, err
    33  }
    34  
    35  // UpdateSpaceApplyManifest - Is there a better name for this, since ...
    36  // -- The Space resource is not actually updated.
    37  // -- Instead what this ApplyManifest may do is to Create or Update Applications instead.
    38  
    39  // Applies the manifest to the given space. Returns back a resulting job URL to poll.
    40  
    41  // For each app specified in the manifest, the server-side handles:
    42  // (1) Finding or creating this app.
    43  // (2) Applying manifest properties to this app.
    44  
    45  func (client *Client) UpdateSpaceApplyManifest(spaceGUID string, rawManifest []byte) (JobURL, Warnings, error) {
    46  	responseLocation, warnings, err := client.MakeRequestSendRaw(
    47  		internal.PostSpaceActionApplyManifestRequest,
    48  		internal.Params{"space_guid": spaceGUID},
    49  		rawManifest,
    50  		"application/x-yaml",
    51  		nil,
    52  	)
    53  
    54  	return JobURL(responseLocation), warnings, err
    55  }