github.com/cloudfoundry-attic/cli-with-i18n@v6.32.1-0.20171002233121-7401370d3b85+incompatible/api/cloudcontroller/ccv2/delete_organization.go (about)

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