aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/Azure/azure-storage-blob-go/2018-03-28/azblob/zz_generated_container.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/Azure/azure-storage-blob-go/2018-03-28/azblob/zz_generated_container.go')
-rw-r--r--vendor/github.com/Azure/azure-storage-blob-go/2018-03-28/azblob/zz_generated_container.go1006
1 files changed, 1006 insertions, 0 deletions
diff --git a/vendor/github.com/Azure/azure-storage-blob-go/2018-03-28/azblob/zz_generated_container.go b/vendor/github.com/Azure/azure-storage-blob-go/2018-03-28/azblob/zz_generated_container.go
new file mode 100644
index 000000000..3e744fcbe
--- /dev/null
+++ b/vendor/github.com/Azure/azure-storage-blob-go/2018-03-28/azblob/zz_generated_container.go
@@ -0,0 +1,1006 @@
+package azblob
+
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+import (
+ "bytes"
+ "context"
+ "encoding/xml"
+ "io"
+ "io/ioutil"
+ "net/http"
+ "net/url"
+ "strconv"
+ "time"
+
+ "github.com/Azure/azure-pipeline-go/pipeline"
+)
+
+// containerClient is the client for the Container methods of the Azblob service.
+type containerClient struct {
+ managementClient
+}
+
+// newContainerClient creates an instance of the containerClient client.
+func newContainerClient(url url.URL, p pipeline.Pipeline) containerClient {
+ return containerClient{newManagementClient(url, p)}
+}
+
+// AcquireLease [Update] establishes and manages a lock on a container for delete operations. The lock duration can be
+// 15 to 60 seconds, or can be infinite
+//
+// timeout is the timeout parameter is expressed in seconds. For more information, see <a
+// href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting
+// Timeouts for Blob Service Operations.</a> duration is specifies the duration of the lease, in seconds, or negative
+// one (-1) for a lease that never expires. A non-infinite lease can be between 15 and 60 seconds. A lease duration
+// cannot be changed using renew or change. proposedLeaseID is proposed lease ID, in a GUID string format. The Blob
+// service returns 400 (Invalid request) if the proposed lease ID is not in the correct format. See Guid Constructor
+// (String) for a list of valid GUID string formats. ifModifiedSince is specify this header value to operate only on a
+// blob if it has been modified since the specified date/time. ifUnmodifiedSince is specify this header value to
+// operate only on a blob if it has not been modified since the specified date/time. requestID is provides a
+// client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage
+// analytics logging is enabled.
+func (client containerClient) AcquireLease(ctx context.Context, timeout *int32, duration *int32, proposedLeaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, requestID *string) (*ContainerAcquireLeaseResponse, error) {
+ if err := validate([]validation{
+ {targetValue: timeout,
+ constraints: []constraint{{target: "timeout", name: null, rule: false,
+ chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil {
+ return nil, err
+ }
+ req, err := client.acquireLeasePreparer(timeout, duration, proposedLeaseID, ifModifiedSince, ifUnmodifiedSince, requestID)
+ if err != nil {
+ return nil, err
+ }
+ resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.acquireLeaseResponder}, req)
+ if err != nil {
+ return nil, err
+ }
+ return resp.(*ContainerAcquireLeaseResponse), err
+}
+
+// acquireLeasePreparer prepares the AcquireLease request.
+func (client containerClient) acquireLeasePreparer(timeout *int32, duration *int32, proposedLeaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, requestID *string) (pipeline.Request, error) {
+ req, err := pipeline.NewRequest("PUT", client.url, nil)
+ if err != nil {
+ return req, pipeline.NewError(err, "failed to create request")
+ }
+ params := req.URL.Query()
+ if timeout != nil {
+ params.Set("timeout", strconv.FormatInt(int64(*timeout), 10))
+ }
+ params.Set("comp", "lease")
+ params.Set("restype", "container")
+ req.URL.RawQuery = params.Encode()
+ if duration != nil {
+ req.Header.Set("x-ms-lease-duration", strconv.FormatInt(int64(*duration), 10))
+ }
+ if proposedLeaseID != nil {
+ req.Header.Set("x-ms-proposed-lease-id", *proposedLeaseID)
+ }
+ if ifModifiedSince != nil {
+ req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123))
+ }
+ if ifUnmodifiedSince != nil {
+ req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123))
+ }
+ req.Header.Set("x-ms-version", ServiceVersion)
+ if requestID != nil {
+ req.Header.Set("x-ms-client-request-id", *requestID)
+ }
+ req.Header.Set("x-ms-lease-action", "acquire")
+ return req, nil
+}
+
+// acquireLeaseResponder handles the response to the AcquireLease request.
+func (client containerClient) acquireLeaseResponder(resp pipeline.Response) (pipeline.Response, error) {
+ err := validateResponse(resp, http.StatusOK, http.StatusCreated)
+ if resp == nil {
+ return nil, err
+ }
+ io.Copy(ioutil.Discard, resp.Response().Body)
+ resp.Response().Body.Close()
+ return &ContainerAcquireLeaseResponse{rawResponse: resp.Response()}, err
+}
+
+// BreakLease [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15
+// to 60 seconds, or can be infinite
+//
+// timeout is the timeout parameter is expressed in seconds. For more information, see <a
+// href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting
+// Timeouts for Blob Service Operations.</a> breakPeriod is for a break operation, proposed duration the lease should
+// continue before it is broken, in seconds, between 0 and 60. This break period is only used if it is shorter than the
+// time remaining on the lease. If longer, the time remaining on the lease is used. A new lease will not be available
+// before the break period has expired, but the lease may be held for longer than the break period. If this header does
+// not appear with a break operation, a fixed-duration lease breaks after the remaining lease period elapses, and an
+// infinite lease breaks immediately. ifModifiedSince is specify this header value to operate only on a blob if it has
+// been modified since the specified date/time. ifUnmodifiedSince is specify this header value to operate only on a
+// blob if it has not been modified since the specified date/time. requestID is provides a client-generated, opaque
+// value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled.
+func (client containerClient) BreakLease(ctx context.Context, timeout *int32, breakPeriod *int32, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, requestID *string) (*ContainerBreakLeaseResponse, error) {
+ if err := validate([]validation{
+ {targetValue: timeout,
+ constraints: []constraint{{target: "timeout", name: null, rule: false,
+ chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil {
+ return nil, err
+ }
+ req, err := client.breakLeasePreparer(timeout, breakPeriod, ifModifiedSince, ifUnmodifiedSince, requestID)
+ if err != nil {
+ return nil, err
+ }
+ resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.breakLeaseResponder}, req)
+ if err != nil {
+ return nil, err
+ }
+ return resp.(*ContainerBreakLeaseResponse), err
+}
+
+// breakLeasePreparer prepares the BreakLease request.
+func (client containerClient) breakLeasePreparer(timeout *int32, breakPeriod *int32, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, requestID *string) (pipeline.Request, error) {
+ req, err := pipeline.NewRequest("PUT", client.url, nil)
+ if err != nil {
+ return req, pipeline.NewError(err, "failed to create request")
+ }
+ params := req.URL.Query()
+ if timeout != nil {
+ params.Set("timeout", strconv.FormatInt(int64(*timeout), 10))
+ }
+ params.Set("comp", "lease")
+ params.Set("restype", "container")
+ req.URL.RawQuery = params.Encode()
+ if breakPeriod != nil {
+ req.Header.Set("x-ms-lease-break-period", strconv.FormatInt(int64(*breakPeriod), 10))
+ }
+ if ifModifiedSince != nil {
+ req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123))
+ }
+ if ifUnmodifiedSince != nil {
+ req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123))
+ }
+ req.Header.Set("x-ms-version", ServiceVersion)
+ if requestID != nil {
+ req.Header.Set("x-ms-client-request-id", *requestID)
+ }
+ req.Header.Set("x-ms-lease-action", "break")
+ return req, nil
+}
+
+// breakLeaseResponder handles the response to the BreakLease request.
+func (client containerClient) breakLeaseResponder(resp pipeline.Response) (pipeline.Response, error) {
+ err := validateResponse(resp, http.StatusOK, http.StatusAccepted)
+ if resp == nil {
+ return nil, err
+ }
+ io.Copy(ioutil.Discard, resp.Response().Body)
+ resp.Response().Body.Close()
+ return &ContainerBreakLeaseResponse{rawResponse: resp.Response()}, err
+}
+
+// ChangeLease [Update] establishes and manages a lock on a container for delete operations. The lock duration can be
+// 15 to 60 seconds, or can be infinite
+//
+// leaseID is if specified, the operation only succeeds if the container's lease is active and matches this ID.
+// proposedLeaseID is proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) if the
+// proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID string
+// formats. timeout is the timeout parameter is expressed in seconds. For more information, see <a
+// href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting
+// Timeouts for Blob Service Operations.</a> ifModifiedSince is specify this header value to operate only on a blob if
+// it has been modified since the specified date/time. ifUnmodifiedSince is specify this header value to operate only
+// on a blob if it has not been modified since the specified date/time. requestID is provides a client-generated,
+// opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is
+// enabled.
+func (client containerClient) ChangeLease(ctx context.Context, leaseID string, proposedLeaseID string, timeout *int32, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, requestID *string) (*ContainerChangeLeaseResponse, error) {
+ if err := validate([]validation{
+ {targetValue: timeout,
+ constraints: []constraint{{target: "timeout", name: null, rule: false,
+ chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil {
+ return nil, err
+ }
+ req, err := client.changeLeasePreparer(leaseID, proposedLeaseID, timeout, ifModifiedSince, ifUnmodifiedSince, requestID)
+ if err != nil {
+ return nil, err
+ }
+ resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.changeLeaseResponder}, req)
+ if err != nil {
+ return nil, err
+ }
+ return resp.(*ContainerChangeLeaseResponse), err
+}
+
+// changeLeasePreparer prepares the ChangeLease request.
+func (client containerClient) changeLeasePreparer(leaseID string, proposedLeaseID string, timeout *int32, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, requestID *string) (pipeline.Request, error) {
+ req, err := pipeline.NewRequest("PUT", client.url, nil)
+ if err != nil {
+ return req, pipeline.NewError(err, "failed to create request")
+ }
+ params := req.URL.Query()
+ if timeout != nil {
+ params.Set("timeout", strconv.FormatInt(int64(*timeout), 10))
+ }
+ params.Set("comp", "lease")
+ params.Set("restype", "container")
+ req.URL.RawQuery = params.Encode()
+ req.Header.Set("x-ms-lease-id", leaseID)
+ req.Header.Set("x-ms-proposed-lease-id", proposedLeaseID)
+ if ifModifiedSince != nil {
+ req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123))
+ }
+ if ifUnmodifiedSince != nil {
+ req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123))
+ }
+ req.Header.Set("x-ms-version", ServiceVersion)
+ if requestID != nil {
+ req.Header.Set("x-ms-client-request-id", *requestID)
+ }
+ req.Header.Set("x-ms-lease-action", "change")
+ return req, nil
+}
+
+// changeLeaseResponder handles the response to the ChangeLease request.
+func (client containerClient) changeLeaseResponder(resp pipeline.Response) (pipeline.Response, error) {
+ err := validateResponse(resp, http.StatusOK)
+ if resp == nil {
+ return nil, err
+ }
+ io.Copy(ioutil.Discard, resp.Response().Body)
+ resp.Response().Body.Close()
+ return &ContainerChangeLeaseResponse{rawResponse: resp.Response()}, err
+}
+
+// Create creates a new container under the specified account. If the container with the same name already exists, the
+// operation fails
+//
+// timeout is the timeout parameter is expressed in seconds. For more information, see <a
+// href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting
+// Timeouts for Blob Service Operations.</a> metadata is optional. Specifies a user-defined name-value pair associated
+// with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or
+// file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with
+// the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version
+// 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing
+// Containers, Blobs, and Metadata for more information. access is specifies whether data in the container may be
+// accessed publicly and the level of access requestID is provides a client-generated, opaque value with a 1 KB
+// character limit that is recorded in the analytics logs when storage analytics logging is enabled.
+func (client containerClient) Create(ctx context.Context, timeout *int32, metadata map[string]string, access PublicAccessType, requestID *string) (*ContainerCreateResponse, error) {
+ if err := validate([]validation{
+ {targetValue: timeout,
+ constraints: []constraint{{target: "timeout", name: null, rule: false,
+ chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}},
+ {targetValue: metadata,
+ constraints: []constraint{{target: "metadata", name: null, rule: false,
+ chain: []constraint{{target: "metadata", name: pattern, rule: `^[a-zA-Z]+$`, chain: nil}}}}}}); err != nil {
+ return nil, err
+ }
+ req, err := client.createPreparer(timeout, metadata, access, requestID)
+ if err != nil {
+ return nil, err
+ }
+ resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.createResponder}, req)
+ if err != nil {
+ return nil, err
+ }
+ return resp.(*ContainerCreateResponse), err
+}
+
+// createPreparer prepares the Create request.
+func (client containerClient) createPreparer(timeout *int32, metadata map[string]string, access PublicAccessType, requestID *string) (pipeline.Request, error) {
+ req, err := pipeline.NewRequest("PUT", client.url, nil)
+ if err != nil {
+ return req, pipeline.NewError(err, "failed to create request")
+ }
+ params := req.URL.Query()
+ if timeout != nil {
+ params.Set("timeout", strconv.FormatInt(int64(*timeout), 10))
+ }
+ params.Set("restype", "container")
+ req.URL.RawQuery = params.Encode()
+ if metadata != nil {
+ for k, v := range metadata {
+ req.Header.Set("x-ms-meta-"+k, v)
+ }
+ }
+ if access != PublicAccessNone {
+ req.Header.Set("x-ms-blob-public-access", string(access))
+ }
+ req.Header.Set("x-ms-version", ServiceVersion)
+ if requestID != nil {
+ req.Header.Set("x-ms-client-request-id", *requestID)
+ }
+ return req, nil
+}
+
+// createResponder handles the response to the Create request.
+func (client containerClient) createResponder(resp pipeline.Response) (pipeline.Response, error) {
+ err := validateResponse(resp, http.StatusOK, http.StatusCreated)
+ if resp == nil {
+ return nil, err
+ }
+ io.Copy(ioutil.Discard, resp.Response().Body)
+ resp.Response().Body.Close()
+ return &ContainerCreateResponse{rawResponse: resp.Response()}, err
+}
+
+// Delete operation marks the specified container for deletion. The container and any blobs contained within it are
+// later deleted during garbage collection
+//
+// timeout is the timeout parameter is expressed in seconds. For more information, see <a
+// href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting
+// Timeouts for Blob Service Operations.</a> leaseID is if specified, the operation only succeeds if the container's
+// lease is active and matches this ID. ifModifiedSince is specify this header value to operate only on a blob if it
+// has been modified since the specified date/time. ifUnmodifiedSince is specify this header value to operate only on a
+// blob if it has not been modified since the specified date/time. requestID is provides a client-generated, opaque
+// value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled.
+func (client containerClient) Delete(ctx context.Context, timeout *int32, leaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, requestID *string) (*ContainerDeleteResponse, error) {
+ if err := validate([]validation{
+ {targetValue: timeout,
+ constraints: []constraint{{target: "timeout", name: null, rule: false,
+ chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil {
+ return nil, err
+ }
+ req, err := client.deletePreparer(timeout, leaseID, ifModifiedSince, ifUnmodifiedSince, requestID)
+ if err != nil {
+ return nil, err
+ }
+ resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.deleteResponder}, req)
+ if err != nil {
+ return nil, err
+ }
+ return resp.(*ContainerDeleteResponse), err
+}
+
+// deletePreparer prepares the Delete request.
+func (client containerClient) deletePreparer(timeout *int32, leaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, requestID *string) (pipeline.Request, error) {
+ req, err := pipeline.NewRequest("DELETE", client.url, nil)
+ if err != nil {
+ return req, pipeline.NewError(err, "failed to create request")
+ }
+ params := req.URL.Query()
+ if timeout != nil {
+ params.Set("timeout", strconv.FormatInt(int64(*timeout), 10))
+ }
+ params.Set("restype", "container")
+ req.URL.RawQuery = params.Encode()
+ if leaseID != nil {
+ req.Header.Set("x-ms-lease-id", *leaseID)
+ }
+ if ifModifiedSince != nil {
+ req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123))
+ }
+ if ifUnmodifiedSince != nil {
+ req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123))
+ }
+ req.Header.Set("x-ms-version", ServiceVersion)
+ if requestID != nil {
+ req.Header.Set("x-ms-client-request-id", *requestID)
+ }
+ return req, nil
+}
+
+// deleteResponder handles the response to the Delete request.
+func (client containerClient) deleteResponder(resp pipeline.Response) (pipeline.Response, error) {
+ err := validateResponse(resp, http.StatusOK, http.StatusAccepted)
+ if resp == nil {
+ return nil, err
+ }
+ io.Copy(ioutil.Discard, resp.Response().Body)
+ resp.Response().Body.Close()
+ return &ContainerDeleteResponse{rawResponse: resp.Response()}, err
+}
+
+// GetAccessPolicy gets the permissions for the specified container. The permissions indicate whether container data
+// may be accessed publicly.
+//
+// timeout is the timeout parameter is expressed in seconds. For more information, see <a
+// href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting
+// Timeouts for Blob Service Operations.</a> leaseID is if specified, the operation only succeeds if the container's
+// lease is active and matches this ID. requestID is provides a client-generated, opaque value with a 1 KB character
+// limit that is recorded in the analytics logs when storage analytics logging is enabled.
+func (client containerClient) GetAccessPolicy(ctx context.Context, timeout *int32, leaseID *string, requestID *string) (*SignedIdentifiers, error) {
+ if err := validate([]validation{
+ {targetValue: timeout,
+ constraints: []constraint{{target: "timeout", name: null, rule: false,
+ chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil {
+ return nil, err
+ }
+ req, err := client.getAccessPolicyPreparer(timeout, leaseID, requestID)
+ if err != nil {
+ return nil, err
+ }
+ resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.getAccessPolicyResponder}, req)
+ if err != nil {
+ return nil, err
+ }
+ return resp.(*SignedIdentifiers), err
+}
+
+// getAccessPolicyPreparer prepares the GetAccessPolicy request.
+func (client containerClient) getAccessPolicyPreparer(timeout *int32, leaseID *string, requestID *string) (pipeline.Request, error) {
+ req, err := pipeline.NewRequest("GET", client.url, nil)
+ if err != nil {
+ return req, pipeline.NewError(err, "failed to create request")
+ }
+ params := req.URL.Query()
+ if timeout != nil {
+ params.Set("timeout", strconv.FormatInt(int64(*timeout), 10))
+ }
+ params.Set("restype", "container")
+ params.Set("comp", "acl")
+ req.URL.RawQuery = params.Encode()
+ if leaseID != nil {
+ req.Header.Set("x-ms-lease-id", *leaseID)
+ }
+ req.Header.Set("x-ms-version", ServiceVersion)
+ if requestID != nil {
+ req.Header.Set("x-ms-client-request-id", *requestID)
+ }
+ return req, nil
+}
+
+// getAccessPolicyResponder handles the response to the GetAccessPolicy request.
+func (client containerClient) getAccessPolicyResponder(resp pipeline.Response) (pipeline.Response, error) {
+ err := validateResponse(resp, http.StatusOK)
+ if resp == nil {
+ return nil, err
+ }
+ result := &SignedIdentifiers{rawResponse: resp.Response()}
+ if err != nil {
+ return result, err
+ }
+ defer resp.Response().Body.Close()
+ b, err := ioutil.ReadAll(resp.Response().Body)
+ if err != nil {
+ return result, NewResponseError(err, resp.Response(), "failed to read response body")
+ }
+ if len(b) > 0 {
+ b = removeBOM(b)
+ err = xml.Unmarshal(b, result)
+ if err != nil {
+ return result, NewResponseError(err, resp.Response(), "failed to unmarshal response body")
+ }
+ }
+ return result, nil
+}
+
+// GetProperties returns all user-defined metadata and system properties for the specified container. The data returned
+// does not include the container's list of blobs
+//
+// timeout is the timeout parameter is expressed in seconds. For more information, see <a
+// href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting
+// Timeouts for Blob Service Operations.</a> leaseID is if specified, the operation only succeeds if the container's
+// lease is active and matches this ID. requestID is provides a client-generated, opaque value with a 1 KB character
+// limit that is recorded in the analytics logs when storage analytics logging is enabled.
+func (client containerClient) GetProperties(ctx context.Context, timeout *int32, leaseID *string, requestID *string) (*ContainerGetPropertiesResponse, error) {
+ if err := validate([]validation{
+ {targetValue: timeout,
+ constraints: []constraint{{target: "timeout", name: null, rule: false,
+ chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil {
+ return nil, err
+ }
+ req, err := client.getPropertiesPreparer(timeout, leaseID, requestID)
+ if err != nil {
+ return nil, err
+ }
+ resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.getPropertiesResponder}, req)
+ if err != nil {
+ return nil, err
+ }
+ return resp.(*ContainerGetPropertiesResponse), err
+}
+
+// getPropertiesPreparer prepares the GetProperties request.
+func (client containerClient) getPropertiesPreparer(timeout *int32, leaseID *string, requestID *string) (pipeline.Request, error) {
+ req, err := pipeline.NewRequest("GET", client.url, nil)
+ if err != nil {
+ return req, pipeline.NewError(err, "failed to create request")
+ }
+ params := req.URL.Query()
+ if timeout != nil {
+ params.Set("timeout", strconv.FormatInt(int64(*timeout), 10))
+ }
+ params.Set("restype", "container")
+ req.URL.RawQuery = params.Encode()
+ if leaseID != nil {
+ req.Header.Set("x-ms-lease-id", *leaseID)
+ }
+ req.Header.Set("x-ms-version", ServiceVersion)
+ if requestID != nil {
+ req.Header.Set("x-ms-client-request-id", *requestID)
+ }
+ return req, nil
+}
+
+// getPropertiesResponder handles the response to the GetProperties request.
+func (client containerClient) getPropertiesResponder(resp pipeline.Response) (pipeline.Response, error) {
+ err := validateResponse(resp, http.StatusOK)
+ if resp == nil {
+ return nil, err
+ }
+ io.Copy(ioutil.Discard, resp.Response().Body)
+ resp.Response().Body.Close()
+ return &ContainerGetPropertiesResponse{rawResponse: resp.Response()}, err
+}
+
+// ListBlobFlatSegment [Update] The List Blobs operation returns a list of the blobs under the specified container
+//
+// prefix is filters the results to return only containers whose name begins with the specified prefix. marker is a
+// string value that identifies the portion of the list of containers to be returned with the next listing operation.
+// The operation returns the NextMarker value within the response body if the listing operation did not return all
+// containers remaining to be listed with the current page. The NextMarker value can be used as the value for the
+// marker parameter in a subsequent call to request the next page of list items. The marker value is opaque to the
+// client. maxresults is specifies the maximum number of containers to return. If the request does not specify
+// maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the
+// listing operation crosses a partition boundary, then the service will return a continuation token for retrieving the
+// remainder of the results. For this reason, it is possible that the service will return fewer results than specified
+// by maxresults, or than the default of 5000. include is include this parameter to specify one or more datasets to
+// include in the response. timeout is the timeout parameter is expressed in seconds. For more information, see <a
+// href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting
+// Timeouts for Blob Service Operations.</a> requestID is provides a client-generated, opaque value with a 1 KB
+// character limit that is recorded in the analytics logs when storage analytics logging is enabled.
+func (client containerClient) ListBlobFlatSegment(ctx context.Context, prefix *string, marker *string, maxresults *int32, include []ListBlobsIncludeItemType, timeout *int32, requestID *string) (*ListBlobsFlatSegmentResponse, error) {
+ if err := validate([]validation{
+ {targetValue: maxresults,
+ constraints: []constraint{{target: "maxresults", name: null, rule: false,
+ chain: []constraint{{target: "maxresults", name: inclusiveMinimum, rule: 1, chain: nil}}}}},
+ {targetValue: timeout,
+ constraints: []constraint{{target: "timeout", name: null, rule: false,
+ chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil {
+ return nil, err
+ }
+ req, err := client.listBlobFlatSegmentPreparer(prefix, marker, maxresults, include, timeout, requestID)
+ if err != nil {
+ return nil, err
+ }
+ resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.listBlobFlatSegmentResponder}, req)
+ if err != nil {
+ return nil, err
+ }
+ return resp.(*ListBlobsFlatSegmentResponse), err
+}
+
+// listBlobFlatSegmentPreparer prepares the ListBlobFlatSegment request.
+func (client containerClient) listBlobFlatSegmentPreparer(prefix *string, marker *string, maxresults *int32, include []ListBlobsIncludeItemType, timeout *int32, requestID *string) (pipeline.Request, error) {
+ req, err := pipeline.NewRequest("GET", client.url, nil)
+ if err != nil {
+ return req, pipeline.NewError(err, "failed to create request")
+ }
+ params := req.URL.Query()
+ if prefix != nil && len(*prefix) > 0 {
+ params.Set("prefix", *prefix)
+ }
+ if marker != nil && len(*marker) > 0 {
+ params.Set("marker", *marker)
+ }
+ if maxresults != nil {
+ params.Set("maxresults", strconv.FormatInt(int64(*maxresults), 10))
+ }
+ if include != nil && len(include) > 0 {
+ params.Set("include", joinConst(include, ","))
+ }
+ if timeout != nil {
+ params.Set("timeout", strconv.FormatInt(int64(*timeout), 10))
+ }
+ params.Set("restype", "container")
+ params.Set("comp", "list")
+ req.URL.RawQuery = params.Encode()
+ req.Header.Set("x-ms-version", ServiceVersion)
+ if requestID != nil {
+ req.Header.Set("x-ms-client-request-id", *requestID)
+ }
+ return req, nil
+}
+
+// listBlobFlatSegmentResponder handles the response to the ListBlobFlatSegment request.
+func (client containerClient) listBlobFlatSegmentResponder(resp pipeline.Response) (pipeline.Response, error) {
+ err := validateResponse(resp, http.StatusOK)
+ if resp == nil {
+ return nil, err
+ }
+ result := &ListBlobsFlatSegmentResponse{rawResponse: resp.Response()}
+ if err != nil {
+ return result, err
+ }
+ defer resp.Response().Body.Close()
+ b, err := ioutil.ReadAll(resp.Response().Body)
+ if err != nil {
+ return result, NewResponseError(err, resp.Response(), "failed to read response body")
+ }
+ if len(b) > 0 {
+ b = removeBOM(b)
+ err = xml.Unmarshal(b, result)
+ if err != nil {
+ return result, NewResponseError(err, resp.Response(), "failed to unmarshal response body")
+ }
+ }
+ return result, nil
+}
+
+// ListBlobHierarchySegment [Update] The List Blobs operation returns a list of the blobs under the specified container
+//
+// delimiter is when the request includes this parameter, the operation returns a BlobPrefix element in the response
+// body that acts as a placeholder for all blobs whose names begin with the same substring up to the appearance of the
+// delimiter character. The delimiter may be a single character or a string. prefix is filters the results to return
+// only containers whose name begins with the specified prefix. marker is a string value that identifies the portion of
+// the list of containers to be returned with the next listing operation. The operation returns the NextMarker value
+// within the response body if the listing operation did not return all containers remaining to be listed with the
+// current page. The NextMarker value can be used as the value for the marker parameter in a subsequent call to request
+// the next page of list items. The marker value is opaque to the client. maxresults is specifies the maximum number of
+// containers to return. If the request does not specify maxresults, or specifies a value greater than 5000, the server
+// will return up to 5000 items. Note that if the listing operation crosses a partition boundary, then the service will
+// return a continuation token for retrieving the remainder of the results. For this reason, it is possible that the
+// service will return fewer results than specified by maxresults, or than the default of 5000. include is include this
+// parameter to specify one or more datasets to include in the response. timeout is the timeout parameter is expressed
+// in seconds. For more information, see <a
+// href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting
+// Timeouts for Blob Service Operations.</a> requestID is provides a client-generated, opaque value with a 1 KB
+// character limit that is recorded in the analytics logs when storage analytics logging is enabled.
+func (client containerClient) ListBlobHierarchySegment(ctx context.Context, delimiter string, prefix *string, marker *string, maxresults *int32, include []ListBlobsIncludeItemType, timeout *int32, requestID *string) (*ListBlobsHierarchySegmentResponse, error) {
+ if err := validate([]validation{
+ {targetValue: maxresults,
+ constraints: []constraint{{target: "maxresults", name: null, rule: false,
+ chain: []constraint{{target: "maxresults", name: inclusiveMinimum, rule: 1, chain: nil}}}}},
+ {targetValue: timeout,
+ constraints: []constraint{{target: "timeout", name: null, rule: false,
+ chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil {
+ return nil, err
+ }
+ req, err := client.listBlobHierarchySegmentPreparer(delimiter, prefix, marker, maxresults, include, timeout, requestID)
+ if err != nil {
+ return nil, err
+ }
+ resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.listBlobHierarchySegmentResponder}, req)
+ if err != nil {
+ return nil, err
+ }
+ return resp.(*ListBlobsHierarchySegmentResponse), err
+}
+
+// listBlobHierarchySegmentPreparer prepares the ListBlobHierarchySegment request.
+func (client containerClient) listBlobHierarchySegmentPreparer(delimiter string, prefix *string, marker *string, maxresults *int32, include []ListBlobsIncludeItemType, timeout *int32, requestID *string) (pipeline.Request, error) {
+ req, err := pipeline.NewRequest("GET", client.url, nil)
+ if err != nil {
+ return req, pipeline.NewError(err, "failed to create request")
+ }
+ params := req.URL.Query()
+ if prefix != nil && len(*prefix) > 0 {
+ params.Set("prefix", *prefix)
+ }
+ params.Set("delimiter", delimiter)
+ if marker != nil && len(*marker) > 0 {
+ params.Set("marker", *marker)
+ }
+ if maxresults != nil {
+ params.Set("maxresults", strconv.FormatInt(int64(*maxresults), 10))
+ }
+ if include != nil && len(include) > 0 {
+ params.Set("include", joinConst(include, ","))
+ }
+ if timeout != nil {
+ params.Set("timeout", strconv.FormatInt(int64(*timeout), 10))
+ }
+ params.Set("restype", "container")
+ params.Set("comp", "list")
+ req.URL.RawQuery = params.Encode()
+ req.Header.Set("x-ms-version", ServiceVersion)
+ if requestID != nil {
+ req.Header.Set("x-ms-client-request-id", *requestID)
+ }
+ return req, nil
+}
+
+// listBlobHierarchySegmentResponder handles the response to the ListBlobHierarchySegment request.
+func (client containerClient) listBlobHierarchySegmentResponder(resp pipeline.Response) (pipeline.Response, error) {
+ err := validateResponse(resp, http.StatusOK)
+ if resp == nil {
+ return nil, err
+ }
+ result := &ListBlobsHierarchySegmentResponse{rawResponse: resp.Response()}
+ if err != nil {
+ return result, err
+ }
+ defer resp.Response().Body.Close()
+ b, err := ioutil.ReadAll(resp.Response().Body)
+ if err != nil {
+ return result, NewResponseError(err, resp.Response(), "failed to read response body")
+ }
+ if len(b) > 0 {
+ b = removeBOM(b)
+ err = xml.Unmarshal(b, result)
+ if err != nil {
+ return result, NewResponseError(err, resp.Response(), "failed to unmarshal response body")
+ }
+ }
+ return result, nil
+}
+
+// ReleaseLease [Update] establishes and manages a lock on a container for delete operations. The lock duration can be
+// 15 to 60 seconds, or can be infinite
+//
+// leaseID is if specified, the operation only succeeds if the container's lease is active and matches this ID. timeout
+// is the timeout parameter is expressed in seconds. For more information, see <a
+// href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting
+// Timeouts for Blob Service Operations.</a> ifModifiedSince is specify this header value to operate only on a blob if
+// it has been modified since the specified date/time. ifUnmodifiedSince is specify this header value to operate only
+// on a blob if it has not been modified since the specified date/time. requestID is provides a client-generated,
+// opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is
+// enabled.
+func (client containerClient) ReleaseLease(ctx context.Context, leaseID string, timeout *int32, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, requestID *string) (*ContainerReleaseLeaseResponse, error) {
+ if err := validate([]validation{
+ {targetValue: timeout,
+ constraints: []constraint{{target: "timeout", name: null, rule: false,
+ chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil {
+ return nil, err
+ }
+ req, err := client.releaseLeasePreparer(leaseID, timeout, ifModifiedSince, ifUnmodifiedSince, requestID)
+ if err != nil {
+ return nil, err
+ }
+ resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.releaseLeaseResponder}, req)
+ if err != nil {
+ return nil, err
+ }
+ return resp.(*ContainerReleaseLeaseResponse), err
+}
+
+// releaseLeasePreparer prepares the ReleaseLease request.
+func (client containerClient) releaseLeasePreparer(leaseID string, timeout *int32, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, requestID *string) (pipeline.Request, error) {
+ req, err := pipeline.NewRequest("PUT", client.url, nil)
+ if err != nil {
+ return req, pipeline.NewError(err, "failed to create request")
+ }
+ params := req.URL.Query()
+ if timeout != nil {
+ params.Set("timeout", strconv.FormatInt(int64(*timeout), 10))
+ }
+ params.Set("comp", "lease")
+ params.Set("restype", "container")
+ req.URL.RawQuery = params.Encode()
+ req.Header.Set("x-ms-lease-id", leaseID)
+ if ifModifiedSince != nil {
+ req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123))
+ }
+ if ifUnmodifiedSince != nil {
+ req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123))
+ }
+ req.Header.Set("x-ms-version", ServiceVersion)
+ if requestID != nil {
+ req.Header.Set("x-ms-client-request-id", *requestID)
+ }
+ req.Header.Set("x-ms-lease-action", "release")
+ return req, nil
+}
+
+// releaseLeaseResponder handles the response to the ReleaseLease request.
+func (client containerClient) releaseLeaseResponder(resp pipeline.Response) (pipeline.Response, error) {
+ err := validateResponse(resp, http.StatusOK)
+ if resp == nil {
+ return nil, err
+ }
+ io.Copy(ioutil.Discard, resp.Response().Body)
+ resp.Response().Body.Close()
+ return &ContainerReleaseLeaseResponse{rawResponse: resp.Response()}, err
+}
+
+// RenewLease [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15
+// to 60 seconds, or can be infinite
+//
+// leaseID is if specified, the operation only succeeds if the container's lease is active and matches this ID. timeout
+// is the timeout parameter is expressed in seconds. For more information, see <a
+// href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting
+// Timeouts for Blob Service Operations.</a> ifModifiedSince is specify this header value to operate only on a blob if
+// it has been modified since the specified date/time. ifUnmodifiedSince is specify this header value to operate only
+// on a blob if it has not been modified since the specified date/time. requestID is provides a client-generated,
+// opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is
+// enabled.
+func (client containerClient) RenewLease(ctx context.Context, leaseID string, timeout *int32, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, requestID *string) (*ContainerRenewLeaseResponse, error) {
+ if err := validate([]validation{
+ {targetValue: timeout,
+ constraints: []constraint{{target: "timeout", name: null, rule: false,
+ chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil {
+ return nil, err
+ }
+ req, err := client.renewLeasePreparer(leaseID, timeout, ifModifiedSince, ifUnmodifiedSince, requestID)
+ if err != nil {
+ return nil, err
+ }
+ resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.renewLeaseResponder}, req)
+ if err != nil {
+ return nil, err
+ }
+ return resp.(*ContainerRenewLeaseResponse), err
+}
+
+// renewLeasePreparer prepares the RenewLease request.
+func (client containerClient) renewLeasePreparer(leaseID string, timeout *int32, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, requestID *string) (pipeline.Request, error) {
+ req, err := pipeline.NewRequest("PUT", client.url, nil)
+ if err != nil {
+ return req, pipeline.NewError(err, "failed to create request")
+ }
+ params := req.URL.Query()
+ if timeout != nil {
+ params.Set("timeout", strconv.FormatInt(int64(*timeout), 10))
+ }
+ params.Set("comp", "lease")
+ params.Set("restype", "container")
+ req.URL.RawQuery = params.Encode()
+ req.Header.Set("x-ms-lease-id", leaseID)
+ if ifModifiedSince != nil {
+ req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123))
+ }
+ if ifUnmodifiedSince != nil {
+ req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123))
+ }
+ req.Header.Set("x-ms-version", ServiceVersion)
+ if requestID != nil {
+ req.Header.Set("x-ms-client-request-id", *requestID)
+ }
+ req.Header.Set("x-ms-lease-action", "renew")
+ return req, nil
+}
+
+// renewLeaseResponder handles the response to the RenewLease request.
+func (client containerClient) renewLeaseResponder(resp pipeline.Response) (pipeline.Response, error) {
+ err := validateResponse(resp, http.StatusOK)
+ if resp == nil {
+ return nil, err
+ }
+ io.Copy(ioutil.Discard, resp.Response().Body)
+ resp.Response().Body.Close()
+ return &ContainerRenewLeaseResponse{rawResponse: resp.Response()}, err
+}
+
+// SetAccessPolicy sets the permissions for the specified container. The permissions indicate whether blobs in a
+// container may be accessed publicly.
+//
+// containerACL is the acls for the container timeout is the timeout parameter is expressed in seconds. For more
+// information, see <a
+// href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting
+// Timeouts for Blob Service Operations.</a> leaseID is if specified, the operation only succeeds if the container's
+// lease is active and matches this ID. access is specifies whether data in the container may be accessed publicly and
+// the level of access ifModifiedSince is specify this header value to operate only on a blob if it has been modified
+// since the specified date/time. ifUnmodifiedSince is specify this header value to operate only on a blob if it has
+// not been modified since the specified date/time. requestID is provides a client-generated, opaque value with a 1 KB
+// character limit that is recorded in the analytics logs when storage analytics logging is enabled.
+func (client containerClient) SetAccessPolicy(ctx context.Context, containerACL []SignedIdentifier, timeout *int32, leaseID *string, access PublicAccessType, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, requestID *string) (*ContainerSetAccessPolicyResponse, error) {
+ if err := validate([]validation{
+ {targetValue: timeout,
+ constraints: []constraint{{target: "timeout", name: null, rule: false,
+ chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil {
+ return nil, err
+ }
+ req, err := client.setAccessPolicyPreparer(containerACL, timeout, leaseID, access, ifModifiedSince, ifUnmodifiedSince, requestID)
+ if err != nil {
+ return nil, err
+ }
+ resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.setAccessPolicyResponder}, req)
+ if err != nil {
+ return nil, err
+ }
+ return resp.(*ContainerSetAccessPolicyResponse), err
+}
+
+// setAccessPolicyPreparer prepares the SetAccessPolicy request.
+func (client containerClient) setAccessPolicyPreparer(containerACL []SignedIdentifier, timeout *int32, leaseID *string, access PublicAccessType, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, requestID *string) (pipeline.Request, error) {
+ req, err := pipeline.NewRequest("PUT", client.url, nil)
+ if err != nil {
+ return req, pipeline.NewError(err, "failed to create request")
+ }
+ params := req.URL.Query()
+ if timeout != nil {
+ params.Set("timeout", strconv.FormatInt(int64(*timeout), 10))
+ }
+ params.Set("restype", "container")
+ params.Set("comp", "acl")
+ req.URL.RawQuery = params.Encode()
+ if leaseID != nil {
+ req.Header.Set("x-ms-lease-id", *leaseID)
+ }
+ if access != PublicAccessNone {
+ req.Header.Set("x-ms-blob-public-access", string(access))
+ }
+ if ifModifiedSince != nil {
+ req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123))
+ }
+ if ifUnmodifiedSince != nil {
+ req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123))
+ }
+ req.Header.Set("x-ms-version", ServiceVersion)
+ if requestID != nil {
+ req.Header.Set("x-ms-client-request-id", *requestID)
+ }
+ b, err := xml.Marshal(SignedIdentifiers{Items: containerACL})
+ if err != nil {
+ return req, pipeline.NewError(err, "failed to marshal request body")
+ }
+ req.Header.Set("Content-Type", "application/xml")
+ err = req.SetBody(bytes.NewReader(b))
+ if err != nil {
+ return req, pipeline.NewError(err, "failed to set request body")
+ }
+ return req, nil
+}
+
+// setAccessPolicyResponder handles the response to the SetAccessPolicy request.
+func (client containerClient) setAccessPolicyResponder(resp pipeline.Response) (pipeline.Response, error) {
+ err := validateResponse(resp, http.StatusOK)
+ if resp == nil {
+ return nil, err
+ }
+ io.Copy(ioutil.Discard, resp.Response().Body)
+ resp.Response().Body.Close()
+ return &ContainerSetAccessPolicyResponse{rawResponse: resp.Response()}, err
+}
+
+// SetMetadata operation sets one or more user-defined name-value pairs for the specified container.
+//
+// timeout is the timeout parameter is expressed in seconds. For more information, see <a
+// href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting
+// Timeouts for Blob Service Operations.</a> leaseID is if specified, the operation only succeeds if the container's
+// lease is active and matches this ID. metadata is optional. Specifies a user-defined name-value pair associated with
+// the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to
+// the destination blob. If one or more name-value pairs are specified, the destination blob is created with the
+// specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version
+// 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing
+// Containers, Blobs, and Metadata for more information. ifModifiedSince is specify this header value to operate only
+// on a blob if it has been modified since the specified date/time. requestID is provides a client-generated, opaque
+// value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled.
+func (client containerClient) SetMetadata(ctx context.Context, timeout *int32, leaseID *string, metadata map[string]string, ifModifiedSince *time.Time, requestID *string) (*ContainerSetMetadataResponse, error) {
+ if err := validate([]validation{
+ {targetValue: timeout,
+ constraints: []constraint{{target: "timeout", name: null, rule: false,
+ chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}},
+ {targetValue: metadata,
+ constraints: []constraint{{target: "metadata", name: null, rule: false,
+ chain: []constraint{{target: "metadata", name: pattern, rule: `^[a-zA-Z]+$`, chain: nil}}}}}}); err != nil {
+ return nil, err
+ }
+ req, err := client.setMetadataPreparer(timeout, leaseID, metadata, ifModifiedSince, requestID)
+ if err != nil {
+ return nil, err
+ }
+ resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.setMetadataResponder}, req)
+ if err != nil {
+ return nil, err
+ }
+ return resp.(*ContainerSetMetadataResponse), err
+}
+
+// setMetadataPreparer prepares the SetMetadata request.
+func (client containerClient) setMetadataPreparer(timeout *int32, leaseID *string, metadata map[string]string, ifModifiedSince *time.Time, requestID *string) (pipeline.Request, error) {
+ req, err := pipeline.NewRequest("PUT", client.url, nil)
+ if err != nil {
+ return req, pipeline.NewError(err, "failed to create request")
+ }
+ params := req.URL.Query()
+ if timeout != nil {
+ params.Set("timeout", strconv.FormatInt(int64(*timeout), 10))
+ }
+ params.Set("restype", "container")
+ params.Set("comp", "metadata")
+ req.URL.RawQuery = params.Encode()
+ if leaseID != nil {
+ req.Header.Set("x-ms-lease-id", *leaseID)
+ }
+ if metadata != nil {
+ for k, v := range metadata {
+ req.Header.Set("x-ms-meta-"+k, v)
+ }
+ }
+ if ifModifiedSince != nil {
+ req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123))
+ }
+ req.Header.Set("x-ms-version", ServiceVersion)
+ if requestID != nil {
+ req.Header.Set("x-ms-client-request-id", *requestID)
+ }
+ return req, nil
+}
+
+// setMetadataResponder handles the response to the SetMetadata request.
+func (client containerClient) setMetadataResponder(resp pipeline.Response) (pipeline.Response, error) {
+ err := validateResponse(resp, http.StatusOK)
+ if resp == nil {
+ return nil, err
+ }
+ io.Copy(ioutil.Discard, resp.Response().Body)
+ resp.Response().Body.Close()
+ return &ContainerSetMetadataResponse{rawResponse: resp.Response()}, err
+}