diff --git a/go.mod b/go.mod index e73d3c3c72d89..d2c0fe43c35a5 100644 --- a/go.mod +++ b/go.mod @@ -1,7 +1,7 @@ module github.com/terraform-providers/terraform-provider-azurerm require ( - github.com/Azure/azure-sdk-for-go v31.0.0+incompatible + github.com/Azure/azure-sdk-for-go v31.0.0+incompatible github.com/Azure/go-autorest/autorest v0.3.0 github.com/Azure/go-autorest/autorest/adal v0.1.0 github.com/Azure/go-autorest/autorest/date v0.1.0 diff --git a/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/README.md b/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/README.md deleted file mode 100644 index 37d2878cc5eef..0000000000000 --- a/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/README.md +++ /dev/null @@ -1,45 +0,0 @@ -## Blob Storage Container SDK for API version 2018-11-09 - -This package allows you to interact with the Containers Blob Storage API - -### Supported Authorizers - -* Azure Active Directory (for the Resource Endpoint `https://storage.azure.com`) -* SharedKeyLite (Blob, File & Queue) - -Note: when using the `ListBlobs` operation, only `SharedKeyLite` authentication is supported. - -### Example Usage - -```go -package main - -import ( - "context" - "fmt" - "time" - - "github.com/Azure/go-autorest/autorest" - "github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers" -) - -func Example() error { - accountName := "storageaccount1" - storageAccountKey := "ABC123...." - containerName := "mycontainer" - - storageAuth := autorest.NewSharedKeyLiteAuthorizer(accountName, storageAccountKey) - containersClient := containers.New() - containersClient.Client.Authorizer = storageAuth - - ctx := context.TODO() - createInput := containers.CreateInput{ - AccessLevel: containers.Private, - } - if _, err := containersClient.Create(ctx, accountName, containerName, createInput); err != nil { - return fmt.Errorf("Error creating Container: %s", err) - } - - return nil -} -``` \ No newline at end of file diff --git a/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/create.go b/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/create.go deleted file mode 100644 index 84c2887d7d1a7..0000000000000 --- a/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/create.go +++ /dev/null @@ -1,123 +0,0 @@ -package containers - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/tombuildsstuff/giovanni/storage/internal/endpoints" - "github.com/tombuildsstuff/giovanni/storage/internal/metadata" -) - -type CreateInput struct { - // Specifies whether data in the container may be accessed publicly and the level of access - AccessLevel AccessLevel - - // A name-value pair to associate with the container as metadata. - MetaData map[string]string -} - -type CreateResponse struct { - autorest.Response - Error *ErrorResponse `xml:"Error"` -} - -// Create creates a new container under the specified account. -// If the container with the same name already exists, the operation fails. -func (client Client) Create(ctx context.Context, accountName, containerName string, input CreateInput) (result CreateResponse, err error) { - if accountName == "" { - return result, validation.NewError("containers.Client", "Create", "`accountName` cannot be an empty string.") - } - if containerName == "" { - return result, validation.NewError("containers.Client", "Create", "`containerName` cannot be an empty string.") - } - if err := metadata.Validate(input.MetaData); err != nil { - return result, validation.NewError("containers.Client", "Create", fmt.Sprintf("`input.MetaData` is not valid: %s.", err)) - } - - req, err := client.CreatePreparer(ctx, accountName, containerName, input) - if err != nil { - err = autorest.NewErrorWithError(err, "containers.Client", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containers.Client", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containers.Client", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client Client) CreatePreparer(ctx context.Context, accountName string, containerName string, input CreateInput) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerName": autorest.Encode("path", containerName), - } - - queryParameters := map[string]interface{}{ - "restype": autorest.Encode("path", "container"), - } - - headers := map[string]interface{}{ - "x-ms-version": APIVersion, - } - - headers = client.setAccessLevelIntoHeaders(headers, input.AccessLevel) - headers = metadata.SetIntoHeaders(headers, input.MetaData) - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/xml; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(endpoints.GetBlobEndpoint(client.BaseURI, accountName)), - autorest.WithPathParameters("/{containerName}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeaders(headers)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client Client) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client Client) CreateResponder(resp *http.Response) (result CreateResponse, err error) { - successfulStatusCodes := []int{ - http.StatusCreated, - } - if autorest.ResponseHasStatusCode(resp, successfulStatusCodes...) { - // when successful there's no response - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(successfulStatusCodes...), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - } else { - // however when there's an error the error's in the response - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(successfulStatusCodes...), - autorest.ByUnmarshallingXML(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - } - - return -} diff --git a/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/get_properties.go b/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/get_properties.go deleted file mode 100644 index 1e308da67c55c..0000000000000 --- a/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/get_properties.go +++ /dev/null @@ -1,124 +0,0 @@ -package containers - -import ( - "context" - "net/http" - "strings" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/tombuildsstuff/giovanni/storage/internal/endpoints" - "github.com/tombuildsstuff/giovanni/storage/internal/metadata" -) - -// GetProperties returns the properties for this Container without a Lease -func (client Client) GetProperties(ctx context.Context, accountName, containerName string) (ContainerProperties, error) { - // If specified, Get Container Properties only succeeds if the container’s lease is active and matches this ID. - // If there is no active lease or the ID does not match, 412 (Precondition Failed) is returned. - return client.GetPropertiesWithLeaseID(ctx, accountName, containerName, "") -} - -// GetPropertiesWithLeaseID returns the properties for this Container using the specified LeaseID -func (client Client) GetPropertiesWithLeaseID(ctx context.Context, accountName, containerName, leaseID string) (result ContainerProperties, err error) { - if accountName == "" { - return result, validation.NewError("containers.Client", "GetPropertiesWithLeaseID", "`accountName` cannot be an empty string.") - } - if containerName == "" { - return result, validation.NewError("containers.Client", "GetPropertiesWithLeaseID", "`containerName` cannot be an empty string.") - } - - req, err := client.GetPropertiesWithLeaseIDPreparer(ctx, accountName, containerName, leaseID) - if err != nil { - err = autorest.NewErrorWithError(err, "containers.Client", "GetProperties", nil, "Failure preparing request") - return - } - - resp, err := client.GetPropertiesWithLeaseIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containers.Client", "GetProperties", resp, "Failure sending request") - return - } - - result, err = client.GetPropertiesWithLeaseIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containers.Client", "GetProperties", resp, "Failure responding to request") - return - } - - return -} - -// GetPropertiesWithLeaseIDPreparer prepares the GetPropertiesWithLeaseID request. -func (client Client) GetPropertiesWithLeaseIDPreparer(ctx context.Context, accountName, containerName, leaseID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerName": autorest.Encode("path", containerName), - } - - queryParameters := map[string]interface{}{ - "restype": autorest.Encode("path", "container"), - } - - headers := map[string]interface{}{ - "x-ms-version": APIVersion, - } - - // If specified, Get Container Properties only succeeds if the container’s lease is active and matches this ID. - // If there is no active lease or the ID does not match, 412 (Precondition Failed) is returned. - if leaseID != "" { - headers["x-ms-lease-id"] = leaseID - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/xml; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(endpoints.GetBlobEndpoint(client.BaseURI, accountName)), - autorest.WithPathParameters("/{containerName}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeaders(headers)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetPropertiesWithLeaseIDSender sends the GetPropertiesWithLeaseID request. The method will close the -// http.Response Body if it receives an error. -func (client Client) GetPropertiesWithLeaseIDSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// GetPropertiesWithLeaseIDResponder handles the response to the GetPropertiesWithLeaseID request. The method always -// closes the http.Response Body. -func (client Client) GetPropertiesWithLeaseIDResponder(resp *http.Response) (result ContainerProperties, err error) { - if resp != nil { - result.LeaseStatus = LeaseStatus(resp.Header.Get("x-ms-lease-status")) - result.LeaseState = LeaseState(resp.Header.Get("x-ms-lease-state")) - if result.LeaseStatus == Locked { - duration := LeaseDuration(resp.Header.Get("x-ms-lease-duration")) - result.LeaseDuration = &duration - } - - // If this header is not returned in the response, the container is private to the account owner. - accessLevel := resp.Header.Get("x-ms-blob-public-access") - if accessLevel != "" { - result.AccessLevel = AccessLevel(accessLevel) - } else { - result.AccessLevel = Private - } - - // we can't necessarily use strconv.ParseBool here since this could be nil (only in some API versions) - result.HasImmutabilityPolicy = strings.EqualFold(resp.Header.Get("x-ms-has-immutability-policy"), "true") - result.HasLegalHold = strings.EqualFold(resp.Header.Get("x-ms-has-legal-hold"), "true") - - result.MetaData = metadata.ParseFromHeaders(resp.Header) - } - - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - - return -} diff --git a/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/lease_acquire.go b/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/lease_acquire.go deleted file mode 100644 index 061c863c43f95..0000000000000 --- a/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/lease_acquire.go +++ /dev/null @@ -1,115 +0,0 @@ -package containers - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/tombuildsstuff/giovanni/storage/internal/endpoints" -) - -type AcquireLeaseInput struct { - // 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 - LeaseDuration int - - ProposedLeaseID string -} - -type AcquireLeaseResponse struct { - autorest.Response - - LeaseID string -} - -// AcquireLease establishes and manages a lock on a container for delete operations. -func (client Client) AcquireLease(ctx context.Context, accountName, containerName string, input AcquireLeaseInput) (result AcquireLeaseResponse, err error) { - if accountName == "" { - return result, validation.NewError("containers.Client", "AcquireLease", "`accountName` cannot be an empty string.") - } - if containerName == "" { - return result, validation.NewError("containers.Client", "AcquireLease", "`containerName` cannot be an empty string.") - } - // An infinite lease duration is -1 seconds. A non-infinite lease can be between 15 and 60 seconds - if input.LeaseDuration != -1 && (input.LeaseDuration <= 15 || input.LeaseDuration >= 60) { - return result, validation.NewError("containers.Client", "AcquireLease", "`input.LeaseDuration` must be -1 (infinite), or between 15 and 60 seconds.") - } - - req, err := client.AcquireLeasePreparer(ctx, accountName, containerName, input) - if err != nil { - err = autorest.NewErrorWithError(err, "containers.Client", "AcquireLease", nil, "Failure preparing request") - return - } - - resp, err := client.AcquireLeaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containers.Client", "AcquireLease", resp, "Failure sending request") - return - } - - result, err = client.AcquireLeaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containers.Client", "AcquireLease", resp, "Failure responding to request") - return - } - - return -} - -// AcquireLeasePreparer prepares the AcquireLease request. -func (client Client) AcquireLeasePreparer(ctx context.Context, accountName string, containerName string, input AcquireLeaseInput) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerName": autorest.Encode("path", containerName), - } - - queryParameters := map[string]interface{}{ - "restype": autorest.Encode("path", "container"), - "comp": autorest.Encode("path", "lease"), - } - - headers := map[string]interface{}{ - "x-ms-version": APIVersion, - "x-ms-lease-action": "acquire", - "x-ms-lease-duration": input.LeaseDuration, - } - - if input.ProposedLeaseID != "" { - headers["x-ms-proposed-lease-id"] = input.ProposedLeaseID - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/xml; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(endpoints.GetBlobEndpoint(client.BaseURI, accountName)), - autorest.WithPathParameters("/{containerName}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeaders(headers)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// AcquireLeaseSender sends the AcquireLease request. The method will close the -// http.Response Body if it receives an error. -func (client Client) AcquireLeaseSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// AcquireLeaseResponder handles the response to the AcquireLease request. The method always -// closes the http.Response Body. -func (client Client) AcquireLeaseResponder(resp *http.Response) (result AcquireLeaseResponse, err error) { - if resp != nil { - result.LeaseID = resp.Header.Get("x-ms-lease-id") - } - - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusCreated), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - - return -} diff --git a/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/lease_break.go b/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/lease_break.go deleted file mode 100644 index 08acfb7a31164..0000000000000 --- a/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/lease_break.go +++ /dev/null @@ -1,129 +0,0 @@ -package containers - -import ( - "context" - "net/http" - "strconv" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/tombuildsstuff/giovanni/storage/internal/endpoints" -) - -type BreakLeaseInput struct { - // 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. - BreakPeriod *int - - LeaseID string -} - -type BreakLeaseResponse struct { - autorest.Response - - // Approximate time remaining in the lease period, in seconds. - // If the break is immediate, 0 is returned. - LeaseTime int -} - -// BreakLease breaks a lock based on it's Lease ID -func (client Client) BreakLease(ctx context.Context, accountName, containerName string, input BreakLeaseInput) (result BreakLeaseResponse, err error) { - if accountName == "" { - return result, validation.NewError("containers.Client", "BreakLease", "`accountName` cannot be an empty string.") - } - if containerName == "" { - return result, validation.NewError("containers.Client", "BreakLease", "`containerName` cannot be an empty string.") - } - if input.LeaseID == "" { - return result, validation.NewError("containers.Client", "BreakLease", "`input.LeaseID` cannot be an empty string.") - } - - req, err := client.BreakLeasePreparer(ctx, accountName, containerName, input) - if err != nil { - err = autorest.NewErrorWithError(err, "containers.Client", "BreakLease", nil, "Failure preparing request") - return - } - - resp, err := client.BreakLeaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containers.Client", "BreakLease", resp, "Failure sending request") - return - } - - result, err = client.BreakLeaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containers.Client", "BreakLease", resp, "Failure responding to request") - return - } - - return -} - -// BreakLeasePreparer prepares the BreakLease request. -func (client Client) BreakLeasePreparer(ctx context.Context, accountName string, containerName string, input BreakLeaseInput) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerName": autorest.Encode("path", containerName), - } - - queryParameters := map[string]interface{}{ - "restype": autorest.Encode("path", "container"), - "comp": autorest.Encode("path", "lease"), - } - - headers := map[string]interface{}{ - "x-ms-version": APIVersion, - "x-ms-lease-action": "break", - "x-ms-lease-id": input.LeaseID, - } - - if input.BreakPeriod != nil { - headers["x-ms-lease-break-period"] = *input.BreakPeriod - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/xml; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(endpoints.GetBlobEndpoint(client.BaseURI, accountName)), - autorest.WithPathParameters("/{containerName}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeaders(headers)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// BreakLeaseSender sends the BreakLease request. The method will close the -// http.Response Body if it receives an error. -func (client Client) BreakLeaseSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// BreakLeaseResponder handles the response to the BreakLease request. The method always -// closes the http.Response Body. -func (client Client) BreakLeaseResponder(resp *http.Response) (result BreakLeaseResponse, err error) { - if resp != nil { - leaseRaw := resp.Header.Get("x-ms-lease-time") - if leaseRaw != "" { - i, err := strconv.Atoi(leaseRaw) - if err == nil { - result.LeaseTime = i - } - } - } - - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusAccepted), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - - return -} diff --git a/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/lease_change.go b/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/lease_change.go deleted file mode 100644 index dfbcb132dae3d..0000000000000 --- a/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/lease_change.go +++ /dev/null @@ -1,111 +0,0 @@ -package containers - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/tombuildsstuff/giovanni/storage/internal/endpoints" -) - -type ChangeLeaseInput struct { - ExistingLeaseID string - ProposedLeaseID string -} - -type ChangeLeaseResponse struct { - autorest.Response - - LeaseID string -} - -// ChangeLease changes the lock from one Lease ID to another Lease ID -func (client Client) ChangeLease(ctx context.Context, accountName, containerName string, input ChangeLeaseInput) (result ChangeLeaseResponse, err error) { - if accountName == "" { - return result, validation.NewError("containers.Client", "ChangeLease", "`accountName` cannot be an empty string.") - } - if containerName == "" { - return result, validation.NewError("containers.Client", "ChangeLease", "`containerName` cannot be an empty string.") - } - if input.ExistingLeaseID == "" { - return result, validation.NewError("containers.Client", "ChangeLease", "`input.ExistingLeaseID` cannot be an empty string.") - } - if input.ProposedLeaseID == "" { - return result, validation.NewError("containers.Client", "ChangeLease", "`input.ProposedLeaseID` cannot be an empty string.") - } - - req, err := client.ChangeLeasePreparer(ctx, accountName, containerName, input) - if err != nil { - err = autorest.NewErrorWithError(err, "containers.Client", "ChangeLease", nil, "Failure preparing request") - return - } - - resp, err := client.ChangeLeaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containers.Client", "ChangeLease", resp, "Failure sending request") - return - } - - result, err = client.ChangeLeaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containers.Client", "ChangeLease", resp, "Failure responding to request") - return - } - - return -} - -// ChangeLeasePreparer prepares the ChangeLease request. -func (client Client) ChangeLeasePreparer(ctx context.Context, accountName string, containerName string, input ChangeLeaseInput) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerName": autorest.Encode("path", containerName), - } - - queryParameters := map[string]interface{}{ - "restype": autorest.Encode("path", "container"), - "comp": autorest.Encode("path", "lease"), - } - - headers := map[string]interface{}{ - "x-ms-version": APIVersion, - "x-ms-lease-action": "change", - "x-ms-lease-id": input.ExistingLeaseID, - "x-ms-proposed-lease-id": input.ProposedLeaseID, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/xml; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(endpoints.GetBlobEndpoint(client.BaseURI, accountName)), - autorest.WithPathParameters("/{containerName}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeaders(headers)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ChangeLeaseSender sends the ChangeLease request. The method will close the -// http.Response Body if it receives an error. -func (client Client) ChangeLeaseSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// ChangeLeaseResponder handles the response to the ChangeLease request. The method always -// closes the http.Response Body. -func (client Client) ChangeLeaseResponder(resp *http.Response) (result ChangeLeaseResponse, err error) { - if resp != nil { - result.LeaseID = resp.Header.Get("x-ms-lease-id") - } - - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - - return -} diff --git a/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/lease_release.go b/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/lease_release.go deleted file mode 100644 index fafcf98f1e67c..0000000000000 --- a/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/lease_release.go +++ /dev/null @@ -1,92 +0,0 @@ -package containers - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/tombuildsstuff/giovanni/storage/internal/endpoints" -) - -// ReleaseLease releases the lock based on the Lease ID -func (client Client) ReleaseLease(ctx context.Context, accountName, containerName, leaseID string) (result autorest.Response, err error) { - if accountName == "" { - return result, validation.NewError("containers.Client", "ReleaseLease", "`accountName` cannot be an empty string.") - } - if containerName == "" { - return result, validation.NewError("containers.Client", "ReleaseLease", "`containerName` cannot be an empty string.") - } - if leaseID == "" { - return result, validation.NewError("containers.Client", "ReleaseLease", "`leaseID` cannot be an empty string.") - } - - req, err := client.ReleaseLeasePreparer(ctx, accountName, containerName, leaseID) - if err != nil { - err = autorest.NewErrorWithError(err, "containers.Client", "ReleaseLease", nil, "Failure preparing request") - return - } - - resp, err := client.ReleaseLeaseSender(req) - if err != nil { - result = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containers.Client", "ReleaseLease", resp, "Failure sending request") - return - } - - result, err = client.ReleaseLeaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containers.Client", "ReleaseLease", resp, "Failure responding to request") - return - } - - return -} - -// ReleaseLeasePreparer prepares the ReleaseLease request. -func (client Client) ReleaseLeasePreparer(ctx context.Context, accountName string, containerName string, leaseID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerName": autorest.Encode("path", containerName), - } - - queryParameters := map[string]interface{}{ - "restype": autorest.Encode("path", "container"), - "comp": autorest.Encode("path", "lease"), - } - - headers := map[string]interface{}{ - "x-ms-version": APIVersion, - "x-ms-lease-action": "release", - "x-ms-lease-id": leaseID, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/xml; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(endpoints.GetBlobEndpoint(client.BaseURI, accountName)), - autorest.WithPathParameters("/{containerName}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeaders(headers)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ReleaseLeaseSender sends the ReleaseLease request. The method will close the -// http.Response Body if it receives an error. -func (client Client) ReleaseLeaseSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// ReleaseLeaseResponder handles the response to the ReleaseLease request. The method always -// closes the http.Response Body. -func (client Client) ReleaseLeaseResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result = autorest.Response{Response: resp} - - return -} diff --git a/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/lease_renew.go b/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/lease_renew.go deleted file mode 100644 index 3fe17656cd879..0000000000000 --- a/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/lease_renew.go +++ /dev/null @@ -1,92 +0,0 @@ -package containers - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/tombuildsstuff/giovanni/storage/internal/endpoints" -) - -// RenewLease renewes the lock based on the Lease ID -func (client Client) RenewLease(ctx context.Context, accountName, containerName, leaseID string) (result autorest.Response, err error) { - if accountName == "" { - return result, validation.NewError("containers.Client", "RenewLease", "`accountName` cannot be an empty string.") - } - if containerName == "" { - return result, validation.NewError("containers.Client", "RenewLease", "`containerName` cannot be an empty string.") - } - if leaseID == "" { - return result, validation.NewError("containers.Client", "RenewLease", "`leaseID` cannot be an empty string.") - } - - req, err := client.RenewLeasePreparer(ctx, accountName, containerName, leaseID) - if err != nil { - err = autorest.NewErrorWithError(err, "containers.Client", "RenewLease", nil, "Failure preparing request") - return - } - - resp, err := client.RenewLeaseSender(req) - if err != nil { - result = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containers.Client", "RenewLease", resp, "Failure sending request") - return - } - - result, err = client.RenewLeaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containers.Client", "RenewLease", resp, "Failure responding to request") - return - } - - return -} - -// RenewLeasePreparer prepares the RenewLease request. -func (client Client) RenewLeasePreparer(ctx context.Context, accountName string, containerName string, leaseID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerName": autorest.Encode("path", containerName), - } - - queryParameters := map[string]interface{}{ - "restype": autorest.Encode("path", "container"), - "comp": autorest.Encode("path", "lease"), - } - - headers := map[string]interface{}{ - "x-ms-version": APIVersion, - "x-ms-lease-action": "renew", - "x-ms-lease-id": leaseID, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/xml; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(endpoints.GetBlobEndpoint(client.BaseURI, accountName)), - autorest.WithPathParameters("/{containerName}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeaders(headers)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RenewLeaseSender sends the RenewLease request. The method will close the -// http.Response Body if it receives an error. -func (client Client) RenewLeaseSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// RenewLeaseResponder handles the response to the RenewLease request. The method always -// closes the http.Response Body. -func (client Client) RenewLeaseResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result = autorest.Response{Response: resp} - - return -} diff --git a/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/list_blobs.go b/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/list_blobs.go deleted file mode 100644 index 82797d091d367..0000000000000 --- a/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/list_blobs.go +++ /dev/null @@ -1,179 +0,0 @@ -package containers - -import ( - "context" - "net/http" - "strings" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/tombuildsstuff/giovanni/storage/internal/endpoints" -) - -type ListBlobsInput struct { - Delimiter *string - Include *[]Dataset - Marker *string - MaxResults *int - Prefix *string -} - -type ListBlobsResult struct { - autorest.Response - - Delimiter string `xml:"Delimiter"` - Marker string `xml:"Marker"` - MaxResults int `xml:"MaxResults"` - NextMarker *string `xml:"NextMarker,omitempty"` - Prefix string `xml:"Prefix"` - Blobs Blobs `xml:"Blobs"` -} - -type Blobs struct { - Blobs []BlobDetails `xml:"Blob"` - BlobPrefix *BlobPrefix `xml:"BlobPrefix"` -} - -type BlobDetails struct { - Name string `xml:"Name"` - Deleted bool `xml:"Deleted,omitempty"` - MetaData map[string]interface{} `map:"Metadata,omitempty"` - Properties *BlobProperties `xml:"Properties,omitempty"` - Snapshot *string `xml:"Snapshot,omitempty"` -} - -type BlobProperties struct { - AccessTier *string `xml:"AccessTier,omitempty"` - AccessTierInferred *bool `xml:"AccessTierInferred,omitempty"` - AccessTierChangeTime *string `xml:"AccessTierChangeTime,omitempty"` - BlobType *string `xml:"BlobType,omitempty"` - BlobSequenceNumber *string `xml:"x-ms-blob-sequence-number,omitempty"` - CacheControl *string `xml:"Cache-Control,omitempty"` - ContentEncoding *string `xml:"ContentEncoding,omitempty"` - ContentLanguage *string `xml:"Content-Language,omitempty"` - ContentLength *int64 `xml:"Content-Length,omitempty"` - ContentMD5 *string `xml:"Content-MD5,omitempty"` - ContentType *string `xml:"Content-Type,omitempty"` - CopyCompletionTime *string `xml:"CopyCompletionTime,omitempty"` - CopyId *string `xml:"CopyId,omitempty"` - CopyStatus *string `xml:"CopyStatus,omitempty"` - CopySource *string `xml:"CopySource,omitempty"` - CopyProgress *string `xml:"CopyProgress,omitempty"` - CopyStatusDescription *string `xml:"CopyStatusDescription,omitempty"` - CreationTime *string `xml:"CreationTime,omitempty"` - ETag *string `xml:"Etag,omitempty"` - DeletedTime *string `xml:"DeletedTime,omitempty"` - IncrementalCopy *bool `xml:"IncrementalCopy,omitempty"` - LastModified *string `xml:"Last-Modified,omitempty"` - LeaseDuration *string `xml:"LeaseDuration,omitempty"` - LeaseState *string `xml:"LeaseState,omitempty"` - LeaseStatus *string `xml:"LeaseStatus,omitempty"` - RemainingRetentionDays *string `xml:"RemainingRetentionDays,omitempty"` - ServerEncrypted *bool `xml:"ServerEncrypted,omitempty"` -} - -type BlobPrefix struct { - Name string `xml:"Name"` -} - -// ListBlobs lists the blobs matching the specified query within the specified Container -func (client Client) ListBlobs(ctx context.Context, accountName, containerName string, input ListBlobsInput) (result ListBlobsResult, err error) { - if accountName == "" { - return result, validation.NewError("containers.Client", "ListBlobs", "`accountName` cannot be an empty string.") - } - if containerName == "" { - return result, validation.NewError("containers.Client", "ListBlobs", "`containerName` cannot be an empty string.") - } - if input.MaxResults != nil && (*input.MaxResults <= 0 || *input.MaxResults > 5000) { - return result, validation.NewError("containers.Client", "ListBlobs", "`input.MaxResults` can either be nil or between 0 and 5000.") - } - - req, err := client.ListBlobsPreparer(ctx, accountName, containerName, input) - if err != nil { - err = autorest.NewErrorWithError(err, "containers.Client", "ListBlobs", nil, "Failure preparing request") - return - } - - resp, err := client.ListBlobsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containers.Client", "ListBlobs", resp, "Failure sending request") - return - } - - result, err = client.ListBlobsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containers.Client", "ListBlobs", resp, "Failure responding to request") - return - } - - return -} - -// ListBlobsPreparer prepares the ListBlobs request. -func (client Client) ListBlobsPreparer(ctx context.Context, accountName, containerName string, input ListBlobsInput) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerName": autorest.Encode("path", containerName), - } - - queryParameters := map[string]interface{}{ - "comp": autorest.Encode("query", "list"), - "restype": autorest.Encode("query", "container"), - } - - if input.Delimiter != nil { - queryParameters["delimiter"] = autorest.Encode("query", *input.Delimiter) - } - if input.Include != nil { - vals := make([]string, 0) - for _, v := range *input.Include { - vals = append(vals, string(v)) - } - include := strings.Join(vals, ",") - queryParameters["include"] = autorest.Encode("query", include) - } - if input.Marker != nil { - queryParameters["marker"] = autorest.Encode("query", *input.Marker) - } - if input.MaxResults != nil { - queryParameters["maxresults"] = autorest.Encode("query", *input.MaxResults) - } - if input.Prefix != nil { - queryParameters["prefix"] = autorest.Encode("query", *input.Prefix) - } - - headers := map[string]interface{}{ - "x-ms-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/xml; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(endpoints.GetBlobEndpoint(client.BaseURI, accountName)), - autorest.WithPathParameters("/{containerName}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeaders(headers)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBlobsSender sends the ListBlobs request. The method will close the -// http.Response Body if it receives an error. -func (client Client) ListBlobsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// ListBlobsResponder handles the response to the ListBlobs request. The method always -// closes the http.Response Body. -func (client Client) ListBlobsResponder(resp *http.Response) (result ListBlobsResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingXML(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - - return -} diff --git a/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/models.go b/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/models.go deleted file mode 100644 index adba36818aa10..0000000000000 --- a/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/models.go +++ /dev/null @@ -1,75 +0,0 @@ -package containers - -import "github.com/Azure/go-autorest/autorest" - -type AccessLevel string - -var ( - // Blob specifies public read access for blobs. - // Blob data within this container can be read via anonymous request, - // but container data is not available. - // Clients cannot enumerate blobs within the container via anonymous request. - Blob AccessLevel = "blob" - - // Container specifies full public read access for container and blob data. - // Clients can enumerate blobs within the container via anonymous request, - // but cannot enumerate containers within the storage account. - Container AccessLevel = "container" - - // Private specifies that container data is private to the account owner - Private AccessLevel = "" -) - -type ContainerProperties struct { - autorest.Response - - AccessLevel AccessLevel - LeaseStatus LeaseStatus - LeaseState LeaseState - LeaseDuration *LeaseDuration - MetaData map[string]string - HasImmutabilityPolicy bool - HasLegalHold bool -} - -type Dataset string - -var ( - Copy Dataset = "copy" - Deleted Dataset = "deleted" - MetaData Dataset = "metadata" - Snapshots Dataset = "snapshots" - UncommittedBlobs Dataset = "uncommittedblobs" -) - -type ErrorResponse struct { - Code *string `xml:"Code"` - Message *string `xml:"Message"` -} - -type LeaseDuration string - -var ( - // If this lease is for a Fixed Duration - Fixed LeaseDuration = "fixed" - - // If this lease is for an Indefinite Duration - Infinite LeaseDuration = "infinite" -) - -type LeaseState string - -var ( - Available LeaseState = "available" - Breaking LeaseState = "breaking" - Broken LeaseState = "broken" - Expired LeaseState = "expired" - Leased LeaseState = "leased" -) - -type LeaseStatus string - -var ( - Locked LeaseStatus = "locked" - Unlocked LeaseStatus = "unlocked" -) diff --git a/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/set_acl.go b/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/set_acl.go deleted file mode 100644 index fcf4e1056fa43..0000000000000 --- a/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/set_acl.go +++ /dev/null @@ -1,100 +0,0 @@ -package containers - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/tombuildsstuff/giovanni/storage/internal/endpoints" -) - -// SetAccessControl sets the Access Control for a Container without a Lease ID -func (client Client) SetAccessControl(ctx context.Context, accountName, containerName string, level AccessLevel) (autorest.Response, error) { - return client.SetAccessControlWithLeaseID(ctx, accountName, containerName, "", level) -} - -// SetAccessControlWithLeaseID sets the Access Control for a Container using the specified Lease ID -func (client Client) SetAccessControlWithLeaseID(ctx context.Context, accountName, containerName, leaseID string, level AccessLevel) (result autorest.Response, err error) { - if accountName == "" { - return result, validation.NewError("containers.Client", "SetAccessControl", "`accountName` cannot be an empty string.") - } - if containerName == "" { - return result, validation.NewError("containers.Client", "SetAccessControl", "`containerName` cannot be an empty string.") - } - - req, err := client.SetAccessControlWithLeaseIDPreparer(ctx, accountName, containerName, leaseID, level) - if err != nil { - err = autorest.NewErrorWithError(err, "containers.Client", "SetAccessControl", nil, "Failure preparing request") - return - } - - resp, err := client.SetAccessControlWithLeaseIDSender(req) - if err != nil { - result = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containers.Client", "SetAccessControl", resp, "Failure sending request") - return - } - - result, err = client.SetAccessControlWithLeaseIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containers.Client", "SetAccessControl", resp, "Failure responding to request") - return - } - - return -} - -// SetAccessControlWithLeaseIDPreparer prepares the SetAccessControlWithLeaseID request. -func (client Client) SetAccessControlWithLeaseIDPreparer(ctx context.Context, accountName, containerName, leaseID string, level AccessLevel) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerName": autorest.Encode("path", containerName), - } - - queryParameters := map[string]interface{}{ - "comp": autorest.Encode("path", "acl"), - "restype": autorest.Encode("path", "container"), - } - - headers := map[string]interface{}{ - "x-ms-version": APIVersion, - } - - headers = client.setAccessLevelIntoHeaders(headers, level) - - // If specified, Get Container Properties only succeeds if the container’s lease is active and matches this ID. - // If there is no active lease or the ID does not match, 412 (Precondition Failed) is returned. - if leaseID != "" { - headers["x-ms-lease-id"] = leaseID - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/xml; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(endpoints.GetBlobEndpoint(client.BaseURI, accountName)), - autorest.WithPathParameters("/{containerName}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeaders(headers)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// SetAccessControlWithLeaseIDSender sends the SetAccessControlWithLeaseID request. The method will close the -// http.Response Body if it receives an error. -func (client Client) SetAccessControlWithLeaseIDSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// SetAccessControlWithLeaseIDResponder handles the response to the SetAccessControlWithLeaseID request. The method always -// closes the http.Response Body. -func (client Client) SetAccessControlWithLeaseIDResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result = autorest.Response{Response: resp} - - return -} diff --git a/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/set_metadata.go b/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/set_metadata.go deleted file mode 100644 index fb9e07fdefa92..0000000000000 --- a/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/set_metadata.go +++ /dev/null @@ -1,105 +0,0 @@ -package containers - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/tombuildsstuff/giovanni/storage/internal/endpoints" - "github.com/tombuildsstuff/giovanni/storage/internal/metadata" -) - -// SetMetaData sets the specified MetaData on the Container without a Lease ID -func (client Client) SetMetaData(ctx context.Context, accountName, containerName string, metaData map[string]string) (autorest.Response, error) { - return client.SetMetaDataWithLeaseID(ctx, accountName, containerName, "", metaData) -} - -// SetMetaDataWithLeaseID sets the specified MetaData on the Container using the specified Lease ID -func (client Client) SetMetaDataWithLeaseID(ctx context.Context, accountName, containerName, leaseID string, metaData map[string]string) (result autorest.Response, err error) { - if accountName == "" { - return result, validation.NewError("containers.Client", "SetMetaData", "`accountName` cannot be an empty string.") - } - if containerName == "" { - return result, validation.NewError("containers.Client", "SetMetaData", "`containerName` cannot be an empty string.") - } - if err := metadata.Validate(metaData); err != nil { - return result, validation.NewError("containers.Client", "SetMetaData", fmt.Sprintf("`metaData` is not valid: %s.", err)) - } - - req, err := client.SetMetaDataWithLeaseIDPreparer(ctx, accountName, containerName, leaseID, metaData) - if err != nil { - err = autorest.NewErrorWithError(err, "containers.Client", "SetMetaData", nil, "Failure preparing request") - return - } - - resp, err := client.SetMetaDataWithLeaseIDSender(req) - if err != nil { - result = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containers.Client", "SetMetaData", resp, "Failure sending request") - return - } - - result, err = client.SetMetaDataWithLeaseIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containers.Client", "SetMetaData", resp, "Failure responding to request") - return - } - - return -} - -// SetMetaDataWithLeaseIDPreparer prepares the SetMetaDataWithLeaseID request. -func (client Client) SetMetaDataWithLeaseIDPreparer(ctx context.Context, accountName, containerName, leaseID string, metaData map[string]string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerName": autorest.Encode("path", containerName), - } - - queryParameters := map[string]interface{}{ - "comp": autorest.Encode("path", "metadata"), - "restype": autorest.Encode("path", "container"), - } - - headers := map[string]interface{}{ - "x-ms-version": APIVersion, - } - - headers = metadata.SetIntoHeaders(headers, metaData) - - // If specified, Get Container Properties only succeeds if the container’s lease is active and matches this ID. - // If there is no active lease or the ID does not match, 412 (Precondition Failed) is returned. - if leaseID != "" { - headers["x-ms-lease-id"] = leaseID - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/xml; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(endpoints.GetBlobEndpoint(client.BaseURI, accountName)), - autorest.WithPathParameters("/{containerName}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeaders(headers)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// SetMetaDataWithLeaseIDSender sends the SetMetaDataWithLeaseID request. The method will close the -// http.Response Body if it receives an error. -func (client Client) SetMetaDataWithLeaseIDSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// SetMetaDataWithLeaseIDResponder handles the response to the SetMetaDataWithLeaseID request. The method always -// closes the http.Response Body. -func (client Client) SetMetaDataWithLeaseIDResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result = autorest.Response{Response: resp} - - return -} diff --git a/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/queue/queues/README.md b/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/queue/queues/README.md new file mode 100644 index 0000000000000..1769bfa56c392 --- /dev/null +++ b/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/queue/queues/README.md @@ -0,0 +1,43 @@ +## Queue Storage Queues SDK for API version 2018-11-09 + +This package allows you to interact with the Queues Queue Storage API + +### Supported Authorizers + +* Azure Active Directory (for the Resource Endpoint `https://storage.azure.com`) +* SharedKeyLite (Blob, File & Queue) + +### Example Usage + +```go +package main + +import ( + "context" + "fmt" + "time" + + "github.com/Azure/go-autorest/autorest" + "github.com/tombuildsstuff/giovanni/storage/2018-11-09/queue/queues" +) + +func Example() error { + accountName := "storageaccount1" + storageAccountKey := "ABC123...." + queueName := "myqueue" + + storageAuth := autorest.NewSharedKeyLiteAuthorizer(accountName, storageAccountKey) + queuesClient := queues.New() + queuesClient.Client.Authorizer = storageAuth + + ctx := context.TODO() + metadata := map[string]string{ + "hello": "world", + } + if _, err := queuesClient.Create(ctx, accountName, queueName, metadata); err != nil { + return fmt.Errorf("Error creating Queue: %s", err) + } + + return nil +} +``` \ No newline at end of file diff --git a/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/client.go b/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/queue/queues/client.go similarity index 50% rename from vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/client.go rename to vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/queue/queues/client.go index 7bf494734484d..2f8008582b939 100644 --- a/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/client.go +++ b/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/queue/queues/client.go @@ -1,11 +1,11 @@ -package containers +package queues import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" ) -// Client is the base client for Blob Storage Containers. +// Client is the base client for Queue Storage Shares. type Client struct { autorest.Client BaseURI string @@ -16,19 +16,10 @@ func New() Client { return NewWithEnvironment(azure.PublicCloud) } -// NewWithBaseURI creates an instance of the Client client. +// NewWithEnvironment creates an instance of the Client client. func NewWithEnvironment(environment azure.Environment) Client { return Client{ Client: autorest.NewClientWithUserAgent(UserAgent()), BaseURI: environment.StorageEndpointSuffix, } } - -func (client Client) setAccessLevelIntoHeaders(headers map[string]interface{}, level AccessLevel) map[string]interface{} { - // If this header is not included in the request, container data is private to the account owner. - if level != Private { - headers["x-ms-blob-public-access"] = string(level) - } - - return headers -} diff --git a/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/queue/queues/create.go b/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/queue/queues/create.go new file mode 100644 index 0000000000000..f18910a88d9e1 --- /dev/null +++ b/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/queue/queues/create.go @@ -0,0 +1,92 @@ +package queues + +import ( + "context" + "fmt" + "net/http" + "strings" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/tombuildsstuff/giovanni/storage/internal/endpoints" + "github.com/tombuildsstuff/giovanni/storage/internal/metadata" +) + +// Create creates the specified Queue within the specified Storage Account +func (client Client) Create(ctx context.Context, accountName, queueName string, metaData map[string]string) (result autorest.Response, err error) { + if accountName == "" { + return result, validation.NewError("queues.Client", "Create", "`accountName` cannot be an empty string.") + } + if queueName == "" { + return result, validation.NewError("queues.Client", "Create", "`queueName` cannot be an empty string.") + } + if strings.ToLower(queueName) != queueName { + return result, validation.NewError("queues.Client", "Create", "`queueName` must be a lower-cased string.") + } + if err := metadata.Validate(metaData); err != nil { + return result, validation.NewError("queues.Client", "Create", fmt.Sprintf("`metadata` is not valid: %s.", err)) + } + + req, err := client.CreatePreparer(ctx, accountName, queueName, metaData) + if err != nil { + err = autorest.NewErrorWithError(err, "queues.Client", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "queues.Client", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "queues.Client", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client Client) CreatePreparer(ctx context.Context, accountName string, queueName string, metaData map[string]string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "queueName": autorest.Encode("path", queueName), + } + + headers := map[string]interface{}{ + "x-ms-version": APIVersion, + } + + headers = metadata.SetIntoHeaders(headers, metaData) + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/xml; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(endpoints.GetQueueEndpoint(client.BaseURI, accountName)), + autorest.WithPathParameters("/{queueName}", pathParameters), + autorest.WithHeaders(headers)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client Client) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client Client) CreateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusCreated), + autorest.ByClosing()) + result = autorest.Response{Response: resp} + + return +} diff --git a/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/delete.go b/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/queue/queues/delete.go similarity index 52% rename from vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/delete.go rename to vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/queue/queues/delete.go index 30958295388eb..5f705959c4467 100644 --- a/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/delete.go +++ b/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/queue/queues/delete.go @@ -1,8 +1,9 @@ -package containers +package queues import ( "context" "net/http" + "strings" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" @@ -10,31 +11,34 @@ import ( "github.com/tombuildsstuff/giovanni/storage/internal/endpoints" ) -// Delete marks the specified container for deletion. -// The container and any blobs contained within it are later deleted during garbage collection. -func (client Client) Delete(ctx context.Context, accountName, containerName string) (result autorest.Response, err error) { +// Delete deletes the specified Queue within the specified Storage Account +func (client Client) Delete(ctx context.Context, accountName, queueName string) (result autorest.Response, err error) { if accountName == "" { - return result, validation.NewError("containers.Client", "Delete", "`accountName` cannot be an empty string.") + return result, validation.NewError("queues.Client", "Delete", "`accountName` cannot be an empty string.") } - if containerName == "" { - return result, validation.NewError("containers.Client", "Delete", "`containerName` cannot be an empty string.") + if queueName == "" { + return result, validation.NewError("queues.Client", "Delete", "`queueName` cannot be an empty string.") + } + if strings.ToLower(queueName) != queueName { + return result, validation.NewError("queues.Client", "Delete", "`queueName` must be a lower-cased string.") } - req, err := client.DeletePreparer(ctx, accountName, containerName) + req, err := client.DeletePreparer(ctx, accountName, queueName) if err != nil { - err = autorest.NewErrorWithError(err, "containers.Client", "Delete", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "queues.Client", "Delete", nil, "Failure preparing request") return } resp, err := client.DeleteSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "containers.Client", "Delete", resp, "Failure sending request") + result = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "queues.Client", "Delete", resp, "Failure sending request") return } result, err = client.DeleteResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "containers.Client", "Delete", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "queues.Client", "Delete", resp, "Failure responding to request") return } @@ -42,13 +46,9 @@ func (client Client) Delete(ctx context.Context, accountName, containerName stri } // DeletePreparer prepares the Delete request. -func (client Client) DeletePreparer(ctx context.Context, accountName string, containerName string) (*http.Request, error) { +func (client Client) DeletePreparer(ctx context.Context, accountName string, queueName string) (*http.Request, error) { pathParameters := map[string]interface{}{ - "containerName": autorest.Encode("path", containerName), - } - - queryParameters := map[string]interface{}{ - "restype": autorest.Encode("path", "container"), + "queueName": autorest.Encode("path", queueName), } headers := map[string]interface{}{ @@ -58,9 +58,8 @@ func (client Client) DeletePreparer(ctx context.Context, accountName string, con preparer := autorest.CreatePreparer( autorest.AsContentType("application/xml; charset=utf-8"), autorest.AsDelete(), - autorest.WithBaseURL(endpoints.GetBlobEndpoint(client.BaseURI, accountName)), - autorest.WithPathParameters("/{containerName}", pathParameters), - autorest.WithQueryParameters(queryParameters), + autorest.WithBaseURL(endpoints.GetQueueEndpoint(client.BaseURI, accountName)), + autorest.WithPathParameters("/{queueName}", pathParameters), autorest.WithHeaders(headers)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -78,8 +77,9 @@ func (client Client) DeleteResponder(resp *http.Response) (result autorest.Respo err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusAccepted), + azure.WithErrorUnlessStatusCode(http.StatusNoContent), autorest.ByClosing()) result = autorest.Response{Response: resp} + return } diff --git a/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/queue/queues/metadata_get.go b/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/queue/queues/metadata_get.go new file mode 100644 index 0000000000000..9c230b613ad34 --- /dev/null +++ b/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/queue/queues/metadata_get.go @@ -0,0 +1,101 @@ +package queues + +import ( + "context" + "net/http" + "strings" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/tombuildsstuff/giovanni/storage/internal/endpoints" + "github.com/tombuildsstuff/giovanni/storage/internal/metadata" +) + +type GetMetaDataResult struct { + autorest.Response + + MetaData map[string]string +} + +// GetMetaData returns the metadata for this Queue +func (client Client) GetMetaData(ctx context.Context, accountName, queueName string) (result GetMetaDataResult, err error) { + if accountName == "" { + return result, validation.NewError("queues.Client", "GetMetaData", "`accountName` cannot be an empty string.") + } + if queueName == "" { + return result, validation.NewError("queues.Client", "GetMetaData", "`queueName` cannot be an empty string.") + } + if strings.ToLower(queueName) != queueName { + return result, validation.NewError("queues.Client", "GetMetaData", "`queueName` must be a lower-cased string.") + } + + req, err := client.GetMetaDataPreparer(ctx, accountName, queueName) + if err != nil { + err = autorest.NewErrorWithError(err, "queues.Client", "GetMetaData", nil, "Failure preparing request") + return + } + + resp, err := client.GetMetaDataSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "queues.Client", "GetMetaData", resp, "Failure sending request") + return + } + + result, err = client.GetMetaDataResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "queues.Client", "GetMetaData", resp, "Failure responding to request") + return + } + + return +} + +// GetMetaDataPreparer prepares the GetMetaData request. +func (client Client) GetMetaDataPreparer(ctx context.Context, accountName, queueName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "queueName": autorest.Encode("path", queueName), + } + + queryParameters := map[string]interface{}{ + "comp": autorest.Encode("path", "metadata"), + } + + headers := map[string]interface{}{ + "x-ms-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/xml; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(endpoints.GetQueueEndpoint(client.BaseURI, accountName)), + autorest.WithPathParameters("/{queueName}", pathParameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeaders(headers)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetMetaDataSender sends the GetMetaData request. The method will close the +// http.Response Body if it receives an error. +func (client Client) GetMetaDataSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetMetaDataResponder handles the response to the GetMetaData request. The method always +// closes the http.Response Body. +func (client Client) GetMetaDataResponder(resp *http.Response) (result GetMetaDataResult, err error) { + if resp != nil { + result.MetaData = metadata.ParseFromHeaders(resp.Header) + } + + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + + return +} diff --git a/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/queue/queues/metadata_set.go b/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/queue/queues/metadata_set.go new file mode 100644 index 0000000000000..51154a5c4334f --- /dev/null +++ b/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/queue/queues/metadata_set.go @@ -0,0 +1,97 @@ +package queues + +import ( + "context" + "fmt" + "net/http" + "strings" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/tombuildsstuff/giovanni/storage/internal/endpoints" + "github.com/tombuildsstuff/giovanni/storage/internal/metadata" +) + +// SetMetaData returns the metadata for this Queue +func (client Client) SetMetaData(ctx context.Context, accountName, queueName string, metaData map[string]string) (result autorest.Response, err error) { + if accountName == "" { + return result, validation.NewError("queues.Client", "SetMetaData", "`accountName` cannot be an empty string.") + } + if queueName == "" { + return result, validation.NewError("queues.Client", "SetMetaData", "`queueName` cannot be an empty string.") + } + if strings.ToLower(queueName) != queueName { + return result, validation.NewError("queues.Client", "SetMetaData", "`queueName` must be a lower-cased string.") + } + if err := metadata.Validate(metaData); err != nil { + return result, validation.NewError("queues.Client", "SetMetaData", fmt.Sprintf("`metadata` is not valid: %s.", err)) + } + + req, err := client.SetMetaDataPreparer(ctx, accountName, queueName, metaData) + if err != nil { + err = autorest.NewErrorWithError(err, "queues.Client", "SetMetaData", nil, "Failure preparing request") + return + } + + resp, err := client.SetMetaDataSender(req) + if err != nil { + result = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "queues.Client", "SetMetaData", resp, "Failure sending request") + return + } + + result, err = client.SetMetaDataResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "queues.Client", "SetMetaData", resp, "Failure responding to request") + return + } + + return +} + +// SetMetaDataPreparer prepares the SetMetaData request. +func (client Client) SetMetaDataPreparer(ctx context.Context, accountName, queueName string, metaData map[string]string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "queueName": autorest.Encode("path", queueName), + } + + queryParameters := map[string]interface{}{ + "comp": autorest.Encode("path", "metadata"), + } + + headers := map[string]interface{}{ + "x-ms-version": APIVersion, + } + + headers = metadata.SetIntoHeaders(headers, metaData) + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/xml; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(endpoints.GetQueueEndpoint(client.BaseURI, accountName)), + autorest.WithPathParameters("/{queueName}", pathParameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeaders(headers)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// SetMetaDataSender sends the SetMetaData request. The method will close the +// http.Response Body if it receives an error. +func (client Client) SetMetaDataSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// SetMetaDataResponder handles the response to the SetMetaData request. The method always +// closes the http.Response Body. +func (client Client) SetMetaDataResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusNoContent), + autorest.ByClosing()) + result = autorest.Response{Response: resp} + + return +} diff --git a/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/queue/queues/models.go b/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/queue/queues/models.go new file mode 100644 index 0000000000000..89c23801279eb --- /dev/null +++ b/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/queue/queues/models.go @@ -0,0 +1,42 @@ +package queues + +type StorageServiceProperties struct { + Logging *LoggingConfig `xml:"Logging,omitempty"` + HourMetrics *MetricsConfig `xml:"HourMetrics,omitempty"` + MinuteMetrics *MetricsConfig `xml:"MinuteMetrics,omitempty"` + Cors *Cors `xml:"Cors,omitempty"` +} + +type LoggingConfig struct { + Version string `xml:"Version"` + Delete bool `xml:"Delete"` + Read bool `xml:"Read"` + Write bool `xml:"Write"` + RetentionPolicy RetentionPolicy `xml:"RetentionPolicy"` +} + +type MetricsConfig struct { + Version string `xml:"Version"` + Enabled bool `xml:"Enabled"` + RetentionPolicy RetentionPolicy `xml:"RetentionPolicy"` + + // Element IncludeAPIs is only expected when Metrics is enabled + IncludeAPIs *bool `xml:"IncludeAPIs,omitempty"` +} + +type RetentionPolicy struct { + Enabled bool `xml:"Enabled"` + Days int `xml:"Days"` +} + +type Cors struct { + CorsRule CorsRule `xml:"CorsRule"` +} + +type CorsRule struct { + AllowedOrigins string `xml:"AllowedOrigins"` + AllowedMethods string `xml:"AllowedMethods"` + AllowedHeaders string `xml:"AllowedHeaders` + ExposedHeaders string `xml:"ExposedHeaders"` + MaxAgeInSeconds int `xml:"MaxAgeInSeconds"` +} diff --git a/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/queue/queues/properties_get.go b/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/queue/queues/properties_get.go new file mode 100644 index 0000000000000..9d17fb2d2a594 --- /dev/null +++ b/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/queue/queues/properties_get.go @@ -0,0 +1,85 @@ +package queues + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/tombuildsstuff/giovanni/storage/internal/endpoints" +) + +type StorageServicePropertiesResponse struct { + StorageServiceProperties + autorest.Response +} + +// SetServiceProperties gets the properties for this queue +func (client Client) GetServiceProperties(ctx context.Context, accountName string) (result StorageServicePropertiesResponse, err error) { + if accountName == "" { + return result, validation.NewError("queues.Client", "SetServiceProperties", "`accountName` cannot be an empty string.") + } + + req, err := client.GetServicePropertiesPreparer(ctx, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "queues.Client", "SetServiceProperties", nil, "Failure preparing request") + return + } + + resp, err := client.GetServicePropertiesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "queues.Client", "SetServiceProperties", resp, "Failure sending request") + return + } + + result, err = client.GetServicePropertiesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "queues.Client", "SetServiceProperties", resp, "Failure responding to request") + return + } + + return +} + +// GetServicePropertiesPreparer prepares the GetServiceProperties request. +func (client Client) GetServicePropertiesPreparer(ctx context.Context, accountName string) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "comp": autorest.Encode("path", "properties"), + "restype": autorest.Encode("path", "service"), + } + + headers := map[string]interface{}{ + "x-ms-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/xml; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(endpoints.GetQueueEndpoint(client.BaseURI, accountName)), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeaders(headers)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetServicePropertiesSender sends the GetServiceProperties request. The method will close the +// http.Response Body if it receives an error. +func (client Client) GetServicePropertiesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetServicePropertiesResponder handles the response to the GetServiceProperties request. The method always +// closes the http.Response Body. +func (client Client) GetServicePropertiesResponder(resp *http.Response) (result StorageServicePropertiesResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingXML(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + + return +} diff --git a/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/queue/queues/properties_set.go b/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/queue/queues/properties_set.go new file mode 100644 index 0000000000000..d6f639245d038 --- /dev/null +++ b/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/queue/queues/properties_set.go @@ -0,0 +1,80 @@ +package queues + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/tombuildsstuff/giovanni/storage/internal/endpoints" +) + +// SetServiceProperties sets the properties for this queue +func (client Client) SetServiceProperties(ctx context.Context, accountName string, properties StorageServiceProperties) (result autorest.Response, err error) { + if accountName == "" { + return result, validation.NewError("queues.Client", "SetServiceProperties", "`accountName` cannot be an empty string.") + } + + req, err := client.SetServicePropertiesPreparer(ctx, accountName, properties) + if err != nil { + err = autorest.NewErrorWithError(err, "queues.Client", "SetServiceProperties", nil, "Failure preparing request") + return + } + + resp, err := client.SetServicePropertiesSender(req) + if err != nil { + result = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "queues.Client", "SetServiceProperties", resp, "Failure sending request") + return + } + + result, err = client.SetServicePropertiesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "queues.Client", "SetServiceProperties", resp, "Failure responding to request") + return + } + + return +} + +// SetServicePropertiesPreparer prepares the SetServiceProperties request. +func (client Client) SetServicePropertiesPreparer(ctx context.Context, accountName string, properties StorageServiceProperties) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "comp": autorest.Encode("path", "properties"), + "restype": autorest.Encode("path", "service"), + } + + headers := map[string]interface{}{ + "x-ms-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/xml; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(endpoints.GetQueueEndpoint(client.BaseURI, accountName)), + autorest.WithQueryParameters(queryParameters), + autorest.WithXML(properties), + autorest.WithHeaders(headers)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// SetServicePropertiesSender sends the SetServiceProperties request. The method will close the +// http.Response Body if it receives an error. +func (client Client) SetServicePropertiesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// SetServicePropertiesResponder handles the response to the SetServiceProperties request. The method always +// closes the http.Response Body. +func (client Client) SetServicePropertiesResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusAccepted), + autorest.ByClosing()) + result = autorest.Response{Response: resp} + + return +} diff --git a/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/resource_id.go b/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/queue/queues/resource_id.go similarity index 50% rename from vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/resource_id.go rename to vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/queue/queues/resource_id.go index 651dd84aed551..912923abca0d0 100644 --- a/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/resource_id.go +++ b/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/queue/queues/resource_id.go @@ -1,4 +1,4 @@ -package containers +package queues import ( "fmt" @@ -8,22 +8,22 @@ import ( "github.com/tombuildsstuff/giovanni/storage/internal/endpoints" ) -// GetResourceID returns the Resource ID for the given Container +// GetResourceID returns the Resource ID for the given Queue // This can be useful when, for example, you're using this as a unique identifier -func (client Client) GetResourceID(accountName, containerName string) string { - domain := endpoints.GetBlobEndpoint(client.BaseURI, accountName) - return fmt.Sprintf("%s/%s", domain, containerName) +func (client Client) GetResourceID(accountName, queueName string) string { + domain := endpoints.GetQueueEndpoint(client.BaseURI, accountName) + return fmt.Sprintf("%s/%s", domain, queueName) } type ResourceID struct { - AccountName string - ContainerName string + AccountName string + QueueName string } -// ParseResourceID parses the Resource ID and returns an object which can be used -// to interact with the Container Resource +// ParseResourceID parses the Resource ID and returns an Object which +// can be used to interact with a Queue within a Storage Account func ParseResourceID(id string) (*ResourceID, error) { - // example: https://foo.blob.core.windows.net/Bar + // example: https://foo.queue.core.windows.net/Bar if id == "" { return nil, fmt.Errorf("`id` was empty") } @@ -38,9 +38,9 @@ func ParseResourceID(id string) (*ResourceID, error) { return nil, fmt.Errorf("Error parsing Account Name: %s", err) } - containerName := strings.TrimPrefix(uri.Path, "/") + queueName := strings.TrimPrefix(uri.Path, "/") return &ResourceID{ - AccountName: *accountName, - ContainerName: containerName, + AccountName: *accountName, + QueueName: queueName, }, nil } diff --git a/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/version.go b/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/queue/queues/version.go similarity index 93% rename from vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/version.go rename to vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/queue/queues/version.go index 7047f301b1796..13c7d2fcd0ba5 100644 --- a/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers/version.go +++ b/vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/queue/queues/version.go @@ -1,4 +1,4 @@ -package containers +package queues import ( "fmt" diff --git a/vendor/modules.txt b/vendor/modules.txt index adfea7103bf75..3b053343fbbb3 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -341,6 +341,7 @@ github.com/terraform-providers/terraform-provider-azuread/version # github.com/tombuildsstuff/giovanni v0.2.1 github.com/tombuildsstuff/giovanni/storage/2018-11-09/file/directories github.com/tombuildsstuff/giovanni/storage/2018-11-09/file/shares +github.com/tombuildsstuff/giovanni/storage/2018-11-09/queue/queues github.com/tombuildsstuff/giovanni/storage/internal/endpoints github.com/tombuildsstuff/giovanni/storage/internal/metadata github.com/tombuildsstuff/giovanni/version