github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/api/cloudcontroller/ccv2/codetemplates/delete_async_by_guid.go.template (about)

     1  package ccv2
     2  
     3  import (
     4  	"net/url"
     5  
     6  	"code.cloudfoundry.org/cli/api/cloudcontroller"
     7  	"code.cloudfoundry.org/cli/api/cloudcontroller/ccv2/internal"
     8  )
     9  
    10  // Delete{{.EntityName}} deletes the {{.EntityName}} associated with the provided
    11  // GUID. It will return the Cloud Controller job that is assigned to the
    12  // {{.EntityName}} deletion.
    13  func (client *Client) Delete{{.EntityName}}(guid string) (Job, Warnings, error) {
    14  	request, err := client.newHTTPRequest(requestOptions{
    15  		RequestName: internal.Delete{{.EntityName}}Request,
    16  		URIParams:   Params{"{{.EntityNameSnake}}_guid": guid},
    17  		Query: url.Values{
    18  			"recursive": {"true"},
    19  			"async":     {"true"},
    20  		},
    21  	})
    22  	if err != nil {
    23  		return Job{}, nil, err
    24  	}
    25  
    26  	var job Job
    27  	response := cloudcontroller.Response{
    28  		Result: &job,
    29  	}
    30  
    31  	err = client.connection.Make(request, &response)
    32  	return job, response.Warnings, err
    33  }