MCPcopy Index your code
hub / github.com/cloudfoundry/cli / UploadBuildpack

Method UploadBuildpack

api/cloudcontroller/ccv3/buildpack.go:66–86  ·  view source on GitHub ↗

UploadBuildpack uploads the contents of a buildpack zip to the server.

(buildpackGUID string, buildpackPath string, buildpack io.Reader, buildpackLength int64)

Source from the content-addressed store, hash-verified

64
65// UploadBuildpack uploads the contents of a buildpack zip to the server.
66func (client *Client) UploadBuildpack(buildpackGUID string, buildpackPath string, buildpack io.Reader, buildpackLength int64) (JobURL, Warnings, error) {
67
68 contentLength, err := uploads.CalculateRequestSize(buildpackLength, buildpackPath, "bits")
69 if err != nil {
70 return "", nil, err
71 }
72
73 contentType, body, writeErrors := uploads.CreateMultipartBodyAndHeader(buildpack, buildpackPath, "bits")
74
75 responseLocation, warnings, err := client.MakeRequestUploadAsync(
76 internal.PostBuildpackBitsRequest,
77 internal.Params{"buildpack_guid": buildpackGUID},
78 contentType,
79 body,
80 contentLength,
81 nil,
82 writeErrors,
83 )
84
85 return JobURL(responseLocation), warnings, err
86}

Callers

nothing calls this directly

Calls 4

CalculateRequestSizeFunction · 0.92
JobURLTypeAlias · 0.70

Tested by

no test coverage detected