build(deps): bump the go-deps group across 1 directory with 8 updates
Bumps the go-deps group with 7 updates in the / directory: | Package | From | To | | --- | --- | --- | | [cloud.google.com/go/compute](https://github.com/googleapis/google-cloud-go) | `1.27.3` | `1.27.4` | | [github.com/Azure/azure-sdk-for-go/sdk/storage/azblob](https://github.com/Azure/azure-sdk-for-go) | `1.3.2` | `1.4.0` | | [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) | `1.54.18` | `1.55.2` | | [github.com/gophercloud/gophercloud](https://github.com/gophercloud/gophercloud) | `1.13.0` | `1.14.0` | | [github.com/openshift-online/ocm-sdk-go](https://github.com/openshift-online/ocm-sdk-go) | `0.1.429` | `0.1.432` | | [github.com/osbuild/images](https://github.com/osbuild/images) | `0.70.0` | `0.72.0` | | [github.com/vmware/govmomi](https://github.com/vmware/govmomi) | `0.38.0` | `0.39.0` | Updates `cloud.google.com/go/compute` from 1.27.3 to 1.27.4 - [Release notes](https://github.com/googleapis/google-cloud-go/releases) - [Changelog](https://github.com/googleapis/google-cloud-go/blob/main/CHANGES.md) - [Commits](https://github.com/googleapis/google-cloud-go/compare/compute/v1.27.3...compute/v1.27.4) Updates `github.com/Azure/azure-sdk-for-go/sdk/storage/azblob` from 1.3.2 to 1.4.0 - [Release notes](https://github.com/Azure/azure-sdk-for-go/releases) - [Changelog](https://github.com/Azure/azure-sdk-for-go/blob/main/documentation/release.md) - [Commits](https://github.com/Azure/azure-sdk-for-go/compare/sdk/storage/azblob/v1.3.2...sdk/azcore/v1.4.0) Updates `github.com/aws/aws-sdk-go` from 1.54.18 to 1.55.2 - [Release notes](https://github.com/aws/aws-sdk-go/releases) - [Commits](https://github.com/aws/aws-sdk-go/compare/v1.54.18...v1.55.2) Updates `github.com/gophercloud/gophercloud` from 1.13.0 to 1.14.0 - [Release notes](https://github.com/gophercloud/gophercloud/releases) - [Changelog](https://github.com/gophercloud/gophercloud/blob/v1.14.0/CHANGELOG.md) - [Commits](https://github.com/gophercloud/gophercloud/compare/v1.13.0...v1.14.0) Updates `github.com/openshift-online/ocm-sdk-go` from 0.1.429 to 0.1.432 - [Release notes](https://github.com/openshift-online/ocm-sdk-go/releases) - [Changelog](https://github.com/openshift-online/ocm-sdk-go/blob/main/CHANGES.md) - [Commits](https://github.com/openshift-online/ocm-sdk-go/compare/v0.1.429...v0.1.432) Updates `github.com/osbuild/images` from 0.70.0 to 0.72.0 - [Release notes](https://github.com/osbuild/images/releases) - [Commits](https://github.com/osbuild/images/compare/v0.70.0...v0.72.0) Updates `github.com/vmware/govmomi` from 0.38.0 to 0.39.0 - [Release notes](https://github.com/vmware/govmomi/releases) - [Changelog](https://github.com/vmware/govmomi/blob/main/CHANGELOG.md) - [Commits](https://github.com/vmware/govmomi/compare/v0.38.0...v0.39.0) Updates `google.golang.org/api` from 0.188.0 to 0.189.0 - [Release notes](https://github.com/googleapis/google-api-go-client/releases) - [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md) - [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.188.0...v0.189.0) --- updated-dependencies: - dependency-name: cloud.google.com/go/compute dependency-type: direct:production update-type: version-update:semver-patch dependency-group: go-deps - dependency-name: github.com/Azure/azure-sdk-for-go/sdk/storage/azblob dependency-type: direct:production update-type: version-update:semver-minor dependency-group: go-deps - dependency-name: github.com/aws/aws-sdk-go dependency-type: direct:production update-type: version-update:semver-minor dependency-group: go-deps - dependency-name: github.com/gophercloud/gophercloud dependency-type: direct:production update-type: version-update:semver-minor dependency-group: go-deps - dependency-name: github.com/openshift-online/ocm-sdk-go dependency-type: direct:production update-type: version-update:semver-patch dependency-group: go-deps - dependency-name: github.com/osbuild/images dependency-type: direct:production update-type: version-update:semver-minor dependency-group: go-deps - dependency-name: github.com/vmware/govmomi dependency-type: direct:production update-type: version-update:semver-minor dependency-group: go-deps - dependency-name: google.golang.org/api dependency-type: direct:production update-type: version-update:semver-minor dependency-group: go-deps ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
parent
fd71c9cefa
commit
ca2c2dfa4f
104 changed files with 4713 additions and 2477 deletions
6
vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/CHANGELOG.md
generated
vendored
6
vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/CHANGELOG.md
generated
vendored
|
|
@ -1,5 +1,11 @@
|
|||
# Release History
|
||||
|
||||
## 1.13.0 (2024-07-16)
|
||||
|
||||
### Features Added
|
||||
|
||||
- Added runtime.NewRequestFromRequest(), allowing for a policy.Request to be created from an existing *http.Request.
|
||||
|
||||
## 1.12.0 (2024-06-06)
|
||||
|
||||
### Features Added
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ func appendNext(parent *ResourceID, parts []string, id string) (*ResourceID, err
|
|||
}
|
||||
|
||||
if strings.EqualFold(parts[0], providersKey) && (len(parts) == 2 || strings.EqualFold(parts[2], providersKey)) {
|
||||
//provider resource can only be on a tenant or a subscription parent
|
||||
// provider resource can only be on a tenant or a subscription parent
|
||||
if parent.ResourceType.String() != SubscriptionResourceType.String() && parent.ResourceType.String() != TenantResourceType.String() {
|
||||
return nil, fmt.Errorf("invalid resource ID: %s", id)
|
||||
}
|
||||
|
|
|
|||
8
vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime/pipeline.go
generated
vendored
8
vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime/pipeline.go
generated
vendored
|
|
@ -34,18 +34,22 @@ func NewPipeline(module, version string, cred azcore.TokenCredential, plOpts azr
|
|||
InsecureAllowCredentialWithHTTP: options.InsecureAllowCredentialWithHTTP,
|
||||
Scopes: []string{conf.Audience + "/.default"},
|
||||
})
|
||||
// we don't want to modify the underlying array in plOpts.PerRetry
|
||||
perRetry := make([]azpolicy.Policy, len(plOpts.PerRetry), len(plOpts.PerRetry)+1)
|
||||
copy(perRetry, plOpts.PerRetry)
|
||||
plOpts.PerRetry = append(perRetry, authPolicy, exported.PolicyFunc(httpTraceNamespacePolicy))
|
||||
perRetry = append(perRetry, authPolicy, exported.PolicyFunc(httpTraceNamespacePolicy))
|
||||
plOpts.PerRetry = perRetry
|
||||
if !options.DisableRPRegistration {
|
||||
regRPOpts := armpolicy.RegistrationOptions{ClientOptions: options.ClientOptions}
|
||||
regPolicy, err := NewRPRegistrationPolicy(cred, ®RPOpts)
|
||||
if err != nil {
|
||||
return azruntime.Pipeline{}, err
|
||||
}
|
||||
// we don't want to modify the underlying array in plOpts.PerCall
|
||||
perCall := make([]azpolicy.Policy, len(plOpts.PerCall), len(plOpts.PerCall)+1)
|
||||
copy(perCall, plOpts.PerCall)
|
||||
plOpts.PerCall = append(perCall, regPolicy)
|
||||
perCall = append(perCall, regPolicy)
|
||||
plOpts.PerCall = perCall
|
||||
}
|
||||
if plOpts.APIVersion.Name == "" {
|
||||
plOpts.APIVersion.Name = "api-version"
|
||||
|
|
|
|||
37
vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported/request.go
generated
vendored
37
vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported/request.go
generated
vendored
|
|
@ -7,6 +7,7 @@
|
|||
package exported
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"errors"
|
||||
|
|
@ -67,6 +68,42 @@ func (ov opValues) get(value any) bool {
|
|||
return ok
|
||||
}
|
||||
|
||||
// NewRequestFromRequest creates a new policy.Request with an existing *http.Request
|
||||
// Exported as runtime.NewRequestFromRequest().
|
||||
func NewRequestFromRequest(req *http.Request) (*Request, error) {
|
||||
policyReq := &Request{req: req}
|
||||
|
||||
if req.Body != nil {
|
||||
// we can avoid a body copy here if the underlying stream is already a
|
||||
// ReadSeekCloser.
|
||||
readSeekCloser, isReadSeekCloser := req.Body.(io.ReadSeekCloser)
|
||||
|
||||
if !isReadSeekCloser {
|
||||
// since this is an already populated http.Request we want to copy
|
||||
// over its body, if it has one.
|
||||
bodyBytes, err := io.ReadAll(req.Body)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err := req.Body.Close(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
readSeekCloser = NopCloser(bytes.NewReader(bodyBytes))
|
||||
}
|
||||
|
||||
// SetBody also takes care of updating the http.Request's body
|
||||
// as well, so they should stay in-sync from this point.
|
||||
if err := policyReq.SetBody(readSeekCloser, req.Header.Get("Content-Type")); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return policyReq, nil
|
||||
}
|
||||
|
||||
// NewRequest creates a new Request with the specified input.
|
||||
// Exported as runtime.NewRequest().
|
||||
func NewRequest(ctx context.Context, httpMethod string, endpoint string) (*Request, error) {
|
||||
|
|
|
|||
2
vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared/constants.go
generated
vendored
2
vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared/constants.go
generated
vendored
|
|
@ -40,5 +40,5 @@ const (
|
|||
Module = "azcore"
|
||||
|
||||
// Version is the semantic version (see http://semver.org) of this module.
|
||||
Version = "v1.12.0"
|
||||
Version = "v1.13.0"
|
||||
)
|
||||
|
|
|
|||
6
vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/request.go
generated
vendored
6
vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/request.go
generated
vendored
|
|
@ -15,6 +15,7 @@ import (
|
|||
"fmt"
|
||||
"io"
|
||||
"mime/multipart"
|
||||
"net/http"
|
||||
"net/textproto"
|
||||
"net/url"
|
||||
"path"
|
||||
|
|
@ -45,6 +46,11 @@ func NewRequest(ctx context.Context, httpMethod string, endpoint string) (*polic
|
|||
return exported.NewRequest(ctx, httpMethod, endpoint)
|
||||
}
|
||||
|
||||
// NewRequestFromRequest creates a new policy.Request with an existing *http.Request
|
||||
func NewRequestFromRequest(req *http.Request) (*policy.Request, error) {
|
||||
return exported.NewRequestFromRequest(req)
|
||||
}
|
||||
|
||||
// EncodeQueryParams will parse and encode any query parameters in the specified URL.
|
||||
// Any semicolons will automatically be escaped.
|
||||
func EncodeQueryParams(u string) (string, error) {
|
||||
|
|
|
|||
15
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/CHANGELOG.md
generated
vendored
15
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/CHANGELOG.md
generated
vendored
|
|
@ -1,5 +1,20 @@
|
|||
# Release History
|
||||
|
||||
## 1.4.0 (2024-07-18)
|
||||
|
||||
### Other Changes
|
||||
* GetProperties() was called twice in DownloadFile method. Enhanced to call it only once, reducing latency.
|
||||
* Updated `azcore` version to `1.13.0`
|
||||
|
||||
## 1.4.0-beta.1 (2024-06-14)
|
||||
|
||||
### Features Added
|
||||
* Updated service version to `2024-05-04`.
|
||||
|
||||
### Other Changes
|
||||
* Updated `azidentity` version to `1.6.0`
|
||||
* Updated `azcore` version to `1.12.0`
|
||||
|
||||
## 1.3.2 (2024-04-09)
|
||||
|
||||
### Bugs Fixed
|
||||
|
|
|
|||
3
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/README.md
generated
vendored
3
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/README.md
generated
vendored
|
|
@ -1,4 +1,7 @@
|
|||
# Azure Blob Storage module for Go
|
||||
[](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob)
|
||||
[](https://dev.azure.com/azure-sdk/public/_build/latest?definitionId=2854&branchName=main)
|
||||
[](https://img.shields.io/azure-devops/coverage/azure-sdk/public/2854/main)
|
||||
|
||||
> Service Version: 2023-11-03
|
||||
|
||||
|
|
|
|||
4
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/appendblob/client.go
generated
vendored
4
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/appendblob/client.go
generated
vendored
|
|
@ -292,8 +292,8 @@ func (ab *Client) GetAccountInfo(ctx context.Context, o *blob.GetAccountInfoOpti
|
|||
|
||||
// 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)
|
||||
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.
|
||||
|
|
|
|||
2
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/assets.json
generated
vendored
2
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/assets.json
generated
vendored
|
|
@ -2,5 +2,5 @@
|
|||
"AssetsRepo": "Azure/azure-sdk-assets",
|
||||
"AssetsRepoPrefixPath": "go",
|
||||
"TagPrefix": "go/storage/azblob",
|
||||
"Tag": "go/storage/azblob_71b0a04c12"
|
||||
"Tag": "go/storage/azblob_bbf7a929e3"
|
||||
}
|
||||
|
|
|
|||
5
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob/client.go
generated
vendored
5
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob/client.go
generated
vendored
|
|
@ -185,9 +185,9 @@ func (b *Client) GetProperties(ctx context.Context, options *GetPropertiesOption
|
|||
|
||||
// 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) {
|
||||
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)
|
||||
resp, err := b.generated().SetHTTPHeaders(ctx, opts, &httpHeaders, leaseAccessConditions, modifiedAccessConditions)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
|
|
@ -448,6 +448,7 @@ func (b *Client) DownloadFile(ctx context.Context, file *os.File, o *DownloadFil
|
|||
return 0, err
|
||||
}
|
||||
size = *props.ContentLength - do.Range.Offset
|
||||
do.Range.Count = size
|
||||
} else {
|
||||
size = count
|
||||
}
|
||||
|
|
|
|||
1
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob/retry_reader.go
generated
vendored
1
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob/retry_reader.go
generated
vendored
|
|
@ -101,7 +101,6 @@ func (s *RetryReader) setResponse(r io.ReadCloser) {
|
|||
// 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
|
||||
|
|
|
|||
4
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blockblob/client.go
generated
vendored
4
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blockblob/client.go
generated
vendored
|
|
@ -364,8 +364,8 @@ func (bb *Client) GetAccountInfo(ctx context.Context, o *blob.GetAccountInfoOpti
|
|||
|
||||
// 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)
|
||||
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.
|
||||
|
|
|
|||
|
|
@ -8,5 +8,5 @@ package exported
|
|||
|
||||
const (
|
||||
ModuleName = "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob"
|
||||
ModuleVersion = "v1.3.2"
|
||||
ModuleVersion = "v1.4.0"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -19,10 +19,10 @@ modelerfour:
|
|||
seal-single-value-enum-by-default: true
|
||||
lenient-model-deduplication: true
|
||||
export-clients: true
|
||||
use: "@autorest/go@4.0.0-preview.61"
|
||||
use: "@autorest/go@4.0.0-preview.65"
|
||||
```
|
||||
|
||||
### Updating service version to 2023-11-03
|
||||
### Updating service version to 2024-05-04
|
||||
```yaml
|
||||
directive:
|
||||
- from:
|
||||
|
|
@ -36,7 +36,7 @@ directive:
|
|||
transform: >-
|
||||
return $.
|
||||
replaceAll(`[]string{"2021-12-02"}`, `[]string{ServiceVersion}`).
|
||||
replaceAll(`2021-12-02`, `2023-11-03`);
|
||||
replaceAll(`2021-12-02`, `2024-05-04`);
|
||||
```
|
||||
|
||||
### Undo breaking change with BlobName
|
||||
|
|
@ -293,7 +293,7 @@ directive:
|
|||
replace(/SourceIfMatch\s+\*string/g, `SourceIfMatch *azcore.ETag`).
|
||||
replace(/SourceIfNoneMatch\s+\*string/g, `SourceIfNoneMatch *azcore.ETag`);
|
||||
|
||||
- from: zz_response_types.go
|
||||
- from: zz_responses.go
|
||||
where: $
|
||||
transform: >-
|
||||
return $.
|
||||
|
|
|
|||
|
|
@ -6,4 +6,4 @@
|
|||
|
||||
package generated
|
||||
|
||||
const ServiceVersion = "2023-11-03"
|
||||
const ServiceVersion = "2024-05-04"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//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.
|
||||
|
|
@ -72,21 +69,37 @@ func (client *AppendBlobClient) appendBlockCreateRequest(ctx context.Context, co
|
|||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
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 modifiedAccessConditions != nil && modifiedAccessConditions.IfMatch != nil {
|
||||
req.Raw().Header["If-Match"] = []string{string(*modifiedAccessConditions.IfMatch)}
|
||||
}
|
||||
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.IfNoneMatch != nil {
|
||||
req.Raw().Header["If-None-Match"] = []string{string(*modifiedAccessConditions.IfNoneMatch)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfUnmodifiedSince != nil {
|
||||
req.Raw().Header["If-Unmodified-Since"] = []string{(*modifiedAccessConditions.IfUnmodifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if appendPositionAccessConditions != nil && appendPositionAccessConditions.AppendPosition != nil {
|
||||
req.Raw().Header["x-ms-blob-condition-appendpos"] = []string{strconv.FormatInt(*appendPositionAccessConditions.AppendPosition, 10)}
|
||||
}
|
||||
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 options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
if options != nil && options.TransactionalContentCRC64 != nil {
|
||||
req.Raw().Header["x-ms-content-crc64"] = []string{base64.StdEncoding.EncodeToString(options.TransactionalContentCRC64)}
|
||||
}
|
||||
if cpkInfo != nil && cpkInfo.EncryptionAlgorithm != nil {
|
||||
req.Raw().Header["x-ms-encryption-algorithm"] = []string{string(*cpkInfo.EncryptionAlgorithm)}
|
||||
}
|
||||
if cpkInfo != nil && cpkInfo.EncryptionKey != nil {
|
||||
req.Raw().Header["x-ms-encryption-key"] = []string{*cpkInfo.EncryptionKey}
|
||||
|
|
@ -94,32 +107,16 @@ func (client *AppendBlobClient) appendBlockCreateRequest(ctx context.Context, co
|
|||
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 leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil {
|
||||
req.Raw().Header["x-ms-lease-id"] = []string{*leaseAccessConditions.LeaseID}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
if err := req.SetBody(body, "application/octet-stream"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -244,76 +241,76 @@ func (client *AppendBlobClient) appendBlockFromURLCreateRequest(ctx context.Cont
|
|||
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["Accept"] = []string{"application/xml"}
|
||||
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 modifiedAccessConditions != nil && modifiedAccessConditions.IfMatch != nil {
|
||||
req.Raw().Header["If-Match"] = []string{string(*modifiedAccessConditions.IfMatch)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfModifiedSince != nil {
|
||||
req.Raw().Header["If-Modified-Since"] = []string{(*modifiedAccessConditions.IfModifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfNoneMatch != nil {
|
||||
req.Raw().Header["If-None-Match"] = []string{string(*modifiedAccessConditions.IfNoneMatch)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfUnmodifiedSince != nil {
|
||||
req.Raw().Header["If-Unmodified-Since"] = []string{(*modifiedAccessConditions.IfUnmodifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if appendPositionAccessConditions != nil && appendPositionAccessConditions.AppendPosition != nil {
|
||||
req.Raw().Header["x-ms-blob-condition-appendpos"] = []string{strconv.FormatInt(*appendPositionAccessConditions.AppendPosition, 10)}
|
||||
}
|
||||
if appendPositionAccessConditions != nil && appendPositionAccessConditions.MaxSize != nil {
|
||||
req.Raw().Header["x-ms-blob-condition-maxsize"] = []string{strconv.FormatInt(*appendPositionAccessConditions.MaxSize, 10)}
|
||||
}
|
||||
if options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
req.Raw().Header["x-ms-copy-source"] = []string{sourceURL}
|
||||
if options != nil && options.CopySourceAuthorization != nil {
|
||||
req.Raw().Header["x-ms-copy-source-authorization"] = []string{*options.CopySourceAuthorization}
|
||||
}
|
||||
if cpkInfo != nil && cpkInfo.EncryptionAlgorithm != nil {
|
||||
req.Raw().Header["x-ms-encryption-algorithm"] = []string{string(*cpkInfo.EncryptionAlgorithm)}
|
||||
}
|
||||
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 leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil {
|
||||
req.Raw().Header["x-ms-lease-id"] = []string{*leaseAccessConditions.LeaseID}
|
||||
}
|
||||
if sourceModifiedAccessConditions != nil && sourceModifiedAccessConditions.SourceIfUnmodifiedSince != nil {
|
||||
req.Raw().Header["x-ms-source-if-unmodified-since"] = []string{(*sourceModifiedAccessConditions.SourceIfUnmodifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
if options != nil && options.SourceContentcrc64 != nil {
|
||||
req.Raw().Header["x-ms-source-content-crc64"] = []string{base64.StdEncoding.EncodeToString(options.SourceContentcrc64)}
|
||||
}
|
||||
if options != nil && options.SourceContentMD5 != nil {
|
||||
req.Raw().Header["x-ms-source-content-md5"] = []string{base64.StdEncoding.EncodeToString(options.SourceContentMD5)}
|
||||
}
|
||||
if sourceModifiedAccessConditions != nil && sourceModifiedAccessConditions.SourceIfMatch != nil {
|
||||
req.Raw().Header["x-ms-source-if-match"] = []string{string(*sourceModifiedAccessConditions.SourceIfMatch)}
|
||||
}
|
||||
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.SourceIfNoneMatch != nil {
|
||||
req.Raw().Header["x-ms-source-if-none-match"] = []string{string(*sourceModifiedAccessConditions.SourceIfNoneMatch)}
|
||||
}
|
||||
if sourceModifiedAccessConditions != nil && sourceModifiedAccessConditions.SourceIfUnmodifiedSince != nil {
|
||||
req.Raw().Header["x-ms-source-if-unmodified-since"] = []string{(*sourceModifiedAccessConditions.SourceIfUnmodifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if options != nil && options.SourceRange != nil {
|
||||
req.Raw().Header["x-ms-source-range"] = []string{*options.SourceRange}
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
|
|
@ -424,10 +421,25 @@ func (client *AppendBlobClient) createCreateRequest(ctx context.Context, content
|
|||
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["Accept"] = []string{"application/xml"}
|
||||
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 modifiedAccessConditions != nil && modifiedAccessConditions.IfMatch != nil {
|
||||
req.Raw().Header["If-Match"] = []string{string(*modifiedAccessConditions.IfMatch)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfModifiedSince != nil {
|
||||
req.Raw().Header["If-Modified-Since"] = []string{(*modifiedAccessConditions.IfModifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfNoneMatch != nil {
|
||||
req.Raw().Header["If-None-Match"] = []string{string(*modifiedAccessConditions.IfNoneMatch)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfUnmodifiedSince != nil {
|
||||
req.Raw().Header["If-Unmodified-Since"] = []string{(*modifiedAccessConditions.IfUnmodifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if blobHTTPHeaders != nil && blobHTTPHeaders.BlobCacheControl != nil {
|
||||
req.Raw().Header["x-ms-blob-cache-control"] = []string{*blobHTTPHeaders.BlobCacheControl}
|
||||
}
|
||||
if blobHTTPHeaders != nil && blobHTTPHeaders.BlobContentDisposition != nil {
|
||||
req.Raw().Header["x-ms-blob-content-disposition"] = []string{*blobHTTPHeaders.BlobContentDisposition}
|
||||
}
|
||||
if blobHTTPHeaders != nil && blobHTTPHeaders.BlobContentEncoding != nil {
|
||||
req.Raw().Header["x-ms-blob-content-encoding"] = []string{*blobHTTPHeaders.BlobContentEncoding}
|
||||
|
|
@ -438,8 +450,39 @@ func (client *AppendBlobClient) createCreateRequest(ctx context.Context, content
|
|||
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 blobHTTPHeaders != nil && blobHTTPHeaders.BlobContentType != nil {
|
||||
req.Raw().Header["x-ms-blob-content-type"] = []string{*blobHTTPHeaders.BlobContentType}
|
||||
}
|
||||
req.Raw().Header["x-ms-blob-type"] = []string{"AppendBlob"}
|
||||
if options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
if cpkInfo != nil && cpkInfo.EncryptionAlgorithm != nil {
|
||||
req.Raw().Header["x-ms-encryption-algorithm"] = []string{string(*cpkInfo.EncryptionAlgorithm)}
|
||||
}
|
||||
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 cpkScopeInfo != nil && cpkScopeInfo.EncryptionScope != nil {
|
||||
req.Raw().Header["x-ms-encryption-scope"] = []string{*cpkScopeInfo.EncryptionScope}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfTags != nil {
|
||||
req.Raw().Header["x-ms-if-tags"] = []string{*modifiedAccessConditions.IfTags}
|
||||
}
|
||||
if options != nil && options.ImmutabilityPolicyMode != nil {
|
||||
req.Raw().Header["x-ms-immutability-policy-mode"] = []string{string(*options.ImmutabilityPolicyMode)}
|
||||
}
|
||||
if options != nil && options.ImmutabilityPolicyExpiry != nil {
|
||||
req.Raw().Header["x-ms-immutability-policy-until-date"] = []string{(*options.ImmutabilityPolicyExpiry).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil {
|
||||
req.Raw().Header["x-ms-lease-id"] = []string{*leaseAccessConditions.LeaseID}
|
||||
}
|
||||
if options != nil && options.LegalHold != nil {
|
||||
req.Raw().Header["x-ms-legal-hold"] = []string{strconv.FormatBool(*options.LegalHold)}
|
||||
}
|
||||
if options != nil && options.Metadata != nil {
|
||||
for k, v := range options.Metadata {
|
||||
|
|
@ -448,56 +491,10 @@ func (client *AppendBlobClient) createCreateRequest(ctx context.Context, content
|
|||
}
|
||||
}
|
||||
}
|
||||
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"}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
|
|
@ -596,29 +593,29 @@ func (client *AppendBlobClient) sealCreateRequest(ctx context.Context, options *
|
|||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfMatch != nil {
|
||||
req.Raw().Header["If-Match"] = []string{string(*modifiedAccessConditions.IfMatch)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfModifiedSince != nil {
|
||||
req.Raw().Header["If-Modified-Since"] = []string{(*modifiedAccessConditions.IfModifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfNoneMatch != nil {
|
||||
req.Raw().Header["If-None-Match"] = []string{string(*modifiedAccessConditions.IfNoneMatch)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfUnmodifiedSince != nil {
|
||||
req.Raw().Header["If-Unmodified-Since"] = []string{(*modifiedAccessConditions.IfUnmodifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if appendPositionAccessConditions != nil && appendPositionAccessConditions.AppendPosition != nil {
|
||||
req.Raw().Header["x-ms-blob-condition-appendpos"] = []string{strconv.FormatInt(*appendPositionAccessConditions.AppendPosition, 10)}
|
||||
}
|
||||
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"}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,6 +1,3 @@
|
|||
//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.
|
||||
|
|
@ -75,11 +72,30 @@ func (client *BlockBlobClient) commitBlockListCreateRequest(ctx context.Context,
|
|||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
if options != nil && options.TransactionalContentMD5 != nil {
|
||||
req.Raw().Header["Content-MD5"] = []string{base64.StdEncoding.EncodeToString(options.TransactionalContentMD5)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfMatch != nil {
|
||||
req.Raw().Header["If-Match"] = []string{string(*modifiedAccessConditions.IfMatch)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfModifiedSince != nil {
|
||||
req.Raw().Header["If-Modified-Since"] = []string{(*modifiedAccessConditions.IfModifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfNoneMatch != nil {
|
||||
req.Raw().Header["If-None-Match"] = []string{string(*modifiedAccessConditions.IfNoneMatch)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfUnmodifiedSince != nil {
|
||||
req.Raw().Header["If-Unmodified-Since"] = []string{(*modifiedAccessConditions.IfUnmodifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if options != nil && options.Tier != nil {
|
||||
req.Raw().Header["x-ms-access-tier"] = []string{string(*options.Tier)}
|
||||
}
|
||||
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.BlobContentDisposition != nil {
|
||||
req.Raw().Header["x-ms-blob-content-disposition"] = []string{*blobHTTPHeaders.BlobContentDisposition}
|
||||
}
|
||||
if blobHTTPHeaders != nil && blobHTTPHeaders.BlobContentEncoding != nil {
|
||||
req.Raw().Header["x-ms-blob-content-encoding"] = []string{*blobHTTPHeaders.BlobContentEncoding}
|
||||
|
|
@ -90,12 +106,42 @@ func (client *BlockBlobClient) commitBlockListCreateRequest(ctx context.Context,
|
|||
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 blobHTTPHeaders != nil && blobHTTPHeaders.BlobContentType != nil {
|
||||
req.Raw().Header["x-ms-blob-content-type"] = []string{*blobHTTPHeaders.BlobContentType}
|
||||
}
|
||||
if options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
if options != nil && options.TransactionalContentCRC64 != nil {
|
||||
req.Raw().Header["x-ms-content-crc64"] = []string{base64.StdEncoding.EncodeToString(options.TransactionalContentCRC64)}
|
||||
}
|
||||
if cpkInfo != nil && cpkInfo.EncryptionAlgorithm != nil {
|
||||
req.Raw().Header["x-ms-encryption-algorithm"] = []string{string(*cpkInfo.EncryptionAlgorithm)}
|
||||
}
|
||||
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 cpkScopeInfo != nil && cpkScopeInfo.EncryptionScope != nil {
|
||||
req.Raw().Header["x-ms-encryption-scope"] = []string{*cpkScopeInfo.EncryptionScope}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfTags != nil {
|
||||
req.Raw().Header["x-ms-if-tags"] = []string{*modifiedAccessConditions.IfTags}
|
||||
}
|
||||
if options != nil && options.ImmutabilityPolicyMode != nil {
|
||||
req.Raw().Header["x-ms-immutability-policy-mode"] = []string{string(*options.ImmutabilityPolicyMode)}
|
||||
}
|
||||
if options != nil && options.ImmutabilityPolicyExpiry != nil {
|
||||
req.Raw().Header["x-ms-immutability-policy-until-date"] = []string{(*options.ImmutabilityPolicyExpiry).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil {
|
||||
req.Raw().Header["x-ms-lease-id"] = []string{*leaseAccessConditions.LeaseID}
|
||||
}
|
||||
if options != nil && options.LegalHold != nil {
|
||||
req.Raw().Header["x-ms-legal-hold"] = []string{strconv.FormatBool(*options.LegalHold)}
|
||||
}
|
||||
if options != nil && options.Metadata != nil {
|
||||
for k, v := range options.Metadata {
|
||||
if v != nil {
|
||||
|
|
@ -103,59 +149,10 @@ func (client *BlockBlobClient) commitBlockListCreateRequest(ctx context.Context,
|
|||
}
|
||||
}
|
||||
}
|
||||
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"}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
if err := runtime.MarshalAsXML(req, blocks); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -257,26 +254,26 @@ func (client *BlockBlobClient) getBlockListCreateRequest(ctx context.Context, li
|
|||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("blocklisttype", string(listType))
|
||||
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}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
if options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
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 leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil {
|
||||
req.Raw().Header["x-ms-lease-id"] = []string{*leaseAccessConditions.LeaseID}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
|
|
@ -375,13 +372,31 @@ func (client *BlockBlobClient) putBlobFromURLCreateRequest(ctx context.Context,
|
|||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["x-ms-blob-type"] = []string{"BlockBlob"}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
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)}
|
||||
}
|
||||
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 modifiedAccessConditions != nil && modifiedAccessConditions.IfMatch != nil {
|
||||
req.Raw().Header["If-Match"] = []string{string(*modifiedAccessConditions.IfMatch)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfModifiedSince != nil {
|
||||
req.Raw().Header["If-Modified-Since"] = []string{(*modifiedAccessConditions.IfModifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfNoneMatch != nil {
|
||||
req.Raw().Header["If-None-Match"] = []string{string(*modifiedAccessConditions.IfNoneMatch)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfUnmodifiedSince != nil {
|
||||
req.Raw().Header["If-Unmodified-Since"] = []string{(*modifiedAccessConditions.IfUnmodifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if options != nil && options.Tier != nil {
|
||||
req.Raw().Header["x-ms-access-tier"] = []string{string(*options.Tier)}
|
||||
}
|
||||
if blobHTTPHeaders != nil && blobHTTPHeaders.BlobCacheControl != nil {
|
||||
req.Raw().Header["x-ms-blob-cache-control"] = []string{*blobHTTPHeaders.BlobCacheControl}
|
||||
}
|
||||
if blobHTTPHeaders != nil && blobHTTPHeaders.BlobContentDisposition != nil {
|
||||
req.Raw().Header["x-ms-blob-content-disposition"] = []string{*blobHTTPHeaders.BlobContentDisposition}
|
||||
}
|
||||
if blobHTTPHeaders != nil && blobHTTPHeaders.BlobContentEncoding != nil {
|
||||
req.Raw().Header["x-ms-blob-content-encoding"] = []string{*blobHTTPHeaders.BlobContentEncoding}
|
||||
|
|
@ -392,8 +407,40 @@ func (client *BlockBlobClient) putBlobFromURLCreateRequest(ctx context.Context,
|
|||
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 blobHTTPHeaders != nil && blobHTTPHeaders.BlobContentType != nil {
|
||||
req.Raw().Header["x-ms-blob-content-type"] = []string{*blobHTTPHeaders.BlobContentType}
|
||||
}
|
||||
req.Raw().Header["x-ms-blob-type"] = []string{"BlockBlob"}
|
||||
if options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
req.Raw().Header["x-ms-copy-source"] = []string{copySource}
|
||||
if options != nil && options.CopySourceAuthorization != nil {
|
||||
req.Raw().Header["x-ms-copy-source-authorization"] = []string{*options.CopySourceAuthorization}
|
||||
}
|
||||
if options != nil && options.CopySourceBlobProperties != nil {
|
||||
req.Raw().Header["x-ms-copy-source-blob-properties"] = []string{strconv.FormatBool(*options.CopySourceBlobProperties)}
|
||||
}
|
||||
if options != nil && options.CopySourceTags != nil {
|
||||
req.Raw().Header["x-ms-copy-source-tag-option"] = []string{string(*options.CopySourceTags)}
|
||||
}
|
||||
if cpkInfo != nil && cpkInfo.EncryptionAlgorithm != nil {
|
||||
req.Raw().Header["x-ms-encryption-algorithm"] = []string{string(*cpkInfo.EncryptionAlgorithm)}
|
||||
}
|
||||
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 cpkScopeInfo != nil && cpkScopeInfo.EncryptionScope != nil {
|
||||
req.Raw().Header["x-ms-encryption-scope"] = []string{*cpkScopeInfo.EncryptionScope}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfTags != nil {
|
||||
req.Raw().Header["x-ms-if-tags"] = []string{*modifiedAccessConditions.IfTags}
|
||||
}
|
||||
if leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil {
|
||||
req.Raw().Header["x-ms-lease-id"] = []string{*leaseAccessConditions.LeaseID}
|
||||
}
|
||||
if options != nil && options.Metadata != nil {
|
||||
for k, v := range options.Metadata {
|
||||
|
|
@ -402,78 +449,28 @@ func (client *BlockBlobClient) putBlobFromURLCreateRequest(ctx context.Context,
|
|||
}
|
||||
}
|
||||
}
|
||||
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 options != nil && options.SourceContentMD5 != nil {
|
||||
req.Raw().Header["x-ms-source-content-md5"] = []string{base64.StdEncoding.EncodeToString(options.SourceContentMD5)}
|
||||
}
|
||||
if sourceModifiedAccessConditions != nil && sourceModifiedAccessConditions.SourceIfMatch != nil {
|
||||
req.Raw().Header["x-ms-source-if-match"] = []string{string(*sourceModifiedAccessConditions.SourceIfMatch)}
|
||||
}
|
||||
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.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 sourceModifiedAccessConditions != nil && sourceModifiedAccessConditions.SourceIfUnmodifiedSince != nil {
|
||||
req.Raw().Header["x-ms-source-if-unmodified-since"] = []string{(*sourceModifiedAccessConditions.SourceIfUnmodifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
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"}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
|
|
@ -570,21 +567,25 @@ func (client *BlockBlobClient) stageBlockCreateRequest(ctx context.Context, bloc
|
|||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("comp", "block")
|
||||
reqQP.Set("blockid", blockID)
|
||||
reqQP.Set("comp", "block")
|
||||
if options != nil && options.Timeout != nil {
|
||||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
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.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
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.EncryptionAlgorithm != nil {
|
||||
req.Raw().Header["x-ms-encryption-algorithm"] = []string{string(*cpkInfo.EncryptionAlgorithm)}
|
||||
}
|
||||
if cpkInfo != nil && cpkInfo.EncryptionKey != nil {
|
||||
req.Raw().Header["x-ms-encryption-key"] = []string{*cpkInfo.EncryptionKey}
|
||||
|
|
@ -592,17 +593,13 @@ func (client *BlockBlobClient) stageBlockCreateRequest(ctx context.Context, bloc
|
|||
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}
|
||||
if leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil {
|
||||
req.Raw().Header["x-ms-lease-id"] = []string{*leaseAccessConditions.LeaseID}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
if err := req.SetBody(body, "application/octet-stream"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -700,22 +697,23 @@ func (client *BlockBlobClient) stageBlockFromURLCreateRequest(ctx context.Contex
|
|||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("comp", "block")
|
||||
reqQP.Set("blockid", blockID)
|
||||
reqQP.Set("comp", "block")
|
||||
if options != nil && options.Timeout != nil {
|
||||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
req.Raw().Header["Content-Length"] = []string{strconv.FormatInt(contentLength, 10)}
|
||||
if options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
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.CopySourceAuthorization != nil {
|
||||
req.Raw().Header["x-ms-copy-source-authorization"] = []string{*options.CopySourceAuthorization}
|
||||
}
|
||||
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.EncryptionAlgorithm != nil {
|
||||
req.Raw().Header["x-ms-encryption-algorithm"] = []string{string(*cpkInfo.EncryptionAlgorithm)}
|
||||
}
|
||||
if cpkInfo != nil && cpkInfo.EncryptionKey != nil {
|
||||
req.Raw().Header["x-ms-encryption-key"] = []string{*cpkInfo.EncryptionKey}
|
||||
|
|
@ -723,35 +721,34 @@ func (client *BlockBlobClient) stageBlockFromURLCreateRequest(ctx context.Contex
|
|||
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 options != nil && options.SourceContentcrc64 != nil {
|
||||
req.Raw().Header["x-ms-source-content-crc64"] = []string{base64.StdEncoding.EncodeToString(options.SourceContentcrc64)}
|
||||
}
|
||||
if sourceModifiedAccessConditions != nil && sourceModifiedAccessConditions.SourceIfUnmodifiedSince != nil {
|
||||
req.Raw().Header["x-ms-source-if-unmodified-since"] = []string{(*sourceModifiedAccessConditions.SourceIfUnmodifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
if options != nil && options.SourceContentMD5 != nil {
|
||||
req.Raw().Header["x-ms-source-content-md5"] = []string{base64.StdEncoding.EncodeToString(options.SourceContentMD5)}
|
||||
}
|
||||
if sourceModifiedAccessConditions != nil && sourceModifiedAccessConditions.SourceIfMatch != nil {
|
||||
req.Raw().Header["x-ms-source-if-match"] = []string{string(*sourceModifiedAccessConditions.SourceIfMatch)}
|
||||
}
|
||||
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.SourceIfNoneMatch != nil {
|
||||
req.Raw().Header["x-ms-source-if-none-match"] = []string{string(*sourceModifiedAccessConditions.SourceIfNoneMatch)}
|
||||
}
|
||||
if sourceModifiedAccessConditions != nil && sourceModifiedAccessConditions.SourceIfUnmodifiedSince != nil {
|
||||
req.Raw().Header["x-ms-source-if-unmodified-since"] = []string{(*sourceModifiedAccessConditions.SourceIfUnmodifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if options != nil && options.SourceRange != nil {
|
||||
req.Raw().Header["x-ms-source-range"] = []string{*options.SourceRange}
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
|
|
@ -848,13 +845,31 @@ func (client *BlockBlobClient) uploadCreateRequest(ctx context.Context, contentL
|
|||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["x-ms-blob-type"] = []string{"BlockBlob"}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
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)}
|
||||
}
|
||||
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 modifiedAccessConditions != nil && modifiedAccessConditions.IfMatch != nil {
|
||||
req.Raw().Header["If-Match"] = []string{string(*modifiedAccessConditions.IfMatch)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfModifiedSince != nil {
|
||||
req.Raw().Header["If-Modified-Since"] = []string{(*modifiedAccessConditions.IfModifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfNoneMatch != nil {
|
||||
req.Raw().Header["If-None-Match"] = []string{string(*modifiedAccessConditions.IfNoneMatch)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfUnmodifiedSince != nil {
|
||||
req.Raw().Header["If-Unmodified-Since"] = []string{(*modifiedAccessConditions.IfUnmodifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if options != nil && options.Tier != nil {
|
||||
req.Raw().Header["x-ms-access-tier"] = []string{string(*options.Tier)}
|
||||
}
|
||||
if blobHTTPHeaders != nil && blobHTTPHeaders.BlobCacheControl != nil {
|
||||
req.Raw().Header["x-ms-blob-cache-control"] = []string{*blobHTTPHeaders.BlobCacheControl}
|
||||
}
|
||||
if blobHTTPHeaders != nil && blobHTTPHeaders.BlobContentDisposition != nil {
|
||||
req.Raw().Header["x-ms-blob-content-disposition"] = []string{*blobHTTPHeaders.BlobContentDisposition}
|
||||
}
|
||||
if blobHTTPHeaders != nil && blobHTTPHeaders.BlobContentEncoding != nil {
|
||||
req.Raw().Header["x-ms-blob-content-encoding"] = []string{*blobHTTPHeaders.BlobContentEncoding}
|
||||
|
|
@ -865,8 +880,42 @@ func (client *BlockBlobClient) uploadCreateRequest(ctx context.Context, contentL
|
|||
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 blobHTTPHeaders != nil && blobHTTPHeaders.BlobContentType != nil {
|
||||
req.Raw().Header["x-ms-blob-content-type"] = []string{*blobHTTPHeaders.BlobContentType}
|
||||
}
|
||||
req.Raw().Header["x-ms-blob-type"] = []string{"BlockBlob"}
|
||||
if options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
if options != nil && options.TransactionalContentCRC64 != nil {
|
||||
req.Raw().Header["x-ms-content-crc64"] = []string{base64.StdEncoding.EncodeToString(options.TransactionalContentCRC64)}
|
||||
}
|
||||
if cpkInfo != nil && cpkInfo.EncryptionAlgorithm != nil {
|
||||
req.Raw().Header["x-ms-encryption-algorithm"] = []string{string(*cpkInfo.EncryptionAlgorithm)}
|
||||
}
|
||||
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 cpkScopeInfo != nil && cpkScopeInfo.EncryptionScope != nil {
|
||||
req.Raw().Header["x-ms-encryption-scope"] = []string{*cpkScopeInfo.EncryptionScope}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfTags != nil {
|
||||
req.Raw().Header["x-ms-if-tags"] = []string{*modifiedAccessConditions.IfTags}
|
||||
}
|
||||
if options != nil && options.ImmutabilityPolicyMode != nil {
|
||||
req.Raw().Header["x-ms-immutability-policy-mode"] = []string{string(*options.ImmutabilityPolicyMode)}
|
||||
}
|
||||
if options != nil && options.ImmutabilityPolicyExpiry != nil {
|
||||
req.Raw().Header["x-ms-immutability-policy-until-date"] = []string{(*options.ImmutabilityPolicyExpiry).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil {
|
||||
req.Raw().Header["x-ms-lease-id"] = []string{*leaseAccessConditions.LeaseID}
|
||||
}
|
||||
if options != nil && options.LegalHold != nil {
|
||||
req.Raw().Header["x-ms-legal-hold"] = []string{strconv.FormatBool(*options.LegalHold)}
|
||||
}
|
||||
if options != nil && options.Metadata != nil {
|
||||
for k, v := range options.Metadata {
|
||||
|
|
@ -875,62 +924,10 @@ func (client *BlockBlobClient) uploadCreateRequest(ctx context.Context, contentL
|
|||
}
|
||||
}
|
||||
}
|
||||
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"}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
if err := req.SetBody(body, "application/octet-stream"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//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.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//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.
|
||||
|
|
@ -71,22 +68,22 @@ func (client *ContainerClient) acquireLeaseCreateRequest(ctx context.Context, du
|
|||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["x-ms-lease-action"] = []string{"acquire"}
|
||||
req.Raw().Header["x-ms-lease-duration"] = []string{strconv.FormatInt(int64(duration), 10)}
|
||||
if options != nil && options.ProposedLeaseID != nil {
|
||||
req.Raw().Header["x-ms-proposed-lease-id"] = []string{*options.ProposedLeaseID}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
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)}
|
||||
}
|
||||
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"}
|
||||
req.Raw().Header["x-ms-lease-action"] = []string{"acquire"}
|
||||
req.Raw().Header["x-ms-lease-duration"] = []string{strconv.FormatInt(int64(duration), 10)}
|
||||
if options != nil && options.ProposedLeaseID != nil {
|
||||
req.Raw().Header["x-ms-proposed-lease-id"] = []string{*options.ProposedLeaseID}
|
||||
}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
|
|
@ -163,21 +160,21 @@ func (client *ContainerClient) breakLeaseCreateRequest(ctx context.Context, opti
|
|||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["x-ms-lease-action"] = []string{"break"}
|
||||
if options != nil && options.BreakPeriod != nil {
|
||||
req.Raw().Header["x-ms-lease-break-period"] = []string{strconv.FormatInt(int64(*options.BreakPeriod), 10)}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
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)}
|
||||
}
|
||||
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"}
|
||||
req.Raw().Header["x-ms-lease-action"] = []string{"break"}
|
||||
if options != nil && options.BreakPeriod != nil {
|
||||
req.Raw().Header["x-ms-lease-break-period"] = []string{strconv.FormatInt(int64(*options.BreakPeriod), 10)}
|
||||
}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
|
|
@ -263,20 +260,20 @@ func (client *ContainerClient) changeLeaseCreateRequest(ctx context.Context, lea
|
|||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["x-ms-lease-action"] = []string{"change"}
|
||||
req.Raw().Header["x-ms-lease-id"] = []string{leaseID}
|
||||
req.Raw().Header["x-ms-proposed-lease-id"] = []string{proposedLeaseID}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
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)}
|
||||
}
|
||||
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"}
|
||||
req.Raw().Header["x-ms-lease-action"] = []string{"change"}
|
||||
req.Raw().Header["x-ms-lease-id"] = []string{leaseID}
|
||||
req.Raw().Header["x-ms-proposed-lease-id"] = []string{proposedLeaseID}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
|
|
@ -352,17 +349,10 @@ func (client *ContainerClient) createCreateRequest(ctx context.Context, options
|
|||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
if options != nil && options.Metadata != nil {
|
||||
for k, v := range options.Metadata {
|
||||
if v != nil {
|
||||
req.Raw().Header["x-ms-meta-"+k] = []string{*v}
|
||||
}
|
||||
}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
if options != nil && options.Access != nil {
|
||||
req.Raw().Header["x-ms-blob-public-access"] = []string{string(*options.Access)}
|
||||
}
|
||||
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}
|
||||
}
|
||||
|
|
@ -372,7 +362,14 @@ func (client *ContainerClient) createCreateRequest(ctx context.Context, options
|
|||
if containerCPKScopeInfo != nil && containerCPKScopeInfo.PreventEncryptionScopeOverride != nil {
|
||||
req.Raw().Header["x-ms-deny-encryption-scope-override"] = []string{strconv.FormatBool(*containerCPKScopeInfo.PreventEncryptionScopeOverride)}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
if options != nil && options.Metadata != nil {
|
||||
for k, v := range options.Metadata {
|
||||
if v != nil {
|
||||
req.Raw().Header["x-ms-meta-"+k] = []string{*v}
|
||||
}
|
||||
}
|
||||
}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
|
|
@ -446,20 +443,20 @@ func (client *ContainerClient) deleteCreateRequest(ctx context.Context, options
|
|||
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}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
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)}
|
||||
}
|
||||
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 leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil {
|
||||
req.Raw().Header["x-ms-lease-id"] = []string{*leaseAccessConditions.LeaseID}
|
||||
}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
|
|
@ -517,27 +514,27 @@ func (client *ContainerClient) filterBlobsCreateRequest(ctx context.Context, whe
|
|||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("restype", "container")
|
||||
reqQP.Set("comp", "blobs")
|
||||
if options != nil && options.Timeout != nil {
|
||||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
if options != nil && options.Include != nil {
|
||||
reqQP.Set("include", strings.Join(strings.Fields(strings.Trim(fmt.Sprint(options.Include), "[]")), ","))
|
||||
}
|
||||
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), "[]")), ","))
|
||||
reqQP.Set("restype", "container")
|
||||
if options != nil && options.Timeout != nil {
|
||||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
reqQP.Set("where", where)
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
if options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
|
|
@ -599,20 +596,20 @@ func (client *ContainerClient) getAccessPolicyCreateRequest(ctx context.Context,
|
|||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("restype", "container")
|
||||
reqQP.Set("comp", "acl")
|
||||
reqQP.Set("restype", "container")
|
||||
if options != nil && options.Timeout != nil {
|
||||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
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}
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
|
|
@ -685,11 +682,11 @@ func (client *ContainerClient) getAccountInfoCreateRequest(ctx context.Context,
|
|||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("restype", "account")
|
||||
reqQP.Set("comp", "properties")
|
||||
reqQP.Set("restype", "account")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
|
|
@ -758,14 +755,14 @@ func (client *ContainerClient) getPropertiesCreateRequest(ctx context.Context, o
|
|||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
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}
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
|
|
@ -865,10 +862,9 @@ func (client *ContainerClient) ListBlobFlatSegmentCreateRequest(ctx context.Cont
|
|||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("restype", "container")
|
||||
reqQP.Set("comp", "list")
|
||||
if options != nil && options.Prefix != nil {
|
||||
reqQP.Set("prefix", *options.Prefix)
|
||||
if options != nil && options.Include != nil {
|
||||
reqQP.Set("include", strings.Join(strings.Fields(strings.Trim(fmt.Sprint(options.Include), "[]")), ","))
|
||||
}
|
||||
if options != nil && options.Marker != nil {
|
||||
reqQP.Set("marker", *options.Marker)
|
||||
|
|
@ -876,18 +872,19 @@ func (client *ContainerClient) ListBlobFlatSegmentCreateRequest(ctx context.Cont
|
|||
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.Prefix != nil {
|
||||
reqQP.Set("prefix", *options.Prefix)
|
||||
}
|
||||
reqQP.Set("restype", "container")
|
||||
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}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
if options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
|
|
@ -955,30 +952,30 @@ func (client *ContainerClient) ListBlobHierarchySegmentCreateRequest(ctx context
|
|||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("restype", "container")
|
||||
reqQP.Set("comp", "list")
|
||||
if options != nil && options.Prefix != nil {
|
||||
reqQP.Set("prefix", *options.Prefix)
|
||||
}
|
||||
reqQP.Set("delimiter", delimiter)
|
||||
if options != nil && options.Include != nil {
|
||||
reqQP.Set("include", strings.Join(strings.Fields(strings.Trim(fmt.Sprint(options.Include), "[]")), ","))
|
||||
}
|
||||
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.Prefix != nil {
|
||||
reqQP.Set("prefix", *options.Prefix)
|
||||
}
|
||||
reqQP.Set("restype", "container")
|
||||
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}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
if options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
|
|
@ -1049,19 +1046,19 @@ func (client *ContainerClient) releaseLeaseCreateRequest(ctx context.Context, le
|
|||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["x-ms-lease-action"] = []string{"release"}
|
||||
req.Raw().Header["x-ms-lease-id"] = []string{leaseID}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
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)}
|
||||
}
|
||||
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"}
|
||||
req.Raw().Header["x-ms-lease-action"] = []string{"release"}
|
||||
req.Raw().Header["x-ms-lease-id"] = []string{leaseID}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
|
|
@ -1128,13 +1125,13 @@ func (client *ContainerClient) renameCreateRequest(ctx context.Context, sourceCo
|
|||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("restype", "container")
|
||||
reqQP.Set("comp", "rename")
|
||||
reqQP.Set("restype", "container")
|
||||
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}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
if options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
|
|
@ -1142,7 +1139,7 @@ func (client *ContainerClient) renameCreateRequest(ctx context.Context, sourceCo
|
|||
if options != nil && options.SourceLeaseID != nil {
|
||||
req.Raw().Header["x-ms-source-lease-id"] = []string{*options.SourceLeaseID}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
|
|
@ -1207,19 +1204,19 @@ func (client *ContainerClient) renewLeaseCreateRequest(ctx context.Context, leas
|
|||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["x-ms-lease-action"] = []string{"renew"}
|
||||
req.Raw().Header["x-ms-lease-id"] = []string{leaseID}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
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)}
|
||||
}
|
||||
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"}
|
||||
req.Raw().Header["x-ms-lease-action"] = []string{"renew"}
|
||||
req.Raw().Header["x-ms-lease-id"] = []string{leaseID}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
|
|
@ -1288,13 +1285,13 @@ func (client *ContainerClient) restoreCreateRequest(ctx context.Context, options
|
|||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("restype", "container")
|
||||
reqQP.Set("comp", "undelete")
|
||||
reqQP.Set("restype", "container")
|
||||
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}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
if options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
|
|
@ -1304,7 +1301,7 @@ func (client *ContainerClient) restoreCreateRequest(ctx context.Context, options
|
|||
if options != nil && options.DeletedContainerVersion != nil {
|
||||
req.Raw().Header["x-ms-deleted-container-version"] = []string{*options.DeletedContainerVersion}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
|
|
@ -1365,29 +1362,29 @@ func (client *ContainerClient) setAccessPolicyCreateRequest(ctx context.Context,
|
|||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("restype", "container")
|
||||
reqQP.Set("comp", "acl")
|
||||
reqQP.Set("restype", "container")
|
||||
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 options != nil && options.Access != nil {
|
||||
req.Raw().Header["x-ms-blob-public-access"] = []string{string(*options.Access)}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
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)}
|
||||
}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
if options != nil && options.Access != nil {
|
||||
req.Raw().Header["x-ms-blob-public-access"] = []string{string(*options.Access)}
|
||||
}
|
||||
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 leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil {
|
||||
req.Raw().Header["x-ms-lease-id"] = []string{*leaseAccessConditions.LeaseID}
|
||||
}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
type wrapper struct {
|
||||
XMLName xml.Name `xml:"SignedIdentifiers"`
|
||||
ContainerACL *[]*SignedIdentifier `xml:"SignedIdentifier"`
|
||||
|
|
@ -1462,12 +1459,19 @@ func (client *ContainerClient) setMetadataCreateRequest(ctx context.Context, opt
|
|||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("restype", "container")
|
||||
reqQP.Set("comp", "metadata")
|
||||
reqQP.Set("restype", "container")
|
||||
if options != nil && options.Timeout != nil {
|
||||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfModifiedSince != nil {
|
||||
req.Raw().Header["If-Modified-Since"] = []string{(*modifiedAccessConditions.IfModifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
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}
|
||||
}
|
||||
|
|
@ -1478,14 +1482,7 @@ func (client *ContainerClient) setMetadataCreateRequest(ctx context.Context, opt
|
|||
}
|
||||
}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfModifiedSince != nil {
|
||||
req.Raw().Header["If-Modified-Since"] = []string{(*modifiedAccessConditions.IfModifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
|
|
@ -1555,20 +1552,20 @@ func (client *ContainerClient) submitBatchCreateRequest(ctx context.Context, con
|
|||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("restype", "container")
|
||||
reqQP.Set("comp", "batch")
|
||||
reqQP.Set("restype", "container")
|
||||
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["Accept"] = []string{"application/xml"}
|
||||
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"}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
if err := req.SetBody(body, multipartContentType); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//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.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//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.
|
||||
|
|
@ -46,8 +43,12 @@ func (a *AccessPolicy) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) er
|
|||
if err := dec.DecodeElement(aux, &start); err != nil {
|
||||
return err
|
||||
}
|
||||
a.Expiry = (*time.Time)(aux.Expiry)
|
||||
a.Start = (*time.Time)(aux.Start)
|
||||
if aux.Expiry != nil && !(*time.Time)(aux.Expiry).IsZero() {
|
||||
a.Expiry = (*time.Time)(aux.Expiry)
|
||||
}
|
||||
if aux.Start != nil && !(*time.Time)(aux.Start).IsZero() {
|
||||
a.Start = (*time.Time)(aux.Start)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
@ -152,19 +153,35 @@ func (b *BlobProperties) UnmarshalXML(dec *xml.Decoder, start xml.StartElement)
|
|||
if err := dec.DecodeElement(aux, &start); err != nil {
|
||||
return err
|
||||
}
|
||||
b.AccessTierChangeTime = (*time.Time)(aux.AccessTierChangeTime)
|
||||
if aux.AccessTierChangeTime != nil && !(*time.Time)(aux.AccessTierChangeTime).IsZero() {
|
||||
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)
|
||||
if aux.CopyCompletionTime != nil && !(*time.Time)(aux.CopyCompletionTime).IsZero() {
|
||||
b.CopyCompletionTime = (*time.Time)(aux.CopyCompletionTime)
|
||||
}
|
||||
if aux.CreationTime != nil && !(*time.Time)(aux.CreationTime).IsZero() {
|
||||
b.CreationTime = (*time.Time)(aux.CreationTime)
|
||||
}
|
||||
if aux.DeletedTime != nil && !(*time.Time)(aux.DeletedTime).IsZero() {
|
||||
b.DeletedTime = (*time.Time)(aux.DeletedTime)
|
||||
}
|
||||
if aux.ExpiresOn != nil && !(*time.Time)(aux.ExpiresOn).IsZero() {
|
||||
b.ExpiresOn = (*time.Time)(aux.ExpiresOn)
|
||||
}
|
||||
if aux.ImmutabilityPolicyExpiresOn != nil && !(*time.Time)(aux.ImmutabilityPolicyExpiresOn).IsZero() {
|
||||
b.ImmutabilityPolicyExpiresOn = (*time.Time)(aux.ImmutabilityPolicyExpiresOn)
|
||||
}
|
||||
if aux.LastAccessedOn != nil && !(*time.Time)(aux.LastAccessedOn).IsZero() {
|
||||
b.LastAccessedOn = (*time.Time)(aux.LastAccessedOn)
|
||||
}
|
||||
if aux.LastModified != nil && !(*time.Time)(aux.LastModified).IsZero() {
|
||||
b.LastModified = (*time.Time)(aux.LastModified)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
@ -271,8 +288,12 @@ func (c *ContainerProperties) UnmarshalXML(dec *xml.Decoder, start xml.StartElem
|
|||
if err := dec.DecodeElement(aux, &start); err != nil {
|
||||
return err
|
||||
}
|
||||
c.DeletedTime = (*time.Time)(aux.DeletedTime)
|
||||
c.LastModified = (*time.Time)(aux.LastModified)
|
||||
if aux.DeletedTime != nil && !(*time.Time)(aux.DeletedTime).IsZero() {
|
||||
c.DeletedTime = (*time.Time)(aux.DeletedTime)
|
||||
}
|
||||
if aux.LastModified != nil && !(*time.Time)(aux.LastModified).IsZero() {
|
||||
c.LastModified = (*time.Time)(aux.LastModified)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
@ -316,7 +337,9 @@ func (g *GeoReplication) UnmarshalXML(dec *xml.Decoder, start xml.StartElement)
|
|||
if err := dec.DecodeElement(aux, &start); err != nil {
|
||||
return err
|
||||
}
|
||||
g.LastSyncTime = (*time.Time)(aux.LastSyncTime)
|
||||
if aux.LastSyncTime != nil && !(*time.Time)(aux.LastSyncTime).IsZero() {
|
||||
g.LastSyncTime = (*time.Time)(aux.LastSyncTime)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
@ -436,8 +459,12 @@ func (u *UserDelegationKey) UnmarshalXML(dec *xml.Decoder, start xml.StartElemen
|
|||
if err := dec.DecodeElement(aux, &start); err != nil {
|
||||
return err
|
||||
}
|
||||
u.SignedExpiry = (*time.Time)(aux.SignedExpiry)
|
||||
u.SignedStart = (*time.Time)(aux.SignedStart)
|
||||
if aux.SignedExpiry != nil && !(*time.Time)(aux.SignedExpiry).IsZero() {
|
||||
u.SignedExpiry = (*time.Time)(aux.SignedExpiry)
|
||||
}
|
||||
if aux.SignedStart != nil && !(*time.Time)(aux.SignedStart).IsZero() {
|
||||
u.SignedStart = (*time.Time)(aux.SignedStart)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
@ -451,18 +478,8 @@ func populate(m map[string]any, k string, v any) {
|
|||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
if data == nil || string(data) == "null" {
|
||||
return nil
|
||||
}
|
||||
if err := json.Unmarshal(data, v); err != nil {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//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.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//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.
|
||||
|
|
@ -69,13 +66,25 @@ func (client *PageBlobClient) clearPagesCreateRequest(ctx context.Context, conte
|
|||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["x-ms-page-write"] = []string{"clear"}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
req.Raw().Header["Content-Length"] = []string{strconv.FormatInt(contentLength, 10)}
|
||||
if options != nil && options.Range != nil {
|
||||
req.Raw().Header["x-ms-range"] = []string{*options.Range}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfMatch != nil {
|
||||
req.Raw().Header["If-Match"] = []string{string(*modifiedAccessConditions.IfMatch)}
|
||||
}
|
||||
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.IfNoneMatch != nil {
|
||||
req.Raw().Header["If-None-Match"] = []string{string(*modifiedAccessConditions.IfNoneMatch)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfUnmodifiedSince != nil {
|
||||
req.Raw().Header["If-Unmodified-Since"] = []string{(*modifiedAccessConditions.IfUnmodifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
if cpkInfo != nil && cpkInfo.EncryptionAlgorithm != nil {
|
||||
req.Raw().Header["x-ms-encryption-algorithm"] = []string{string(*cpkInfo.EncryptionAlgorithm)}
|
||||
}
|
||||
if cpkInfo != nil && cpkInfo.EncryptionKey != nil {
|
||||
req.Raw().Header["x-ms-encryption-key"] = []string{*cpkInfo.EncryptionKey}
|
||||
|
|
@ -83,41 +92,29 @@ func (client *PageBlobClient) clearPagesCreateRequest(ctx context.Context, conte
|
|||
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 sequenceNumberAccessConditions != nil && sequenceNumberAccessConditions.IfSequenceNumberEqualTo != nil {
|
||||
req.Raw().Header["x-ms-if-sequence-number-eq"] = []string{strconv.FormatInt(*sequenceNumberAccessConditions.IfSequenceNumberEqualTo, 10)}
|
||||
}
|
||||
if sequenceNumberAccessConditions != nil && sequenceNumberAccessConditions.IfSequenceNumberLessThanOrEqualTo != nil {
|
||||
req.Raw().Header["x-ms-if-sequence-number-le"] = []string{strconv.FormatInt(*sequenceNumberAccessConditions.IfSequenceNumberLessThanOrEqualTo, 10)}
|
||||
}
|
||||
if sequenceNumberAccessConditions != nil && sequenceNumberAccessConditions.IfSequenceNumberLessThan != nil {
|
||||
req.Raw().Header["x-ms-if-sequence-number-lt"] = []string{strconv.FormatInt(*sequenceNumberAccessConditions.IfSequenceNumberLessThan, 10)}
|
||||
}
|
||||
if sequenceNumberAccessConditions != nil && sequenceNumberAccessConditions.IfSequenceNumberEqualTo != nil {
|
||||
req.Raw().Header["x-ms-if-sequence-number-eq"] = []string{strconv.FormatInt(*sequenceNumberAccessConditions.IfSequenceNumberEqualTo, 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}
|
||||
}
|
||||
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}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
req.Raw().Header["x-ms-page-write"] = []string{"clear"}
|
||||
if options != nil && options.Range != nil {
|
||||
req.Raw().Header["x-ms-range"] = []string{*options.Range}
|
||||
}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
|
|
@ -218,27 +215,27 @@ func (client *PageBlobClient) copyIncrementalCreateRequest(ctx context.Context,
|
|||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
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)}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfMatch != nil {
|
||||
req.Raw().Header["If-Match"] = []string{string(*modifiedAccessConditions.IfMatch)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfModifiedSince != nil {
|
||||
req.Raw().Header["If-Modified-Since"] = []string{(*modifiedAccessConditions.IfModifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
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 modifiedAccessConditions != nil && modifiedAccessConditions.IfUnmodifiedSince != nil {
|
||||
req.Raw().Header["If-Unmodified-Since"] = []string{(*modifiedAccessConditions.IfUnmodifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
req.Raw().Header["x-ms-copy-source"] = []string{copySource}
|
||||
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"}
|
||||
req.Raw().Header["x-ms-copy-source"] = []string{copySource}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfTags != nil {
|
||||
req.Raw().Header["x-ms-if-tags"] = []string{*modifiedAccessConditions.IfTags}
|
||||
}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
|
|
@ -322,13 +319,28 @@ func (client *PageBlobClient) createCreateRequest(ctx context.Context, contentLe
|
|||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["x-ms-blob-type"] = []string{"PageBlob"}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
req.Raw().Header["Content-Length"] = []string{strconv.FormatInt(contentLength, 10)}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfMatch != nil {
|
||||
req.Raw().Header["If-Match"] = []string{string(*modifiedAccessConditions.IfMatch)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfModifiedSince != nil {
|
||||
req.Raw().Header["If-Modified-Since"] = []string{(*modifiedAccessConditions.IfModifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfNoneMatch != nil {
|
||||
req.Raw().Header["If-None-Match"] = []string{string(*modifiedAccessConditions.IfNoneMatch)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfUnmodifiedSince != nil {
|
||||
req.Raw().Header["If-Unmodified-Since"] = []string{(*modifiedAccessConditions.IfUnmodifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if options != nil && options.Tier != nil {
|
||||
req.Raw().Header["x-ms-access-tier"] = []string{string(*options.Tier)}
|
||||
}
|
||||
if blobHTTPHeaders != nil && blobHTTPHeaders.BlobContentType != nil {
|
||||
req.Raw().Header["x-ms-blob-content-type"] = []string{*blobHTTPHeaders.BlobContentType}
|
||||
if blobHTTPHeaders != nil && blobHTTPHeaders.BlobCacheControl != nil {
|
||||
req.Raw().Header["x-ms-blob-cache-control"] = []string{*blobHTTPHeaders.BlobCacheControl}
|
||||
}
|
||||
if blobHTTPHeaders != nil && blobHTTPHeaders.BlobContentDisposition != nil {
|
||||
req.Raw().Header["x-ms-blob-content-disposition"] = []string{*blobHTTPHeaders.BlobContentDisposition}
|
||||
}
|
||||
if blobHTTPHeaders != nil && blobHTTPHeaders.BlobContentEncoding != nil {
|
||||
req.Raw().Header["x-ms-blob-content-encoding"] = []string{*blobHTTPHeaders.BlobContentEncoding}
|
||||
|
|
@ -336,11 +348,46 @@ func (client *PageBlobClient) createCreateRequest(ctx context.Context, contentLe
|
|||
if blobHTTPHeaders != nil && blobHTTPHeaders.BlobContentLanguage != nil {
|
||||
req.Raw().Header["x-ms-blob-content-language"] = []string{*blobHTTPHeaders.BlobContentLanguage}
|
||||
}
|
||||
req.Raw().Header["x-ms-blob-content-length"] = []string{strconv.FormatInt(blobContentLength, 10)}
|
||||
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 blobHTTPHeaders != nil && blobHTTPHeaders.BlobContentType != nil {
|
||||
req.Raw().Header["x-ms-blob-content-type"] = []string{*blobHTTPHeaders.BlobContentType}
|
||||
}
|
||||
if options != nil && options.BlobSequenceNumber != nil {
|
||||
req.Raw().Header["x-ms-blob-sequence-number"] = []string{strconv.FormatInt(*options.BlobSequenceNumber, 10)}
|
||||
}
|
||||
req.Raw().Header["x-ms-blob-type"] = []string{"PageBlob"}
|
||||
if options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
if cpkInfo != nil && cpkInfo.EncryptionAlgorithm != nil {
|
||||
req.Raw().Header["x-ms-encryption-algorithm"] = []string{string(*cpkInfo.EncryptionAlgorithm)}
|
||||
}
|
||||
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 cpkScopeInfo != nil && cpkScopeInfo.EncryptionScope != nil {
|
||||
req.Raw().Header["x-ms-encryption-scope"] = []string{*cpkScopeInfo.EncryptionScope}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfTags != nil {
|
||||
req.Raw().Header["x-ms-if-tags"] = []string{*modifiedAccessConditions.IfTags}
|
||||
}
|
||||
if options != nil && options.ImmutabilityPolicyMode != nil {
|
||||
req.Raw().Header["x-ms-immutability-policy-mode"] = []string{string(*options.ImmutabilityPolicyMode)}
|
||||
}
|
||||
if options != nil && options.ImmutabilityPolicyExpiry != nil {
|
||||
req.Raw().Header["x-ms-immutability-policy-until-date"] = []string{(*options.ImmutabilityPolicyExpiry).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil {
|
||||
req.Raw().Header["x-ms-lease-id"] = []string{*leaseAccessConditions.LeaseID}
|
||||
}
|
||||
if options != nil && options.LegalHold != nil {
|
||||
req.Raw().Header["x-ms-legal-hold"] = []string{strconv.FormatBool(*options.LegalHold)}
|
||||
}
|
||||
if options != nil && options.Metadata != nil {
|
||||
for k, v := range options.Metadata {
|
||||
|
|
@ -349,60 +396,10 @@ func (client *PageBlobClient) createCreateRequest(ctx context.Context, contentLe
|
|||
}
|
||||
}
|
||||
}
|
||||
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-blob-content-length"] = []string{strconv.FormatInt(blobContentLength, 10)}
|
||||
if options != nil && options.BlobSequenceNumber != nil {
|
||||
req.Raw().Header["x-ms-blob-sequence-number"] = []string{strconv.FormatInt(*options.BlobSequenceNumber, 10)}
|
||||
}
|
||||
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"}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
|
|
@ -498,45 +495,45 @@ func (client *PageBlobClient) GetPageRangesCreateRequest(ctx context.Context, op
|
|||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("comp", "pagelist")
|
||||
if options != nil && options.Snapshot != nil {
|
||||
reqQP.Set("snapshot", *options.Snapshot)
|
||||
}
|
||||
if options != nil && options.Timeout != nil {
|
||||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
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))
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
if options != nil && options.Range != nil {
|
||||
req.Raw().Header["x-ms-range"] = []string{*options.Range}
|
||||
if options != nil && options.Snapshot != nil {
|
||||
reqQP.Set("snapshot", *options.Snapshot)
|
||||
}
|
||||
if leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil {
|
||||
req.Raw().Header["x-ms-lease-id"] = []string{*leaseAccessConditions.LeaseID}
|
||||
if options != nil && options.Timeout != nil {
|
||||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfMatch != nil {
|
||||
req.Raw().Header["If-Match"] = []string{string(*modifiedAccessConditions.IfMatch)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfModifiedSince != nil {
|
||||
req.Raw().Header["If-Modified-Since"] = []string{(*modifiedAccessConditions.IfModifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfNoneMatch != nil {
|
||||
req.Raw().Header["If-None-Match"] = []string{string(*modifiedAccessConditions.IfNoneMatch)}
|
||||
}
|
||||
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 options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
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 leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil {
|
||||
req.Raw().Header["x-ms-lease-id"] = []string{*leaseAccessConditions.LeaseID}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
if options != nil && options.Range != nil {
|
||||
req.Raw().Header["x-ms-range"] = []string{*options.Range}
|
||||
}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
|
|
@ -619,51 +616,51 @@ func (client *PageBlobClient) GetPageRangesDiffCreateRequest(ctx context.Context
|
|||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("comp", "pagelist")
|
||||
if options != nil && options.Snapshot != nil {
|
||||
reqQP.Set("snapshot", *options.Snapshot)
|
||||
}
|
||||
if options != nil && options.Timeout != nil {
|
||||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
if options != nil && options.Prevsnapshot != nil {
|
||||
reqQP.Set("prevsnapshot", *options.Prevsnapshot)
|
||||
}
|
||||
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.Prevsnapshot != nil {
|
||||
reqQP.Set("prevsnapshot", *options.Prevsnapshot)
|
||||
}
|
||||
if options != nil && options.Snapshot != nil {
|
||||
reqQP.Set("snapshot", *options.Snapshot)
|
||||
}
|
||||
if options != nil && options.Timeout != nil {
|
||||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfMatch != nil {
|
||||
req.Raw().Header["If-Match"] = []string{string(*modifiedAccessConditions.IfMatch)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfModifiedSince != nil {
|
||||
req.Raw().Header["If-Modified-Since"] = []string{(*modifiedAccessConditions.IfModifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfNoneMatch != nil {
|
||||
req.Raw().Header["If-None-Match"] = []string{string(*modifiedAccessConditions.IfNoneMatch)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfUnmodifiedSince != nil {
|
||||
req.Raw().Header["If-Unmodified-Since"] = []string{(*modifiedAccessConditions.IfUnmodifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfTags != nil {
|
||||
req.Raw().Header["x-ms-if-tags"] = []string{*modifiedAccessConditions.IfTags}
|
||||
}
|
||||
if leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil {
|
||||
req.Raw().Header["x-ms-lease-id"] = []string{*leaseAccessConditions.LeaseID}
|
||||
}
|
||||
if options != nil && options.PrevSnapshotURL != nil {
|
||||
req.Raw().Header["x-ms-previous-snapshot-url"] = []string{*options.PrevSnapshotURL}
|
||||
}
|
||||
if options != nil && options.Range != nil {
|
||||
req.Raw().Header["x-ms-range"] = []string{*options.Range}
|
||||
}
|
||||
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 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
|
||||
}
|
||||
|
||||
|
|
@ -750,8 +747,25 @@ func (client *PageBlobClient) resizeCreateRequest(ctx context.Context, blobConte
|
|||
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}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfMatch != nil {
|
||||
req.Raw().Header["If-Match"] = []string{string(*modifiedAccessConditions.IfMatch)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfModifiedSince != nil {
|
||||
req.Raw().Header["If-Modified-Since"] = []string{(*modifiedAccessConditions.IfModifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfNoneMatch != nil {
|
||||
req.Raw().Header["If-None-Match"] = []string{string(*modifiedAccessConditions.IfNoneMatch)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfUnmodifiedSince != nil {
|
||||
req.Raw().Header["If-Unmodified-Since"] = []string{(*modifiedAccessConditions.IfUnmodifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
req.Raw().Header["x-ms-blob-content-length"] = []string{strconv.FormatInt(blobContentLength, 10)}
|
||||
if options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
if cpkInfo != nil && cpkInfo.EncryptionAlgorithm != nil {
|
||||
req.Raw().Header["x-ms-encryption-algorithm"] = []string{string(*cpkInfo.EncryptionAlgorithm)}
|
||||
}
|
||||
if cpkInfo != nil && cpkInfo.EncryptionKey != nil {
|
||||
req.Raw().Header["x-ms-encryption-key"] = []string{*cpkInfo.EncryptionKey}
|
||||
|
|
@ -759,33 +773,16 @@ func (client *PageBlobClient) resizeCreateRequest(ctx context.Context, blobConte
|
|||
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-blob-content-length"] = []string{strconv.FormatInt(blobContentLength, 10)}
|
||||
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}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
|
|
@ -868,33 +865,33 @@ func (client *PageBlobClient) updateSequenceNumberCreateRequest(ctx context.Cont
|
|||
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}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfMatch != nil {
|
||||
req.Raw().Header["If-Match"] = []string{string(*modifiedAccessConditions.IfMatch)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfModifiedSince != nil {
|
||||
req.Raw().Header["If-Modified-Since"] = []string{(*modifiedAccessConditions.IfModifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfNoneMatch != nil {
|
||||
req.Raw().Header["If-None-Match"] = []string{string(*modifiedAccessConditions.IfNoneMatch)}
|
||||
}
|
||||
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 options != nil && options.BlobSequenceNumber != nil {
|
||||
req.Raw().Header["x-ms-blob-sequence-number"] = []string{strconv.FormatInt(*options.BlobSequenceNumber, 10)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfNoneMatch != nil {
|
||||
req.Raw().Header["If-None-Match"] = []string{string(*modifiedAccessConditions.IfNoneMatch)}
|
||||
if options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfTags != nil {
|
||||
req.Raw().Header["x-ms-if-tags"] = []string{*modifiedAccessConditions.IfTags}
|
||||
}
|
||||
if leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil {
|
||||
req.Raw().Header["x-ms-lease-id"] = []string{*leaseAccessConditions.LeaseID}
|
||||
}
|
||||
req.Raw().Header["x-ms-sequence-number-action"] = []string{string(sequenceNumberAction)}
|
||||
if options != nil && options.BlobSequenceNumber != nil {
|
||||
req.Raw().Header["x-ms-blob-sequence-number"] = []string{strconv.FormatInt(*options.BlobSequenceNumber, 10)}
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
|
|
@ -980,19 +977,31 @@ func (client *PageBlobClient) uploadPagesCreateRequest(ctx context.Context, cont
|
|||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["x-ms-page-write"] = []string{"update"}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
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 modifiedAccessConditions != nil && modifiedAccessConditions.IfMatch != nil {
|
||||
req.Raw().Header["If-Match"] = []string{string(*modifiedAccessConditions.IfMatch)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfModifiedSince != nil {
|
||||
req.Raw().Header["If-Modified-Since"] = []string{(*modifiedAccessConditions.IfModifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfNoneMatch != nil {
|
||||
req.Raw().Header["If-None-Match"] = []string{string(*modifiedAccessConditions.IfNoneMatch)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfUnmodifiedSince != nil {
|
||||
req.Raw().Header["If-Unmodified-Since"] = []string{(*modifiedAccessConditions.IfUnmodifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
if options != nil && options.TransactionalContentCRC64 != nil {
|
||||
req.Raw().Header["x-ms-content-crc64"] = []string{base64.StdEncoding.EncodeToString(options.TransactionalContentCRC64)}
|
||||
}
|
||||
if options != nil && options.Range != nil {
|
||||
req.Raw().Header["x-ms-range"] = []string{*options.Range}
|
||||
}
|
||||
if leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil {
|
||||
req.Raw().Header["x-ms-lease-id"] = []string{*leaseAccessConditions.LeaseID}
|
||||
if cpkInfo != nil && cpkInfo.EncryptionAlgorithm != nil {
|
||||
req.Raw().Header["x-ms-encryption-algorithm"] = []string{string(*cpkInfo.EncryptionAlgorithm)}
|
||||
}
|
||||
if cpkInfo != nil && cpkInfo.EncryptionKey != nil {
|
||||
req.Raw().Header["x-ms-encryption-key"] = []string{*cpkInfo.EncryptionKey}
|
||||
|
|
@ -1000,41 +1009,29 @@ func (client *PageBlobClient) uploadPagesCreateRequest(ctx context.Context, cont
|
|||
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 sequenceNumberAccessConditions != nil && sequenceNumberAccessConditions.IfSequenceNumberEqualTo != nil {
|
||||
req.Raw().Header["x-ms-if-sequence-number-eq"] = []string{strconv.FormatInt(*sequenceNumberAccessConditions.IfSequenceNumberEqualTo, 10)}
|
||||
}
|
||||
if sequenceNumberAccessConditions != nil && sequenceNumberAccessConditions.IfSequenceNumberLessThanOrEqualTo != nil {
|
||||
req.Raw().Header["x-ms-if-sequence-number-le"] = []string{strconv.FormatInt(*sequenceNumberAccessConditions.IfSequenceNumberLessThanOrEqualTo, 10)}
|
||||
}
|
||||
if sequenceNumberAccessConditions != nil && sequenceNumberAccessConditions.IfSequenceNumberLessThan != nil {
|
||||
req.Raw().Header["x-ms-if-sequence-number-lt"] = []string{strconv.FormatInt(*sequenceNumberAccessConditions.IfSequenceNumberLessThan, 10)}
|
||||
}
|
||||
if sequenceNumberAccessConditions != nil && sequenceNumberAccessConditions.IfSequenceNumberEqualTo != nil {
|
||||
req.Raw().Header["x-ms-if-sequence-number-eq"] = []string{strconv.FormatInt(*sequenceNumberAccessConditions.IfSequenceNumberEqualTo, 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}
|
||||
}
|
||||
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}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
req.Raw().Header["x-ms-page-write"] = []string{"update"}
|
||||
if options != nil && options.Range != nil {
|
||||
req.Raw().Header["x-ms-range"] = []string{*options.Range}
|
||||
}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
if err := req.SetBody(body, "application/octet-stream"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -1158,31 +1155,41 @@ func (client *PageBlobClient) uploadPagesFromURLCreateRequest(ctx context.Contex
|
|||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["x-ms-page-write"] = []string{"update"}
|
||||
req.Raw().Header["x-ms-copy-source"] = []string{sourceURL}
|
||||
req.Raw().Header["x-ms-source-range"] = []string{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["Accept"] = []string{"application/xml"}
|
||||
req.Raw().Header["Content-Length"] = []string{strconv.FormatInt(contentLength, 10)}
|
||||
req.Raw().Header["x-ms-range"] = []string{rangeParam}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfMatch != nil {
|
||||
req.Raw().Header["If-Match"] = []string{string(*modifiedAccessConditions.IfMatch)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfModifiedSince != nil {
|
||||
req.Raw().Header["If-Modified-Since"] = []string{(*modifiedAccessConditions.IfModifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfNoneMatch != nil {
|
||||
req.Raw().Header["If-None-Match"] = []string{string(*modifiedAccessConditions.IfNoneMatch)}
|
||||
}
|
||||
if modifiedAccessConditions != nil && modifiedAccessConditions.IfUnmodifiedSince != nil {
|
||||
req.Raw().Header["If-Unmodified-Since"] = []string{(*modifiedAccessConditions.IfUnmodifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
if options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
req.Raw().Header["x-ms-copy-source"] = []string{sourceURL}
|
||||
if options != nil && options.CopySourceAuthorization != nil {
|
||||
req.Raw().Header["x-ms-copy-source-authorization"] = []string{*options.CopySourceAuthorization}
|
||||
}
|
||||
if cpkInfo != nil && cpkInfo.EncryptionAlgorithm != nil {
|
||||
req.Raw().Header["x-ms-encryption-algorithm"] = []string{string(*cpkInfo.EncryptionAlgorithm)}
|
||||
}
|
||||
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 sequenceNumberAccessConditions != nil && sequenceNumberAccessConditions.IfSequenceNumberEqualTo != nil {
|
||||
req.Raw().Header["x-ms-if-sequence-number-eq"] = []string{strconv.FormatInt(*sequenceNumberAccessConditions.IfSequenceNumberEqualTo, 10)}
|
||||
}
|
||||
if sequenceNumberAccessConditions != nil && sequenceNumberAccessConditions.IfSequenceNumberLessThanOrEqualTo != nil {
|
||||
req.Raw().Header["x-ms-if-sequence-number-le"] = []string{strconv.FormatInt(*sequenceNumberAccessConditions.IfSequenceNumberLessThanOrEqualTo, 10)}
|
||||
|
|
@ -1190,44 +1197,34 @@ func (client *PageBlobClient) uploadPagesFromURLCreateRequest(ctx context.Contex
|
|||
if sequenceNumberAccessConditions != nil && sequenceNumberAccessConditions.IfSequenceNumberLessThan != nil {
|
||||
req.Raw().Header["x-ms-if-sequence-number-lt"] = []string{strconv.FormatInt(*sequenceNumberAccessConditions.IfSequenceNumberLessThan, 10)}
|
||||
}
|
||||
if sequenceNumberAccessConditions != nil && sequenceNumberAccessConditions.IfSequenceNumberEqualTo != nil {
|
||||
req.Raw().Header["x-ms-if-sequence-number-eq"] = []string{strconv.FormatInt(*sequenceNumberAccessConditions.IfSequenceNumberEqualTo, 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 leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil {
|
||||
req.Raw().Header["x-ms-lease-id"] = []string{*leaseAccessConditions.LeaseID}
|
||||
}
|
||||
if sourceModifiedAccessConditions != nil && sourceModifiedAccessConditions.SourceIfUnmodifiedSince != nil {
|
||||
req.Raw().Header["x-ms-source-if-unmodified-since"] = []string{(*sourceModifiedAccessConditions.SourceIfUnmodifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
req.Raw().Header["x-ms-page-write"] = []string{"update"}
|
||||
req.Raw().Header["x-ms-range"] = []string{rangeParam}
|
||||
if options != nil && options.SourceContentcrc64 != nil {
|
||||
req.Raw().Header["x-ms-source-content-crc64"] = []string{base64.StdEncoding.EncodeToString(options.SourceContentcrc64)}
|
||||
}
|
||||
if options != nil && options.SourceContentMD5 != nil {
|
||||
req.Raw().Header["x-ms-source-content-md5"] = []string{base64.StdEncoding.EncodeToString(options.SourceContentMD5)}
|
||||
}
|
||||
if sourceModifiedAccessConditions != nil && sourceModifiedAccessConditions.SourceIfMatch != nil {
|
||||
req.Raw().Header["x-ms-source-if-match"] = []string{string(*sourceModifiedAccessConditions.SourceIfMatch)}
|
||||
}
|
||||
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.SourceIfNoneMatch != nil {
|
||||
req.Raw().Header["x-ms-source-if-none-match"] = []string{string(*sourceModifiedAccessConditions.SourceIfNoneMatch)}
|
||||
}
|
||||
if sourceModifiedAccessConditions != nil && sourceModifiedAccessConditions.SourceIfUnmodifiedSince != nil {
|
||||
req.Raw().Header["x-ms-source-if-unmodified-since"] = []string{(*sourceModifiedAccessConditions.SourceIfUnmodifiedSince).In(gmt).Format(time.RFC1123)}
|
||||
}
|
||||
req.Raw().Header["x-ms-source-range"] = []string{sourceRange}
|
||||
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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//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.
|
||||
|
|
@ -1,6 +1,3 @@
|
|||
//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.
|
||||
|
|
@ -62,25 +59,25 @@ func (client *ServiceClient) filterBlobsCreateRequest(ctx context.Context, where
|
|||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("comp", "blobs")
|
||||
if options != nil && options.Timeout != nil {
|
||||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
if options != nil && options.Include != nil {
|
||||
reqQP.Set("include", strings.Join(strings.Fields(strings.Trim(fmt.Sprint(options.Include), "[]")), ","))
|
||||
}
|
||||
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), "[]")), ","))
|
||||
if options != nil && options.Timeout != nil {
|
||||
reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10))
|
||||
}
|
||||
reqQP.Set("where", where)
|
||||
req.Raw().URL.RawQuery = strings.Replace(reqQP.Encode(), "+", "%20", -1)
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
if options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
|
|
@ -139,11 +136,11 @@ func (client *ServiceClient) getAccountInfoCreateRequest(ctx context.Context, op
|
|||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("restype", "account")
|
||||
reqQP.Set("comp", "properties")
|
||||
reqQP.Set("restype", "account")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
|
|
@ -213,17 +210,17 @@ func (client *ServiceClient) getPropertiesCreateRequest(ctx context.Context, opt
|
|||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("restype", "service")
|
||||
reqQP.Set("comp", "properties")
|
||||
reqQP.Set("restype", "service")
|
||||
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}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
if options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
|
|
@ -276,17 +273,17 @@ func (client *ServiceClient) getStatisticsCreateRequest(ctx context.Context, opt
|
|||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("restype", "service")
|
||||
reqQP.Set("comp", "stats")
|
||||
reqQP.Set("restype", "service")
|
||||
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}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
if options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
|
|
@ -348,17 +345,17 @@ func (client *ServiceClient) getUserDelegationKeyCreateRequest(ctx context.Conte
|
|||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("restype", "service")
|
||||
reqQP.Set("comp", "userdelegationkey")
|
||||
reqQP.Set("restype", "service")
|
||||
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}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
if options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
if err := runtime.MarshalAsXML(req, keyInfo); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -405,8 +402,8 @@ func (client *ServiceClient) ListContainersSegmentCreateRequest(ctx context.Cont
|
|||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("comp", "list")
|
||||
if options != nil && options.Prefix != nil {
|
||||
reqQP.Set("prefix", *options.Prefix)
|
||||
if options != nil && options.Include != nil {
|
||||
reqQP.Set("include", strings.Join(strings.Fields(strings.Trim(fmt.Sprint(options.Include), "[]")), ","))
|
||||
}
|
||||
if options != nil && options.Marker != nil {
|
||||
reqQP.Set("marker", *options.Marker)
|
||||
|
|
@ -414,18 +411,18 @@ func (client *ServiceClient) ListContainersSegmentCreateRequest(ctx context.Cont
|
|||
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.Prefix != nil {
|
||||
reqQP.Set("prefix", *options.Prefix)
|
||||
}
|
||||
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}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
if options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
|
|
@ -479,17 +476,17 @@ func (client *ServiceClient) setPropertiesCreateRequest(ctx context.Context, sto
|
|||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("restype", "service")
|
||||
reqQP.Set("comp", "properties")
|
||||
reqQP.Set("restype", "service")
|
||||
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}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
if options != nil && options.RequestID != nil {
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID}
|
||||
}
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
if err := runtime.MarshalAsXML(req, storageServiceProperties); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -551,13 +548,13 @@ func (client *ServiceClient) submitBatchCreateRequest(ctx context.Context, conte
|
|||
}
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
runtime.SkipBodyDownload(req)
|
||||
req.Raw().Header["Accept"] = []string{"application/xml"}
|
||||
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"}
|
||||
req.Raw().Header["x-ms-version"] = []string{ServiceVersion}
|
||||
if err := req.SetBody(body, multipartContentType); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//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.
|
||||
|
|
@ -36,7 +33,14 @@ func (t *dateTimeRFC1123) UnmarshalJSON(data []byte) error {
|
|||
}
|
||||
|
||||
func (t *dateTimeRFC1123) UnmarshalText(data []byte) error {
|
||||
if len(data) == 0 {
|
||||
return nil
|
||||
}
|
||||
p, err := time.Parse(time.RFC1123, string(data))
|
||||
*t = dateTimeRFC1123(p)
|
||||
return err
|
||||
}
|
||||
|
||||
func (t dateTimeRFC1123) String() string {
|
||||
return time.Time(t).Format(time.RFC1123)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//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.
|
||||
|
|
@ -15,12 +12,16 @@ import (
|
|||
)
|
||||
|
||||
// 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+)*"*$`)
|
||||
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 + `"`
|
||||
utcDateTime = "2006-01-02T15:04:05.999999999"
|
||||
utcDateTimeJSON = `"` + utcDateTime + `"`
|
||||
utcDateTimeNoT = "2006-01-02 15:04:05.999999999"
|
||||
utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"`
|
||||
dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00`
|
||||
dateTimeJSON = `"` + time.RFC3339Nano + `"`
|
||||
dateTimeJSONNoT = `"` + dateTimeNoT + `"`
|
||||
)
|
||||
|
||||
type dateTimeRFC3339 time.Time
|
||||
|
|
@ -36,17 +37,36 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error {
|
||||
layout := utcDateTimeJSON
|
||||
if tzOffsetRegex.Match(data) {
|
||||
tzOffset := tzOffsetRegex.Match(data)
|
||||
hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t")
|
||||
var layout string
|
||||
if tzOffset && hasT {
|
||||
layout = dateTimeJSON
|
||||
} else if tzOffset {
|
||||
layout = dateTimeJSONNoT
|
||||
} else if hasT {
|
||||
layout = utcDateTimeJSON
|
||||
} else {
|
||||
layout = utcDateTimeJSONNoT
|
||||
}
|
||||
return t.Parse(layout, string(data))
|
||||
}
|
||||
|
||||
func (t *dateTimeRFC3339) UnmarshalText(data []byte) error {
|
||||
layout := utcDateTime
|
||||
if tzOffsetRegex.Match(data) {
|
||||
if len(data) == 0 {
|
||||
return nil
|
||||
}
|
||||
tzOffset := tzOffsetRegex.Match(data)
|
||||
hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t")
|
||||
var layout string
|
||||
if tzOffset && hasT {
|
||||
layout = time.RFC3339Nano
|
||||
} else if tzOffset {
|
||||
layout = dateTimeNoT
|
||||
} else if hasT {
|
||||
layout = utcDateTime
|
||||
} else {
|
||||
layout = utcDateTimeNoT
|
||||
}
|
||||
return t.Parse(layout, string(data))
|
||||
}
|
||||
|
|
@ -56,3 +76,7 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error {
|
|||
*t = dateTimeRFC3339(p)
|
||||
return err
|
||||
}
|
||||
|
||||
func (t dateTimeRFC3339) String() string {
|
||||
return time.Time(t).Format(time.RFC3339Nano)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//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.
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@ func DoBatchTransfer(ctx context.Context, o *BatchTransferOptions) error {
|
|||
|
||||
// Create the goroutines that process each operation (in parallel).
|
||||
for g := uint16(0); g < o.Concurrency; g++ {
|
||||
//grIndex := g
|
||||
go func() {
|
||||
for f := range operationChannel {
|
||||
err := f()
|
||||
|
|
|
|||
4
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/pageblob/client.go
generated
vendored
4
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/pageblob/client.go
generated
vendored
|
|
@ -380,8 +380,8 @@ func (pb *Client) GetAccountInfo(ctx context.Context, o *blob.GetAccountInfoOpti
|
|||
|
||||
// SetHTTPHeaders changes a blob's HTTP headers.
|
||||
// For more information, see https://docs.microsoft.com/rest/api/storageservices/set-blob-properties.
|
||||
func (pb *Client) SetHTTPHeaders(ctx context.Context, HTTPHeaders blob.HTTPHeaders, o *blob.SetHTTPHeadersOptions) (blob.SetHTTPHeadersResponse, error) {
|
||||
return pb.BlobClient().SetHTTPHeaders(ctx, HTTPHeaders, o)
|
||||
func (pb *Client) SetHTTPHeaders(ctx context.Context, httpHeaders blob.HTTPHeaders, o *blob.SetHTTPHeadersOptions) (blob.SetHTTPHeadersResponse, error) {
|
||||
return pb.BlobClient().SetHTTPHeaders(ctx, httpHeaders, o)
|
||||
}
|
||||
|
||||
// SetMetadata changes a blob's metadata.
|
||||
|
|
|
|||
4
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/sas/service.go
generated
vendored
4
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/sas/service.go
generated
vendored
|
|
@ -255,7 +255,7 @@ func (v BlobSignatureValues) SignWithUserDelegation(userDelegationCredential *Us
|
|||
signature: signature,
|
||||
}
|
||||
|
||||
//User delegation SAS specific parameters
|
||||
// User delegation SAS specific parameters
|
||||
p.signedOID = *udk.SignedOID
|
||||
p.signedTID = *udk.SignedTID
|
||||
p.signedStart = *udk.SignedStart
|
||||
|
|
@ -272,7 +272,7 @@ func getCanonicalName(account string, containerName string, blobName string, dir
|
|||
// Blob: "/blob/account/containername/blobname"
|
||||
elements := []string{"/blob/", account, "/", containerName}
|
||||
if blobName != "" {
|
||||
elements = append(elements, "/", strings.Replace(blobName, "\\", "/", -1))
|
||||
elements = append(elements, "/", strings.ReplaceAll(blobName, "\\", "/"))
|
||||
} else if directoryName != "" {
|
||||
elements = append(elements, "/", directoryName)
|
||||
}
|
||||
|
|
|
|||
2
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/sas/url_parts.go
generated
vendored
2
vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/sas/url_parts.go
generated
vendored
|
|
@ -117,7 +117,7 @@ func (up URLParts) String() string {
|
|||
|
||||
rawQuery := up.UnparsedParams
|
||||
|
||||
//If no snapshot is initially provided, fill it in from the SAS query properties to help the user
|
||||
// If no snapshot is initially provided, fill it in from the SAS query properties to help the user
|
||||
if up.Snapshot == "" && !up.SAS.SnapshotTime().IsZero() {
|
||||
up.Snapshot = up.SAS.SnapshotTime().Format(exported.SnapshotTimeFormat)
|
||||
}
|
||||
|
|
|
|||
109
vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go
generated
vendored
109
vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go
generated
vendored
|
|
@ -829,27 +829,48 @@ var awsPartition = partition{
|
|||
endpointKey{
|
||||
Region: "ap-northeast-2",
|
||||
}: endpoint{},
|
||||
endpointKey{
|
||||
Region: "ap-northeast-3",
|
||||
}: endpoint{},
|
||||
endpointKey{
|
||||
Region: "ap-south-1",
|
||||
}: endpoint{},
|
||||
endpointKey{
|
||||
Region: "ap-south-2",
|
||||
}: endpoint{},
|
||||
endpointKey{
|
||||
Region: "ap-southeast-1",
|
||||
}: endpoint{},
|
||||
endpointKey{
|
||||
Region: "ap-southeast-2",
|
||||
}: endpoint{},
|
||||
endpointKey{
|
||||
Region: "ap-southeast-3",
|
||||
}: endpoint{},
|
||||
endpointKey{
|
||||
Region: "ap-southeast-4",
|
||||
}: endpoint{},
|
||||
endpointKey{
|
||||
Region: "ca-central-1",
|
||||
}: endpoint{},
|
||||
endpointKey{
|
||||
Region: "ca-west-1",
|
||||
}: endpoint{},
|
||||
endpointKey{
|
||||
Region: "eu-central-1",
|
||||
}: endpoint{},
|
||||
endpointKey{
|
||||
Region: "eu-central-2",
|
||||
}: endpoint{},
|
||||
endpointKey{
|
||||
Region: "eu-north-1",
|
||||
}: endpoint{},
|
||||
endpointKey{
|
||||
Region: "eu-south-1",
|
||||
}: endpoint{},
|
||||
endpointKey{
|
||||
Region: "eu-south-2",
|
||||
}: endpoint{},
|
||||
endpointKey{
|
||||
Region: "eu-west-1",
|
||||
}: endpoint{},
|
||||
|
|
@ -859,6 +880,12 @@ var awsPartition = partition{
|
|||
endpointKey{
|
||||
Region: "eu-west-3",
|
||||
}: endpoint{},
|
||||
endpointKey{
|
||||
Region: "il-central-1",
|
||||
}: endpoint{},
|
||||
endpointKey{
|
||||
Region: "me-central-1",
|
||||
}: endpoint{},
|
||||
endpointKey{
|
||||
Region: "me-south-1",
|
||||
}: endpoint{},
|
||||
|
|
@ -13041,6 +13068,9 @@ var awsPartition = partition{
|
|||
endpointKey{
|
||||
Region: "eu-central-1",
|
||||
}: endpoint{},
|
||||
endpointKey{
|
||||
Region: "eu-central-2",
|
||||
}: endpoint{},
|
||||
endpointKey{
|
||||
Region: "eu-north-1",
|
||||
}: endpoint{},
|
||||
|
|
@ -22495,6 +22525,9 @@ var awsPartition = partition{
|
|||
}: endpoint{
|
||||
Hostname: "network-firewall-fips.ca-central-1.amazonaws.com",
|
||||
},
|
||||
endpointKey{
|
||||
Region: "ca-west-1",
|
||||
}: endpoint{},
|
||||
endpointKey{
|
||||
Region: "eu-central-1",
|
||||
}: endpoint{},
|
||||
|
|
@ -24452,6 +24485,14 @@ var awsPartition = partition{
|
|||
Region: "ca-central-1",
|
||||
},
|
||||
},
|
||||
endpointKey{
|
||||
Region: "ca-west-1",
|
||||
}: endpoint{
|
||||
Hostname: "portal.sso.ca-west-1.amazonaws.com",
|
||||
CredentialScope: credentialScope{
|
||||
Region: "ca-west-1",
|
||||
},
|
||||
},
|
||||
endpointKey{
|
||||
Region: "eu-central-1",
|
||||
}: endpoint{
|
||||
|
|
@ -33594,6 +33635,20 @@ var awsPartition = partition{
|
|||
}: endpoint{},
|
||||
},
|
||||
},
|
||||
"tax": service{
|
||||
PartitionEndpoint: "aws-global",
|
||||
IsRegionalized: boxedFalse,
|
||||
Endpoints: serviceEndpoints{
|
||||
endpointKey{
|
||||
Region: "aws-global",
|
||||
}: endpoint{
|
||||
Hostname: "tax.us-east-1.amazonaws.com",
|
||||
CredentialScope: credentialScope{
|
||||
Region: "us-east-1",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"textract": service{
|
||||
Endpoints: serviceEndpoints{
|
||||
endpointKey{
|
||||
|
|
@ -39946,16 +40001,12 @@ var awsusgovPartition = partition{
|
|||
Endpoints: serviceEndpoints{
|
||||
endpointKey{
|
||||
Region: "us-gov-east-1",
|
||||
}: endpoint{
|
||||
Hostname: "autoscaling-plans.us-gov-east-1.amazonaws.com",
|
||||
Protocols: []string{"http", "https"},
|
||||
},
|
||||
}: endpoint{},
|
||||
endpointKey{
|
||||
Region: "us-gov-east-1",
|
||||
Variant: fipsVariant,
|
||||
}: endpoint{
|
||||
Hostname: "autoscaling-plans.us-gov-east-1.amazonaws.com",
|
||||
Protocols: []string{"http", "https"},
|
||||
Hostname: "autoscaling-plans.us-gov-east-1.amazonaws.com",
|
||||
},
|
||||
endpointKey{
|
||||
Region: "us-gov-east-1-fips",
|
||||
|
|
@ -39967,16 +40018,12 @@ var awsusgovPartition = partition{
|
|||
},
|
||||
endpointKey{
|
||||
Region: "us-gov-west-1",
|
||||
}: endpoint{
|
||||
Hostname: "autoscaling-plans.us-gov-west-1.amazonaws.com",
|
||||
Protocols: []string{"http", "https"},
|
||||
},
|
||||
}: endpoint{},
|
||||
endpointKey{
|
||||
Region: "us-gov-west-1",
|
||||
Variant: fipsVariant,
|
||||
}: endpoint{
|
||||
Hostname: "autoscaling-plans.us-gov-west-1.amazonaws.com",
|
||||
Protocols: []string{"http", "https"},
|
||||
Hostname: "autoscaling-plans.us-gov-west-1.amazonaws.com",
|
||||
},
|
||||
endpointKey{
|
||||
Region: "us-gov-west-1-fips",
|
||||
|
|
@ -40942,20 +40989,40 @@ var awsusgovPartition = partition{
|
|||
"directconnect": service{
|
||||
Endpoints: serviceEndpoints{
|
||||
endpointKey{
|
||||
Region: "us-gov-east-1",
|
||||
Region: "fips-us-gov-east-1",
|
||||
}: endpoint{
|
||||
Hostname: "directconnect.us-gov-east-1.amazonaws.com",
|
||||
Hostname: "directconnect-fips.us-gov-east-1.amazonaws.com",
|
||||
CredentialScope: credentialScope{
|
||||
Region: "us-gov-east-1",
|
||||
},
|
||||
Deprecated: boxedTrue,
|
||||
},
|
||||
endpointKey{
|
||||
Region: "us-gov-west-1",
|
||||
Region: "fips-us-gov-west-1",
|
||||
}: endpoint{
|
||||
Hostname: "directconnect.us-gov-west-1.amazonaws.com",
|
||||
Hostname: "directconnect-fips.us-gov-west-1.amazonaws.com",
|
||||
CredentialScope: credentialScope{
|
||||
Region: "us-gov-west-1",
|
||||
},
|
||||
Deprecated: boxedTrue,
|
||||
},
|
||||
endpointKey{
|
||||
Region: "us-gov-east-1",
|
||||
}: endpoint{},
|
||||
endpointKey{
|
||||
Region: "us-gov-east-1",
|
||||
Variant: fipsVariant,
|
||||
}: endpoint{
|
||||
Hostname: "directconnect-fips.us-gov-east-1.amazonaws.com",
|
||||
},
|
||||
endpointKey{
|
||||
Region: "us-gov-west-1",
|
||||
}: endpoint{},
|
||||
endpointKey{
|
||||
Region: "us-gov-west-1",
|
||||
Variant: fipsVariant,
|
||||
}: endpoint{
|
||||
Hostname: "directconnect-fips.us-gov-west-1.amazonaws.com",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -46345,6 +46412,9 @@ var awsisoPartition = partition{
|
|||
endpointKey{
|
||||
Region: "us-iso-east-1",
|
||||
}: endpoint{},
|
||||
endpointKey{
|
||||
Region: "us-iso-west-1",
|
||||
}: endpoint{},
|
||||
},
|
||||
},
|
||||
"appconfig": service{
|
||||
|
|
@ -47658,6 +47728,13 @@ var awsisobPartition = partition{
|
|||
}: endpoint{},
|
||||
},
|
||||
},
|
||||
"apigateway": service{
|
||||
Endpoints: serviceEndpoints{
|
||||
endpointKey{
|
||||
Region: "us-isob-east-1",
|
||||
}: endpoint{},
|
||||
},
|
||||
},
|
||||
"appconfig": service{
|
||||
Endpoints: serviceEndpoints{
|
||||
endpointKey{
|
||||
|
|
|
|||
13
vendor/github.com/aws/aws-sdk-go/aws/request/waiter.go
generated
vendored
13
vendor/github.com/aws/aws-sdk-go/aws/request/waiter.go
generated
vendored
|
|
@ -256,8 +256,17 @@ func (a *WaiterAcceptor) match(name string, l aws.Logger, req *Request, err erro
|
|||
s := a.Expected.(int)
|
||||
result = s == req.HTTPResponse.StatusCode
|
||||
case ErrorWaiterMatch:
|
||||
if aerr, ok := err.(awserr.Error); ok {
|
||||
result = aerr.Code() == a.Expected.(string)
|
||||
switch ex := a.Expected.(type) {
|
||||
case string:
|
||||
if aerr, ok := err.(awserr.Error); ok {
|
||||
result = aerr.Code() == ex
|
||||
}
|
||||
case bool:
|
||||
if ex {
|
||||
result = err != nil
|
||||
} else {
|
||||
result = err == nil
|
||||
}
|
||||
}
|
||||
default:
|
||||
waiterLogf(l, "WARNING: Waiter %s encountered unexpected matcher: %s",
|
||||
|
|
|
|||
2
vendor/github.com/aws/aws-sdk-go/aws/version.go
generated
vendored
2
vendor/github.com/aws/aws-sdk-go/aws/version.go
generated
vendored
|
|
@ -5,4 +5,4 @@ package aws
|
|||
const SDKName = "aws-sdk-go"
|
||||
|
||||
// SDKVersion is the version of this SDK
|
||||
const SDKVersion = "1.54.18"
|
||||
const SDKVersion = "1.55.2"
|
||||
|
|
|
|||
891
vendor/github.com/aws/aws-sdk-go/service/ec2/api.go
generated
vendored
891
vendor/github.com/aws/aws-sdk-go/service/ec2/api.go
generated
vendored
File diff suppressed because it is too large
Load diff
1
vendor/github.com/go-logr/logr/README.md
generated
vendored
1
vendor/github.com/go-logr/logr/README.md
generated
vendored
|
|
@ -1,6 +1,7 @@
|
|||
# A minimal logging API for Go
|
||||
|
||||
[](https://pkg.go.dev/github.com/go-logr/logr)
|
||||
[](https://goreportcard.com/report/github.com/go-logr/logr)
|
||||
[](https://securityscorecards.dev/viewer/?platform=github.com&org=go-logr&repo=logr)
|
||||
|
||||
logr offers an(other) opinion on how Go programs and libraries can do logging
|
||||
|
|
|
|||
185
vendor/github.com/go-logr/logr/funcr/funcr.go
generated
vendored
185
vendor/github.com/go-logr/logr/funcr/funcr.go
generated
vendored
|
|
@ -236,15 +236,14 @@ func newFormatter(opts Options, outfmt outputFormat) Formatter {
|
|||
// implementation. It should be constructed with NewFormatter. Some of
|
||||
// its methods directly implement logr.LogSink.
|
||||
type Formatter struct {
|
||||
outputFormat outputFormat
|
||||
prefix string
|
||||
values []any
|
||||
valuesStr string
|
||||
parentValuesStr string
|
||||
depth int
|
||||
opts *Options
|
||||
group string // for slog groups
|
||||
groupDepth int
|
||||
outputFormat outputFormat
|
||||
prefix string
|
||||
values []any
|
||||
valuesStr string
|
||||
depth int
|
||||
opts *Options
|
||||
groupName string // for slog groups
|
||||
groups []groupDef
|
||||
}
|
||||
|
||||
// outputFormat indicates which outputFormat to use.
|
||||
|
|
@ -257,6 +256,13 @@ const (
|
|||
outputJSON
|
||||
)
|
||||
|
||||
// groupDef represents a saved group. The values may be empty, but we don't
|
||||
// know if we need to render the group until the final record is rendered.
|
||||
type groupDef struct {
|
||||
name string
|
||||
values string
|
||||
}
|
||||
|
||||
// PseudoStruct is a list of key-value pairs that gets logged as a struct.
|
||||
type PseudoStruct []any
|
||||
|
||||
|
|
@ -264,76 +270,102 @@ type PseudoStruct []any
|
|||
func (f Formatter) render(builtins, args []any) string {
|
||||
// Empirically bytes.Buffer is faster than strings.Builder for this.
|
||||
buf := bytes.NewBuffer(make([]byte, 0, 1024))
|
||||
|
||||
if f.outputFormat == outputJSON {
|
||||
buf.WriteByte('{') // for the whole line
|
||||
buf.WriteByte('{') // for the whole record
|
||||
}
|
||||
|
||||
// Render builtins
|
||||
vals := builtins
|
||||
if hook := f.opts.RenderBuiltinsHook; hook != nil {
|
||||
vals = hook(f.sanitize(vals))
|
||||
}
|
||||
f.flatten(buf, vals, false, false) // keys are ours, no need to escape
|
||||
f.flatten(buf, vals, false) // keys are ours, no need to escape
|
||||
continuing := len(builtins) > 0
|
||||
|
||||
if f.parentValuesStr != "" {
|
||||
// Turn the inner-most group into a string
|
||||
argsStr := func() string {
|
||||
buf := bytes.NewBuffer(make([]byte, 0, 1024))
|
||||
|
||||
vals = args
|
||||
if hook := f.opts.RenderArgsHook; hook != nil {
|
||||
vals = hook(f.sanitize(vals))
|
||||
}
|
||||
f.flatten(buf, vals, true) // escape user-provided keys
|
||||
|
||||
return buf.String()
|
||||
}()
|
||||
|
||||
// Render the stack of groups from the inside out.
|
||||
bodyStr := f.renderGroup(f.groupName, f.valuesStr, argsStr)
|
||||
for i := len(f.groups) - 1; i >= 0; i-- {
|
||||
grp := &f.groups[i]
|
||||
if grp.values == "" && bodyStr == "" {
|
||||
// no contents, so we must elide the whole group
|
||||
continue
|
||||
}
|
||||
bodyStr = f.renderGroup(grp.name, grp.values, bodyStr)
|
||||
}
|
||||
|
||||
if bodyStr != "" {
|
||||
if continuing {
|
||||
buf.WriteByte(f.comma())
|
||||
}
|
||||
buf.WriteString(f.parentValuesStr)
|
||||
continuing = true
|
||||
}
|
||||
|
||||
groupDepth := f.groupDepth
|
||||
if f.group != "" {
|
||||
if f.valuesStr != "" || len(args) != 0 {
|
||||
if continuing {
|
||||
buf.WriteByte(f.comma())
|
||||
}
|
||||
buf.WriteString(f.quoted(f.group, true)) // escape user-provided keys
|
||||
buf.WriteByte(f.colon())
|
||||
buf.WriteByte('{') // for the group
|
||||
continuing = false
|
||||
} else {
|
||||
// The group was empty
|
||||
groupDepth--
|
||||
}
|
||||
}
|
||||
|
||||
if f.valuesStr != "" {
|
||||
if continuing {
|
||||
buf.WriteByte(f.comma())
|
||||
}
|
||||
buf.WriteString(f.valuesStr)
|
||||
continuing = true
|
||||
}
|
||||
|
||||
vals = args
|
||||
if hook := f.opts.RenderArgsHook; hook != nil {
|
||||
vals = hook(f.sanitize(vals))
|
||||
}
|
||||
f.flatten(buf, vals, continuing, true) // escape user-provided keys
|
||||
|
||||
for i := 0; i < groupDepth; i++ {
|
||||
buf.WriteByte('}') // for the groups
|
||||
buf.WriteString(bodyStr)
|
||||
}
|
||||
|
||||
if f.outputFormat == outputJSON {
|
||||
buf.WriteByte('}') // for the whole line
|
||||
buf.WriteByte('}') // for the whole record
|
||||
}
|
||||
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
// flatten renders a list of key-value pairs into a buffer. If continuing is
|
||||
// true, it assumes that the buffer has previous values and will emit a
|
||||
// separator (which depends on the output format) before the first pair it
|
||||
// writes. If escapeKeys is true, the keys are assumed to have
|
||||
// non-JSON-compatible characters in them and must be evaluated for escapes.
|
||||
// renderGroup returns a string representation of the named group with rendered
|
||||
// values and args. If the name is empty, this will return the values and args,
|
||||
// joined. If the name is not empty, this will return a single key-value pair,
|
||||
// where the value is a grouping of the values and args. If the values and
|
||||
// args are both empty, this will return an empty string, even if the name was
|
||||
// specified.
|
||||
func (f Formatter) renderGroup(name string, values string, args string) string {
|
||||
buf := bytes.NewBuffer(make([]byte, 0, 1024))
|
||||
|
||||
needClosingBrace := false
|
||||
if name != "" && (values != "" || args != "") {
|
||||
buf.WriteString(f.quoted(name, true)) // escape user-provided keys
|
||||
buf.WriteByte(f.colon())
|
||||
buf.WriteByte('{')
|
||||
needClosingBrace = true
|
||||
}
|
||||
|
||||
continuing := false
|
||||
if values != "" {
|
||||
buf.WriteString(values)
|
||||
continuing = true
|
||||
}
|
||||
|
||||
if args != "" {
|
||||
if continuing {
|
||||
buf.WriteByte(f.comma())
|
||||
}
|
||||
buf.WriteString(args)
|
||||
}
|
||||
|
||||
if needClosingBrace {
|
||||
buf.WriteByte('}')
|
||||
}
|
||||
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
// flatten renders a list of key-value pairs into a buffer. If escapeKeys is
|
||||
// true, the keys are assumed to have non-JSON-compatible characters in them
|
||||
// and must be evaluated for escapes.
|
||||
//
|
||||
// This function returns a potentially modified version of kvList, which
|
||||
// ensures that there is a value for every key (adding a value if needed) and
|
||||
// that each key is a string (substituting a key if needed).
|
||||
func (f Formatter) flatten(buf *bytes.Buffer, kvList []any, continuing bool, escapeKeys bool) []any {
|
||||
func (f Formatter) flatten(buf *bytes.Buffer, kvList []any, escapeKeys bool) []any {
|
||||
// This logic overlaps with sanitize() but saves one type-cast per key,
|
||||
// which can be measurable.
|
||||
if len(kvList)%2 != 0 {
|
||||
|
|
@ -354,7 +386,7 @@ func (f Formatter) flatten(buf *bytes.Buffer, kvList []any, continuing bool, esc
|
|||
}
|
||||
v := kvList[i+1]
|
||||
|
||||
if i > 0 || continuing {
|
||||
if i > 0 {
|
||||
if f.outputFormat == outputJSON {
|
||||
buf.WriteByte(f.comma())
|
||||
} else {
|
||||
|
|
@ -766,46 +798,17 @@ func (f Formatter) sanitize(kvList []any) []any {
|
|||
// startGroup opens a new group scope (basically a sub-struct), which locks all
|
||||
// the current saved values and starts them anew. This is needed to satisfy
|
||||
// slog.
|
||||
func (f *Formatter) startGroup(group string) {
|
||||
func (f *Formatter) startGroup(name string) {
|
||||
// Unnamed groups are just inlined.
|
||||
if group == "" {
|
||||
if name == "" {
|
||||
return
|
||||
}
|
||||
|
||||
// Any saved values can no longer be changed.
|
||||
buf := bytes.NewBuffer(make([]byte, 0, 1024))
|
||||
continuing := false
|
||||
|
||||
if f.parentValuesStr != "" {
|
||||
buf.WriteString(f.parentValuesStr)
|
||||
continuing = true
|
||||
}
|
||||
|
||||
if f.group != "" && f.valuesStr != "" {
|
||||
if continuing {
|
||||
buf.WriteByte(f.comma())
|
||||
}
|
||||
buf.WriteString(f.quoted(f.group, true)) // escape user-provided keys
|
||||
buf.WriteByte(f.colon())
|
||||
buf.WriteByte('{') // for the group
|
||||
continuing = false
|
||||
}
|
||||
|
||||
if f.valuesStr != "" {
|
||||
if continuing {
|
||||
buf.WriteByte(f.comma())
|
||||
}
|
||||
buf.WriteString(f.valuesStr)
|
||||
}
|
||||
|
||||
// NOTE: We don't close the scope here - that's done later, when a log line
|
||||
// is actually rendered (because we have N scopes to close).
|
||||
|
||||
f.parentValuesStr = buf.String()
|
||||
n := len(f.groups)
|
||||
f.groups = append(f.groups[:n:n], groupDef{f.groupName, f.valuesStr})
|
||||
|
||||
// Start collecting new values.
|
||||
f.group = group
|
||||
f.groupDepth++
|
||||
f.groupName = name
|
||||
f.valuesStr = ""
|
||||
f.values = nil
|
||||
}
|
||||
|
|
@ -900,7 +903,7 @@ func (f *Formatter) AddValues(kvList []any) {
|
|||
|
||||
// Pre-render values, so we don't have to do it on each Info/Error call.
|
||||
buf := bytes.NewBuffer(make([]byte, 0, 1024))
|
||||
f.flatten(buf, vals, false, true) // escape user-provided keys
|
||||
f.flatten(buf, vals, true) // escape user-provided keys
|
||||
f.valuesStr = buf.String()
|
||||
}
|
||||
|
||||
|
|
|
|||
2
vendor/github.com/googleapis/gax-go/v2/.release-please-manifest.json
generated
vendored
2
vendor/github.com/googleapis/gax-go/v2/.release-please-manifest.json
generated
vendored
|
|
@ -1,3 +1,3 @@
|
|||
{
|
||||
"v2": "2.12.5"
|
||||
"v2": "2.13.0"
|
||||
}
|
||||
|
|
|
|||
7
vendor/github.com/googleapis/gax-go/v2/CHANGES.md
generated
vendored
7
vendor/github.com/googleapis/gax-go/v2/CHANGES.md
generated
vendored
|
|
@ -1,5 +1,12 @@
|
|||
# Changelog
|
||||
|
||||
## [2.13.0](https://github.com/googleapis/gax-go/compare/v2.12.5...v2.13.0) (2024-07-22)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **iterator:** add package to help work with new iter.Seq types ([#358](https://github.com/googleapis/gax-go/issues/358)) ([6bccdaa](https://github.com/googleapis/gax-go/commit/6bccdaac011fe6fd147e4eb533a8e6520b7d4acc))
|
||||
|
||||
## [2.12.5](https://github.com/googleapis/gax-go/compare/v2.12.4...v2.12.5) (2024-06-18)
|
||||
|
||||
|
||||
|
|
|
|||
2
vendor/github.com/googleapis/gax-go/v2/internal/version.go
generated
vendored
2
vendor/github.com/googleapis/gax-go/v2/internal/version.go
generated
vendored
|
|
@ -30,4 +30,4 @@
|
|||
package internal
|
||||
|
||||
// Version is the current tagged release of the library.
|
||||
const Version = "2.12.5"
|
||||
const Version = "2.13.0"
|
||||
|
|
|
|||
6
vendor/github.com/gophercloud/gophercloud/CHANGELOG.md
generated
vendored
6
vendor/github.com/gophercloud/gophercloud/CHANGELOG.md
generated
vendored
|
|
@ -1,3 +1,9 @@
|
|||
## v1.14.0 (2024-07-24)
|
||||
|
||||
* [GH-3095](https://github.com/gophercloud/gophercloud/pull/3095) [neutron]: introduce Description argument for the portforwarding
|
||||
* [GH-3098](https://github.com/gophercloud/gophercloud/pull/3098) [neutron]: introduce Stateful argument for the security groups
|
||||
* [GH-3099](https://github.com/gophercloud/gophercloud/pull/3099) [networking]: subnet add field dns_publish_fixed_ip
|
||||
|
||||
## v1.13.0 (2024-07-08)
|
||||
|
||||
* [GH-3044](https://github.com/gophercloud/gophercloud/pull/3044) [v1] Add ci jobs for openstack caracal
|
||||
|
|
|
|||
2
vendor/github.com/gophercloud/gophercloud/provider_client.go
generated
vendored
2
vendor/github.com/gophercloud/gophercloud/provider_client.go
generated
vendored
|
|
@ -14,7 +14,7 @@ import (
|
|||
|
||||
// DefaultUserAgent is the default User-Agent string set in the request header.
|
||||
const (
|
||||
DefaultUserAgent = "gophercloud/v1.13.0"
|
||||
DefaultUserAgent = "gophercloud/v1.14.0"
|
||||
DefaultMaxBackoffRetries = 60
|
||||
)
|
||||
|
||||
|
|
|
|||
12
vendor/github.com/osbuild/images/pkg/blueprint/customizations.go
generated
vendored
12
vendor/github.com/osbuild/images/pkg/blueprint/customizations.go
generated
vendored
|
|
@ -114,9 +114,10 @@ type ServicesCustomization struct {
|
|||
}
|
||||
|
||||
type OpenSCAPCustomization struct {
|
||||
DataStream string `json:"datastream,omitempty" toml:"datastream,omitempty"`
|
||||
ProfileID string `json:"profile_id,omitempty" toml:"profile_id,omitempty"`
|
||||
Tailoring *OpenSCAPTailoringCustomizations `json:"tailoring,omitempty" toml:"tailoring,omitempty"`
|
||||
DataStream string `json:"datastream,omitempty" toml:"datastream,omitempty"`
|
||||
ProfileID string `json:"profile_id,omitempty" toml:"profile_id,omitempty"`
|
||||
Tailoring *OpenSCAPTailoringCustomizations `json:"tailoring,omitempty" toml:"tailoring,omitempty"`
|
||||
XMLTailoring *OpenSCAPXMLTailoringCustomizations `json:"xml_tailoring,omitempty" toml:"xml_tailoring,omitempty"`
|
||||
}
|
||||
|
||||
type OpenSCAPTailoringCustomizations struct {
|
||||
|
|
@ -124,6 +125,11 @@ type OpenSCAPTailoringCustomizations struct {
|
|||
Unselected []string `json:"unselected,omitempty" toml:"unselected,omitempty"`
|
||||
}
|
||||
|
||||
type OpenSCAPXMLTailoringCustomizations struct {
|
||||
ProfileID string `json:"profile_id,omitempty" toml:"profile_id,omitempty"`
|
||||
Filepath string `json:"filepath,omitempty" toml:"filepath,omitempty"`
|
||||
}
|
||||
|
||||
// Configure the container storage separately from containers, since we most likely would
|
||||
// like to use the same storage path for all of the containers.
|
||||
type ContainerStorageCustomization struct {
|
||||
|
|
|
|||
70
vendor/github.com/osbuild/images/pkg/customizations/oscap/oscap.go
generated
vendored
70
vendor/github.com/osbuild/images/pkg/customizations/oscap/oscap.go
generated
vendored
|
|
@ -1,7 +1,11 @@
|
|||
package oscap
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/osbuild/images/pkg/blueprint"
|
||||
)
|
||||
|
||||
type Profile string
|
||||
|
|
@ -57,6 +61,72 @@ type TailoringConfig struct {
|
|||
Unselected []string
|
||||
}
|
||||
|
||||
func NewConfigs(oscapConfig blueprint.OpenSCAPCustomization, defaultDatastream *string) (*RemediationConfig, *TailoringConfig, error) {
|
||||
var datastream = oscapConfig.DataStream
|
||||
if datastream == "" {
|
||||
if defaultDatastream == nil {
|
||||
return nil, nil, fmt.Errorf("No OSCAP datastream specified and the distro does not have any default set")
|
||||
}
|
||||
datastream = *defaultDatastream
|
||||
}
|
||||
|
||||
remediationConfig := &RemediationConfig{
|
||||
Datastream: datastream,
|
||||
ProfileID: oscapConfig.ProfileID,
|
||||
CompressionEnabled: true,
|
||||
}
|
||||
|
||||
if oscapConfig.XMLTailoring != nil && oscapConfig.Tailoring != nil {
|
||||
return nil, nil, fmt.Errorf("Either XML tailoring file and profile ID must be set or custom rules (selected/unselected), not both")
|
||||
}
|
||||
|
||||
if xmlConfigs := oscapConfig.XMLTailoring; xmlConfigs != nil {
|
||||
if xmlConfigs.Filepath == "" {
|
||||
return nil, nil, fmt.Errorf("Filepath to an XML tailoring file is required")
|
||||
}
|
||||
|
||||
if xmlConfigs.ProfileID == "" {
|
||||
return nil, nil, fmt.Errorf("Tailoring profile ID is required for an XML tailoring file")
|
||||
}
|
||||
|
||||
remediationConfig.ProfileID = xmlConfigs.ProfileID
|
||||
remediationConfig.TailoringPath = xmlConfigs.Filepath
|
||||
|
||||
// since the XML tailoring file has already been provided
|
||||
// we don't need the autotailor stage and the config can
|
||||
// be left empty and we can just return the `remediationConfig`
|
||||
return remediationConfig, nil, nil
|
||||
}
|
||||
|
||||
tc := oscapConfig.Tailoring
|
||||
if tc == nil {
|
||||
return remediationConfig, nil, nil
|
||||
}
|
||||
|
||||
tailoringPath := filepath.Join(DataDir, "tailoring.xml")
|
||||
tailoredProfileID := fmt.Sprintf("%s_osbuild_tailoring", remediationConfig.ProfileID)
|
||||
|
||||
tailoringConfig := &TailoringConfig{
|
||||
RemediationConfig: RemediationConfig{
|
||||
ProfileID: remediationConfig.ProfileID,
|
||||
TailoringPath: tailoringPath,
|
||||
Datastream: datastream,
|
||||
},
|
||||
TailoredProfileID: tailoredProfileID,
|
||||
Selected: tc.Selected,
|
||||
Unselected: tc.Unselected,
|
||||
}
|
||||
|
||||
// the reason for changing the remediation config profile
|
||||
// after we create the tailoring configs is that the tailoring
|
||||
// config needs to know about the original base profile id, but
|
||||
// the remediation config needs to know the updated profile id.
|
||||
remediationConfig.ProfileID = tailoredProfileID
|
||||
remediationConfig.TailoringPath = tailoringPath
|
||||
|
||||
return remediationConfig, tailoringConfig, nil
|
||||
}
|
||||
|
||||
func DefaultFedoraDatastream() string {
|
||||
return defaultFedoraDatastream
|
||||
}
|
||||
|
|
|
|||
33
vendor/github.com/osbuild/images/pkg/distro/fedora/images.go
generated
vendored
33
vendor/github.com/osbuild/images/pkg/distro/fedora/images.go
generated
vendored
|
|
@ -3,7 +3,6 @@ package fedora
|
|||
import (
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/osbuild/images/internal/common"
|
||||
"github.com/osbuild/images/internal/workload"
|
||||
|
|
@ -190,37 +189,13 @@ func osCustomizations(
|
|||
}
|
||||
osc.Directories = append(osc.Directories, oscapDataNode)
|
||||
|
||||
var datastream = oscapConfig.DataStream
|
||||
if datastream == "" {
|
||||
if imageConfig.DefaultOSCAPDatastream == nil {
|
||||
return manifest.OSCustomizations{}, fmt.Errorf("No OSCAP datastream specified and the distro does not have any default set")
|
||||
}
|
||||
datastream = *imageConfig.DefaultOSCAPDatastream
|
||||
}
|
||||
|
||||
remediationConfig := oscap.RemediationConfig{
|
||||
Datastream: datastream,
|
||||
ProfileID: oscapConfig.ProfileID,
|
||||
CompressionEnabled: true,
|
||||
}
|
||||
|
||||
var tailoringConfig *oscap.TailoringConfig
|
||||
if oscapConfig.Tailoring != nil {
|
||||
remediationConfig.TailoringPath = filepath.Join(oscap.DataDir, "tailoring.xml")
|
||||
tailoringConfig = &oscap.TailoringConfig{
|
||||
RemediationConfig: remediationConfig,
|
||||
TailoredProfileID: fmt.Sprintf("%s_osbuild_tailoring", oscapConfig.ProfileID),
|
||||
Selected: oscapConfig.Tailoring.Selected,
|
||||
Unselected: oscapConfig.Tailoring.Unselected,
|
||||
}
|
||||
// we need to set this after the tailoring config
|
||||
// since the tailoring config needs to know about both
|
||||
// the base profile id and the tailored profile id
|
||||
remediationConfig.ProfileID = tailoringConfig.TailoredProfileID
|
||||
remediationConfig, tailoringConfig, err := oscap.NewConfigs(*oscapConfig, imageConfig.DefaultOSCAPDatastream)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("error creating OpenSCAP configs: %w", err))
|
||||
}
|
||||
|
||||
osc.OpenSCAPTailorConfig = tailoringConfig
|
||||
osc.OpenSCAPRemediationConfig = &remediationConfig
|
||||
osc.OpenSCAPRemediationConfig = remediationConfig
|
||||
}
|
||||
|
||||
osc.ShellInit = imageConfig.ShellInit
|
||||
|
|
|
|||
33
vendor/github.com/osbuild/images/pkg/distro/rhel/images.go
generated
vendored
33
vendor/github.com/osbuild/images/pkg/distro/rhel/images.go
generated
vendored
|
|
@ -3,7 +3,6 @@ package rhel
|
|||
import (
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/osbuild/images/internal/workload"
|
||||
"github.com/osbuild/images/pkg/blueprint"
|
||||
|
|
@ -211,37 +210,13 @@ func osCustomizations(
|
|||
}
|
||||
osc.Directories = append(osc.Directories, oscapDataNode)
|
||||
|
||||
var datastream = oscapConfig.DataStream
|
||||
if datastream == "" {
|
||||
if imageConfig.DefaultOSCAPDatastream == nil {
|
||||
return manifest.OSCustomizations{}, fmt.Errorf("No OSCAP datastream specified and the distro does not have any default set")
|
||||
}
|
||||
datastream = *imageConfig.DefaultOSCAPDatastream
|
||||
}
|
||||
|
||||
remediationConfig := oscap.RemediationConfig{
|
||||
Datastream: datastream,
|
||||
ProfileID: oscapConfig.ProfileID,
|
||||
CompressionEnabled: true,
|
||||
}
|
||||
|
||||
var tailoringConfig *oscap.TailoringConfig
|
||||
if oscapConfig.Tailoring != nil {
|
||||
remediationConfig.TailoringPath = filepath.Join(oscap.DataDir, "tailoring.xml")
|
||||
tailoringConfig = &oscap.TailoringConfig{
|
||||
RemediationConfig: remediationConfig,
|
||||
TailoredProfileID: fmt.Sprintf("%s_osbuild_tailoring", oscapConfig.ProfileID),
|
||||
Selected: oscapConfig.Tailoring.Selected,
|
||||
Unselected: oscapConfig.Tailoring.Unselected,
|
||||
}
|
||||
// we need to set this after the tailoring config
|
||||
// since the tailoring config needs to know about both
|
||||
// the base profile id and the tailored profile id
|
||||
remediationConfig.ProfileID = tailoringConfig.TailoredProfileID
|
||||
remediationConfig, tailoringConfig, err := oscap.NewConfigs(*oscapConfig, imageConfig.DefaultOSCAPDatastream)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("error creating OpenSCAP configs: %w", err))
|
||||
}
|
||||
|
||||
osc.OpenSCAPTailorConfig = tailoringConfig
|
||||
osc.OpenSCAPRemediationConfig = &remediationConfig
|
||||
osc.OpenSCAPRemediationConfig = remediationConfig
|
||||
}
|
||||
|
||||
osc.ShellInit = imageConfig.ShellInit
|
||||
|
|
|
|||
14
vendor/github.com/osbuild/images/pkg/distro/rhel/rhel9/azure.go
generated
vendored
14
vendor/github.com/osbuild/images/pkg/distro/rhel/rhel9/azure.go
generated
vendored
|
|
@ -216,12 +216,18 @@ func azureSapPackageSet(t *rhel.ImageType) rpmmd.PackageSet {
|
|||
}
|
||||
|
||||
// PARTITION TABLES
|
||||
|
||||
func azureRhuiBasePartitionTables(t *rhel.ImageType) (disk.PartitionTable, bool) {
|
||||
// RHEL >= 9.3 needs to have a bigger /boot, see RHEL-7999
|
||||
bootSize := uint64(600) * common.MebiByte
|
||||
if common.VersionLessThan(t.Arch().Distro().OsVersion(), "9.3") && t.IsRHEL() {
|
||||
var bootSize uint64
|
||||
switch {
|
||||
case common.VersionLessThan(t.Arch().Distro().OsVersion(), "9.3") && t.IsRHEL():
|
||||
// RHEL <= 9.2 had only 500 MiB /boot
|
||||
bootSize = 500 * common.MebiByte
|
||||
case common.VersionLessThan(t.Arch().Distro().OsVersion(), "9.4") && t.IsRHEL():
|
||||
// RHEL 9.3 had 600 MiB /boot, see RHEL-7999
|
||||
bootSize = 600 * common.MebiByte
|
||||
default:
|
||||
// RHEL >= 9.4 needs to have even a bigger /boot, see COMPOSER-2155
|
||||
bootSize = 1 * common.GibiByte
|
||||
}
|
||||
|
||||
switch t.Arch().Name() {
|
||||
|
|
|
|||
2
vendor/github.com/osbuild/images/pkg/osbuild/copy_stage.go
generated
vendored
2
vendor/github.com/osbuild/images/pkg/osbuild/copy_stage.go
generated
vendored
|
|
@ -61,7 +61,7 @@ func GenCopyFSTreeOptions(inputName, inputPipeline, filename string, pt *disk.Pa
|
|||
[]Mount,
|
||||
) {
|
||||
|
||||
fsRootMntName, mounts, devices, err := genMountsDevicesFromPt(filename, pt)
|
||||
fsRootMntName, mounts, devices, err := GenMountsDevicesFromPT(filename, pt)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
|
|||
4
vendor/github.com/osbuild/images/pkg/osbuild/device.go
generated
vendored
4
vendor/github.com/osbuild/images/pkg/osbuild/device.go
generated
vendored
|
|
@ -266,7 +266,7 @@ func genOsbuildMount(source string, mnt disk.Mountable) (*Mount, error) {
|
|||
}
|
||||
}
|
||||
|
||||
// genMountsDevicesFromPt generates osbuild mounts and devices from a disk.PartitionTable
|
||||
// GenMountsDevicesFromPT generates osbuild mounts and devices from a disk.PartitionTable
|
||||
// filename is the name of the underlying image file (which will get loop-mounted).
|
||||
//
|
||||
// Returned values:
|
||||
|
|
@ -274,7 +274,7 @@ func genOsbuildMount(source string, mnt disk.Mountable) (*Mount, error) {
|
|||
// 2) generated mounts
|
||||
// 3) generated devices
|
||||
// 4) error if any
|
||||
func genMountsDevicesFromPt(filename string, pt *disk.PartitionTable) (string, []Mount, map[string]Device, error) {
|
||||
func GenMountsDevicesFromPT(filename string, pt *disk.PartitionTable) (string, []Mount, map[string]Device, error) {
|
||||
devices := make(map[string]Device, len(pt.Partitions))
|
||||
mounts := make([]Mount, 0, len(pt.Partitions))
|
||||
var fsRootMntName string
|
||||
|
|
|
|||
142
vendor/github.com/vmware/govmomi/govc/flags/output.go
generated
vendored
142
vendor/github.com/vmware/govmomi/govc/flags/output.go
generated
vendored
|
|
@ -1,11 +1,11 @@
|
|||
/*
|
||||
Copyright (c) 2014-2016 VMware, Inc. All Rights Reserved.
|
||||
Copyright (c) 2014-2024 VMware, Inc. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
|
@ -26,11 +26,11 @@ import (
|
|||
"os"
|
||||
"reflect"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/dougm/pretty"
|
||||
|
||||
"github.com/vmware/govmomi/govc/cli"
|
||||
"github.com/vmware/govmomi/task"
|
||||
"github.com/vmware/govmomi/vim25/progress"
|
||||
"github.com/vmware/govmomi/vim25/soap"
|
||||
|
|
@ -50,6 +50,7 @@ type OutputFlag struct {
|
|||
TTY bool
|
||||
Dump bool
|
||||
Out io.Writer
|
||||
Spec bool
|
||||
|
||||
formatError bool
|
||||
formatIndent bool
|
||||
|
|
@ -72,6 +73,9 @@ func (flag *OutputFlag) Register(ctx context.Context, f *flag.FlagSet) {
|
|||
f.BoolVar(&flag.JSON, "json", false, "Enable JSON output")
|
||||
f.BoolVar(&flag.XML, "xml", false, "Enable XML output")
|
||||
f.BoolVar(&flag.Dump, "dump", false, "Enable Go output")
|
||||
if cli.ShowUnreleased() {
|
||||
f.BoolVar(&flag.Spec, "spec", false, "Output spec without sending request")
|
||||
}
|
||||
// Avoid adding more flags for now..
|
||||
flag.formatIndent = os.Getenv("GOVC_INDENT") != "false" // Default to indented output
|
||||
flag.formatError = os.Getenv("GOVC_FORMAT_ERROR") != "false" // Default to formatted errors
|
||||
|
|
@ -159,6 +163,25 @@ func dumpValue(val interface{}) interface{} {
|
|||
return val
|
||||
}
|
||||
|
||||
type outputAny struct {
|
||||
Value any
|
||||
}
|
||||
|
||||
func (*outputAny) Write(io.Writer) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *outputAny) Dump() interface{} {
|
||||
return a.Value
|
||||
}
|
||||
|
||||
func (flag *OutputFlag) WriteAny(val any) error {
|
||||
if !flag.All() {
|
||||
flag.XML = true
|
||||
}
|
||||
return flag.WriteResult(&outputAny{val})
|
||||
}
|
||||
|
||||
func (flag *OutputFlag) WriteResult(result OutputWriter) error {
|
||||
var err error
|
||||
|
||||
|
|
@ -204,7 +227,7 @@ type errorOutput struct {
|
|||
}
|
||||
|
||||
func (e errorOutput) Write(w io.Writer) error {
|
||||
reason := e.error.Error()
|
||||
reason := e.Error()
|
||||
var messages []string
|
||||
var faults []types.LocalizableMessage
|
||||
|
||||
|
|
@ -261,15 +284,15 @@ func (e errorOutput) canEncode() bool {
|
|||
return soap.IsSoapFault(e.error) || soap.IsVimFault(e.error)
|
||||
}
|
||||
|
||||
// cannotEncode causes cli.Run to output err.Error() as it would without an error format specified
|
||||
var cannotEncode = errors.New("cannot encode error")
|
||||
// errCannotEncode causes cli.Run to output err.Error() as it would without an error format specified
|
||||
var errCannotEncode = errors.New("cannot encode error")
|
||||
|
||||
func (e errorOutput) MarshalJSON() ([]byte, error) {
|
||||
_, ok := e.error.(json.Marshaler)
|
||||
if ok || e.canEncode() {
|
||||
return json.Marshal(e.error)
|
||||
}
|
||||
return nil, cannotEncode
|
||||
return nil, errCannotEncode
|
||||
}
|
||||
|
||||
func (e errorOutput) MarshalXML(encoder *xml.Encoder, start xml.StartElement) error {
|
||||
|
|
@ -277,108 +300,9 @@ func (e errorOutput) MarshalXML(encoder *xml.Encoder, start xml.StartElement) er
|
|||
if ok || e.canEncode() {
|
||||
return encoder.Encode(e.error)
|
||||
}
|
||||
return cannotEncode
|
||||
return errCannotEncode
|
||||
}
|
||||
|
||||
type progressLogger struct {
|
||||
flag *OutputFlag
|
||||
prefix string
|
||||
|
||||
wg sync.WaitGroup
|
||||
|
||||
sink chan chan progress.Report
|
||||
done chan struct{}
|
||||
}
|
||||
|
||||
func newProgressLogger(flag *OutputFlag, prefix string) *progressLogger {
|
||||
p := &progressLogger{
|
||||
flag: flag,
|
||||
prefix: prefix,
|
||||
|
||||
sink: make(chan chan progress.Report),
|
||||
done: make(chan struct{}),
|
||||
}
|
||||
|
||||
p.wg.Add(1)
|
||||
|
||||
go p.loopA()
|
||||
|
||||
return p
|
||||
}
|
||||
|
||||
// loopA runs before Sink() has been called.
|
||||
func (p *progressLogger) loopA() {
|
||||
var err error
|
||||
|
||||
defer p.wg.Done()
|
||||
|
||||
tick := time.NewTicker(100 * time.Millisecond)
|
||||
defer tick.Stop()
|
||||
|
||||
called := false
|
||||
|
||||
for stop := false; !stop; {
|
||||
select {
|
||||
case ch := <-p.sink:
|
||||
err = p.loopB(tick, ch)
|
||||
stop = true
|
||||
called = true
|
||||
case <-p.done:
|
||||
stop = true
|
||||
case <-tick.C:
|
||||
line := fmt.Sprintf("\r%s", p.prefix)
|
||||
p.flag.Log(line)
|
||||
}
|
||||
}
|
||||
|
||||
if err != nil && err != io.EOF {
|
||||
p.flag.Log(fmt.Sprintf("\r%sError: %s\n", p.prefix, err))
|
||||
} else if called {
|
||||
p.flag.Log(fmt.Sprintf("\r%sOK\n", p.prefix))
|
||||
}
|
||||
}
|
||||
|
||||
// loopA runs after Sink() has been called.
|
||||
func (p *progressLogger) loopB(tick *time.Ticker, ch <-chan progress.Report) error {
|
||||
var r progress.Report
|
||||
var ok bool
|
||||
var err error
|
||||
|
||||
for ok = true; ok; {
|
||||
select {
|
||||
case r, ok = <-ch:
|
||||
if !ok {
|
||||
break
|
||||
}
|
||||
err = r.Error()
|
||||
case <-tick.C:
|
||||
line := fmt.Sprintf("\r%s", p.prefix)
|
||||
if r != nil {
|
||||
line += fmt.Sprintf("(%.0f%%", r.Percentage())
|
||||
detail := r.Detail()
|
||||
if detail != "" {
|
||||
line += fmt.Sprintf(", %s", detail)
|
||||
}
|
||||
line += ")"
|
||||
}
|
||||
p.flag.Log(line)
|
||||
}
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (p *progressLogger) Sink() chan<- progress.Report {
|
||||
ch := make(chan progress.Report)
|
||||
p.sink <- ch
|
||||
return ch
|
||||
}
|
||||
|
||||
func (p *progressLogger) Wait() {
|
||||
close(p.done)
|
||||
p.wg.Wait()
|
||||
}
|
||||
|
||||
func (flag *OutputFlag) ProgressLogger(prefix string) *progressLogger {
|
||||
return newProgressLogger(flag, prefix)
|
||||
func (flag *OutputFlag) ProgressLogger(prefix string) *progress.ProgressLogger {
|
||||
return progress.NewProgressLogger(flag.Log, prefix)
|
||||
}
|
||||
|
|
|
|||
74
vendor/github.com/vmware/govmomi/govc/importx/options.go
generated
vendored
74
vendor/github.com/vmware/govmomi/govc/importx/options.go
generated
vendored
|
|
@ -1,11 +1,11 @@
|
|||
/*
|
||||
Copyright (c) 2015-2023 VMware, Inc. All Rights Reserved.
|
||||
Copyright (c) 2015-2024 VMware, Inc. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
|
@ -26,78 +26,12 @@ import (
|
|||
"github.com/vmware/govmomi/govc/flags"
|
||||
"github.com/vmware/govmomi/object"
|
||||
"github.com/vmware/govmomi/ovf"
|
||||
"github.com/vmware/govmomi/ovf/importer"
|
||||
"github.com/vmware/govmomi/vim25/types"
|
||||
)
|
||||
|
||||
type KeyValue struct {
|
||||
Key string
|
||||
Value string
|
||||
}
|
||||
|
||||
// case insensitive for Key + Value
|
||||
func (kv *KeyValue) UnmarshalJSON(b []byte) error {
|
||||
e := struct {
|
||||
types.KeyValue
|
||||
Key *string
|
||||
Value *string
|
||||
}{
|
||||
types.KeyValue{}, &kv.Key, &kv.Value,
|
||||
}
|
||||
|
||||
err := json.Unmarshal(b, &e)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if kv.Key == "" {
|
||||
kv.Key = e.KeyValue.Key // "key"
|
||||
}
|
||||
|
||||
if kv.Value == "" {
|
||||
kv.Value = e.KeyValue.Value // "value"
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type Property struct {
|
||||
KeyValue
|
||||
Spec *ovf.Property `json:",omitempty"`
|
||||
}
|
||||
|
||||
type Network struct {
|
||||
Name string
|
||||
Network string
|
||||
}
|
||||
|
||||
type Options struct {
|
||||
AllDeploymentOptions []string `json:",omitempty"`
|
||||
Deployment string `json:",omitempty"`
|
||||
|
||||
AllDiskProvisioningOptions []string `json:",omitempty"`
|
||||
DiskProvisioning string
|
||||
|
||||
AllIPAllocationPolicyOptions []string `json:",omitempty"`
|
||||
IPAllocationPolicy string
|
||||
|
||||
AllIPProtocolOptions []string `json:",omitempty"`
|
||||
IPProtocol string
|
||||
|
||||
PropertyMapping []Property `json:",omitempty"`
|
||||
|
||||
NetworkMapping []Network `json:",omitempty"`
|
||||
|
||||
Annotation string `json:",omitempty"`
|
||||
|
||||
MarkAsTemplate bool
|
||||
PowerOn bool
|
||||
InjectOvfEnv bool
|
||||
WaitForIP bool
|
||||
Name *string
|
||||
}
|
||||
|
||||
type OptionsFlag struct {
|
||||
Options Options
|
||||
Options importer.Options
|
||||
|
||||
path string
|
||||
}
|
||||
|
|
|
|||
15
vendor/github.com/vmware/govmomi/govc/importx/ova.go
generated
vendored
15
vendor/github.com/vmware/govmomi/govc/importx/ova.go
generated
vendored
|
|
@ -1,11 +1,11 @@
|
|||
/*
|
||||
Copyright (c) 2014-2015 VMware, Inc. All Rights Reserved.
|
||||
Copyright (c) 2014-2024 VMware, Inc. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
|
@ -22,6 +22,7 @@ import (
|
|||
|
||||
"github.com/vmware/govmomi/govc/cli"
|
||||
"github.com/vmware/govmomi/object"
|
||||
"github.com/vmware/govmomi/ovf/importer"
|
||||
"github.com/vmware/govmomi/vim25/types"
|
||||
)
|
||||
|
||||
|
|
@ -43,21 +44,21 @@ func (cmd *ova) Run(ctx context.Context, f *flag.FlagSet) error {
|
|||
return err
|
||||
}
|
||||
|
||||
archive := &TapeArchive{Path: fpath}
|
||||
archive.Client = cmd.Client
|
||||
archive := &importer.TapeArchive{Path: fpath}
|
||||
archive.Client = cmd.Importer.Client
|
||||
|
||||
cmd.Archive = archive
|
||||
cmd.Importer.Archive = archive
|
||||
|
||||
moref, err := cmd.Import(fpath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
vm := object.NewVirtualMachine(cmd.Client, *moref)
|
||||
vm := object.NewVirtualMachine(cmd.Importer.Client, *moref)
|
||||
return cmd.Deploy(vm, cmd.OutputFlag)
|
||||
}
|
||||
|
||||
func (cmd *ova) Import(fpath string) (*types.ManagedObjectReference, error) {
|
||||
ovf := "*.ovf"
|
||||
return cmd.ovfx.Import(ovf)
|
||||
return cmd.Importer.Import(context.TODO(), ovf, cmd.Options)
|
||||
}
|
||||
|
|
|
|||
337
vendor/github.com/vmware/govmomi/govc/importx/ovf.go
generated
vendored
337
vendor/github.com/vmware/govmomi/govc/importx/ovf.go
generated
vendored
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2014-2023 VMware, Inc. All Rights Reserved.
|
||||
Copyright (c) 2014-2024 VMware, Inc. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
|
@ -17,23 +17,14 @@ limitations under the License.
|
|||
package importx
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
"github.com/vmware/govmomi/find"
|
||||
"github.com/vmware/govmomi/govc/cli"
|
||||
"github.com/vmware/govmomi/govc/flags"
|
||||
"github.com/vmware/govmomi/nfc"
|
||||
"github.com/vmware/govmomi/object"
|
||||
"github.com/vmware/govmomi/ovf"
|
||||
"github.com/vmware/govmomi/vim25"
|
||||
"github.com/vmware/govmomi/vim25/soap"
|
||||
"github.com/vmware/govmomi/vim25/types"
|
||||
"github.com/vmware/govmomi/ovf/importer"
|
||||
)
|
||||
|
||||
type ovfx struct {
|
||||
|
|
@ -43,17 +34,9 @@ type ovfx struct {
|
|||
*flags.ResourcePoolFlag
|
||||
*flags.FolderFlag
|
||||
|
||||
*ArchiveFlag
|
||||
*OptionsFlag
|
||||
|
||||
Name string
|
||||
VerifyManifest bool
|
||||
Hidden bool
|
||||
|
||||
Client *vim25.Client
|
||||
Datacenter *object.Datacenter
|
||||
Datastore *object.Datastore
|
||||
ResourcePool *object.ResourcePool
|
||||
Importer importer.Importer
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
|
@ -72,14 +55,12 @@ func (cmd *ovfx) Register(ctx context.Context, f *flag.FlagSet) {
|
|||
cmd.FolderFlag, ctx = flags.NewFolderFlag(ctx)
|
||||
cmd.FolderFlag.Register(ctx, f)
|
||||
|
||||
cmd.ArchiveFlag, ctx = newArchiveFlag(ctx)
|
||||
cmd.ArchiveFlag.Register(ctx, f)
|
||||
cmd.OptionsFlag, ctx = newOptionsFlag(ctx)
|
||||
cmd.OptionsFlag.Register(ctx, f)
|
||||
|
||||
f.StringVar(&cmd.Name, "name", "", "Name to use for new entity")
|
||||
f.BoolVar(&cmd.VerifyManifest, "m", false, "Verify checksum of uploaded files against manifest (.mf)")
|
||||
f.BoolVar(&cmd.Hidden, "hidden", false, "Enable hidden properties")
|
||||
f.StringVar(&cmd.Importer.Name, "name", "", "Name to use for new entity")
|
||||
f.BoolVar(&cmd.Importer.VerifyManifest, "m", false, "Verify checksum of uploaded files against manifest (.mf)")
|
||||
f.BoolVar(&cmd.Importer.Hidden, "hidden", false, "Enable hidden properties")
|
||||
}
|
||||
|
||||
func (cmd *ovfx) Process(ctx context.Context) error {
|
||||
|
|
@ -95,9 +76,6 @@ func (cmd *ovfx) Process(ctx context.Context) error {
|
|||
if err := cmd.ResourcePoolFlag.Process(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := cmd.ArchiveFlag.Process(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := cmd.OptionsFlag.Process(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -117,17 +95,17 @@ func (cmd *ovfx) Run(ctx context.Context, f *flag.FlagSet) error {
|
|||
return err
|
||||
}
|
||||
|
||||
archive := &FileArchive{Path: fpath}
|
||||
archive.Client = cmd.Client
|
||||
archive := &importer.FileArchive{Path: fpath}
|
||||
archive.Client = cmd.Importer.Client
|
||||
|
||||
cmd.Archive = archive
|
||||
cmd.Importer.Archive = archive
|
||||
|
||||
moref, err := cmd.Import(fpath)
|
||||
moref, err := cmd.Importer.Import(context.TODO(), fpath, cmd.Options)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
vm := object.NewVirtualMachine(cmd.Client, *moref)
|
||||
vm := object.NewVirtualMachine(cmd.Importer.Client, *moref)
|
||||
return cmd.Deploy(vm, cmd.OutputFlag)
|
||||
}
|
||||
|
||||
|
|
@ -139,313 +117,70 @@ func (cmd *ovfx) Prepare(f *flag.FlagSet) (string, error) {
|
|||
return "", errors.New("no file specified")
|
||||
}
|
||||
|
||||
cmd.Client, err = cmd.DatastoreFlag.Client()
|
||||
cmd.Importer.Log = cmd.OutputFlag.Log
|
||||
cmd.Importer.Client, err = cmd.DatastoreFlag.Client()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
cmd.Datacenter, err = cmd.DatastoreFlag.Datacenter()
|
||||
cmd.Importer.Datacenter, err = cmd.DatastoreFlag.Datacenter()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
cmd.Datastore, err = cmd.DatastoreFlag.Datastore()
|
||||
cmd.Importer.Datastore, err = cmd.DatastoreFlag.Datastore()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
cmd.ResourcePool, err = cmd.ResourcePoolFlag.ResourcePoolIfSpecified()
|
||||
cmd.Importer.ResourcePool, err = cmd.ResourcePoolIfSpecified()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return f.Arg(0), nil
|
||||
}
|
||||
|
||||
func (cmd *ovfx) Map(op []Property) (p []types.KeyValue) {
|
||||
for _, v := range op {
|
||||
p = append(p, types.KeyValue{
|
||||
Key: v.Key,
|
||||
Value: v.Value,
|
||||
})
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (cmd *ovfx) validateNetwork(e *ovf.Envelope, net Network) {
|
||||
var names []string
|
||||
|
||||
if e.Network != nil {
|
||||
for _, n := range e.Network.Networks {
|
||||
if n.Name == net.Name {
|
||||
return
|
||||
}
|
||||
names = append(names, n.Name)
|
||||
}
|
||||
}
|
||||
|
||||
_, _ = cmd.Log(fmt.Sprintf("Warning: invalid NetworkMapping.Name=%q, valid names=%s\n", net.Name, names))
|
||||
}
|
||||
|
||||
func (cmd *ovfx) NetworkMap(e *ovf.Envelope) ([]types.OvfNetworkMapping, error) {
|
||||
ctx := context.TODO()
|
||||
finder, err := cmd.DatastoreFlag.Finder()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var nmap []types.OvfNetworkMapping
|
||||
for _, m := range cmd.Options.NetworkMapping {
|
||||
if m.Network == "" {
|
||||
continue // Not set, let vSphere choose the default network
|
||||
}
|
||||
cmd.validateNetwork(e, m)
|
||||
|
||||
var ref types.ManagedObjectReference
|
||||
|
||||
net, err := finder.Network(ctx, m.Network)
|
||||
if err != nil {
|
||||
switch err.(type) {
|
||||
case *find.NotFoundError:
|
||||
if !ref.FromString(m.Network) {
|
||||
return nil, err
|
||||
} // else this is a raw MO ref
|
||||
default:
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
ref = net.Reference()
|
||||
}
|
||||
|
||||
nmap = append(nmap, types.OvfNetworkMapping{
|
||||
Name: m.Name,
|
||||
Network: ref,
|
||||
})
|
||||
}
|
||||
|
||||
return nmap, err
|
||||
}
|
||||
|
||||
func (cmd *ovfx) Import(fpath string) (*types.ManagedObjectReference, error) {
|
||||
ctx := context.TODO()
|
||||
|
||||
o, err := cmd.ReadOvf(fpath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
e, err := cmd.ReadEnvelope(o)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to parse ovf: %s", err)
|
||||
}
|
||||
|
||||
name := "Govc Virtual Appliance"
|
||||
if e.VirtualSystem != nil {
|
||||
name = e.VirtualSystem.ID
|
||||
if e.VirtualSystem.Name != nil {
|
||||
name = *e.VirtualSystem.Name
|
||||
}
|
||||
|
||||
if cmd.Hidden {
|
||||
// TODO: userConfigurable is optional and defaults to false, so we should *add* userConfigurable=true
|
||||
// if not set for a Property. But, there'd be a bunch more work involved to preserve other data in doing
|
||||
// a complete xml.Marshal of the .ovf
|
||||
o = bytes.ReplaceAll(o, []byte(`userConfigurable="false"`), []byte(`userConfigurable="true"`))
|
||||
}
|
||||
}
|
||||
|
||||
// Override name from options if specified
|
||||
if cmd.Options.Name != nil {
|
||||
name = *cmd.Options.Name
|
||||
}
|
||||
|
||||
// Override name from arguments if specified
|
||||
if cmd.Name != "" {
|
||||
name = cmd.Name
|
||||
}
|
||||
|
||||
nmap, err := cmd.NetworkMap(e)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cisp := types.OvfCreateImportSpecParams{
|
||||
DiskProvisioning: cmd.Options.DiskProvisioning,
|
||||
EntityName: name,
|
||||
IpAllocationPolicy: cmd.Options.IPAllocationPolicy,
|
||||
IpProtocol: cmd.Options.IPProtocol,
|
||||
OvfManagerCommonParams: types.OvfManagerCommonParams{
|
||||
DeploymentOption: cmd.Options.Deployment,
|
||||
Locale: "US"},
|
||||
PropertyMapping: cmd.Map(cmd.Options.PropertyMapping),
|
||||
NetworkMapping: nmap,
|
||||
}
|
||||
|
||||
host, err := cmd.HostSystemIfSpecified()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return "", err
|
||||
}
|
||||
|
||||
if cmd.ResourcePool == nil {
|
||||
if cmd.Importer.ResourcePool == nil {
|
||||
if host == nil {
|
||||
cmd.ResourcePool, err = cmd.ResourcePoolFlag.ResourcePool()
|
||||
cmd.Importer.ResourcePool, err = cmd.ResourcePoolFlag.ResourcePool()
|
||||
} else {
|
||||
cmd.ResourcePool, err = host.ResourcePool(ctx)
|
||||
cmd.Importer.ResourcePool, err = host.ResourcePool(context.TODO())
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return "", err
|
||||
}
|
||||
}
|
||||
|
||||
m := ovf.NewManager(cmd.Client)
|
||||
spec, err := m.CreateImportSpec(ctx, string(o), cmd.ResourcePool, cmd.Datastore, cisp)
|
||||
cmd.Importer.Finder, err = cmd.DatastoreFlag.Finder()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if spec.Error != nil {
|
||||
return nil, errors.New(spec.Error[0].LocalizedMessage)
|
||||
}
|
||||
if spec.Warning != nil {
|
||||
for _, w := range spec.Warning {
|
||||
_, _ = cmd.Log(fmt.Sprintf("Warning: %s\n", w.LocalizedMessage))
|
||||
}
|
||||
return "", err
|
||||
}
|
||||
|
||||
if cmd.Options.Annotation != "" {
|
||||
switch s := spec.ImportSpec.(type) {
|
||||
case *types.VirtualMachineImportSpec:
|
||||
s.ConfigSpec.Annotation = cmd.Options.Annotation
|
||||
case *types.VirtualAppImportSpec:
|
||||
s.VAppConfigSpec.Annotation = cmd.Options.Annotation
|
||||
}
|
||||
cmd.Importer.Host, err = cmd.HostSystemIfSpecified()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
var folder *object.Folder
|
||||
// The folder argument must not be set on a VM in a vApp, otherwise causes
|
||||
// InvalidArgument fault: A specified parameter was not correct: pool
|
||||
if cmd.ResourcePool.Reference().Type != "VirtualApp" {
|
||||
folder, err = cmd.FolderOrDefault("vm")
|
||||
if cmd.Importer.ResourcePool.Reference().Type != "VirtualApp" {
|
||||
cmd.Importer.Folder, err = cmd.FolderOrDefault("vm")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return "", err
|
||||
}
|
||||
}
|
||||
|
||||
if cmd.VerifyManifest {
|
||||
err = cmd.readManifest(fpath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
if cmd.Importer.Name == "" {
|
||||
// Override name from options if specified
|
||||
if cmd.Options.Name != nil {
|
||||
cmd.Importer.Name = *cmd.Options.Name
|
||||
}
|
||||
} else {
|
||||
cmd.Options.Name = &cmd.Importer.Name
|
||||
}
|
||||
|
||||
lease, err := cmd.ResourcePool.ImportVApp(ctx, spec.ImportSpec, folder, host)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info, err := lease.Wait(ctx, spec.FileItem)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
u := lease.StartUpdater(ctx, info)
|
||||
defer u.Done()
|
||||
|
||||
for _, i := range info.Items {
|
||||
err = cmd.Upload(ctx, lease, i)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return &info.Entity, lease.Complete(ctx)
|
||||
}
|
||||
|
||||
func (cmd *ovfx) Upload(ctx context.Context, lease *nfc.Lease, item nfc.FileItem) error {
|
||||
file := item.Path
|
||||
|
||||
f, size, err := cmd.Open(file)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
logger := cmd.ProgressLogger(fmt.Sprintf("Uploading %s... ", path.Base(file)))
|
||||
defer logger.Wait()
|
||||
|
||||
opts := soap.Upload{
|
||||
ContentLength: size,
|
||||
Progress: logger,
|
||||
}
|
||||
|
||||
err = lease.Upload(ctx, item, f, opts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if cmd.VerifyManifest {
|
||||
mapImportKeyToKey := func(urls []types.HttpNfcLeaseDeviceUrl, importKey string) string {
|
||||
for _, url := range urls {
|
||||
if url.ImportKey == importKey {
|
||||
return url.Key
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
leaseInfo, err := lease.Wait(ctx, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cmd.validateChecksum(ctx, lease, file, mapImportKeyToKey(leaseInfo.DeviceUrl, item.DeviceId))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (cmd *ovfx) validateChecksum(ctx context.Context, lease *nfc.Lease, file string, key string) error {
|
||||
sum, found := cmd.manifest[file]
|
||||
if !found {
|
||||
msg := fmt.Sprintf("missing checksum for %v in manifest file", file)
|
||||
return errors.New(msg)
|
||||
}
|
||||
// Perform the checksum match eagerly, after each file upload, instead
|
||||
// of after uploading all the files, to provide fail-fast behavior.
|
||||
// (Trade-off here is multiple GetManifest() API calls to the server.)
|
||||
manifests, err := lease.GetManifest(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, m := range manifests {
|
||||
if m.Key == key {
|
||||
// Compare server-side computed checksum of uploaded file
|
||||
// against the client's manifest entry (assuming client's
|
||||
// manifest has correct checksums - client doesn't compute
|
||||
// checksum of the file before uploading).
|
||||
|
||||
// Try matching sha1 first (newer versions have moved to sha256).
|
||||
if strings.ToUpper(sum.Algorithm) == "SHA1" {
|
||||
if sum.Checksum != m.Sha1 {
|
||||
msg := fmt.Sprintf("manifest checksum %v mismatch with uploaded checksum %v for file %v",
|
||||
sum.Checksum, m.Sha1, file)
|
||||
return errors.New(msg)
|
||||
}
|
||||
// Uploaded file checksum computed by server matches with local manifest entry.
|
||||
return nil
|
||||
}
|
||||
// If not sha1, check for other types (in a separate field).
|
||||
if !strings.EqualFold(sum.Algorithm, m.ChecksumType) {
|
||||
msg := fmt.Sprintf("manifest checksum type %v mismatch with uploaded checksum type %v for file %v",
|
||||
sum.Algorithm, m.ChecksumType, file)
|
||||
return errors.New(msg)
|
||||
}
|
||||
if !strings.EqualFold(sum.Checksum, m.Checksum) {
|
||||
msg := fmt.Sprintf("manifest checksum %v mismatch with uploaded checksum %v for file %v",
|
||||
sum.Checksum, m.Checksum, file)
|
||||
return errors.New(msg)
|
||||
}
|
||||
// Uploaded file checksum computed by server matches with local manifest entry.
|
||||
return nil
|
||||
}
|
||||
}
|
||||
msg := fmt.Sprintf("missing manifest entry on server for uploaded file %v (key %v), manifests=%#v", file, key, manifests)
|
||||
return errors.New(msg)
|
||||
return f.Arg(0), nil
|
||||
}
|
||||
|
|
|
|||
139
vendor/github.com/vmware/govmomi/govc/importx/spec.go
generated
vendored
139
vendor/github.com/vmware/govmomi/govc/importx/spec.go
generated
vendored
|
|
@ -22,27 +22,18 @@ import (
|
|||
"fmt"
|
||||
"io"
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
"github.com/vmware/govmomi/govc/cli"
|
||||
"github.com/vmware/govmomi/govc/flags"
|
||||
"github.com/vmware/govmomi/ovf"
|
||||
"github.com/vmware/govmomi/vim25/types"
|
||||
)
|
||||
|
||||
var (
|
||||
allDiskProvisioningOptions = types.OvfCreateImportSpecParamsDiskProvisioningType("").Strings()
|
||||
|
||||
allIPAllocationPolicyOptions = types.VAppIPAssignmentInfoIpAllocationPolicy("").Strings()
|
||||
|
||||
allIPProtocolOptions = types.VAppIPAssignmentInfoProtocols("").Strings()
|
||||
"github.com/vmware/govmomi/ovf/importer"
|
||||
)
|
||||
|
||||
type spec struct {
|
||||
*ArchiveFlag
|
||||
*flags.ClientFlag
|
||||
*flags.OutputFlag
|
||||
|
||||
Archive importer.Archive
|
||||
|
||||
hidden bool
|
||||
}
|
||||
|
||||
|
|
@ -51,8 +42,6 @@ func init() {
|
|||
}
|
||||
|
||||
func (cmd *spec) Register(ctx context.Context, f *flag.FlagSet) {
|
||||
cmd.ArchiveFlag, ctx = newArchiveFlag(ctx)
|
||||
cmd.ArchiveFlag.Register(ctx, f)
|
||||
cmd.ClientFlag, ctx = flags.NewClientFlag(ctx)
|
||||
cmd.ClientFlag.Register(ctx, f)
|
||||
|
||||
|
|
@ -63,9 +52,6 @@ func (cmd *spec) Register(ctx context.Context, f *flag.FlagSet) {
|
|||
}
|
||||
|
||||
func (cmd *spec) Process(ctx context.Context) error {
|
||||
if err := cmd.ArchiveFlag.Process(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := cmd.ClientFlag.Process(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -86,29 +72,29 @@ func (cmd *spec) Run(ctx context.Context, f *flag.FlagSet) error {
|
|||
if len(fpath) > 0 {
|
||||
switch path.Ext(fpath) {
|
||||
case ".ovf":
|
||||
cmd.Archive = &FileArchive{Path: fpath}
|
||||
cmd.Archive = &importer.FileArchive{Path: fpath}
|
||||
case "", ".ova":
|
||||
cmd.Archive = &TapeArchive{Path: fpath}
|
||||
cmd.Archive = &importer.TapeArchive{Path: fpath}
|
||||
fpath = "*.ovf"
|
||||
default:
|
||||
return fmt.Errorf("invalid file extension %s", path.Ext(fpath))
|
||||
}
|
||||
|
||||
if isRemotePath(f.Arg(0)) {
|
||||
if importer.IsRemotePath(f.Arg(0)) {
|
||||
client, err := cmd.Client()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
switch archive := cmd.Archive.(type) {
|
||||
case *FileArchive:
|
||||
case *importer.FileArchive:
|
||||
archive.Client = client
|
||||
case *TapeArchive:
|
||||
case *importer.TapeArchive:
|
||||
archive.Client = client
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
env, err := cmd.Spec(fpath)
|
||||
env, err := importer.Spec(fpath, cmd.Archive, cmd.hidden, cmd.Verbose())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -120,114 +106,9 @@ func (cmd *spec) Run(ctx context.Context, f *flag.FlagSet) error {
|
|||
}
|
||||
|
||||
type specResult struct {
|
||||
*Options
|
||||
*importer.Options
|
||||
}
|
||||
|
||||
func (*specResult) Write(w io.Writer) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (cmd *spec) Map(e *ovf.Envelope) (res []Property) {
|
||||
if e == nil || e.VirtualSystem == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
for _, p := range e.VirtualSystem.Product {
|
||||
for i, v := range p.Property {
|
||||
if v.UserConfigurable == nil {
|
||||
continue
|
||||
}
|
||||
if !*v.UserConfigurable && !cmd.hidden {
|
||||
continue
|
||||
}
|
||||
|
||||
d := ""
|
||||
if v.Default != nil {
|
||||
d = *v.Default
|
||||
}
|
||||
|
||||
// vSphere only accept True/False as boolean values for some reason
|
||||
if v.Type == "boolean" {
|
||||
d = strings.Title(d)
|
||||
}
|
||||
|
||||
np := Property{KeyValue: KeyValue{Key: p.Key(v), Value: d}}
|
||||
|
||||
if cmd.Verbose() {
|
||||
np.Spec = &p.Property[i]
|
||||
}
|
||||
|
||||
res = append(res, np)
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (cmd *spec) Spec(fpath string) (*Options, error) {
|
||||
e := &ovf.Envelope{}
|
||||
if fpath != "" {
|
||||
d, err := cmd.ReadOvf(fpath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if e, err = cmd.ReadEnvelope(d); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
var deploymentOptions []string
|
||||
if e.DeploymentOption != nil && e.DeploymentOption.Configuration != nil {
|
||||
// add default first
|
||||
for _, c := range e.DeploymentOption.Configuration {
|
||||
if c.Default != nil && *c.Default {
|
||||
deploymentOptions = append(deploymentOptions, c.ID)
|
||||
}
|
||||
}
|
||||
|
||||
for _, c := range e.DeploymentOption.Configuration {
|
||||
if c.Default == nil || !*c.Default {
|
||||
deploymentOptions = append(deploymentOptions, c.ID)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
o := Options{
|
||||
DiskProvisioning: allDiskProvisioningOptions[0],
|
||||
IPAllocationPolicy: allIPAllocationPolicyOptions[0],
|
||||
IPProtocol: allIPProtocolOptions[0],
|
||||
MarkAsTemplate: false,
|
||||
PowerOn: false,
|
||||
WaitForIP: false,
|
||||
InjectOvfEnv: false,
|
||||
PropertyMapping: cmd.Map(e),
|
||||
}
|
||||
|
||||
if deploymentOptions != nil {
|
||||
o.Deployment = deploymentOptions[0]
|
||||
}
|
||||
|
||||
if e.VirtualSystem != nil && e.VirtualSystem.Annotation != nil {
|
||||
for _, a := range e.VirtualSystem.Annotation {
|
||||
o.Annotation += a.Annotation
|
||||
}
|
||||
}
|
||||
|
||||
if e.Network != nil {
|
||||
for _, net := range e.Network.Networks {
|
||||
o.NetworkMapping = append(o.NetworkMapping, Network{net.Name, ""})
|
||||
}
|
||||
}
|
||||
|
||||
if cmd.Verbose() {
|
||||
if deploymentOptions != nil {
|
||||
o.AllDeploymentOptions = deploymentOptions
|
||||
}
|
||||
o.AllDiskProvisioningOptions = allDiskProvisioningOptions
|
||||
o.AllIPAllocationPolicyOptions = allIPAllocationPolicyOptions
|
||||
o.AllIPProtocolOptions = allIPProtocolOptions
|
||||
}
|
||||
|
||||
return &o, nil
|
||||
}
|
||||
|
|
|
|||
11
vendor/github.com/vmware/govmomi/govc/vm/clone.go
generated
vendored
11
vendor/github.com/vmware/govmomi/govc/vm/clone.go
generated
vendored
|
|
@ -1,11 +1,11 @@
|
|||
/*
|
||||
Copyright (c) 2014-2016 VMware, Inc. All Rights Reserved.
|
||||
Copyright (c) 2016-2024 VMware, Inc. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
|
@ -243,6 +243,9 @@ func (cmd *clone) Run(ctx context.Context, f *flag.FlagSet) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if cmd.Spec {
|
||||
return nil
|
||||
}
|
||||
|
||||
if cmd.cpus > 0 || cmd.memory > 0 || cmd.annotation != "" {
|
||||
vmConfigSpec := types.VirtualMachineConfigSpec{}
|
||||
|
|
@ -471,6 +474,10 @@ func (cmd *clone) cloneVM(ctx context.Context) (*object.VirtualMachine, error) {
|
|||
cloneSpec.Customization = &customSpec
|
||||
}
|
||||
|
||||
if cmd.Spec {
|
||||
return nil, cmd.WriteAny(cloneSpec)
|
||||
}
|
||||
|
||||
task, err := cmd.VirtualMachine.Clone(ctx, cmd.Folder, cmd.name, *cloneSpec)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
|||
16
vendor/github.com/vmware/govmomi/govc/vm/create.go
generated
vendored
16
vendor/github.com/vmware/govmomi/govc/vm/create.go
generated
vendored
|
|
@ -307,7 +307,7 @@ func (cmd *create) Run(ctx context.Context, f *flag.FlagSet) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if cmd.place {
|
||||
if cmd.place || cmd.Spec {
|
||||
return nil
|
||||
}
|
||||
info, err := task.WaitForResult(ctx, nil)
|
||||
|
|
@ -490,7 +490,7 @@ func (cmd *create) createVM(ctx context.Context) (*object.Task, error) {
|
|||
return nil, fmt.Errorf("please provide either a cluster, datastore or datastore-cluster")
|
||||
}
|
||||
|
||||
if !cmd.force {
|
||||
if !cmd.force && !cmd.Spec {
|
||||
vmxPath := fmt.Sprintf("%s/%s.vmx", cmd.name, cmd.name)
|
||||
|
||||
_, err := datastore.Stat(ctx, vmxPath)
|
||||
|
|
@ -506,6 +506,10 @@ func (cmd *create) createVM(ctx context.Context) (*object.Task, error) {
|
|||
VmPathName: fmt.Sprintf("[%s]", datastore.Name()),
|
||||
}
|
||||
|
||||
if cmd.Spec {
|
||||
return nil, cmd.WriteAny(spec)
|
||||
}
|
||||
|
||||
return folder.CreateVM(ctx, *spec, cmd.ResourcePool, cmd.HostSystem)
|
||||
}
|
||||
|
||||
|
|
@ -519,6 +523,14 @@ func (cmd *create) addStorage(devices object.VirtualDeviceList) (object.VirtualD
|
|||
|
||||
devices = append(devices, nvme)
|
||||
cmd.controller = devices.Name(nvme)
|
||||
} else if cmd.controller == "sata" {
|
||||
sata, err := devices.CreateSATAController()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
devices = append(devices, sata)
|
||||
cmd.controller = devices.Name(sata)
|
||||
} else {
|
||||
scsi, err := devices.CreateSCSIController(cmd.controller)
|
||||
if err != nil {
|
||||
|
|
|
|||
42
vendor/github.com/vmware/govmomi/govc/vm/migrate.go
generated
vendored
42
vendor/github.com/vmware/govmomi/govc/vm/migrate.go
generated
vendored
|
|
@ -1,11 +1,11 @@
|
|||
/*
|
||||
Copyright (c) 2016 VMware, Inc. All Rights Reserved.
|
||||
Copyright (c) 2016-2024 VMware, Inc. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
|
@ -32,6 +32,7 @@ type migrate struct {
|
|||
*flags.ResourcePoolFlag
|
||||
*flags.HostSystemFlag
|
||||
*flags.DatastoreFlag
|
||||
*flags.NetworkFlag
|
||||
*flags.VirtualMachineFlag
|
||||
|
||||
priority types.VirtualMachineMovePriority
|
||||
|
|
@ -58,6 +59,9 @@ func (cmd *migrate) Register(ctx context.Context, f *flag.FlagSet) {
|
|||
cmd.DatastoreFlag, ctx = flags.NewDatastoreFlag(ctx)
|
||||
cmd.DatastoreFlag.Register(ctx, f)
|
||||
|
||||
cmd.NetworkFlag, ctx = flags.NewNetworkFlag(ctx)
|
||||
cmd.NetworkFlag.Register(ctx, f)
|
||||
|
||||
f.StringVar((*string)(&cmd.priority), "priority", string(types.VirtualMachineMovePriorityDefaultPriority), "The task priority")
|
||||
}
|
||||
|
||||
|
|
@ -77,6 +81,9 @@ func (cmd *migrate) Process(ctx context.Context) error {
|
|||
if err := cmd.DatastoreFlag.Process(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := cmd.NetworkFlag.Process(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
@ -95,7 +102,36 @@ Examples:
|
|||
}
|
||||
|
||||
func (cmd *migrate) relocate(ctx context.Context, vm *object.VirtualMachine) error {
|
||||
task, err := vm.Relocate(ctx, cmd.spec, cmd.priority)
|
||||
spec := cmd.spec
|
||||
|
||||
if cmd.NetworkFlag.IsSet() {
|
||||
dev, err := cmd.NetworkFlag.Device()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
devices, err := vm.Device(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
net := devices.SelectByType((*types.VirtualEthernetCard)(nil))
|
||||
if len(net) != 1 {
|
||||
return fmt.Errorf("-net specified, but %s has %d nics", vm.Name(), len(net))
|
||||
}
|
||||
cmd.NetworkFlag.Change(net[0], dev)
|
||||
|
||||
spec.DeviceChange = append(spec.DeviceChange, &types.VirtualDeviceConfigSpec{
|
||||
Device: net[0],
|
||||
Operation: types.VirtualDeviceConfigSpecOperationEdit,
|
||||
})
|
||||
}
|
||||
|
||||
if cmd.VirtualMachineFlag.Spec {
|
||||
return cmd.VirtualMachineFlag.WriteAny(spec)
|
||||
}
|
||||
|
||||
task, err := vm.Relocate(ctx, spec, cmd.priority)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
2
vendor/github.com/vmware/govmomi/internal/version/version.go
generated
vendored
2
vendor/github.com/vmware/govmomi/internal/version/version.go
generated
vendored
|
|
@ -21,5 +21,5 @@ const (
|
|||
ClientName = "govmomi"
|
||||
|
||||
// ClientVersion is the version of this SDK
|
||||
ClientVersion = "0.38.0"
|
||||
ClientVersion = "0.39.0"
|
||||
)
|
||||
|
|
|
|||
77
vendor/github.com/vmware/govmomi/object/virtual_device_list.go
generated
vendored
77
vendor/github.com/vmware/govmomi/object/virtual_device_list.go
generated
vendored
|
|
@ -361,6 +361,77 @@ func (l VirtualDeviceList) newNVMEBusNumber() int32 {
|
|||
return -1
|
||||
}
|
||||
|
||||
// FindSATAController will find the named SATA or AHCI controller if given, otherwise will pick an available controller.
|
||||
// An error is returned if the named controller is not found or not a SATA or AHCI controller. Or, if name is not
|
||||
// given and no available controller can be found.
|
||||
func (l VirtualDeviceList) FindSATAController(name string) (types.BaseVirtualController, error) {
|
||||
if name != "" {
|
||||
d := l.Find(name)
|
||||
if d == nil {
|
||||
return nil, fmt.Errorf("device '%s' not found", name)
|
||||
}
|
||||
switch c := d.(type) {
|
||||
case *types.VirtualSATAController:
|
||||
return c, nil
|
||||
case *types.VirtualAHCIController:
|
||||
return c, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("%s is not a SATA or AHCI controller", name)
|
||||
}
|
||||
}
|
||||
|
||||
c := l.PickController((*types.VirtualSATAController)(nil))
|
||||
if c == nil {
|
||||
c = l.PickController((*types.VirtualAHCIController)(nil))
|
||||
}
|
||||
if c == nil {
|
||||
return nil, errors.New("no available SATA or AHCI controller")
|
||||
}
|
||||
|
||||
switch c := c.(type) {
|
||||
case *types.VirtualSATAController:
|
||||
return c, nil
|
||||
case *types.VirtualAHCIController:
|
||||
return c, nil
|
||||
}
|
||||
|
||||
return nil, errors.New("unexpected controller type")
|
||||
}
|
||||
|
||||
// CreateSATAController creates a new SATA controller.
|
||||
func (l VirtualDeviceList) CreateSATAController() (types.BaseVirtualDevice, error) {
|
||||
sata := &types.VirtualAHCIController{}
|
||||
sata.BusNumber = l.newSATABusNumber()
|
||||
sata.Key = l.NewKey()
|
||||
|
||||
return sata, nil
|
||||
}
|
||||
|
||||
var sataBusNumbers = []int{0, 1, 2, 3}
|
||||
|
||||
// newSATABusNumber returns the bus number to use for adding a new SATA bus device.
|
||||
// -1 is returned if there are no bus numbers available.
|
||||
func (l VirtualDeviceList) newSATABusNumber() int32 {
|
||||
var used []int
|
||||
|
||||
for _, d := range l.SelectByType((*types.VirtualSATAController)(nil)) {
|
||||
num := d.(types.BaseVirtualController).GetVirtualController().BusNumber
|
||||
if num >= 0 {
|
||||
used = append(used, int(num))
|
||||
} // else caller is creating a new vm using SATAControllerTypes
|
||||
}
|
||||
|
||||
sort.Ints(used)
|
||||
|
||||
for i, n := range sataBusNumbers {
|
||||
if i == len(used) || n != used[i] {
|
||||
return int32(n)
|
||||
}
|
||||
}
|
||||
|
||||
return -1
|
||||
}
|
||||
|
||||
// FindDiskController will find an existing ide or scsi disk controller.
|
||||
func (l VirtualDeviceList) FindDiskController(name string) (types.BaseVirtualController, error) {
|
||||
switch {
|
||||
|
|
@ -370,6 +441,8 @@ func (l VirtualDeviceList) FindDiskController(name string) (types.BaseVirtualCon
|
|||
return l.FindSCSIController("")
|
||||
case name == "nvme":
|
||||
return l.FindNVMEController("")
|
||||
case name == "sata":
|
||||
return l.FindSATAController("")
|
||||
default:
|
||||
if c, ok := l.Find(name).(types.BaseVirtualController); ok {
|
||||
return c, nil
|
||||
|
|
@ -389,6 +462,8 @@ func (l VirtualDeviceList) PickController(kind types.BaseVirtualController) type
|
|||
return num < 15
|
||||
case *types.VirtualIDEController:
|
||||
return num < 2
|
||||
case types.BaseVirtualSATAController:
|
||||
return num < 30
|
||||
case *types.VirtualNVMEController:
|
||||
return num < 8
|
||||
default:
|
||||
|
|
@ -909,8 +984,6 @@ func (l VirtualDeviceList) Type(device types.BaseVirtualDevice) string {
|
|||
return "pvscsi"
|
||||
case *types.VirtualLsiLogicSASController:
|
||||
return "lsilogic-sas"
|
||||
case *types.VirtualNVMEController:
|
||||
return "nvme"
|
||||
case *types.VirtualPrecisionClock:
|
||||
return "clock"
|
||||
default:
|
||||
|
|
|
|||
27
vendor/github.com/vmware/govmomi/object/virtual_disk_manager.go
generated
vendored
27
vendor/github.com/vmware/govmomi/object/virtual_disk_manager.go
generated
vendored
|
|
@ -94,6 +94,33 @@ func (m VirtualDiskManager) CreateVirtualDisk(
|
|||
return NewTask(m.c, res.Returnval), nil
|
||||
}
|
||||
|
||||
// ExtendVirtualDisk extends an existing virtual disk.
|
||||
func (m VirtualDiskManager) ExtendVirtualDisk(
|
||||
ctx context.Context,
|
||||
name string, datacenter *Datacenter,
|
||||
capacityKb int64,
|
||||
eagerZero *bool) (*Task, error) {
|
||||
|
||||
req := types.ExtendVirtualDisk_Task{
|
||||
This: m.Reference(),
|
||||
Name: name,
|
||||
NewCapacityKb: capacityKb,
|
||||
EagerZero: eagerZero,
|
||||
}
|
||||
|
||||
if datacenter != nil {
|
||||
ref := datacenter.Reference()
|
||||
req.Datacenter = &ref
|
||||
}
|
||||
|
||||
res, err := methods.ExtendVirtualDisk_Task(ctx, m.c, &req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return NewTask(m.c, res.Returnval), nil
|
||||
}
|
||||
|
||||
// MoveVirtualDisk moves a virtual disk.
|
||||
func (m VirtualDiskManager) MoveVirtualDisk(
|
||||
ctx context.Context,
|
||||
|
|
|
|||
111
vendor/github.com/vmware/govmomi/object/vm_compatability_checker.go
generated
vendored
Normal file
111
vendor/github.com/vmware/govmomi/object/vm_compatability_checker.go
generated
vendored
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
/*
|
||||
Copyright (c) 2024-2024 VMware, Inc. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package object
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/vmware/govmomi/vim25"
|
||||
"github.com/vmware/govmomi/vim25/methods"
|
||||
"github.com/vmware/govmomi/vim25/types"
|
||||
)
|
||||
|
||||
// VmCompatibilityChecker models the CompatibilityChecker, a singleton managed
|
||||
// object that can answer questions about compatibility of a virtual machine
|
||||
// with a host.
|
||||
//
|
||||
// For more information, see:
|
||||
// https://dp-downloads.broadcom.com/api-content/apis/API_VWSA_001/8.0U3/html/ReferenceGuides/vim.vm.check.CompatibilityChecker.html
|
||||
type VmCompatibilityChecker struct {
|
||||
Common
|
||||
}
|
||||
|
||||
func NewVmCompatibilityChecker(c *vim25.Client) *VmCompatibilityChecker {
|
||||
return &VmCompatibilityChecker{
|
||||
Common: NewCommon(c, *c.ServiceContent.VmCompatibilityChecker),
|
||||
}
|
||||
}
|
||||
|
||||
func (c VmCompatibilityChecker) CheckCompatibility(
|
||||
ctx context.Context,
|
||||
vm types.ManagedObjectReference,
|
||||
host *types.ManagedObjectReference,
|
||||
pool *types.ManagedObjectReference,
|
||||
testTypes ...types.CheckTestType) ([]types.CheckResult, error) {
|
||||
|
||||
req := types.CheckCompatibility_Task{
|
||||
This: c.Reference(),
|
||||
Vm: vm,
|
||||
Host: host,
|
||||
Pool: pool,
|
||||
TestType: checkTestTypesToStrings(testTypes),
|
||||
}
|
||||
|
||||
res, err := methods.CheckCompatibility_Task(ctx, c.c, &req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ti, err := NewTask(c.c, res.Returnval).WaitForResult(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return ti.Result.(types.ArrayOfCheckResult).CheckResult, nil
|
||||
}
|
||||
|
||||
func (c VmCompatibilityChecker) CheckVmConfig(
|
||||
ctx context.Context,
|
||||
spec types.VirtualMachineConfigSpec,
|
||||
vm *types.ManagedObjectReference,
|
||||
host *types.ManagedObjectReference,
|
||||
pool *types.ManagedObjectReference,
|
||||
testTypes ...types.CheckTestType) ([]types.CheckResult, error) {
|
||||
|
||||
req := types.CheckVmConfig_Task{
|
||||
This: c.Reference(),
|
||||
Spec: spec,
|
||||
Vm: vm,
|
||||
Host: host,
|
||||
Pool: pool,
|
||||
TestType: checkTestTypesToStrings(testTypes),
|
||||
}
|
||||
|
||||
res, err := methods.CheckVmConfig_Task(ctx, c.c, &req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ti, err := NewTask(c.c, res.Returnval).WaitForResult(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return ti.Result.(types.ArrayOfCheckResult).CheckResult, nil
|
||||
}
|
||||
|
||||
func checkTestTypesToStrings(testTypes []types.CheckTestType) []string {
|
||||
if len(testTypes) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
s := make([]string, len(testTypes))
|
||||
for i := range testTypes {
|
||||
s[i] = string(testTypes[i])
|
||||
}
|
||||
return s
|
||||
}
|
||||
67
vendor/github.com/vmware/govmomi/object/vm_provisioning_checker.go
generated
vendored
Normal file
67
vendor/github.com/vmware/govmomi/object/vm_provisioning_checker.go
generated
vendored
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
Copyright (c) 2024-2024 VMware, Inc. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package object
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/vmware/govmomi/vim25"
|
||||
"github.com/vmware/govmomi/vim25/methods"
|
||||
"github.com/vmware/govmomi/vim25/types"
|
||||
)
|
||||
|
||||
// VmProvisioningChecker models the ProvisioningChecker, a singleton managed
|
||||
// object that can answer questions about the feasibility of certain
|
||||
// provisioning operations.
|
||||
//
|
||||
// For more information, see:
|
||||
// https://dp-downloads.broadcom.com/api-content/apis/API_VWSA_001/8.0U3/html/ReferenceGuides/vim.vm.check.ProvisioningChecker.html
|
||||
type VmProvisioningChecker struct {
|
||||
Common
|
||||
}
|
||||
|
||||
func NewVmProvisioningChecker(c *vim25.Client) *VmProvisioningChecker {
|
||||
return &VmProvisioningChecker{
|
||||
Common: NewCommon(c, *c.ServiceContent.VmProvisioningChecker),
|
||||
}
|
||||
}
|
||||
|
||||
func (c VmProvisioningChecker) CheckRelocate(
|
||||
ctx context.Context,
|
||||
vm types.ManagedObjectReference,
|
||||
spec types.VirtualMachineRelocateSpec,
|
||||
testTypes ...types.CheckTestType) ([]types.CheckResult, error) {
|
||||
|
||||
req := types.CheckRelocate_Task{
|
||||
This: c.Reference(),
|
||||
Vm: vm,
|
||||
Spec: spec,
|
||||
TestType: checkTestTypesToStrings(testTypes),
|
||||
}
|
||||
|
||||
res, err := methods.CheckRelocate_Task(ctx, c.c, &req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ti, err := NewTask(c.c, res.Returnval).WaitForResult(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return ti.Result.(types.ArrayOfCheckResult).CheckResult, nil
|
||||
}
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
/*
|
||||
Copyright (c) 2014-2015 VMware, Inc. All Rights Reserved.
|
||||
Copyright (c) 2024-2024 VMware, Inc. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
|
@ -14,14 +14,13 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
package importx
|
||||
package importer
|
||||
|
||||
import (
|
||||
"archive/tar"
|
||||
"bytes"
|
||||
"context"
|
||||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/url"
|
||||
|
|
@ -31,32 +30,12 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/vmware/govmomi/ovf"
|
||||
"github.com/vmware/govmomi/vapi/library"
|
||||
"github.com/vmware/govmomi/vim25"
|
||||
"github.com/vmware/govmomi/vim25/soap"
|
||||
)
|
||||
|
||||
// ArchiveFlag doesn't register any flags;
|
||||
// only encapsulates some common archive related functionality.
|
||||
type ArchiveFlag struct {
|
||||
Archive
|
||||
|
||||
manifest map[string]*library.Checksum
|
||||
}
|
||||
|
||||
func newArchiveFlag(ctx context.Context) (*ArchiveFlag, context.Context) {
|
||||
return &ArchiveFlag{}, ctx
|
||||
}
|
||||
|
||||
func (f *ArchiveFlag) Register(ctx context.Context, fs *flag.FlagSet) {
|
||||
}
|
||||
|
||||
func (f *ArchiveFlag) Process(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f *ArchiveFlag) ReadOvf(fpath string) ([]byte, error) {
|
||||
r, _, err := f.Open(fpath)
|
||||
func ReadOvf(fpath string, a Archive) ([]byte, error) {
|
||||
r, _, err := a.Open(fpath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -65,7 +44,7 @@ func (f *ArchiveFlag) ReadOvf(fpath string) ([]byte, error) {
|
|||
return io.ReadAll(r)
|
||||
}
|
||||
|
||||
func (f *ArchiveFlag) ReadEnvelope(data []byte) (*ovf.Envelope, error) {
|
||||
func ReadEnvelope(data []byte) (*ovf.Envelope, error) {
|
||||
e, err := ovf.Unmarshal(bytes.NewReader(data))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to parse ovf: %s", err)
|
||||
|
|
@ -74,22 +53,6 @@ func (f *ArchiveFlag) ReadEnvelope(data []byte) (*ovf.Envelope, error) {
|
|||
return e, nil
|
||||
}
|
||||
|
||||
func (f *ArchiveFlag) readManifest(fpath string) error {
|
||||
base := filepath.Base(fpath)
|
||||
ext := filepath.Ext(base)
|
||||
mfName := strings.Replace(base, ext, ".mf", 1)
|
||||
|
||||
mf, _, err := f.Open(mfName)
|
||||
if err != nil {
|
||||
msg := fmt.Sprintf("manifest %q: %s", mf, err)
|
||||
fmt.Fprintln(os.Stderr, msg)
|
||||
return errors.New(msg)
|
||||
}
|
||||
f.manifest, err = library.ReadManifest(mf)
|
||||
_ = mf.Close()
|
||||
return err
|
||||
}
|
||||
|
||||
type Archive interface {
|
||||
Open(string) (io.ReadCloser, int64, error)
|
||||
}
|
||||
|
|
@ -163,7 +126,7 @@ type Opener struct {
|
|||
*vim25.Client
|
||||
}
|
||||
|
||||
func isRemotePath(path string) bool {
|
||||
func IsRemotePath(path string) bool {
|
||||
if strings.HasPrefix(path, "http://") || strings.HasPrefix(path, "https://") {
|
||||
return true
|
||||
}
|
||||
|
|
@ -185,7 +148,7 @@ func (o Opener) OpenLocal(path string) (io.ReadCloser, int64, error) {
|
|||
}
|
||||
|
||||
func (o Opener) OpenFile(path string) (io.ReadCloser, int64, error) {
|
||||
if isRemotePath(path) {
|
||||
if IsRemotePath(path) {
|
||||
return o.OpenRemote(path)
|
||||
}
|
||||
return o.OpenLocal(path)
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
/*
|
||||
Copyright (c) 2014 VMware, Inc. All Rights Reserved.
|
||||
Copyright (c) 2024-2024 VMware, Inc. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
package importx
|
||||
package importer
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
326
vendor/github.com/vmware/govmomi/ovf/importer/importer.go
generated
vendored
Normal file
326
vendor/github.com/vmware/govmomi/ovf/importer/importer.go
generated
vendored
Normal file
|
|
@ -0,0 +1,326 @@
|
|||
/*
|
||||
Copyright (c) 2024-2024 VMware, Inc. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package importer
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/vmware/govmomi/find"
|
||||
"github.com/vmware/govmomi/nfc"
|
||||
"github.com/vmware/govmomi/object"
|
||||
"github.com/vmware/govmomi/ovf"
|
||||
"github.com/vmware/govmomi/vapi/library"
|
||||
"github.com/vmware/govmomi/vim25"
|
||||
"github.com/vmware/govmomi/vim25/progress"
|
||||
"github.com/vmware/govmomi/vim25/soap"
|
||||
"github.com/vmware/govmomi/vim25/types"
|
||||
)
|
||||
|
||||
type Importer struct {
|
||||
Log progress.LogFunc
|
||||
|
||||
Name string
|
||||
VerifyManifest bool
|
||||
Hidden bool
|
||||
|
||||
Client *vim25.Client
|
||||
Finder *find.Finder
|
||||
Sinker progress.Sinker
|
||||
|
||||
Datacenter *object.Datacenter
|
||||
Datastore *object.Datastore
|
||||
ResourcePool *object.ResourcePool
|
||||
Host *object.HostSystem
|
||||
Folder *object.Folder
|
||||
|
||||
Archive Archive
|
||||
Manifest map[string]*library.Checksum
|
||||
}
|
||||
|
||||
func (imp *Importer) ReadManifest(fpath string) error {
|
||||
base := filepath.Base(fpath)
|
||||
ext := filepath.Ext(base)
|
||||
mfName := strings.Replace(base, ext, ".mf", 1)
|
||||
|
||||
mf, _, err := imp.Archive.Open(mfName)
|
||||
if err != nil {
|
||||
msg := fmt.Sprintf("manifest %q: %s", mf, err)
|
||||
fmt.Fprintln(os.Stderr, msg)
|
||||
return errors.New(msg)
|
||||
}
|
||||
imp.Manifest, err = library.ReadManifest(mf)
|
||||
_ = mf.Close()
|
||||
return err
|
||||
}
|
||||
|
||||
func (imp *Importer) Import(ctx context.Context, fpath string, opts Options) (*types.ManagedObjectReference, error) {
|
||||
|
||||
o, err := ReadOvf(fpath, imp.Archive)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
e, err := ReadEnvelope(o)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to parse ovf: %s", err)
|
||||
}
|
||||
|
||||
if e.VirtualSystem != nil {
|
||||
if e.VirtualSystem != nil {
|
||||
if opts.Name == nil {
|
||||
opts.Name = &e.VirtualSystem.ID
|
||||
if e.VirtualSystem.Name != nil {
|
||||
opts.Name = e.VirtualSystem.Name
|
||||
}
|
||||
}
|
||||
}
|
||||
if imp.Hidden {
|
||||
// TODO: userConfigurable is optional and defaults to false, so we should *add* userConfigurable=true
|
||||
// if not set for a Property. But, there'd be a bunch more work involved to preserve other data in doing
|
||||
// a complete xml.Marshal of the .ovf
|
||||
o = bytes.ReplaceAll(o, []byte(`userConfigurable="false"`), []byte(`userConfigurable="true"`))
|
||||
}
|
||||
}
|
||||
|
||||
name := "Govc Virtual Appliance"
|
||||
if opts.Name != nil {
|
||||
name = *opts.Name
|
||||
}
|
||||
|
||||
nmap, err := imp.NetworkMap(ctx, e, opts.NetworkMapping)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cisp := types.OvfCreateImportSpecParams{
|
||||
DiskProvisioning: opts.DiskProvisioning,
|
||||
EntityName: name,
|
||||
IpAllocationPolicy: opts.IPAllocationPolicy,
|
||||
IpProtocol: opts.IPProtocol,
|
||||
OvfManagerCommonParams: types.OvfManagerCommonParams{
|
||||
DeploymentOption: opts.Deployment,
|
||||
Locale: "US"},
|
||||
PropertyMapping: OVFMap(opts.PropertyMapping),
|
||||
NetworkMapping: nmap,
|
||||
}
|
||||
|
||||
m := ovf.NewManager(imp.Client)
|
||||
spec, err := m.CreateImportSpec(ctx, string(o), imp.ResourcePool, imp.Datastore, cisp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if spec.Error != nil {
|
||||
return nil, errors.New(spec.Error[0].LocalizedMessage)
|
||||
}
|
||||
if spec.Warning != nil {
|
||||
for _, w := range spec.Warning {
|
||||
_, _ = imp.Log(fmt.Sprintf("Warning: %s\n", w.LocalizedMessage))
|
||||
}
|
||||
}
|
||||
|
||||
if opts.Annotation != "" {
|
||||
switch s := spec.ImportSpec.(type) {
|
||||
case *types.VirtualMachineImportSpec:
|
||||
s.ConfigSpec.Annotation = opts.Annotation
|
||||
case *types.VirtualAppImportSpec:
|
||||
s.VAppConfigSpec.Annotation = opts.Annotation
|
||||
}
|
||||
}
|
||||
|
||||
if imp.VerifyManifest {
|
||||
if err := imp.ReadManifest(fpath); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
lease, err := imp.ResourcePool.ImportVApp(ctx, spec.ImportSpec, imp.Folder, imp.Host)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info, err := lease.Wait(ctx, spec.FileItem)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
u := lease.StartUpdater(ctx, info)
|
||||
defer u.Done()
|
||||
|
||||
for _, i := range info.Items {
|
||||
if err := imp.Upload(ctx, lease, i); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return &info.Entity, lease.Complete(ctx)
|
||||
}
|
||||
|
||||
func (imp *Importer) NetworkMap(ctx context.Context, e *ovf.Envelope, networks []Network) ([]types.OvfNetworkMapping, error) {
|
||||
var nmap []types.OvfNetworkMapping
|
||||
for _, m := range networks {
|
||||
if m.Network == "" {
|
||||
continue // Not set, let vSphere choose the default network
|
||||
}
|
||||
if err := ValidateNetwork(e, m); err != nil && imp.Log != nil {
|
||||
_, _ = imp.Log(err.Error() + "\n")
|
||||
}
|
||||
|
||||
var ref types.ManagedObjectReference
|
||||
|
||||
net, err := imp.Finder.Network(ctx, m.Network)
|
||||
if err != nil {
|
||||
switch err.(type) {
|
||||
case *find.NotFoundError:
|
||||
if !ref.FromString(m.Network) {
|
||||
return nil, err
|
||||
} // else this is a raw MO ref
|
||||
default:
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
ref = net.Reference()
|
||||
}
|
||||
|
||||
nmap = append(nmap, types.OvfNetworkMapping{
|
||||
Name: m.Name,
|
||||
Network: ref,
|
||||
})
|
||||
}
|
||||
|
||||
return nmap, nil
|
||||
}
|
||||
|
||||
func OVFMap(op []Property) (p []types.KeyValue) {
|
||||
for _, v := range op {
|
||||
p = append(p, types.KeyValue{
|
||||
Key: v.Key,
|
||||
Value: v.Value,
|
||||
})
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func ValidateNetwork(e *ovf.Envelope, net Network) error {
|
||||
var names []string
|
||||
|
||||
if e.Network != nil {
|
||||
for _, n := range e.Network.Networks {
|
||||
if n.Name == net.Name {
|
||||
return nil
|
||||
}
|
||||
names = append(names, n.Name)
|
||||
}
|
||||
}
|
||||
|
||||
return fmt.Errorf("warning: invalid NetworkMapping.Name=%q, valid names=%s", net.Name, names)
|
||||
}
|
||||
|
||||
func ValidateChecksum(ctx context.Context, lease *nfc.Lease, sum *library.Checksum, file string, key string) error {
|
||||
// Perform the checksum match eagerly, after each file upload, instead
|
||||
// of after uploading all the files, to provide fail-fast behavior.
|
||||
// (Trade-off here is multiple GetManifest() API calls to the server.)
|
||||
manifests, err := lease.GetManifest(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, m := range manifests {
|
||||
if m.Key == key {
|
||||
// Compare server-side computed checksum of uploaded file
|
||||
// against the client's manifest entry (assuming client's
|
||||
// manifest has correct checksums - client doesn't compute
|
||||
// checksum of the file before uploading).
|
||||
|
||||
// Try matching sha1 first (newer versions have moved to sha256).
|
||||
if strings.ToUpper(sum.Algorithm) == "SHA1" {
|
||||
if sum.Checksum != m.Sha1 {
|
||||
msg := fmt.Sprintf("manifest checksum %v mismatch with uploaded checksum %v for file %v",
|
||||
sum.Checksum, m.Sha1, file)
|
||||
return errors.New(msg)
|
||||
}
|
||||
// Uploaded file checksum computed by server matches with local manifest entry.
|
||||
return nil
|
||||
}
|
||||
// If not sha1, check for other types (in a separate field).
|
||||
if !strings.EqualFold(sum.Algorithm, m.ChecksumType) {
|
||||
msg := fmt.Sprintf("manifest checksum type %v mismatch with uploaded checksum type %v for file %v",
|
||||
sum.Algorithm, m.ChecksumType, file)
|
||||
return errors.New(msg)
|
||||
}
|
||||
if !strings.EqualFold(sum.Checksum, m.Checksum) {
|
||||
msg := fmt.Sprintf("manifest checksum %v mismatch with uploaded checksum %v for file %v",
|
||||
sum.Checksum, m.Checksum, file)
|
||||
return errors.New(msg)
|
||||
}
|
||||
// Uploaded file checksum computed by server matches with local manifest entry.
|
||||
return nil
|
||||
}
|
||||
}
|
||||
msg := fmt.Sprintf("missing manifest entry on server for uploaded file %v (key %v), manifests=%#v", file, key, manifests)
|
||||
return errors.New(msg)
|
||||
}
|
||||
|
||||
func (imp *Importer) Upload(ctx context.Context, lease *nfc.Lease, item nfc.FileItem) error {
|
||||
file := item.Path
|
||||
|
||||
f, size, err := imp.Archive.Open(file)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
logger := progress.NewProgressLogger(imp.Log, fmt.Sprintf("Uploading %s... ", path.Base(file)))
|
||||
defer logger.Wait()
|
||||
|
||||
opts := soap.Upload{
|
||||
ContentLength: size,
|
||||
Progress: logger,
|
||||
}
|
||||
|
||||
err = lease.Upload(ctx, item, f, opts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if imp.VerifyManifest {
|
||||
mapImportKeyToKey := func(urls []types.HttpNfcLeaseDeviceUrl, importKey string) string {
|
||||
for _, url := range urls {
|
||||
if url.ImportKey == importKey {
|
||||
return url.Key
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
leaseInfo, err := lease.Wait(ctx, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
sum, ok := imp.Manifest[file]
|
||||
if !ok {
|
||||
return fmt.Errorf("missing checksum for %v in manifest file", file)
|
||||
}
|
||||
return ValidateChecksum(ctx, lease, sum, file, mapImportKeyToKey(leaseInfo.DeviceUrl, item.DeviceId))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
91
vendor/github.com/vmware/govmomi/ovf/importer/options.go
generated
vendored
Normal file
91
vendor/github.com/vmware/govmomi/ovf/importer/options.go
generated
vendored
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
Copyright (c) 2024-2024 VMware, Inc. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package importer
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/vmware/govmomi/ovf"
|
||||
"github.com/vmware/govmomi/vim25/types"
|
||||
)
|
||||
|
||||
type KeyValue struct {
|
||||
Key string
|
||||
Value string
|
||||
}
|
||||
|
||||
// case insensitive for Key + Value
|
||||
func (kv *KeyValue) UnmarshalJSON(b []byte) error {
|
||||
e := struct {
|
||||
types.KeyValue
|
||||
Key *string
|
||||
Value *string
|
||||
}{
|
||||
types.KeyValue{}, &kv.Key, &kv.Value,
|
||||
}
|
||||
|
||||
err := json.Unmarshal(b, &e)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if kv.Key == "" {
|
||||
kv.Key = e.KeyValue.Key // "key"
|
||||
}
|
||||
|
||||
if kv.Value == "" {
|
||||
kv.Value = e.KeyValue.Value // "value"
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type Property struct {
|
||||
KeyValue
|
||||
Spec *ovf.Property `json:",omitempty"`
|
||||
}
|
||||
|
||||
type Network struct {
|
||||
Name string
|
||||
Network string
|
||||
}
|
||||
|
||||
type Options struct {
|
||||
AllDeploymentOptions []string `json:",omitempty"`
|
||||
Deployment string `json:",omitempty"`
|
||||
|
||||
AllDiskProvisioningOptions []string `json:",omitempty"`
|
||||
DiskProvisioning string
|
||||
|
||||
AllIPAllocationPolicyOptions []string `json:",omitempty"`
|
||||
IPAllocationPolicy string
|
||||
|
||||
AllIPProtocolOptions []string `json:",omitempty"`
|
||||
IPProtocol string
|
||||
|
||||
PropertyMapping []Property `json:",omitempty"`
|
||||
|
||||
NetworkMapping []Network `json:",omitempty"`
|
||||
|
||||
Annotation string `json:",omitempty"`
|
||||
|
||||
MarkAsTemplate bool
|
||||
PowerOn bool
|
||||
InjectOvfEnv bool
|
||||
WaitForIP bool
|
||||
Name *string
|
||||
}
|
||||
138
vendor/github.com/vmware/govmomi/ovf/importer/spec.go
generated
vendored
Normal file
138
vendor/github.com/vmware/govmomi/ovf/importer/spec.go
generated
vendored
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
/*
|
||||
Copyright (c) 2024-2024 VMware, Inc. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package importer
|
||||
|
||||
import (
|
||||
"golang.org/x/text/cases"
|
||||
"golang.org/x/text/language"
|
||||
|
||||
"github.com/vmware/govmomi/ovf"
|
||||
"github.com/vmware/govmomi/vim25/types"
|
||||
)
|
||||
|
||||
var (
|
||||
allDiskProvisioningOptions = types.OvfCreateImportSpecParamsDiskProvisioningType("").Strings()
|
||||
|
||||
allIPAllocationPolicyOptions = types.VAppIPAssignmentInfoIpAllocationPolicy("").Strings()
|
||||
|
||||
allIPProtocolOptions = types.VAppIPAssignmentInfoProtocols("").Strings()
|
||||
)
|
||||
|
||||
func SpecMap(e *ovf.Envelope, hidden, verbose bool) (res []Property) {
|
||||
if e == nil || e.VirtualSystem == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
for _, p := range e.VirtualSystem.Product {
|
||||
for i, v := range p.Property {
|
||||
if v.UserConfigurable == nil {
|
||||
continue
|
||||
}
|
||||
if !*v.UserConfigurable && !hidden {
|
||||
continue
|
||||
}
|
||||
|
||||
d := ""
|
||||
if v.Default != nil {
|
||||
d = *v.Default
|
||||
}
|
||||
|
||||
// vSphere only accept True/False as boolean values for some reason
|
||||
if v.Type == "boolean" {
|
||||
d = cases.Title(language.Und).String(d)
|
||||
}
|
||||
|
||||
np := Property{KeyValue: KeyValue{Key: p.Key(v), Value: d}}
|
||||
|
||||
if verbose {
|
||||
np.Spec = &p.Property[i]
|
||||
}
|
||||
|
||||
res = append(res, np)
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func Spec(fpath string, a Archive, hidden, verbose bool) (*Options, error) {
|
||||
e := &ovf.Envelope{}
|
||||
if fpath != "" {
|
||||
d, err := ReadOvf(fpath, a)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if e, err = ReadEnvelope(d); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
var deploymentOptions []string
|
||||
if e.DeploymentOption != nil && e.DeploymentOption.Configuration != nil {
|
||||
// add default first
|
||||
for _, c := range e.DeploymentOption.Configuration {
|
||||
if c.Default != nil && *c.Default {
|
||||
deploymentOptions = append(deploymentOptions, c.ID)
|
||||
}
|
||||
}
|
||||
|
||||
for _, c := range e.DeploymentOption.Configuration {
|
||||
if c.Default == nil || !*c.Default {
|
||||
deploymentOptions = append(deploymentOptions, c.ID)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
o := Options{
|
||||
DiskProvisioning: allDiskProvisioningOptions[0],
|
||||
IPAllocationPolicy: allIPAllocationPolicyOptions[0],
|
||||
IPProtocol: allIPProtocolOptions[0],
|
||||
MarkAsTemplate: false,
|
||||
PowerOn: false,
|
||||
WaitForIP: false,
|
||||
InjectOvfEnv: false,
|
||||
PropertyMapping: SpecMap(e, hidden, verbose),
|
||||
}
|
||||
|
||||
if deploymentOptions != nil {
|
||||
o.Deployment = deploymentOptions[0]
|
||||
}
|
||||
|
||||
if e.VirtualSystem != nil && e.VirtualSystem.Annotation != nil {
|
||||
for _, a := range e.VirtualSystem.Annotation {
|
||||
o.Annotation += a.Annotation
|
||||
}
|
||||
}
|
||||
|
||||
if e.Network != nil {
|
||||
for _, net := range e.Network.Networks {
|
||||
o.NetworkMapping = append(o.NetworkMapping, Network{net.Name, ""})
|
||||
}
|
||||
}
|
||||
|
||||
if verbose {
|
||||
if deploymentOptions != nil {
|
||||
o.AllDeploymentOptions = deploymentOptions
|
||||
}
|
||||
o.AllDiskProvisioningOptions = allDiskProvisioningOptions
|
||||
o.AllIPAllocationPolicyOptions = allIPAllocationPolicyOptions
|
||||
o.AllIPProtocolOptions = allIPProtocolOptions
|
||||
}
|
||||
|
||||
return &o, nil
|
||||
}
|
||||
50
vendor/github.com/vmware/govmomi/vapi/library/finder/path.go
generated
vendored
50
vendor/github.com/vmware/govmomi/vapi/library/finder/path.go
generated
vendored
|
|
@ -21,10 +21,13 @@ import (
|
|||
"fmt"
|
||||
"net/url"
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
"github.com/vmware/govmomi/object"
|
||||
"github.com/vmware/govmomi/property"
|
||||
"github.com/vmware/govmomi/vapi/library"
|
||||
"github.com/vmware/govmomi/vim25"
|
||||
"github.com/vmware/govmomi/vim25/mo"
|
||||
"github.com/vmware/govmomi/vim25/types"
|
||||
)
|
||||
|
||||
|
|
@ -130,3 +133,50 @@ func (f *PathFinder) datastoreName(ctx context.Context, id string) (string, erro
|
|||
f.cache[id] = name
|
||||
return name, nil
|
||||
}
|
||||
|
||||
// ResolveLibraryItemStorage transforms StorageURIs Datastore url (uuid) to Datastore name.
|
||||
func (f *PathFinder) ResolveLibraryItemStorage(ctx context.Context, storage []library.Storage) error {
|
||||
// TODO:
|
||||
// - reuse PathFinder.cache
|
||||
// - the transform here isn't Content Library specific, but is currently the only known use case
|
||||
backing := map[string]*mo.Datastore{}
|
||||
var ids []types.ManagedObjectReference
|
||||
|
||||
// don't think we can have more than 1 Datastore backing currently, future proof anyhow
|
||||
for _, item := range storage {
|
||||
id := item.StorageBacking.DatastoreID
|
||||
if _, ok := backing[id]; ok {
|
||||
continue
|
||||
}
|
||||
backing[id] = nil
|
||||
ids = append(ids, types.ManagedObjectReference{Type: "Datastore", Value: id})
|
||||
}
|
||||
|
||||
var ds []mo.Datastore
|
||||
pc := property.DefaultCollector(f.c)
|
||||
if err := pc.Retrieve(ctx, ids, []string{"name", "info.url"}, &ds); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for i := range ds {
|
||||
backing[ds[i].Self.Value] = &ds[i]
|
||||
}
|
||||
|
||||
for _, item := range storage {
|
||||
b := backing[item.StorageBacking.DatastoreID]
|
||||
dsurl := b.Info.GetDatastoreInfo().Url
|
||||
|
||||
for i := range item.StorageURIs {
|
||||
u := strings.TrimPrefix(item.StorageURIs[i], dsurl)
|
||||
u = strings.TrimPrefix(u, "/")
|
||||
u = strings.SplitN(u, "?", 2)[0] // strip query, if any
|
||||
|
||||
item.StorageURIs[i] = (&object.DatastorePath{
|
||||
Datastore: b.Name,
|
||||
Path: u,
|
||||
}).String()
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
26
vendor/github.com/vmware/govmomi/vim25/mo/type_info.go
generated
vendored
26
vendor/github.com/vmware/govmomi/vim25/mo/type_info.go
generated
vendored
|
|
@ -35,9 +35,6 @@ type typeInfo struct {
|
|||
|
||||
// Map property names to field indices.
|
||||
props map[string][]int
|
||||
|
||||
// Use base type for interface indices.
|
||||
base bool
|
||||
}
|
||||
|
||||
var typeInfoLock sync.RWMutex
|
||||
|
|
@ -68,20 +65,22 @@ func typeInfoForType(tname string) *typeInfo {
|
|||
|
||||
func baseType(ftyp reflect.Type) reflect.Type {
|
||||
base := strings.TrimPrefix(ftyp.Name(), "Base")
|
||||
switch base {
|
||||
case "MethodFault":
|
||||
return nil
|
||||
}
|
||||
if kind, ok := types.TypeFunc()(base); ok {
|
||||
return kind
|
||||
}
|
||||
return ftyp
|
||||
return nil
|
||||
}
|
||||
|
||||
func newTypeInfo(typ reflect.Type, base ...bool) *typeInfo {
|
||||
func newTypeInfo(typ reflect.Type) *typeInfo {
|
||||
t := typeInfo{
|
||||
typ: typ,
|
||||
props: make(map[string][]int),
|
||||
}
|
||||
if len(base) == 1 {
|
||||
t.base = base[0]
|
||||
}
|
||||
|
||||
t.build(typ, "", []int{})
|
||||
|
||||
return &t
|
||||
|
|
@ -170,13 +169,16 @@ func (t *typeInfo) build(typ reflect.Type, fn string, fi []int) {
|
|||
t.build(ftyp, fnc, fic)
|
||||
}
|
||||
|
||||
// Base type can only access base fields, for example Datastore.Info
|
||||
// is types.BaseDataStore, so we create a new(types.DatastoreInfo)
|
||||
// Indexed property path may traverse into array element fields.
|
||||
// When interface, use the base type to index fields.
|
||||
// For example, BaseVirtualDevice:
|
||||
// config.hardware.device[4000].deviceInfo.label
|
||||
if t.base && ftyp.Kind() == reflect.Interface {
|
||||
base := baseType(ftyp)
|
||||
t.build(base, fnc, fic)
|
||||
if ftyp.Kind() == reflect.Interface {
|
||||
if base := baseType(ftyp); base != nil {
|
||||
t.build(base, fnc, fic)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -283,7 +285,7 @@ func assignValue(val reflect.Value, fi []int, pv reflect.Value, field ...string)
|
|||
item = reflect.New(rt.Elem())
|
||||
}
|
||||
|
||||
field := newTypeInfo(item.Type(), true)
|
||||
field := newTypeInfo(item.Type())
|
||||
if ix, ok := field.props[path]; ok {
|
||||
assignValue(item, ix, pv)
|
||||
}
|
||||
|
|
|
|||
125
vendor/github.com/vmware/govmomi/vim25/progress/loger.go
generated
vendored
Normal file
125
vendor/github.com/vmware/govmomi/vim25/progress/loger.go
generated
vendored
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
/*
|
||||
Copyright (c) 2024-2024 VMware, Inc. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package progress
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
type LogFunc func(msg string) (int, error)
|
||||
|
||||
type ProgressLogger struct {
|
||||
log LogFunc
|
||||
prefix string
|
||||
|
||||
wg sync.WaitGroup
|
||||
|
||||
sink chan chan Report
|
||||
done chan struct{}
|
||||
}
|
||||
|
||||
func NewProgressLogger(log LogFunc, prefix string) *ProgressLogger {
|
||||
p := &ProgressLogger{
|
||||
log: log,
|
||||
prefix: prefix,
|
||||
|
||||
sink: make(chan chan Report),
|
||||
done: make(chan struct{}),
|
||||
}
|
||||
|
||||
p.wg.Add(1)
|
||||
|
||||
go p.loopA()
|
||||
|
||||
return p
|
||||
}
|
||||
|
||||
// loopA runs before Sink() has been called.
|
||||
func (p *ProgressLogger) loopA() {
|
||||
var err error
|
||||
|
||||
defer p.wg.Done()
|
||||
|
||||
tick := time.NewTicker(100 * time.Millisecond)
|
||||
defer tick.Stop()
|
||||
|
||||
called := false
|
||||
|
||||
for stop := false; !stop; {
|
||||
select {
|
||||
case ch := <-p.sink:
|
||||
err = p.loopB(tick, ch)
|
||||
stop = true
|
||||
called = true
|
||||
case <-p.done:
|
||||
stop = true
|
||||
case <-tick.C:
|
||||
line := fmt.Sprintf("\r%s", p.prefix)
|
||||
p.log(line)
|
||||
}
|
||||
}
|
||||
|
||||
if err != nil && err != io.EOF {
|
||||
p.log(fmt.Sprintf("\r%sError: %s\n", p.prefix, err))
|
||||
} else if called {
|
||||
p.log(fmt.Sprintf("\r%sOK\n", p.prefix))
|
||||
}
|
||||
}
|
||||
|
||||
// loopA runs after Sink() has been called.
|
||||
func (p *ProgressLogger) loopB(tick *time.Ticker, ch <-chan Report) error {
|
||||
var r Report
|
||||
var ok bool
|
||||
var err error
|
||||
|
||||
for ok = true; ok; {
|
||||
select {
|
||||
case r, ok = <-ch:
|
||||
if !ok {
|
||||
break
|
||||
}
|
||||
err = r.Error()
|
||||
case <-tick.C:
|
||||
line := fmt.Sprintf("\r%s", p.prefix)
|
||||
if r != nil {
|
||||
line += fmt.Sprintf("(%.0f%%", r.Percentage())
|
||||
detail := r.Detail()
|
||||
if detail != "" {
|
||||
line += fmt.Sprintf(", %s", detail)
|
||||
}
|
||||
line += ")"
|
||||
}
|
||||
p.log(line)
|
||||
}
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (p *ProgressLogger) Sink() chan<- Report {
|
||||
ch := make(chan Report)
|
||||
p.sink <- ch
|
||||
return ch
|
||||
}
|
||||
|
||||
func (p *ProgressLogger) Wait() {
|
||||
close(p.done)
|
||||
p.wg.Wait()
|
||||
}
|
||||
4
vendor/github.com/vmware/govmomi/vim25/types/types.go
generated
vendored
4
vendor/github.com/vmware/govmomi/vim25/types/types.go
generated
vendored
|
|
@ -91361,7 +91361,7 @@ type VirtualMachineVirtualNuma struct {
|
|||
// vNUMA node.
|
||||
// If set to be non zero, VM uses the value as vNUMA node size.
|
||||
// If unset, the VM continue to follow the behavior in last poweron.
|
||||
CoresPerNumaNode int32 `xml:"coresPerNumaNode,omitempty" json:"coresPerNumaNode,omitempty"`
|
||||
CoresPerNumaNode *int32 `xml:"coresPerNumaNode" json:"coresPerNumaNode,omitempty"`
|
||||
// Capability to expose virtual NUMA when CPU hotadd is enabled.
|
||||
//
|
||||
// If set to true, ESXi will consider exposing virtual NUMA to
|
||||
|
|
@ -91389,7 +91389,7 @@ type VirtualMachineVirtualNumaInfo struct {
|
|||
// field should be ignored.
|
||||
// In other cases, this field represents the virtual NUMA node size
|
||||
// seen by the guest.
|
||||
CoresPerNumaNode int32 `xml:"coresPerNumaNode,omitempty" json:"coresPerNumaNode,omitempty"`
|
||||
CoresPerNumaNode *int32 `xml:"coresPerNumaNode" json:"coresPerNumaNode,omitempty"`
|
||||
// Whether coresPerNode is determined automatically.
|
||||
AutoCoresPerNumaNode *bool `xml:"autoCoresPerNumaNode" json:"autoCoresPerNumaNode,omitempty"`
|
||||
// Whether virtual NUMA topology is exposed when CPU hotadd is
|
||||
|
|
|
|||
164
vendor/github.com/vmware/govmomi/vmdk/disk_info.go
generated
vendored
Normal file
164
vendor/github.com/vmware/govmomi/vmdk/disk_info.go
generated
vendored
Normal file
|
|
@ -0,0 +1,164 @@
|
|||
/*
|
||||
Copyright (c) 2024-2024 VMware, Inc. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package vmdk
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/vmware/govmomi/object"
|
||||
"github.com/vmware/govmomi/vim25"
|
||||
"github.com/vmware/govmomi/vim25/mo"
|
||||
"github.com/vmware/govmomi/vim25/types"
|
||||
)
|
||||
|
||||
type VirtualDiskInfo struct {
|
||||
CapacityInBytes int64
|
||||
DeviceKey int32
|
||||
FileName string
|
||||
Size int64
|
||||
UniqueSize int64
|
||||
}
|
||||
|
||||
// GetVirtualDiskInfoByUUID returns information about a virtual disk identified
|
||||
// by the provided UUID. This method is valid for the following backing types:
|
||||
//
|
||||
// - VirtualDiskFlatVer2BackingInfo
|
||||
// - VirtualDiskSeSparseBackingInfo
|
||||
// - VirtualDiskRawDiskMappingVer1BackingInfo
|
||||
// - VirtualDiskSparseVer2BackingInfo
|
||||
// - VirtualDiskRawDiskVer2BackingInfo
|
||||
//
|
||||
// These are the only backing types that have a UUID property for comparing the
|
||||
// provided value.
|
||||
func GetVirtualDiskInfoByUUID(
|
||||
ctx context.Context,
|
||||
client *vim25.Client,
|
||||
mo mo.VirtualMachine,
|
||||
fetchProperties bool,
|
||||
diskUUID string) (VirtualDiskInfo, error) {
|
||||
|
||||
if diskUUID == "" {
|
||||
return VirtualDiskInfo{}, fmt.Errorf("diskUUID is empty")
|
||||
}
|
||||
|
||||
switch {
|
||||
case fetchProperties,
|
||||
mo.Config == nil,
|
||||
mo.Config.Hardware.Device == nil,
|
||||
mo.LayoutEx == nil,
|
||||
mo.LayoutEx.Disk == nil,
|
||||
mo.LayoutEx.File == nil:
|
||||
|
||||
if ctx == nil {
|
||||
return VirtualDiskInfo{}, fmt.Errorf("ctx is nil")
|
||||
}
|
||||
if client == nil {
|
||||
return VirtualDiskInfo{}, fmt.Errorf("client is nil")
|
||||
}
|
||||
|
||||
obj := object.NewVirtualMachine(client, mo.Self)
|
||||
|
||||
if err := obj.Properties(
|
||||
ctx,
|
||||
mo.Self,
|
||||
[]string{"config", "layoutEx"},
|
||||
&mo); err != nil {
|
||||
|
||||
return VirtualDiskInfo{},
|
||||
fmt.Errorf("failed to retrieve properties: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
// Find the disk by UUID by inspecting all of the disk backing types that
|
||||
// can have an associated UUID.
|
||||
var (
|
||||
disk *types.VirtualDisk
|
||||
fileName string
|
||||
)
|
||||
for i := range mo.Config.Hardware.Device {
|
||||
switch tvd := mo.Config.Hardware.Device[i].(type) {
|
||||
case *types.VirtualDisk:
|
||||
switch tb := tvd.Backing.(type) {
|
||||
case *types.VirtualDiskFlatVer2BackingInfo:
|
||||
if tb.Uuid == diskUUID {
|
||||
disk = tvd
|
||||
fileName = tb.FileName
|
||||
}
|
||||
case *types.VirtualDiskSeSparseBackingInfo:
|
||||
if tb.Uuid == diskUUID {
|
||||
disk = tvd
|
||||
fileName = tb.FileName
|
||||
}
|
||||
case *types.VirtualDiskRawDiskMappingVer1BackingInfo:
|
||||
if tb.Uuid == diskUUID {
|
||||
disk = tvd
|
||||
fileName = tb.FileName
|
||||
}
|
||||
case *types.VirtualDiskSparseVer2BackingInfo:
|
||||
if tb.Uuid == diskUUID {
|
||||
disk = tvd
|
||||
fileName = tb.FileName
|
||||
}
|
||||
case *types.VirtualDiskRawDiskVer2BackingInfo:
|
||||
if tb.Uuid == diskUUID {
|
||||
disk = tvd
|
||||
fileName = tb.DescriptorFileName
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if disk == nil {
|
||||
return VirtualDiskInfo{},
|
||||
fmt.Errorf("disk not found with uuid %q", diskUUID)
|
||||
}
|
||||
|
||||
// Build a lookup table for determining if file key belongs to this disk
|
||||
// chain.
|
||||
diskFileKeys := map[int32]struct{}{}
|
||||
for i := range mo.LayoutEx.Disk {
|
||||
if d := mo.LayoutEx.Disk[i]; d.Key == disk.Key {
|
||||
for j := range d.Chain {
|
||||
for k := range d.Chain[j].FileKey {
|
||||
diskFileKeys[d.Chain[j].FileKey[k]] = struct{}{}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Sum the disk's total size and unique size.
|
||||
var (
|
||||
size int64
|
||||
uniqueSize int64
|
||||
)
|
||||
for i := range mo.LayoutEx.File {
|
||||
f := mo.LayoutEx.File[i]
|
||||
if _, ok := diskFileKeys[f.Key]; ok {
|
||||
size += f.Size
|
||||
uniqueSize += f.UniqueSize
|
||||
}
|
||||
}
|
||||
|
||||
return VirtualDiskInfo{
|
||||
CapacityInBytes: disk.CapacityInBytes,
|
||||
DeviceKey: disk.Key,
|
||||
FileName: fileName,
|
||||
Size: size,
|
||||
UniqueSize: uniqueSize,
|
||||
}, nil
|
||||
}
|
||||
20
vendor/github.com/vmware/govmomi/vmdk/import.go
generated
vendored
20
vendor/github.com/vmware/govmomi/vmdk/import.go
generated
vendored
|
|
@ -10,7 +10,7 @@ You may obtain a copy of the License at
|
|||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
nSee the License for the specific language governing permissions and
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
|
|
@ -41,8 +41,8 @@ var (
|
|||
ErrInvalidFormat = errors.New("vmdk: invalid format (must be streamOptimized)")
|
||||
)
|
||||
|
||||
// info is used to inspect a vmdk and generate an ovf template
|
||||
type info struct {
|
||||
// Info is used to inspect a vmdk and generate an ovf template
|
||||
type Info struct {
|
||||
Header struct {
|
||||
MagicNumber uint32
|
||||
Version uint32
|
||||
|
|
@ -56,15 +56,15 @@ type info struct {
|
|||
ImportName string
|
||||
}
|
||||
|
||||
// stat looks at the vmdk header to make sure the format is streamOptimized and
|
||||
// Stat looks at the vmdk header to make sure the format is streamOptimized and
|
||||
// extracts the disk capacity required to properly generate the ovf descriptor.
|
||||
func stat(name string) (*info, error) {
|
||||
func Stat(name string) (*Info, error) {
|
||||
f, err := os.Open(filepath.Clean(name))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var di info
|
||||
var di Info
|
||||
|
||||
var buf bytes.Buffer
|
||||
|
||||
|
|
@ -174,8 +174,8 @@ var ovfenv = `<?xml version="1.0" encoding="UTF-8"?>
|
|||
</VirtualSystem>
|
||||
</Envelope>`
|
||||
|
||||
// ovf returns an expanded descriptor template
|
||||
func (di *info) ovf() (string, error) {
|
||||
// OVF returns an expanded descriptor template
|
||||
func (di *Info) OVF() (string, error) {
|
||||
var buf bytes.Buffer
|
||||
|
||||
tmpl, err := template.New("ovf").Parse(ovfenv)
|
||||
|
|
@ -209,7 +209,7 @@ func Import(ctx context.Context, c *vim25.Client, name string, datastore *object
|
|||
m := ovf.NewManager(c)
|
||||
fm := datastore.NewFileManager(p.Datacenter, p.Force)
|
||||
|
||||
disk, err := stat(name)
|
||||
disk, err := Stat(name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -245,7 +245,7 @@ func Import(ctx context.Context, c *vim25.Client, name string, datastore *object
|
|||
}
|
||||
|
||||
// Expand the ovf template
|
||||
descriptor, err := disk.ovf()
|
||||
descriptor, err := disk.OVF()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue