From ebf6f91df0397e14d8ff9669fade13be587f99d4 Mon Sep 17 00:00:00 2001 From: Tamer Sherif <69483382+tasherif-msft@users.noreply.github.com> Date: Wed, 3 May 2023 10:30:13 -0700 Subject: [PATCH] [AzDatalake] Generated Layer + mod file (#20725) * first generation * removed pagination * cleanup spacing and add build file * doc fix --- sdk/storage/azdatalake/go.mod | 11 + sdk/storage/azdatalake/go.sum | 12 + .../azdatalake/internal/generated/autorest.md | 81 + .../azdatalake/internal/generated/build.go | 10 + .../internal/generated/zz_constants.go | 158 ++ .../generated/zz_filesystem_client.go | 496 ++++++ .../internal/generated/zz_models.go | 679 ++++++++ .../internal/generated/zz_models_serde.go | 415 +++++ .../internal/generated/zz_path_client.go | 1530 +++++++++++++++++ .../internal/generated/zz_response_types.go | 557 ++++++ .../internal/generated/zz_service_client.go | 100 ++ .../internal/generated/zz_time_rfc1123.go | 43 + 12 files changed, 4092 insertions(+) create mode 100644 sdk/storage/azdatalake/go.mod create mode 100644 sdk/storage/azdatalake/go.sum create mode 100644 sdk/storage/azdatalake/internal/generated/autorest.md create mode 100644 sdk/storage/azdatalake/internal/generated/build.go create mode 100644 sdk/storage/azdatalake/internal/generated/zz_constants.go create mode 100644 sdk/storage/azdatalake/internal/generated/zz_filesystem_client.go create mode 100644 sdk/storage/azdatalake/internal/generated/zz_models.go create mode 100644 sdk/storage/azdatalake/internal/generated/zz_models_serde.go create mode 100644 sdk/storage/azdatalake/internal/generated/zz_path_client.go create mode 100644 sdk/storage/azdatalake/internal/generated/zz_response_types.go create mode 100644 sdk/storage/azdatalake/internal/generated/zz_service_client.go create mode 100644 sdk/storage/azdatalake/internal/generated/zz_time_rfc1123.go diff --git a/sdk/storage/azdatalake/go.mod b/sdk/storage/azdatalake/go.mod new file mode 100644 index 000000000000..dfd718eb5e06 --- /dev/null +++ b/sdk/storage/azdatalake/go.mod @@ -0,0 +1,11 @@ +module github.com/Azure/azure-sdk-for-go/sdk/storage/azdatalake + +go 1.19 + +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.5.0 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect + golang.org/x/net v0.8.0 // indirect + golang.org/x/text v0.8.0 // indirect +) diff --git a/sdk/storage/azdatalake/go.sum b/sdk/storage/azdatalake/go.sum new file mode 100644 index 000000000000..5b3d1f6c33e0 --- /dev/null +++ b/sdk/storage/azdatalake/go.sum @@ -0,0 +1,12 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.5.0 h1:xGLAFFd9D3iLGxYiUGPdITSzsFmU1K8VtfuUHWAoN7M= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.5.0/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= diff --git a/sdk/storage/azdatalake/internal/generated/autorest.md b/sdk/storage/azdatalake/internal/generated/autorest.md new file mode 100644 index 000000000000..9a83369f048b --- /dev/null +++ b/sdk/storage/azdatalake/internal/generated/autorest.md @@ -0,0 +1,81 @@ +# Code Generation - Azure Datalake SDK for Golang + +### Settings + +```yaml +go: true +clear-output-folder: false +version: "^3.0.0" +license-header: MICROSOFT_MIT_NO_VERSION +input-file: "https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/data-plane/Microsoft.StorageDataLake/preview/2020-10-02/DataLakeStorage.json" +credential-scope: "https://storage.azure.com/.default" +output-folder: ../generated +file-prefix: "zz_" +openapi-type: "data-plane" +verbose: true +security: AzureKey +modelerfour: + group-parameters: false + seal-single-value-enum-by-default: true + lenient-model-deduplication: true +export-clients: true +use: "@autorest/go@4.0.0-preview.45" +``` + +### Remove Filesystem and PathName from parameter list since they are not needed +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"] + transform: > + for (const property in $) + { + if (property.includes('/{filesystem}/{path}')) + { + $[property]["parameters"] = $[property]["parameters"].filter(function(param) { return (typeof param['$ref'] === "undefined") || (false == param['$ref'].endsWith("#/parameters/FileSystem") && false == param['$ref'].endsWith("#/parameters/Path"))}); + } + else if (property.includes('/{filesystem}')) + { + $[property]["parameters"] = $[property]["parameters"].filter(function(param) { return (typeof param['$ref'] === "undefined") || (false == param['$ref'].endsWith("#/parameters/FileSystem"))}); + } + } +``` + +### Remove pager methods and export various generated methods in filesystem client + +``` yaml +directive: + - from: zz_filesystem_client.go + where: $ + transform: >- + return $. + replace(/func \(client \*FileSystemClient\) NewListBlobHierarchySegmentPager\(.+\/\/ listBlobHierarchySegmentCreateRequest creates the ListBlobHierarchySegment request/s, `//\n// ListBlobHierarchySegmentCreateRequest creates the ListBlobHierarchySegment request`). + replace(/\(client \*FileSystemClient\) listBlobHierarchySegmentCreateRequest\(/, `(client *FileSystemClient) ListBlobHierarchySegmentCreateRequest(`). + replace(/\(client \*FileSystemClient\) listBlobHierarchySegmentHandleResponse\(/, `(client *FileSystemClient) ListBlobHierarchySegmentHandleResponse(`); +``` + +### Remove pager methods and export various generated methods in filesystem client + +``` yaml +directive: + - from: zz_filesystem_client.go + where: $ + transform: >- + return $. + replace(/func \(client \*FileSystemClient\) NewListPathsPager\(.+\/\/ listPathsCreateRequest creates the ListPaths request/s, `//\n// ListPathsCreateRequest creates the ListPaths request`). + replace(/\(client \*FileSystemClient\) listPathsCreateRequest\(/, `(client *FileSystemClient) ListPathsCreateRequest(`). + replace(/\(client \*FileSystemClient\) listPathsHandleResponse\(/, `(client *FileSystemClient) ListPathsHandleResponse(`); +``` + +### Remove pager methods and export various generated methods in service client + +``` yaml +directive: + - from: zz_service_client.go + where: $ + transform: >- + return $. + replace(/func \(client \*ServiceClient\) NewListFileSystemsPager\(.+\/\/ listFileSystemsCreateRequest creates the ListFileSystems request/s, `//\n// ListFileSystemsCreateRequest creates the ListFileSystems request`). + replace(/\(client \*ServiceClient\) listFileSystemsCreateRequest\(/, `(client *FileSystemClient) ListFileSystemsCreateRequest(`). + replace(/\(client \*ServiceClient\) listFileSystemsHandleResponse\(/, `(client *FileSystemClient) ListFileSystemsHandleResponse(`); +``` \ No newline at end of file diff --git a/sdk/storage/azdatalake/internal/generated/build.go b/sdk/storage/azdatalake/internal/generated/build.go new file mode 100644 index 000000000000..57f112001bd2 --- /dev/null +++ b/sdk/storage/azdatalake/internal/generated/build.go @@ -0,0 +1,10 @@ +//go:build go1.18 +// +build go1.18 + +//go:generate autorest ./autorest.md +//go:generate gofmt -w . + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +package generated diff --git a/sdk/storage/azdatalake/internal/generated/zz_constants.go b/sdk/storage/azdatalake/internal/generated/zz_constants.go new file mode 100644 index 000000000000..ce7c1ce6f3b9 --- /dev/null +++ b/sdk/storage/azdatalake/internal/generated/zz_constants.go @@ -0,0 +1,158 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package generated + +type ListBlobsIncludeItem string + +const ( + ListBlobsIncludeItemCopy ListBlobsIncludeItem = "copy" + ListBlobsIncludeItemDeleted ListBlobsIncludeItem = "deleted" + ListBlobsIncludeItemMetadata ListBlobsIncludeItem = "metadata" + ListBlobsIncludeItemSnapshots ListBlobsIncludeItem = "snapshots" + ListBlobsIncludeItemUncommittedblobs ListBlobsIncludeItem = "uncommittedblobs" + ListBlobsIncludeItemVersions ListBlobsIncludeItem = "versions" + ListBlobsIncludeItemTags ListBlobsIncludeItem = "tags" +) + +// PossibleListBlobsIncludeItemValues returns the possible values for the ListBlobsIncludeItem const type. +func PossibleListBlobsIncludeItemValues() []ListBlobsIncludeItem { + return []ListBlobsIncludeItem{ + ListBlobsIncludeItemCopy, + ListBlobsIncludeItemDeleted, + ListBlobsIncludeItemMetadata, + ListBlobsIncludeItemSnapshots, + ListBlobsIncludeItemUncommittedblobs, + ListBlobsIncludeItemVersions, + ListBlobsIncludeItemTags, + } +} + +type PathExpiryOptions string + +const ( + PathExpiryOptionsAbsolute PathExpiryOptions = "Absolute" + PathExpiryOptionsNeverExpire PathExpiryOptions = "NeverExpire" + PathExpiryOptionsRelativeToCreation PathExpiryOptions = "RelativeToCreation" + PathExpiryOptionsRelativeToNow PathExpiryOptions = "RelativeToNow" +) + +// PossiblePathExpiryOptionsValues returns the possible values for the PathExpiryOptions const type. +func PossiblePathExpiryOptionsValues() []PathExpiryOptions { + return []PathExpiryOptions{ + PathExpiryOptionsAbsolute, + PathExpiryOptionsNeverExpire, + PathExpiryOptionsRelativeToCreation, + PathExpiryOptionsRelativeToNow, + } +} + +type PathGetPropertiesAction string + +const ( + PathGetPropertiesActionGetAccessControl PathGetPropertiesAction = "getAccessControl" + PathGetPropertiesActionGetStatus PathGetPropertiesAction = "getStatus" +) + +// PossiblePathGetPropertiesActionValues returns the possible values for the PathGetPropertiesAction const type. +func PossiblePathGetPropertiesActionValues() []PathGetPropertiesAction { + return []PathGetPropertiesAction{ + PathGetPropertiesActionGetAccessControl, + PathGetPropertiesActionGetStatus, + } +} + +type PathLeaseAction string + +const ( + PathLeaseActionAcquire PathLeaseAction = "acquire" + PathLeaseActionBreak PathLeaseAction = "break" + PathLeaseActionChange PathLeaseAction = "change" + PathLeaseActionRenew PathLeaseAction = "renew" + PathLeaseActionRelease PathLeaseAction = "release" +) + +// PossiblePathLeaseActionValues returns the possible values for the PathLeaseAction const type. +func PossiblePathLeaseActionValues() []PathLeaseAction { + return []PathLeaseAction{ + PathLeaseActionAcquire, + PathLeaseActionBreak, + PathLeaseActionChange, + PathLeaseActionRenew, + PathLeaseActionRelease, + } +} + +type PathRenameMode string + +const ( + PathRenameModeLegacy PathRenameMode = "legacy" + PathRenameModePosix PathRenameMode = "posix" +) + +// PossiblePathRenameModeValues returns the possible values for the PathRenameMode const type. +func PossiblePathRenameModeValues() []PathRenameMode { + return []PathRenameMode{ + PathRenameModeLegacy, + PathRenameModePosix, + } +} + +type PathResourceType string + +const ( + PathResourceTypeDirectory PathResourceType = "directory" + PathResourceTypeFile PathResourceType = "file" +) + +// PossiblePathResourceTypeValues returns the possible values for the PathResourceType const type. +func PossiblePathResourceTypeValues() []PathResourceType { + return []PathResourceType{ + PathResourceTypeDirectory, + PathResourceTypeFile, + } +} + +type PathSetAccessControlRecursiveMode string + +const ( + PathSetAccessControlRecursiveModeSet PathSetAccessControlRecursiveMode = "set" + PathSetAccessControlRecursiveModeModify PathSetAccessControlRecursiveMode = "modify" + PathSetAccessControlRecursiveModeRemove PathSetAccessControlRecursiveMode = "remove" +) + +// PossiblePathSetAccessControlRecursiveModeValues returns the possible values for the PathSetAccessControlRecursiveMode const type. +func PossiblePathSetAccessControlRecursiveModeValues() []PathSetAccessControlRecursiveMode { + return []PathSetAccessControlRecursiveMode{ + PathSetAccessControlRecursiveModeSet, + PathSetAccessControlRecursiveModeModify, + PathSetAccessControlRecursiveModeRemove, + } +} + +type PathUpdateAction string + +const ( + PathUpdateActionAppend PathUpdateAction = "append" + PathUpdateActionFlush PathUpdateAction = "flush" + PathUpdateActionSetProperties PathUpdateAction = "setProperties" + PathUpdateActionSetAccessControl PathUpdateAction = "setAccessControl" + PathUpdateActionSetAccessControlRecursive PathUpdateAction = "setAccessControlRecursive" +) + +// PossiblePathUpdateActionValues returns the possible values for the PathUpdateAction const type. +func PossiblePathUpdateActionValues() []PathUpdateAction { + return []PathUpdateAction{ + PathUpdateActionAppend, + PathUpdateActionFlush, + PathUpdateActionSetProperties, + PathUpdateActionSetAccessControl, + PathUpdateActionSetAccessControlRecursive, + } +} diff --git a/sdk/storage/azdatalake/internal/generated/zz_filesystem_client.go b/sdk/storage/azdatalake/internal/generated/zz_filesystem_client.go new file mode 100644 index 000000000000..900c08f05fa0 --- /dev/null +++ b/sdk/storage/azdatalake/internal/generated/zz_filesystem_client.go @@ -0,0 +1,496 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package generated + +import ( + "context" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strconv" + "strings" + "time" +) + +// FileSystemClient contains the methods for the FileSystem group. +// Don't use this type directly, use NewFileSystemClient() instead. +type FileSystemClient struct { + endpoint string + pl runtime.Pipeline +} + +// NewFileSystemClient creates a new instance of FileSystemClient with the specified values. +// - endpoint - The URL of the service account, container, or blob that is the target of the desired operation. +// - pl - the pipeline used for sending requests and handling responses. +func NewFileSystemClient(endpoint string, pl runtime.Pipeline) *FileSystemClient { + client := &FileSystemClient{ + endpoint: endpoint, + pl: pl, + } + return client +} + +// Create - Create a FileSystem rooted at the specified location. If the FileSystem already exists, the operation fails. This +// operation does not support conditional HTTP requests. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-10-02 +// - options - FileSystemClientCreateOptions contains the optional parameters for the FileSystemClient.Create method. +func (client *FileSystemClient) Create(ctx context.Context, options *FileSystemClientCreateOptions) (FileSystemClientCreateResponse, error) { + req, err := client.createCreateRequest(ctx, options) + if err != nil { + return FileSystemClientCreateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FileSystemClientCreateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusCreated) { + return FileSystemClientCreateResponse{}, runtime.NewResponseError(resp) + } + return client.createHandleResponse(resp) +} + +// createCreateRequest creates the Create request. +func (client *FileSystemClient) createCreateRequest(ctx context.Context, options *FileSystemClientCreateOptions) (*policy.Request, error) { + req, err := runtime.NewRequest(ctx, http.MethodPut, client.endpoint) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("resource", "filesystem") + if options != nil && options.Timeout != nil { + reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.RequestID != nil { + req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} + } + req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + if options != nil && options.Properties != nil { + req.Raw().Header["x-ms-properties"] = []string{*options.Properties} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *FileSystemClient) createHandleResponse(resp *http.Response) (FileSystemClientCreateResponse, error) { + result := FileSystemClientCreateResponse{} + if val := resp.Header.Get("Date"); val != "" { + date, err := time.Parse(time.RFC1123, val) + if err != nil { + return FileSystemClientCreateResponse{}, err + } + result.Date = &date + } + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if val := resp.Header.Get("Last-Modified"); val != "" { + lastModified, err := time.Parse(time.RFC1123, val) + if err != nil { + return FileSystemClientCreateResponse{}, err + } + result.LastModified = &lastModified + } + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.ClientRequestID = &val + } + if val := resp.Header.Get("x-ms-version"); val != "" { + result.Version = &val + } + if val := resp.Header.Get("x-ms-namespace-enabled"); val != "" { + result.NamespaceEnabled = &val + } + return result, nil +} + +// Delete - Marks the FileSystem for deletion. When a FileSystem is deleted, a FileSystem with the same identifier cannot +// be created for at least 30 seconds. While the filesystem is being deleted, attempts to +// create a filesystem with the same identifier will fail with status code 409 (Conflict), with the service returning additional +// error information indicating that the filesystem is being deleted. All +// other operations, including operations on any files or directories within the filesystem, will fail with status code 404 +// (Not Found) while the filesystem is being deleted. This operation supports +// conditional HTTP requests. For more information, see Specifying Conditional Headers for Blob Service Operations +// [https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations]. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-10-02 +// - options - FileSystemClientDeleteOptions contains the optional parameters for the FileSystemClient.Delete method. +// - ModifiedAccessConditions - ModifiedAccessConditions contains a group of parameters for the FileSystemClient.SetProperties +// method. +func (client *FileSystemClient) Delete(ctx context.Context, options *FileSystemClientDeleteOptions, modifiedAccessConditions *ModifiedAccessConditions) (FileSystemClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, options, modifiedAccessConditions) + if err != nil { + return FileSystemClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FileSystemClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted) { + return FileSystemClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return client.deleteHandleResponse(resp) +} + +// deleteCreateRequest creates the Delete request. +func (client *FileSystemClient) deleteCreateRequest(ctx context.Context, options *FileSystemClientDeleteOptions, modifiedAccessConditions *ModifiedAccessConditions) (*policy.Request, error) { + req, err := runtime.NewRequest(ctx, http.MethodDelete, client.endpoint) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("resource", "filesystem") + if options != nil && options.Timeout != nil { + reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.RequestID != nil { + req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} + } + req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + if modifiedAccessConditions != nil && modifiedAccessConditions.IfModifiedSince != nil { + req.Raw().Header["If-Modified-Since"] = []string{modifiedAccessConditions.IfModifiedSince.Format(time.RFC1123)} + } + if modifiedAccessConditions != nil && modifiedAccessConditions.IfUnmodifiedSince != nil { + req.Raw().Header["If-Unmodified-Since"] = []string{modifiedAccessConditions.IfUnmodifiedSince.Format(time.RFC1123)} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// deleteHandleResponse handles the Delete response. +func (client *FileSystemClient) deleteHandleResponse(resp *http.Response) (FileSystemClientDeleteResponse, error) { + result := FileSystemClientDeleteResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.RequestID = &val + } + if val := resp.Header.Get("x-ms-version"); val != "" { + result.Version = &val + } + if val := resp.Header.Get("Date"); val != "" { + date, err := time.Parse(time.RFC1123, val) + if err != nil { + return FileSystemClientDeleteResponse{}, err + } + result.Date = &date + } + return result, nil +} + +// GetProperties - All system and user-defined filesystem properties are specified in the response headers. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-10-02 +// - options - FileSystemClientGetPropertiesOptions contains the optional parameters for the FileSystemClient.GetProperties +// method. +func (client *FileSystemClient) GetProperties(ctx context.Context, options *FileSystemClientGetPropertiesOptions) (FileSystemClientGetPropertiesResponse, error) { + req, err := client.getPropertiesCreateRequest(ctx, options) + if err != nil { + return FileSystemClientGetPropertiesResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FileSystemClientGetPropertiesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FileSystemClientGetPropertiesResponse{}, runtime.NewResponseError(resp) + } + return client.getPropertiesHandleResponse(resp) +} + +// getPropertiesCreateRequest creates the GetProperties request. +func (client *FileSystemClient) getPropertiesCreateRequest(ctx context.Context, options *FileSystemClientGetPropertiesOptions) (*policy.Request, error) { + req, err := runtime.NewRequest(ctx, http.MethodHead, client.endpoint) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("resource", "filesystem") + if options != nil && options.Timeout != nil { + reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.RequestID != nil { + req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} + } + req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getPropertiesHandleResponse handles the GetProperties response. +func (client *FileSystemClient) getPropertiesHandleResponse(resp *http.Response) (FileSystemClientGetPropertiesResponse, error) { + result := FileSystemClientGetPropertiesResponse{} + if val := resp.Header.Get("Date"); val != "" { + date, err := time.Parse(time.RFC1123, val) + if err != nil { + return FileSystemClientGetPropertiesResponse{}, err + } + result.Date = &date + } + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if val := resp.Header.Get("Last-Modified"); val != "" { + lastModified, err := time.Parse(time.RFC1123, val) + if err != nil { + return FileSystemClientGetPropertiesResponse{}, err + } + result.LastModified = &lastModified + } + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.RequestID = &val + } + if val := resp.Header.Get("x-ms-version"); val != "" { + result.Version = &val + } + if val := resp.Header.Get("x-ms-properties"); val != "" { + result.Properties = &val + } + if val := resp.Header.Get("x-ms-namespace-enabled"); val != "" { + result.NamespaceEnabled = &val + } + return result, nil +} + +// NewListBlobHierarchySegmentPager - The List Blobs operation returns a list of the blobs under the specified container +// +// Generated from API version 2020-10-02 +// - options - FileSystemClientListBlobHierarchySegmentOptions contains the optional parameters for the FileSystemClient.NewListBlobHierarchySegmentPager +// method. +// +// ListBlobHierarchySegmentCreateRequest creates the ListBlobHierarchySegment request. +func (client *FileSystemClient) ListBlobHierarchySegmentCreateRequest(ctx context.Context, options *FileSystemClientListBlobHierarchySegmentOptions) (*policy.Request, error) { + req, err := runtime.NewRequest(ctx, http.MethodGet, client.endpoint) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("restype", "container") + reqQP.Set("comp", "list") + if options != nil && options.Prefix != nil { + reqQP.Set("prefix", *options.Prefix) + } + if options != nil && options.Delimiter != nil { + reqQP.Set("delimiter", *options.Delimiter) + } + 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.Showonly != nil { + reqQP.Set("showonly", "deleted") + } + 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{"2020-10-02"} + 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 +} + +// listBlobHierarchySegmentHandleResponse handles the ListBlobHierarchySegment response. +func (client *FileSystemClient) ListBlobHierarchySegmentHandleResponse(resp *http.Response) (FileSystemClientListBlobHierarchySegmentResponse, error) { + result := FileSystemClientListBlobHierarchySegmentResponse{} + if val := resp.Header.Get("Content-Type"); val != "" { + result.ContentType = &val + } + if val := resp.Header.Get("x-ms-client-request-id"); val != "" { + result.ClientRequestID = &val + } + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.RequestID = &val + } + if val := resp.Header.Get("x-ms-version"); val != "" { + result.Version = &val + } + if val := resp.Header.Get("Date"); val != "" { + date, err := time.Parse(time.RFC1123, val) + if err != nil { + return FileSystemClientListBlobHierarchySegmentResponse{}, err + } + result.Date = &date + } + if err := runtime.UnmarshalAsXML(resp, &result.ListBlobsHierarchySegmentResponse); err != nil { + return FileSystemClientListBlobHierarchySegmentResponse{}, err + } + return result, nil +} + +// NewListPathsPager - List FileSystem paths and their properties. +// +// Generated from API version 2020-10-02 +// - recursive - Required +// - options - FileSystemClientListPathsOptions contains the optional parameters for the FileSystemClient.NewListPathsPager +// method. +// +// ListPathsCreateRequest creates the ListPaths request. +func (client *FileSystemClient) ListPathsCreateRequest(ctx context.Context, recursive bool, options *FileSystemClientListPathsOptions) (*policy.Request, error) { + req, err := runtime.NewRequest(ctx, http.MethodGet, client.endpoint) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("resource", "filesystem") + if options != nil && options.Timeout != nil { + reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10)) + } + if options != nil && options.Continuation != nil { + reqQP.Set("continuation", *options.Continuation) + } + if options != nil && options.Path != nil { + reqQP.Set("directory", *options.Path) + } + reqQP.Set("recursive", strconv.FormatBool(recursive)) + if options != nil && options.MaxResults != nil { + reqQP.Set("maxResults", strconv.FormatInt(int64(*options.MaxResults), 10)) + } + if options != nil && options.Upn != nil { + reqQP.Set("upn", strconv.FormatBool(*options.Upn)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.RequestID != nil { + req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} + } + req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listPathsHandleResponse handles the ListPaths response. +func (client *FileSystemClient) ListPathsHandleResponse(resp *http.Response) (FileSystemClientListPathsResponse, error) { + result := FileSystemClientListPathsResponse{} + if val := resp.Header.Get("Date"); val != "" { + date, err := time.Parse(time.RFC1123, val) + if err != nil { + return FileSystemClientListPathsResponse{}, err + } + result.Date = &date + } + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if val := resp.Header.Get("Last-Modified"); val != "" { + lastModified, err := time.Parse(time.RFC1123, val) + if err != nil { + return FileSystemClientListPathsResponse{}, err + } + result.LastModified = &lastModified + } + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.RequestID = &val + } + if val := resp.Header.Get("x-ms-version"); val != "" { + result.Version = &val + } + if val := resp.Header.Get("x-ms-continuation"); val != "" { + result.Continuation = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.PathList); err != nil { + return FileSystemClientListPathsResponse{}, err + } + return result, nil +} + +// SetProperties - Set properties for the FileSystem. This operation supports conditional HTTP requests. For more information, +// see Specifying Conditional Headers for Blob Service Operations +// [https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations]. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-10-02 +// - options - FileSystemClientSetPropertiesOptions contains the optional parameters for the FileSystemClient.SetProperties +// method. +// - ModifiedAccessConditions - ModifiedAccessConditions contains a group of parameters for the FileSystemClient.SetProperties +// method. +func (client *FileSystemClient) SetProperties(ctx context.Context, options *FileSystemClientSetPropertiesOptions, modifiedAccessConditions *ModifiedAccessConditions) (FileSystemClientSetPropertiesResponse, error) { + req, err := client.setPropertiesCreateRequest(ctx, options, modifiedAccessConditions) + if err != nil { + return FileSystemClientSetPropertiesResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FileSystemClientSetPropertiesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FileSystemClientSetPropertiesResponse{}, runtime.NewResponseError(resp) + } + return client.setPropertiesHandleResponse(resp) +} + +// setPropertiesCreateRequest creates the SetProperties request. +func (client *FileSystemClient) setPropertiesCreateRequest(ctx context.Context, options *FileSystemClientSetPropertiesOptions, modifiedAccessConditions *ModifiedAccessConditions) (*policy.Request, error) { + req, err := runtime.NewRequest(ctx, http.MethodPatch, client.endpoint) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("resource", "filesystem") + if options != nil && options.Timeout != nil { + reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.RequestID != nil { + req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} + } + req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + if options != nil && options.Properties != nil { + req.Raw().Header["x-ms-properties"] = []string{*options.Properties} + } + if modifiedAccessConditions != nil && modifiedAccessConditions.IfModifiedSince != nil { + req.Raw().Header["If-Modified-Since"] = []string{modifiedAccessConditions.IfModifiedSince.Format(time.RFC1123)} + } + if modifiedAccessConditions != nil && modifiedAccessConditions.IfUnmodifiedSince != nil { + req.Raw().Header["If-Unmodified-Since"] = []string{modifiedAccessConditions.IfUnmodifiedSince.Format(time.RFC1123)} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// setPropertiesHandleResponse handles the SetProperties response. +func (client *FileSystemClient) setPropertiesHandleResponse(resp *http.Response) (FileSystemClientSetPropertiesResponse, error) { + result := FileSystemClientSetPropertiesResponse{} + if val := resp.Header.Get("Date"); val != "" { + date, err := time.Parse(time.RFC1123, val) + if err != nil { + return FileSystemClientSetPropertiesResponse{}, err + } + result.Date = &date + } + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if val := resp.Header.Get("Last-Modified"); val != "" { + lastModified, err := time.Parse(time.RFC1123, val) + if err != nil { + return FileSystemClientSetPropertiesResponse{}, err + } + result.LastModified = &lastModified + } + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.RequestID = &val + } + if val := resp.Header.Get("x-ms-version"); val != "" { + result.Version = &val + } + return result, nil +} diff --git a/sdk/storage/azdatalake/internal/generated/zz_models.go b/sdk/storage/azdatalake/internal/generated/zz_models.go new file mode 100644 index 000000000000..1edd40a69a4a --- /dev/null +++ b/sdk/storage/azdatalake/internal/generated/zz_models.go @@ -0,0 +1,679 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package generated + +import "time" + +type ACLFailedEntry struct { + ErrorMessage *string `json:"errorMessage,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +type BlobHierarchyListSegment struct { + // REQUIRED + BlobItems []*BlobItemInternal `xml:"Blob"` + BlobPrefixes []*BlobPrefix `xml:"BlobPrefix"` +} + +// BlobItemInternal - An Azure Storage blob +type BlobItemInternal struct { + // REQUIRED + Deleted *bool `xml:"Deleted"` + + // REQUIRED + Name *string `xml:"Name"` + + // REQUIRED; Properties of a blob + Properties *BlobPropertiesInternal `xml:"Properties"` + + // REQUIRED + Snapshot *string `xml:"Snapshot"` + DeletionID *string `xml:"DeletionId"` + IsCurrentVersion *bool `xml:"IsCurrentVersion"` + VersionID *string `xml:"VersionId"` +} + +type BlobPrefix struct { + // REQUIRED + Name *string `xml:"Name"` +} + +// BlobPropertiesInternal - Properties of a blob +type BlobPropertiesInternal struct { + // REQUIRED + Etag *string `xml:"Etag"` + + // REQUIRED + LastModified *time.Time `xml:"Last-Modified"` + AccessTierChangeTime *time.Time `xml:"AccessTierChangeTime"` + AccessTierInferred *bool `xml:"AccessTierInferred"` + BlobSequenceNumber *int64 `xml:"x-ms-blob-sequence-number"` + CacheControl *string `xml:"Cache-Control"` + ContentDisposition *string `xml:"Content-Disposition"` + ContentEncoding *string `xml:"Content-Encoding"` + ContentLanguage *string `xml:"Content-Language"` + + // Size in bytes + ContentLength *int64 `xml:"Content-Length"` + ContentMD5 []byte `xml:"Content-MD5"` + ContentType *string `xml:"Content-Type"` + CopyCompletionTime *time.Time `xml:"CopyCompletionTime"` + CopyID *string `xml:"CopyId"` + CopyProgress *string `xml:"CopyProgress"` + CopySource *string `xml:"CopySource"` + CopyStatusDescription *string `xml:"CopyStatusDescription"` + CreationTime *time.Time `xml:"Creation-Time"` + CustomerProvidedKeySHA256 *string `xml:"CustomerProvidedKeySha256"` + DeleteTime *time.Time `xml:"DeleteTime"` + DeletedTime *time.Time `xml:"DeletedTime"` + DestinationSnapshot *string `xml:"DestinationSnapshot"` + + // The name of the encryption scope under which the blob is encrypted. + EncryptionScope *string `xml:"EncryptionScope"` + ExpiresOn *time.Time `xml:"Expiry-Time"` + IncrementalCopy *bool `xml:"IncrementalCopy"` + IsSealed *bool `xml:"Sealed"` + LastAccessedOn *time.Time `xml:"LastAccessTime"` + RemainingRetentionDays *int32 `xml:"RemainingRetentionDays"` + ServerEncrypted *bool `xml:"ServerEncrypted"` + TagCount *int32 `xml:"TagCount"` +} + +// CpkInfo contains a group of parameters for the PathClient.Create method. +type CpkInfo struct { + // The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided + // if the x-ms-encryption-key header is provided.. Specifying any value will set the value to AES256. + EncryptionAlgorithm *string + // Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption + // is performed with the root account encryption key. For more information, see + // Encryption at Rest for Azure Storage Services. + EncryptionKey *string + // The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. + EncryptionKeySHA256 *string +} + +type FileSystem struct { + ETag *string `json:"eTag,omitempty"` + LastModified *string `json:"lastModified,omitempty"` + Name *string `json:"name,omitempty"` +} + +// FileSystemClientCreateOptions contains the optional parameters for the FileSystemClient.Create method. +type FileSystemClientCreateOptions struct { + // Optional. User-defined properties to be stored with the filesystem, in the format of a comma-separated list of name and + // value pairs "n1=v1, n2=v2, …", where each value is a base64 encoded string. Note + // that the string may only contain ASCII characters in the ISO-8859-1 character set. If the filesystem exists, any properties + // not included in the list will be removed. All properties are removed if the + // header is omitted. To merge new and existing properties, first get all existing properties and the current E-Tag, then + // make a conditional request with the E-Tag and include values for all properties. + Properties *string + // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage + // analytics logging is enabled. + RequestID *string + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for Blob Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations] + Timeout *int32 +} + +// FileSystemClientDeleteOptions contains the optional parameters for the FileSystemClient.Delete method. +type FileSystemClientDeleteOptions struct { + // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage + // analytics logging is enabled. + RequestID *string + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for Blob Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations] + Timeout *int32 +} + +// FileSystemClientGetPropertiesOptions contains the optional parameters for the FileSystemClient.GetProperties method. +type FileSystemClientGetPropertiesOptions struct { + // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage + // analytics logging is enabled. + RequestID *string + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for Blob Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations] + Timeout *int32 +} + +// FileSystemClientListBlobHierarchySegmentOptions contains the optional parameters for the FileSystemClient.NewListBlobHierarchySegmentPager +// method. +type FileSystemClientListBlobHierarchySegmentOptions struct { + // When the request includes this parameter, the operation returns a BlobPrefix element in the response body that acts as + // a placeholder for all blobs whose names begin with the same substring up to the + // appearance of the delimiter character. The delimiter may be a single character or a string. + Delimiter *string + // Include this parameter to specify one or more datasets to include in the response. + Include []ListBlobsIncludeItem + // A string value that identifies the portion of the list of containers to be returned with the next listing operation. The + // operation returns the NextMarker value within the response body if the listing + // operation did not return all containers remaining to be listed with the current page. The NextMarker value can be used + // as the value for the marker parameter in a subsequent call to request the next + // page of list items. The marker value is opaque to the client. + Marker *string + // An optional value that specifies the maximum number of items to return. If omitted or greater than 5,000, the response + // will include up to 5,000 items. + MaxResults *int32 + // Filters results to filesystems within the specified prefix. + Prefix *string + // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage + // analytics logging is enabled. + RequestID *string + // Include this parameter to specify one or more datasets to include in the response.. Specifying any value will set the value + // to deleted. + Showonly *string + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for Blob Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations] + Timeout *int32 +} + +// FileSystemClientListPathsOptions contains the optional parameters for the FileSystemClient.NewListPathsPager method. +type FileSystemClientListPathsOptions struct { + // Optional. When deleting a directory, the number of paths that are deleted with each invocation is limited. If the number + // of paths to be deleted exceeds this limit, a continuation token is returned in + // this response header. When a continuation token is returned in the response, it must be specified in a subsequent invocation + // of the delete operation to continue deleting the directory. + Continuation *string + // An optional value that specifies the maximum number of items to return. If omitted or greater than 5,000, the response + // will include up to 5,000 items. + MaxResults *int32 + // Optional. Filters results to paths within the specified directory. An error occurs if the directory does not exist. + Path *string + // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage + // analytics logging is enabled. + RequestID *string + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for Blob Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations] + Timeout *int32 + // Optional. Valid only when Hierarchical Namespace is enabled for the account. If "true", the user identity values returned + // in the x-ms-owner, x-ms-group, and x-ms-acl response headers will be + // transformed from Azure Active Directory Object IDs to User Principal Names. If "false", the values will be returned as + // Azure Active Directory Object IDs. The default value is false. Note that group + // and application Object IDs are not translated because they do not have unique friendly names. + Upn *bool +} + +// FileSystemClientSetPropertiesOptions contains the optional parameters for the FileSystemClient.SetProperties method. +type FileSystemClientSetPropertiesOptions struct { + // Optional. User-defined properties to be stored with the filesystem, in the format of a comma-separated list of name and + // value pairs "n1=v1, n2=v2, …", where each value is a base64 encoded string. Note + // that the string may only contain ASCII characters in the ISO-8859-1 character set. If the filesystem exists, any properties + // not included in the list will be removed. All properties are removed if the + // header is omitted. To merge new and existing properties, first get all existing properties and the current E-Tag, then + // make a conditional request with the E-Tag and include values for all properties. + Properties *string + // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage + // analytics logging is enabled. + RequestID *string + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for Blob Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations] + Timeout *int32 +} + +type FileSystemList struct { + Filesystems []*FileSystem `json:"filesystems,omitempty"` +} + +// LeaseAccessConditions contains a group of parameters for the PathClient.Create method. +type LeaseAccessConditions struct { + // If specified, the operation only succeeds if the resource's lease is active and matches this ID. + LeaseID *string +} + +// ListBlobsHierarchySegmentResponse - An enumeration of blobs +type ListBlobsHierarchySegmentResponse struct { + // REQUIRED + ContainerName *string `xml:"ContainerName,attr"` + + // REQUIRED + Segment *BlobHierarchyListSegment `xml:"Blobs"` + + // REQUIRED + ServiceEndpoint *string `xml:"ServiceEndpoint,attr"` + Delimiter *string `xml:"Delimiter"` + Marker *string `xml:"Marker"` + MaxResults *int32 `xml:"MaxResults"` + NextMarker *string `xml:"NextMarker"` + Prefix *string `xml:"Prefix"` +} + +// ModifiedAccessConditions contains a group of parameters for the FileSystemClient.SetProperties method. +type ModifiedAccessConditions struct { + // Specify an ETag value to operate only on blobs with a matching value. + IfMatch *string + // Specify this header value to operate only on a blob if it has been modified since the specified date/time. + IfModifiedSince *time.Time + // Specify an ETag value to operate only on blobs without a matching value. + IfNoneMatch *string + // Specify this header value to operate only on a blob if it has not been modified since the specified date/time. + IfUnmodifiedSince *time.Time +} + +type Path struct { + ContentLength *int64 `json:"contentLength,omitempty"` + CreationTime *string `json:"creationTime,omitempty"` + ETag *string `json:"eTag,omitempty"` + + // The name of the encryption scope under which the blob is encrypted. + EncryptionScope *string `json:"EncryptionScope,omitempty"` + ExpiryTime *string `json:"expiryTime,omitempty"` + Group *string `json:"group,omitempty"` + IsDirectory *bool `json:"isDirectory,omitempty"` + LastModified *string `json:"lastModified,omitempty"` + Name *string `json:"name,omitempty"` + Owner *string `json:"owner,omitempty"` + Permissions *string `json:"permissions,omitempty"` +} + +// PathClientAppendDataOptions contains the optional parameters for the PathClient.AppendData method. +type PathClientAppendDataOptions struct { + // Required for "Append Data" and "Flush Data". Must be 0 for "Flush Data". Must be the length of the request content in bytes + // for "Append Data". + ContentLength *int64 + // This parameter allows the caller to upload data in parallel and control the order in which it is appended to the file. + // It is required when uploading data to be appended to the file and when flushing + // previously uploaded data to the file. The value must be the position where the data is to be appended. Uploaded data is + // not immediately flushed, or written, to the file. To flush, the previously + // uploaded data must be contiguous, the position parameter must be specified and equal to the length of the file after all + // data has been written, and there must not be a request entity body included + // with the request. + Position *int64 + // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage + // analytics logging is enabled. + RequestID *string + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for Blob Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations] + Timeout *int32 + // Specify the transactional crc64 for the body, to be validated by the service. + TransactionalContentCRC64 []byte +} + +// PathClientCreateOptions contains the optional parameters for the PathClient.Create method. +type PathClientCreateOptions struct { + // Optional. When deleting a directory, the number of paths that are deleted with each invocation is limited. If the number + // of paths to be deleted exceeds this limit, a continuation token is returned in + // this response header. When a continuation token is returned in the response, it must be specified in a subsequent invocation + // of the delete operation to continue deleting the directory. + Continuation *string + // Optional. Valid only when namespace is enabled. This parameter determines the behavior of the rename operation. The value + // must be "legacy" or "posix", and the default value will be "posix". + Mode *PathRenameMode + // Optional and only valid if Hierarchical Namespace is enabled for the account. Sets POSIX access permissions for the file + // owner, the file owning group, and others. Each class may be granted read, + // write, or execute permission. The sticky bit is also supported. Both symbolic (rwxrw-rw-) and 4-digit octal notation (e.g. + // 0766) are supported. + Permissions *string + // Optional. User-defined properties to be stored with the filesystem, in the format of a comma-separated list of name and + // value pairs "n1=v1, n2=v2, …", where each value is a base64 encoded string. Note + // that the string may only contain ASCII characters in the ISO-8859-1 character set. If the filesystem exists, any properties + // not included in the list will be removed. All properties are removed if the + // header is omitted. To merge new and existing properties, first get all existing properties and the current E-Tag, then + // make a conditional request with the E-Tag and include values for all properties. + Properties *string + // An optional file or directory to be renamed. The value must have the following format: "/{filesystem}/{path}". If "x-ms-properties" + // is specified, the properties will overwrite the existing properties; + // otherwise, the existing properties will be preserved. This value must be a URL percent-encoded string. Note that the string + // may only contain ASCII characters in the ISO-8859-1 character set. + RenameSource *string + // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage + // analytics logging is enabled. + RequestID *string + // Required only for Create File and Create Directory. The value must be "file" or "directory". + Resource *PathResourceType + // A lease ID for the source path. If specified, the source path must have an active lease and the lease ID must match. + SourceLeaseID *string + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for Blob Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations] + Timeout *int32 + // Optional and only valid if Hierarchical Namespace is enabled for the account. When creating a file or directory and the + // parent folder does not have a default ACL, the umask restricts the permissions + // of the file or directory to be created. The resulting permission is given by p bitwise and not u, where p is the permission + // and u is the umask. For example, if p is 0777 and u is 0057, then the + // resulting permission is 0720. The default permission is 0777 for a directory and 0666 for a file. The default umask is + // 0027. The umask must be specified in 4-digit octal notation (e.g. 0766). + Umask *string +} + +// PathClientDeleteOptions contains the optional parameters for the PathClient.Delete method. +type PathClientDeleteOptions struct { + // Optional. When deleting a directory, the number of paths that are deleted with each invocation is limited. If the number + // of paths to be deleted exceeds this limit, a continuation token is returned in + // this response header. When a continuation token is returned in the response, it must be specified in a subsequent invocation + // of the delete operation to continue deleting the directory. + Continuation *string + // Required + Recursive *bool + // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage + // analytics logging is enabled. + RequestID *string + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for Blob Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations] + Timeout *int32 +} + +// PathClientFlushDataOptions contains the optional parameters for the PathClient.FlushData method. +type PathClientFlushDataOptions struct { + // Azure Storage Events allow applications to receive notifications when files change. When Azure Storage Events are enabled, + // a file changed event is raised. This event has a property indicating whether + // this is the final change to distinguish the difference between an intermediate flush to a file stream and the final close + // of a file stream. The close query parameter is valid only when the action is + // "flush" and change notifications are enabled. If the value of close is "true" and the flush operation completes successfully, + // the service raises a file change notification with a property indicating + // that this is the final update (the file stream has been closed). If "false" a change notification is raised indicating + // the file has changed. The default is false. This query parameter is set to true + // by the Hadoop ABFS driver to indicate that the file stream has been closed." + Close *bool + // Required for "Append Data" and "Flush Data". Must be 0 for "Flush Data". Must be the length of the request content in bytes + // for "Append Data". + ContentLength *int64 + // This parameter allows the caller to upload data in parallel and control the order in which it is appended to the file. + // It is required when uploading data to be appended to the file and when flushing + // previously uploaded data to the file. The value must be the position where the data is to be appended. Uploaded data is + // not immediately flushed, or written, to the file. To flush, the previously + // uploaded data must be contiguous, the position parameter must be specified and equal to the length of the file after all + // data has been written, and there must not be a request entity body included + // with the request. + Position *int64 + // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage + // analytics logging is enabled. + RequestID *string + // Valid only for flush operations. If "true", uncommitted data is retained after the flush operation completes; otherwise, + // the uncommitted data is deleted after the flush operation. The default is + // false. Data at offsets less than the specified position are written to the file when flush succeeds, but this optional + // parameter allows data after the flush position to be retained for a future flush + // operation. + RetainUncommittedData *bool + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for Blob Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations] + Timeout *int32 +} + +// PathClientGetPropertiesOptions contains the optional parameters for the PathClient.GetProperties method. +type PathClientGetPropertiesOptions struct { + // Optional. If the value is "getStatus" only the system defined properties for the path are returned. If the value is "getAccessControl" + // the access control list is returned in the response headers + // (Hierarchical Namespace must be enabled for the account), otherwise the properties are returned. + Action *PathGetPropertiesAction + // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage + // analytics logging is enabled. + RequestID *string + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for Blob Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations] + Timeout *int32 + // Optional. Valid only when Hierarchical Namespace is enabled for the account. If "true", the user identity values returned + // in the x-ms-owner, x-ms-group, and x-ms-acl response headers will be + // transformed from Azure Active Directory Object IDs to User Principal Names. If "false", the values will be returned as + // Azure Active Directory Object IDs. The default value is false. Note that group + // and application Object IDs are not translated because they do not have unique friendly names. + Upn *bool +} + +// PathClientLeaseOptions contains the optional parameters for the PathClient.Lease method. +type PathClientLeaseOptions struct { + // Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) if the proposed lease ID is + // not in the correct format. See Guid Constructor (String) for a list of valid GUID + // string formats. + ProposedLeaseID *string + // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage + // analytics logging is enabled. + RequestID *string + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for Blob Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations] + Timeout *int32 + // The lease break period duration is optional to break a lease, and specifies the break period of the lease in seconds. The + // lease break duration must be between 0 and 60 seconds. + XMSLeaseBreakPeriod *int32 + // The lease duration is required to acquire a lease, and specifies the duration of the lease in seconds. The lease duration + // must be between 15 and 60 seconds or -1 for infinite lease. + XMSLeaseDuration *int32 +} + +// PathClientReadOptions contains the optional parameters for the PathClient.Read method. +type PathClientReadOptions struct { + // The HTTP Range request header specifies one or more byte ranges of the resource to be retrieved. + Range *string + // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage + // analytics logging is enabled. + RequestID *string + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for Blob Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations] + Timeout *int32 + // Optional. When this header is set to "true" and specified together with the Range header, the service returns the MD5 hash + // for the range, as long as the range is less than or equal to 4MB in size. If + // this header is specified without the Range header, the service returns status code 400 (Bad Request). If this header is + // set to true when the range exceeds 4 MB in size, the service returns status code + // 400 (Bad Request). + XMSRangeGetContentMD5 *bool +} + +// PathClientSetAccessControlOptions contains the optional parameters for the PathClient.SetAccessControl method. +type PathClientSetAccessControlOptions struct { + // Sets POSIX access control rights on files and directories. The value is a comma-separated list of access control entries. + // Each access control entry (ACE) consists of a scope, a type, a user or group + // identifier, and permissions in the format "[scope:][type]:[id]:[permissions]". + ACL *string + // Optional. The owning group of the blob or directory. + Group *string + // Optional. The owner of the blob or directory. + Owner *string + // Optional and only valid if Hierarchical Namespace is enabled for the account. Sets POSIX access permissions for the file + // owner, the file owning group, and others. Each class may be granted read, + // write, or execute permission. The sticky bit is also supported. Both symbolic (rwxrw-rw-) and 4-digit octal notation (e.g. + // 0766) are supported. + Permissions *string + // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage + // analytics logging is enabled. + RequestID *string + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for Blob Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations] + Timeout *int32 +} + +// PathClientSetAccessControlRecursiveOptions contains the optional parameters for the PathClient.SetAccessControlRecursive +// method. +type PathClientSetAccessControlRecursiveOptions struct { + // Sets POSIX access control rights on files and directories. The value is a comma-separated list of access control entries. + // Each access control entry (ACE) consists of a scope, a type, a user or group + // identifier, and permissions in the format "[scope:][type]:[id]:[permissions]". + ACL *string + // Optional. When deleting a directory, the number of paths that are deleted with each invocation is limited. If the number + // of paths to be deleted exceeds this limit, a continuation token is returned in + // this response header. When a continuation token is returned in the response, it must be specified in a subsequent invocation + // of the delete operation to continue deleting the directory. + Continuation *string + // Optional. Valid for "SetAccessControlRecursive" operation. If set to false, the operation will terminate quickly on encountering + // user errors (4XX). If true, the operation will ignore user errors and + // proceed with the operation on other sub-entities of the directory. Continuation token will only be returned when forceFlag + // is true in case of user errors. If not set the default value is false for + // this. + ForceFlag *bool + // Optional. It specifies the maximum number of files or directories on which the acl change will be applied. If omitted or + // greater than 2,000, the request will process up to 2,000 items + MaxRecords *int32 + // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage + // analytics logging is enabled. + RequestID *string + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for Blob Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations] + Timeout *int32 +} + +// PathClientSetExpiryOptions contains the optional parameters for the PathClient.SetExpiry method. +type PathClientSetExpiryOptions struct { + // The time to set the blob to expiry + ExpiresOn *string + // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage + // analytics logging is enabled. + RequestID *string + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for Blob Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations] + Timeout *int32 +} + +// PathClientUndeleteOptions contains the optional parameters for the PathClient.Undelete method. +type PathClientUndeleteOptions struct { + // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage + // analytics logging is enabled. + RequestID *string + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for Blob Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations] + Timeout *int32 + // Only for hierarchical namespace enabled accounts. Optional. The path of the soft deleted blob to undelete. + UndeleteSource *string +} + +// PathClientUpdateOptions contains the optional parameters for the PathClient.Update method. +type PathClientUpdateOptions struct { + // Sets POSIX access control rights on files and directories. The value is a comma-separated list of access control entries. + // Each access control entry (ACE) consists of a scope, a type, a user or group + // identifier, and permissions in the format "[scope:][type]:[id]:[permissions]". + ACL *string + // Azure Storage Events allow applications to receive notifications when files change. When Azure Storage Events are enabled, + // a file changed event is raised. This event has a property indicating whether + // this is the final change to distinguish the difference between an intermediate flush to a file stream and the final close + // of a file stream. The close query parameter is valid only when the action is + // "flush" and change notifications are enabled. If the value of close is "true" and the flush operation completes successfully, + // the service raises a file change notification with a property indicating + // that this is the final update (the file stream has been closed). If "false" a change notification is raised indicating + // the file has changed. The default is false. This query parameter is set to true + // by the Hadoop ABFS driver to indicate that the file stream has been closed." + Close *bool + // Required for "Append Data" and "Flush Data". Must be 0 for "Flush Data". Must be the length of the request content in bytes + // for "Append Data". + ContentLength *int64 + // Optional. The number of paths processed with each invocation is limited. If the number of paths to be processed exceeds + // this limit, a continuation token is returned in the response header + // x-ms-continuation. When a continuation token is returned in the response, it must be percent-encoded and specified in a + // subsequent invocation of setAccessControlRecursive operation. + Continuation *string + // Optional. Valid for "SetAccessControlRecursive" operation. If set to false, the operation will terminate quickly on encountering + // user errors (4XX). If true, the operation will ignore user errors and + // proceed with the operation on other sub-entities of the directory. Continuation token will only be returned when forceFlag + // is true in case of user errors. If not set the default value is false for + // this. + ForceFlag *bool + // Optional. The owning group of the blob or directory. + Group *string + // Optional. Valid for "SetAccessControlRecursive" operation. It specifies the maximum number of files or directories on which + // the acl change will be applied. If omitted or greater than 2,000, the + // request will process up to 2,000 items + MaxRecords *int32 + // Optional. The owner of the blob or directory. + Owner *string + // Optional and only valid if Hierarchical Namespace is enabled for the account. Sets POSIX access permissions for the file + // owner, the file owning group, and others. Each class may be granted read, + // write, or execute permission. The sticky bit is also supported. Both symbolic (rwxrw-rw-) and 4-digit octal notation (e.g. + // 0766) are supported. + Permissions *string + // This parameter allows the caller to upload data in parallel and control the order in which it is appended to the file. + // It is required when uploading data to be appended to the file and when flushing + // previously uploaded data to the file. The value must be the position where the data is to be appended. Uploaded data is + // not immediately flushed, or written, to the file. To flush, the previously + // uploaded data must be contiguous, the position parameter must be specified and equal to the length of the file after all + // data has been written, and there must not be a request entity body included + // with the request. + Position *int64 + // Optional. User-defined properties to be stored with the filesystem, in the format of a comma-separated list of name and + // value pairs "n1=v1, n2=v2, …", where each value is a base64 encoded string. Note + // that the string may only contain ASCII characters in the ISO-8859-1 character set. If the filesystem exists, any properties + // not included in the list will be removed. All properties are removed if the + // header is omitted. To merge new and existing properties, first get all existing properties and the current E-Tag, then + // make a conditional request with the E-Tag and include values for all properties. + Properties *string + // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage + // analytics logging is enabled. + RequestID *string + // Valid only for flush operations. If "true", uncommitted data is retained after the flush operation completes; otherwise, + // the uncommitted data is deleted after the flush operation. The default is + // false. Data at offsets less than the specified position are written to the file when flush succeeds, but this optional + // parameter allows data after the flush position to be retained for a future flush + // operation. + RetainUncommittedData *bool + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for Blob Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations] + Timeout *int32 +} + +// PathHTTPHeaders contains a group of parameters for the PathClient.Create method. +type PathHTTPHeaders struct { + // Optional. Sets the blob's cache control. If specified, this property is stored with the blob and returned with a read request. + CacheControl *string + // Optional. Sets the blob's Content-Disposition header. + ContentDisposition *string + // Optional. Sets the blob's content encoding. If specified, this property is stored with the blob and returned with a read + // request. + ContentEncoding *string + // Optional. Set the blob's content language. If specified, this property is stored with the blob and returned with a read + // request. + ContentLanguage *string + // Specify the transactional md5 for the body, to be validated by the service. + ContentMD5 []byte + // Optional. Sets the blob's content type. If specified, this property is stored with the blob and returned with a read request. + ContentType *string + // Specify the transactional md5 for the body, to be validated by the service. + TransactionalContentHash []byte +} + +type PathList struct { + Paths []*Path `json:"paths,omitempty"` +} + +// ServiceClientListFileSystemsOptions contains the optional parameters for the ServiceClient.NewListFileSystemsPager method. +type ServiceClientListFileSystemsOptions struct { + // Optional. When deleting a directory, the number of paths that are deleted with each invocation is limited. If the number + // of paths to be deleted exceeds this limit, a continuation token is returned in + // this response header. When a continuation token is returned in the response, it must be specified in a subsequent invocation + // of the delete operation to continue deleting the directory. + Continuation *string + // An optional value that specifies the maximum number of items to return. If omitted or greater than 5,000, the response + // will include up to 5,000 items. + MaxResults *int32 + // Filters results to filesystems within the specified prefix. + Prefix *string + // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage + // analytics logging is enabled. + RequestID *string + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for Blob Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations] + Timeout *int32 +} + +type SetAccessControlRecursiveResponse struct { + DirectoriesSuccessful *int32 `json:"directoriesSuccessful,omitempty"` + FailedEntries []*ACLFailedEntry `json:"failedEntries,omitempty"` + FailureCount *int32 `json:"failureCount,omitempty"` + FilesSuccessful *int32 `json:"filesSuccessful,omitempty"` +} + +// SourceModifiedAccessConditions contains a group of parameters for the PathClient.Create method. +type SourceModifiedAccessConditions struct { + // Specify an ETag value to operate only on blobs with a matching value. + SourceIfMatch *string + // Specify this header value to operate only on a blob if it has been modified since the specified date/time. + SourceIfModifiedSince *time.Time + // Specify an ETag value to operate only on blobs without a matching value. + SourceIfNoneMatch *string + // Specify this header value to operate only on a blob if it has not been modified since the specified date/time. + SourceIfUnmodifiedSince *time.Time +} + +type StorageError struct { + // The service error response object. + Error *StorageErrorError `json:"error,omitempty"` +} + +// StorageErrorError - The service error response object. +type StorageErrorError struct { + // The service error code. + Code *string `json:"Code,omitempty"` + + // The service error message. + Message *string `json:"Message,omitempty"` +} diff --git a/sdk/storage/azdatalake/internal/generated/zz_models_serde.go b/sdk/storage/azdatalake/internal/generated/zz_models_serde.go new file mode 100644 index 000000000000..0bcadcc50c20 --- /dev/null +++ b/sdk/storage/azdatalake/internal/generated/zz_models_serde.go @@ -0,0 +1,415 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package generated + +import ( + "encoding/json" + "encoding/xml" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "reflect" + "time" +) + +// MarshalJSON implements the json.Marshaller interface for type ACLFailedEntry. +func (a ACLFailedEntry) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "errorMessage", a.ErrorMessage) + populate(objectMap, "name", a.Name) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ACLFailedEntry. +func (a *ACLFailedEntry) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "errorMessage": + err = unpopulate(val, "ErrorMessage", &a.ErrorMessage) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalXML implements the xml.Marshaller interface for type BlobHierarchyListSegment. +func (b BlobHierarchyListSegment) MarshalXML(enc *xml.Encoder, start xml.StartElement) error { + type alias BlobHierarchyListSegment + aux := &struct { + *alias + BlobItems *[]*BlobItemInternal `xml:"Blob"` + BlobPrefixes *[]*BlobPrefix `xml:"BlobPrefix"` + }{ + alias: (*alias)(&b), + } + if b.BlobItems != nil { + aux.BlobItems = &b.BlobItems + } + if b.BlobPrefixes != nil { + aux.BlobPrefixes = &b.BlobPrefixes + } + return enc.EncodeElement(aux, start) +} + +// MarshalXML implements the xml.Marshaller interface for type BlobPropertiesInternal. +func (b BlobPropertiesInternal) MarshalXML(enc *xml.Encoder, start xml.StartElement) error { + type alias BlobPropertiesInternal + aux := &struct { + *alias + AccessTierChangeTime *timeRFC1123 `xml:"AccessTierChangeTime"` + ContentMD5 *string `xml:"Content-MD5"` + CopyCompletionTime *timeRFC1123 `xml:"CopyCompletionTime"` + CreationTime *timeRFC1123 `xml:"Creation-Time"` + DeleteTime *timeRFC1123 `xml:"DeleteTime"` + DeletedTime *timeRFC1123 `xml:"DeletedTime"` + ExpiresOn *timeRFC1123 `xml:"Expiry-Time"` + LastAccessedOn *timeRFC1123 `xml:"LastAccessTime"` + LastModified *timeRFC1123 `xml:"Last-Modified"` + }{ + alias: (*alias)(&b), + AccessTierChangeTime: (*timeRFC1123)(b.AccessTierChangeTime), + CopyCompletionTime: (*timeRFC1123)(b.CopyCompletionTime), + CreationTime: (*timeRFC1123)(b.CreationTime), + DeleteTime: (*timeRFC1123)(b.DeleteTime), + DeletedTime: (*timeRFC1123)(b.DeletedTime), + ExpiresOn: (*timeRFC1123)(b.ExpiresOn), + LastAccessedOn: (*timeRFC1123)(b.LastAccessedOn), + LastModified: (*timeRFC1123)(b.LastModified), + } + if b.ContentMD5 != nil { + encodedContentMD5 := runtime.EncodeByteArray(b.ContentMD5, runtime.Base64StdFormat) + aux.ContentMD5 = &encodedContentMD5 + } + return enc.EncodeElement(aux, start) +} + +// UnmarshalXML implements the xml.Unmarshaller interface for type BlobPropertiesInternal. +func (b *BlobPropertiesInternal) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error { + type alias BlobPropertiesInternal + aux := &struct { + *alias + AccessTierChangeTime *timeRFC1123 `xml:"AccessTierChangeTime"` + ContentMD5 *string `xml:"Content-MD5"` + CopyCompletionTime *timeRFC1123 `xml:"CopyCompletionTime"` + CreationTime *timeRFC1123 `xml:"Creation-Time"` + DeleteTime *timeRFC1123 `xml:"DeleteTime"` + DeletedTime *timeRFC1123 `xml:"DeletedTime"` + ExpiresOn *timeRFC1123 `xml:"Expiry-Time"` + LastAccessedOn *timeRFC1123 `xml:"LastAccessTime"` + LastModified *timeRFC1123 `xml:"Last-Modified"` + }{ + alias: (*alias)(b), + } + if err := dec.DecodeElement(aux, &start); err != nil { + return err + } + b.AccessTierChangeTime = (*time.Time)(aux.AccessTierChangeTime) + if aux.ContentMD5 != nil { + if err := runtime.DecodeByteArray(*aux.ContentMD5, &b.ContentMD5, runtime.Base64StdFormat); err != nil { + return err + } + } + b.CopyCompletionTime = (*time.Time)(aux.CopyCompletionTime) + b.CreationTime = (*time.Time)(aux.CreationTime) + b.DeleteTime = (*time.Time)(aux.DeleteTime) + b.DeletedTime = (*time.Time)(aux.DeletedTime) + b.ExpiresOn = (*time.Time)(aux.ExpiresOn) + b.LastAccessedOn = (*time.Time)(aux.LastAccessedOn) + b.LastModified = (*time.Time)(aux.LastModified) + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FileSystem. +func (f FileSystem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "eTag", f.ETag) + populate(objectMap, "lastModified", f.LastModified) + populate(objectMap, "name", f.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FileSystem. +func (f *FileSystem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "eTag": + err = unpopulate(val, "ETag", &f.ETag) + delete(rawMsg, key) + case "lastModified": + err = unpopulate(val, "LastModified", &f.LastModified) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FileSystemList. +func (f FileSystemList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "filesystems", f.Filesystems) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FileSystemList. +func (f *FileSystemList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "filesystems": + err = unpopulate(val, "Filesystems", &f.Filesystems) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Path. +func (p Path) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "contentLength", p.ContentLength) + populate(objectMap, "creationTime", p.CreationTime) + populate(objectMap, "eTag", p.ETag) + populate(objectMap, "EncryptionScope", p.EncryptionScope) + populate(objectMap, "expiryTime", p.ExpiryTime) + populate(objectMap, "group", p.Group) + populate(objectMap, "isDirectory", p.IsDirectory) + populate(objectMap, "lastModified", p.LastModified) + populate(objectMap, "name", p.Name) + populate(objectMap, "owner", p.Owner) + populate(objectMap, "permissions", p.Permissions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Path. +func (p *Path) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "contentLength": + err = unpopulate(val, "ContentLength", &p.ContentLength) + delete(rawMsg, key) + case "creationTime": + err = unpopulate(val, "CreationTime", &p.CreationTime) + delete(rawMsg, key) + case "eTag": + err = unpopulate(val, "ETag", &p.ETag) + delete(rawMsg, key) + case "EncryptionScope": + err = unpopulate(val, "EncryptionScope", &p.EncryptionScope) + delete(rawMsg, key) + case "expiryTime": + err = unpopulate(val, "ExpiryTime", &p.ExpiryTime) + delete(rawMsg, key) + case "group": + err = unpopulate(val, "Group", &p.Group) + delete(rawMsg, key) + case "isDirectory": + err = unpopulate(val, "IsDirectory", &p.IsDirectory) + delete(rawMsg, key) + case "lastModified": + err = unpopulate(val, "LastModified", &p.LastModified) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "owner": + err = unpopulate(val, "Owner", &p.Owner) + delete(rawMsg, key) + case "permissions": + err = unpopulate(val, "Permissions", &p.Permissions) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PathList. +func (p PathList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "paths", p.Paths) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PathList. +func (p *PathList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "paths": + err = unpopulate(val, "Paths", &p.Paths) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SetAccessControlRecursiveResponse. +func (s SetAccessControlRecursiveResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "directoriesSuccessful", s.DirectoriesSuccessful) + populate(objectMap, "failedEntries", s.FailedEntries) + populate(objectMap, "failureCount", s.FailureCount) + populate(objectMap, "filesSuccessful", s.FilesSuccessful) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SetAccessControlRecursiveResponse. +func (s *SetAccessControlRecursiveResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "directoriesSuccessful": + err = unpopulate(val, "DirectoriesSuccessful", &s.DirectoriesSuccessful) + delete(rawMsg, key) + case "failedEntries": + err = unpopulate(val, "FailedEntries", &s.FailedEntries) + delete(rawMsg, key) + case "failureCount": + err = unpopulate(val, "FailureCount", &s.FailureCount) + delete(rawMsg, key) + case "filesSuccessful": + err = unpopulate(val, "FilesSuccessful", &s.FilesSuccessful) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type StorageError. +func (s StorageError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", s.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageError. +func (s *StorageError) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &s.Error) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type StorageErrorError. +func (s StorageErrorError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "Code", s.Code) + populate(objectMap, "Message", s.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageErrorError. +func (s *StorageErrorError) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "Code": + err = unpopulate(val, "Code", &s.Code) + delete(rawMsg, key) + case "Message": + err = unpopulate(val, "Message", &s.Message) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v any) error { + if data == nil { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/storage/azdatalake/internal/generated/zz_path_client.go b/sdk/storage/azdatalake/internal/generated/zz_path_client.go new file mode 100644 index 000000000000..876f13e3f14d --- /dev/null +++ b/sdk/storage/azdatalake/internal/generated/zz_path_client.go @@ -0,0 +1,1530 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package generated + +import ( + "context" + "encoding/base64" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "io" + "net/http" + "strconv" + "time" +) + +// PathClient contains the methods for the Path group. +// Don't use this type directly, use NewPathClient() instead. +type PathClient struct { + endpoint string + pl runtime.Pipeline +} + +// NewPathClient creates a new instance of PathClient with the specified values. +// - endpoint - The URL of the service account, container, or blob that is the target of the desired operation. +// - pl - the pipeline used for sending requests and handling responses. +func NewPathClient(endpoint string, pl runtime.Pipeline) *PathClient { + client := &PathClient{ + endpoint: endpoint, + pl: pl, + } + return client +} + +// AppendData - Append data to the file. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-10-02 +// - body - Initial data +// - options - PathClientAppendDataOptions contains the optional parameters for the PathClient.AppendData method. +// - PathHTTPHeaders - PathHTTPHeaders contains a group of parameters for the PathClient.Create method. +// - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the PathClient.Create method. +// - CpkInfo - CpkInfo contains a group of parameters for the PathClient.Create method. +func (client *PathClient) AppendData(ctx context.Context, body io.ReadSeekCloser, options *PathClientAppendDataOptions, pathHTTPHeaders *PathHTTPHeaders, leaseAccessConditions *LeaseAccessConditions, cpkInfo *CpkInfo) (PathClientAppendDataResponse, error) { + req, err := client.appendDataCreateRequest(ctx, body, options, pathHTTPHeaders, leaseAccessConditions, cpkInfo) + if err != nil { + return PathClientAppendDataResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PathClientAppendDataResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted) { + return PathClientAppendDataResponse{}, runtime.NewResponseError(resp) + } + return client.appendDataHandleResponse(resp) +} + +// appendDataCreateRequest creates the AppendData request. +func (client *PathClient) appendDataCreateRequest(ctx context.Context, body io.ReadSeekCloser, options *PathClientAppendDataOptions, pathHTTPHeaders *PathHTTPHeaders, leaseAccessConditions *LeaseAccessConditions, cpkInfo *CpkInfo) (*policy.Request, error) { + req, err := runtime.NewRequest(ctx, http.MethodPatch, client.endpoint) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("action", "append") + if options != nil && options.Position != nil { + reqQP.Set("position", strconv.FormatInt(*options.Position, 10)) + } + if options != nil && options.Timeout != nil { + reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.ContentLength != nil { + req.Raw().Header["Content-Length"] = []string{strconv.FormatInt(*options.ContentLength, 10)} + } + if pathHTTPHeaders != nil && pathHTTPHeaders.TransactionalContentHash != nil { + req.Raw().Header["Content-MD5"] = []string{base64.StdEncoding.EncodeToString(pathHTTPHeaders.TransactionalContentHash)} + } + 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 options != nil && options.RequestID != nil { + req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} + } + req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + 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{"AES256"} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, req.SetBody(body, "application/json") +} + +// appendDataHandleResponse handles the AppendData response. +func (client *PathClient) appendDataHandleResponse(resp *http.Response) (PathClientAppendDataResponse, error) { + result := PathClientAppendDataResponse{} + if val := resp.Header.Get("Date"); val != "" { + date, err := time.Parse(time.RFC1123, val) + if err != nil { + return PathClientAppendDataResponse{}, err + } + result.Date = &date + } + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.RequestID = &val + } + if val := resp.Header.Get("x-ms-client-request-id"); val != "" { + result.ClientRequestID = &val + } + if val := resp.Header.Get("x-ms-version"); val != "" { + result.Version = &val + } + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if val := resp.Header.Get("Content-MD5"); val != "" { + contentMD5, err := base64.StdEncoding.DecodeString(val) + if err != nil { + return PathClientAppendDataResponse{}, err + } + result.ContentMD5 = contentMD5 + } + if val := resp.Header.Get("x-ms-content-crc64"); val != "" { + xMSContentCRC64, err := base64.StdEncoding.DecodeString(val) + if err != nil { + return PathClientAppendDataResponse{}, err + } + result.XMSContentCRC64 = xMSContentCRC64 + } + if val := resp.Header.Get("x-ms-request-server-encrypted"); val != "" { + isServerEncrypted, err := strconv.ParseBool(val) + if err != nil { + return PathClientAppendDataResponse{}, err + } + result.IsServerEncrypted = &isServerEncrypted + } + if val := resp.Header.Get("x-ms-encryption-key-sha256"); val != "" { + result.EncryptionKeySHA256 = &val + } + return result, nil +} + +// Create - Create or rename a file or directory. By default, the destination is overwritten and if the destination already +// exists and has a lease the lease is broken. This operation supports conditional HTTP +// requests. For more information, see Specifying Conditional Headers for Blob Service Operations +// [https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations]. +// To fail if the destination already exists, use a conditional request with +// If-None-Match: "*". +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-10-02 +// - options - PathClientCreateOptions contains the optional parameters for the PathClient.Create method. +// - PathHTTPHeaders - PathHTTPHeaders contains a group of parameters for the PathClient.Create method. +// - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the PathClient.Create method. +// - ModifiedAccessConditions - ModifiedAccessConditions contains a group of parameters for the FileSystemClient.SetProperties +// method. +// - SourceModifiedAccessConditions - SourceModifiedAccessConditions contains a group of parameters for the PathClient.Create +// method. +// - CpkInfo - CpkInfo contains a group of parameters for the PathClient.Create method. +func (client *PathClient) Create(ctx context.Context, options *PathClientCreateOptions, pathHTTPHeaders *PathHTTPHeaders, leaseAccessConditions *LeaseAccessConditions, modifiedAccessConditions *ModifiedAccessConditions, sourceModifiedAccessConditions *SourceModifiedAccessConditions, cpkInfo *CpkInfo) (PathClientCreateResponse, error) { + req, err := client.createCreateRequest(ctx, options, pathHTTPHeaders, leaseAccessConditions, modifiedAccessConditions, sourceModifiedAccessConditions, cpkInfo) + if err != nil { + return PathClientCreateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PathClientCreateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusCreated) { + return PathClientCreateResponse{}, runtime.NewResponseError(resp) + } + return client.createHandleResponse(resp) +} + +// createCreateRequest creates the Create request. +func (client *PathClient) createCreateRequest(ctx context.Context, options *PathClientCreateOptions, pathHTTPHeaders *PathHTTPHeaders, leaseAccessConditions *LeaseAccessConditions, modifiedAccessConditions *ModifiedAccessConditions, sourceModifiedAccessConditions *SourceModifiedAccessConditions, cpkInfo *CpkInfo) (*policy.Request, error) { + req, err := runtime.NewRequest(ctx, http.MethodPut, client.endpoint) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Timeout != nil { + reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10)) + } + if options != nil && options.Resource != nil { + reqQP.Set("resource", string(*options.Resource)) + } + if options != nil && options.Continuation != nil { + reqQP.Set("continuation", *options.Continuation) + } + if options != nil && options.Mode != nil { + reqQP.Set("mode", string(*options.Mode)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.RequestID != nil { + req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} + } + req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + if pathHTTPHeaders != nil && pathHTTPHeaders.CacheControl != nil { + req.Raw().Header["x-ms-cache-control"] = []string{*pathHTTPHeaders.CacheControl} + } + if pathHTTPHeaders != nil && pathHTTPHeaders.ContentEncoding != nil { + req.Raw().Header["x-ms-content-encoding"] = []string{*pathHTTPHeaders.ContentEncoding} + } + if pathHTTPHeaders != nil && pathHTTPHeaders.ContentLanguage != nil { + req.Raw().Header["x-ms-content-language"] = []string{*pathHTTPHeaders.ContentLanguage} + } + if pathHTTPHeaders != nil && pathHTTPHeaders.ContentDisposition != nil { + req.Raw().Header["x-ms-content-disposition"] = []string{*pathHTTPHeaders.ContentDisposition} + } + if pathHTTPHeaders != nil && pathHTTPHeaders.ContentType != nil { + req.Raw().Header["x-ms-content-type"] = []string{*pathHTTPHeaders.ContentType} + } + if options != nil && options.RenameSource != nil { + req.Raw().Header["x-ms-rename-source"] = []string{*options.RenameSource} + } + if leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil { + req.Raw().Header["x-ms-lease-id"] = []string{*leaseAccessConditions.LeaseID} + } + if options != nil && options.SourceLeaseID != nil { + req.Raw().Header["x-ms-source-lease-id"] = []string{*options.SourceLeaseID} + } + if options != nil && options.Properties != nil { + req.Raw().Header["x-ms-properties"] = []string{*options.Properties} + } + if options != nil && options.Permissions != nil { + req.Raw().Header["x-ms-permissions"] = []string{*options.Permissions} + } + if options != nil && options.Umask != nil { + req.Raw().Header["x-ms-umask"] = []string{*options.Umask} + } + if modifiedAccessConditions != nil && modifiedAccessConditions.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*modifiedAccessConditions.IfMatch} + } + if modifiedAccessConditions != nil && modifiedAccessConditions.IfNoneMatch != nil { + req.Raw().Header["If-None-Match"] = []string{*modifiedAccessConditions.IfNoneMatch} + } + if modifiedAccessConditions != nil && modifiedAccessConditions.IfModifiedSince != nil { + req.Raw().Header["If-Modified-Since"] = []string{modifiedAccessConditions.IfModifiedSince.Format(time.RFC1123)} + } + if modifiedAccessConditions != nil && modifiedAccessConditions.IfUnmodifiedSince != nil { + req.Raw().Header["If-Unmodified-Since"] = []string{modifiedAccessConditions.IfUnmodifiedSince.Format(time.RFC1123)} + } + if sourceModifiedAccessConditions != nil && sourceModifiedAccessConditions.SourceIfMatch != nil { + req.Raw().Header["x-ms-source-if-match"] = []string{*sourceModifiedAccessConditions.SourceIfMatch} + } + if sourceModifiedAccessConditions != nil && sourceModifiedAccessConditions.SourceIfNoneMatch != nil { + req.Raw().Header["x-ms-source-if-none-match"] = []string{*sourceModifiedAccessConditions.SourceIfNoneMatch} + } + if sourceModifiedAccessConditions != nil && sourceModifiedAccessConditions.SourceIfModifiedSince != nil { + req.Raw().Header["x-ms-source-if-modified-since"] = []string{sourceModifiedAccessConditions.SourceIfModifiedSince.Format(time.RFC1123)} + } + if sourceModifiedAccessConditions != nil && sourceModifiedAccessConditions.SourceIfUnmodifiedSince != nil { + req.Raw().Header["x-ms-source-if-unmodified-since"] = []string{sourceModifiedAccessConditions.SourceIfUnmodifiedSince.Format(time.RFC1123)} + } + 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{"AES256"} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *PathClient) createHandleResponse(resp *http.Response) (PathClientCreateResponse, error) { + result := PathClientCreateResponse{} + if val := resp.Header.Get("Date"); val != "" { + date, err := time.Parse(time.RFC1123, val) + if err != nil { + return PathClientCreateResponse{}, err + } + result.Date = &date + } + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if val := resp.Header.Get("Last-Modified"); val != "" { + lastModified, err := time.Parse(time.RFC1123, val) + if err != nil { + return PathClientCreateResponse{}, err + } + result.LastModified = &lastModified + } + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.RequestID = &val + } + if val := resp.Header.Get("x-ms-version"); val != "" { + result.Version = &val + } + if val := resp.Header.Get("x-ms-continuation"); val != "" { + result.Continuation = &val + } + if val := resp.Header.Get("Content-Length"); val != "" { + contentLength, err := strconv.ParseInt(val, 10, 64) + if err != nil { + return PathClientCreateResponse{}, err + } + result.ContentLength = &contentLength + } + if val := resp.Header.Get("x-ms-request-server-encrypted"); val != "" { + isServerEncrypted, err := strconv.ParseBool(val) + if err != nil { + return PathClientCreateResponse{}, err + } + result.IsServerEncrypted = &isServerEncrypted + } + if val := resp.Header.Get("x-ms-encryption-key-sha256"); val != "" { + result.EncryptionKeySHA256 = &val + } + return result, nil +} + +// Delete - Delete the file or directory. This operation supports conditional HTTP requests. For more information, see Specifying +// Conditional Headers for Blob Service Operations +// [https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations]. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-10-02 +// - options - PathClientDeleteOptions contains the optional parameters for the PathClient.Delete method. +// - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the PathClient.Create method. +// - ModifiedAccessConditions - ModifiedAccessConditions contains a group of parameters for the FileSystemClient.SetProperties +// method. +func (client *PathClient) Delete(ctx context.Context, options *PathClientDeleteOptions, leaseAccessConditions *LeaseAccessConditions, modifiedAccessConditions *ModifiedAccessConditions) (PathClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, options, leaseAccessConditions, modifiedAccessConditions) + if err != nil { + return PathClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PathClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PathClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return client.deleteHandleResponse(resp) +} + +// deleteCreateRequest creates the Delete request. +func (client *PathClient) deleteCreateRequest(ctx context.Context, options *PathClientDeleteOptions, leaseAccessConditions *LeaseAccessConditions, modifiedAccessConditions *ModifiedAccessConditions) (*policy.Request, error) { + req, err := runtime.NewRequest(ctx, http.MethodDelete, client.endpoint) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Timeout != nil { + reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10)) + } + if options != nil && options.Recursive != nil { + reqQP.Set("recursive", strconv.FormatBool(*options.Recursive)) + } + if options != nil && options.Continuation != nil { + reqQP.Set("continuation", *options.Continuation) + } + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.RequestID != nil { + req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} + } + req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + if leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil { + req.Raw().Header["x-ms-lease-id"] = []string{*leaseAccessConditions.LeaseID} + } + if modifiedAccessConditions != nil && modifiedAccessConditions.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*modifiedAccessConditions.IfMatch} + } + if modifiedAccessConditions != nil && modifiedAccessConditions.IfNoneMatch != nil { + req.Raw().Header["If-None-Match"] = []string{*modifiedAccessConditions.IfNoneMatch} + } + if modifiedAccessConditions != nil && modifiedAccessConditions.IfModifiedSince != nil { + req.Raw().Header["If-Modified-Since"] = []string{modifiedAccessConditions.IfModifiedSince.Format(time.RFC1123)} + } + if modifiedAccessConditions != nil && modifiedAccessConditions.IfUnmodifiedSince != nil { + req.Raw().Header["If-Unmodified-Since"] = []string{modifiedAccessConditions.IfUnmodifiedSince.Format(time.RFC1123)} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// deleteHandleResponse handles the Delete response. +func (client *PathClient) deleteHandleResponse(resp *http.Response) (PathClientDeleteResponse, error) { + result := PathClientDeleteResponse{} + if val := resp.Header.Get("Date"); val != "" { + date, err := time.Parse(time.RFC1123, val) + if err != nil { + return PathClientDeleteResponse{}, err + } + result.Date = &date + } + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.RequestID = &val + } + if val := resp.Header.Get("x-ms-version"); val != "" { + result.Version = &val + } + if val := resp.Header.Get("x-ms-continuation"); val != "" { + result.Continuation = &val + } + if val := resp.Header.Get("x-ms-deletion-id"); val != "" { + result.DeletionID = &val + } + return result, nil +} + +// FlushData - Set the owner, group, permissions, or access control list for a path. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-10-02 +// - options - PathClientFlushDataOptions contains the optional parameters for the PathClient.FlushData method. +// - PathHTTPHeaders - PathHTTPHeaders contains a group of parameters for the PathClient.Create method. +// - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the PathClient.Create method. +// - ModifiedAccessConditions - ModifiedAccessConditions contains a group of parameters for the FileSystemClient.SetProperties +// method. +// - CpkInfo - CpkInfo contains a group of parameters for the PathClient.Create method. +func (client *PathClient) FlushData(ctx context.Context, options *PathClientFlushDataOptions, pathHTTPHeaders *PathHTTPHeaders, leaseAccessConditions *LeaseAccessConditions, modifiedAccessConditions *ModifiedAccessConditions, cpkInfo *CpkInfo) (PathClientFlushDataResponse, error) { + req, err := client.flushDataCreateRequest(ctx, options, pathHTTPHeaders, leaseAccessConditions, modifiedAccessConditions, cpkInfo) + if err != nil { + return PathClientFlushDataResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PathClientFlushDataResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PathClientFlushDataResponse{}, runtime.NewResponseError(resp) + } + return client.flushDataHandleResponse(resp) +} + +// flushDataCreateRequest creates the FlushData request. +func (client *PathClient) flushDataCreateRequest(ctx context.Context, options *PathClientFlushDataOptions, pathHTTPHeaders *PathHTTPHeaders, leaseAccessConditions *LeaseAccessConditions, modifiedAccessConditions *ModifiedAccessConditions, cpkInfo *CpkInfo) (*policy.Request, error) { + req, err := runtime.NewRequest(ctx, http.MethodPatch, client.endpoint) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("action", "flush") + if options != nil && options.Timeout != nil { + reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10)) + } + if options != nil && options.Position != nil { + reqQP.Set("position", strconv.FormatInt(*options.Position, 10)) + } + if options != nil && options.RetainUncommittedData != nil { + reqQP.Set("retainUncommittedData", strconv.FormatBool(*options.RetainUncommittedData)) + } + if options != nil && options.Close != nil { + reqQP.Set("close", strconv.FormatBool(*options.Close)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.ContentLength != nil { + req.Raw().Header["Content-Length"] = []string{strconv.FormatInt(*options.ContentLength, 10)} + } + if pathHTTPHeaders != nil && pathHTTPHeaders.ContentMD5 != nil { + req.Raw().Header["x-ms-content-md5"] = []string{base64.StdEncoding.EncodeToString(pathHTTPHeaders.ContentMD5)} + } + if leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil { + req.Raw().Header["x-ms-lease-id"] = []string{*leaseAccessConditions.LeaseID} + } + if pathHTTPHeaders != nil && pathHTTPHeaders.CacheControl != nil { + req.Raw().Header["x-ms-cache-control"] = []string{*pathHTTPHeaders.CacheControl} + } + if pathHTTPHeaders != nil && pathHTTPHeaders.ContentType != nil { + req.Raw().Header["x-ms-content-type"] = []string{*pathHTTPHeaders.ContentType} + } + if pathHTTPHeaders != nil && pathHTTPHeaders.ContentDisposition != nil { + req.Raw().Header["x-ms-content-disposition"] = []string{*pathHTTPHeaders.ContentDisposition} + } + if pathHTTPHeaders != nil && pathHTTPHeaders.ContentEncoding != nil { + req.Raw().Header["x-ms-content-encoding"] = []string{*pathHTTPHeaders.ContentEncoding} + } + if pathHTTPHeaders != nil && pathHTTPHeaders.ContentLanguage != nil { + req.Raw().Header["x-ms-content-language"] = []string{*pathHTTPHeaders.ContentLanguage} + } + if modifiedAccessConditions != nil && modifiedAccessConditions.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*modifiedAccessConditions.IfMatch} + } + if modifiedAccessConditions != nil && modifiedAccessConditions.IfNoneMatch != nil { + req.Raw().Header["If-None-Match"] = []string{*modifiedAccessConditions.IfNoneMatch} + } + if modifiedAccessConditions != nil && modifiedAccessConditions.IfModifiedSince != nil { + req.Raw().Header["If-Modified-Since"] = []string{modifiedAccessConditions.IfModifiedSince.Format(time.RFC1123)} + } + if modifiedAccessConditions != nil && modifiedAccessConditions.IfUnmodifiedSince != nil { + req.Raw().Header["If-Unmodified-Since"] = []string{modifiedAccessConditions.IfUnmodifiedSince.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-version"] = []string{"2020-10-02"} + 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{"AES256"} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// flushDataHandleResponse handles the FlushData response. +func (client *PathClient) flushDataHandleResponse(resp *http.Response) (PathClientFlushDataResponse, error) { + result := PathClientFlushDataResponse{} + if val := resp.Header.Get("Date"); val != "" { + date, err := time.Parse(time.RFC1123, val) + if err != nil { + return PathClientFlushDataResponse{}, err + } + result.Date = &date + } + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if val := resp.Header.Get("Last-Modified"); val != "" { + lastModified, err := time.Parse(time.RFC1123, val) + if err != nil { + return PathClientFlushDataResponse{}, err + } + result.LastModified = &lastModified + } + if val := resp.Header.Get("Content-Length"); val != "" { + contentLength, err := strconv.ParseInt(val, 10, 64) + if err != nil { + return PathClientFlushDataResponse{}, err + } + result.ContentLength = &contentLength + } + if val := resp.Header.Get("x-ms-client-request-id"); val != "" { + result.ClientRequestID = &val + } + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.RequestID = &val + } + if val := resp.Header.Get("x-ms-version"); val != "" { + result.Version = &val + } + if val := resp.Header.Get("x-ms-request-server-encrypted"); val != "" { + isServerEncrypted, err := strconv.ParseBool(val) + if err != nil { + return PathClientFlushDataResponse{}, err + } + result.IsServerEncrypted = &isServerEncrypted + } + if val := resp.Header.Get("x-ms-encryption-key-sha256"); val != "" { + result.EncryptionKeySHA256 = &val + } + return result, nil +} + +// GetProperties - Get Properties returns all system and user defined properties for a path. Get Status returns all system +// defined properties for a path. Get Access Control List returns the access control list for a +// path. This operation supports conditional HTTP requests. For more information, see Specifying Conditional Headers for Blob +// Service Operations +// [https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations]. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-10-02 +// - options - PathClientGetPropertiesOptions contains the optional parameters for the PathClient.GetProperties method. +// - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the PathClient.Create method. +// - ModifiedAccessConditions - ModifiedAccessConditions contains a group of parameters for the FileSystemClient.SetProperties +// method. +func (client *PathClient) GetProperties(ctx context.Context, options *PathClientGetPropertiesOptions, leaseAccessConditions *LeaseAccessConditions, modifiedAccessConditions *ModifiedAccessConditions) (PathClientGetPropertiesResponse, error) { + req, err := client.getPropertiesCreateRequest(ctx, options, leaseAccessConditions, modifiedAccessConditions) + if err != nil { + return PathClientGetPropertiesResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PathClientGetPropertiesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PathClientGetPropertiesResponse{}, runtime.NewResponseError(resp) + } + return client.getPropertiesHandleResponse(resp) +} + +// getPropertiesCreateRequest creates the GetProperties request. +func (client *PathClient) getPropertiesCreateRequest(ctx context.Context, options *PathClientGetPropertiesOptions, leaseAccessConditions *LeaseAccessConditions, modifiedAccessConditions *ModifiedAccessConditions) (*policy.Request, error) { + req, err := runtime.NewRequest(ctx, http.MethodHead, client.endpoint) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Timeout != nil { + reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10)) + } + if options != nil && options.Action != nil { + reqQP.Set("action", string(*options.Action)) + } + if options != nil && options.Upn != nil { + reqQP.Set("upn", strconv.FormatBool(*options.Upn)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.RequestID != nil { + req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} + } + req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + if leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil { + req.Raw().Header["x-ms-lease-id"] = []string{*leaseAccessConditions.LeaseID} + } + if modifiedAccessConditions != nil && modifiedAccessConditions.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*modifiedAccessConditions.IfMatch} + } + if modifiedAccessConditions != nil && modifiedAccessConditions.IfNoneMatch != nil { + req.Raw().Header["If-None-Match"] = []string{*modifiedAccessConditions.IfNoneMatch} + } + if modifiedAccessConditions != nil && modifiedAccessConditions.IfModifiedSince != nil { + req.Raw().Header["If-Modified-Since"] = []string{modifiedAccessConditions.IfModifiedSince.Format(time.RFC1123)} + } + if modifiedAccessConditions != nil && modifiedAccessConditions.IfUnmodifiedSince != nil { + req.Raw().Header["If-Unmodified-Since"] = []string{modifiedAccessConditions.IfUnmodifiedSince.Format(time.RFC1123)} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getPropertiesHandleResponse handles the GetProperties response. +func (client *PathClient) getPropertiesHandleResponse(resp *http.Response) (PathClientGetPropertiesResponse, error) { + result := PathClientGetPropertiesResponse{} + if val := resp.Header.Get("Accept-Ranges"); val != "" { + result.AcceptRanges = &val + } + if val := resp.Header.Get("Cache-Control"); val != "" { + result.CacheControl = &val + } + if val := resp.Header.Get("Content-Disposition"); val != "" { + result.ContentDisposition = &val + } + if val := resp.Header.Get("Content-Encoding"); val != "" { + result.ContentEncoding = &val + } + if val := resp.Header.Get("Content-Language"); val != "" { + result.ContentLanguage = &val + } + if val := resp.Header.Get("Content-Length"); val != "" { + contentLength, err := strconv.ParseInt(val, 10, 64) + if err != nil { + return PathClientGetPropertiesResponse{}, err + } + result.ContentLength = &contentLength + } + if val := resp.Header.Get("Content-Range"); val != "" { + result.ContentRange = &val + } + if val := resp.Header.Get("Content-Type"); val != "" { + result.ContentType = &val + } + if val := resp.Header.Get("Content-MD5"); val != "" { + result.ContentMD5 = &val + } + if val := resp.Header.Get("Date"); val != "" { + date, err := time.Parse(time.RFC1123, val) + if err != nil { + return PathClientGetPropertiesResponse{}, err + } + result.Date = &date + } + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if val := resp.Header.Get("Last-Modified"); val != "" { + lastModified, err := time.Parse(time.RFC1123, val) + if err != nil { + return PathClientGetPropertiesResponse{}, err + } + result.LastModified = &lastModified + } + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.RequestID = &val + } + if val := resp.Header.Get("x-ms-version"); val != "" { + result.Version = &val + } + if val := resp.Header.Get("x-ms-resource-type"); val != "" { + result.ResourceType = &val + } + if val := resp.Header.Get("x-ms-properties"); val != "" { + result.Properties = &val + } + if val := resp.Header.Get("x-ms-owner"); val != "" { + result.Owner = &val + } + if val := resp.Header.Get("x-ms-group"); val != "" { + result.Group = &val + } + if val := resp.Header.Get("x-ms-permissions"); val != "" { + result.Permissions = &val + } + if val := resp.Header.Get("x-ms-acl"); val != "" { + result.ACL = &val + } + if val := resp.Header.Get("x-ms-lease-duration"); val != "" { + result.LeaseDuration = &val + } + if val := resp.Header.Get("x-ms-lease-state"); val != "" { + result.LeaseState = &val + } + if val := resp.Header.Get("x-ms-lease-status"); val != "" { + result.LeaseStatus = &val + } + return result, nil +} + +// Lease - Create and manage a lease to restrict write and delete access to the path. This operation supports conditional +// HTTP requests. For more information, see Specifying Conditional Headers for Blob Service +// Operations [https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations]. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-10-02 +// - xmsLeaseAction - There are five lease actions: "acquire", "break", "change", "renew", and "release". Use "acquire" and +// specify the "x-ms-proposed-lease-id" and "x-ms-lease-duration" to acquire a new lease. Use "break" +// to break an existing lease. When a lease is broken, the lease break period is allowed to elapse, during which time no lease +// operation except break and release can be performed on the file. When a +// lease is successfully broken, the response indicates the interval in seconds until a new lease can be acquired. Use "change" +// and specify the current lease ID in "x-ms-lease-id" and the new lease ID in +// "x-ms-proposed-lease-id" to change the lease ID of an active lease. Use "renew" and specify the "x-ms-lease-id" to renew +// an existing lease. Use "release" and specify the "x-ms-lease-id" to release a +// lease. +// - options - PathClientLeaseOptions contains the optional parameters for the PathClient.Lease method. +// - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the PathClient.Create method. +// - ModifiedAccessConditions - ModifiedAccessConditions contains a group of parameters for the FileSystemClient.SetProperties +// method. +func (client *PathClient) Lease(ctx context.Context, xmsLeaseAction PathLeaseAction, options *PathClientLeaseOptions, leaseAccessConditions *LeaseAccessConditions, modifiedAccessConditions *ModifiedAccessConditions) (PathClientLeaseResponse, error) { + req, err := client.leaseCreateRequest(ctx, xmsLeaseAction, options, leaseAccessConditions, modifiedAccessConditions) + if err != nil { + return PathClientLeaseResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PathClientLeaseResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + return PathClientLeaseResponse{}, runtime.NewResponseError(resp) + } + return client.leaseHandleResponse(resp) +} + +// leaseCreateRequest creates the Lease request. +func (client *PathClient) leaseCreateRequest(ctx context.Context, xmsLeaseAction PathLeaseAction, options *PathClientLeaseOptions, leaseAccessConditions *LeaseAccessConditions, modifiedAccessConditions *ModifiedAccessConditions) (*policy.Request, error) { + req, err := runtime.NewRequest(ctx, http.MethodPost, client.endpoint) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Timeout != nil { + reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.RequestID != nil { + req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} + } + req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-lease-action"] = []string{string(xmsLeaseAction)} + if options != nil && options.XMSLeaseDuration != nil { + req.Raw().Header["x-ms-lease-duration"] = []string{strconv.FormatInt(int64(*options.XMSLeaseDuration), 10)} + } + if options != nil && options.XMSLeaseBreakPeriod != nil { + req.Raw().Header["x-ms-lease-break-period"] = []string{strconv.FormatInt(int64(*options.XMSLeaseBreakPeriod), 10)} + } + if leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil { + req.Raw().Header["x-ms-lease-id"] = []string{*leaseAccessConditions.LeaseID} + } + if options != nil && options.ProposedLeaseID != nil { + req.Raw().Header["x-ms-proposed-lease-id"] = []string{*options.ProposedLeaseID} + } + if modifiedAccessConditions != nil && modifiedAccessConditions.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*modifiedAccessConditions.IfMatch} + } + if modifiedAccessConditions != nil && modifiedAccessConditions.IfNoneMatch != nil { + req.Raw().Header["If-None-Match"] = []string{*modifiedAccessConditions.IfNoneMatch} + } + if modifiedAccessConditions != nil && modifiedAccessConditions.IfModifiedSince != nil { + req.Raw().Header["If-Modified-Since"] = []string{modifiedAccessConditions.IfModifiedSince.Format(time.RFC1123)} + } + if modifiedAccessConditions != nil && modifiedAccessConditions.IfUnmodifiedSince != nil { + req.Raw().Header["If-Unmodified-Since"] = []string{modifiedAccessConditions.IfUnmodifiedSince.Format(time.RFC1123)} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// leaseHandleResponse handles the Lease response. +func (client *PathClient) leaseHandleResponse(resp *http.Response) (PathClientLeaseResponse, error) { + result := PathClientLeaseResponse{} + if val := resp.Header.Get("Date"); val != "" { + date, err := time.Parse(time.RFC1123, val) + if err != nil { + return PathClientLeaseResponse{}, err + } + result.Date = &date + } + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if val := resp.Header.Get("Last-Modified"); val != "" { + lastModified, err := time.Parse(time.RFC1123, val) + if err != nil { + return PathClientLeaseResponse{}, err + } + result.LastModified = &lastModified + } + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.RequestID = &val + } + if val := resp.Header.Get("x-ms-version"); val != "" { + result.Version = &val + } + if val := resp.Header.Get("x-ms-lease-id"); val != "" { + result.LeaseID = &val + } + if val := resp.Header.Get("x-ms-lease-time"); val != "" { + result.LeaseTime = &val + } + return result, nil +} + +// Read - Read the contents of a file. For read operations, range requests are supported. This operation supports conditional +// HTTP requests. For more information, see Specifying Conditional Headers for Blob +// Service Operations [https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations]. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-10-02 +// - options - PathClientReadOptions contains the optional parameters for the PathClient.Read method. +// - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the PathClient.Create method. +// - ModifiedAccessConditions - ModifiedAccessConditions contains a group of parameters for the FileSystemClient.SetProperties +// method. +// - CpkInfo - CpkInfo contains a group of parameters for the PathClient.Create method. +func (client *PathClient) Read(ctx context.Context, options *PathClientReadOptions, leaseAccessConditions *LeaseAccessConditions, modifiedAccessConditions *ModifiedAccessConditions, cpkInfo *CpkInfo) (PathClientReadResponse, error) { + req, err := client.readCreateRequest(ctx, options, leaseAccessConditions, modifiedAccessConditions, cpkInfo) + if err != nil { + return PathClientReadResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PathClientReadResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusPartialContent) { + return PathClientReadResponse{}, runtime.NewResponseError(resp) + } + return client.readHandleResponse(resp) +} + +// readCreateRequest creates the Read request. +func (client *PathClient) readCreateRequest(ctx context.Context, options *PathClientReadOptions, leaseAccessConditions *LeaseAccessConditions, modifiedAccessConditions *ModifiedAccessConditions, cpkInfo *CpkInfo) (*policy.Request, error) { + req, err := runtime.NewRequest(ctx, http.MethodGet, client.endpoint) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Timeout != nil { + reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + runtime.SkipBodyDownload(req) + if options != nil && options.RequestID != nil { + req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} + } + req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + if options != nil && options.Range != nil { + req.Raw().Header["Range"] = []string{*options.Range} + } + if leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil { + req.Raw().Header["x-ms-lease-id"] = []string{*leaseAccessConditions.LeaseID} + } + if options != nil && options.XMSRangeGetContentMD5 != nil { + req.Raw().Header["x-ms-range-get-content-md5"] = []string{strconv.FormatBool(*options.XMSRangeGetContentMD5)} + } + if modifiedAccessConditions != nil && modifiedAccessConditions.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*modifiedAccessConditions.IfMatch} + } + if modifiedAccessConditions != nil && modifiedAccessConditions.IfNoneMatch != nil { + req.Raw().Header["If-None-Match"] = []string{*modifiedAccessConditions.IfNoneMatch} + } + if modifiedAccessConditions != nil && modifiedAccessConditions.IfModifiedSince != nil { + req.Raw().Header["If-Modified-Since"] = []string{modifiedAccessConditions.IfModifiedSince.Format(time.RFC1123)} + } + if modifiedAccessConditions != nil && modifiedAccessConditions.IfUnmodifiedSince != nil { + req.Raw().Header["If-Unmodified-Since"] = []string{modifiedAccessConditions.IfUnmodifiedSince.Format(time.RFC1123)} + } + 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{"AES256"} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// readHandleResponse handles the Read response. +func (client *PathClient) readHandleResponse(resp *http.Response) (PathClientReadResponse, error) { + result := PathClientReadResponse{Body: resp.Body} + if val := resp.Header.Get("Accept-Ranges"); val != "" { + result.AcceptRanges = &val + } + if val := resp.Header.Get("Cache-Control"); val != "" { + result.CacheControl = &val + } + if val := resp.Header.Get("Content-Disposition"); val != "" { + result.ContentDisposition = &val + } + if val := resp.Header.Get("Content-Encoding"); val != "" { + result.ContentEncoding = &val + } + if val := resp.Header.Get("Content-Language"); val != "" { + result.ContentLanguage = &val + } + if val := resp.Header.Get("Content-Length"); val != "" { + contentLength, err := strconv.ParseInt(val, 10, 64) + if err != nil { + return PathClientReadResponse{}, err + } + result.ContentLength = &contentLength + } + if val := resp.Header.Get("Content-Range"); val != "" { + result.ContentRange = &val + } + if val := resp.Header.Get("Content-Type"); val != "" { + result.ContentType = &val + } + if val := resp.Header.Get("Content-MD5"); val != "" { + result.ContentMD5 = &val + } + if val := resp.Header.Get("Date"); val != "" { + date, err := time.Parse(time.RFC1123, val) + if err != nil { + return PathClientReadResponse{}, err + } + result.Date = &date + } + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if val := resp.Header.Get("Last-Modified"); val != "" { + lastModified, err := time.Parse(time.RFC1123, val) + if err != nil { + return PathClientReadResponse{}, err + } + result.LastModified = &lastModified + } + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.RequestID = &val + } + if val := resp.Header.Get("x-ms-version"); val != "" { + result.Version = &val + } + if val := resp.Header.Get("x-ms-resource-type"); val != "" { + result.ResourceType = &val + } + if val := resp.Header.Get("x-ms-properties"); val != "" { + result.Properties = &val + } + if val := resp.Header.Get("x-ms-lease-duration"); val != "" { + result.LeaseDuration = &val + } + if val := resp.Header.Get("x-ms-lease-state"); val != "" { + result.LeaseState = &val + } + if val := resp.Header.Get("x-ms-lease-status"); val != "" { + result.LeaseStatus = &val + } + if val := resp.Header.Get("x-ms-request-server-encrypted"); val != "" { + isServerEncrypted, err := strconv.ParseBool(val) + if err != nil { + return PathClientReadResponse{}, err + } + result.IsServerEncrypted = &isServerEncrypted + } + if val := resp.Header.Get("x-ms-encryption-key-sha256"); val != "" { + result.EncryptionKeySHA256 = &val + } + if val := resp.Header.Get("x-ms-content-md5"); val != "" { + result.XMSContentMD5 = &val + } + return result, nil +} + +// SetAccessControl - Set the owner, group, permissions, or access control list for a path. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-10-02 +// - options - PathClientSetAccessControlOptions contains the optional parameters for the PathClient.SetAccessControl method. +// - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the PathClient.Create method. +// - ModifiedAccessConditions - ModifiedAccessConditions contains a group of parameters for the FileSystemClient.SetProperties +// method. +func (client *PathClient) SetAccessControl(ctx context.Context, options *PathClientSetAccessControlOptions, leaseAccessConditions *LeaseAccessConditions, modifiedAccessConditions *ModifiedAccessConditions) (PathClientSetAccessControlResponse, error) { + req, err := client.setAccessControlCreateRequest(ctx, options, leaseAccessConditions, modifiedAccessConditions) + if err != nil { + return PathClientSetAccessControlResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PathClientSetAccessControlResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PathClientSetAccessControlResponse{}, runtime.NewResponseError(resp) + } + return client.setAccessControlHandleResponse(resp) +} + +// setAccessControlCreateRequest creates the SetAccessControl request. +func (client *PathClient) setAccessControlCreateRequest(ctx context.Context, options *PathClientSetAccessControlOptions, leaseAccessConditions *LeaseAccessConditions, modifiedAccessConditions *ModifiedAccessConditions) (*policy.Request, error) { + req, err := runtime.NewRequest(ctx, http.MethodPatch, client.endpoint) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("action", "setAccessControl") + 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.Owner != nil { + req.Raw().Header["x-ms-owner"] = []string{*options.Owner} + } + if options != nil && options.Group != nil { + req.Raw().Header["x-ms-group"] = []string{*options.Group} + } + if options != nil && options.Permissions != nil { + req.Raw().Header["x-ms-permissions"] = []string{*options.Permissions} + } + if options != nil && options.ACL != nil { + req.Raw().Header["x-ms-acl"] = []string{*options.ACL} + } + if modifiedAccessConditions != nil && modifiedAccessConditions.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*modifiedAccessConditions.IfMatch} + } + if modifiedAccessConditions != nil && modifiedAccessConditions.IfNoneMatch != nil { + req.Raw().Header["If-None-Match"] = []string{*modifiedAccessConditions.IfNoneMatch} + } + if modifiedAccessConditions != nil && modifiedAccessConditions.IfModifiedSince != nil { + req.Raw().Header["If-Modified-Since"] = []string{modifiedAccessConditions.IfModifiedSince.Format(time.RFC1123)} + } + if modifiedAccessConditions != nil && modifiedAccessConditions.IfUnmodifiedSince != nil { + req.Raw().Header["If-Unmodified-Since"] = []string{modifiedAccessConditions.IfUnmodifiedSince.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-version"] = []string{"2020-10-02"} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// setAccessControlHandleResponse handles the SetAccessControl response. +func (client *PathClient) setAccessControlHandleResponse(resp *http.Response) (PathClientSetAccessControlResponse, error) { + result := PathClientSetAccessControlResponse{} + if val := resp.Header.Get("Date"); val != "" { + date, err := time.Parse(time.RFC1123, val) + if err != nil { + return PathClientSetAccessControlResponse{}, err + } + result.Date = &date + } + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if val := resp.Header.Get("Last-Modified"); val != "" { + lastModified, err := time.Parse(time.RFC1123, val) + if err != nil { + return PathClientSetAccessControlResponse{}, err + } + result.LastModified = &lastModified + } + if val := resp.Header.Get("x-ms-client-request-id"); val != "" { + result.ClientRequestID = &val + } + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.RequestID = &val + } + if val := resp.Header.Get("x-ms-version"); val != "" { + result.Version = &val + } + return result, nil +} + +// SetAccessControlRecursive - Set the access control list for a path and sub-paths. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-10-02 +// - mode - Mode "set" sets POSIX access control rights on files and directories, "modify" modifies one or more POSIX access +// control rights that pre-exist on files and directories, "remove" removes one or more +// POSIX access control rights that were present earlier on files and directories +// - options - PathClientSetAccessControlRecursiveOptions contains the optional parameters for the PathClient.SetAccessControlRecursive +// method. +func (client *PathClient) SetAccessControlRecursive(ctx context.Context, mode PathSetAccessControlRecursiveMode, options *PathClientSetAccessControlRecursiveOptions) (PathClientSetAccessControlRecursiveResponse, error) { + req, err := client.setAccessControlRecursiveCreateRequest(ctx, mode, options) + if err != nil { + return PathClientSetAccessControlRecursiveResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PathClientSetAccessControlRecursiveResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PathClientSetAccessControlRecursiveResponse{}, runtime.NewResponseError(resp) + } + return client.setAccessControlRecursiveHandleResponse(resp) +} + +// setAccessControlRecursiveCreateRequest creates the SetAccessControlRecursive request. +func (client *PathClient) setAccessControlRecursiveCreateRequest(ctx context.Context, mode PathSetAccessControlRecursiveMode, options *PathClientSetAccessControlRecursiveOptions) (*policy.Request, error) { + req, err := runtime.NewRequest(ctx, http.MethodPatch, client.endpoint) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("action", "setAccessControlRecursive") + if options != nil && options.Timeout != nil { + reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10)) + } + if options != nil && options.Continuation != nil { + reqQP.Set("continuation", *options.Continuation) + } + reqQP.Set("mode", string(mode)) + if options != nil && options.ForceFlag != nil { + reqQP.Set("forceFlag", strconv.FormatBool(*options.ForceFlag)) + } + if options != nil && options.MaxRecords != nil { + reqQP.Set("maxRecords", strconv.FormatInt(int64(*options.MaxRecords), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.ACL != nil { + req.Raw().Header["x-ms-acl"] = []string{*options.ACL} + } + if options != nil && options.RequestID != nil { + req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} + } + req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// setAccessControlRecursiveHandleResponse handles the SetAccessControlRecursive response. +func (client *PathClient) setAccessControlRecursiveHandleResponse(resp *http.Response) (PathClientSetAccessControlRecursiveResponse, error) { + result := PathClientSetAccessControlRecursiveResponse{} + if val := resp.Header.Get("Date"); val != "" { + date, err := time.Parse(time.RFC1123, val) + if err != nil { + return PathClientSetAccessControlRecursiveResponse{}, err + } + result.Date = &date + } + if val := resp.Header.Get("x-ms-client-request-id"); val != "" { + result.ClientRequestID = &val + } + if val := resp.Header.Get("x-ms-continuation"); val != "" { + result.Continuation = &val + } + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.RequestID = &val + } + if val := resp.Header.Get("x-ms-version"); val != "" { + result.Version = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.SetAccessControlRecursiveResponse); err != nil { + return PathClientSetAccessControlRecursiveResponse{}, err + } + return result, nil +} + +// SetExpiry - Sets the time a blob will expire and be deleted. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-10-02 +// - expiryOptions - Required. Indicates mode of the expiry time +// - options - PathClientSetExpiryOptions contains the optional parameters for the PathClient.SetExpiry method. +func (client *PathClient) SetExpiry(ctx context.Context, expiryOptions PathExpiryOptions, options *PathClientSetExpiryOptions) (PathClientSetExpiryResponse, error) { + req, err := client.setExpiryCreateRequest(ctx, expiryOptions, options) + if err != nil { + return PathClientSetExpiryResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PathClientSetExpiryResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PathClientSetExpiryResponse{}, runtime.NewResponseError(resp) + } + return client.setExpiryHandleResponse(resp) +} + +// setExpiryCreateRequest creates the SetExpiry request. +func (client *PathClient) setExpiryCreateRequest(ctx context.Context, expiryOptions PathExpiryOptions, options *PathClientSetExpiryOptions) (*policy.Request, error) { + req, err := runtime.NewRequest(ctx, http.MethodPut, client.endpoint) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("comp", "expiry") + 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{"2020-10-02"} + if options != nil && options.RequestID != nil { + req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} + } + req.Raw().Header["x-ms-expiry-option"] = []string{string(expiryOptions)} + if options != nil && options.ExpiresOn != nil { + req.Raw().Header["x-ms-expiry-time"] = []string{*options.ExpiresOn} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// setExpiryHandleResponse handles the SetExpiry response. +func (client *PathClient) setExpiryHandleResponse(resp *http.Response) (PathClientSetExpiryResponse, error) { + result := PathClientSetExpiryResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if val := resp.Header.Get("Last-Modified"); val != "" { + lastModified, err := time.Parse(time.RFC1123, val) + if err != nil { + return PathClientSetExpiryResponse{}, err + } + result.LastModified = &lastModified + } + if val := resp.Header.Get("x-ms-client-request-id"); val != "" { + result.ClientRequestID = &val + } + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.RequestID = &val + } + if val := resp.Header.Get("x-ms-version"); val != "" { + result.Version = &val + } + if val := resp.Header.Get("Date"); val != "" { + date, err := time.Parse(time.RFC1123, val) + if err != nil { + return PathClientSetExpiryResponse{}, err + } + result.Date = &date + } + return result, nil +} + +// Undelete - Undelete a path that was previously soft deleted +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-10-02 +// - options - PathClientUndeleteOptions contains the optional parameters for the PathClient.Undelete method. +func (client *PathClient) Undelete(ctx context.Context, options *PathClientUndeleteOptions) (PathClientUndeleteResponse, error) { + req, err := client.undeleteCreateRequest(ctx, options) + if err != nil { + return PathClientUndeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PathClientUndeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PathClientUndeleteResponse{}, runtime.NewResponseError(resp) + } + return client.undeleteHandleResponse(resp) +} + +// undeleteCreateRequest creates the Undelete request. +func (client *PathClient) undeleteCreateRequest(ctx context.Context, options *PathClientUndeleteOptions) (*policy.Request, error) { + req, err := runtime.NewRequest(ctx, http.MethodPut, client.endpoint) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("comp", "undelete") + if options != nil && options.Timeout != nil { + reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.UndeleteSource != nil { + req.Raw().Header["x-ms-undelete-source"] = []string{*options.UndeleteSource} + } + req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + if options != nil && options.RequestID != nil { + req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// undeleteHandleResponse handles the Undelete response. +func (client *PathClient) undeleteHandleResponse(resp *http.Response) (PathClientUndeleteResponse, error) { + result := PathClientUndeleteResponse{} + if val := resp.Header.Get("x-ms-client-request-id"); val != "" { + result.ClientRequestID = &val + } + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.RequestID = &val + } + if val := resp.Header.Get("x-ms-resource-type"); val != "" { + result.ResourceType = &val + } + if val := resp.Header.Get("x-ms-version"); val != "" { + result.Version = &val + } + if val := resp.Header.Get("Date"); val != "" { + date, err := time.Parse(time.RFC1123, val) + if err != nil { + return PathClientUndeleteResponse{}, err + } + result.Date = &date + } + return result, nil +} + +// Update - Uploads data to be appended to a file, flushes (writes) previously uploaded data to a file, sets properties for +// a file or directory, or sets access control for a file or directory. Data can only be +// appended to a file. Concurrent writes to the same file using multiple clients are not supported. This operation supports +// conditional HTTP requests. For more information, see Specifying Conditional +// Headers for Blob Service Operations [https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations]. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-10-02 +// - action - The action must be "append" to upload data to be appended to a file, "flush" to flush previously uploaded data +// to a file, "setProperties" to set the properties of a file or directory, +// "setAccessControl" to set the owner, group, permissions, or access control list for a file or directory, or "setAccessControlRecursive" +// to set the access control list for a directory recursively. Note +// that Hierarchical Namespace must be enabled for the account in order to use access control. Also note that the Access Control +// List (ACL) includes permissions for the owner, owning group, and others, +// so the x-ms-permissions and x-ms-acl request headers are mutually exclusive. +// - mode - Mode "set" sets POSIX access control rights on files and directories, "modify" modifies one or more POSIX access +// control rights that pre-exist on files and directories, "remove" removes one or more +// POSIX access control rights that were present earlier on files and directories +// - body - Initial data +// - options - PathClientUpdateOptions contains the optional parameters for the PathClient.Update method. +// - PathHTTPHeaders - PathHTTPHeaders contains a group of parameters for the PathClient.Create method. +// - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the PathClient.Create method. +// - ModifiedAccessConditions - ModifiedAccessConditions contains a group of parameters for the FileSystemClient.SetProperties +// method. +func (client *PathClient) Update(ctx context.Context, action PathUpdateAction, mode PathSetAccessControlRecursiveMode, body io.ReadSeekCloser, options *PathClientUpdateOptions, pathHTTPHeaders *PathHTTPHeaders, leaseAccessConditions *LeaseAccessConditions, modifiedAccessConditions *ModifiedAccessConditions) (PathClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, action, mode, body, options, pathHTTPHeaders, leaseAccessConditions, modifiedAccessConditions) + if err != nil { + return PathClientUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PathClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return PathClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *PathClient) updateCreateRequest(ctx context.Context, action PathUpdateAction, mode PathSetAccessControlRecursiveMode, body io.ReadSeekCloser, options *PathClientUpdateOptions, pathHTTPHeaders *PathHTTPHeaders, leaseAccessConditions *LeaseAccessConditions, modifiedAccessConditions *ModifiedAccessConditions) (*policy.Request, error) { + req, err := runtime.NewRequest(ctx, http.MethodPatch, client.endpoint) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Timeout != nil { + reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10)) + } + reqQP.Set("action", string(action)) + if options != nil && options.MaxRecords != nil { + reqQP.Set("maxRecords", strconv.FormatInt(int64(*options.MaxRecords), 10)) + } + if options != nil && options.Continuation != nil { + reqQP.Set("continuation", *options.Continuation) + } + reqQP.Set("mode", string(mode)) + if options != nil && options.ForceFlag != nil { + reqQP.Set("forceFlag", strconv.FormatBool(*options.ForceFlag)) + } + if options != nil && options.Position != nil { + reqQP.Set("position", strconv.FormatInt(*options.Position, 10)) + } + if options != nil && options.RetainUncommittedData != nil { + reqQP.Set("retainUncommittedData", strconv.FormatBool(*options.RetainUncommittedData)) + } + if options != nil && options.Close != nil { + reqQP.Set("close", strconv.FormatBool(*options.Close)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.RequestID != nil { + req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} + } + req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + if options != nil && options.ContentLength != nil { + req.Raw().Header["Content-Length"] = []string{strconv.FormatInt(*options.ContentLength, 10)} + } + if pathHTTPHeaders != nil && pathHTTPHeaders.ContentMD5 != nil { + req.Raw().Header["x-ms-content-md5"] = []string{base64.StdEncoding.EncodeToString(pathHTTPHeaders.ContentMD5)} + } + if leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil { + req.Raw().Header["x-ms-lease-id"] = []string{*leaseAccessConditions.LeaseID} + } + if pathHTTPHeaders != nil && pathHTTPHeaders.CacheControl != nil { + req.Raw().Header["x-ms-cache-control"] = []string{*pathHTTPHeaders.CacheControl} + } + if pathHTTPHeaders != nil && pathHTTPHeaders.ContentType != nil { + req.Raw().Header["x-ms-content-type"] = []string{*pathHTTPHeaders.ContentType} + } + if pathHTTPHeaders != nil && pathHTTPHeaders.ContentDisposition != nil { + req.Raw().Header["x-ms-content-disposition"] = []string{*pathHTTPHeaders.ContentDisposition} + } + if pathHTTPHeaders != nil && pathHTTPHeaders.ContentEncoding != nil { + req.Raw().Header["x-ms-content-encoding"] = []string{*pathHTTPHeaders.ContentEncoding} + } + if pathHTTPHeaders != nil && pathHTTPHeaders.ContentLanguage != nil { + req.Raw().Header["x-ms-content-language"] = []string{*pathHTTPHeaders.ContentLanguage} + } + if options != nil && options.Properties != nil { + req.Raw().Header["x-ms-properties"] = []string{*options.Properties} + } + if options != nil && options.Owner != nil { + req.Raw().Header["x-ms-owner"] = []string{*options.Owner} + } + if options != nil && options.Group != nil { + req.Raw().Header["x-ms-group"] = []string{*options.Group} + } + if options != nil && options.Permissions != nil { + req.Raw().Header["x-ms-permissions"] = []string{*options.Permissions} + } + if options != nil && options.ACL != nil { + req.Raw().Header["x-ms-acl"] = []string{*options.ACL} + } + if modifiedAccessConditions != nil && modifiedAccessConditions.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*modifiedAccessConditions.IfMatch} + } + if modifiedAccessConditions != nil && modifiedAccessConditions.IfNoneMatch != nil { + req.Raw().Header["If-None-Match"] = []string{*modifiedAccessConditions.IfNoneMatch} + } + if modifiedAccessConditions != nil && modifiedAccessConditions.IfModifiedSince != nil { + req.Raw().Header["If-Modified-Since"] = []string{modifiedAccessConditions.IfModifiedSince.Format(time.RFC1123)} + } + if modifiedAccessConditions != nil && modifiedAccessConditions.IfUnmodifiedSince != nil { + req.Raw().Header["If-Unmodified-Since"] = []string{modifiedAccessConditions.IfUnmodifiedSince.Format(time.RFC1123)} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, req.SetBody(body, "application/octet-stream") +} + +// updateHandleResponse handles the Update response. +func (client *PathClient) updateHandleResponse(resp *http.Response) (PathClientUpdateResponse, error) { + result := PathClientUpdateResponse{} + if val := resp.Header.Get("Date"); val != "" { + date, err := time.Parse(time.RFC1123, val) + if err != nil { + return PathClientUpdateResponse{}, err + } + result.Date = &date + } + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if val := resp.Header.Get("Last-Modified"); val != "" { + lastModified, err := time.Parse(time.RFC1123, val) + if err != nil { + return PathClientUpdateResponse{}, err + } + result.LastModified = &lastModified + } + if val := resp.Header.Get("Accept-Ranges"); val != "" { + result.AcceptRanges = &val + } + if val := resp.Header.Get("Cache-Control"); val != "" { + result.CacheControl = &val + } + if val := resp.Header.Get("Content-Disposition"); val != "" { + result.ContentDisposition = &val + } + if val := resp.Header.Get("Content-Encoding"); val != "" { + result.ContentEncoding = &val + } + if val := resp.Header.Get("Content-Language"); val != "" { + result.ContentLanguage = &val + } + if val := resp.Header.Get("Content-Length"); val != "" { + contentLength, err := strconv.ParseInt(val, 10, 64) + if err != nil { + return PathClientUpdateResponse{}, err + } + result.ContentLength = &contentLength + } + if val := resp.Header.Get("Content-Range"); val != "" { + result.ContentRange = &val + } + if val := resp.Header.Get("Content-Type"); val != "" { + result.ContentType = &val + } + if val := resp.Header.Get("Content-MD5"); val != "" { + result.ContentMD5 = &val + } + if val := resp.Header.Get("x-ms-properties"); val != "" { + result.Properties = &val + } + if val := resp.Header.Get("x-ms-continuation"); val != "" { + result.XMSContinuation = &val + } + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.RequestID = &val + } + if val := resp.Header.Get("x-ms-version"); val != "" { + result.Version = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.SetAccessControlRecursiveResponse); err != nil { + return PathClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/storage/azdatalake/internal/generated/zz_response_types.go b/sdk/storage/azdatalake/internal/generated/zz_response_types.go new file mode 100644 index 000000000000..e95f5035e654 --- /dev/null +++ b/sdk/storage/azdatalake/internal/generated/zz_response_types.go @@ -0,0 +1,557 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package generated + +import ( + "io" + "time" +) + +// FileSystemClientCreateResponse contains the response from method FileSystemClient.Create. +type FileSystemClientCreateResponse struct { + // ClientRequestID contains the information returned from the x-ms-request-id header response. + ClientRequestID *string + + // Date contains the information returned from the Date header response. + Date *time.Time + + // ETag contains the information returned from the ETag header response. + ETag *string + + // LastModified contains the information returned from the Last-Modified header response. + LastModified *time.Time + + // NamespaceEnabled contains the information returned from the x-ms-namespace-enabled header response. + NamespaceEnabled *string + + // Version contains the information returned from the x-ms-version header response. + Version *string +} + +// FileSystemClientDeleteResponse contains the response from method FileSystemClient.Delete. +type FileSystemClientDeleteResponse struct { + // Date contains the information returned from the Date header response. + Date *time.Time + + // RequestID contains the information returned from the x-ms-request-id header response. + RequestID *string + + // Version contains the information returned from the x-ms-version header response. + Version *string +} + +// FileSystemClientGetPropertiesResponse contains the response from method FileSystemClient.GetProperties. +type FileSystemClientGetPropertiesResponse struct { + // Date contains the information returned from the Date header response. + Date *time.Time + + // ETag contains the information returned from the ETag header response. + ETag *string + + // LastModified contains the information returned from the Last-Modified header response. + LastModified *time.Time + + // NamespaceEnabled contains the information returned from the x-ms-namespace-enabled header response. + NamespaceEnabled *string + + // Properties contains the information returned from the x-ms-properties header response. + Properties *string + + // RequestID contains the information returned from the x-ms-request-id header response. + RequestID *string + + // Version contains the information returned from the x-ms-version header response. + Version *string +} + +// FileSystemClientListBlobHierarchySegmentResponse contains the response from method FileSystemClient.NewListBlobHierarchySegmentPager. +type FileSystemClientListBlobHierarchySegmentResponse struct { + ListBlobsHierarchySegmentResponse + // ClientRequestID contains the information returned from the x-ms-client-request-id header response. + ClientRequestID *string `xml:"ClientRequestID"` + + // ContentType contains the information returned from the Content-Type header response. + ContentType *string `xml:"ContentType"` + + // Date contains the information returned from the Date header response. + Date *time.Time `xml:"Date"` + + // RequestID contains the information returned from the x-ms-request-id header response. + RequestID *string `xml:"RequestID"` + + // Version contains the information returned from the x-ms-version header response. + Version *string `xml:"Version"` +} + +// FileSystemClientListPathsResponse contains the response from method FileSystemClient.NewListPathsPager. +type FileSystemClientListPathsResponse struct { + PathList + // Continuation contains the information returned from the x-ms-continuation header response. + Continuation *string + + // Date contains the information returned from the Date header response. + Date *time.Time + + // ETag contains the information returned from the ETag header response. + ETag *string + + // LastModified contains the information returned from the Last-Modified header response. + LastModified *time.Time + + // RequestID contains the information returned from the x-ms-request-id header response. + RequestID *string + + // Version contains the information returned from the x-ms-version header response. + Version *string +} + +// FileSystemClientSetPropertiesResponse contains the response from method FileSystemClient.SetProperties. +type FileSystemClientSetPropertiesResponse struct { + // Date contains the information returned from the Date header response. + Date *time.Time + + // ETag contains the information returned from the ETag header response. + ETag *string + + // LastModified contains the information returned from the Last-Modified header response. + LastModified *time.Time + + // RequestID contains the information returned from the x-ms-request-id header response. + RequestID *string + + // Version contains the information returned from the x-ms-version header response. + Version *string +} + +// PathClientAppendDataResponse contains the response from method PathClient.AppendData. +type PathClientAppendDataResponse struct { + // ClientRequestID contains the information returned from the x-ms-client-request-id header response. + ClientRequestID *string + + // ContentMD5 contains the information returned from the Content-MD5 header response. + ContentMD5 []byte + + // Date contains the information returned from the Date header response. + Date *time.Time + + // ETag contains the information returned from the ETag header response. + ETag *string + + // EncryptionKeySHA256 contains the information returned from the x-ms-encryption-key-sha256 header response. + EncryptionKeySHA256 *string + + // IsServerEncrypted contains the information returned from the x-ms-request-server-encrypted header response. + IsServerEncrypted *bool + + // RequestID contains the information returned from the x-ms-request-id header response. + RequestID *string + + // Version contains the information returned from the x-ms-version header response. + Version *string + + // XMSContentCRC64 contains the information returned from the x-ms-content-crc64 header response. + XMSContentCRC64 []byte +} + +// PathClientCreateResponse contains the response from method PathClient.Create. +type PathClientCreateResponse struct { + // ContentLength contains the information returned from the Content-Length header response. + ContentLength *int64 + + // Continuation contains the information returned from the x-ms-continuation header response. + Continuation *string + + // Date contains the information returned from the Date header response. + Date *time.Time + + // ETag contains the information returned from the ETag header response. + ETag *string + + // EncryptionKeySHA256 contains the information returned from the x-ms-encryption-key-sha256 header response. + EncryptionKeySHA256 *string + + // IsServerEncrypted contains the information returned from the x-ms-request-server-encrypted header response. + IsServerEncrypted *bool + + // LastModified contains the information returned from the Last-Modified header response. + LastModified *time.Time + + // RequestID contains the information returned from the x-ms-request-id header response. + RequestID *string + + // Version contains the information returned from the x-ms-version header response. + Version *string +} + +// PathClientDeleteResponse contains the response from method PathClient.Delete. +type PathClientDeleteResponse struct { + // Continuation contains the information returned from the x-ms-continuation header response. + Continuation *string + + // Date contains the information returned from the Date header response. + Date *time.Time + + // DeletionID contains the information returned from the x-ms-deletion-id header response. + DeletionID *string + + // RequestID contains the information returned from the x-ms-request-id header response. + RequestID *string + + // Version contains the information returned from the x-ms-version header response. + Version *string +} + +// PathClientFlushDataResponse contains the response from method PathClient.FlushData. +type PathClientFlushDataResponse struct { + // ClientRequestID contains the information returned from the x-ms-client-request-id header response. + ClientRequestID *string + + // ContentLength contains the information returned from the Content-Length header response. + ContentLength *int64 + + // Date contains the information returned from the Date header response. + Date *time.Time + + // ETag contains the information returned from the ETag header response. + ETag *string + + // EncryptionKeySHA256 contains the information returned from the x-ms-encryption-key-sha256 header response. + EncryptionKeySHA256 *string + + // IsServerEncrypted contains the information returned from the x-ms-request-server-encrypted header response. + IsServerEncrypted *bool + + // LastModified contains the information returned from the Last-Modified header response. + LastModified *time.Time + + // RequestID contains the information returned from the x-ms-request-id header response. + RequestID *string + + // Version contains the information returned from the x-ms-version header response. + Version *string +} + +// PathClientGetPropertiesResponse contains the response from method PathClient.GetProperties. +type PathClientGetPropertiesResponse struct { + // ACL contains the information returned from the x-ms-acl header response. + ACL *string + + // AcceptRanges contains the information returned from the Accept-Ranges header response. + AcceptRanges *string + + // CacheControl contains the information returned from the Cache-Control header response. + CacheControl *string + + // ContentDisposition contains the information returned from the Content-Disposition header response. + ContentDisposition *string + + // ContentEncoding contains the information returned from the Content-Encoding header response. + ContentEncoding *string + + // ContentLanguage contains the information returned from the Content-Language header response. + ContentLanguage *string + + // ContentLength contains the information returned from the Content-Length header response. + ContentLength *int64 + + // ContentMD5 contains the information returned from the Content-MD5 header response. + ContentMD5 *string + + // ContentRange contains the information returned from the Content-Range header response. + ContentRange *string + + // ContentType contains the information returned from the Content-Type header response. + ContentType *string + + // Date contains the information returned from the Date header response. + Date *time.Time + + // ETag contains the information returned from the ETag header response. + ETag *string + + // Group contains the information returned from the x-ms-group header response. + Group *string + + // LastModified contains the information returned from the Last-Modified header response. + LastModified *time.Time + + // LeaseDuration contains the information returned from the x-ms-lease-duration header response. + LeaseDuration *string + + // LeaseState contains the information returned from the x-ms-lease-state header response. + LeaseState *string + + // LeaseStatus contains the information returned from the x-ms-lease-status header response. + LeaseStatus *string + + // Owner contains the information returned from the x-ms-owner header response. + Owner *string + + // Permissions contains the information returned from the x-ms-permissions header response. + Permissions *string + + // Properties contains the information returned from the x-ms-properties header response. + Properties *string + + // RequestID contains the information returned from the x-ms-request-id header response. + RequestID *string + + // ResourceType contains the information returned from the x-ms-resource-type header response. + ResourceType *string + + // Version contains the information returned from the x-ms-version header response. + Version *string +} + +// PathClientLeaseResponse contains the response from method PathClient.Lease. +type PathClientLeaseResponse struct { + // Date contains the information returned from the Date header response. + Date *time.Time + + // ETag contains the information returned from the ETag header response. + ETag *string + + // LastModified contains the information returned from the Last-Modified header response. + LastModified *time.Time + + // LeaseID contains the information returned from the x-ms-lease-id header response. + LeaseID *string + + // LeaseTime contains the information returned from the x-ms-lease-time header response. + LeaseTime *string + + // RequestID contains the information returned from the x-ms-request-id header response. + RequestID *string + + // Version contains the information returned from the x-ms-version header response. + Version *string +} + +// PathClientReadResponse contains the response from method PathClient.Read. +type PathClientReadResponse struct { + // AcceptRanges contains the information returned from the Accept-Ranges header response. + AcceptRanges *string + + // Body contains the streaming response. + Body io.ReadCloser + + // CacheControl contains the information returned from the Cache-Control header response. + CacheControl *string + + // ContentDisposition contains the information returned from the Content-Disposition header response. + ContentDisposition *string + + // ContentEncoding contains the information returned from the Content-Encoding header response. + ContentEncoding *string + + // ContentLanguage contains the information returned from the Content-Language header response. + ContentLanguage *string + + // ContentLength contains the information returned from the Content-Length header response. + ContentLength *int64 + + // ContentMD5 contains the information returned from the Content-MD5 header response. + ContentMD5 *string + + // ContentRange contains the information returned from the Content-Range header response. + ContentRange *string + + // ContentType contains the information returned from the Content-Type header response. + ContentType *string + + // Date contains the information returned from the Date header response. + Date *time.Time + + // ETag contains the information returned from the ETag header response. + ETag *string + + // EncryptionKeySHA256 contains the information returned from the x-ms-encryption-key-sha256 header response. + EncryptionKeySHA256 *string + + // IsServerEncrypted contains the information returned from the x-ms-request-server-encrypted header response. + IsServerEncrypted *bool + + // LastModified contains the information returned from the Last-Modified header response. + LastModified *time.Time + + // LeaseDuration contains the information returned from the x-ms-lease-duration header response. + LeaseDuration *string + + // LeaseState contains the information returned from the x-ms-lease-state header response. + LeaseState *string + + // LeaseStatus contains the information returned from the x-ms-lease-status header response. + LeaseStatus *string + + // Properties contains the information returned from the x-ms-properties header response. + Properties *string + + // RequestID contains the information returned from the x-ms-request-id header response. + RequestID *string + + // ResourceType contains the information returned from the x-ms-resource-type header response. + ResourceType *string + + // Version contains the information returned from the x-ms-version header response. + Version *string + + // XMSContentMD5 contains the information returned from the x-ms-content-md5 header response. + XMSContentMD5 *string +} + +// PathClientSetAccessControlRecursiveResponse contains the response from method PathClient.SetAccessControlRecursive. +type PathClientSetAccessControlRecursiveResponse struct { + SetAccessControlRecursiveResponse + // ClientRequestID contains the information returned from the x-ms-client-request-id header response. + ClientRequestID *string + + // Continuation contains the information returned from the x-ms-continuation header response. + Continuation *string + + // Date contains the information returned from the Date header response. + Date *time.Time + + // RequestID contains the information returned from the x-ms-request-id header response. + RequestID *string + + // Version contains the information returned from the x-ms-version header response. + Version *string +} + +// PathClientSetAccessControlResponse contains the response from method PathClient.SetAccessControl. +type PathClientSetAccessControlResponse struct { + // ClientRequestID contains the information returned from the x-ms-client-request-id header response. + ClientRequestID *string + + // Date contains the information returned from the Date header response. + Date *time.Time + + // ETag contains the information returned from the ETag header response. + ETag *string + + // LastModified contains the information returned from the Last-Modified header response. + LastModified *time.Time + + // RequestID contains the information returned from the x-ms-request-id header response. + RequestID *string + + // Version contains the information returned from the x-ms-version header response. + Version *string +} + +// PathClientSetExpiryResponse contains the response from method PathClient.SetExpiry. +type PathClientSetExpiryResponse struct { + // ClientRequestID contains the information returned from the x-ms-client-request-id header response. + ClientRequestID *string + + // Date contains the information returned from the Date header response. + Date *time.Time + + // ETag contains the information returned from the ETag header response. + ETag *string + + // LastModified contains the information returned from the Last-Modified header response. + LastModified *time.Time + + // RequestID contains the information returned from the x-ms-request-id header response. + RequestID *string + + // Version contains the information returned from the x-ms-version header response. + Version *string +} + +// PathClientUndeleteResponse contains the response from method PathClient.Undelete. +type PathClientUndeleteResponse struct { + // ClientRequestID contains the information returned from the x-ms-client-request-id header response. + ClientRequestID *string + + // Date contains the information returned from the Date header response. + Date *time.Time + + // RequestID contains the information returned from the x-ms-request-id header response. + RequestID *string + + // ResourceType contains the information returned from the x-ms-resource-type header response. + ResourceType *string + + // Version contains the information returned from the x-ms-version header response. + Version *string +} + +// PathClientUpdateResponse contains the response from method PathClient.Update. +type PathClientUpdateResponse struct { + SetAccessControlRecursiveResponse + // AcceptRanges contains the information returned from the Accept-Ranges header response. + AcceptRanges *string + + // CacheControl contains the information returned from the Cache-Control header response. + CacheControl *string + + // ContentDisposition contains the information returned from the Content-Disposition header response. + ContentDisposition *string + + // ContentEncoding contains the information returned from the Content-Encoding header response. + ContentEncoding *string + + // ContentLanguage contains the information returned from the Content-Language header response. + ContentLanguage *string + + // ContentLength contains the information returned from the Content-Length header response. + ContentLength *int64 + + // ContentMD5 contains the information returned from the Content-MD5 header response. + ContentMD5 *string + + // ContentRange contains the information returned from the Content-Range header response. + ContentRange *string + + // ContentType contains the information returned from the Content-Type header response. + ContentType *string + + // Date contains the information returned from the Date header response. + Date *time.Time + + // ETag contains the information returned from the ETag header response. + ETag *string + + // LastModified contains the information returned from the Last-Modified header response. + LastModified *time.Time + + // Properties contains the information returned from the x-ms-properties header response. + Properties *string + + // RequestID contains the information returned from the x-ms-request-id header response. + RequestID *string + + // Version contains the information returned from the x-ms-version header response. + Version *string + + // XMSContinuation contains the information returned from the x-ms-continuation header response. + XMSContinuation *string +} + +// ServiceClientListFileSystemsResponse contains the response from method ServiceClient.NewListFileSystemsPager. +type ServiceClientListFileSystemsResponse struct { + FileSystemList + // ContentType contains the information returned from the Content-Type header response. + ContentType *string + + // Continuation contains the information returned from the x-ms-continuation header response. + Continuation *string + + // Date contains the information returned from the Date header response. + Date *time.Time + + // RequestID contains the information returned from the x-ms-request-id header response. + RequestID *string + + // Version contains the information returned from the x-ms-version header response. + Version *string +} diff --git a/sdk/storage/azdatalake/internal/generated/zz_service_client.go b/sdk/storage/azdatalake/internal/generated/zz_service_client.go new file mode 100644 index 000000000000..40654cbdefbe --- /dev/null +++ b/sdk/storage/azdatalake/internal/generated/zz_service_client.go @@ -0,0 +1,100 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strconv" + "time" +) + +// ServiceClient contains the methods for the Service group. +// Don't use this type directly, use NewServiceClient() instead. +type ServiceClient struct { + endpoint string + pl runtime.Pipeline +} + +// NewServiceClient creates a new instance of ServiceClient with the specified values. +// - endpoint - The URL of the service account, container, or blob that is the target of the desired operation. +// - pl - the pipeline used for sending requests and handling responses. +func NewServiceClient(endpoint string, pl runtime.Pipeline) *ServiceClient { + client := &ServiceClient{ + endpoint: endpoint, + pl: pl, + } + return client +} + +// NewListFileSystemsPager - List filesystems and their properties in given account. +// +// Generated from API version 2020-10-02 +// - options - ServiceClientListFileSystemsOptions contains the optional parameters for the ServiceClient.NewListFileSystemsPager +// method. +// +// ListFileSystemsCreateRequest creates the ListFileSystems request. +func (client *FileSystemClient) ListFileSystemsCreateRequest(ctx context.Context, options *ServiceClientListFileSystemsOptions) (*policy.Request, error) { + req, err := runtime.NewRequest(ctx, http.MethodGet, client.endpoint) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("resource", "account") + if options != nil && options.Prefix != nil { + reqQP.Set("prefix", *options.Prefix) + } + if options != nil && options.Continuation != nil { + reqQP.Set("continuation", *options.Continuation) + } + if options != nil && options.MaxResults != nil { + reqQP.Set("maxResults", strconv.FormatInt(int64(*options.MaxResults), 10)) + } + if options != nil && options.Timeout != nil { + reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.RequestID != nil { + req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} + } + req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listFileSystemsHandleResponse handles the ListFileSystems response. +func (client *FileSystemClient) ListFileSystemsHandleResponse(resp *http.Response) (ServiceClientListFileSystemsResponse, error) { + result := ServiceClientListFileSystemsResponse{} + if val := resp.Header.Get("Date"); val != "" { + date, err := time.Parse(time.RFC1123, val) + if err != nil { + return ServiceClientListFileSystemsResponse{}, err + } + result.Date = &date + } + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.RequestID = &val + } + if val := resp.Header.Get("x-ms-version"); val != "" { + result.Version = &val + } + if val := resp.Header.Get("x-ms-continuation"); val != "" { + result.Continuation = &val + } + if val := resp.Header.Get("Content-Type"); val != "" { + result.ContentType = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.FileSystemList); err != nil { + return ServiceClientListFileSystemsResponse{}, err + } + return result, nil +} diff --git a/sdk/storage/azdatalake/internal/generated/zz_time_rfc1123.go b/sdk/storage/azdatalake/internal/generated/zz_time_rfc1123.go new file mode 100644 index 000000000000..4b4d51aa3994 --- /dev/null +++ b/sdk/storage/azdatalake/internal/generated/zz_time_rfc1123.go @@ -0,0 +1,43 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package generated + +import ( + "strings" + "time" +) + +const ( + rfc1123JSON = `"` + time.RFC1123 + `"` +) + +type timeRFC1123 time.Time + +func (t timeRFC1123) MarshalJSON() ([]byte, error) { + b := []byte(time.Time(t).Format(rfc1123JSON)) + return b, nil +} + +func (t timeRFC1123) MarshalText() ([]byte, error) { + b := []byte(time.Time(t).Format(time.RFC1123)) + return b, nil +} + +func (t *timeRFC1123) UnmarshalJSON(data []byte) error { + p, err := time.Parse(rfc1123JSON, strings.ToUpper(string(data))) + *t = timeRFC1123(p) + return err +} + +func (t *timeRFC1123) UnmarshalText(data []byte) error { + p, err := time.Parse(time.RFC1123, string(data)) + *t = timeRFC1123(p) + return err +}