| 1 | package blobsscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/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 ChangeLeaseInputscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/blobs`/ChangeLeaseInput# struct { |
| 15 | ExistingLeaseIDscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/blobs`/ChangeLeaseInput#ExistingLeaseID. string |
| 16 | ProposedLeaseIDscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/blobs`/ChangeLeaseInput#ProposedLeaseID. string |
| 17 | } |
| 18 | |
| 19 | type ChangeLeaseResponsescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/blobs`/ChangeLeaseResponse# struct { |
| 20 | 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-11-09/blob/blobs`/ChangeLeaseResponse#Response. |
| 21 | |
| 22 | LeaseIDscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/blobs`/ChangeLeaseResponse#LeaseID. string |
| 23 | } |
| 24 | |
| 25 | // ChangeLease changes an existing lock on a blob for another lock. |
| 26 | func (client Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/blobs`/Client#) ChangeLeasescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/blobs`/Client#ChangeLease().(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 ChangeLeaseInputscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/blobs`/ChangeLeaseInput#) (result ChangeLeaseResponsescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/blobs`/ChangeLeaseResponse#, err error) { |
| 27 | if accountName == "" { |
| 28 | 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", "ChangeLease", "`accountName` cannot be an empty string.") |
| 29 | } |
| 30 | if containerName == "" { |
| 31 | 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", "ChangeLease", "`containerName` cannot be an empty string.") |
| 32 | } |
| 33 | 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 { |
| 34 | 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", "ChangeLease", "`containerName` must be a lower-cased string.") |
| 35 | } |
| 36 | if blobName == "" { |
| 37 | 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", "ChangeLease", "`blobName` cannot be an empty string.") |
| 38 | } |
| 39 | if input.ExistingLeaseIDscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/blobs`/ChangeLeaseInput#ExistingLeaseID. == "" { |
| 40 | 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", "ChangeLease", "`input.ExistingLeaseID` cannot be an empty string.") |
| 41 | } |
| 42 | if input.ProposedLeaseIDscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/blobs`/ChangeLeaseInput#ProposedLeaseID. == "" { |
| 43 | 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", "ChangeLease", "`input.ProposedLeaseID` cannot be an empty string.") |
| 44 | } |
| 45 | |
| 46 | req, err := client.ChangeLeasePreparerscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/blobs`/Client#ChangeLeasePreparer().(ctx, accountName, containerName, blobName, input) |
| 47 | if err != nil { |
| 48 | 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", "ChangeLease", nil, "Failure preparing request") |
| 49 | return |
| 50 | } |
| 51 | |
| 52 | resp, err := client.ChangeLeaseSenderscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/blobs`/Client#ChangeLeaseSender().(req) |
| 53 | if err != nil { |
| 54 | result.Responsescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/blobs`/ChangeLeaseResponse#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} |
| 55 | 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", "ChangeLease", resp, "Failure sending request") |
| 56 | return |
| 57 | } |
| 58 | |
| 59 | result, err = client.ChangeLeaseResponderscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/blobs`/Client#ChangeLeaseResponder().(resp) |
| 60 | if err != nil { |
| 61 | 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", "ChangeLease", resp, "Failure responding to request") |
| 62 | return |
| 63 | } |
| 64 | |
| 65 | return |
| 66 | } |
| 67 | |
| 68 | // ChangeLeasePreparer prepares the ChangeLease request. |
| 69 | func (client Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/blobs`/Client#) ChangeLeasePreparerscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/blobs`/Client#ChangeLeasePreparer().(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 ChangeLeaseInputscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/blobs`/ChangeLeaseInput#) (*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) { |
| 70 | pathParameters := map[string]interface{}{ |
| 71 | "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), |
| 72 | "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), |
| 73 | } |
| 74 | |
| 75 | queryParameters := map[string]interface{}{ |
| 76 | "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", "lease"), |
| 77 | } |
| 78 | |
| 79 | headers := map[string]interface{}{ |
| 80 | "x-ms-version": APIVersionscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/blobs`/APIVersion., |
| 81 | "x-ms-lease-action": "change", |
| 82 | "x-ms-lease-id": input.ExistingLeaseIDscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/blobs`/ChangeLeaseInput#ExistingLeaseID., |
| 83 | "x-ms-proposed-lease-id": input.ProposedLeaseIDscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/blobs`/ChangeLeaseInput#ProposedLeaseID., |
| 84 | } |
| 85 | |
| 86 | 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().( |
| 87 | 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().(), |
| 88 | 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-11-09/blob/blobs`/Client#BaseURI., accountName)), |
| 89 | 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), |
| 90 | 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), |
| 91 | 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)) |
| 92 | 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)) |
| 93 | } |
| 94 | |
| 95 | // ChangeLeaseSender sends the ChangeLease request. The method will close the |
| 96 | // http.Response Body if it receives an error. |
| 97 | func (client Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/blobs`/Client#) ChangeLeaseSenderscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/blobs`/Client#ChangeLeaseSender().(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) { |
| 98 | 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, |
| 99 | 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-11-09/blob/blobs`/Client#Client.)) |
| 100 | } |
| 101 | |
| 102 | // ChangeLeaseResponder handles the response to the ChangeLease request. The method always |
| 103 | // closes the http.Response Body. |
| 104 | func (client Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/blobs`/Client#) ChangeLeaseResponderscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/blobs`/Client#ChangeLeaseResponder().(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 ChangeLeaseResponsescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/blobs`/ChangeLeaseResponse#, err error) { |
| 105 | if resp != nil && resp.Headerscip-go gomod github.com/golang/go/src go1.13 `net/http`/Response#Header. != nil { |
| 106 | result.LeaseIDscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/blobs`/ChangeLeaseResponse#LeaseID. = 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().("x-ms-lease-id") |
| 107 | } |
| 108 | |
| 109 | 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().( |
| 110 | resp, |
| 111 | client.ByInspectingscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/Client#ByInspecting().(), |
| 112 | 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`/.StatusOKscip-go gomod github.com/golang/go/src go1.13 `net/http`/StatusOK.), |
| 113 | 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().()) |
| 114 | result.Responsescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/blobs`/ChangeLeaseResponse#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} |
| 115 | |
| 116 | return |
| 117 | } |