зеркало из https://github.com/Azure/ARO-RP.git
vendor changes for ARO-4373
This commit is contained in:
Родитель
5c6ca9d820
Коммит
883f1cb0ed
3
go.mod
3
go.mod
|
@ -10,6 +10,8 @@ require (
|
|||
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns v1.2.0
|
||||
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault v1.4.0
|
||||
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2 v2.2.1
|
||||
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.5.0
|
||||
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.3.2
|
||||
github.com/Azure/go-autorest/autorest v0.11.29
|
||||
github.com/Azure/go-autorest/autorest/adal v0.9.23
|
||||
github.com/Azure/go-autorest/autorest/date v0.3.0
|
||||
|
@ -81,6 +83,7 @@ require (
|
|||
golang.org/x/sync v0.7.0
|
||||
golang.org/x/text v0.16.0
|
||||
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d
|
||||
gopkg.in/go-jose/go-jose.v2 v2.6.1
|
||||
k8s.io/api v0.30.1
|
||||
k8s.io/apiextensions-apiserver v0.25.0
|
||||
k8s.io/apimachinery v0.30.1
|
||||
|
|
8
go.sum
8
go.sum
|
@ -20,6 +20,10 @@ github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault v1.4.
|
|||
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2 v2.2.1 h1:bWh0Z2rOEDfB/ywv/l0iHN1JgyazE6kW/aIA89+CEK0=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2 v2.2.1/go.mod h1:Bzf34hhAE9NSxailk8xVeLEZbUjOXcC+GnU1mMKdhLw=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.1.1 h1:7CBQ+Ei8SP2c6ydQTGCCrS35bDxgTMfoP2miAwK++OU=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.5.0 h1:AifHbc4mg0x9zW52WOpKbsHaDKuRhlI7TVl47thgQ70=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.5.0/go.mod h1:T5RfihdXtBDxt1Ch2wobif3TvzTdumDy29kahv6AV9A=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.3.2 h1:YUUxeiOWgdAQE3pXt2H7QXzZs0q8UBjgRbl56qo8GYM=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.3.2/go.mod h1:dmXQgZuiSubAecswZE+Sm8jkvEa7kQgTPVRvwL/nd0E=
|
||||
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E=
|
||||
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0=
|
||||
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E=
|
||||
|
@ -765,8 +769,8 @@ gopkg.in/alexcesaro/statsd.v2 v2.0.0 h1:FXkZSCZIH17vLCO5sO2UucTHsH9pc+17F6pl3JVC
|
|||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||
gopkg.in/go-jose/go-jose.v2 v2.6.3 h1:nt80fvSDlhKWQgSWyHyy5CfmlQr+asih51R8PTWNKKs=
|
||||
gopkg.in/go-jose/go-jose.v2 v2.6.3/go.mod h1:zzZDPkNNw/c9IE7Z9jr11mBZQhKQTMzoEEIoEdZlFBI=
|
||||
gopkg.in/go-jose/go-jose.v2 v2.6.1 h1:qEzJlIDmG9q5VO0M/o8tGS65QMHMS1w01TQJB1VPJ4U=
|
||||
gopkg.in/go-jose/go-jose.v2 v2.6.1/go.mod h1:zzZDPkNNw/c9IE7Z9jr11mBZQhKQTMzoEEIoEdZlFBI=
|
||||
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
|
||||
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k=
|
||||
|
|
68
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/CHANGELOG.md
сгенерированный
поставляемый
Normal file
68
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/CHANGELOG.md
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,68 @@
|
|||
# Release History
|
||||
|
||||
## 1.5.0 (2023-11-24)
|
||||
### Features Added
|
||||
|
||||
- Support for test fakes and OpenTelemetry trace spans.
|
||||
|
||||
|
||||
## 1.5.0-beta.1 (2023-10-09)
|
||||
### Features Added
|
||||
|
||||
- Support for test fakes and OpenTelemetry trace spans.
|
||||
|
||||
## 1.4.0 (2023-08-25)
|
||||
### Features Added
|
||||
|
||||
- New value `CorsRuleAllowedMethodsItemCONNECT`, `CorsRuleAllowedMethodsItemTRACE` added to enum type `CorsRuleAllowedMethodsItem`
|
||||
- New enum type `MigrationName` with values `MigrationNameDefault`
|
||||
- New enum type `MigrationStatus` with values `MigrationStatusComplete`, `MigrationStatusFailed`, `MigrationStatusInProgress`, `MigrationStatusInvalid`, `MigrationStatusSubmittedForConversion`
|
||||
- New enum type `PostFailoverRedundancy` with values `PostFailoverRedundancyStandardLRS`, `PostFailoverRedundancyStandardZRS`
|
||||
- New enum type `PostPlannedFailoverRedundancy` with values `PostPlannedFailoverRedundancyStandardGRS`, `PostPlannedFailoverRedundancyStandardGZRS`, `PostPlannedFailoverRedundancyStandardRAGRS`, `PostPlannedFailoverRedundancyStandardRAGZRS`
|
||||
- New function `*AccountsClient.BeginCustomerInitiatedMigration(context.Context, string, string, AccountMigration, *AccountsClientBeginCustomerInitiatedMigrationOptions) (*runtime.Poller[AccountsClientCustomerInitiatedMigrationResponse], error)`
|
||||
- New function `*AccountsClient.GetCustomerInitiatedMigration(context.Context, string, string, MigrationName, *AccountsClientGetCustomerInitiatedMigrationOptions) (AccountsClientGetCustomerInitiatedMigrationResponse, error)`
|
||||
- New struct `AccountMigration`
|
||||
- New struct `AccountMigrationProperties`
|
||||
- New struct `BlobInventoryCreationTime`
|
||||
- New struct `ErrorAdditionalInfo`
|
||||
- New struct `ErrorDetail`
|
||||
- New struct `ErrorResponseAutoGenerated`
|
||||
- New field `AccountMigrationInProgress`, `IsSKUConversionBlocked` in struct `AccountProperties`
|
||||
- New field `CreationTime` in struct `BlobInventoryPolicyFilter`
|
||||
- New field `CanPlannedFailover`, `PostFailoverRedundancy`, `PostPlannedFailoverRedundancy` in struct `GeoReplicationStats`
|
||||
|
||||
|
||||
## 1.3.0 (2023-03-27)
|
||||
### Features Added
|
||||
|
||||
- New struct `ClientFactory` which is a client factory used to create any client in this module
|
||||
|
||||
## 1.2.0 (2022-12-23)
|
||||
### Features Added
|
||||
|
||||
- New type alias `ListEncryptionScopesInclude`
|
||||
- New field `FailoverType` in struct `AccountsClientBeginFailoverOptions`
|
||||
- New field `TierToCold` in struct `ManagementPolicyBaseBlob`
|
||||
- New field `TierToHot` in struct `ManagementPolicyBaseBlob`
|
||||
- New field `Filter` in struct `EncryptionScopesClientListOptions`
|
||||
- New field `Include` in struct `EncryptionScopesClientListOptions`
|
||||
- New field `Maxpagesize` in struct `EncryptionScopesClientListOptions`
|
||||
- New field `TierToHot` in struct `ManagementPolicyVersion`
|
||||
- New field `TierToCold` in struct `ManagementPolicyVersion`
|
||||
- New field `TierToCold` in struct `ManagementPolicySnapShot`
|
||||
- New field `TierToHot` in struct `ManagementPolicySnapShot`
|
||||
|
||||
|
||||
## 1.1.0 (2022-08-10)
|
||||
### Features Added
|
||||
|
||||
- New const `DirectoryServiceOptionsAADKERB`
|
||||
|
||||
|
||||
## 1.0.0 (2022-05-16)
|
||||
|
||||
The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 1.0.0, which contains breaking changes.
|
||||
|
||||
To migrate the existing applications to the latest version, please refer to [Migration Guide](https://aka.ms/azsdk/go/mgmt/migration).
|
||||
|
||||
To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/go/mgmt).
|
21
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/LICENSE.txt
сгенерированный
поставляемый
Normal file
21
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/LICENSE.txt
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
102
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/README.md
сгенерированный
поставляемый
Normal file
102
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/README.md
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,102 @@
|
|||
# Azure Storage Module for Go
|
||||
|
||||
[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage)
|
||||
|
||||
The `armstorage` module provides operations for working with Azure Storage.
|
||||
|
||||
[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/storage/armstorage)
|
||||
|
||||
# Getting started
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- an [Azure subscription](https://azure.microsoft.com/free/)
|
||||
- Go 1.18 or above (You could download and install the latest version of Go from [here](https://go.dev/doc/install). It will replace the existing Go on your machine. If you want to install multiple Go versions on the same machine, you could refer this [doc](https://go.dev/doc/manage-install).)
|
||||
|
||||
## Install the package
|
||||
|
||||
This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management.
|
||||
|
||||
Install the Azure Storage module:
|
||||
|
||||
```sh
|
||||
go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage
|
||||
```
|
||||
|
||||
## Authorization
|
||||
|
||||
When creating a client, you will need to provide a credential for authenticating with Azure Storage. The `azidentity` module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more.
|
||||
|
||||
```go
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
```
|
||||
|
||||
For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity).
|
||||
|
||||
## Client Factory
|
||||
|
||||
Azure Storage module consists of one or more clients. We provide a client factory which could be used to create any client in this module.
|
||||
|
||||
```go
|
||||
clientFactory, err := armstorage.NewClientFactory(<subscription ID>, cred, nil)
|
||||
```
|
||||
|
||||
You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore).
|
||||
|
||||
```go
|
||||
options := arm.ClientOptions {
|
||||
ClientOptions: azcore.ClientOptions {
|
||||
Cloud: cloud.AzureChina,
|
||||
},
|
||||
}
|
||||
clientFactory, err := armstorage.NewClientFactory(<subscription ID>, cred, &options)
|
||||
```
|
||||
|
||||
## Clients
|
||||
|
||||
A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory.
|
||||
|
||||
```go
|
||||
client := clientFactory.NewAccountsClient()
|
||||
```
|
||||
|
||||
## Fakes
|
||||
|
||||
The fake package contains types used for constructing in-memory fake servers used in unit tests.
|
||||
This allows writing tests to cover various success/error conditions without the need for connecting to a live service.
|
||||
|
||||
Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes.
|
||||
|
||||
## More sample code
|
||||
|
||||
- [Blob](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/storage/blob)
|
||||
- [Creating a Fake](https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/resourcemanager/storage/armstorage/fake_example_test.go)
|
||||
- [File](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/storage/file)
|
||||
- [Management Policy](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/storage/managementpolicy)
|
||||
- [Queue](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/storage/queue)
|
||||
- [Storage Account](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/storage/storageaccount)
|
||||
- [Table](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/storage/table)
|
||||
|
||||
## Provide Feedback
|
||||
|
||||
If you encounter bugs or have suggestions, please
|
||||
[open an issue](https://github.com/Azure/azure-sdk-for-go/issues) and assign the `Storage` label.
|
||||
|
||||
# Contributing
|
||||
|
||||
This project welcomes contributions and suggestions. Most contributions require
|
||||
you to agree to a Contributor License Agreement (CLA) declaring that you have
|
||||
the right to, and actually do, grant us the rights to use your contribution.
|
||||
For details, visit [https://cla.microsoft.com](https://cla.microsoft.com).
|
||||
|
||||
When you submit a pull request, a CLA-bot will automatically determine whether
|
||||
you need to provide a CLA and decorate the PR appropriately (e.g., label,
|
||||
comment). Simply follow the instructions provided by the bot. You will only
|
||||
need to do this once across all repos using our CLA.
|
||||
|
||||
This project has adopted the
|
||||
[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
|
||||
For more information, see the
|
||||
[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
|
||||
or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any
|
||||
additional questions or comments.
|
1330
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/accounts_client.go
сгенерированный
поставляемый
Normal file
1330
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/accounts_client.go
сгенерированный
поставляемый
Normal file
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
6
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/assets.json
сгенерированный
поставляемый
Normal file
6
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/assets.json
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"AssetsRepo": "Azure/azure-sdk-assets",
|
||||
"AssetsRepoPrefixPath": "go",
|
||||
"TagPrefix": "go/resourcemanager/storage/armstorage",
|
||||
"Tag": "go/resourcemanager/storage/armstorage_c9d59e874d"
|
||||
}
|
15
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/autorest.md
сгенерированный
поставляемый
Normal file
15
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/autorest.md
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,15 @@
|
|||
### AutoRest Configuration
|
||||
|
||||
> see https://aka.ms/autorest
|
||||
|
||||
``` yaml
|
||||
azure-arm: true
|
||||
require:
|
||||
- https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/readme.md
|
||||
- https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/readme.go.md
|
||||
license-header: MICROSOFT_MIT_NO_VERSION
|
||||
module-version: 1.5.0
|
||||
modelerfour:
|
||||
seal-single-value-enum-by-default: true
|
||||
tag: package-2023-01
|
||||
```
|
1151
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/blobcontainers_client.go
сгенерированный
поставляемый
Normal file
1151
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/blobcontainers_client.go
сгенерированный
поставляемый
Normal file
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
318
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/blobinventorypolicies_client.go
сгенерированный
поставляемый
Normal file
318
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/blobinventorypolicies_client.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,318 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package armstorage
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// BlobInventoryPoliciesClient contains the methods for the BlobInventoryPolicies group.
|
||||
// Don't use this type directly, use NewBlobInventoryPoliciesClient() instead.
|
||||
type BlobInventoryPoliciesClient struct {
|
||||
internal *arm.Client
|
||||
subscriptionID string
|
||||
}
|
||||
|
||||
// NewBlobInventoryPoliciesClient creates a new instance of BlobInventoryPoliciesClient with the specified values.
|
||||
// - subscriptionID - The ID of the target subscription.
|
||||
// - credential - used to authorize requests. Usually a credential from azidentity.
|
||||
// - options - pass nil to accept the default values.
|
||||
func NewBlobInventoryPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BlobInventoryPoliciesClient, error) {
|
||||
cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client := &BlobInventoryPoliciesClient{
|
||||
subscriptionID: subscriptionID,
|
||||
internal: cl,
|
||||
}
|
||||
return client, nil
|
||||
}
|
||||
|
||||
// CreateOrUpdate - Sets the blob inventory policy to the specified storage account.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - blobInventoryPolicyName - The name of the storage account blob inventory policy. It should always be 'default'
|
||||
// - properties - The blob inventory policy set to a storage account.
|
||||
// - options - BlobInventoryPoliciesClientCreateOrUpdateOptions contains the optional parameters for the BlobInventoryPoliciesClient.CreateOrUpdate
|
||||
// method.
|
||||
func (client *BlobInventoryPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, blobInventoryPolicyName BlobInventoryPolicyName, properties BlobInventoryPolicy, options *BlobInventoryPoliciesClientCreateOrUpdateOptions) (BlobInventoryPoliciesClientCreateOrUpdateResponse, error) {
|
||||
var err error
|
||||
const operationName = "BlobInventoryPoliciesClient.CreateOrUpdate"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, accountName, blobInventoryPolicyName, properties, options)
|
||||
if err != nil {
|
||||
return BlobInventoryPoliciesClientCreateOrUpdateResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return BlobInventoryPoliciesClientCreateOrUpdateResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return BlobInventoryPoliciesClientCreateOrUpdateResponse{}, err
|
||||
}
|
||||
resp, err := client.createOrUpdateHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// createOrUpdateCreateRequest creates the CreateOrUpdate request.
|
||||
func (client *BlobInventoryPoliciesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, blobInventoryPolicyName BlobInventoryPolicyName, properties BlobInventoryPolicy, options *BlobInventoryPoliciesClientCreateOrUpdateOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if blobInventoryPolicyName == "" {
|
||||
return nil, errors.New("parameter blobInventoryPolicyName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{blobInventoryPolicyName}", url.PathEscape(string(blobInventoryPolicyName)))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
if err := runtime.MarshalAsJSON(req, properties); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// createOrUpdateHandleResponse handles the CreateOrUpdate response.
|
||||
func (client *BlobInventoryPoliciesClient) createOrUpdateHandleResponse(resp *http.Response) (BlobInventoryPoliciesClientCreateOrUpdateResponse, error) {
|
||||
result := BlobInventoryPoliciesClientCreateOrUpdateResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.BlobInventoryPolicy); err != nil {
|
||||
return BlobInventoryPoliciesClientCreateOrUpdateResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Delete - Deletes the blob inventory policy associated with the specified storage account.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - blobInventoryPolicyName - The name of the storage account blob inventory policy. It should always be 'default'
|
||||
// - options - BlobInventoryPoliciesClientDeleteOptions contains the optional parameters for the BlobInventoryPoliciesClient.Delete
|
||||
// method.
|
||||
func (client *BlobInventoryPoliciesClient) Delete(ctx context.Context, resourceGroupName string, accountName string, blobInventoryPolicyName BlobInventoryPolicyName, options *BlobInventoryPoliciesClientDeleteOptions) (BlobInventoryPoliciesClientDeleteResponse, error) {
|
||||
var err error
|
||||
const operationName = "BlobInventoryPoliciesClient.Delete"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, blobInventoryPolicyName, options)
|
||||
if err != nil {
|
||||
return BlobInventoryPoliciesClientDeleteResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return BlobInventoryPoliciesClientDeleteResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return BlobInventoryPoliciesClientDeleteResponse{}, err
|
||||
}
|
||||
return BlobInventoryPoliciesClientDeleteResponse{}, nil
|
||||
}
|
||||
|
||||
// deleteCreateRequest creates the Delete request.
|
||||
func (client *BlobInventoryPoliciesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, blobInventoryPolicyName BlobInventoryPolicyName, options *BlobInventoryPoliciesClientDeleteOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if blobInventoryPolicyName == "" {
|
||||
return nil, errors.New("parameter blobInventoryPolicyName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{blobInventoryPolicyName}", url.PathEscape(string(blobInventoryPolicyName)))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// Get - Gets the blob inventory policy associated with the specified storage account.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - blobInventoryPolicyName - The name of the storage account blob inventory policy. It should always be 'default'
|
||||
// - options - BlobInventoryPoliciesClientGetOptions contains the optional parameters for the BlobInventoryPoliciesClient.Get
|
||||
// method.
|
||||
func (client *BlobInventoryPoliciesClient) Get(ctx context.Context, resourceGroupName string, accountName string, blobInventoryPolicyName BlobInventoryPolicyName, options *BlobInventoryPoliciesClientGetOptions) (BlobInventoryPoliciesClientGetResponse, error) {
|
||||
var err error
|
||||
const operationName = "BlobInventoryPoliciesClient.Get"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, blobInventoryPolicyName, options)
|
||||
if err != nil {
|
||||
return BlobInventoryPoliciesClientGetResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return BlobInventoryPoliciesClientGetResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return BlobInventoryPoliciesClientGetResponse{}, err
|
||||
}
|
||||
resp, err := client.getHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// getCreateRequest creates the Get request.
|
||||
func (client *BlobInventoryPoliciesClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, blobInventoryPolicyName BlobInventoryPolicyName, options *BlobInventoryPoliciesClientGetOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if blobInventoryPolicyName == "" {
|
||||
return nil, errors.New("parameter blobInventoryPolicyName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{blobInventoryPolicyName}", url.PathEscape(string(blobInventoryPolicyName)))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// getHandleResponse handles the Get response.
|
||||
func (client *BlobInventoryPoliciesClient) getHandleResponse(resp *http.Response) (BlobInventoryPoliciesClientGetResponse, error) {
|
||||
result := BlobInventoryPoliciesClientGetResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.BlobInventoryPolicy); err != nil {
|
||||
return BlobInventoryPoliciesClientGetResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// NewListPager - Gets the blob inventory policy associated with the specified storage account.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - options - BlobInventoryPoliciesClientListOptions contains the optional parameters for the BlobInventoryPoliciesClient.NewListPager
|
||||
// method.
|
||||
func (client *BlobInventoryPoliciesClient) NewListPager(resourceGroupName string, accountName string, options *BlobInventoryPoliciesClientListOptions) *runtime.Pager[BlobInventoryPoliciesClientListResponse] {
|
||||
return runtime.NewPager(runtime.PagingHandler[BlobInventoryPoliciesClientListResponse]{
|
||||
More: func(page BlobInventoryPoliciesClientListResponse) bool {
|
||||
return false
|
||||
},
|
||||
Fetcher: func(ctx context.Context, page *BlobInventoryPoliciesClientListResponse) (BlobInventoryPoliciesClientListResponse, error) {
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "BlobInventoryPoliciesClient.NewListPager")
|
||||
req, err := client.listCreateRequest(ctx, resourceGroupName, accountName, options)
|
||||
if err != nil {
|
||||
return BlobInventoryPoliciesClientListResponse{}, err
|
||||
}
|
||||
resp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return BlobInventoryPoliciesClientListResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusOK) {
|
||||
return BlobInventoryPoliciesClientListResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.listHandleResponse(resp)
|
||||
},
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
}
|
||||
|
||||
// listCreateRequest creates the List request.
|
||||
func (client *BlobInventoryPoliciesClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *BlobInventoryPoliciesClientListOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// listHandleResponse handles the List response.
|
||||
func (client *BlobInventoryPoliciesClient) listHandleResponse(resp *http.Response) (BlobInventoryPoliciesClientListResponse, error) {
|
||||
result := BlobInventoryPoliciesClientListResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.ListBlobInventoryPolicy); err != nil {
|
||||
return BlobInventoryPoliciesClientListResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
251
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/blobservices_client.go
сгенерированный
поставляемый
Normal file
251
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/blobservices_client.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,251 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package armstorage
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// BlobServicesClient contains the methods for the BlobServices group.
|
||||
// Don't use this type directly, use NewBlobServicesClient() instead.
|
||||
type BlobServicesClient struct {
|
||||
internal *arm.Client
|
||||
subscriptionID string
|
||||
}
|
||||
|
||||
// NewBlobServicesClient creates a new instance of BlobServicesClient with the specified values.
|
||||
// - subscriptionID - The ID of the target subscription.
|
||||
// - credential - used to authorize requests. Usually a credential from azidentity.
|
||||
// - options - pass nil to accept the default values.
|
||||
func NewBlobServicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BlobServicesClient, error) {
|
||||
cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client := &BlobServicesClient{
|
||||
subscriptionID: subscriptionID,
|
||||
internal: cl,
|
||||
}
|
||||
return client, nil
|
||||
}
|
||||
|
||||
// GetServiceProperties - Gets the properties of a storage account’s Blob service, including properties for Storage Analytics
|
||||
// and CORS (Cross-Origin Resource Sharing) rules.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - options - BlobServicesClientGetServicePropertiesOptions contains the optional parameters for the BlobServicesClient.GetServiceProperties
|
||||
// method.
|
||||
func (client *BlobServicesClient) GetServiceProperties(ctx context.Context, resourceGroupName string, accountName string, options *BlobServicesClientGetServicePropertiesOptions) (BlobServicesClientGetServicePropertiesResponse, error) {
|
||||
var err error
|
||||
const operationName = "BlobServicesClient.GetServiceProperties"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.getServicePropertiesCreateRequest(ctx, resourceGroupName, accountName, options)
|
||||
if err != nil {
|
||||
return BlobServicesClientGetServicePropertiesResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return BlobServicesClientGetServicePropertiesResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return BlobServicesClientGetServicePropertiesResponse{}, err
|
||||
}
|
||||
resp, err := client.getServicePropertiesHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// getServicePropertiesCreateRequest creates the GetServiceProperties request.
|
||||
func (client *BlobServicesClient) getServicePropertiesCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *BlobServicesClientGetServicePropertiesOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
urlPath = strings.ReplaceAll(urlPath, "{BlobServicesName}", url.PathEscape("default"))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// getServicePropertiesHandleResponse handles the GetServiceProperties response.
|
||||
func (client *BlobServicesClient) getServicePropertiesHandleResponse(resp *http.Response) (BlobServicesClientGetServicePropertiesResponse, error) {
|
||||
result := BlobServicesClientGetServicePropertiesResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.BlobServiceProperties); err != nil {
|
||||
return BlobServicesClientGetServicePropertiesResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// NewListPager - List blob services of storage account. It returns a collection of one object named default.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - options - BlobServicesClientListOptions contains the optional parameters for the BlobServicesClient.NewListPager method.
|
||||
func (client *BlobServicesClient) NewListPager(resourceGroupName string, accountName string, options *BlobServicesClientListOptions) *runtime.Pager[BlobServicesClientListResponse] {
|
||||
return runtime.NewPager(runtime.PagingHandler[BlobServicesClientListResponse]{
|
||||
More: func(page BlobServicesClientListResponse) bool {
|
||||
return false
|
||||
},
|
||||
Fetcher: func(ctx context.Context, page *BlobServicesClientListResponse) (BlobServicesClientListResponse, error) {
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "BlobServicesClient.NewListPager")
|
||||
req, err := client.listCreateRequest(ctx, resourceGroupName, accountName, options)
|
||||
if err != nil {
|
||||
return BlobServicesClientListResponse{}, err
|
||||
}
|
||||
resp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return BlobServicesClientListResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusOK) {
|
||||
return BlobServicesClientListResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.listHandleResponse(resp)
|
||||
},
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
}
|
||||
|
||||
// listCreateRequest creates the List request.
|
||||
func (client *BlobServicesClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *BlobServicesClientListOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// listHandleResponse handles the List response.
|
||||
func (client *BlobServicesClient) listHandleResponse(resp *http.Response) (BlobServicesClientListResponse, error) {
|
||||
result := BlobServicesClientListResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.BlobServiceItems); err != nil {
|
||||
return BlobServicesClientListResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// SetServiceProperties - Sets the properties of a storage account’s Blob service, including properties for Storage Analytics
|
||||
// and CORS (Cross-Origin Resource Sharing) rules.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - parameters - The properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin
|
||||
// Resource Sharing) rules.
|
||||
// - options - BlobServicesClientSetServicePropertiesOptions contains the optional parameters for the BlobServicesClient.SetServiceProperties
|
||||
// method.
|
||||
func (client *BlobServicesClient) SetServiceProperties(ctx context.Context, resourceGroupName string, accountName string, parameters BlobServiceProperties, options *BlobServicesClientSetServicePropertiesOptions) (BlobServicesClientSetServicePropertiesResponse, error) {
|
||||
var err error
|
||||
const operationName = "BlobServicesClient.SetServiceProperties"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.setServicePropertiesCreateRequest(ctx, resourceGroupName, accountName, parameters, options)
|
||||
if err != nil {
|
||||
return BlobServicesClientSetServicePropertiesResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return BlobServicesClientSetServicePropertiesResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return BlobServicesClientSetServicePropertiesResponse{}, err
|
||||
}
|
||||
resp, err := client.setServicePropertiesHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// setServicePropertiesCreateRequest creates the SetServiceProperties request.
|
||||
func (client *BlobServicesClient) setServicePropertiesCreateRequest(ctx context.Context, resourceGroupName string, accountName string, parameters BlobServiceProperties, options *BlobServicesClientSetServicePropertiesOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
urlPath = strings.ReplaceAll(urlPath, "{BlobServicesName}", url.PathEscape("default"))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
if err := runtime.MarshalAsJSON(req, parameters); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// setServicePropertiesHandleResponse handles the SetServiceProperties response.
|
||||
func (client *BlobServicesClient) setServicePropertiesHandleResponse(resp *http.Response) (BlobServicesClientSetServicePropertiesResponse, error) {
|
||||
result := BlobServicesClientSetServicePropertiesResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.BlobServiceProperties); err != nil {
|
||||
return BlobServicesClientSetServicePropertiesResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
7
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/build.go
сгенерированный
поставляемый
Normal file
7
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/build.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,7 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
// This file enables 'go generate' to regenerate this specific SDK
|
||||
//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate resourcemanager/storage/armstorage
|
||||
|
||||
package armstorage
|
28
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/ci.yml
сгенерированный
поставляемый
Normal file
28
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/ci.yml
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,28 @@
|
|||
# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file.
|
||||
trigger:
|
||||
branches:
|
||||
include:
|
||||
- main
|
||||
- feature/*
|
||||
- hotfix/*
|
||||
- release/*
|
||||
paths:
|
||||
include:
|
||||
- sdk/resourcemanager/storage/armstorage/
|
||||
|
||||
pr:
|
||||
branches:
|
||||
include:
|
||||
- main
|
||||
- feature/*
|
||||
- hotfix/*
|
||||
- release/*
|
||||
paths:
|
||||
include:
|
||||
- sdk/resourcemanager/storage/armstorage/
|
||||
|
||||
stages:
|
||||
- template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml
|
||||
parameters:
|
||||
IncludeRelease: true
|
||||
ServiceDirectory: 'resourcemanager/storage/armstorage'
|
158
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/client_factory.go
сгенерированный
поставляемый
Normal file
158
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/client_factory.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,158 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package armstorage
|
||||
|
||||
import (
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
|
||||
)
|
||||
|
||||
// ClientFactory is a client factory used to create any client in this module.
|
||||
// Don't use this type directly, use NewClientFactory instead.
|
||||
type ClientFactory struct {
|
||||
subscriptionID string
|
||||
credential azcore.TokenCredential
|
||||
options *arm.ClientOptions
|
||||
}
|
||||
|
||||
// NewClientFactory creates a new instance of ClientFactory with the specified values.
|
||||
// The parameter values will be propagated to any client created from this factory.
|
||||
// - subscriptionID - The ID of the target subscription.
|
||||
// - credential - used to authorize requests. Usually a credential from azidentity.
|
||||
// - options - pass nil to accept the default values.
|
||||
func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) {
|
||||
_, err := arm.NewClient(moduleName, moduleVersion, credential, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &ClientFactory{
|
||||
subscriptionID: subscriptionID, credential: credential,
|
||||
options: options.Clone(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// NewAccountsClient creates a new instance of AccountsClient.
|
||||
func (c *ClientFactory) NewAccountsClient() *AccountsClient {
|
||||
subClient, _ := NewAccountsClient(c.subscriptionID, c.credential, c.options)
|
||||
return subClient
|
||||
}
|
||||
|
||||
// NewBlobContainersClient creates a new instance of BlobContainersClient.
|
||||
func (c *ClientFactory) NewBlobContainersClient() *BlobContainersClient {
|
||||
subClient, _ := NewBlobContainersClient(c.subscriptionID, c.credential, c.options)
|
||||
return subClient
|
||||
}
|
||||
|
||||
// NewBlobInventoryPoliciesClient creates a new instance of BlobInventoryPoliciesClient.
|
||||
func (c *ClientFactory) NewBlobInventoryPoliciesClient() *BlobInventoryPoliciesClient {
|
||||
subClient, _ := NewBlobInventoryPoliciesClient(c.subscriptionID, c.credential, c.options)
|
||||
return subClient
|
||||
}
|
||||
|
||||
// NewBlobServicesClient creates a new instance of BlobServicesClient.
|
||||
func (c *ClientFactory) NewBlobServicesClient() *BlobServicesClient {
|
||||
subClient, _ := NewBlobServicesClient(c.subscriptionID, c.credential, c.options)
|
||||
return subClient
|
||||
}
|
||||
|
||||
// NewDeletedAccountsClient creates a new instance of DeletedAccountsClient.
|
||||
func (c *ClientFactory) NewDeletedAccountsClient() *DeletedAccountsClient {
|
||||
subClient, _ := NewDeletedAccountsClient(c.subscriptionID, c.credential, c.options)
|
||||
return subClient
|
||||
}
|
||||
|
||||
// NewEncryptionScopesClient creates a new instance of EncryptionScopesClient.
|
||||
func (c *ClientFactory) NewEncryptionScopesClient() *EncryptionScopesClient {
|
||||
subClient, _ := NewEncryptionScopesClient(c.subscriptionID, c.credential, c.options)
|
||||
return subClient
|
||||
}
|
||||
|
||||
// NewFileServicesClient creates a new instance of FileServicesClient.
|
||||
func (c *ClientFactory) NewFileServicesClient() *FileServicesClient {
|
||||
subClient, _ := NewFileServicesClient(c.subscriptionID, c.credential, c.options)
|
||||
return subClient
|
||||
}
|
||||
|
||||
// NewFileSharesClient creates a new instance of FileSharesClient.
|
||||
func (c *ClientFactory) NewFileSharesClient() *FileSharesClient {
|
||||
subClient, _ := NewFileSharesClient(c.subscriptionID, c.credential, c.options)
|
||||
return subClient
|
||||
}
|
||||
|
||||
// NewLocalUsersClient creates a new instance of LocalUsersClient.
|
||||
func (c *ClientFactory) NewLocalUsersClient() *LocalUsersClient {
|
||||
subClient, _ := NewLocalUsersClient(c.subscriptionID, c.credential, c.options)
|
||||
return subClient
|
||||
}
|
||||
|
||||
// NewManagementPoliciesClient creates a new instance of ManagementPoliciesClient.
|
||||
func (c *ClientFactory) NewManagementPoliciesClient() *ManagementPoliciesClient {
|
||||
subClient, _ := NewManagementPoliciesClient(c.subscriptionID, c.credential, c.options)
|
||||
return subClient
|
||||
}
|
||||
|
||||
// NewObjectReplicationPoliciesClient creates a new instance of ObjectReplicationPoliciesClient.
|
||||
func (c *ClientFactory) NewObjectReplicationPoliciesClient() *ObjectReplicationPoliciesClient {
|
||||
subClient, _ := NewObjectReplicationPoliciesClient(c.subscriptionID, c.credential, c.options)
|
||||
return subClient
|
||||
}
|
||||
|
||||
// NewOperationsClient creates a new instance of OperationsClient.
|
||||
func (c *ClientFactory) NewOperationsClient() *OperationsClient {
|
||||
subClient, _ := NewOperationsClient(c.credential, c.options)
|
||||
return subClient
|
||||
}
|
||||
|
||||
// NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient.
|
||||
func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient {
|
||||
subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options)
|
||||
return subClient
|
||||
}
|
||||
|
||||
// NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient.
|
||||
func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient {
|
||||
subClient, _ := NewPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options)
|
||||
return subClient
|
||||
}
|
||||
|
||||
// NewQueueClient creates a new instance of QueueClient.
|
||||
func (c *ClientFactory) NewQueueClient() *QueueClient {
|
||||
subClient, _ := NewQueueClient(c.subscriptionID, c.credential, c.options)
|
||||
return subClient
|
||||
}
|
||||
|
||||
// NewQueueServicesClient creates a new instance of QueueServicesClient.
|
||||
func (c *ClientFactory) NewQueueServicesClient() *QueueServicesClient {
|
||||
subClient, _ := NewQueueServicesClient(c.subscriptionID, c.credential, c.options)
|
||||
return subClient
|
||||
}
|
||||
|
||||
// NewSKUsClient creates a new instance of SKUsClient.
|
||||
func (c *ClientFactory) NewSKUsClient() *SKUsClient {
|
||||
subClient, _ := NewSKUsClient(c.subscriptionID, c.credential, c.options)
|
||||
return subClient
|
||||
}
|
||||
|
||||
// NewTableClient creates a new instance of TableClient.
|
||||
func (c *ClientFactory) NewTableClient() *TableClient {
|
||||
subClient, _ := NewTableClient(c.subscriptionID, c.credential, c.options)
|
||||
return subClient
|
||||
}
|
||||
|
||||
// NewTableServicesClient creates a new instance of TableServicesClient.
|
||||
func (c *ClientFactory) NewTableServicesClient() *TableServicesClient {
|
||||
subClient, _ := NewTableServicesClient(c.subscriptionID, c.credential, c.options)
|
||||
return subClient
|
||||
}
|
||||
|
||||
// NewUsagesClient creates a new instance of UsagesClient.
|
||||
func (c *ClientFactory) NewUsagesClient() *UsagesClient {
|
||||
subClient, _ := NewUsagesClient(c.subscriptionID, c.credential, c.options)
|
||||
return subClient
|
||||
}
|
1274
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/constants.go
сгенерированный
поставляемый
Normal file
1274
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/constants.go
сгенерированный
поставляемый
Normal file
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
163
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/deletedaccounts_client.go
сгенерированный
поставляемый
Normal file
163
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/deletedaccounts_client.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,163 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package armstorage
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// DeletedAccountsClient contains the methods for the DeletedAccounts group.
|
||||
// Don't use this type directly, use NewDeletedAccountsClient() instead.
|
||||
type DeletedAccountsClient struct {
|
||||
internal *arm.Client
|
||||
subscriptionID string
|
||||
}
|
||||
|
||||
// NewDeletedAccountsClient creates a new instance of DeletedAccountsClient with the specified values.
|
||||
// - subscriptionID - The ID of the target subscription.
|
||||
// - credential - used to authorize requests. Usually a credential from azidentity.
|
||||
// - options - pass nil to accept the default values.
|
||||
func NewDeletedAccountsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DeletedAccountsClient, error) {
|
||||
cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client := &DeletedAccountsClient{
|
||||
subscriptionID: subscriptionID,
|
||||
internal: cl,
|
||||
}
|
||||
return client, nil
|
||||
}
|
||||
|
||||
// Get - Get properties of specified deleted account resource.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - deletedAccountName - Name of the deleted storage account.
|
||||
// - location - The location of the deleted storage account.
|
||||
// - options - DeletedAccountsClientGetOptions contains the optional parameters for the DeletedAccountsClient.Get method.
|
||||
func (client *DeletedAccountsClient) Get(ctx context.Context, deletedAccountName string, location string, options *DeletedAccountsClientGetOptions) (DeletedAccountsClientGetResponse, error) {
|
||||
var err error
|
||||
const operationName = "DeletedAccountsClient.Get"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.getCreateRequest(ctx, deletedAccountName, location, options)
|
||||
if err != nil {
|
||||
return DeletedAccountsClientGetResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return DeletedAccountsClientGetResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return DeletedAccountsClientGetResponse{}, err
|
||||
}
|
||||
resp, err := client.getHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// getCreateRequest creates the Get request.
|
||||
func (client *DeletedAccountsClient) getCreateRequest(ctx context.Context, deletedAccountName string, location string, options *DeletedAccountsClientGetOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/deletedAccounts/{deletedAccountName}"
|
||||
if deletedAccountName == "" {
|
||||
return nil, errors.New("parameter deletedAccountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{deletedAccountName}", url.PathEscape(deletedAccountName))
|
||||
if location == "" {
|
||||
return nil, errors.New("parameter location cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// getHandleResponse handles the Get response.
|
||||
func (client *DeletedAccountsClient) getHandleResponse(resp *http.Response) (DeletedAccountsClientGetResponse, error) {
|
||||
result := DeletedAccountsClientGetResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.DeletedAccount); err != nil {
|
||||
return DeletedAccountsClientGetResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// NewListPager - Lists deleted accounts under the subscription.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - options - DeletedAccountsClientListOptions contains the optional parameters for the DeletedAccountsClient.NewListPager
|
||||
// method.
|
||||
func (client *DeletedAccountsClient) NewListPager(options *DeletedAccountsClientListOptions) *runtime.Pager[DeletedAccountsClientListResponse] {
|
||||
return runtime.NewPager(runtime.PagingHandler[DeletedAccountsClientListResponse]{
|
||||
More: func(page DeletedAccountsClientListResponse) bool {
|
||||
return page.NextLink != nil && len(*page.NextLink) > 0
|
||||
},
|
||||
Fetcher: func(ctx context.Context, page *DeletedAccountsClientListResponse) (DeletedAccountsClientListResponse, error) {
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DeletedAccountsClient.NewListPager")
|
||||
nextLink := ""
|
||||
if page != nil {
|
||||
nextLink = *page.NextLink
|
||||
}
|
||||
resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) {
|
||||
return client.listCreateRequest(ctx, options)
|
||||
}, nil)
|
||||
if err != nil {
|
||||
return DeletedAccountsClientListResponse{}, err
|
||||
}
|
||||
return client.listHandleResponse(resp)
|
||||
},
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
}
|
||||
|
||||
// listCreateRequest creates the List request.
|
||||
func (client *DeletedAccountsClient) listCreateRequest(ctx context.Context, options *DeletedAccountsClientListOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Storage/deletedAccounts"
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// listHandleResponse handles the List response.
|
||||
func (client *DeletedAccountsClient) listHandleResponse(resp *http.Response) (DeletedAccountsClientListResponse, error) {
|
||||
result := DeletedAccountsClientListResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.DeletedAccountListResult); err != nil {
|
||||
return DeletedAccountsClientListResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
347
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/encryptionscopes_client.go
сгенерированный
поставляемый
Normal file
347
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/encryptionscopes_client.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,347 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package armstorage
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// EncryptionScopesClient contains the methods for the EncryptionScopes group.
|
||||
// Don't use this type directly, use NewEncryptionScopesClient() instead.
|
||||
type EncryptionScopesClient struct {
|
||||
internal *arm.Client
|
||||
subscriptionID string
|
||||
}
|
||||
|
||||
// NewEncryptionScopesClient creates a new instance of EncryptionScopesClient with the specified values.
|
||||
// - subscriptionID - The ID of the target subscription.
|
||||
// - credential - used to authorize requests. Usually a credential from azidentity.
|
||||
// - options - pass nil to accept the default values.
|
||||
func NewEncryptionScopesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*EncryptionScopesClient, error) {
|
||||
cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client := &EncryptionScopesClient{
|
||||
subscriptionID: subscriptionID,
|
||||
internal: cl,
|
||||
}
|
||||
return client, nil
|
||||
}
|
||||
|
||||
// Get - Returns the properties for the specified encryption scope.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - encryptionScopeName - The name of the encryption scope within the specified storage account. Encryption scope names must
|
||||
// be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every
|
||||
// dash (-) character must be immediately preceded and followed by a letter or number.
|
||||
// - options - EncryptionScopesClientGetOptions contains the optional parameters for the EncryptionScopesClient.Get method.
|
||||
func (client *EncryptionScopesClient) Get(ctx context.Context, resourceGroupName string, accountName string, encryptionScopeName string, options *EncryptionScopesClientGetOptions) (EncryptionScopesClientGetResponse, error) {
|
||||
var err error
|
||||
const operationName = "EncryptionScopesClient.Get"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, encryptionScopeName, options)
|
||||
if err != nil {
|
||||
return EncryptionScopesClientGetResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return EncryptionScopesClientGetResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return EncryptionScopesClientGetResponse{}, err
|
||||
}
|
||||
resp, err := client.getHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// getCreateRequest creates the Get request.
|
||||
func (client *EncryptionScopesClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, encryptionScopeName string, options *EncryptionScopesClientGetOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if encryptionScopeName == "" {
|
||||
return nil, errors.New("parameter encryptionScopeName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{encryptionScopeName}", url.PathEscape(encryptionScopeName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// getHandleResponse handles the Get response.
|
||||
func (client *EncryptionScopesClient) getHandleResponse(resp *http.Response) (EncryptionScopesClientGetResponse, error) {
|
||||
result := EncryptionScopesClientGetResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.EncryptionScope); err != nil {
|
||||
return EncryptionScopesClientGetResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// NewListPager - Lists all the encryption scopes available under the specified storage account.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - options - EncryptionScopesClientListOptions contains the optional parameters for the EncryptionScopesClient.NewListPager
|
||||
// method.
|
||||
func (client *EncryptionScopesClient) NewListPager(resourceGroupName string, accountName string, options *EncryptionScopesClientListOptions) *runtime.Pager[EncryptionScopesClientListResponse] {
|
||||
return runtime.NewPager(runtime.PagingHandler[EncryptionScopesClientListResponse]{
|
||||
More: func(page EncryptionScopesClientListResponse) bool {
|
||||
return page.NextLink != nil && len(*page.NextLink) > 0
|
||||
},
|
||||
Fetcher: func(ctx context.Context, page *EncryptionScopesClientListResponse) (EncryptionScopesClientListResponse, error) {
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "EncryptionScopesClient.NewListPager")
|
||||
nextLink := ""
|
||||
if page != nil {
|
||||
nextLink = *page.NextLink
|
||||
}
|
||||
resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) {
|
||||
return client.listCreateRequest(ctx, resourceGroupName, accountName, options)
|
||||
}, nil)
|
||||
if err != nil {
|
||||
return EncryptionScopesClientListResponse{}, err
|
||||
}
|
||||
return client.listHandleResponse(resp)
|
||||
},
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
}
|
||||
|
||||
// listCreateRequest creates the List request.
|
||||
func (client *EncryptionScopesClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *EncryptionScopesClientListOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
if options != nil && options.Maxpagesize != nil {
|
||||
reqQP.Set("$maxpagesize", strconv.FormatInt(int64(*options.Maxpagesize), 10))
|
||||
}
|
||||
if options != nil && options.Filter != nil {
|
||||
reqQP.Set("$filter", *options.Filter)
|
||||
}
|
||||
if options != nil && options.Include != nil {
|
||||
reqQP.Set("$include", string(*options.Include))
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// listHandleResponse handles the List response.
|
||||
func (client *EncryptionScopesClient) listHandleResponse(resp *http.Response) (EncryptionScopesClientListResponse, error) {
|
||||
result := EncryptionScopesClientListResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.EncryptionScopeListResult); err != nil {
|
||||
return EncryptionScopesClientListResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Patch - Update encryption scope properties as specified in the request body. Update fails if the specified encryption scope
|
||||
// does not already exist.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - encryptionScopeName - The name of the encryption scope within the specified storage account. Encryption scope names must
|
||||
// be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every
|
||||
// dash (-) character must be immediately preceded and followed by a letter or number.
|
||||
// - encryptionScope - Encryption scope properties to be used for the update.
|
||||
// - options - EncryptionScopesClientPatchOptions contains the optional parameters for the EncryptionScopesClient.Patch method.
|
||||
func (client *EncryptionScopesClient) Patch(ctx context.Context, resourceGroupName string, accountName string, encryptionScopeName string, encryptionScope EncryptionScope, options *EncryptionScopesClientPatchOptions) (EncryptionScopesClientPatchResponse, error) {
|
||||
var err error
|
||||
const operationName = "EncryptionScopesClient.Patch"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.patchCreateRequest(ctx, resourceGroupName, accountName, encryptionScopeName, encryptionScope, options)
|
||||
if err != nil {
|
||||
return EncryptionScopesClientPatchResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return EncryptionScopesClientPatchResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return EncryptionScopesClientPatchResponse{}, err
|
||||
}
|
||||
resp, err := client.patchHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// patchCreateRequest creates the Patch request.
|
||||
func (client *EncryptionScopesClient) patchCreateRequest(ctx context.Context, resourceGroupName string, accountName string, encryptionScopeName string, encryptionScope EncryptionScope, options *EncryptionScopesClientPatchOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if encryptionScopeName == "" {
|
||||
return nil, errors.New("parameter encryptionScopeName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{encryptionScopeName}", url.PathEscape(encryptionScopeName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
if err := runtime.MarshalAsJSON(req, encryptionScope); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// patchHandleResponse handles the Patch response.
|
||||
func (client *EncryptionScopesClient) patchHandleResponse(resp *http.Response) (EncryptionScopesClientPatchResponse, error) {
|
||||
result := EncryptionScopesClientPatchResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.EncryptionScope); err != nil {
|
||||
return EncryptionScopesClientPatchResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Put - Synchronously creates or updates an encryption scope under the specified storage account. If an encryption scope
|
||||
// is already created and a subsequent request is issued with different properties, the
|
||||
// encryption scope properties will be updated per the specified request.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - encryptionScopeName - The name of the encryption scope within the specified storage account. Encryption scope names must
|
||||
// be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every
|
||||
// dash (-) character must be immediately preceded and followed by a letter or number.
|
||||
// - encryptionScope - Encryption scope properties to be used for the create or update.
|
||||
// - options - EncryptionScopesClientPutOptions contains the optional parameters for the EncryptionScopesClient.Put method.
|
||||
func (client *EncryptionScopesClient) Put(ctx context.Context, resourceGroupName string, accountName string, encryptionScopeName string, encryptionScope EncryptionScope, options *EncryptionScopesClientPutOptions) (EncryptionScopesClientPutResponse, error) {
|
||||
var err error
|
||||
const operationName = "EncryptionScopesClient.Put"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.putCreateRequest(ctx, resourceGroupName, accountName, encryptionScopeName, encryptionScope, options)
|
||||
if err != nil {
|
||||
return EncryptionScopesClientPutResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return EncryptionScopesClientPutResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return EncryptionScopesClientPutResponse{}, err
|
||||
}
|
||||
resp, err := client.putHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// putCreateRequest creates the Put request.
|
||||
func (client *EncryptionScopesClient) putCreateRequest(ctx context.Context, resourceGroupName string, accountName string, encryptionScopeName string, encryptionScope EncryptionScope, options *EncryptionScopesClientPutOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if encryptionScopeName == "" {
|
||||
return nil, errors.New("parameter encryptionScopeName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{encryptionScopeName}", url.PathEscape(encryptionScopeName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
if err := runtime.MarshalAsJSON(req, encryptionScope); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// putHandleResponse handles the Put response.
|
||||
func (client *EncryptionScopesClient) putHandleResponse(resp *http.Response) (EncryptionScopesClientPutResponse, error) {
|
||||
result := EncryptionScopesClientPutResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.EncryptionScope); err != nil {
|
||||
return EncryptionScopesClientPutResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
249
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/fileservices_client.go
сгенерированный
поставляемый
Normal file
249
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/fileservices_client.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,249 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package armstorage
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// FileServicesClient contains the methods for the FileServices group.
|
||||
// Don't use this type directly, use NewFileServicesClient() instead.
|
||||
type FileServicesClient struct {
|
||||
internal *arm.Client
|
||||
subscriptionID string
|
||||
}
|
||||
|
||||
// NewFileServicesClient creates a new instance of FileServicesClient with the specified values.
|
||||
// - subscriptionID - The ID of the target subscription.
|
||||
// - credential - used to authorize requests. Usually a credential from azidentity.
|
||||
// - options - pass nil to accept the default values.
|
||||
func NewFileServicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FileServicesClient, error) {
|
||||
cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client := &FileServicesClient{
|
||||
subscriptionID: subscriptionID,
|
||||
internal: cl,
|
||||
}
|
||||
return client, nil
|
||||
}
|
||||
|
||||
// GetServiceProperties - Gets the properties of file services in storage accounts, including CORS (Cross-Origin Resource
|
||||
// Sharing) rules.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - options - FileServicesClientGetServicePropertiesOptions contains the optional parameters for the FileServicesClient.GetServiceProperties
|
||||
// method.
|
||||
func (client *FileServicesClient) GetServiceProperties(ctx context.Context, resourceGroupName string, accountName string, options *FileServicesClientGetServicePropertiesOptions) (FileServicesClientGetServicePropertiesResponse, error) {
|
||||
var err error
|
||||
const operationName = "FileServicesClient.GetServiceProperties"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.getServicePropertiesCreateRequest(ctx, resourceGroupName, accountName, options)
|
||||
if err != nil {
|
||||
return FileServicesClientGetServicePropertiesResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return FileServicesClientGetServicePropertiesResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return FileServicesClientGetServicePropertiesResponse{}, err
|
||||
}
|
||||
resp, err := client.getServicePropertiesHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// getServicePropertiesCreateRequest creates the GetServiceProperties request.
|
||||
func (client *FileServicesClient) getServicePropertiesCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *FileServicesClientGetServicePropertiesOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
urlPath = strings.ReplaceAll(urlPath, "{FileServicesName}", url.PathEscape("default"))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// getServicePropertiesHandleResponse handles the GetServiceProperties response.
|
||||
func (client *FileServicesClient) getServicePropertiesHandleResponse(resp *http.Response) (FileServicesClientGetServicePropertiesResponse, error) {
|
||||
result := FileServicesClientGetServicePropertiesResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.FileServiceProperties); err != nil {
|
||||
return FileServicesClientGetServicePropertiesResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// List - List all file services in storage accounts
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - options - FileServicesClientListOptions contains the optional parameters for the FileServicesClient.List method.
|
||||
func (client *FileServicesClient) List(ctx context.Context, resourceGroupName string, accountName string, options *FileServicesClientListOptions) (FileServicesClientListResponse, error) {
|
||||
var err error
|
||||
const operationName = "FileServicesClient.List"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.listCreateRequest(ctx, resourceGroupName, accountName, options)
|
||||
if err != nil {
|
||||
return FileServicesClientListResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return FileServicesClientListResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return FileServicesClientListResponse{}, err
|
||||
}
|
||||
resp, err := client.listHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// listCreateRequest creates the List request.
|
||||
func (client *FileServicesClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *FileServicesClientListOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// listHandleResponse handles the List response.
|
||||
func (client *FileServicesClient) listHandleResponse(resp *http.Response) (FileServicesClientListResponse, error) {
|
||||
result := FileServicesClientListResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.FileServiceItems); err != nil {
|
||||
return FileServicesClientListResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// SetServiceProperties - Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource
|
||||
// Sharing) rules.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - parameters - The properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules.
|
||||
// - options - FileServicesClientSetServicePropertiesOptions contains the optional parameters for the FileServicesClient.SetServiceProperties
|
||||
// method.
|
||||
func (client *FileServicesClient) SetServiceProperties(ctx context.Context, resourceGroupName string, accountName string, parameters FileServiceProperties, options *FileServicesClientSetServicePropertiesOptions) (FileServicesClientSetServicePropertiesResponse, error) {
|
||||
var err error
|
||||
const operationName = "FileServicesClient.SetServiceProperties"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.setServicePropertiesCreateRequest(ctx, resourceGroupName, accountName, parameters, options)
|
||||
if err != nil {
|
||||
return FileServicesClientSetServicePropertiesResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return FileServicesClientSetServicePropertiesResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return FileServicesClientSetServicePropertiesResponse{}, err
|
||||
}
|
||||
resp, err := client.setServicePropertiesHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// setServicePropertiesCreateRequest creates the SetServiceProperties request.
|
||||
func (client *FileServicesClient) setServicePropertiesCreateRequest(ctx context.Context, resourceGroupName string, accountName string, parameters FileServiceProperties, options *FileServicesClientSetServicePropertiesOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
urlPath = strings.ReplaceAll(urlPath, "{FileServicesName}", url.PathEscape("default"))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
if err := runtime.MarshalAsJSON(req, parameters); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// setServicePropertiesHandleResponse handles the SetServiceProperties response.
|
||||
func (client *FileServicesClient) setServicePropertiesHandleResponse(resp *http.Response) (FileServicesClientSetServicePropertiesResponse, error) {
|
||||
result := FileServicesClientSetServicePropertiesResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.FileServiceProperties); err != nil {
|
||||
return FileServicesClientSetServicePropertiesResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
572
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/fileshares_client.go
сгенерированный
поставляемый
Normal file
572
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/fileshares_client.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,572 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package armstorage
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// FileSharesClient contains the methods for the FileShares group.
|
||||
// Don't use this type directly, use NewFileSharesClient() instead.
|
||||
type FileSharesClient struct {
|
||||
internal *arm.Client
|
||||
subscriptionID string
|
||||
}
|
||||
|
||||
// NewFileSharesClient creates a new instance of FileSharesClient with the specified values.
|
||||
// - subscriptionID - The ID of the target subscription.
|
||||
// - credential - used to authorize requests. Usually a credential from azidentity.
|
||||
// - options - pass nil to accept the default values.
|
||||
func NewFileSharesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FileSharesClient, error) {
|
||||
cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client := &FileSharesClient{
|
||||
subscriptionID: subscriptionID,
|
||||
internal: cl,
|
||||
}
|
||||
return client, nil
|
||||
}
|
||||
|
||||
// Create - Creates a new share under the specified account as described by request body. The share resource includes metadata
|
||||
// and properties for that share. It does not include a list of the files contained by
|
||||
// the share.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - shareName - The name of the file share within the specified storage account. File share names must be between 3 and 63
|
||||
// characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-)
|
||||
// character must be immediately preceded and followed by a letter or number.
|
||||
// - fileShare - Properties of the file share to create.
|
||||
// - options - FileSharesClientCreateOptions contains the optional parameters for the FileSharesClient.Create method.
|
||||
func (client *FileSharesClient) Create(ctx context.Context, resourceGroupName string, accountName string, shareName string, fileShare FileShare, options *FileSharesClientCreateOptions) (FileSharesClientCreateResponse, error) {
|
||||
var err error
|
||||
const operationName = "FileSharesClient.Create"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, shareName, fileShare, options)
|
||||
if err != nil {
|
||||
return FileSharesClientCreateResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return FileSharesClientCreateResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return FileSharesClientCreateResponse{}, err
|
||||
}
|
||||
resp, err := client.createHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// createCreateRequest creates the Create request.
|
||||
func (client *FileSharesClient) createCreateRequest(ctx context.Context, resourceGroupName string, accountName string, shareName string, fileShare FileShare, options *FileSharesClientCreateOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if shareName == "" {
|
||||
return nil, errors.New("parameter shareName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{shareName}", url.PathEscape(shareName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
if options != nil && options.Expand != nil {
|
||||
reqQP.Set("$expand", *options.Expand)
|
||||
}
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
if err := runtime.MarshalAsJSON(req, fileShare); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// createHandleResponse handles the Create response.
|
||||
func (client *FileSharesClient) createHandleResponse(resp *http.Response) (FileSharesClientCreateResponse, error) {
|
||||
result := FileSharesClientCreateResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.FileShare); err != nil {
|
||||
return FileSharesClientCreateResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Delete - Deletes specified share under its account.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - shareName - The name of the file share within the specified storage account. File share names must be between 3 and 63
|
||||
// characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-)
|
||||
// character must be immediately preceded and followed by a letter or number.
|
||||
// - options - FileSharesClientDeleteOptions contains the optional parameters for the FileSharesClient.Delete method.
|
||||
func (client *FileSharesClient) Delete(ctx context.Context, resourceGroupName string, accountName string, shareName string, options *FileSharesClientDeleteOptions) (FileSharesClientDeleteResponse, error) {
|
||||
var err error
|
||||
const operationName = "FileSharesClient.Delete"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, shareName, options)
|
||||
if err != nil {
|
||||
return FileSharesClientDeleteResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return FileSharesClientDeleteResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return FileSharesClientDeleteResponse{}, err
|
||||
}
|
||||
return FileSharesClientDeleteResponse{}, nil
|
||||
}
|
||||
|
||||
// deleteCreateRequest creates the Delete request.
|
||||
func (client *FileSharesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, shareName string, options *FileSharesClientDeleteOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if shareName == "" {
|
||||
return nil, errors.New("parameter shareName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{shareName}", url.PathEscape(shareName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
if options != nil && options.Include != nil {
|
||||
reqQP.Set("$include", *options.Include)
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
if options != nil && options.XMSSnapshot != nil {
|
||||
req.Raw().Header["x-ms-snapshot"] = []string{*options.XMSSnapshot}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// Get - Gets properties of a specified share.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - shareName - The name of the file share within the specified storage account. File share names must be between 3 and 63
|
||||
// characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-)
|
||||
// character must be immediately preceded and followed by a letter or number.
|
||||
// - options - FileSharesClientGetOptions contains the optional parameters for the FileSharesClient.Get method.
|
||||
func (client *FileSharesClient) Get(ctx context.Context, resourceGroupName string, accountName string, shareName string, options *FileSharesClientGetOptions) (FileSharesClientGetResponse, error) {
|
||||
var err error
|
||||
const operationName = "FileSharesClient.Get"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, shareName, options)
|
||||
if err != nil {
|
||||
return FileSharesClientGetResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return FileSharesClientGetResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return FileSharesClientGetResponse{}, err
|
||||
}
|
||||
resp, err := client.getHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// getCreateRequest creates the Get request.
|
||||
func (client *FileSharesClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, shareName string, options *FileSharesClientGetOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if shareName == "" {
|
||||
return nil, errors.New("parameter shareName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{shareName}", url.PathEscape(shareName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
if options != nil && options.Expand != nil {
|
||||
reqQP.Set("$expand", *options.Expand)
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
if options != nil && options.XMSSnapshot != nil {
|
||||
req.Raw().Header["x-ms-snapshot"] = []string{*options.XMSSnapshot}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// getHandleResponse handles the Get response.
|
||||
func (client *FileSharesClient) getHandleResponse(resp *http.Response) (FileSharesClientGetResponse, error) {
|
||||
result := FileSharesClientGetResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.FileShare); err != nil {
|
||||
return FileSharesClientGetResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Lease - The Lease Share operation establishes and manages a lock on a share for delete operations. The lock duration can
|
||||
// be 15 to 60 seconds, or can be infinite.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - shareName - The name of the file share within the specified storage account. File share names must be between 3 and 63
|
||||
// characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-)
|
||||
// character must be immediately preceded and followed by a letter or number.
|
||||
// - options - FileSharesClientLeaseOptions contains the optional parameters for the FileSharesClient.Lease method.
|
||||
func (client *FileSharesClient) Lease(ctx context.Context, resourceGroupName string, accountName string, shareName string, options *FileSharesClientLeaseOptions) (FileSharesClientLeaseResponse, error) {
|
||||
var err error
|
||||
const operationName = "FileSharesClient.Lease"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.leaseCreateRequest(ctx, resourceGroupName, accountName, shareName, options)
|
||||
if err != nil {
|
||||
return FileSharesClientLeaseResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return FileSharesClientLeaseResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return FileSharesClientLeaseResponse{}, err
|
||||
}
|
||||
resp, err := client.leaseHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// leaseCreateRequest creates the Lease request.
|
||||
func (client *FileSharesClient) leaseCreateRequest(ctx context.Context, resourceGroupName string, accountName string, shareName string, options *FileSharesClientLeaseOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}/lease"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if shareName == "" {
|
||||
return nil, errors.New("parameter shareName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{shareName}", url.PathEscape(shareName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
if options != nil && options.XMSSnapshot != nil {
|
||||
req.Raw().Header["x-ms-snapshot"] = []string{*options.XMSSnapshot}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
if options != nil && options.Parameters != nil {
|
||||
if err := runtime.MarshalAsJSON(req, *options.Parameters); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// leaseHandleResponse handles the Lease response.
|
||||
func (client *FileSharesClient) leaseHandleResponse(resp *http.Response) (FileSharesClientLeaseResponse, error) {
|
||||
result := FileSharesClientLeaseResponse{}
|
||||
if val := resp.Header.Get("ETag"); val != "" {
|
||||
result.ETag = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.LeaseShareResponse); err != nil {
|
||||
return FileSharesClientLeaseResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// NewListPager - Lists all shares.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - options - FileSharesClientListOptions contains the optional parameters for the FileSharesClient.NewListPager method.
|
||||
func (client *FileSharesClient) NewListPager(resourceGroupName string, accountName string, options *FileSharesClientListOptions) *runtime.Pager[FileSharesClientListResponse] {
|
||||
return runtime.NewPager(runtime.PagingHandler[FileSharesClientListResponse]{
|
||||
More: func(page FileSharesClientListResponse) bool {
|
||||
return page.NextLink != nil && len(*page.NextLink) > 0
|
||||
},
|
||||
Fetcher: func(ctx context.Context, page *FileSharesClientListResponse) (FileSharesClientListResponse, error) {
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "FileSharesClient.NewListPager")
|
||||
nextLink := ""
|
||||
if page != nil {
|
||||
nextLink = *page.NextLink
|
||||
}
|
||||
resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) {
|
||||
return client.listCreateRequest(ctx, resourceGroupName, accountName, options)
|
||||
}, nil)
|
||||
if err != nil {
|
||||
return FileSharesClientListResponse{}, err
|
||||
}
|
||||
return client.listHandleResponse(resp)
|
||||
},
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
}
|
||||
|
||||
// listCreateRequest creates the List request.
|
||||
func (client *FileSharesClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *FileSharesClientListOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
if options != nil && options.Maxpagesize != nil {
|
||||
reqQP.Set("$maxpagesize", *options.Maxpagesize)
|
||||
}
|
||||
if options != nil && options.Filter != nil {
|
||||
reqQP.Set("$filter", *options.Filter)
|
||||
}
|
||||
if options != nil && options.Expand != nil {
|
||||
reqQP.Set("$expand", *options.Expand)
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// listHandleResponse handles the List response.
|
||||
func (client *FileSharesClient) listHandleResponse(resp *http.Response) (FileSharesClientListResponse, error) {
|
||||
result := FileSharesClientListResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.FileShareItems); err != nil {
|
||||
return FileSharesClientListResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Restore - Restore a file share within a valid retention days if share soft delete is enabled
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - shareName - The name of the file share within the specified storage account. File share names must be between 3 and 63
|
||||
// characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-)
|
||||
// character must be immediately preceded and followed by a letter or number.
|
||||
// - options - FileSharesClientRestoreOptions contains the optional parameters for the FileSharesClient.Restore method.
|
||||
func (client *FileSharesClient) Restore(ctx context.Context, resourceGroupName string, accountName string, shareName string, deletedShare DeletedShare, options *FileSharesClientRestoreOptions) (FileSharesClientRestoreResponse, error) {
|
||||
var err error
|
||||
const operationName = "FileSharesClient.Restore"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.restoreCreateRequest(ctx, resourceGroupName, accountName, shareName, deletedShare, options)
|
||||
if err != nil {
|
||||
return FileSharesClientRestoreResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return FileSharesClientRestoreResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return FileSharesClientRestoreResponse{}, err
|
||||
}
|
||||
return FileSharesClientRestoreResponse{}, nil
|
||||
}
|
||||
|
||||
// restoreCreateRequest creates the Restore request.
|
||||
func (client *FileSharesClient) restoreCreateRequest(ctx context.Context, resourceGroupName string, accountName string, shareName string, deletedShare DeletedShare, options *FileSharesClientRestoreOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}/restore"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if shareName == "" {
|
||||
return nil, errors.New("parameter shareName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{shareName}", url.PathEscape(shareName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
if err := runtime.MarshalAsJSON(req, deletedShare); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// Update - Updates share properties as specified in request body. Properties not mentioned in the request will not be changed.
|
||||
// Update fails if the specified share does not already exist.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - shareName - The name of the file share within the specified storage account. File share names must be between 3 and 63
|
||||
// characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-)
|
||||
// character must be immediately preceded and followed by a letter or number.
|
||||
// - fileShare - Properties to update for the file share.
|
||||
// - options - FileSharesClientUpdateOptions contains the optional parameters for the FileSharesClient.Update method.
|
||||
func (client *FileSharesClient) Update(ctx context.Context, resourceGroupName string, accountName string, shareName string, fileShare FileShare, options *FileSharesClientUpdateOptions) (FileSharesClientUpdateResponse, error) {
|
||||
var err error
|
||||
const operationName = "FileSharesClient.Update"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, shareName, fileShare, options)
|
||||
if err != nil {
|
||||
return FileSharesClientUpdateResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return FileSharesClientUpdateResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return FileSharesClientUpdateResponse{}, err
|
||||
}
|
||||
resp, err := client.updateHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// updateCreateRequest creates the Update request.
|
||||
func (client *FileSharesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, shareName string, fileShare FileShare, options *FileSharesClientUpdateOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if shareName == "" {
|
||||
return nil, errors.New("parameter shareName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{shareName}", url.PathEscape(shareName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
if err := runtime.MarshalAsJSON(req, fileShare); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// updateHandleResponse handles the Update response.
|
||||
func (client *FileSharesClient) updateHandleResponse(resp *http.Response) (FileSharesClientUpdateResponse, error) {
|
||||
result := FileSharesClientUpdateResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.FileShare); err != nil {
|
||||
return FileSharesClientUpdateResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
461
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/localusers_client.go
сгенерированный
поставляемый
Normal file
461
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/localusers_client.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,461 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package armstorage
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// LocalUsersClient contains the methods for the LocalUsers group.
|
||||
// Don't use this type directly, use NewLocalUsersClient() instead.
|
||||
type LocalUsersClient struct {
|
||||
internal *arm.Client
|
||||
subscriptionID string
|
||||
}
|
||||
|
||||
// NewLocalUsersClient creates a new instance of LocalUsersClient with the specified values.
|
||||
// - subscriptionID - The ID of the target subscription.
|
||||
// - credential - used to authorize requests. Usually a credential from azidentity.
|
||||
// - options - pass nil to accept the default values.
|
||||
func NewLocalUsersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LocalUsersClient, error) {
|
||||
cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client := &LocalUsersClient{
|
||||
subscriptionID: subscriptionID,
|
||||
internal: cl,
|
||||
}
|
||||
return client, nil
|
||||
}
|
||||
|
||||
// CreateOrUpdate - Create or update the properties of a local user associated with the storage account
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - username - The name of local user. The username must contain lowercase letters and numbers only. It must be unique only
|
||||
// within the storage account.
|
||||
// - properties - The local user associated with a storage account.
|
||||
// - options - LocalUsersClientCreateOrUpdateOptions contains the optional parameters for the LocalUsersClient.CreateOrUpdate
|
||||
// method.
|
||||
func (client *LocalUsersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, username string, properties LocalUser, options *LocalUsersClientCreateOrUpdateOptions) (LocalUsersClientCreateOrUpdateResponse, error) {
|
||||
var err error
|
||||
const operationName = "LocalUsersClient.CreateOrUpdate"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, accountName, username, properties, options)
|
||||
if err != nil {
|
||||
return LocalUsersClientCreateOrUpdateResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return LocalUsersClientCreateOrUpdateResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return LocalUsersClientCreateOrUpdateResponse{}, err
|
||||
}
|
||||
resp, err := client.createOrUpdateHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// createOrUpdateCreateRequest creates the CreateOrUpdate request.
|
||||
func (client *LocalUsersClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, username string, properties LocalUser, options *LocalUsersClientCreateOrUpdateOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/localUsers/{username}"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if username == "" {
|
||||
return nil, errors.New("parameter username cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{username}", url.PathEscape(username))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
if err := runtime.MarshalAsJSON(req, properties); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// createOrUpdateHandleResponse handles the CreateOrUpdate response.
|
||||
func (client *LocalUsersClient) createOrUpdateHandleResponse(resp *http.Response) (LocalUsersClientCreateOrUpdateResponse, error) {
|
||||
result := LocalUsersClientCreateOrUpdateResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.LocalUser); err != nil {
|
||||
return LocalUsersClientCreateOrUpdateResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Delete - Deletes the local user associated with the specified storage account.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - username - The name of local user. The username must contain lowercase letters and numbers only. It must be unique only
|
||||
// within the storage account.
|
||||
// - options - LocalUsersClientDeleteOptions contains the optional parameters for the LocalUsersClient.Delete method.
|
||||
func (client *LocalUsersClient) Delete(ctx context.Context, resourceGroupName string, accountName string, username string, options *LocalUsersClientDeleteOptions) (LocalUsersClientDeleteResponse, error) {
|
||||
var err error
|
||||
const operationName = "LocalUsersClient.Delete"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, username, options)
|
||||
if err != nil {
|
||||
return LocalUsersClientDeleteResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return LocalUsersClientDeleteResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return LocalUsersClientDeleteResponse{}, err
|
||||
}
|
||||
return LocalUsersClientDeleteResponse{}, nil
|
||||
}
|
||||
|
||||
// deleteCreateRequest creates the Delete request.
|
||||
func (client *LocalUsersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, username string, options *LocalUsersClientDeleteOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/localUsers/{username}"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if username == "" {
|
||||
return nil, errors.New("parameter username cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{username}", url.PathEscape(username))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// Get - Get the local user of the storage account by username.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - username - The name of local user. The username must contain lowercase letters and numbers only. It must be unique only
|
||||
// within the storage account.
|
||||
// - options - LocalUsersClientGetOptions contains the optional parameters for the LocalUsersClient.Get method.
|
||||
func (client *LocalUsersClient) Get(ctx context.Context, resourceGroupName string, accountName string, username string, options *LocalUsersClientGetOptions) (LocalUsersClientGetResponse, error) {
|
||||
var err error
|
||||
const operationName = "LocalUsersClient.Get"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, username, options)
|
||||
if err != nil {
|
||||
return LocalUsersClientGetResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return LocalUsersClientGetResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return LocalUsersClientGetResponse{}, err
|
||||
}
|
||||
resp, err := client.getHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// getCreateRequest creates the Get request.
|
||||
func (client *LocalUsersClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, username string, options *LocalUsersClientGetOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/localUsers/{username}"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if username == "" {
|
||||
return nil, errors.New("parameter username cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{username}", url.PathEscape(username))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// getHandleResponse handles the Get response.
|
||||
func (client *LocalUsersClient) getHandleResponse(resp *http.Response) (LocalUsersClientGetResponse, error) {
|
||||
result := LocalUsersClientGetResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.LocalUser); err != nil {
|
||||
return LocalUsersClientGetResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// NewListPager - List the local users associated with the storage account.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - options - LocalUsersClientListOptions contains the optional parameters for the LocalUsersClient.NewListPager method.
|
||||
func (client *LocalUsersClient) NewListPager(resourceGroupName string, accountName string, options *LocalUsersClientListOptions) *runtime.Pager[LocalUsersClientListResponse] {
|
||||
return runtime.NewPager(runtime.PagingHandler[LocalUsersClientListResponse]{
|
||||
More: func(page LocalUsersClientListResponse) bool {
|
||||
return false
|
||||
},
|
||||
Fetcher: func(ctx context.Context, page *LocalUsersClientListResponse) (LocalUsersClientListResponse, error) {
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "LocalUsersClient.NewListPager")
|
||||
req, err := client.listCreateRequest(ctx, resourceGroupName, accountName, options)
|
||||
if err != nil {
|
||||
return LocalUsersClientListResponse{}, err
|
||||
}
|
||||
resp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return LocalUsersClientListResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusOK) {
|
||||
return LocalUsersClientListResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.listHandleResponse(resp)
|
||||
},
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
}
|
||||
|
||||
// listCreateRequest creates the List request.
|
||||
func (client *LocalUsersClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *LocalUsersClientListOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/localUsers"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// listHandleResponse handles the List response.
|
||||
func (client *LocalUsersClient) listHandleResponse(resp *http.Response) (LocalUsersClientListResponse, error) {
|
||||
result := LocalUsersClientListResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.LocalUsers); err != nil {
|
||||
return LocalUsersClientListResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// ListKeys - List SSH authorized keys and shared key of the local user.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - username - The name of local user. The username must contain lowercase letters and numbers only. It must be unique only
|
||||
// within the storage account.
|
||||
// - options - LocalUsersClientListKeysOptions contains the optional parameters for the LocalUsersClient.ListKeys method.
|
||||
func (client *LocalUsersClient) ListKeys(ctx context.Context, resourceGroupName string, accountName string, username string, options *LocalUsersClientListKeysOptions) (LocalUsersClientListKeysResponse, error) {
|
||||
var err error
|
||||
const operationName = "LocalUsersClient.ListKeys"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.listKeysCreateRequest(ctx, resourceGroupName, accountName, username, options)
|
||||
if err != nil {
|
||||
return LocalUsersClientListKeysResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return LocalUsersClientListKeysResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return LocalUsersClientListKeysResponse{}, err
|
||||
}
|
||||
resp, err := client.listKeysHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// listKeysCreateRequest creates the ListKeys request.
|
||||
func (client *LocalUsersClient) listKeysCreateRequest(ctx context.Context, resourceGroupName string, accountName string, username string, options *LocalUsersClientListKeysOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/localUsers/{username}/listKeys"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if username == "" {
|
||||
return nil, errors.New("parameter username cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{username}", url.PathEscape(username))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// listKeysHandleResponse handles the ListKeys response.
|
||||
func (client *LocalUsersClient) listKeysHandleResponse(resp *http.Response) (LocalUsersClientListKeysResponse, error) {
|
||||
result := LocalUsersClientListKeysResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.LocalUserKeys); err != nil {
|
||||
return LocalUsersClientListKeysResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// RegeneratePassword - Regenerate the local user SSH password.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - username - The name of local user. The username must contain lowercase letters and numbers only. It must be unique only
|
||||
// within the storage account.
|
||||
// - options - LocalUsersClientRegeneratePasswordOptions contains the optional parameters for the LocalUsersClient.RegeneratePassword
|
||||
// method.
|
||||
func (client *LocalUsersClient) RegeneratePassword(ctx context.Context, resourceGroupName string, accountName string, username string, options *LocalUsersClientRegeneratePasswordOptions) (LocalUsersClientRegeneratePasswordResponse, error) {
|
||||
var err error
|
||||
const operationName = "LocalUsersClient.RegeneratePassword"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.regeneratePasswordCreateRequest(ctx, resourceGroupName, accountName, username, options)
|
||||
if err != nil {
|
||||
return LocalUsersClientRegeneratePasswordResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return LocalUsersClientRegeneratePasswordResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return LocalUsersClientRegeneratePasswordResponse{}, err
|
||||
}
|
||||
resp, err := client.regeneratePasswordHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// regeneratePasswordCreateRequest creates the RegeneratePassword request.
|
||||
func (client *LocalUsersClient) regeneratePasswordCreateRequest(ctx context.Context, resourceGroupName string, accountName string, username string, options *LocalUsersClientRegeneratePasswordOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/localUsers/{username}/regeneratePassword"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if username == "" {
|
||||
return nil, errors.New("parameter username cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{username}", url.PathEscape(username))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// regeneratePasswordHandleResponse handles the RegeneratePassword response.
|
||||
func (client *LocalUsersClient) regeneratePasswordHandleResponse(resp *http.Response) (LocalUsersClientRegeneratePasswordResponse, error) {
|
||||
result := LocalUsersClientRegeneratePasswordResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.LocalUserRegeneratePasswordResult); err != nil {
|
||||
return LocalUsersClientRegeneratePasswordResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
249
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/managementpolicies_client.go
сгенерированный
поставляемый
Normal file
249
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/managementpolicies_client.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,249 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package armstorage
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// ManagementPoliciesClient contains the methods for the ManagementPolicies group.
|
||||
// Don't use this type directly, use NewManagementPoliciesClient() instead.
|
||||
type ManagementPoliciesClient struct {
|
||||
internal *arm.Client
|
||||
subscriptionID string
|
||||
}
|
||||
|
||||
// NewManagementPoliciesClient creates a new instance of ManagementPoliciesClient with the specified values.
|
||||
// - subscriptionID - The ID of the target subscription.
|
||||
// - credential - used to authorize requests. Usually a credential from azidentity.
|
||||
// - options - pass nil to accept the default values.
|
||||
func NewManagementPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagementPoliciesClient, error) {
|
||||
cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client := &ManagementPoliciesClient{
|
||||
subscriptionID: subscriptionID,
|
||||
internal: cl,
|
||||
}
|
||||
return client, nil
|
||||
}
|
||||
|
||||
// CreateOrUpdate - Sets the managementpolicy to the specified storage account.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - managementPolicyName - The name of the Storage Account Management Policy. It should always be 'default'
|
||||
// - properties - The ManagementPolicy set to a storage account.
|
||||
// - options - ManagementPoliciesClientCreateOrUpdateOptions contains the optional parameters for the ManagementPoliciesClient.CreateOrUpdate
|
||||
// method.
|
||||
func (client *ManagementPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, managementPolicyName ManagementPolicyName, properties ManagementPolicy, options *ManagementPoliciesClientCreateOrUpdateOptions) (ManagementPoliciesClientCreateOrUpdateResponse, error) {
|
||||
var err error
|
||||
const operationName = "ManagementPoliciesClient.CreateOrUpdate"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, accountName, managementPolicyName, properties, options)
|
||||
if err != nil {
|
||||
return ManagementPoliciesClientCreateOrUpdateResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return ManagementPoliciesClientCreateOrUpdateResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return ManagementPoliciesClientCreateOrUpdateResponse{}, err
|
||||
}
|
||||
resp, err := client.createOrUpdateHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// createOrUpdateCreateRequest creates the CreateOrUpdate request.
|
||||
func (client *ManagementPoliciesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, managementPolicyName ManagementPolicyName, properties ManagementPolicy, options *ManagementPoliciesClientCreateOrUpdateOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if managementPolicyName == "" {
|
||||
return nil, errors.New("parameter managementPolicyName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{managementPolicyName}", url.PathEscape(string(managementPolicyName)))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
if err := runtime.MarshalAsJSON(req, properties); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// createOrUpdateHandleResponse handles the CreateOrUpdate response.
|
||||
func (client *ManagementPoliciesClient) createOrUpdateHandleResponse(resp *http.Response) (ManagementPoliciesClientCreateOrUpdateResponse, error) {
|
||||
result := ManagementPoliciesClientCreateOrUpdateResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.ManagementPolicy); err != nil {
|
||||
return ManagementPoliciesClientCreateOrUpdateResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Delete - Deletes the managementpolicy associated with the specified storage account.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - managementPolicyName - The name of the Storage Account Management Policy. It should always be 'default'
|
||||
// - options - ManagementPoliciesClientDeleteOptions contains the optional parameters for the ManagementPoliciesClient.Delete
|
||||
// method.
|
||||
func (client *ManagementPoliciesClient) Delete(ctx context.Context, resourceGroupName string, accountName string, managementPolicyName ManagementPolicyName, options *ManagementPoliciesClientDeleteOptions) (ManagementPoliciesClientDeleteResponse, error) {
|
||||
var err error
|
||||
const operationName = "ManagementPoliciesClient.Delete"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, managementPolicyName, options)
|
||||
if err != nil {
|
||||
return ManagementPoliciesClientDeleteResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return ManagementPoliciesClientDeleteResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return ManagementPoliciesClientDeleteResponse{}, err
|
||||
}
|
||||
return ManagementPoliciesClientDeleteResponse{}, nil
|
||||
}
|
||||
|
||||
// deleteCreateRequest creates the Delete request.
|
||||
func (client *ManagementPoliciesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, managementPolicyName ManagementPolicyName, options *ManagementPoliciesClientDeleteOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if managementPolicyName == "" {
|
||||
return nil, errors.New("parameter managementPolicyName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{managementPolicyName}", url.PathEscape(string(managementPolicyName)))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// Get - Gets the managementpolicy associated with the specified storage account.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - managementPolicyName - The name of the Storage Account Management Policy. It should always be 'default'
|
||||
// - options - ManagementPoliciesClientGetOptions contains the optional parameters for the ManagementPoliciesClient.Get method.
|
||||
func (client *ManagementPoliciesClient) Get(ctx context.Context, resourceGroupName string, accountName string, managementPolicyName ManagementPolicyName, options *ManagementPoliciesClientGetOptions) (ManagementPoliciesClientGetResponse, error) {
|
||||
var err error
|
||||
const operationName = "ManagementPoliciesClient.Get"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, managementPolicyName, options)
|
||||
if err != nil {
|
||||
return ManagementPoliciesClientGetResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return ManagementPoliciesClientGetResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return ManagementPoliciesClientGetResponse{}, err
|
||||
}
|
||||
resp, err := client.getHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// getCreateRequest creates the Get request.
|
||||
func (client *ManagementPoliciesClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, managementPolicyName ManagementPolicyName, options *ManagementPoliciesClientGetOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if managementPolicyName == "" {
|
||||
return nil, errors.New("parameter managementPolicyName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{managementPolicyName}", url.PathEscape(string(managementPolicyName)))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// getHandleResponse handles the Get response.
|
||||
func (client *ManagementPoliciesClient) getHandleResponse(resp *http.Response) (ManagementPoliciesClientGetResponse, error) {
|
||||
result := ManagementPoliciesClientGetResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.ManagementPolicy); err != nil {
|
||||
return ManagementPoliciesClientGetResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
2832
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/models.go
сгенерированный
поставляемый
Normal file
2832
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/models.go
сгенерированный
поставляемый
Normal file
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
6851
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/models_serde.go
сгенерированный
поставляемый
Normal file
6851
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/models_serde.go
сгенерированный
поставляемый
Normal file
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
324
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/objectreplicationpolicies_client.go
сгенерированный
поставляемый
Normal file
324
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/objectreplicationpolicies_client.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,324 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package armstorage
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// ObjectReplicationPoliciesClient contains the methods for the ObjectReplicationPolicies group.
|
||||
// Don't use this type directly, use NewObjectReplicationPoliciesClient() instead.
|
||||
type ObjectReplicationPoliciesClient struct {
|
||||
internal *arm.Client
|
||||
subscriptionID string
|
||||
}
|
||||
|
||||
// NewObjectReplicationPoliciesClient creates a new instance of ObjectReplicationPoliciesClient with the specified values.
|
||||
// - subscriptionID - The ID of the target subscription.
|
||||
// - credential - used to authorize requests. Usually a credential from azidentity.
|
||||
// - options - pass nil to accept the default values.
|
||||
func NewObjectReplicationPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ObjectReplicationPoliciesClient, error) {
|
||||
cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client := &ObjectReplicationPoliciesClient{
|
||||
subscriptionID: subscriptionID,
|
||||
internal: cl,
|
||||
}
|
||||
return client, nil
|
||||
}
|
||||
|
||||
// CreateOrUpdate - Create or update the object replication policy of the storage account.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - objectReplicationPolicyID - For the destination account, provide the value 'default'. Configure the policy on the destination
|
||||
// account first. For the source account, provide the value of the policy ID that is returned when you
|
||||
// download the policy that was defined on the destination account. The policy is downloaded as a JSON file.
|
||||
// - properties - The object replication policy set to a storage account. A unique policy ID will be created if absent.
|
||||
// - options - ObjectReplicationPoliciesClientCreateOrUpdateOptions contains the optional parameters for the ObjectReplicationPoliciesClient.CreateOrUpdate
|
||||
// method.
|
||||
func (client *ObjectReplicationPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, objectReplicationPolicyID string, properties ObjectReplicationPolicy, options *ObjectReplicationPoliciesClientCreateOrUpdateOptions) (ObjectReplicationPoliciesClientCreateOrUpdateResponse, error) {
|
||||
var err error
|
||||
const operationName = "ObjectReplicationPoliciesClient.CreateOrUpdate"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, accountName, objectReplicationPolicyID, properties, options)
|
||||
if err != nil {
|
||||
return ObjectReplicationPoliciesClientCreateOrUpdateResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return ObjectReplicationPoliciesClientCreateOrUpdateResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return ObjectReplicationPoliciesClientCreateOrUpdateResponse{}, err
|
||||
}
|
||||
resp, err := client.createOrUpdateHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// createOrUpdateCreateRequest creates the CreateOrUpdate request.
|
||||
func (client *ObjectReplicationPoliciesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, objectReplicationPolicyID string, properties ObjectReplicationPolicy, options *ObjectReplicationPoliciesClientCreateOrUpdateOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if objectReplicationPolicyID == "" {
|
||||
return nil, errors.New("parameter objectReplicationPolicyID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{objectReplicationPolicyId}", url.PathEscape(objectReplicationPolicyID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
if err := runtime.MarshalAsJSON(req, properties); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// createOrUpdateHandleResponse handles the CreateOrUpdate response.
|
||||
func (client *ObjectReplicationPoliciesClient) createOrUpdateHandleResponse(resp *http.Response) (ObjectReplicationPoliciesClientCreateOrUpdateResponse, error) {
|
||||
result := ObjectReplicationPoliciesClientCreateOrUpdateResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.ObjectReplicationPolicy); err != nil {
|
||||
return ObjectReplicationPoliciesClientCreateOrUpdateResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Delete - Deletes the object replication policy associated with the specified storage account.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - objectReplicationPolicyID - For the destination account, provide the value 'default'. Configure the policy on the destination
|
||||
// account first. For the source account, provide the value of the policy ID that is returned when you
|
||||
// download the policy that was defined on the destination account. The policy is downloaded as a JSON file.
|
||||
// - options - ObjectReplicationPoliciesClientDeleteOptions contains the optional parameters for the ObjectReplicationPoliciesClient.Delete
|
||||
// method.
|
||||
func (client *ObjectReplicationPoliciesClient) Delete(ctx context.Context, resourceGroupName string, accountName string, objectReplicationPolicyID string, options *ObjectReplicationPoliciesClientDeleteOptions) (ObjectReplicationPoliciesClientDeleteResponse, error) {
|
||||
var err error
|
||||
const operationName = "ObjectReplicationPoliciesClient.Delete"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, objectReplicationPolicyID, options)
|
||||
if err != nil {
|
||||
return ObjectReplicationPoliciesClientDeleteResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return ObjectReplicationPoliciesClientDeleteResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return ObjectReplicationPoliciesClientDeleteResponse{}, err
|
||||
}
|
||||
return ObjectReplicationPoliciesClientDeleteResponse{}, nil
|
||||
}
|
||||
|
||||
// deleteCreateRequest creates the Delete request.
|
||||
func (client *ObjectReplicationPoliciesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, objectReplicationPolicyID string, options *ObjectReplicationPoliciesClientDeleteOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if objectReplicationPolicyID == "" {
|
||||
return nil, errors.New("parameter objectReplicationPolicyID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{objectReplicationPolicyId}", url.PathEscape(objectReplicationPolicyID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// Get - Get the object replication policy of the storage account by policy ID.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - objectReplicationPolicyID - For the destination account, provide the value 'default'. Configure the policy on the destination
|
||||
// account first. For the source account, provide the value of the policy ID that is returned when you
|
||||
// download the policy that was defined on the destination account. The policy is downloaded as a JSON file.
|
||||
// - options - ObjectReplicationPoliciesClientGetOptions contains the optional parameters for the ObjectReplicationPoliciesClient.Get
|
||||
// method.
|
||||
func (client *ObjectReplicationPoliciesClient) Get(ctx context.Context, resourceGroupName string, accountName string, objectReplicationPolicyID string, options *ObjectReplicationPoliciesClientGetOptions) (ObjectReplicationPoliciesClientGetResponse, error) {
|
||||
var err error
|
||||
const operationName = "ObjectReplicationPoliciesClient.Get"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, objectReplicationPolicyID, options)
|
||||
if err != nil {
|
||||
return ObjectReplicationPoliciesClientGetResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return ObjectReplicationPoliciesClientGetResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return ObjectReplicationPoliciesClientGetResponse{}, err
|
||||
}
|
||||
resp, err := client.getHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// getCreateRequest creates the Get request.
|
||||
func (client *ObjectReplicationPoliciesClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, objectReplicationPolicyID string, options *ObjectReplicationPoliciesClientGetOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if objectReplicationPolicyID == "" {
|
||||
return nil, errors.New("parameter objectReplicationPolicyID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{objectReplicationPolicyId}", url.PathEscape(objectReplicationPolicyID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// getHandleResponse handles the Get response.
|
||||
func (client *ObjectReplicationPoliciesClient) getHandleResponse(resp *http.Response) (ObjectReplicationPoliciesClientGetResponse, error) {
|
||||
result := ObjectReplicationPoliciesClientGetResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.ObjectReplicationPolicy); err != nil {
|
||||
return ObjectReplicationPoliciesClientGetResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// NewListPager - List the object replication policies associated with the storage account.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - options - ObjectReplicationPoliciesClientListOptions contains the optional parameters for the ObjectReplicationPoliciesClient.NewListPager
|
||||
// method.
|
||||
func (client *ObjectReplicationPoliciesClient) NewListPager(resourceGroupName string, accountName string, options *ObjectReplicationPoliciesClientListOptions) *runtime.Pager[ObjectReplicationPoliciesClientListResponse] {
|
||||
return runtime.NewPager(runtime.PagingHandler[ObjectReplicationPoliciesClientListResponse]{
|
||||
More: func(page ObjectReplicationPoliciesClientListResponse) bool {
|
||||
return false
|
||||
},
|
||||
Fetcher: func(ctx context.Context, page *ObjectReplicationPoliciesClientListResponse) (ObjectReplicationPoliciesClientListResponse, error) {
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ObjectReplicationPoliciesClient.NewListPager")
|
||||
req, err := client.listCreateRequest(ctx, resourceGroupName, accountName, options)
|
||||
if err != nil {
|
||||
return ObjectReplicationPoliciesClientListResponse{}, err
|
||||
}
|
||||
resp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return ObjectReplicationPoliciesClientListResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusOK) {
|
||||
return ObjectReplicationPoliciesClientListResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.listHandleResponse(resp)
|
||||
},
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
}
|
||||
|
||||
// listCreateRequest creates the List request.
|
||||
func (client *ObjectReplicationPoliciesClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *ObjectReplicationPoliciesClientListOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// listHandleResponse handles the List response.
|
||||
func (client *ObjectReplicationPoliciesClient) listHandleResponse(resp *http.Response) (ObjectReplicationPoliciesClientListResponse, error) {
|
||||
result := ObjectReplicationPoliciesClientListResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.ObjectReplicationPolicies); err != nil {
|
||||
return ObjectReplicationPoliciesClientListResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
89
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/operations_client.go
сгенерированный
поставляемый
Normal file
89
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/operations_client.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,89 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package armstorage
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// OperationsClient contains the methods for the Operations group.
|
||||
// Don't use this type directly, use NewOperationsClient() instead.
|
||||
type OperationsClient struct {
|
||||
internal *arm.Client
|
||||
}
|
||||
|
||||
// NewOperationsClient creates a new instance of OperationsClient with the specified values.
|
||||
// - credential - used to authorize requests. Usually a credential from azidentity.
|
||||
// - options - pass nil to accept the default values.
|
||||
func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) {
|
||||
cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client := &OperationsClient{
|
||||
internal: cl,
|
||||
}
|
||||
return client, nil
|
||||
}
|
||||
|
||||
// NewListPager - Lists all of the available Storage Rest API operations.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method.
|
||||
func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] {
|
||||
return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{
|
||||
More: func(page OperationsClientListResponse) bool {
|
||||
return false
|
||||
},
|
||||
Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) {
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewListPager")
|
||||
req, err := client.listCreateRequest(ctx, options)
|
||||
if err != nil {
|
||||
return OperationsClientListResponse{}, err
|
||||
}
|
||||
resp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return OperationsClientListResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusOK) {
|
||||
return OperationsClientListResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.listHandleResponse(resp)
|
||||
},
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
}
|
||||
|
||||
// listCreateRequest creates the List request.
|
||||
func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) {
|
||||
urlPath := "/providers/Microsoft.Storage/operations"
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// listHandleResponse handles the List response.
|
||||
func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) {
|
||||
result := OperationsClientListResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil {
|
||||
return OperationsClientListResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
577
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/options.go
сгенерированный
поставляемый
Normal file
577
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/options.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,577 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package armstorage
|
||||
|
||||
// AccountsClientBeginAbortHierarchicalNamespaceMigrationOptions contains the optional parameters for the AccountsClient.BeginAbortHierarchicalNamespaceMigration
|
||||
// method.
|
||||
type AccountsClientBeginAbortHierarchicalNamespaceMigrationOptions struct {
|
||||
// Resumes the LRO from the provided token.
|
||||
ResumeToken string
|
||||
}
|
||||
|
||||
// AccountsClientBeginCreateOptions contains the optional parameters for the AccountsClient.BeginCreate method.
|
||||
type AccountsClientBeginCreateOptions struct {
|
||||
// Resumes the LRO from the provided token.
|
||||
ResumeToken string
|
||||
}
|
||||
|
||||
// AccountsClientBeginCustomerInitiatedMigrationOptions contains the optional parameters for the AccountsClient.BeginCustomerInitiatedMigration
|
||||
// method.
|
||||
type AccountsClientBeginCustomerInitiatedMigrationOptions struct {
|
||||
// Resumes the LRO from the provided token.
|
||||
ResumeToken string
|
||||
}
|
||||
|
||||
// AccountsClientBeginFailoverOptions contains the optional parameters for the AccountsClient.BeginFailover method.
|
||||
type AccountsClientBeginFailoverOptions struct {
|
||||
// The parameter is set to 'Planned' to indicate whether a Planned failover is requested.. Specifying any value will set the
|
||||
// value to Planned.
|
||||
FailoverType *string
|
||||
|
||||
// Resumes the LRO from the provided token.
|
||||
ResumeToken string
|
||||
}
|
||||
|
||||
// AccountsClientBeginHierarchicalNamespaceMigrationOptions contains the optional parameters for the AccountsClient.BeginHierarchicalNamespaceMigration
|
||||
// method.
|
||||
type AccountsClientBeginHierarchicalNamespaceMigrationOptions struct {
|
||||
// Resumes the LRO from the provided token.
|
||||
ResumeToken string
|
||||
}
|
||||
|
||||
// AccountsClientBeginRestoreBlobRangesOptions contains the optional parameters for the AccountsClient.BeginRestoreBlobRanges
|
||||
// method.
|
||||
type AccountsClientBeginRestoreBlobRangesOptions struct {
|
||||
// Resumes the LRO from the provided token.
|
||||
ResumeToken string
|
||||
}
|
||||
|
||||
// AccountsClientCheckNameAvailabilityOptions contains the optional parameters for the AccountsClient.CheckNameAvailability
|
||||
// method.
|
||||
type AccountsClientCheckNameAvailabilityOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// AccountsClientDeleteOptions contains the optional parameters for the AccountsClient.Delete method.
|
||||
type AccountsClientDeleteOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// AccountsClientGetCustomerInitiatedMigrationOptions contains the optional parameters for the AccountsClient.GetCustomerInitiatedMigration
|
||||
// method.
|
||||
type AccountsClientGetCustomerInitiatedMigrationOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// AccountsClientGetPropertiesOptions contains the optional parameters for the AccountsClient.GetProperties method.
|
||||
type AccountsClientGetPropertiesOptions struct {
|
||||
// May be used to expand the properties within account's properties. By default, data is not included when fetching properties.
|
||||
// Currently we only support geoReplicationStats and blobRestoreStatus.
|
||||
Expand *StorageAccountExpand
|
||||
}
|
||||
|
||||
// AccountsClientListAccountSASOptions contains the optional parameters for the AccountsClient.ListAccountSAS method.
|
||||
type AccountsClientListAccountSASOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// AccountsClientListByResourceGroupOptions contains the optional parameters for the AccountsClient.NewListByResourceGroupPager
|
||||
// method.
|
||||
type AccountsClientListByResourceGroupOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// AccountsClientListKeysOptions contains the optional parameters for the AccountsClient.ListKeys method.
|
||||
type AccountsClientListKeysOptions struct {
|
||||
// Specifies type of the key to be listed. Possible value is kerb.. Specifying any value will set the value to kerb.
|
||||
Expand *string
|
||||
}
|
||||
|
||||
// AccountsClientListOptions contains the optional parameters for the AccountsClient.NewListPager method.
|
||||
type AccountsClientListOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// AccountsClientListServiceSASOptions contains the optional parameters for the AccountsClient.ListServiceSAS method.
|
||||
type AccountsClientListServiceSASOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// AccountsClientRegenerateKeyOptions contains the optional parameters for the AccountsClient.RegenerateKey method.
|
||||
type AccountsClientRegenerateKeyOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// AccountsClientRevokeUserDelegationKeysOptions contains the optional parameters for the AccountsClient.RevokeUserDelegationKeys
|
||||
// method.
|
||||
type AccountsClientRevokeUserDelegationKeysOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// AccountsClientUpdateOptions contains the optional parameters for the AccountsClient.Update method.
|
||||
type AccountsClientUpdateOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// BlobContainersClientBeginObjectLevelWormOptions contains the optional parameters for the BlobContainersClient.BeginObjectLevelWorm
|
||||
// method.
|
||||
type BlobContainersClientBeginObjectLevelWormOptions struct {
|
||||
// Resumes the LRO from the provided token.
|
||||
ResumeToken string
|
||||
}
|
||||
|
||||
// BlobContainersClientClearLegalHoldOptions contains the optional parameters for the BlobContainersClient.ClearLegalHold
|
||||
// method.
|
||||
type BlobContainersClientClearLegalHoldOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// BlobContainersClientCreateOptions contains the optional parameters for the BlobContainersClient.Create method.
|
||||
type BlobContainersClientCreateOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// BlobContainersClientCreateOrUpdateImmutabilityPolicyOptions contains the optional parameters for the BlobContainersClient.CreateOrUpdateImmutabilityPolicy
|
||||
// method.
|
||||
type BlobContainersClientCreateOrUpdateImmutabilityPolicyOptions struct {
|
||||
// The entity state (ETag) version of the immutability policy to update. A value of "*" can be used to apply the operation
|
||||
// only if the immutability policy already exists. If omitted, this operation will
|
||||
// always be applied.
|
||||
IfMatch *string
|
||||
|
||||
// The ImmutabilityPolicy Properties that will be created or updated to a blob container.
|
||||
Parameters *ImmutabilityPolicy
|
||||
}
|
||||
|
||||
// BlobContainersClientDeleteImmutabilityPolicyOptions contains the optional parameters for the BlobContainersClient.DeleteImmutabilityPolicy
|
||||
// method.
|
||||
type BlobContainersClientDeleteImmutabilityPolicyOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// BlobContainersClientDeleteOptions contains the optional parameters for the BlobContainersClient.Delete method.
|
||||
type BlobContainersClientDeleteOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// BlobContainersClientExtendImmutabilityPolicyOptions contains the optional parameters for the BlobContainersClient.ExtendImmutabilityPolicy
|
||||
// method.
|
||||
type BlobContainersClientExtendImmutabilityPolicyOptions struct {
|
||||
// The ImmutabilityPolicy Properties that will be extended for a blob container.
|
||||
Parameters *ImmutabilityPolicy
|
||||
}
|
||||
|
||||
// BlobContainersClientGetImmutabilityPolicyOptions contains the optional parameters for the BlobContainersClient.GetImmutabilityPolicy
|
||||
// method.
|
||||
type BlobContainersClientGetImmutabilityPolicyOptions struct {
|
||||
// The entity state (ETag) version of the immutability policy to update. A value of "*" can be used to apply the operation
|
||||
// only if the immutability policy already exists. If omitted, this operation will
|
||||
// always be applied.
|
||||
IfMatch *string
|
||||
}
|
||||
|
||||
// BlobContainersClientGetOptions contains the optional parameters for the BlobContainersClient.Get method.
|
||||
type BlobContainersClientGetOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// BlobContainersClientLeaseOptions contains the optional parameters for the BlobContainersClient.Lease method.
|
||||
type BlobContainersClientLeaseOptions struct {
|
||||
// Lease Container request body.
|
||||
Parameters *LeaseContainerRequest
|
||||
}
|
||||
|
||||
// BlobContainersClientListOptions contains the optional parameters for the BlobContainersClient.NewListPager method.
|
||||
type BlobContainersClientListOptions struct {
|
||||
// Optional. When specified, only container names starting with the filter will be listed.
|
||||
Filter *string
|
||||
|
||||
// Optional, used to include the properties for soft deleted blob containers.
|
||||
Include *ListContainersInclude
|
||||
|
||||
// Optional. Specified maximum number of containers that can be included in the list.
|
||||
Maxpagesize *string
|
||||
}
|
||||
|
||||
// BlobContainersClientLockImmutabilityPolicyOptions contains the optional parameters for the BlobContainersClient.LockImmutabilityPolicy
|
||||
// method.
|
||||
type BlobContainersClientLockImmutabilityPolicyOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// BlobContainersClientSetLegalHoldOptions contains the optional parameters for the BlobContainersClient.SetLegalHold method.
|
||||
type BlobContainersClientSetLegalHoldOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// BlobContainersClientUpdateOptions contains the optional parameters for the BlobContainersClient.Update method.
|
||||
type BlobContainersClientUpdateOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// BlobInventoryPoliciesClientCreateOrUpdateOptions contains the optional parameters for the BlobInventoryPoliciesClient.CreateOrUpdate
|
||||
// method.
|
||||
type BlobInventoryPoliciesClientCreateOrUpdateOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// BlobInventoryPoliciesClientDeleteOptions contains the optional parameters for the BlobInventoryPoliciesClient.Delete method.
|
||||
type BlobInventoryPoliciesClientDeleteOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// BlobInventoryPoliciesClientGetOptions contains the optional parameters for the BlobInventoryPoliciesClient.Get method.
|
||||
type BlobInventoryPoliciesClientGetOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// BlobInventoryPoliciesClientListOptions contains the optional parameters for the BlobInventoryPoliciesClient.NewListPager
|
||||
// method.
|
||||
type BlobInventoryPoliciesClientListOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// BlobServicesClientGetServicePropertiesOptions contains the optional parameters for the BlobServicesClient.GetServiceProperties
|
||||
// method.
|
||||
type BlobServicesClientGetServicePropertiesOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// BlobServicesClientListOptions contains the optional parameters for the BlobServicesClient.NewListPager method.
|
||||
type BlobServicesClientListOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// BlobServicesClientSetServicePropertiesOptions contains the optional parameters for the BlobServicesClient.SetServiceProperties
|
||||
// method.
|
||||
type BlobServicesClientSetServicePropertiesOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// DeletedAccountsClientGetOptions contains the optional parameters for the DeletedAccountsClient.Get method.
|
||||
type DeletedAccountsClientGetOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// DeletedAccountsClientListOptions contains the optional parameters for the DeletedAccountsClient.NewListPager method.
|
||||
type DeletedAccountsClientListOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// EncryptionScopesClientGetOptions contains the optional parameters for the EncryptionScopesClient.Get method.
|
||||
type EncryptionScopesClientGetOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// EncryptionScopesClientListOptions contains the optional parameters for the EncryptionScopesClient.NewListPager method.
|
||||
type EncryptionScopesClientListOptions struct {
|
||||
// Optional. When specified, only encryption scope names starting with the filter will be listed.
|
||||
Filter *string
|
||||
|
||||
// Optional, when specified, will list encryption scopes with the specific state. Defaults to All
|
||||
Include *ListEncryptionScopesInclude
|
||||
|
||||
// Optional, specifies the maximum number of encryption scopes that will be included in the list response.
|
||||
Maxpagesize *int32
|
||||
}
|
||||
|
||||
// EncryptionScopesClientPatchOptions contains the optional parameters for the EncryptionScopesClient.Patch method.
|
||||
type EncryptionScopesClientPatchOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// EncryptionScopesClientPutOptions contains the optional parameters for the EncryptionScopesClient.Put method.
|
||||
type EncryptionScopesClientPutOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// FileServicesClientGetServicePropertiesOptions contains the optional parameters for the FileServicesClient.GetServiceProperties
|
||||
// method.
|
||||
type FileServicesClientGetServicePropertiesOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// FileServicesClientListOptions contains the optional parameters for the FileServicesClient.List method.
|
||||
type FileServicesClientListOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// FileServicesClientSetServicePropertiesOptions contains the optional parameters for the FileServicesClient.SetServiceProperties
|
||||
// method.
|
||||
type FileServicesClientSetServicePropertiesOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// FileSharesClientCreateOptions contains the optional parameters for the FileSharesClient.Create method.
|
||||
type FileSharesClientCreateOptions struct {
|
||||
// Optional, used to expand the properties within share's properties. Valid values are: snapshots. Should be passed as a string
|
||||
// with delimiter ','
|
||||
Expand *string
|
||||
}
|
||||
|
||||
// FileSharesClientDeleteOptions contains the optional parameters for the FileSharesClient.Delete method.
|
||||
type FileSharesClientDeleteOptions struct {
|
||||
// Optional. Valid values are: snapshots, leased-snapshots, none. The default value is snapshots. For 'snapshots', the file
|
||||
// share is deleted including all of its file share snapshots. If the file share
|
||||
// contains leased-snapshots, the deletion fails. For 'leased-snapshots', the file share is deleted included all of its file
|
||||
// share snapshots (leased/unleased). For 'none', the file share is deleted if it
|
||||
// has no share snapshots. If the file share contains any snapshots (leased or unleased), the deletion fails.
|
||||
Include *string
|
||||
|
||||
// Optional, used to delete a snapshot.
|
||||
XMSSnapshot *string
|
||||
}
|
||||
|
||||
// FileSharesClientGetOptions contains the optional parameters for the FileSharesClient.Get method.
|
||||
type FileSharesClientGetOptions struct {
|
||||
// Optional, used to expand the properties within share's properties. Valid values are: stats. Should be passed as a string
|
||||
// with delimiter ','.
|
||||
Expand *string
|
||||
|
||||
// Optional, used to retrieve properties of a snapshot.
|
||||
XMSSnapshot *string
|
||||
}
|
||||
|
||||
// FileSharesClientLeaseOptions contains the optional parameters for the FileSharesClient.Lease method.
|
||||
type FileSharesClientLeaseOptions struct {
|
||||
// Lease Share request body.
|
||||
Parameters *LeaseShareRequest
|
||||
|
||||
// Optional. Specify the snapshot time to lease a snapshot.
|
||||
XMSSnapshot *string
|
||||
}
|
||||
|
||||
// FileSharesClientListOptions contains the optional parameters for the FileSharesClient.NewListPager method.
|
||||
type FileSharesClientListOptions struct {
|
||||
// Optional, used to expand the properties within share's properties. Valid values are: deleted, snapshots. Should be passed
|
||||
// as a string with delimiter ','
|
||||
Expand *string
|
||||
|
||||
// Optional. When specified, only share names starting with the filter will be listed.
|
||||
Filter *string
|
||||
|
||||
// Optional. Specified maximum number of shares that can be included in the list.
|
||||
Maxpagesize *string
|
||||
}
|
||||
|
||||
// FileSharesClientRestoreOptions contains the optional parameters for the FileSharesClient.Restore method.
|
||||
type FileSharesClientRestoreOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// FileSharesClientUpdateOptions contains the optional parameters for the FileSharesClient.Update method.
|
||||
type FileSharesClientUpdateOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// LocalUsersClientCreateOrUpdateOptions contains the optional parameters for the LocalUsersClient.CreateOrUpdate method.
|
||||
type LocalUsersClientCreateOrUpdateOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// LocalUsersClientDeleteOptions contains the optional parameters for the LocalUsersClient.Delete method.
|
||||
type LocalUsersClientDeleteOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// LocalUsersClientGetOptions contains the optional parameters for the LocalUsersClient.Get method.
|
||||
type LocalUsersClientGetOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// LocalUsersClientListKeysOptions contains the optional parameters for the LocalUsersClient.ListKeys method.
|
||||
type LocalUsersClientListKeysOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// LocalUsersClientListOptions contains the optional parameters for the LocalUsersClient.NewListPager method.
|
||||
type LocalUsersClientListOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// LocalUsersClientRegeneratePasswordOptions contains the optional parameters for the LocalUsersClient.RegeneratePassword
|
||||
// method.
|
||||
type LocalUsersClientRegeneratePasswordOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// ManagementPoliciesClientCreateOrUpdateOptions contains the optional parameters for the ManagementPoliciesClient.CreateOrUpdate
|
||||
// method.
|
||||
type ManagementPoliciesClientCreateOrUpdateOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// ManagementPoliciesClientDeleteOptions contains the optional parameters for the ManagementPoliciesClient.Delete method.
|
||||
type ManagementPoliciesClientDeleteOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// ManagementPoliciesClientGetOptions contains the optional parameters for the ManagementPoliciesClient.Get method.
|
||||
type ManagementPoliciesClientGetOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// ObjectReplicationPoliciesClientCreateOrUpdateOptions contains the optional parameters for the ObjectReplicationPoliciesClient.CreateOrUpdate
|
||||
// method.
|
||||
type ObjectReplicationPoliciesClientCreateOrUpdateOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// ObjectReplicationPoliciesClientDeleteOptions contains the optional parameters for the ObjectReplicationPoliciesClient.Delete
|
||||
// method.
|
||||
type ObjectReplicationPoliciesClientDeleteOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// ObjectReplicationPoliciesClientGetOptions contains the optional parameters for the ObjectReplicationPoliciesClient.Get
|
||||
// method.
|
||||
type ObjectReplicationPoliciesClientGetOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// ObjectReplicationPoliciesClientListOptions contains the optional parameters for the ObjectReplicationPoliciesClient.NewListPager
|
||||
// method.
|
||||
type ObjectReplicationPoliciesClientListOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method.
|
||||
type OperationsClientListOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// PrivateEndpointConnectionsClientDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Delete
|
||||
// method.
|
||||
type PrivateEndpointConnectionsClientDeleteOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get
|
||||
// method.
|
||||
type PrivateEndpointConnectionsClientGetOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListPager
|
||||
// method.
|
||||
type PrivateEndpointConnectionsClientListOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// PrivateEndpointConnectionsClientPutOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Put
|
||||
// method.
|
||||
type PrivateEndpointConnectionsClientPutOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// PrivateLinkResourcesClientListByStorageAccountOptions contains the optional parameters for the PrivateLinkResourcesClient.ListByStorageAccount
|
||||
// method.
|
||||
type PrivateLinkResourcesClientListByStorageAccountOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// QueueClientCreateOptions contains the optional parameters for the QueueClient.Create method.
|
||||
type QueueClientCreateOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// QueueClientDeleteOptions contains the optional parameters for the QueueClient.Delete method.
|
||||
type QueueClientDeleteOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// QueueClientGetOptions contains the optional parameters for the QueueClient.Get method.
|
||||
type QueueClientGetOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// QueueClientListOptions contains the optional parameters for the QueueClient.NewListPager method.
|
||||
type QueueClientListOptions struct {
|
||||
// Optional, When specified, only the queues with a name starting with the given filter will be listed.
|
||||
Filter *string
|
||||
|
||||
// Optional, a maximum number of queues that should be included in a list queue response
|
||||
Maxpagesize *string
|
||||
}
|
||||
|
||||
// QueueClientUpdateOptions contains the optional parameters for the QueueClient.Update method.
|
||||
type QueueClientUpdateOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// QueueServicesClientGetServicePropertiesOptions contains the optional parameters for the QueueServicesClient.GetServiceProperties
|
||||
// method.
|
||||
type QueueServicesClientGetServicePropertiesOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// QueueServicesClientListOptions contains the optional parameters for the QueueServicesClient.List method.
|
||||
type QueueServicesClientListOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// QueueServicesClientSetServicePropertiesOptions contains the optional parameters for the QueueServicesClient.SetServiceProperties
|
||||
// method.
|
||||
type QueueServicesClientSetServicePropertiesOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// SKUsClientListOptions contains the optional parameters for the SKUsClient.NewListPager method.
|
||||
type SKUsClientListOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// TableClientCreateOptions contains the optional parameters for the TableClient.Create method.
|
||||
type TableClientCreateOptions struct {
|
||||
// The parameters to provide to create a table.
|
||||
Parameters *Table
|
||||
}
|
||||
|
||||
// TableClientDeleteOptions contains the optional parameters for the TableClient.Delete method.
|
||||
type TableClientDeleteOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// TableClientGetOptions contains the optional parameters for the TableClient.Get method.
|
||||
type TableClientGetOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// TableClientListOptions contains the optional parameters for the TableClient.NewListPager method.
|
||||
type TableClientListOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// TableClientUpdateOptions contains the optional parameters for the TableClient.Update method.
|
||||
type TableClientUpdateOptions struct {
|
||||
// The parameters to provide to create a table.
|
||||
Parameters *Table
|
||||
}
|
||||
|
||||
// TableServicesClientGetServicePropertiesOptions contains the optional parameters for the TableServicesClient.GetServiceProperties
|
||||
// method.
|
||||
type TableServicesClientGetServicePropertiesOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// TableServicesClientListOptions contains the optional parameters for the TableServicesClient.List method.
|
||||
type TableServicesClientListOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// TableServicesClientSetServicePropertiesOptions contains the optional parameters for the TableServicesClient.SetServiceProperties
|
||||
// method.
|
||||
type TableServicesClientSetServicePropertiesOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// UsagesClientListByLocationOptions contains the optional parameters for the UsagesClient.NewListByLocationPager method.
|
||||
type UsagesClientListByLocationOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
318
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/privateendpointconnections_client.go
сгенерированный
поставляемый
Normal file
318
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/privateendpointconnections_client.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,318 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package armstorage
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group.
|
||||
// Don't use this type directly, use NewPrivateEndpointConnectionsClient() instead.
|
||||
type PrivateEndpointConnectionsClient struct {
|
||||
internal *arm.Client
|
||||
subscriptionID string
|
||||
}
|
||||
|
||||
// NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values.
|
||||
// - subscriptionID - The ID of the target subscription.
|
||||
// - credential - used to authorize requests. Usually a credential from azidentity.
|
||||
// - options - pass nil to accept the default values.
|
||||
func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error) {
|
||||
cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client := &PrivateEndpointConnectionsClient{
|
||||
subscriptionID: subscriptionID,
|
||||
internal: cl,
|
||||
}
|
||||
return client, nil
|
||||
}
|
||||
|
||||
// Delete - Deletes the specified private endpoint connection associated with the storage account.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource
|
||||
// - options - PrivateEndpointConnectionsClientDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Delete
|
||||
// method.
|
||||
func (client *PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientDeleteOptions) (PrivateEndpointConnectionsClientDeleteResponse, error) {
|
||||
var err error
|
||||
const operationName = "PrivateEndpointConnectionsClient.Delete"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, privateEndpointConnectionName, options)
|
||||
if err != nil {
|
||||
return PrivateEndpointConnectionsClientDeleteResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return PrivateEndpointConnectionsClientDeleteResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return PrivateEndpointConnectionsClientDeleteResponse{}, err
|
||||
}
|
||||
return PrivateEndpointConnectionsClientDeleteResponse{}, nil
|
||||
}
|
||||
|
||||
// deleteCreateRequest creates the Delete request.
|
||||
func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientDeleteOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if privateEndpointConnectionName == "" {
|
||||
return nil, errors.New("parameter privateEndpointConnectionName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// Get - Gets the specified private endpoint connection associated with the storage account.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource
|
||||
// - options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get
|
||||
// method.
|
||||
func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error) {
|
||||
var err error
|
||||
const operationName = "PrivateEndpointConnectionsClient.Get"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, privateEndpointConnectionName, options)
|
||||
if err != nil {
|
||||
return PrivateEndpointConnectionsClientGetResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return PrivateEndpointConnectionsClientGetResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return PrivateEndpointConnectionsClientGetResponse{}, err
|
||||
}
|
||||
resp, err := client.getHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// getCreateRequest creates the Get request.
|
||||
func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if privateEndpointConnectionName == "" {
|
||||
return nil, errors.New("parameter privateEndpointConnectionName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// getHandleResponse handles the Get response.
|
||||
func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientGetResponse, error) {
|
||||
result := PrivateEndpointConnectionsClientGetResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil {
|
||||
return PrivateEndpointConnectionsClientGetResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// NewListPager - List all the private endpoint connections associated with the storage account.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - options - PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListPager
|
||||
// method.
|
||||
func (client *PrivateEndpointConnectionsClient) NewListPager(resourceGroupName string, accountName string, options *PrivateEndpointConnectionsClientListOptions) *runtime.Pager[PrivateEndpointConnectionsClientListResponse] {
|
||||
return runtime.NewPager(runtime.PagingHandler[PrivateEndpointConnectionsClientListResponse]{
|
||||
More: func(page PrivateEndpointConnectionsClientListResponse) bool {
|
||||
return false
|
||||
},
|
||||
Fetcher: func(ctx context.Context, page *PrivateEndpointConnectionsClientListResponse) (PrivateEndpointConnectionsClientListResponse, error) {
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PrivateEndpointConnectionsClient.NewListPager")
|
||||
req, err := client.listCreateRequest(ctx, resourceGroupName, accountName, options)
|
||||
if err != nil {
|
||||
return PrivateEndpointConnectionsClientListResponse{}, err
|
||||
}
|
||||
resp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return PrivateEndpointConnectionsClientListResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusOK) {
|
||||
return PrivateEndpointConnectionsClientListResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.listHandleResponse(resp)
|
||||
},
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
}
|
||||
|
||||
// listCreateRequest creates the List request.
|
||||
func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *PrivateEndpointConnectionsClientListOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// listHandleResponse handles the List response.
|
||||
func (client *PrivateEndpointConnectionsClient) listHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientListResponse, error) {
|
||||
result := PrivateEndpointConnectionsClientListResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil {
|
||||
return PrivateEndpointConnectionsClientListResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Put - Update the state of specified private endpoint connection associated with the storage account.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource
|
||||
// - properties - The private endpoint connection properties.
|
||||
// - options - PrivateEndpointConnectionsClientPutOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Put
|
||||
// method.
|
||||
func (client *PrivateEndpointConnectionsClient) Put(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, options *PrivateEndpointConnectionsClientPutOptions) (PrivateEndpointConnectionsClientPutResponse, error) {
|
||||
var err error
|
||||
const operationName = "PrivateEndpointConnectionsClient.Put"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.putCreateRequest(ctx, resourceGroupName, accountName, privateEndpointConnectionName, properties, options)
|
||||
if err != nil {
|
||||
return PrivateEndpointConnectionsClientPutResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return PrivateEndpointConnectionsClientPutResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return PrivateEndpointConnectionsClientPutResponse{}, err
|
||||
}
|
||||
resp, err := client.putHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// putCreateRequest creates the Put request.
|
||||
func (client *PrivateEndpointConnectionsClient) putCreateRequest(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, options *PrivateEndpointConnectionsClientPutOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if privateEndpointConnectionName == "" {
|
||||
return nil, errors.New("parameter privateEndpointConnectionName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
if err := runtime.MarshalAsJSON(req, properties); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// putHandleResponse handles the Put response.
|
||||
func (client *PrivateEndpointConnectionsClient) putHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientPutResponse, error) {
|
||||
result := PrivateEndpointConnectionsClientPutResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil {
|
||||
return PrivateEndpointConnectionsClientPutResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
110
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/privatelinkresources_client.go
сгенерированный
поставляемый
Normal file
110
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/privatelinkresources_client.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,110 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package armstorage
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// PrivateLinkResourcesClient contains the methods for the PrivateLinkResources group.
|
||||
// Don't use this type directly, use NewPrivateLinkResourcesClient() instead.
|
||||
type PrivateLinkResourcesClient struct {
|
||||
internal *arm.Client
|
||||
subscriptionID string
|
||||
}
|
||||
|
||||
// NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values.
|
||||
// - subscriptionID - The ID of the target subscription.
|
||||
// - credential - used to authorize requests. Usually a credential from azidentity.
|
||||
// - options - pass nil to accept the default values.
|
||||
func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkResourcesClient, error) {
|
||||
cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client := &PrivateLinkResourcesClient{
|
||||
subscriptionID: subscriptionID,
|
||||
internal: cl,
|
||||
}
|
||||
return client, nil
|
||||
}
|
||||
|
||||
// ListByStorageAccount - Gets the private link resources that need to be created for a storage account.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - options - PrivateLinkResourcesClientListByStorageAccountOptions contains the optional parameters for the PrivateLinkResourcesClient.ListByStorageAccount
|
||||
// method.
|
||||
func (client *PrivateLinkResourcesClient) ListByStorageAccount(ctx context.Context, resourceGroupName string, accountName string, options *PrivateLinkResourcesClientListByStorageAccountOptions) (PrivateLinkResourcesClientListByStorageAccountResponse, error) {
|
||||
var err error
|
||||
const operationName = "PrivateLinkResourcesClient.ListByStorageAccount"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.listByStorageAccountCreateRequest(ctx, resourceGroupName, accountName, options)
|
||||
if err != nil {
|
||||
return PrivateLinkResourcesClientListByStorageAccountResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return PrivateLinkResourcesClientListByStorageAccountResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return PrivateLinkResourcesClientListByStorageAccountResponse{}, err
|
||||
}
|
||||
resp, err := client.listByStorageAccountHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// listByStorageAccountCreateRequest creates the ListByStorageAccount request.
|
||||
func (client *PrivateLinkResourcesClient) listByStorageAccountCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *PrivateLinkResourcesClientListByStorageAccountOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateLinkResources"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// listByStorageAccountHandleResponse handles the ListByStorageAccount response.
|
||||
func (client *PrivateLinkResourcesClient) listByStorageAccountHandleResponse(resp *http.Response) (PrivateLinkResourcesClientListByStorageAccountResponse, error) {
|
||||
result := PrivateLinkResourcesClientListByStorageAccountResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil {
|
||||
return PrivateLinkResourcesClientListByStorageAccountResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
401
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/queue_client.go
сгенерированный
поставляемый
Normal file
401
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/queue_client.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,401 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package armstorage
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// QueueClient contains the methods for the Queue group.
|
||||
// Don't use this type directly, use NewQueueClient() instead.
|
||||
type QueueClient struct {
|
||||
internal *arm.Client
|
||||
subscriptionID string
|
||||
}
|
||||
|
||||
// NewQueueClient creates a new instance of QueueClient with the specified values.
|
||||
// - subscriptionID - The ID of the target subscription.
|
||||
// - credential - used to authorize requests. Usually a credential from azidentity.
|
||||
// - options - pass nil to accept the default values.
|
||||
func NewQueueClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*QueueClient, error) {
|
||||
cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client := &QueueClient{
|
||||
subscriptionID: subscriptionID,
|
||||
internal: cl,
|
||||
}
|
||||
return client, nil
|
||||
}
|
||||
|
||||
// Create - Creates a new queue with the specified queue name, under the specified account.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - queueName - A queue name must be unique within a storage account and must be between 3 and 63 characters.The name must
|
||||
// comprise of lowercase alphanumeric and dash(-) characters only, it should begin and end with
|
||||
// an alphanumeric character and it cannot have two consecutive dash(-) characters.
|
||||
// - queue - Queue properties and metadata to be created with
|
||||
// - options - QueueClientCreateOptions contains the optional parameters for the QueueClient.Create method.
|
||||
func (client *QueueClient) Create(ctx context.Context, resourceGroupName string, accountName string, queueName string, queue Queue, options *QueueClientCreateOptions) (QueueClientCreateResponse, error) {
|
||||
var err error
|
||||
const operationName = "QueueClient.Create"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, queueName, queue, options)
|
||||
if err != nil {
|
||||
return QueueClientCreateResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return QueueClientCreateResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return QueueClientCreateResponse{}, err
|
||||
}
|
||||
resp, err := client.createHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// createCreateRequest creates the Create request.
|
||||
func (client *QueueClient) createCreateRequest(ctx context.Context, resourceGroupName string, accountName string, queueName string, queue Queue, options *QueueClientCreateOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if queueName == "" {
|
||||
return nil, errors.New("parameter queueName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{queueName}", url.PathEscape(queueName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
if err := runtime.MarshalAsJSON(req, queue); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// createHandleResponse handles the Create response.
|
||||
func (client *QueueClient) createHandleResponse(resp *http.Response) (QueueClientCreateResponse, error) {
|
||||
result := QueueClientCreateResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.Queue); err != nil {
|
||||
return QueueClientCreateResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Delete - Deletes the queue with the specified queue name, under the specified account if it exists.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - queueName - A queue name must be unique within a storage account and must be between 3 and 63 characters.The name must
|
||||
// comprise of lowercase alphanumeric and dash(-) characters only, it should begin and end with
|
||||
// an alphanumeric character and it cannot have two consecutive dash(-) characters.
|
||||
// - options - QueueClientDeleteOptions contains the optional parameters for the QueueClient.Delete method.
|
||||
func (client *QueueClient) Delete(ctx context.Context, resourceGroupName string, accountName string, queueName string, options *QueueClientDeleteOptions) (QueueClientDeleteResponse, error) {
|
||||
var err error
|
||||
const operationName = "QueueClient.Delete"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, queueName, options)
|
||||
if err != nil {
|
||||
return QueueClientDeleteResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return QueueClientDeleteResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusNoContent) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return QueueClientDeleteResponse{}, err
|
||||
}
|
||||
return QueueClientDeleteResponse{}, nil
|
||||
}
|
||||
|
||||
// deleteCreateRequest creates the Delete request.
|
||||
func (client *QueueClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, queueName string, options *QueueClientDeleteOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if queueName == "" {
|
||||
return nil, errors.New("parameter queueName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{queueName}", url.PathEscape(queueName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// Get - Gets the queue with the specified queue name, under the specified account if it exists.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - queueName - A queue name must be unique within a storage account and must be between 3 and 63 characters.The name must
|
||||
// comprise of lowercase alphanumeric and dash(-) characters only, it should begin and end with
|
||||
// an alphanumeric character and it cannot have two consecutive dash(-) characters.
|
||||
// - options - QueueClientGetOptions contains the optional parameters for the QueueClient.Get method.
|
||||
func (client *QueueClient) Get(ctx context.Context, resourceGroupName string, accountName string, queueName string, options *QueueClientGetOptions) (QueueClientGetResponse, error) {
|
||||
var err error
|
||||
const operationName = "QueueClient.Get"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, queueName, options)
|
||||
if err != nil {
|
||||
return QueueClientGetResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return QueueClientGetResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return QueueClientGetResponse{}, err
|
||||
}
|
||||
resp, err := client.getHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// getCreateRequest creates the Get request.
|
||||
func (client *QueueClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, queueName string, options *QueueClientGetOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if queueName == "" {
|
||||
return nil, errors.New("parameter queueName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{queueName}", url.PathEscape(queueName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// getHandleResponse handles the Get response.
|
||||
func (client *QueueClient) getHandleResponse(resp *http.Response) (QueueClientGetResponse, error) {
|
||||
result := QueueClientGetResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.Queue); err != nil {
|
||||
return QueueClientGetResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// NewListPager - Gets a list of all the queues under the specified storage account
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - options - QueueClientListOptions contains the optional parameters for the QueueClient.NewListPager method.
|
||||
func (client *QueueClient) NewListPager(resourceGroupName string, accountName string, options *QueueClientListOptions) *runtime.Pager[QueueClientListResponse] {
|
||||
return runtime.NewPager(runtime.PagingHandler[QueueClientListResponse]{
|
||||
More: func(page QueueClientListResponse) bool {
|
||||
return page.NextLink != nil && len(*page.NextLink) > 0
|
||||
},
|
||||
Fetcher: func(ctx context.Context, page *QueueClientListResponse) (QueueClientListResponse, error) {
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "QueueClient.NewListPager")
|
||||
nextLink := ""
|
||||
if page != nil {
|
||||
nextLink = *page.NextLink
|
||||
}
|
||||
resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) {
|
||||
return client.listCreateRequest(ctx, resourceGroupName, accountName, options)
|
||||
}, nil)
|
||||
if err != nil {
|
||||
return QueueClientListResponse{}, err
|
||||
}
|
||||
return client.listHandleResponse(resp)
|
||||
},
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
}
|
||||
|
||||
// listCreateRequest creates the List request.
|
||||
func (client *QueueClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *QueueClientListOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
if options != nil && options.Maxpagesize != nil {
|
||||
reqQP.Set("$maxpagesize", *options.Maxpagesize)
|
||||
}
|
||||
if options != nil && options.Filter != nil {
|
||||
reqQP.Set("$filter", *options.Filter)
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// listHandleResponse handles the List response.
|
||||
func (client *QueueClient) listHandleResponse(resp *http.Response) (QueueClientListResponse, error) {
|
||||
result := QueueClientListResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.ListQueueResource); err != nil {
|
||||
return QueueClientListResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Update - Creates a new queue with the specified queue name, under the specified account.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - queueName - A queue name must be unique within a storage account and must be between 3 and 63 characters.The name must
|
||||
// comprise of lowercase alphanumeric and dash(-) characters only, it should begin and end with
|
||||
// an alphanumeric character and it cannot have two consecutive dash(-) characters.
|
||||
// - queue - Queue properties and metadata to be created with
|
||||
// - options - QueueClientUpdateOptions contains the optional parameters for the QueueClient.Update method.
|
||||
func (client *QueueClient) Update(ctx context.Context, resourceGroupName string, accountName string, queueName string, queue Queue, options *QueueClientUpdateOptions) (QueueClientUpdateResponse, error) {
|
||||
var err error
|
||||
const operationName = "QueueClient.Update"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, queueName, queue, options)
|
||||
if err != nil {
|
||||
return QueueClientUpdateResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return QueueClientUpdateResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return QueueClientUpdateResponse{}, err
|
||||
}
|
||||
resp, err := client.updateHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// updateCreateRequest creates the Update request.
|
||||
func (client *QueueClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, queueName string, queue Queue, options *QueueClientUpdateOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if queueName == "" {
|
||||
return nil, errors.New("parameter queueName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{queueName}", url.PathEscape(queueName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
if err := runtime.MarshalAsJSON(req, queue); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// updateHandleResponse handles the Update response.
|
||||
func (client *QueueClient) updateHandleResponse(resp *http.Response) (QueueClientUpdateResponse, error) {
|
||||
result := QueueClientUpdateResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.Queue); err != nil {
|
||||
return QueueClientUpdateResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
250
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/queueservices_client.go
сгенерированный
поставляемый
Normal file
250
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/queueservices_client.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,250 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package armstorage
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// QueueServicesClient contains the methods for the QueueServices group.
|
||||
// Don't use this type directly, use NewQueueServicesClient() instead.
|
||||
type QueueServicesClient struct {
|
||||
internal *arm.Client
|
||||
subscriptionID string
|
||||
}
|
||||
|
||||
// NewQueueServicesClient creates a new instance of QueueServicesClient with the specified values.
|
||||
// - subscriptionID - The ID of the target subscription.
|
||||
// - credential - used to authorize requests. Usually a credential from azidentity.
|
||||
// - options - pass nil to accept the default values.
|
||||
func NewQueueServicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*QueueServicesClient, error) {
|
||||
cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client := &QueueServicesClient{
|
||||
subscriptionID: subscriptionID,
|
||||
internal: cl,
|
||||
}
|
||||
return client, nil
|
||||
}
|
||||
|
||||
// GetServiceProperties - Gets the properties of a storage account’s Queue service, including properties for Storage Analytics
|
||||
// and CORS (Cross-Origin Resource Sharing) rules.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - options - QueueServicesClientGetServicePropertiesOptions contains the optional parameters for the QueueServicesClient.GetServiceProperties
|
||||
// method.
|
||||
func (client *QueueServicesClient) GetServiceProperties(ctx context.Context, resourceGroupName string, accountName string, options *QueueServicesClientGetServicePropertiesOptions) (QueueServicesClientGetServicePropertiesResponse, error) {
|
||||
var err error
|
||||
const operationName = "QueueServicesClient.GetServiceProperties"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.getServicePropertiesCreateRequest(ctx, resourceGroupName, accountName, options)
|
||||
if err != nil {
|
||||
return QueueServicesClientGetServicePropertiesResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return QueueServicesClientGetServicePropertiesResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return QueueServicesClientGetServicePropertiesResponse{}, err
|
||||
}
|
||||
resp, err := client.getServicePropertiesHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// getServicePropertiesCreateRequest creates the GetServiceProperties request.
|
||||
func (client *QueueServicesClient) getServicePropertiesCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *QueueServicesClientGetServicePropertiesOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
urlPath = strings.ReplaceAll(urlPath, "{queueServiceName}", url.PathEscape("default"))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// getServicePropertiesHandleResponse handles the GetServiceProperties response.
|
||||
func (client *QueueServicesClient) getServicePropertiesHandleResponse(resp *http.Response) (QueueServicesClientGetServicePropertiesResponse, error) {
|
||||
result := QueueServicesClientGetServicePropertiesResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.QueueServiceProperties); err != nil {
|
||||
return QueueServicesClientGetServicePropertiesResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// List - List all queue services for the storage account
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - options - QueueServicesClientListOptions contains the optional parameters for the QueueServicesClient.List method.
|
||||
func (client *QueueServicesClient) List(ctx context.Context, resourceGroupName string, accountName string, options *QueueServicesClientListOptions) (QueueServicesClientListResponse, error) {
|
||||
var err error
|
||||
const operationName = "QueueServicesClient.List"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.listCreateRequest(ctx, resourceGroupName, accountName, options)
|
||||
if err != nil {
|
||||
return QueueServicesClientListResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return QueueServicesClientListResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return QueueServicesClientListResponse{}, err
|
||||
}
|
||||
resp, err := client.listHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// listCreateRequest creates the List request.
|
||||
func (client *QueueServicesClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *QueueServicesClientListOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// listHandleResponse handles the List response.
|
||||
func (client *QueueServicesClient) listHandleResponse(resp *http.Response) (QueueServicesClientListResponse, error) {
|
||||
result := QueueServicesClientListResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.ListQueueServices); err != nil {
|
||||
return QueueServicesClientListResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// SetServiceProperties - Sets the properties of a storage account’s Queue service, including properties for Storage Analytics
|
||||
// and CORS (Cross-Origin Resource Sharing) rules.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - parameters - The properties of a storage account’s Queue service, only properties for Storage Analytics and CORS (Cross-Origin
|
||||
// Resource Sharing) rules can be specified.
|
||||
// - options - QueueServicesClientSetServicePropertiesOptions contains the optional parameters for the QueueServicesClient.SetServiceProperties
|
||||
// method.
|
||||
func (client *QueueServicesClient) SetServiceProperties(ctx context.Context, resourceGroupName string, accountName string, parameters QueueServiceProperties, options *QueueServicesClientSetServicePropertiesOptions) (QueueServicesClientSetServicePropertiesResponse, error) {
|
||||
var err error
|
||||
const operationName = "QueueServicesClient.SetServiceProperties"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.setServicePropertiesCreateRequest(ctx, resourceGroupName, accountName, parameters, options)
|
||||
if err != nil {
|
||||
return QueueServicesClientSetServicePropertiesResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return QueueServicesClientSetServicePropertiesResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return QueueServicesClientSetServicePropertiesResponse{}, err
|
||||
}
|
||||
resp, err := client.setServicePropertiesHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// setServicePropertiesCreateRequest creates the SetServiceProperties request.
|
||||
func (client *QueueServicesClient) setServicePropertiesCreateRequest(ctx context.Context, resourceGroupName string, accountName string, parameters QueueServiceProperties, options *QueueServicesClientSetServicePropertiesOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
urlPath = strings.ReplaceAll(urlPath, "{queueServiceName}", url.PathEscape("default"))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
if err := runtime.MarshalAsJSON(req, parameters); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// setServicePropertiesHandleResponse handles the SetServiceProperties response.
|
||||
func (client *QueueServicesClient) setServicePropertiesHandleResponse(resp *http.Response) (QueueServicesClientSetServicePropertiesResponse, error) {
|
||||
result := QueueServicesClientSetServicePropertiesResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.QueueServiceProperties); err != nil {
|
||||
return QueueServicesClientSetServicePropertiesResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
557
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/response_types.go
сгенерированный
поставляемый
Normal file
557
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/response_types.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,557 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package armstorage
|
||||
|
||||
// AccountsClientAbortHierarchicalNamespaceMigrationResponse contains the response from method AccountsClient.BeginAbortHierarchicalNamespaceMigration.
|
||||
type AccountsClientAbortHierarchicalNamespaceMigrationResponse struct {
|
||||
// placeholder for future response values
|
||||
}
|
||||
|
||||
// AccountsClientCheckNameAvailabilityResponse contains the response from method AccountsClient.CheckNameAvailability.
|
||||
type AccountsClientCheckNameAvailabilityResponse struct {
|
||||
// The CheckNameAvailability operation response.
|
||||
CheckNameAvailabilityResult
|
||||
}
|
||||
|
||||
// AccountsClientCreateResponse contains the response from method AccountsClient.BeginCreate.
|
||||
type AccountsClientCreateResponse struct {
|
||||
// The storage account.
|
||||
Account
|
||||
}
|
||||
|
||||
// AccountsClientCustomerInitiatedMigrationResponse contains the response from method AccountsClient.BeginCustomerInitiatedMigration.
|
||||
type AccountsClientCustomerInitiatedMigrationResponse struct {
|
||||
// placeholder for future response values
|
||||
}
|
||||
|
||||
// AccountsClientDeleteResponse contains the response from method AccountsClient.Delete.
|
||||
type AccountsClientDeleteResponse struct {
|
||||
// placeholder for future response values
|
||||
}
|
||||
|
||||
// AccountsClientFailoverResponse contains the response from method AccountsClient.BeginFailover.
|
||||
type AccountsClientFailoverResponse struct {
|
||||
// placeholder for future response values
|
||||
}
|
||||
|
||||
// AccountsClientGetCustomerInitiatedMigrationResponse contains the response from method AccountsClient.GetCustomerInitiatedMigration.
|
||||
type AccountsClientGetCustomerInitiatedMigrationResponse struct {
|
||||
// The parameters or status associated with an ongoing or enqueued storage account migration in order to update its current
|
||||
// SKU or region.
|
||||
AccountMigration
|
||||
}
|
||||
|
||||
// AccountsClientGetPropertiesResponse contains the response from method AccountsClient.GetProperties.
|
||||
type AccountsClientGetPropertiesResponse struct {
|
||||
// The storage account.
|
||||
Account
|
||||
}
|
||||
|
||||
// AccountsClientHierarchicalNamespaceMigrationResponse contains the response from method AccountsClient.BeginHierarchicalNamespaceMigration.
|
||||
type AccountsClientHierarchicalNamespaceMigrationResponse struct {
|
||||
// placeholder for future response values
|
||||
}
|
||||
|
||||
// AccountsClientListAccountSASResponse contains the response from method AccountsClient.ListAccountSAS.
|
||||
type AccountsClientListAccountSASResponse struct {
|
||||
// The List SAS credentials operation response.
|
||||
ListAccountSasResponse
|
||||
}
|
||||
|
||||
// AccountsClientListByResourceGroupResponse contains the response from method AccountsClient.NewListByResourceGroupPager.
|
||||
type AccountsClientListByResourceGroupResponse struct {
|
||||
// The response from the List Storage Accounts operation.
|
||||
AccountListResult
|
||||
}
|
||||
|
||||
// AccountsClientListKeysResponse contains the response from method AccountsClient.ListKeys.
|
||||
type AccountsClientListKeysResponse struct {
|
||||
// The response from the ListKeys operation.
|
||||
AccountListKeysResult
|
||||
}
|
||||
|
||||
// AccountsClientListResponse contains the response from method AccountsClient.NewListPager.
|
||||
type AccountsClientListResponse struct {
|
||||
// The response from the List Storage Accounts operation.
|
||||
AccountListResult
|
||||
}
|
||||
|
||||
// AccountsClientListServiceSASResponse contains the response from method AccountsClient.ListServiceSAS.
|
||||
type AccountsClientListServiceSASResponse struct {
|
||||
// The List service SAS credentials operation response.
|
||||
ListServiceSasResponse
|
||||
}
|
||||
|
||||
// AccountsClientRegenerateKeyResponse contains the response from method AccountsClient.RegenerateKey.
|
||||
type AccountsClientRegenerateKeyResponse struct {
|
||||
// The response from the ListKeys operation.
|
||||
AccountListKeysResult
|
||||
}
|
||||
|
||||
// AccountsClientRestoreBlobRangesResponse contains the response from method AccountsClient.BeginRestoreBlobRanges.
|
||||
type AccountsClientRestoreBlobRangesResponse struct {
|
||||
// Blob restore status.
|
||||
BlobRestoreStatus
|
||||
}
|
||||
|
||||
// AccountsClientRevokeUserDelegationKeysResponse contains the response from method AccountsClient.RevokeUserDelegationKeys.
|
||||
type AccountsClientRevokeUserDelegationKeysResponse struct {
|
||||
// placeholder for future response values
|
||||
}
|
||||
|
||||
// AccountsClientUpdateResponse contains the response from method AccountsClient.Update.
|
||||
type AccountsClientUpdateResponse struct {
|
||||
// The storage account.
|
||||
Account
|
||||
}
|
||||
|
||||
// BlobContainersClientClearLegalHoldResponse contains the response from method BlobContainersClient.ClearLegalHold.
|
||||
type BlobContainersClientClearLegalHoldResponse struct {
|
||||
// The LegalHold property of a blob container.
|
||||
LegalHold
|
||||
}
|
||||
|
||||
// BlobContainersClientCreateOrUpdateImmutabilityPolicyResponse contains the response from method BlobContainersClient.CreateOrUpdateImmutabilityPolicy.
|
||||
type BlobContainersClientCreateOrUpdateImmutabilityPolicyResponse struct {
|
||||
// The ImmutabilityPolicy property of a blob container, including Id, resource name, resource type, Etag.
|
||||
ImmutabilityPolicy
|
||||
|
||||
// ETag contains the information returned from the ETag header response.
|
||||
ETag *string
|
||||
}
|
||||
|
||||
// BlobContainersClientCreateResponse contains the response from method BlobContainersClient.Create.
|
||||
type BlobContainersClientCreateResponse struct {
|
||||
// Properties of the blob container, including Id, resource name, resource type, Etag.
|
||||
BlobContainer
|
||||
}
|
||||
|
||||
// BlobContainersClientDeleteImmutabilityPolicyResponse contains the response from method BlobContainersClient.DeleteImmutabilityPolicy.
|
||||
type BlobContainersClientDeleteImmutabilityPolicyResponse struct {
|
||||
// The ImmutabilityPolicy property of a blob container, including Id, resource name, resource type, Etag.
|
||||
ImmutabilityPolicy
|
||||
|
||||
// ETag contains the information returned from the ETag header response.
|
||||
ETag *string
|
||||
}
|
||||
|
||||
// BlobContainersClientDeleteResponse contains the response from method BlobContainersClient.Delete.
|
||||
type BlobContainersClientDeleteResponse struct {
|
||||
// placeholder for future response values
|
||||
}
|
||||
|
||||
// BlobContainersClientExtendImmutabilityPolicyResponse contains the response from method BlobContainersClient.ExtendImmutabilityPolicy.
|
||||
type BlobContainersClientExtendImmutabilityPolicyResponse struct {
|
||||
// The ImmutabilityPolicy property of a blob container, including Id, resource name, resource type, Etag.
|
||||
ImmutabilityPolicy
|
||||
|
||||
// ETag contains the information returned from the ETag header response.
|
||||
ETag *string
|
||||
}
|
||||
|
||||
// BlobContainersClientGetImmutabilityPolicyResponse contains the response from method BlobContainersClient.GetImmutabilityPolicy.
|
||||
type BlobContainersClientGetImmutabilityPolicyResponse struct {
|
||||
// The ImmutabilityPolicy property of a blob container, including Id, resource name, resource type, Etag.
|
||||
ImmutabilityPolicy
|
||||
|
||||
// ETag contains the information returned from the ETag header response.
|
||||
ETag *string
|
||||
}
|
||||
|
||||
// BlobContainersClientGetResponse contains the response from method BlobContainersClient.Get.
|
||||
type BlobContainersClientGetResponse struct {
|
||||
// Properties of the blob container, including Id, resource name, resource type, Etag.
|
||||
BlobContainer
|
||||
}
|
||||
|
||||
// BlobContainersClientLeaseResponse contains the response from method BlobContainersClient.Lease.
|
||||
type BlobContainersClientLeaseResponse struct {
|
||||
// Lease Container response schema.
|
||||
LeaseContainerResponse
|
||||
}
|
||||
|
||||
// BlobContainersClientListResponse contains the response from method BlobContainersClient.NewListPager.
|
||||
type BlobContainersClientListResponse struct {
|
||||
// Response schema. Contains list of blobs returned, and if paging is requested or required, a URL to next page of containers.
|
||||
ListContainerItems
|
||||
}
|
||||
|
||||
// BlobContainersClientLockImmutabilityPolicyResponse contains the response from method BlobContainersClient.LockImmutabilityPolicy.
|
||||
type BlobContainersClientLockImmutabilityPolicyResponse struct {
|
||||
// The ImmutabilityPolicy property of a blob container, including Id, resource name, resource type, Etag.
|
||||
ImmutabilityPolicy
|
||||
|
||||
// ETag contains the information returned from the ETag header response.
|
||||
ETag *string
|
||||
}
|
||||
|
||||
// BlobContainersClientObjectLevelWormResponse contains the response from method BlobContainersClient.BeginObjectLevelWorm.
|
||||
type BlobContainersClientObjectLevelWormResponse struct {
|
||||
// placeholder for future response values
|
||||
}
|
||||
|
||||
// BlobContainersClientSetLegalHoldResponse contains the response from method BlobContainersClient.SetLegalHold.
|
||||
type BlobContainersClientSetLegalHoldResponse struct {
|
||||
// The LegalHold property of a blob container.
|
||||
LegalHold
|
||||
}
|
||||
|
||||
// BlobContainersClientUpdateResponse contains the response from method BlobContainersClient.Update.
|
||||
type BlobContainersClientUpdateResponse struct {
|
||||
// Properties of the blob container, including Id, resource name, resource type, Etag.
|
||||
BlobContainer
|
||||
}
|
||||
|
||||
// BlobInventoryPoliciesClientCreateOrUpdateResponse contains the response from method BlobInventoryPoliciesClient.CreateOrUpdate.
|
||||
type BlobInventoryPoliciesClientCreateOrUpdateResponse struct {
|
||||
// The storage account blob inventory policy.
|
||||
BlobInventoryPolicy
|
||||
}
|
||||
|
||||
// BlobInventoryPoliciesClientDeleteResponse contains the response from method BlobInventoryPoliciesClient.Delete.
|
||||
type BlobInventoryPoliciesClientDeleteResponse struct {
|
||||
// placeholder for future response values
|
||||
}
|
||||
|
||||
// BlobInventoryPoliciesClientGetResponse contains the response from method BlobInventoryPoliciesClient.Get.
|
||||
type BlobInventoryPoliciesClientGetResponse struct {
|
||||
// The storage account blob inventory policy.
|
||||
BlobInventoryPolicy
|
||||
}
|
||||
|
||||
// BlobInventoryPoliciesClientListResponse contains the response from method BlobInventoryPoliciesClient.NewListPager.
|
||||
type BlobInventoryPoliciesClientListResponse struct {
|
||||
// List of blob inventory policies returned.
|
||||
ListBlobInventoryPolicy
|
||||
}
|
||||
|
||||
// BlobServicesClientGetServicePropertiesResponse contains the response from method BlobServicesClient.GetServiceProperties.
|
||||
type BlobServicesClientGetServicePropertiesResponse struct {
|
||||
// The properties of a storage account’s Blob service.
|
||||
BlobServiceProperties
|
||||
}
|
||||
|
||||
// BlobServicesClientListResponse contains the response from method BlobServicesClient.NewListPager.
|
||||
type BlobServicesClientListResponse struct {
|
||||
BlobServiceItems
|
||||
}
|
||||
|
||||
// BlobServicesClientSetServicePropertiesResponse contains the response from method BlobServicesClient.SetServiceProperties.
|
||||
type BlobServicesClientSetServicePropertiesResponse struct {
|
||||
// The properties of a storage account’s Blob service.
|
||||
BlobServiceProperties
|
||||
}
|
||||
|
||||
// DeletedAccountsClientGetResponse contains the response from method DeletedAccountsClient.Get.
|
||||
type DeletedAccountsClientGetResponse struct {
|
||||
// Deleted storage account
|
||||
DeletedAccount
|
||||
}
|
||||
|
||||
// DeletedAccountsClientListResponse contains the response from method DeletedAccountsClient.NewListPager.
|
||||
type DeletedAccountsClientListResponse struct {
|
||||
// The response from the List Deleted Accounts operation.
|
||||
DeletedAccountListResult
|
||||
}
|
||||
|
||||
// EncryptionScopesClientGetResponse contains the response from method EncryptionScopesClient.Get.
|
||||
type EncryptionScopesClientGetResponse struct {
|
||||
// The Encryption Scope resource.
|
||||
EncryptionScope
|
||||
}
|
||||
|
||||
// EncryptionScopesClientListResponse contains the response from method EncryptionScopesClient.NewListPager.
|
||||
type EncryptionScopesClientListResponse struct {
|
||||
// List of encryption scopes requested, and if paging is required, a URL to the next page of encryption scopes.
|
||||
EncryptionScopeListResult
|
||||
}
|
||||
|
||||
// EncryptionScopesClientPatchResponse contains the response from method EncryptionScopesClient.Patch.
|
||||
type EncryptionScopesClientPatchResponse struct {
|
||||
// The Encryption Scope resource.
|
||||
EncryptionScope
|
||||
}
|
||||
|
||||
// EncryptionScopesClientPutResponse contains the response from method EncryptionScopesClient.Put.
|
||||
type EncryptionScopesClientPutResponse struct {
|
||||
// The Encryption Scope resource.
|
||||
EncryptionScope
|
||||
}
|
||||
|
||||
// FileServicesClientGetServicePropertiesResponse contains the response from method FileServicesClient.GetServiceProperties.
|
||||
type FileServicesClientGetServicePropertiesResponse struct {
|
||||
// The properties of File services in storage account.
|
||||
FileServiceProperties
|
||||
}
|
||||
|
||||
// FileServicesClientListResponse contains the response from method FileServicesClient.List.
|
||||
type FileServicesClientListResponse struct {
|
||||
FileServiceItems
|
||||
}
|
||||
|
||||
// FileServicesClientSetServicePropertiesResponse contains the response from method FileServicesClient.SetServiceProperties.
|
||||
type FileServicesClientSetServicePropertiesResponse struct {
|
||||
// The properties of File services in storage account.
|
||||
FileServiceProperties
|
||||
}
|
||||
|
||||
// FileSharesClientCreateResponse contains the response from method FileSharesClient.Create.
|
||||
type FileSharesClientCreateResponse struct {
|
||||
// Properties of the file share, including Id, resource name, resource type, Etag.
|
||||
FileShare
|
||||
}
|
||||
|
||||
// FileSharesClientDeleteResponse contains the response from method FileSharesClient.Delete.
|
||||
type FileSharesClientDeleteResponse struct {
|
||||
// placeholder for future response values
|
||||
}
|
||||
|
||||
// FileSharesClientGetResponse contains the response from method FileSharesClient.Get.
|
||||
type FileSharesClientGetResponse struct {
|
||||
// Properties of the file share, including Id, resource name, resource type, Etag.
|
||||
FileShare
|
||||
}
|
||||
|
||||
// FileSharesClientLeaseResponse contains the response from method FileSharesClient.Lease.
|
||||
type FileSharesClientLeaseResponse struct {
|
||||
// Lease Share response schema.
|
||||
LeaseShareResponse
|
||||
|
||||
// ETag contains the information returned from the ETag header response.
|
||||
ETag *string
|
||||
}
|
||||
|
||||
// FileSharesClientListResponse contains the response from method FileSharesClient.NewListPager.
|
||||
type FileSharesClientListResponse struct {
|
||||
// Response schema. Contains list of shares returned, and if paging is requested or required, a URL to next page of shares.
|
||||
FileShareItems
|
||||
}
|
||||
|
||||
// FileSharesClientRestoreResponse contains the response from method FileSharesClient.Restore.
|
||||
type FileSharesClientRestoreResponse struct {
|
||||
// placeholder for future response values
|
||||
}
|
||||
|
||||
// FileSharesClientUpdateResponse contains the response from method FileSharesClient.Update.
|
||||
type FileSharesClientUpdateResponse struct {
|
||||
// Properties of the file share, including Id, resource name, resource type, Etag.
|
||||
FileShare
|
||||
}
|
||||
|
||||
// LocalUsersClientCreateOrUpdateResponse contains the response from method LocalUsersClient.CreateOrUpdate.
|
||||
type LocalUsersClientCreateOrUpdateResponse struct {
|
||||
// The local user associated with the storage accounts.
|
||||
LocalUser
|
||||
}
|
||||
|
||||
// LocalUsersClientDeleteResponse contains the response from method LocalUsersClient.Delete.
|
||||
type LocalUsersClientDeleteResponse struct {
|
||||
// placeholder for future response values
|
||||
}
|
||||
|
||||
// LocalUsersClientGetResponse contains the response from method LocalUsersClient.Get.
|
||||
type LocalUsersClientGetResponse struct {
|
||||
// The local user associated with the storage accounts.
|
||||
LocalUser
|
||||
}
|
||||
|
||||
// LocalUsersClientListKeysResponse contains the response from method LocalUsersClient.ListKeys.
|
||||
type LocalUsersClientListKeysResponse struct {
|
||||
// The Storage Account Local User keys.
|
||||
LocalUserKeys
|
||||
}
|
||||
|
||||
// LocalUsersClientListResponse contains the response from method LocalUsersClient.NewListPager.
|
||||
type LocalUsersClientListResponse struct {
|
||||
// List storage account local users.
|
||||
LocalUsers
|
||||
}
|
||||
|
||||
// LocalUsersClientRegeneratePasswordResponse contains the response from method LocalUsersClient.RegeneratePassword.
|
||||
type LocalUsersClientRegeneratePasswordResponse struct {
|
||||
// The secrets of Storage Account Local User.
|
||||
LocalUserRegeneratePasswordResult
|
||||
}
|
||||
|
||||
// ManagementPoliciesClientCreateOrUpdateResponse contains the response from method ManagementPoliciesClient.CreateOrUpdate.
|
||||
type ManagementPoliciesClientCreateOrUpdateResponse struct {
|
||||
// The Get Storage Account ManagementPolicies operation response.
|
||||
ManagementPolicy
|
||||
}
|
||||
|
||||
// ManagementPoliciesClientDeleteResponse contains the response from method ManagementPoliciesClient.Delete.
|
||||
type ManagementPoliciesClientDeleteResponse struct {
|
||||
// placeholder for future response values
|
||||
}
|
||||
|
||||
// ManagementPoliciesClientGetResponse contains the response from method ManagementPoliciesClient.Get.
|
||||
type ManagementPoliciesClientGetResponse struct {
|
||||
// The Get Storage Account ManagementPolicies operation response.
|
||||
ManagementPolicy
|
||||
}
|
||||
|
||||
// ObjectReplicationPoliciesClientCreateOrUpdateResponse contains the response from method ObjectReplicationPoliciesClient.CreateOrUpdate.
|
||||
type ObjectReplicationPoliciesClientCreateOrUpdateResponse struct {
|
||||
// The replication policy between two storage accounts. Multiple rules can be defined in one policy.
|
||||
ObjectReplicationPolicy
|
||||
}
|
||||
|
||||
// ObjectReplicationPoliciesClientDeleteResponse contains the response from method ObjectReplicationPoliciesClient.Delete.
|
||||
type ObjectReplicationPoliciesClientDeleteResponse struct {
|
||||
// placeholder for future response values
|
||||
}
|
||||
|
||||
// ObjectReplicationPoliciesClientGetResponse contains the response from method ObjectReplicationPoliciesClient.Get.
|
||||
type ObjectReplicationPoliciesClientGetResponse struct {
|
||||
// The replication policy between two storage accounts. Multiple rules can be defined in one policy.
|
||||
ObjectReplicationPolicy
|
||||
}
|
||||
|
||||
// ObjectReplicationPoliciesClientListResponse contains the response from method ObjectReplicationPoliciesClient.NewListPager.
|
||||
type ObjectReplicationPoliciesClientListResponse struct {
|
||||
// List storage account object replication policies.
|
||||
ObjectReplicationPolicies
|
||||
}
|
||||
|
||||
// OperationsClientListResponse contains the response from method OperationsClient.NewListPager.
|
||||
type OperationsClientListResponse struct {
|
||||
// Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of
|
||||
// results.
|
||||
OperationListResult
|
||||
}
|
||||
|
||||
// PrivateEndpointConnectionsClientDeleteResponse contains the response from method PrivateEndpointConnectionsClient.Delete.
|
||||
type PrivateEndpointConnectionsClientDeleteResponse struct {
|
||||
// placeholder for future response values
|
||||
}
|
||||
|
||||
// PrivateEndpointConnectionsClientGetResponse contains the response from method PrivateEndpointConnectionsClient.Get.
|
||||
type PrivateEndpointConnectionsClientGetResponse struct {
|
||||
// The Private Endpoint Connection resource.
|
||||
PrivateEndpointConnection
|
||||
}
|
||||
|
||||
// PrivateEndpointConnectionsClientListResponse contains the response from method PrivateEndpointConnectionsClient.NewListPager.
|
||||
type PrivateEndpointConnectionsClientListResponse struct {
|
||||
// List of private endpoint connection associated with the specified storage account
|
||||
PrivateEndpointConnectionListResult
|
||||
}
|
||||
|
||||
// PrivateEndpointConnectionsClientPutResponse contains the response from method PrivateEndpointConnectionsClient.Put.
|
||||
type PrivateEndpointConnectionsClientPutResponse struct {
|
||||
// The Private Endpoint Connection resource.
|
||||
PrivateEndpointConnection
|
||||
}
|
||||
|
||||
// PrivateLinkResourcesClientListByStorageAccountResponse contains the response from method PrivateLinkResourcesClient.ListByStorageAccount.
|
||||
type PrivateLinkResourcesClientListByStorageAccountResponse struct {
|
||||
// A list of private link resources
|
||||
PrivateLinkResourceListResult
|
||||
}
|
||||
|
||||
// QueueClientCreateResponse contains the response from method QueueClient.Create.
|
||||
type QueueClientCreateResponse struct {
|
||||
Queue
|
||||
}
|
||||
|
||||
// QueueClientDeleteResponse contains the response from method QueueClient.Delete.
|
||||
type QueueClientDeleteResponse struct {
|
||||
// placeholder for future response values
|
||||
}
|
||||
|
||||
// QueueClientGetResponse contains the response from method QueueClient.Get.
|
||||
type QueueClientGetResponse struct {
|
||||
Queue
|
||||
}
|
||||
|
||||
// QueueClientListResponse contains the response from method QueueClient.NewListPager.
|
||||
type QueueClientListResponse struct {
|
||||
// Response schema. Contains list of queues returned
|
||||
ListQueueResource
|
||||
}
|
||||
|
||||
// QueueClientUpdateResponse contains the response from method QueueClient.Update.
|
||||
type QueueClientUpdateResponse struct {
|
||||
Queue
|
||||
}
|
||||
|
||||
// QueueServicesClientGetServicePropertiesResponse contains the response from method QueueServicesClient.GetServiceProperties.
|
||||
type QueueServicesClientGetServicePropertiesResponse struct {
|
||||
// The properties of a storage account’s Queue service.
|
||||
QueueServiceProperties
|
||||
}
|
||||
|
||||
// QueueServicesClientListResponse contains the response from method QueueServicesClient.List.
|
||||
type QueueServicesClientListResponse struct {
|
||||
ListQueueServices
|
||||
}
|
||||
|
||||
// QueueServicesClientSetServicePropertiesResponse contains the response from method QueueServicesClient.SetServiceProperties.
|
||||
type QueueServicesClientSetServicePropertiesResponse struct {
|
||||
// The properties of a storage account’s Queue service.
|
||||
QueueServiceProperties
|
||||
}
|
||||
|
||||
// SKUsClientListResponse contains the response from method SKUsClient.NewListPager.
|
||||
type SKUsClientListResponse struct {
|
||||
// The response from the List Storage SKUs operation.
|
||||
SKUListResult
|
||||
}
|
||||
|
||||
// TableClientCreateResponse contains the response from method TableClient.Create.
|
||||
type TableClientCreateResponse struct {
|
||||
// Properties of the table, including Id, resource name, resource type.
|
||||
Table
|
||||
}
|
||||
|
||||
// TableClientDeleteResponse contains the response from method TableClient.Delete.
|
||||
type TableClientDeleteResponse struct {
|
||||
// placeholder for future response values
|
||||
}
|
||||
|
||||
// TableClientGetResponse contains the response from method TableClient.Get.
|
||||
type TableClientGetResponse struct {
|
||||
// Properties of the table, including Id, resource name, resource type.
|
||||
Table
|
||||
}
|
||||
|
||||
// TableClientListResponse contains the response from method TableClient.NewListPager.
|
||||
type TableClientListResponse struct {
|
||||
// Response schema. Contains list of tables returned
|
||||
ListTableResource
|
||||
}
|
||||
|
||||
// TableClientUpdateResponse contains the response from method TableClient.Update.
|
||||
type TableClientUpdateResponse struct {
|
||||
// Properties of the table, including Id, resource name, resource type.
|
||||
Table
|
||||
}
|
||||
|
||||
// TableServicesClientGetServicePropertiesResponse contains the response from method TableServicesClient.GetServiceProperties.
|
||||
type TableServicesClientGetServicePropertiesResponse struct {
|
||||
// The properties of a storage account’s Table service.
|
||||
TableServiceProperties
|
||||
}
|
||||
|
||||
// TableServicesClientListResponse contains the response from method TableServicesClient.List.
|
||||
type TableServicesClientListResponse struct {
|
||||
ListTableServices
|
||||
}
|
||||
|
||||
// TableServicesClientSetServicePropertiesResponse contains the response from method TableServicesClient.SetServiceProperties.
|
||||
type TableServicesClientSetServicePropertiesResponse struct {
|
||||
// The properties of a storage account’s Table service.
|
||||
TableServiceProperties
|
||||
}
|
||||
|
||||
// UsagesClientListByLocationResponse contains the response from method UsagesClient.NewListByLocationPager.
|
||||
type UsagesClientListByLocationResponse struct {
|
||||
// The response from the List Usages operation.
|
||||
UsageListResult
|
||||
}
|
99
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/skus_client.go
сгенерированный
поставляемый
Normal file
99
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/skus_client.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,99 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package armstorage
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// SKUsClient contains the methods for the SKUs group.
|
||||
// Don't use this type directly, use NewSKUsClient() instead.
|
||||
type SKUsClient struct {
|
||||
internal *arm.Client
|
||||
subscriptionID string
|
||||
}
|
||||
|
||||
// NewSKUsClient creates a new instance of SKUsClient with the specified values.
|
||||
// - subscriptionID - The ID of the target subscription.
|
||||
// - credential - used to authorize requests. Usually a credential from azidentity.
|
||||
// - options - pass nil to accept the default values.
|
||||
func NewSKUsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SKUsClient, error) {
|
||||
cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client := &SKUsClient{
|
||||
subscriptionID: subscriptionID,
|
||||
internal: cl,
|
||||
}
|
||||
return client, nil
|
||||
}
|
||||
|
||||
// NewListPager - Lists the available SKUs supported by Microsoft.Storage for given subscription.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - options - SKUsClientListOptions contains the optional parameters for the SKUsClient.NewListPager method.
|
||||
func (client *SKUsClient) NewListPager(options *SKUsClientListOptions) *runtime.Pager[SKUsClientListResponse] {
|
||||
return runtime.NewPager(runtime.PagingHandler[SKUsClientListResponse]{
|
||||
More: func(page SKUsClientListResponse) bool {
|
||||
return false
|
||||
},
|
||||
Fetcher: func(ctx context.Context, page *SKUsClientListResponse) (SKUsClientListResponse, error) {
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SKUsClient.NewListPager")
|
||||
req, err := client.listCreateRequest(ctx, options)
|
||||
if err != nil {
|
||||
return SKUsClientListResponse{}, err
|
||||
}
|
||||
resp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return SKUsClientListResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusOK) {
|
||||
return SKUsClientListResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.listHandleResponse(resp)
|
||||
},
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
}
|
||||
|
||||
// listCreateRequest creates the List request.
|
||||
func (client *SKUsClient) listCreateRequest(ctx context.Context, options *SKUsClientListOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Storage/skus"
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// listHandleResponse handles the List response.
|
||||
func (client *SKUsClient) listHandleResponse(resp *http.Response) (SKUsClientListResponse, error) {
|
||||
result := SKUsClientListResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.SKUListResult); err != nil {
|
||||
return SKUsClientListResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
395
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/table_client.go
сгенерированный
поставляемый
Normal file
395
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/table_client.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,395 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package armstorage
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// TableClient contains the methods for the Table group.
|
||||
// Don't use this type directly, use NewTableClient() instead.
|
||||
type TableClient struct {
|
||||
internal *arm.Client
|
||||
subscriptionID string
|
||||
}
|
||||
|
||||
// NewTableClient creates a new instance of TableClient with the specified values.
|
||||
// - subscriptionID - The ID of the target subscription.
|
||||
// - credential - used to authorize requests. Usually a credential from azidentity.
|
||||
// - options - pass nil to accept the default values.
|
||||
func NewTableClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TableClient, error) {
|
||||
cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client := &TableClient{
|
||||
subscriptionID: subscriptionID,
|
||||
internal: cl,
|
||||
}
|
||||
return client, nil
|
||||
}
|
||||
|
||||
// Create - Creates a new table with the specified table name, under the specified account.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - tableName - A table name must be unique within a storage account and must be between 3 and 63 characters.The name must
|
||||
// comprise of only alphanumeric characters and it cannot begin with a numeric character.
|
||||
// - options - TableClientCreateOptions contains the optional parameters for the TableClient.Create method.
|
||||
func (client *TableClient) Create(ctx context.Context, resourceGroupName string, accountName string, tableName string, options *TableClientCreateOptions) (TableClientCreateResponse, error) {
|
||||
var err error
|
||||
const operationName = "TableClient.Create"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, tableName, options)
|
||||
if err != nil {
|
||||
return TableClientCreateResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return TableClientCreateResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return TableClientCreateResponse{}, err
|
||||
}
|
||||
resp, err := client.createHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// createCreateRequest creates the Create request.
|
||||
func (client *TableClient) createCreateRequest(ctx context.Context, resourceGroupName string, accountName string, tableName string, options *TableClientCreateOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if tableName == "" {
|
||||
return nil, errors.New("parameter tableName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{tableName}", url.PathEscape(tableName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
if options != nil && options.Parameters != nil {
|
||||
if err := runtime.MarshalAsJSON(req, *options.Parameters); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// createHandleResponse handles the Create response.
|
||||
func (client *TableClient) createHandleResponse(resp *http.Response) (TableClientCreateResponse, error) {
|
||||
result := TableClientCreateResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.Table); err != nil {
|
||||
return TableClientCreateResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Delete - Deletes the table with the specified table name, under the specified account if it exists.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - tableName - A table name must be unique within a storage account and must be between 3 and 63 characters.The name must
|
||||
// comprise of only alphanumeric characters and it cannot begin with a numeric character.
|
||||
// - options - TableClientDeleteOptions contains the optional parameters for the TableClient.Delete method.
|
||||
func (client *TableClient) Delete(ctx context.Context, resourceGroupName string, accountName string, tableName string, options *TableClientDeleteOptions) (TableClientDeleteResponse, error) {
|
||||
var err error
|
||||
const operationName = "TableClient.Delete"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, tableName, options)
|
||||
if err != nil {
|
||||
return TableClientDeleteResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return TableClientDeleteResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusNoContent) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return TableClientDeleteResponse{}, err
|
||||
}
|
||||
return TableClientDeleteResponse{}, nil
|
||||
}
|
||||
|
||||
// deleteCreateRequest creates the Delete request.
|
||||
func (client *TableClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, tableName string, options *TableClientDeleteOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if tableName == "" {
|
||||
return nil, errors.New("parameter tableName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{tableName}", url.PathEscape(tableName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// Get - Gets the table with the specified table name, under the specified account if it exists.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - tableName - A table name must be unique within a storage account and must be between 3 and 63 characters.The name must
|
||||
// comprise of only alphanumeric characters and it cannot begin with a numeric character.
|
||||
// - options - TableClientGetOptions contains the optional parameters for the TableClient.Get method.
|
||||
func (client *TableClient) Get(ctx context.Context, resourceGroupName string, accountName string, tableName string, options *TableClientGetOptions) (TableClientGetResponse, error) {
|
||||
var err error
|
||||
const operationName = "TableClient.Get"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, tableName, options)
|
||||
if err != nil {
|
||||
return TableClientGetResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return TableClientGetResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return TableClientGetResponse{}, err
|
||||
}
|
||||
resp, err := client.getHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// getCreateRequest creates the Get request.
|
||||
func (client *TableClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, tableName string, options *TableClientGetOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if tableName == "" {
|
||||
return nil, errors.New("parameter tableName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{tableName}", url.PathEscape(tableName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// getHandleResponse handles the Get response.
|
||||
func (client *TableClient) getHandleResponse(resp *http.Response) (TableClientGetResponse, error) {
|
||||
result := TableClientGetResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.Table); err != nil {
|
||||
return TableClientGetResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// NewListPager - Gets a list of all the tables under the specified storage account
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - options - TableClientListOptions contains the optional parameters for the TableClient.NewListPager method.
|
||||
func (client *TableClient) NewListPager(resourceGroupName string, accountName string, options *TableClientListOptions) *runtime.Pager[TableClientListResponse] {
|
||||
return runtime.NewPager(runtime.PagingHandler[TableClientListResponse]{
|
||||
More: func(page TableClientListResponse) bool {
|
||||
return page.NextLink != nil && len(*page.NextLink) > 0
|
||||
},
|
||||
Fetcher: func(ctx context.Context, page *TableClientListResponse) (TableClientListResponse, error) {
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "TableClient.NewListPager")
|
||||
nextLink := ""
|
||||
if page != nil {
|
||||
nextLink = *page.NextLink
|
||||
}
|
||||
resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) {
|
||||
return client.listCreateRequest(ctx, resourceGroupName, accountName, options)
|
||||
}, nil)
|
||||
if err != nil {
|
||||
return TableClientListResponse{}, err
|
||||
}
|
||||
return client.listHandleResponse(resp)
|
||||
},
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
}
|
||||
|
||||
// listCreateRequest creates the List request.
|
||||
func (client *TableClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *TableClientListOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// listHandleResponse handles the List response.
|
||||
func (client *TableClient) listHandleResponse(resp *http.Response) (TableClientListResponse, error) {
|
||||
result := TableClientListResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.ListTableResource); err != nil {
|
||||
return TableClientListResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Update - Creates a new table with the specified table name, under the specified account.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - tableName - A table name must be unique within a storage account and must be between 3 and 63 characters.The name must
|
||||
// comprise of only alphanumeric characters and it cannot begin with a numeric character.
|
||||
// - options - TableClientUpdateOptions contains the optional parameters for the TableClient.Update method.
|
||||
func (client *TableClient) Update(ctx context.Context, resourceGroupName string, accountName string, tableName string, options *TableClientUpdateOptions) (TableClientUpdateResponse, error) {
|
||||
var err error
|
||||
const operationName = "TableClient.Update"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, tableName, options)
|
||||
if err != nil {
|
||||
return TableClientUpdateResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return TableClientUpdateResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return TableClientUpdateResponse{}, err
|
||||
}
|
||||
resp, err := client.updateHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// updateCreateRequest creates the Update request.
|
||||
func (client *TableClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, tableName string, options *TableClientUpdateOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if tableName == "" {
|
||||
return nil, errors.New("parameter tableName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{tableName}", url.PathEscape(tableName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
if options != nil && options.Parameters != nil {
|
||||
if err := runtime.MarshalAsJSON(req, *options.Parameters); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// updateHandleResponse handles the Update response.
|
||||
func (client *TableClient) updateHandleResponse(resp *http.Response) (TableClientUpdateResponse, error) {
|
||||
result := TableClientUpdateResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.Table); err != nil {
|
||||
return TableClientUpdateResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
250
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/tableservices_client.go
сгенерированный
поставляемый
Normal file
250
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/tableservices_client.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,250 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package armstorage
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// TableServicesClient contains the methods for the TableServices group.
|
||||
// Don't use this type directly, use NewTableServicesClient() instead.
|
||||
type TableServicesClient struct {
|
||||
internal *arm.Client
|
||||
subscriptionID string
|
||||
}
|
||||
|
||||
// NewTableServicesClient creates a new instance of TableServicesClient with the specified values.
|
||||
// - subscriptionID - The ID of the target subscription.
|
||||
// - credential - used to authorize requests. Usually a credential from azidentity.
|
||||
// - options - pass nil to accept the default values.
|
||||
func NewTableServicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TableServicesClient, error) {
|
||||
cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client := &TableServicesClient{
|
||||
subscriptionID: subscriptionID,
|
||||
internal: cl,
|
||||
}
|
||||
return client, nil
|
||||
}
|
||||
|
||||
// GetServiceProperties - Gets the properties of a storage account’s Table service, including properties for Storage Analytics
|
||||
// and CORS (Cross-Origin Resource Sharing) rules.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - options - TableServicesClientGetServicePropertiesOptions contains the optional parameters for the TableServicesClient.GetServiceProperties
|
||||
// method.
|
||||
func (client *TableServicesClient) GetServiceProperties(ctx context.Context, resourceGroupName string, accountName string, options *TableServicesClientGetServicePropertiesOptions) (TableServicesClientGetServicePropertiesResponse, error) {
|
||||
var err error
|
||||
const operationName = "TableServicesClient.GetServiceProperties"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.getServicePropertiesCreateRequest(ctx, resourceGroupName, accountName, options)
|
||||
if err != nil {
|
||||
return TableServicesClientGetServicePropertiesResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return TableServicesClientGetServicePropertiesResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return TableServicesClientGetServicePropertiesResponse{}, err
|
||||
}
|
||||
resp, err := client.getServicePropertiesHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// getServicePropertiesCreateRequest creates the GetServiceProperties request.
|
||||
func (client *TableServicesClient) getServicePropertiesCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *TableServicesClientGetServicePropertiesOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
urlPath = strings.ReplaceAll(urlPath, "{tableServiceName}", url.PathEscape("default"))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// getServicePropertiesHandleResponse handles the GetServiceProperties response.
|
||||
func (client *TableServicesClient) getServicePropertiesHandleResponse(resp *http.Response) (TableServicesClientGetServicePropertiesResponse, error) {
|
||||
result := TableServicesClientGetServicePropertiesResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.TableServiceProperties); err != nil {
|
||||
return TableServicesClientGetServicePropertiesResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// List - List all table services for the storage account.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - options - TableServicesClientListOptions contains the optional parameters for the TableServicesClient.List method.
|
||||
func (client *TableServicesClient) List(ctx context.Context, resourceGroupName string, accountName string, options *TableServicesClientListOptions) (TableServicesClientListResponse, error) {
|
||||
var err error
|
||||
const operationName = "TableServicesClient.List"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.listCreateRequest(ctx, resourceGroupName, accountName, options)
|
||||
if err != nil {
|
||||
return TableServicesClientListResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return TableServicesClientListResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return TableServicesClientListResponse{}, err
|
||||
}
|
||||
resp, err := client.listHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// listCreateRequest creates the List request.
|
||||
func (client *TableServicesClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *TableServicesClientListOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// listHandleResponse handles the List response.
|
||||
func (client *TableServicesClient) listHandleResponse(resp *http.Response) (TableServicesClientListResponse, error) {
|
||||
result := TableServicesClientListResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.ListTableServices); err != nil {
|
||||
return TableServicesClientListResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// SetServiceProperties - Sets the properties of a storage account’s Table service, including properties for Storage Analytics
|
||||
// and CORS (Cross-Origin Resource Sharing) rules.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive.
|
||||
// - accountName - The name of the storage account within the specified resource group. Storage account names must be between
|
||||
// 3 and 24 characters in length and use numbers and lower-case letters only.
|
||||
// - parameters - The properties of a storage account’s Table service, only properties for Storage Analytics and CORS (Cross-Origin
|
||||
// Resource Sharing) rules can be specified.
|
||||
// - options - TableServicesClientSetServicePropertiesOptions contains the optional parameters for the TableServicesClient.SetServiceProperties
|
||||
// method.
|
||||
func (client *TableServicesClient) SetServiceProperties(ctx context.Context, resourceGroupName string, accountName string, parameters TableServiceProperties, options *TableServicesClientSetServicePropertiesOptions) (TableServicesClientSetServicePropertiesResponse, error) {
|
||||
var err error
|
||||
const operationName = "TableServicesClient.SetServiceProperties"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.setServicePropertiesCreateRequest(ctx, resourceGroupName, accountName, parameters, options)
|
||||
if err != nil {
|
||||
return TableServicesClientSetServicePropertiesResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return TableServicesClientSetServicePropertiesResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return TableServicesClientSetServicePropertiesResponse{}, err
|
||||
}
|
||||
resp, err := client.setServicePropertiesHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// setServicePropertiesCreateRequest creates the SetServiceProperties request.
|
||||
func (client *TableServicesClient) setServicePropertiesCreateRequest(ctx context.Context, resourceGroupName string, accountName string, parameters TableServiceProperties, options *TableServicesClientSetServicePropertiesOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}"
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if accountName == "" {
|
||||
return nil, errors.New("parameter accountName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName))
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
urlPath = strings.ReplaceAll(urlPath, "{tableServiceName}", url.PathEscape("default"))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
if err := runtime.MarshalAsJSON(req, parameters); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// setServicePropertiesHandleResponse handles the SetServiceProperties response.
|
||||
func (client *TableServicesClient) setServicePropertiesHandleResponse(resp *http.Response) (TableServicesClientSetServicePropertiesResponse, error) {
|
||||
result := TableServicesClientSetServicePropertiesResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.TableServiceProperties); err != nil {
|
||||
return TableServicesClientSetServicePropertiesResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
86
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/time_rfc3339.go
сгенерированный
поставляемый
Normal file
86
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/time_rfc3339.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,86 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package armstorage
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases.
|
||||
var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`)
|
||||
|
||||
const (
|
||||
utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"`
|
||||
utcDateTime = "2006-01-02T15:04:05.999999999"
|
||||
dateTimeJSON = `"` + time.RFC3339Nano + `"`
|
||||
)
|
||||
|
||||
type dateTimeRFC3339 time.Time
|
||||
|
||||
func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) {
|
||||
tt := time.Time(t)
|
||||
return tt.MarshalJSON()
|
||||
}
|
||||
|
||||
func (t dateTimeRFC3339) MarshalText() ([]byte, error) {
|
||||
tt := time.Time(t)
|
||||
return tt.MarshalText()
|
||||
}
|
||||
|
||||
func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error {
|
||||
layout := utcDateTimeJSON
|
||||
if tzOffsetRegex.Match(data) {
|
||||
layout = dateTimeJSON
|
||||
}
|
||||
return t.Parse(layout, string(data))
|
||||
}
|
||||
|
||||
func (t *dateTimeRFC3339) UnmarshalText(data []byte) error {
|
||||
layout := utcDateTime
|
||||
if tzOffsetRegex.Match(data) {
|
||||
layout = time.RFC3339Nano
|
||||
}
|
||||
return t.Parse(layout, string(data))
|
||||
}
|
||||
|
||||
func (t *dateTimeRFC3339) Parse(layout, value string) error {
|
||||
p, err := time.Parse(layout, strings.ToUpper(value))
|
||||
*t = dateTimeRFC3339(p)
|
||||
return err
|
||||
}
|
||||
|
||||
func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) {
|
||||
if t == nil {
|
||||
return
|
||||
} else if azcore.IsNullValue(t) {
|
||||
m[k] = nil
|
||||
return
|
||||
} else if reflect.ValueOf(t).IsNil() {
|
||||
return
|
||||
}
|
||||
m[k] = (*dateTimeRFC3339)(t)
|
||||
}
|
||||
|
||||
func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error {
|
||||
if data == nil || strings.EqualFold(string(data), "null") {
|
||||
return nil
|
||||
}
|
||||
var aux dateTimeRFC3339
|
||||
if err := json.Unmarshal(data, &aux); err != nil {
|
||||
return fmt.Errorf("struct field %s: %v", fn, err)
|
||||
}
|
||||
*t = (*time.Time)(&aux)
|
||||
return nil
|
||||
}
|
105
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/usages_client.go
сгенерированный
поставляемый
Normal file
105
vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/usages_client.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,105 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package armstorage
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// UsagesClient contains the methods for the Usages group.
|
||||
// Don't use this type directly, use NewUsagesClient() instead.
|
||||
type UsagesClient struct {
|
||||
internal *arm.Client
|
||||
subscriptionID string
|
||||
}
|
||||
|
||||
// NewUsagesClient creates a new instance of UsagesClient with the specified values.
|
||||
// - subscriptionID - The ID of the target subscription.
|
||||
// - credential - used to authorize requests. Usually a credential from azidentity.
|
||||
// - options - pass nil to accept the default values.
|
||||
func NewUsagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*UsagesClient, error) {
|
||||
cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client := &UsagesClient{
|
||||
subscriptionID: subscriptionID,
|
||||
internal: cl,
|
||||
}
|
||||
return client, nil
|
||||
}
|
||||
|
||||
// NewListByLocationPager - Gets the current usage count and the limit for the resources of the location under the subscription.
|
||||
//
|
||||
// Generated from API version 2023-01-01
|
||||
// - location - The location of the Azure Storage resource.
|
||||
// - options - UsagesClientListByLocationOptions contains the optional parameters for the UsagesClient.NewListByLocationPager
|
||||
// method.
|
||||
func (client *UsagesClient) NewListByLocationPager(location string, options *UsagesClientListByLocationOptions) *runtime.Pager[UsagesClientListByLocationResponse] {
|
||||
return runtime.NewPager(runtime.PagingHandler[UsagesClientListByLocationResponse]{
|
||||
More: func(page UsagesClientListByLocationResponse) bool {
|
||||
return false
|
||||
},
|
||||
Fetcher: func(ctx context.Context, page *UsagesClientListByLocationResponse) (UsagesClientListByLocationResponse, error) {
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "UsagesClient.NewListByLocationPager")
|
||||
req, err := client.listByLocationCreateRequest(ctx, location, options)
|
||||
if err != nil {
|
||||
return UsagesClientListByLocationResponse{}, err
|
||||
}
|
||||
resp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return UsagesClientListByLocationResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusOK) {
|
||||
return UsagesClientListByLocationResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.listByLocationHandleResponse(resp)
|
||||
},
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
}
|
||||
|
||||
// listByLocationCreateRequest creates the ListByLocation request.
|
||||
func (client *UsagesClient) listByLocationCreateRequest(ctx context.Context, location string, options *UsagesClientListByLocationOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/usages"
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if location == "" {
|
||||
return nil, errors.New("parameter location cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-01-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// listByLocationHandleResponse handles the ListByLocation response.
|
||||
func (client *UsagesClient) listByLocationHandleResponse(resp *http.Response) (UsagesClientListByLocationResponse, error) {
|
||||
result := UsagesClientListByLocationResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.UsageListResult); err != nil {
|
||||
return UsagesClientListByLocationResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
285
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/CHANGELOG.md
сгенерированный
поставляемый
Normal file
285
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/CHANGELOG.md
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,285 @@
|
|||
# Release History
|
||||
|
||||
## 1.3.2 (2024-04-09)
|
||||
|
||||
### Bugs Fixed
|
||||
* Fixed an issue where GetSASURL() was providing HTTPS SAS, instead of the default http+https SAS. Fixes [#22448](https://github.com/Azure/azure-sdk-for-go/issues/22448)
|
||||
|
||||
### Other Changes
|
||||
* Integrate `InsecureAllowCredentialWithHTTP` client options.
|
||||
* Update dependencies.
|
||||
|
||||
## 1.3.1 (2024-02-28)
|
||||
|
||||
### Bugs Fixed
|
||||
|
||||
* Re-enabled `SharedKeyCredential` authentication mode for non TLS protected endpoints.
|
||||
* Use random write in `DownloadFile` method. Fixes [#22426](https://github.com/Azure/azure-sdk-for-go/issues/22426).
|
||||
|
||||
## 1.3.0 (2024-02-12)
|
||||
|
||||
### Bugs Fixed
|
||||
* Fix concurrency issue while Downloading File. Fixes [#22156](https://github.com/Azure/azure-sdk-for-go/issues/22156).
|
||||
* Fix panic when nil options bag is passed to NewGetPageRangesPager. Fixes [22356](https://github.com/Azure/azure-sdk-for-go/issues/22356).
|
||||
* Fix file offset update after Download file. Fixes [#22297](https://github.com/Azure/azure-sdk-for-go/issues/22297).
|
||||
|
||||
### Other Changes
|
||||
* Updated the version of `azcore` to `1.9.2`
|
||||
|
||||
## 1.3.0-beta.1 (2024-01-09)
|
||||
|
||||
### Features Added
|
||||
|
||||
* Updated service version to `2023-11-03`.
|
||||
* Added support for Audience when OAuth is used.
|
||||
|
||||
### Bugs Fixed
|
||||
|
||||
* Block `SharedKeyCredential` authentication mode for non TLS protected endpoints. Fixes [#21841](https://github.com/Azure/azure-sdk-for-go/issues/21841).
|
||||
|
||||
## 1.2.1 (2023-12-13)
|
||||
|
||||
### Features Added
|
||||
|
||||
* Exposed GetSASURL from specialized clients
|
||||
|
||||
### Bugs Fixed
|
||||
|
||||
* Fixed case in Blob Batch API when blob path has / in it. Fixes [#21649](https://github.com/Azure/azure-sdk-for-go/issues/21649).
|
||||
* Fixed SharedKeyMissingError when using client.BlobClient().GetSASURL() method
|
||||
* Fixed an issue that would cause metadata keys with empty values to be omitted when enumerating blobs.
|
||||
* Fixed an issue where passing empty map to set blob tags API was causing panic. Fixes [#21869](https://github.com/Azure/azure-sdk-for-go/issues/21869).
|
||||
* Fixed an issue where downloaded file has incorrect size when not a multiple of block size. Fixes [#21995](https://github.com/Azure/azure-sdk-for-go/issues/21995).
|
||||
* Fixed case where `io.ErrUnexpectedEOF` was treated as expected error in `UploadStream`. Fixes [#21837](https://github.com/Azure/azure-sdk-for-go/issues/21837).
|
||||
|
||||
### Other Changes
|
||||
|
||||
* Updated the version of `azcore` to `1.9.1` and `azidentity` to `1.4.0`.
|
||||
|
||||
## 1.2.0 (2023-10-11)
|
||||
|
||||
### Bugs Fixed
|
||||
* Fixed null pointer exception when `SetImmutabilityPolicyOptions` is passed as `nil`.
|
||||
|
||||
## 1.2.0-beta.1 (2023-09-18)
|
||||
|
||||
### Features Added
|
||||
* Added support for service version 2020-12-06, 2021-02-12, 2021-04-10, 2021-06-08, 2021-08-06 , 2021-10-04, 2021-12-02, 2022-11-02, 2023-01-03, 2023-05-03, and 2023-08-03
|
||||
* Added support for [Cold Tier](https://learn.microsoft.com/azure/storage/blobs/access-tiers-overview?tabs=azure-portal).
|
||||
* Added `CopySourceTag` option for `UploadBlobFromURLOptions`
|
||||
* Added [FilterBlobs by Tags](https://learn.microsoft.com/rest/api/storageservices/find-blobs-by-tags-container) API for container client.
|
||||
* Added `System` option to `ListContainersInclude` to allow listing of system containers (i.e, $web).
|
||||
* Updated the SAS Version to `2021-12-02` and added `Encryption Scope` to Account SAS, Service SAS, and User Delegation SAS
|
||||
* Added `ArchiveStatusRehydratePendingToCold` value to `ArchiveStatus` enum.
|
||||
* Content length limit for `AppendBlob.AppendBlock()` and `AppendBlob.AppendBlockFromURL()` raised from 4 MB to 100 MB.
|
||||
|
||||
### Bugs Fixed
|
||||
* Fixed issue where some requests fail with mismatch in string to sign.
|
||||
* Fixed service SAS creation where expiry time or permissions can be omitted when stored access policy is used. Fixes [#21229](https://github.com/Azure/azure-sdk-for-go/issues/21229).
|
||||
|
||||
### Other Changes
|
||||
* Updating version of azcore to 1.6.0.
|
||||
|
||||
## 1.1.0 (2023-07-13)
|
||||
|
||||
### Features Added
|
||||
|
||||
* Added [Blob Batch API](https://learn.microsoft.com/rest/api/storageservices/blob-batch).
|
||||
* Added support for bearer challenge for identity based managed disks.
|
||||
* Added support for GetAccountInfo to container and blob level clients.
|
||||
* Added [UploadBlobFromURL API](https://learn.microsoft.com/rest/api/storageservices/put-blob-from-url).
|
||||
* Added support for CopySourceAuthorization to appendblob.AppendBlockFromURL
|
||||
* Added support for tag permission in Container SAS.
|
||||
|
||||
### Bugs Fixed
|
||||
|
||||
* Fixed time formatting for the conditional request headers. Fixes [#20475](https://github.com/Azure/azure-sdk-for-go/issues/20475).
|
||||
* Fixed an issue where passing a blob tags map of length 0 would result in the x-ms-tags header to be sent to the service with an empty string as value.
|
||||
* Fixed block size and number of blocks calculation in `UploadBuffer` and `UploadFile`. Fixes [#20735](https://github.com/Azure/azure-sdk-for-go/issues/20735).
|
||||
|
||||
### Other Changes
|
||||
|
||||
* Add `dragonfly` to the list of build constraints for `blockblob`.
|
||||
* Updating version of azcore to 1.6.0 and azidentity to 1.3.0
|
||||
|
||||
## 1.1.0-beta.1 (2023-05-09)
|
||||
|
||||
### Features Added
|
||||
|
||||
* Added [Blob Batch API](https://learn.microsoft.com/rest/api/storageservices/blob-batch).
|
||||
* Added support for bearer challenge for identity based managed disks.
|
||||
* Added support for GetAccountInfo to container and blob level clients.
|
||||
* Added [UploadBlobFromURL API](https://learn.microsoft.com/rest/api/storageservices/put-blob-from-url).
|
||||
* Added support for CopySourceAuthorization to appendblob.AppendBlockFromURL
|
||||
* Added support for tag permission in Container SAS.
|
||||
|
||||
### Bugs Fixed
|
||||
|
||||
* Fixed time formatting for the conditional request headers. Fixes [#20475](https://github.com/Azure/azure-sdk-for-go/issues/20475).
|
||||
* Fixed an issue where passing a blob tags map of length 0 would result in the x-ms-tags header to be sent to the service with an empty string as value.
|
||||
|
||||
## 1.0.0 (2023-02-07)
|
||||
|
||||
### Features Added
|
||||
|
||||
* Add support to log calculated block size and count during uploads
|
||||
* Added MissingSharedKeyCredential error type for cleaner UX. Related to [#19864](https://github.com/Azure/azure-sdk-for-go/issues/19864).
|
||||
|
||||
### Breaking Changes
|
||||
|
||||
* Changed API signatures to map correctly to Azure Storage REST APIs, These changes impact:
|
||||
* `blob.GetSASURL()`
|
||||
* `blockblob.StageBlockFromURL()`
|
||||
* `container.SetAccessPolicy()`
|
||||
* `container.GetSASURL()`
|
||||
* `service.GetSASURL()`
|
||||
* `service.FilterBlobs()`
|
||||
* `lease.AcquireLease()` (blobs and containers)
|
||||
* `lease.ChangeLease()` (blobs and containers)
|
||||
* Type name changes:
|
||||
* `CpkInfo` -> `CPKInfo`
|
||||
* `CpkScopeInfo` -> `CPKScopeInfo`
|
||||
* `RuleId` -> `RuleID`
|
||||
* `PolicyId` -> `PolicyID`
|
||||
* `CorsRule` -> `CORSRule`
|
||||
* Remove `AccountServices` it is now hardcoded to blobs
|
||||
|
||||
### Bugs Fixed
|
||||
|
||||
* Fixed encoding issues seen in FilterBlobs. Fixes [#17421](https://github.com/Azure/azure-sdk-for-go/issues/17421).
|
||||
* Fixing inconsistency seen with Metadata and ORS response. Fixes [#19688](https://github.com/Azure/azure-sdk-for-go/issues/19688).
|
||||
* Fixed endless loop during pagination issue [#19773](https://github.com/Azure/azure-sdk-for-go/pull/19773).
|
||||
|
||||
### Other Changes
|
||||
|
||||
* Exported some missing types in the `blob`, `container` and `service` packages. Fixes [#19775](https://github.com/Azure/azure-sdk-for-go/issues/19775).
|
||||
* SAS changes [#19781](https://github.com/Azure/azure-sdk-for-go/pull/19781):
|
||||
* AccountSASPermissions: SetImmutabilityPolicy support
|
||||
* ContainerSASPermissions: Move support
|
||||
* Validations to ensure correct sas perm ordering
|
||||
|
||||
## 0.6.1 (2022-12-09)
|
||||
|
||||
### Bugs Fixed
|
||||
|
||||
* Fix compilation error on Darwin.
|
||||
|
||||
## 0.6.0 (2022-12-08)
|
||||
|
||||
### Features Added
|
||||
|
||||
* Added BlobDeleteType to DeleteOptions to allow access to ['Permanent'](https://learn.microsoft.com/rest/api/storageservices/delete-blob#permanent-delete) DeleteType.
|
||||
* Added [Set Blob Expiry API](https://learn.microsoft.com/rest/api/storageservices/set-blob-expiry).
|
||||
* Added method `ServiceClient()` to the `azblob.Client` type, allowing access to the underlying service client.
|
||||
* Added support for object level immutability policy with versioning (Version Level WORM).
|
||||
* Added the custom CRC64 polynomial used by storage for transactional hashes, and implemented automatic hashing for transactions.
|
||||
|
||||
### Breaking Changes
|
||||
|
||||
* Corrected the name for `saoid` and `suoid` SAS parameters in `BlobSignatureValues` struct as per [this](https://learn.microsoft.com/rest/api/storageservices/create-user-delegation-sas#construct-a-user-delegation-sas)
|
||||
* Updated type of `BlockSize` from int to int64 in `UploadStreamOptions`
|
||||
* CRC64 transactional hashes are now supplied with a `uint64` rather than a `[]byte` to conform with Golang's `hash/crc64` package
|
||||
* Field `XMSContentCRC64` has been renamed to `ContentCRC64`
|
||||
* The `Lease*` constant types and values in the `blob` and `container` packages have been moved to the `lease` package and their names fixed up to avoid stuttering.
|
||||
* Fields `TransactionalContentCRC64` and `TransactionalContentMD5` have been replaced by `TransactionalValidation`.
|
||||
* Fields `SourceContentCRC64` and `SourceContentMD5` have been replaced by `SourceContentValidation`.
|
||||
* Field `TransactionalContentMD5` has been removed from type `AppendBlockFromURLOptions`.
|
||||
|
||||
### Bugs Fixed
|
||||
|
||||
* Corrected signing of User Delegation SAS. Fixes [#19372](https://github.com/Azure/azure-sdk-for-go/issues/19372) and [#19454](https://github.com/Azure/azure-sdk-for-go/issues/19454)
|
||||
* Added formatting of start and expiry time in [SetAccessPolicy](https://learn.microsoft.com/rest/api/storageservices/set-container-acl#request-body). Fixes [#18712](https://github.com/Azure/azure-sdk-for-go/issues/18712)
|
||||
* Uploading block blobs larger than 256MB can fail in some cases with error `net/http: HTTP/1.x transport connection broken`.
|
||||
* Blob name parameters are URL-encoded before constructing the complete blob URL.
|
||||
|
||||
### Other Changes
|
||||
|
||||
* Added some missing public surface area in the `container` and `service` packages.
|
||||
* The `UploadStream()` methods now use anonymous memory mapped files for buffers in order to reduce heap allocations/fragmentation.
|
||||
* The anonymous memory mapped files are typically backed by the page/swap file, multiple files are not actually created.
|
||||
|
||||
## 0.5.1 (2022-10-11)
|
||||
|
||||
### Bugs Fixed
|
||||
|
||||
* `GetSASURL()`: for container and blob clients, don't add a forward slash before the query string
|
||||
* Fixed issue [#19249](https://github.com/Azure/azure-sdk-for-go/issues/19249) by increasing service version to '2020-02-10'.
|
||||
|
||||
### Other Changes
|
||||
|
||||
* Improved docs for client constructors.
|
||||
* Updating azcore version to 1.1.4
|
||||
|
||||
## 0.5.0 (2022-09-29)
|
||||
|
||||
### Breaking Changes
|
||||
|
||||
* Complete architectural change for better user experience. Please view the [README](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/storage/azblob#readme)
|
||||
|
||||
### Features Added
|
||||
|
||||
* Added [UserDelegationCredential](https://learn.microsoft.com/rest/api/storageservices/create-user-delegation-sas) which resolves [#18976](https://github.com/Azure/azure-sdk-for-go/issues/18976), [#16916](https://github.com/Azure/azure-sdk-for-go/issues/16916), [#18977](https://github.com/Azure/azure-sdk-for-go/issues/18977)
|
||||
* Added [Restore Container API](https://learn.microsoft.com/rest/api/storageservices/restore-container).
|
||||
|
||||
### Bugs Fixed
|
||||
|
||||
* Fixed issue [#18767](https://github.com/Azure/azure-sdk-for-go/issues/18767)
|
||||
* Fix deadlock when error writes are slow [#16937](https://github.com/Azure/azure-sdk-for-go/pull/16937)
|
||||
|
||||
## 0.4.1 (2022-05-12)
|
||||
|
||||
### Other Changes
|
||||
|
||||
* Updated to latest `azcore` and `internal` modules
|
||||
|
||||
## 0.4.0 (2022-04-19)
|
||||
|
||||
### Breaking Changes
|
||||
|
||||
* Fixed Issue #17150 : Renaming/refactoring high level methods.
|
||||
* Fixed Issue #16972 : Constructors should return clients by reference.
|
||||
* Renaming the options bags to match the naming convention same as that of response. The behaviour of options bags
|
||||
remains the same.
|
||||
|
||||
### Bugs Fixed
|
||||
|
||||
* Fixed Issue #17515 : SetTags options bag missing leaseID.
|
||||
* Fixed Issue #17423 : Drop "Type" suffix from `GeoReplicationStatusType`.
|
||||
* Fixed Issue #17335 : Nil pointer exception when passing nil options bag in `ListBlobsFlat` API call.
|
||||
* Fixed Issue #17188 : `BlobURLParts` not supporting VersionID
|
||||
* Fixed Issue #17152 , Issue #17131 , Issue #17061 : `UploadStreamToBlockBlob` / `UploadStreamToBlockBlob` methods
|
||||
ignoring the options bag.
|
||||
* Fixed Issue #16920 : Fixing error handling example.
|
||||
* Fixed Issue #16786 : Refactoring of autorest code generation definition and adding necessary transformations.
|
||||
* Fixed Issue #16679 : Response parsing issue in List blobs API.
|
||||
|
||||
## 0.3.0 (2022-02-09)
|
||||
|
||||
### Breaking Changes
|
||||
|
||||
* Updated to latest `azcore`. Public surface area is unchanged.
|
||||
* [#16978](https://github.com/Azure/azure-sdk-for-go/pull/16978): The `DownloadResponse.Body` parameter is
|
||||
now `*RetryReaderOptions`.
|
||||
|
||||
### Bugs Fixed
|
||||
|
||||
* Fixed Issue #16193 : `azblob.GetSASToken` wrong signed resource.
|
||||
* Fixed Issue #16223 : `HttpRange` does not expose its fields.
|
||||
* Fixed Issue #16254 : Issue passing reader to upload `BlockBlobClient`
|
||||
* Fixed Issue #16295 : Problem with listing blobs by using of `ListBlobsHierarchy()`
|
||||
* Fixed Issue #16542 : Empty `StorageError` in the Azurite environment
|
||||
* Fixed Issue #16679 : Unable to access Metadata when listing blobs
|
||||
* Fixed Issue #16816 : `ContainerClient.GetSASToken` doesn't allow list permission.
|
||||
* Fixed Issue #16988 : Too many arguments in call to `runtime.NewResponseError`
|
||||
|
||||
## 0.2.0 (2021-11-03)
|
||||
|
||||
### Breaking Changes
|
||||
|
||||
* Clients now have one constructor per authentication method
|
||||
|
||||
## 0.1.0 (2021-09-13)
|
||||
|
||||
### Features Added
|
||||
|
||||
* This is the initial preview release of the `azblob` library
|
21
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/LICENSE.txt
сгенерированный
поставляемый
Normal file
21
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/LICENSE.txt
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE
|
282
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/README.md
сгенерированный
поставляемый
Normal file
282
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/README.md
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,282 @@
|
|||
# Azure Blob Storage module for Go
|
||||
|
||||
> Service Version: 2023-11-03
|
||||
|
||||
Azure Blob Storage is Microsoft's object storage solution for the cloud. Blob
|
||||
Storage is optimized for storing massive amounts of unstructured data - data that does not adhere to a particular data model or
|
||||
definition, such as text or binary data. For more information, see [Introduction to Azure Blob Storage](https://learn.microsoft.com/azure/storage/blobs/storage-blobs-introduction).
|
||||
|
||||
Use the Azure Blob Storage client module `github.com/Azure/azure-sdk-for-go/sdk/storage/azblob` to:
|
||||
|
||||
* Authenticate clients with Azure Blob Storage
|
||||
* Manipulate containers and blobs in an Azure storage account
|
||||
|
||||
Key links:
|
||||
|
||||
[Source code][source] | [API reference documentation][docs] | [REST API documentation][rest_docs] | [Product documentation][product_docs] | [Samples][go_samples]
|
||||
|
||||
## Getting started
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- Go, version 1.18 or higher - [Install Go](https://go.dev/doc/install)
|
||||
- Azure subscription - [Create a free account](https://azure.microsoft.com/free/)
|
||||
- Azure storage account - To create a storage account, use tools including the [Azure portal][storage_account_create_portal],
|
||||
[Azure PowerShell][storage_account_create_ps], or the [Azure CLI][storage_account_create_cli].
|
||||
Here's an example using the Azure CLI:
|
||||
|
||||
```bash
|
||||
az storage account create --name MyStorageAccount --resource-group MyResourceGroup --location westus --sku Standard_LRS
|
||||
```
|
||||
|
||||
### Install the package
|
||||
|
||||
Install the Azure Blob Storage client module for Go with [go get][goget]:
|
||||
|
||||
```bash
|
||||
go get github.com/Azure/azure-sdk-for-go/sdk/storage/azblob
|
||||
```
|
||||
|
||||
If you plan to authenticate with Azure Active Directory (recommended), also install the [azidentity][azidentity] module.
|
||||
|
||||
```bash
|
||||
go get github.com/Azure/azure-sdk-for-go/sdk/azidentity
|
||||
```
|
||||
|
||||
### Authenticate the client
|
||||
|
||||
To interact with the Azure Blob Storage service, you'll need to create an instance of the `azblob.Client` type. The [azidentity][azidentity] module makes it easy to add Azure Active Directory support for authenticating Azure SDK clients with their corresponding Azure services.
|
||||
|
||||
```go
|
||||
// create a credential for authenticating with Azure Active Directory
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
// TODO: handle err
|
||||
|
||||
// create an azblob.Client for the specified storage account that uses the above credential
|
||||
client, err := azblob.NewClient("https://MYSTORAGEACCOUNT.blob.core.windows.net/", cred, nil)
|
||||
// TODO: handle err
|
||||
```
|
||||
|
||||
Learn more about enabling Azure Active Directory for authentication with Azure Storage:
|
||||
|
||||
* [Authorize access to blobs using Azure Active Directory][storage_ad]
|
||||
|
||||
Other options for authentication include connection strings, shared key, shared access signatures (SAS), and anonymous public access. Use the appropriate client constructor function for the authentication mechanism you wish to use. For examples, see:
|
||||
|
||||
* [Blob samples][samples]
|
||||
|
||||
## Key concepts
|
||||
|
||||
Blob Storage is designed for:
|
||||
|
||||
- Serving images or documents directly to a browser.
|
||||
- Storing files for distributed access.
|
||||
- Streaming video and audio.
|
||||
- Writing to log files.
|
||||
- Storing data for backup and restore, disaster recovery, and archiving.
|
||||
- Storing data for analysis by an on-premises or Azure-hosted service.
|
||||
|
||||
Blob Storage offers three types of resources:
|
||||
|
||||
- The _storage account_
|
||||
- One or more _containers_ in a storage account
|
||||
- One or more _blobs_ in a container
|
||||
|
||||
Instances of the `azblob.Client` type provide methods for manipulating containers and blobs within a storage account.
|
||||
The storage account is specified when the `azblob.Client` is constructed.
|
||||
|
||||
### Specialized clients
|
||||
|
||||
The Azure Blob Storage client module for Go also provides specialized clients in various subpackages. Use these clients when you need to interact with a specific kind of blob. Learn more about [block blobs, append blobs, and page blobs](https://learn.microsoft.com/rest/api/storageservices/understanding-block-blobs--append-blobs--and-page-blobs).
|
||||
|
||||
- [appendblob][append_blob]
|
||||
- [blockblob][block_blob]
|
||||
- [pageblob][page_blob]
|
||||
|
||||
The [blob][blob] package contains APIs common to all blob types. This includes APIs for deleting and undeleting a blob, setting metadata, and more.
|
||||
|
||||
The [lease][lease] package contains clients for managing leases on blobs and containers. See the [REST API reference](https://learn.microsoft.com/rest/api/storageservices/lease-blob#remarks) for general information on leases.
|
||||
|
||||
The [container][container] package contains APIs specific to containers. This includes APIs for setting access policies or properties, and more.
|
||||
|
||||
The [service][service] package contains APIs specific to the Blob service. This includes APIs for manipulating containers, retrieving account information, and more.
|
||||
|
||||
The [sas][sas] package contains utilities to aid in the creation and manipulation of shared access signature (SAS) tokens.
|
||||
See the package's documentation for more information.
|
||||
|
||||
### Goroutine safety
|
||||
|
||||
We guarantee that all client instance methods are goroutine-safe and independent of each other (see [guideline](https://azure.github.io/azure-sdk/golang_introduction.html#thread-safety)). This ensures that the recommendation to reuse client instances is always safe, even across goroutines.
|
||||
|
||||
### Blob metadata
|
||||
|
||||
Blob metadata name-value pairs are valid HTTP headers and should adhere to all restrictions governing HTTP headers. Metadata names must be valid HTTP header names, may contain only ASCII characters, and should be treated as case-insensitive. Base64-encode or URL-encode metadata values containing non-ASCII characters.
|
||||
|
||||
### Additional concepts
|
||||
<!-- CLIENT COMMON BAR -->
|
||||
[Client options](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore/policy#ClientOptions) |
|
||||
[Accessing the response](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime#WithCaptureResponse) |
|
||||
[Handling failures](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore#ResponseError) |
|
||||
[Logging](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore/log)
|
||||
<!-- CLIENT COMMON BAR -->
|
||||
|
||||
## Examples
|
||||
|
||||
### Upload a blob
|
||||
|
||||
```go
|
||||
const (
|
||||
account = "https://MYSTORAGEACCOUNT.blob.core.windows.net/"
|
||||
containerName = "sample-container"
|
||||
blobName = "sample-blob"
|
||||
sampleFile = "path/to/sample/file"
|
||||
)
|
||||
|
||||
// authenticate with Azure Active Directory
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
// TODO: handle error
|
||||
|
||||
// create a client for the specified storage account
|
||||
client, err := azblob.NewClient(account, cred, nil)
|
||||
// TODO: handle error
|
||||
|
||||
// open the file for reading
|
||||
file, err := os.OpenFile(sampleFile, os.O_RDONLY, 0)
|
||||
// TODO: handle error
|
||||
defer file.Close()
|
||||
|
||||
// upload the file to the specified container with the specified blob name
|
||||
_, err = client.UploadFile(context.TODO(), containerName, blobName, file, nil)
|
||||
// TODO: handle error
|
||||
```
|
||||
|
||||
### Download a blob
|
||||
|
||||
```go
|
||||
// this example accesses a public blob via anonymous access, so no credentials are required
|
||||
client, err := azblob.NewClientWithNoCredential("https://azurestoragesamples.blob.core.windows.net/", nil)
|
||||
// TODO: handle error
|
||||
|
||||
// create or open a local file where we can download the blob
|
||||
file, err := os.Create("cloud.jpg")
|
||||
// TODO: handle error
|
||||
defer file.Close()
|
||||
|
||||
// download the blob
|
||||
_, err = client.DownloadFile(context.TODO(), "samples", "cloud.jpg", file, nil)
|
||||
// TODO: handle error
|
||||
```
|
||||
|
||||
### Enumerate blobs
|
||||
|
||||
```go
|
||||
const (
|
||||
account = "https://MYSTORAGEACCOUNT.blob.core.windows.net/"
|
||||
containerName = "sample-container"
|
||||
)
|
||||
|
||||
// authenticate with Azure Active Directory
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
// TODO: handle error
|
||||
|
||||
// create a client for the specified storage account
|
||||
client, err := azblob.NewClient(account, cred, nil)
|
||||
// TODO: handle error
|
||||
|
||||
// blob listings are returned across multiple pages
|
||||
pager := client.NewListBlobsFlatPager(containerName, nil)
|
||||
|
||||
// continue fetching pages until no more remain
|
||||
for pager.More() {
|
||||
// advance to the next page
|
||||
page, err := pager.NextPage(context.TODO())
|
||||
// TODO: handle error
|
||||
|
||||
// print the blob names for this page
|
||||
for _, blob := range page.Segment.BlobItems {
|
||||
fmt.Println(*blob.Name)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
All Blob service operations will return an
|
||||
[*azcore.ResponseError][azcore_response_error] on failure with a
|
||||
populated `ErrorCode` field. Many of these errors are recoverable.
|
||||
The [bloberror][blob_error] package provides the possible Storage error codes
|
||||
along with helper facilities for error handling.
|
||||
|
||||
```go
|
||||
const (
|
||||
connectionString = "<connection_string>"
|
||||
containerName = "sample-container"
|
||||
)
|
||||
|
||||
// create a client with the provided connection string
|
||||
client, err := azblob.NewClientFromConnectionString(connectionString, nil)
|
||||
// TODO: handle error
|
||||
|
||||
// try to delete the container, avoiding any potential race conditions with an in-progress or completed deletion
|
||||
_, err = client.DeleteContainer(context.TODO(), containerName, nil)
|
||||
|
||||
if bloberror.HasCode(err, bloberror.ContainerBeingDeleted, bloberror.ContainerNotFound) {
|
||||
// ignore any errors if the container is being deleted or already has been deleted
|
||||
} else if err != nil {
|
||||
// TODO: some other error
|
||||
}
|
||||
```
|
||||
|
||||
## Next steps
|
||||
|
||||
Get started with our [Blob samples][samples]. They contain complete examples of the above snippets and more.
|
||||
|
||||
## Contributing
|
||||
|
||||
See the [Storage CONTRIBUTING.md][storage_contrib] for details on building,
|
||||
testing, and contributing to this library.
|
||||
|
||||
This project welcomes contributions and suggestions. Most contributions require
|
||||
you to agree to a Contributor License Agreement (CLA) declaring that you have
|
||||
the right to, and actually do, grant us the rights to use your contribution. For
|
||||
details, visit [cla.microsoft.com][cla].
|
||||
|
||||
This project has adopted the [Microsoft Open Source Code of Conduct][coc].
|
||||
For more information see the [Code of Conduct FAQ][coc_faq]
|
||||
or contact [opencode@microsoft.com][coc_contact] with any
|
||||
additional questions or comments.
|
||||
|
||||
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-go%2Fsdk%2Fstorage%2Fazblob%2FREADME.png)
|
||||
|
||||
<!-- LINKS -->
|
||||
[source]: https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/storage/azblob
|
||||
[docs]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob#section_documentation
|
||||
[rest_docs]: https://learn.microsoft.com/rest/api/storageservices/blob-service-rest-api
|
||||
[product_docs]: https://learn.microsoft.com/azure/storage/blobs/storage-blobs-overview
|
||||
[godevdl]: https://go.dev/dl/
|
||||
[goget]: https://pkg.go.dev/cmd/go#hdr-Add_dependencies_to_current_module_and_install_them
|
||||
[go_samples]: https://github.com/Azure-Samples/azure-sdk-for-go-samples/tree/main
|
||||
[storage_account_docs]: https://learn.microsoft.com/azure/storage/common/storage-account-overview
|
||||
[storage_account_create_ps]: https://learn.microsoft.com/azure/storage/common/storage-quickstart-create-account?tabs=azure-powershell
|
||||
[storage_account_create_cli]: https://learn.microsoft.com/azure/storage/common/storage-quickstart-create-account?tabs=azure-cli
|
||||
[storage_account_create_portal]: https://learn.microsoft.com/azure/storage/common/storage-quickstart-create-account?tabs=azure-portal
|
||||
[azure_cli]: https://learn.microsoft.com/cli/azure
|
||||
[azure_sub]: https://azure.microsoft.com/free/
|
||||
[azidentity]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity
|
||||
[storage_ad]: https://learn.microsoft.com/azure/storage/common/storage-auth-aad
|
||||
[azcore_response_error]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore#ResponseError
|
||||
[samples]: https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/storage/azblob/examples_test.go
|
||||
[append_blob]: https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/storage/azblob/appendblob/client.go
|
||||
[blob]: https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/storage/azblob/blob/client.go
|
||||
[blob_error]: https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/storage/azblob/bloberror/error_codes.go
|
||||
[block_blob]: https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/storage/azblob/blockblob/client.go
|
||||
[container]: https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/storage/azblob/container/client.go
|
||||
[lease]: https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/storage/azblob/lease
|
||||
[page_blob]: https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/storage/azblob/pageblob/client.go
|
||||
[sas]: https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/storage/azblob/sas
|
||||
[service]: https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/storage/azblob/service/client.go
|
||||
[storage_contrib]: https://github.com/Azure/azure-sdk-for-go/blob/main/CONTRIBUTING.md
|
||||
[cla]: https://cla.microsoft.com
|
||||
[coc]: https://opensource.microsoft.com/codeofconduct/
|
||||
[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/
|
||||
[coc_contact]: mailto:opencode@microsoft.com
|
366
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/appendblob/client.go
сгенерированный
поставляемый
Normal file
366
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/appendblob/client.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,366 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
package appendblob
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"io"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/base"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/exported"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/shared"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/sas"
|
||||
)
|
||||
|
||||
// ClientOptions contains the optional parameters when creating a Client.
|
||||
type ClientOptions base.ClientOptions
|
||||
|
||||
// Client represents a client to an Azure Storage append blob;
|
||||
type Client base.CompositeClient[generated.BlobClient, generated.AppendBlobClient]
|
||||
|
||||
// NewClient creates an instance of Client with the specified values.
|
||||
// - blobURL - the URL of the blob e.g. https://<account>.blob.core.windows.net/container/blob.txt
|
||||
// - cred - an Azure AD credential, typically obtained via the azidentity module
|
||||
// - options - client options; pass nil to accept the default values
|
||||
func NewClient(blobURL string, cred azcore.TokenCredential, options *ClientOptions) (*Client, error) {
|
||||
audience := base.GetAudience((*base.ClientOptions)(options))
|
||||
conOptions := shared.GetClientOptions(options)
|
||||
authPolicy := shared.NewStorageChallengePolicy(cred, audience, conOptions.InsecureAllowCredentialWithHTTP)
|
||||
plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}}
|
||||
|
||||
azClient, err := azcore.NewClient(exported.ModuleName, exported.ModuleVersion, plOpts, &conOptions.ClientOptions)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return (*Client)(base.NewAppendBlobClient(blobURL, azClient, nil)), nil
|
||||
}
|
||||
|
||||
// NewClientWithNoCredential creates an instance of Client with the specified values.
|
||||
// This is used to anonymously access a blob or with a shared access signature (SAS) token.
|
||||
// - blobURL - the URL of the blob e.g. https://<account>.blob.core.windows.net/container/blob.txt?<sas token>
|
||||
// - options - client options; pass nil to accept the default values
|
||||
func NewClientWithNoCredential(blobURL string, options *ClientOptions) (*Client, error) {
|
||||
conOptions := shared.GetClientOptions(options)
|
||||
|
||||
azClient, err := azcore.NewClient(exported.ModuleName, exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return (*Client)(base.NewAppendBlobClient(blobURL, azClient, nil)), nil
|
||||
}
|
||||
|
||||
// NewClientWithSharedKeyCredential creates an instance of Client with the specified values.
|
||||
// - blobURL - the URL of the blob e.g. https://<account>.blob.core.windows.net/container/blob.txt
|
||||
// - cred - a SharedKeyCredential created with the matching blob's storage account and access key
|
||||
// - options - client options; pass nil to accept the default values
|
||||
func NewClientWithSharedKeyCredential(blobURL string, cred *blob.SharedKeyCredential, options *ClientOptions) (*Client, error) {
|
||||
authPolicy := exported.NewSharedKeyCredPolicy(cred)
|
||||
conOptions := shared.GetClientOptions(options)
|
||||
plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}}
|
||||
|
||||
azClient, err := azcore.NewClient(exported.ModuleName, exported.ModuleVersion, plOpts, &conOptions.ClientOptions)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return (*Client)(base.NewAppendBlobClient(blobURL, azClient, cred)), nil
|
||||
}
|
||||
|
||||
// NewClientFromConnectionString creates an instance of Client with the specified values.
|
||||
// - connectionString - a connection string for the desired storage account
|
||||
// - containerName - the name of the container within the storage account
|
||||
// - blobName - the name of the blob within the container
|
||||
// - options - client options; pass nil to accept the default values
|
||||
func NewClientFromConnectionString(connectionString, containerName, blobName string, options *ClientOptions) (*Client, error) {
|
||||
parsed, err := shared.ParseConnectionString(connectionString)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
parsed.ServiceURL = runtime.JoinPaths(parsed.ServiceURL, containerName, blobName)
|
||||
|
||||
if parsed.AccountKey != "" && parsed.AccountName != "" {
|
||||
credential, err := exported.NewSharedKeyCredential(parsed.AccountName, parsed.AccountKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return NewClientWithSharedKeyCredential(parsed.ServiceURL, credential, options)
|
||||
}
|
||||
|
||||
return NewClientWithNoCredential(parsed.ServiceURL, options)
|
||||
}
|
||||
|
||||
// BlobClient returns the embedded blob client for this AppendBlob client.
|
||||
func (ab *Client) BlobClient() *blob.Client {
|
||||
innerBlob, _ := base.InnerClients((*base.CompositeClient[generated.BlobClient, generated.AppendBlobClient])(ab))
|
||||
return (*blob.Client)(innerBlob)
|
||||
}
|
||||
|
||||
func (ab *Client) sharedKey() *blob.SharedKeyCredential {
|
||||
return base.SharedKeyComposite((*base.CompositeClient[generated.BlobClient, generated.AppendBlobClient])(ab))
|
||||
}
|
||||
|
||||
func (ab *Client) generated() *generated.AppendBlobClient {
|
||||
_, appendBlob := base.InnerClients((*base.CompositeClient[generated.BlobClient, generated.AppendBlobClient])(ab))
|
||||
return appendBlob
|
||||
}
|
||||
|
||||
func (ab *Client) innerBlobGenerated() *generated.BlobClient {
|
||||
b := ab.BlobClient()
|
||||
return base.InnerClient((*base.Client[generated.BlobClient])(b))
|
||||
}
|
||||
|
||||
// URL returns the URL endpoint used by the Client object.
|
||||
func (ab *Client) URL() string {
|
||||
return ab.generated().Endpoint()
|
||||
}
|
||||
|
||||
// WithSnapshot creates a new AppendBlobURL object identical to the source but with the specified snapshot timestamp.
|
||||
// Pass "" to remove the snapshot returning a URL to the base blob.
|
||||
func (ab *Client) WithSnapshot(snapshot string) (*Client, error) {
|
||||
p, err := blob.ParseURL(ab.URL())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
p.Snapshot = snapshot
|
||||
|
||||
return (*Client)(base.NewAppendBlobClient(p.String(), ab.generated().InternalClient(), ab.sharedKey())), nil
|
||||
}
|
||||
|
||||
// WithVersionID creates a new AppendBlobURL object identical to the source but with the specified version id.
|
||||
// Pass "" to remove the versionID returning a URL to the base blob.
|
||||
func (ab *Client) WithVersionID(versionID string) (*Client, error) {
|
||||
p, err := blob.ParseURL(ab.URL())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
p.VersionID = versionID
|
||||
|
||||
return (*Client)(base.NewAppendBlobClient(p.String(), ab.generated().InternalClient(), ab.sharedKey())), nil
|
||||
}
|
||||
|
||||
// Create creates a 0-size append blob. Call AppendBlock to append data to an append blob.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/put-blob.
|
||||
func (ab *Client) Create(ctx context.Context, o *CreateOptions) (CreateResponse, error) {
|
||||
opts, httpHeaders, leaseAccessConditions, cpkInfo, cpkScopeInfo, modifiedAccessConditions := o.format()
|
||||
resp, err := ab.generated().Create(ctx, 0, opts, httpHeaders, leaseAccessConditions, cpkInfo,
|
||||
cpkScopeInfo, modifiedAccessConditions)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// AppendBlock writes a stream to a new block of data to the end of the existing append blob.
|
||||
// This method panics if the stream is not at position 0.
|
||||
// Note that the http client closes the body stream after the request is sent to the service.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/append-block.
|
||||
func (ab *Client) AppendBlock(ctx context.Context, body io.ReadSeekCloser, o *AppendBlockOptions) (AppendBlockResponse, error) {
|
||||
count, err := shared.ValidateSeekableStreamAt0AndGetCount(body)
|
||||
if err != nil {
|
||||
return AppendBlockResponse{}, nil
|
||||
}
|
||||
|
||||
appendOptions, appendPositionAccessConditions, cpkInfo, cpkScope, modifiedAccessConditions, leaseAccessConditions := o.format()
|
||||
|
||||
if o != nil && o.TransactionalValidation != nil {
|
||||
body, err = o.TransactionalValidation.Apply(body, appendOptions)
|
||||
if err != nil {
|
||||
return AppendBlockResponse{}, nil
|
||||
}
|
||||
}
|
||||
|
||||
resp, err := ab.generated().AppendBlock(ctx,
|
||||
count,
|
||||
body,
|
||||
appendOptions,
|
||||
leaseAccessConditions,
|
||||
appendPositionAccessConditions,
|
||||
cpkInfo,
|
||||
cpkScope,
|
||||
modifiedAccessConditions)
|
||||
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// AppendBlockFromURL copies a new block of data from source URL to the end of the existing append blob.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/append-block-from-url.
|
||||
func (ab *Client) AppendBlockFromURL(ctx context.Context, source string, o *AppendBlockFromURLOptions) (AppendBlockFromURLResponse, error) {
|
||||
appendBlockFromURLOptions,
|
||||
cpkInfo,
|
||||
cpkScopeInfo,
|
||||
leaseAccessConditions,
|
||||
appendPositionAccessConditions,
|
||||
modifiedAccessConditions,
|
||||
sourceModifiedAccessConditions := o.format()
|
||||
|
||||
// content length should be 0 on * from URL. always. It's a 400 if it isn't.
|
||||
resp, err := ab.generated().AppendBlockFromURL(ctx,
|
||||
source,
|
||||
0,
|
||||
appendBlockFromURLOptions,
|
||||
cpkInfo,
|
||||
cpkScopeInfo,
|
||||
leaseAccessConditions,
|
||||
appendPositionAccessConditions,
|
||||
modifiedAccessConditions,
|
||||
sourceModifiedAccessConditions)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// Seal - The purpose of Append Blob Seal is to allow users and applications to seal append blobs, marking them as read only.
|
||||
// https://docs.microsoft.com/en-us/rest/api/storageservices/append-blob-seal
|
||||
func (ab *Client) Seal(ctx context.Context, o *SealOptions) (SealResponse, error) {
|
||||
leaseAccessConditions, modifiedAccessConditions, positionAccessConditions := o.format()
|
||||
resp, err := ab.generated().Seal(ctx,
|
||||
nil,
|
||||
leaseAccessConditions,
|
||||
modifiedAccessConditions,
|
||||
positionAccessConditions)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// Delete marks the specified blob or snapshot for deletion. The blob is later deleted during garbage collection.
|
||||
// Note that deleting a blob also deletes all its snapshots.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/delete-blob.
|
||||
func (ab *Client) Delete(ctx context.Context, o *blob.DeleteOptions) (blob.DeleteResponse, error) {
|
||||
return ab.BlobClient().Delete(ctx, o)
|
||||
}
|
||||
|
||||
// Undelete restores the contents and metadata of a soft-deleted blob and any associated soft-deleted snapshots.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/undelete-blob.
|
||||
func (ab *Client) Undelete(ctx context.Context, o *blob.UndeleteOptions) (blob.UndeleteResponse, error) {
|
||||
return ab.BlobClient().Undelete(ctx, o)
|
||||
}
|
||||
|
||||
// SetImmutabilityPolicy operation enables users to set the immutability policy on a blob.
|
||||
// https://learn.microsoft.com/en-us/azure/storage/blobs/immutable-storage-overview
|
||||
func (ab *Client) SetImmutabilityPolicy(ctx context.Context, expiryTime time.Time, options *blob.SetImmutabilityPolicyOptions) (blob.SetImmutabilityPolicyResponse, error) {
|
||||
return ab.BlobClient().SetImmutabilityPolicy(ctx, expiryTime, options)
|
||||
}
|
||||
|
||||
// DeleteImmutabilityPolicy operation enables users to delete the immutability policy on a blob.
|
||||
// https://learn.microsoft.com/en-us/azure/storage/blobs/immutable-storage-overview
|
||||
func (ab *Client) DeleteImmutabilityPolicy(ctx context.Context, options *blob.DeleteImmutabilityPolicyOptions) (blob.DeleteImmutabilityPolicyResponse, error) {
|
||||
return ab.BlobClient().DeleteImmutabilityPolicy(ctx, options)
|
||||
}
|
||||
|
||||
// SetLegalHold operation enables users to set legal hold on a blob.
|
||||
// https://learn.microsoft.com/en-us/azure/storage/blobs/immutable-storage-overview
|
||||
func (ab *Client) SetLegalHold(ctx context.Context, legalHold bool, options *blob.SetLegalHoldOptions) (blob.SetLegalHoldResponse, error) {
|
||||
return ab.BlobClient().SetLegalHold(ctx, legalHold, options)
|
||||
}
|
||||
|
||||
// SetTier
|
||||
// Deprecated: SetTier only works for page blob in premium storage account and block blob in blob storage account.
|
||||
func (ab *Client) SetTier(ctx context.Context, tier blob.AccessTier, o *blob.SetTierOptions) (blob.SetTierResponse, error) {
|
||||
return blob.SetTierResponse{}, errors.New("operation will not work on this blob type. SetTier only works for page blob in premium storage account and block blob in blob storage account")
|
||||
}
|
||||
|
||||
// SetExpiry operation sets an expiry time on an existing blob. This operation is only allowed on Hierarchical Namespace enabled accounts.
|
||||
// For more information, see https://learn.microsoft.com/en-us/rest/api/storageservices/set-blob-expiry
|
||||
func (ab *Client) SetExpiry(ctx context.Context, expiryType ExpiryType, o *SetExpiryOptions) (SetExpiryResponse, error) {
|
||||
if expiryType == nil {
|
||||
expiryType = ExpiryTypeNever{}
|
||||
}
|
||||
et, opts := expiryType.Format(o)
|
||||
resp, err := ab.innerBlobGenerated().SetExpiry(ctx, et, opts)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// GetProperties returns the blob's properties.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/get-blob-properties.
|
||||
func (ab *Client) GetProperties(ctx context.Context, o *blob.GetPropertiesOptions) (blob.GetPropertiesResponse, error) {
|
||||
return ab.BlobClient().GetProperties(ctx, o)
|
||||
}
|
||||
|
||||
// GetAccountInfo provides account level information
|
||||
// For more information, see https://learn.microsoft.com/en-us/rest/api/storageservices/get-account-information?tabs=shared-access-signatures.
|
||||
func (ab *Client) GetAccountInfo(ctx context.Context, o *blob.GetAccountInfoOptions) (blob.GetAccountInfoResponse, error) {
|
||||
return ab.BlobClient().GetAccountInfo(ctx, o)
|
||||
}
|
||||
|
||||
// SetHTTPHeaders changes a blob's HTTP headers.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/set-blob-properties.
|
||||
func (ab *Client) SetHTTPHeaders(ctx context.Context, HTTPHeaders blob.HTTPHeaders, o *blob.SetHTTPHeadersOptions) (blob.SetHTTPHeadersResponse, error) {
|
||||
return ab.BlobClient().SetHTTPHeaders(ctx, HTTPHeaders, o)
|
||||
}
|
||||
|
||||
// SetMetadata changes a blob's metadata.
|
||||
// https://docs.microsoft.com/rest/api/storageservices/set-blob-metadata.
|
||||
func (ab *Client) SetMetadata(ctx context.Context, metadata map[string]*string, o *blob.SetMetadataOptions) (blob.SetMetadataResponse, error) {
|
||||
return ab.BlobClient().SetMetadata(ctx, metadata, o)
|
||||
}
|
||||
|
||||
// CreateSnapshot creates a read-only snapshot of a blob.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/snapshot-blob.
|
||||
func (ab *Client) CreateSnapshot(ctx context.Context, o *blob.CreateSnapshotOptions) (blob.CreateSnapshotResponse, error) {
|
||||
return ab.BlobClient().CreateSnapshot(ctx, o)
|
||||
}
|
||||
|
||||
// StartCopyFromURL copies the data at the source URL to a blob.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/copy-blob.
|
||||
func (ab *Client) StartCopyFromURL(ctx context.Context, copySource string, o *blob.StartCopyFromURLOptions) (blob.StartCopyFromURLResponse, error) {
|
||||
return ab.BlobClient().StartCopyFromURL(ctx, copySource, o)
|
||||
}
|
||||
|
||||
// AbortCopyFromURL stops a pending copy that was previously started and leaves a destination blob with 0 length and metadata.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/abort-copy-blob.
|
||||
func (ab *Client) AbortCopyFromURL(ctx context.Context, copyID string, o *blob.AbortCopyFromURLOptions) (blob.AbortCopyFromURLResponse, error) {
|
||||
return ab.BlobClient().AbortCopyFromURL(ctx, copyID, o)
|
||||
}
|
||||
|
||||
// SetTags operation enables users to set tags on a blob or specific blob version, but not snapshot.
|
||||
// Each call to this operation replaces all existing tags attached to the blob.
|
||||
// To remove all tags from the blob, call this operation with no tags set.
|
||||
// https://docs.microsoft.com/en-us/rest/api/storageservices/set-blob-tags
|
||||
func (ab *Client) SetTags(ctx context.Context, tags map[string]string, o *blob.SetTagsOptions) (blob.SetTagsResponse, error) {
|
||||
return ab.BlobClient().SetTags(ctx, tags, o)
|
||||
}
|
||||
|
||||
// GetTags operation enables users to get tags on a blob or specific blob version, or snapshot.
|
||||
// https://docs.microsoft.com/en-us/rest/api/storageservices/get-blob-tags
|
||||
func (ab *Client) GetTags(ctx context.Context, o *blob.GetTagsOptions) (blob.GetTagsResponse, error) {
|
||||
return ab.BlobClient().GetTags(ctx, o)
|
||||
}
|
||||
|
||||
// CopyFromURL
|
||||
// Deprecated: CopyFromURL works only with block blob
|
||||
func (ab *Client) CopyFromURL(ctx context.Context, copySource string, o *blob.CopyFromURLOptions) (blob.CopyFromURLResponse, error) {
|
||||
return blob.CopyFromURLResponse{}, errors.New("operation will not work on this blob type. CopyFromURL works only with block blob")
|
||||
}
|
||||
|
||||
// GetSASURL is a convenience method for generating a SAS token for the currently pointed at append blob.
|
||||
// It can only be used if the credential supplied during creation was a SharedKeyCredential.
|
||||
func (ab *Client) GetSASURL(permissions sas.BlobPermissions, expiry time.Time, o *blob.GetSASURLOptions) (string, error) {
|
||||
return ab.BlobClient().GetSASURL(permissions, expiry, o)
|
||||
}
|
||||
|
||||
// Concurrent Download Functions -----------------------------------------------------------------------------------------
|
||||
|
||||
// DownloadStream reads a range of bytes from a blob. The response also includes the blob's properties and metadata.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/get-blob.
|
||||
func (ab *Client) DownloadStream(ctx context.Context, o *blob.DownloadStreamOptions) (blob.DownloadStreamResponse, error) {
|
||||
return ab.BlobClient().DownloadStream(ctx, o)
|
||||
}
|
||||
|
||||
// DownloadBuffer downloads an Azure blob to a buffer with parallel.
|
||||
func (ab *Client) DownloadBuffer(ctx context.Context, buffer []byte, o *blob.DownloadBufferOptions) (int64, error) {
|
||||
return ab.BlobClient().DownloadBuffer(ctx, shared.NewBytesWriter(buffer), o)
|
||||
}
|
||||
|
||||
// DownloadFile downloads an Azure blob to a local file.
|
||||
// The file would be truncated if the size doesn't match.
|
||||
func (ab *Client) DownloadFile(ctx context.Context, file *os.File, o *blob.DownloadFileOptions) (int64, error) {
|
||||
return ab.BlobClient().DownloadFile(ctx, file, o)
|
||||
}
|
180
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/appendblob/models.go
сгенерированный
поставляемый
Normal file
180
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/appendblob/models.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,180 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
package appendblob
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/exported"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/shared"
|
||||
)
|
||||
|
||||
// Type Declarations ---------------------------------------------------------------------
|
||||
|
||||
// AppendPositionAccessConditions contains a group of parameters for the Client.AppendBlock method.
|
||||
type AppendPositionAccessConditions = generated.AppendPositionAccessConditions
|
||||
|
||||
// Request Model Declaration -------------------------------------------------------------------------------------------
|
||||
|
||||
// CreateOptions provides set of configurations for Create Append Blob operation
|
||||
type CreateOptions struct {
|
||||
// Specifies the date time when the blobs immutability policy is set to expire.
|
||||
ImmutabilityPolicyExpiry *time.Time
|
||||
|
||||
// Specifies the immutability policy mode to set on the blob.
|
||||
ImmutabilityPolicyMode *blob.ImmutabilityPolicySetting
|
||||
|
||||
// Specified if a legal hold should be set on the blob.
|
||||
LegalHold *bool
|
||||
|
||||
AccessConditions *blob.AccessConditions
|
||||
|
||||
HTTPHeaders *blob.HTTPHeaders
|
||||
|
||||
CPKInfo *blob.CPKInfo
|
||||
|
||||
CPKScopeInfo *blob.CPKScopeInfo
|
||||
|
||||
// Optional. Used to set blob tags in various blob operations.
|
||||
Tags map[string]string
|
||||
|
||||
// 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.
|
||||
Metadata map[string]*string
|
||||
}
|
||||
|
||||
func (o *CreateOptions) format() (*generated.AppendBlobClientCreateOptions, *generated.BlobHTTPHeaders, *generated.LeaseAccessConditions, *generated.CPKInfo, *generated.CPKScopeInfo, *generated.ModifiedAccessConditions) {
|
||||
if o == nil {
|
||||
return nil, nil, nil, nil, nil, nil
|
||||
}
|
||||
|
||||
options := generated.AppendBlobClientCreateOptions{
|
||||
BlobTagsString: shared.SerializeBlobTagsToStrPtr(o.Tags),
|
||||
Metadata: o.Metadata,
|
||||
ImmutabilityPolicyExpiry: o.ImmutabilityPolicyExpiry,
|
||||
ImmutabilityPolicyMode: o.ImmutabilityPolicyMode,
|
||||
LegalHold: o.LegalHold,
|
||||
}
|
||||
|
||||
leaseAccessConditions, modifiedAccessConditions := exported.FormatBlobAccessConditions(o.AccessConditions)
|
||||
return &options, o.HTTPHeaders, leaseAccessConditions, o.CPKInfo, o.CPKScopeInfo, modifiedAccessConditions
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// AppendBlockOptions contains the optional parameters for the Client.AppendBlock method.
|
||||
type AppendBlockOptions struct {
|
||||
// TransactionalValidation specifies the transfer validation type to use.
|
||||
// The default is nil (no transfer validation).
|
||||
TransactionalValidation blob.TransferValidationType
|
||||
|
||||
AppendPositionAccessConditions *AppendPositionAccessConditions
|
||||
|
||||
CPKInfo *blob.CPKInfo
|
||||
|
||||
CPKScopeInfo *blob.CPKScopeInfo
|
||||
|
||||
AccessConditions *blob.AccessConditions
|
||||
}
|
||||
|
||||
func (o *AppendBlockOptions) format() (*generated.AppendBlobClientAppendBlockOptions, *generated.AppendPositionAccessConditions,
|
||||
*generated.CPKInfo, *generated.CPKScopeInfo, *generated.ModifiedAccessConditions, *generated.LeaseAccessConditions) {
|
||||
if o == nil {
|
||||
return nil, nil, nil, nil, nil, nil
|
||||
}
|
||||
|
||||
leaseAccessConditions, modifiedAccessConditions := exported.FormatBlobAccessConditions(o.AccessConditions)
|
||||
return &generated.AppendBlobClientAppendBlockOptions{}, o.AppendPositionAccessConditions, o.CPKInfo, o.CPKScopeInfo, modifiedAccessConditions, leaseAccessConditions
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// AppendBlockFromURLOptions contains the optional parameters for the Client.AppendBlockFromURL method.
|
||||
type AppendBlockFromURLOptions struct {
|
||||
// Only Bearer type is supported. Credentials should be a valid OAuth access token to copy source.
|
||||
CopySourceAuthorization *string
|
||||
|
||||
// SourceContentValidation contains the validation mechanism used on the range of bytes read from the source.
|
||||
SourceContentValidation blob.SourceContentValidationType
|
||||
|
||||
AppendPositionAccessConditions *AppendPositionAccessConditions
|
||||
|
||||
CPKInfo *blob.CPKInfo
|
||||
|
||||
CPKScopeInfo *blob.CPKScopeInfo
|
||||
|
||||
SourceModifiedAccessConditions *blob.SourceModifiedAccessConditions
|
||||
|
||||
AccessConditions *blob.AccessConditions
|
||||
|
||||
// Range specifies a range of bytes. The default value is all bytes.
|
||||
Range blob.HTTPRange
|
||||
}
|
||||
|
||||
func (o *AppendBlockFromURLOptions) format() (*generated.AppendBlobClientAppendBlockFromURLOptions, *generated.CPKInfo,
|
||||
*generated.CPKScopeInfo, *generated.LeaseAccessConditions, *generated.AppendPositionAccessConditions,
|
||||
*generated.ModifiedAccessConditions, *generated.SourceModifiedAccessConditions) {
|
||||
if o == nil {
|
||||
return nil, nil, nil, nil, nil, nil, nil
|
||||
}
|
||||
|
||||
options := &generated.AppendBlobClientAppendBlockFromURLOptions{
|
||||
SourceRange: exported.FormatHTTPRange(o.Range),
|
||||
CopySourceAuthorization: o.CopySourceAuthorization,
|
||||
}
|
||||
|
||||
if o.SourceContentValidation != nil {
|
||||
o.SourceContentValidation.Apply(options)
|
||||
}
|
||||
|
||||
leaseAccessConditions, modifiedAccessConditions := exported.FormatBlobAccessConditions(o.AccessConditions)
|
||||
return options, o.CPKInfo, o.CPKScopeInfo, leaseAccessConditions, o.AppendPositionAccessConditions, modifiedAccessConditions, o.SourceModifiedAccessConditions
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// SealOptions provides set of configurations for SealAppendBlob operation
|
||||
type SealOptions struct {
|
||||
AccessConditions *blob.AccessConditions
|
||||
AppendPositionAccessConditions *AppendPositionAccessConditions
|
||||
}
|
||||
|
||||
func (o *SealOptions) format() (*generated.LeaseAccessConditions,
|
||||
*generated.ModifiedAccessConditions, *generated.AppendPositionAccessConditions) {
|
||||
if o == nil {
|
||||
return nil, nil, nil
|
||||
}
|
||||
|
||||
leaseAccessConditions, modifiedAccessConditions := exported.FormatBlobAccessConditions(o.AccessConditions)
|
||||
return leaseAccessConditions, modifiedAccessConditions, o.AppendPositionAccessConditions
|
||||
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// ExpiryType defines values for ExpiryType
|
||||
type ExpiryType = exported.ExpiryType
|
||||
|
||||
// ExpiryTypeAbsolute defines the absolute time for the blob expiry
|
||||
type ExpiryTypeAbsolute = exported.ExpiryTypeAbsolute
|
||||
|
||||
// ExpiryTypeRelativeToNow defines the duration relative to now for the blob expiry
|
||||
type ExpiryTypeRelativeToNow = exported.ExpiryTypeRelativeToNow
|
||||
|
||||
// ExpiryTypeRelativeToCreation defines the duration relative to creation for the blob expiry
|
||||
type ExpiryTypeRelativeToCreation = exported.ExpiryTypeRelativeToCreation
|
||||
|
||||
// ExpiryTypeNever defines that the blob will be set to never expire
|
||||
type ExpiryTypeNever = exported.ExpiryTypeNever
|
||||
|
||||
// SetExpiryOptions contains the optional parameters for the Client.SetExpiry method.
|
||||
type SetExpiryOptions = exported.SetExpiryOptions
|
26
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/appendblob/responses.go
сгенерированный
поставляемый
Normal file
26
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/appendblob/responses.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,26 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
package appendblob
|
||||
|
||||
import (
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated"
|
||||
)
|
||||
|
||||
// CreateResponse contains the response from method Client.Create.
|
||||
type CreateResponse = generated.AppendBlobClientCreateResponse
|
||||
|
||||
// AppendBlockResponse contains the response from method Client.AppendBlock.
|
||||
type AppendBlockResponse = generated.AppendBlobClientAppendBlockResponse
|
||||
|
||||
// AppendBlockFromURLResponse contains the response from method Client.AppendBlockFromURL.
|
||||
type AppendBlockFromURLResponse = generated.AppendBlobClientAppendBlockFromURLResponse
|
||||
|
||||
// SealResponse contains the response from method Client.Seal.
|
||||
type SealResponse = generated.AppendBlobClientSealResponse
|
||||
|
||||
// SetExpiryResponse contains the response from method Client.SetExpiry.
|
||||
type SetExpiryResponse = generated.BlobClientSetExpiryResponse
|
6
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/assets.json
сгенерированный
поставляемый
Normal file
6
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/assets.json
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"AssetsRepo": "Azure/azure-sdk-assets",
|
||||
"AssetsRepoPrefixPath": "go",
|
||||
"TagPrefix": "go/storage/azblob",
|
||||
"Tag": "go/storage/azblob_71b0a04c12"
|
||||
}
|
471
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob/client.go
сгенерированный
поставляемый
Normal file
471
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob/client.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,471 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
package blob
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"os"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/streaming"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/bloberror"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/base"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/exported"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/shared"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/sas"
|
||||
)
|
||||
|
||||
// ClientOptions contains the optional parameters when creating a Client.
|
||||
type ClientOptions base.ClientOptions
|
||||
|
||||
// Client represents a URL to an Azure Storage blob; the blob may be a block blob, append blob, or page blob.
|
||||
type Client base.Client[generated.BlobClient]
|
||||
|
||||
// NewClient creates an instance of Client with the specified values.
|
||||
// - blobURL - the URL of the blob e.g. https://<account>.blob.core.windows.net/container/blob.txt
|
||||
// - cred - an Azure AD credential, typically obtained via the azidentity module
|
||||
// - options - client options; pass nil to accept the default values
|
||||
func NewClient(blobURL string, cred azcore.TokenCredential, options *ClientOptions) (*Client, error) {
|
||||
audience := base.GetAudience((*base.ClientOptions)(options))
|
||||
conOptions := shared.GetClientOptions(options)
|
||||
authPolicy := shared.NewStorageChallengePolicy(cred, audience, conOptions.InsecureAllowCredentialWithHTTP)
|
||||
plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}}
|
||||
|
||||
azClient, err := azcore.NewClient(exported.ModuleName, exported.ModuleVersion, plOpts, &conOptions.ClientOptions)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return (*Client)(base.NewBlobClient(blobURL, azClient, &cred, (*base.ClientOptions)(conOptions))), nil
|
||||
}
|
||||
|
||||
// NewClientWithNoCredential creates an instance of Client with the specified values.
|
||||
// This is used to anonymously access a blob or with a shared access signature (SAS) token.
|
||||
// - blobURL - the URL of the blob e.g. https://<account>.blob.core.windows.net/container/blob.txt?<sas token>
|
||||
// - options - client options; pass nil to accept the default values
|
||||
func NewClientWithNoCredential(blobURL string, options *ClientOptions) (*Client, error) {
|
||||
conOptions := shared.GetClientOptions(options)
|
||||
|
||||
azClient, err := azcore.NewClient(exported.ModuleName, exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return (*Client)(base.NewBlobClient(blobURL, azClient, nil, (*base.ClientOptions)(conOptions))), nil
|
||||
}
|
||||
|
||||
// NewClientWithSharedKeyCredential creates an instance of Client with the specified values.
|
||||
// - blobURL - the URL of the blob e.g. https://<account>.blob.core.windows.net/container/blob.txt
|
||||
// - cred - a SharedKeyCredential created with the matching blob's storage account and access key
|
||||
// - options - client options; pass nil to accept the default values
|
||||
func NewClientWithSharedKeyCredential(blobURL string, cred *SharedKeyCredential, options *ClientOptions) (*Client, error) {
|
||||
authPolicy := exported.NewSharedKeyCredPolicy(cred)
|
||||
conOptions := shared.GetClientOptions(options)
|
||||
plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}}
|
||||
|
||||
azClient, err := azcore.NewClient(exported.ModuleName, exported.ModuleVersion, plOpts, &conOptions.ClientOptions)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return (*Client)(base.NewBlobClient(blobURL, azClient, cred, (*base.ClientOptions)(conOptions))), nil
|
||||
}
|
||||
|
||||
// NewClientFromConnectionString creates an instance of Client with the specified values.
|
||||
// - connectionString - a connection string for the desired storage account
|
||||
// - containerName - the name of the container within the storage account
|
||||
// - blobName - the name of the blob within the container
|
||||
// - options - client options; pass nil to accept the default values
|
||||
func NewClientFromConnectionString(connectionString, containerName, blobName string, options *ClientOptions) (*Client, error) {
|
||||
parsed, err := shared.ParseConnectionString(connectionString)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
parsed.ServiceURL = runtime.JoinPaths(parsed.ServiceURL, containerName, blobName)
|
||||
|
||||
if parsed.AccountKey != "" && parsed.AccountName != "" {
|
||||
credential, err := exported.NewSharedKeyCredential(parsed.AccountName, parsed.AccountKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return NewClientWithSharedKeyCredential(parsed.ServiceURL, credential, options)
|
||||
}
|
||||
|
||||
return NewClientWithNoCredential(parsed.ServiceURL, options)
|
||||
}
|
||||
|
||||
func (b *Client) generated() *generated.BlobClient {
|
||||
return base.InnerClient((*base.Client[generated.BlobClient])(b))
|
||||
}
|
||||
|
||||
func (b *Client) sharedKey() *SharedKeyCredential {
|
||||
return base.SharedKey((*base.Client[generated.BlobClient])(b))
|
||||
}
|
||||
|
||||
func (b *Client) credential() any {
|
||||
return base.Credential((*base.Client[generated.BlobClient])(b))
|
||||
}
|
||||
|
||||
func (b *Client) getClientOptions() *base.ClientOptions {
|
||||
return base.GetClientOptions((*base.Client[generated.BlobClient])(b))
|
||||
}
|
||||
|
||||
// URL returns the URL endpoint used by the Client object.
|
||||
func (b *Client) URL() string {
|
||||
return b.generated().Endpoint()
|
||||
}
|
||||
|
||||
// WithSnapshot creates a new Client object identical to the source but with the specified snapshot timestamp.
|
||||
// Pass "" to remove the snapshot returning a URL to the base blob.
|
||||
func (b *Client) WithSnapshot(snapshot string) (*Client, error) {
|
||||
p, err := ParseURL(b.URL())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
p.Snapshot = snapshot
|
||||
|
||||
return (*Client)(base.NewBlobClient(p.String(), b.generated().InternalClient(), b.credential(), b.getClientOptions())), nil
|
||||
}
|
||||
|
||||
// WithVersionID creates a new AppendBlobURL object identical to the source but with the specified version id.
|
||||
// Pass "" to remove the versionID returning a URL to the base blob.
|
||||
func (b *Client) WithVersionID(versionID string) (*Client, error) {
|
||||
p, err := ParseURL(b.URL())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
p.VersionID = versionID
|
||||
|
||||
return (*Client)(base.NewBlobClient(p.String(), b.generated().InternalClient(), b.credential(), b.getClientOptions())), nil
|
||||
}
|
||||
|
||||
// Delete marks the specified blob or snapshot for deletion. The blob is later deleted during garbage collection.
|
||||
// Note that deleting a blob also deletes all its snapshots.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/delete-blob.
|
||||
func (b *Client) Delete(ctx context.Context, o *DeleteOptions) (DeleteResponse, error) {
|
||||
deleteOptions, leaseInfo, accessConditions := o.format()
|
||||
resp, err := b.generated().Delete(ctx, deleteOptions, leaseInfo, accessConditions)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// Undelete restores the contents and metadata of a soft-deleted blob and any associated soft-deleted snapshots.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/undelete-blob.
|
||||
func (b *Client) Undelete(ctx context.Context, o *UndeleteOptions) (UndeleteResponse, error) {
|
||||
undeleteOptions := o.format()
|
||||
resp, err := b.generated().Undelete(ctx, undeleteOptions)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// SetTier operation sets the tier on a blob. The operation is allowed on a page
|
||||
// blob in a premium storage account and on a block blob in a blob storage account (locally
|
||||
// redundant storage only). A premium page blob's tier determines the allowed size, IOPs, and
|
||||
// bandwidth of the blob. A block blob's tier determines Hot/Cool/Archive storage type. This operation
|
||||
// does not update the blob's ETag.
|
||||
// For detailed information about block blob level tiers see https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blob-storage-tiers.
|
||||
func (b *Client) SetTier(ctx context.Context, tier AccessTier, o *SetTierOptions) (SetTierResponse, error) {
|
||||
opts, leaseAccessConditions, modifiedAccessConditions := o.format()
|
||||
resp, err := b.generated().SetTier(ctx, tier, opts, leaseAccessConditions, modifiedAccessConditions)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// GetProperties returns the blob's properties.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/get-blob-properties.
|
||||
func (b *Client) GetProperties(ctx context.Context, options *GetPropertiesOptions) (GetPropertiesResponse, error) {
|
||||
opts, leaseAccessConditions, cpkInfo, modifiedAccessConditions := options.format()
|
||||
resp, err := b.generated().GetProperties(ctx, opts, leaseAccessConditions, cpkInfo, modifiedAccessConditions)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// SetHTTPHeaders changes a blob's HTTP headers.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/set-blob-properties.
|
||||
func (b *Client) SetHTTPHeaders(ctx context.Context, HTTPHeaders HTTPHeaders, o *SetHTTPHeadersOptions) (SetHTTPHeadersResponse, error) {
|
||||
opts, leaseAccessConditions, modifiedAccessConditions := o.format()
|
||||
resp, err := b.generated().SetHTTPHeaders(ctx, opts, &HTTPHeaders, leaseAccessConditions, modifiedAccessConditions)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// SetMetadata changes a blob's metadata.
|
||||
// https://docs.microsoft.com/rest/api/storageservices/set-blob-metadata.
|
||||
func (b *Client) SetMetadata(ctx context.Context, metadata map[string]*string, o *SetMetadataOptions) (SetMetadataResponse, error) {
|
||||
basics := generated.BlobClientSetMetadataOptions{Metadata: metadata}
|
||||
leaseAccessConditions, cpkInfo, cpkScope, modifiedAccessConditions := o.format()
|
||||
resp, err := b.generated().SetMetadata(ctx, &basics, leaseAccessConditions, cpkInfo, cpkScope, modifiedAccessConditions)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// CreateSnapshot creates a read-only snapshot of a blob.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/snapshot-blob.
|
||||
func (b *Client) CreateSnapshot(ctx context.Context, options *CreateSnapshotOptions) (CreateSnapshotResponse, error) {
|
||||
// CreateSnapshot does NOT panic if the user tries to create a snapshot using a URL that already has a snapshot query parameter
|
||||
// because checking this would be a performance hit for a VERY unusual path, and we don't think the common case should suffer this
|
||||
// performance hit.
|
||||
opts, cpkInfo, cpkScope, modifiedAccessConditions, leaseAccessConditions := options.format()
|
||||
resp, err := b.generated().CreateSnapshot(ctx, opts, cpkInfo, cpkScope, modifiedAccessConditions, leaseAccessConditions)
|
||||
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// StartCopyFromURL copies the data at the source URL to a blob.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/copy-blob.
|
||||
func (b *Client) StartCopyFromURL(ctx context.Context, copySource string, options *StartCopyFromURLOptions) (StartCopyFromURLResponse, error) {
|
||||
opts, sourceModifiedAccessConditions, modifiedAccessConditions, leaseAccessConditions := options.format()
|
||||
resp, err := b.generated().StartCopyFromURL(ctx, copySource, opts, sourceModifiedAccessConditions, modifiedAccessConditions, leaseAccessConditions)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// AbortCopyFromURL stops a pending copy that was previously started and leaves a destination blob with 0 length and metadata.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/abort-copy-blob.
|
||||
func (b *Client) AbortCopyFromURL(ctx context.Context, copyID string, options *AbortCopyFromURLOptions) (AbortCopyFromURLResponse, error) {
|
||||
opts, leaseAccessConditions := options.format()
|
||||
resp, err := b.generated().AbortCopyFromURL(ctx, copyID, opts, leaseAccessConditions)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// SetTags operation enables users to set tags on a blob or specific blob version, but not snapshot.
|
||||
// Each call to this operation replaces all existing tags attached to the blob.
|
||||
// To remove all tags from the blob, call this operation with no tags set.
|
||||
// https://docs.microsoft.com/en-us/rest/api/storageservices/set-blob-tags
|
||||
func (b *Client) SetTags(ctx context.Context, tags map[string]string, options *SetTagsOptions) (SetTagsResponse, error) {
|
||||
serializedTags := shared.SerializeBlobTags(tags)
|
||||
blobSetTagsOptions, modifiedAccessConditions, leaseAccessConditions := options.format()
|
||||
resp, err := b.generated().SetTags(ctx, *serializedTags, blobSetTagsOptions, modifiedAccessConditions, leaseAccessConditions)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// GetTags operation enables users to get tags on a blob or specific blob version, or snapshot.
|
||||
// https://docs.microsoft.com/en-us/rest/api/storageservices/get-blob-tags
|
||||
func (b *Client) GetTags(ctx context.Context, options *GetTagsOptions) (GetTagsResponse, error) {
|
||||
blobGetTagsOptions, modifiedAccessConditions, leaseAccessConditions := options.format()
|
||||
resp, err := b.generated().GetTags(ctx, blobGetTagsOptions, modifiedAccessConditions, leaseAccessConditions)
|
||||
return resp, err
|
||||
|
||||
}
|
||||
|
||||
// SetImmutabilityPolicy operation enables users to set the immutability policy on a blob. Mode defaults to "Unlocked".
|
||||
// https://learn.microsoft.com/en-us/azure/storage/blobs/immutable-storage-overview
|
||||
func (b *Client) SetImmutabilityPolicy(ctx context.Context, expiryTime time.Time, options *SetImmutabilityPolicyOptions) (SetImmutabilityPolicyResponse, error) {
|
||||
blobSetImmutabilityPolicyOptions, modifiedAccessConditions := options.format()
|
||||
blobSetImmutabilityPolicyOptions.ImmutabilityPolicyExpiry = &expiryTime
|
||||
resp, err := b.generated().SetImmutabilityPolicy(ctx, blobSetImmutabilityPolicyOptions, modifiedAccessConditions)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// DeleteImmutabilityPolicy operation enables users to delete the immutability policy on a blob.
|
||||
// https://learn.microsoft.com/en-us/azure/storage/blobs/immutable-storage-overview
|
||||
func (b *Client) DeleteImmutabilityPolicy(ctx context.Context, options *DeleteImmutabilityPolicyOptions) (DeleteImmutabilityPolicyResponse, error) {
|
||||
deleteImmutabilityOptions := options.format()
|
||||
resp, err := b.generated().DeleteImmutabilityPolicy(ctx, deleteImmutabilityOptions)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// SetLegalHold operation enables users to set legal hold on a blob.
|
||||
// https://learn.microsoft.com/en-us/azure/storage/blobs/immutable-storage-overview
|
||||
func (b *Client) SetLegalHold(ctx context.Context, legalHold bool, options *SetLegalHoldOptions) (SetLegalHoldResponse, error) {
|
||||
setLegalHoldOptions := options.format()
|
||||
resp, err := b.generated().SetLegalHold(ctx, legalHold, setLegalHoldOptions)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// CopyFromURL synchronously copies the data at the source URL to a block blob, with sizes up to 256 MB.
|
||||
// For more information, see https://docs.microsoft.com/en-us/rest/api/storageservices/copy-blob-from-url.
|
||||
func (b *Client) CopyFromURL(ctx context.Context, copySource string, options *CopyFromURLOptions) (CopyFromURLResponse, error) {
|
||||
copyOptions, smac, mac, lac, cpkScopeInfo := options.format()
|
||||
resp, err := b.generated().CopyFromURL(ctx, copySource, copyOptions, smac, mac, lac, cpkScopeInfo)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// GetAccountInfo provides account level information
|
||||
// For more information, see https://learn.microsoft.com/en-us/rest/api/storageservices/get-account-information?tabs=shared-access-signatures.
|
||||
func (b *Client) GetAccountInfo(ctx context.Context, o *GetAccountInfoOptions) (GetAccountInfoResponse, error) {
|
||||
getAccountInfoOptions := o.format()
|
||||
resp, err := b.generated().GetAccountInfo(ctx, getAccountInfoOptions)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// GetSASURL is a convenience method for generating a SAS token for the currently pointed at blob.
|
||||
// It can only be used if the credential supplied during creation was a SharedKeyCredential.
|
||||
func (b *Client) GetSASURL(permissions sas.BlobPermissions, expiry time.Time, o *GetSASURLOptions) (string, error) {
|
||||
if b.sharedKey() == nil {
|
||||
return "", bloberror.MissingSharedKeyCredential
|
||||
}
|
||||
|
||||
urlParts, err := ParseURL(b.URL())
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
t, err := time.Parse(SnapshotTimeFormat, urlParts.Snapshot)
|
||||
|
||||
if err != nil {
|
||||
t = time.Time{}
|
||||
}
|
||||
st := o.format()
|
||||
|
||||
qps, err := sas.BlobSignatureValues{
|
||||
ContainerName: urlParts.ContainerName,
|
||||
BlobName: urlParts.BlobName,
|
||||
SnapshotTime: t,
|
||||
Version: sas.Version,
|
||||
Permissions: permissions.String(),
|
||||
StartTime: st,
|
||||
ExpiryTime: expiry.UTC(),
|
||||
}.SignWithSharedKey(b.sharedKey())
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
endpoint := b.URL() + "?" + qps.Encode()
|
||||
|
||||
return endpoint, nil
|
||||
}
|
||||
|
||||
// Concurrent Download Functions -----------------------------------------------------------------------------------------
|
||||
|
||||
// downloadBuffer downloads an Azure blob to a WriterAt in parallel.
|
||||
func (b *Client) downloadBuffer(ctx context.Context, writer io.WriterAt, o downloadOptions) (int64, error) {
|
||||
if o.BlockSize == 0 {
|
||||
o.BlockSize = DefaultDownloadBlockSize
|
||||
}
|
||||
|
||||
count := o.Range.Count
|
||||
if count == CountToEnd { // If size not specified, calculate it
|
||||
// If we don't have the length at all, get it
|
||||
gr, err := b.GetProperties(ctx, o.getBlobPropertiesOptions())
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
count = *gr.ContentLength - o.Range.Offset
|
||||
}
|
||||
|
||||
if count <= 0 {
|
||||
// The file is empty, there is nothing to download.
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
// Prepare and do parallel download.
|
||||
progress := int64(0)
|
||||
progressLock := &sync.Mutex{}
|
||||
|
||||
err := shared.DoBatchTransfer(ctx, &shared.BatchTransferOptions{
|
||||
OperationName: "downloadBlobToWriterAt",
|
||||
TransferSize: count,
|
||||
ChunkSize: o.BlockSize,
|
||||
NumChunks: uint64(((count - 1) / o.BlockSize) + 1),
|
||||
Concurrency: o.Concurrency,
|
||||
Operation: func(ctx context.Context, chunkStart int64, count int64) error {
|
||||
downloadBlobOptions := o.getDownloadBlobOptions(HTTPRange{
|
||||
Offset: chunkStart + o.Range.Offset,
|
||||
Count: count,
|
||||
}, nil)
|
||||
dr, err := b.DownloadStream(ctx, downloadBlobOptions)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var body io.ReadCloser = dr.NewRetryReader(ctx, &o.RetryReaderOptionsPerBlock)
|
||||
if o.Progress != nil {
|
||||
rangeProgress := int64(0)
|
||||
body = streaming.NewResponseProgress(
|
||||
body,
|
||||
func(bytesTransferred int64) {
|
||||
diff := bytesTransferred - rangeProgress
|
||||
rangeProgress = bytesTransferred
|
||||
progressLock.Lock()
|
||||
progress += diff
|
||||
o.Progress(progress)
|
||||
progressLock.Unlock()
|
||||
})
|
||||
}
|
||||
_, err = io.Copy(shared.NewSectionWriter(writer, chunkStart, count), body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = body.Close()
|
||||
return err
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return count, nil
|
||||
}
|
||||
|
||||
// DownloadStream reads a range of bytes from a blob. The response also includes the blob's properties and metadata.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/get-blob.
|
||||
func (b *Client) DownloadStream(ctx context.Context, o *DownloadStreamOptions) (DownloadStreamResponse, error) {
|
||||
downloadOptions, leaseAccessConditions, cpkInfo, modifiedAccessConditions := o.format()
|
||||
if o == nil {
|
||||
o = &DownloadStreamOptions{}
|
||||
}
|
||||
|
||||
dr, err := b.generated().Download(ctx, downloadOptions, leaseAccessConditions, cpkInfo, modifiedAccessConditions)
|
||||
if err != nil {
|
||||
return DownloadStreamResponse{}, err
|
||||
}
|
||||
|
||||
return DownloadStreamResponse{
|
||||
client: b,
|
||||
DownloadResponse: dr,
|
||||
getInfo: httpGetterInfo{Range: o.Range, ETag: dr.ETag},
|
||||
ObjectReplicationRules: deserializeORSPolicies(dr.ObjectReplicationRules),
|
||||
cpkInfo: o.CPKInfo,
|
||||
cpkScope: o.CPKScopeInfo,
|
||||
}, err
|
||||
}
|
||||
|
||||
// DownloadBuffer downloads an Azure blob to a buffer with parallel.
|
||||
func (b *Client) DownloadBuffer(ctx context.Context, buffer []byte, o *DownloadBufferOptions) (int64, error) {
|
||||
if o == nil {
|
||||
o = &DownloadBufferOptions{}
|
||||
}
|
||||
return b.downloadBuffer(ctx, shared.NewBytesWriter(buffer), (downloadOptions)(*o))
|
||||
}
|
||||
|
||||
// DownloadFile downloads an Azure blob to a local file.
|
||||
// The file would be truncated if the size doesn't match.
|
||||
func (b *Client) DownloadFile(ctx context.Context, file *os.File, o *DownloadFileOptions) (int64, error) {
|
||||
if o == nil {
|
||||
o = &DownloadFileOptions{}
|
||||
}
|
||||
do := (*downloadOptions)(o)
|
||||
|
||||
// 1. Calculate the size of the destination file
|
||||
var size int64
|
||||
|
||||
count := do.Range.Count
|
||||
if count == CountToEnd {
|
||||
// Try to get Azure blob's size
|
||||
getBlobPropertiesOptions := do.getBlobPropertiesOptions()
|
||||
props, err := b.GetProperties(ctx, getBlobPropertiesOptions)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
size = *props.ContentLength - do.Range.Offset
|
||||
} else {
|
||||
size = count
|
||||
}
|
||||
|
||||
// 2. Compare and try to resize local file's size if it doesn't match Azure blob's size.
|
||||
stat, err := file.Stat()
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
if stat.Size() != size {
|
||||
if err = file.Truncate(size); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
|
||||
if size > 0 {
|
||||
return b.downloadBuffer(ctx, file, *do)
|
||||
} else { // if the blob's size is 0, there is no need in downloading it
|
||||
return 0, nil
|
||||
}
|
||||
}
|
235
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob/constants.go
сгенерированный
поставляемый
Normal file
235
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob/constants.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,235 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
package blob
|
||||
|
||||
import (
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/exported"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/shared"
|
||||
)
|
||||
|
||||
const (
|
||||
CountToEnd = 0
|
||||
|
||||
SnapshotTimeFormat = exported.SnapshotTimeFormat
|
||||
|
||||
// DefaultDownloadBlockSize is default block size
|
||||
DefaultDownloadBlockSize = int64(4 * 1024 * 1024) // 4MB
|
||||
|
||||
// DefaultConcurrency is the default number of blocks downloaded or uploaded in parallel
|
||||
DefaultConcurrency = shared.DefaultConcurrency
|
||||
)
|
||||
|
||||
// BlobType defines values for BlobType
|
||||
type BlobType = generated.BlobType
|
||||
|
||||
const (
|
||||
BlobTypeBlockBlob BlobType = generated.BlobTypeBlockBlob
|
||||
BlobTypePageBlob BlobType = generated.BlobTypePageBlob
|
||||
BlobTypeAppendBlob BlobType = generated.BlobTypeAppendBlob
|
||||
)
|
||||
|
||||
// PossibleBlobTypeValues returns the possible values for the BlobType const type.
|
||||
func PossibleBlobTypeValues() []BlobType {
|
||||
return generated.PossibleBlobTypeValues()
|
||||
}
|
||||
|
||||
// DeleteSnapshotsOptionType defines values for DeleteSnapshotsOptionType
|
||||
type DeleteSnapshotsOptionType = generated.DeleteSnapshotsOptionType
|
||||
|
||||
const (
|
||||
DeleteSnapshotsOptionTypeInclude DeleteSnapshotsOptionType = generated.DeleteSnapshotsOptionTypeInclude
|
||||
DeleteSnapshotsOptionTypeOnly DeleteSnapshotsOptionType = generated.DeleteSnapshotsOptionTypeOnly
|
||||
)
|
||||
|
||||
// PossibleDeleteSnapshotsOptionTypeValues returns the possible values for the DeleteSnapshotsOptionType const type.
|
||||
func PossibleDeleteSnapshotsOptionTypeValues() []DeleteSnapshotsOptionType {
|
||||
return generated.PossibleDeleteSnapshotsOptionTypeValues()
|
||||
}
|
||||
|
||||
// AccessTier defines values for Blob Access Tier.
|
||||
type AccessTier = generated.AccessTier
|
||||
|
||||
const (
|
||||
AccessTierArchive AccessTier = generated.AccessTierArchive
|
||||
AccessTierCool AccessTier = generated.AccessTierCool
|
||||
AccessTierCold AccessTier = generated.AccessTierCold
|
||||
AccessTierHot AccessTier = generated.AccessTierHot
|
||||
AccessTierP10 AccessTier = generated.AccessTierP10
|
||||
AccessTierP15 AccessTier = generated.AccessTierP15
|
||||
AccessTierP20 AccessTier = generated.AccessTierP20
|
||||
AccessTierP30 AccessTier = generated.AccessTierP30
|
||||
AccessTierP4 AccessTier = generated.AccessTierP4
|
||||
AccessTierP40 AccessTier = generated.AccessTierP40
|
||||
AccessTierP50 AccessTier = generated.AccessTierP50
|
||||
AccessTierP6 AccessTier = generated.AccessTierP6
|
||||
AccessTierP60 AccessTier = generated.AccessTierP60
|
||||
AccessTierP70 AccessTier = generated.AccessTierP70
|
||||
AccessTierP80 AccessTier = generated.AccessTierP80
|
||||
AccessTierPremium AccessTier = generated.AccessTierPremium
|
||||
)
|
||||
|
||||
// PossibleAccessTierValues returns the possible values for the AccessTier const type.
|
||||
func PossibleAccessTierValues() []AccessTier {
|
||||
return generated.PossibleAccessTierValues()
|
||||
}
|
||||
|
||||
// RehydratePriority - If an object is in rehydrate pending state then this header is returned with priority of rehydrate.
|
||||
// Valid values are High and Standard.
|
||||
type RehydratePriority = generated.RehydratePriority
|
||||
|
||||
const (
|
||||
RehydratePriorityHigh RehydratePriority = generated.RehydratePriorityHigh
|
||||
RehydratePriorityStandard RehydratePriority = generated.RehydratePriorityStandard
|
||||
)
|
||||
|
||||
// PossibleRehydratePriorityValues returns the possible values for the RehydratePriority const type.
|
||||
func PossibleRehydratePriorityValues() []RehydratePriority {
|
||||
return generated.PossibleRehydratePriorityValues()
|
||||
}
|
||||
|
||||
// ImmutabilityPolicyMode defines values for ImmutabilityPolicyMode
|
||||
type ImmutabilityPolicyMode = generated.ImmutabilityPolicyMode
|
||||
|
||||
const (
|
||||
ImmutabilityPolicyModeMutable ImmutabilityPolicyMode = generated.ImmutabilityPolicyModeMutable
|
||||
ImmutabilityPolicyModeUnlocked ImmutabilityPolicyMode = generated.ImmutabilityPolicyModeUnlocked
|
||||
ImmutabilityPolicyModeLocked ImmutabilityPolicyMode = generated.ImmutabilityPolicyModeLocked
|
||||
)
|
||||
|
||||
// PossibleImmutabilityPolicyModeValues returns the possible values for the ImmutabilityPolicyMode const type.
|
||||
func PossibleImmutabilityPolicyModeValues() []ImmutabilityPolicyMode {
|
||||
return generated.PossibleImmutabilityPolicyModeValues()
|
||||
}
|
||||
|
||||
// ImmutabilityPolicySetting returns the possible values for the ImmutabilityPolicySetting const type.
|
||||
type ImmutabilityPolicySetting = generated.ImmutabilityPolicySetting
|
||||
|
||||
const (
|
||||
ImmutabilityPolicySettingUnlocked ImmutabilityPolicySetting = generated.ImmutabilityPolicySettingUnlocked
|
||||
ImmutabilityPolicySettingLocked ImmutabilityPolicySetting = generated.ImmutabilityPolicySettingLocked
|
||||
)
|
||||
|
||||
// PossibleImmutabilityPolicySettingValues returns the possible values for the ImmutabilityPolicySetting const type.
|
||||
func PossibleImmutabilityPolicySettingValues() []ImmutabilityPolicySetting {
|
||||
return generated.PossibleImmutabilityPolicySettingValues()
|
||||
}
|
||||
|
||||
// CopyStatusType defines values for CopyStatusType
|
||||
type CopyStatusType = generated.CopyStatusType
|
||||
|
||||
const (
|
||||
CopyStatusTypePending CopyStatusType = generated.CopyStatusTypePending
|
||||
CopyStatusTypeSuccess CopyStatusType = generated.CopyStatusTypeSuccess
|
||||
CopyStatusTypeAborted CopyStatusType = generated.CopyStatusTypeAborted
|
||||
CopyStatusTypeFailed CopyStatusType = generated.CopyStatusTypeFailed
|
||||
)
|
||||
|
||||
// PossibleCopyStatusTypeValues returns the possible values for the CopyStatusType const type.
|
||||
func PossibleCopyStatusTypeValues() []CopyStatusType {
|
||||
return generated.PossibleCopyStatusTypeValues()
|
||||
}
|
||||
|
||||
// EncryptionAlgorithmType defines values for EncryptionAlgorithmType.
|
||||
type EncryptionAlgorithmType = generated.EncryptionAlgorithmType
|
||||
|
||||
const (
|
||||
EncryptionAlgorithmTypeNone EncryptionAlgorithmType = generated.EncryptionAlgorithmTypeNone
|
||||
EncryptionAlgorithmTypeAES256 EncryptionAlgorithmType = generated.EncryptionAlgorithmTypeAES256
|
||||
)
|
||||
|
||||
// PossibleEncryptionAlgorithmTypeValues returns the possible values for the EncryptionAlgorithmType const type.
|
||||
func PossibleEncryptionAlgorithmTypeValues() []EncryptionAlgorithmType {
|
||||
return generated.PossibleEncryptionAlgorithmTypeValues()
|
||||
}
|
||||
|
||||
// ArchiveStatus defines values for ArchiveStatus.
|
||||
type ArchiveStatus = generated.ArchiveStatus
|
||||
|
||||
const (
|
||||
ArchiveStatusRehydratePendingToCool ArchiveStatus = generated.ArchiveStatusRehydratePendingToCool
|
||||
ArchiveStatusRehydratePendingToHot ArchiveStatus = generated.ArchiveStatusRehydratePendingToHot
|
||||
ArchiveStatusRehydratePendingToCold ArchiveStatus = generated.ArchiveStatusRehydratePendingToCold
|
||||
)
|
||||
|
||||
// PossibleArchiveStatusValues returns the possible values for the ArchiveStatus const type.
|
||||
func PossibleArchiveStatusValues() []ArchiveStatus {
|
||||
return generated.PossibleArchiveStatusValues()
|
||||
}
|
||||
|
||||
// DeleteType defines values for DeleteType.
|
||||
type DeleteType = generated.DeleteType
|
||||
|
||||
const (
|
||||
DeleteTypeNone DeleteType = generated.DeleteTypeNone
|
||||
DeleteTypePermanent DeleteType = generated.DeleteTypePermanent
|
||||
)
|
||||
|
||||
// PossibleDeleteTypeValues returns the possible values for the DeleteType const type.
|
||||
func PossibleDeleteTypeValues() []DeleteType {
|
||||
return generated.PossibleDeleteTypeValues()
|
||||
}
|
||||
|
||||
// QueryFormatType - The quick query format type.
|
||||
type QueryFormatType = generated.QueryFormatType
|
||||
|
||||
const (
|
||||
QueryFormatTypeDelimited QueryFormatType = generated.QueryFormatTypeDelimited
|
||||
QueryFormatTypeJSON QueryFormatType = generated.QueryFormatTypeJSON
|
||||
QueryFormatTypeArrow QueryFormatType = generated.QueryFormatTypeArrow
|
||||
QueryFormatTypeParquet QueryFormatType = generated.QueryFormatTypeParquet
|
||||
)
|
||||
|
||||
// PossibleQueryFormatTypeValues returns the possible values for the QueryFormatType const type.
|
||||
func PossibleQueryFormatTypeValues() []QueryFormatType {
|
||||
return generated.PossibleQueryFormatTypeValues()
|
||||
}
|
||||
|
||||
// TransferValidationType abstracts the various mechanisms used to verify a transfer.
|
||||
type TransferValidationType = exported.TransferValidationType
|
||||
|
||||
// TransferValidationTypeCRC64 is a TransferValidationType used to provide a precomputed CRC64.
|
||||
type TransferValidationTypeCRC64 = exported.TransferValidationTypeCRC64
|
||||
|
||||
// TransferValidationTypeComputeCRC64 is a TransferValidationType that indicates a CRC64 should be computed during transfer.
|
||||
func TransferValidationTypeComputeCRC64() TransferValidationType {
|
||||
return exported.TransferValidationTypeComputeCRC64()
|
||||
}
|
||||
|
||||
// TransferValidationTypeMD5 is a TransferValidationType used to provide a precomputed MD5.
|
||||
type TransferValidationTypeMD5 = exported.TransferValidationTypeMD5
|
||||
|
||||
// SourceContentValidationType abstracts the various mechanisms used to validate source content.
|
||||
// This interface is not publicly implementable.
|
||||
type SourceContentValidationType interface {
|
||||
Apply(generated.SourceContentSetter)
|
||||
notPubliclyImplementable()
|
||||
}
|
||||
|
||||
// SourceContentValidationTypeCRC64 is a SourceContentValidationType used to provide a precomputed CRC64.
|
||||
type SourceContentValidationTypeCRC64 []byte
|
||||
|
||||
// Apply implements the SourceContentValidationType interface for type SourceContentValidationTypeCRC64.
|
||||
func (s SourceContentValidationTypeCRC64) Apply(src generated.SourceContentSetter) {
|
||||
src.SetSourceContentCRC64(s)
|
||||
}
|
||||
|
||||
func (SourceContentValidationTypeCRC64) notPubliclyImplementable() {}
|
||||
|
||||
var _ SourceContentValidationType = (SourceContentValidationTypeCRC64)(nil)
|
||||
|
||||
// SourceContentValidationTypeMD5 is a SourceContentValidationType used to provide a precomputed MD5.
|
||||
type SourceContentValidationTypeMD5 []byte
|
||||
|
||||
// Apply implements the SourceContentValidationType interface for type SourceContentValidationTypeMD5.
|
||||
func (s SourceContentValidationTypeMD5) Apply(src generated.SourceContentSetter) {
|
||||
src.SetSourceContentMD5(s)
|
||||
}
|
||||
|
||||
func (SourceContentValidationTypeMD5) notPubliclyImplementable() {}
|
||||
|
||||
var _ SourceContentValidationType = (SourceContentValidationTypeMD5)(nil)
|
580
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob/models.go
сгенерированный
поставляемый
Normal file
580
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob/models.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,580 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
package blob
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/exported"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/shared"
|
||||
)
|
||||
|
||||
// SharedKeyCredential contains an account's name and its primary or secondary key.
|
||||
type SharedKeyCredential = exported.SharedKeyCredential
|
||||
|
||||
// NewSharedKeyCredential creates an immutable SharedKeyCredential containing the
|
||||
// storage account's name and either its primary or secondary key.
|
||||
func NewSharedKeyCredential(accountName, accountKey string) (*SharedKeyCredential, error) {
|
||||
return exported.NewSharedKeyCredential(accountName, accountKey)
|
||||
}
|
||||
|
||||
// Type Declarations ---------------------------------------------------------------------
|
||||
|
||||
// AccessConditions identifies blob-specific access conditions which you optionally set.
|
||||
type AccessConditions = exported.BlobAccessConditions
|
||||
|
||||
// LeaseAccessConditions contains optional parameters to access leased entity.
|
||||
type LeaseAccessConditions = exported.LeaseAccessConditions
|
||||
|
||||
// ModifiedAccessConditions contains a group of parameters for specifying access conditions.
|
||||
type ModifiedAccessConditions = exported.ModifiedAccessConditions
|
||||
|
||||
// CPKInfo contains a group of parameters for client provided encryption key.
|
||||
type CPKInfo = generated.CPKInfo
|
||||
|
||||
// CPKScopeInfo contains a group of parameters for client provided encryption scope.
|
||||
type CPKScopeInfo = generated.CPKScopeInfo
|
||||
|
||||
// HTTPHeaders contains a group of parameters for the BlobClient.SetHTTPHeaders method.
|
||||
type HTTPHeaders = generated.BlobHTTPHeaders
|
||||
|
||||
// SourceModifiedAccessConditions contains a group of parameters for the BlobClient.StartCopyFromURL method.
|
||||
type SourceModifiedAccessConditions = generated.SourceModifiedAccessConditions
|
||||
|
||||
// Tags represent map of blob index tags
|
||||
type Tags = generated.BlobTag
|
||||
|
||||
// HTTPRange defines a range of bytes within an HTTP resource, starting at offset and
|
||||
// ending at offset+count. A zero-value HTTPRange indicates the entire resource. An HTTPRange
|
||||
// which has an offset and zero value count indicates from the offset to the resource's end.
|
||||
type HTTPRange = exported.HTTPRange
|
||||
|
||||
// Request Model Declaration -------------------------------------------------------------------------------------------
|
||||
|
||||
// DownloadStreamOptions contains the optional parameters for the Client.Download method.
|
||||
type DownloadStreamOptions struct {
|
||||
// When set to true and specified together with the Range, the service returns the MD5 hash for the range, as long as the
|
||||
// range is less than or equal to 4 MB in size.
|
||||
RangeGetContentMD5 *bool
|
||||
|
||||
// Range specifies a range of bytes. The default value is all bytes.
|
||||
Range HTTPRange
|
||||
|
||||
AccessConditions *AccessConditions
|
||||
CPKInfo *CPKInfo
|
||||
CPKScopeInfo *CPKScopeInfo
|
||||
}
|
||||
|
||||
func (o *DownloadStreamOptions) format() (*generated.BlobClientDownloadOptions, *generated.LeaseAccessConditions, *generated.CPKInfo, *generated.ModifiedAccessConditions) {
|
||||
if o == nil {
|
||||
return nil, nil, nil, nil
|
||||
}
|
||||
|
||||
basics := generated.BlobClientDownloadOptions{
|
||||
RangeGetContentMD5: o.RangeGetContentMD5,
|
||||
Range: exported.FormatHTTPRange(o.Range),
|
||||
}
|
||||
|
||||
leaseAccessConditions, modifiedAccessConditions := exported.FormatBlobAccessConditions(o.AccessConditions)
|
||||
return &basics, leaseAccessConditions, o.CPKInfo, modifiedAccessConditions
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// downloadOptions contains common options used by the DownloadBuffer and DownloadFile functions.
|
||||
type downloadOptions struct {
|
||||
// Range specifies a range of bytes. The default value is all bytes.
|
||||
Range HTTPRange
|
||||
|
||||
// BlockSize specifies the block size to use for each parallel download; the default size is DefaultDownloadBlockSize.
|
||||
BlockSize int64
|
||||
|
||||
// Progress is a function that is invoked periodically as bytes are received.
|
||||
Progress func(bytesTransferred int64)
|
||||
|
||||
// BlobAccessConditions indicates the access conditions used when making HTTP GET requests against the blob.
|
||||
AccessConditions *AccessConditions
|
||||
|
||||
// ClientProvidedKeyOptions indicates the client provided key by name and/or by value to encrypt/decrypt data.
|
||||
CPKInfo *CPKInfo
|
||||
CPKScopeInfo *CPKScopeInfo
|
||||
|
||||
// Concurrency indicates the maximum number of blocks to download in parallel (0=default).
|
||||
Concurrency uint16
|
||||
|
||||
// RetryReaderOptionsPerBlock is used when downloading each block.
|
||||
RetryReaderOptionsPerBlock RetryReaderOptions
|
||||
}
|
||||
|
||||
func (o *downloadOptions) getBlobPropertiesOptions() *GetPropertiesOptions {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return &GetPropertiesOptions{
|
||||
AccessConditions: o.AccessConditions,
|
||||
CPKInfo: o.CPKInfo,
|
||||
}
|
||||
}
|
||||
|
||||
func (o *downloadOptions) getDownloadBlobOptions(rnge HTTPRange, rangeGetContentMD5 *bool) *DownloadStreamOptions {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return &DownloadStreamOptions{
|
||||
AccessConditions: o.AccessConditions,
|
||||
CPKInfo: o.CPKInfo,
|
||||
CPKScopeInfo: o.CPKScopeInfo,
|
||||
Range: rnge,
|
||||
RangeGetContentMD5: rangeGetContentMD5,
|
||||
}
|
||||
}
|
||||
|
||||
// DownloadBufferOptions contains the optional parameters for the DownloadBuffer method.
|
||||
type DownloadBufferOptions struct {
|
||||
// Range specifies a range of bytes. The default value is all bytes.
|
||||
Range HTTPRange
|
||||
|
||||
// BlockSize specifies the block size to use for each parallel download; the default size is DefaultDownloadBlockSize.
|
||||
BlockSize int64
|
||||
|
||||
// Progress is a function that is invoked periodically as bytes are received.
|
||||
Progress func(bytesTransferred int64)
|
||||
|
||||
// BlobAccessConditions indicates the access conditions used when making HTTP GET requests against the blob.
|
||||
AccessConditions *AccessConditions
|
||||
|
||||
// CPKInfo contains a group of parameters for client provided encryption key.
|
||||
CPKInfo *CPKInfo
|
||||
|
||||
// CPKScopeInfo contains a group of parameters for client provided encryption scope.
|
||||
CPKScopeInfo *CPKScopeInfo
|
||||
|
||||
// Concurrency indicates the maximum number of blocks to download in parallel (0=default).
|
||||
Concurrency uint16
|
||||
|
||||
// RetryReaderOptionsPerBlock is used when downloading each block.
|
||||
RetryReaderOptionsPerBlock RetryReaderOptions
|
||||
}
|
||||
|
||||
// DownloadFileOptions contains the optional parameters for the DownloadFile method.
|
||||
type DownloadFileOptions struct {
|
||||
// Range specifies a range of bytes. The default value is all bytes.
|
||||
Range HTTPRange
|
||||
|
||||
// BlockSize specifies the block size to use for each parallel download; the default size is DefaultDownloadBlockSize.
|
||||
BlockSize int64
|
||||
|
||||
// Progress is a function that is invoked periodically as bytes are received.
|
||||
Progress func(bytesTransferred int64)
|
||||
|
||||
// BlobAccessConditions indicates the access conditions used when making HTTP GET requests against the blob.
|
||||
AccessConditions *AccessConditions
|
||||
|
||||
// ClientProvidedKeyOptions indicates the client provided key by name and/or by value to encrypt/decrypt data.
|
||||
CPKInfo *CPKInfo
|
||||
CPKScopeInfo *CPKScopeInfo
|
||||
|
||||
// Concurrency indicates the maximum number of blocks to download in parallel. The default value is 5.
|
||||
Concurrency uint16
|
||||
|
||||
// RetryReaderOptionsPerBlock is used when downloading each block.
|
||||
RetryReaderOptionsPerBlock RetryReaderOptions
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// DeleteOptions contains the optional parameters for the Client.Delete method.
|
||||
type DeleteOptions struct {
|
||||
// Required if the blob has associated snapshots. Specify one of the following two options: include: Delete the base blob
|
||||
// and all of its snapshots. only: Delete only the blob's snapshots and not the blob itself.
|
||||
DeleteSnapshots *DeleteSnapshotsOptionType
|
||||
AccessConditions *AccessConditions
|
||||
// Setting DeleteType to DeleteTypePermanent will permanently delete soft-delete snapshot and/or version blobs.
|
||||
// WARNING: This is a dangerous operation and should not be used unless you know the implications. Please proceed
|
||||
// with caution.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/delete-blob
|
||||
BlobDeleteType *DeleteType
|
||||
}
|
||||
|
||||
func (o *DeleteOptions) format() (*generated.BlobClientDeleteOptions, *generated.LeaseAccessConditions, *generated.ModifiedAccessConditions) {
|
||||
if o == nil {
|
||||
return nil, nil, nil
|
||||
}
|
||||
|
||||
basics := generated.BlobClientDeleteOptions{
|
||||
DeleteSnapshots: o.DeleteSnapshots,
|
||||
DeleteType: o.BlobDeleteType, // None by default
|
||||
}
|
||||
|
||||
if o.AccessConditions == nil {
|
||||
return &basics, nil, nil
|
||||
}
|
||||
|
||||
return &basics, o.AccessConditions.LeaseAccessConditions, o.AccessConditions.ModifiedAccessConditions
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// UndeleteOptions contains the optional parameters for the Client.Undelete method.
|
||||
type UndeleteOptions struct {
|
||||
// placeholder for future options
|
||||
}
|
||||
|
||||
func (o *UndeleteOptions) format() *generated.BlobClientUndeleteOptions {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// SetTierOptions contains the optional parameters for the Client.SetTier method.
|
||||
type SetTierOptions struct {
|
||||
// Optional: Indicates the priority with which to rehydrate an archived blob.
|
||||
RehydratePriority *RehydratePriority
|
||||
|
||||
AccessConditions *AccessConditions
|
||||
}
|
||||
|
||||
func (o *SetTierOptions) format() (*generated.BlobClientSetTierOptions, *generated.LeaseAccessConditions, *generated.ModifiedAccessConditions) {
|
||||
if o == nil {
|
||||
return nil, nil, nil
|
||||
}
|
||||
|
||||
leaseAccessConditions, modifiedAccessConditions := exported.FormatBlobAccessConditions(o.AccessConditions)
|
||||
return &generated.BlobClientSetTierOptions{RehydratePriority: o.RehydratePriority}, leaseAccessConditions, modifiedAccessConditions
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// GetPropertiesOptions contains the optional parameters for the Client.GetProperties method
|
||||
type GetPropertiesOptions struct {
|
||||
AccessConditions *AccessConditions
|
||||
CPKInfo *CPKInfo
|
||||
}
|
||||
|
||||
func (o *GetPropertiesOptions) format() (*generated.BlobClientGetPropertiesOptions,
|
||||
*generated.LeaseAccessConditions, *generated.CPKInfo, *generated.ModifiedAccessConditions) {
|
||||
if o == nil {
|
||||
return nil, nil, nil, nil
|
||||
}
|
||||
|
||||
leaseAccessConditions, modifiedAccessConditions := exported.FormatBlobAccessConditions(o.AccessConditions)
|
||||
return nil, leaseAccessConditions, o.CPKInfo, modifiedAccessConditions
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// SetHTTPHeadersOptions contains the optional parameters for the Client.SetHTTPHeaders method.
|
||||
type SetHTTPHeadersOptions struct {
|
||||
AccessConditions *AccessConditions
|
||||
}
|
||||
|
||||
func (o *SetHTTPHeadersOptions) format() (*generated.BlobClientSetHTTPHeadersOptions, *generated.LeaseAccessConditions, *generated.ModifiedAccessConditions) {
|
||||
if o == nil {
|
||||
return nil, nil, nil
|
||||
}
|
||||
|
||||
leaseAccessConditions, modifiedAccessConditions := exported.FormatBlobAccessConditions(o.AccessConditions)
|
||||
return nil, leaseAccessConditions, modifiedAccessConditions
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// SetMetadataOptions provides set of configurations for Set Metadata on blob operation
|
||||
type SetMetadataOptions struct {
|
||||
AccessConditions *AccessConditions
|
||||
CPKInfo *CPKInfo
|
||||
CPKScopeInfo *CPKScopeInfo
|
||||
}
|
||||
|
||||
func (o *SetMetadataOptions) format() (*generated.LeaseAccessConditions, *CPKInfo,
|
||||
*CPKScopeInfo, *ModifiedAccessConditions) {
|
||||
if o == nil {
|
||||
return nil, nil, nil, nil
|
||||
}
|
||||
|
||||
leaseAccessConditions, modifiedAccessConditions := exported.FormatBlobAccessConditions(o.AccessConditions)
|
||||
return leaseAccessConditions, o.CPKInfo, o.CPKScopeInfo, modifiedAccessConditions
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// CreateSnapshotOptions contains the optional parameters for the Client.CreateSnapshot method.
|
||||
type CreateSnapshotOptions struct {
|
||||
Metadata map[string]*string
|
||||
AccessConditions *AccessConditions
|
||||
CPKInfo *CPKInfo
|
||||
CPKScopeInfo *CPKScopeInfo
|
||||
}
|
||||
|
||||
func (o *CreateSnapshotOptions) format() (*generated.BlobClientCreateSnapshotOptions, *generated.CPKInfo,
|
||||
*generated.CPKScopeInfo, *generated.ModifiedAccessConditions, *generated.LeaseAccessConditions) {
|
||||
if o == nil {
|
||||
return nil, nil, nil, nil, nil
|
||||
}
|
||||
|
||||
leaseAccessConditions, modifiedAccessConditions := exported.FormatBlobAccessConditions(o.AccessConditions)
|
||||
|
||||
return &generated.BlobClientCreateSnapshotOptions{
|
||||
Metadata: o.Metadata,
|
||||
}, o.CPKInfo, o.CPKScopeInfo, modifiedAccessConditions, leaseAccessConditions
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// StartCopyFromURLOptions contains the optional parameters for the Client.StartCopyFromURL method.
|
||||
type StartCopyFromURLOptions struct {
|
||||
// Specifies the date time when the blobs immutability policy is set to expire.
|
||||
ImmutabilityPolicyExpiry *time.Time
|
||||
// Specifies the immutability policy mode to set on the blob.
|
||||
ImmutabilityPolicyMode *ImmutabilityPolicySetting
|
||||
// Specified if a legal hold should be set on the blob.
|
||||
LegalHold *bool
|
||||
// Optional. Used to set blob tags in various blob operations.
|
||||
BlobTags map[string]string
|
||||
// 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.
|
||||
Metadata map[string]*string
|
||||
// Optional: Indicates the priority with which to rehydrate an archived blob.
|
||||
RehydratePriority *RehydratePriority
|
||||
// Overrides the sealed state of the destination blob. Service version 2019-12-12 and newer.
|
||||
SealBlob *bool
|
||||
// Optional. Indicates the tier to be set on the blob.
|
||||
Tier *AccessTier
|
||||
|
||||
SourceModifiedAccessConditions *SourceModifiedAccessConditions
|
||||
|
||||
AccessConditions *AccessConditions
|
||||
}
|
||||
|
||||
func (o *StartCopyFromURLOptions) format() (*generated.BlobClientStartCopyFromURLOptions,
|
||||
*generated.SourceModifiedAccessConditions, *generated.ModifiedAccessConditions, *generated.LeaseAccessConditions) {
|
||||
if o == nil {
|
||||
return nil, nil, nil, nil
|
||||
}
|
||||
|
||||
basics := generated.BlobClientStartCopyFromURLOptions{
|
||||
BlobTagsString: shared.SerializeBlobTagsToStrPtr(o.BlobTags),
|
||||
Metadata: o.Metadata,
|
||||
RehydratePriority: o.RehydratePriority,
|
||||
SealBlob: o.SealBlob,
|
||||
Tier: o.Tier,
|
||||
ImmutabilityPolicyExpiry: o.ImmutabilityPolicyExpiry,
|
||||
ImmutabilityPolicyMode: o.ImmutabilityPolicyMode,
|
||||
LegalHold: o.LegalHold,
|
||||
}
|
||||
|
||||
leaseAccessConditions, modifiedAccessConditions := exported.FormatBlobAccessConditions(o.AccessConditions)
|
||||
return &basics, o.SourceModifiedAccessConditions, modifiedAccessConditions, leaseAccessConditions
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// AbortCopyFromURLOptions contains the optional parameters for the Client.AbortCopyFromURL method.
|
||||
type AbortCopyFromURLOptions struct {
|
||||
LeaseAccessConditions *LeaseAccessConditions
|
||||
}
|
||||
|
||||
func (o *AbortCopyFromURLOptions) format() (*generated.BlobClientAbortCopyFromURLOptions, *generated.LeaseAccessConditions) {
|
||||
if o == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return nil, o.LeaseAccessConditions
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// SetTagsOptions contains the optional parameters for the Client.SetTags method.
|
||||
type SetTagsOptions struct {
|
||||
// The version id parameter is an opaque DateTime value that, when present,
|
||||
// specifies the version of the blob to operate on. It's for service version 2019-10-10 and newer.
|
||||
VersionID *string
|
||||
// Optional header, Specifies the transactional crc64 for the body, to be validated by the service.
|
||||
TransactionalContentCRC64 []byte
|
||||
// Optional header, Specifies the transactional md5 for the body, to be validated by the service.
|
||||
TransactionalContentMD5 []byte
|
||||
|
||||
AccessConditions *AccessConditions
|
||||
}
|
||||
|
||||
func (o *SetTagsOptions) format() (*generated.BlobClientSetTagsOptions, *ModifiedAccessConditions, *generated.LeaseAccessConditions) {
|
||||
if o == nil {
|
||||
return nil, nil, nil
|
||||
}
|
||||
|
||||
options := &generated.BlobClientSetTagsOptions{
|
||||
TransactionalContentMD5: o.TransactionalContentMD5,
|
||||
TransactionalContentCRC64: o.TransactionalContentCRC64,
|
||||
VersionID: o.VersionID,
|
||||
}
|
||||
|
||||
leaseAccessConditions, modifiedAccessConditions := exported.FormatBlobAccessConditions(o.AccessConditions)
|
||||
return options, modifiedAccessConditions, leaseAccessConditions
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// GetTagsOptions contains the optional parameters for the Client.GetTags method.
|
||||
type GetTagsOptions struct {
|
||||
// The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve.
|
||||
Snapshot *string
|
||||
// The version id parameter is an opaque DateTime value that, when present, specifies the version of the blob to operate on.
|
||||
// It's for service version 2019-10-10 and newer.
|
||||
VersionID *string
|
||||
|
||||
BlobAccessConditions *AccessConditions
|
||||
}
|
||||
|
||||
func (o *GetTagsOptions) format() (*generated.BlobClientGetTagsOptions, *generated.ModifiedAccessConditions, *generated.LeaseAccessConditions) {
|
||||
if o == nil {
|
||||
return nil, nil, nil
|
||||
}
|
||||
|
||||
options := &generated.BlobClientGetTagsOptions{
|
||||
Snapshot: o.Snapshot,
|
||||
VersionID: o.VersionID,
|
||||
}
|
||||
|
||||
leaseAccessConditions, modifiedAccessConditions := exported.FormatBlobAccessConditions(o.BlobAccessConditions)
|
||||
return options, modifiedAccessConditions, leaseAccessConditions
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// SetImmutabilityPolicyOptions contains the parameter for Client.SetImmutabilityPolicy
|
||||
type SetImmutabilityPolicyOptions struct {
|
||||
// Specifies the immutability policy mode to set on the blob. Possible values to set include: "Locked", "Unlocked".
|
||||
// "Mutable" can only be returned by service, don't set to "Mutable". If mode is not set - it will default to Unlocked.
|
||||
Mode *ImmutabilityPolicySetting
|
||||
ModifiedAccessConditions *ModifiedAccessConditions
|
||||
}
|
||||
|
||||
func (o *SetImmutabilityPolicyOptions) format() (*generated.BlobClientSetImmutabilityPolicyOptions, *ModifiedAccessConditions) {
|
||||
if o == nil {
|
||||
return &generated.BlobClientSetImmutabilityPolicyOptions{}, nil
|
||||
}
|
||||
ac := &exported.BlobAccessConditions{
|
||||
ModifiedAccessConditions: o.ModifiedAccessConditions,
|
||||
}
|
||||
_, modifiedAccessConditions := exported.FormatBlobAccessConditions(ac)
|
||||
|
||||
options := &generated.BlobClientSetImmutabilityPolicyOptions{
|
||||
ImmutabilityPolicyMode: o.Mode,
|
||||
}
|
||||
|
||||
return options, modifiedAccessConditions
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// DeleteImmutabilityPolicyOptions contains the optional parameters for the Client.DeleteImmutabilityPolicy method.
|
||||
type DeleteImmutabilityPolicyOptions struct {
|
||||
// placeholder for future options
|
||||
}
|
||||
|
||||
func (o *DeleteImmutabilityPolicyOptions) format() *generated.BlobClientDeleteImmutabilityPolicyOptions {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// SetLegalHoldOptions contains the optional parameters for the Client.SetLegalHold method.
|
||||
type SetLegalHoldOptions struct {
|
||||
// placeholder for future options
|
||||
}
|
||||
|
||||
func (o *SetLegalHoldOptions) format() *generated.BlobClientSetLegalHoldOptions {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// GetSASURLOptions contains the optional parameters for the Client.GetSASURL method.
|
||||
type GetSASURLOptions struct {
|
||||
StartTime *time.Time
|
||||
}
|
||||
|
||||
func (o *GetSASURLOptions) format() time.Time {
|
||||
if o == nil {
|
||||
return time.Time{}
|
||||
}
|
||||
|
||||
var st time.Time
|
||||
if o.StartTime != nil {
|
||||
st = o.StartTime.UTC()
|
||||
} else {
|
||||
st = time.Time{}
|
||||
}
|
||||
return st
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// CopyFromURLOptions contains the optional parameters for the Client.CopyFromURL method.
|
||||
type CopyFromURLOptions struct {
|
||||
// Optional. Used to set blob tags in various blob operations.
|
||||
BlobTags map[string]string
|
||||
// Only Bearer type is supported. Credentials should be a valid OAuth access token to copy source.
|
||||
CopySourceAuthorization *string
|
||||
// Specifies the date time when the blobs immutability policy is set to expire.
|
||||
ImmutabilityPolicyExpiry *time.Time
|
||||
// Specifies the immutability policy mode to set on the blob.
|
||||
ImmutabilityPolicyMode *ImmutabilityPolicySetting
|
||||
// Specified if a legal hold should be set on the blob.
|
||||
LegalHold *bool
|
||||
// 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.
|
||||
Metadata map[string]*string
|
||||
// Specify the md5 calculated for the range of bytes that must be read from the copy source.
|
||||
SourceContentMD5 []byte
|
||||
// Optional. Indicates the tier to be set on the blob.
|
||||
Tier *AccessTier
|
||||
|
||||
SourceModifiedAccessConditions *SourceModifiedAccessConditions
|
||||
|
||||
BlobAccessConditions *AccessConditions
|
||||
|
||||
CPKScopeInfo *CPKScopeInfo
|
||||
}
|
||||
|
||||
func (o *CopyFromURLOptions) format() (*generated.BlobClientCopyFromURLOptions, *generated.SourceModifiedAccessConditions, *generated.ModifiedAccessConditions, *generated.LeaseAccessConditions, *generated.CPKScopeInfo) {
|
||||
if o == nil {
|
||||
return nil, nil, nil, nil, nil
|
||||
}
|
||||
|
||||
options := &generated.BlobClientCopyFromURLOptions{
|
||||
BlobTagsString: shared.SerializeBlobTagsToStrPtr(o.BlobTags),
|
||||
CopySourceAuthorization: o.CopySourceAuthorization,
|
||||
ImmutabilityPolicyExpiry: o.ImmutabilityPolicyExpiry,
|
||||
ImmutabilityPolicyMode: o.ImmutabilityPolicyMode,
|
||||
LegalHold: o.LegalHold,
|
||||
Metadata: o.Metadata,
|
||||
SourceContentMD5: o.SourceContentMD5,
|
||||
Tier: o.Tier,
|
||||
}
|
||||
|
||||
leaseAccessConditions, modifiedAccessConditions := exported.FormatBlobAccessConditions(o.BlobAccessConditions)
|
||||
return options, o.SourceModifiedAccessConditions, modifiedAccessConditions, leaseAccessConditions, o.CPKScopeInfo
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// GetAccountInfoOptions provides set of options for Client.GetAccountInfo
|
||||
type GetAccountInfoOptions struct {
|
||||
// placeholder for future options
|
||||
}
|
||||
|
||||
func (o *GetAccountInfoOptions) format() *generated.BlobClientGetAccountInfoOptions {
|
||||
return nil
|
||||
}
|
119
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob/responses.go
сгенерированный
поставляемый
Normal file
119
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob/responses.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,119 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
package blob
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated"
|
||||
)
|
||||
|
||||
// DownloadResponse contains the response from method BlobClient.Download.
|
||||
type DownloadResponse = generated.BlobClientDownloadResponse
|
||||
|
||||
// DownloadStreamResponse contains the response from the DownloadStream method.
|
||||
// To read from the stream, read from the Body field, or call the NewRetryReader method.
|
||||
type DownloadStreamResponse struct {
|
||||
DownloadResponse
|
||||
ObjectReplicationRules []ObjectReplicationPolicy
|
||||
|
||||
client *Client
|
||||
getInfo httpGetterInfo
|
||||
cpkInfo *CPKInfo
|
||||
cpkScope *CPKScopeInfo
|
||||
}
|
||||
|
||||
// NewRetryReader constructs new RetryReader stream for reading data. If a connection fails while
|
||||
// reading, it will make additional requests to reestablish a connection and continue reading.
|
||||
// Pass nil for options to accept the default options.
|
||||
// Callers of this method should not access the DownloadStreamResponse.Body field.
|
||||
func (r *DownloadStreamResponse) NewRetryReader(ctx context.Context, options *RetryReaderOptions) *RetryReader {
|
||||
if options == nil {
|
||||
options = &RetryReaderOptions{}
|
||||
}
|
||||
|
||||
return newRetryReader(ctx, r.Body, r.getInfo, func(ctx context.Context, getInfo httpGetterInfo) (io.ReadCloser, error) {
|
||||
accessConditions := &AccessConditions{
|
||||
ModifiedAccessConditions: &ModifiedAccessConditions{IfMatch: getInfo.ETag},
|
||||
}
|
||||
options := DownloadStreamOptions{
|
||||
Range: getInfo.Range,
|
||||
AccessConditions: accessConditions,
|
||||
CPKInfo: r.cpkInfo,
|
||||
CPKScopeInfo: r.cpkScope,
|
||||
}
|
||||
resp, err := r.client.DownloadStream(ctx, &options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp.Body, err
|
||||
}, *options)
|
||||
}
|
||||
|
||||
// DeleteResponse contains the response from method BlobClient.Delete.
|
||||
type DeleteResponse = generated.BlobClientDeleteResponse
|
||||
|
||||
// UndeleteResponse contains the response from method BlobClient.Undelete.
|
||||
type UndeleteResponse = generated.BlobClientUndeleteResponse
|
||||
|
||||
// SetTierResponse contains the response from method BlobClient.SetTier.
|
||||
type SetTierResponse = generated.BlobClientSetTierResponse
|
||||
|
||||
// GetPropertiesResponse contains the response from method BlobClient.GetProperties.
|
||||
type GetPropertiesResponse = generated.BlobClientGetPropertiesResponse
|
||||
|
||||
// SetHTTPHeadersResponse contains the response from method BlobClient.SetHTTPHeaders.
|
||||
type SetHTTPHeadersResponse = generated.BlobClientSetHTTPHeadersResponse
|
||||
|
||||
// SetMetadataResponse contains the response from method BlobClient.SetMetadata.
|
||||
type SetMetadataResponse = generated.BlobClientSetMetadataResponse
|
||||
|
||||
// CreateSnapshotResponse contains the response from method BlobClient.CreateSnapshot.
|
||||
type CreateSnapshotResponse = generated.BlobClientCreateSnapshotResponse
|
||||
|
||||
// StartCopyFromURLResponse contains the response from method BlobClient.StartCopyFromURL.
|
||||
type StartCopyFromURLResponse = generated.BlobClientStartCopyFromURLResponse
|
||||
|
||||
// AbortCopyFromURLResponse contains the response from method BlobClient.AbortCopyFromURL.
|
||||
type AbortCopyFromURLResponse = generated.BlobClientAbortCopyFromURLResponse
|
||||
|
||||
// SetTagsResponse contains the response from method BlobClient.SetTags.
|
||||
type SetTagsResponse = generated.BlobClientSetTagsResponse
|
||||
|
||||
// GetTagsResponse contains the response from method BlobClient.GetTags.
|
||||
type GetTagsResponse = generated.BlobClientGetTagsResponse
|
||||
|
||||
// SetImmutabilityPolicyResponse contains the response from method BlobClient.SetImmutabilityPolicy.
|
||||
type SetImmutabilityPolicyResponse = generated.BlobClientSetImmutabilityPolicyResponse
|
||||
|
||||
// DeleteImmutabilityPolicyResponse contains the response from method BlobClient.DeleteImmutabilityPolicyResponse.
|
||||
type DeleteImmutabilityPolicyResponse = generated.BlobClientDeleteImmutabilityPolicyResponse
|
||||
|
||||
// SetLegalHoldResponse contains the response from method BlobClient.SetLegalHold.
|
||||
type SetLegalHoldResponse = generated.BlobClientSetLegalHoldResponse
|
||||
|
||||
// CopyFromURLResponse contains the response from method BlobClient.CopyFromURL.
|
||||
type CopyFromURLResponse = generated.BlobClientCopyFromURLResponse
|
||||
|
||||
// GetAccountInfoResponse contains the response from method BlobClient.GetAccountInfo.
|
||||
type GetAccountInfoResponse = generated.BlobClientGetAccountInfoResponse
|
||||
|
||||
// AcquireLeaseResponse contains the response from method BlobClient.AcquireLease.
|
||||
type AcquireLeaseResponse = generated.BlobClientAcquireLeaseResponse
|
||||
|
||||
// BreakLeaseResponse contains the response from method BlobClient.BreakLease.
|
||||
type BreakLeaseResponse = generated.BlobClientBreakLeaseResponse
|
||||
|
||||
// ChangeLeaseResponse contains the response from method BlobClient.ChangeLease.
|
||||
type ChangeLeaseResponse = generated.BlobClientChangeLeaseResponse
|
||||
|
||||
// ReleaseLeaseResponse contains the response from method BlobClient.ReleaseLease.
|
||||
type ReleaseLeaseResponse = generated.BlobClientReleaseLeaseResponse
|
||||
|
||||
// RenewLeaseResponse contains the response from method BlobClient.RenewLease.
|
||||
type RenewLeaseResponse = generated.BlobClientRenewLeaseResponse
|
192
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob/retry_reader.go
сгенерированный
поставляемый
Normal file
192
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob/retry_reader.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,192 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
package blob
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
)
|
||||
|
||||
// HTTPGetter is a function type that refers to a method that performs an HTTP GET operation.
|
||||
type httpGetter func(ctx context.Context, i httpGetterInfo) (io.ReadCloser, error)
|
||||
|
||||
// HTTPGetterInfo is passed to an HTTPGetter function passing it parameters
|
||||
// that should be used to make an HTTP GET request.
|
||||
type httpGetterInfo struct {
|
||||
Range HTTPRange
|
||||
|
||||
// ETag specifies the resource's etag that should be used when creating
|
||||
// the HTTP GET request's If-Match header
|
||||
ETag *azcore.ETag
|
||||
}
|
||||
|
||||
// RetryReaderOptions configures the retry reader's behavior.
|
||||
// Zero-value fields will have their specified default values applied during use.
|
||||
// This allows for modification of a subset of fields.
|
||||
type RetryReaderOptions struct {
|
||||
// MaxRetries specifies the maximum number of attempts a failed read will be retried
|
||||
// before producing an error.
|
||||
// The default value is three.
|
||||
MaxRetries int32
|
||||
|
||||
// OnFailedRead, when non-nil, is called after any failure to read. Expected usage is diagnostic logging.
|
||||
OnFailedRead func(failureCount int32, lastError error, rnge HTTPRange, willRetry bool)
|
||||
|
||||
// EarlyCloseAsError can be set to true to prevent retries after "read on closed response body". By default,
|
||||
// retryReader has the following special behaviour: closing the response body before it is all read is treated as a
|
||||
// retryable error. This is to allow callers to force a retry by closing the body from another goroutine (e.g. if the =
|
||||
// read is too slow, caller may want to force a retry in the hope that the retry will be quicker). If
|
||||
// TreatEarlyCloseAsError is true, then retryReader's special behaviour is suppressed, and "read on closed body" is instead
|
||||
// treated as a fatal (non-retryable) error.
|
||||
// Note that setting TreatEarlyCloseAsError only guarantees that Closing will produce a fatal error if the Close happens
|
||||
// from the same "thread" (goroutine) as Read. Concurrent Close calls from other goroutines may instead produce network errors
|
||||
// which will be retried.
|
||||
// The default value is false.
|
||||
EarlyCloseAsError bool
|
||||
|
||||
doInjectError bool
|
||||
doInjectErrorRound int32
|
||||
injectedError error
|
||||
}
|
||||
|
||||
// RetryReader attempts to read from response, and if there is a retry-able network error
|
||||
// returned during reading, it will retry according to retry reader option through executing
|
||||
// user defined action with provided data to get a new response, and continue the overall reading process
|
||||
// through reading from the new response.
|
||||
// RetryReader implements the io.ReadCloser interface.
|
||||
type RetryReader struct {
|
||||
ctx context.Context
|
||||
info httpGetterInfo
|
||||
retryReaderOptions RetryReaderOptions
|
||||
getter httpGetter
|
||||
countWasBounded bool
|
||||
|
||||
// we support Close-ing during Reads (from other goroutines), so we protect the shared state, which is response
|
||||
responseMu *sync.Mutex
|
||||
response io.ReadCloser
|
||||
}
|
||||
|
||||
// newRetryReader creates a retry reader.
|
||||
func newRetryReader(ctx context.Context, initialResponse io.ReadCloser, info httpGetterInfo, getter httpGetter, o RetryReaderOptions) *RetryReader {
|
||||
if o.MaxRetries < 1 {
|
||||
o.MaxRetries = 3
|
||||
}
|
||||
return &RetryReader{
|
||||
ctx: ctx,
|
||||
getter: getter,
|
||||
info: info,
|
||||
countWasBounded: info.Range.Count != CountToEnd,
|
||||
response: initialResponse,
|
||||
responseMu: &sync.Mutex{},
|
||||
retryReaderOptions: o,
|
||||
}
|
||||
}
|
||||
|
||||
// setResponse function
|
||||
func (s *RetryReader) setResponse(r io.ReadCloser) {
|
||||
s.responseMu.Lock()
|
||||
defer s.responseMu.Unlock()
|
||||
s.response = r
|
||||
}
|
||||
|
||||
// Read from retry reader
|
||||
func (s *RetryReader) Read(p []byte) (n int, err error) {
|
||||
for try := int32(0); ; try++ {
|
||||
//fmt.Println(try) // Comment out for debugging.
|
||||
if s.countWasBounded && s.info.Range.Count == CountToEnd {
|
||||
// User specified an original count and the remaining bytes are 0, return 0, EOF
|
||||
return 0, io.EOF
|
||||
}
|
||||
|
||||
s.responseMu.Lock()
|
||||
resp := s.response
|
||||
s.responseMu.Unlock()
|
||||
if resp == nil { // We don't have a response stream to read from, try to get one.
|
||||
newResponse, err := s.getter(s.ctx, s.info)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
// Successful GET; this is the network stream we'll read from.
|
||||
s.setResponse(newResponse)
|
||||
resp = newResponse
|
||||
}
|
||||
n, err := resp.Read(p) // Read from the stream (this will return non-nil err if forceRetry is called, from another goroutine, while it is running)
|
||||
|
||||
// Injection mechanism for testing.
|
||||
if s.retryReaderOptions.doInjectError && try == s.retryReaderOptions.doInjectErrorRound {
|
||||
if s.retryReaderOptions.injectedError != nil {
|
||||
err = s.retryReaderOptions.injectedError
|
||||
} else {
|
||||
err = &net.DNSError{IsTemporary: true}
|
||||
}
|
||||
}
|
||||
|
||||
// We successfully read data or end EOF.
|
||||
if err == nil || err == io.EOF {
|
||||
s.info.Range.Offset += int64(n) // Increments the start offset in case we need to make a new HTTP request in the future
|
||||
if s.info.Range.Count != CountToEnd {
|
||||
s.info.Range.Count -= int64(n) // Decrement the count in case we need to make a new HTTP request in the future
|
||||
}
|
||||
return n, err // Return the return to the caller
|
||||
}
|
||||
_ = s.Close()
|
||||
|
||||
s.setResponse(nil) // Our stream is no longer good
|
||||
|
||||
// Check the retry count and error code, and decide whether to retry.
|
||||
retriesExhausted := try >= s.retryReaderOptions.MaxRetries
|
||||
_, isNetError := err.(net.Error)
|
||||
isUnexpectedEOF := err == io.ErrUnexpectedEOF
|
||||
willRetry := (isNetError || isUnexpectedEOF || s.wasRetryableEarlyClose(err)) && !retriesExhausted
|
||||
|
||||
// Notify, for logging purposes, of any failures
|
||||
if s.retryReaderOptions.OnFailedRead != nil {
|
||||
failureCount := try + 1 // because try is zero-based
|
||||
s.retryReaderOptions.OnFailedRead(failureCount, err, s.info.Range, willRetry)
|
||||
}
|
||||
|
||||
if willRetry {
|
||||
continue
|
||||
// Loop around and try to get and read from new stream.
|
||||
}
|
||||
return n, err // Not retryable, or retries exhausted, so just return
|
||||
}
|
||||
}
|
||||
|
||||
// By default, we allow early Closing, from another concurrent goroutine, to be used to force a retry
|
||||
// Is this safe, to close early from another goroutine? Early close ultimately ends up calling
|
||||
// net.Conn.Close, and that is documented as "Any blocked Read or Write operations will be unblocked and return errors"
|
||||
// which is exactly the behaviour we want.
|
||||
// NOTE: that if caller has forced an early Close from a separate goroutine (separate from the Read)
|
||||
// then there are two different types of error that may happen - either the one we check for here,
|
||||
// or a net.Error (due to closure of connection). Which one happens depends on timing. We only need this routine
|
||||
// to check for one, since the other is a net.Error, which our main Read retry loop is already handing.
|
||||
func (s *RetryReader) wasRetryableEarlyClose(err error) bool {
|
||||
if s.retryReaderOptions.EarlyCloseAsError {
|
||||
return false // user wants all early closes to be errors, and so not retryable
|
||||
}
|
||||
// unfortunately, http.errReadOnClosedResBody is private, so the best we can do here is to check for its text
|
||||
return strings.HasSuffix(err.Error(), ReadOnClosedBodyMessage)
|
||||
}
|
||||
|
||||
// ReadOnClosedBodyMessage of retry reader
|
||||
const ReadOnClosedBodyMessage = "read on closed response body"
|
||||
|
||||
// Close retry reader
|
||||
func (s *RetryReader) Close() error {
|
||||
s.responseMu.Lock()
|
||||
defer s.responseMu.Unlock()
|
||||
if s.response != nil {
|
||||
return s.response.Close()
|
||||
}
|
||||
return nil
|
||||
}
|
79
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob/utils.go
сгенерированный
поставляемый
Normal file
79
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob/utils.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,79 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
package blob
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/sas"
|
||||
)
|
||||
|
||||
// ObjectReplicationRules struct
|
||||
type ObjectReplicationRules struct {
|
||||
RuleID string
|
||||
Status string
|
||||
}
|
||||
|
||||
// ObjectReplicationPolicy are deserialized attributes.
|
||||
type ObjectReplicationPolicy struct {
|
||||
PolicyID *string
|
||||
Rules *[]ObjectReplicationRules
|
||||
}
|
||||
|
||||
// deserializeORSPolicies is utility function to deserialize ORS Policies.
|
||||
func deserializeORSPolicies(policies map[string]*string) (objectReplicationPolicies []ObjectReplicationPolicy) {
|
||||
if policies == nil {
|
||||
return nil
|
||||
}
|
||||
// For source blobs (blobs that have policy ids and rule ids applied to them),
|
||||
// the header will be formatted as "x-ms-or-<policy_id>_<rule_id>: {Complete, Failed}".
|
||||
// The value of this header is the status of the replication.
|
||||
orPolicyStatusHeader := make(map[string]*string)
|
||||
for key, value := range policies {
|
||||
if strings.Contains(key, "or-") && key != "x-ms-or-policy-id" {
|
||||
orPolicyStatusHeader[key] = value
|
||||
}
|
||||
}
|
||||
|
||||
parsedResult := make(map[string][]ObjectReplicationRules)
|
||||
for key, value := range orPolicyStatusHeader {
|
||||
policyAndRuleIDs := strings.Split(strings.Split(key, "or-")[1], "_")
|
||||
policyId, ruleId := policyAndRuleIDs[0], policyAndRuleIDs[1]
|
||||
|
||||
parsedResult[policyId] = append(parsedResult[policyId], ObjectReplicationRules{RuleID: ruleId, Status: *value})
|
||||
}
|
||||
|
||||
for policyId, rules := range parsedResult {
|
||||
objectReplicationPolicies = append(objectReplicationPolicies, ObjectReplicationPolicy{
|
||||
PolicyID: &policyId,
|
||||
Rules: &rules,
|
||||
})
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// ParseHTTPHeaders parses GetPropertiesResponse and returns HTTPHeaders.
|
||||
func ParseHTTPHeaders(resp GetPropertiesResponse) HTTPHeaders {
|
||||
return HTTPHeaders{
|
||||
BlobContentType: resp.ContentType,
|
||||
BlobContentEncoding: resp.ContentEncoding,
|
||||
BlobContentLanguage: resp.ContentLanguage,
|
||||
BlobContentDisposition: resp.ContentDisposition,
|
||||
BlobCacheControl: resp.CacheControl,
|
||||
BlobContentMD5: resp.ContentMD5,
|
||||
}
|
||||
}
|
||||
|
||||
// URLParts object represents the components that make up an Azure Storage Container/Blob URL.
|
||||
// NOTE: Changing any SAS-related field requires computing a new SAS signature.
|
||||
type URLParts = sas.URLParts
|
||||
|
||||
// ParseURL parses a URL initializing URLParts' fields including any SAS-related & snapshot query parameters. Any other
|
||||
// query parameters remain in the UnparsedParams field. This method overwrites all fields in the URLParts object.
|
||||
func ParseURL(u string) (URLParts, error) {
|
||||
return sas.ParseURL(u)
|
||||
}
|
159
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/bloberror/error_codes.go
сгенерированный
поставляемый
Normal file
159
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/bloberror/error_codes.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,159 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
package bloberror
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated"
|
||||
)
|
||||
|
||||
// HasCode returns true if the provided error is an *azcore.ResponseError
|
||||
// with its ErrorCode field equal to one of the specified Codes.
|
||||
func HasCode(err error, codes ...Code) bool {
|
||||
var respErr *azcore.ResponseError
|
||||
if !errors.As(err, &respErr) {
|
||||
return false
|
||||
}
|
||||
|
||||
for _, code := range codes {
|
||||
if respErr.ErrorCode == string(code) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// Code - Error codes returned by the service
|
||||
type Code = generated.StorageErrorCode
|
||||
|
||||
const (
|
||||
AccountAlreadyExists Code = "AccountAlreadyExists"
|
||||
AccountBeingCreated Code = "AccountBeingCreated"
|
||||
AccountIsDisabled Code = "AccountIsDisabled"
|
||||
AppendPositionConditionNotMet Code = "AppendPositionConditionNotMet"
|
||||
AuthenticationFailed Code = "AuthenticationFailed"
|
||||
AuthorizationFailure Code = "AuthorizationFailure"
|
||||
AuthorizationPermissionMismatch Code = "AuthorizationPermissionMismatch"
|
||||
AuthorizationProtocolMismatch Code = "AuthorizationProtocolMismatch"
|
||||
AuthorizationResourceTypeMismatch Code = "AuthorizationResourceTypeMismatch"
|
||||
AuthorizationServiceMismatch Code = "AuthorizationServiceMismatch"
|
||||
AuthorizationSourceIPMismatch Code = "AuthorizationSourceIPMismatch"
|
||||
BlobAlreadyExists Code = "BlobAlreadyExists"
|
||||
BlobArchived Code = "BlobArchived"
|
||||
BlobBeingRehydrated Code = "BlobBeingRehydrated"
|
||||
BlobImmutableDueToPolicy Code = "BlobImmutableDueToPolicy"
|
||||
BlobNotArchived Code = "BlobNotArchived"
|
||||
BlobNotFound Code = "BlobNotFound"
|
||||
BlobOverwritten Code = "BlobOverwritten"
|
||||
BlobTierInadequateForContentLength Code = "BlobTierInadequateForContentLength"
|
||||
BlobUsesCustomerSpecifiedEncryption Code = "BlobUsesCustomerSpecifiedEncryption"
|
||||
BlockCountExceedsLimit Code = "BlockCountExceedsLimit"
|
||||
BlockListTooLong Code = "BlockListTooLong"
|
||||
CannotChangeToLowerTier Code = "CannotChangeToLowerTier"
|
||||
CannotVerifyCopySource Code = "CannotVerifyCopySource"
|
||||
ConditionHeadersNotSupported Code = "ConditionHeadersNotSupported"
|
||||
ConditionNotMet Code = "ConditionNotMet"
|
||||
ContainerAlreadyExists Code = "ContainerAlreadyExists"
|
||||
ContainerBeingDeleted Code = "ContainerBeingDeleted"
|
||||
ContainerDisabled Code = "ContainerDisabled"
|
||||
ContainerNotFound Code = "ContainerNotFound"
|
||||
ContentLengthLargerThanTierLimit Code = "ContentLengthLargerThanTierLimit"
|
||||
CopyAcrossAccountsNotSupported Code = "CopyAcrossAccountsNotSupported"
|
||||
CopyIDMismatch Code = "CopyIdMismatch"
|
||||
EmptyMetadataKey Code = "EmptyMetadataKey"
|
||||
FeatureVersionMismatch Code = "FeatureVersionMismatch"
|
||||
ImmutabilityPolicyDeleteOnLockedPolicy Code = "ImmutabilityPolicyDeleteOnLockedPolicy"
|
||||
IncrementalCopyBlobMismatch Code = "IncrementalCopyBlobMismatch"
|
||||
IncrementalCopyOfEralierVersionSnapshotNotAllowed Code = "IncrementalCopyOfEralierVersionSnapshotNotAllowed"
|
||||
IncrementalCopySourceMustBeSnapshot Code = "IncrementalCopySourceMustBeSnapshot"
|
||||
InfiniteLeaseDurationRequired Code = "InfiniteLeaseDurationRequired"
|
||||
InsufficientAccountPermissions Code = "InsufficientAccountPermissions"
|
||||
InternalError Code = "InternalError"
|
||||
InvalidAuthenticationInfo Code = "InvalidAuthenticationInfo"
|
||||
InvalidBlobOrBlock Code = "InvalidBlobOrBlock"
|
||||
InvalidBlobTier Code = "InvalidBlobTier"
|
||||
InvalidBlobType Code = "InvalidBlobType"
|
||||
InvalidBlockID Code = "InvalidBlockId"
|
||||
InvalidBlockList Code = "InvalidBlockList"
|
||||
InvalidHTTPVerb Code = "InvalidHttpVerb"
|
||||
InvalidHeaderValue Code = "InvalidHeaderValue"
|
||||
InvalidInput Code = "InvalidInput"
|
||||
InvalidMD5 Code = "InvalidMd5"
|
||||
InvalidMetadata Code = "InvalidMetadata"
|
||||
InvalidOperation Code = "InvalidOperation"
|
||||
InvalidPageRange Code = "InvalidPageRange"
|
||||
InvalidQueryParameterValue Code = "InvalidQueryParameterValue"
|
||||
InvalidRange Code = "InvalidRange"
|
||||
InvalidResourceName Code = "InvalidResourceName"
|
||||
InvalidSourceBlobType Code = "InvalidSourceBlobType"
|
||||
InvalidSourceBlobURL Code = "InvalidSourceBlobUrl"
|
||||
InvalidURI Code = "InvalidUri"
|
||||
InvalidVersionForPageBlobOperation Code = "InvalidVersionForPageBlobOperation"
|
||||
InvalidXMLDocument Code = "InvalidXmlDocument"
|
||||
InvalidXMLNodeValue Code = "InvalidXmlNodeValue"
|
||||
LeaseAlreadyBroken Code = "LeaseAlreadyBroken"
|
||||
LeaseAlreadyPresent Code = "LeaseAlreadyPresent"
|
||||
LeaseIDMismatchWithBlobOperation Code = "LeaseIdMismatchWithBlobOperation"
|
||||
LeaseIDMismatchWithContainerOperation Code = "LeaseIdMismatchWithContainerOperation"
|
||||
LeaseIDMismatchWithLeaseOperation Code = "LeaseIdMismatchWithLeaseOperation"
|
||||
LeaseIDMissing Code = "LeaseIdMissing"
|
||||
LeaseIsBreakingAndCannotBeAcquired Code = "LeaseIsBreakingAndCannotBeAcquired"
|
||||
LeaseIsBreakingAndCannotBeChanged Code = "LeaseIsBreakingAndCannotBeChanged"
|
||||
LeaseIsBrokenAndCannotBeRenewed Code = "LeaseIsBrokenAndCannotBeRenewed"
|
||||
LeaseLost Code = "LeaseLost"
|
||||
LeaseNotPresentWithBlobOperation Code = "LeaseNotPresentWithBlobOperation"
|
||||
LeaseNotPresentWithContainerOperation Code = "LeaseNotPresentWithContainerOperation"
|
||||
LeaseNotPresentWithLeaseOperation Code = "LeaseNotPresentWithLeaseOperation"
|
||||
MD5Mismatch Code = "Md5Mismatch"
|
||||
CRC64Mismatch Code = "Crc64Mismatch"
|
||||
MaxBlobSizeConditionNotMet Code = "MaxBlobSizeConditionNotMet"
|
||||
MetadataTooLarge Code = "MetadataTooLarge"
|
||||
MissingContentLengthHeader Code = "MissingContentLengthHeader"
|
||||
MissingRequiredHeader Code = "MissingRequiredHeader"
|
||||
MissingRequiredQueryParameter Code = "MissingRequiredQueryParameter"
|
||||
MissingRequiredXMLNode Code = "MissingRequiredXmlNode"
|
||||
MultipleConditionHeadersNotSupported Code = "MultipleConditionHeadersNotSupported"
|
||||
NoAuthenticationInformation Code = "NoAuthenticationInformation"
|
||||
NoPendingCopyOperation Code = "NoPendingCopyOperation"
|
||||
OperationNotAllowedOnIncrementalCopyBlob Code = "OperationNotAllowedOnIncrementalCopyBlob"
|
||||
OperationNotAllowedOnRootBlob Code = "OperationNotAllowedOnRootBlob"
|
||||
OperationTimedOut Code = "OperationTimedOut"
|
||||
OutOfRangeInput Code = "OutOfRangeInput"
|
||||
OutOfRangeQueryParameterValue Code = "OutOfRangeQueryParameterValue"
|
||||
PendingCopyOperation Code = "PendingCopyOperation"
|
||||
PreviousSnapshotCannotBeNewer Code = "PreviousSnapshotCannotBeNewer"
|
||||
PreviousSnapshotNotFound Code = "PreviousSnapshotNotFound"
|
||||
PreviousSnapshotOperationNotSupported Code = "PreviousSnapshotOperationNotSupported"
|
||||
RequestBodyTooLarge Code = "RequestBodyTooLarge"
|
||||
RequestURLFailedToParse Code = "RequestUrlFailedToParse"
|
||||
ResourceAlreadyExists Code = "ResourceAlreadyExists"
|
||||
ResourceNotFound Code = "ResourceNotFound"
|
||||
ResourceTypeMismatch Code = "ResourceTypeMismatch"
|
||||
SequenceNumberConditionNotMet Code = "SequenceNumberConditionNotMet"
|
||||
SequenceNumberIncrementTooLarge Code = "SequenceNumberIncrementTooLarge"
|
||||
ServerBusy Code = "ServerBusy"
|
||||
SnapshotCountExceeded Code = "SnapshotCountExceeded"
|
||||
SnapshotOperationRateExceeded Code = "SnapshotOperationRateExceeded"
|
||||
SnapshotsPresent Code = "SnapshotsPresent"
|
||||
SourceConditionNotMet Code = "SourceConditionNotMet"
|
||||
SystemInUse Code = "SystemInUse"
|
||||
TargetConditionNotMet Code = "TargetConditionNotMet"
|
||||
UnauthorizedBlobOverwrite Code = "UnauthorizedBlobOverwrite"
|
||||
UnsupportedHTTPVerb Code = "UnsupportedHttpVerb"
|
||||
UnsupportedHeader Code = "UnsupportedHeader"
|
||||
UnsupportedQueryParameter Code = "UnsupportedQueryParameter"
|
||||
UnsupportedXMLNode Code = "UnsupportedXmlNode"
|
||||
)
|
||||
|
||||
var (
|
||||
// MissingSharedKeyCredential - Error is returned when SAS URL is being created without SharedKeyCredential.
|
||||
MissingSharedKeyCredential = errors.New("SAS can only be signed with a SharedKeyCredential")
|
||||
UnsupportedChecksum = errors.New("for multi-part uploads, user generated checksums cannot be validated")
|
||||
)
|
249
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blockblob/chunkwriting.go
сгенерированный
поставляемый
Normal file
249
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blockblob/chunkwriting.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,249 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
package blockblob
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"io"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/streaming"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/internal/uuid"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/shared"
|
||||
)
|
||||
|
||||
// blockWriter provides methods to upload blocks that represent a file to a server and commit them.
|
||||
// This allows us to provide a local implementation that fakes the server for hermetic testing.
|
||||
type blockWriter interface {
|
||||
StageBlock(context.Context, string, io.ReadSeekCloser, *StageBlockOptions) (StageBlockResponse, error)
|
||||
Upload(context.Context, io.ReadSeekCloser, *UploadOptions) (UploadResponse, error)
|
||||
CommitBlockList(context.Context, []string, *CommitBlockListOptions) (CommitBlockListResponse, error)
|
||||
}
|
||||
|
||||
// copyFromReader copies a source io.Reader to blob storage using concurrent uploads.
|
||||
func copyFromReader[T ~[]byte](ctx context.Context, src io.Reader, dst blockWriter, options UploadStreamOptions, getBufferManager func(maxBuffers int, bufferSize int64) shared.BufferManager[T]) (CommitBlockListResponse, error) {
|
||||
options.setDefaults()
|
||||
|
||||
wg := sync.WaitGroup{} // Used to know when all outgoing blocks have finished processing
|
||||
errCh := make(chan error, 1) // contains the first error encountered during processing
|
||||
|
||||
buffers := getBufferManager(options.Concurrency, options.BlockSize)
|
||||
defer buffers.Free()
|
||||
|
||||
// this controls the lifetime of the uploading goroutines.
|
||||
// if an error is encountered, cancel() is called which will terminate all uploads.
|
||||
// NOTE: the ordering is important here. cancel MUST execute before
|
||||
// cleaning up the buffers so that any uploading goroutines exit first,
|
||||
// releasing their buffers back to the pool for cleanup.
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
|
||||
// all blocks have IDs that start with a random UUID
|
||||
blockIDPrefix, err := uuid.New()
|
||||
if err != nil {
|
||||
return CommitBlockListResponse{}, err
|
||||
}
|
||||
tracker := blockTracker{
|
||||
blockIDPrefix: blockIDPrefix,
|
||||
options: options,
|
||||
}
|
||||
|
||||
// This goroutine grabs a buffer, reads from the stream into the buffer,
|
||||
// then creates a goroutine to upload/stage the block.
|
||||
for blockNum := uint32(0); true; blockNum++ {
|
||||
var buffer T
|
||||
select {
|
||||
case buffer = <-buffers.Acquire():
|
||||
// got a buffer
|
||||
default:
|
||||
// no buffer available; allocate a new buffer if possible
|
||||
if _, err := buffers.Grow(); err != nil {
|
||||
return CommitBlockListResponse{}, err
|
||||
}
|
||||
|
||||
// either grab the newly allocated buffer or wait for one to become available
|
||||
buffer = <-buffers.Acquire()
|
||||
}
|
||||
|
||||
var n int
|
||||
n, err = shared.ReadAtLeast(src, buffer, len(buffer))
|
||||
|
||||
if n > 0 {
|
||||
// some data was read, upload it
|
||||
wg.Add(1) // We're posting a buffer to be sent
|
||||
|
||||
// NOTE: we must pass blockNum as an arg to our goroutine else
|
||||
// it's captured by reference and can change underneath us!
|
||||
go func(blockNum uint32) {
|
||||
// Upload the outgoing block, matching the number of bytes read
|
||||
err := tracker.uploadBlock(ctx, dst, blockNum, buffer[:n])
|
||||
if err != nil {
|
||||
select {
|
||||
case errCh <- err:
|
||||
// error was set
|
||||
default:
|
||||
// some other error is already set
|
||||
}
|
||||
cancel()
|
||||
}
|
||||
buffers.Release(buffer) // The goroutine reading from the stream can reuse this buffer now
|
||||
|
||||
// signal that the block has been staged.
|
||||
// we MUST do this after attempting to write to errCh
|
||||
// to avoid it racing with the reading goroutine.
|
||||
wg.Done()
|
||||
}(blockNum)
|
||||
} else {
|
||||
// nothing was read so the buffer is empty, send it back for reuse/clean-up.
|
||||
buffers.Release(buffer)
|
||||
}
|
||||
|
||||
if err != nil { // The reader is done, no more outgoing buffers
|
||||
if errors.Is(err, io.EOF) {
|
||||
// these are expected errors, we don't surface those
|
||||
err = nil
|
||||
} else {
|
||||
// some other error happened, terminate any outstanding uploads
|
||||
cancel()
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
wg.Wait() // Wait for all outgoing blocks to complete
|
||||
|
||||
if err != nil {
|
||||
// there was an error reading from src, favor this error over any error during staging
|
||||
return CommitBlockListResponse{}, err
|
||||
}
|
||||
|
||||
select {
|
||||
case err = <-errCh:
|
||||
// there was an error during staging
|
||||
return CommitBlockListResponse{}, err
|
||||
default:
|
||||
// no error was encountered
|
||||
}
|
||||
|
||||
// If no error, after all blocks uploaded, commit them to the blob & return the result
|
||||
return tracker.commitBlocks(ctx, dst)
|
||||
}
|
||||
|
||||
// used to manage the uploading and committing of blocks
|
||||
type blockTracker struct {
|
||||
blockIDPrefix uuid.UUID // UUID used with all blockIDs
|
||||
maxBlockNum uint32 // defaults to 0
|
||||
firstBlock []byte // Used only if maxBlockNum is 0
|
||||
options UploadStreamOptions
|
||||
}
|
||||
|
||||
func (bt *blockTracker) uploadBlock(ctx context.Context, to blockWriter, num uint32, buffer []byte) error {
|
||||
if num == 0 {
|
||||
bt.firstBlock = buffer
|
||||
|
||||
// If whole payload fits in 1 block, don't stage it; End will upload it with 1 I/O operation
|
||||
// If the payload is exactly the same size as the buffer, there may be more content coming in.
|
||||
if len(buffer) < int(bt.options.BlockSize) {
|
||||
return nil
|
||||
}
|
||||
} else {
|
||||
// Else, upload a staged block...
|
||||
atomicMorphUint32(&bt.maxBlockNum, func(startVal uint32) (val uint32, morphResult uint32) {
|
||||
// Atomically remember (in t.numBlocks) the maximum block num we've ever seen
|
||||
if startVal < num {
|
||||
return num, 0
|
||||
}
|
||||
return startVal, 0
|
||||
})
|
||||
}
|
||||
|
||||
blockID := newUUIDBlockID(bt.blockIDPrefix).WithBlockNumber(num).ToBase64()
|
||||
_, err := to.StageBlock(ctx, blockID, streaming.NopCloser(bytes.NewReader(buffer)), bt.options.getStageBlockOptions())
|
||||
return err
|
||||
}
|
||||
|
||||
func (bt *blockTracker) commitBlocks(ctx context.Context, to blockWriter) (CommitBlockListResponse, error) {
|
||||
// If the first block had the exact same size as the buffer
|
||||
// we would have staged it as a block thinking that there might be more data coming
|
||||
if bt.maxBlockNum == 0 && len(bt.firstBlock) < int(bt.options.BlockSize) {
|
||||
// If whole payload fits in 1 block (block #0), upload it with 1 I/O operation
|
||||
up, err := to.Upload(ctx, streaming.NopCloser(bytes.NewReader(bt.firstBlock)), bt.options.getUploadOptions())
|
||||
if err != nil {
|
||||
return CommitBlockListResponse{}, err
|
||||
}
|
||||
|
||||
// convert UploadResponse to CommitBlockListResponse
|
||||
return CommitBlockListResponse{
|
||||
ClientRequestID: up.ClientRequestID,
|
||||
ContentMD5: up.ContentMD5,
|
||||
Date: up.Date,
|
||||
ETag: up.ETag,
|
||||
EncryptionKeySHA256: up.EncryptionKeySHA256,
|
||||
EncryptionScope: up.EncryptionScope,
|
||||
IsServerEncrypted: up.IsServerEncrypted,
|
||||
LastModified: up.LastModified,
|
||||
RequestID: up.RequestID,
|
||||
Version: up.Version,
|
||||
VersionID: up.VersionID,
|
||||
//ContentCRC64: up.ContentCRC64, doesn't exist on UploadResponse
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Multiple blocks staged, commit them all now
|
||||
blockID := newUUIDBlockID(bt.blockIDPrefix)
|
||||
blockIDs := make([]string, bt.maxBlockNum+1)
|
||||
for bn := uint32(0); bn < bt.maxBlockNum+1; bn++ {
|
||||
blockIDs[bn] = blockID.WithBlockNumber(bn).ToBase64()
|
||||
}
|
||||
|
||||
return to.CommitBlockList(ctx, blockIDs, bt.options.getCommitBlockListOptions())
|
||||
}
|
||||
|
||||
// AtomicMorpherUint32 identifies a method passed to and invoked by the AtomicMorph function.
|
||||
// The AtomicMorpher callback is passed a startValue and based on this value it returns
|
||||
// what the new value should be and the result that AtomicMorph should return to its caller.
|
||||
type atomicMorpherUint32 func(startVal uint32) (val uint32, morphResult uint32)
|
||||
|
||||
// AtomicMorph atomically morphs target in to new value (and result) as indicated bythe AtomicMorpher callback function.
|
||||
func atomicMorphUint32(target *uint32, morpher atomicMorpherUint32) uint32 {
|
||||
for {
|
||||
currentVal := atomic.LoadUint32(target)
|
||||
desiredVal, morphResult := morpher(currentVal)
|
||||
if atomic.CompareAndSwapUint32(target, currentVal, desiredVal) {
|
||||
return morphResult
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
type blockID [64]byte
|
||||
|
||||
func (blockID blockID) ToBase64() string {
|
||||
return base64.StdEncoding.EncodeToString(blockID[:])
|
||||
}
|
||||
|
||||
type uuidBlockID blockID
|
||||
|
||||
func newUUIDBlockID(u uuid.UUID) uuidBlockID {
|
||||
ubi := uuidBlockID{} // Create a new uuidBlockID
|
||||
copy(ubi[:len(u)], u[:]) // Copy the specified UUID into it
|
||||
// Block number defaults to 0
|
||||
return ubi
|
||||
}
|
||||
|
||||
func (ubi uuidBlockID) WithBlockNumber(blockNumber uint32) uuidBlockID {
|
||||
binary.BigEndian.PutUint32(ubi[len(uuid.UUID{}):], blockNumber) // Put block number after UUID
|
||||
return ubi // Return the passed-in copy
|
||||
}
|
||||
|
||||
func (ubi uuidBlockID) ToBase64() string {
|
||||
return blockID(ubi).ToBase64()
|
||||
}
|
597
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blockblob/client.go
сгенерированный
поставляемый
Normal file
597
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blockblob/client.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,597 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
package blockblob
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"errors"
|
||||
"io"
|
||||
"math"
|
||||
"os"
|
||||
"reflect"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/streaming"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/internal/log"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/internal/uuid"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/bloberror"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/base"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/exported"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/shared"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/sas"
|
||||
)
|
||||
|
||||
// ClientOptions contains the optional parameters when creating a Client.
|
||||
type ClientOptions base.ClientOptions
|
||||
|
||||
// Client defines a set of operations applicable to block blobs.
|
||||
type Client base.CompositeClient[generated.BlobClient, generated.BlockBlobClient]
|
||||
|
||||
// NewClient creates an instance of Client with the specified values.
|
||||
// - blobURL - the URL of the blob e.g. https://<account>.blob.core.windows.net/container/blob.txt
|
||||
// - cred - an Azure AD credential, typically obtained via the azidentity module
|
||||
// - options - client options; pass nil to accept the default values
|
||||
func NewClient(blobURL string, cred azcore.TokenCredential, options *ClientOptions) (*Client, error) {
|
||||
audience := base.GetAudience((*base.ClientOptions)(options))
|
||||
conOptions := shared.GetClientOptions(options)
|
||||
authPolicy := shared.NewStorageChallengePolicy(cred, audience, conOptions.InsecureAllowCredentialWithHTTP)
|
||||
plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}}
|
||||
|
||||
azClient, err := azcore.NewClient(exported.ModuleName, exported.ModuleVersion, plOpts, &conOptions.ClientOptions)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return (*Client)(base.NewBlockBlobClient(blobURL, azClient, nil)), nil
|
||||
}
|
||||
|
||||
// NewClientWithNoCredential creates an instance of Client with the specified values.
|
||||
// This is used to anonymously access a blob or with a shared access signature (SAS) token.
|
||||
// - blobURL - the URL of the blob e.g. https://<account>.blob.core.windows.net/container/blob.txt?<sas token>
|
||||
// - options - client options; pass nil to accept the default values
|
||||
func NewClientWithNoCredential(blobURL string, options *ClientOptions) (*Client, error) {
|
||||
conOptions := shared.GetClientOptions(options)
|
||||
|
||||
azClient, err := azcore.NewClient(exported.ModuleName, exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return (*Client)(base.NewBlockBlobClient(blobURL, azClient, nil)), nil
|
||||
}
|
||||
|
||||
// NewClientWithSharedKeyCredential creates an instance of Client with the specified values.
|
||||
// - blobURL - the URL of the blob e.g. https://<account>.blob.core.windows.net/container/blob.txt
|
||||
// - cred - a SharedKeyCredential created with the matching blob's storage account and access key
|
||||
// - options - client options; pass nil to accept the default values
|
||||
func NewClientWithSharedKeyCredential(blobURL string, cred *blob.SharedKeyCredential, options *ClientOptions) (*Client, error) {
|
||||
authPolicy := exported.NewSharedKeyCredPolicy(cred)
|
||||
conOptions := shared.GetClientOptions(options)
|
||||
plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}}
|
||||
|
||||
azClient, err := azcore.NewClient(exported.ModuleName, exported.ModuleVersion, plOpts, &conOptions.ClientOptions)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return (*Client)(base.NewBlockBlobClient(blobURL, azClient, cred)), nil
|
||||
}
|
||||
|
||||
// NewClientFromConnectionString creates an instance of Client with the specified values.
|
||||
// - connectionString - a connection string for the desired storage account
|
||||
// - containerName - the name of the container within the storage account
|
||||
// - blobName - the name of the blob within the container
|
||||
// - options - client options; pass nil to accept the default values
|
||||
func NewClientFromConnectionString(connectionString, containerName, blobName string, options *ClientOptions) (*Client, error) {
|
||||
parsed, err := shared.ParseConnectionString(connectionString)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
parsed.ServiceURL = runtime.JoinPaths(parsed.ServiceURL, containerName, blobName)
|
||||
|
||||
if parsed.AccountKey != "" && parsed.AccountName != "" {
|
||||
credential, err := exported.NewSharedKeyCredential(parsed.AccountName, parsed.AccountKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return NewClientWithSharedKeyCredential(parsed.ServiceURL, credential, options)
|
||||
}
|
||||
|
||||
return NewClientWithNoCredential(parsed.ServiceURL, options)
|
||||
}
|
||||
|
||||
func (bb *Client) sharedKey() *blob.SharedKeyCredential {
|
||||
return base.SharedKeyComposite((*base.CompositeClient[generated.BlobClient, generated.BlockBlobClient])(bb))
|
||||
}
|
||||
|
||||
func (bb *Client) generated() *generated.BlockBlobClient {
|
||||
_, blockBlob := base.InnerClients((*base.CompositeClient[generated.BlobClient, generated.BlockBlobClient])(bb))
|
||||
return blockBlob
|
||||
}
|
||||
|
||||
func (bb *Client) innerBlobGenerated() *generated.BlobClient {
|
||||
b := bb.BlobClient()
|
||||
return base.InnerClient((*base.Client[generated.BlobClient])(b))
|
||||
}
|
||||
|
||||
// URL returns the URL endpoint used by the Client object.
|
||||
func (bb *Client) URL() string {
|
||||
return bb.generated().Endpoint()
|
||||
}
|
||||
|
||||
// BlobClient returns the embedded blob client for this BlockBlob client.
|
||||
func (bb *Client) BlobClient() *blob.Client {
|
||||
blobClient, _ := base.InnerClients((*base.CompositeClient[generated.BlobClient, generated.BlockBlobClient])(bb))
|
||||
return (*blob.Client)(blobClient)
|
||||
}
|
||||
|
||||
// WithSnapshot creates a new Client object identical to the source but with the specified snapshot timestamp.
|
||||
// Pass "" to remove the snapshot returning a URL to the base blob.
|
||||
func (bb *Client) WithSnapshot(snapshot string) (*Client, error) {
|
||||
p, err := blob.ParseURL(bb.URL())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
p.Snapshot = snapshot
|
||||
|
||||
return (*Client)(base.NewBlockBlobClient(p.String(), bb.generated().Internal(), bb.sharedKey())), nil
|
||||
}
|
||||
|
||||
// WithVersionID creates a new AppendBlobURL object identical to the source but with the specified version id.
|
||||
// Pass "" to remove the versionID returning a URL to the base blob.
|
||||
func (bb *Client) WithVersionID(versionID string) (*Client, error) {
|
||||
p, err := blob.ParseURL(bb.URL())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
p.VersionID = versionID
|
||||
|
||||
return (*Client)(base.NewBlockBlobClient(p.String(), bb.generated().Internal(), bb.sharedKey())), nil
|
||||
}
|
||||
|
||||
// Upload creates a new block blob or overwrites an existing block blob.
|
||||
// Updating an existing block blob overwrites any existing metadata on the blob. Partial updates are not
|
||||
// supported with Upload; the content of the existing blob is overwritten with the new content. To
|
||||
// perform a partial update of a block blob, use StageBlock and CommitBlockList.
|
||||
// This method panics if the stream is not at position 0.
|
||||
// Note that the http client closes the body stream after the request is sent to the service.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/put-blob.
|
||||
func (bb *Client) Upload(ctx context.Context, body io.ReadSeekCloser, options *UploadOptions) (UploadResponse, error) {
|
||||
count, err := shared.ValidateSeekableStreamAt0AndGetCount(body)
|
||||
if err != nil {
|
||||
return UploadResponse{}, err
|
||||
}
|
||||
|
||||
opts, httpHeaders, leaseInfo, cpkV, cpkN, accessConditions := options.format()
|
||||
|
||||
if options != nil && options.TransactionalValidation != nil {
|
||||
body, err = options.TransactionalValidation.Apply(body, opts)
|
||||
if err != nil {
|
||||
return UploadResponse{}, err
|
||||
}
|
||||
}
|
||||
|
||||
resp, err := bb.generated().Upload(ctx, count, body, opts, httpHeaders, leaseInfo, cpkV, cpkN, accessConditions)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// UploadBlobFromURL - The Put Blob from URL operation creates a new Block Blob where the contents of the blob are read from
|
||||
// a given URL. Partial updates are not supported with Put Blob from URL; the content of an existing blob is overwritten
|
||||
// with the content of the new blob. To perform partial updates to a block blob’s contents using a source URL, use the Put
|
||||
// Block from URL API in conjunction with Put Block List.
|
||||
// For more information, see https://learn.microsoft.com/rest/api/storageservices/put-blob-from-url
|
||||
func (bb *Client) UploadBlobFromURL(ctx context.Context, copySource string, options *UploadBlobFromURLOptions) (UploadBlobFromURLResponse, error) {
|
||||
opts, httpHeaders, leaseAccessConditions, cpkInfo, cpkSourceInfo, modifiedAccessConditions, sourceModifiedConditions := options.format()
|
||||
|
||||
resp, err := bb.generated().PutBlobFromURL(ctx, int64(0), copySource, opts, httpHeaders, leaseAccessConditions, cpkInfo, cpkSourceInfo, modifiedAccessConditions, sourceModifiedConditions)
|
||||
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// StageBlock uploads the specified block to the block blob's "staging area" to be later committed by a call to CommitBlockList.
|
||||
// Note that the http client closes the body stream after the request is sent to the service.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/put-block.
|
||||
func (bb *Client) StageBlock(ctx context.Context, base64BlockID string, body io.ReadSeekCloser, options *StageBlockOptions) (StageBlockResponse, error) {
|
||||
count, err := shared.ValidateSeekableStreamAt0AndGetCount(body)
|
||||
if err != nil {
|
||||
return StageBlockResponse{}, err
|
||||
}
|
||||
|
||||
opts, leaseAccessConditions, cpkInfo, cpkScopeInfo := options.format()
|
||||
|
||||
if options != nil && options.TransactionalValidation != nil {
|
||||
body, err = options.TransactionalValidation.Apply(body, opts)
|
||||
if err != nil {
|
||||
return StageBlockResponse{}, nil
|
||||
}
|
||||
}
|
||||
|
||||
resp, err := bb.generated().StageBlock(ctx, base64BlockID, count, body, opts, leaseAccessConditions, cpkInfo, cpkScopeInfo)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// StageBlockFromURL copies the specified block from a source URL to the block blob's "staging area" to be later committed by a call to CommitBlockList.
|
||||
// If count is CountToEnd (0), then data is read from specified offset to the end.
|
||||
// For more information, see https://docs.microsoft.com/en-us/rest/api/storageservices/put-block-from-url.
|
||||
func (bb *Client) StageBlockFromURL(ctx context.Context, base64BlockID string, sourceURL string, options *StageBlockFromURLOptions) (StageBlockFromURLResponse, error) {
|
||||
|
||||
stageBlockFromURLOptions, cpkInfo, cpkScopeInfo, leaseAccessConditions, sourceModifiedAccessConditions := options.format()
|
||||
|
||||
resp, err := bb.generated().StageBlockFromURL(ctx, base64BlockID, 0, sourceURL, stageBlockFromURLOptions,
|
||||
cpkInfo, cpkScopeInfo, leaseAccessConditions, sourceModifiedAccessConditions)
|
||||
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// CommitBlockList writes a blob by specifying the list of block IDs that make up the blob.
|
||||
// In order to be written as part of a blob, a block must have been successfully written
|
||||
// to the server in a prior PutBlock operation. You can call PutBlockList to update a blob
|
||||
// by uploading only those blocks that have changed, then committing the new and existing
|
||||
// blocks together. Any blocks not specified in the block list and permanently deleted.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/put-block-list.
|
||||
func (bb *Client) CommitBlockList(ctx context.Context, base64BlockIDs []string, options *CommitBlockListOptions) (CommitBlockListResponse, error) {
|
||||
// this is a code smell in the generated code
|
||||
blockIds := make([]*string, len(base64BlockIDs))
|
||||
for k, v := range base64BlockIDs {
|
||||
blockIds[k] = to.Ptr(v)
|
||||
}
|
||||
|
||||
blockLookupList := generated.BlockLookupList{Latest: blockIds}
|
||||
|
||||
var commitOptions *generated.BlockBlobClientCommitBlockListOptions
|
||||
var headers *generated.BlobHTTPHeaders
|
||||
var leaseAccess *blob.LeaseAccessConditions
|
||||
var cpkInfo *generated.CPKInfo
|
||||
var cpkScope *generated.CPKScopeInfo
|
||||
var modifiedAccess *generated.ModifiedAccessConditions
|
||||
|
||||
if options != nil {
|
||||
commitOptions = &generated.BlockBlobClientCommitBlockListOptions{
|
||||
BlobTagsString: shared.SerializeBlobTagsToStrPtr(options.Tags),
|
||||
Metadata: options.Metadata,
|
||||
RequestID: options.RequestID,
|
||||
Tier: options.Tier,
|
||||
Timeout: options.Timeout,
|
||||
TransactionalContentCRC64: options.TransactionalContentCRC64,
|
||||
TransactionalContentMD5: options.TransactionalContentMD5,
|
||||
LegalHold: options.LegalHold,
|
||||
ImmutabilityPolicyMode: options.ImmutabilityPolicyMode,
|
||||
ImmutabilityPolicyExpiry: options.ImmutabilityPolicyExpiryTime,
|
||||
}
|
||||
|
||||
// If user attempts to pass in their own checksum, errors out.
|
||||
if options.TransactionalContentMD5 != nil || options.TransactionalContentCRC64 != nil {
|
||||
return CommitBlockListResponse{}, bloberror.UnsupportedChecksum
|
||||
}
|
||||
|
||||
headers = options.HTTPHeaders
|
||||
leaseAccess, modifiedAccess = exported.FormatBlobAccessConditions(options.AccessConditions)
|
||||
cpkInfo = options.CPKInfo
|
||||
cpkScope = options.CPKScopeInfo
|
||||
}
|
||||
|
||||
resp, err := bb.generated().CommitBlockList(ctx, blockLookupList, commitOptions, headers, leaseAccess, cpkInfo, cpkScope, modifiedAccess)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// GetBlockList returns the list of blocks that have been uploaded as part of a block blob using the specified block list filter.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/get-block-list.
|
||||
func (bb *Client) GetBlockList(ctx context.Context, listType BlockListType, options *GetBlockListOptions) (GetBlockListResponse, error) {
|
||||
o, lac, mac := options.format()
|
||||
|
||||
resp, err := bb.generated().GetBlockList(ctx, listType, o, lac, mac)
|
||||
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// Redeclared APIs ----- Copy over to Append blob and Page blob as well.
|
||||
|
||||
// Delete marks the specified blob or snapshot for deletion. The blob is later deleted during garbage collection.
|
||||
// Note that deleting a blob also deletes all its snapshots.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/delete-blob.
|
||||
func (bb *Client) Delete(ctx context.Context, o *blob.DeleteOptions) (blob.DeleteResponse, error) {
|
||||
return bb.BlobClient().Delete(ctx, o)
|
||||
}
|
||||
|
||||
// Undelete restores the contents and metadata of a soft-deleted blob and any associated soft-deleted snapshots.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/undelete-blob.
|
||||
func (bb *Client) Undelete(ctx context.Context, o *blob.UndeleteOptions) (blob.UndeleteResponse, error) {
|
||||
return bb.BlobClient().Undelete(ctx, o)
|
||||
}
|
||||
|
||||
// SetImmutabilityPolicy operation enables users to set the immutability policy on a blob.
|
||||
// https://learn.microsoft.com/en-us/azure/storage/blobs/immutable-storage-overview
|
||||
func (bb *Client) SetImmutabilityPolicy(ctx context.Context, expiryTime time.Time, options *blob.SetImmutabilityPolicyOptions) (blob.SetImmutabilityPolicyResponse, error) {
|
||||
return bb.BlobClient().SetImmutabilityPolicy(ctx, expiryTime, options)
|
||||
}
|
||||
|
||||
// DeleteImmutabilityPolicy operation enables users to delete the immutability policy on a blob.
|
||||
// https://learn.microsoft.com/en-us/azure/storage/blobs/immutable-storage-overview
|
||||
func (bb *Client) DeleteImmutabilityPolicy(ctx context.Context, options *blob.DeleteImmutabilityPolicyOptions) (blob.DeleteImmutabilityPolicyResponse, error) {
|
||||
return bb.BlobClient().DeleteImmutabilityPolicy(ctx, options)
|
||||
}
|
||||
|
||||
// SetLegalHold operation enables users to set legal hold on a blob.
|
||||
// https://learn.microsoft.com/en-us/azure/storage/blobs/immutable-storage-overview
|
||||
func (bb *Client) SetLegalHold(ctx context.Context, legalHold bool, options *blob.SetLegalHoldOptions) (blob.SetLegalHoldResponse, error) {
|
||||
return bb.BlobClient().SetLegalHold(ctx, legalHold, options)
|
||||
}
|
||||
|
||||
// SetTier operation sets the tier on a blob. The operation is allowed on a page
|
||||
// blob in a premium storage account and on a block blob in a blob storage account (locally
|
||||
// redundant storage only). A premium page blob's tier determines the allowed size, IOPs, and
|
||||
// bandwidth of the blob. A block blob's tier determines Hot/Cool/Archive storage type. This operation
|
||||
// does not update the blob's ETag.
|
||||
// For detailed information about block blob level tiering see https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blob-storage-tiers.
|
||||
func (bb *Client) SetTier(ctx context.Context, tier blob.AccessTier, o *blob.SetTierOptions) (blob.SetTierResponse, error) {
|
||||
return bb.BlobClient().SetTier(ctx, tier, o)
|
||||
}
|
||||
|
||||
// SetExpiry operation sets an expiry time on an existing blob. This operation is only allowed on Hierarchical Namespace enabled accounts.
|
||||
// For more information, see https://learn.microsoft.com/en-us/rest/api/storageservices/set-blob-expiry
|
||||
func (bb *Client) SetExpiry(ctx context.Context, expiryType ExpiryType, o *SetExpiryOptions) (SetExpiryResponse, error) {
|
||||
if expiryType == nil {
|
||||
expiryType = ExpiryTypeNever{}
|
||||
}
|
||||
et, opts := expiryType.Format(o)
|
||||
resp, err := bb.innerBlobGenerated().SetExpiry(ctx, et, opts)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// GetProperties returns the blob's properties.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/get-blob-properties.
|
||||
func (bb *Client) GetProperties(ctx context.Context, o *blob.GetPropertiesOptions) (blob.GetPropertiesResponse, error) {
|
||||
return bb.BlobClient().GetProperties(ctx, o)
|
||||
}
|
||||
|
||||
// GetAccountInfo provides account level information
|
||||
// For more information, see https://learn.microsoft.com/en-us/rest/api/storageservices/get-account-information?tabs=shared-access-signatures.
|
||||
func (bb *Client) GetAccountInfo(ctx context.Context, o *blob.GetAccountInfoOptions) (blob.GetAccountInfoResponse, error) {
|
||||
return bb.BlobClient().GetAccountInfo(ctx, o)
|
||||
}
|
||||
|
||||
// SetHTTPHeaders changes a blob's HTTP headers.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/set-blob-properties.
|
||||
func (bb *Client) SetHTTPHeaders(ctx context.Context, HTTPHeaders blob.HTTPHeaders, o *blob.SetHTTPHeadersOptions) (blob.SetHTTPHeadersResponse, error) {
|
||||
return bb.BlobClient().SetHTTPHeaders(ctx, HTTPHeaders, o)
|
||||
}
|
||||
|
||||
// SetMetadata changes a blob's metadata.
|
||||
// https://docs.microsoft.com/rest/api/storageservices/set-blob-metadata.
|
||||
func (bb *Client) SetMetadata(ctx context.Context, metadata map[string]*string, o *blob.SetMetadataOptions) (blob.SetMetadataResponse, error) {
|
||||
return bb.BlobClient().SetMetadata(ctx, metadata, o)
|
||||
}
|
||||
|
||||
// CreateSnapshot creates a read-only snapshot of a blob.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/snapshot-blob.
|
||||
func (bb *Client) CreateSnapshot(ctx context.Context, o *blob.CreateSnapshotOptions) (blob.CreateSnapshotResponse, error) {
|
||||
return bb.BlobClient().CreateSnapshot(ctx, o)
|
||||
}
|
||||
|
||||
// StartCopyFromURL copies the data at the source URL to a blob.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/copy-blob.
|
||||
func (bb *Client) StartCopyFromURL(ctx context.Context, copySource string, o *blob.StartCopyFromURLOptions) (blob.StartCopyFromURLResponse, error) {
|
||||
return bb.BlobClient().StartCopyFromURL(ctx, copySource, o)
|
||||
}
|
||||
|
||||
// AbortCopyFromURL stops a pending copy that was previously started and leaves a destination blob with 0 length and metadata.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/abort-copy-blob.
|
||||
func (bb *Client) AbortCopyFromURL(ctx context.Context, copyID string, o *blob.AbortCopyFromURLOptions) (blob.AbortCopyFromURLResponse, error) {
|
||||
return bb.BlobClient().AbortCopyFromURL(ctx, copyID, o)
|
||||
}
|
||||
|
||||
// SetTags operation enables users to set tags on a blob or specific blob version, but not snapshot.
|
||||
// Each call to this operation replaces all existing tags attached to the blob.
|
||||
// To remove all tags from the blob, call this operation with no tags set.
|
||||
// https://docs.microsoft.com/en-us/rest/api/storageservices/set-blob-tags
|
||||
func (bb *Client) SetTags(ctx context.Context, tags map[string]string, o *blob.SetTagsOptions) (blob.SetTagsResponse, error) {
|
||||
return bb.BlobClient().SetTags(ctx, tags, o)
|
||||
}
|
||||
|
||||
// GetTags operation enables users to get tags on a blob or specific blob version, or snapshot.
|
||||
// https://docs.microsoft.com/en-us/rest/api/storageservices/get-blob-tags
|
||||
func (bb *Client) GetTags(ctx context.Context, o *blob.GetTagsOptions) (blob.GetTagsResponse, error) {
|
||||
return bb.BlobClient().GetTags(ctx, o)
|
||||
}
|
||||
|
||||
// CopyFromURL synchronously copies the data at the source URL to a block blob, with sizes up to 256 MB.
|
||||
// For more information, see https://docs.microsoft.com/en-us/rest/api/storageservices/copy-blob-from-url.
|
||||
func (bb *Client) CopyFromURL(ctx context.Context, copySource string, o *blob.CopyFromURLOptions) (blob.CopyFromURLResponse, error) {
|
||||
return bb.BlobClient().CopyFromURL(ctx, copySource, o)
|
||||
}
|
||||
|
||||
// GetSASURL is a convenience method for generating a SAS token for the currently pointed at block blob.
|
||||
// It can only be used if the credential supplied during creation was a SharedKeyCredential.
|
||||
func (bb *Client) GetSASURL(permissions sas.BlobPermissions, expiry time.Time, o *blob.GetSASURLOptions) (string, error) {
|
||||
return bb.BlobClient().GetSASURL(permissions, expiry, o)
|
||||
}
|
||||
|
||||
// Concurrent Upload Functions -----------------------------------------------------------------------------------------
|
||||
|
||||
// uploadFromReader uploads a buffer in blocks to a block blob.
|
||||
func (bb *Client) uploadFromReader(ctx context.Context, reader io.ReaderAt, actualSize int64, o *uploadFromReaderOptions) (uploadFromReaderResponse, error) {
|
||||
if o.BlockSize == 0 {
|
||||
// If bufferSize > (MaxStageBlockBytes * MaxBlocks), then error
|
||||
if actualSize > MaxStageBlockBytes*MaxBlocks {
|
||||
return uploadFromReaderResponse{}, errors.New("buffer is too large to upload to a block blob")
|
||||
}
|
||||
// If bufferSize <= MaxUploadBlobBytes, then Upload should be used with just 1 I/O request
|
||||
if actualSize <= MaxUploadBlobBytes {
|
||||
o.BlockSize = MaxUploadBlobBytes // Default if unspecified
|
||||
} else {
|
||||
o.BlockSize = int64(math.Ceil(float64(actualSize) / MaxBlocks)) // ceil(buffer / max blocks) = block size to use all 50,000 blocks
|
||||
if o.BlockSize < blob.DefaultDownloadBlockSize { // If the block size is smaller than 4MB, round up to 4MB
|
||||
o.BlockSize = blob.DefaultDownloadBlockSize
|
||||
}
|
||||
// StageBlock will be called with blockSize blocks and a Concurrency of (BufferSize / BlockSize).
|
||||
}
|
||||
}
|
||||
|
||||
if actualSize <= MaxUploadBlobBytes {
|
||||
// If the size can fit in 1 Upload call, do it this way
|
||||
var body io.ReadSeeker = io.NewSectionReader(reader, 0, actualSize)
|
||||
if o.Progress != nil {
|
||||
body = streaming.NewRequestProgress(shared.NopCloser(body), o.Progress)
|
||||
}
|
||||
|
||||
uploadBlockBlobOptions := o.getUploadBlockBlobOptions()
|
||||
resp, err := bb.Upload(ctx, shared.NopCloser(body), uploadBlockBlobOptions)
|
||||
|
||||
return toUploadReaderAtResponseFromUploadResponse(resp), err
|
||||
}
|
||||
|
||||
var numBlocks = uint16(((actualSize - 1) / o.BlockSize) + 1)
|
||||
if numBlocks > MaxBlocks {
|
||||
// prevent any math bugs from attempting to upload too many blocks which will always fail
|
||||
return uploadFromReaderResponse{}, errors.New("block limit exceeded")
|
||||
}
|
||||
|
||||
if log.Should(exported.EventUpload) {
|
||||
urlparts, err := blob.ParseURL(bb.generated().Endpoint())
|
||||
if err == nil {
|
||||
log.Writef(exported.EventUpload, "blob name %s actual size %v block-size %v block-count %v",
|
||||
urlparts.BlobName, actualSize, o.BlockSize, numBlocks)
|
||||
}
|
||||
}
|
||||
|
||||
blockIDList := make([]string, numBlocks) // Base-64 encoded block IDs
|
||||
progress := int64(0)
|
||||
progressLock := &sync.Mutex{}
|
||||
|
||||
err := shared.DoBatchTransfer(ctx, &shared.BatchTransferOptions{
|
||||
OperationName: "uploadFromReader",
|
||||
TransferSize: actualSize,
|
||||
ChunkSize: o.BlockSize,
|
||||
NumChunks: uint64(((actualSize - 1) / o.BlockSize) + 1),
|
||||
Concurrency: o.Concurrency,
|
||||
Operation: func(ctx context.Context, offset int64, chunkSize int64) error {
|
||||
// This function is called once per block.
|
||||
// It is passed this block's offset within the buffer and its count of bytes
|
||||
// Prepare to read the proper block/section of the buffer
|
||||
if chunkSize < o.BlockSize {
|
||||
// this is the last block. its actual size might be less
|
||||
// than the calculated size due to rounding up of the payload
|
||||
// size to fit in a whole number of blocks.
|
||||
chunkSize = (actualSize - offset)
|
||||
}
|
||||
var body io.ReadSeeker = io.NewSectionReader(reader, offset, chunkSize)
|
||||
blockNum := offset / o.BlockSize
|
||||
if o.Progress != nil {
|
||||
blockProgress := int64(0)
|
||||
body = streaming.NewRequestProgress(shared.NopCloser(body),
|
||||
func(bytesTransferred int64) {
|
||||
diff := bytesTransferred - blockProgress
|
||||
blockProgress = bytesTransferred
|
||||
progressLock.Lock() // 1 goroutine at a time gets progress report
|
||||
progress += diff
|
||||
o.Progress(progress)
|
||||
progressLock.Unlock()
|
||||
})
|
||||
}
|
||||
|
||||
// Block IDs are unique values to avoid issue if 2+ clients are uploading blocks
|
||||
// at the same time causing PutBlockList to get a mix of blocks from all the clients.
|
||||
generatedUuid, err := uuid.New()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
blockIDList[blockNum] = base64.StdEncoding.EncodeToString([]byte(generatedUuid.String()))
|
||||
stageBlockOptions := o.getStageBlockOptions()
|
||||
_, err = bb.StageBlock(ctx, blockIDList[blockNum], shared.NopCloser(body), stageBlockOptions)
|
||||
return err
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
return uploadFromReaderResponse{}, err
|
||||
}
|
||||
// All put blocks were successful, call Put Block List to finalize the blob
|
||||
commitBlockListOptions := o.getCommitBlockListOptions()
|
||||
resp, err := bb.CommitBlockList(ctx, blockIDList, commitBlockListOptions)
|
||||
|
||||
return toUploadReaderAtResponseFromCommitBlockListResponse(resp), err
|
||||
}
|
||||
|
||||
// UploadBuffer uploads a buffer in blocks to a block blob.
|
||||
func (bb *Client) UploadBuffer(ctx context.Context, buffer []byte, o *UploadBufferOptions) (UploadBufferResponse, error) {
|
||||
uploadOptions := uploadFromReaderOptions{}
|
||||
if o != nil {
|
||||
uploadOptions = *o
|
||||
}
|
||||
|
||||
// If user attempts to pass in their own checksum, errors out.
|
||||
if uploadOptions.TransactionalValidation != nil && reflect.TypeOf(uploadOptions.TransactionalValidation).Kind() != reflect.Func {
|
||||
return UploadBufferResponse{}, bloberror.UnsupportedChecksum
|
||||
}
|
||||
|
||||
return bb.uploadFromReader(ctx, bytes.NewReader(buffer), int64(len(buffer)), &uploadOptions)
|
||||
}
|
||||
|
||||
// UploadFile uploads a file in blocks to a block blob.
|
||||
func (bb *Client) UploadFile(ctx context.Context, file *os.File, o *UploadFileOptions) (UploadFileResponse, error) {
|
||||
stat, err := file.Stat()
|
||||
if err != nil {
|
||||
return uploadFromReaderResponse{}, err
|
||||
}
|
||||
uploadOptions := uploadFromReaderOptions{}
|
||||
if o != nil {
|
||||
uploadOptions = *o
|
||||
}
|
||||
|
||||
// If user attempts to pass in their own checksum, errors out.
|
||||
if uploadOptions.TransactionalValidation != nil && reflect.TypeOf(uploadOptions.TransactionalValidation).Kind() != reflect.Func {
|
||||
return UploadFileResponse{}, bloberror.UnsupportedChecksum
|
||||
}
|
||||
|
||||
return bb.uploadFromReader(ctx, file, stat.Size(), &uploadOptions)
|
||||
}
|
||||
|
||||
// UploadStream copies the file held in io.Reader to the Blob at blockBlobClient.
|
||||
// A Context deadline or cancellation will cause this to error.
|
||||
func (bb *Client) UploadStream(ctx context.Context, body io.Reader, o *UploadStreamOptions) (UploadStreamResponse, error) {
|
||||
if o == nil {
|
||||
o = &UploadStreamOptions{}
|
||||
}
|
||||
|
||||
// If user attempts to pass in their own checksum, errors out.
|
||||
if o.TransactionalValidation != nil && reflect.TypeOf(o.TransactionalValidation).Kind() != reflect.Func {
|
||||
return UploadStreamResponse{}, bloberror.UnsupportedChecksum
|
||||
}
|
||||
|
||||
result, err := copyFromReader(ctx, body, bb, *o, shared.NewMMBPool)
|
||||
if err != nil {
|
||||
return CommitBlockListResponse{}, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Concurrent Download Functions -----------------------------------------------------------------------------------------
|
||||
|
||||
// DownloadStream reads a range of bytes from a blob. The response also includes the blob's properties and metadata.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/get-blob.
|
||||
func (bb *Client) DownloadStream(ctx context.Context, o *blob.DownloadStreamOptions) (blob.DownloadStreamResponse, error) {
|
||||
return bb.BlobClient().DownloadStream(ctx, o)
|
||||
}
|
||||
|
||||
// DownloadBuffer downloads an Azure blob to a buffer with parallel.
|
||||
func (bb *Client) DownloadBuffer(ctx context.Context, buffer []byte, o *blob.DownloadBufferOptions) (int64, error) {
|
||||
return bb.BlobClient().DownloadBuffer(ctx, shared.NewBytesWriter(buffer), o)
|
||||
}
|
||||
|
||||
// DownloadFile downloads an Azure blob to a local file.
|
||||
// The file would be truncated if the size doesn't match.
|
||||
func (bb *Client) DownloadFile(ctx context.Context, file *os.File, o *blob.DownloadFileOptions) (int64, error) {
|
||||
return bb.BlobClient().DownloadFile(ctx, file, o)
|
||||
}
|
52
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blockblob/constants.go
сгенерированный
поставляемый
Normal file
52
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blockblob/constants.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,52 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
package blockblob
|
||||
|
||||
import "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated"
|
||||
|
||||
const (
|
||||
// CountToEnd specifies the end of the file.
|
||||
CountToEnd = 0
|
||||
|
||||
_1MiB = 1024 * 1024
|
||||
|
||||
// MaxUploadBlobBytes indicates the maximum number of bytes that can be sent in a call to Upload.
|
||||
MaxUploadBlobBytes = 256 * 1024 * 1024 // 256MB
|
||||
|
||||
// MaxStageBlockBytes indicates the maximum number of bytes that can be sent in a call to StageBlock.
|
||||
MaxStageBlockBytes = 4000 * 1024 * 1024 // 4GB
|
||||
|
||||
// MaxBlocks indicates the maximum number of blocks allowed in a block blob.
|
||||
MaxBlocks = 50000
|
||||
)
|
||||
|
||||
// BlockListType defines values for BlockListType
|
||||
type BlockListType = generated.BlockListType
|
||||
|
||||
const (
|
||||
BlockListTypeCommitted BlockListType = generated.BlockListTypeCommitted
|
||||
BlockListTypeUncommitted BlockListType = generated.BlockListTypeUncommitted
|
||||
BlockListTypeAll BlockListType = generated.BlockListTypeAll
|
||||
)
|
||||
|
||||
// PossibleBlockListTypeValues returns the possible values for the BlockListType const type.
|
||||
func PossibleBlockListTypeValues() []BlockListType {
|
||||
return generated.PossibleBlockListTypeValues()
|
||||
}
|
||||
|
||||
// BlobCopySourceTags - can be 'COPY' or 'REPLACE'
|
||||
type BlobCopySourceTags = generated.BlobCopySourceTags
|
||||
|
||||
const (
|
||||
BlobCopySourceTagsCopy = generated.BlobCopySourceTagsCOPY
|
||||
BlobCopySourceTagsReplace = generated.BlobCopySourceTagsREPLACE
|
||||
)
|
||||
|
||||
// PossibleBlobCopySourceTagsValues returns the possible values for the BlobCopySourceTags const type.
|
||||
func PossibleBlobCopySourceTagsValues() []BlobCopySourceTags {
|
||||
return generated.PossibleBlobCopySourceTagsValues()
|
||||
}
|
411
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blockblob/models.go
сгенерированный
поставляемый
Normal file
411
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blockblob/models.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,411 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
package blockblob
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/exported"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/shared"
|
||||
)
|
||||
|
||||
// Type Declarations ---------------------------------------------------------------------
|
||||
|
||||
// Block - Represents a single block in a block blob. It describes the block's ID and size.
|
||||
type Block = generated.Block
|
||||
|
||||
// BlockList - can be uncommitted or committed blocks (committed/uncommitted)
|
||||
type BlockList = generated.BlockList
|
||||
|
||||
// Request Model Declaration -------------------------------------------------------------------------------------------
|
||||
|
||||
// UploadOptions contains the optional parameters for the Client.Upload method.
|
||||
type UploadOptions struct {
|
||||
// Optional. Used to set blob tags in various blob operations.
|
||||
Tags map[string]string
|
||||
|
||||
// Optional. Specifies a user-defined name-value pair associated with the blob.
|
||||
Metadata map[string]*string
|
||||
|
||||
// Optional. Indicates the tier to be set on the blob.
|
||||
Tier *blob.AccessTier
|
||||
|
||||
// TransactionalValidation specifies the transfer validation type to use.
|
||||
// The default is nil (no transfer validation).
|
||||
TransactionalValidation blob.TransferValidationType
|
||||
|
||||
HTTPHeaders *blob.HTTPHeaders
|
||||
CPKInfo *blob.CPKInfo
|
||||
CPKScopeInfo *blob.CPKScopeInfo
|
||||
AccessConditions *blob.AccessConditions
|
||||
LegalHold *bool
|
||||
ImmutabilityPolicyMode *blob.ImmutabilityPolicySetting
|
||||
ImmutabilityPolicyExpiryTime *time.Time
|
||||
|
||||
// Deprecated: TransactionalContentMD5 can be set by using TransactionalValidation instead
|
||||
TransactionalContentMD5 []byte
|
||||
}
|
||||
|
||||
func (o *UploadOptions) format() (*generated.BlockBlobClientUploadOptions, *generated.BlobHTTPHeaders, *generated.LeaseAccessConditions,
|
||||
*generated.CPKInfo, *generated.CPKScopeInfo, *generated.ModifiedAccessConditions) {
|
||||
if o == nil {
|
||||
return nil, nil, nil, nil, nil, nil
|
||||
}
|
||||
|
||||
basics := generated.BlockBlobClientUploadOptions{
|
||||
BlobTagsString: shared.SerializeBlobTagsToStrPtr(o.Tags),
|
||||
Metadata: o.Metadata,
|
||||
Tier: o.Tier,
|
||||
TransactionalContentMD5: o.TransactionalContentMD5,
|
||||
LegalHold: o.LegalHold,
|
||||
ImmutabilityPolicyMode: o.ImmutabilityPolicyMode,
|
||||
ImmutabilityPolicyExpiry: o.ImmutabilityPolicyExpiryTime,
|
||||
}
|
||||
|
||||
leaseAccessConditions, modifiedAccessConditions := exported.FormatBlobAccessConditions(o.AccessConditions)
|
||||
return &basics, o.HTTPHeaders, leaseAccessConditions, o.CPKInfo, o.CPKScopeInfo, modifiedAccessConditions
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// UploadBlobFromURLOptions contains the optional parameters for the Client.UploadBlobFromURL method.
|
||||
type UploadBlobFromURLOptions struct {
|
||||
// Optional. Used to set blob tags in various blob operations.
|
||||
Tags map[string]string
|
||||
|
||||
// Only Bearer type is supported. Credentials should be a valid OAuth access token to copy source.
|
||||
CopySourceAuthorization *string
|
||||
|
||||
// Optional, default is true. Indicates if properties from the source blob should be copied.
|
||||
CopySourceBlobProperties *bool
|
||||
|
||||
// Optional, default 'replace'. Indicates if source tags should be copied or replaced with the tags specified by x-ms-tags.
|
||||
CopySourceTags *BlobCopySourceTags
|
||||
|
||||
// Optional. Specifies a user-defined name-value pair associated with the blob.
|
||||
Metadata map[string]*string
|
||||
|
||||
// Optional. Specifies the md5 calculated for the range of bytes that must be read from the copy source.
|
||||
SourceContentMD5 []byte
|
||||
|
||||
// Optional. Indicates the tier to be set on the blob.
|
||||
Tier *blob.AccessTier
|
||||
|
||||
// Additional optional headers
|
||||
HTTPHeaders *blob.HTTPHeaders
|
||||
AccessConditions *blob.AccessConditions
|
||||
CPKInfo *blob.CPKInfo
|
||||
CPKScopeInfo *blob.CPKScopeInfo
|
||||
SourceModifiedAccessConditions *blob.SourceModifiedAccessConditions
|
||||
}
|
||||
|
||||
func (o *UploadBlobFromURLOptions) format() (*generated.BlockBlobClientPutBlobFromURLOptions, *generated.BlobHTTPHeaders,
|
||||
*generated.LeaseAccessConditions, *generated.CPKInfo, *generated.CPKScopeInfo, *generated.ModifiedAccessConditions,
|
||||
*generated.SourceModifiedAccessConditions) {
|
||||
if o == nil {
|
||||
return nil, nil, nil, nil, nil, nil, nil
|
||||
}
|
||||
|
||||
options := generated.BlockBlobClientPutBlobFromURLOptions{
|
||||
BlobTagsString: shared.SerializeBlobTagsToStrPtr(o.Tags),
|
||||
CopySourceAuthorization: o.CopySourceAuthorization,
|
||||
CopySourceBlobProperties: o.CopySourceBlobProperties,
|
||||
CopySourceTags: o.CopySourceTags,
|
||||
Metadata: o.Metadata,
|
||||
SourceContentMD5: o.SourceContentMD5,
|
||||
Tier: o.Tier,
|
||||
}
|
||||
|
||||
leaseAccessConditions, modifiedAccessConditions := exported.FormatBlobAccessConditions(o.AccessConditions)
|
||||
return &options, o.HTTPHeaders, leaseAccessConditions, o.CPKInfo, o.CPKScopeInfo, modifiedAccessConditions, o.SourceModifiedAccessConditions
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// StageBlockOptions contains the optional parameters for the Client.StageBlock method.
|
||||
type StageBlockOptions struct {
|
||||
CPKInfo *blob.CPKInfo
|
||||
|
||||
CPKScopeInfo *blob.CPKScopeInfo
|
||||
|
||||
LeaseAccessConditions *blob.LeaseAccessConditions
|
||||
|
||||
// TransactionalValidation specifies the transfer validation type to use.
|
||||
// The default is nil (no transfer validation).
|
||||
TransactionalValidation blob.TransferValidationType
|
||||
}
|
||||
|
||||
// StageBlockOptions contains the optional parameters for the Client.StageBlock method.
|
||||
func (o *StageBlockOptions) format() (*generated.BlockBlobClientStageBlockOptions, *generated.LeaseAccessConditions, *generated.CPKInfo, *generated.CPKScopeInfo) {
|
||||
if o == nil {
|
||||
return nil, nil, nil, nil
|
||||
}
|
||||
|
||||
return &generated.BlockBlobClientStageBlockOptions{}, o.LeaseAccessConditions, o.CPKInfo, o.CPKScopeInfo
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// StageBlockFromURLOptions contains the optional parameters for the Client.StageBlockFromURL method.
|
||||
type StageBlockFromURLOptions struct {
|
||||
// Only Bearer type is supported. Credentials should be a valid OAuth access token to copy source.
|
||||
CopySourceAuthorization *string
|
||||
|
||||
LeaseAccessConditions *blob.LeaseAccessConditions
|
||||
|
||||
SourceModifiedAccessConditions *blob.SourceModifiedAccessConditions
|
||||
|
||||
// SourceContentValidation contains the validation mechanism used on the range of bytes read from the source.
|
||||
SourceContentValidation blob.SourceContentValidationType
|
||||
|
||||
// Range specifies a range of bytes. The default value is all bytes.
|
||||
Range blob.HTTPRange
|
||||
|
||||
CPKInfo *blob.CPKInfo
|
||||
|
||||
CPKScopeInfo *blob.CPKScopeInfo
|
||||
}
|
||||
|
||||
func (o *StageBlockFromURLOptions) format() (*generated.BlockBlobClientStageBlockFromURLOptions, *generated.CPKInfo, *generated.CPKScopeInfo, *generated.LeaseAccessConditions, *generated.SourceModifiedAccessConditions) {
|
||||
if o == nil {
|
||||
return nil, nil, nil, nil, nil
|
||||
}
|
||||
|
||||
options := &generated.BlockBlobClientStageBlockFromURLOptions{
|
||||
CopySourceAuthorization: o.CopySourceAuthorization,
|
||||
SourceRange: exported.FormatHTTPRange(o.Range),
|
||||
}
|
||||
|
||||
if o.SourceContentValidation != nil {
|
||||
o.SourceContentValidation.Apply(options)
|
||||
}
|
||||
|
||||
return options, o.CPKInfo, o.CPKScopeInfo, o.LeaseAccessConditions, o.SourceModifiedAccessConditions
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// CommitBlockListOptions contains the optional parameters for Client.CommitBlockList method.
|
||||
type CommitBlockListOptions struct {
|
||||
Tags map[string]string
|
||||
Metadata map[string]*string
|
||||
RequestID *string
|
||||
Tier *blob.AccessTier
|
||||
Timeout *int32
|
||||
HTTPHeaders *blob.HTTPHeaders
|
||||
CPKInfo *blob.CPKInfo
|
||||
CPKScopeInfo *blob.CPKScopeInfo
|
||||
AccessConditions *blob.AccessConditions
|
||||
LegalHold *bool
|
||||
ImmutabilityPolicyMode *blob.ImmutabilityPolicySetting
|
||||
ImmutabilityPolicyExpiryTime *time.Time
|
||||
|
||||
// Deprecated: TransactionalContentCRC64 cannot be generated
|
||||
TransactionalContentCRC64 []byte
|
||||
|
||||
// Deprecated: TransactionalContentMD5 cannot be generated
|
||||
TransactionalContentMD5 []byte
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// GetBlockListOptions contains the optional parameters for the Client.GetBlockList method.
|
||||
type GetBlockListOptions struct {
|
||||
Snapshot *string
|
||||
AccessConditions *blob.AccessConditions
|
||||
}
|
||||
|
||||
func (o *GetBlockListOptions) format() (*generated.BlockBlobClientGetBlockListOptions, *generated.LeaseAccessConditions, *generated.ModifiedAccessConditions) {
|
||||
if o == nil {
|
||||
return nil, nil, nil
|
||||
}
|
||||
|
||||
leaseAccessConditions, modifiedAccessConditions := exported.FormatBlobAccessConditions(o.AccessConditions)
|
||||
return &generated.BlockBlobClientGetBlockListOptions{Snapshot: o.Snapshot}, leaseAccessConditions, modifiedAccessConditions
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------
|
||||
|
||||
// uploadFromReaderOptions identifies options used by the UploadBuffer and UploadFile functions.
|
||||
type uploadFromReaderOptions struct {
|
||||
// BlockSize specifies the block size to use; the default (and maximum size) is MaxStageBlockBytes.
|
||||
BlockSize int64
|
||||
|
||||
// Progress is a function that is invoked periodically as bytes are sent to the BlockBlobClient.
|
||||
// Note that the progress reporting is not always increasing; it can go down when retrying a request.
|
||||
Progress func(bytesTransferred int64)
|
||||
|
||||
// HTTPHeaders indicates the HTTP headers to be associated with the blob.
|
||||
HTTPHeaders *blob.HTTPHeaders
|
||||
|
||||
// Metadata indicates the metadata to be associated with the blob when PutBlockList is called.
|
||||
Metadata map[string]*string
|
||||
|
||||
// AccessConditions indicates the access conditions for the block blob.
|
||||
AccessConditions *blob.AccessConditions
|
||||
|
||||
// AccessTier indicates the tier of blob
|
||||
AccessTier *blob.AccessTier
|
||||
|
||||
// BlobTags
|
||||
Tags map[string]string
|
||||
|
||||
// ClientProvidedKeyOptions indicates the client provided key by name and/or by value to encrypt/decrypt data.
|
||||
CPKInfo *blob.CPKInfo
|
||||
CPKScopeInfo *blob.CPKScopeInfo
|
||||
|
||||
// Concurrency indicates the maximum number of blocks to upload in parallel (0=default)
|
||||
Concurrency uint16
|
||||
|
||||
TransactionalValidation blob.TransferValidationType
|
||||
|
||||
// Deprecated: TransactionalContentCRC64 cannot be generated at block level
|
||||
TransactionalContentCRC64 uint64
|
||||
|
||||
// Deprecated: TransactionalContentMD5 cannot be generated at block level
|
||||
TransactionalContentMD5 []byte
|
||||
}
|
||||
|
||||
// UploadBufferOptions provides set of configurations for UploadBuffer operation.
|
||||
type UploadBufferOptions = uploadFromReaderOptions
|
||||
|
||||
// UploadFileOptions provides set of configurations for UploadFile operation.
|
||||
type UploadFileOptions = uploadFromReaderOptions
|
||||
|
||||
func (o *uploadFromReaderOptions) getStageBlockOptions() *StageBlockOptions {
|
||||
leaseAccessConditions, _ := exported.FormatBlobAccessConditions(o.AccessConditions)
|
||||
return &StageBlockOptions{
|
||||
CPKInfo: o.CPKInfo,
|
||||
CPKScopeInfo: o.CPKScopeInfo,
|
||||
LeaseAccessConditions: leaseAccessConditions,
|
||||
|
||||
TransactionalValidation: o.TransactionalValidation,
|
||||
}
|
||||
}
|
||||
|
||||
func (o *uploadFromReaderOptions) getUploadBlockBlobOptions() *UploadOptions {
|
||||
return &UploadOptions{
|
||||
Tags: o.Tags,
|
||||
Metadata: o.Metadata,
|
||||
Tier: o.AccessTier,
|
||||
HTTPHeaders: o.HTTPHeaders,
|
||||
AccessConditions: o.AccessConditions,
|
||||
CPKInfo: o.CPKInfo,
|
||||
CPKScopeInfo: o.CPKScopeInfo,
|
||||
}
|
||||
}
|
||||
|
||||
func (o *uploadFromReaderOptions) getCommitBlockListOptions() *CommitBlockListOptions {
|
||||
return &CommitBlockListOptions{
|
||||
Tags: o.Tags,
|
||||
Metadata: o.Metadata,
|
||||
Tier: o.AccessTier,
|
||||
HTTPHeaders: o.HTTPHeaders,
|
||||
CPKInfo: o.CPKInfo,
|
||||
CPKScopeInfo: o.CPKScopeInfo,
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// UploadStreamOptions provides set of configurations for UploadStream operation.
|
||||
type UploadStreamOptions struct {
|
||||
// BlockSize defines the size of the buffer used during upload. The default and minimum value is 1 MiB.
|
||||
BlockSize int64
|
||||
|
||||
// Concurrency defines the max number of concurrent uploads to be performed to upload the file.
|
||||
// Each concurrent upload will create a buffer of size BlockSize. The default value is one.
|
||||
Concurrency int
|
||||
|
||||
TransactionalValidation blob.TransferValidationType
|
||||
|
||||
HTTPHeaders *blob.HTTPHeaders
|
||||
Metadata map[string]*string
|
||||
AccessConditions *blob.AccessConditions
|
||||
AccessTier *blob.AccessTier
|
||||
Tags map[string]string
|
||||
CPKInfo *blob.CPKInfo
|
||||
CPKScopeInfo *blob.CPKScopeInfo
|
||||
}
|
||||
|
||||
func (u *UploadStreamOptions) setDefaults() {
|
||||
if u.Concurrency == 0 {
|
||||
u.Concurrency = 1
|
||||
}
|
||||
|
||||
if u.BlockSize < _1MiB {
|
||||
u.BlockSize = _1MiB
|
||||
}
|
||||
}
|
||||
|
||||
func (u *UploadStreamOptions) getStageBlockOptions() *StageBlockOptions {
|
||||
if u == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
leaseAccessConditions, _ := exported.FormatBlobAccessConditions(u.AccessConditions)
|
||||
return &StageBlockOptions{
|
||||
TransactionalValidation: u.TransactionalValidation,
|
||||
CPKInfo: u.CPKInfo,
|
||||
CPKScopeInfo: u.CPKScopeInfo,
|
||||
LeaseAccessConditions: leaseAccessConditions,
|
||||
}
|
||||
}
|
||||
|
||||
func (u *UploadStreamOptions) getCommitBlockListOptions() *CommitBlockListOptions {
|
||||
if u == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return &CommitBlockListOptions{
|
||||
Tags: u.Tags,
|
||||
Metadata: u.Metadata,
|
||||
Tier: u.AccessTier,
|
||||
HTTPHeaders: u.HTTPHeaders,
|
||||
CPKInfo: u.CPKInfo,
|
||||
CPKScopeInfo: u.CPKScopeInfo,
|
||||
AccessConditions: u.AccessConditions,
|
||||
}
|
||||
}
|
||||
|
||||
func (u *UploadStreamOptions) getUploadOptions() *UploadOptions {
|
||||
if u == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return &UploadOptions{
|
||||
Tags: u.Tags,
|
||||
Metadata: u.Metadata,
|
||||
Tier: u.AccessTier,
|
||||
HTTPHeaders: u.HTTPHeaders,
|
||||
CPKInfo: u.CPKInfo,
|
||||
CPKScopeInfo: u.CPKScopeInfo,
|
||||
AccessConditions: u.AccessConditions,
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// ExpiryType defines values for ExpiryType.
|
||||
type ExpiryType = exported.ExpiryType
|
||||
|
||||
// ExpiryTypeAbsolute defines the absolute time for the blob expiry.
|
||||
type ExpiryTypeAbsolute = exported.ExpiryTypeAbsolute
|
||||
|
||||
// ExpiryTypeRelativeToNow defines the duration relative to now for the blob expiry.
|
||||
type ExpiryTypeRelativeToNow = exported.ExpiryTypeRelativeToNow
|
||||
|
||||
// ExpiryTypeRelativeToCreation defines the duration relative to creation for the blob expiry.
|
||||
type ExpiryTypeRelativeToCreation = exported.ExpiryTypeRelativeToCreation
|
||||
|
||||
// ExpiryTypeNever defines that the blob will be set to never expire.
|
||||
type ExpiryTypeNever = exported.ExpiryTypeNever
|
||||
|
||||
// SetExpiryOptions contains the optional parameters for the Client.SetExpiry method.
|
||||
type SetExpiryOptions = exported.SetExpiryOptions
|
117
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blockblob/responses.go
сгенерированный
поставляемый
Normal file
117
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blockblob/responses.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,117 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
package blockblob
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated"
|
||||
)
|
||||
|
||||
// UploadResponse contains the response from method Client.Upload.
|
||||
type UploadResponse = generated.BlockBlobClientUploadResponse
|
||||
|
||||
// UploadBlobFromURLResponse contains the response from the method Client.UploadBlobFromURL
|
||||
type UploadBlobFromURLResponse = generated.BlockBlobClientPutBlobFromURLResponse
|
||||
|
||||
// StageBlockResponse contains the response from method Client.StageBlock.
|
||||
type StageBlockResponse = generated.BlockBlobClientStageBlockResponse
|
||||
|
||||
// CommitBlockListResponse contains the response from method Client.CommitBlockList.
|
||||
type CommitBlockListResponse = generated.BlockBlobClientCommitBlockListResponse
|
||||
|
||||
// StageBlockFromURLResponse contains the response from method Client.StageBlockFromURL.
|
||||
type StageBlockFromURLResponse = generated.BlockBlobClientStageBlockFromURLResponse
|
||||
|
||||
// GetBlockListResponse contains the response from method Client.GetBlockList.
|
||||
type GetBlockListResponse = generated.BlockBlobClientGetBlockListResponse
|
||||
|
||||
// uploadFromReaderResponse contains the response from method Client.UploadBuffer/Client.UploadFile.
|
||||
type uploadFromReaderResponse struct {
|
||||
// ClientRequestID contains the information returned from the x-ms-client-request-id header response.
|
||||
ClientRequestID *string
|
||||
|
||||
// ContentMD5 contains the information returned from the Content-MD5 header response.
|
||||
ContentMD5 []byte
|
||||
|
||||
// Date contains the information returned from the Date header response.
|
||||
Date *time.Time
|
||||
|
||||
// ETag contains the information returned from the ETag header response.
|
||||
ETag *azcore.ETag
|
||||
|
||||
// EncryptionKeySHA256 contains the information returned from the x-ms-encryption-key-sha256 header response.
|
||||
EncryptionKeySHA256 *string
|
||||
|
||||
// EncryptionScope contains the information returned from the x-ms-encryption-scope header response.
|
||||
EncryptionScope *string
|
||||
|
||||
// IsServerEncrypted contains the information returned from the x-ms-request-server-encrypted header response.
|
||||
IsServerEncrypted *bool
|
||||
|
||||
// LastModified contains the information returned from the Last-Modified header response.
|
||||
LastModified *time.Time
|
||||
|
||||
// RequestID contains the information returned from the x-ms-request-id header response.
|
||||
RequestID *string
|
||||
|
||||
// Version contains the information returned from the x-ms-version header response.
|
||||
Version *string
|
||||
|
||||
// VersionID contains the information returned from the x-ms-version-id header response.
|
||||
VersionID *string
|
||||
|
||||
// ContentCRC64 contains the information returned from the x-ms-content-crc64 header response.
|
||||
// Will be a part of response only if uploading data >= internal.MaxUploadBlobBytes (= 256 * 1024 * 1024 // 256MB)
|
||||
ContentCRC64 []byte
|
||||
}
|
||||
|
||||
func toUploadReaderAtResponseFromUploadResponse(resp UploadResponse) uploadFromReaderResponse {
|
||||
return uploadFromReaderResponse{
|
||||
ClientRequestID: resp.ClientRequestID,
|
||||
ContentMD5: resp.ContentMD5,
|
||||
Date: resp.Date,
|
||||
ETag: resp.ETag,
|
||||
EncryptionKeySHA256: resp.EncryptionKeySHA256,
|
||||
EncryptionScope: resp.EncryptionScope,
|
||||
IsServerEncrypted: resp.IsServerEncrypted,
|
||||
LastModified: resp.LastModified,
|
||||
RequestID: resp.RequestID,
|
||||
Version: resp.Version,
|
||||
VersionID: resp.VersionID,
|
||||
}
|
||||
}
|
||||
|
||||
func toUploadReaderAtResponseFromCommitBlockListResponse(resp CommitBlockListResponse) uploadFromReaderResponse {
|
||||
return uploadFromReaderResponse{
|
||||
ClientRequestID: resp.ClientRequestID,
|
||||
ContentMD5: resp.ContentMD5,
|
||||
Date: resp.Date,
|
||||
ETag: resp.ETag,
|
||||
EncryptionKeySHA256: resp.EncryptionKeySHA256,
|
||||
EncryptionScope: resp.EncryptionScope,
|
||||
IsServerEncrypted: resp.IsServerEncrypted,
|
||||
LastModified: resp.LastModified,
|
||||
RequestID: resp.RequestID,
|
||||
Version: resp.Version,
|
||||
VersionID: resp.VersionID,
|
||||
ContentCRC64: resp.ContentCRC64,
|
||||
}
|
||||
}
|
||||
|
||||
// UploadFileResponse contains the response from method Client.UploadBuffer/Client.UploadFile.
|
||||
type UploadFileResponse = uploadFromReaderResponse
|
||||
|
||||
// UploadBufferResponse contains the response from method Client.UploadBuffer/Client.UploadFile.
|
||||
type UploadBufferResponse = uploadFromReaderResponse
|
||||
|
||||
// UploadStreamResponse contains the response from method Client.CommitBlockList.
|
||||
type UploadStreamResponse = CommitBlockListResponse
|
||||
|
||||
// SetExpiryResponse contains the response from method Client.SetExpiry.
|
||||
type SetExpiryResponse = generated.BlobClientSetExpiryResponse
|
34
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/ci.yml
сгенерированный
поставляемый
Normal file
34
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/ci.yml
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,34 @@
|
|||
trigger:
|
||||
branches:
|
||||
include:
|
||||
- main
|
||||
- feature/*
|
||||
- hotfix/*
|
||||
- release/*
|
||||
paths:
|
||||
include:
|
||||
- sdk/storage/azblob
|
||||
|
||||
pr:
|
||||
branches:
|
||||
include:
|
||||
- main
|
||||
- feature/*
|
||||
- hotfix/*
|
||||
- release/*
|
||||
paths:
|
||||
include:
|
||||
- sdk/storage/azblob
|
||||
|
||||
|
||||
extends:
|
||||
template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml
|
||||
parameters:
|
||||
ServiceDirectory: 'storage/azblob'
|
||||
RunLiveTests: true
|
||||
UsePipelineProxy: false
|
||||
EnvVars:
|
||||
AZURE_CLIENT_ID: $(AZBLOB_CLIENT_ID)
|
||||
AZURE_TENANT_ID: $(AZBLOB_TENANT_ID)
|
||||
AZURE_CLIENT_SECRET: $(AZBLOB_CLIENT_SECRET)
|
||||
AZURE_SUBSCRIPTION_ID: $(AZBLOB_SUBSCRIPTION_ID)
|
164
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/client.go
сгенерированный
поставляемый
Normal file
164
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/client.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,164 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
package azblob
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"os"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/base"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/shared"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/service"
|
||||
)
|
||||
|
||||
// ClientOptions contains the optional parameters when creating a Client.
|
||||
type ClientOptions base.ClientOptions
|
||||
|
||||
// Client represents a URL to an Azure Storage blob; the blob may be a block blob, append blob, or page blob.
|
||||
type Client struct {
|
||||
svc *service.Client
|
||||
}
|
||||
|
||||
// NewClient creates an instance of Client with the specified values.
|
||||
// - serviceURL - the URL of the storage account e.g. https://<account>.blob.core.windows.net/
|
||||
// - cred - an Azure AD credential, typically obtained via the azidentity module
|
||||
// - options - client options; pass nil to accept the default values
|
||||
func NewClient(serviceURL string, cred azcore.TokenCredential, options *ClientOptions) (*Client, error) {
|
||||
svcClient, err := service.NewClient(serviceURL, cred, (*service.ClientOptions)(options))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &Client{
|
||||
svc: svcClient,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// NewClientWithNoCredential creates an instance of Client with the specified values.
|
||||
// This is used to anonymously access a storage account or with a shared access signature (SAS) token.
|
||||
// - serviceURL - the URL of the storage account e.g. https://<account>.blob.core.windows.net/?<sas token>
|
||||
// - options - client options; pass nil to accept the default values
|
||||
func NewClientWithNoCredential(serviceURL string, options *ClientOptions) (*Client, error) {
|
||||
svcClient, err := service.NewClientWithNoCredential(serviceURL, (*service.ClientOptions)(options))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &Client{
|
||||
svc: svcClient,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// NewClientWithSharedKeyCredential creates an instance of Client with the specified values.
|
||||
// - serviceURL - the URL of the storage account e.g. https://<account>.blob.core.windows.net/
|
||||
// - cred - a SharedKeyCredential created with the matching storage account and access key
|
||||
// - options - client options; pass nil to accept the default values
|
||||
func NewClientWithSharedKeyCredential(serviceURL string, cred *SharedKeyCredential, options *ClientOptions) (*Client, error) {
|
||||
svcClient, err := service.NewClientWithSharedKeyCredential(serviceURL, cred, (*service.ClientOptions)(options))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &Client{
|
||||
svc: svcClient,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// NewClientFromConnectionString creates an instance of Client with the specified values.
|
||||
// - connectionString - a connection string for the desired storage account
|
||||
// - options - client options; pass nil to accept the default values
|
||||
func NewClientFromConnectionString(connectionString string, options *ClientOptions) (*Client, error) {
|
||||
svcClient, err := service.NewClientFromConnectionString(connectionString, (*service.ClientOptions)(options))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Client{
|
||||
svc: svcClient,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// URL returns the URL endpoint used by the BlobClient object.
|
||||
func (c *Client) URL() string {
|
||||
return c.svc.URL()
|
||||
}
|
||||
|
||||
// ServiceClient returns the embedded service client for this client.
|
||||
func (c *Client) ServiceClient() *service.Client {
|
||||
return c.svc
|
||||
}
|
||||
|
||||
// CreateContainer is a lifecycle method to creates a new container under the specified account.
|
||||
// If the container with the same name already exists, a ResourceExistsError will be raised.
|
||||
// This method returns a client with which to interact with the newly created container.
|
||||
func (c *Client) CreateContainer(ctx context.Context, containerName string, o *CreateContainerOptions) (CreateContainerResponse, error) {
|
||||
return c.svc.CreateContainer(ctx, containerName, o)
|
||||
}
|
||||
|
||||
// DeleteContainer is a lifecycle method that marks the specified container for deletion.
|
||||
// The container and any blobs contained within it are later deleted during garbage collection.
|
||||
// If the container is not found, a ResourceNotFoundError will be raised.
|
||||
func (c *Client) DeleteContainer(ctx context.Context, containerName string, o *DeleteContainerOptions) (DeleteContainerResponse, error) {
|
||||
return c.svc.DeleteContainer(ctx, containerName, o)
|
||||
}
|
||||
|
||||
// DeleteBlob marks the specified blob or snapshot for deletion. The blob is later deleted during garbage collection.
|
||||
// Note that deleting a blob also deletes all its snapshots.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/delete-blob.
|
||||
func (c *Client) DeleteBlob(ctx context.Context, containerName string, blobName string, o *DeleteBlobOptions) (DeleteBlobResponse, error) {
|
||||
return c.svc.NewContainerClient(containerName).NewBlobClient(blobName).Delete(ctx, o)
|
||||
}
|
||||
|
||||
// NewListBlobsFlatPager returns a pager for blobs starting from the specified Marker. Use an empty
|
||||
// Marker to start enumeration from the beginning. Blob names are returned in lexicographic order.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/list-blobs.
|
||||
func (c *Client) NewListBlobsFlatPager(containerName string, o *ListBlobsFlatOptions) *runtime.Pager[ListBlobsFlatResponse] {
|
||||
return c.svc.NewContainerClient(containerName).NewListBlobsFlatPager(o)
|
||||
}
|
||||
|
||||
// NewListContainersPager operation returns a pager of the containers under the specified account.
|
||||
// Use an empty Marker to start enumeration from the beginning. Container names are returned in lexicographic order.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/list-containers2.
|
||||
func (c *Client) NewListContainersPager(o *ListContainersOptions) *runtime.Pager[ListContainersResponse] {
|
||||
return c.svc.NewListContainersPager(o)
|
||||
}
|
||||
|
||||
// UploadBuffer uploads a buffer in blocks to a block blob.
|
||||
func (c *Client) UploadBuffer(ctx context.Context, containerName string, blobName string, buffer []byte, o *UploadBufferOptions) (UploadBufferResponse, error) {
|
||||
return c.svc.NewContainerClient(containerName).NewBlockBlobClient(blobName).UploadBuffer(ctx, buffer, o)
|
||||
}
|
||||
|
||||
// UploadFile uploads a file in blocks to a block blob.
|
||||
func (c *Client) UploadFile(ctx context.Context, containerName string, blobName string, file *os.File, o *UploadFileOptions) (UploadFileResponse, error) {
|
||||
return c.svc.NewContainerClient(containerName).NewBlockBlobClient(blobName).UploadFile(ctx, file, o)
|
||||
}
|
||||
|
||||
// UploadStream copies the file held in io.Reader to the Blob at blockBlobClient.
|
||||
// A Context deadline or cancellation will cause this to error.
|
||||
func (c *Client) UploadStream(ctx context.Context, containerName string, blobName string, body io.Reader, o *UploadStreamOptions) (UploadStreamResponse, error) {
|
||||
return c.svc.NewContainerClient(containerName).NewBlockBlobClient(blobName).UploadStream(ctx, body, o)
|
||||
}
|
||||
|
||||
// DownloadBuffer downloads an Azure blob to a buffer with parallel.
|
||||
func (c *Client) DownloadBuffer(ctx context.Context, containerName string, blobName string, buffer []byte, o *DownloadBufferOptions) (int64, error) {
|
||||
return c.svc.NewContainerClient(containerName).NewBlobClient(blobName).DownloadBuffer(ctx, shared.NewBytesWriter(buffer), o)
|
||||
}
|
||||
|
||||
// DownloadFile downloads an Azure blob to a local file.
|
||||
// The file would be truncated if the size doesn't match.
|
||||
func (c *Client) DownloadFile(ctx context.Context, containerName string, blobName string, file *os.File, o *DownloadFileOptions) (int64, error) {
|
||||
return c.svc.NewContainerClient(containerName).NewBlobClient(blobName).DownloadFile(ctx, file, o)
|
||||
}
|
||||
|
||||
// DownloadStream reads a range of bytes from a blob. The response also includes the blob's properties and metadata.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/get-blob.
|
||||
func (c *Client) DownloadStream(ctx context.Context, containerName string, blobName string, o *DownloadStreamOptions) (DownloadStreamResponse, error) {
|
||||
o = shared.CopyOptions(o)
|
||||
return c.svc.NewContainerClient(containerName).NewBlobClient(blobName).DownloadStream(ctx, o)
|
||||
}
|
36
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/common.go
сгенерированный
поставляемый
Normal file
36
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/common.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,36 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
package azblob
|
||||
|
||||
import (
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/exported"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/sas"
|
||||
)
|
||||
|
||||
// SharedKeyCredential contains an account's name and its primary or secondary key.
|
||||
type SharedKeyCredential = exported.SharedKeyCredential
|
||||
|
||||
// NewSharedKeyCredential creates an immutable SharedKeyCredential containing the
|
||||
// storage account's name and either its primary or secondary key.
|
||||
func NewSharedKeyCredential(accountName, accountKey string) (*SharedKeyCredential, error) {
|
||||
return exported.NewSharedKeyCredential(accountName, accountKey)
|
||||
}
|
||||
|
||||
// URLParts object represents the components that make up an Azure Storage Container/Blob URL.
|
||||
// NOTE: Changing any SAS-related field requires computing a new SAS signature.
|
||||
type URLParts = sas.URLParts
|
||||
|
||||
// ParseURL parses a URL initializing URLParts' fields including any SAS-related & snapshot query parameters. Any other
|
||||
// query parameters remain in the UnparsedParams field. This method overwrites all fields in the URLParts object.
|
||||
func ParseURL(u string) (URLParts, error) {
|
||||
return sas.ParseURL(u)
|
||||
}
|
||||
|
||||
// HTTPRange defines a range of bytes within an HTTP resource, starting at offset and
|
||||
// ending at offset+count. A zero-value HTTPRange indicates the entire resource. An HTTPRange
|
||||
// which has an offset and zero value count indicates from the offset to the resource's end.
|
||||
type HTTPRange = exported.HTTPRange
|
37
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/constants.go
сгенерированный
поставляемый
Normal file
37
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/constants.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,37 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
package azblob
|
||||
|
||||
import (
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated"
|
||||
)
|
||||
|
||||
// PublicAccessType defines values for AccessType - private (default) or blob or container.
|
||||
type PublicAccessType = generated.PublicAccessType
|
||||
|
||||
const (
|
||||
PublicAccessTypeBlob PublicAccessType = generated.PublicAccessTypeBlob
|
||||
PublicAccessTypeContainer PublicAccessType = generated.PublicAccessTypeContainer
|
||||
)
|
||||
|
||||
// PossiblePublicAccessTypeValues returns the possible values for the PublicAccessType const type.
|
||||
func PossiblePublicAccessTypeValues() []PublicAccessType {
|
||||
return generated.PossiblePublicAccessTypeValues()
|
||||
}
|
||||
|
||||
// DeleteSnapshotsOptionType defines values for DeleteSnapshotsOptionType.
|
||||
type DeleteSnapshotsOptionType = generated.DeleteSnapshotsOptionType
|
||||
|
||||
const (
|
||||
DeleteSnapshotsOptionTypeInclude DeleteSnapshotsOptionType = generated.DeleteSnapshotsOptionTypeInclude
|
||||
DeleteSnapshotsOptionTypeOnly DeleteSnapshotsOptionType = generated.DeleteSnapshotsOptionTypeOnly
|
||||
)
|
||||
|
||||
// PossibleDeleteSnapshotsOptionTypeValues returns the possible values for the DeleteSnapshotsOptionType const type.
|
||||
func PossibleDeleteSnapshotsOptionTypeValues() []DeleteSnapshotsOptionType {
|
||||
return generated.PossibleDeleteSnapshotsOptionTypeValues()
|
||||
}
|
94
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/container/batch_builder.go
сгенерированный
поставляемый
Normal file
94
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/container/batch_builder.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,94 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
package container
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/url"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/exported"
|
||||
)
|
||||
|
||||
// BatchBuilder is used for creating the batch operations list. It contains the list of either delete or set tier sub-requests.
|
||||
// NOTE: All sub-requests in the batch must be of the same type, either delete or set tier.
|
||||
type BatchBuilder struct {
|
||||
endpoint string
|
||||
authPolicy policy.Policy
|
||||
subRequests []*policy.Request
|
||||
operationType *exported.BlobBatchOperationType
|
||||
}
|
||||
|
||||
func (bb *BatchBuilder) checkOperationType(operationType exported.BlobBatchOperationType) error {
|
||||
if bb.operationType == nil {
|
||||
bb.operationType = &operationType
|
||||
return nil
|
||||
}
|
||||
if *bb.operationType != operationType {
|
||||
return fmt.Errorf("BlobBatch only supports one operation type per batch and is already being used for %s operations", *bb.operationType)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Delete operation is used to add delete sub-request to the batch builder.
|
||||
func (bb *BatchBuilder) Delete(blobName string, options *BatchDeleteOptions) error {
|
||||
err := bb.checkOperationType(exported.BatchDeleteOperationType)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
blobName = url.PathEscape(blobName)
|
||||
blobURL := runtime.JoinPaths(bb.endpoint, blobName)
|
||||
|
||||
blobClient, err := blob.NewClientWithNoCredential(blobURL, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
deleteOptions, leaseInfo, accessConditions := options.format()
|
||||
req, err := getGeneratedBlobClient(blobClient).DeleteCreateRequest(context.TODO(), deleteOptions, leaseInfo, accessConditions)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// remove x-ms-version header
|
||||
exported.UpdateSubRequestHeaders(req)
|
||||
|
||||
bb.subRequests = append(bb.subRequests, req)
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetTier operation is used to add set tier sub-request to the batch builder.
|
||||
func (bb *BatchBuilder) SetTier(blobName string, accessTier blob.AccessTier, options *BatchSetTierOptions) error {
|
||||
err := bb.checkOperationType(exported.BatchSetTierOperationType)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
blobName = url.PathEscape(blobName)
|
||||
blobURL := runtime.JoinPaths(bb.endpoint, blobName)
|
||||
|
||||
blobClient, err := blob.NewClientWithNoCredential(blobURL, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
setTierOptions, leaseInfo, accessConditions := options.format()
|
||||
req, err := getGeneratedBlobClient(blobClient).SetTierCreateRequest(context.TODO(), accessTier, setTierOptions, leaseInfo, accessConditions)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// remove x-ms-version header
|
||||
exported.UpdateSubRequestHeaders(req)
|
||||
|
||||
bb.subRequests = append(bb.subRequests, req)
|
||||
return nil
|
||||
}
|
437
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/container/client.go
сгенерированный
поставляемый
Normal file
437
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/container/client.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,437 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
package container
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"time"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/streaming"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/appendblob"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/bloberror"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blockblob"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/base"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/exported"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/shared"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/pageblob"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/sas"
|
||||
)
|
||||
|
||||
// ClientOptions contains the optional parameters when creating a Client.
|
||||
type ClientOptions base.ClientOptions
|
||||
|
||||
// Client represents a URL to the Azure Storage container allowing you to manipulate its blobs.
|
||||
type Client base.Client[generated.ContainerClient]
|
||||
|
||||
// NewClient creates an instance of Client with the specified values.
|
||||
// - containerURL - the URL of the container e.g. https://<account>.blob.core.windows.net/container
|
||||
// - cred - an Azure AD credential, typically obtained via the azidentity module
|
||||
// - options - client options; pass nil to accept the default values
|
||||
func NewClient(containerURL string, cred azcore.TokenCredential, options *ClientOptions) (*Client, error) {
|
||||
audience := base.GetAudience((*base.ClientOptions)(options))
|
||||
conOptions := shared.GetClientOptions(options)
|
||||
authPolicy := shared.NewStorageChallengePolicy(cred, audience, conOptions.InsecureAllowCredentialWithHTTP)
|
||||
plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}}
|
||||
|
||||
azClient, err := azcore.NewClient(exported.ModuleName, exported.ModuleVersion, plOpts, &conOptions.ClientOptions)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return (*Client)(base.NewContainerClient(containerURL, azClient, &cred, (*base.ClientOptions)(conOptions))), nil
|
||||
}
|
||||
|
||||
// NewClientWithNoCredential creates an instance of Client with the specified values.
|
||||
// This is used to anonymously access a container or with a shared access signature (SAS) token.
|
||||
// - containerURL - the URL of the container e.g. https://<account>.blob.core.windows.net/container?<sas token>
|
||||
// - options - client options; pass nil to accept the default values
|
||||
func NewClientWithNoCredential(containerURL string, options *ClientOptions) (*Client, error) {
|
||||
conOptions := shared.GetClientOptions(options)
|
||||
|
||||
azClient, err := azcore.NewClient(exported.ModuleName, exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return (*Client)(base.NewContainerClient(containerURL, azClient, nil, (*base.ClientOptions)(conOptions))), nil
|
||||
}
|
||||
|
||||
// NewClientWithSharedKeyCredential creates an instance of Client with the specified values.
|
||||
// - containerURL - the URL of the container e.g. https://<account>.blob.core.windows.net/container
|
||||
// - cred - a SharedKeyCredential created with the matching container's storage account and access key
|
||||
// - options - client options; pass nil to accept the default values
|
||||
func NewClientWithSharedKeyCredential(containerURL string, cred *SharedKeyCredential, options *ClientOptions) (*Client, error) {
|
||||
authPolicy := exported.NewSharedKeyCredPolicy(cred)
|
||||
conOptions := shared.GetClientOptions(options)
|
||||
plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}}
|
||||
|
||||
azClient, err := azcore.NewClient(exported.ModuleName, exported.ModuleVersion, plOpts, &conOptions.ClientOptions)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return (*Client)(base.NewContainerClient(containerURL, azClient, cred, (*base.ClientOptions)(conOptions))), nil
|
||||
}
|
||||
|
||||
// NewClientFromConnectionString creates an instance of Client with the specified values.
|
||||
// - connectionString - a connection string for the desired storage account
|
||||
// - containerName - the name of the container within the storage account
|
||||
// - options - client options; pass nil to accept the default values
|
||||
func NewClientFromConnectionString(connectionString string, containerName string, options *ClientOptions) (*Client, error) {
|
||||
parsed, err := shared.ParseConnectionString(connectionString)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
parsed.ServiceURL = runtime.JoinPaths(parsed.ServiceURL, containerName)
|
||||
|
||||
if parsed.AccountKey != "" && parsed.AccountName != "" {
|
||||
credential, err := exported.NewSharedKeyCredential(parsed.AccountName, parsed.AccountKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return NewClientWithSharedKeyCredential(parsed.ServiceURL, credential, options)
|
||||
}
|
||||
|
||||
return NewClientWithNoCredential(parsed.ServiceURL, options)
|
||||
}
|
||||
|
||||
func (c *Client) generated() *generated.ContainerClient {
|
||||
return base.InnerClient((*base.Client[generated.ContainerClient])(c))
|
||||
}
|
||||
|
||||
func (c *Client) sharedKey() *SharedKeyCredential {
|
||||
return base.SharedKey((*base.Client[generated.ContainerClient])(c))
|
||||
}
|
||||
|
||||
func (c *Client) credential() any {
|
||||
return base.Credential((*base.Client[generated.ContainerClient])(c))
|
||||
}
|
||||
|
||||
// helper method to return the generated.BlobClient which is used for creating the sub-requests
|
||||
func getGeneratedBlobClient(b *blob.Client) *generated.BlobClient {
|
||||
return base.InnerClient((*base.Client[generated.BlobClient])(b))
|
||||
}
|
||||
|
||||
func (c *Client) getClientOptions() *base.ClientOptions {
|
||||
return base.GetClientOptions((*base.Client[generated.ContainerClient])(c))
|
||||
}
|
||||
|
||||
// URL returns the URL endpoint used by the Client object.
|
||||
func (c *Client) URL() string {
|
||||
return c.generated().Endpoint()
|
||||
}
|
||||
|
||||
// NewBlobClient creates a new blob.Client object by concatenating blobName to the end of
|
||||
// Client's URL. The blob name will be URL-encoded.
|
||||
// The new blob.Client uses the same request policy pipeline as this Client.
|
||||
func (c *Client) NewBlobClient(blobName string) *blob.Client {
|
||||
blobName = url.PathEscape(blobName)
|
||||
blobURL := runtime.JoinPaths(c.URL(), blobName)
|
||||
return (*blob.Client)(base.NewBlobClient(blobURL, c.generated().InternalClient().WithClientName(exported.ModuleName), c.credential(), c.getClientOptions()))
|
||||
}
|
||||
|
||||
// NewAppendBlobClient creates a new appendblob.Client object by concatenating blobName to the end of
|
||||
// this Client's URL. The blob name will be URL-encoded.
|
||||
// The new appendblob.Client uses the same request policy pipeline as this Client.
|
||||
func (c *Client) NewAppendBlobClient(blobName string) *appendblob.Client {
|
||||
blobName = url.PathEscape(blobName)
|
||||
blobURL := runtime.JoinPaths(c.URL(), blobName)
|
||||
return (*appendblob.Client)(base.NewAppendBlobClient(blobURL, c.generated().InternalClient().WithClientName(exported.ModuleName), c.sharedKey()))
|
||||
}
|
||||
|
||||
// NewBlockBlobClient creates a new blockblob.Client object by concatenating blobName to the end of
|
||||
// this Client's URL. The blob name will be URL-encoded.
|
||||
// The new blockblob.Client uses the same request policy pipeline as this Client.
|
||||
func (c *Client) NewBlockBlobClient(blobName string) *blockblob.Client {
|
||||
blobName = url.PathEscape(blobName)
|
||||
blobURL := runtime.JoinPaths(c.URL(), blobName)
|
||||
return (*blockblob.Client)(base.NewBlockBlobClient(blobURL, c.generated().InternalClient().WithClientName(exported.ModuleName), c.sharedKey()))
|
||||
}
|
||||
|
||||
// NewPageBlobClient creates a new pageblob.Client object by concatenating blobName to the end of
|
||||
// this Client's URL. The blob name will be URL-encoded.
|
||||
// The new pageblob.Client uses the same request policy pipeline as this Client.
|
||||
func (c *Client) NewPageBlobClient(blobName string) *pageblob.Client {
|
||||
blobName = url.PathEscape(blobName)
|
||||
blobURL := runtime.JoinPaths(c.URL(), blobName)
|
||||
return (*pageblob.Client)(base.NewPageBlobClient(blobURL, c.generated().InternalClient().WithClientName(exported.ModuleName), c.sharedKey()))
|
||||
}
|
||||
|
||||
// Create creates a new container within a storage account. If a container with the same name already exists, the operation fails.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/create-container.
|
||||
func (c *Client) Create(ctx context.Context, options *CreateOptions) (CreateResponse, error) {
|
||||
var opts *generated.ContainerClientCreateOptions
|
||||
var cpkScopes *generated.ContainerCPKScopeInfo
|
||||
if options != nil {
|
||||
opts = &generated.ContainerClientCreateOptions{
|
||||
Access: options.Access,
|
||||
Metadata: options.Metadata,
|
||||
}
|
||||
cpkScopes = options.CPKScopeInfo
|
||||
}
|
||||
resp, err := c.generated().Create(ctx, opts, cpkScopes)
|
||||
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// Delete marks the specified container for deletion. The container and any blobs contained within it are later deleted during garbage collection.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/delete-container.
|
||||
func (c *Client) Delete(ctx context.Context, options *DeleteOptions) (DeleteResponse, error) {
|
||||
opts, leaseAccessConditions, modifiedAccessConditions := options.format()
|
||||
resp, err := c.generated().Delete(ctx, opts, leaseAccessConditions, modifiedAccessConditions)
|
||||
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// Restore operation restore the contents and properties of a soft deleted container to a specified container.
|
||||
// For more information, see https://docs.microsoft.com/en-us/rest/api/storageservices/restore-container.
|
||||
func (c *Client) Restore(ctx context.Context, deletedContainerVersion string, options *RestoreOptions) (RestoreResponse, error) {
|
||||
urlParts, err := blob.ParseURL(c.URL())
|
||||
if err != nil {
|
||||
return RestoreResponse{}, err
|
||||
}
|
||||
|
||||
opts := &generated.ContainerClientRestoreOptions{
|
||||
DeletedContainerName: &urlParts.ContainerName,
|
||||
DeletedContainerVersion: &deletedContainerVersion,
|
||||
}
|
||||
resp, err := c.generated().Restore(ctx, opts)
|
||||
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// GetProperties returns the container's properties.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/get-container-metadata.
|
||||
func (c *Client) GetProperties(ctx context.Context, o *GetPropertiesOptions) (GetPropertiesResponse, error) {
|
||||
// NOTE: GetMetadata actually calls GetProperties internally because GetProperties returns the metadata AND the properties.
|
||||
// This allows us to not expose a GetMetadata method at all simplifying the API.
|
||||
// The optionals are nil, like they were in track 1.5
|
||||
opts, leaseAccessConditions := o.format()
|
||||
|
||||
resp, err := c.generated().GetProperties(ctx, opts, leaseAccessConditions)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// SetMetadata sets the container's metadata.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/set-container-metadata.
|
||||
func (c *Client) SetMetadata(ctx context.Context, o *SetMetadataOptions) (SetMetadataResponse, error) {
|
||||
metadataOptions, lac, mac := o.format()
|
||||
resp, err := c.generated().SetMetadata(ctx, metadataOptions, lac, mac)
|
||||
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// GetAccessPolicy returns the container's access policy. The access policy indicates whether container's blobs may be accessed publicly.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/get-container-acl.
|
||||
func (c *Client) GetAccessPolicy(ctx context.Context, o *GetAccessPolicyOptions) (GetAccessPolicyResponse, error) {
|
||||
options, ac := o.format()
|
||||
resp, err := c.generated().GetAccessPolicy(ctx, options, ac)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// SetAccessPolicy sets the container's permissions. The access policy indicates whether blobs in a container may be accessed publicly.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/set-container-acl.
|
||||
func (c *Client) SetAccessPolicy(ctx context.Context, o *SetAccessPolicyOptions) (SetAccessPolicyResponse, error) {
|
||||
accessPolicy, mac, lac, acl, err := o.format()
|
||||
if err != nil {
|
||||
return SetAccessPolicyResponse{}, err
|
||||
}
|
||||
resp, err := c.generated().SetAccessPolicy(ctx, acl, accessPolicy, mac, lac)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// GetAccountInfo provides account level information
|
||||
// For more information, see https://learn.microsoft.com/en-us/rest/api/storageservices/get-account-information?tabs=shared-access-signatures.
|
||||
func (c *Client) GetAccountInfo(ctx context.Context, o *GetAccountInfoOptions) (GetAccountInfoResponse, error) {
|
||||
getAccountInfoOptions := o.format()
|
||||
resp, err := c.generated().GetAccountInfo(ctx, getAccountInfoOptions)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// NewListBlobsFlatPager returns a pager for blobs starting from the specified Marker. Use an empty
|
||||
// Marker to start enumeration from the beginning. Blob names are returned in lexicographic order.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/list-blobs.
|
||||
func (c *Client) NewListBlobsFlatPager(o *ListBlobsFlatOptions) *runtime.Pager[ListBlobsFlatResponse] {
|
||||
listOptions := generated.ContainerClientListBlobFlatSegmentOptions{}
|
||||
if o != nil {
|
||||
listOptions.Include = o.Include.format()
|
||||
listOptions.Marker = o.Marker
|
||||
listOptions.Maxresults = o.MaxResults
|
||||
listOptions.Prefix = o.Prefix
|
||||
}
|
||||
return runtime.NewPager(runtime.PagingHandler[ListBlobsFlatResponse]{
|
||||
More: func(page ListBlobsFlatResponse) bool {
|
||||
return page.NextMarker != nil && len(*page.NextMarker) > 0
|
||||
},
|
||||
Fetcher: func(ctx context.Context, page *ListBlobsFlatResponse) (ListBlobsFlatResponse, error) {
|
||||
var req *policy.Request
|
||||
var err error
|
||||
if page == nil {
|
||||
req, err = c.generated().ListBlobFlatSegmentCreateRequest(ctx, &listOptions)
|
||||
} else {
|
||||
listOptions.Marker = page.NextMarker
|
||||
req, err = c.generated().ListBlobFlatSegmentCreateRequest(ctx, &listOptions)
|
||||
}
|
||||
if err != nil {
|
||||
return ListBlobsFlatResponse{}, err
|
||||
}
|
||||
resp, err := c.generated().InternalClient().Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return ListBlobsFlatResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusOK) {
|
||||
// TOOD: storage error?
|
||||
return ListBlobsFlatResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return c.generated().ListBlobFlatSegmentHandleResponse(resp)
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// NewListBlobsHierarchyPager returns a channel of blobs starting from the specified Marker. Use an empty
|
||||
// Marker to start enumeration from the beginning. Blob names are returned in lexicographic order.
|
||||
// After getting a segment, process it, and then call ListBlobsHierarchicalSegment again (passing the
|
||||
// previously-returned Marker) to get the next segment.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/list-blobs.
|
||||
func (c *Client) NewListBlobsHierarchyPager(delimiter string, o *ListBlobsHierarchyOptions) *runtime.Pager[ListBlobsHierarchyResponse] {
|
||||
listOptions := o.format()
|
||||
return runtime.NewPager(runtime.PagingHandler[ListBlobsHierarchyResponse]{
|
||||
More: func(page ListBlobsHierarchyResponse) bool {
|
||||
return page.NextMarker != nil && len(*page.NextMarker) > 0
|
||||
},
|
||||
Fetcher: func(ctx context.Context, page *ListBlobsHierarchyResponse) (ListBlobsHierarchyResponse, error) {
|
||||
var req *policy.Request
|
||||
var err error
|
||||
if page == nil {
|
||||
req, err = c.generated().ListBlobHierarchySegmentCreateRequest(ctx, delimiter, &listOptions)
|
||||
} else {
|
||||
listOptions.Marker = page.NextMarker
|
||||
req, err = c.generated().ListBlobHierarchySegmentCreateRequest(ctx, delimiter, &listOptions)
|
||||
}
|
||||
if err != nil {
|
||||
return ListBlobsHierarchyResponse{}, err
|
||||
}
|
||||
resp, err := c.generated().InternalClient().Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return ListBlobsHierarchyResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusOK) {
|
||||
return ListBlobsHierarchyResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return c.generated().ListBlobHierarchySegmentHandleResponse(resp)
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// GetSASURL is a convenience method for generating a SAS token for the currently pointed at container.
|
||||
// It can only be used if the credential supplied during creation was a SharedKeyCredential.
|
||||
func (c *Client) GetSASURL(permissions sas.ContainerPermissions, expiry time.Time, o *GetSASURLOptions) (string, error) {
|
||||
if c.sharedKey() == nil {
|
||||
return "", bloberror.MissingSharedKeyCredential
|
||||
}
|
||||
st := o.format()
|
||||
urlParts, err := blob.ParseURL(c.URL())
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
// Containers do not have snapshots, nor versions.
|
||||
qps, err := sas.BlobSignatureValues{
|
||||
Version: sas.Version,
|
||||
ContainerName: urlParts.ContainerName,
|
||||
Permissions: permissions.String(),
|
||||
StartTime: st,
|
||||
ExpiryTime: expiry.UTC(),
|
||||
}.SignWithSharedKey(c.sharedKey())
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
endpoint := c.URL() + "?" + qps.Encode()
|
||||
|
||||
return endpoint, nil
|
||||
}
|
||||
|
||||
// NewBatchBuilder creates an instance of BatchBuilder using the same auth policy as the client.
|
||||
// BatchBuilder is used to build the batch consisting of either delete or set tier sub-requests.
|
||||
// All sub-requests in the batch must be of the same type, either delete or set tier.
|
||||
func (c *Client) NewBatchBuilder() (*BatchBuilder, error) {
|
||||
var authPolicy policy.Policy
|
||||
|
||||
switch cred := c.credential().(type) {
|
||||
case *azcore.TokenCredential:
|
||||
conOptions := c.getClientOptions()
|
||||
authPolicy = shared.NewStorageChallengePolicy(*cred, base.GetAudience(conOptions), conOptions.InsecureAllowCredentialWithHTTP)
|
||||
case *SharedKeyCredential:
|
||||
authPolicy = exported.NewSharedKeyCredPolicy(cred)
|
||||
case nil:
|
||||
// for authentication using SAS
|
||||
authPolicy = nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unrecognised authentication type %T", cred)
|
||||
}
|
||||
|
||||
return &BatchBuilder{
|
||||
endpoint: c.URL(),
|
||||
authPolicy: authPolicy,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// SubmitBatch operation allows multiple API calls to be embedded into a single HTTP request.
|
||||
// It builds the request body using the BatchBuilder object passed.
|
||||
// BatchBuilder contains the list of operations to be submitted. It supports up to 256 sub-requests in a single batch.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/blob-batch.
|
||||
func (c *Client) SubmitBatch(ctx context.Context, bb *BatchBuilder, options *SubmitBatchOptions) (SubmitBatchResponse, error) {
|
||||
if bb == nil || len(bb.subRequests) == 0 {
|
||||
return SubmitBatchResponse{}, errors.New("batch builder is empty")
|
||||
}
|
||||
|
||||
// create the request body
|
||||
batchReq, batchID, err := exported.CreateBatchRequest(&exported.BlobBatchBuilder{
|
||||
AuthPolicy: bb.authPolicy,
|
||||
SubRequests: bb.subRequests,
|
||||
})
|
||||
if err != nil {
|
||||
return SubmitBatchResponse{}, err
|
||||
}
|
||||
|
||||
reader := bytes.NewReader(batchReq)
|
||||
rsc := streaming.NopCloser(reader)
|
||||
multipartContentType := "multipart/mixed; boundary=" + batchID
|
||||
|
||||
resp, err := c.generated().SubmitBatch(ctx, int64(len(batchReq)), multipartContentType, rsc, options.format())
|
||||
if err != nil {
|
||||
return SubmitBatchResponse{}, err
|
||||
}
|
||||
|
||||
batchResponses, err := exported.ParseBlobBatchResponse(resp.Body, resp.ContentType, bb.subRequests)
|
||||
if err != nil {
|
||||
return SubmitBatchResponse{}, err
|
||||
}
|
||||
|
||||
return SubmitBatchResponse{
|
||||
Responses: batchResponses,
|
||||
ContentType: resp.ContentType,
|
||||
RequestID: resp.RequestID,
|
||||
Version: resp.Version,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// FilterBlobs operation finds all blobs in the container whose tags match a given search expression.
|
||||
// https://docs.microsoft.com/en-us/rest/api/storageservices/find-blobs-by-tags-container
|
||||
// eg. "dog='germanshepherd' and penguin='emperorpenguin'"
|
||||
func (c *Client) FilterBlobs(ctx context.Context, where string, o *FilterBlobsOptions) (FilterBlobsResponse, error) {
|
||||
containerClientFilterBlobsOptions := o.format()
|
||||
resp, err := c.generated().FilterBlobs(ctx, where, containerClientFilterBlobsOptions)
|
||||
return resp, err
|
||||
}
|
150
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/container/constants.go
сгенерированный
поставляемый
Normal file
150
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/container/constants.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,150 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
package container
|
||||
|
||||
import "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated"
|
||||
|
||||
// AccessTier defines values for blob access tiers.
|
||||
type AccessTier = generated.AccessTier
|
||||
|
||||
const (
|
||||
AccessTierArchive AccessTier = generated.AccessTierArchive
|
||||
AccessTierCool AccessTier = generated.AccessTierCool
|
||||
AccessTierHot AccessTier = generated.AccessTierHot
|
||||
AccessTierP10 AccessTier = generated.AccessTierP10
|
||||
AccessTierP15 AccessTier = generated.AccessTierP15
|
||||
AccessTierP20 AccessTier = generated.AccessTierP20
|
||||
AccessTierP30 AccessTier = generated.AccessTierP30
|
||||
AccessTierP4 AccessTier = generated.AccessTierP4
|
||||
AccessTierP40 AccessTier = generated.AccessTierP40
|
||||
AccessTierP50 AccessTier = generated.AccessTierP50
|
||||
AccessTierP6 AccessTier = generated.AccessTierP6
|
||||
AccessTierP60 AccessTier = generated.AccessTierP60
|
||||
AccessTierP70 AccessTier = generated.AccessTierP70
|
||||
AccessTierP80 AccessTier = generated.AccessTierP80
|
||||
AccessTierPremium AccessTier = generated.AccessTierPremium
|
||||
)
|
||||
|
||||
// PossibleAccessTierValues returns the possible values for the AccessTier const type.
|
||||
func PossibleAccessTierValues() []AccessTier {
|
||||
return generated.PossibleAccessTierValues()
|
||||
}
|
||||
|
||||
// PublicAccessType defines values for AccessType - private (default) or blob or container.
|
||||
type PublicAccessType = generated.PublicAccessType
|
||||
|
||||
const (
|
||||
PublicAccessTypeBlob PublicAccessType = generated.PublicAccessTypeBlob
|
||||
PublicAccessTypeContainer PublicAccessType = generated.PublicAccessTypeContainer
|
||||
)
|
||||
|
||||
// PossiblePublicAccessTypeValues returns the possible values for the PublicAccessType const type.
|
||||
func PossiblePublicAccessTypeValues() []PublicAccessType {
|
||||
return generated.PossiblePublicAccessTypeValues()
|
||||
}
|
||||
|
||||
// SKUName defines values for SkuName - LRS, GRS, RAGRS, ZRS, Premium LRS.
|
||||
type SKUName = generated.SKUName
|
||||
|
||||
const (
|
||||
SKUNameStandardLRS SKUName = generated.SKUNameStandardLRS
|
||||
SKUNameStandardGRS SKUName = generated.SKUNameStandardGRS
|
||||
SKUNameStandardRAGRS SKUName = generated.SKUNameStandardRAGRS
|
||||
SKUNameStandardZRS SKUName = generated.SKUNameStandardZRS
|
||||
SKUNamePremiumLRS SKUName = generated.SKUNamePremiumLRS
|
||||
)
|
||||
|
||||
// PossibleSKUNameValues returns the possible values for the SKUName const type.
|
||||
func PossibleSKUNameValues() []SKUName {
|
||||
return generated.PossibleSKUNameValues()
|
||||
}
|
||||
|
||||
// AccountKind defines values for AccountKind
|
||||
type AccountKind = generated.AccountKind
|
||||
|
||||
const (
|
||||
AccountKindStorage AccountKind = generated.AccountKindStorage
|
||||
AccountKindBlobStorage AccountKind = generated.AccountKindBlobStorage
|
||||
AccountKindStorageV2 AccountKind = generated.AccountKindStorageV2
|
||||
AccountKindFileStorage AccountKind = generated.AccountKindFileStorage
|
||||
AccountKindBlockBlobStorage AccountKind = generated.AccountKindBlockBlobStorage
|
||||
)
|
||||
|
||||
// PossibleAccountKindValues returns the possible values for the AccountKind const type.
|
||||
func PossibleAccountKindValues() []AccountKind {
|
||||
return generated.PossibleAccountKindValues()
|
||||
}
|
||||
|
||||
// BlobType defines values for BlobType
|
||||
type BlobType = generated.BlobType
|
||||
|
||||
const (
|
||||
BlobTypeBlockBlob BlobType = generated.BlobTypeBlockBlob
|
||||
BlobTypePageBlob BlobType = generated.BlobTypePageBlob
|
||||
BlobTypeAppendBlob BlobType = generated.BlobTypeAppendBlob
|
||||
)
|
||||
|
||||
// PossibleBlobTypeValues returns the possible values for the BlobType const type.
|
||||
func PossibleBlobTypeValues() []BlobType {
|
||||
return generated.PossibleBlobTypeValues()
|
||||
}
|
||||
|
||||
// ArchiveStatus defines values for ArchiveStatus
|
||||
type ArchiveStatus = generated.ArchiveStatus
|
||||
|
||||
const (
|
||||
ArchiveStatusRehydratePendingToCool ArchiveStatus = generated.ArchiveStatusRehydratePendingToCool
|
||||
ArchiveStatusRehydratePendingToHot ArchiveStatus = generated.ArchiveStatusRehydratePendingToHot
|
||||
)
|
||||
|
||||
// PossibleArchiveStatusValues returns the possible values for the ArchiveStatus const type.
|
||||
func PossibleArchiveStatusValues() []ArchiveStatus {
|
||||
return generated.PossibleArchiveStatusValues()
|
||||
}
|
||||
|
||||
// CopyStatusType defines values for CopyStatusType
|
||||
type CopyStatusType = generated.CopyStatusType
|
||||
|
||||
const (
|
||||
CopyStatusTypePending CopyStatusType = generated.CopyStatusTypePending
|
||||
CopyStatusTypeSuccess CopyStatusType = generated.CopyStatusTypeSuccess
|
||||
CopyStatusTypeAborted CopyStatusType = generated.CopyStatusTypeAborted
|
||||
CopyStatusTypeFailed CopyStatusType = generated.CopyStatusTypeFailed
|
||||
)
|
||||
|
||||
// PossibleCopyStatusTypeValues returns the possible values for the CopyStatusType const type.
|
||||
func PossibleCopyStatusTypeValues() []CopyStatusType {
|
||||
return generated.PossibleCopyStatusTypeValues()
|
||||
}
|
||||
|
||||
// ImmutabilityPolicyMode defines values for ImmutabilityPolicyMode
|
||||
type ImmutabilityPolicyMode = generated.ImmutabilityPolicyMode
|
||||
|
||||
const (
|
||||
ImmutabilityPolicyModeMutable ImmutabilityPolicyMode = generated.ImmutabilityPolicyModeMutable
|
||||
ImmutabilityPolicyModeUnlocked ImmutabilityPolicyMode = generated.ImmutabilityPolicyModeUnlocked
|
||||
ImmutabilityPolicyModeLocked ImmutabilityPolicyMode = generated.ImmutabilityPolicyModeLocked
|
||||
)
|
||||
|
||||
// PossibleImmutabilityPolicyModeValues returns the possible values for the ImmutabilityPolicyMode const type.
|
||||
func PossibleImmutabilityPolicyModeValues() []ImmutabilityPolicyMode {
|
||||
return generated.PossibleImmutabilityPolicyModeValues()
|
||||
}
|
||||
|
||||
// RehydratePriority - If an object is in rehydrate pending state then this header is returned with priority of rehydrate.
|
||||
// Valid values are High and Standard.
|
||||
type RehydratePriority = generated.RehydratePriority
|
||||
|
||||
const (
|
||||
RehydratePriorityHigh RehydratePriority = generated.RehydratePriorityHigh
|
||||
RehydratePriorityStandard RehydratePriority = generated.RehydratePriorityStandard
|
||||
)
|
||||
|
||||
// PossibleRehydratePriorityValues returns the possible values for the RehydratePriority const type.
|
||||
func PossibleRehydratePriorityValues() []RehydratePriority {
|
||||
return generated.PossibleRehydratePriorityValues()
|
||||
}
|
427
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/container/models.go
сгенерированный
поставляемый
Normal file
427
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/container/models.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,427 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
package container
|
||||
|
||||
import (
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob"
|
||||
"reflect"
|
||||
"time"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/exported"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated"
|
||||
)
|
||||
|
||||
// SharedKeyCredential contains an account's name and its primary or secondary key.
|
||||
type SharedKeyCredential = exported.SharedKeyCredential
|
||||
|
||||
// NewSharedKeyCredential creates an immutable SharedKeyCredential containing the
|
||||
// storage account's name and either its primary or secondary key.
|
||||
func NewSharedKeyCredential(accountName, accountKey string) (*SharedKeyCredential, error) {
|
||||
return exported.NewSharedKeyCredential(accountName, accountKey)
|
||||
}
|
||||
|
||||
// Request Model Declaration -------------------------------------------------------------------------------------------
|
||||
|
||||
// CPKScopeInfo contains a group of parameters for the ContainerClient.Create method.
|
||||
type CPKScopeInfo = generated.ContainerCPKScopeInfo
|
||||
|
||||
// BlobFlatListSegment - List of BlobItem.
|
||||
type BlobFlatListSegment = generated.BlobFlatListSegment
|
||||
|
||||
// BlobHierarchyListSegment - List of BlobItem and BlobPrefix.
|
||||
type BlobHierarchyListSegment = generated.BlobHierarchyListSegment
|
||||
|
||||
// BlobProperties - Properties of a blob.
|
||||
type BlobProperties = generated.BlobProperties
|
||||
|
||||
// BlobItem - An Azure Storage blob.
|
||||
type BlobItem = generated.BlobItem
|
||||
|
||||
// BlobTags - Blob tags.
|
||||
type BlobTags = generated.BlobTags
|
||||
|
||||
// BlobPrefix is a blob's prefix when hierarchically listing blobs.
|
||||
type BlobPrefix = generated.BlobPrefix
|
||||
|
||||
// BlobTag - a key/value pair on a blob.
|
||||
type BlobTag = generated.BlobTag
|
||||
|
||||
// AccessConditions identifies container-specific access conditions which you optionally set.
|
||||
type AccessConditions = exported.ContainerAccessConditions
|
||||
|
||||
// LeaseAccessConditions contains optional parameters to access leased entity.
|
||||
type LeaseAccessConditions = exported.LeaseAccessConditions
|
||||
|
||||
// ModifiedAccessConditions contains a group of parameters for specifying access conditions.
|
||||
type ModifiedAccessConditions = exported.ModifiedAccessConditions
|
||||
|
||||
// AccessPolicy - An Access policy.
|
||||
type AccessPolicy = generated.AccessPolicy
|
||||
|
||||
// AccessPolicyPermission type simplifies creating the permissions string for a container's access policy.
|
||||
// Initialize an instance of this type and then call its String method to set AccessPolicy's Permission field.
|
||||
type AccessPolicyPermission = exported.AccessPolicyPermission
|
||||
|
||||
// SignedIdentifier - signed identifier.
|
||||
type SignedIdentifier = generated.SignedIdentifier
|
||||
|
||||
// Request Model Declaration -------------------------------------------------------------------------------------------
|
||||
|
||||
// CreateOptions contains the optional parameters for the Client.Create method.
|
||||
type CreateOptions struct {
|
||||
// Specifies whether data in the container may be accessed publicly and the level of access.
|
||||
Access *PublicAccessType
|
||||
|
||||
// Optional. Specifies a user-defined name-value pair associated with the blob.
|
||||
Metadata map[string]*string
|
||||
|
||||
// Optional. Specifies the encryption scope settings to set on the container.
|
||||
CPKScopeInfo *CPKScopeInfo
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// DeleteOptions contains the optional parameters for the Client.Delete method.
|
||||
type DeleteOptions struct {
|
||||
AccessConditions *AccessConditions
|
||||
}
|
||||
|
||||
func (o *DeleteOptions) format() (*generated.ContainerClientDeleteOptions, *generated.LeaseAccessConditions, *generated.ModifiedAccessConditions) {
|
||||
if o == nil {
|
||||
return nil, nil, nil
|
||||
}
|
||||
|
||||
leaseAccessConditions, modifiedAccessConditions := exported.FormatContainerAccessConditions(o.AccessConditions)
|
||||
return nil, leaseAccessConditions, modifiedAccessConditions
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// RestoreOptions contains the optional parameters for the Client.Restore method.
|
||||
type RestoreOptions struct {
|
||||
// placeholder for future options
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// GetPropertiesOptions contains the optional parameters for the ContainerClient.GetProperties method.
|
||||
type GetPropertiesOptions struct {
|
||||
LeaseAccessConditions *LeaseAccessConditions
|
||||
}
|
||||
|
||||
// ContainerClientGetPropertiesOptions contains the optional parameters for the ContainerClient.GetProperties method.
|
||||
func (o *GetPropertiesOptions) format() (*generated.ContainerClientGetPropertiesOptions, *generated.LeaseAccessConditions) {
|
||||
if o == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
return nil, o.LeaseAccessConditions
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// ListBlobsInclude indicates what additional information the service should return with each blob.
|
||||
type ListBlobsInclude struct {
|
||||
Copy, Metadata, Snapshots, UncommittedBlobs, Deleted, Tags, Versions, LegalHold, ImmutabilityPolicy, DeletedWithVersions bool
|
||||
}
|
||||
|
||||
func (l ListBlobsInclude) format() []generated.ListBlobsIncludeItem {
|
||||
if reflect.ValueOf(l).IsZero() {
|
||||
return nil
|
||||
}
|
||||
|
||||
include := []generated.ListBlobsIncludeItem{}
|
||||
|
||||
if l.Copy {
|
||||
include = append(include, generated.ListBlobsIncludeItemCopy)
|
||||
}
|
||||
if l.Deleted {
|
||||
include = append(include, generated.ListBlobsIncludeItemDeleted)
|
||||
}
|
||||
if l.DeletedWithVersions {
|
||||
include = append(include, generated.ListBlobsIncludeItemDeletedwithversions)
|
||||
}
|
||||
if l.ImmutabilityPolicy {
|
||||
include = append(include, generated.ListBlobsIncludeItemImmutabilitypolicy)
|
||||
}
|
||||
if l.LegalHold {
|
||||
include = append(include, generated.ListBlobsIncludeItemLegalhold)
|
||||
}
|
||||
if l.Metadata {
|
||||
include = append(include, generated.ListBlobsIncludeItemMetadata)
|
||||
}
|
||||
if l.Snapshots {
|
||||
include = append(include, generated.ListBlobsIncludeItemSnapshots)
|
||||
}
|
||||
if l.Tags {
|
||||
include = append(include, generated.ListBlobsIncludeItemTags)
|
||||
}
|
||||
if l.UncommittedBlobs {
|
||||
include = append(include, generated.ListBlobsIncludeItemUncommittedblobs)
|
||||
}
|
||||
if l.Versions {
|
||||
include = append(include, generated.ListBlobsIncludeItemVersions)
|
||||
}
|
||||
|
||||
return include
|
||||
}
|
||||
|
||||
// ListBlobsFlatOptions contains the optional parameters for the ContainerClient.ListBlobFlatSegment method.
|
||||
type ListBlobsFlatOptions struct {
|
||||
// Include this parameter to specify one or more datasets to include in the response.
|
||||
Include ListBlobsInclude
|
||||
// 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.
|
||||
Marker *string
|
||||
// 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.
|
||||
MaxResults *int32
|
||||
// Filters the results to return only containers whose name begins with the specified prefix.
|
||||
Prefix *string
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// ListBlobsHierarchyOptions provides set of configurations for Client.NewListBlobsHierarchyPager
|
||||
type ListBlobsHierarchyOptions struct {
|
||||
// Include this parameter to specify one or more datasets to include in the response.
|
||||
Include ListBlobsInclude
|
||||
// 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.
|
||||
Marker *string
|
||||
// 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.
|
||||
MaxResults *int32
|
||||
// Filters the results to return only containers whose name begins with the specified prefix.
|
||||
Prefix *string
|
||||
}
|
||||
|
||||
// ContainerClientListBlobHierarchySegmentOptions contains the optional parameters for the ContainerClient.ListBlobHierarchySegment method.
|
||||
func (o *ListBlobsHierarchyOptions) format() generated.ContainerClientListBlobHierarchySegmentOptions {
|
||||
if o == nil {
|
||||
return generated.ContainerClientListBlobHierarchySegmentOptions{}
|
||||
}
|
||||
|
||||
return generated.ContainerClientListBlobHierarchySegmentOptions{
|
||||
Include: o.Include.format(),
|
||||
Marker: o.Marker,
|
||||
Maxresults: o.MaxResults,
|
||||
Prefix: o.Prefix,
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// GetSASURLOptions contains the optional parameters for the Client.GetSASURL method.
|
||||
type GetSASURLOptions struct {
|
||||
StartTime *time.Time
|
||||
}
|
||||
|
||||
func (o *GetSASURLOptions) format() time.Time {
|
||||
if o == nil {
|
||||
return time.Time{}
|
||||
}
|
||||
|
||||
var st time.Time
|
||||
if o.StartTime != nil {
|
||||
st = o.StartTime.UTC()
|
||||
} else {
|
||||
st = time.Time{}
|
||||
}
|
||||
return st
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// SetMetadataOptions contains the optional parameters for the Client.SetMetadata method.
|
||||
type SetMetadataOptions struct {
|
||||
Metadata map[string]*string
|
||||
LeaseAccessConditions *LeaseAccessConditions
|
||||
ModifiedAccessConditions *ModifiedAccessConditions
|
||||
}
|
||||
|
||||
func (o *SetMetadataOptions) format() (*generated.ContainerClientSetMetadataOptions, *generated.LeaseAccessConditions, *generated.ModifiedAccessConditions) {
|
||||
if o == nil {
|
||||
return nil, nil, nil
|
||||
}
|
||||
|
||||
return &generated.ContainerClientSetMetadataOptions{Metadata: o.Metadata}, o.LeaseAccessConditions, o.ModifiedAccessConditions
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// GetAccessPolicyOptions contains the optional parameters for the Client.GetAccessPolicy method.
|
||||
type GetAccessPolicyOptions struct {
|
||||
LeaseAccessConditions *LeaseAccessConditions
|
||||
}
|
||||
|
||||
func (o *GetAccessPolicyOptions) format() (*generated.ContainerClientGetAccessPolicyOptions, *LeaseAccessConditions) {
|
||||
if o == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
return nil, o.LeaseAccessConditions
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// SetAccessPolicyOptions provides set of configurations for ContainerClient.SetAccessPolicy operation.
|
||||
type SetAccessPolicyOptions struct {
|
||||
// Specifies whether data in the container may be accessed publicly and the level of access.
|
||||
// If this header is not included in the request, container data is private to the account owner.
|
||||
Access *PublicAccessType
|
||||
AccessConditions *AccessConditions
|
||||
ContainerACL []*SignedIdentifier
|
||||
}
|
||||
|
||||
func (o *SetAccessPolicyOptions) format() (*generated.ContainerClientSetAccessPolicyOptions, *LeaseAccessConditions, *ModifiedAccessConditions, []*SignedIdentifier, error) {
|
||||
if o == nil {
|
||||
return nil, nil, nil, nil, nil
|
||||
}
|
||||
if o.ContainerACL != nil {
|
||||
for _, c := range o.ContainerACL {
|
||||
err := formatTime(c)
|
||||
if err != nil {
|
||||
return nil, nil, nil, nil, err
|
||||
}
|
||||
}
|
||||
}
|
||||
lac, mac := exported.FormatContainerAccessConditions(o.AccessConditions)
|
||||
return &generated.ContainerClientSetAccessPolicyOptions{
|
||||
Access: o.Access,
|
||||
}, lac, mac, o.ContainerACL, nil
|
||||
}
|
||||
|
||||
func formatTime(c *SignedIdentifier) error {
|
||||
if c.AccessPolicy == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
if c.AccessPolicy.Start != nil {
|
||||
st, err := time.Parse(time.RFC3339, c.AccessPolicy.Start.UTC().Format(time.RFC3339))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
c.AccessPolicy.Start = &st
|
||||
}
|
||||
if c.AccessPolicy.Expiry != nil {
|
||||
et, err := time.Parse(time.RFC3339, c.AccessPolicy.Expiry.UTC().Format(time.RFC3339))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
c.AccessPolicy.Expiry = &et
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// GetAccountInfoOptions provides set of options for Client.GetAccountInfo
|
||||
type GetAccountInfoOptions struct {
|
||||
// placeholder for future options
|
||||
}
|
||||
|
||||
func (o *GetAccountInfoOptions) format() *generated.ContainerClientGetAccountInfoOptions {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// BatchDeleteOptions contains the optional parameters for the BatchBuilder.Delete method.
|
||||
type BatchDeleteOptions struct {
|
||||
blob.DeleteOptions
|
||||
VersionID *string
|
||||
Snapshot *string
|
||||
}
|
||||
|
||||
func (o *BatchDeleteOptions) format() (*generated.BlobClientDeleteOptions, *generated.LeaseAccessConditions, *generated.ModifiedAccessConditions) {
|
||||
if o == nil {
|
||||
return nil, nil, nil
|
||||
}
|
||||
|
||||
basics := generated.BlobClientDeleteOptions{
|
||||
DeleteSnapshots: o.DeleteSnapshots,
|
||||
DeleteType: o.BlobDeleteType, // None by default
|
||||
Snapshot: o.Snapshot,
|
||||
VersionID: o.VersionID,
|
||||
}
|
||||
|
||||
leaseAccessConditions, modifiedAccessConditions := exported.FormatBlobAccessConditions(o.AccessConditions)
|
||||
return &basics, leaseAccessConditions, modifiedAccessConditions
|
||||
}
|
||||
|
||||
// BatchSetTierOptions contains the optional parameters for the BatchBuilder.SetTier method.
|
||||
type BatchSetTierOptions struct {
|
||||
blob.SetTierOptions
|
||||
VersionID *string
|
||||
Snapshot *string
|
||||
}
|
||||
|
||||
func (o *BatchSetTierOptions) format() (*generated.BlobClientSetTierOptions, *generated.LeaseAccessConditions, *generated.ModifiedAccessConditions) {
|
||||
if o == nil {
|
||||
return nil, nil, nil
|
||||
}
|
||||
|
||||
basics := generated.BlobClientSetTierOptions{
|
||||
RehydratePriority: o.RehydratePriority,
|
||||
Snapshot: o.Snapshot,
|
||||
VersionID: o.VersionID,
|
||||
}
|
||||
|
||||
leaseAccessConditions, modifiedAccessConditions := exported.FormatBlobAccessConditions(o.AccessConditions)
|
||||
return &basics, leaseAccessConditions, modifiedAccessConditions
|
||||
}
|
||||
|
||||
// SubmitBatchOptions contains the optional parameters for the Client.SubmitBatch method.
|
||||
type SubmitBatchOptions struct {
|
||||
// placeholder for future options
|
||||
}
|
||||
|
||||
func (o *SubmitBatchOptions) format() *generated.ContainerClientSubmitBatchOptions {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// FilterBlobsOptions provides set of options for Client.FilterBlobs.
|
||||
type FilterBlobsOptions struct {
|
||||
// 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.
|
||||
Marker *string
|
||||
// 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.
|
||||
MaxResults *int32
|
||||
}
|
||||
|
||||
func (o *FilterBlobsOptions) format() *generated.ContainerClientFilterBlobsOptions {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return &generated.ContainerClientFilterBlobsOptions{
|
||||
Marker: o.Marker,
|
||||
Maxresults: o.MaxResults,
|
||||
}
|
||||
}
|
69
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/container/responses.go
сгенерированный
поставляемый
Normal file
69
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/container/responses.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,69 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
package container
|
||||
|
||||
import (
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/exported"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated"
|
||||
)
|
||||
|
||||
// CreateResponse contains the response from method Client.Create.
|
||||
type CreateResponse = generated.ContainerClientCreateResponse
|
||||
|
||||
// DeleteResponse contains the response from method Client.Delete.
|
||||
type DeleteResponse = generated.ContainerClientDeleteResponse
|
||||
|
||||
// RestoreResponse contains the response from method Client.Restore.
|
||||
type RestoreResponse = generated.ContainerClientRestoreResponse
|
||||
|
||||
// GetPropertiesResponse contains the response from method Client.GetProperties.
|
||||
type GetPropertiesResponse = generated.ContainerClientGetPropertiesResponse
|
||||
|
||||
// ListBlobsFlatResponse contains the response from method Client.ListBlobFlatSegment.
|
||||
type ListBlobsFlatResponse = generated.ContainerClientListBlobFlatSegmentResponse
|
||||
|
||||
// ListBlobsFlatSegmentResponse - An enumeration of blobs
|
||||
type ListBlobsFlatSegmentResponse = generated.ListBlobsFlatSegmentResponse
|
||||
|
||||
// ListBlobsHierarchyResponse contains the response from method Client.ListBlobHierarchySegment.
|
||||
type ListBlobsHierarchyResponse = generated.ContainerClientListBlobHierarchySegmentResponse
|
||||
|
||||
// ListBlobsHierarchySegmentResponse - An enumeration of blobs
|
||||
type ListBlobsHierarchySegmentResponse = generated.ListBlobsHierarchySegmentResponse
|
||||
|
||||
// SetMetadataResponse contains the response from method Client.SetMetadata.
|
||||
type SetMetadataResponse = generated.ContainerClientSetMetadataResponse
|
||||
|
||||
// GetAccessPolicyResponse contains the response from method Client.GetAccessPolicy.
|
||||
type GetAccessPolicyResponse = generated.ContainerClientGetAccessPolicyResponse
|
||||
|
||||
// SetAccessPolicyResponse contains the response from method Client.SetAccessPolicy.
|
||||
type SetAccessPolicyResponse = generated.ContainerClientSetAccessPolicyResponse
|
||||
|
||||
// GetAccountInfoResponse contains the response from method Client.GetAccountInfo.
|
||||
type GetAccountInfoResponse = generated.ContainerClientGetAccountInfoResponse
|
||||
|
||||
// SubmitBatchResponse contains the response from method Client.SubmitBatch.
|
||||
type SubmitBatchResponse struct {
|
||||
// Responses contains the responses of the sub-requests in the batch
|
||||
Responses []*BatchResponseItem
|
||||
|
||||
// ContentType contains the information returned from the Content-Type header response.
|
||||
ContentType *string
|
||||
|
||||
// RequestID contains the information returned from the x-ms-request-id header response.
|
||||
RequestID *string
|
||||
|
||||
// Version contains the information returned from the x-ms-version header response.
|
||||
Version *string
|
||||
}
|
||||
|
||||
// BatchResponseItem contains the response for the individual sub-requests.
|
||||
type BatchResponseItem = exported.BatchResponseItem
|
||||
|
||||
// FilterBlobsResponse contains the response from method Client.FilterBlobs.
|
||||
type FilterBlobsResponse = generated.ContainerClientFilterBlobsResponse
|
210
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/doc.go
сгенерированный
поставляемый
Normal file
210
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/doc.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,210 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
/*
|
||||
|
||||
Package azblob can access an Azure Blob Storage.
|
||||
|
||||
The azblob package is capable of :-
|
||||
- Creating, deleting, and querying containers in an account
|
||||
- Creating, deleting, and querying blobs in a container
|
||||
- Creating Shared Access Signature for authentication
|
||||
|
||||
Types of Resources
|
||||
|
||||
The azblob package allows you to interact with three types of resources :-
|
||||
|
||||
* Azure storage accounts.
|
||||
* Containers within those storage accounts.
|
||||
* Blobs (block blobs/ page blobs/ append blobs) within those containers.
|
||||
|
||||
The Azure Blob Storage (azblob) client library for Go allows you to interact with each of these components through the use of a dedicated client object.
|
||||
To create a client object, you will need the account's blob service endpoint URL and a credential that allows you to access the account.
|
||||
|
||||
Types of Credentials
|
||||
|
||||
The clients support different forms of authentication.
|
||||
The azblob library supports any of the `azcore.TokenCredential` interfaces, authorization via a Connection String,
|
||||
or authorization with a Shared Access Signature token.
|
||||
|
||||
Using a Shared Key
|
||||
|
||||
To use an account shared key (aka account key or access key), provide the key as a string.
|
||||
This can be found in your storage account in the Azure Portal under the "Access Keys" section.
|
||||
|
||||
Use the key as the credential parameter to authenticate the client:
|
||||
|
||||
accountName, ok := os.LookupEnv("AZURE_STORAGE_ACCOUNT_NAME")
|
||||
if !ok {
|
||||
panic("AZURE_STORAGE_ACCOUNT_NAME could not be found")
|
||||
}
|
||||
accountKey, ok := os.LookupEnv("AZURE_STORAGE_ACCOUNT_KEY")
|
||||
if !ok {
|
||||
panic("AZURE_STORAGE_ACCOUNT_KEY could not be found")
|
||||
}
|
||||
|
||||
serviceURL := fmt.Sprintf("https://%s.blob.core.windows.net/", accountName)
|
||||
|
||||
cred, err := azblob.NewSharedKeyCredential(accountName, accountKey)
|
||||
handle(err)
|
||||
|
||||
serviceClient, err := azblob.NewClientWithSharedKeyCredential(serviceURL, cred, nil)
|
||||
handle(err)
|
||||
|
||||
fmt.Println(serviceClient.URL())
|
||||
|
||||
Using a Connection String
|
||||
|
||||
Depending on your use case and authorization method, you may prefer to initialize a client instance with a connection string instead of providing the account URL and credential separately.
|
||||
To do this, pass the connection string to the service client's `NewClientFromConnectionString` method.
|
||||
The connection string can be found in your storage account in the Azure Portal under the "Access Keys" section.
|
||||
|
||||
connStr := "DefaultEndpointsProtocol=https;AccountName=<my_account_name>;AccountKey=<my_account_key>;EndpointSuffix=core.windows.net"
|
||||
serviceClient, err := azblob.NewClientFromConnectionString(connStr, nil)
|
||||
handle(err)
|
||||
|
||||
Using a Shared Access Signature (SAS) Token
|
||||
|
||||
To use a shared access signature (SAS) token, provide the token at the end of your service URL.
|
||||
You can generate a SAS token from the Azure Portal under Shared Access Signature or use the ServiceClient.GetSASToken() functions.
|
||||
|
||||
accountName, ok := os.LookupEnv("AZURE_STORAGE_ACCOUNT_NAME")
|
||||
if !ok {
|
||||
panic("AZURE_STORAGE_ACCOUNT_NAME could not be found")
|
||||
}
|
||||
accountKey, ok := os.LookupEnv("AZURE_STORAGE_ACCOUNT_KEY")
|
||||
if !ok {
|
||||
panic("AZURE_STORAGE_ACCOUNT_KEY could not be found")
|
||||
}
|
||||
serviceURL := fmt.Sprintf("https://%s.blob.core.windows.net/", accountName)
|
||||
|
||||
cred, err := azblob.NewSharedKeyCredential(accountName, accountKey)
|
||||
handle(err)
|
||||
serviceClient, err := azblob.NewClientWithSharedKeyCredential(serviceURL, cred, nil)
|
||||
handle(err)
|
||||
fmt.Println(serviceClient.URL())
|
||||
|
||||
// Alternatively, you can create SAS on the fly
|
||||
|
||||
resources := sas.AccountResourceTypes{Service: true}
|
||||
permission := sas.AccountPermissions{Read: true}
|
||||
start := time.Now()
|
||||
expiry := start.AddDate(0, 0, 1)
|
||||
serviceURLWithSAS, err := serviceClient.ServiceClient().GetSASURL(resources, permission, expiry, &service.GetSASURLOptions{StartTime: &start})
|
||||
handle(err)
|
||||
|
||||
serviceClientWithSAS, err := azblob.NewClientWithNoCredential(serviceURLWithSAS, nil)
|
||||
handle(err)
|
||||
|
||||
fmt.Println(serviceClientWithSAS.URL())
|
||||
|
||||
Types of Clients
|
||||
|
||||
There are three different clients provided to interact with the various components of the Blob Service:
|
||||
|
||||
1. **`ServiceClient`**
|
||||
* Get and set account settings.
|
||||
* Query, create, and delete containers within the account.
|
||||
|
||||
2. **`ContainerClient`**
|
||||
* Get and set container access settings, properties, and metadata.
|
||||
* Create, delete, and query blobs within the container.
|
||||
* `ContainerLeaseClient` to support container lease management.
|
||||
|
||||
3. **`BlobClient`**
|
||||
* `AppendBlobClient`, `BlockBlobClient`, and `PageBlobClient`
|
||||
* Get and set blob properties.
|
||||
* Perform CRUD operations on a given blob.
|
||||
* `BlobLeaseClient` to support blob lease management.
|
||||
|
||||
Examples
|
||||
|
||||
// Your account name and key can be obtained from the Azure Portal.
|
||||
accountName, ok := os.LookupEnv("AZURE_STORAGE_ACCOUNT_NAME")
|
||||
if !ok {
|
||||
panic("AZURE_STORAGE_ACCOUNT_NAME could not be found")
|
||||
}
|
||||
|
||||
accountKey, ok := os.LookupEnv("AZURE_STORAGE_ACCOUNT_KEY")
|
||||
if !ok {
|
||||
panic("AZURE_STORAGE_ACCOUNT_KEY could not be found")
|
||||
}
|
||||
cred, err := azblob.NewSharedKeyCredential(accountName, accountKey)
|
||||
handle(err)
|
||||
|
||||
// The service URL for blob endpoints is usually in the form: http(s)://<account>.blob.core.windows.net/
|
||||
serviceClient, err := azblob.NewClientWithSharedKeyCredential(fmt.Sprintf("https://%s.blob.core.windows.net/", accountName), cred, nil)
|
||||
handle(err)
|
||||
|
||||
// ===== 1. Create a container =====
|
||||
|
||||
// First, create a container client, and use the Create method to create a new container in your account
|
||||
containerClient := serviceClient.ServiceClient().NewContainerClient("testcontainer")
|
||||
handle(err)
|
||||
|
||||
// All APIs have an options' bag struct as a parameter.
|
||||
// The options' bag struct allows you to specify optional parameters such as metadata, public access types, etc.
|
||||
// If you want to use the default options, pass in nil.
|
||||
_, err = containerClient.Create(context.TODO(), nil)
|
||||
handle(err)
|
||||
|
||||
// ===== 2. Upload and Download a block blob =====
|
||||
uploadData := "Hello world!"
|
||||
|
||||
// Create a new blockBlobClient from the containerClient
|
||||
blockBlobClient := containerClient.NewBlockBlobClient("HelloWorld.txt")
|
||||
handle(err)
|
||||
|
||||
// Upload data to the block blob
|
||||
blockBlobUploadOptions := blockblob.UploadOptions{
|
||||
Metadata: map[string]*string{"Foo": to.Ptr("Bar")},
|
||||
Tags: map[string]string{"Year": "2022"},
|
||||
}
|
||||
_, err = blockBlobClient.Upload(context.TODO(), streaming.NopCloser(strings.NewReader(uploadData)), &blockBlobUploadOptions)
|
||||
handle(err)
|
||||
|
||||
// Download the blob's contents and ensure that the download worked properly
|
||||
blobDownloadResponse, err := blockBlobClient.DownloadStream(context.TODO(), nil)
|
||||
handle(err)
|
||||
|
||||
// Use the bytes.Buffer object to read the downloaded data.
|
||||
// RetryReaderOptions has a lot of in-depth tuning abilities, but for the sake of simplicity, we'll omit those here.
|
||||
reader := blobDownloadResponse.Body(nil)
|
||||
downloadData, err := io.ReadAll(reader)
|
||||
handle(err)
|
||||
if string(downloadData) != uploadData {
|
||||
handle(errors.New("uploaded data should be same as downloaded data"))
|
||||
}
|
||||
|
||||
if err = reader.Close(); err != nil {
|
||||
handle(err)
|
||||
return
|
||||
}
|
||||
|
||||
// ===== 3. List blobs =====
|
||||
// List methods returns a pager object which can be used to iterate over the results of a paging operation.
|
||||
// To iterate over a page use the NextPage(context.Context) to fetch the next page of results.
|
||||
// PageResponse() can be used to iterate over the results of the specific page.
|
||||
// Always check the Err() method after paging to see if an error was returned by the pager. A pager will return either an error or the page of results.
|
||||
pager := containerClient.NewListBlobsFlatPager(nil)
|
||||
for pager.More() {
|
||||
resp, err := pager.NextPage(context.TODO())
|
||||
handle(err)
|
||||
for _, v := range resp.Segment.BlobItems {
|
||||
fmt.Println(*v.Name)
|
||||
}
|
||||
}
|
||||
|
||||
// Delete the blob.
|
||||
_, err = blockBlobClient.Delete(context.TODO(), nil)
|
||||
handle(err)
|
||||
|
||||
// Delete the container.
|
||||
_, err = containerClient.Delete(context.TODO(), nil)
|
||||
handle(err)
|
||||
*/
|
||||
|
||||
package azblob
|
129
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/base/clients.go
сгенерированный
поставляемый
Normal file
129
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/base/clients.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,129 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
package base
|
||||
|
||||
import (
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/exported"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/shared"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// ClientOptions contains the optional parameters when creating a Client.
|
||||
type ClientOptions struct {
|
||||
azcore.ClientOptions
|
||||
|
||||
// Audience to use when requesting tokens for Azure Active Directory authentication.
|
||||
// Only has an effect when credential is of type TokenCredential. The value could be
|
||||
// https://storage.azure.com/ (default) or https://<account>.blob.core.windows.net.
|
||||
Audience string
|
||||
}
|
||||
|
||||
type Client[T any] struct {
|
||||
inner *T
|
||||
credential any
|
||||
options *ClientOptions
|
||||
}
|
||||
|
||||
func InnerClient[T any](client *Client[T]) *T {
|
||||
return client.inner
|
||||
}
|
||||
|
||||
func SharedKey[T any](client *Client[T]) *exported.SharedKeyCredential {
|
||||
switch cred := client.credential.(type) {
|
||||
case *exported.SharedKeyCredential:
|
||||
return cred
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func Credential[T any](client *Client[T]) any {
|
||||
return client.credential
|
||||
}
|
||||
|
||||
func GetClientOptions[T any](client *Client[T]) *ClientOptions {
|
||||
return client.options
|
||||
}
|
||||
|
||||
func GetAudience(clOpts *ClientOptions) string {
|
||||
if clOpts == nil || len(strings.TrimSpace(clOpts.Audience)) == 0 {
|
||||
return shared.TokenScope
|
||||
} else {
|
||||
return strings.TrimRight(clOpts.Audience, "/") + "/.default"
|
||||
}
|
||||
}
|
||||
|
||||
func NewClient[T any](inner *T) *Client[T] {
|
||||
return &Client[T]{inner: inner}
|
||||
}
|
||||
|
||||
func NewServiceClient(containerURL string, azClient *azcore.Client, credential any, options *ClientOptions) *Client[generated.ServiceClient] {
|
||||
return &Client[generated.ServiceClient]{
|
||||
inner: generated.NewServiceClient(containerURL, azClient),
|
||||
credential: credential,
|
||||
options: options,
|
||||
}
|
||||
}
|
||||
|
||||
func NewContainerClient(containerURL string, azClient *azcore.Client, credential any, options *ClientOptions) *Client[generated.ContainerClient] {
|
||||
return &Client[generated.ContainerClient]{
|
||||
inner: generated.NewContainerClient(containerURL, azClient),
|
||||
credential: credential,
|
||||
options: options,
|
||||
}
|
||||
}
|
||||
|
||||
func NewBlobClient(blobURL string, azClient *azcore.Client, credential any, options *ClientOptions) *Client[generated.BlobClient] {
|
||||
return &Client[generated.BlobClient]{
|
||||
inner: generated.NewBlobClient(blobURL, azClient),
|
||||
credential: credential,
|
||||
options: options,
|
||||
}
|
||||
}
|
||||
|
||||
type CompositeClient[T, U any] struct {
|
||||
innerT *T
|
||||
innerU *U
|
||||
sharedKey *exported.SharedKeyCredential
|
||||
}
|
||||
|
||||
func InnerClients[T, U any](client *CompositeClient[T, U]) (*Client[T], *U) {
|
||||
return &Client[T]{
|
||||
inner: client.innerT,
|
||||
credential: client.sharedKey,
|
||||
}, client.innerU
|
||||
}
|
||||
|
||||
func NewAppendBlobClient(blobURL string, azClient *azcore.Client, sharedKey *exported.SharedKeyCredential) *CompositeClient[generated.BlobClient, generated.AppendBlobClient] {
|
||||
return &CompositeClient[generated.BlobClient, generated.AppendBlobClient]{
|
||||
innerT: generated.NewBlobClient(blobURL, azClient),
|
||||
innerU: generated.NewAppendBlobClient(blobURL, azClient),
|
||||
sharedKey: sharedKey,
|
||||
}
|
||||
}
|
||||
|
||||
func NewBlockBlobClient(blobURL string, azClient *azcore.Client, sharedKey *exported.SharedKeyCredential) *CompositeClient[generated.BlobClient, generated.BlockBlobClient] {
|
||||
return &CompositeClient[generated.BlobClient, generated.BlockBlobClient]{
|
||||
innerT: generated.NewBlobClient(blobURL, azClient),
|
||||
innerU: generated.NewBlockBlobClient(blobURL, azClient),
|
||||
sharedKey: sharedKey,
|
||||
}
|
||||
}
|
||||
|
||||
func NewPageBlobClient(blobURL string, azClient *azcore.Client, sharedKey *exported.SharedKeyCredential) *CompositeClient[generated.BlobClient, generated.PageBlobClient] {
|
||||
return &CompositeClient[generated.BlobClient, generated.PageBlobClient]{
|
||||
innerT: generated.NewBlobClient(blobURL, azClient),
|
||||
innerU: generated.NewPageBlobClient(blobURL, azClient),
|
||||
sharedKey: sharedKey,
|
||||
}
|
||||
}
|
||||
|
||||
func SharedKeyComposite[T, U any](client *CompositeClient[T, U]) *exported.SharedKeyCredential {
|
||||
return client.sharedKey
|
||||
}
|
43
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/exported/access_conditions.go
сгенерированный
поставляемый
Normal file
43
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/exported/access_conditions.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,43 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
package exported
|
||||
|
||||
import "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated"
|
||||
|
||||
const SnapshotTimeFormat = "2006-01-02T15:04:05.0000000Z07:00"
|
||||
|
||||
// ContainerAccessConditions identifies container-specific access conditions which you optionally set.
|
||||
type ContainerAccessConditions struct {
|
||||
ModifiedAccessConditions *ModifiedAccessConditions
|
||||
LeaseAccessConditions *LeaseAccessConditions
|
||||
}
|
||||
|
||||
func FormatContainerAccessConditions(b *ContainerAccessConditions) (*LeaseAccessConditions, *ModifiedAccessConditions) {
|
||||
if b == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return b.LeaseAccessConditions, b.ModifiedAccessConditions
|
||||
}
|
||||
|
||||
// BlobAccessConditions identifies blob-specific access conditions which you optionally set.
|
||||
type BlobAccessConditions struct {
|
||||
LeaseAccessConditions *LeaseAccessConditions
|
||||
ModifiedAccessConditions *ModifiedAccessConditions
|
||||
}
|
||||
|
||||
func FormatBlobAccessConditions(b *BlobAccessConditions) (*LeaseAccessConditions, *ModifiedAccessConditions) {
|
||||
if b == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return b.LeaseAccessConditions, b.ModifiedAccessConditions
|
||||
}
|
||||
|
||||
// LeaseAccessConditions contains optional parameters to access leased entity.
|
||||
type LeaseAccessConditions = generated.LeaseAccessConditions
|
||||
|
||||
// ModifiedAccessConditions contains a group of parameters for specifying access conditions.
|
||||
type ModifiedAccessConditions = generated.ModifiedAccessConditions
|
67
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/exported/access_policy.go
сгенерированный
поставляемый
Normal file
67
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/exported/access_policy.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,67 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
package exported
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// AccessPolicyPermission type simplifies creating the permissions string for a container's access policy.
|
||||
// Initialize an instance of this type and then call its String method to set AccessPolicy's Permission field.
|
||||
type AccessPolicyPermission struct {
|
||||
Read, Add, Create, Write, Delete, List bool
|
||||
}
|
||||
|
||||
// String produces the access policy permission string for an Azure Storage container.
|
||||
// Call this method to set AccessPolicy's Permission field.
|
||||
func (p *AccessPolicyPermission) String() string {
|
||||
var b bytes.Buffer
|
||||
if p.Read {
|
||||
b.WriteRune('r')
|
||||
}
|
||||
if p.Add {
|
||||
b.WriteRune('a')
|
||||
}
|
||||
if p.Create {
|
||||
b.WriteRune('c')
|
||||
}
|
||||
if p.Write {
|
||||
b.WriteRune('w')
|
||||
}
|
||||
if p.Delete {
|
||||
b.WriteRune('d')
|
||||
}
|
||||
if p.List {
|
||||
b.WriteRune('l')
|
||||
}
|
||||
return b.String()
|
||||
}
|
||||
|
||||
// Parse initializes the AccessPolicyPermission's fields from a string.
|
||||
func (p *AccessPolicyPermission) Parse(s string) error {
|
||||
*p = AccessPolicyPermission{} // Clear the flags
|
||||
for _, r := range s {
|
||||
switch r {
|
||||
case 'r':
|
||||
p.Read = true
|
||||
case 'a':
|
||||
p.Add = true
|
||||
case 'c':
|
||||
p.Create = true
|
||||
case 'w':
|
||||
p.Write = true
|
||||
case 'd':
|
||||
p.Delete = true
|
||||
case 'l':
|
||||
p.List = true
|
||||
default:
|
||||
return fmt.Errorf("invalid permission: '%v'", r)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
280
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/exported/blob_batch.go
сгенерированный
поставляемый
Normal file
280
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/exported/blob_batch.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,280 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
package exported
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"mime"
|
||||
"mime/multipart"
|
||||
"net/http"
|
||||
"net/textproto"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/internal/log"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/internal/uuid"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/shared"
|
||||
)
|
||||
|
||||
const (
|
||||
batchIdPrefix = "batch_"
|
||||
httpVersion = "HTTP/1.1"
|
||||
httpNewline = "\r\n"
|
||||
)
|
||||
|
||||
// createBatchID is used for creating a new batch id which is used as batch boundary in the request body
|
||||
func createBatchID() (string, error) {
|
||||
batchID, err := uuid.New()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return batchIdPrefix + batchID.String(), nil
|
||||
}
|
||||
|
||||
// buildSubRequest is used for building the sub-request. Example:
|
||||
// DELETE /container0/blob0 HTTP/1.1
|
||||
// x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT
|
||||
// Authorization: SharedKey account:<redacted>
|
||||
// Content-Length: 0
|
||||
func buildSubRequest(req *policy.Request) []byte {
|
||||
var batchSubRequest strings.Builder
|
||||
blobPath := req.Raw().URL.EscapedPath()
|
||||
if len(req.Raw().URL.RawQuery) > 0 {
|
||||
blobPath += "?" + req.Raw().URL.RawQuery
|
||||
}
|
||||
|
||||
batchSubRequest.WriteString(fmt.Sprintf("%s %s %s%s", req.Raw().Method, blobPath, httpVersion, httpNewline))
|
||||
|
||||
for k, v := range req.Raw().Header {
|
||||
if strings.EqualFold(k, shared.HeaderXmsVersion) {
|
||||
continue
|
||||
}
|
||||
if len(v) > 0 {
|
||||
batchSubRequest.WriteString(fmt.Sprintf("%v: %v%v", k, v[0], httpNewline))
|
||||
}
|
||||
}
|
||||
|
||||
batchSubRequest.WriteString(httpNewline)
|
||||
return []byte(batchSubRequest.String())
|
||||
}
|
||||
|
||||
// CreateBatchRequest creates a new batch request using the sub-requests present in the BlobBatchBuilder.
|
||||
//
|
||||
// Example of a sub-request in the batch request body:
|
||||
//
|
||||
// --batch_357de4f7-6d0b-4e02-8cd2-6361411a9525
|
||||
// Content-Type: application/http
|
||||
// Content-Transfer-Encoding: binary
|
||||
// Content-ID: 0
|
||||
//
|
||||
// DELETE /container0/blob0 HTTP/1.1
|
||||
// x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT
|
||||
// Authorization: SharedKey account:<redacted>
|
||||
// Content-Length: 0
|
||||
func CreateBatchRequest(bb *BlobBatchBuilder) ([]byte, string, error) {
|
||||
batchID, err := createBatchID()
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
|
||||
// Create a new multipart buffer
|
||||
reqBody := &bytes.Buffer{}
|
||||
writer := multipart.NewWriter(reqBody)
|
||||
|
||||
// Set the boundary
|
||||
err = writer.SetBoundary(batchID)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
|
||||
partHeaders := make(textproto.MIMEHeader)
|
||||
partHeaders["Content-Type"] = []string{"application/http"}
|
||||
partHeaders["Content-Transfer-Encoding"] = []string{"binary"}
|
||||
var partWriter io.Writer
|
||||
|
||||
for i, req := range bb.SubRequests {
|
||||
if bb.AuthPolicy != nil {
|
||||
_, err := bb.AuthPolicy.Do(req)
|
||||
if err != nil && !strings.EqualFold(err.Error(), "no more policies") {
|
||||
if log.Should(EventSubmitBatch) {
|
||||
log.Writef(EventSubmitBatch, "failed to authorize sub-request for %v.\nError: %v", req.Raw().URL.Path, err.Error())
|
||||
}
|
||||
return nil, "", err
|
||||
}
|
||||
}
|
||||
|
||||
partHeaders["Content-ID"] = []string{fmt.Sprintf("%v", i)}
|
||||
partWriter, err = writer.CreatePart(partHeaders)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
|
||||
_, err = partWriter.Write(buildSubRequest(req))
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
}
|
||||
|
||||
// Close the multipart writer
|
||||
err = writer.Close()
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
|
||||
return reqBody.Bytes(), batchID, nil
|
||||
}
|
||||
|
||||
// UpdateSubRequestHeaders updates the sub-request headers.
|
||||
// Removes x-ms-version header.
|
||||
func UpdateSubRequestHeaders(req *policy.Request) {
|
||||
// remove x-ms-version header from the request header
|
||||
for k := range req.Raw().Header {
|
||||
if strings.EqualFold(k, shared.HeaderXmsVersion) {
|
||||
delete(req.Raw().Header, k)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// BatchResponseItem contains the response for the individual sub-requests.
|
||||
type BatchResponseItem struct {
|
||||
ContentID *int
|
||||
ContainerName *string
|
||||
BlobName *string
|
||||
RequestID *string
|
||||
Version *string
|
||||
Error error // nil error indicates that the batch sub-request operation is successful
|
||||
}
|
||||
|
||||
func getResponseBoundary(contentType *string) (string, error) {
|
||||
if contentType == nil {
|
||||
return "", fmt.Errorf("Content-Type returned in SubmitBatch response is nil")
|
||||
}
|
||||
|
||||
_, params, err := mime.ParseMediaType(*contentType)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if val, ok := params["boundary"]; ok {
|
||||
return val, nil
|
||||
} else {
|
||||
return "", fmt.Errorf("batch boundary not present in Content-Type header of the SubmitBatch response.\nContent-Type: %v", *contentType)
|
||||
}
|
||||
}
|
||||
|
||||
func getContentID(part *multipart.Part) (*int, error) {
|
||||
contentID := part.Header.Get("Content-ID")
|
||||
if contentID == "" {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
val, err := strconv.Atoi(strings.TrimSpace(contentID))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &val, nil
|
||||
}
|
||||
|
||||
func getResponseHeader(key string, resp *http.Response) *string {
|
||||
val := resp.Header.Get(key)
|
||||
if val == "" {
|
||||
return nil
|
||||
}
|
||||
return &val
|
||||
}
|
||||
|
||||
// ParseBlobBatchResponse is used for parsing the batch response body into individual sub-responses for each item in the batch.
|
||||
func ParseBlobBatchResponse(respBody io.ReadCloser, contentType *string, subRequests []*policy.Request) ([]*BatchResponseItem, error) {
|
||||
boundary, err := getResponseBoundary(contentType)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
respReader := multipart.NewReader(respBody, boundary)
|
||||
var responses []*BatchResponseItem
|
||||
|
||||
for {
|
||||
part, err := respReader.NextPart()
|
||||
if errors.Is(err, io.EOF) {
|
||||
break
|
||||
} else if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
batchSubResponse := &BatchResponseItem{}
|
||||
batchSubResponse.ContentID, err = getContentID(part)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if batchSubResponse.ContentID != nil {
|
||||
path := strings.Trim(subRequests[*batchSubResponse.ContentID].Raw().URL.Path, "/")
|
||||
p := strings.Split(path, "/")
|
||||
batchSubResponse.ContainerName = to.Ptr(p[0])
|
||||
batchSubResponse.BlobName = to.Ptr(strings.Join(p[1:], "/"))
|
||||
}
|
||||
|
||||
respBytes, err := io.ReadAll(part)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
respBytes = append(respBytes, byte('\n'))
|
||||
buf := bytes.NewBuffer(respBytes)
|
||||
resp, err := http.ReadResponse(bufio.NewReader(buf), nil)
|
||||
// sub-response parsing error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
batchSubResponse.RequestID = getResponseHeader(shared.HeaderXmsRequestID, resp)
|
||||
batchSubResponse.Version = getResponseHeader(shared.HeaderXmsVersion, resp)
|
||||
|
||||
// sub-response failure
|
||||
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
|
||||
if len(responses) == 0 && batchSubResponse.ContentID == nil {
|
||||
// this case can happen when the parent request fails.
|
||||
// For example, batch request having more than 256 sub-requests.
|
||||
return nil, fmt.Errorf("%v", string(respBytes))
|
||||
}
|
||||
|
||||
resp.Request = subRequests[*batchSubResponse.ContentID].Raw()
|
||||
batchSubResponse.Error = runtime.NewResponseError(resp)
|
||||
}
|
||||
|
||||
responses = append(responses, batchSubResponse)
|
||||
}
|
||||
|
||||
if len(responses) != len(subRequests) {
|
||||
return nil, fmt.Errorf("expected %v responses, got %v for the batch ID: %v", len(subRequests), len(responses), boundary)
|
||||
}
|
||||
|
||||
return responses, nil
|
||||
}
|
||||
|
||||
// not exported but used for batch request creation
|
||||
|
||||
// BlobBatchBuilder is used for creating the blob batch request
|
||||
type BlobBatchBuilder struct {
|
||||
AuthPolicy policy.Policy
|
||||
SubRequests []*policy.Request
|
||||
}
|
||||
|
||||
// BlobBatchOperationType defines the operation of the blob batch sub-requests.
|
||||
type BlobBatchOperationType string
|
||||
|
||||
const (
|
||||
BatchDeleteOperationType BlobBatchOperationType = "delete"
|
||||
BatchSetTierOperationType BlobBatchOperationType = "set tier"
|
||||
)
|
33
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/exported/exported.go
сгенерированный
поставляемый
Normal file
33
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/exported/exported.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,33 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
package exported
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// HTTPRange defines a range of bytes within an HTTP resource, starting at offset and
|
||||
// ending at offset+count. A zero-value HTTPRange indicates the entire resource. An HTTPRange
|
||||
// which has an offset and zero value count indicates from the offset to the resource's end.
|
||||
type HTTPRange struct {
|
||||
Offset int64
|
||||
Count int64
|
||||
}
|
||||
|
||||
// FormatHTTPRange converts an HTTPRange to its string format.
|
||||
func FormatHTTPRange(r HTTPRange) *string {
|
||||
if r.Offset == 0 && r.Count == 0 {
|
||||
return nil // No specified range
|
||||
}
|
||||
endOffset := "" // if count == CountToEnd (0)
|
||||
if r.Count > 0 {
|
||||
endOffset = strconv.FormatInt((r.Offset+r.Count)-1, 10)
|
||||
}
|
||||
dataRange := fmt.Sprintf("bytes=%v-%s", r.Offset, endOffset)
|
||||
return &dataRange
|
||||
}
|
20
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/exported/log_events.go
сгенерированный
поставляемый
Normal file
20
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/exported/log_events.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,20 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
package exported
|
||||
|
||||
import (
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/internal/log"
|
||||
)
|
||||
|
||||
// NOTE: these are publicly exported via type-aliasing in azblob/log.go
|
||||
const (
|
||||
// EventUpload is used when we compute number of blocks to upload and size of each block.
|
||||
EventUpload log.Event = "azblob.Upload"
|
||||
|
||||
// EventSubmitBatch is used for logging events related to submit blob batch operation.
|
||||
EventSubmitBatch log.Event = "azblob.SubmitBatch"
|
||||
)
|
71
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/exported/set_expiry.go
сгенерированный
поставляемый
Normal file
71
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/exported/set_expiry.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,71 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
package exported
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated"
|
||||
)
|
||||
|
||||
// ExpiryType defines values for ExpiryType
|
||||
type ExpiryType interface {
|
||||
Format(o *SetExpiryOptions) (generated.ExpiryOptions, *generated.BlobClientSetExpiryOptions)
|
||||
notPubliclyImplementable()
|
||||
}
|
||||
|
||||
// ExpiryTypeAbsolute defines the absolute time for the blob expiry
|
||||
type ExpiryTypeAbsolute time.Time
|
||||
|
||||
// ExpiryTypeRelativeToNow defines the duration relative to now for the blob expiry
|
||||
type ExpiryTypeRelativeToNow time.Duration
|
||||
|
||||
// ExpiryTypeRelativeToCreation defines the duration relative to creation for the blob expiry
|
||||
type ExpiryTypeRelativeToCreation time.Duration
|
||||
|
||||
// ExpiryTypeNever defines that the blob will be set to never expire
|
||||
type ExpiryTypeNever struct {
|
||||
// empty struct since NeverExpire expiry type does not require expiry time
|
||||
}
|
||||
|
||||
// SetExpiryOptions contains the optional parameters for the Client.SetExpiry method.
|
||||
type SetExpiryOptions struct {
|
||||
// placeholder for future options
|
||||
}
|
||||
|
||||
func (e ExpiryTypeAbsolute) Format(o *SetExpiryOptions) (generated.ExpiryOptions, *generated.BlobClientSetExpiryOptions) {
|
||||
return generated.ExpiryOptionsAbsolute, &generated.BlobClientSetExpiryOptions{
|
||||
ExpiresOn: to.Ptr(time.Time(e).UTC().Format(http.TimeFormat)),
|
||||
}
|
||||
}
|
||||
|
||||
func (e ExpiryTypeAbsolute) notPubliclyImplementable() {}
|
||||
|
||||
func (e ExpiryTypeRelativeToNow) Format(o *SetExpiryOptions) (generated.ExpiryOptions, *generated.BlobClientSetExpiryOptions) {
|
||||
return generated.ExpiryOptionsRelativeToNow, &generated.BlobClientSetExpiryOptions{
|
||||
ExpiresOn: to.Ptr(strconv.FormatInt(time.Duration(e).Milliseconds(), 10)),
|
||||
}
|
||||
}
|
||||
|
||||
func (e ExpiryTypeRelativeToNow) notPubliclyImplementable() {}
|
||||
|
||||
func (e ExpiryTypeRelativeToCreation) Format(o *SetExpiryOptions) (generated.ExpiryOptions, *generated.BlobClientSetExpiryOptions) {
|
||||
return generated.ExpiryOptionsRelativeToCreation, &generated.BlobClientSetExpiryOptions{
|
||||
ExpiresOn: to.Ptr(strconv.FormatInt(time.Duration(e).Milliseconds(), 10)),
|
||||
}
|
||||
}
|
||||
|
||||
func (e ExpiryTypeRelativeToCreation) notPubliclyImplementable() {}
|
||||
|
||||
func (e ExpiryTypeNever) Format(o *SetExpiryOptions) (generated.ExpiryOptions, *generated.BlobClientSetExpiryOptions) {
|
||||
return generated.ExpiryOptionsNeverExpire, nil
|
||||
}
|
||||
|
||||
func (e ExpiryTypeNever) notPubliclyImplementable() {}
|
225
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/exported/shared_key_credential.go
сгенерированный
поставляемый
Normal file
225
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/exported/shared_key_credential.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,225 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
package exported
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/hmac"
|
||||
"crypto/sha256"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
azlog "github.com/Azure/azure-sdk-for-go/sdk/azcore/log"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/internal/log"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/shared"
|
||||
)
|
||||
|
||||
// NewSharedKeyCredential creates an immutable SharedKeyCredential containing the
|
||||
// storage account's name and either its primary or secondary key.
|
||||
func NewSharedKeyCredential(accountName string, accountKey string) (*SharedKeyCredential, error) {
|
||||
c := SharedKeyCredential{accountName: accountName}
|
||||
if err := c.SetAccountKey(accountKey); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &c, nil
|
||||
}
|
||||
|
||||
// SharedKeyCredential contains an account's name and its primary or secondary key.
|
||||
type SharedKeyCredential struct {
|
||||
// Only the NewSharedKeyCredential method should set these; all other methods should treat them as read-only
|
||||
accountName string
|
||||
accountKey atomic.Value // []byte
|
||||
}
|
||||
|
||||
// AccountName returns the Storage account's name.
|
||||
func (c *SharedKeyCredential) AccountName() string {
|
||||
return c.accountName
|
||||
}
|
||||
|
||||
// SetAccountKey replaces the existing account key with the specified account key.
|
||||
func (c *SharedKeyCredential) SetAccountKey(accountKey string) error {
|
||||
_bytes, err := base64.StdEncoding.DecodeString(accountKey)
|
||||
if err != nil {
|
||||
return fmt.Errorf("decode account key: %w", err)
|
||||
}
|
||||
c.accountKey.Store(_bytes)
|
||||
return nil
|
||||
}
|
||||
|
||||
// ComputeHMACSHA256 generates a hash signature for an HTTP request or for a SAS.
|
||||
func (c *SharedKeyCredential) computeHMACSHA256(message string) (string, error) {
|
||||
h := hmac.New(sha256.New, c.accountKey.Load().([]byte))
|
||||
_, err := h.Write([]byte(message))
|
||||
return base64.StdEncoding.EncodeToString(h.Sum(nil)), err
|
||||
}
|
||||
|
||||
func (c *SharedKeyCredential) buildStringToSign(req *http.Request) (string, error) {
|
||||
// https://docs.microsoft.com/en-us/rest/api/storageservices/authentication-for-the-azure-storage-services
|
||||
headers := req.Header
|
||||
contentLength := getHeader(shared.HeaderContentLength, headers)
|
||||
if contentLength == "0" {
|
||||
contentLength = ""
|
||||
}
|
||||
|
||||
canonicalizedResource, err := c.buildCanonicalizedResource(req.URL)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
stringToSign := strings.Join([]string{
|
||||
req.Method,
|
||||
getHeader(shared.HeaderContentEncoding, headers),
|
||||
getHeader(shared.HeaderContentLanguage, headers),
|
||||
contentLength,
|
||||
getHeader(shared.HeaderContentMD5, headers),
|
||||
getHeader(shared.HeaderContentType, headers),
|
||||
"", // Empty date because x-ms-date is expected (as per web page above)
|
||||
getHeader(shared.HeaderIfModifiedSince, headers),
|
||||
getHeader(shared.HeaderIfMatch, headers),
|
||||
getHeader(shared.HeaderIfNoneMatch, headers),
|
||||
getHeader(shared.HeaderIfUnmodifiedSince, headers),
|
||||
getHeader(shared.HeaderRange, headers),
|
||||
c.buildCanonicalizedHeader(headers),
|
||||
canonicalizedResource,
|
||||
}, "\n")
|
||||
return stringToSign, nil
|
||||
}
|
||||
|
||||
func getHeader(key string, headers map[string][]string) string {
|
||||
if headers == nil {
|
||||
return ""
|
||||
}
|
||||
if v, ok := headers[key]; ok {
|
||||
if len(v) > 0 {
|
||||
return v[0]
|
||||
}
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
func (c *SharedKeyCredential) buildCanonicalizedHeader(headers http.Header) string {
|
||||
cm := map[string][]string{}
|
||||
for k, v := range headers {
|
||||
headerName := strings.TrimSpace(strings.ToLower(k))
|
||||
if strings.HasPrefix(headerName, "x-ms-") {
|
||||
cm[headerName] = v // NOTE: the value must not have any whitespace around it.
|
||||
}
|
||||
}
|
||||
if len(cm) == 0 {
|
||||
return ""
|
||||
}
|
||||
|
||||
keys := make([]string, 0, len(cm))
|
||||
for key := range cm {
|
||||
keys = append(keys, key)
|
||||
}
|
||||
sort.Strings(keys)
|
||||
ch := bytes.NewBufferString("")
|
||||
for i, key := range keys {
|
||||
if i > 0 {
|
||||
ch.WriteRune('\n')
|
||||
}
|
||||
ch.WriteString(key)
|
||||
ch.WriteRune(':')
|
||||
ch.WriteString(strings.Join(cm[key], ","))
|
||||
}
|
||||
return ch.String()
|
||||
}
|
||||
|
||||
func (c *SharedKeyCredential) buildCanonicalizedResource(u *url.URL) (string, error) {
|
||||
// https://docs.microsoft.com/en-us/rest/api/storageservices/authentication-for-the-azure-storage-services
|
||||
cr := bytes.NewBufferString("/")
|
||||
cr.WriteString(c.accountName)
|
||||
|
||||
if len(u.Path) > 0 {
|
||||
// Any portion of the CanonicalizedResource string that is derived from
|
||||
// the resource's URI should be encoded exactly as it is in the URI.
|
||||
// -- https://msdn.microsoft.com/en-gb/library/azure/dd179428.aspx
|
||||
cr.WriteString(u.EscapedPath())
|
||||
} else {
|
||||
// a slash is required to indicate the root path
|
||||
cr.WriteString("/")
|
||||
}
|
||||
|
||||
// params is a map[string][]string; param name is key; params values is []string
|
||||
params, err := url.ParseQuery(u.RawQuery) // Returns URL decoded values
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("failed to parse query params: %w", err)
|
||||
}
|
||||
|
||||
if len(params) > 0 { // There is at least 1 query parameter
|
||||
var paramNames []string // We use this to sort the parameter key names
|
||||
for paramName := range params {
|
||||
paramNames = append(paramNames, paramName) // paramNames must be lowercase
|
||||
}
|
||||
sort.Strings(paramNames)
|
||||
|
||||
for _, paramName := range paramNames {
|
||||
paramValues := params[paramName]
|
||||
sort.Strings(paramValues)
|
||||
|
||||
// Join the sorted key values separated by ','
|
||||
// Then prepend "keyName:"; then add this string to the buffer
|
||||
cr.WriteString("\n" + strings.ToLower(paramName) + ":" + strings.Join(paramValues, ","))
|
||||
}
|
||||
}
|
||||
return cr.String(), nil
|
||||
}
|
||||
|
||||
// ComputeHMACSHA256 is a helper for computing the signed string outside of this package.
|
||||
func ComputeHMACSHA256(cred *SharedKeyCredential, message string) (string, error) {
|
||||
return cred.computeHMACSHA256(message)
|
||||
}
|
||||
|
||||
// the following content isn't actually exported but must live
|
||||
// next to SharedKeyCredential as it uses its unexported methods
|
||||
|
||||
type SharedKeyCredPolicy struct {
|
||||
cred *SharedKeyCredential
|
||||
}
|
||||
|
||||
func NewSharedKeyCredPolicy(cred *SharedKeyCredential) *SharedKeyCredPolicy {
|
||||
return &SharedKeyCredPolicy{cred: cred}
|
||||
}
|
||||
|
||||
func (s *SharedKeyCredPolicy) Do(req *policy.Request) (*http.Response, error) {
|
||||
// skip adding the authorization header if no SharedKeyCredential was provided.
|
||||
// this prevents a panic that might be hard to diagnose and allows testing
|
||||
// against http endpoints that don't require authentication.
|
||||
if s.cred == nil {
|
||||
return req.Next()
|
||||
}
|
||||
|
||||
if d := getHeader(shared.HeaderXmsDate, req.Raw().Header); d == "" {
|
||||
req.Raw().Header.Set(shared.HeaderXmsDate, time.Now().UTC().Format(http.TimeFormat))
|
||||
}
|
||||
stringToSign, err := s.cred.buildStringToSign(req.Raw())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
signature, err := s.cred.computeHMACSHA256(stringToSign)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
authHeader := strings.Join([]string{"SharedKey ", s.cred.AccountName(), ":", signature}, "")
|
||||
req.Raw().Header.Set(shared.HeaderAuthorization, authHeader)
|
||||
|
||||
response, err := req.Next()
|
||||
if err != nil && response != nil && response.StatusCode == http.StatusForbidden {
|
||||
// Service failed to authenticate request, log it
|
||||
log.Write(azlog.EventResponse, "===== HTTP Forbidden status, String-to-Sign:\n"+stringToSign+"\n===============================\n")
|
||||
}
|
||||
return response, err
|
||||
}
|
67
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/exported/transfer_validation_option.go
сгенерированный
поставляемый
Normal file
67
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/exported/transfer_validation_option.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,67 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
package exported
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"hash/crc64"
|
||||
"io"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/streaming"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/shared"
|
||||
)
|
||||
|
||||
// TransferValidationType abstracts the various mechanisms used to verify a transfer.
|
||||
type TransferValidationType interface {
|
||||
Apply(io.ReadSeekCloser, generated.TransactionalContentSetter) (io.ReadSeekCloser, error)
|
||||
notPubliclyImplementable()
|
||||
}
|
||||
|
||||
// TransferValidationTypeCRC64 is a TransferValidationType used to provide a precomputed CRC64.
|
||||
type TransferValidationTypeCRC64 uint64
|
||||
|
||||
func (c TransferValidationTypeCRC64) Apply(rsc io.ReadSeekCloser, cfg generated.TransactionalContentSetter) (io.ReadSeekCloser, error) {
|
||||
buf := make([]byte, 8)
|
||||
binary.LittleEndian.PutUint64(buf, uint64(c))
|
||||
cfg.SetCRC64(buf)
|
||||
return rsc, nil
|
||||
}
|
||||
|
||||
func (TransferValidationTypeCRC64) notPubliclyImplementable() {}
|
||||
|
||||
// TransferValidationTypeComputeCRC64 is a TransferValidationType that indicates a CRC64 should be computed during transfer.
|
||||
func TransferValidationTypeComputeCRC64() TransferValidationType {
|
||||
return transferValidationTypeFn(func(rsc io.ReadSeekCloser, cfg generated.TransactionalContentSetter) (io.ReadSeekCloser, error) {
|
||||
buf, err := io.ReadAll(rsc)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
crc := crc64.Checksum(buf, shared.CRC64Table)
|
||||
return TransferValidationTypeCRC64(crc).Apply(streaming.NopCloser(bytes.NewReader(buf)), cfg)
|
||||
})
|
||||
}
|
||||
|
||||
// TransferValidationTypeMD5 is a TransferValidationType used to provide a precomputed MD5.
|
||||
type TransferValidationTypeMD5 []byte
|
||||
|
||||
func (c TransferValidationTypeMD5) Apply(rsc io.ReadSeekCloser, cfg generated.TransactionalContentSetter) (io.ReadSeekCloser, error) {
|
||||
cfg.SetMD5(c)
|
||||
return rsc, nil
|
||||
}
|
||||
|
||||
func (TransferValidationTypeMD5) notPubliclyImplementable() {}
|
||||
|
||||
type transferValidationTypeFn func(io.ReadSeekCloser, generated.TransactionalContentSetter) (io.ReadSeekCloser, error)
|
||||
|
||||
func (t transferValidationTypeFn) Apply(rsc io.ReadSeekCloser, cfg generated.TransactionalContentSetter) (io.ReadSeekCloser, error) {
|
||||
return t(rsc, cfg)
|
||||
}
|
||||
|
||||
func (transferValidationTypeFn) notPubliclyImplementable() {}
|
64
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/exported/user_delegation_credential.go
сгенерированный
поставляемый
Normal file
64
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/exported/user_delegation_credential.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,64 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
package exported
|
||||
|
||||
import (
|
||||
"crypto/hmac"
|
||||
"crypto/sha256"
|
||||
"encoding/base64"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated"
|
||||
)
|
||||
|
||||
// NewUserDelegationCredential creates a new UserDelegationCredential using a Storage account's Name and a user delegation Key from it
|
||||
func NewUserDelegationCredential(accountName string, udk UserDelegationKey) *UserDelegationCredential {
|
||||
return &UserDelegationCredential{
|
||||
accountName: accountName,
|
||||
userDelegationKey: udk,
|
||||
}
|
||||
}
|
||||
|
||||
// UserDelegationKey contains UserDelegationKey.
|
||||
type UserDelegationKey = generated.UserDelegationKey
|
||||
|
||||
// UserDelegationCredential contains an account's name and its user delegation key.
|
||||
type UserDelegationCredential struct {
|
||||
accountName string
|
||||
userDelegationKey UserDelegationKey
|
||||
}
|
||||
|
||||
// getAccountName returns the Storage account's Name
|
||||
func (f *UserDelegationCredential) getAccountName() string {
|
||||
return f.accountName
|
||||
}
|
||||
|
||||
// GetAccountName is a helper method for accessing the user delegation key parameters outside this package.
|
||||
func GetAccountName(udc *UserDelegationCredential) string {
|
||||
return udc.getAccountName()
|
||||
}
|
||||
|
||||
// computeHMACSHA256 generates a hash signature for an HTTP request or for a SAS.
|
||||
func (f *UserDelegationCredential) computeHMACSHA256(message string) (string, error) {
|
||||
bytes, _ := base64.StdEncoding.DecodeString(*f.userDelegationKey.Value)
|
||||
h := hmac.New(sha256.New, bytes)
|
||||
_, err := h.Write([]byte(message))
|
||||
return base64.StdEncoding.EncodeToString(h.Sum(nil)), err
|
||||
}
|
||||
|
||||
// ComputeUDCHMACSHA256 is a helper method for computing the signed string outside this package.
|
||||
func ComputeUDCHMACSHA256(udc *UserDelegationCredential, message string) (string, error) {
|
||||
return udc.computeHMACSHA256(message)
|
||||
}
|
||||
|
||||
// getUDKParams returns UserDelegationKey
|
||||
func (f *UserDelegationCredential) getUDKParams() *UserDelegationKey {
|
||||
return &f.userDelegationKey
|
||||
}
|
||||
|
||||
// GetUDKParams is a helper method for accessing the user delegation key parameters outside this package.
|
||||
func GetUDKParams(udc *UserDelegationCredential) *UserDelegationKey {
|
||||
return udc.getUDKParams()
|
||||
}
|
12
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/exported/version.go
сгенерированный
поставляемый
Normal file
12
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/exported/version.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,12 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
package exported
|
||||
|
||||
const (
|
||||
ModuleName = "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob"
|
||||
ModuleVersion = "v1.3.2"
|
||||
)
|
32
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/appendblob_client.go
сгенерированный
поставляемый
Normal file
32
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/appendblob_client.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,32 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package generated
|
||||
|
||||
import (
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
)
|
||||
|
||||
func (client *AppendBlobClient) Endpoint() string {
|
||||
return client.endpoint
|
||||
}
|
||||
|
||||
func (client *AppendBlobClient) InternalClient() *azcore.Client {
|
||||
return client.internal
|
||||
}
|
||||
|
||||
// NewAppendBlobClient creates a new instance of AppendBlobClient with the specified values.
|
||||
// - endpoint - The URL of the service account, container, or blob that is the target of the desired operation.
|
||||
// - azClient - azcore.Client is a basic HTTP client. It consists of a pipeline and tracing provider.
|
||||
func NewAppendBlobClient(endpoint string, azClient *azcore.Client) *AppendBlobClient {
|
||||
client := &AppendBlobClient{
|
||||
internal: azClient,
|
||||
endpoint: endpoint,
|
||||
}
|
||||
return client
|
||||
}
|
475
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/autorest.md
сгенерированный
поставляемый
Normal file
475
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/autorest.md
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,475 @@
|
|||
# Code Generation - Azure Blob SDK for Golang
|
||||
|
||||
### Settings
|
||||
|
||||
```yaml
|
||||
go: true
|
||||
clear-output-folder: false
|
||||
version: "^3.0.0"
|
||||
license-header: MICROSOFT_MIT_NO_VERSION
|
||||
input-file: "https://raw.githubusercontent.com/Azure/azure-rest-api-specs/a32d0b2423d19835246bb2ef92941503bfd5e734/specification/storage/data-plane/Microsoft.BlobStorage/preview/2021-12-02/blob.json"
|
||||
credential-scope: "https://storage.azure.com/.default"
|
||||
output-folder: ../generated
|
||||
file-prefix: "zz_"
|
||||
openapi-type: "data-plane"
|
||||
verbose: true
|
||||
security: AzureKey
|
||||
modelerfour:
|
||||
group-parameters: false
|
||||
seal-single-value-enum-by-default: true
|
||||
lenient-model-deduplication: true
|
||||
export-clients: true
|
||||
use: "@autorest/go@4.0.0-preview.61"
|
||||
```
|
||||
|
||||
### Updating service version to 2023-11-03
|
||||
```yaml
|
||||
directive:
|
||||
- from:
|
||||
- zz_appendblob_client.go
|
||||
- zz_blob_client.go
|
||||
- zz_blockblob_client.go
|
||||
- zz_container_client.go
|
||||
- zz_pageblob_client.go
|
||||
- zz_service_client.go
|
||||
where: $
|
||||
transform: >-
|
||||
return $.
|
||||
replaceAll(`[]string{"2021-12-02"}`, `[]string{ServiceVersion}`).
|
||||
replaceAll(`2021-12-02`, `2023-11-03`);
|
||||
```
|
||||
|
||||
### Undo breaking change with BlobName
|
||||
``` yaml
|
||||
directive:
|
||||
- from: zz_models.go
|
||||
where: $
|
||||
transform: >-
|
||||
return $.
|
||||
replace(/Name\s+\*BlobName/g, `Name *string`);
|
||||
```
|
||||
|
||||
### Removing UnmarshalXML for BlobItems to create customer UnmarshalXML function
|
||||
```yaml
|
||||
directive:
|
||||
- from: swagger-document
|
||||
where: $.definitions
|
||||
transform: >
|
||||
$.BlobItemInternal["x-ms-go-omit-serde-methods"] = true;
|
||||
```
|
||||
|
||||
### Remove pager methods and export various generated methods in container client
|
||||
|
||||
``` yaml
|
||||
directive:
|
||||
- from: zz_container_client.go
|
||||
where: $
|
||||
transform: >-
|
||||
return $.
|
||||
replace(/func \(client \*ContainerClient\) NewListBlobFlatSegmentPager\(.+\/\/ listBlobFlatSegmentCreateRequest creates the ListBlobFlatSegment request/s, `//\n// listBlobFlatSegmentCreateRequest creates the ListBlobFlatSegment request`).
|
||||
replace(/\(client \*ContainerClient\) listBlobFlatSegmentCreateRequest\(/, `(client *ContainerClient) ListBlobFlatSegmentCreateRequest(`).
|
||||
replace(/\(client \*ContainerClient\) listBlobFlatSegmentHandleResponse\(/, `(client *ContainerClient) ListBlobFlatSegmentHandleResponse(`);
|
||||
```
|
||||
|
||||
### Remove pager methods and export various generated methods in service client
|
||||
|
||||
``` yaml
|
||||
directive:
|
||||
- from: zz_service_client.go
|
||||
where: $
|
||||
transform: >-
|
||||
return $.
|
||||
replace(/func \(client \*ServiceClient\) NewListContainersSegmentPager\(.+\/\/ listContainersSegmentCreateRequest creates the ListContainersSegment request/s, `//\n// listContainersSegmentCreateRequest creates the ListContainersSegment request`).
|
||||
replace(/\(client \*ServiceClient\) listContainersSegmentCreateRequest\(/, `(client *ServiceClient) ListContainersSegmentCreateRequest(`).
|
||||
replace(/\(client \*ServiceClient\) listContainersSegmentHandleResponse\(/, `(client *ServiceClient) ListContainersSegmentHandleResponse(`);
|
||||
```
|
||||
|
||||
### Fix BlobMetadata.
|
||||
|
||||
``` yaml
|
||||
directive:
|
||||
- from: swagger-document
|
||||
where: $.definitions
|
||||
transform: >
|
||||
delete $.BlobMetadata["properties"];
|
||||
|
||||
```
|
||||
|
||||
### Don't include container name or blob in path - we have direct URIs.
|
||||
|
||||
``` yaml
|
||||
directive:
|
||||
- from: swagger-document
|
||||
where: $["x-ms-paths"]
|
||||
transform: >
|
||||
for (const property in $)
|
||||
{
|
||||
if (property.includes('/{containerName}/{blob}'))
|
||||
{
|
||||
$[property]["parameters"] = $[property]["parameters"].filter(function(param) { return (typeof param['$ref'] === "undefined") || (false == param['$ref'].endsWith("#/parameters/ContainerName") && false == param['$ref'].endsWith("#/parameters/Blob"))});
|
||||
}
|
||||
else if (property.includes('/{containerName}'))
|
||||
{
|
||||
$[property]["parameters"] = $[property]["parameters"].filter(function(param) { return (typeof param['$ref'] === "undefined") || (false == param['$ref'].endsWith("#/parameters/ContainerName"))});
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Remove DataLake stuff.
|
||||
|
||||
``` yaml
|
||||
directive:
|
||||
- from: swagger-document
|
||||
where: $["x-ms-paths"]
|
||||
transform: >
|
||||
for (const property in $)
|
||||
{
|
||||
if (property.includes('filesystem'))
|
||||
{
|
||||
delete $[property];
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Remove DataLakeStorageError
|
||||
|
||||
``` yaml
|
||||
directive:
|
||||
- from: swagger-document
|
||||
where: $.definitions
|
||||
transform: >
|
||||
delete $.DataLakeStorageError;
|
||||
```
|
||||
|
||||
### Fix 304s
|
||||
|
||||
``` yaml
|
||||
directive:
|
||||
- from: swagger-document
|
||||
where: $["x-ms-paths"]["/{containerName}/{blob}"]
|
||||
transform: >
|
||||
$.get.responses["304"] = {
|
||||
"description": "The condition specified using HTTP conditional header(s) is not met.",
|
||||
"x-az-response-name": "ConditionNotMetError",
|
||||
"headers": { "x-ms-error-code": { "x-ms-client-name": "ErrorCode", "type": "string" } }
|
||||
};
|
||||
```
|
||||
|
||||
### Fix GeoReplication
|
||||
|
||||
``` yaml
|
||||
directive:
|
||||
- from: swagger-document
|
||||
where: $.definitions
|
||||
transform: >
|
||||
delete $.GeoReplication.properties.Status["x-ms-enum"];
|
||||
$.GeoReplication.properties.Status["x-ms-enum"] = {
|
||||
"name": "BlobGeoReplicationStatus",
|
||||
"modelAsString": false
|
||||
};
|
||||
```
|
||||
|
||||
### Fix RehydratePriority
|
||||
|
||||
``` yaml
|
||||
directive:
|
||||
- from: swagger-document
|
||||
where: $.definitions
|
||||
transform: >
|
||||
delete $.RehydratePriority["x-ms-enum"];
|
||||
$.RehydratePriority["x-ms-enum"] = {
|
||||
"name": "RehydratePriority",
|
||||
"modelAsString": false
|
||||
};
|
||||
```
|
||||
|
||||
### Fix BlobDeleteType
|
||||
|
||||
``` yaml
|
||||
directive:
|
||||
- from: swagger-document
|
||||
where: $.parameters
|
||||
transform: >
|
||||
delete $.BlobDeleteType.enum;
|
||||
$.BlobDeleteType.enum = [
|
||||
"None",
|
||||
"Permanent"
|
||||
];
|
||||
```
|
||||
|
||||
### Fix EncryptionAlgorithm
|
||||
|
||||
``` yaml
|
||||
directive:
|
||||
- from: swagger-document
|
||||
where: $.parameters
|
||||
transform: >
|
||||
delete $.EncryptionAlgorithm.enum;
|
||||
$.EncryptionAlgorithm.enum = [
|
||||
"None",
|
||||
"AES256"
|
||||
];
|
||||
```
|
||||
|
||||
### Fix XML string "ObjectReplicationMetadata" to "OrMetadata"
|
||||
|
||||
``` yaml
|
||||
directive:
|
||||
- from: swagger-document
|
||||
where: $.definitions
|
||||
transform: >
|
||||
$.BlobItemInternal.properties["OrMetadata"] = $.BlobItemInternal.properties["ObjectReplicationMetadata"];
|
||||
delete $.BlobItemInternal.properties["ObjectReplicationMetadata"];
|
||||
```
|
||||
|
||||
# Export various createRequest/HandleResponse methods
|
||||
|
||||
``` yaml
|
||||
directive:
|
||||
- from: zz_container_client.go
|
||||
where: $
|
||||
transform: >-
|
||||
return $.
|
||||
replace(/listBlobHierarchySegmentCreateRequest/g, function(_, s) { return `ListBlobHierarchySegmentCreateRequest` }).
|
||||
replace(/listBlobHierarchySegmentHandleResponse/g, function(_, s) { return `ListBlobHierarchySegmentHandleResponse` });
|
||||
|
||||
- from: zz_pageblob_client.go
|
||||
where: $
|
||||
transform: >-
|
||||
return $.
|
||||
replace(/getPageRanges(Diff)?CreateRequest/g, function(_, s) { if (s === undefined) { s = '' }; return `GetPageRanges${s}CreateRequest` }).
|
||||
replace(/getPageRanges(Diff)?HandleResponse/g, function(_, s) { if (s === undefined) { s = '' }; return `GetPageRanges${s}HandleResponse` });
|
||||
```
|
||||
|
||||
### Clean up some const type names so they don't stutter
|
||||
|
||||
``` yaml
|
||||
directive:
|
||||
- from: swagger-document
|
||||
where: $.parameters['BlobDeleteType']
|
||||
transform: >
|
||||
$["x-ms-enum"].name = "DeleteType";
|
||||
$["x-ms-client-name"] = "DeleteType";
|
||||
|
||||
- from: swagger-document
|
||||
where: $.parameters['BlobExpiryOptions']
|
||||
transform: >
|
||||
$["x-ms-enum"].name = "ExpiryOptions";
|
||||
$["x-ms-client-name"].name = "ExpiryOptions";
|
||||
|
||||
- from: swagger-document
|
||||
where: $["x-ms-paths"][*].*.responses[*].headers["x-ms-immutability-policy-mode"]
|
||||
transform: >
|
||||
$["x-ms-client-name"].name = "ImmutabilityPolicyMode";
|
||||
$.enum = [ "Mutable", "Unlocked", "Locked"];
|
||||
$["x-ms-enum"] = { "name": "ImmutabilityPolicyMode", "modelAsString": false };
|
||||
|
||||
- from: swagger-document
|
||||
where: $.parameters['ImmutabilityPolicyMode']
|
||||
transform: >
|
||||
$["x-ms-enum"].name = "ImmutabilityPolicySetting";
|
||||
$["x-ms-client-name"].name = "ImmutabilityPolicySetting";
|
||||
|
||||
- from: swagger-document
|
||||
where: $.definitions['BlobPropertiesInternal']
|
||||
transform: >
|
||||
$.properties.ImmutabilityPolicyMode["x-ms-enum"].name = "ImmutabilityPolicyMode";
|
||||
```
|
||||
|
||||
### use azcore.ETag
|
||||
|
||||
``` yaml
|
||||
directive:
|
||||
- from:
|
||||
- zz_models.go
|
||||
- zz_options.go
|
||||
where: $
|
||||
transform: >-
|
||||
return $.
|
||||
replace(/import "time"/, `import (\n\t"time"\n\t"github.com/Azure/azure-sdk-for-go/sdk/azcore"\n)`).
|
||||
replace(/Etag\s+\*string/g, `ETag *azcore.ETag`).
|
||||
replace(/IfMatch\s+\*string/g, `IfMatch *azcore.ETag`).
|
||||
replace(/IfNoneMatch\s+\*string/g, `IfNoneMatch *azcore.ETag`).
|
||||
replace(/SourceIfMatch\s+\*string/g, `SourceIfMatch *azcore.ETag`).
|
||||
replace(/SourceIfNoneMatch\s+\*string/g, `SourceIfNoneMatch *azcore.ETag`);
|
||||
|
||||
- from: zz_response_types.go
|
||||
where: $
|
||||
transform: >-
|
||||
return $.
|
||||
replace(/"time"/, `"time"\n\t"github.com/Azure/azure-sdk-for-go/sdk/azcore"`).
|
||||
replace(/ETag\s+\*string/g, `ETag *azcore.ETag`);
|
||||
|
||||
- from:
|
||||
- zz_appendblob_client.go
|
||||
- zz_blob_client.go
|
||||
- zz_blockblob_client.go
|
||||
- zz_container_client.go
|
||||
- zz_pageblob_client.go
|
||||
where: $
|
||||
transform: >-
|
||||
return $.
|
||||
replace(/"github\.com\/Azure\/azure\-sdk\-for\-go\/sdk\/azcore\/policy"/, `"github.com/Azure/azure-sdk-for-go/sdk/azcore"\n\t"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"`).
|
||||
replace(/result\.ETag\s+=\s+&val/g, `result.ETag = (*azcore.ETag)(&val)`).
|
||||
replace(/\*modifiedAccessConditions.IfMatch/g, `string(*modifiedAccessConditions.IfMatch)`).
|
||||
replace(/\*modifiedAccessConditions.IfNoneMatch/g, `string(*modifiedAccessConditions.IfNoneMatch)`).
|
||||
replace(/\*sourceModifiedAccessConditions.SourceIfMatch/g, `string(*sourceModifiedAccessConditions.SourceIfMatch)`).
|
||||
replace(/\*sourceModifiedAccessConditions.SourceIfNoneMatch/g, `string(*sourceModifiedAccessConditions.SourceIfNoneMatch)`);
|
||||
```
|
||||
|
||||
### Unsure why this casing changed, but fixing it
|
||||
|
||||
``` yaml
|
||||
directive:
|
||||
- from: zz_models.go
|
||||
where: $
|
||||
transform: >-
|
||||
return $.
|
||||
replace(/SignedOid\s+\*string/g, `SignedOID *string`).
|
||||
replace(/SignedTid\s+\*string/g, `SignedTID *string`);
|
||||
```
|
||||
|
||||
### Fixing Typo with StorageErrorCodeIncrementalCopyOfEarlierVersionSnapshotNotAllowed
|
||||
|
||||
``` yaml
|
||||
directive:
|
||||
- from: zz_constants.go
|
||||
where: $
|
||||
transform: >-
|
||||
return $.
|
||||
replace(/IncrementalCopyOfEralierVersionSnapshotNotAllowed/g, "IncrementalCopyOfEarlierVersionSnapshotNotAllowed");
|
||||
```
|
||||
|
||||
### Fix up x-ms-content-crc64 header response name
|
||||
|
||||
``` yaml
|
||||
directive:
|
||||
- from: swagger-document
|
||||
where: $.x-ms-paths.*.*.responses.*.headers.x-ms-content-crc64
|
||||
transform: >
|
||||
$["x-ms-client-name"] = "ContentCRC64"
|
||||
```
|
||||
|
||||
``` yaml
|
||||
directive:
|
||||
- rename-model:
|
||||
from: BlobItemInternal
|
||||
to: BlobItem
|
||||
- rename-model:
|
||||
from: BlobPropertiesInternal
|
||||
to: BlobProperties
|
||||
```
|
||||
|
||||
### Updating encoding URL, Golang adds '+' which disrupts encoding with service
|
||||
|
||||
``` yaml
|
||||
directive:
|
||||
- from: zz_service_client.go
|
||||
where: $
|
||||
transform: >-
|
||||
return $.
|
||||
replace(/req.Raw\(\).URL.RawQuery \= reqQP.Encode\(\)/, `req.Raw().URL.RawQuery = strings.Replace(reqQP.Encode(), "+", "%20", -1)`)
|
||||
```
|
||||
|
||||
### Change `where` parameter in blob filtering to be required
|
||||
|
||||
``` yaml
|
||||
directive:
|
||||
- from: swagger-document
|
||||
where: $.parameters.FilterBlobsWhere
|
||||
transform: >
|
||||
$.required = true;
|
||||
```
|
||||
|
||||
### Change `Duration` parameter in leases to be required
|
||||
|
||||
``` yaml
|
||||
directive:
|
||||
- from: swagger-document
|
||||
where: $.parameters.LeaseDuration
|
||||
transform: >
|
||||
$.required = true;
|
||||
```
|
||||
|
||||
### Change CPK acronym to be all caps
|
||||
|
||||
``` yaml
|
||||
directive:
|
||||
- from: source-file-go
|
||||
where: $
|
||||
transform: >-
|
||||
return $.
|
||||
replace(/Cpk/g, "CPK");
|
||||
```
|
||||
|
||||
### Change CORS acronym to be all caps
|
||||
|
||||
``` yaml
|
||||
directive:
|
||||
- from: source-file-go
|
||||
where: $
|
||||
transform: >-
|
||||
return $.
|
||||
replace(/Cors/g, "CORS");
|
||||
```
|
||||
|
||||
### Change cors xml to be correct
|
||||
|
||||
``` yaml
|
||||
directive:
|
||||
- from: source-file-go
|
||||
where: $
|
||||
transform: >-
|
||||
return $.
|
||||
replace(/xml:"CORS>CORSRule"/g, "xml:\"Cors>CorsRule\"");
|
||||
```
|
||||
|
||||
### Fix Content-Type header in submit batch request
|
||||
|
||||
``` yaml
|
||||
directive:
|
||||
- from:
|
||||
- zz_container_client.go
|
||||
- zz_service_client.go
|
||||
where: $
|
||||
transform: >-
|
||||
return $.
|
||||
replace (/req.SetBody\(body\,\s+\"application\/xml\"\)/g, `req.SetBody(body, multipartContentType)`);
|
||||
```
|
||||
|
||||
### Fix response status code check in submit batch request
|
||||
|
||||
``` yaml
|
||||
directive:
|
||||
- from: zz_service_client.go
|
||||
where: $
|
||||
transform: >-
|
||||
return $.
|
||||
replace(/if\s+!runtime\.HasStatusCode\(httpResp,\s+http\.StatusOK\)\s+\{\s+err\s+=\s+runtime\.NewResponseError\(httpResp\)\s+return ServiceClientSubmitBatchResponse\{\}\,\s+err\s+}/g,
|
||||
`if !runtime.HasStatusCode(httpResp, http.StatusAccepted) {\n\t\terr = runtime.NewResponseError(httpResp)\n\t\treturn ServiceClientSubmitBatchResponse{}, err\n\t}`);
|
||||
```
|
||||
|
||||
### Convert time to GMT for If-Modified-Since and If-Unmodified-Since request headers
|
||||
|
||||
``` yaml
|
||||
directive:
|
||||
- from:
|
||||
- zz_container_client.go
|
||||
- zz_blob_client.go
|
||||
- zz_appendblob_client.go
|
||||
- zz_blockblob_client.go
|
||||
- zz_pageblob_client.go
|
||||
where: $
|
||||
transform: >-
|
||||
return $.
|
||||
replace (/req\.Raw\(\)\.Header\[\"If-Modified-Since\"\]\s+=\s+\[\]string\{modifiedAccessConditions\.IfModifiedSince\.Format\(time\.RFC1123\)\}/g,
|
||||
`req.Raw().Header["If-Modified-Since"] = []string{(*modifiedAccessConditions.IfModifiedSince).In(gmt).Format(time.RFC1123)}`).
|
||||
replace (/req\.Raw\(\)\.Header\[\"If-Unmodified-Since\"\]\s+=\s+\[\]string\{modifiedAccessConditions\.IfUnmodifiedSince\.Format\(time\.RFC1123\)\}/g,
|
||||
`req.Raw().Header["If-Unmodified-Since"] = []string{(*modifiedAccessConditions.IfUnmodifiedSince).In(gmt).Format(time.RFC1123)}`).
|
||||
replace (/req\.Raw\(\)\.Header\[\"x-ms-source-if-modified-since\"\]\s+=\s+\[\]string\{sourceModifiedAccessConditions\.SourceIfModifiedSince\.Format\(time\.RFC1123\)\}/g,
|
||||
`req.Raw().Header["x-ms-source-if-modified-since"] = []string{(*sourceModifiedAccessConditions.SourceIfModifiedSince).In(gmt).Format(time.RFC1123)}`).
|
||||
replace (/req\.Raw\(\)\.Header\[\"x-ms-source-if-unmodified-since\"\]\s+=\s+\[\]string\{sourceModifiedAccessConditions\.SourceIfUnmodifiedSince\.Format\(time\.RFC1123\)\}/g,
|
||||
`req.Raw().Header["x-ms-source-if-unmodified-since"] = []string{(*sourceModifiedAccessConditions.SourceIfUnmodifiedSince).In(gmt).Format(time.RFC1123)}`).
|
||||
replace (/req\.Raw\(\)\.Header\[\"x-ms-immutability-policy-until-date\"\]\s+=\s+\[\]string\{options\.ImmutabilityPolicyExpiry\.Format\(time\.RFC1123\)\}/g,
|
||||
`req.Raw().Header["x-ms-immutability-policy-until-date"] = []string{(*options.ImmutabilityPolicyExpiry).In(gmt).Format(time.RFC1123)}`);
|
||||
|
44
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/blob_client.go
сгенерированный
поставляемый
Normal file
44
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/blob_client.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,44 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
package generated
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"time"
|
||||
)
|
||||
|
||||
// used to convert times from UTC to GMT before sending across the wire
|
||||
var gmt = time.FixedZone("GMT", 0)
|
||||
|
||||
func (client *BlobClient) Endpoint() string {
|
||||
return client.endpoint
|
||||
}
|
||||
|
||||
func (client *BlobClient) InternalClient() *azcore.Client {
|
||||
return client.internal
|
||||
}
|
||||
|
||||
func (client *BlobClient) DeleteCreateRequest(ctx context.Context, options *BlobClientDeleteOptions, leaseAccessConditions *LeaseAccessConditions, modifiedAccessConditions *ModifiedAccessConditions) (*policy.Request, error) {
|
||||
return client.deleteCreateRequest(ctx, options, leaseAccessConditions, modifiedAccessConditions)
|
||||
}
|
||||
|
||||
func (client *BlobClient) SetTierCreateRequest(ctx context.Context, tier AccessTier, options *BlobClientSetTierOptions, leaseAccessConditions *LeaseAccessConditions, modifiedAccessConditions *ModifiedAccessConditions) (*policy.Request, error) {
|
||||
return client.setTierCreateRequest(ctx, tier, options, leaseAccessConditions, modifiedAccessConditions)
|
||||
}
|
||||
|
||||
// NewBlobClient creates a new instance of BlobClient with the specified values.
|
||||
// - endpoint - The URL of the service account, container, or blob that is the target of the desired operation.
|
||||
// - azClient - azcore.Client is a basic HTTP client. It consists of a pipeline and tracing provider.
|
||||
func NewBlobClient(endpoint string, azClient *azcore.Client) *BlobClient {
|
||||
client := &BlobClient{
|
||||
internal: azClient,
|
||||
endpoint: endpoint,
|
||||
}
|
||||
return client
|
||||
}
|
32
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/block_blob_client.go
сгенерированный
поставляемый
Normal file
32
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/block_blob_client.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,32 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package generated
|
||||
|
||||
import (
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
)
|
||||
|
||||
func (client *BlockBlobClient) Endpoint() string {
|
||||
return client.endpoint
|
||||
}
|
||||
|
||||
func (client *BlockBlobClient) Internal() *azcore.Client {
|
||||
return client.internal
|
||||
}
|
||||
|
||||
// NewBlockBlobClient creates a new instance of BlockBlobClient with the specified values.
|
||||
// - endpoint - The URL of the service account, container, or blob that is the target of the desired operation.
|
||||
// - azClient - azcore.Client is a basic HTTP client. It consists of a pipeline and tracing provider.
|
||||
func NewBlockBlobClient(endpoint string, azClient *azcore.Client) *BlockBlobClient {
|
||||
client := &BlockBlobClient{
|
||||
internal: azClient,
|
||||
endpoint: endpoint,
|
||||
}
|
||||
return client
|
||||
}
|
10
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/build.go
сгенерированный
поставляемый
Normal file
10
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/build.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,10 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
//go:generate autorest ./autorest.md
|
||||
//go:generate gofmt -w .
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
package generated
|
9
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/constants.go
сгенерированный
поставляемый
Normal file
9
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/constants.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,9 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
package generated
|
||||
|
||||
const ServiceVersion = "2023-11-03"
|
30
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/container_client.go
сгенерированный
поставляемый
Normal file
30
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/container_client.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,30 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
package generated
|
||||
|
||||
import (
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
)
|
||||
|
||||
func (client *ContainerClient) Endpoint() string {
|
||||
return client.endpoint
|
||||
}
|
||||
|
||||
func (client *ContainerClient) InternalClient() *azcore.Client {
|
||||
return client.internal
|
||||
}
|
||||
|
||||
// NewContainerClient creates a new instance of ContainerClient with the specified values.
|
||||
// - endpoint - The URL of the service account, container, or blob that is the target of the desired operation.
|
||||
// - pl - the pipeline used for sending requests and handling responses.
|
||||
func NewContainerClient(endpoint string, azClient *azcore.Client) *ContainerClient {
|
||||
client := &ContainerClient{
|
||||
internal: azClient,
|
||||
endpoint: endpoint,
|
||||
}
|
||||
return client
|
||||
}
|
141
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/models.go
сгенерированный
поставляемый
Normal file
141
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/models.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,141 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
package generated
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
type TransactionalContentSetter interface {
|
||||
SetCRC64([]byte)
|
||||
SetMD5([]byte)
|
||||
}
|
||||
|
||||
func (a *AppendBlobClientAppendBlockOptions) SetCRC64(v []byte) {
|
||||
a.TransactionalContentCRC64 = v
|
||||
}
|
||||
|
||||
func (a *AppendBlobClientAppendBlockOptions) SetMD5(v []byte) {
|
||||
a.TransactionalContentMD5 = v
|
||||
}
|
||||
|
||||
func (b *BlockBlobClientStageBlockOptions) SetCRC64(v []byte) {
|
||||
b.TransactionalContentCRC64 = v
|
||||
}
|
||||
|
||||
func (b *BlockBlobClientStageBlockOptions) SetMD5(v []byte) {
|
||||
b.TransactionalContentMD5 = v
|
||||
}
|
||||
|
||||
func (p *PageBlobClientUploadPagesOptions) SetCRC64(v []byte) {
|
||||
p.TransactionalContentCRC64 = v
|
||||
}
|
||||
|
||||
func (p *PageBlobClientUploadPagesOptions) SetMD5(v []byte) {
|
||||
p.TransactionalContentMD5 = v
|
||||
}
|
||||
|
||||
func (b *BlockBlobClientUploadOptions) SetCRC64(v []byte) {
|
||||
b.TransactionalContentCRC64 = v
|
||||
}
|
||||
|
||||
func (b *BlockBlobClientUploadOptions) SetMD5(v []byte) {
|
||||
b.TransactionalContentMD5 = v
|
||||
}
|
||||
|
||||
type SourceContentSetter interface {
|
||||
SetSourceContentCRC64(v []byte)
|
||||
SetSourceContentMD5(v []byte)
|
||||
}
|
||||
|
||||
func (a *AppendBlobClientAppendBlockFromURLOptions) SetSourceContentCRC64(v []byte) {
|
||||
a.SourceContentcrc64 = v
|
||||
}
|
||||
|
||||
func (a *AppendBlobClientAppendBlockFromURLOptions) SetSourceContentMD5(v []byte) {
|
||||
a.SourceContentMD5 = v
|
||||
}
|
||||
|
||||
func (b *BlockBlobClientStageBlockFromURLOptions) SetSourceContentCRC64(v []byte) {
|
||||
b.SourceContentcrc64 = v
|
||||
}
|
||||
|
||||
func (b *BlockBlobClientStageBlockFromURLOptions) SetSourceContentMD5(v []byte) {
|
||||
b.SourceContentMD5 = v
|
||||
}
|
||||
|
||||
func (p *PageBlobClientUploadPagesFromURLOptions) SetSourceContentCRC64(v []byte) {
|
||||
p.SourceContentcrc64 = v
|
||||
}
|
||||
|
||||
func (p *PageBlobClientUploadPagesFromURLOptions) SetSourceContentMD5(v []byte) {
|
||||
p.SourceContentMD5 = v
|
||||
}
|
||||
|
||||
// Custom UnmarshalXML functions for types that need special handling.
|
||||
|
||||
// UnmarshalXML implements the xml.Unmarshaller interface for type BlobPrefix.
|
||||
func (b *BlobPrefix) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error {
|
||||
type alias BlobPrefix
|
||||
aux := &struct {
|
||||
*alias
|
||||
BlobName *BlobName `xml:"Name"`
|
||||
}{
|
||||
alias: (*alias)(b),
|
||||
}
|
||||
if err := dec.DecodeElement(aux, &start); err != nil {
|
||||
return err
|
||||
}
|
||||
if aux.BlobName != nil {
|
||||
if aux.BlobName.Encoded != nil && *aux.BlobName.Encoded {
|
||||
name, err := url.QueryUnescape(*aux.BlobName.Content)
|
||||
|
||||
// name, err := base64.StdEncoding.DecodeString(*aux.BlobName.Content)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
b.Name = to.Ptr(string(name))
|
||||
} else {
|
||||
b.Name = aux.BlobName.Content
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// UnmarshalXML implements the xml.Unmarshaller interface for type BlobItem.
|
||||
func (b *BlobItem) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error {
|
||||
type alias BlobItem
|
||||
aux := &struct {
|
||||
*alias
|
||||
BlobName *BlobName `xml:"Name"`
|
||||
Metadata additionalProperties `xml:"Metadata"`
|
||||
OrMetadata additionalProperties `xml:"OrMetadata"`
|
||||
}{
|
||||
alias: (*alias)(b),
|
||||
}
|
||||
if err := dec.DecodeElement(aux, &start); err != nil {
|
||||
return err
|
||||
}
|
||||
b.Metadata = (map[string]*string)(aux.Metadata)
|
||||
b.OrMetadata = (map[string]*string)(aux.OrMetadata)
|
||||
if aux.BlobName != nil {
|
||||
if aux.BlobName.Encoded != nil && *aux.BlobName.Encoded {
|
||||
name, err := url.QueryUnescape(*aux.BlobName.Content)
|
||||
|
||||
// name, err := base64.StdEncoding.DecodeString(*aux.BlobName.Content)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
b.Name = to.Ptr(string(name))
|
||||
} else {
|
||||
b.Name = aux.BlobName.Content
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
30
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/pageblob_client.go
сгенерированный
поставляемый
Normal file
30
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/pageblob_client.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,30 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
package generated
|
||||
|
||||
import (
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
)
|
||||
|
||||
func (client *PageBlobClient) Endpoint() string {
|
||||
return client.endpoint
|
||||
}
|
||||
|
||||
func (client *PageBlobClient) InternalClient() *azcore.Client {
|
||||
return client.internal
|
||||
}
|
||||
|
||||
// NewPageBlobClient creates a new instance of PageBlobClient with the specified values.
|
||||
// - endpoint - The URL of the service account, container, or blob that is the target of the desired operation.
|
||||
// - azClient - azcore.Client is a basic HTTP client. It consists of a pipeline and tracing provider.
|
||||
func NewPageBlobClient(endpoint string, azClient *azcore.Client) *PageBlobClient {
|
||||
client := &PageBlobClient{
|
||||
internal: azClient,
|
||||
endpoint: endpoint,
|
||||
}
|
||||
return client
|
||||
}
|
30
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/service_client.go
сгенерированный
поставляемый
Normal file
30
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/service_client.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,30 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
package generated
|
||||
|
||||
import (
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
)
|
||||
|
||||
func (client *ServiceClient) Endpoint() string {
|
||||
return client.endpoint
|
||||
}
|
||||
|
||||
func (client *ServiceClient) InternalClient() *azcore.Client {
|
||||
return client.internal
|
||||
}
|
||||
|
||||
// NewServiceClient creates a new instance of ServiceClient with the specified values.
|
||||
// - endpoint - The URL of the service account, container, or blob that is the target of the desired operation.
|
||||
// - azClient - azcore.Client is a basic HTTP client. It consists of a pipeline and tracing provider.
|
||||
func NewServiceClient(endpoint string, azClient *azcore.Client) *ServiceClient {
|
||||
client := &ServiceClient{
|
||||
internal: azClient,
|
||||
endpoint: endpoint,
|
||||
}
|
||||
return client
|
||||
}
|
662
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/zz_appendblob_client.go
сгенерированный
поставляемый
Normal file
662
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/zz_appendblob_client.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,662 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package generated
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"io"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
// AppendBlobClient contains the methods for the AppendBlob group.
|
||||
// Don't use this type directly, use a constructor function instead.
|
||||
type AppendBlobClient struct {
|
||||
internal *azcore.Client
|
||||
endpoint string
|
||||
}
|
||||
|
||||
// AppendBlock - The Append Block operation commits a new block of data to the end of an existing append blob. The Append
|
||||
// Block operation is permitted only if the blob was created with x-ms-blob-type set to
|
||||
// AppendBlob. Append Block is supported only on version 2015-02-21 version or later.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-11-03
|
||||
// - contentLength - The length of the request.
|
||||
// - body - Initial data
|
||||
// - options - AppendBlobClientAppendBlockOptions contains the optional parameters for the AppendBlobClient.AppendBlock method.
|
||||
// - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ContainerClient.GetProperties method.
|
||||
// - AppendPositionAccessConditions - AppendPositionAccessConditions contains a group of parameters for the AppendBlobClient.AppendBlock
|
||||
// method.
|
||||
// - CPKInfo - CPKInfo contains a group of parameters for the BlobClient.Download method.
|
||||
// - CPKScopeInfo - CPKScopeInfo contains a group of parameters for the BlobClient.SetMetadata method.
|
||||
// - ModifiedAccessConditions - ModifiedAccessConditions contains a group of parameters for the ContainerClient.Delete method.
|
||||
func (client *AppendBlobClient) AppendBlock(ctx context.Context, contentLength int64, body io.ReadSeekCloser, options *AppendBlobClientAppendBlockOptions, leaseAccessConditions *LeaseAccessConditions, appendPositionAccessConditions *AppendPositionAccessConditions, cpkInfo *CPKInfo, cpkScopeInfo *CPKScopeInfo, modifiedAccessConditions *ModifiedAccessConditions) (AppendBlobClientAppendBlockResponse, error) {
|
||||
var err error
|
||||
req, err := client.appendBlockCreateRequest(ctx, contentLength, body, options, leaseAccessConditions, appendPositionAccessConditions, cpkInfo, cpkScopeInfo, modifiedAccessConditions)
|
||||
if err != nil {
|
||||
return AppendBlobClientAppendBlockResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return AppendBlobClientAppendBlockResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusCreated) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return AppendBlobClientAppendBlockResponse{}, err
|
||||
}
|
||||
resp, err := client.appendBlockHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// appendBlockCreateRequest creates the AppendBlock request.
|
||||
func (client *AppendBlobClient) appendBlockCreateRequest(ctx context.Context, contentLength int64, body io.ReadSeekCloser, options *AppendBlobClientAppendBlockOptions, leaseAccessConditions *LeaseAccessConditions, appendPositionAccessConditions *AppendPositionAccessConditions, cpkInfo *CPKInfo, cpkScopeInfo *CPKScopeInfo, modifiedAccessConditions *ModifiedAccessConditions) (*policy.Request, error) {
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPut, client.endpoint)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("comp", "appendblock")
|
||||
if options != nil && options.Timeout != nil {
|
||||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Content-Length"] = []string{strconv.FormatInt(contentLength, 10)}
|
||||
if options != nil && options.TransactionalContentMD5 != nil {
|
||||
req.Raw().Header["Content-MD5"] = []string{base64.StdEncoding.EncodeToString(options.TransactionalContentMD5)}
|
||||
}
|
||||
if options != nil && options.TransactionalContentCRC64 != nil {
|
||||
req.Raw().Header["x-ms-content-crc64"] = []string{base64.StdEncoding.EncodeToString(options.TransactionalContentCRC64)}
|
||||
}
|
||||
if leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil {
|
||||
req.Raw().Header["x-ms-lease-id"] = []string{*leaseAccessConditions.LeaseID}
|
||||
}
|
||||
if appendPositionAccessConditions != nil && appendPositionAccessConditions.MaxSize != nil {
|
||||
req.Raw().Header["x-ms-blob-condition-maxsize"] = []string{strconv.FormatInt(*appendPositionAccessConditions.MaxSize, 10)}
|
||||
}
|
||||
if appendPositionAccessConditions != nil && appendPositionAccessConditions.AppendPosition != nil {
|
||||
req.Raw().Header["x-ms-blob-condition-appendpos"] = []string{strconv.FormatInt(*appendPositionAccessConditions.AppendPosition, 10)}
|
||||
}
|
||||
if cpkInfo != nil && cpkInfo.EncryptionKey != nil {
|
||||
req.Raw().Header["x-ms-encryption-key"] = []string{*cpkInfo.EncryptionKey}
|
||||
}
|
||||
if cpkInfo != nil && cpkInfo.EncryptionKeySHA256 != nil {
|
||||
req.Raw().Header["x-ms-encryption-key-sha256"] = []string{*cpkInfo.EncryptionKeySHA256}
|
||||
}
|
||||
if cpkInfo != nil && cpkInfo.EncryptionAlgorithm != nil {
|
||||
req.Raw().Header["x-ms-encryption-algorithm"] = []string{string(*cpkInfo.EncryptionAlgorithm)}
|
||||
}
|
||||
if cpkScopeInfo != nil && cpkScopeInfo.EncryptionScope != nil {
|
||||
req.Raw().Header["x-ms-encryption-scope"] = []string{*cpkScopeInfo.EncryptionScope}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfModifiedSince != nil {
|
||||
req.Raw().Header["If-Modified-Since"] = []string{(*modifiedAccessConditions.IfModifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfUnmodifiedSince != nil {
|
||||
req.Raw().Header["If-Unmodified-Since"] = []string{(*modifiedAccessConditions.IfUnmodifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfMatch != nil {
|
||||
req.Raw().Header["If-Match"] = []string{string(*modifiedAccessConditions.IfMatch)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfNoneMatch != nil {
|
||||
req.Raw().Header["If-None-Match"] = []string{string(*modifiedAccessConditions.IfNoneMatch)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfTags != nil {
|
||||
req.Raw().Header["x-ms-if-tags"] = []string{*modifiedAccessConditions.IfTags}
|
||||
}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
if options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
if err := req.SetBody(body, "application/octet-stream"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// appendBlockHandleResponse handles the AppendBlock response.
|
||||
func (client *AppendBlobClient) appendBlockHandleResponse(resp *http.Response) (AppendBlobClientAppendBlockResponse, error) {
|
||||
result := AppendBlobClientAppendBlockResponse{}
|
||||
if val := resp.Header.Get("x-ms-blob-append-offset"); val != "" {
|
||||
result.BlobAppendOffset = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-blob-committed-block-count"); val != "" {
|
||||
blobCommittedBlockCount32, err := strconv.ParseInt(val, 10, 32)
|
||||
blobCommittedBlockCount := int32(blobCommittedBlockCount32)
|
||||
if err != nil {
|
||||
return AppendBlobClientAppendBlockResponse{}, err
|
||||
}
|
||||
result.BlobCommittedBlockCount = &blobCommittedBlockCount
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-client-request-id"); val != "" {
|
||||
result.ClientRequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-content-crc64"); val != "" {
|
||||
contentCRC64, err := base64.StdEncoding.DecodeString(val)
|
||||
if err != nil {
|
||||
return AppendBlobClientAppendBlockResponse{}, err
|
||||
}
|
||||
result.ContentCRC64 = contentCRC64
|
||||
}
|
||||
if val := resp.Header.Get("Content-MD5"); val != "" {
|
||||
contentMD5, err := base64.StdEncoding.DecodeString(val)
|
||||
if err != nil {
|
||||
return AppendBlobClientAppendBlockResponse{}, err
|
||||
}
|
||||
result.ContentMD5 = contentMD5
|
||||
}
|
||||
if val := resp.Header.Get("Date"); val != "" {
|
||||
date, err := time.Parse(time.RFC1123, val)
|
||||
if err != nil {
|
||||
return AppendBlobClientAppendBlockResponse{}, err
|
||||
}
|
||||
result.Date = &date
|
||||
}
|
||||
if val := resp.Header.Get("ETag"); val != "" {
|
||||
result.ETag = (*azcore.ETag)(&val)
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-encryption-key-sha256"); val != "" {
|
||||
result.EncryptionKeySHA256 = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-encryption-scope"); val != "" {
|
||||
result.EncryptionScope = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-server-encrypted"); val != "" {
|
||||
isServerEncrypted, err := strconv.ParseBool(val)
|
||||
if err != nil {
|
||||
return AppendBlobClientAppendBlockResponse{}, err
|
||||
}
|
||||
result.IsServerEncrypted = &isServerEncrypted
|
||||
}
|
||||
if val := resp.Header.Get("Last-Modified"); val != "" {
|
||||
lastModified, err := time.Parse(time.RFC1123, val)
|
||||
if err != nil {
|
||||
return AppendBlobClientAppendBlockResponse{}, err
|
||||
}
|
||||
result.LastModified = &lastModified
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.RequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-version"); val != "" {
|
||||
result.Version = &val
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// AppendBlockFromURL - The Append Block operation commits a new block of data to the end of an existing append blob where
|
||||
// the contents are read from a source url. The Append Block operation is permitted only if the blob was
|
||||
// created with x-ms-blob-type set to AppendBlob. Append Block is supported only on version 2015-02-21 version or later.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-11-03
|
||||
// - sourceURL - Specify a URL to the copy source.
|
||||
// - contentLength - The length of the request.
|
||||
// - options - AppendBlobClientAppendBlockFromURLOptions contains the optional parameters for the AppendBlobClient.AppendBlockFromURL
|
||||
// method.
|
||||
// - CPKInfo - CPKInfo contains a group of parameters for the BlobClient.Download method.
|
||||
// - CPKScopeInfo - CPKScopeInfo contains a group of parameters for the BlobClient.SetMetadata method.
|
||||
// - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ContainerClient.GetProperties method.
|
||||
// - AppendPositionAccessConditions - AppendPositionAccessConditions contains a group of parameters for the AppendBlobClient.AppendBlock
|
||||
// method.
|
||||
// - ModifiedAccessConditions - ModifiedAccessConditions contains a group of parameters for the ContainerClient.Delete method.
|
||||
// - SourceModifiedAccessConditions - SourceModifiedAccessConditions contains a group of parameters for the BlobClient.StartCopyFromURL
|
||||
// method.
|
||||
func (client *AppendBlobClient) AppendBlockFromURL(ctx context.Context, sourceURL string, contentLength int64, options *AppendBlobClientAppendBlockFromURLOptions, cpkInfo *CPKInfo, cpkScopeInfo *CPKScopeInfo, leaseAccessConditions *LeaseAccessConditions, appendPositionAccessConditions *AppendPositionAccessConditions, modifiedAccessConditions *ModifiedAccessConditions, sourceModifiedAccessConditions *SourceModifiedAccessConditions) (AppendBlobClientAppendBlockFromURLResponse, error) {
|
||||
var err error
|
||||
req, err := client.appendBlockFromURLCreateRequest(ctx, sourceURL, contentLength, options, cpkInfo, cpkScopeInfo, leaseAccessConditions, appendPositionAccessConditions, modifiedAccessConditions, sourceModifiedAccessConditions)
|
||||
if err != nil {
|
||||
return AppendBlobClientAppendBlockFromURLResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return AppendBlobClientAppendBlockFromURLResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusCreated) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return AppendBlobClientAppendBlockFromURLResponse{}, err
|
||||
}
|
||||
resp, err := client.appendBlockFromURLHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// appendBlockFromURLCreateRequest creates the AppendBlockFromURL request.
|
||||
func (client *AppendBlobClient) appendBlockFromURLCreateRequest(ctx context.Context, sourceURL string, contentLength int64, options *AppendBlobClientAppendBlockFromURLOptions, cpkInfo *CPKInfo, cpkScopeInfo *CPKScopeInfo, leaseAccessConditions *LeaseAccessConditions, appendPositionAccessConditions *AppendPositionAccessConditions, modifiedAccessConditions *ModifiedAccessConditions, sourceModifiedAccessConditions *SourceModifiedAccessConditions) (*policy.Request, error) {
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPut, client.endpoint)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("comp", "appendblock")
|
||||
if options != nil && options.Timeout != nil {
|
||||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["x-ms-copy-source"] = []string{sourceURL}
|
||||
if options != nil && options.SourceRange != nil {
|
||||
req.Raw().Header["x-ms-source-range"] = []string{*options.SourceRange}
|
||||
}
|
||||
if options != nil && options.SourceContentMD5 != nil {
|
||||
req.Raw().Header["x-ms-source-content-md5"] = []string{base64.StdEncoding.EncodeToString(options.SourceContentMD5)}
|
||||
}
|
||||
if options != nil && options.SourceContentcrc64 != nil {
|
||||
req.Raw().Header["x-ms-source-content-crc64"] = []string{base64.StdEncoding.EncodeToString(options.SourceContentcrc64)}
|
||||
}
|
||||
req.Raw().Header["Content-Length"] = []string{strconv.FormatInt(contentLength, 10)}
|
||||
if options != nil && options.TransactionalContentMD5 != nil {
|
||||
req.Raw().Header["Content-MD5"] = []string{base64.StdEncoding.EncodeToString(options.TransactionalContentMD5)}
|
||||
}
|
||||
if cpkInfo != nil && cpkInfo.EncryptionKey != nil {
|
||||
req.Raw().Header["x-ms-encryption-key"] = []string{*cpkInfo.EncryptionKey}
|
||||
}
|
||||
if cpkInfo != nil && cpkInfo.EncryptionKeySHA256 != nil {
|
||||
req.Raw().Header["x-ms-encryption-key-sha256"] = []string{*cpkInfo.EncryptionKeySHA256}
|
||||
}
|
||||
if cpkInfo != nil && cpkInfo.EncryptionAlgorithm != nil {
|
||||
req.Raw().Header["x-ms-encryption-algorithm"] = []string{string(*cpkInfo.EncryptionAlgorithm)}
|
||||
}
|
||||
if cpkScopeInfo != nil && cpkScopeInfo.EncryptionScope != nil {
|
||||
req.Raw().Header["x-ms-encryption-scope"] = []string{*cpkScopeInfo.EncryptionScope}
|
||||
}
|
||||
if leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil {
|
||||
req.Raw().Header["x-ms-lease-id"] = []string{*leaseAccessConditions.LeaseID}
|
||||
}
|
||||
if appendPositionAccessConditions != nil && appendPositionAccessConditions.MaxSize != nil {
|
||||
req.Raw().Header["x-ms-blob-condition-maxsize"] = []string{strconv.FormatInt(*appendPositionAccessConditions.MaxSize, 10)}
|
||||
}
|
||||
if appendPositionAccessConditions != nil && appendPositionAccessConditions.AppendPosition != nil {
|
||||
req.Raw().Header["x-ms-blob-condition-appendpos"] = []string{strconv.FormatInt(*appendPositionAccessConditions.AppendPosition, 10)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfModifiedSince != nil {
|
||||
req.Raw().Header["If-Modified-Since"] = []string{(*modifiedAccessConditions.IfModifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfUnmodifiedSince != nil {
|
||||
req.Raw().Header["If-Unmodified-Since"] = []string{(*modifiedAccessConditions.IfUnmodifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfMatch != nil {
|
||||
req.Raw().Header["If-Match"] = []string{string(*modifiedAccessConditions.IfMatch)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfNoneMatch != nil {
|
||||
req.Raw().Header["If-None-Match"] = []string{string(*modifiedAccessConditions.IfNoneMatch)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfTags != nil {
|
||||
req.Raw().Header["x-ms-if-tags"] = []string{*modifiedAccessConditions.IfTags}
|
||||
}
|
||||
if sourceModifiedAccessConditions != nil && sourceModifiedAccessConditions.SourceIfModifiedSince != nil {
|
||||
req.Raw().Header["x-ms-source-if-modified-since"] = []string{(*sourceModifiedAccessConditions.SourceIfModifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if sourceModifiedAccessConditions != nil && sourceModifiedAccessConditions.SourceIfUnmodifiedSince != nil {
|
||||
req.Raw().Header["x-ms-source-if-unmodified-since"] = []string{(*sourceModifiedAccessConditions.SourceIfUnmodifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if sourceModifiedAccessConditions != nil && sourceModifiedAccessConditions.SourceIfMatch != nil {
|
||||
req.Raw().Header["x-ms-source-if-match"] = []string{string(*sourceModifiedAccessConditions.SourceIfMatch)}
|
||||
}
|
||||
if sourceModifiedAccessConditions != nil && sourceModifiedAccessConditions.SourceIfNoneMatch != nil {
|
||||
req.Raw().Header["x-ms-source-if-none-match"] = []string{string(*sourceModifiedAccessConditions.SourceIfNoneMatch)}
|
||||
}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
if options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
if options != nil && options.CopySourceAuthorization != nil {
|
||||
req.Raw().Header["x-ms-copy-source-authorization"] = []string{*options.CopySourceAuthorization}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// appendBlockFromURLHandleResponse handles the AppendBlockFromURL response.
|
||||
func (client *AppendBlobClient) appendBlockFromURLHandleResponse(resp *http.Response) (AppendBlobClientAppendBlockFromURLResponse, error) {
|
||||
result := AppendBlobClientAppendBlockFromURLResponse{}
|
||||
if val := resp.Header.Get("x-ms-blob-append-offset"); val != "" {
|
||||
result.BlobAppendOffset = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-blob-committed-block-count"); val != "" {
|
||||
blobCommittedBlockCount32, err := strconv.ParseInt(val, 10, 32)
|
||||
blobCommittedBlockCount := int32(blobCommittedBlockCount32)
|
||||
if err != nil {
|
||||
return AppendBlobClientAppendBlockFromURLResponse{}, err
|
||||
}
|
||||
result.BlobCommittedBlockCount = &blobCommittedBlockCount
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-content-crc64"); val != "" {
|
||||
contentCRC64, err := base64.StdEncoding.DecodeString(val)
|
||||
if err != nil {
|
||||
return AppendBlobClientAppendBlockFromURLResponse{}, err
|
||||
}
|
||||
result.ContentCRC64 = contentCRC64
|
||||
}
|
||||
if val := resp.Header.Get("Content-MD5"); val != "" {
|
||||
contentMD5, err := base64.StdEncoding.DecodeString(val)
|
||||
if err != nil {
|
||||
return AppendBlobClientAppendBlockFromURLResponse{}, err
|
||||
}
|
||||
result.ContentMD5 = contentMD5
|
||||
}
|
||||
if val := resp.Header.Get("Date"); val != "" {
|
||||
date, err := time.Parse(time.RFC1123, val)
|
||||
if err != nil {
|
||||
return AppendBlobClientAppendBlockFromURLResponse{}, err
|
||||
}
|
||||
result.Date = &date
|
||||
}
|
||||
if val := resp.Header.Get("ETag"); val != "" {
|
||||
result.ETag = (*azcore.ETag)(&val)
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-encryption-key-sha256"); val != "" {
|
||||
result.EncryptionKeySHA256 = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-encryption-scope"); val != "" {
|
||||
result.EncryptionScope = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-server-encrypted"); val != "" {
|
||||
isServerEncrypted, err := strconv.ParseBool(val)
|
||||
if err != nil {
|
||||
return AppendBlobClientAppendBlockFromURLResponse{}, err
|
||||
}
|
||||
result.IsServerEncrypted = &isServerEncrypted
|
||||
}
|
||||
if val := resp.Header.Get("Last-Modified"); val != "" {
|
||||
lastModified, err := time.Parse(time.RFC1123, val)
|
||||
if err != nil {
|
||||
return AppendBlobClientAppendBlockFromURLResponse{}, err
|
||||
}
|
||||
result.LastModified = &lastModified
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.RequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-version"); val != "" {
|
||||
result.Version = &val
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Create - The Create Append Blob operation creates a new append blob.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-11-03
|
||||
// - contentLength - The length of the request.
|
||||
// - options - AppendBlobClientCreateOptions contains the optional parameters for the AppendBlobClient.Create method.
|
||||
// - BlobHTTPHeaders - BlobHTTPHeaders contains a group of parameters for the BlobClient.SetHTTPHeaders method.
|
||||
// - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ContainerClient.GetProperties method.
|
||||
// - CPKInfo - CPKInfo contains a group of parameters for the BlobClient.Download method.
|
||||
// - CPKScopeInfo - CPKScopeInfo contains a group of parameters for the BlobClient.SetMetadata method.
|
||||
// - ModifiedAccessConditions - ModifiedAccessConditions contains a group of parameters for the ContainerClient.Delete method.
|
||||
func (client *AppendBlobClient) Create(ctx context.Context, contentLength int64, options *AppendBlobClientCreateOptions, blobHTTPHeaders *BlobHTTPHeaders, leaseAccessConditions *LeaseAccessConditions, cpkInfo *CPKInfo, cpkScopeInfo *CPKScopeInfo, modifiedAccessConditions *ModifiedAccessConditions) (AppendBlobClientCreateResponse, error) {
|
||||
var err error
|
||||
req, err := client.createCreateRequest(ctx, contentLength, options, blobHTTPHeaders, leaseAccessConditions, cpkInfo, cpkScopeInfo, modifiedAccessConditions)
|
||||
if err != nil {
|
||||
return AppendBlobClientCreateResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return AppendBlobClientCreateResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusCreated) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return AppendBlobClientCreateResponse{}, err
|
||||
}
|
||||
resp, err := client.createHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// createCreateRequest creates the Create request.
|
||||
func (client *AppendBlobClient) createCreateRequest(ctx context.Context, contentLength int64, options *AppendBlobClientCreateOptions, blobHTTPHeaders *BlobHTTPHeaders, leaseAccessConditions *LeaseAccessConditions, cpkInfo *CPKInfo, cpkScopeInfo *CPKScopeInfo, modifiedAccessConditions *ModifiedAccessConditions) (*policy.Request, error) {
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPut, client.endpoint)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
if options != nil && options.Timeout != nil {
|
||||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["x-ms-blob-type"] = []string{"AppendBlob"}
|
||||
req.Raw().Header["Content-Length"] = []string{strconv.FormatInt(contentLength, 10)}
|
||||
if blobHTTPHeaders != nil && blobHTTPHeaders.BlobContentType != nil {
|
||||
req.Raw().Header["x-ms-blob-content-type"] = []string{*blobHTTPHeaders.BlobContentType}
|
||||
}
|
||||
if blobHTTPHeaders != nil && blobHTTPHeaders.BlobContentEncoding != nil {
|
||||
req.Raw().Header["x-ms-blob-content-encoding"] = []string{*blobHTTPHeaders.BlobContentEncoding}
|
||||
}
|
||||
if blobHTTPHeaders != nil && blobHTTPHeaders.BlobContentLanguage != nil {
|
||||
req.Raw().Header["x-ms-blob-content-language"] = []string{*blobHTTPHeaders.BlobContentLanguage}
|
||||
}
|
||||
if blobHTTPHeaders != nil && blobHTTPHeaders.BlobContentMD5 != nil {
|
||||
req.Raw().Header["x-ms-blob-content-md5"] = []string{base64.StdEncoding.EncodeToString(blobHTTPHeaders.BlobContentMD5)}
|
||||
}
|
||||
if blobHTTPHeaders != nil && blobHTTPHeaders.BlobCacheControl != nil {
|
||||
req.Raw().Header["x-ms-blob-cache-control"] = []string{*blobHTTPHeaders.BlobCacheControl}
|
||||
}
|
||||
if options != nil && options.Metadata != nil {
|
||||
for k, v := range options.Metadata {
|
||||
if v != nil {
|
||||
req.Raw().Header["x-ms-meta-"+k] = []string{*v}
|
||||
}
|
||||
}
|
||||
}
|
||||
if leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil {
|
||||
req.Raw().Header["x-ms-lease-id"] = []string{*leaseAccessConditions.LeaseID}
|
||||
}
|
||||
if blobHTTPHeaders != nil && blobHTTPHeaders.BlobContentDisposition != nil {
|
||||
req.Raw().Header["x-ms-blob-content-disposition"] = []string{*blobHTTPHeaders.BlobContentDisposition}
|
||||
}
|
||||
if cpkInfo != nil && cpkInfo.EncryptionKey != nil {
|
||||
req.Raw().Header["x-ms-encryption-key"] = []string{*cpkInfo.EncryptionKey}
|
||||
}
|
||||
if cpkInfo != nil && cpkInfo.EncryptionKeySHA256 != nil {
|
||||
req.Raw().Header["x-ms-encryption-key-sha256"] = []string{*cpkInfo.EncryptionKeySHA256}
|
||||
}
|
||||
if cpkInfo != nil && cpkInfo.EncryptionAlgorithm != nil {
|
||||
req.Raw().Header["x-ms-encryption-algorithm"] = []string{string(*cpkInfo.EncryptionAlgorithm)}
|
||||
}
|
||||
if cpkScopeInfo != nil && cpkScopeInfo.EncryptionScope != nil {
|
||||
req.Raw().Header["x-ms-encryption-scope"] = []string{*cpkScopeInfo.EncryptionScope}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfModifiedSince != nil {
|
||||
req.Raw().Header["If-Modified-Since"] = []string{(*modifiedAccessConditions.IfModifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfUnmodifiedSince != nil {
|
||||
req.Raw().Header["If-Unmodified-Since"] = []string{(*modifiedAccessConditions.IfUnmodifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfMatch != nil {
|
||||
req.Raw().Header["If-Match"] = []string{string(*modifiedAccessConditions.IfMatch)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfNoneMatch != nil {
|
||||
req.Raw().Header["If-None-Match"] = []string{string(*modifiedAccessConditions.IfNoneMatch)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfTags != nil {
|
||||
req.Raw().Header["x-ms-if-tags"] = []string{*modifiedAccessConditions.IfTags}
|
||||
}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
if options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
if options != nil && options.BlobTagsString != nil {
|
||||
req.Raw().Header["x-ms-tags"] = []string{*options.BlobTagsString}
|
||||
}
|
||||
if options != nil && options.ImmutabilityPolicyExpiry != nil {
|
||||
req.Raw().Header["x-ms-immutability-policy-until-date"] = []string{(*options.ImmutabilityPolicyExpiry).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if options != nil && options.ImmutabilityPolicyMode != nil {
|
||||
req.Raw().Header["x-ms-immutability-policy-mode"] = []string{string(*options.ImmutabilityPolicyMode)}
|
||||
}
|
||||
if options != nil && options.LegalHold != nil {
|
||||
req.Raw().Header["x-ms-legal-hold"] = []string{strconv.FormatBool(*options.LegalHold)}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// createHandleResponse handles the Create response.
|
||||
func (client *AppendBlobClient) createHandleResponse(resp *http.Response) (AppendBlobClientCreateResponse, error) {
|
||||
result := AppendBlobClientCreateResponse{}
|
||||
if val := resp.Header.Get("x-ms-client-request-id"); val != "" {
|
||||
result.ClientRequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("Content-MD5"); val != "" {
|
||||
contentMD5, err := base64.StdEncoding.DecodeString(val)
|
||||
if err != nil {
|
||||
return AppendBlobClientCreateResponse{}, err
|
||||
}
|
||||
result.ContentMD5 = contentMD5
|
||||
}
|
||||
if val := resp.Header.Get("Date"); val != "" {
|
||||
date, err := time.Parse(time.RFC1123, val)
|
||||
if err != nil {
|
||||
return AppendBlobClientCreateResponse{}, err
|
||||
}
|
||||
result.Date = &date
|
||||
}
|
||||
if val := resp.Header.Get("ETag"); val != "" {
|
||||
result.ETag = (*azcore.ETag)(&val)
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-encryption-key-sha256"); val != "" {
|
||||
result.EncryptionKeySHA256 = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-encryption-scope"); val != "" {
|
||||
result.EncryptionScope = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-server-encrypted"); val != "" {
|
||||
isServerEncrypted, err := strconv.ParseBool(val)
|
||||
if err != nil {
|
||||
return AppendBlobClientCreateResponse{}, err
|
||||
}
|
||||
result.IsServerEncrypted = &isServerEncrypted
|
||||
}
|
||||
if val := resp.Header.Get("Last-Modified"); val != "" {
|
||||
lastModified, err := time.Parse(time.RFC1123, val)
|
||||
if err != nil {
|
||||
return AppendBlobClientCreateResponse{}, err
|
||||
}
|
||||
result.LastModified = &lastModified
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.RequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-version"); val != "" {
|
||||
result.Version = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-version-id"); val != "" {
|
||||
result.VersionID = &val
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Seal - The Seal operation seals the Append Blob to make it read-only. Seal is supported only on version 2019-12-12 version
|
||||
// or later.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-11-03
|
||||
// - options - AppendBlobClientSealOptions contains the optional parameters for the AppendBlobClient.Seal method.
|
||||
// - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ContainerClient.GetProperties method.
|
||||
// - ModifiedAccessConditions - ModifiedAccessConditions contains a group of parameters for the ContainerClient.Delete method.
|
||||
// - AppendPositionAccessConditions - AppendPositionAccessConditions contains a group of parameters for the AppendBlobClient.AppendBlock
|
||||
// method.
|
||||
func (client *AppendBlobClient) Seal(ctx context.Context, options *AppendBlobClientSealOptions, leaseAccessConditions *LeaseAccessConditions, modifiedAccessConditions *ModifiedAccessConditions, appendPositionAccessConditions *AppendPositionAccessConditions) (AppendBlobClientSealResponse, error) {
|
||||
var err error
|
||||
req, err := client.sealCreateRequest(ctx, options, leaseAccessConditions, modifiedAccessConditions, appendPositionAccessConditions)
|
||||
if err != nil {
|
||||
return AppendBlobClientSealResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return AppendBlobClientSealResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return AppendBlobClientSealResponse{}, err
|
||||
}
|
||||
resp, err := client.sealHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// sealCreateRequest creates the Seal request.
|
||||
func (client *AppendBlobClient) sealCreateRequest(ctx context.Context, options *AppendBlobClientSealOptions, leaseAccessConditions *LeaseAccessConditions, modifiedAccessConditions *ModifiedAccessConditions, appendPositionAccessConditions *AppendPositionAccessConditions) (*policy.Request, error) {
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPut, client.endpoint)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("comp", "seal")
|
||||
if options != nil && options.Timeout != nil {
|
||||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
if options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
if leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil {
|
||||
req.Raw().Header["x-ms-lease-id"] = []string{*leaseAccessConditions.LeaseID}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfModifiedSince != nil {
|
||||
req.Raw().Header["If-Modified-Since"] = []string{(*modifiedAccessConditions.IfModifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfUnmodifiedSince != nil {
|
||||
req.Raw().Header["If-Unmodified-Since"] = []string{(*modifiedAccessConditions.IfUnmodifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfMatch != nil {
|
||||
req.Raw().Header["If-Match"] = []string{string(*modifiedAccessConditions.IfMatch)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfNoneMatch != nil {
|
||||
req.Raw().Header["If-None-Match"] = []string{string(*modifiedAccessConditions.IfNoneMatch)}
|
||||
}
|
||||
if appendPositionAccessConditions != nil && appendPositionAccessConditions.AppendPosition != nil {
|
||||
req.Raw().Header["x-ms-blob-condition-appendpos"] = []string{strconv.FormatInt(*appendPositionAccessConditions.AppendPosition, 10)}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// sealHandleResponse handles the Seal response.
|
||||
func (client *AppendBlobClient) sealHandleResponse(resp *http.Response) (AppendBlobClientSealResponse, error) {
|
||||
result := AppendBlobClientSealResponse{}
|
||||
if val := resp.Header.Get("x-ms-client-request-id"); val != "" {
|
||||
result.ClientRequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("Date"); val != "" {
|
||||
date, err := time.Parse(time.RFC1123, val)
|
||||
if err != nil {
|
||||
return AppendBlobClientSealResponse{}, err
|
||||
}
|
||||
result.Date = &date
|
||||
}
|
||||
if val := resp.Header.Get("ETag"); val != "" {
|
||||
result.ETag = (*azcore.ETag)(&val)
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-blob-sealed"); val != "" {
|
||||
isSealed, err := strconv.ParseBool(val)
|
||||
if err != nil {
|
||||
return AppendBlobClientSealResponse{}, err
|
||||
}
|
||||
result.IsSealed = &isSealed
|
||||
}
|
||||
if val := resp.Header.Get("Last-Modified"); val != "" {
|
||||
lastModified, err := time.Parse(time.RFC1123, val)
|
||||
if err != nil {
|
||||
return AppendBlobClientSealResponse{}, err
|
||||
}
|
||||
result.LastModified = &lastModified
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.RequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-version"); val != "" {
|
||||
result.Version = &val
|
||||
}
|
||||
return result, nil
|
||||
}
|
2962
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/zz_blob_client.go
сгенерированный
поставляемый
Normal file
2962
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/zz_blob_client.go
сгенерированный
поставляемый
Normal file
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
993
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/zz_blockblob_client.go
сгенерированный
поставляемый
Normal file
993
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/zz_blockblob_client.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,993 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package generated
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"io"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
// BlockBlobClient contains the methods for the BlockBlob group.
|
||||
// Don't use this type directly, use a constructor function instead.
|
||||
type BlockBlobClient struct {
|
||||
internal *azcore.Client
|
||||
endpoint string
|
||||
}
|
||||
|
||||
// CommitBlockList - The Commit Block List operation writes a blob by specifying the list of block IDs that make up the blob.
|
||||
// In order to be written as part of a blob, a block must have been successfully written to the
|
||||
// server in a prior Put Block operation. You can call Put Block List to update a blob by uploading only those blocks that
|
||||
// have changed, then committing the new and existing blocks together. You can do
|
||||
// this by specifying whether to commit a block from the committed block list or from the uncommitted block list, or to commit
|
||||
// the most recently uploaded version of the block, whichever list it may
|
||||
// belong to.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-11-03
|
||||
// - blocks - Blob Blocks.
|
||||
// - options - BlockBlobClientCommitBlockListOptions contains the optional parameters for the BlockBlobClient.CommitBlockList
|
||||
// method.
|
||||
// - BlobHTTPHeaders - BlobHTTPHeaders contains a group of parameters for the BlobClient.SetHTTPHeaders method.
|
||||
// - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ContainerClient.GetProperties method.
|
||||
// - CPKInfo - CPKInfo contains a group of parameters for the BlobClient.Download method.
|
||||
// - CPKScopeInfo - CPKScopeInfo contains a group of parameters for the BlobClient.SetMetadata method.
|
||||
// - ModifiedAccessConditions - ModifiedAccessConditions contains a group of parameters for the ContainerClient.Delete method.
|
||||
func (client *BlockBlobClient) CommitBlockList(ctx context.Context, blocks BlockLookupList, options *BlockBlobClientCommitBlockListOptions, blobHTTPHeaders *BlobHTTPHeaders, leaseAccessConditions *LeaseAccessConditions, cpkInfo *CPKInfo, cpkScopeInfo *CPKScopeInfo, modifiedAccessConditions *ModifiedAccessConditions) (BlockBlobClientCommitBlockListResponse, error) {
|
||||
var err error
|
||||
req, err := client.commitBlockListCreateRequest(ctx, blocks, options, blobHTTPHeaders, leaseAccessConditions, cpkInfo, cpkScopeInfo, modifiedAccessConditions)
|
||||
if err != nil {
|
||||
return BlockBlobClientCommitBlockListResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return BlockBlobClientCommitBlockListResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusCreated) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return BlockBlobClientCommitBlockListResponse{}, err
|
||||
}
|
||||
resp, err := client.commitBlockListHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// commitBlockListCreateRequest creates the CommitBlockList request.
|
||||
func (client *BlockBlobClient) commitBlockListCreateRequest(ctx context.Context, blocks BlockLookupList, options *BlockBlobClientCommitBlockListOptions, blobHTTPHeaders *BlobHTTPHeaders, leaseAccessConditions *LeaseAccessConditions, cpkInfo *CPKInfo, cpkScopeInfo *CPKScopeInfo, modifiedAccessConditions *ModifiedAccessConditions) (*policy.Request, error) {
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPut, client.endpoint)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("comp", "blocklist")
|
||||
if options != nil && options.Timeout != nil {
|
||||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
if blobHTTPHeaders != nil && blobHTTPHeaders.BlobCacheControl != nil {
|
||||
req.Raw().Header["x-ms-blob-cache-control"] = []string{*blobHTTPHeaders.BlobCacheControl}
|
||||
}
|
||||
if blobHTTPHeaders != nil && blobHTTPHeaders.BlobContentType != nil {
|
||||
req.Raw().Header["x-ms-blob-content-type"] = []string{*blobHTTPHeaders.BlobContentType}
|
||||
}
|
||||
if blobHTTPHeaders != nil && blobHTTPHeaders.BlobContentEncoding != nil {
|
||||
req.Raw().Header["x-ms-blob-content-encoding"] = []string{*blobHTTPHeaders.BlobContentEncoding}
|
||||
}
|
||||
if blobHTTPHeaders != nil && blobHTTPHeaders.BlobContentLanguage != nil {
|
||||
req.Raw().Header["x-ms-blob-content-language"] = []string{*blobHTTPHeaders.BlobContentLanguage}
|
||||
}
|
||||
if blobHTTPHeaders != nil && blobHTTPHeaders.BlobContentMD5 != nil {
|
||||
req.Raw().Header["x-ms-blob-content-md5"] = []string{base64.StdEncoding.EncodeToString(blobHTTPHeaders.BlobContentMD5)}
|
||||
}
|
||||
if options != nil && options.TransactionalContentMD5 != nil {
|
||||
req.Raw().Header["Content-MD5"] = []string{base64.StdEncoding.EncodeToString(options.TransactionalContentMD5)}
|
||||
}
|
||||
if options != nil && options.TransactionalContentCRC64 != nil {
|
||||
req.Raw().Header["x-ms-content-crc64"] = []string{base64.StdEncoding.EncodeToString(options.TransactionalContentCRC64)}
|
||||
}
|
||||
if options != nil && options.Metadata != nil {
|
||||
for k, v := range options.Metadata {
|
||||
if v != nil {
|
||||
req.Raw().Header["x-ms-meta-"+k] = []string{*v}
|
||||
}
|
||||
}
|
||||
}
|
||||
if leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil {
|
||||
req.Raw().Header["x-ms-lease-id"] = []string{*leaseAccessConditions.LeaseID}
|
||||
}
|
||||
if blobHTTPHeaders != nil && blobHTTPHeaders.BlobContentDisposition != nil {
|
||||
req.Raw().Header["x-ms-blob-content-disposition"] = []string{*blobHTTPHeaders.BlobContentDisposition}
|
||||
}
|
||||
if cpkInfo != nil && cpkInfo.EncryptionKey != nil {
|
||||
req.Raw().Header["x-ms-encryption-key"] = []string{*cpkInfo.EncryptionKey}
|
||||
}
|
||||
if cpkInfo != nil && cpkInfo.EncryptionKeySHA256 != nil {
|
||||
req.Raw().Header["x-ms-encryption-key-sha256"] = []string{*cpkInfo.EncryptionKeySHA256}
|
||||
}
|
||||
if cpkInfo != nil && cpkInfo.EncryptionAlgorithm != nil {
|
||||
req.Raw().Header["x-ms-encryption-algorithm"] = []string{string(*cpkInfo.EncryptionAlgorithm)}
|
||||
}
|
||||
if cpkScopeInfo != nil && cpkScopeInfo.EncryptionScope != nil {
|
||||
req.Raw().Header["x-ms-encryption-scope"] = []string{*cpkScopeInfo.EncryptionScope}
|
||||
}
|
||||
if options != nil && options.Tier != nil {
|
||||
req.Raw().Header["x-ms-access-tier"] = []string{string(*options.Tier)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfModifiedSince != nil {
|
||||
req.Raw().Header["If-Modified-Since"] = []string{(*modifiedAccessConditions.IfModifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfUnmodifiedSince != nil {
|
||||
req.Raw().Header["If-Unmodified-Since"] = []string{(*modifiedAccessConditions.IfUnmodifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfMatch != nil {
|
||||
req.Raw().Header["If-Match"] = []string{string(*modifiedAccessConditions.IfMatch)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfNoneMatch != nil {
|
||||
req.Raw().Header["If-None-Match"] = []string{string(*modifiedAccessConditions.IfNoneMatch)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfTags != nil {
|
||||
req.Raw().Header["x-ms-if-tags"] = []string{*modifiedAccessConditions.IfTags}
|
||||
}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
if options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
if options != nil && options.BlobTagsString != nil {
|
||||
req.Raw().Header["x-ms-tags"] = []string{*options.BlobTagsString}
|
||||
}
|
||||
if options != nil && options.ImmutabilityPolicyExpiry != nil {
|
||||
req.Raw().Header["x-ms-immutability-policy-until-date"] = []string{(*options.ImmutabilityPolicyExpiry).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if options != nil && options.ImmutabilityPolicyMode != nil {
|
||||
req.Raw().Header["x-ms-immutability-policy-mode"] = []string{string(*options.ImmutabilityPolicyMode)}
|
||||
}
|
||||
if options != nil && options.LegalHold != nil {
|
||||
req.Raw().Header["x-ms-legal-hold"] = []string{strconv.FormatBool(*options.LegalHold)}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
if err := runtime.MarshalAsXML(req, blocks); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// commitBlockListHandleResponse handles the CommitBlockList response.
|
||||
func (client *BlockBlobClient) commitBlockListHandleResponse(resp *http.Response) (BlockBlobClientCommitBlockListResponse, error) {
|
||||
result := BlockBlobClientCommitBlockListResponse{}
|
||||
if val := resp.Header.Get("x-ms-client-request-id"); val != "" {
|
||||
result.ClientRequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-content-crc64"); val != "" {
|
||||
contentCRC64, err := base64.StdEncoding.DecodeString(val)
|
||||
if err != nil {
|
||||
return BlockBlobClientCommitBlockListResponse{}, err
|
||||
}
|
||||
result.ContentCRC64 = contentCRC64
|
||||
}
|
||||
if val := resp.Header.Get("Content-MD5"); val != "" {
|
||||
contentMD5, err := base64.StdEncoding.DecodeString(val)
|
||||
if err != nil {
|
||||
return BlockBlobClientCommitBlockListResponse{}, err
|
||||
}
|
||||
result.ContentMD5 = contentMD5
|
||||
}
|
||||
if val := resp.Header.Get("Date"); val != "" {
|
||||
date, err := time.Parse(time.RFC1123, val)
|
||||
if err != nil {
|
||||
return BlockBlobClientCommitBlockListResponse{}, err
|
||||
}
|
||||
result.Date = &date
|
||||
}
|
||||
if val := resp.Header.Get("ETag"); val != "" {
|
||||
result.ETag = (*azcore.ETag)(&val)
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-encryption-key-sha256"); val != "" {
|
||||
result.EncryptionKeySHA256 = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-encryption-scope"); val != "" {
|
||||
result.EncryptionScope = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-server-encrypted"); val != "" {
|
||||
isServerEncrypted, err := strconv.ParseBool(val)
|
||||
if err != nil {
|
||||
return BlockBlobClientCommitBlockListResponse{}, err
|
||||
}
|
||||
result.IsServerEncrypted = &isServerEncrypted
|
||||
}
|
||||
if val := resp.Header.Get("Last-Modified"); val != "" {
|
||||
lastModified, err := time.Parse(time.RFC1123, val)
|
||||
if err != nil {
|
||||
return BlockBlobClientCommitBlockListResponse{}, err
|
||||
}
|
||||
result.LastModified = &lastModified
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.RequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-version"); val != "" {
|
||||
result.Version = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-version-id"); val != "" {
|
||||
result.VersionID = &val
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// GetBlockList - The Get Block List operation retrieves the list of blocks that have been uploaded as part of a block blob
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-11-03
|
||||
// - listType - Specifies whether to return the list of committed blocks, the list of uncommitted blocks, or both lists together.
|
||||
// - options - BlockBlobClientGetBlockListOptions contains the optional parameters for the BlockBlobClient.GetBlockList method.
|
||||
// - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ContainerClient.GetProperties method.
|
||||
// - ModifiedAccessConditions - ModifiedAccessConditions contains a group of parameters for the ContainerClient.Delete method.
|
||||
func (client *BlockBlobClient) GetBlockList(ctx context.Context, listType BlockListType, options *BlockBlobClientGetBlockListOptions, leaseAccessConditions *LeaseAccessConditions, modifiedAccessConditions *ModifiedAccessConditions) (BlockBlobClientGetBlockListResponse, error) {
|
||||
var err error
|
||||
req, err := client.getBlockListCreateRequest(ctx, listType, options, leaseAccessConditions, modifiedAccessConditions)
|
||||
if err != nil {
|
||||
return BlockBlobClientGetBlockListResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return BlockBlobClientGetBlockListResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return BlockBlobClientGetBlockListResponse{}, err
|
||||
}
|
||||
resp, err := client.getBlockListHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// getBlockListCreateRequest creates the GetBlockList request.
|
||||
func (client *BlockBlobClient) getBlockListCreateRequest(ctx context.Context, listType BlockListType, options *BlockBlobClientGetBlockListOptions, leaseAccessConditions *LeaseAccessConditions, modifiedAccessConditions *ModifiedAccessConditions) (*policy.Request, error) {
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, client.endpoint)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("comp", "blocklist")
|
||||
if options != nil && options.Snapshot != nil {
|
||||
reqQP.Set("snapshot", *options.Snapshot)
|
||||
}
|
||||
reqQP.Set("blocklisttype", string(listType))
|
||||
if options != nil && options.Timeout != nil {
|
||||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
if leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil {
|
||||
req.Raw().Header["x-ms-lease-id"] = []string{*leaseAccessConditions.LeaseID}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfTags != nil {
|
||||
req.Raw().Header["x-ms-if-tags"] = []string{*modifiedAccessConditions.IfTags}
|
||||
}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
if options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// getBlockListHandleResponse handles the GetBlockList response.
|
||||
func (client *BlockBlobClient) getBlockListHandleResponse(resp *http.Response) (BlockBlobClientGetBlockListResponse, error) {
|
||||
result := BlockBlobClientGetBlockListResponse{}
|
||||
if val := resp.Header.Get("x-ms-blob-content-length"); val != "" {
|
||||
blobContentLength, err := strconv.ParseInt(val, 10, 64)
|
||||
if err != nil {
|
||||
return BlockBlobClientGetBlockListResponse{}, err
|
||||
}
|
||||
result.BlobContentLength = &blobContentLength
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-client-request-id"); val != "" {
|
||||
result.ClientRequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("Content-Type"); val != "" {
|
||||
result.ContentType = &val
|
||||
}
|
||||
if val := resp.Header.Get("Date"); val != "" {
|
||||
date, err := time.Parse(time.RFC1123, val)
|
||||
if err != nil {
|
||||
return BlockBlobClientGetBlockListResponse{}, err
|
||||
}
|
||||
result.Date = &date
|
||||
}
|
||||
if val := resp.Header.Get("ETag"); val != "" {
|
||||
result.ETag = (*azcore.ETag)(&val)
|
||||
}
|
||||
if val := resp.Header.Get("Last-Modified"); val != "" {
|
||||
lastModified, err := time.Parse(time.RFC1123, val)
|
||||
if err != nil {
|
||||
return BlockBlobClientGetBlockListResponse{}, err
|
||||
}
|
||||
result.LastModified = &lastModified
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.RequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-version"); val != "" {
|
||||
result.Version = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsXML(resp, &result.BlockList); err != nil {
|
||||
return BlockBlobClientGetBlockListResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// PutBlobFromURL - The Put Blob from URL operation creates a new Block Blob where the contents of the blob are read from
|
||||
// a given URL. This API is supported beginning with the 2020-04-08 version. Partial updates are not
|
||||
// supported with Put Blob from URL; the content of an existing blob is overwritten with the content of the new blob. To perform
|
||||
// partial updates to a block blob’s contents using a source URL, use the Put
|
||||
// Block from URL API in conjunction with Put Block List.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-11-03
|
||||
// - contentLength - The length of the request.
|
||||
// - copySource - Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in length that specifies
|
||||
// a page blob snapshot. The value should be URL-encoded as it would appear in a request
|
||||
// URI. The source blob must either be public or must be authenticated via a shared access signature.
|
||||
// - options - BlockBlobClientPutBlobFromURLOptions contains the optional parameters for the BlockBlobClient.PutBlobFromURL
|
||||
// method.
|
||||
// - BlobHTTPHeaders - BlobHTTPHeaders contains a group of parameters for the BlobClient.SetHTTPHeaders method.
|
||||
// - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ContainerClient.GetProperties method.
|
||||
// - CPKInfo - CPKInfo contains a group of parameters for the BlobClient.Download method.
|
||||
// - CPKScopeInfo - CPKScopeInfo contains a group of parameters for the BlobClient.SetMetadata method.
|
||||
// - ModifiedAccessConditions - ModifiedAccessConditions contains a group of parameters for the ContainerClient.Delete method.
|
||||
// - SourceModifiedAccessConditions - SourceModifiedAccessConditions contains a group of parameters for the BlobClient.StartCopyFromURL
|
||||
// method.
|
||||
func (client *BlockBlobClient) PutBlobFromURL(ctx context.Context, contentLength int64, copySource string, options *BlockBlobClientPutBlobFromURLOptions, blobHTTPHeaders *BlobHTTPHeaders, leaseAccessConditions *LeaseAccessConditions, cpkInfo *CPKInfo, cpkScopeInfo *CPKScopeInfo, modifiedAccessConditions *ModifiedAccessConditions, sourceModifiedAccessConditions *SourceModifiedAccessConditions) (BlockBlobClientPutBlobFromURLResponse, error) {
|
||||
var err error
|
||||
req, err := client.putBlobFromURLCreateRequest(ctx, contentLength, copySource, options, blobHTTPHeaders, leaseAccessConditions, cpkInfo, cpkScopeInfo, modifiedAccessConditions, sourceModifiedAccessConditions)
|
||||
if err != nil {
|
||||
return BlockBlobClientPutBlobFromURLResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return BlockBlobClientPutBlobFromURLResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusCreated) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return BlockBlobClientPutBlobFromURLResponse{}, err
|
||||
}
|
||||
resp, err := client.putBlobFromURLHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// putBlobFromURLCreateRequest creates the PutBlobFromURL request.
|
||||
func (client *BlockBlobClient) putBlobFromURLCreateRequest(ctx context.Context, contentLength int64, copySource string, options *BlockBlobClientPutBlobFromURLOptions, blobHTTPHeaders *BlobHTTPHeaders, leaseAccessConditions *LeaseAccessConditions, cpkInfo *CPKInfo, cpkScopeInfo *CPKScopeInfo, modifiedAccessConditions *ModifiedAccessConditions, sourceModifiedAccessConditions *SourceModifiedAccessConditions) (*policy.Request, error) {
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPut, client.endpoint)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
if options != nil && options.Timeout != nil {
|
||||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["x-ms-blob-type"] = []string{"BlockBlob"}
|
||||
if options != nil && options.TransactionalContentMD5 != nil {
|
||||
req.Raw().Header["Content-MD5"] = []string{base64.StdEncoding.EncodeToString(options.TransactionalContentMD5)}
|
||||
}
|
||||
req.Raw().Header["Content-Length"] = []string{strconv.FormatInt(contentLength, 10)}
|
||||
if blobHTTPHeaders != nil && blobHTTPHeaders.BlobContentType != nil {
|
||||
req.Raw().Header["x-ms-blob-content-type"] = []string{*blobHTTPHeaders.BlobContentType}
|
||||
}
|
||||
if blobHTTPHeaders != nil && blobHTTPHeaders.BlobContentEncoding != nil {
|
||||
req.Raw().Header["x-ms-blob-content-encoding"] = []string{*blobHTTPHeaders.BlobContentEncoding}
|
||||
}
|
||||
if blobHTTPHeaders != nil && blobHTTPHeaders.BlobContentLanguage != nil {
|
||||
req.Raw().Header["x-ms-blob-content-language"] = []string{*blobHTTPHeaders.BlobContentLanguage}
|
||||
}
|
||||
if blobHTTPHeaders != nil && blobHTTPHeaders.BlobContentMD5 != nil {
|
||||
req.Raw().Header["x-ms-blob-content-md5"] = []string{base64.StdEncoding.EncodeToString(blobHTTPHeaders.BlobContentMD5)}
|
||||
}
|
||||
if blobHTTPHeaders != nil && blobHTTPHeaders.BlobCacheControl != nil {
|
||||
req.Raw().Header["x-ms-blob-cache-control"] = []string{*blobHTTPHeaders.BlobCacheControl}
|
||||
}
|
||||
if options != nil && options.Metadata != nil {
|
||||
for k, v := range options.Metadata {
|
||||
if v != nil {
|
||||
req.Raw().Header["x-ms-meta-"+k] = []string{*v}
|
||||
}
|
||||
}
|
||||
}
|
||||
if leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil {
|
||||
req.Raw().Header["x-ms-lease-id"] = []string{*leaseAccessConditions.LeaseID}
|
||||
}
|
||||
if blobHTTPHeaders != nil && blobHTTPHeaders.BlobContentDisposition != nil {
|
||||
req.Raw().Header["x-ms-blob-content-disposition"] = []string{*blobHTTPHeaders.BlobContentDisposition}
|
||||
}
|
||||
if cpkInfo != nil && cpkInfo.EncryptionKey != nil {
|
||||
req.Raw().Header["x-ms-encryption-key"] = []string{*cpkInfo.EncryptionKey}
|
||||
}
|
||||
if cpkInfo != nil && cpkInfo.EncryptionKeySHA256 != nil {
|
||||
req.Raw().Header["x-ms-encryption-key-sha256"] = []string{*cpkInfo.EncryptionKeySHA256}
|
||||
}
|
||||
if cpkInfo != nil && cpkInfo.EncryptionAlgorithm != nil {
|
||||
req.Raw().Header["x-ms-encryption-algorithm"] = []string{string(*cpkInfo.EncryptionAlgorithm)}
|
||||
}
|
||||
if cpkScopeInfo != nil && cpkScopeInfo.EncryptionScope != nil {
|
||||
req.Raw().Header["x-ms-encryption-scope"] = []string{*cpkScopeInfo.EncryptionScope}
|
||||
}
|
||||
if options != nil && options.Tier != nil {
|
||||
req.Raw().Header["x-ms-access-tier"] = []string{string(*options.Tier)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfModifiedSince != nil {
|
||||
req.Raw().Header["If-Modified-Since"] = []string{(*modifiedAccessConditions.IfModifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfUnmodifiedSince != nil {
|
||||
req.Raw().Header["If-Unmodified-Since"] = []string{(*modifiedAccessConditions.IfUnmodifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfMatch != nil {
|
||||
req.Raw().Header["If-Match"] = []string{string(*modifiedAccessConditions.IfMatch)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfNoneMatch != nil {
|
||||
req.Raw().Header["If-None-Match"] = []string{string(*modifiedAccessConditions.IfNoneMatch)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfTags != nil {
|
||||
req.Raw().Header["x-ms-if-tags"] = []string{*modifiedAccessConditions.IfTags}
|
||||
}
|
||||
if sourceModifiedAccessConditions != nil && sourceModifiedAccessConditions.SourceIfModifiedSince != nil {
|
||||
req.Raw().Header["x-ms-source-if-modified-since"] = []string{(*sourceModifiedAccessConditions.SourceIfModifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if sourceModifiedAccessConditions != nil && sourceModifiedAccessConditions.SourceIfUnmodifiedSince != nil {
|
||||
req.Raw().Header["x-ms-source-if-unmodified-since"] = []string{(*sourceModifiedAccessConditions.SourceIfUnmodifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if sourceModifiedAccessConditions != nil && sourceModifiedAccessConditions.SourceIfMatch != nil {
|
||||
req.Raw().Header["x-ms-source-if-match"] = []string{string(*sourceModifiedAccessConditions.SourceIfMatch)}
|
||||
}
|
||||
if sourceModifiedAccessConditions != nil && sourceModifiedAccessConditions.SourceIfNoneMatch != nil {
|
||||
req.Raw().Header["x-ms-source-if-none-match"] = []string{string(*sourceModifiedAccessConditions.SourceIfNoneMatch)}
|
||||
}
|
||||
if sourceModifiedAccessConditions != nil && sourceModifiedAccessConditions.SourceIfTags != nil {
|
||||
req.Raw().Header["x-ms-source-if-tags"] = []string{*sourceModifiedAccessConditions.SourceIfTags}
|
||||
}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
if options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
if options != nil && options.SourceContentMD5 != nil {
|
||||
req.Raw().Header["x-ms-source-content-md5"] = []string{base64.StdEncoding.EncodeToString(options.SourceContentMD5)}
|
||||
}
|
||||
if options != nil && options.BlobTagsString != nil {
|
||||
req.Raw().Header["x-ms-tags"] = []string{*options.BlobTagsString}
|
||||
}
|
||||
req.Raw().Header["x-ms-copy-source"] = []string{copySource}
|
||||
if options != nil && options.CopySourceBlobProperties != nil {
|
||||
req.Raw().Header["x-ms-copy-source-blob-properties"] = []string{strconv.FormatBool(*options.CopySourceBlobProperties)}
|
||||
}
|
||||
if options != nil && options.CopySourceAuthorization != nil {
|
||||
req.Raw().Header["x-ms-copy-source-authorization"] = []string{*options.CopySourceAuthorization}
|
||||
}
|
||||
if options != nil && options.CopySourceTags != nil {
|
||||
req.Raw().Header["x-ms-copy-source-tag-option"] = []string{string(*options.CopySourceTags)}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// putBlobFromURLHandleResponse handles the PutBlobFromURL response.
|
||||
func (client *BlockBlobClient) putBlobFromURLHandleResponse(resp *http.Response) (BlockBlobClientPutBlobFromURLResponse, error) {
|
||||
result := BlockBlobClientPutBlobFromURLResponse{}
|
||||
if val := resp.Header.Get("x-ms-client-request-id"); val != "" {
|
||||
result.ClientRequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("Content-MD5"); val != "" {
|
||||
contentMD5, err := base64.StdEncoding.DecodeString(val)
|
||||
if err != nil {
|
||||
return BlockBlobClientPutBlobFromURLResponse{}, err
|
||||
}
|
||||
result.ContentMD5 = contentMD5
|
||||
}
|
||||
if val := resp.Header.Get("Date"); val != "" {
|
||||
date, err := time.Parse(time.RFC1123, val)
|
||||
if err != nil {
|
||||
return BlockBlobClientPutBlobFromURLResponse{}, err
|
||||
}
|
||||
result.Date = &date
|
||||
}
|
||||
if val := resp.Header.Get("ETag"); val != "" {
|
||||
result.ETag = (*azcore.ETag)(&val)
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-encryption-key-sha256"); val != "" {
|
||||
result.EncryptionKeySHA256 = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-encryption-scope"); val != "" {
|
||||
result.EncryptionScope = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-server-encrypted"); val != "" {
|
||||
isServerEncrypted, err := strconv.ParseBool(val)
|
||||
if err != nil {
|
||||
return BlockBlobClientPutBlobFromURLResponse{}, err
|
||||
}
|
||||
result.IsServerEncrypted = &isServerEncrypted
|
||||
}
|
||||
if val := resp.Header.Get("Last-Modified"); val != "" {
|
||||
lastModified, err := time.Parse(time.RFC1123, val)
|
||||
if err != nil {
|
||||
return BlockBlobClientPutBlobFromURLResponse{}, err
|
||||
}
|
||||
result.LastModified = &lastModified
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.RequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-version"); val != "" {
|
||||
result.Version = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-version-id"); val != "" {
|
||||
result.VersionID = &val
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// StageBlock - The Stage Block operation creates a new block to be committed as part of a blob
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-11-03
|
||||
// - blockID - A valid Base64 string value that identifies the block. Prior to encoding, the string must be less than or equal
|
||||
// to 64 bytes in size. For a given blob, the length of the value specified for the blockid
|
||||
// parameter must be the same size for each block.
|
||||
// - contentLength - The length of the request.
|
||||
// - body - Initial data
|
||||
// - options - BlockBlobClientStageBlockOptions contains the optional parameters for the BlockBlobClient.StageBlock method.
|
||||
// - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ContainerClient.GetProperties method.
|
||||
// - CPKInfo - CPKInfo contains a group of parameters for the BlobClient.Download method.
|
||||
// - CPKScopeInfo - CPKScopeInfo contains a group of parameters for the BlobClient.SetMetadata method.
|
||||
func (client *BlockBlobClient) StageBlock(ctx context.Context, blockID string, contentLength int64, body io.ReadSeekCloser, options *BlockBlobClientStageBlockOptions, leaseAccessConditions *LeaseAccessConditions, cpkInfo *CPKInfo, cpkScopeInfo *CPKScopeInfo) (BlockBlobClientStageBlockResponse, error) {
|
||||
var err error
|
||||
req, err := client.stageBlockCreateRequest(ctx, blockID, contentLength, body, options, leaseAccessConditions, cpkInfo, cpkScopeInfo)
|
||||
if err != nil {
|
||||
return BlockBlobClientStageBlockResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return BlockBlobClientStageBlockResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusCreated) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return BlockBlobClientStageBlockResponse{}, err
|
||||
}
|
||||
resp, err := client.stageBlockHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// stageBlockCreateRequest creates the StageBlock request.
|
||||
func (client *BlockBlobClient) stageBlockCreateRequest(ctx context.Context, blockID string, contentLength int64, body io.ReadSeekCloser, options *BlockBlobClientStageBlockOptions, leaseAccessConditions *LeaseAccessConditions, cpkInfo *CPKInfo, cpkScopeInfo *CPKScopeInfo) (*policy.Request, error) {
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPut, client.endpoint)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("comp", "block")
|
||||
reqQP.Set("blockid", blockID)
|
||||
if options != nil && options.Timeout != nil {
|
||||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Content-Length"] = []string{strconv.FormatInt(contentLength, 10)}
|
||||
if options != nil && options.TransactionalContentMD5 != nil {
|
||||
req.Raw().Header["Content-MD5"] = []string{base64.StdEncoding.EncodeToString(options.TransactionalContentMD5)}
|
||||
}
|
||||
if options != nil && options.TransactionalContentCRC64 != nil {
|
||||
req.Raw().Header["x-ms-content-crc64"] = []string{base64.StdEncoding.EncodeToString(options.TransactionalContentCRC64)}
|
||||
}
|
||||
if leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil {
|
||||
req.Raw().Header["x-ms-lease-id"] = []string{*leaseAccessConditions.LeaseID}
|
||||
}
|
||||
if cpkInfo != nil && cpkInfo.EncryptionKey != nil {
|
||||
req.Raw().Header["x-ms-encryption-key"] = []string{*cpkInfo.EncryptionKey}
|
||||
}
|
||||
if cpkInfo != nil && cpkInfo.EncryptionKeySHA256 != nil {
|
||||
req.Raw().Header["x-ms-encryption-key-sha256"] = []string{*cpkInfo.EncryptionKeySHA256}
|
||||
}
|
||||
if cpkInfo != nil && cpkInfo.EncryptionAlgorithm != nil {
|
||||
req.Raw().Header["x-ms-encryption-algorithm"] = []string{string(*cpkInfo.EncryptionAlgorithm)}
|
||||
}
|
||||
if cpkScopeInfo != nil && cpkScopeInfo.EncryptionScope != nil {
|
||||
req.Raw().Header["x-ms-encryption-scope"] = []string{*cpkScopeInfo.EncryptionScope}
|
||||
}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
if options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
if err := req.SetBody(body, "application/octet-stream"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// stageBlockHandleResponse handles the StageBlock response.
|
||||
func (client *BlockBlobClient) stageBlockHandleResponse(resp *http.Response) (BlockBlobClientStageBlockResponse, error) {
|
||||
result := BlockBlobClientStageBlockResponse{}
|
||||
if val := resp.Header.Get("x-ms-client-request-id"); val != "" {
|
||||
result.ClientRequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-content-crc64"); val != "" {
|
||||
contentCRC64, err := base64.StdEncoding.DecodeString(val)
|
||||
if err != nil {
|
||||
return BlockBlobClientStageBlockResponse{}, err
|
||||
}
|
||||
result.ContentCRC64 = contentCRC64
|
||||
}
|
||||
if val := resp.Header.Get("Content-MD5"); val != "" {
|
||||
contentMD5, err := base64.StdEncoding.DecodeString(val)
|
||||
if err != nil {
|
||||
return BlockBlobClientStageBlockResponse{}, err
|
||||
}
|
||||
result.ContentMD5 = contentMD5
|
||||
}
|
||||
if val := resp.Header.Get("Date"); val != "" {
|
||||
date, err := time.Parse(time.RFC1123, val)
|
||||
if err != nil {
|
||||
return BlockBlobClientStageBlockResponse{}, err
|
||||
}
|
||||
result.Date = &date
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-encryption-key-sha256"); val != "" {
|
||||
result.EncryptionKeySHA256 = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-encryption-scope"); val != "" {
|
||||
result.EncryptionScope = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-server-encrypted"); val != "" {
|
||||
isServerEncrypted, err := strconv.ParseBool(val)
|
||||
if err != nil {
|
||||
return BlockBlobClientStageBlockResponse{}, err
|
||||
}
|
||||
result.IsServerEncrypted = &isServerEncrypted
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.RequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-version"); val != "" {
|
||||
result.Version = &val
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// StageBlockFromURL - The Stage Block operation creates a new block to be committed as part of a blob where the contents
|
||||
// are read from a URL.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-11-03
|
||||
// - blockID - A valid Base64 string value that identifies the block. Prior to encoding, the string must be less than or equal
|
||||
// to 64 bytes in size. For a given blob, the length of the value specified for the blockid
|
||||
// parameter must be the same size for each block.
|
||||
// - contentLength - The length of the request.
|
||||
// - sourceURL - Specify a URL to the copy source.
|
||||
// - options - BlockBlobClientStageBlockFromURLOptions contains the optional parameters for the BlockBlobClient.StageBlockFromURL
|
||||
// method.
|
||||
// - CPKInfo - CPKInfo contains a group of parameters for the BlobClient.Download method.
|
||||
// - CPKScopeInfo - CPKScopeInfo contains a group of parameters for the BlobClient.SetMetadata method.
|
||||
// - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ContainerClient.GetProperties method.
|
||||
// - SourceModifiedAccessConditions - SourceModifiedAccessConditions contains a group of parameters for the BlobClient.StartCopyFromURL
|
||||
// method.
|
||||
func (client *BlockBlobClient) StageBlockFromURL(ctx context.Context, blockID string, contentLength int64, sourceURL string, options *BlockBlobClientStageBlockFromURLOptions, cpkInfo *CPKInfo, cpkScopeInfo *CPKScopeInfo, leaseAccessConditions *LeaseAccessConditions, sourceModifiedAccessConditions *SourceModifiedAccessConditions) (BlockBlobClientStageBlockFromURLResponse, error) {
|
||||
var err error
|
||||
req, err := client.stageBlockFromURLCreateRequest(ctx, blockID, contentLength, sourceURL, options, cpkInfo, cpkScopeInfo, leaseAccessConditions, sourceModifiedAccessConditions)
|
||||
if err != nil {
|
||||
return BlockBlobClientStageBlockFromURLResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return BlockBlobClientStageBlockFromURLResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusCreated) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return BlockBlobClientStageBlockFromURLResponse{}, err
|
||||
}
|
||||
resp, err := client.stageBlockFromURLHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// stageBlockFromURLCreateRequest creates the StageBlockFromURL request.
|
||||
func (client *BlockBlobClient) stageBlockFromURLCreateRequest(ctx context.Context, blockID string, contentLength int64, sourceURL string, options *BlockBlobClientStageBlockFromURLOptions, cpkInfo *CPKInfo, cpkScopeInfo *CPKScopeInfo, leaseAccessConditions *LeaseAccessConditions, sourceModifiedAccessConditions *SourceModifiedAccessConditions) (*policy.Request, error) {
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPut, client.endpoint)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("comp", "block")
|
||||
reqQP.Set("blockid", blockID)
|
||||
if options != nil && options.Timeout != nil {
|
||||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Content-Length"] = []string{strconv.FormatInt(contentLength, 10)}
|
||||
req.Raw().Header["x-ms-copy-source"] = []string{sourceURL}
|
||||
if options != nil && options.SourceRange != nil {
|
||||
req.Raw().Header["x-ms-source-range"] = []string{*options.SourceRange}
|
||||
}
|
||||
if options != nil && options.SourceContentMD5 != nil {
|
||||
req.Raw().Header["x-ms-source-content-md5"] = []string{base64.StdEncoding.EncodeToString(options.SourceContentMD5)}
|
||||
}
|
||||
if options != nil && options.SourceContentcrc64 != nil {
|
||||
req.Raw().Header["x-ms-source-content-crc64"] = []string{base64.StdEncoding.EncodeToString(options.SourceContentcrc64)}
|
||||
}
|
||||
if cpkInfo != nil && cpkInfo.EncryptionKey != nil {
|
||||
req.Raw().Header["x-ms-encryption-key"] = []string{*cpkInfo.EncryptionKey}
|
||||
}
|
||||
if cpkInfo != nil && cpkInfo.EncryptionKeySHA256 != nil {
|
||||
req.Raw().Header["x-ms-encryption-key-sha256"] = []string{*cpkInfo.EncryptionKeySHA256}
|
||||
}
|
||||
if cpkInfo != nil && cpkInfo.EncryptionAlgorithm != nil {
|
||||
req.Raw().Header["x-ms-encryption-algorithm"] = []string{string(*cpkInfo.EncryptionAlgorithm)}
|
||||
}
|
||||
if cpkScopeInfo != nil && cpkScopeInfo.EncryptionScope != nil {
|
||||
req.Raw().Header["x-ms-encryption-scope"] = []string{*cpkScopeInfo.EncryptionScope}
|
||||
}
|
||||
if leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil {
|
||||
req.Raw().Header["x-ms-lease-id"] = []string{*leaseAccessConditions.LeaseID}
|
||||
}
|
||||
if sourceModifiedAccessConditions != nil && sourceModifiedAccessConditions.SourceIfModifiedSince != nil {
|
||||
req.Raw().Header["x-ms-source-if-modified-since"] = []string{(*sourceModifiedAccessConditions.SourceIfModifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if sourceModifiedAccessConditions != nil && sourceModifiedAccessConditions.SourceIfUnmodifiedSince != nil {
|
||||
req.Raw().Header["x-ms-source-if-unmodified-since"] = []string{(*sourceModifiedAccessConditions.SourceIfUnmodifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if sourceModifiedAccessConditions != nil && sourceModifiedAccessConditions.SourceIfMatch != nil {
|
||||
req.Raw().Header["x-ms-source-if-match"] = []string{string(*sourceModifiedAccessConditions.SourceIfMatch)}
|
||||
}
|
||||
if sourceModifiedAccessConditions != nil && sourceModifiedAccessConditions.SourceIfNoneMatch != nil {
|
||||
req.Raw().Header["x-ms-source-if-none-match"] = []string{string(*sourceModifiedAccessConditions.SourceIfNoneMatch)}
|
||||
}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
if options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
if options != nil && options.CopySourceAuthorization != nil {
|
||||
req.Raw().Header["x-ms-copy-source-authorization"] = []string{*options.CopySourceAuthorization}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// stageBlockFromURLHandleResponse handles the StageBlockFromURL response.
|
||||
func (client *BlockBlobClient) stageBlockFromURLHandleResponse(resp *http.Response) (BlockBlobClientStageBlockFromURLResponse, error) {
|
||||
result := BlockBlobClientStageBlockFromURLResponse{}
|
||||
if val := resp.Header.Get("x-ms-client-request-id"); val != "" {
|
||||
result.ClientRequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-content-crc64"); val != "" {
|
||||
contentCRC64, err := base64.StdEncoding.DecodeString(val)
|
||||
if err != nil {
|
||||
return BlockBlobClientStageBlockFromURLResponse{}, err
|
||||
}
|
||||
result.ContentCRC64 = contentCRC64
|
||||
}
|
||||
if val := resp.Header.Get("Content-MD5"); val != "" {
|
||||
contentMD5, err := base64.StdEncoding.DecodeString(val)
|
||||
if err != nil {
|
||||
return BlockBlobClientStageBlockFromURLResponse{}, err
|
||||
}
|
||||
result.ContentMD5 = contentMD5
|
||||
}
|
||||
if val := resp.Header.Get("Date"); val != "" {
|
||||
date, err := time.Parse(time.RFC1123, val)
|
||||
if err != nil {
|
||||
return BlockBlobClientStageBlockFromURLResponse{}, err
|
||||
}
|
||||
result.Date = &date
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-encryption-key-sha256"); val != "" {
|
||||
result.EncryptionKeySHA256 = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-encryption-scope"); val != "" {
|
||||
result.EncryptionScope = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-server-encrypted"); val != "" {
|
||||
isServerEncrypted, err := strconv.ParseBool(val)
|
||||
if err != nil {
|
||||
return BlockBlobClientStageBlockFromURLResponse{}, err
|
||||
}
|
||||
result.IsServerEncrypted = &isServerEncrypted
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.RequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-version"); val != "" {
|
||||
result.Version = &val
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Upload - The Upload Block Blob operation updates the content of an existing block blob. Updating an existing block blob
|
||||
// overwrites any existing metadata on the blob. Partial updates are not supported with Put
|
||||
// Blob; the content of the existing blob is overwritten with the content of the new blob. To perform a partial update of
|
||||
// the content of a block blob, use the Put Block List operation.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-11-03
|
||||
// - contentLength - The length of the request.
|
||||
// - body - Initial data
|
||||
// - options - BlockBlobClientUploadOptions contains the optional parameters for the BlockBlobClient.Upload method.
|
||||
// - BlobHTTPHeaders - BlobHTTPHeaders contains a group of parameters for the BlobClient.SetHTTPHeaders method.
|
||||
// - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ContainerClient.GetProperties method.
|
||||
// - CPKInfo - CPKInfo contains a group of parameters for the BlobClient.Download method.
|
||||
// - CPKScopeInfo - CPKScopeInfo contains a group of parameters for the BlobClient.SetMetadata method.
|
||||
// - ModifiedAccessConditions - ModifiedAccessConditions contains a group of parameters for the ContainerClient.Delete method.
|
||||
func (client *BlockBlobClient) Upload(ctx context.Context, contentLength int64, body io.ReadSeekCloser, options *BlockBlobClientUploadOptions, blobHTTPHeaders *BlobHTTPHeaders, leaseAccessConditions *LeaseAccessConditions, cpkInfo *CPKInfo, cpkScopeInfo *CPKScopeInfo, modifiedAccessConditions *ModifiedAccessConditions) (BlockBlobClientUploadResponse, error) {
|
||||
var err error
|
||||
req, err := client.uploadCreateRequest(ctx, contentLength, body, options, blobHTTPHeaders, leaseAccessConditions, cpkInfo, cpkScopeInfo, modifiedAccessConditions)
|
||||
if err != nil {
|
||||
return BlockBlobClientUploadResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return BlockBlobClientUploadResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusCreated) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return BlockBlobClientUploadResponse{}, err
|
||||
}
|
||||
resp, err := client.uploadHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// uploadCreateRequest creates the Upload request.
|
||||
func (client *BlockBlobClient) uploadCreateRequest(ctx context.Context, contentLength int64, body io.ReadSeekCloser, options *BlockBlobClientUploadOptions, blobHTTPHeaders *BlobHTTPHeaders, leaseAccessConditions *LeaseAccessConditions, cpkInfo *CPKInfo, cpkScopeInfo *CPKScopeInfo, modifiedAccessConditions *ModifiedAccessConditions) (*policy.Request, error) {
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPut, client.endpoint)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
if options != nil && options.Timeout != nil {
|
||||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["x-ms-blob-type"] = []string{"BlockBlob"}
|
||||
if options != nil && options.TransactionalContentMD5 != nil {
|
||||
req.Raw().Header["Content-MD5"] = []string{base64.StdEncoding.EncodeToString(options.TransactionalContentMD5)}
|
||||
}
|
||||
req.Raw().Header["Content-Length"] = []string{strconv.FormatInt(contentLength, 10)}
|
||||
if blobHTTPHeaders != nil && blobHTTPHeaders.BlobContentType != nil {
|
||||
req.Raw().Header["x-ms-blob-content-type"] = []string{*blobHTTPHeaders.BlobContentType}
|
||||
}
|
||||
if blobHTTPHeaders != nil && blobHTTPHeaders.BlobContentEncoding != nil {
|
||||
req.Raw().Header["x-ms-blob-content-encoding"] = []string{*blobHTTPHeaders.BlobContentEncoding}
|
||||
}
|
||||
if blobHTTPHeaders != nil && blobHTTPHeaders.BlobContentLanguage != nil {
|
||||
req.Raw().Header["x-ms-blob-content-language"] = []string{*blobHTTPHeaders.BlobContentLanguage}
|
||||
}
|
||||
if blobHTTPHeaders != nil && blobHTTPHeaders.BlobContentMD5 != nil {
|
||||
req.Raw().Header["x-ms-blob-content-md5"] = []string{base64.StdEncoding.EncodeToString(blobHTTPHeaders.BlobContentMD5)}
|
||||
}
|
||||
if blobHTTPHeaders != nil && blobHTTPHeaders.BlobCacheControl != nil {
|
||||
req.Raw().Header["x-ms-blob-cache-control"] = []string{*blobHTTPHeaders.BlobCacheControl}
|
||||
}
|
||||
if options != nil && options.Metadata != nil {
|
||||
for k, v := range options.Metadata {
|
||||
if v != nil {
|
||||
req.Raw().Header["x-ms-meta-"+k] = []string{*v}
|
||||
}
|
||||
}
|
||||
}
|
||||
if leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil {
|
||||
req.Raw().Header["x-ms-lease-id"] = []string{*leaseAccessConditions.LeaseID}
|
||||
}
|
||||
if blobHTTPHeaders != nil && blobHTTPHeaders.BlobContentDisposition != nil {
|
||||
req.Raw().Header["x-ms-blob-content-disposition"] = []string{*blobHTTPHeaders.BlobContentDisposition}
|
||||
}
|
||||
if cpkInfo != nil && cpkInfo.EncryptionKey != nil {
|
||||
req.Raw().Header["x-ms-encryption-key"] = []string{*cpkInfo.EncryptionKey}
|
||||
}
|
||||
if cpkInfo != nil && cpkInfo.EncryptionKeySHA256 != nil {
|
||||
req.Raw().Header["x-ms-encryption-key-sha256"] = []string{*cpkInfo.EncryptionKeySHA256}
|
||||
}
|
||||
if cpkInfo != nil && cpkInfo.EncryptionAlgorithm != nil {
|
||||
req.Raw().Header["x-ms-encryption-algorithm"] = []string{string(*cpkInfo.EncryptionAlgorithm)}
|
||||
}
|
||||
if cpkScopeInfo != nil && cpkScopeInfo.EncryptionScope != nil {
|
||||
req.Raw().Header["x-ms-encryption-scope"] = []string{*cpkScopeInfo.EncryptionScope}
|
||||
}
|
||||
if options != nil && options.Tier != nil {
|
||||
req.Raw().Header["x-ms-access-tier"] = []string{string(*options.Tier)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfModifiedSince != nil {
|
||||
req.Raw().Header["If-Modified-Since"] = []string{(*modifiedAccessConditions.IfModifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfUnmodifiedSince != nil {
|
||||
req.Raw().Header["If-Unmodified-Since"] = []string{(*modifiedAccessConditions.IfUnmodifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfMatch != nil {
|
||||
req.Raw().Header["If-Match"] = []string{string(*modifiedAccessConditions.IfMatch)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfNoneMatch != nil {
|
||||
req.Raw().Header["If-None-Match"] = []string{string(*modifiedAccessConditions.IfNoneMatch)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfTags != nil {
|
||||
req.Raw().Header["x-ms-if-tags"] = []string{*modifiedAccessConditions.IfTags}
|
||||
}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
if options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
if options != nil && options.BlobTagsString != nil {
|
||||
req.Raw().Header["x-ms-tags"] = []string{*options.BlobTagsString}
|
||||
}
|
||||
if options != nil && options.ImmutabilityPolicyExpiry != nil {
|
||||
req.Raw().Header["x-ms-immutability-policy-until-date"] = []string{(*options.ImmutabilityPolicyExpiry).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if options != nil && options.ImmutabilityPolicyMode != nil {
|
||||
req.Raw().Header["x-ms-immutability-policy-mode"] = []string{string(*options.ImmutabilityPolicyMode)}
|
||||
}
|
||||
if options != nil && options.LegalHold != nil {
|
||||
req.Raw().Header["x-ms-legal-hold"] = []string{strconv.FormatBool(*options.LegalHold)}
|
||||
}
|
||||
if options != nil && options.TransactionalContentCRC64 != nil {
|
||||
req.Raw().Header["x-ms-content-crc64"] = []string{base64.StdEncoding.EncodeToString(options.TransactionalContentCRC64)}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
if err := req.SetBody(body, "application/octet-stream"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// uploadHandleResponse handles the Upload response.
|
||||
func (client *BlockBlobClient) uploadHandleResponse(resp *http.Response) (BlockBlobClientUploadResponse, error) {
|
||||
result := BlockBlobClientUploadResponse{}
|
||||
if val := resp.Header.Get("x-ms-client-request-id"); val != "" {
|
||||
result.ClientRequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("Content-MD5"); val != "" {
|
||||
contentMD5, err := base64.StdEncoding.DecodeString(val)
|
||||
if err != nil {
|
||||
return BlockBlobClientUploadResponse{}, err
|
||||
}
|
||||
result.ContentMD5 = contentMD5
|
||||
}
|
||||
if val := resp.Header.Get("Date"); val != "" {
|
||||
date, err := time.Parse(time.RFC1123, val)
|
||||
if err != nil {
|
||||
return BlockBlobClientUploadResponse{}, err
|
||||
}
|
||||
result.Date = &date
|
||||
}
|
||||
if val := resp.Header.Get("ETag"); val != "" {
|
||||
result.ETag = (*azcore.ETag)(&val)
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-encryption-key-sha256"); val != "" {
|
||||
result.EncryptionKeySHA256 = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-encryption-scope"); val != "" {
|
||||
result.EncryptionScope = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-server-encrypted"); val != "" {
|
||||
isServerEncrypted, err := strconv.ParseBool(val)
|
||||
if err != nil {
|
||||
return BlockBlobClientUploadResponse{}, err
|
||||
}
|
||||
result.IsServerEncrypted = &isServerEncrypted
|
||||
}
|
||||
if val := resp.Header.Get("Last-Modified"); val != "" {
|
||||
lastModified, err := time.Parse(time.RFC1123, val)
|
||||
if err != nil {
|
||||
return BlockBlobClientUploadResponse{}, err
|
||||
}
|
||||
result.LastModified = &lastModified
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.RequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-version"); val != "" {
|
||||
result.Version = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-version-id"); val != "" {
|
||||
result.VersionID = &val
|
||||
}
|
||||
return result, nil
|
||||
}
|
747
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/zz_constants.go
сгенерированный
поставляемый
Normal file
747
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/zz_constants.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,747 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package generated
|
||||
|
||||
type AccessTier string
|
||||
|
||||
const (
|
||||
AccessTierArchive AccessTier = "Archive"
|
||||
AccessTierCold AccessTier = "Cold"
|
||||
AccessTierCool AccessTier = "Cool"
|
||||
AccessTierHot AccessTier = "Hot"
|
||||
AccessTierP10 AccessTier = "P10"
|
||||
AccessTierP15 AccessTier = "P15"
|
||||
AccessTierP20 AccessTier = "P20"
|
||||
AccessTierP30 AccessTier = "P30"
|
||||
AccessTierP4 AccessTier = "P4"
|
||||
AccessTierP40 AccessTier = "P40"
|
||||
AccessTierP50 AccessTier = "P50"
|
||||
AccessTierP6 AccessTier = "P6"
|
||||
AccessTierP60 AccessTier = "P60"
|
||||
AccessTierP70 AccessTier = "P70"
|
||||
AccessTierP80 AccessTier = "P80"
|
||||
AccessTierPremium AccessTier = "Premium"
|
||||
)
|
||||
|
||||
// PossibleAccessTierValues returns the possible values for the AccessTier const type.
|
||||
func PossibleAccessTierValues() []AccessTier {
|
||||
return []AccessTier{
|
||||
AccessTierArchive,
|
||||
AccessTierCold,
|
||||
AccessTierCool,
|
||||
AccessTierHot,
|
||||
AccessTierP10,
|
||||
AccessTierP15,
|
||||
AccessTierP20,
|
||||
AccessTierP30,
|
||||
AccessTierP4,
|
||||
AccessTierP40,
|
||||
AccessTierP50,
|
||||
AccessTierP6,
|
||||
AccessTierP60,
|
||||
AccessTierP70,
|
||||
AccessTierP80,
|
||||
AccessTierPremium,
|
||||
}
|
||||
}
|
||||
|
||||
type AccountKind string
|
||||
|
||||
const (
|
||||
AccountKindBlobStorage AccountKind = "BlobStorage"
|
||||
AccountKindBlockBlobStorage AccountKind = "BlockBlobStorage"
|
||||
AccountKindFileStorage AccountKind = "FileStorage"
|
||||
AccountKindStorage AccountKind = "Storage"
|
||||
AccountKindStorageV2 AccountKind = "StorageV2"
|
||||
)
|
||||
|
||||
// PossibleAccountKindValues returns the possible values for the AccountKind const type.
|
||||
func PossibleAccountKindValues() []AccountKind {
|
||||
return []AccountKind{
|
||||
AccountKindBlobStorage,
|
||||
AccountKindBlockBlobStorage,
|
||||
AccountKindFileStorage,
|
||||
AccountKindStorage,
|
||||
AccountKindStorageV2,
|
||||
}
|
||||
}
|
||||
|
||||
type ArchiveStatus string
|
||||
|
||||
const (
|
||||
ArchiveStatusRehydratePendingToCold ArchiveStatus = "rehydrate-pending-to-cold"
|
||||
ArchiveStatusRehydratePendingToCool ArchiveStatus = "rehydrate-pending-to-cool"
|
||||
ArchiveStatusRehydratePendingToHot ArchiveStatus = "rehydrate-pending-to-hot"
|
||||
)
|
||||
|
||||
// PossibleArchiveStatusValues returns the possible values for the ArchiveStatus const type.
|
||||
func PossibleArchiveStatusValues() []ArchiveStatus {
|
||||
return []ArchiveStatus{
|
||||
ArchiveStatusRehydratePendingToCold,
|
||||
ArchiveStatusRehydratePendingToCool,
|
||||
ArchiveStatusRehydratePendingToHot,
|
||||
}
|
||||
}
|
||||
|
||||
type BlobCopySourceTags string
|
||||
|
||||
const (
|
||||
BlobCopySourceTagsCOPY BlobCopySourceTags = "COPY"
|
||||
BlobCopySourceTagsREPLACE BlobCopySourceTags = "REPLACE"
|
||||
)
|
||||
|
||||
// PossibleBlobCopySourceTagsValues returns the possible values for the BlobCopySourceTags const type.
|
||||
func PossibleBlobCopySourceTagsValues() []BlobCopySourceTags {
|
||||
return []BlobCopySourceTags{
|
||||
BlobCopySourceTagsCOPY,
|
||||
BlobCopySourceTagsREPLACE,
|
||||
}
|
||||
}
|
||||
|
||||
// BlobGeoReplicationStatus - The status of the secondary location
|
||||
type BlobGeoReplicationStatus string
|
||||
|
||||
const (
|
||||
BlobGeoReplicationStatusBootstrap BlobGeoReplicationStatus = "bootstrap"
|
||||
BlobGeoReplicationStatusLive BlobGeoReplicationStatus = "live"
|
||||
BlobGeoReplicationStatusUnavailable BlobGeoReplicationStatus = "unavailable"
|
||||
)
|
||||
|
||||
// PossibleBlobGeoReplicationStatusValues returns the possible values for the BlobGeoReplicationStatus const type.
|
||||
func PossibleBlobGeoReplicationStatusValues() []BlobGeoReplicationStatus {
|
||||
return []BlobGeoReplicationStatus{
|
||||
BlobGeoReplicationStatusBootstrap,
|
||||
BlobGeoReplicationStatusLive,
|
||||
BlobGeoReplicationStatusUnavailable,
|
||||
}
|
||||
}
|
||||
|
||||
type BlobType string
|
||||
|
||||
const (
|
||||
BlobTypeAppendBlob BlobType = "AppendBlob"
|
||||
BlobTypeBlockBlob BlobType = "BlockBlob"
|
||||
BlobTypePageBlob BlobType = "PageBlob"
|
||||
)
|
||||
|
||||
// PossibleBlobTypeValues returns the possible values for the BlobType const type.
|
||||
func PossibleBlobTypeValues() []BlobType {
|
||||
return []BlobType{
|
||||
BlobTypeAppendBlob,
|
||||
BlobTypeBlockBlob,
|
||||
BlobTypePageBlob,
|
||||
}
|
||||
}
|
||||
|
||||
type BlockListType string
|
||||
|
||||
const (
|
||||
BlockListTypeAll BlockListType = "all"
|
||||
BlockListTypeCommitted BlockListType = "committed"
|
||||
BlockListTypeUncommitted BlockListType = "uncommitted"
|
||||
)
|
||||
|
||||
// PossibleBlockListTypeValues returns the possible values for the BlockListType const type.
|
||||
func PossibleBlockListTypeValues() []BlockListType {
|
||||
return []BlockListType{
|
||||
BlockListTypeAll,
|
||||
BlockListTypeCommitted,
|
||||
BlockListTypeUncommitted,
|
||||
}
|
||||
}
|
||||
|
||||
type CopyStatusType string
|
||||
|
||||
const (
|
||||
CopyStatusTypeAborted CopyStatusType = "aborted"
|
||||
CopyStatusTypeFailed CopyStatusType = "failed"
|
||||
CopyStatusTypePending CopyStatusType = "pending"
|
||||
CopyStatusTypeSuccess CopyStatusType = "success"
|
||||
)
|
||||
|
||||
// PossibleCopyStatusTypeValues returns the possible values for the CopyStatusType const type.
|
||||
func PossibleCopyStatusTypeValues() []CopyStatusType {
|
||||
return []CopyStatusType{
|
||||
CopyStatusTypeAborted,
|
||||
CopyStatusTypeFailed,
|
||||
CopyStatusTypePending,
|
||||
CopyStatusTypeSuccess,
|
||||
}
|
||||
}
|
||||
|
||||
type DeleteSnapshotsOptionType string
|
||||
|
||||
const (
|
||||
DeleteSnapshotsOptionTypeInclude DeleteSnapshotsOptionType = "include"
|
||||
DeleteSnapshotsOptionTypeOnly DeleteSnapshotsOptionType = "only"
|
||||
)
|
||||
|
||||
// PossibleDeleteSnapshotsOptionTypeValues returns the possible values for the DeleteSnapshotsOptionType const type.
|
||||
func PossibleDeleteSnapshotsOptionTypeValues() []DeleteSnapshotsOptionType {
|
||||
return []DeleteSnapshotsOptionType{
|
||||
DeleteSnapshotsOptionTypeInclude,
|
||||
DeleteSnapshotsOptionTypeOnly,
|
||||
}
|
||||
}
|
||||
|
||||
type DeleteType string
|
||||
|
||||
const (
|
||||
DeleteTypeNone DeleteType = "None"
|
||||
DeleteTypePermanent DeleteType = "Permanent"
|
||||
)
|
||||
|
||||
// PossibleDeleteTypeValues returns the possible values for the DeleteType const type.
|
||||
func PossibleDeleteTypeValues() []DeleteType {
|
||||
return []DeleteType{
|
||||
DeleteTypeNone,
|
||||
DeleteTypePermanent,
|
||||
}
|
||||
}
|
||||
|
||||
type EncryptionAlgorithmType string
|
||||
|
||||
const (
|
||||
EncryptionAlgorithmTypeAES256 EncryptionAlgorithmType = "AES256"
|
||||
EncryptionAlgorithmTypeNone EncryptionAlgorithmType = "None"
|
||||
)
|
||||
|
||||
// PossibleEncryptionAlgorithmTypeValues returns the possible values for the EncryptionAlgorithmType const type.
|
||||
func PossibleEncryptionAlgorithmTypeValues() []EncryptionAlgorithmType {
|
||||
return []EncryptionAlgorithmType{
|
||||
EncryptionAlgorithmTypeAES256,
|
||||
EncryptionAlgorithmTypeNone,
|
||||
}
|
||||
}
|
||||
|
||||
type ExpiryOptions string
|
||||
|
||||
const (
|
||||
ExpiryOptionsAbsolute ExpiryOptions = "Absolute"
|
||||
ExpiryOptionsNeverExpire ExpiryOptions = "NeverExpire"
|
||||
ExpiryOptionsRelativeToCreation ExpiryOptions = "RelativeToCreation"
|
||||
ExpiryOptionsRelativeToNow ExpiryOptions = "RelativeToNow"
|
||||
)
|
||||
|
||||
// PossibleExpiryOptionsValues returns the possible values for the ExpiryOptions const type.
|
||||
func PossibleExpiryOptionsValues() []ExpiryOptions {
|
||||
return []ExpiryOptions{
|
||||
ExpiryOptionsAbsolute,
|
||||
ExpiryOptionsNeverExpire,
|
||||
ExpiryOptionsRelativeToCreation,
|
||||
ExpiryOptionsRelativeToNow,
|
||||
}
|
||||
}
|
||||
|
||||
type FilterBlobsIncludeItem string
|
||||
|
||||
const (
|
||||
FilterBlobsIncludeItemNone FilterBlobsIncludeItem = "none"
|
||||
FilterBlobsIncludeItemVersions FilterBlobsIncludeItem = "versions"
|
||||
)
|
||||
|
||||
// PossibleFilterBlobsIncludeItemValues returns the possible values for the FilterBlobsIncludeItem const type.
|
||||
func PossibleFilterBlobsIncludeItemValues() []FilterBlobsIncludeItem {
|
||||
return []FilterBlobsIncludeItem{
|
||||
FilterBlobsIncludeItemNone,
|
||||
FilterBlobsIncludeItemVersions,
|
||||
}
|
||||
}
|
||||
|
||||
type ImmutabilityPolicyMode string
|
||||
|
||||
const (
|
||||
ImmutabilityPolicyModeLocked ImmutabilityPolicyMode = "Locked"
|
||||
ImmutabilityPolicyModeMutable ImmutabilityPolicyMode = "Mutable"
|
||||
ImmutabilityPolicyModeUnlocked ImmutabilityPolicyMode = "Unlocked"
|
||||
)
|
||||
|
||||
// PossibleImmutabilityPolicyModeValues returns the possible values for the ImmutabilityPolicyMode const type.
|
||||
func PossibleImmutabilityPolicyModeValues() []ImmutabilityPolicyMode {
|
||||
return []ImmutabilityPolicyMode{
|
||||
ImmutabilityPolicyModeLocked,
|
||||
ImmutabilityPolicyModeMutable,
|
||||
ImmutabilityPolicyModeUnlocked,
|
||||
}
|
||||
}
|
||||
|
||||
type ImmutabilityPolicySetting string
|
||||
|
||||
const (
|
||||
ImmutabilityPolicySettingLocked ImmutabilityPolicySetting = "Locked"
|
||||
ImmutabilityPolicySettingUnlocked ImmutabilityPolicySetting = "Unlocked"
|
||||
)
|
||||
|
||||
// PossibleImmutabilityPolicySettingValues returns the possible values for the ImmutabilityPolicySetting const type.
|
||||
func PossibleImmutabilityPolicySettingValues() []ImmutabilityPolicySetting {
|
||||
return []ImmutabilityPolicySetting{
|
||||
ImmutabilityPolicySettingLocked,
|
||||
ImmutabilityPolicySettingUnlocked,
|
||||
}
|
||||
}
|
||||
|
||||
type LeaseDurationType string
|
||||
|
||||
const (
|
||||
LeaseDurationTypeFixed LeaseDurationType = "fixed"
|
||||
LeaseDurationTypeInfinite LeaseDurationType = "infinite"
|
||||
)
|
||||
|
||||
// PossibleLeaseDurationTypeValues returns the possible values for the LeaseDurationType const type.
|
||||
func PossibleLeaseDurationTypeValues() []LeaseDurationType {
|
||||
return []LeaseDurationType{
|
||||
LeaseDurationTypeFixed,
|
||||
LeaseDurationTypeInfinite,
|
||||
}
|
||||
}
|
||||
|
||||
type LeaseStateType string
|
||||
|
||||
const (
|
||||
LeaseStateTypeAvailable LeaseStateType = "available"
|
||||
LeaseStateTypeBreaking LeaseStateType = "breaking"
|
||||
LeaseStateTypeBroken LeaseStateType = "broken"
|
||||
LeaseStateTypeExpired LeaseStateType = "expired"
|
||||
LeaseStateTypeLeased LeaseStateType = "leased"
|
||||
)
|
||||
|
||||
// PossibleLeaseStateTypeValues returns the possible values for the LeaseStateType const type.
|
||||
func PossibleLeaseStateTypeValues() []LeaseStateType {
|
||||
return []LeaseStateType{
|
||||
LeaseStateTypeAvailable,
|
||||
LeaseStateTypeBreaking,
|
||||
LeaseStateTypeBroken,
|
||||
LeaseStateTypeExpired,
|
||||
LeaseStateTypeLeased,
|
||||
}
|
||||
}
|
||||
|
||||
type LeaseStatusType string
|
||||
|
||||
const (
|
||||
LeaseStatusTypeLocked LeaseStatusType = "locked"
|
||||
LeaseStatusTypeUnlocked LeaseStatusType = "unlocked"
|
||||
)
|
||||
|
||||
// PossibleLeaseStatusTypeValues returns the possible values for the LeaseStatusType const type.
|
||||
func PossibleLeaseStatusTypeValues() []LeaseStatusType {
|
||||
return []LeaseStatusType{
|
||||
LeaseStatusTypeLocked,
|
||||
LeaseStatusTypeUnlocked,
|
||||
}
|
||||
}
|
||||
|
||||
type ListBlobsIncludeItem string
|
||||
|
||||
const (
|
||||
ListBlobsIncludeItemCopy ListBlobsIncludeItem = "copy"
|
||||
ListBlobsIncludeItemDeleted ListBlobsIncludeItem = "deleted"
|
||||
ListBlobsIncludeItemDeletedwithversions ListBlobsIncludeItem = "deletedwithversions"
|
||||
ListBlobsIncludeItemImmutabilitypolicy ListBlobsIncludeItem = "immutabilitypolicy"
|
||||
ListBlobsIncludeItemLegalhold ListBlobsIncludeItem = "legalhold"
|
||||
ListBlobsIncludeItemMetadata ListBlobsIncludeItem = "metadata"
|
||||
ListBlobsIncludeItemSnapshots ListBlobsIncludeItem = "snapshots"
|
||||
ListBlobsIncludeItemTags ListBlobsIncludeItem = "tags"
|
||||
ListBlobsIncludeItemUncommittedblobs ListBlobsIncludeItem = "uncommittedblobs"
|
||||
ListBlobsIncludeItemVersions ListBlobsIncludeItem = "versions"
|
||||
)
|
||||
|
||||
// PossibleListBlobsIncludeItemValues returns the possible values for the ListBlobsIncludeItem const type.
|
||||
func PossibleListBlobsIncludeItemValues() []ListBlobsIncludeItem {
|
||||
return []ListBlobsIncludeItem{
|
||||
ListBlobsIncludeItemCopy,
|
||||
ListBlobsIncludeItemDeleted,
|
||||
ListBlobsIncludeItemDeletedwithversions,
|
||||
ListBlobsIncludeItemImmutabilitypolicy,
|
||||
ListBlobsIncludeItemLegalhold,
|
||||
ListBlobsIncludeItemMetadata,
|
||||
ListBlobsIncludeItemSnapshots,
|
||||
ListBlobsIncludeItemTags,
|
||||
ListBlobsIncludeItemUncommittedblobs,
|
||||
ListBlobsIncludeItemVersions,
|
||||
}
|
||||
}
|
||||
|
||||
type ListContainersIncludeType string
|
||||
|
||||
const (
|
||||
ListContainersIncludeTypeDeleted ListContainersIncludeType = "deleted"
|
||||
ListContainersIncludeTypeMetadata ListContainersIncludeType = "metadata"
|
||||
ListContainersIncludeTypeSystem ListContainersIncludeType = "system"
|
||||
)
|
||||
|
||||
// PossibleListContainersIncludeTypeValues returns the possible values for the ListContainersIncludeType const type.
|
||||
func PossibleListContainersIncludeTypeValues() []ListContainersIncludeType {
|
||||
return []ListContainersIncludeType{
|
||||
ListContainersIncludeTypeDeleted,
|
||||
ListContainersIncludeTypeMetadata,
|
||||
ListContainersIncludeTypeSystem,
|
||||
}
|
||||
}
|
||||
|
||||
type PremiumPageBlobAccessTier string
|
||||
|
||||
const (
|
||||
PremiumPageBlobAccessTierP10 PremiumPageBlobAccessTier = "P10"
|
||||
PremiumPageBlobAccessTierP15 PremiumPageBlobAccessTier = "P15"
|
||||
PremiumPageBlobAccessTierP20 PremiumPageBlobAccessTier = "P20"
|
||||
PremiumPageBlobAccessTierP30 PremiumPageBlobAccessTier = "P30"
|
||||
PremiumPageBlobAccessTierP4 PremiumPageBlobAccessTier = "P4"
|
||||
PremiumPageBlobAccessTierP40 PremiumPageBlobAccessTier = "P40"
|
||||
PremiumPageBlobAccessTierP50 PremiumPageBlobAccessTier = "P50"
|
||||
PremiumPageBlobAccessTierP6 PremiumPageBlobAccessTier = "P6"
|
||||
PremiumPageBlobAccessTierP60 PremiumPageBlobAccessTier = "P60"
|
||||
PremiumPageBlobAccessTierP70 PremiumPageBlobAccessTier = "P70"
|
||||
PremiumPageBlobAccessTierP80 PremiumPageBlobAccessTier = "P80"
|
||||
)
|
||||
|
||||
// PossiblePremiumPageBlobAccessTierValues returns the possible values for the PremiumPageBlobAccessTier const type.
|
||||
func PossiblePremiumPageBlobAccessTierValues() []PremiumPageBlobAccessTier {
|
||||
return []PremiumPageBlobAccessTier{
|
||||
PremiumPageBlobAccessTierP10,
|
||||
PremiumPageBlobAccessTierP15,
|
||||
PremiumPageBlobAccessTierP20,
|
||||
PremiumPageBlobAccessTierP30,
|
||||
PremiumPageBlobAccessTierP4,
|
||||
PremiumPageBlobAccessTierP40,
|
||||
PremiumPageBlobAccessTierP50,
|
||||
PremiumPageBlobAccessTierP6,
|
||||
PremiumPageBlobAccessTierP60,
|
||||
PremiumPageBlobAccessTierP70,
|
||||
PremiumPageBlobAccessTierP80,
|
||||
}
|
||||
}
|
||||
|
||||
type PublicAccessType string
|
||||
|
||||
const (
|
||||
PublicAccessTypeBlob PublicAccessType = "blob"
|
||||
PublicAccessTypeContainer PublicAccessType = "container"
|
||||
)
|
||||
|
||||
// PossiblePublicAccessTypeValues returns the possible values for the PublicAccessType const type.
|
||||
func PossiblePublicAccessTypeValues() []PublicAccessType {
|
||||
return []PublicAccessType{
|
||||
PublicAccessTypeBlob,
|
||||
PublicAccessTypeContainer,
|
||||
}
|
||||
}
|
||||
|
||||
// QueryFormatType - The quick query format type.
|
||||
type QueryFormatType string
|
||||
|
||||
const (
|
||||
QueryFormatTypeArrow QueryFormatType = "arrow"
|
||||
QueryFormatTypeDelimited QueryFormatType = "delimited"
|
||||
QueryFormatTypeJSON QueryFormatType = "json"
|
||||
QueryFormatTypeParquet QueryFormatType = "parquet"
|
||||
)
|
||||
|
||||
// PossibleQueryFormatTypeValues returns the possible values for the QueryFormatType const type.
|
||||
func PossibleQueryFormatTypeValues() []QueryFormatType {
|
||||
return []QueryFormatType{
|
||||
QueryFormatTypeArrow,
|
||||
QueryFormatTypeDelimited,
|
||||
QueryFormatTypeJSON,
|
||||
QueryFormatTypeParquet,
|
||||
}
|
||||
}
|
||||
|
||||
// RehydratePriority - If an object is in rehydrate pending state then this header is returned with priority of rehydrate.
|
||||
// Valid values are High and Standard.
|
||||
type RehydratePriority string
|
||||
|
||||
const (
|
||||
RehydratePriorityHigh RehydratePriority = "High"
|
||||
RehydratePriorityStandard RehydratePriority = "Standard"
|
||||
)
|
||||
|
||||
// PossibleRehydratePriorityValues returns the possible values for the RehydratePriority const type.
|
||||
func PossibleRehydratePriorityValues() []RehydratePriority {
|
||||
return []RehydratePriority{
|
||||
RehydratePriorityHigh,
|
||||
RehydratePriorityStandard,
|
||||
}
|
||||
}
|
||||
|
||||
type SKUName string
|
||||
|
||||
const (
|
||||
SKUNamePremiumLRS SKUName = "Premium_LRS"
|
||||
SKUNameStandardGRS SKUName = "Standard_GRS"
|
||||
SKUNameStandardLRS SKUName = "Standard_LRS"
|
||||
SKUNameStandardRAGRS SKUName = "Standard_RAGRS"
|
||||
SKUNameStandardZRS SKUName = "Standard_ZRS"
|
||||
)
|
||||
|
||||
// PossibleSKUNameValues returns the possible values for the SKUName const type.
|
||||
func PossibleSKUNameValues() []SKUName {
|
||||
return []SKUName{
|
||||
SKUNamePremiumLRS,
|
||||
SKUNameStandardGRS,
|
||||
SKUNameStandardLRS,
|
||||
SKUNameStandardRAGRS,
|
||||
SKUNameStandardZRS,
|
||||
}
|
||||
}
|
||||
|
||||
type SequenceNumberActionType string
|
||||
|
||||
const (
|
||||
SequenceNumberActionTypeIncrement SequenceNumberActionType = "increment"
|
||||
SequenceNumberActionTypeMax SequenceNumberActionType = "max"
|
||||
SequenceNumberActionTypeUpdate SequenceNumberActionType = "update"
|
||||
)
|
||||
|
||||
// PossibleSequenceNumberActionTypeValues returns the possible values for the SequenceNumberActionType const type.
|
||||
func PossibleSequenceNumberActionTypeValues() []SequenceNumberActionType {
|
||||
return []SequenceNumberActionType{
|
||||
SequenceNumberActionTypeIncrement,
|
||||
SequenceNumberActionTypeMax,
|
||||
SequenceNumberActionTypeUpdate,
|
||||
}
|
||||
}
|
||||
|
||||
// StorageErrorCode - Error codes returned by the service
|
||||
type StorageErrorCode string
|
||||
|
||||
const (
|
||||
StorageErrorCodeAccountAlreadyExists StorageErrorCode = "AccountAlreadyExists"
|
||||
StorageErrorCodeAccountBeingCreated StorageErrorCode = "AccountBeingCreated"
|
||||
StorageErrorCodeAccountIsDisabled StorageErrorCode = "AccountIsDisabled"
|
||||
StorageErrorCodeAppendPositionConditionNotMet StorageErrorCode = "AppendPositionConditionNotMet"
|
||||
StorageErrorCodeAuthenticationFailed StorageErrorCode = "AuthenticationFailed"
|
||||
StorageErrorCodeAuthorizationFailure StorageErrorCode = "AuthorizationFailure"
|
||||
StorageErrorCodeAuthorizationPermissionMismatch StorageErrorCode = "AuthorizationPermissionMismatch"
|
||||
StorageErrorCodeAuthorizationProtocolMismatch StorageErrorCode = "AuthorizationProtocolMismatch"
|
||||
StorageErrorCodeAuthorizationResourceTypeMismatch StorageErrorCode = "AuthorizationResourceTypeMismatch"
|
||||
StorageErrorCodeAuthorizationServiceMismatch StorageErrorCode = "AuthorizationServiceMismatch"
|
||||
StorageErrorCodeAuthorizationSourceIPMismatch StorageErrorCode = "AuthorizationSourceIPMismatch"
|
||||
StorageErrorCodeBlobAlreadyExists StorageErrorCode = "BlobAlreadyExists"
|
||||
StorageErrorCodeBlobArchived StorageErrorCode = "BlobArchived"
|
||||
StorageErrorCodeBlobBeingRehydrated StorageErrorCode = "BlobBeingRehydrated"
|
||||
StorageErrorCodeBlobImmutableDueToPolicy StorageErrorCode = "BlobImmutableDueToPolicy"
|
||||
StorageErrorCodeBlobNotArchived StorageErrorCode = "BlobNotArchived"
|
||||
StorageErrorCodeBlobNotFound StorageErrorCode = "BlobNotFound"
|
||||
StorageErrorCodeBlobOverwritten StorageErrorCode = "BlobOverwritten"
|
||||
StorageErrorCodeBlobTierInadequateForContentLength StorageErrorCode = "BlobTierInadequateForContentLength"
|
||||
StorageErrorCodeBlobUsesCustomerSpecifiedEncryption StorageErrorCode = "BlobUsesCustomerSpecifiedEncryption"
|
||||
StorageErrorCodeBlockCountExceedsLimit StorageErrorCode = "BlockCountExceedsLimit"
|
||||
StorageErrorCodeBlockListTooLong StorageErrorCode = "BlockListTooLong"
|
||||
StorageErrorCodeCannotChangeToLowerTier StorageErrorCode = "CannotChangeToLowerTier"
|
||||
StorageErrorCodeCannotVerifyCopySource StorageErrorCode = "CannotVerifyCopySource"
|
||||
StorageErrorCodeConditionHeadersNotSupported StorageErrorCode = "ConditionHeadersNotSupported"
|
||||
StorageErrorCodeConditionNotMet StorageErrorCode = "ConditionNotMet"
|
||||
StorageErrorCodeContainerAlreadyExists StorageErrorCode = "ContainerAlreadyExists"
|
||||
StorageErrorCodeContainerBeingDeleted StorageErrorCode = "ContainerBeingDeleted"
|
||||
StorageErrorCodeContainerDisabled StorageErrorCode = "ContainerDisabled"
|
||||
StorageErrorCodeContainerNotFound StorageErrorCode = "ContainerNotFound"
|
||||
StorageErrorCodeContentLengthLargerThanTierLimit StorageErrorCode = "ContentLengthLargerThanTierLimit"
|
||||
StorageErrorCodeCopyAcrossAccountsNotSupported StorageErrorCode = "CopyAcrossAccountsNotSupported"
|
||||
StorageErrorCodeCopyIDMismatch StorageErrorCode = "CopyIdMismatch"
|
||||
StorageErrorCodeEmptyMetadataKey StorageErrorCode = "EmptyMetadataKey"
|
||||
StorageErrorCodeFeatureVersionMismatch StorageErrorCode = "FeatureVersionMismatch"
|
||||
StorageErrorCodeIncrementalCopyBlobMismatch StorageErrorCode = "IncrementalCopyBlobMismatch"
|
||||
StorageErrorCodeIncrementalCopyOfEarlierVersionSnapshotNotAllowed StorageErrorCode = "IncrementalCopyOfEarlierVersionSnapshotNotAllowed"
|
||||
StorageErrorCodeIncrementalCopySourceMustBeSnapshot StorageErrorCode = "IncrementalCopySourceMustBeSnapshot"
|
||||
StorageErrorCodeInfiniteLeaseDurationRequired StorageErrorCode = "InfiniteLeaseDurationRequired"
|
||||
StorageErrorCodeInsufficientAccountPermissions StorageErrorCode = "InsufficientAccountPermissions"
|
||||
StorageErrorCodeInternalError StorageErrorCode = "InternalError"
|
||||
StorageErrorCodeInvalidAuthenticationInfo StorageErrorCode = "InvalidAuthenticationInfo"
|
||||
StorageErrorCodeInvalidBlobOrBlock StorageErrorCode = "InvalidBlobOrBlock"
|
||||
StorageErrorCodeInvalidBlobTier StorageErrorCode = "InvalidBlobTier"
|
||||
StorageErrorCodeInvalidBlobType StorageErrorCode = "InvalidBlobType"
|
||||
StorageErrorCodeInvalidBlockID StorageErrorCode = "InvalidBlockId"
|
||||
StorageErrorCodeInvalidBlockList StorageErrorCode = "InvalidBlockList"
|
||||
StorageErrorCodeInvalidHTTPVerb StorageErrorCode = "InvalidHttpVerb"
|
||||
StorageErrorCodeInvalidHeaderValue StorageErrorCode = "InvalidHeaderValue"
|
||||
StorageErrorCodeInvalidInput StorageErrorCode = "InvalidInput"
|
||||
StorageErrorCodeInvalidMD5 StorageErrorCode = "InvalidMd5"
|
||||
StorageErrorCodeInvalidMetadata StorageErrorCode = "InvalidMetadata"
|
||||
StorageErrorCodeInvalidOperation StorageErrorCode = "InvalidOperation"
|
||||
StorageErrorCodeInvalidPageRange StorageErrorCode = "InvalidPageRange"
|
||||
StorageErrorCodeInvalidQueryParameterValue StorageErrorCode = "InvalidQueryParameterValue"
|
||||
StorageErrorCodeInvalidRange StorageErrorCode = "InvalidRange"
|
||||
StorageErrorCodeInvalidResourceName StorageErrorCode = "InvalidResourceName"
|
||||
StorageErrorCodeInvalidSourceBlobType StorageErrorCode = "InvalidSourceBlobType"
|
||||
StorageErrorCodeInvalidSourceBlobURL StorageErrorCode = "InvalidSourceBlobUrl"
|
||||
StorageErrorCodeInvalidURI StorageErrorCode = "InvalidUri"
|
||||
StorageErrorCodeInvalidVersionForPageBlobOperation StorageErrorCode = "InvalidVersionForPageBlobOperation"
|
||||
StorageErrorCodeInvalidXMLDocument StorageErrorCode = "InvalidXmlDocument"
|
||||
StorageErrorCodeInvalidXMLNodeValue StorageErrorCode = "InvalidXmlNodeValue"
|
||||
StorageErrorCodeLeaseAlreadyBroken StorageErrorCode = "LeaseAlreadyBroken"
|
||||
StorageErrorCodeLeaseAlreadyPresent StorageErrorCode = "LeaseAlreadyPresent"
|
||||
StorageErrorCodeLeaseIDMismatchWithBlobOperation StorageErrorCode = "LeaseIdMismatchWithBlobOperation"
|
||||
StorageErrorCodeLeaseIDMismatchWithContainerOperation StorageErrorCode = "LeaseIdMismatchWithContainerOperation"
|
||||
StorageErrorCodeLeaseIDMismatchWithLeaseOperation StorageErrorCode = "LeaseIdMismatchWithLeaseOperation"
|
||||
StorageErrorCodeLeaseIDMissing StorageErrorCode = "LeaseIdMissing"
|
||||
StorageErrorCodeLeaseIsBreakingAndCannotBeAcquired StorageErrorCode = "LeaseIsBreakingAndCannotBeAcquired"
|
||||
StorageErrorCodeLeaseIsBreakingAndCannotBeChanged StorageErrorCode = "LeaseIsBreakingAndCannotBeChanged"
|
||||
StorageErrorCodeLeaseIsBrokenAndCannotBeRenewed StorageErrorCode = "LeaseIsBrokenAndCannotBeRenewed"
|
||||
StorageErrorCodeLeaseLost StorageErrorCode = "LeaseLost"
|
||||
StorageErrorCodeLeaseNotPresentWithBlobOperation StorageErrorCode = "LeaseNotPresentWithBlobOperation"
|
||||
StorageErrorCodeLeaseNotPresentWithContainerOperation StorageErrorCode = "LeaseNotPresentWithContainerOperation"
|
||||
StorageErrorCodeLeaseNotPresentWithLeaseOperation StorageErrorCode = "LeaseNotPresentWithLeaseOperation"
|
||||
StorageErrorCodeMD5Mismatch StorageErrorCode = "Md5Mismatch"
|
||||
StorageErrorCodeMaxBlobSizeConditionNotMet StorageErrorCode = "MaxBlobSizeConditionNotMet"
|
||||
StorageErrorCodeMetadataTooLarge StorageErrorCode = "MetadataTooLarge"
|
||||
StorageErrorCodeMissingContentLengthHeader StorageErrorCode = "MissingContentLengthHeader"
|
||||
StorageErrorCodeMissingRequiredHeader StorageErrorCode = "MissingRequiredHeader"
|
||||
StorageErrorCodeMissingRequiredQueryParameter StorageErrorCode = "MissingRequiredQueryParameter"
|
||||
StorageErrorCodeMissingRequiredXMLNode StorageErrorCode = "MissingRequiredXmlNode"
|
||||
StorageErrorCodeMultipleConditionHeadersNotSupported StorageErrorCode = "MultipleConditionHeadersNotSupported"
|
||||
StorageErrorCodeNoAuthenticationInformation StorageErrorCode = "NoAuthenticationInformation"
|
||||
StorageErrorCodeNoPendingCopyOperation StorageErrorCode = "NoPendingCopyOperation"
|
||||
StorageErrorCodeOperationNotAllowedOnIncrementalCopyBlob StorageErrorCode = "OperationNotAllowedOnIncrementalCopyBlob"
|
||||
StorageErrorCodeOperationTimedOut StorageErrorCode = "OperationTimedOut"
|
||||
StorageErrorCodeOutOfRangeInput StorageErrorCode = "OutOfRangeInput"
|
||||
StorageErrorCodeOutOfRangeQueryParameterValue StorageErrorCode = "OutOfRangeQueryParameterValue"
|
||||
StorageErrorCodePendingCopyOperation StorageErrorCode = "PendingCopyOperation"
|
||||
StorageErrorCodePreviousSnapshotCannotBeNewer StorageErrorCode = "PreviousSnapshotCannotBeNewer"
|
||||
StorageErrorCodePreviousSnapshotNotFound StorageErrorCode = "PreviousSnapshotNotFound"
|
||||
StorageErrorCodePreviousSnapshotOperationNotSupported StorageErrorCode = "PreviousSnapshotOperationNotSupported"
|
||||
StorageErrorCodeRequestBodyTooLarge StorageErrorCode = "RequestBodyTooLarge"
|
||||
StorageErrorCodeRequestURLFailedToParse StorageErrorCode = "RequestUrlFailedToParse"
|
||||
StorageErrorCodeResourceAlreadyExists StorageErrorCode = "ResourceAlreadyExists"
|
||||
StorageErrorCodeResourceNotFound StorageErrorCode = "ResourceNotFound"
|
||||
StorageErrorCodeResourceTypeMismatch StorageErrorCode = "ResourceTypeMismatch"
|
||||
StorageErrorCodeSequenceNumberConditionNotMet StorageErrorCode = "SequenceNumberConditionNotMet"
|
||||
StorageErrorCodeSequenceNumberIncrementTooLarge StorageErrorCode = "SequenceNumberIncrementTooLarge"
|
||||
StorageErrorCodeServerBusy StorageErrorCode = "ServerBusy"
|
||||
StorageErrorCodeSnapshotCountExceeded StorageErrorCode = "SnapshotCountExceeded"
|
||||
StorageErrorCodeSnapshotOperationRateExceeded StorageErrorCode = "SnapshotOperationRateExceeded"
|
||||
StorageErrorCodeSnapshotsPresent StorageErrorCode = "SnapshotsPresent"
|
||||
StorageErrorCodeSourceConditionNotMet StorageErrorCode = "SourceConditionNotMet"
|
||||
StorageErrorCodeSystemInUse StorageErrorCode = "SystemInUse"
|
||||
StorageErrorCodeTargetConditionNotMet StorageErrorCode = "TargetConditionNotMet"
|
||||
StorageErrorCodeUnauthorizedBlobOverwrite StorageErrorCode = "UnauthorizedBlobOverwrite"
|
||||
StorageErrorCodeUnsupportedHTTPVerb StorageErrorCode = "UnsupportedHttpVerb"
|
||||
StorageErrorCodeUnsupportedHeader StorageErrorCode = "UnsupportedHeader"
|
||||
StorageErrorCodeUnsupportedQueryParameter StorageErrorCode = "UnsupportedQueryParameter"
|
||||
StorageErrorCodeUnsupportedXMLNode StorageErrorCode = "UnsupportedXmlNode"
|
||||
)
|
||||
|
||||
// PossibleStorageErrorCodeValues returns the possible values for the StorageErrorCode const type.
|
||||
func PossibleStorageErrorCodeValues() []StorageErrorCode {
|
||||
return []StorageErrorCode{
|
||||
StorageErrorCodeAccountAlreadyExists,
|
||||
StorageErrorCodeAccountBeingCreated,
|
||||
StorageErrorCodeAccountIsDisabled,
|
||||
StorageErrorCodeAppendPositionConditionNotMet,
|
||||
StorageErrorCodeAuthenticationFailed,
|
||||
StorageErrorCodeAuthorizationFailure,
|
||||
StorageErrorCodeAuthorizationPermissionMismatch,
|
||||
StorageErrorCodeAuthorizationProtocolMismatch,
|
||||
StorageErrorCodeAuthorizationResourceTypeMismatch,
|
||||
StorageErrorCodeAuthorizationServiceMismatch,
|
||||
StorageErrorCodeAuthorizationSourceIPMismatch,
|
||||
StorageErrorCodeBlobAlreadyExists,
|
||||
StorageErrorCodeBlobArchived,
|
||||
StorageErrorCodeBlobBeingRehydrated,
|
||||
StorageErrorCodeBlobImmutableDueToPolicy,
|
||||
StorageErrorCodeBlobNotArchived,
|
||||
StorageErrorCodeBlobNotFound,
|
||||
StorageErrorCodeBlobOverwritten,
|
||||
StorageErrorCodeBlobTierInadequateForContentLength,
|
||||
StorageErrorCodeBlobUsesCustomerSpecifiedEncryption,
|
||||
StorageErrorCodeBlockCountExceedsLimit,
|
||||
StorageErrorCodeBlockListTooLong,
|
||||
StorageErrorCodeCannotChangeToLowerTier,
|
||||
StorageErrorCodeCannotVerifyCopySource,
|
||||
StorageErrorCodeConditionHeadersNotSupported,
|
||||
StorageErrorCodeConditionNotMet,
|
||||
StorageErrorCodeContainerAlreadyExists,
|
||||
StorageErrorCodeContainerBeingDeleted,
|
||||
StorageErrorCodeContainerDisabled,
|
||||
StorageErrorCodeContainerNotFound,
|
||||
StorageErrorCodeContentLengthLargerThanTierLimit,
|
||||
StorageErrorCodeCopyAcrossAccountsNotSupported,
|
||||
StorageErrorCodeCopyIDMismatch,
|
||||
StorageErrorCodeEmptyMetadataKey,
|
||||
StorageErrorCodeFeatureVersionMismatch,
|
||||
StorageErrorCodeIncrementalCopyBlobMismatch,
|
||||
StorageErrorCodeIncrementalCopyOfEarlierVersionSnapshotNotAllowed,
|
||||
StorageErrorCodeIncrementalCopySourceMustBeSnapshot,
|
||||
StorageErrorCodeInfiniteLeaseDurationRequired,
|
||||
StorageErrorCodeInsufficientAccountPermissions,
|
||||
StorageErrorCodeInternalError,
|
||||
StorageErrorCodeInvalidAuthenticationInfo,
|
||||
StorageErrorCodeInvalidBlobOrBlock,
|
||||
StorageErrorCodeInvalidBlobTier,
|
||||
StorageErrorCodeInvalidBlobType,
|
||||
StorageErrorCodeInvalidBlockID,
|
||||
StorageErrorCodeInvalidBlockList,
|
||||
StorageErrorCodeInvalidHTTPVerb,
|
||||
StorageErrorCodeInvalidHeaderValue,
|
||||
StorageErrorCodeInvalidInput,
|
||||
StorageErrorCodeInvalidMD5,
|
||||
StorageErrorCodeInvalidMetadata,
|
||||
StorageErrorCodeInvalidOperation,
|
||||
StorageErrorCodeInvalidPageRange,
|
||||
StorageErrorCodeInvalidQueryParameterValue,
|
||||
StorageErrorCodeInvalidRange,
|
||||
StorageErrorCodeInvalidResourceName,
|
||||
StorageErrorCodeInvalidSourceBlobType,
|
||||
StorageErrorCodeInvalidSourceBlobURL,
|
||||
StorageErrorCodeInvalidURI,
|
||||
StorageErrorCodeInvalidVersionForPageBlobOperation,
|
||||
StorageErrorCodeInvalidXMLDocument,
|
||||
StorageErrorCodeInvalidXMLNodeValue,
|
||||
StorageErrorCodeLeaseAlreadyBroken,
|
||||
StorageErrorCodeLeaseAlreadyPresent,
|
||||
StorageErrorCodeLeaseIDMismatchWithBlobOperation,
|
||||
StorageErrorCodeLeaseIDMismatchWithContainerOperation,
|
||||
StorageErrorCodeLeaseIDMismatchWithLeaseOperation,
|
||||
StorageErrorCodeLeaseIDMissing,
|
||||
StorageErrorCodeLeaseIsBreakingAndCannotBeAcquired,
|
||||
StorageErrorCodeLeaseIsBreakingAndCannotBeChanged,
|
||||
StorageErrorCodeLeaseIsBrokenAndCannotBeRenewed,
|
||||
StorageErrorCodeLeaseLost,
|
||||
StorageErrorCodeLeaseNotPresentWithBlobOperation,
|
||||
StorageErrorCodeLeaseNotPresentWithContainerOperation,
|
||||
StorageErrorCodeLeaseNotPresentWithLeaseOperation,
|
||||
StorageErrorCodeMD5Mismatch,
|
||||
StorageErrorCodeMaxBlobSizeConditionNotMet,
|
||||
StorageErrorCodeMetadataTooLarge,
|
||||
StorageErrorCodeMissingContentLengthHeader,
|
||||
StorageErrorCodeMissingRequiredHeader,
|
||||
StorageErrorCodeMissingRequiredQueryParameter,
|
||||
StorageErrorCodeMissingRequiredXMLNode,
|
||||
StorageErrorCodeMultipleConditionHeadersNotSupported,
|
||||
StorageErrorCodeNoAuthenticationInformation,
|
||||
StorageErrorCodeNoPendingCopyOperation,
|
||||
StorageErrorCodeOperationNotAllowedOnIncrementalCopyBlob,
|
||||
StorageErrorCodeOperationTimedOut,
|
||||
StorageErrorCodeOutOfRangeInput,
|
||||
StorageErrorCodeOutOfRangeQueryParameterValue,
|
||||
StorageErrorCodePendingCopyOperation,
|
||||
StorageErrorCodePreviousSnapshotCannotBeNewer,
|
||||
StorageErrorCodePreviousSnapshotNotFound,
|
||||
StorageErrorCodePreviousSnapshotOperationNotSupported,
|
||||
StorageErrorCodeRequestBodyTooLarge,
|
||||
StorageErrorCodeRequestURLFailedToParse,
|
||||
StorageErrorCodeResourceAlreadyExists,
|
||||
StorageErrorCodeResourceNotFound,
|
||||
StorageErrorCodeResourceTypeMismatch,
|
||||
StorageErrorCodeSequenceNumberConditionNotMet,
|
||||
StorageErrorCodeSequenceNumberIncrementTooLarge,
|
||||
StorageErrorCodeServerBusy,
|
||||
StorageErrorCodeSnapshotCountExceeded,
|
||||
StorageErrorCodeSnapshotOperationRateExceeded,
|
||||
StorageErrorCodeSnapshotsPresent,
|
||||
StorageErrorCodeSourceConditionNotMet,
|
||||
StorageErrorCodeSystemInUse,
|
||||
StorageErrorCodeTargetConditionNotMet,
|
||||
StorageErrorCodeUnauthorizedBlobOverwrite,
|
||||
StorageErrorCodeUnsupportedHTTPVerb,
|
||||
StorageErrorCodeUnsupportedHeader,
|
||||
StorageErrorCodeUnsupportedQueryParameter,
|
||||
StorageErrorCodeUnsupportedXMLNode,
|
||||
}
|
||||
}
|
1591
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/zz_container_client.go
сгенерированный
поставляемый
Normal file
1591
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/zz_container_client.go
сгенерированный
поставляемый
Normal file
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
544
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/zz_models.go
сгенерированный
поставляемый
Normal file
544
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/zz_models.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,544 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package generated
|
||||
|
||||
import (
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"time"
|
||||
)
|
||||
|
||||
// AccessPolicy - An Access policy
|
||||
type AccessPolicy struct {
|
||||
// the date-time the policy expires
|
||||
Expiry *time.Time `xml:"Expiry"`
|
||||
|
||||
// the permissions for the acl policy
|
||||
Permission *string `xml:"Permission"`
|
||||
|
||||
// the date-time the policy is active
|
||||
Start *time.Time `xml:"Start"`
|
||||
}
|
||||
|
||||
// ArrowConfiguration - Groups the settings used for formatting the response if the response should be Arrow formatted.
|
||||
type ArrowConfiguration struct {
|
||||
// REQUIRED
|
||||
Schema []*ArrowField `xml:"Schema>Field"`
|
||||
}
|
||||
|
||||
// ArrowField - Groups settings regarding specific field of an arrow schema
|
||||
type ArrowField struct {
|
||||
// REQUIRED
|
||||
Type *string `xml:"Type"`
|
||||
Name *string `xml:"Name"`
|
||||
Precision *int32 `xml:"Precision"`
|
||||
Scale *int32 `xml:"Scale"`
|
||||
}
|
||||
|
||||
type BlobFlatListSegment struct {
|
||||
// REQUIRED
|
||||
BlobItems []*BlobItem `xml:"Blob"`
|
||||
}
|
||||
|
||||
type BlobHierarchyListSegment struct {
|
||||
// REQUIRED
|
||||
BlobItems []*BlobItem `xml:"Blob"`
|
||||
BlobPrefixes []*BlobPrefix `xml:"BlobPrefix"`
|
||||
}
|
||||
|
||||
// BlobItem - An Azure Storage blob
|
||||
type BlobItem struct {
|
||||
// REQUIRED
|
||||
Deleted *bool `xml:"Deleted"`
|
||||
|
||||
// REQUIRED
|
||||
Name *string `xml:"Name"`
|
||||
|
||||
// REQUIRED; Properties of a blob
|
||||
Properties *BlobProperties `xml:"Properties"`
|
||||
|
||||
// REQUIRED
|
||||
Snapshot *string `xml:"Snapshot"`
|
||||
|
||||
// Blob tags
|
||||
BlobTags *BlobTags `xml:"Tags"`
|
||||
HasVersionsOnly *bool `xml:"HasVersionsOnly"`
|
||||
IsCurrentVersion *bool `xml:"IsCurrentVersion"`
|
||||
|
||||
// Dictionary of
|
||||
Metadata map[string]*string `xml:"Metadata"`
|
||||
|
||||
// Dictionary of
|
||||
OrMetadata map[string]*string `xml:"OrMetadata"`
|
||||
VersionID *string `xml:"VersionId"`
|
||||
}
|
||||
|
||||
type BlobName struct {
|
||||
// The name of the blob.
|
||||
Content *string `xml:",chardata"`
|
||||
|
||||
// Indicates if the blob name is encoded.
|
||||
Encoded *bool `xml:"Encoded,attr"`
|
||||
}
|
||||
|
||||
type BlobPrefix struct {
|
||||
// REQUIRED
|
||||
Name *string `xml:"Name"`
|
||||
}
|
||||
|
||||
// BlobProperties - Properties of a blob
|
||||
type BlobProperties struct {
|
||||
// REQUIRED
|
||||
ETag *azcore.ETag `xml:"Etag"`
|
||||
|
||||
// REQUIRED
|
||||
LastModified *time.Time `xml:"Last-Modified"`
|
||||
AccessTier *AccessTier `xml:"AccessTier"`
|
||||
AccessTierChangeTime *time.Time `xml:"AccessTierChangeTime"`
|
||||
AccessTierInferred *bool `xml:"AccessTierInferred"`
|
||||
ArchiveStatus *ArchiveStatus `xml:"ArchiveStatus"`
|
||||
BlobSequenceNumber *int64 `xml:"x-ms-blob-sequence-number"`
|
||||
BlobType *BlobType `xml:"BlobType"`
|
||||
CacheControl *string `xml:"Cache-Control"`
|
||||
ContentDisposition *string `xml:"Content-Disposition"`
|
||||
ContentEncoding *string `xml:"Content-Encoding"`
|
||||
ContentLanguage *string `xml:"Content-Language"`
|
||||
|
||||
// Size in bytes
|
||||
ContentLength *int64 `xml:"Content-Length"`
|
||||
ContentMD5 []byte `xml:"Content-MD5"`
|
||||
ContentType *string `xml:"Content-Type"`
|
||||
CopyCompletionTime *time.Time `xml:"CopyCompletionTime"`
|
||||
CopyID *string `xml:"CopyId"`
|
||||
CopyProgress *string `xml:"CopyProgress"`
|
||||
CopySource *string `xml:"CopySource"`
|
||||
CopyStatus *CopyStatusType `xml:"CopyStatus"`
|
||||
CopyStatusDescription *string `xml:"CopyStatusDescription"`
|
||||
CreationTime *time.Time `xml:"Creation-Time"`
|
||||
CustomerProvidedKeySHA256 *string `xml:"CustomerProvidedKeySha256"`
|
||||
DeletedTime *time.Time `xml:"DeletedTime"`
|
||||
DestinationSnapshot *string `xml:"DestinationSnapshot"`
|
||||
|
||||
// The name of the encryption scope under which the blob is encrypted.
|
||||
EncryptionScope *string `xml:"EncryptionScope"`
|
||||
ExpiresOn *time.Time `xml:"Expiry-Time"`
|
||||
ImmutabilityPolicyExpiresOn *time.Time `xml:"ImmutabilityPolicyUntilDate"`
|
||||
ImmutabilityPolicyMode *ImmutabilityPolicyMode `xml:"ImmutabilityPolicyMode"`
|
||||
IncrementalCopy *bool `xml:"IncrementalCopy"`
|
||||
IsSealed *bool `xml:"Sealed"`
|
||||
LastAccessedOn *time.Time `xml:"LastAccessTime"`
|
||||
LeaseDuration *LeaseDurationType `xml:"LeaseDuration"`
|
||||
LeaseState *LeaseStateType `xml:"LeaseState"`
|
||||
LeaseStatus *LeaseStatusType `xml:"LeaseStatus"`
|
||||
LegalHold *bool `xml:"LegalHold"`
|
||||
|
||||
// If an object is in rehydrate pending state then this header is returned with priority of rehydrate. Valid values are High
|
||||
// and Standard.
|
||||
RehydratePriority *RehydratePriority `xml:"RehydratePriority"`
|
||||
RemainingRetentionDays *int32 `xml:"RemainingRetentionDays"`
|
||||
ServerEncrypted *bool `xml:"ServerEncrypted"`
|
||||
TagCount *int32 `xml:"TagCount"`
|
||||
}
|
||||
|
||||
type BlobTag struct {
|
||||
// REQUIRED
|
||||
Key *string `xml:"Key"`
|
||||
|
||||
// REQUIRED
|
||||
Value *string `xml:"Value"`
|
||||
}
|
||||
|
||||
// BlobTags - Blob tags
|
||||
type BlobTags struct {
|
||||
// REQUIRED
|
||||
BlobTagSet []*BlobTag `xml:"TagSet>Tag"`
|
||||
}
|
||||
|
||||
// Block - Represents a single block in a block blob. It describes the block's ID and size.
|
||||
type Block struct {
|
||||
// REQUIRED; The base64 encoded block ID.
|
||||
Name *string `xml:"Name"`
|
||||
|
||||
// REQUIRED; The block size in bytes.
|
||||
Size *int64 `xml:"Size"`
|
||||
}
|
||||
|
||||
type BlockList struct {
|
||||
CommittedBlocks []*Block `xml:"CommittedBlocks>Block"`
|
||||
UncommittedBlocks []*Block `xml:"UncommittedBlocks>Block"`
|
||||
}
|
||||
|
||||
type BlockLookupList struct {
|
||||
Committed []*string `xml:"Committed"`
|
||||
Latest []*string `xml:"Latest"`
|
||||
Uncommitted []*string `xml:"Uncommitted"`
|
||||
}
|
||||
|
||||
type ClearRange struct {
|
||||
// REQUIRED
|
||||
End *int64 `xml:"End"`
|
||||
|
||||
// REQUIRED
|
||||
Start *int64 `xml:"Start"`
|
||||
}
|
||||
|
||||
// ContainerItem - An Azure Storage container
|
||||
type ContainerItem struct {
|
||||
// REQUIRED
|
||||
Name *string `xml:"Name"`
|
||||
|
||||
// REQUIRED; Properties of a container
|
||||
Properties *ContainerProperties `xml:"Properties"`
|
||||
Deleted *bool `xml:"Deleted"`
|
||||
|
||||
// Dictionary of
|
||||
Metadata map[string]*string `xml:"Metadata"`
|
||||
Version *string `xml:"Version"`
|
||||
}
|
||||
|
||||
// ContainerProperties - Properties of a container
|
||||
type ContainerProperties struct {
|
||||
// REQUIRED
|
||||
ETag *azcore.ETag `xml:"Etag"`
|
||||
|
||||
// REQUIRED
|
||||
LastModified *time.Time `xml:"Last-Modified"`
|
||||
DefaultEncryptionScope *string `xml:"DefaultEncryptionScope"`
|
||||
DeletedTime *time.Time `xml:"DeletedTime"`
|
||||
HasImmutabilityPolicy *bool `xml:"HasImmutabilityPolicy"`
|
||||
HasLegalHold *bool `xml:"HasLegalHold"`
|
||||
|
||||
// Indicates if version level worm is enabled on this container.
|
||||
IsImmutableStorageWithVersioningEnabled *bool `xml:"ImmutableStorageWithVersioningEnabled"`
|
||||
LeaseDuration *LeaseDurationType `xml:"LeaseDuration"`
|
||||
LeaseState *LeaseStateType `xml:"LeaseState"`
|
||||
LeaseStatus *LeaseStatusType `xml:"LeaseStatus"`
|
||||
PreventEncryptionScopeOverride *bool `xml:"DenyEncryptionScopeOverride"`
|
||||
PublicAccess *PublicAccessType `xml:"PublicAccess"`
|
||||
RemainingRetentionDays *int32 `xml:"RemainingRetentionDays"`
|
||||
}
|
||||
|
||||
// CORSRule - CORS is an HTTP feature that enables a web application running under one domain to access resources in another
|
||||
// domain. Web browsers implement a security restriction known as same-origin policy that
|
||||
// prevents a web page from calling APIs in a different domain; CORS provides a secure way to allow one domain (the origin
|
||||
// domain) to call APIs in another domain
|
||||
type CORSRule struct {
|
||||
// REQUIRED; the request headers that the origin domain may specify on the CORS request.
|
||||
AllowedHeaders *string `xml:"AllowedHeaders"`
|
||||
|
||||
// REQUIRED; The methods (HTTP request verbs) that the origin domain may use for a CORS request. (comma separated)
|
||||
AllowedMethods *string `xml:"AllowedMethods"`
|
||||
|
||||
// REQUIRED; The origin domains that are permitted to make a request against the storage service via CORS. The origin domain
|
||||
// is the domain from which the request originates. Note that the origin must be an exact
|
||||
// case-sensitive match with the origin that the user age sends to the service. You can also use the wildcard character '*'
|
||||
// to allow all origin domains to make requests via CORS.
|
||||
AllowedOrigins *string `xml:"AllowedOrigins"`
|
||||
|
||||
// REQUIRED; The response headers that may be sent in the response to the CORS request and exposed by the browser to the request
|
||||
// issuer
|
||||
ExposedHeaders *string `xml:"ExposedHeaders"`
|
||||
|
||||
// REQUIRED; The maximum amount time that a browser should cache the preflight OPTIONS request.
|
||||
MaxAgeInSeconds *int32 `xml:"MaxAgeInSeconds"`
|
||||
}
|
||||
|
||||
// DelimitedTextConfiguration - Groups the settings used for interpreting the blob data if the blob is delimited text formatted.
|
||||
type DelimitedTextConfiguration struct {
|
||||
// The string used to separate columns.
|
||||
ColumnSeparator *string `xml:"ColumnSeparator"`
|
||||
|
||||
// The string used as an escape character.
|
||||
EscapeChar *string `xml:"EscapeChar"`
|
||||
|
||||
// The string used to quote a specific field.
|
||||
FieldQuote *string `xml:"FieldQuote"`
|
||||
|
||||
// Represents whether the data has headers.
|
||||
HeadersPresent *bool `xml:"HasHeaders"`
|
||||
|
||||
// The string used to separate records.
|
||||
RecordSeparator *string `xml:"RecordSeparator"`
|
||||
}
|
||||
|
||||
// FilterBlobItem - Blob info from a Filter Blobs API call
|
||||
type FilterBlobItem struct {
|
||||
// REQUIRED
|
||||
ContainerName *string `xml:"ContainerName"`
|
||||
|
||||
// REQUIRED
|
||||
Name *string `xml:"Name"`
|
||||
IsCurrentVersion *bool `xml:"IsCurrentVersion"`
|
||||
|
||||
// Blob tags
|
||||
Tags *BlobTags `xml:"Tags"`
|
||||
VersionID *string `xml:"VersionId"`
|
||||
}
|
||||
|
||||
// FilterBlobSegment - The result of a Filter Blobs API call
|
||||
type FilterBlobSegment struct {
|
||||
// REQUIRED
|
||||
Blobs []*FilterBlobItem `xml:"Blobs>Blob"`
|
||||
|
||||
// REQUIRED
|
||||
ServiceEndpoint *string `xml:"ServiceEndpoint,attr"`
|
||||
|
||||
// REQUIRED
|
||||
Where *string `xml:"Where"`
|
||||
NextMarker *string `xml:"NextMarker"`
|
||||
}
|
||||
|
||||
// GeoReplication - Geo-Replication information for the Secondary Storage Service
|
||||
type GeoReplication struct {
|
||||
// REQUIRED; A GMT date/time value, to the second. All primary writes preceding this value are guaranteed to be available
|
||||
// for read operations at the secondary. Primary writes after this point in time may or may
|
||||
// not be available for reads.
|
||||
LastSyncTime *time.Time `xml:"LastSyncTime"`
|
||||
|
||||
// REQUIRED; The status of the secondary location
|
||||
Status *BlobGeoReplicationStatus `xml:"Status"`
|
||||
}
|
||||
|
||||
// JSONTextConfiguration - json text configuration
|
||||
type JSONTextConfiguration struct {
|
||||
// The string used to separate records.
|
||||
RecordSeparator *string `xml:"RecordSeparator"`
|
||||
}
|
||||
|
||||
// KeyInfo - Key information
|
||||
type KeyInfo struct {
|
||||
// REQUIRED; The date-time the key expires in ISO 8601 UTC time
|
||||
Expiry *string `xml:"Expiry"`
|
||||
|
||||
// REQUIRED; The date-time the key is active in ISO 8601 UTC time
|
||||
Start *string `xml:"Start"`
|
||||
}
|
||||
|
||||
// ListBlobsFlatSegmentResponse - An enumeration of blobs
|
||||
type ListBlobsFlatSegmentResponse struct {
|
||||
// REQUIRED
|
||||
ContainerName *string `xml:"ContainerName,attr"`
|
||||
|
||||
// REQUIRED
|
||||
Segment *BlobFlatListSegment `xml:"Blobs"`
|
||||
|
||||
// REQUIRED
|
||||
ServiceEndpoint *string `xml:"ServiceEndpoint,attr"`
|
||||
Marker *string `xml:"Marker"`
|
||||
MaxResults *int32 `xml:"MaxResults"`
|
||||
NextMarker *string `xml:"NextMarker"`
|
||||
Prefix *string `xml:"Prefix"`
|
||||
}
|
||||
|
||||
// ListBlobsHierarchySegmentResponse - An enumeration of blobs
|
||||
type ListBlobsHierarchySegmentResponse struct {
|
||||
// REQUIRED
|
||||
ContainerName *string `xml:"ContainerName,attr"`
|
||||
|
||||
// REQUIRED
|
||||
Segment *BlobHierarchyListSegment `xml:"Blobs"`
|
||||
|
||||
// REQUIRED
|
||||
ServiceEndpoint *string `xml:"ServiceEndpoint,attr"`
|
||||
Delimiter *string `xml:"Delimiter"`
|
||||
Marker *string `xml:"Marker"`
|
||||
MaxResults *int32 `xml:"MaxResults"`
|
||||
NextMarker *string `xml:"NextMarker"`
|
||||
Prefix *string `xml:"Prefix"`
|
||||
}
|
||||
|
||||
// ListContainersSegmentResponse - An enumeration of containers
|
||||
type ListContainersSegmentResponse struct {
|
||||
// REQUIRED
|
||||
ContainerItems []*ContainerItem `xml:"Containers>Container"`
|
||||
|
||||
// REQUIRED
|
||||
ServiceEndpoint *string `xml:"ServiceEndpoint,attr"`
|
||||
Marker *string `xml:"Marker"`
|
||||
MaxResults *int32 `xml:"MaxResults"`
|
||||
NextMarker *string `xml:"NextMarker"`
|
||||
Prefix *string `xml:"Prefix"`
|
||||
}
|
||||
|
||||
// Logging - Azure Analytics Logging settings.
|
||||
type Logging struct {
|
||||
// REQUIRED; Indicates whether all delete requests should be logged.
|
||||
Delete *bool `xml:"Delete"`
|
||||
|
||||
// REQUIRED; Indicates whether all read requests should be logged.
|
||||
Read *bool `xml:"Read"`
|
||||
|
||||
// REQUIRED; the retention policy which determines how long the associated data should persist
|
||||
RetentionPolicy *RetentionPolicy `xml:"RetentionPolicy"`
|
||||
|
||||
// REQUIRED; The version of Storage Analytics to configure.
|
||||
Version *string `xml:"Version"`
|
||||
|
||||
// REQUIRED; Indicates whether all write requests should be logged.
|
||||
Write *bool `xml:"Write"`
|
||||
}
|
||||
|
||||
// Metrics - a summary of request statistics grouped by API in hour or minute aggregates for blobs
|
||||
type Metrics struct {
|
||||
// REQUIRED; Indicates whether metrics are enabled for the Blob service.
|
||||
Enabled *bool `xml:"Enabled"`
|
||||
|
||||
// Indicates whether metrics should generate summary statistics for called API operations.
|
||||
IncludeAPIs *bool `xml:"IncludeAPIs"`
|
||||
|
||||
// the retention policy which determines how long the associated data should persist
|
||||
RetentionPolicy *RetentionPolicy `xml:"RetentionPolicy"`
|
||||
|
||||
// The version of Storage Analytics to configure.
|
||||
Version *string `xml:"Version"`
|
||||
}
|
||||
|
||||
// PageList - the list of pages
|
||||
type PageList struct {
|
||||
ClearRange []*ClearRange `xml:"ClearRange"`
|
||||
NextMarker *string `xml:"NextMarker"`
|
||||
PageRange []*PageRange `xml:"PageRange"`
|
||||
}
|
||||
|
||||
type PageRange struct {
|
||||
// REQUIRED
|
||||
End *int64 `xml:"End"`
|
||||
|
||||
// REQUIRED
|
||||
Start *int64 `xml:"Start"`
|
||||
}
|
||||
|
||||
type QueryFormat struct {
|
||||
// REQUIRED; The quick query format type.
|
||||
Type *QueryFormatType `xml:"Type"`
|
||||
|
||||
// Groups the settings used for formatting the response if the response should be Arrow formatted.
|
||||
ArrowConfiguration *ArrowConfiguration `xml:"ArrowConfiguration"`
|
||||
|
||||
// Groups the settings used for interpreting the blob data if the blob is delimited text formatted.
|
||||
DelimitedTextConfiguration *DelimitedTextConfiguration `xml:"DelimitedTextConfiguration"`
|
||||
|
||||
// json text configuration
|
||||
JSONTextConfiguration *JSONTextConfiguration `xml:"JsonTextConfiguration"`
|
||||
|
||||
// parquet configuration
|
||||
ParquetTextConfiguration any `xml:"ParquetTextConfiguration"`
|
||||
}
|
||||
|
||||
// QueryRequest - Groups the set of query request settings.
|
||||
type QueryRequest struct {
|
||||
// REQUIRED; The query expression in SQL. The maximum size of the query expression is 256KiB.
|
||||
Expression *string `xml:"Expression"`
|
||||
|
||||
// CONSTANT; Required. The type of the provided query expression.
|
||||
// Field has constant value "SQL", any specified value is ignored.
|
||||
QueryType *string `xml:"QueryType"`
|
||||
InputSerialization *QuerySerialization `xml:"InputSerialization"`
|
||||
OutputSerialization *QuerySerialization `xml:"OutputSerialization"`
|
||||
}
|
||||
|
||||
type QuerySerialization struct {
|
||||
// REQUIRED
|
||||
Format *QueryFormat `xml:"Format"`
|
||||
}
|
||||
|
||||
// RetentionPolicy - the retention policy which determines how long the associated data should persist
|
||||
type RetentionPolicy struct {
|
||||
// REQUIRED; Indicates whether a retention policy is enabled for the storage service
|
||||
Enabled *bool `xml:"Enabled"`
|
||||
|
||||
// Indicates whether permanent delete is allowed on this storage account.
|
||||
AllowPermanentDelete *bool `xml:"AllowPermanentDelete"`
|
||||
|
||||
// Indicates the number of days that metrics or logging or soft-deleted data should be retained. All data older than this
|
||||
// value will be deleted
|
||||
Days *int32 `xml:"Days"`
|
||||
}
|
||||
|
||||
// SignedIdentifier - signed identifier
|
||||
type SignedIdentifier struct {
|
||||
// REQUIRED; An Access policy
|
||||
AccessPolicy *AccessPolicy `xml:"AccessPolicy"`
|
||||
|
||||
// REQUIRED; a unique id
|
||||
ID *string `xml:"Id"`
|
||||
}
|
||||
|
||||
// StaticWebsite - The properties that enable an account to host a static website
|
||||
type StaticWebsite struct {
|
||||
// REQUIRED; Indicates whether this account is hosting a static website
|
||||
Enabled *bool `xml:"Enabled"`
|
||||
|
||||
// Absolute path of the default index page
|
||||
DefaultIndexDocumentPath *string `xml:"DefaultIndexDocumentPath"`
|
||||
|
||||
// The absolute path of the custom 404 page
|
||||
ErrorDocument404Path *string `xml:"ErrorDocument404Path"`
|
||||
|
||||
// The default name of the index page under each directory
|
||||
IndexDocument *string `xml:"IndexDocument"`
|
||||
}
|
||||
|
||||
type StorageError struct {
|
||||
Message *string
|
||||
}
|
||||
|
||||
// StorageServiceProperties - Storage Service Properties.
|
||||
type StorageServiceProperties struct {
|
||||
// The set of CORS rules.
|
||||
CORS []*CORSRule `xml:"Cors>CorsRule"`
|
||||
|
||||
// The default version to use for requests to the Blob service if an incoming request's version is not specified. Possible
|
||||
// values include version 2008-10-27 and all more recent versions
|
||||
DefaultServiceVersion *string `xml:"DefaultServiceVersion"`
|
||||
|
||||
// the retention policy which determines how long the associated data should persist
|
||||
DeleteRetentionPolicy *RetentionPolicy `xml:"DeleteRetentionPolicy"`
|
||||
|
||||
// a summary of request statistics grouped by API in hour or minute aggregates for blobs
|
||||
HourMetrics *Metrics `xml:"HourMetrics"`
|
||||
|
||||
// Azure Analytics Logging settings.
|
||||
Logging *Logging `xml:"Logging"`
|
||||
|
||||
// a summary of request statistics grouped by API in hour or minute aggregates for blobs
|
||||
MinuteMetrics *Metrics `xml:"MinuteMetrics"`
|
||||
|
||||
// The properties that enable an account to host a static website
|
||||
StaticWebsite *StaticWebsite `xml:"StaticWebsite"`
|
||||
}
|
||||
|
||||
// StorageServiceStats - Stats for the storage service.
|
||||
type StorageServiceStats struct {
|
||||
// Geo-Replication information for the Secondary Storage Service
|
||||
GeoReplication *GeoReplication `xml:"GeoReplication"`
|
||||
}
|
||||
|
||||
// UserDelegationKey - A user delegation key
|
||||
type UserDelegationKey struct {
|
||||
// REQUIRED; The date-time the key expires
|
||||
SignedExpiry *time.Time `xml:"SignedExpiry"`
|
||||
|
||||
// REQUIRED; The Azure Active Directory object ID in GUID format.
|
||||
SignedOID *string `xml:"SignedOid"`
|
||||
|
||||
// REQUIRED; Abbreviation of the Azure Storage service that accepts the key
|
||||
SignedService *string `xml:"SignedService"`
|
||||
|
||||
// REQUIRED; The date-time the key is active
|
||||
SignedStart *time.Time `xml:"SignedStart"`
|
||||
|
||||
// REQUIRED; The Azure Active Directory tenant ID in GUID format
|
||||
SignedTID *string `xml:"SignedTid"`
|
||||
|
||||
// REQUIRED; The service version that created the key
|
||||
SignedVersion *string `xml:"SignedVersion"`
|
||||
|
||||
// REQUIRED; The key as a base64 string
|
||||
Value *string `xml:"Value"`
|
||||
}
|
472
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/zz_models_serde.go
сгенерированный
поставляемый
Normal file
472
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/zz_models_serde.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,472 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package generated
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"reflect"
|
||||
"time"
|
||||
)
|
||||
|
||||
// MarshalXML implements the xml.Marshaller interface for type AccessPolicy.
|
||||
func (a AccessPolicy) MarshalXML(enc *xml.Encoder, start xml.StartElement) error {
|
||||
type alias AccessPolicy
|
||||
aux := &struct {
|
||||
*alias
|
||||
Expiry *dateTimeRFC3339 `xml:"Expiry"`
|
||||
Start *dateTimeRFC3339 `xml:"Start"`
|
||||
}{
|
||||
alias: (*alias)(&a),
|
||||
Expiry: (*dateTimeRFC3339)(a.Expiry),
|
||||
Start: (*dateTimeRFC3339)(a.Start),
|
||||
}
|
||||
return enc.EncodeElement(aux, start)
|
||||
}
|
||||
|
||||
// UnmarshalXML implements the xml.Unmarshaller interface for type AccessPolicy.
|
||||
func (a *AccessPolicy) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error {
|
||||
type alias AccessPolicy
|
||||
aux := &struct {
|
||||
*alias
|
||||
Expiry *dateTimeRFC3339 `xml:"Expiry"`
|
||||
Start *dateTimeRFC3339 `xml:"Start"`
|
||||
}{
|
||||
alias: (*alias)(a),
|
||||
}
|
||||
if err := dec.DecodeElement(aux, &start); err != nil {
|
||||
return err
|
||||
}
|
||||
a.Expiry = (*time.Time)(aux.Expiry)
|
||||
a.Start = (*time.Time)(aux.Start)
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalXML implements the xml.Marshaller interface for type ArrowConfiguration.
|
||||
func (a ArrowConfiguration) MarshalXML(enc *xml.Encoder, start xml.StartElement) error {
|
||||
type alias ArrowConfiguration
|
||||
aux := &struct {
|
||||
*alias
|
||||
Schema *[]*ArrowField `xml:"Schema>Field"`
|
||||
}{
|
||||
alias: (*alias)(&a),
|
||||
}
|
||||
if a.Schema != nil {
|
||||
aux.Schema = &a.Schema
|
||||
}
|
||||
return enc.EncodeElement(aux, start)
|
||||
}
|
||||
|
||||
// MarshalXML implements the xml.Marshaller interface for type BlobFlatListSegment.
|
||||
func (b BlobFlatListSegment) MarshalXML(enc *xml.Encoder, start xml.StartElement) error {
|
||||
type alias BlobFlatListSegment
|
||||
aux := &struct {
|
||||
*alias
|
||||
BlobItems *[]*BlobItem `xml:"Blob"`
|
||||
}{
|
||||
alias: (*alias)(&b),
|
||||
}
|
||||
if b.BlobItems != nil {
|
||||
aux.BlobItems = &b.BlobItems
|
||||
}
|
||||
return enc.EncodeElement(aux, start)
|
||||
}
|
||||
|
||||
// MarshalXML implements the xml.Marshaller interface for type BlobHierarchyListSegment.
|
||||
func (b BlobHierarchyListSegment) MarshalXML(enc *xml.Encoder, start xml.StartElement) error {
|
||||
type alias BlobHierarchyListSegment
|
||||
aux := &struct {
|
||||
*alias
|
||||
BlobItems *[]*BlobItem `xml:"Blob"`
|
||||
BlobPrefixes *[]*BlobPrefix `xml:"BlobPrefix"`
|
||||
}{
|
||||
alias: (*alias)(&b),
|
||||
}
|
||||
if b.BlobItems != nil {
|
||||
aux.BlobItems = &b.BlobItems
|
||||
}
|
||||
if b.BlobPrefixes != nil {
|
||||
aux.BlobPrefixes = &b.BlobPrefixes
|
||||
}
|
||||
return enc.EncodeElement(aux, start)
|
||||
}
|
||||
|
||||
// MarshalXML implements the xml.Marshaller interface for type BlobProperties.
|
||||
func (b BlobProperties) MarshalXML(enc *xml.Encoder, start xml.StartElement) error {
|
||||
type alias BlobProperties
|
||||
aux := &struct {
|
||||
*alias
|
||||
AccessTierChangeTime *dateTimeRFC1123 `xml:"AccessTierChangeTime"`
|
||||
ContentMD5 *string `xml:"Content-MD5"`
|
||||
CopyCompletionTime *dateTimeRFC1123 `xml:"CopyCompletionTime"`
|
||||
CreationTime *dateTimeRFC1123 `xml:"Creation-Time"`
|
||||
DeletedTime *dateTimeRFC1123 `xml:"DeletedTime"`
|
||||
ExpiresOn *dateTimeRFC1123 `xml:"Expiry-Time"`
|
||||
ImmutabilityPolicyExpiresOn *dateTimeRFC1123 `xml:"ImmutabilityPolicyUntilDate"`
|
||||
LastAccessedOn *dateTimeRFC1123 `xml:"LastAccessTime"`
|
||||
LastModified *dateTimeRFC1123 `xml:"Last-Modified"`
|
||||
}{
|
||||
alias: (*alias)(&b),
|
||||
AccessTierChangeTime: (*dateTimeRFC1123)(b.AccessTierChangeTime),
|
||||
CopyCompletionTime: (*dateTimeRFC1123)(b.CopyCompletionTime),
|
||||
CreationTime: (*dateTimeRFC1123)(b.CreationTime),
|
||||
DeletedTime: (*dateTimeRFC1123)(b.DeletedTime),
|
||||
ExpiresOn: (*dateTimeRFC1123)(b.ExpiresOn),
|
||||
ImmutabilityPolicyExpiresOn: (*dateTimeRFC1123)(b.ImmutabilityPolicyExpiresOn),
|
||||
LastAccessedOn: (*dateTimeRFC1123)(b.LastAccessedOn),
|
||||
LastModified: (*dateTimeRFC1123)(b.LastModified),
|
||||
}
|
||||
if b.ContentMD5 != nil {
|
||||
encodedContentMD5 := runtime.EncodeByteArray(b.ContentMD5, runtime.Base64StdFormat)
|
||||
aux.ContentMD5 = &encodedContentMD5
|
||||
}
|
||||
return enc.EncodeElement(aux, start)
|
||||
}
|
||||
|
||||
// UnmarshalXML implements the xml.Unmarshaller interface for type BlobProperties.
|
||||
func (b *BlobProperties) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error {
|
||||
type alias BlobProperties
|
||||
aux := &struct {
|
||||
*alias
|
||||
AccessTierChangeTime *dateTimeRFC1123 `xml:"AccessTierChangeTime"`
|
||||
ContentMD5 *string `xml:"Content-MD5"`
|
||||
CopyCompletionTime *dateTimeRFC1123 `xml:"CopyCompletionTime"`
|
||||
CreationTime *dateTimeRFC1123 `xml:"Creation-Time"`
|
||||
DeletedTime *dateTimeRFC1123 `xml:"DeletedTime"`
|
||||
ExpiresOn *dateTimeRFC1123 `xml:"Expiry-Time"`
|
||||
ImmutabilityPolicyExpiresOn *dateTimeRFC1123 `xml:"ImmutabilityPolicyUntilDate"`
|
||||
LastAccessedOn *dateTimeRFC1123 `xml:"LastAccessTime"`
|
||||
LastModified *dateTimeRFC1123 `xml:"Last-Modified"`
|
||||
}{
|
||||
alias: (*alias)(b),
|
||||
}
|
||||
if err := dec.DecodeElement(aux, &start); err != nil {
|
||||
return err
|
||||
}
|
||||
b.AccessTierChangeTime = (*time.Time)(aux.AccessTierChangeTime)
|
||||
if aux.ContentMD5 != nil {
|
||||
if err := runtime.DecodeByteArray(*aux.ContentMD5, &b.ContentMD5, runtime.Base64StdFormat); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
b.CopyCompletionTime = (*time.Time)(aux.CopyCompletionTime)
|
||||
b.CreationTime = (*time.Time)(aux.CreationTime)
|
||||
b.DeletedTime = (*time.Time)(aux.DeletedTime)
|
||||
b.ExpiresOn = (*time.Time)(aux.ExpiresOn)
|
||||
b.ImmutabilityPolicyExpiresOn = (*time.Time)(aux.ImmutabilityPolicyExpiresOn)
|
||||
b.LastAccessedOn = (*time.Time)(aux.LastAccessedOn)
|
||||
b.LastModified = (*time.Time)(aux.LastModified)
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalXML implements the xml.Marshaller interface for type BlobTags.
|
||||
func (b BlobTags) MarshalXML(enc *xml.Encoder, start xml.StartElement) error {
|
||||
start.Name.Local = "Tags"
|
||||
type alias BlobTags
|
||||
aux := &struct {
|
||||
*alias
|
||||
BlobTagSet *[]*BlobTag `xml:"TagSet>Tag"`
|
||||
}{
|
||||
alias: (*alias)(&b),
|
||||
}
|
||||
if b.BlobTagSet != nil {
|
||||
aux.BlobTagSet = &b.BlobTagSet
|
||||
}
|
||||
return enc.EncodeElement(aux, start)
|
||||
}
|
||||
|
||||
// MarshalXML implements the xml.Marshaller interface for type BlockList.
|
||||
func (b BlockList) MarshalXML(enc *xml.Encoder, start xml.StartElement) error {
|
||||
type alias BlockList
|
||||
aux := &struct {
|
||||
*alias
|
||||
CommittedBlocks *[]*Block `xml:"CommittedBlocks>Block"`
|
||||
UncommittedBlocks *[]*Block `xml:"UncommittedBlocks>Block"`
|
||||
}{
|
||||
alias: (*alias)(&b),
|
||||
}
|
||||
if b.CommittedBlocks != nil {
|
||||
aux.CommittedBlocks = &b.CommittedBlocks
|
||||
}
|
||||
if b.UncommittedBlocks != nil {
|
||||
aux.UncommittedBlocks = &b.UncommittedBlocks
|
||||
}
|
||||
return enc.EncodeElement(aux, start)
|
||||
}
|
||||
|
||||
// MarshalXML implements the xml.Marshaller interface for type BlockLookupList.
|
||||
func (b BlockLookupList) MarshalXML(enc *xml.Encoder, start xml.StartElement) error {
|
||||
start.Name.Local = "BlockList"
|
||||
type alias BlockLookupList
|
||||
aux := &struct {
|
||||
*alias
|
||||
Committed *[]*string `xml:"Committed"`
|
||||
Latest *[]*string `xml:"Latest"`
|
||||
Uncommitted *[]*string `xml:"Uncommitted"`
|
||||
}{
|
||||
alias: (*alias)(&b),
|
||||
}
|
||||
if b.Committed != nil {
|
||||
aux.Committed = &b.Committed
|
||||
}
|
||||
if b.Latest != nil {
|
||||
aux.Latest = &b.Latest
|
||||
}
|
||||
if b.Uncommitted != nil {
|
||||
aux.Uncommitted = &b.Uncommitted
|
||||
}
|
||||
return enc.EncodeElement(aux, start)
|
||||
}
|
||||
|
||||
// UnmarshalXML implements the xml.Unmarshaller interface for type ContainerItem.
|
||||
func (c *ContainerItem) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error {
|
||||
type alias ContainerItem
|
||||
aux := &struct {
|
||||
*alias
|
||||
Metadata additionalProperties `xml:"Metadata"`
|
||||
}{
|
||||
alias: (*alias)(c),
|
||||
}
|
||||
if err := dec.DecodeElement(aux, &start); err != nil {
|
||||
return err
|
||||
}
|
||||
c.Metadata = (map[string]*string)(aux.Metadata)
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalXML implements the xml.Marshaller interface for type ContainerProperties.
|
||||
func (c ContainerProperties) MarshalXML(enc *xml.Encoder, start xml.StartElement) error {
|
||||
type alias ContainerProperties
|
||||
aux := &struct {
|
||||
*alias
|
||||
DeletedTime *dateTimeRFC1123 `xml:"DeletedTime"`
|
||||
LastModified *dateTimeRFC1123 `xml:"Last-Modified"`
|
||||
}{
|
||||
alias: (*alias)(&c),
|
||||
DeletedTime: (*dateTimeRFC1123)(c.DeletedTime),
|
||||
LastModified: (*dateTimeRFC1123)(c.LastModified),
|
||||
}
|
||||
return enc.EncodeElement(aux, start)
|
||||
}
|
||||
|
||||
// UnmarshalXML implements the xml.Unmarshaller interface for type ContainerProperties.
|
||||
func (c *ContainerProperties) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error {
|
||||
type alias ContainerProperties
|
||||
aux := &struct {
|
||||
*alias
|
||||
DeletedTime *dateTimeRFC1123 `xml:"DeletedTime"`
|
||||
LastModified *dateTimeRFC1123 `xml:"Last-Modified"`
|
||||
}{
|
||||
alias: (*alias)(c),
|
||||
}
|
||||
if err := dec.DecodeElement(aux, &start); err != nil {
|
||||
return err
|
||||
}
|
||||
c.DeletedTime = (*time.Time)(aux.DeletedTime)
|
||||
c.LastModified = (*time.Time)(aux.LastModified)
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalXML implements the xml.Marshaller interface for type FilterBlobSegment.
|
||||
func (f FilterBlobSegment) MarshalXML(enc *xml.Encoder, start xml.StartElement) error {
|
||||
type alias FilterBlobSegment
|
||||
aux := &struct {
|
||||
*alias
|
||||
Blobs *[]*FilterBlobItem `xml:"Blobs>Blob"`
|
||||
}{
|
||||
alias: (*alias)(&f),
|
||||
}
|
||||
if f.Blobs != nil {
|
||||
aux.Blobs = &f.Blobs
|
||||
}
|
||||
return enc.EncodeElement(aux, start)
|
||||
}
|
||||
|
||||
// MarshalXML implements the xml.Marshaller interface for type GeoReplication.
|
||||
func (g GeoReplication) MarshalXML(enc *xml.Encoder, start xml.StartElement) error {
|
||||
type alias GeoReplication
|
||||
aux := &struct {
|
||||
*alias
|
||||
LastSyncTime *dateTimeRFC1123 `xml:"LastSyncTime"`
|
||||
}{
|
||||
alias: (*alias)(&g),
|
||||
LastSyncTime: (*dateTimeRFC1123)(g.LastSyncTime),
|
||||
}
|
||||
return enc.EncodeElement(aux, start)
|
||||
}
|
||||
|
||||
// UnmarshalXML implements the xml.Unmarshaller interface for type GeoReplication.
|
||||
func (g *GeoReplication) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error {
|
||||
type alias GeoReplication
|
||||
aux := &struct {
|
||||
*alias
|
||||
LastSyncTime *dateTimeRFC1123 `xml:"LastSyncTime"`
|
||||
}{
|
||||
alias: (*alias)(g),
|
||||
}
|
||||
if err := dec.DecodeElement(aux, &start); err != nil {
|
||||
return err
|
||||
}
|
||||
g.LastSyncTime = (*time.Time)(aux.LastSyncTime)
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalXML implements the xml.Marshaller interface for type ListContainersSegmentResponse.
|
||||
func (l ListContainersSegmentResponse) MarshalXML(enc *xml.Encoder, start xml.StartElement) error {
|
||||
type alias ListContainersSegmentResponse
|
||||
aux := &struct {
|
||||
*alias
|
||||
ContainerItems *[]*ContainerItem `xml:"Containers>Container"`
|
||||
}{
|
||||
alias: (*alias)(&l),
|
||||
}
|
||||
if l.ContainerItems != nil {
|
||||
aux.ContainerItems = &l.ContainerItems
|
||||
}
|
||||
return enc.EncodeElement(aux, start)
|
||||
}
|
||||
|
||||
// MarshalXML implements the xml.Marshaller interface for type PageList.
|
||||
func (p PageList) MarshalXML(enc *xml.Encoder, start xml.StartElement) error {
|
||||
type alias PageList
|
||||
aux := &struct {
|
||||
*alias
|
||||
ClearRange *[]*ClearRange `xml:"ClearRange"`
|
||||
PageRange *[]*PageRange `xml:"PageRange"`
|
||||
}{
|
||||
alias: (*alias)(&p),
|
||||
}
|
||||
if p.ClearRange != nil {
|
||||
aux.ClearRange = &p.ClearRange
|
||||
}
|
||||
if p.PageRange != nil {
|
||||
aux.PageRange = &p.PageRange
|
||||
}
|
||||
return enc.EncodeElement(aux, start)
|
||||
}
|
||||
|
||||
// MarshalXML implements the xml.Marshaller interface for type QueryRequest.
|
||||
func (q QueryRequest) MarshalXML(enc *xml.Encoder, start xml.StartElement) error {
|
||||
start.Name.Local = "QueryRequest"
|
||||
type alias QueryRequest
|
||||
aux := &struct {
|
||||
*alias
|
||||
}{
|
||||
alias: (*alias)(&q),
|
||||
}
|
||||
return enc.EncodeElement(aux, start)
|
||||
}
|
||||
|
||||
// MarshalJSON implements the json.Marshaller interface for type StorageError.
|
||||
func (s StorageError) MarshalJSON() ([]byte, error) {
|
||||
objectMap := make(map[string]any)
|
||||
populate(objectMap, "Message", s.Message)
|
||||
return json.Marshal(objectMap)
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements the json.Unmarshaller interface for type StorageError.
|
||||
func (s *StorageError) UnmarshalJSON(data []byte) error {
|
||||
var rawMsg map[string]json.RawMessage
|
||||
if err := json.Unmarshal(data, &rawMsg); err != nil {
|
||||
return fmt.Errorf("unmarshalling type %T: %v", s, err)
|
||||
}
|
||||
for key, val := range rawMsg {
|
||||
var err error
|
||||
switch key {
|
||||
case "Message":
|
||||
err = unpopulate(val, "Message", &s.Message)
|
||||
delete(rawMsg, key)
|
||||
}
|
||||
if err != nil {
|
||||
return fmt.Errorf("unmarshalling type %T: %v", s, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalXML implements the xml.Marshaller interface for type StorageServiceProperties.
|
||||
func (s StorageServiceProperties) MarshalXML(enc *xml.Encoder, start xml.StartElement) error {
|
||||
type alias StorageServiceProperties
|
||||
aux := &struct {
|
||||
*alias
|
||||
CORS *[]*CORSRule `xml:"Cors>CorsRule"`
|
||||
}{
|
||||
alias: (*alias)(&s),
|
||||
}
|
||||
if s.CORS != nil {
|
||||
aux.CORS = &s.CORS
|
||||
}
|
||||
return enc.EncodeElement(aux, start)
|
||||
}
|
||||
|
||||
// MarshalXML implements the xml.Marshaller interface for type UserDelegationKey.
|
||||
func (u UserDelegationKey) MarshalXML(enc *xml.Encoder, start xml.StartElement) error {
|
||||
type alias UserDelegationKey
|
||||
aux := &struct {
|
||||
*alias
|
||||
SignedExpiry *dateTimeRFC3339 `xml:"SignedExpiry"`
|
||||
SignedStart *dateTimeRFC3339 `xml:"SignedStart"`
|
||||
}{
|
||||
alias: (*alias)(&u),
|
||||
SignedExpiry: (*dateTimeRFC3339)(u.SignedExpiry),
|
||||
SignedStart: (*dateTimeRFC3339)(u.SignedStart),
|
||||
}
|
||||
return enc.EncodeElement(aux, start)
|
||||
}
|
||||
|
||||
// UnmarshalXML implements the xml.Unmarshaller interface for type UserDelegationKey.
|
||||
func (u *UserDelegationKey) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error {
|
||||
type alias UserDelegationKey
|
||||
aux := &struct {
|
||||
*alias
|
||||
SignedExpiry *dateTimeRFC3339 `xml:"SignedExpiry"`
|
||||
SignedStart *dateTimeRFC3339 `xml:"SignedStart"`
|
||||
}{
|
||||
alias: (*alias)(u),
|
||||
}
|
||||
if err := dec.DecodeElement(aux, &start); err != nil {
|
||||
return err
|
||||
}
|
||||
u.SignedExpiry = (*time.Time)(aux.SignedExpiry)
|
||||
u.SignedStart = (*time.Time)(aux.SignedStart)
|
||||
return nil
|
||||
}
|
||||
|
||||
func populate(m map[string]any, k string, v any) {
|
||||
if v == nil {
|
||||
return
|
||||
} else if azcore.IsNullValue(v) {
|
||||
m[k] = nil
|
||||
} else if !reflect.ValueOf(v).IsNil() {
|
||||
m[k] = v
|
||||
}
|
||||
}
|
||||
|
||||
func populateAny(m map[string]any, k string, v any) {
|
||||
if v == nil {
|
||||
return
|
||||
} else if azcore.IsNullValue(v) {
|
||||
m[k] = nil
|
||||
} else {
|
||||
m[k] = v
|
||||
}
|
||||
}
|
||||
|
||||
func unpopulate(data json.RawMessage, fn string, v any) error {
|
||||
if data == nil {
|
||||
return nil
|
||||
}
|
||||
if err := json.Unmarshal(data, v); err != nil {
|
||||
return fmt.Errorf("struct field %s: %v", fn, err)
|
||||
}
|
||||
return nil
|
||||
}
|
1469
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/zz_options.go
сгенерированный
поставляемый
Normal file
1469
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/zz_options.go
сгенерированный
поставляемый
Normal file
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
1295
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/zz_pageblob_client.go
сгенерированный
поставляемый
Normal file
1295
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/zz_pageblob_client.go
сгенерированный
поставляемый
Normal file
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
2016
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/zz_response_types.go
сгенерированный
поставляемый
Normal file
2016
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/zz_response_types.go
сгенерированный
поставляемый
Normal file
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
580
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/zz_service_client.go
сгенерированный
поставляемый
Normal file
580
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/zz_service_client.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,580 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package generated
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"io"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// ServiceClient contains the methods for the Service group.
|
||||
// Don't use this type directly, use a constructor function instead.
|
||||
type ServiceClient struct {
|
||||
internal *azcore.Client
|
||||
endpoint string
|
||||
}
|
||||
|
||||
// FilterBlobs - The Filter Blobs operation enables callers to list blobs across all containers whose tags match a given search
|
||||
// expression. Filter blobs searches across all containers within a storage account but can
|
||||
// be scoped within the expression to a single container.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-11-03
|
||||
// - where - Filters the results to return only to return only blobs whose tags match the specified expression.
|
||||
// - options - ServiceClientFilterBlobsOptions contains the optional parameters for the ServiceClient.FilterBlobs method.
|
||||
func (client *ServiceClient) FilterBlobs(ctx context.Context, where string, options *ServiceClientFilterBlobsOptions) (ServiceClientFilterBlobsResponse, error) {
|
||||
var err error
|
||||
req, err := client.filterBlobsCreateRequest(ctx, where, options)
|
||||
if err != nil {
|
||||
return ServiceClientFilterBlobsResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return ServiceClientFilterBlobsResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return ServiceClientFilterBlobsResponse{}, err
|
||||
}
|
||||
resp, err := client.filterBlobsHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// filterBlobsCreateRequest creates the FilterBlobs request.
|
||||
func (client *ServiceClient) filterBlobsCreateRequest(ctx context.Context, where string, options *ServiceClientFilterBlobsOptions) (*policy.Request, error) {
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, client.endpoint)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("comp", "blobs")
|
||||
if options != nil && options.Timeout != nil {
|
||||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
reqQP.Set("where", where)
|
||||
if options != nil && options.Marker != nil {
|
||||
reqQP.Set("marker", *options.Marker)
|
||||
}
|
||||
if options != nil && options.Maxresults != nil {
|
||||
reqQP.Set("maxresults", strconv.FormatInt(int64(*options.Maxresults), 10))
|
||||
}
|
||||
if options != nil && options.Include != nil {
|
||||
reqQP.Set("include", strings.Join(strings.Fields(strings.Trim(fmt.Sprint(options.Include), "[]")), ","))
|
||||
}
|
||||
req.Raw().URL.RawQuery = strings.Replace(reqQP.Encode(), "+", "%20", -1)
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
if options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// filterBlobsHandleResponse handles the FilterBlobs response.
|
||||
func (client *ServiceClient) filterBlobsHandleResponse(resp *http.Response) (ServiceClientFilterBlobsResponse, error) {
|
||||
result := ServiceClientFilterBlobsResponse{}
|
||||
if val := resp.Header.Get("x-ms-client-request-id"); val != "" {
|
||||
result.ClientRequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("Date"); val != "" {
|
||||
date, err := time.Parse(time.RFC1123, val)
|
||||
if err != nil {
|
||||
return ServiceClientFilterBlobsResponse{}, err
|
||||
}
|
||||
result.Date = &date
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.RequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-version"); val != "" {
|
||||
result.Version = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsXML(resp, &result.FilterBlobSegment); err != nil {
|
||||
return ServiceClientFilterBlobsResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// GetAccountInfo - Returns the sku name and account kind
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-11-03
|
||||
// - options - ServiceClientGetAccountInfoOptions contains the optional parameters for the ServiceClient.GetAccountInfo method.
|
||||
func (client *ServiceClient) GetAccountInfo(ctx context.Context, options *ServiceClientGetAccountInfoOptions) (ServiceClientGetAccountInfoResponse, error) {
|
||||
var err error
|
||||
req, err := client.getAccountInfoCreateRequest(ctx, options)
|
||||
if err != nil {
|
||||
return ServiceClientGetAccountInfoResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return ServiceClientGetAccountInfoResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return ServiceClientGetAccountInfoResponse{}, err
|
||||
}
|
||||
resp, err := client.getAccountInfoHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// getAccountInfoCreateRequest creates the GetAccountInfo request.
|
||||
func (client *ServiceClient) getAccountInfoCreateRequest(ctx context.Context, options *ServiceClientGetAccountInfoOptions) (*policy.Request, error) {
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, client.endpoint)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("restype", "account")
|
||||
reqQP.Set("comp", "properties")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// getAccountInfoHandleResponse handles the GetAccountInfo response.
|
||||
func (client *ServiceClient) getAccountInfoHandleResponse(resp *http.Response) (ServiceClientGetAccountInfoResponse, error) {
|
||||
result := ServiceClientGetAccountInfoResponse{}
|
||||
if val := resp.Header.Get("x-ms-account-kind"); val != "" {
|
||||
result.AccountKind = (*AccountKind)(&val)
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-client-request-id"); val != "" {
|
||||
result.ClientRequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("Date"); val != "" {
|
||||
date, err := time.Parse(time.RFC1123, val)
|
||||
if err != nil {
|
||||
return ServiceClientGetAccountInfoResponse{}, err
|
||||
}
|
||||
result.Date = &date
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-is-hns-enabled"); val != "" {
|
||||
isHierarchicalNamespaceEnabled, err := strconv.ParseBool(val)
|
||||
if err != nil {
|
||||
return ServiceClientGetAccountInfoResponse{}, err
|
||||
}
|
||||
result.IsHierarchicalNamespaceEnabled = &isHierarchicalNamespaceEnabled
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.RequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-sku-name"); val != "" {
|
||||
result.SKUName = (*SKUName)(&val)
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-version"); val != "" {
|
||||
result.Version = &val
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// GetProperties - gets the properties of a storage account's Blob service, including properties for Storage Analytics and
|
||||
// CORS (Cross-Origin Resource Sharing) rules.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-11-03
|
||||
// - options - ServiceClientGetPropertiesOptions contains the optional parameters for the ServiceClient.GetProperties method.
|
||||
func (client *ServiceClient) GetProperties(ctx context.Context, options *ServiceClientGetPropertiesOptions) (ServiceClientGetPropertiesResponse, error) {
|
||||
var err error
|
||||
req, err := client.getPropertiesCreateRequest(ctx, options)
|
||||
if err != nil {
|
||||
return ServiceClientGetPropertiesResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return ServiceClientGetPropertiesResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return ServiceClientGetPropertiesResponse{}, err
|
||||
}
|
||||
resp, err := client.getPropertiesHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// getPropertiesCreateRequest creates the GetProperties request.
|
||||
func (client *ServiceClient) getPropertiesCreateRequest(ctx context.Context, options *ServiceClientGetPropertiesOptions) (*policy.Request, error) {
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, client.endpoint)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("restype", "service")
|
||||
reqQP.Set("comp", "properties")
|
||||
if options != nil && options.Timeout != nil {
|
||||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
if options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// getPropertiesHandleResponse handles the GetProperties response.
|
||||
func (client *ServiceClient) getPropertiesHandleResponse(resp *http.Response) (ServiceClientGetPropertiesResponse, error) {
|
||||
result := ServiceClientGetPropertiesResponse{}
|
||||
if val := resp.Header.Get("x-ms-client-request-id"); val != "" {
|
||||
result.ClientRequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.RequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-version"); val != "" {
|
||||
result.Version = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsXML(resp, &result.StorageServiceProperties); err != nil {
|
||||
return ServiceClientGetPropertiesResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// GetStatistics - Retrieves statistics related to replication for the Blob service. It is only available on the secondary
|
||||
// location endpoint when read-access geo-redundant replication is enabled for the storage account.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-11-03
|
||||
// - options - ServiceClientGetStatisticsOptions contains the optional parameters for the ServiceClient.GetStatistics method.
|
||||
func (client *ServiceClient) GetStatistics(ctx context.Context, options *ServiceClientGetStatisticsOptions) (ServiceClientGetStatisticsResponse, error) {
|
||||
var err error
|
||||
req, err := client.getStatisticsCreateRequest(ctx, options)
|
||||
if err != nil {
|
||||
return ServiceClientGetStatisticsResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return ServiceClientGetStatisticsResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return ServiceClientGetStatisticsResponse{}, err
|
||||
}
|
||||
resp, err := client.getStatisticsHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// getStatisticsCreateRequest creates the GetStatistics request.
|
||||
func (client *ServiceClient) getStatisticsCreateRequest(ctx context.Context, options *ServiceClientGetStatisticsOptions) (*policy.Request, error) {
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, client.endpoint)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("restype", "service")
|
||||
reqQP.Set("comp", "stats")
|
||||
if options != nil && options.Timeout != nil {
|
||||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
if options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// getStatisticsHandleResponse handles the GetStatistics response.
|
||||
func (client *ServiceClient) getStatisticsHandleResponse(resp *http.Response) (ServiceClientGetStatisticsResponse, error) {
|
||||
result := ServiceClientGetStatisticsResponse{}
|
||||
if val := resp.Header.Get("x-ms-client-request-id"); val != "" {
|
||||
result.ClientRequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("Date"); val != "" {
|
||||
date, err := time.Parse(time.RFC1123, val)
|
||||
if err != nil {
|
||||
return ServiceClientGetStatisticsResponse{}, err
|
||||
}
|
||||
result.Date = &date
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.RequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-version"); val != "" {
|
||||
result.Version = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsXML(resp, &result.StorageServiceStats); err != nil {
|
||||
return ServiceClientGetStatisticsResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// GetUserDelegationKey - Retrieves a user delegation key for the Blob service. This is only a valid operation when using
|
||||
// bearer token authentication.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-11-03
|
||||
// - keyInfo - Key information
|
||||
// - options - ServiceClientGetUserDelegationKeyOptions contains the optional parameters for the ServiceClient.GetUserDelegationKey
|
||||
// method.
|
||||
func (client *ServiceClient) GetUserDelegationKey(ctx context.Context, keyInfo KeyInfo, options *ServiceClientGetUserDelegationKeyOptions) (ServiceClientGetUserDelegationKeyResponse, error) {
|
||||
var err error
|
||||
req, err := client.getUserDelegationKeyCreateRequest(ctx, keyInfo, options)
|
||||
if err != nil {
|
||||
return ServiceClientGetUserDelegationKeyResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return ServiceClientGetUserDelegationKeyResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return ServiceClientGetUserDelegationKeyResponse{}, err
|
||||
}
|
||||
resp, err := client.getUserDelegationKeyHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// getUserDelegationKeyCreateRequest creates the GetUserDelegationKey request.
|
||||
func (client *ServiceClient) getUserDelegationKeyCreateRequest(ctx context.Context, keyInfo KeyInfo, options *ServiceClientGetUserDelegationKeyOptions) (*policy.Request, error) {
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPost, client.endpoint)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("restype", "service")
|
||||
reqQP.Set("comp", "userdelegationkey")
|
||||
if options != nil && options.Timeout != nil {
|
||||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
if options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
if err := runtime.MarshalAsXML(req, keyInfo); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// getUserDelegationKeyHandleResponse handles the GetUserDelegationKey response.
|
||||
func (client *ServiceClient) getUserDelegationKeyHandleResponse(resp *http.Response) (ServiceClientGetUserDelegationKeyResponse, error) {
|
||||
result := ServiceClientGetUserDelegationKeyResponse{}
|
||||
if val := resp.Header.Get("x-ms-client-request-id"); val != "" {
|
||||
result.ClientRequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("Date"); val != "" {
|
||||
date, err := time.Parse(time.RFC1123, val)
|
||||
if err != nil {
|
||||
return ServiceClientGetUserDelegationKeyResponse{}, err
|
||||
}
|
||||
result.Date = &date
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.RequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-version"); val != "" {
|
||||
result.Version = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsXML(resp, &result.UserDelegationKey); err != nil {
|
||||
return ServiceClientGetUserDelegationKeyResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// NewListContainersSegmentPager - The List Containers Segment operation returns a list of the containers under the specified
|
||||
// account
|
||||
//
|
||||
// Generated from API version 2023-11-03
|
||||
// - options - ServiceClientListContainersSegmentOptions contains the optional parameters for the ServiceClient.NewListContainersSegmentPager
|
||||
// method.
|
||||
//
|
||||
// listContainersSegmentCreateRequest creates the ListContainersSegment request.
|
||||
func (client *ServiceClient) ListContainersSegmentCreateRequest(ctx context.Context, options *ServiceClientListContainersSegmentOptions) (*policy.Request, error) {
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, client.endpoint)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("comp", "list")
|
||||
if options != nil && options.Prefix != nil {
|
||||
reqQP.Set("prefix", *options.Prefix)
|
||||
}
|
||||
if options != nil && options.Marker != nil {
|
||||
reqQP.Set("marker", *options.Marker)
|
||||
}
|
||||
if options != nil && options.Maxresults != nil {
|
||||
reqQP.Set("maxresults", strconv.FormatInt(int64(*options.Maxresults), 10))
|
||||
}
|
||||
if options != nil && options.Include != nil {
|
||||
reqQP.Set("include", strings.Join(strings.Fields(strings.Trim(fmt.Sprint(options.Include), "[]")), ","))
|
||||
}
|
||||
if options != nil && options.Timeout != nil {
|
||||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
if options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// listContainersSegmentHandleResponse handles the ListContainersSegment response.
|
||||
func (client *ServiceClient) ListContainersSegmentHandleResponse(resp *http.Response) (ServiceClientListContainersSegmentResponse, error) {
|
||||
result := ServiceClientListContainersSegmentResponse{}
|
||||
if val := resp.Header.Get("x-ms-client-request-id"); val != "" {
|
||||
result.ClientRequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.RequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-version"); val != "" {
|
||||
result.Version = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsXML(resp, &result.ListContainersSegmentResponse); err != nil {
|
||||
return ServiceClientListContainersSegmentResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// SetProperties - Sets properties for a storage account's Blob service endpoint, including properties for Storage Analytics
|
||||
// and CORS (Cross-Origin Resource Sharing) rules
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-11-03
|
||||
// - storageServiceProperties - The StorageService properties.
|
||||
// - options - ServiceClientSetPropertiesOptions contains the optional parameters for the ServiceClient.SetProperties method.
|
||||
func (client *ServiceClient) SetProperties(ctx context.Context, storageServiceProperties StorageServiceProperties, options *ServiceClientSetPropertiesOptions) (ServiceClientSetPropertiesResponse, error) {
|
||||
var err error
|
||||
req, err := client.setPropertiesCreateRequest(ctx, storageServiceProperties, options)
|
||||
if err != nil {
|
||||
return ServiceClientSetPropertiesResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return ServiceClientSetPropertiesResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusAccepted) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return ServiceClientSetPropertiesResponse{}, err
|
||||
}
|
||||
resp, err := client.setPropertiesHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// setPropertiesCreateRequest creates the SetProperties request.
|
||||
func (client *ServiceClient) setPropertiesCreateRequest(ctx context.Context, storageServiceProperties StorageServiceProperties, options *ServiceClientSetPropertiesOptions) (*policy.Request, error) {
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPut, client.endpoint)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("restype", "service")
|
||||
reqQP.Set("comp", "properties")
|
||||
if options != nil && options.Timeout != nil {
|
||||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
if options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
if err := runtime.MarshalAsXML(req, storageServiceProperties); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// setPropertiesHandleResponse handles the SetProperties response.
|
||||
func (client *ServiceClient) setPropertiesHandleResponse(resp *http.Response) (ServiceClientSetPropertiesResponse, error) {
|
||||
result := ServiceClientSetPropertiesResponse{}
|
||||
if val := resp.Header.Get("x-ms-client-request-id"); val != "" {
|
||||
result.ClientRequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.RequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-version"); val != "" {
|
||||
result.Version = &val
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// SubmitBatch - The Batch operation allows multiple API calls to be embedded into a single HTTP request.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-11-03
|
||||
// - contentLength - The length of the request.
|
||||
// - multipartContentType - Required. The value of this header must be multipart/mixed with a batch boundary. Example header
|
||||
// value: multipart/mixed; boundary=batch_
|
||||
// - body - Initial data
|
||||
// - options - ServiceClientSubmitBatchOptions contains the optional parameters for the ServiceClient.SubmitBatch method.
|
||||
func (client *ServiceClient) SubmitBatch(ctx context.Context, contentLength int64, multipartContentType string, body io.ReadSeekCloser, options *ServiceClientSubmitBatchOptions) (ServiceClientSubmitBatchResponse, error) {
|
||||
var err error
|
||||
req, err := client.submitBatchCreateRequest(ctx, contentLength, multipartContentType, body, options)
|
||||
if err != nil {
|
||||
return ServiceClientSubmitBatchResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return ServiceClientSubmitBatchResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusAccepted) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return ServiceClientSubmitBatchResponse{}, err
|
||||
}
|
||||
resp, err := client.submitBatchHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// submitBatchCreateRequest creates the SubmitBatch request.
|
||||
func (client *ServiceClient) submitBatchCreateRequest(ctx context.Context, contentLength int64, multipartContentType string, body io.ReadSeekCloser, options *ServiceClientSubmitBatchOptions) (*policy.Request, error) {
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPost, client.endpoint)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("comp", "batch")
|
||||
if options != nil && options.Timeout != nil {
|
||||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
runtime.SkipBodyDownload(req)
|
||||
req.Raw().Header["Content-Length"] = []string{strconv.FormatInt(contentLength, 10)}
|
||||
req.Raw().Header["Content-Type"] = []string{multipartContentType}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
if options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
if err := req.SetBody(body, multipartContentType); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// submitBatchHandleResponse handles the SubmitBatch response.
|
||||
func (client *ServiceClient) submitBatchHandleResponse(resp *http.Response) (ServiceClientSubmitBatchResponse, error) {
|
||||
result := ServiceClientSubmitBatchResponse{Body: resp.Body}
|
||||
if val := resp.Header.Get("Content-Type"); val != "" {
|
||||
result.ContentType = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.RequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-version"); val != "" {
|
||||
result.Version = &val
|
||||
}
|
||||
return result, nil
|
||||
}
|
42
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/zz_time_rfc1123.go
сгенерированный
поставляемый
Normal file
42
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/zz_time_rfc1123.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,42 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package generated
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
dateTimeRFC1123JSON = `"` + time.RFC1123 + `"`
|
||||
)
|
||||
|
||||
type dateTimeRFC1123 time.Time
|
||||
|
||||
func (t dateTimeRFC1123) MarshalJSON() ([]byte, error) {
|
||||
b := []byte(time.Time(t).Format(dateTimeRFC1123JSON))
|
||||
return b, nil
|
||||
}
|
||||
|
||||
func (t dateTimeRFC1123) MarshalText() ([]byte, error) {
|
||||
b := []byte(time.Time(t).Format(time.RFC1123))
|
||||
return b, nil
|
||||
}
|
||||
|
||||
func (t *dateTimeRFC1123) UnmarshalJSON(data []byte) error {
|
||||
p, err := time.Parse(dateTimeRFC1123JSON, strings.ToUpper(string(data)))
|
||||
*t = dateTimeRFC1123(p)
|
||||
return err
|
||||
}
|
||||
|
||||
func (t *dateTimeRFC1123) UnmarshalText(data []byte) error {
|
||||
p, err := time.Parse(time.RFC1123, string(data))
|
||||
*t = dateTimeRFC1123(p)
|
||||
return err
|
||||
}
|
58
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/zz_time_rfc3339.go
сгенерированный
поставляемый
Normal file
58
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/zz_time_rfc3339.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,58 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package generated
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases.
|
||||
var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`)
|
||||
|
||||
const (
|
||||
utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"`
|
||||
utcDateTime = "2006-01-02T15:04:05.999999999"
|
||||
dateTimeJSON = `"` + time.RFC3339Nano + `"`
|
||||
)
|
||||
|
||||
type dateTimeRFC3339 time.Time
|
||||
|
||||
func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) {
|
||||
tt := time.Time(t)
|
||||
return tt.MarshalJSON()
|
||||
}
|
||||
|
||||
func (t dateTimeRFC3339) MarshalText() ([]byte, error) {
|
||||
tt := time.Time(t)
|
||||
return tt.MarshalText()
|
||||
}
|
||||
|
||||
func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error {
|
||||
layout := utcDateTimeJSON
|
||||
if tzOffsetRegex.Match(data) {
|
||||
layout = dateTimeJSON
|
||||
}
|
||||
return t.Parse(layout, string(data))
|
||||
}
|
||||
|
||||
func (t *dateTimeRFC3339) UnmarshalText(data []byte) error {
|
||||
layout := utcDateTime
|
||||
if tzOffsetRegex.Match(data) {
|
||||
layout = time.RFC3339Nano
|
||||
}
|
||||
return t.Parse(layout, string(data))
|
||||
}
|
||||
|
||||
func (t *dateTimeRFC3339) Parse(layout, value string) error {
|
||||
p, err := time.Parse(layout, strings.ToUpper(value))
|
||||
*t = dateTimeRFC3339(p)
|
||||
return err
|
||||
}
|
53
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/zz_xml_helper.go
сгенерированный
поставляемый
Normal file
53
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated/zz_xml_helper.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,53 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package generated
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"errors"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
|
||||
"io"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type additionalProperties map[string]*string
|
||||
|
||||
// UnmarshalXML implements the xml.Unmarshaler interface for additionalProperties.
|
||||
func (ap *additionalProperties) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
|
||||
tokName := ""
|
||||
tokValue := ""
|
||||
for {
|
||||
t, err := d.Token()
|
||||
if errors.Is(err, io.EOF) {
|
||||
break
|
||||
} else if err != nil {
|
||||
return err
|
||||
}
|
||||
switch tt := t.(type) {
|
||||
case xml.StartElement:
|
||||
tokName = strings.ToLower(tt.Name.Local)
|
||||
tokValue = ""
|
||||
case xml.CharData:
|
||||
if tokName == "" {
|
||||
continue
|
||||
}
|
||||
tokValue = string(tt)
|
||||
case xml.EndElement:
|
||||
if tokName == "" {
|
||||
continue
|
||||
}
|
||||
if *ap == nil {
|
||||
*ap = additionalProperties{}
|
||||
}
|
||||
(*ap)[tokName] = to.Ptr(tokValue)
|
||||
tokName = ""
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче