Debian Codegraph @

storage/2018-03-28/blob/blobs/put_block.go

raw symbols SCIP
1 package blobsscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/
2
3 import (
4 "contextscip-go gomod github.com/golang/go/src go1.13 context/"
5 "net/httpscip-go gomod github.com/golang/go/src go1.13 `net/http`/"
6 "stringsscip-go gomod github.com/golang/go/src go1.13 strings/"
7
8 "github.com/Azure/go-autorest/autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/"
9 "github.com/Azure/go-autorest/autorest/azurescip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest/azure`/"
10 "github.com/Azure/go-autorest/autorest/validationscip-go gomod github.com/Azure/go-autorest/autorest/validation v0.3.1 `github.com/Azure/go-autorest/autorest/validation`/"
11 "github.com/tombuildsstuff/giovanni/storage/internal/endpointsscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/internal/endpoints`/"
12 )
13
14 type PutBlockInputscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/PutBlockInput# struct {
15 BlockIDscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/PutBlockInput#BlockID. string
16 Contentscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/PutBlockInput#Content. []byte
17 ContentMD5scip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/PutBlockInput#ContentMD5. *string
18 LeaseIDscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/PutBlockInput#LeaseID. *string
19 }
20
21 type PutBlockResultscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/PutBlockResult# struct {
22 autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.Responsescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/PutBlockResult#Response.
23
24 ContentMD5scip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/PutBlockResult#ContentMD5. string
25 }
26
27 // PutBlock creates a new block to be committed as part of a blob.
28 func (client Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/Client#) PutBlockscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/Client#PutBlock().(ctx contextscip-go gomod github.com/golang/go/src go1.13 context/.Contextscip-go gomod github.com/golang/go/src go1.13 context/Context#, accountName, containerName, blobName string, input PutBlockInputscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/PutBlockInput#) (result PutBlockResultscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/PutBlockResult#, err error) {
29 if accountName == "" {
30 return result, validationscip-go gomod github.com/Azure/go-autorest/autorest/validation v0.3.1 `github.com/Azure/go-autorest/autorest/validation`/.NewErrorscip-go gomod github.com/Azure/go-autorest/autorest/validation v0.3.1 `github.com/Azure/go-autorest/autorest/validation`/NewError().("blobs.Client", "PutBlock", "`accountName` cannot be an empty string.")
31 }
32 if containerName == "" {
33 return result, validationscip-go gomod github.com/Azure/go-autorest/autorest/validation v0.3.1 `github.com/Azure/go-autorest/autorest/validation`/.NewErrorscip-go gomod github.com/Azure/go-autorest/autorest/validation v0.3.1 `github.com/Azure/go-autorest/autorest/validation`/NewError().("blobs.Client", "PutBlock", "`containerName` cannot be an empty string.")
34 }
35 if stringsscip-go gomod github.com/golang/go/src go1.13 strings/.ToLowerscip-go gomod github.com/golang/go/src go1.13 strings/ToLower().(containerName) != containerName {
36 return result, validationscip-go gomod github.com/Azure/go-autorest/autorest/validation v0.3.1 `github.com/Azure/go-autorest/autorest/validation`/.NewErrorscip-go gomod github.com/Azure/go-autorest/autorest/validation v0.3.1 `github.com/Azure/go-autorest/autorest/validation`/NewError().("blobs.Client", "PutBlock", "`containerName` must be a lower-cased string.")
37 }
38 if blobName == "" {
39 return result, validationscip-go gomod github.com/Azure/go-autorest/autorest/validation v0.3.1 `github.com/Azure/go-autorest/autorest/validation`/.NewErrorscip-go gomod github.com/Azure/go-autorest/autorest/validation v0.3.1 `github.com/Azure/go-autorest/autorest/validation`/NewError().("blobs.Client", "PutBlock", "`blobName` cannot be an empty string.")
40 }
41 if input.BlockIDscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/PutBlockInput#BlockID. == "" {
42 return result, validationscip-go gomod github.com/Azure/go-autorest/autorest/validation v0.3.1 `github.com/Azure/go-autorest/autorest/validation`/.NewErrorscip-go gomod github.com/Azure/go-autorest/autorest/validation v0.3.1 `github.com/Azure/go-autorest/autorest/validation`/NewError().("blobs.Client", "PutBlock", "`input.BlockID` cannot be an empty string.")
43 }
44 if len(input.Contentscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/PutBlockInput#Content.) == 0 {
45 return result, validationscip-go gomod github.com/Azure/go-autorest/autorest/validation v0.3.1 `github.com/Azure/go-autorest/autorest/validation`/.NewErrorscip-go gomod github.com/Azure/go-autorest/autorest/validation v0.3.1 `github.com/Azure/go-autorest/autorest/validation`/NewError().("blobs.Client", "PutBlock", "`input.Content` cannot be empty.")
46 }
47
48 req, err := client.PutBlockPreparerscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/Client#PutBlockPreparer().(ctx, accountName, containerName, blobName, input)
49 if err != nil {
50 err = autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.NewErrorWithErrorscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/NewErrorWithError().(err, "blobs.Client", "PutBlock", nil, "Failure preparing request")
51 return
52 }
53
54 resp, err := client.PutBlockSenderscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/Client#PutBlockSender().(req)
55 if err != nil {
56 result.Responsescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/PutBlockResult#Response. = autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.Responsescip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/Response#{Responsescip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/Response#Response.: resp}
57 err = autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.NewErrorWithErrorscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/NewErrorWithError().(err, "blobs.Client", "PutBlock", resp, "Failure sending request")
58 return
59 }
60
61 result, err = client.PutBlockResponderscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/Client#PutBlockResponder().(resp)
62 if err != nil {
63 err = autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.NewErrorWithErrorscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/NewErrorWithError().(err, "blobs.Client", "PutBlock", resp, "Failure responding to request")
64 return
65 }
66
67 return
68 }
69
70 // PutBlockPreparer prepares the PutBlock request.
71 func (client Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/Client#) PutBlockPreparerscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/Client#PutBlockPreparer().(ctx contextscip-go gomod github.com/golang/go/src go1.13 context/.Contextscip-go gomod github.com/golang/go/src go1.13 context/Context#, accountName, containerName, blobName string, input PutBlockInputscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/PutBlockInput#) (*httpscip-go gomod github.com/golang/go/src go1.13 `net/http`/.Requestscip-go gomod github.com/golang/go/src go1.13 `net/http`/Request#, error) {
72 pathParameters := map[string]interface{}{
73 "containerName": autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.Encodescip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/Encode().("path", containerName),
74 "blobName": autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.Encodescip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/Encode().("path", blobName),
75 }
76
77 queryParameters := map[string]interface{}{
78 "comp": autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.Encodescip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/Encode().("query", "block"),
79 "blockid": autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.Encodescip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/Encode().("query", input.BlockIDscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/PutBlockInput#BlockID.),
80 }
81
82 headers := map[string]interface{}{
83 "x-ms-version": APIVersionscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/APIVersion.,
84 "Content-Length": int(len(input.Contentscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/PutBlockInput#Content.)),
85 }
86
87 if input.ContentMD5scip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/PutBlockInput#ContentMD5. != nil {
88 headers["x-ms-blob-content-md5"] = *input.ContentMD5scip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/PutBlockInput#ContentMD5.
89 }
90 if input.LeaseIDscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/PutBlockInput#LeaseID. != nil {
91 headers["x-ms-lease-id"] = *input.LeaseIDscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/PutBlockInput#LeaseID.
92 }
93
94 preparer := autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.CreatePreparerscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/CreatePreparer().(
95 autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.AsPutscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/AsPut().(),
96 autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.WithBaseURLscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/WithBaseURL().(endpointsscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/internal/endpoints`/.GetBlobEndpointscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/internal/endpoints`/GetBlobEndpoint().(client.BaseURIscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/Client#BaseURI., accountName)),
97 autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.WithPathParametersscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/WithPathParameters().("/{containerName}/{blobName}", pathParameters),
98 autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.WithQueryParametersscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/WithQueryParameters().(queryParameters),
99 autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.WithHeadersscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/WithHeaders().(headers),
100 autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.WithBytesscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/WithBytes().(&input.Contentscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/PutBlockInput#Content.))
101 return preparer.Preparescip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/Preparer#Prepare().((&httpscip-go gomod github.com/golang/go/src go1.13 `net/http`/.Requestscip-go gomod github.com/golang/go/src go1.13 `net/http`/Request#{}).WithContextscip-go gomod github.com/golang/go/src go1.13 `net/http`/Request#WithContext().(ctx))
102 }
103
104 // PutBlockSender sends the PutBlock request. The method will close the
105 // http.Response Body if it receives an error.
106 func (client Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/Client#) PutBlockSenderscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/Client#PutBlockSender().(req *httpscip-go gomod github.com/golang/go/src go1.13 `net/http`/.Requestscip-go gomod github.com/golang/go/src go1.13 `net/http`/Request#) (*httpscip-go gomod github.com/golang/go/src go1.13 `net/http`/.Responsescip-go gomod github.com/golang/go/src go1.13 `net/http`/Response#, error) {
107 return autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.SendWithSenderscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/SendWithSender().(client, req,
108 azurescip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest/azure`/.DoRetryWithRegistrationscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest/azure`/DoRetryWithRegistration().(client.Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/Client#Client.))
109 }
110
111 // PutBlockResponder handles the response to the PutBlock request. The method always
112 // closes the http.Response Body.
113 func (client Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/Client#) PutBlockResponderscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/Client#PutBlockResponder().(resp *httpscip-go gomod github.com/golang/go/src go1.13 `net/http`/.Responsescip-go gomod github.com/golang/go/src go1.13 `net/http`/Response#) (result PutBlockResultscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/PutBlockResult#, err error) {
114 if resp != nil && resp.Headerscip-go gomod github.com/golang/go/src go1.13 `net/http`/Response#Header. != nil {
115 result.ContentMD5scip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/PutBlockResult#ContentMD5. = resp.Headerscip-go gomod github.com/golang/go/src go1.13 `net/http`/Response#Header..Getscip-go gomod github.com/golang/go/src go1.13 `net/http`/Header#Get().("Content-MD5")
116 }
117
118 err = autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.Respondscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/Respond().(
119 resp,
120 client.ByInspectingscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/Client#ByInspecting().(),
121 azurescip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest/azure`/.WithErrorUnlessStatusCodescip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest/azure`/WithErrorUnlessStatusCode().(httpscip-go gomod github.com/golang/go/src go1.13 `net/http`/.StatusCreatedscip-go gomod github.com/golang/go/src go1.13 `net/http`/StatusCreated.),
122 autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.ByClosingscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/ByClosing().())
123 result.Responsescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-03-28/blob/blobs`/PutBlockResult#Response. = autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.Responsescip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/Response#{Responsescip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/Response#Response.: resp}
124
125 return
126 }