diff --git a/sdk/storage/azfile/README.md b/sdk/storage/azfile/README.md index 9d543493bf30..67e9d5c360ec 100644 --- a/sdk/storage/azfile/README.md +++ b/sdk/storage/azfile/README.md @@ -1,6 +1,6 @@ # Azure File Storage SDK for Go -> Service Version: 2022-11-02 +> Service Version: 2023-11-03 Azure File Shares offers fully managed file shares in the cloud that are accessible via the industry standard [Server Message Block (SMB) protocol](https://docs.microsoft.com/windows/desktop/FileIO/microsoft-smb-protocol-and-cifs-protocol-overview). diff --git a/sdk/storage/azfile/internal/generated/autorest.md b/sdk/storage/azfile/internal/generated/autorest.md index 9572da0256e2..f887159b7f0b 100644 --- a/sdk/storage/azfile/internal/generated/autorest.md +++ b/sdk/storage/azfile/internal/generated/autorest.md @@ -19,7 +19,7 @@ modelerfour: seal-single-value-enum-by-default: true lenient-model-deduplication: true export-clients: true -use: "@autorest/go@4.0.0-preview.49" +use: "@autorest/go@4.0.0-preview.61" ``` ### Updating service version to 2023-11-03 @@ -160,6 +160,7 @@ directive: - zz_directory_client.go - zz_file_client.go - zz_models.go + - zz_options.go where: $ transform: >- return $. diff --git a/sdk/storage/azfile/internal/generated/models.go b/sdk/storage/azfile/internal/generated/models.go index 3aeb9ae89d49..36a671cc6a86 100644 --- a/sdk/storage/azfile/internal/generated/models.go +++ b/sdk/storage/azfile/internal/generated/models.go @@ -38,12 +38,12 @@ func (h Handle) MarshalXML(enc *xml.Encoder, start xml.StartElement) error { type alias Handle aux := &struct { *alias - LastReconnectTime *timeRFC1123 `xml:"LastReconnectTime"` - OpenTime *timeRFC1123 `xml:"OpenTime"` + LastReconnectTime *dateTimeRFC1123 `xml:"LastReconnectTime"` + OpenTime *dateTimeRFC1123 `xml:"OpenTime"` }{ alias: (*alias)(&h), - LastReconnectTime: (*timeRFC1123)(h.LastReconnectTime), - OpenTime: (*timeRFC1123)(h.OpenTime), + LastReconnectTime: (*dateTimeRFC1123)(h.LastReconnectTime), + OpenTime: (*dateTimeRFC1123)(h.OpenTime), } return enc.EncodeElement(aux, start) } @@ -53,9 +53,9 @@ func (h *Handle) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error { type alias Handle aux := &struct { *alias - Path *StringEncoded `xml:"Path"` - LastReconnectTime *timeRFC1123 `xml:"LastReconnectTime"` - OpenTime *timeRFC1123 `xml:"OpenTime"` + Path *StringEncoded `xml:"Path"` + LastReconnectTime *dateTimeRFC1123 `xml:"LastReconnectTime"` + OpenTime *dateTimeRFC1123 `xml:"OpenTime"` }{ alias: (*alias)(h), } diff --git a/sdk/storage/azfile/internal/generated/zz_constants.go b/sdk/storage/azfile/internal/generated/zz_constants.go index 9df8784a97a1..edbc1a5c1c74 100644 --- a/sdk/storage/azfile/internal/generated/zz_constants.go +++ b/sdk/storage/azfile/internal/generated/zz_constants.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package generated diff --git a/sdk/storage/azfile/internal/generated/zz_directory_client.go b/sdk/storage/azfile/internal/generated/zz_directory_client.go index 5a13781a835b..41d3367a1dd5 100644 --- a/sdk/storage/azfile/internal/generated/zz_directory_client.go +++ b/sdk/storage/azfile/internal/generated/zz_directory_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package generated @@ -38,18 +37,21 @@ type DirectoryClient struct { // Generated from API version 2023-11-03 // - options - DirectoryClientCreateOptions contains the optional parameters for the DirectoryClient.Create method. func (client *DirectoryClient) Create(ctx context.Context, options *DirectoryClientCreateOptions) (DirectoryClientCreateResponse, error) { + var err error req, err := client.createCreateRequest(ctx, options) if err != nil { return DirectoryClientCreateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DirectoryClientCreateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusCreated) { - return DirectoryClientCreateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return DirectoryClientCreateResponse{}, err } - return client.createHandleResponse(resp) + resp, err := client.createHandleResponse(httpResp) + return resp, err } // createCreateRequest creates the Create request. @@ -103,22 +105,6 @@ func (client *DirectoryClient) createCreateRequest(ctx context.Context, options // createHandleResponse handles the Create response. func (client *DirectoryClient) createHandleResponse(resp *http.Response) (DirectoryClientCreateResponse, error) { result := DirectoryClientCreateResponse{} - if val := resp.Header.Get("ETag"); val != "" { - result.ETag = (*azcore.ETag)(&val) - } - if val := resp.Header.Get("Last-Modified"); val != "" { - lastModified, err := time.Parse(time.RFC1123, val) - if err != nil { - return DirectoryClientCreateResponse{}, 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("Date"); val != "" { date, err := time.Parse(time.RFC1123, val) if err != nil { @@ -126,19 +112,19 @@ func (client *DirectoryClient) createHandleResponse(resp *http.Response) (Direct } result.Date = &date } - if val := resp.Header.Get("x-ms-request-server-encrypted"); val != "" { - isServerEncrypted, err := strconv.ParseBool(val) - if err != nil { - return DirectoryClientCreateResponse{}, err - } - result.IsServerEncrypted = &isServerEncrypted - } - if val := resp.Header.Get("x-ms-file-permission-key"); val != "" { - result.FilePermissionKey = &val + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = (*azcore.ETag)(&val) } if val := resp.Header.Get("x-ms-file-attributes"); val != "" { result.FileAttributes = &val } + if val := resp.Header.Get("x-ms-file-change-time"); val != "" { + fileChangeTime, err := time.Parse(ISO8601, val) + if err != nil { + return DirectoryClientCreateResponse{}, err + } + result.FileChangeTime = &fileChangeTime + } if val := resp.Header.Get("x-ms-file-creation-time"); val != "" { fileCreationTime, err := time.Parse(ISO8601, val) if err != nil { @@ -146,6 +132,9 @@ func (client *DirectoryClient) createHandleResponse(resp *http.Response) (Direct } result.FileCreationTime = &fileCreationTime } + if val := resp.Header.Get("x-ms-file-id"); val != "" { + result.ID = &val + } if val := resp.Header.Get("x-ms-file-last-write-time"); val != "" { fileLastWriteTime, err := time.Parse(ISO8601, val) if err != nil { @@ -153,18 +142,31 @@ func (client *DirectoryClient) createHandleResponse(resp *http.Response) (Direct } result.FileLastWriteTime = &fileLastWriteTime } - if val := resp.Header.Get("x-ms-file-change-time"); val != "" { - fileChangeTime, err := time.Parse(ISO8601, val) + if val := resp.Header.Get("x-ms-file-parent-id"); val != "" { + result.ParentID = &val + } + if val := resp.Header.Get("x-ms-file-permission-key"); val != "" { + result.FilePermissionKey = &val + } + if val := resp.Header.Get("x-ms-request-server-encrypted"); val != "" { + isServerEncrypted, err := strconv.ParseBool(val) if err != nil { return DirectoryClientCreateResponse{}, err } - result.FileChangeTime = &fileChangeTime + result.IsServerEncrypted = &isServerEncrypted } - if val := resp.Header.Get("x-ms-file-id"); val != "" { - result.ID = &val + if val := resp.Header.Get("Last-Modified"); val != "" { + lastModified, err := time.Parse(time.RFC1123, val) + if err != nil { + return DirectoryClientCreateResponse{}, err + } + result.LastModified = &lastModified } - if val := resp.Header.Get("x-ms-file-parent-id"); val != "" { - result.ParentID = &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 } @@ -175,18 +177,21 @@ func (client *DirectoryClient) createHandleResponse(resp *http.Response) (Direct // Generated from API version 2023-11-03 // - options - DirectoryClientDeleteOptions contains the optional parameters for the DirectoryClient.Delete method. func (client *DirectoryClient) Delete(ctx context.Context, options *DirectoryClientDeleteOptions) (DirectoryClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, options) if err != nil { return DirectoryClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DirectoryClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted) { - return DirectoryClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return DirectoryClientDeleteResponse{}, err } - return client.deleteHandleResponse(resp) + resp, err := client.deleteHandleResponse(httpResp) + return resp, err } // deleteCreateRequest creates the Delete request. @@ -215,12 +220,6 @@ func (client *DirectoryClient) deleteCreateRequest(ctx context.Context, options // deleteHandleResponse handles the Delete response. func (client *DirectoryClient) deleteHandleResponse(resp *http.Response) (DirectoryClientDeleteResponse, error) { result := DirectoryClientDeleteResponse{} - 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 { @@ -228,6 +227,12 @@ func (client *DirectoryClient) deleteHandleResponse(resp *http.Response) (Direct } 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 + } return result, nil } @@ -240,18 +245,21 @@ func (client *DirectoryClient) deleteHandleResponse(resp *http.Response) (Direct // - options - DirectoryClientForceCloseHandlesOptions contains the optional parameters for the DirectoryClient.ForceCloseHandles // method. func (client *DirectoryClient) ForceCloseHandles(ctx context.Context, handleID string, options *DirectoryClientForceCloseHandlesOptions) (DirectoryClientForceCloseHandlesResponse, error) { + var err error req, err := client.forceCloseHandlesCreateRequest(ctx, handleID, options) if err != nil { return DirectoryClientForceCloseHandlesResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DirectoryClientForceCloseHandlesResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DirectoryClientForceCloseHandlesResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DirectoryClientForceCloseHandlesResponse{}, err } - return client.forceCloseHandlesHandleResponse(resp) + resp, err := client.forceCloseHandlesHandleResponse(httpResp) + return resp, err } // forceCloseHandlesCreateRequest creates the ForceCloseHandles request. @@ -290,12 +298,6 @@ func (client *DirectoryClient) forceCloseHandlesCreateRequest(ctx context.Contex // forceCloseHandlesHandleResponse handles the ForceCloseHandles response. func (client *DirectoryClient) forceCloseHandlesHandleResponse(resp *http.Response) (DirectoryClientForceCloseHandlesResponse, error) { result := DirectoryClientForceCloseHandlesResponse{} - 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 { @@ -322,6 +324,12 @@ func (client *DirectoryClient) forceCloseHandlesHandleResponse(resp *http.Respon } result.NumberOfHandlesFailedToClose = &numberOfHandlesFailedToClose } + 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 } @@ -333,18 +341,21 @@ func (client *DirectoryClient) forceCloseHandlesHandleResponse(resp *http.Respon // Generated from API version 2023-11-03 // - options - DirectoryClientGetPropertiesOptions contains the optional parameters for the DirectoryClient.GetProperties method. func (client *DirectoryClient) GetProperties(ctx context.Context, options *DirectoryClientGetPropertiesOptions) (DirectoryClientGetPropertiesResponse, error) { + var err error req, err := client.getPropertiesCreateRequest(ctx, options) if err != nil { return DirectoryClientGetPropertiesResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DirectoryClientGetPropertiesResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DirectoryClientGetPropertiesResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DirectoryClientGetPropertiesResponse{}, err } - return client.getPropertiesHandleResponse(resp) + resp, err := client.getPropertiesHandleResponse(httpResp) + return resp, err } // getPropertiesCreateRequest creates the GetProperties request. @@ -376,30 +387,6 @@ func (client *DirectoryClient) getPropertiesCreateRequest(ctx context.Context, o // getPropertiesHandleResponse handles the GetProperties response. func (client *DirectoryClient) getPropertiesHandleResponse(resp *http.Response) (DirectoryClientGetPropertiesResponse, error) { result := DirectoryClientGetPropertiesResponse{} - for hh := range resp.Header { - if len(hh) > len("x-ms-meta-") && strings.EqualFold(hh[:len("x-ms-meta-")], "x-ms-meta-") { - if result.Metadata == nil { - result.Metadata = map[string]*string{} - } - result.Metadata[hh[len("x-ms-meta-"):]] = to.Ptr(resp.Header.Get(hh)) - } - } - if val := resp.Header.Get("ETag"); val != "" { - result.ETag = (*azcore.ETag)(&val) - } - if val := resp.Header.Get("Last-Modified"); val != "" { - lastModified, err := time.Parse(time.RFC1123, val) - if err != nil { - return DirectoryClientGetPropertiesResponse{}, 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("Date"); val != "" { date, err := time.Parse(time.RFC1123, val) if err != nil { @@ -407,16 +394,19 @@ func (client *DirectoryClient) getPropertiesHandleResponse(resp *http.Response) } result.Date = &date } - if val := resp.Header.Get("x-ms-server-encrypted"); val != "" { - isServerEncrypted, err := strconv.ParseBool(val) - if err != nil { - return DirectoryClientGetPropertiesResponse{}, err - } - result.IsServerEncrypted = &isServerEncrypted + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = (*azcore.ETag)(&val) } if val := resp.Header.Get("x-ms-file-attributes"); val != "" { result.FileAttributes = &val } + if val := resp.Header.Get("x-ms-file-change-time"); val != "" { + fileChangeTime, err := time.Parse(ISO8601, val) + if err != nil { + return DirectoryClientGetPropertiesResponse{}, err + } + result.FileChangeTime = &fileChangeTime + } if val := resp.Header.Get("x-ms-file-creation-time"); val != "" { fileCreationTime, err := time.Parse(ISO8601, val) if err != nil { @@ -424,6 +414,9 @@ func (client *DirectoryClient) getPropertiesHandleResponse(resp *http.Response) } result.FileCreationTime = &fileCreationTime } + if val := resp.Header.Get("x-ms-file-id"); val != "" { + result.ID = &val + } if val := resp.Header.Get("x-ms-file-last-write-time"); val != "" { fileLastWriteTime, err := time.Parse(ISO8601, val) if err != nil { @@ -431,21 +424,39 @@ func (client *DirectoryClient) getPropertiesHandleResponse(resp *http.Response) } result.FileLastWriteTime = &fileLastWriteTime } - if val := resp.Header.Get("x-ms-file-change-time"); val != "" { - fileChangeTime, err := time.Parse(ISO8601, val) + if val := resp.Header.Get("x-ms-file-parent-id"); val != "" { + result.ParentID = &val + } + if val := resp.Header.Get("x-ms-file-permission-key"); val != "" { + result.FilePermissionKey = &val + } + if val := resp.Header.Get("x-ms-server-encrypted"); val != "" { + isServerEncrypted, err := strconv.ParseBool(val) if err != nil { return DirectoryClientGetPropertiesResponse{}, err } - result.FileChangeTime = &fileChangeTime + result.IsServerEncrypted = &isServerEncrypted } - if val := resp.Header.Get("x-ms-file-permission-key"); val != "" { - result.FilePermissionKey = &val + if val := resp.Header.Get("Last-Modified"); val != "" { + lastModified, err := time.Parse(time.RFC1123, val) + if err != nil { + return DirectoryClientGetPropertiesResponse{}, err + } + result.LastModified = &lastModified } - if val := resp.Header.Get("x-ms-file-id"); val != "" { - result.ID = &val + for hh := range resp.Header { + if len(hh) > len("x-ms-meta-") && strings.EqualFold(hh[:len("x-ms-meta-")], "x-ms-meta-") { + if result.Metadata == nil { + result.Metadata = map[string]*string{} + } + result.Metadata[hh[len("x-ms-meta-"):]] = to.Ptr(resp.Header.Get(hh)) + } } - if val := resp.Header.Get("x-ms-file-parent-id"); val != "" { - result.ParentID = &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 } @@ -505,12 +516,6 @@ func (client *DirectoryClient) ListFilesAndDirectoriesSegmentHandleResponse(resp if val := resp.Header.Get("Content-Type"); val != "" { result.ContentType = &val } - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.RequestID = &val - } - if val := resp.Header.Get("x-ms-version"); val != "" { - result.Version = &val - } if val := resp.Header.Get("Date"); val != "" { date, err := time.Parse(time.RFC1123, val) if err != nil { @@ -518,6 +523,12 @@ func (client *DirectoryClient) ListFilesAndDirectoriesSegmentHandleResponse(resp } result.Date = &date } + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.RequestID = &val + } + if val := resp.Header.Get("x-ms-version"); val != "" { + result.Version = &val + } if err := runtime.UnmarshalAsXML(resp, &result.ListFilesAndDirectoriesSegmentResponse); err != nil { return DirectoryClientListFilesAndDirectoriesSegmentResponse{}, err } @@ -530,18 +541,21 @@ func (client *DirectoryClient) ListFilesAndDirectoriesSegmentHandleResponse(resp // Generated from API version 2023-11-03 // - options - DirectoryClientListHandlesOptions contains the optional parameters for the DirectoryClient.ListHandles method. func (client *DirectoryClient) ListHandles(ctx context.Context, options *DirectoryClientListHandlesOptions) (DirectoryClientListHandlesResponse, error) { + var err error req, err := client.listHandlesCreateRequest(ctx, options) if err != nil { return DirectoryClientListHandlesResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DirectoryClientListHandlesResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DirectoryClientListHandlesResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DirectoryClientListHandlesResponse{}, err } - return client.listHandlesHandleResponse(resp) + resp, err := client.listHandlesHandleResponse(httpResp) + return resp, err } // listHandlesCreateRequest creates the ListHandles request. @@ -585,12 +599,6 @@ func (client *DirectoryClient) listHandlesHandleResponse(resp *http.Response) (D if val := resp.Header.Get("Content-Type"); val != "" { result.ContentType = &val } - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.RequestID = &val - } - if val := resp.Header.Get("x-ms-version"); val != "" { - result.Version = &val - } if val := resp.Header.Get("Date"); val != "" { date, err := time.Parse(time.RFC1123, val) if err != nil { @@ -598,6 +606,12 @@ func (client *DirectoryClient) listHandlesHandleResponse(resp *http.Response) (D } result.Date = &date } + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.RequestID = &val + } + if val := resp.Header.Get("x-ms-version"); val != "" { + result.Version = &val + } if err := runtime.UnmarshalAsXML(resp, &result.ListHandlesResponse); err != nil { return DirectoryClientListHandlesResponse{}, err } @@ -616,18 +630,21 @@ func (client *DirectoryClient) listHandlesHandleResponse(resp *http.Response) (D // method. // - CopyFileSMBInfo - CopyFileSMBInfo contains a group of parameters for the DirectoryClient.Rename method. func (client *DirectoryClient) Rename(ctx context.Context, renameSource string, options *DirectoryClientRenameOptions, sourceLeaseAccessConditions *SourceLeaseAccessConditions, destinationLeaseAccessConditions *DestinationLeaseAccessConditions, copyFileSMBInfo *CopyFileSMBInfo) (DirectoryClientRenameResponse, error) { + var err error req, err := client.renameCreateRequest(ctx, renameSource, options, sourceLeaseAccessConditions, destinationLeaseAccessConditions, copyFileSMBInfo) if err != nil { return DirectoryClientRenameResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DirectoryClientRenameResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DirectoryClientRenameResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DirectoryClientRenameResponse{}, err } - return client.renameHandleResponse(resp) + resp, err := client.renameHandleResponse(httpResp) + return resp, err } // renameCreateRequest creates the Rename request. @@ -698,22 +715,6 @@ func (client *DirectoryClient) renameCreateRequest(ctx context.Context, renameSo // renameHandleResponse handles the Rename response. func (client *DirectoryClient) renameHandleResponse(resp *http.Response) (DirectoryClientRenameResponse, error) { result := DirectoryClientRenameResponse{} - if val := resp.Header.Get("ETag"); val != "" { - result.ETag = (*azcore.ETag)(&val) - } - if val := resp.Header.Get("Last-Modified"); val != "" { - lastModified, err := time.Parse(time.RFC1123, val) - if err != nil { - return DirectoryClientRenameResponse{}, 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("Date"); val != "" { date, err := time.Parse(time.RFC1123, val) if err != nil { @@ -721,19 +722,19 @@ func (client *DirectoryClient) renameHandleResponse(resp *http.Response) (Direct } result.Date = &date } - if val := resp.Header.Get("x-ms-request-server-encrypted"); val != "" { - isServerEncrypted, err := strconv.ParseBool(val) - if err != nil { - return DirectoryClientRenameResponse{}, err - } - result.IsServerEncrypted = &isServerEncrypted - } - if val := resp.Header.Get("x-ms-file-permission-key"); val != "" { - result.FilePermissionKey = &val + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = (*azcore.ETag)(&val) } if val := resp.Header.Get("x-ms-file-attributes"); val != "" { result.FileAttributes = &val } + if val := resp.Header.Get("x-ms-file-change-time"); val != "" { + fileChangeTime, err := time.Parse(ISO8601, val) + if err != nil { + return DirectoryClientRenameResponse{}, err + } + result.FileChangeTime = &fileChangeTime + } if val := resp.Header.Get("x-ms-file-creation-time"); val != "" { fileCreationTime, err := time.Parse(ISO8601, val) if err != nil { @@ -741,6 +742,9 @@ func (client *DirectoryClient) renameHandleResponse(resp *http.Response) (Direct } result.FileCreationTime = &fileCreationTime } + if val := resp.Header.Get("x-ms-file-id"); val != "" { + result.ID = &val + } if val := resp.Header.Get("x-ms-file-last-write-time"); val != "" { fileLastWriteTime, err := time.Parse(ISO8601, val) if err != nil { @@ -748,18 +752,31 @@ func (client *DirectoryClient) renameHandleResponse(resp *http.Response) (Direct } result.FileLastWriteTime = &fileLastWriteTime } - if val := resp.Header.Get("x-ms-file-change-time"); val != "" { - fileChangeTime, err := time.Parse(ISO8601, val) + if val := resp.Header.Get("x-ms-file-parent-id"); val != "" { + result.ParentID = &val + } + if val := resp.Header.Get("x-ms-file-permission-key"); val != "" { + result.FilePermissionKey = &val + } + if val := resp.Header.Get("x-ms-request-server-encrypted"); val != "" { + isServerEncrypted, err := strconv.ParseBool(val) if err != nil { return DirectoryClientRenameResponse{}, err } - result.FileChangeTime = &fileChangeTime + result.IsServerEncrypted = &isServerEncrypted } - if val := resp.Header.Get("x-ms-file-id"); val != "" { - result.ID = &val + if val := resp.Header.Get("Last-Modified"); val != "" { + lastModified, err := time.Parse(time.RFC1123, val) + if err != nil { + return DirectoryClientRenameResponse{}, err + } + result.LastModified = &lastModified } - if val := resp.Header.Get("x-ms-file-parent-id"); val != "" { - result.ParentID = &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 } @@ -770,18 +787,21 @@ func (client *DirectoryClient) renameHandleResponse(resp *http.Response) (Direct // Generated from API version 2023-11-03 // - options - DirectoryClientSetMetadataOptions contains the optional parameters for the DirectoryClient.SetMetadata method. func (client *DirectoryClient) SetMetadata(ctx context.Context, options *DirectoryClientSetMetadataOptions) (DirectoryClientSetMetadataResponse, error) { + var err error req, err := client.setMetadataCreateRequest(ctx, options) if err != nil { return DirectoryClientSetMetadataResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DirectoryClientSetMetadataResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DirectoryClientSetMetadataResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DirectoryClientSetMetadataResponse{}, err } - return client.setMetadataHandleResponse(resp) + resp, err := client.setMetadataHandleResponse(httpResp) + return resp, err } // setMetadataCreateRequest creates the SetMetadata request. @@ -818,15 +838,6 @@ func (client *DirectoryClient) setMetadataCreateRequest(ctx context.Context, opt // setMetadataHandleResponse handles the SetMetadata response. func (client *DirectoryClient) setMetadataHandleResponse(resp *http.Response) (DirectoryClientSetMetadataResponse, error) { result := DirectoryClientSetMetadataResponse{} - if val := resp.Header.Get("ETag"); val != "" { - result.ETag = (*azcore.ETag)(&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 { @@ -834,6 +845,9 @@ func (client *DirectoryClient) setMetadataHandleResponse(resp *http.Response) (D } result.Date = &date } + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = (*azcore.ETag)(&val) + } if val := resp.Header.Get("x-ms-request-server-encrypted"); val != "" { isServerEncrypted, err := strconv.ParseBool(val) if err != nil { @@ -841,6 +855,12 @@ func (client *DirectoryClient) setMetadataHandleResponse(resp *http.Response) (D } result.IsServerEncrypted = &isServerEncrypted } + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.RequestID = &val + } + if val := resp.Header.Get("x-ms-version"); val != "" { + result.Version = &val + } return result, nil } @@ -850,18 +870,21 @@ func (client *DirectoryClient) setMetadataHandleResponse(resp *http.Response) (D // Generated from API version 2023-11-03 // - options - DirectoryClientSetPropertiesOptions contains the optional parameters for the DirectoryClient.SetProperties method. func (client *DirectoryClient) SetProperties(ctx context.Context, options *DirectoryClientSetPropertiesOptions) (DirectoryClientSetPropertiesResponse, error) { + var err error req, err := client.setPropertiesCreateRequest(ctx, options) if err != nil { return DirectoryClientSetPropertiesResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DirectoryClientSetPropertiesResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DirectoryClientSetPropertiesResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DirectoryClientSetPropertiesResponse{}, err } - return client.setPropertiesHandleResponse(resp) + resp, err := client.setPropertiesHandleResponse(httpResp) + return resp, err } // setPropertiesCreateRequest creates the SetProperties request. @@ -909,22 +932,6 @@ func (client *DirectoryClient) setPropertiesCreateRequest(ctx context.Context, o // setPropertiesHandleResponse handles the SetProperties response. func (client *DirectoryClient) setPropertiesHandleResponse(resp *http.Response) (DirectoryClientSetPropertiesResponse, error) { result := DirectoryClientSetPropertiesResponse{} - if val := resp.Header.Get("ETag"); val != "" { - result.ETag = (*azcore.ETag)(&val) - } - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.RequestID = &val - } - if val := resp.Header.Get("Last-Modified"); val != "" { - lastModified, err := time.Parse(time.RFC1123, val) - if err != nil { - return DirectoryClientSetPropertiesResponse{}, err - } - result.LastModified = &lastModified - } - 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 { @@ -932,19 +939,19 @@ func (client *DirectoryClient) setPropertiesHandleResponse(resp *http.Response) } result.Date = &date } - if val := resp.Header.Get("x-ms-request-server-encrypted"); val != "" { - isServerEncrypted, err := strconv.ParseBool(val) - if err != nil { - return DirectoryClientSetPropertiesResponse{}, err - } - result.IsServerEncrypted = &isServerEncrypted - } - if val := resp.Header.Get("x-ms-file-permission-key"); val != "" { - result.FilePermissionKey = &val + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = (*azcore.ETag)(&val) } if val := resp.Header.Get("x-ms-file-attributes"); val != "" { result.FileAttributes = &val } + if val := resp.Header.Get("x-ms-file-change-time"); val != "" { + fileChangeTime, err := time.Parse(ISO8601, val) + if err != nil { + return DirectoryClientSetPropertiesResponse{}, err + } + result.FileChangeTime = &fileChangeTime + } if val := resp.Header.Get("x-ms-file-creation-time"); val != "" { fileCreationTime, err := time.Parse(ISO8601, val) if err != nil { @@ -952,6 +959,9 @@ func (client *DirectoryClient) setPropertiesHandleResponse(resp *http.Response) } result.FileCreationTime = &fileCreationTime } + if val := resp.Header.Get("x-ms-file-id"); val != "" { + result.ID = &val + } if val := resp.Header.Get("x-ms-file-last-write-time"); val != "" { fileLastWriteTime, err := time.Parse(ISO8601, val) if err != nil { @@ -959,18 +969,31 @@ func (client *DirectoryClient) setPropertiesHandleResponse(resp *http.Response) } result.FileLastWriteTime = &fileLastWriteTime } - if val := resp.Header.Get("x-ms-file-change-time"); val != "" { - fileChangeTime, err := time.Parse(ISO8601, val) + if val := resp.Header.Get("x-ms-file-parent-id"); val != "" { + result.ParentID = &val + } + if val := resp.Header.Get("x-ms-file-permission-key"); val != "" { + result.FilePermissionKey = &val + } + if val := resp.Header.Get("x-ms-request-server-encrypted"); val != "" { + isServerEncrypted, err := strconv.ParseBool(val) if err != nil { return DirectoryClientSetPropertiesResponse{}, err } - result.FileChangeTime = &fileChangeTime + result.IsServerEncrypted = &isServerEncrypted } - if val := resp.Header.Get("x-ms-file-id"); val != "" { - result.ID = &val + if val := resp.Header.Get("Last-Modified"); val != "" { + lastModified, err := time.Parse(time.RFC1123, val) + if err != nil { + return DirectoryClientSetPropertiesResponse{}, err + } + result.LastModified = &lastModified } - if val := resp.Header.Get("x-ms-file-parent-id"); val != "" { - result.ParentID = &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 } diff --git a/sdk/storage/azfile/internal/generated/zz_file_client.go b/sdk/storage/azfile/internal/generated/zz_file_client.go index be104c8e1aa0..e8ce03fd2d10 100644 --- a/sdk/storage/azfile/internal/generated/zz_file_client.go +++ b/sdk/storage/azfile/internal/generated/zz_file_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package generated @@ -41,18 +40,21 @@ type FileClient struct { // - options - FileClientAbortCopyOptions contains the optional parameters for the FileClient.AbortCopy method. // - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ShareClient.GetProperties method. func (client *FileClient) AbortCopy(ctx context.Context, copyID string, options *FileClientAbortCopyOptions, leaseAccessConditions *LeaseAccessConditions) (FileClientAbortCopyResponse, error) { + var err error req, err := client.abortCopyCreateRequest(ctx, copyID, options, leaseAccessConditions) if err != nil { return FileClientAbortCopyResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return FileClientAbortCopyResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusNoContent) { - return FileClientAbortCopyResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return FileClientAbortCopyResponse{}, err } - return client.abortCopyHandleResponse(resp) + resp, err := client.abortCopyHandleResponse(httpResp) + return resp, err } // abortCopyCreateRequest creates the AbortCopy request. @@ -86,12 +88,6 @@ func (client *FileClient) abortCopyCreateRequest(ctx context.Context, copyID str // abortCopyHandleResponse handles the AbortCopy response. func (client *FileClient) abortCopyHandleResponse(resp *http.Response) (FileClientAbortCopyResponse, error) { result := FileClientAbortCopyResponse{} - 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 { @@ -99,6 +95,12 @@ func (client *FileClient) abortCopyHandleResponse(resp *http.Response) (FileClie } 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 + } return result, nil } @@ -111,18 +113,21 @@ func (client *FileClient) abortCopyHandleResponse(resp *http.Response) (FileClie // renew or change. // - options - FileClientAcquireLeaseOptions contains the optional parameters for the FileClient.AcquireLease method. func (client *FileClient) AcquireLease(ctx context.Context, duration int32, options *FileClientAcquireLeaseOptions) (FileClientAcquireLeaseResponse, error) { + var err error req, err := client.acquireLeaseCreateRequest(ctx, duration, options) if err != nil { return FileClientAcquireLeaseResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return FileClientAcquireLeaseResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusCreated) { - return FileClientAcquireLeaseResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return FileClientAcquireLeaseResponse{}, err } - return client.acquireLeaseHandleResponse(resp) + resp, err := client.acquireLeaseHandleResponse(httpResp) + return resp, err } // acquireLeaseCreateRequest creates the AcquireLease request. @@ -159,6 +164,16 @@ func (client *FileClient) acquireLeaseCreateRequest(ctx context.Context, duratio // acquireLeaseHandleResponse handles the AcquireLease response. func (client *FileClient) acquireLeaseHandleResponse(resp *http.Response) (FileClientAcquireLeaseResponse, error) { result := FileClientAcquireLeaseResponse{} + if val := resp.Header.Get("x-ms-client-request-id"); val != "" { + result.ClientRequestID = &val + } + if val := resp.Header.Get("Date"); val != "" { + date, err := time.Parse(time.RFC1123, val) + if err != nil { + return FileClientAcquireLeaseResponse{}, err + } + result.Date = &date + } if val := resp.Header.Get("ETag"); val != "" { result.ETag = (*azcore.ETag)(&val) } @@ -172,22 +187,12 @@ func (client *FileClient) acquireLeaseHandleResponse(resp *http.Response) (FileC if val := resp.Header.Get("x-ms-lease-id"); val != "" { result.LeaseID = &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 FileClientAcquireLeaseResponse{}, err - } - result.Date = &date - } return result, nil } @@ -198,18 +203,21 @@ func (client *FileClient) acquireLeaseHandleResponse(resp *http.Response) (FileC // - options - FileClientBreakLeaseOptions contains the optional parameters for the FileClient.BreakLease method. // - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ShareClient.GetProperties method. func (client *FileClient) BreakLease(ctx context.Context, options *FileClientBreakLeaseOptions, leaseAccessConditions *LeaseAccessConditions) (FileClientBreakLeaseResponse, error) { + var err error req, err := client.breakLeaseCreateRequest(ctx, options, leaseAccessConditions) if err != nil { return FileClientBreakLeaseResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return FileClientBreakLeaseResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted) { - return FileClientBreakLeaseResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return FileClientBreakLeaseResponse{}, err } - return client.breakLeaseHandleResponse(resp) + resp, err := client.breakLeaseHandleResponse(httpResp) + return resp, err } // breakLeaseCreateRequest creates the BreakLease request. @@ -245,6 +253,16 @@ func (client *FileClient) breakLeaseCreateRequest(ctx context.Context, options * // breakLeaseHandleResponse handles the BreakLease response. func (client *FileClient) breakLeaseHandleResponse(resp *http.Response) (FileClientBreakLeaseResponse, error) { result := FileClientBreakLeaseResponse{} + if val := resp.Header.Get("x-ms-client-request-id"); val != "" { + result.ClientRequestID = &val + } + if val := resp.Header.Get("Date"); val != "" { + date, err := time.Parse(time.RFC1123, val) + if err != nil { + return FileClientBreakLeaseResponse{}, err + } + result.Date = &date + } if val := resp.Header.Get("ETag"); val != "" { result.ETag = (*azcore.ETag)(&val) } @@ -258,22 +276,12 @@ func (client *FileClient) breakLeaseHandleResponse(resp *http.Response) (FileCli if val := resp.Header.Get("x-ms-lease-id"); val != "" { result.LeaseID = &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 FileClientBreakLeaseResponse{}, err - } - result.Date = &date - } return result, nil } @@ -284,18 +292,21 @@ func (client *FileClient) breakLeaseHandleResponse(resp *http.Response) (FileCli // - leaseID - Specifies the current lease ID on the resource. // - options - FileClientChangeLeaseOptions contains the optional parameters for the FileClient.ChangeLease method. func (client *FileClient) ChangeLease(ctx context.Context, leaseID string, options *FileClientChangeLeaseOptions) (FileClientChangeLeaseResponse, error) { + var err error req, err := client.changeLeaseCreateRequest(ctx, leaseID, options) if err != nil { return FileClientChangeLeaseResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return FileClientChangeLeaseResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return FileClientChangeLeaseResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FileClientChangeLeaseResponse{}, err } - return client.changeLeaseHandleResponse(resp) + resp, err := client.changeLeaseHandleResponse(httpResp) + return resp, err } // changeLeaseCreateRequest creates the ChangeLease request. @@ -332,6 +343,16 @@ func (client *FileClient) changeLeaseCreateRequest(ctx context.Context, leaseID // changeLeaseHandleResponse handles the ChangeLease response. func (client *FileClient) changeLeaseHandleResponse(resp *http.Response) (FileClientChangeLeaseResponse, error) { result := FileClientChangeLeaseResponse{} + if val := resp.Header.Get("x-ms-client-request-id"); val != "" { + result.ClientRequestID = &val + } + if val := resp.Header.Get("Date"); val != "" { + date, err := time.Parse(time.RFC1123, val) + if err != nil { + return FileClientChangeLeaseResponse{}, err + } + result.Date = &date + } if val := resp.Header.Get("ETag"); val != "" { result.ETag = (*azcore.ETag)(&val) } @@ -345,22 +366,12 @@ func (client *FileClient) changeLeaseHandleResponse(resp *http.Response) (FileCl if val := resp.Header.Get("x-ms-lease-id"); val != "" { result.LeaseID = &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 FileClientChangeLeaseResponse{}, err - } - result.Date = &date - } return result, nil } @@ -373,18 +384,21 @@ func (client *FileClient) changeLeaseHandleResponse(resp *http.Response) (FileCl // - ShareFileHTTPHeaders - ShareFileHTTPHeaders contains a group of parameters for the FileClient.Create method. // - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ShareClient.GetProperties method. func (client *FileClient) Create(ctx context.Context, fileContentLength int64, options *FileClientCreateOptions, shareFileHTTPHeaders *ShareFileHTTPHeaders, leaseAccessConditions *LeaseAccessConditions) (FileClientCreateResponse, error) { + var err error req, err := client.createCreateRequest(ctx, fileContentLength, options, shareFileHTTPHeaders, leaseAccessConditions) if err != nil { return FileClientCreateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return FileClientCreateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusCreated) { - return FileClientCreateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return FileClientCreateResponse{}, err } - return client.createHandleResponse(resp) + resp, err := client.createHandleResponse(httpResp) + return resp, err } // createCreateRequest creates the Create request. @@ -460,22 +474,6 @@ func (client *FileClient) createCreateRequest(ctx context.Context, fileContentLe // createHandleResponse handles the Create response. func (client *FileClient) createHandleResponse(resp *http.Response) (FileClientCreateResponse, error) { result := FileClientCreateResponse{} - if val := resp.Header.Get("ETag"); val != "" { - result.ETag = (*azcore.ETag)(&val) - } - if val := resp.Header.Get("Last-Modified"); val != "" { - lastModified, err := time.Parse(time.RFC1123, val) - if err != nil { - return FileClientCreateResponse{}, 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("Date"); val != "" { date, err := time.Parse(time.RFC1123, val) if err != nil { @@ -483,19 +481,19 @@ func (client *FileClient) createHandleResponse(resp *http.Response) (FileClientC } result.Date = &date } - if val := resp.Header.Get("x-ms-request-server-encrypted"); val != "" { - isServerEncrypted, err := strconv.ParseBool(val) - if err != nil { - return FileClientCreateResponse{}, err - } - result.IsServerEncrypted = &isServerEncrypted - } - if val := resp.Header.Get("x-ms-file-permission-key"); val != "" { - result.FilePermissionKey = &val + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = (*azcore.ETag)(&val) } if val := resp.Header.Get("x-ms-file-attributes"); val != "" { result.FileAttributes = &val } + if val := resp.Header.Get("x-ms-file-change-time"); val != "" { + fileChangeTime, err := time.Parse(ISO8601, val) + if err != nil { + return FileClientCreateResponse{}, err + } + result.FileChangeTime = &fileChangeTime + } if val := resp.Header.Get("x-ms-file-creation-time"); val != "" { fileCreationTime, err := time.Parse(ISO8601, val) if err != nil { @@ -503,6 +501,9 @@ func (client *FileClient) createHandleResponse(resp *http.Response) (FileClientC } result.FileCreationTime = &fileCreationTime } + if val := resp.Header.Get("x-ms-file-id"); val != "" { + result.ID = &val + } if val := resp.Header.Get("x-ms-file-last-write-time"); val != "" { fileLastWriteTime, err := time.Parse(ISO8601, val) if err != nil { @@ -510,18 +511,31 @@ func (client *FileClient) createHandleResponse(resp *http.Response) (FileClientC } result.FileLastWriteTime = &fileLastWriteTime } - if val := resp.Header.Get("x-ms-file-change-time"); val != "" { - fileChangeTime, err := time.Parse(ISO8601, val) + if val := resp.Header.Get("x-ms-file-parent-id"); val != "" { + result.ParentID = &val + } + if val := resp.Header.Get("x-ms-file-permission-key"); val != "" { + result.FilePermissionKey = &val + } + if val := resp.Header.Get("x-ms-request-server-encrypted"); val != "" { + isServerEncrypted, err := strconv.ParseBool(val) if err != nil { return FileClientCreateResponse{}, err } - result.FileChangeTime = &fileChangeTime + result.IsServerEncrypted = &isServerEncrypted } - if val := resp.Header.Get("x-ms-file-id"); val != "" { - result.ID = &val + if val := resp.Header.Get("Last-Modified"); val != "" { + lastModified, err := time.Parse(time.RFC1123, val) + if err != nil { + return FileClientCreateResponse{}, err + } + result.LastModified = &lastModified } - if val := resp.Header.Get("x-ms-file-parent-id"); val != "" { - result.ParentID = &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 } @@ -533,18 +547,21 @@ func (client *FileClient) createHandleResponse(resp *http.Response) (FileClientC // - options - FileClientDeleteOptions contains the optional parameters for the FileClient.Delete method. // - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ShareClient.GetProperties method. func (client *FileClient) Delete(ctx context.Context, options *FileClientDeleteOptions, leaseAccessConditions *LeaseAccessConditions) (FileClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, options, leaseAccessConditions) if err != nil { return FileClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return FileClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted) { - return FileClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return FileClientDeleteResponse{}, err } - return client.deleteHandleResponse(resp) + resp, err := client.deleteHandleResponse(httpResp) + return resp, err } // deleteCreateRequest creates the Delete request. @@ -575,12 +592,6 @@ func (client *FileClient) deleteCreateRequest(ctx context.Context, options *File // deleteHandleResponse handles the Delete response. func (client *FileClient) deleteHandleResponse(resp *http.Response) (FileClientDeleteResponse, error) { result := FileClientDeleteResponse{} - 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 { @@ -588,6 +599,12 @@ func (client *FileClient) deleteHandleResponse(resp *http.Response) (FileClientD } 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 + } return result, nil } @@ -598,18 +615,21 @@ func (client *FileClient) deleteHandleResponse(resp *http.Response) (FileClientD // - options - FileClientDownloadOptions contains the optional parameters for the FileClient.Download method. // - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ShareClient.GetProperties method. func (client *FileClient) Download(ctx context.Context, options *FileClientDownloadOptions, leaseAccessConditions *LeaseAccessConditions) (FileClientDownloadResponse, error) { + var err error req, err := client.downloadCreateRequest(ctx, options, leaseAccessConditions) if err != nil { return FileClientDownloadResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return FileClientDownloadResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusPartialContent) { - return FileClientDownloadResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusPartialContent) { + err = runtime.NewResponseError(httpResp) + return FileClientDownloadResponse{}, err } - return client.downloadHandleResponse(resp) + resp, err := client.downloadHandleResponse(httpResp) + return resp, err } // downloadCreateRequest creates the Download request. @@ -647,20 +667,20 @@ func (client *FileClient) downloadCreateRequest(ctx context.Context, options *Fi // downloadHandleResponse handles the Download response. func (client *FileClient) downloadHandleResponse(resp *http.Response) (FileClientDownloadResponse, error) { result := FileClientDownloadResponse{Body: resp.Body} - if val := resp.Header.Get("Last-Modified"); val != "" { - lastModified, err := time.Parse(time.RFC1123, val) - if err != nil { - return FileClientDownloadResponse{}, err - } - result.LastModified = &lastModified + if val := resp.Header.Get("Accept-Ranges"); val != "" { + result.AcceptRanges = &val } - for hh := range resp.Header { - if len(hh) > len("x-ms-meta-") && strings.EqualFold(hh[:len("x-ms-meta-")], "x-ms-meta-") { - if result.Metadata == nil { - result.Metadata = map[string]*string{} - } - result.Metadata[hh[len("x-ms-meta-"):]] = to.Ptr(resp.Header.Get(hh)) - } + 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) @@ -669,15 +689,6 @@ func (client *FileClient) downloadHandleResponse(resp *http.Response) (FileClien } result.ContentLength = &contentLength } - if val := resp.Header.Get("Content-Type"); val != "" { - result.ContentType = &val - } - if val := resp.Header.Get("Content-Range"); val != "" { - result.ContentRange = &val - } - if val := resp.Header.Get("ETag"); val != "" { - result.ETag = (*azcore.ETag)(&val) - } if val := resp.Header.Get("Content-MD5"); val != "" { contentMD5, err := base64.StdEncoding.DecodeString(val) if err != nil { @@ -685,33 +696,11 @@ func (client *FileClient) downloadHandleResponse(resp *http.Response) (FileClien } result.ContentMD5 = contentMD5 } - if val := resp.Header.Get("Content-Encoding"); val != "" { - result.ContentEncoding = &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-Language"); val != "" { - result.ContentLanguage = &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("Accept-Ranges"); val != "" { - result.AcceptRanges = &val + if val := resp.Header.Get("Content-Range"); val != "" { + result.ContentRange = &val } - if val := resp.Header.Get("Date"); val != "" { - date, err := time.Parse(time.RFC1123, val) - if err != nil { - return FileClientDownloadResponse{}, err - } - result.Date = &date + if val := resp.Header.Get("Content-Type"); val != "" { + result.ContentType = &val } if val := resp.Header.Get("x-ms-copy-completion-time"); val != "" { copyCompletionTime, err := time.Parse(time.RFC1123, val) @@ -720,9 +709,6 @@ func (client *FileClient) downloadHandleResponse(resp *http.Response) (FileClien } result.CopyCompletionTime = ©CompletionTime } - if val := resp.Header.Get("x-ms-copy-status-description"); val != "" { - result.CopyStatusDescription = &val - } if val := resp.Header.Get("x-ms-copy-id"); val != "" { result.CopyID = &val } @@ -735,22 +721,35 @@ func (client *FileClient) downloadHandleResponse(resp *http.Response) (FileClien if val := resp.Header.Get("x-ms-copy-status"); val != "" { result.CopyStatus = (*CopyStatusType)(&val) } - if val := resp.Header.Get("x-ms-content-md5"); val != "" { - fileContentMD5, err := base64.StdEncoding.DecodeString(val) + if val := resp.Header.Get("x-ms-copy-status-description"); val != "" { + result.CopyStatusDescription = &val + } + if val := resp.Header.Get("Date"); val != "" { + date, err := time.Parse(time.RFC1123, val) if err != nil { return FileClientDownloadResponse{}, err } - result.FileContentMD5 = fileContentMD5 + result.Date = &date } - if val := resp.Header.Get("x-ms-server-encrypted"); val != "" { - isServerEncrypted, err := strconv.ParseBool(val) + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = (*azcore.ETag)(&val) + } + if val := resp.Header.Get("x-ms-file-attributes"); val != "" { + result.FileAttributes = &val + } + if val := resp.Header.Get("x-ms-file-change-time"); val != "" { + fileChangeTime, err := time.Parse(ISO8601, val) if err != nil { return FileClientDownloadResponse{}, err } - result.IsServerEncrypted = &isServerEncrypted + result.FileChangeTime = &fileChangeTime } - if val := resp.Header.Get("x-ms-file-attributes"); val != "" { - result.FileAttributes = &val + if val := resp.Header.Get("x-ms-content-md5"); val != "" { + fileContentMD5, err := base64.StdEncoding.DecodeString(val) + if err != nil { + return FileClientDownloadResponse{}, err + } + result.FileContentMD5 = fileContentMD5 } if val := resp.Header.Get("x-ms-file-creation-time"); val != "" { fileCreationTime, err := time.Parse(ISO8601, val) @@ -759,6 +758,9 @@ func (client *FileClient) downloadHandleResponse(resp *http.Response) (FileClien } result.FileCreationTime = &fileCreationTime } + if val := resp.Header.Get("x-ms-file-id"); val != "" { + result.ID = &val + } if val := resp.Header.Get("x-ms-file-last-write-time"); val != "" { fileLastWriteTime, err := time.Parse(ISO8601, val) if err != nil { @@ -766,21 +768,25 @@ func (client *FileClient) downloadHandleResponse(resp *http.Response) (FileClien } result.FileLastWriteTime = &fileLastWriteTime } - if val := resp.Header.Get("x-ms-file-change-time"); val != "" { - fileChangeTime, err := time.Parse(ISO8601, val) - if err != nil { - return FileClientDownloadResponse{}, err - } - result.FileChangeTime = &fileChangeTime + if val := resp.Header.Get("x-ms-file-parent-id"); val != "" { + result.ParentID = &val } if val := resp.Header.Get("x-ms-file-permission-key"); val != "" { result.FilePermissionKey = &val } - if val := resp.Header.Get("x-ms-file-id"); val != "" { - result.ID = &val + if val := resp.Header.Get("x-ms-server-encrypted"); val != "" { + isServerEncrypted, err := strconv.ParseBool(val) + if err != nil { + return FileClientDownloadResponse{}, err + } + result.IsServerEncrypted = &isServerEncrypted } - if val := resp.Header.Get("x-ms-file-parent-id"); val != "" { - result.ParentID = &val + if val := resp.Header.Get("Last-Modified"); val != "" { + lastModified, err := time.Parse(time.RFC1123, val) + if err != nil { + return FileClientDownloadResponse{}, err + } + result.LastModified = &lastModified } if val := resp.Header.Get("x-ms-lease-duration"); val != "" { result.LeaseDuration = (*LeaseDurationType)(&val) @@ -791,6 +797,20 @@ func (client *FileClient) downloadHandleResponse(resp *http.Response) (FileClien if val := resp.Header.Get("x-ms-lease-status"); val != "" { result.LeaseStatus = (*LeaseStatusType)(&val) } + for hh := range resp.Header { + if len(hh) > len("x-ms-meta-") && strings.EqualFold(hh[:len("x-ms-meta-")], "x-ms-meta-") { + if result.Metadata == nil { + result.Metadata = map[string]*string{} + } + result.Metadata[hh[len("x-ms-meta-"):]] = to.Ptr(resp.Header.Get(hh)) + } + } + 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 } @@ -802,18 +822,21 @@ func (client *FileClient) downloadHandleResponse(resp *http.Response) (FileClien // all handles. // - options - FileClientForceCloseHandlesOptions contains the optional parameters for the FileClient.ForceCloseHandles method. func (client *FileClient) ForceCloseHandles(ctx context.Context, handleID string, options *FileClientForceCloseHandlesOptions) (FileClientForceCloseHandlesResponse, error) { + var err error req, err := client.forceCloseHandlesCreateRequest(ctx, handleID, options) if err != nil { return FileClientForceCloseHandlesResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return FileClientForceCloseHandlesResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return FileClientForceCloseHandlesResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FileClientForceCloseHandlesResponse{}, err } - return client.forceCloseHandlesHandleResponse(resp) + resp, err := client.forceCloseHandlesHandleResponse(httpResp) + return resp, err } // forceCloseHandlesCreateRequest creates the ForceCloseHandles request. @@ -849,12 +872,6 @@ func (client *FileClient) forceCloseHandlesCreateRequest(ctx context.Context, ha // forceCloseHandlesHandleResponse handles the ForceCloseHandles response. func (client *FileClient) forceCloseHandlesHandleResponse(resp *http.Response) (FileClientForceCloseHandlesResponse, error) { result := FileClientForceCloseHandlesResponse{} - 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 { @@ -881,6 +898,12 @@ func (client *FileClient) forceCloseHandlesHandleResponse(resp *http.Response) ( } result.NumberOfHandlesFailedToClose = &numberOfHandlesFailedToClose } + 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 } @@ -892,18 +915,21 @@ func (client *FileClient) forceCloseHandlesHandleResponse(resp *http.Response) ( // - options - FileClientGetPropertiesOptions contains the optional parameters for the FileClient.GetProperties method. // - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ShareClient.GetProperties method. func (client *FileClient) GetProperties(ctx context.Context, options *FileClientGetPropertiesOptions, leaseAccessConditions *LeaseAccessConditions) (FileClientGetPropertiesResponse, error) { + var err error req, err := client.getPropertiesCreateRequest(ctx, options, leaseAccessConditions) if err != nil { return FileClientGetPropertiesResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return FileClientGetPropertiesResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return FileClientGetPropertiesResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FileClientGetPropertiesResponse{}, err } - return client.getPropertiesHandleResponse(resp) + resp, err := client.getPropertiesHandleResponse(httpResp) + return resp, err } // getPropertiesCreateRequest creates the GetProperties request. @@ -937,23 +963,17 @@ func (client *FileClient) getPropertiesCreateRequest(ctx context.Context, option // getPropertiesHandleResponse handles the GetProperties response. func (client *FileClient) getPropertiesHandleResponse(resp *http.Response) (FileClientGetPropertiesResponse, error) { result := FileClientGetPropertiesResponse{} - if val := resp.Header.Get("Last-Modified"); val != "" { - lastModified, err := time.Parse(time.RFC1123, val) - if err != nil { - return FileClientGetPropertiesResponse{}, err - } - result.LastModified = &lastModified + if val := resp.Header.Get("Cache-Control"); val != "" { + result.CacheControl = &val } - for hh := range resp.Header { - if len(hh) > len("x-ms-meta-") && strings.EqualFold(hh[:len("x-ms-meta-")], "x-ms-meta-") { - if result.Metadata == nil { - result.Metadata = map[string]*string{} - } - result.Metadata[hh[len("x-ms-meta-"):]] = to.Ptr(resp.Header.Get(hh)) - } + if val := resp.Header.Get("Content-Disposition"); val != "" { + result.ContentDisposition = &val } - if val := resp.Header.Get("x-ms-type"); val != "" { - result.FileType = &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) @@ -962,12 +982,6 @@ func (client *FileClient) getPropertiesHandleResponse(resp *http.Response) (File } result.ContentLength = &contentLength } - if val := resp.Header.Get("Content-Type"); val != "" { - result.ContentType = &val - } - if val := resp.Header.Get("ETag"); val != "" { - result.ETag = (*azcore.ETag)(&val) - } if val := resp.Header.Get("Content-MD5"); val != "" { contentMD5, err := base64.StdEncoding.DecodeString(val) if err != nil { @@ -975,30 +989,8 @@ func (client *FileClient) getPropertiesHandleResponse(resp *http.Response) (File } result.ContentMD5 = contentMD5 } - if val := resp.Header.Get("Content-Encoding"); val != "" { - result.ContentEncoding = &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-Language"); val != "" { - result.ContentLanguage = &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 FileClientGetPropertiesResponse{}, err - } - result.Date = &date + if val := resp.Header.Get("Content-Type"); val != "" { + result.ContentType = &val } if val := resp.Header.Get("x-ms-copy-completion-time"); val != "" { copyCompletionTime, err := time.Parse(time.RFC1123, val) @@ -1007,9 +999,6 @@ func (client *FileClient) getPropertiesHandleResponse(resp *http.Response) (File } result.CopyCompletionTime = ©CompletionTime } - if val := resp.Header.Get("x-ms-copy-status-description"); val != "" { - result.CopyStatusDescription = &val - } if val := resp.Header.Get("x-ms-copy-id"); val != "" { result.CopyID = &val } @@ -1022,16 +1011,29 @@ func (client *FileClient) getPropertiesHandleResponse(resp *http.Response) (File if val := resp.Header.Get("x-ms-copy-status"); val != "" { result.CopyStatus = (*CopyStatusType)(&val) } - if val := resp.Header.Get("x-ms-server-encrypted"); val != "" { - isServerEncrypted, err := strconv.ParseBool(val) + if val := resp.Header.Get("x-ms-copy-status-description"); val != "" { + result.CopyStatusDescription = &val + } + if val := resp.Header.Get("Date"); val != "" { + date, err := time.Parse(time.RFC1123, val) if err != nil { return FileClientGetPropertiesResponse{}, err } - result.IsServerEncrypted = &isServerEncrypted + result.Date = &date + } + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = (*azcore.ETag)(&val) } if val := resp.Header.Get("x-ms-file-attributes"); val != "" { result.FileAttributes = &val } + if val := resp.Header.Get("x-ms-file-change-time"); val != "" { + fileChangeTime, err := time.Parse(ISO8601, val) + if err != nil { + return FileClientGetPropertiesResponse{}, err + } + result.FileChangeTime = &fileChangeTime + } if val := resp.Header.Get("x-ms-file-creation-time"); val != "" { fileCreationTime, err := time.Parse(ISO8601, val) if err != nil { @@ -1039,6 +1041,9 @@ func (client *FileClient) getPropertiesHandleResponse(resp *http.Response) (File } result.FileCreationTime = &fileCreationTime } + if val := resp.Header.Get("x-ms-file-id"); val != "" { + result.ID = &val + } if val := resp.Header.Get("x-ms-file-last-write-time"); val != "" { fileLastWriteTime, err := time.Parse(ISO8601, val) if err != nil { @@ -1046,21 +1051,28 @@ func (client *FileClient) getPropertiesHandleResponse(resp *http.Response) (File } result.FileLastWriteTime = &fileLastWriteTime } - if val := resp.Header.Get("x-ms-file-change-time"); val != "" { - fileChangeTime, err := time.Parse(ISO8601, val) - if err != nil { - return FileClientGetPropertiesResponse{}, err - } - result.FileChangeTime = &fileChangeTime + if val := resp.Header.Get("x-ms-file-parent-id"); val != "" { + result.ParentID = &val } if val := resp.Header.Get("x-ms-file-permission-key"); val != "" { result.FilePermissionKey = &val } - if val := resp.Header.Get("x-ms-file-id"); val != "" { - result.ID = &val + if val := resp.Header.Get("x-ms-type"); val != "" { + result.FileType = &val } - if val := resp.Header.Get("x-ms-file-parent-id"); val != "" { - result.ParentID = &val + if val := resp.Header.Get("x-ms-server-encrypted"); val != "" { + isServerEncrypted, err := strconv.ParseBool(val) + if err != nil { + return FileClientGetPropertiesResponse{}, err + } + result.IsServerEncrypted = &isServerEncrypted + } + if val := resp.Header.Get("Last-Modified"); val != "" { + lastModified, err := time.Parse(time.RFC1123, val) + if err != nil { + return FileClientGetPropertiesResponse{}, err + } + result.LastModified = &lastModified } if val := resp.Header.Get("x-ms-lease-duration"); val != "" { result.LeaseDuration = (*LeaseDurationType)(&val) @@ -1071,6 +1083,20 @@ func (client *FileClient) getPropertiesHandleResponse(resp *http.Response) (File if val := resp.Header.Get("x-ms-lease-status"); val != "" { result.LeaseStatus = (*LeaseStatusType)(&val) } + for hh := range resp.Header { + if len(hh) > len("x-ms-meta-") && strings.EqualFold(hh[:len("x-ms-meta-")], "x-ms-meta-") { + if result.Metadata == nil { + result.Metadata = map[string]*string{} + } + result.Metadata[hh[len("x-ms-meta-"):]] = to.Ptr(resp.Header.Get(hh)) + } + } + 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 } @@ -1081,18 +1107,21 @@ func (client *FileClient) getPropertiesHandleResponse(resp *http.Response) (File // - options - FileClientGetRangeListOptions contains the optional parameters for the FileClient.GetRangeList method. // - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ShareClient.GetProperties method. func (client *FileClient) GetRangeList(ctx context.Context, options *FileClientGetRangeListOptions, leaseAccessConditions *LeaseAccessConditions) (FileClientGetRangeListResponse, error) { + var err error req, err := client.getRangeListCreateRequest(ctx, options, leaseAccessConditions) if err != nil { return FileClientGetRangeListResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return FileClientGetRangeListResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return FileClientGetRangeListResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FileClientGetRangeListResponse{}, err } - return client.getRangeListHandleResponse(resp) + resp, err := client.getRangeListHandleResponse(httpResp) + return resp, err } // getRangeListCreateRequest creates the GetRangeList request. @@ -1133,12 +1162,12 @@ func (client *FileClient) getRangeListCreateRequest(ctx context.Context, options // getRangeListHandleResponse handles the GetRangeList response. func (client *FileClient) getRangeListHandleResponse(resp *http.Response) (FileClientGetRangeListResponse, error) { result := FileClientGetRangeListResponse{} - if val := resp.Header.Get("Last-Modified"); val != "" { - lastModified, err := time.Parse(time.RFC1123, val) + if val := resp.Header.Get("Date"); val != "" { + date, err := time.Parse(time.RFC1123, val) if err != nil { return FileClientGetRangeListResponse{}, err } - result.LastModified = &lastModified + result.Date = &date } if val := resp.Header.Get("ETag"); val != "" { result.ETag = (*azcore.ETag)(&val) @@ -1150,19 +1179,19 @@ func (client *FileClient) getRangeListHandleResponse(resp *http.Response) (FileC } result.FileContentLength = &fileContentLength } + if val := resp.Header.Get("Last-Modified"); val != "" { + lastModified, err := time.Parse(time.RFC1123, val) + if err != nil { + return FileClientGetRangeListResponse{}, 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("Date"); val != "" { - date, err := time.Parse(time.RFC1123, val) - if err != nil { - return FileClientGetRangeListResponse{}, err - } - result.Date = &date - } if err := runtime.UnmarshalAsXML(resp, &result.ShareFileRangeList); err != nil { return FileClientGetRangeListResponse{}, err } @@ -1175,18 +1204,21 @@ func (client *FileClient) getRangeListHandleResponse(resp *http.Response) (FileC // Generated from API version 2023-11-03 // - options - FileClientListHandlesOptions contains the optional parameters for the FileClient.ListHandles method. func (client *FileClient) ListHandles(ctx context.Context, options *FileClientListHandlesOptions) (FileClientListHandlesResponse, error) { + var err error req, err := client.listHandlesCreateRequest(ctx, options) if err != nil { return FileClientListHandlesResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return FileClientListHandlesResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return FileClientListHandlesResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FileClientListHandlesResponse{}, err } - return client.listHandlesHandleResponse(resp) + resp, err := client.listHandlesHandleResponse(httpResp) + return resp, err } // listHandlesCreateRequest creates the ListHandles request. @@ -1227,12 +1259,6 @@ func (client *FileClient) listHandlesHandleResponse(resp *http.Response) (FileCl if val := resp.Header.Get("Content-Type"); val != "" { result.ContentType = &val } - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.RequestID = &val - } - if val := resp.Header.Get("x-ms-version"); val != "" { - result.Version = &val - } if val := resp.Header.Get("Date"); val != "" { date, err := time.Parse(time.RFC1123, val) if err != nil { @@ -1240,6 +1266,12 @@ func (client *FileClient) listHandlesHandleResponse(resp *http.Response) (FileCl } result.Date = &date } + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.RequestID = &val + } + if val := resp.Header.Get("x-ms-version"); val != "" { + result.Version = &val + } if err := runtime.UnmarshalAsXML(resp, &result.ListHandlesResponse); err != nil { return FileClientListHandlesResponse{}, err } @@ -1253,18 +1285,21 @@ func (client *FileClient) listHandlesHandleResponse(resp *http.Response) (FileCl // - leaseID - Specifies the current lease ID on the resource. // - options - FileClientReleaseLeaseOptions contains the optional parameters for the FileClient.ReleaseLease method. func (client *FileClient) ReleaseLease(ctx context.Context, leaseID string, options *FileClientReleaseLeaseOptions) (FileClientReleaseLeaseResponse, error) { + var err error req, err := client.releaseLeaseCreateRequest(ctx, leaseID, options) if err != nil { return FileClientReleaseLeaseResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return FileClientReleaseLeaseResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return FileClientReleaseLeaseResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FileClientReleaseLeaseResponse{}, err } - return client.releaseLeaseHandleResponse(resp) + resp, err := client.releaseLeaseHandleResponse(httpResp) + return resp, err } // releaseLeaseCreateRequest creates the ReleaseLease request. @@ -1298,6 +1333,16 @@ func (client *FileClient) releaseLeaseCreateRequest(ctx context.Context, leaseID // releaseLeaseHandleResponse handles the ReleaseLease response. func (client *FileClient) releaseLeaseHandleResponse(resp *http.Response) (FileClientReleaseLeaseResponse, error) { result := FileClientReleaseLeaseResponse{} + if val := resp.Header.Get("x-ms-client-request-id"); val != "" { + result.ClientRequestID = &val + } + if val := resp.Header.Get("Date"); val != "" { + date, err := time.Parse(time.RFC1123, val) + if err != nil { + return FileClientReleaseLeaseResponse{}, err + } + result.Date = &date + } if val := resp.Header.Get("ETag"); val != "" { result.ETag = (*azcore.ETag)(&val) } @@ -1308,22 +1353,12 @@ func (client *FileClient) releaseLeaseHandleResponse(resp *http.Response) (FileC } 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 FileClientReleaseLeaseResponse{}, err - } - result.Date = &date - } return result, nil } @@ -1340,18 +1375,21 @@ func (client *FileClient) releaseLeaseHandleResponse(resp *http.Response) (FileC // - CopyFileSMBInfo - CopyFileSMBInfo contains a group of parameters for the DirectoryClient.Rename method. // - ShareFileHTTPHeaders - ShareFileHTTPHeaders contains a group of parameters for the FileClient.Create method. func (client *FileClient) Rename(ctx context.Context, renameSource string, options *FileClientRenameOptions, sourceLeaseAccessConditions *SourceLeaseAccessConditions, destinationLeaseAccessConditions *DestinationLeaseAccessConditions, copyFileSMBInfo *CopyFileSMBInfo, shareFileHTTPHeaders *ShareFileHTTPHeaders) (FileClientRenameResponse, error) { + var err error req, err := client.renameCreateRequest(ctx, renameSource, options, sourceLeaseAccessConditions, destinationLeaseAccessConditions, copyFileSMBInfo, shareFileHTTPHeaders) if err != nil { return FileClientRenameResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return FileClientRenameResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return FileClientRenameResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FileClientRenameResponse{}, err } - return client.renameHandleResponse(resp) + resp, err := client.renameHandleResponse(httpResp) + return resp, err } // renameCreateRequest creates the Rename request. @@ -1424,22 +1462,6 @@ func (client *FileClient) renameCreateRequest(ctx context.Context, renameSource // renameHandleResponse handles the Rename response. func (client *FileClient) renameHandleResponse(resp *http.Response) (FileClientRenameResponse, error) { result := FileClientRenameResponse{} - if val := resp.Header.Get("ETag"); val != "" { - result.ETag = (*azcore.ETag)(&val) - } - if val := resp.Header.Get("Last-Modified"); val != "" { - lastModified, err := time.Parse(time.RFC1123, val) - if err != nil { - return FileClientRenameResponse{}, 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("Date"); val != "" { date, err := time.Parse(time.RFC1123, val) if err != nil { @@ -1447,19 +1469,19 @@ func (client *FileClient) renameHandleResponse(resp *http.Response) (FileClientR } result.Date = &date } - if val := resp.Header.Get("x-ms-request-server-encrypted"); val != "" { - isServerEncrypted, err := strconv.ParseBool(val) - if err != nil { - return FileClientRenameResponse{}, err - } - result.IsServerEncrypted = &isServerEncrypted - } - if val := resp.Header.Get("x-ms-file-permission-key"); val != "" { - result.FilePermissionKey = &val + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = (*azcore.ETag)(&val) } if val := resp.Header.Get("x-ms-file-attributes"); val != "" { result.FileAttributes = &val } + if val := resp.Header.Get("x-ms-file-change-time"); val != "" { + fileChangeTime, err := time.Parse(ISO8601, val) + if err != nil { + return FileClientRenameResponse{}, err + } + result.FileChangeTime = &fileChangeTime + } if val := resp.Header.Get("x-ms-file-creation-time"); val != "" { fileCreationTime, err := time.Parse(ISO8601, val) if err != nil { @@ -1467,6 +1489,9 @@ func (client *FileClient) renameHandleResponse(resp *http.Response) (FileClientR } result.FileCreationTime = &fileCreationTime } + if val := resp.Header.Get("x-ms-file-id"); val != "" { + result.ID = &val + } if val := resp.Header.Get("x-ms-file-last-write-time"); val != "" { fileLastWriteTime, err := time.Parse(ISO8601, val) if err != nil { @@ -1474,18 +1499,31 @@ func (client *FileClient) renameHandleResponse(resp *http.Response) (FileClientR } result.FileLastWriteTime = &fileLastWriteTime } - if val := resp.Header.Get("x-ms-file-change-time"); val != "" { - fileChangeTime, err := time.Parse(ISO8601, val) + if val := resp.Header.Get("x-ms-file-parent-id"); val != "" { + result.ParentID = &val + } + if val := resp.Header.Get("x-ms-file-permission-key"); val != "" { + result.FilePermissionKey = &val + } + if val := resp.Header.Get("x-ms-request-server-encrypted"); val != "" { + isServerEncrypted, err := strconv.ParseBool(val) if err != nil { return FileClientRenameResponse{}, err } - result.FileChangeTime = &fileChangeTime + result.IsServerEncrypted = &isServerEncrypted } - if val := resp.Header.Get("x-ms-file-id"); val != "" { - result.ID = &val + if val := resp.Header.Get("Last-Modified"); val != "" { + lastModified, err := time.Parse(time.RFC1123, val) + if err != nil { + return FileClientRenameResponse{}, err + } + result.LastModified = &lastModified } - if val := resp.Header.Get("x-ms-file-parent-id"); val != "" { - result.ParentID = &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 } @@ -1498,18 +1536,21 @@ func (client *FileClient) renameHandleResponse(resp *http.Response) (FileClientR // - ShareFileHTTPHeaders - ShareFileHTTPHeaders contains a group of parameters for the FileClient.Create method. // - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ShareClient.GetProperties method. func (client *FileClient) SetHTTPHeaders(ctx context.Context, options *FileClientSetHTTPHeadersOptions, shareFileHTTPHeaders *ShareFileHTTPHeaders, leaseAccessConditions *LeaseAccessConditions) (FileClientSetHTTPHeadersResponse, error) { + var err error req, err := client.setHTTPHeadersCreateRequest(ctx, options, shareFileHTTPHeaders, leaseAccessConditions) if err != nil { return FileClientSetHTTPHeadersResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return FileClientSetHTTPHeadersResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return FileClientSetHTTPHeadersResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FileClientSetHTTPHeadersResponse{}, err } - return client.setHTTPHeadersHandleResponse(resp) + resp, err := client.setHTTPHeadersHandleResponse(httpResp) + return resp, err } // setHTTPHeadersCreateRequest creates the SetHTTPHeaders request. @@ -1580,22 +1621,6 @@ func (client *FileClient) setHTTPHeadersCreateRequest(ctx context.Context, optio // setHTTPHeadersHandleResponse handles the SetHTTPHeaders response. func (client *FileClient) setHTTPHeadersHandleResponse(resp *http.Response) (FileClientSetHTTPHeadersResponse, error) { result := FileClientSetHTTPHeadersResponse{} - if val := resp.Header.Get("ETag"); val != "" { - result.ETag = (*azcore.ETag)(&val) - } - if val := resp.Header.Get("Last-Modified"); val != "" { - lastModified, err := time.Parse(time.RFC1123, val) - if err != nil { - return FileClientSetHTTPHeadersResponse{}, 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("Date"); val != "" { date, err := time.Parse(time.RFC1123, val) if err != nil { @@ -1603,19 +1628,19 @@ func (client *FileClient) setHTTPHeadersHandleResponse(resp *http.Response) (Fil } result.Date = &date } - if val := resp.Header.Get("x-ms-request-server-encrypted"); val != "" { - isServerEncrypted, err := strconv.ParseBool(val) - if err != nil { - return FileClientSetHTTPHeadersResponse{}, err - } - result.IsServerEncrypted = &isServerEncrypted - } - if val := resp.Header.Get("x-ms-file-permission-key"); val != "" { - result.FilePermissionKey = &val + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = (*azcore.ETag)(&val) } if val := resp.Header.Get("x-ms-file-attributes"); val != "" { result.FileAttributes = &val } + if val := resp.Header.Get("x-ms-file-change-time"); val != "" { + fileChangeTime, err := time.Parse(ISO8601, val) + if err != nil { + return FileClientSetHTTPHeadersResponse{}, err + } + result.FileChangeTime = &fileChangeTime + } if val := resp.Header.Get("x-ms-file-creation-time"); val != "" { fileCreationTime, err := time.Parse(ISO8601, val) if err != nil { @@ -1623,6 +1648,9 @@ func (client *FileClient) setHTTPHeadersHandleResponse(resp *http.Response) (Fil } result.FileCreationTime = &fileCreationTime } + if val := resp.Header.Get("x-ms-file-id"); val != "" { + result.ID = &val + } if val := resp.Header.Get("x-ms-file-last-write-time"); val != "" { fileLastWriteTime, err := time.Parse(ISO8601, val) if err != nil { @@ -1630,18 +1658,31 @@ func (client *FileClient) setHTTPHeadersHandleResponse(resp *http.Response) (Fil } result.FileLastWriteTime = &fileLastWriteTime } - if val := resp.Header.Get("x-ms-file-change-time"); val != "" { - fileChangeTime, err := time.Parse(ISO8601, val) + if val := resp.Header.Get("x-ms-file-parent-id"); val != "" { + result.ParentID = &val + } + if val := resp.Header.Get("x-ms-file-permission-key"); val != "" { + result.FilePermissionKey = &val + } + if val := resp.Header.Get("x-ms-request-server-encrypted"); val != "" { + isServerEncrypted, err := strconv.ParseBool(val) if err != nil { return FileClientSetHTTPHeadersResponse{}, err } - result.FileChangeTime = &fileChangeTime + result.IsServerEncrypted = &isServerEncrypted } - if val := resp.Header.Get("x-ms-file-id"); val != "" { - result.ID = &val + if val := resp.Header.Get("Last-Modified"); val != "" { + lastModified, err := time.Parse(time.RFC1123, val) + if err != nil { + return FileClientSetHTTPHeadersResponse{}, err + } + result.LastModified = &lastModified } - if val := resp.Header.Get("x-ms-file-parent-id"); val != "" { - result.ParentID = &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 } @@ -1653,18 +1694,21 @@ func (client *FileClient) setHTTPHeadersHandleResponse(resp *http.Response) (Fil // - options - FileClientSetMetadataOptions contains the optional parameters for the FileClient.SetMetadata method. // - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ShareClient.GetProperties method. func (client *FileClient) SetMetadata(ctx context.Context, options *FileClientSetMetadataOptions, leaseAccessConditions *LeaseAccessConditions) (FileClientSetMetadataResponse, error) { + var err error req, err := client.setMetadataCreateRequest(ctx, options, leaseAccessConditions) if err != nil { return FileClientSetMetadataResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return FileClientSetMetadataResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return FileClientSetMetadataResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FileClientSetMetadataResponse{}, err } - return client.setMetadataHandleResponse(resp) + resp, err := client.setMetadataHandleResponse(httpResp) + return resp, err } // setMetadataCreateRequest creates the SetMetadata request. @@ -1703,15 +1747,6 @@ func (client *FileClient) setMetadataCreateRequest(ctx context.Context, options // setMetadataHandleResponse handles the SetMetadata response. func (client *FileClient) setMetadataHandleResponse(resp *http.Response) (FileClientSetMetadataResponse, error) { result := FileClientSetMetadataResponse{} - if val := resp.Header.Get("ETag"); val != "" { - result.ETag = (*azcore.ETag)(&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 { @@ -1719,6 +1754,9 @@ func (client *FileClient) setMetadataHandleResponse(resp *http.Response) (FileCl } result.Date = &date } + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = (*azcore.ETag)(&val) + } if val := resp.Header.Get("x-ms-request-server-encrypted"); val != "" { isServerEncrypted, err := strconv.ParseBool(val) if err != nil { @@ -1733,6 +1771,12 @@ func (client *FileClient) setMetadataHandleResponse(resp *http.Response) (FileCl } 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 } @@ -1750,18 +1794,21 @@ func (client *FileClient) setMetadataHandleResponse(resp *http.Response) (FileCl // - CopyFileSMBInfo - CopyFileSMBInfo contains a group of parameters for the DirectoryClient.Rename method. // - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ShareClient.GetProperties method. func (client *FileClient) StartCopy(ctx context.Context, copySource string, options *FileClientStartCopyOptions, copyFileSMBInfo *CopyFileSMBInfo, leaseAccessConditions *LeaseAccessConditions) (FileClientStartCopyResponse, error) { + var err error req, err := client.startCopyCreateRequest(ctx, copySource, options, copyFileSMBInfo, leaseAccessConditions) if err != nil { return FileClientStartCopyResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return FileClientStartCopyResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted) { - return FileClientStartCopyResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return FileClientStartCopyResponse{}, err } - return client.startCopyHandleResponse(resp) + resp, err := client.startCopyHandleResponse(httpResp) + return resp, err } // startCopyCreateRequest creates the StartCopy request. @@ -1830,6 +1877,19 @@ func (client *FileClient) startCopyCreateRequest(ctx context.Context, copySource // startCopyHandleResponse handles the StartCopy response. func (client *FileClient) startCopyHandleResponse(resp *http.Response) (FileClientStartCopyResponse, error) { result := FileClientStartCopyResponse{} + if val := resp.Header.Get("x-ms-copy-id"); val != "" { + result.CopyID = &val + } + if val := resp.Header.Get("x-ms-copy-status"); val != "" { + result.CopyStatus = (*CopyStatusType)(&val) + } + if val := resp.Header.Get("Date"); val != "" { + date, err := time.Parse(time.RFC1123, val) + if err != nil { + return FileClientStartCopyResponse{}, err + } + result.Date = &date + } if val := resp.Header.Get("ETag"); val != "" { result.ETag = (*azcore.ETag)(&val) } @@ -1846,19 +1906,6 @@ func (client *FileClient) startCopyHandleResponse(resp *http.Response) (FileClie 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 FileClientStartCopyResponse{}, err - } - result.Date = &date - } - if val := resp.Header.Get("x-ms-copy-id"); val != "" { - result.CopyID = &val - } - if val := resp.Header.Get("x-ms-copy-status"); val != "" { - result.CopyStatus = (*CopyStatusType)(&val) - } return result, nil } @@ -1882,18 +1929,21 @@ func (client *FileClient) startCopyHandleResponse(resp *http.Response) (FileClie // - options - FileClientUploadRangeOptions contains the optional parameters for the FileClient.UploadRange method. // - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ShareClient.GetProperties method. func (client *FileClient) UploadRange(ctx context.Context, rangeParam string, fileRangeWrite FileRangeWriteType, contentLength int64, optionalbody io.ReadSeekCloser, options *FileClientUploadRangeOptions, leaseAccessConditions *LeaseAccessConditions) (FileClientUploadRangeResponse, error) { + var err error req, err := client.uploadRangeCreateRequest(ctx, rangeParam, fileRangeWrite, contentLength, optionalbody, options, leaseAccessConditions) if err != nil { return FileClientUploadRangeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return FileClientUploadRangeResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusCreated) { - return FileClientUploadRangeResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return FileClientUploadRangeResponse{}, err } - return client.uploadRangeHandleResponse(resp) + resp, err := client.uploadRangeHandleResponse(httpResp) + return resp, err } // uploadRangeCreateRequest creates the UploadRange request. @@ -1937,16 +1987,6 @@ func (client *FileClient) uploadRangeCreateRequest(ctx context.Context, rangePar // uploadRangeHandleResponse handles the UploadRange response. func (client *FileClient) uploadRangeHandleResponse(resp *http.Response) (FileClientUploadRangeResponse, error) { result := FileClientUploadRangeResponse{} - if val := resp.Header.Get("ETag"); val != "" { - result.ETag = (*azcore.ETag)(&val) - } - if val := resp.Header.Get("Last-Modified"); val != "" { - lastModified, err := time.Parse(time.RFC1123, val) - if err != nil { - return FileClientUploadRangeResponse{}, err - } - result.LastModified = &lastModified - } if val := resp.Header.Get("Content-MD5"); val != "" { contentMD5, err := base64.StdEncoding.DecodeString(val) if err != nil { @@ -1954,12 +1994,6 @@ func (client *FileClient) uploadRangeHandleResponse(resp *http.Response) (FileCl } result.ContentMD5 = contentMD5 } - 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 { @@ -1967,6 +2001,16 @@ func (client *FileClient) uploadRangeHandleResponse(resp *http.Response) (FileCl } result.Date = &date } + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = (*azcore.ETag)(&val) + } + if val := resp.Header.Get("x-ms-file-last-write-time"); val != "" { + fileLastWriteTime, err := time.Parse(ISO8601, val) + if err != nil { + return FileClientUploadRangeResponse{}, err + } + result.FileLastWriteTime = &fileLastWriteTime + } if val := resp.Header.Get("x-ms-request-server-encrypted"); val != "" { isServerEncrypted, err := strconv.ParseBool(val) if err != nil { @@ -1974,12 +2018,18 @@ func (client *FileClient) uploadRangeHandleResponse(resp *http.Response) (FileCl } result.IsServerEncrypted = &isServerEncrypted } - if val := resp.Header.Get("x-ms-file-last-write-time"); val != "" { - fileLastWriteTime, err := time.Parse(ISO8601, val) + if val := resp.Header.Get("Last-Modified"); val != "" { + lastModified, err := time.Parse(time.RFC1123, val) if err != nil { return FileClientUploadRangeResponse{}, err } - result.FileLastWriteTime = &fileLastWriteTime + 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 } @@ -2002,18 +2052,21 @@ func (client *FileClient) uploadRangeHandleResponse(resp *http.Response) (FileCl // method. // - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ShareClient.GetProperties method. func (client *FileClient) UploadRangeFromURL(ctx context.Context, rangeParam string, copySource string, contentLength int64, options *FileClientUploadRangeFromURLOptions, sourceModifiedAccessConditions *SourceModifiedAccessConditions, leaseAccessConditions *LeaseAccessConditions) (FileClientUploadRangeFromURLResponse, error) { + var err error req, err := client.uploadRangeFromURLCreateRequest(ctx, rangeParam, copySource, contentLength, options, sourceModifiedAccessConditions, leaseAccessConditions) if err != nil { return FileClientUploadRangeFromURLResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return FileClientUploadRangeFromURLResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusCreated) { - return FileClientUploadRangeFromURLResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return FileClientUploadRangeFromURLResponse{}, err } - return client.uploadRangeFromURLHandleResponse(resp) + resp, err := client.uploadRangeFromURLHandleResponse(httpResp) + return resp, err } // uploadRangeFromURLCreateRequest creates the UploadRangeFromURL request. @@ -2070,35 +2123,29 @@ func (client *FileClient) uploadRangeFromURLCreateRequest(ctx context.Context, r // uploadRangeFromURLHandleResponse handles the UploadRangeFromURL response. func (client *FileClient) uploadRangeFromURLHandleResponse(resp *http.Response) (FileClientUploadRangeFromURLResponse, error) { result := FileClientUploadRangeFromURLResponse{} - if val := resp.Header.Get("ETag"); val != "" { - result.ETag = (*azcore.ETag)(&val) - } - if val := resp.Header.Get("Last-Modified"); val != "" { - lastModified, err := time.Parse(time.RFC1123, val) + if val := resp.Header.Get("Content-MD5"); val != "" { + contentMD5, err := base64.StdEncoding.DecodeString(val) if err != nil { return FileClientUploadRangeFromURLResponse{}, err } - result.LastModified = &lastModified + result.ContentMD5 = contentMD5 } - if val := resp.Header.Get("x-ms-content-crc64"); val != "" { - xMSContentCRC64, err := base64.StdEncoding.DecodeString(val) + if val := resp.Header.Get("Date"); val != "" { + date, err := time.Parse(time.RFC1123, val) if err != nil { return FileClientUploadRangeFromURLResponse{}, err } - result.XMSContentCRC64 = xMSContentCRC64 - } - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.RequestID = &val + result.Date = &date } - if val := resp.Header.Get("x-ms-version"); val != "" { - result.Version = &val + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = (*azcore.ETag)(&val) } - if val := resp.Header.Get("Date"); val != "" { - date, err := time.Parse(time.RFC1123, val) + if val := resp.Header.Get("x-ms-file-last-write-time"); val != "" { + fileLastWriteTime, err := time.Parse(ISO8601, val) if err != nil { return FileClientUploadRangeFromURLResponse{}, err } - result.Date = &date + result.FileLastWriteTime = &fileLastWriteTime } if val := resp.Header.Get("x-ms-request-server-encrypted"); val != "" { isServerEncrypted, err := strconv.ParseBool(val) @@ -2107,19 +2154,25 @@ func (client *FileClient) uploadRangeFromURLHandleResponse(resp *http.Response) } result.IsServerEncrypted = &isServerEncrypted } - if val := resp.Header.Get("x-ms-file-last-write-time"); val != "" { - fileLastWriteTime, err := time.Parse(ISO8601, val) + if val := resp.Header.Get("Last-Modified"); val != "" { + lastModified, err := time.Parse(time.RFC1123, val) if err != nil { return FileClientUploadRangeFromURLResponse{}, err } - result.FileLastWriteTime = &fileLastWriteTime + result.LastModified = &lastModified } - if val := resp.Header.Get("Content-MD5"); val != "" { - contentMD5, err := base64.StdEncoding.DecodeString(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-content-crc64"); val != "" { + xMSContentCRC64, err := base64.StdEncoding.DecodeString(val) if err != nil { return FileClientUploadRangeFromURLResponse{}, err } - result.ContentMD5 = contentMD5 + result.XMSContentCRC64 = xMSContentCRC64 } return result, nil } diff --git a/sdk/storage/azfile/internal/generated/zz_models.go b/sdk/storage/azfile/internal/generated/zz_models.go index 10aace210fe4..448879f6564c 100644 --- a/sdk/storage/azfile/internal/generated/zz_models.go +++ b/sdk/storage/azfile/internal/generated/zz_models.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package generated @@ -34,30 +33,6 @@ type ClearRange struct { Start *int64 `xml:"Start"` } -// CopyFileSMBInfo contains a group of parameters for the DirectoryClient.Rename method. -type CopyFileSMBInfo struct { - // Specifies either the option to copy file attributes from a source file(source) to a target file or a list of attributes - // to set on a target file. - FileAttributes *string - // Specifies either the option to copy file last write time from a source file(source) to a target file or a time value in - // ISO 8601 format to set as last write time on a target file. - FileChangeTime *string - // Specifies either the option to copy file creation time from a source file(source) to a target file or a time value in ISO - // 8601 format to set as creation time on a target file. - FileCreationTime *string - // Specifies either the option to copy file last write time from a source file(source) to a target file or a time value in - // ISO 8601 format to set as last write time on a target file. - FileLastWriteTime *string - // Specifies the option to copy file security descriptor from source file or to set it using the value which is defined by - // the header value of x-ms-file-permission or x-ms-file-permission-key. - FilePermissionCopyMode *PermissionCopyModeType - // Specifies the option to overwrite the target file if it already exists and has read-only attribute set. - IgnoreReadOnly *bool - // Specifies the option to set archive attribute on a target file. True means archive attribute will be set on a target file - // despite attribute overrides or a source file state. - SetArchiveAttribute *bool -} - // CORSRule - CORS is an HTTP feature that enables a web application running under one domain to access resources in another // domain. Web browsers implement a security restriction known as same-origin policy that // prevents a web page from calling APIs in a different domain; CORS provides a secure way to allow one domain (the origin @@ -83,16 +58,6 @@ type CORSRule struct { MaxAgeInSeconds *int32 `xml:"MaxAgeInSeconds"` } -// DestinationLeaseAccessConditions contains a group of parameters for the DirectoryClient.Rename method. -type DestinationLeaseAccessConditions struct { - // Required if the destination file has an active infinite lease. The lease ID specified for this header must match the lease - // ID of the destination file. If the request does not include the lease ID or - // it is not valid, the operation fails with status code 412 (Precondition Failed). If this header is specified and the destination - // file does not currently have an active lease, the operation will also - // fail with status code 412 (Precondition Failed). - DestinationLeaseID *string -} - // Directory - A listed directory item. type Directory struct { // REQUIRED @@ -105,167 +70,6 @@ type Directory struct { Properties *FileProperty `xml:"Properties"` } -// DirectoryClientCreateOptions contains the optional parameters for the DirectoryClient.Create method. -type DirectoryClientCreateOptions struct { - // If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file and ‘Directory’ for directory. - // ‘None’ can also be specified as default. - FileAttributes *string - // Change time for the file/directory. Default value: Now. - FileChangeTime *string - // Creation time for the file/directory. Default value: Now. - FileCreationTime *string - // Last write time for the file/directory. Default value: Now. - FileLastWriteTime *string - // If specified the permission (security descriptor) shall be set for the directory/file. This header can be used if Permission - // size is <= 8KB, else x-ms-file-permission-key header shall be used. Default - // value: Inherit. If SDDL is specified as input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission - // or x-ms-file-permission-key should be specified. - FilePermission *string - // Key of the permission to be set for the directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key - // should be specified. - FilePermissionKey *string - // A name-value pair to associate with a file storage object. - Metadata map[string]*string - // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// DirectoryClientDeleteOptions contains the optional parameters for the DirectoryClient.Delete method. -type DirectoryClientDeleteOptions struct { - // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// DirectoryClientForceCloseHandlesOptions contains the optional parameters for the DirectoryClient.ForceCloseHandles method. -type DirectoryClientForceCloseHandlesOptions struct { - // A string value that identifies the portion of the list to be returned with the next list operation. The operation returns - // a marker value within the response body if the list returned was not complete. - // The marker value may then be used in a subsequent call to request the next set of list items. The marker value is opaque - // to the client. - Marker *string - // Specifies operation should apply to the directory specified in the URI, its files, its subdirectories and their files. - Recursive *bool - // The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. - Sharesnapshot *string - // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// DirectoryClientGetPropertiesOptions contains the optional parameters for the DirectoryClient.GetProperties method. -type DirectoryClientGetPropertiesOptions struct { - // The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. - Sharesnapshot *string - // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// DirectoryClientListFilesAndDirectoriesSegmentOptions contains the optional parameters for the DirectoryClient.NewListFilesAndDirectoriesSegmentPager -// method. -type DirectoryClientListFilesAndDirectoriesSegmentOptions struct { - // Include this parameter to specify one or more datasets to include in the response. - Include []ListFilesIncludeType - // Include extended information. - IncludeExtendedInfo *bool - // A string value that identifies the portion of the list to be returned with the next list operation. The operation returns - // a marker value within the response body if the list returned was not complete. - // The marker value may then be used in a subsequent call to request the next set of list items. The marker value is opaque - // to the client. - Marker *string - // Specifies the maximum number of entries to return. If the request does not specify maxresults, or specifies a value greater - // than 5,000, the server will return up to 5,000 items. - Maxresults *int32 - // Filters the results to return only entries whose name begins with the specified prefix. - Prefix *string - // The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. - Sharesnapshot *string - // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// DirectoryClientListHandlesOptions contains the optional parameters for the DirectoryClient.ListHandles method. -type DirectoryClientListHandlesOptions struct { - // A string value that identifies the portion of the list to be returned with the next list operation. The operation returns - // a marker value within the response body if the list returned was not complete. - // The marker value may then be used in a subsequent call to request the next set of list items. The marker value is opaque - // to the client. - Marker *string - // Specifies the maximum number of entries to return. If the request does not specify maxresults, or specifies a value greater - // than 5,000, the server will return up to 5,000 items. - Maxresults *int32 - // Specifies operation should apply to the directory specified in the URI, its files, its subdirectories and their files. - Recursive *bool - // The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. - Sharesnapshot *string - // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// DirectoryClientRenameOptions contains the optional parameters for the DirectoryClient.Rename method. -type DirectoryClientRenameOptions struct { - // If specified the permission (security descriptor) shall be set for the directory/file. This header can be used if Permission - // size is <= 8KB, else x-ms-file-permission-key header shall be used. Default - // value: Inherit. If SDDL is specified as input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission - // or x-ms-file-permission-key should be specified. - FilePermission *string - // Key of the permission to be set for the directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key - // should be specified. - FilePermissionKey *string - // Optional. A boolean value that specifies whether the ReadOnly attribute on a preexisting destination file should be respected. - // If true, the rename will succeed, otherwise, a previous file at the - // destination with the ReadOnly attribute set will cause the rename to fail. - IgnoreReadOnly *bool - // A name-value pair to associate with a file storage object. - Metadata map[string]*string - // Optional. A boolean value for if the destination file already exists, whether this request will overwrite the file or not. - // If true, the rename will succeed and will overwrite the destination file. If - // not provided or if false and the destination file does exist, the request will not overwrite the destination file. If provided - // and the destination file doesn’t exist, the rename will succeed. Note: - // This value does not override the x-ms-file-copy-ignore-read-only header value. - ReplaceIfExists *bool - // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// DirectoryClientSetMetadataOptions contains the optional parameters for the DirectoryClient.SetMetadata method. -type DirectoryClientSetMetadataOptions struct { - // A name-value pair to associate with a file storage object. - Metadata map[string]*string - // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// DirectoryClientSetPropertiesOptions contains the optional parameters for the DirectoryClient.SetProperties method. -type DirectoryClientSetPropertiesOptions struct { - // If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file and ‘Directory’ for directory. - // ‘None’ can also be specified as default. - FileAttributes *string - // Change time for the file/directory. Default value: Now. - FileChangeTime *string - // Creation time for the file/directory. Default value: Now. - FileCreationTime *string - // Last write time for the file/directory. Default value: Now. - FileLastWriteTime *string - // If specified the permission (security descriptor) shall be set for the directory/file. This header can be used if Permission - // size is <= 8KB, else x-ms-file-permission-key header shall be used. Default - // value: Inherit. If SDDL is specified as input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission - // or x-ms-file-permission-key should be specified. - FilePermission *string - // Key of the permission to be set for the directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key - // should be specified. - FilePermissionKey *string - // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - // File - A listed file item. type File struct { // REQUIRED @@ -278,268 +82,6 @@ type File struct { PermissionKey *string `xml:"PermissionKey"` } -// FileClientAbortCopyOptions contains the optional parameters for the FileClient.AbortCopy method. -type FileClientAbortCopyOptions struct { - // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// FileClientAcquireLeaseOptions contains the optional parameters for the FileClient.AcquireLease method. -type FileClientAcquireLeaseOptions struct { - // Proposed lease ID, in a GUID string format. The File 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 File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// FileClientBreakLeaseOptions contains the optional parameters for the FileClient.BreakLease method. -type FileClientBreakLeaseOptions 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 File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// FileClientChangeLeaseOptions contains the optional parameters for the FileClient.ChangeLease method. -type FileClientChangeLeaseOptions struct { - // Proposed lease ID, in a GUID string format. The File 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 File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// FileClientCreateOptions contains the optional parameters for the FileClient.Create method. -type FileClientCreateOptions struct { - // If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file and ‘Directory’ for directory. - // ‘None’ can also be specified as default. - FileAttributes *string - // Change time for the file/directory. Default value: Now. - FileChangeTime *string - // Creation time for the file/directory. Default value: Now. - FileCreationTime *string - // Last write time for the file/directory. Default value: Now. - FileLastWriteTime *string - // If specified the permission (security descriptor) shall be set for the directory/file. This header can be used if Permission - // size is <= 8KB, else x-ms-file-permission-key header shall be used. Default - // value: Inherit. If SDDL is specified as input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission - // or x-ms-file-permission-key should be specified. - FilePermission *string - // Key of the permission to be set for the directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key - // should be specified. - FilePermissionKey *string - // A name-value pair to associate with a file storage object. - Metadata map[string]*string - // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// FileClientDeleteOptions contains the optional parameters for the FileClient.Delete method. -type FileClientDeleteOptions struct { - // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// FileClientDownloadOptions contains the optional parameters for the FileClient.Download method. -type FileClientDownloadOptions struct { - // Return file data only from the specified byte range. - Range *string - // 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 4 MB in size. - RangeGetContentMD5 *bool - // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// FileClientForceCloseHandlesOptions contains the optional parameters for the FileClient.ForceCloseHandles method. -type FileClientForceCloseHandlesOptions struct { - // A string value that identifies the portion of the list to be returned with the next list operation. The operation returns - // a marker value within the response body if the list returned was not complete. - // The marker value may then be used in a subsequent call to request the next set of list items. The marker value is opaque - // to the client. - Marker *string - // The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. - Sharesnapshot *string - // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// FileClientGetPropertiesOptions contains the optional parameters for the FileClient.GetProperties method. -type FileClientGetPropertiesOptions struct { - // The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. - Sharesnapshot *string - // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// FileClientGetRangeListOptions contains the optional parameters for the FileClient.GetRangeList method. -type FileClientGetRangeListOptions struct { - // The previous snapshot parameter is an opaque DateTime value that, when present, specifies the previous snapshot. - Prevsharesnapshot *string - // Specifies the range of bytes over which to list ranges, inclusively. - Range *string - // The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. - Sharesnapshot *string - // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// FileClientListHandlesOptions contains the optional parameters for the FileClient.ListHandles method. -type FileClientListHandlesOptions struct { - // A string value that identifies the portion of the list to be returned with the next list operation. The operation returns - // a marker value within the response body if the list returned was not complete. - // The marker value may then be used in a subsequent call to request the next set of list items. The marker value is opaque - // to the client. - Marker *string - // Specifies the maximum number of entries to return. If the request does not specify maxresults, or specifies a value greater - // than 5,000, the server will return up to 5,000 items. - Maxresults *int32 - // The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. - Sharesnapshot *string - // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// FileClientReleaseLeaseOptions contains the optional parameters for the FileClient.ReleaseLease method. -type FileClientReleaseLeaseOptions 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 File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// FileClientRenameOptions contains the optional parameters for the FileClient.Rename method. -type FileClientRenameOptions struct { - // If specified the permission (security descriptor) shall be set for the directory/file. This header can be used if Permission - // size is <= 8KB, else x-ms-file-permission-key header shall be used. Default - // value: Inherit. If SDDL is specified as input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission - // or x-ms-file-permission-key should be specified. - FilePermission *string - // Key of the permission to be set for the directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key - // should be specified. - FilePermissionKey *string - // Optional. A boolean value that specifies whether the ReadOnly attribute on a preexisting destination file should be respected. - // If true, the rename will succeed, otherwise, a previous file at the - // destination with the ReadOnly attribute set will cause the rename to fail. - IgnoreReadOnly *bool - // A name-value pair to associate with a file storage object. - Metadata map[string]*string - // Optional. A boolean value for if the destination file already exists, whether this request will overwrite the file or not. - // If true, the rename will succeed and will overwrite the destination file. If - // not provided or if false and the destination file does exist, the request will not overwrite the destination file. If provided - // and the destination file doesn’t exist, the rename will succeed. Note: - // This value does not override the x-ms-file-copy-ignore-read-only header value. - ReplaceIfExists *bool - // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// FileClientSetHTTPHeadersOptions contains the optional parameters for the FileClient.SetHTTPHeaders method. -type FileClientSetHTTPHeadersOptions struct { - // If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file and ‘Directory’ for directory. - // ‘None’ can also be specified as default. - FileAttributes *string - // Change time for the file/directory. Default value: Now. - FileChangeTime *string - // Resizes a file to the specified size. If the specified byte value is less than the current size of the file, then all ranges - // above the specified byte value are cleared. - FileContentLength *int64 - // Creation time for the file/directory. Default value: Now. - FileCreationTime *string - // Last write time for the file/directory. Default value: Now. - FileLastWriteTime *string - // If specified the permission (security descriptor) shall be set for the directory/file. This header can be used if Permission - // size is <= 8KB, else x-ms-file-permission-key header shall be used. Default - // value: Inherit. If SDDL is specified as input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission - // or x-ms-file-permission-key should be specified. - FilePermission *string - // Key of the permission to be set for the directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key - // should be specified. - FilePermissionKey *string - // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// FileClientSetMetadataOptions contains the optional parameters for the FileClient.SetMetadata method. -type FileClientSetMetadataOptions struct { - // A name-value pair to associate with a file storage object. - Metadata map[string]*string - // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// FileClientStartCopyOptions contains the optional parameters for the FileClient.StartCopy method. -type FileClientStartCopyOptions struct { - // If specified the permission (security descriptor) shall be set for the directory/file. This header can be used if Permission - // size is <= 8KB, else x-ms-file-permission-key header shall be used. Default - // value: Inherit. If SDDL is specified as input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission - // or x-ms-file-permission-key should be specified. - FilePermission *string - // Key of the permission to be set for the directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key - // should be specified. - FilePermissionKey *string - // A name-value pair to associate with a file storage object. - Metadata map[string]*string - // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// FileClientUploadRangeFromURLOptions contains the optional parameters for the FileClient.UploadRangeFromURL method. -type FileClientUploadRangeFromURLOptions struct { - // Only Bearer type is supported. Credentials should be a valid OAuth access token to copy source. - CopySourceAuthorization *string - // If the file last write time should be preserved or overwritten - FileLastWrittenMode *FileLastWrittenMode - // Specify the crc64 calculated for the range of bytes that must be read from the copy source. - SourceContentCRC64 []byte - // Bytes of source data in the specified range. - SourceRange *string - // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// FileClientUploadRangeOptions contains the optional parameters for the FileClient.UploadRange method. -type FileClientUploadRangeOptions struct { - // An MD5 hash of the content. This hash is used to verify the integrity of the data during transport. When the Content-MD5 - // header is specified, the File service compares the hash of the content that has - // arrived with the header value that was sent. If the two hashes do not match, the operation will fail with error code 400 - // (Bad Request). - ContentMD5 []byte - // If the file last write time should be preserved or overwritten - FileLastWrittenMode *FileLastWrittenMode - // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - // FileProperty - File properties. type FileProperty struct { // REQUIRED; Content length of the file. This value may not be up-to-date since an SMB client may have modified the file locally. @@ -600,12 +142,6 @@ type Handle struct { ParentID *string `xml:"ParentId"` } -// LeaseAccessConditions contains a group of parameters for the ShareClient.GetProperties method. -type LeaseAccessConditions struct { - // If specified, the operation only succeeds if the resource's lease is active and matches this ID. - LeaseID *string -} - // ListFilesAndDirectoriesSegmentResponse - An enumeration of directories and files. type ListFilesAndDirectoriesSegmentResponse struct { // REQUIRED @@ -690,40 +226,6 @@ type SMBSettings struct { Multichannel *SMBMultichannel `xml:"Multichannel"` } -// ServiceClientGetPropertiesOptions contains the optional parameters for the ServiceClient.GetProperties method. -type ServiceClientGetPropertiesOptions struct { - // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// ServiceClientListSharesSegmentOptions contains the optional parameters for the ServiceClient.NewListSharesSegmentPager -// method. -type ServiceClientListSharesSegmentOptions struct { - // Include this parameter to specify one or more datasets to include in the response. - Include []ListSharesIncludeType - // A string value that identifies the portion of the list to be returned with the next list operation. The operation returns - // a marker value within the response body if the list returned was not complete. - // The marker value may then be used in a subsequent call to request the next set of list items. The marker value is opaque - // to the client. - Marker *string - // Specifies the maximum number of entries to return. If the request does not specify maxresults, or specifies a value greater - // than 5,000, the server will return up to 5,000 items. - Maxresults *int32 - // Filters the results to return only entries whose name begins with the specified prefix. - Prefix *string - // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// ServiceClientSetPropertiesOptions contains the optional parameters for the ServiceClient.SetProperties method. -type ServiceClientSetPropertiesOptions struct { - // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - // Share - A listed Azure Storage share item. type Share struct { // REQUIRED @@ -739,214 +241,6 @@ type Share struct { Version *string `xml:"Version"` } -// ShareClientAcquireLeaseOptions contains the optional parameters for the ShareClient.AcquireLease method. -type ShareClientAcquireLeaseOptions struct { - // Proposed lease ID, in a GUID string format. The File 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 snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. - Sharesnapshot *string - // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// ShareClientBreakLeaseOptions contains the optional parameters for the ShareClient.BreakLease method. -type ShareClientBreakLeaseOptions struct { - // For a break operation, proposed duration the lease should continue before it is broken, in seconds, between 0 and 60. This - // break period is only used if it is shorter than the time remaining on the - // lease. If longer, the time remaining on the lease is used. A new lease will not be available before the break period has - // expired, but the lease may be held for longer than the break period. If this - // header does not appear with a break operation, a fixed-duration lease breaks after the remaining lease period elapses, - // and an infinite lease breaks immediately. - BreakPeriod *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 snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. - Sharesnapshot *string - // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// ShareClientChangeLeaseOptions contains the optional parameters for the ShareClient.ChangeLease method. -type ShareClientChangeLeaseOptions struct { - // Proposed lease ID, in a GUID string format. The File 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 snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. - Sharesnapshot *string - // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// ShareClientCreateOptions contains the optional parameters for the ShareClient.Create method. -type ShareClientCreateOptions struct { - // Specifies the access tier of the share. - AccessTier *ShareAccessTier - // Protocols to enable on the share. - EnabledProtocols *string - // A name-value pair to associate with a file storage object. - Metadata map[string]*string - // Specifies the maximum size of the share, in gigabytes. - Quota *int32 - // Root squash to set on the share. Only valid for NFS shares. - RootSquash *ShareRootSquash - // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// ShareClientCreatePermissionOptions contains the optional parameters for the ShareClient.CreatePermission method. -type ShareClientCreatePermissionOptions struct { - // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// ShareClientCreateSnapshotOptions contains the optional parameters for the ShareClient.CreateSnapshot method. -type ShareClientCreateSnapshotOptions struct { - // A name-value pair to associate with a file storage object. - Metadata map[string]*string - // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// ShareClientDeleteOptions contains the optional parameters for the ShareClient.Delete method. -type ShareClientDeleteOptions struct { - // Specifies the option include to delete the base share and all of its snapshots. - DeleteSnapshots *DeleteSnapshotsOptionType - // The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. - Sharesnapshot *string - // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// ShareClientGetAccessPolicyOptions contains the optional parameters for the ShareClient.GetAccessPolicy method. -type ShareClientGetAccessPolicyOptions struct { - // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// ShareClientGetPermissionOptions contains the optional parameters for the ShareClient.GetPermission method. -type ShareClientGetPermissionOptions struct { - // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// ShareClientGetPropertiesOptions contains the optional parameters for the ShareClient.GetProperties method. -type ShareClientGetPropertiesOptions struct { - // The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. - Sharesnapshot *string - // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// ShareClientGetStatisticsOptions contains the optional parameters for the ShareClient.GetStatistics method. -type ShareClientGetStatisticsOptions struct { - // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// ShareClientReleaseLeaseOptions contains the optional parameters for the ShareClient.ReleaseLease method. -type ShareClientReleaseLeaseOptions 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 snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. - Sharesnapshot *string - // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// ShareClientRenewLeaseOptions contains the optional parameters for the ShareClient.RenewLease method. -type ShareClientRenewLeaseOptions 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 snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. - Sharesnapshot *string - // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// ShareClientRestoreOptions contains the optional parameters for the ShareClient.Restore method. -type ShareClientRestoreOptions struct { - // Specifies the name of the previously-deleted share. - DeletedShareName *string - // Specifies the version of the previously-deleted share. - DeletedShareVersion *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 File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// ShareClientSetAccessPolicyOptions contains the optional parameters for the ShareClient.SetAccessPolicy method. -type ShareClientSetAccessPolicyOptions struct { - // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// ShareClientSetMetadataOptions contains the optional parameters for the ShareClient.SetMetadata method. -type ShareClientSetMetadataOptions struct { - // A name-value pair to associate with a file storage object. - Metadata map[string]*string - // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// ShareClientSetPropertiesOptions contains the optional parameters for the ShareClient.SetProperties method. -type ShareClientSetPropertiesOptions struct { - // Specifies the access tier of the share. - AccessTier *ShareAccessTier - // Specifies the maximum size of the share, in gigabytes. - Quota *int32 - // Root squash to set on the share. Only valid for NFS shares. - RootSquash *ShareRootSquash - // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. - // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] - Timeout *int32 -} - -// ShareFileHTTPHeaders contains a group of parameters for the FileClient.Create method. -type ShareFileHTTPHeaders struct { - // Sets the file's cache control. The File service stores this value but does not use or modify it. - CacheControl *string - // Sets the file's Content-Disposition header. - ContentDisposition *string - // Specifies which content encodings have been applied to the file. - ContentEncoding *string - // Specifies the natural languages used by this resource. - ContentLanguage *string - // Sets the file's MD5 hash. - ContentMD5 []byte - // Sets the MIME content type of the file. The default type is 'application/octet-stream'. - ContentType *string -} - // ShareFileRangeList - The list of file ranges type ShareFileRangeList struct { ClearRanges []*ClearRange `xml:"ClearRange"` @@ -1014,20 +308,6 @@ type SMBMultichannel struct { Enabled *bool `xml:"Enabled"` } -// SourceLeaseAccessConditions contains a group of parameters for the DirectoryClient.Rename method. -type SourceLeaseAccessConditions struct { - // Required if the source file has an active infinite lease. - SourceLeaseID *string -} - -// SourceModifiedAccessConditions contains a group of parameters for the FileClient.UploadRangeFromURL method. -type SourceModifiedAccessConditions struct { - // Specify the crc64 value to operate only on range with a matching crc64 checksum. - SourceIfMatchCRC64 []byte - // Specify the crc64 value to operate only on range without a matching crc64 checksum. - SourceIfNoneMatchCRC64 []byte -} - type StorageError struct { Message *string } diff --git a/sdk/storage/azfile/internal/generated/zz_models_serde.go b/sdk/storage/azfile/internal/generated/zz_models_serde.go index 94664adc2280..91a56c2eb3dc 100644 --- a/sdk/storage/azfile/internal/generated/zz_models_serde.go +++ b/sdk/storage/azfile/internal/generated/zz_models_serde.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package generated @@ -23,12 +22,12 @@ func (a AccessPolicy) MarshalXML(enc *xml.Encoder, start xml.StartElement) error type alias AccessPolicy aux := &struct { *alias - Expiry *timeRFC3339 `xml:"Expiry"` - Start *timeRFC3339 `xml:"Start"` + Expiry *dateTimeRFC3339 `xml:"Expiry"` + Start *dateTimeRFC3339 `xml:"Start"` }{ alias: (*alias)(&a), - Expiry: (*timeRFC3339)(a.Expiry), - Start: (*timeRFC3339)(a.Start), + Expiry: (*dateTimeRFC3339)(a.Expiry), + Start: (*dateTimeRFC3339)(a.Start), } return enc.EncodeElement(aux, start) } @@ -38,8 +37,8 @@ func (a *AccessPolicy) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) er type alias AccessPolicy aux := &struct { *alias - Expiry *timeRFC3339 `xml:"Expiry"` - Start *timeRFC3339 `xml:"Start"` + Expiry *dateTimeRFC3339 `xml:"Expiry"` + Start *dateTimeRFC3339 `xml:"Start"` }{ alias: (*alias)(a), } @@ -56,18 +55,18 @@ func (f FileProperty) MarshalXML(enc *xml.Encoder, start xml.StartElement) error type alias FileProperty aux := &struct { *alias - ChangeTime *timeRFC3339 `xml:"ChangeTime"` - CreationTime *timeRFC3339 `xml:"CreationTime"` - LastAccessTime *timeRFC3339 `xml:"LastAccessTime"` - LastModified *timeRFC1123 `xml:"Last-Modified"` - LastWriteTime *timeRFC3339 `xml:"LastWriteTime"` + ChangeTime *dateTimeRFC3339 `xml:"ChangeTime"` + CreationTime *dateTimeRFC3339 `xml:"CreationTime"` + LastAccessTime *dateTimeRFC3339 `xml:"LastAccessTime"` + LastModified *dateTimeRFC1123 `xml:"Last-Modified"` + LastWriteTime *dateTimeRFC3339 `xml:"LastWriteTime"` }{ alias: (*alias)(&f), - ChangeTime: (*timeRFC3339)(f.ChangeTime), - CreationTime: (*timeRFC3339)(f.CreationTime), - LastAccessTime: (*timeRFC3339)(f.LastAccessTime), - LastModified: (*timeRFC1123)(f.LastModified), - LastWriteTime: (*timeRFC3339)(f.LastWriteTime), + ChangeTime: (*dateTimeRFC3339)(f.ChangeTime), + CreationTime: (*dateTimeRFC3339)(f.CreationTime), + LastAccessTime: (*dateTimeRFC3339)(f.LastAccessTime), + LastModified: (*dateTimeRFC1123)(f.LastModified), + LastWriteTime: (*dateTimeRFC3339)(f.LastWriteTime), } return enc.EncodeElement(aux, start) } @@ -77,11 +76,11 @@ func (f *FileProperty) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) er type alias FileProperty aux := &struct { *alias - ChangeTime *timeRFC3339 `xml:"ChangeTime"` - CreationTime *timeRFC3339 `xml:"CreationTime"` - LastAccessTime *timeRFC3339 `xml:"LastAccessTime"` - LastModified *timeRFC1123 `xml:"Last-Modified"` - LastWriteTime *timeRFC3339 `xml:"LastWriteTime"` + ChangeTime *dateTimeRFC3339 `xml:"ChangeTime"` + CreationTime *dateTimeRFC3339 `xml:"CreationTime"` + LastAccessTime *dateTimeRFC3339 `xml:"LastAccessTime"` + LastModified *dateTimeRFC1123 `xml:"Last-Modified"` + LastWriteTime *dateTimeRFC3339 `xml:"LastWriteTime"` }{ alias: (*alias)(f), } @@ -212,16 +211,16 @@ func (s ShareProperties) MarshalXML(enc *xml.Encoder, start xml.StartElement) er type alias ShareProperties aux := &struct { *alias - AccessTierChangeTime *timeRFC1123 `xml:"AccessTierChangeTime"` - DeletedTime *timeRFC1123 `xml:"DeletedTime"` - LastModified *timeRFC1123 `xml:"Last-Modified"` - NextAllowedQuotaDowngradeTime *timeRFC1123 `xml:"NextAllowedQuotaDowngradeTime"` + AccessTierChangeTime *dateTimeRFC1123 `xml:"AccessTierChangeTime"` + DeletedTime *dateTimeRFC1123 `xml:"DeletedTime"` + LastModified *dateTimeRFC1123 `xml:"Last-Modified"` + NextAllowedQuotaDowngradeTime *dateTimeRFC1123 `xml:"NextAllowedQuotaDowngradeTime"` }{ alias: (*alias)(&s), - AccessTierChangeTime: (*timeRFC1123)(s.AccessTierChangeTime), - DeletedTime: (*timeRFC1123)(s.DeletedTime), - LastModified: (*timeRFC1123)(s.LastModified), - NextAllowedQuotaDowngradeTime: (*timeRFC1123)(s.NextAllowedQuotaDowngradeTime), + AccessTierChangeTime: (*dateTimeRFC1123)(s.AccessTierChangeTime), + DeletedTime: (*dateTimeRFC1123)(s.DeletedTime), + LastModified: (*dateTimeRFC1123)(s.LastModified), + NextAllowedQuotaDowngradeTime: (*dateTimeRFC1123)(s.NextAllowedQuotaDowngradeTime), } return enc.EncodeElement(aux, start) } @@ -231,10 +230,10 @@ func (s *ShareProperties) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) type alias ShareProperties aux := &struct { *alias - AccessTierChangeTime *timeRFC1123 `xml:"AccessTierChangeTime"` - DeletedTime *timeRFC1123 `xml:"DeletedTime"` - LastModified *timeRFC1123 `xml:"Last-Modified"` - NextAllowedQuotaDowngradeTime *timeRFC1123 `xml:"NextAllowedQuotaDowngradeTime"` + AccessTierChangeTime *dateTimeRFC1123 `xml:"AccessTierChangeTime"` + DeletedTime *dateTimeRFC1123 `xml:"DeletedTime"` + LastModified *dateTimeRFC1123 `xml:"Last-Modified"` + NextAllowedQuotaDowngradeTime *dateTimeRFC1123 `xml:"NextAllowedQuotaDowngradeTime"` }{ alias: (*alias)(s), } diff --git a/sdk/storage/azfile/internal/generated/zz_options.go b/sdk/storage/azfile/internal/generated/zz_options.go new file mode 100644 index 000000000000..5c1c92079d19 --- /dev/null +++ b/sdk/storage/azfile/internal/generated/zz_options.go @@ -0,0 +1,852 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package generated + +// CopyFileSMBInfo contains a group of parameters for the DirectoryClient.Rename method. +type CopyFileSMBInfo struct { + // Specifies either the option to copy file attributes from a source file(source) to a target file or a list of attributes + // to set on a target file. + FileAttributes *string + + // Specifies either the option to copy file last write time from a source file(source) to a target file or a time value in + // ISO 8601 format to set as last write time on a target file. + FileChangeTime *string + + // Specifies either the option to copy file creation time from a source file(source) to a target file or a time value in ISO + // 8601 format to set as creation time on a target file. + FileCreationTime *string + + // Specifies either the option to copy file last write time from a source file(source) to a target file or a time value in + // ISO 8601 format to set as last write time on a target file. + FileLastWriteTime *string + + // Specifies the option to copy file security descriptor from source file or to set it using the value which is defined by + // the header value of x-ms-file-permission or x-ms-file-permission-key. + FilePermissionCopyMode *PermissionCopyModeType + + // Specifies the option to overwrite the target file if it already exists and has read-only attribute set. + IgnoreReadOnly *bool + + // Specifies the option to set archive attribute on a target file. True means archive attribute will be set on a target file + // despite attribute overrides or a source file state. + SetArchiveAttribute *bool +} + +// DestinationLeaseAccessConditions contains a group of parameters for the DirectoryClient.Rename method. +type DestinationLeaseAccessConditions struct { + // Required if the destination file has an active infinite lease. The lease ID specified for this header must match the lease + // ID of the destination file. If the request does not include the lease ID or + // it is not valid, the operation fails with status code 412 (Precondition Failed). If this header is specified and the destination + // file does not currently have an active lease, the operation will also + // fail with status code 412 (Precondition Failed). + DestinationLeaseID *string +} + +// DirectoryClientCreateOptions contains the optional parameters for the DirectoryClient.Create method. +type DirectoryClientCreateOptions struct { + // If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file and ‘Directory’ for directory. + // ‘None’ can also be specified as default. + FileAttributes *string + + // Change time for the file/directory. Default value: Now. + FileChangeTime *string + + // Creation time for the file/directory. Default value: Now. + FileCreationTime *string + + // Last write time for the file/directory. Default value: Now. + FileLastWriteTime *string + + // If specified the permission (security descriptor) shall be set for the directory/file. This header can be used if Permission + // size is <= 8KB, else x-ms-file-permission-key header shall be used. Default + // value: Inherit. If SDDL is specified as input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission + // or x-ms-file-permission-key should be specified. + FilePermission *string + + // Key of the permission to be set for the directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key + // should be specified. + FilePermissionKey *string + + // A name-value pair to associate with a file storage object. + Metadata map[string]*string + + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// DirectoryClientDeleteOptions contains the optional parameters for the DirectoryClient.Delete method. +type DirectoryClientDeleteOptions struct { + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// DirectoryClientForceCloseHandlesOptions contains the optional parameters for the DirectoryClient.ForceCloseHandles method. +type DirectoryClientForceCloseHandlesOptions struct { + // A string value that identifies the portion of the list to be returned with the next list operation. The operation returns + // a marker value within the response body if the list returned was not complete. + // The marker value may then be used in a subsequent call to request the next set of list items. The marker value is opaque + // to the client. + Marker *string + + // Specifies operation should apply to the directory specified in the URI, its files, its subdirectories and their files. + Recursive *bool + + // The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. + Sharesnapshot *string + + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// DirectoryClientGetPropertiesOptions contains the optional parameters for the DirectoryClient.GetProperties method. +type DirectoryClientGetPropertiesOptions struct { + // The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. + Sharesnapshot *string + + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// DirectoryClientListFilesAndDirectoriesSegmentOptions contains the optional parameters for the DirectoryClient.NewListFilesAndDirectoriesSegmentPager +// method. +type DirectoryClientListFilesAndDirectoriesSegmentOptions struct { + // Include this parameter to specify one or more datasets to include in the response. + Include []ListFilesIncludeType + + // Include extended information. + IncludeExtendedInfo *bool + + // A string value that identifies the portion of the list to be returned with the next list operation. The operation returns + // a marker value within the response body if the list returned was not complete. + // The marker value may then be used in a subsequent call to request the next set of list items. The marker value is opaque + // to the client. + Marker *string + + // Specifies the maximum number of entries to return. If the request does not specify maxresults, or specifies a value greater + // than 5,000, the server will return up to 5,000 items. + Maxresults *int32 + + // Filters the results to return only entries whose name begins with the specified prefix. + Prefix *string + + // The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. + Sharesnapshot *string + + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// DirectoryClientListHandlesOptions contains the optional parameters for the DirectoryClient.ListHandles method. +type DirectoryClientListHandlesOptions struct { + // A string value that identifies the portion of the list to be returned with the next list operation. The operation returns + // a marker value within the response body if the list returned was not complete. + // The marker value may then be used in a subsequent call to request the next set of list items. The marker value is opaque + // to the client. + Marker *string + + // Specifies the maximum number of entries to return. If the request does not specify maxresults, or specifies a value greater + // than 5,000, the server will return up to 5,000 items. + Maxresults *int32 + + // Specifies operation should apply to the directory specified in the URI, its files, its subdirectories and their files. + Recursive *bool + + // The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. + Sharesnapshot *string + + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// DirectoryClientRenameOptions contains the optional parameters for the DirectoryClient.Rename method. +type DirectoryClientRenameOptions struct { + // If specified the permission (security descriptor) shall be set for the directory/file. This header can be used if Permission + // size is <= 8KB, else x-ms-file-permission-key header shall be used. Default + // value: Inherit. If SDDL is specified as input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission + // or x-ms-file-permission-key should be specified. + FilePermission *string + + // Key of the permission to be set for the directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key + // should be specified. + FilePermissionKey *string + + // Optional. A boolean value that specifies whether the ReadOnly attribute on a preexisting destination file should be respected. + // If true, the rename will succeed, otherwise, a previous file at the + // destination with the ReadOnly attribute set will cause the rename to fail. + IgnoreReadOnly *bool + + // A name-value pair to associate with a file storage object. + Metadata map[string]*string + + // Optional. A boolean value for if the destination file already exists, whether this request will overwrite the file or not. + // If true, the rename will succeed and will overwrite the destination file. If + // not provided or if false and the destination file does exist, the request will not overwrite the destination file. If provided + // and the destination file doesn’t exist, the rename will succeed. Note: + // This value does not override the x-ms-file-copy-ignore-read-only header value. + ReplaceIfExists *bool + + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// DirectoryClientSetMetadataOptions contains the optional parameters for the DirectoryClient.SetMetadata method. +type DirectoryClientSetMetadataOptions struct { + // A name-value pair to associate with a file storage object. + Metadata map[string]*string + + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// DirectoryClientSetPropertiesOptions contains the optional parameters for the DirectoryClient.SetProperties method. +type DirectoryClientSetPropertiesOptions struct { + // If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file and ‘Directory’ for directory. + // ‘None’ can also be specified as default. + FileAttributes *string + + // Change time for the file/directory. Default value: Now. + FileChangeTime *string + + // Creation time for the file/directory. Default value: Now. + FileCreationTime *string + + // Last write time for the file/directory. Default value: Now. + FileLastWriteTime *string + + // If specified the permission (security descriptor) shall be set for the directory/file. This header can be used if Permission + // size is <= 8KB, else x-ms-file-permission-key header shall be used. Default + // value: Inherit. If SDDL is specified as input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission + // or x-ms-file-permission-key should be specified. + FilePermission *string + + // Key of the permission to be set for the directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key + // should be specified. + FilePermissionKey *string + + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// FileClientAbortCopyOptions contains the optional parameters for the FileClient.AbortCopy method. +type FileClientAbortCopyOptions struct { + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// FileClientAcquireLeaseOptions contains the optional parameters for the FileClient.AcquireLease method. +type FileClientAcquireLeaseOptions struct { + // Proposed lease ID, in a GUID string format. The File 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 File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// FileClientBreakLeaseOptions contains the optional parameters for the FileClient.BreakLease method. +type FileClientBreakLeaseOptions 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 File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// FileClientChangeLeaseOptions contains the optional parameters for the FileClient.ChangeLease method. +type FileClientChangeLeaseOptions struct { + // Proposed lease ID, in a GUID string format. The File 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 File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// FileClientCreateOptions contains the optional parameters for the FileClient.Create method. +type FileClientCreateOptions struct { + // If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file and ‘Directory’ for directory. + // ‘None’ can also be specified as default. + FileAttributes *string + + // Change time for the file/directory. Default value: Now. + FileChangeTime *string + + // Creation time for the file/directory. Default value: Now. + FileCreationTime *string + + // Last write time for the file/directory. Default value: Now. + FileLastWriteTime *string + + // If specified the permission (security descriptor) shall be set for the directory/file. This header can be used if Permission + // size is <= 8KB, else x-ms-file-permission-key header shall be used. Default + // value: Inherit. If SDDL is specified as input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission + // or x-ms-file-permission-key should be specified. + FilePermission *string + + // Key of the permission to be set for the directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key + // should be specified. + FilePermissionKey *string + + // A name-value pair to associate with a file storage object. + Metadata map[string]*string + + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// FileClientDeleteOptions contains the optional parameters for the FileClient.Delete method. +type FileClientDeleteOptions struct { + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// FileClientDownloadOptions contains the optional parameters for the FileClient.Download method. +type FileClientDownloadOptions struct { + // Return file data only from the specified byte range. + Range *string + + // 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 4 MB in size. + RangeGetContentMD5 *bool + + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// FileClientForceCloseHandlesOptions contains the optional parameters for the FileClient.ForceCloseHandles method. +type FileClientForceCloseHandlesOptions struct { + // A string value that identifies the portion of the list to be returned with the next list operation. The operation returns + // a marker value within the response body if the list returned was not complete. + // The marker value may then be used in a subsequent call to request the next set of list items. The marker value is opaque + // to the client. + Marker *string + + // The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. + Sharesnapshot *string + + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// FileClientGetPropertiesOptions contains the optional parameters for the FileClient.GetProperties method. +type FileClientGetPropertiesOptions struct { + // The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. + Sharesnapshot *string + + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// FileClientGetRangeListOptions contains the optional parameters for the FileClient.GetRangeList method. +type FileClientGetRangeListOptions struct { + // The previous snapshot parameter is an opaque DateTime value that, when present, specifies the previous snapshot. + Prevsharesnapshot *string + + // Specifies the range of bytes over which to list ranges, inclusively. + Range *string + + // The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. + Sharesnapshot *string + + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// FileClientListHandlesOptions contains the optional parameters for the FileClient.ListHandles method. +type FileClientListHandlesOptions struct { + // A string value that identifies the portion of the list to be returned with the next list operation. The operation returns + // a marker value within the response body if the list returned was not complete. + // The marker value may then be used in a subsequent call to request the next set of list items. The marker value is opaque + // to the client. + Marker *string + + // Specifies the maximum number of entries to return. If the request does not specify maxresults, or specifies a value greater + // than 5,000, the server will return up to 5,000 items. + Maxresults *int32 + + // The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. + Sharesnapshot *string + + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// FileClientReleaseLeaseOptions contains the optional parameters for the FileClient.ReleaseLease method. +type FileClientReleaseLeaseOptions 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 File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// FileClientRenameOptions contains the optional parameters for the FileClient.Rename method. +type FileClientRenameOptions struct { + // If specified the permission (security descriptor) shall be set for the directory/file. This header can be used if Permission + // size is <= 8KB, else x-ms-file-permission-key header shall be used. Default + // value: Inherit. If SDDL is specified as input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission + // or x-ms-file-permission-key should be specified. + FilePermission *string + + // Key of the permission to be set for the directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key + // should be specified. + FilePermissionKey *string + + // Optional. A boolean value that specifies whether the ReadOnly attribute on a preexisting destination file should be respected. + // If true, the rename will succeed, otherwise, a previous file at the + // destination with the ReadOnly attribute set will cause the rename to fail. + IgnoreReadOnly *bool + + // A name-value pair to associate with a file storage object. + Metadata map[string]*string + + // Optional. A boolean value for if the destination file already exists, whether this request will overwrite the file or not. + // If true, the rename will succeed and will overwrite the destination file. If + // not provided or if false and the destination file does exist, the request will not overwrite the destination file. If provided + // and the destination file doesn’t exist, the rename will succeed. Note: + // This value does not override the x-ms-file-copy-ignore-read-only header value. + ReplaceIfExists *bool + + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// FileClientSetHTTPHeadersOptions contains the optional parameters for the FileClient.SetHTTPHeaders method. +type FileClientSetHTTPHeadersOptions struct { + // If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file and ‘Directory’ for directory. + // ‘None’ can also be specified as default. + FileAttributes *string + + // Change time for the file/directory. Default value: Now. + FileChangeTime *string + + // Resizes a file to the specified size. If the specified byte value is less than the current size of the file, then all ranges + // above the specified byte value are cleared. + FileContentLength *int64 + + // Creation time for the file/directory. Default value: Now. + FileCreationTime *string + + // Last write time for the file/directory. Default value: Now. + FileLastWriteTime *string + + // If specified the permission (security descriptor) shall be set for the directory/file. This header can be used if Permission + // size is <= 8KB, else x-ms-file-permission-key header shall be used. Default + // value: Inherit. If SDDL is specified as input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission + // or x-ms-file-permission-key should be specified. + FilePermission *string + + // Key of the permission to be set for the directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key + // should be specified. + FilePermissionKey *string + + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// FileClientSetMetadataOptions contains the optional parameters for the FileClient.SetMetadata method. +type FileClientSetMetadataOptions struct { + // A name-value pair to associate with a file storage object. + Metadata map[string]*string + + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// FileClientStartCopyOptions contains the optional parameters for the FileClient.StartCopy method. +type FileClientStartCopyOptions struct { + // If specified the permission (security descriptor) shall be set for the directory/file. This header can be used if Permission + // size is <= 8KB, else x-ms-file-permission-key header shall be used. Default + // value: Inherit. If SDDL is specified as input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission + // or x-ms-file-permission-key should be specified. + FilePermission *string + + // Key of the permission to be set for the directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key + // should be specified. + FilePermissionKey *string + + // A name-value pair to associate with a file storage object. + Metadata map[string]*string + + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// FileClientUploadRangeFromURLOptions contains the optional parameters for the FileClient.UploadRangeFromURL method. +type FileClientUploadRangeFromURLOptions struct { + // Only Bearer type is supported. Credentials should be a valid OAuth access token to copy source. + CopySourceAuthorization *string + + // If the file last write time should be preserved or overwritten + FileLastWrittenMode *FileLastWrittenMode + + // Specify the crc64 calculated for the range of bytes that must be read from the copy source. + SourceContentCRC64 []byte + + // Bytes of source data in the specified range. + SourceRange *string + + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// FileClientUploadRangeOptions contains the optional parameters for the FileClient.UploadRange method. +type FileClientUploadRangeOptions struct { + // An MD5 hash of the content. This hash is used to verify the integrity of the data during transport. When the Content-MD5 + // header is specified, the File service compares the hash of the content that has + // arrived with the header value that was sent. If the two hashes do not match, the operation will fail with error code 400 + // (Bad Request). + ContentMD5 []byte + + // If the file last write time should be preserved or overwritten + FileLastWrittenMode *FileLastWrittenMode + + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// LeaseAccessConditions contains a group of parameters for the ShareClient.GetProperties method. +type LeaseAccessConditions struct { + // If specified, the operation only succeeds if the resource's lease is active and matches this ID. + LeaseID *string +} + +// ServiceClientGetPropertiesOptions contains the optional parameters for the ServiceClient.GetProperties method. +type ServiceClientGetPropertiesOptions struct { + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// ServiceClientListSharesSegmentOptions contains the optional parameters for the ServiceClient.NewListSharesSegmentPager +// method. +type ServiceClientListSharesSegmentOptions struct { + // Include this parameter to specify one or more datasets to include in the response. + Include []ListSharesIncludeType + + // A string value that identifies the portion of the list to be returned with the next list operation. The operation returns + // a marker value within the response body if the list returned was not complete. + // The marker value may then be used in a subsequent call to request the next set of list items. The marker value is opaque + // to the client. + Marker *string + + // Specifies the maximum number of entries to return. If the request does not specify maxresults, or specifies a value greater + // than 5,000, the server will return up to 5,000 items. + Maxresults *int32 + + // Filters the results to return only entries whose name begins with the specified prefix. + Prefix *string + + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// ServiceClientSetPropertiesOptions contains the optional parameters for the ServiceClient.SetProperties method. +type ServiceClientSetPropertiesOptions struct { + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// ShareClientAcquireLeaseOptions contains the optional parameters for the ShareClient.AcquireLease method. +type ShareClientAcquireLeaseOptions struct { + // Proposed lease ID, in a GUID string format. The File 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 snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. + Sharesnapshot *string + + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// ShareClientBreakLeaseOptions contains the optional parameters for the ShareClient.BreakLease method. +type ShareClientBreakLeaseOptions struct { + // For a break operation, proposed duration the lease should continue before it is broken, in seconds, between 0 and 60. This + // break period is only used if it is shorter than the time remaining on the + // lease. If longer, the time remaining on the lease is used. A new lease will not be available before the break period has + // expired, but the lease may be held for longer than the break period. If this + // header does not appear with a break operation, a fixed-duration lease breaks after the remaining lease period elapses, + // and an infinite lease breaks immediately. + BreakPeriod *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 snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. + Sharesnapshot *string + + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// ShareClientChangeLeaseOptions contains the optional parameters for the ShareClient.ChangeLease method. +type ShareClientChangeLeaseOptions struct { + // Proposed lease ID, in a GUID string format. The File 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 snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. + Sharesnapshot *string + + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// ShareClientCreateOptions contains the optional parameters for the ShareClient.Create method. +type ShareClientCreateOptions struct { + // Specifies the access tier of the share. + AccessTier *ShareAccessTier + + // Protocols to enable on the share. + EnabledProtocols *string + + // A name-value pair to associate with a file storage object. + Metadata map[string]*string + + // Specifies the maximum size of the share, in gigabytes. + Quota *int32 + + // Root squash to set on the share. Only valid for NFS shares. + RootSquash *ShareRootSquash + + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// ShareClientCreatePermissionOptions contains the optional parameters for the ShareClient.CreatePermission method. +type ShareClientCreatePermissionOptions struct { + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// ShareClientCreateSnapshotOptions contains the optional parameters for the ShareClient.CreateSnapshot method. +type ShareClientCreateSnapshotOptions struct { + // A name-value pair to associate with a file storage object. + Metadata map[string]*string + + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// ShareClientDeleteOptions contains the optional parameters for the ShareClient.Delete method. +type ShareClientDeleteOptions struct { + // Specifies the option include to delete the base share and all of its snapshots. + DeleteSnapshots *DeleteSnapshotsOptionType + + // The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. + Sharesnapshot *string + + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// ShareClientGetAccessPolicyOptions contains the optional parameters for the ShareClient.GetAccessPolicy method. +type ShareClientGetAccessPolicyOptions struct { + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// ShareClientGetPermissionOptions contains the optional parameters for the ShareClient.GetPermission method. +type ShareClientGetPermissionOptions struct { + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// ShareClientGetPropertiesOptions contains the optional parameters for the ShareClient.GetProperties method. +type ShareClientGetPropertiesOptions struct { + // The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. + Sharesnapshot *string + + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// ShareClientGetStatisticsOptions contains the optional parameters for the ShareClient.GetStatistics method. +type ShareClientGetStatisticsOptions struct { + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// ShareClientReleaseLeaseOptions contains the optional parameters for the ShareClient.ReleaseLease method. +type ShareClientReleaseLeaseOptions 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 snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. + Sharesnapshot *string + + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// ShareClientRenewLeaseOptions contains the optional parameters for the ShareClient.RenewLease method. +type ShareClientRenewLeaseOptions 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 snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. + Sharesnapshot *string + + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// ShareClientRestoreOptions contains the optional parameters for the ShareClient.Restore method. +type ShareClientRestoreOptions struct { + // Specifies the name of the previously-deleted share. + DeletedShareName *string + + // Specifies the version of the previously-deleted share. + DeletedShareVersion *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 File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// ShareClientSetAccessPolicyOptions contains the optional parameters for the ShareClient.SetAccessPolicy method. +type ShareClientSetAccessPolicyOptions struct { + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// ShareClientSetMetadataOptions contains the optional parameters for the ShareClient.SetMetadata method. +type ShareClientSetMetadataOptions struct { + // A name-value pair to associate with a file storage object. + Metadata map[string]*string + + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// ShareClientSetPropertiesOptions contains the optional parameters for the ShareClient.SetProperties method. +type ShareClientSetPropertiesOptions struct { + // Specifies the access tier of the share. + AccessTier *ShareAccessTier + + // Specifies the maximum size of the share, in gigabytes. + Quota *int32 + + // Root squash to set on the share. Only valid for NFS shares. + RootSquash *ShareRootSquash + + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN] + Timeout *int32 +} + +// ShareFileHTTPHeaders contains a group of parameters for the FileClient.Create method. +type ShareFileHTTPHeaders struct { + // Sets the file's cache control. The File service stores this value but does not use or modify it. + CacheControl *string + + // Sets the file's Content-Disposition header. + ContentDisposition *string + + // Specifies which content encodings have been applied to the file. + ContentEncoding *string + + // Specifies the natural languages used by this resource. + ContentLanguage *string + + // Sets the file's MD5 hash. + ContentMD5 []byte + + // Sets the MIME content type of the file. The default type is 'application/octet-stream'. + ContentType *string +} + +// SourceLeaseAccessConditions contains a group of parameters for the DirectoryClient.Rename method. +type SourceLeaseAccessConditions struct { + // Required if the source file has an active infinite lease. + SourceLeaseID *string +} + +// SourceModifiedAccessConditions contains a group of parameters for the FileClient.UploadRangeFromURL method. +type SourceModifiedAccessConditions struct { + // Specify the crc64 value to operate only on range with a matching crc64 checksum. + SourceIfMatchCRC64 []byte + + // Specify the crc64 value to operate only on range without a matching crc64 checksum. + SourceIfNoneMatchCRC64 []byte +} diff --git a/sdk/storage/azfile/internal/generated/zz_response_types.go b/sdk/storage/azfile/internal/generated/zz_response_types.go index b94bd5e6fae4..69709e4aaabf 100644 --- a/sdk/storage/azfile/internal/generated/zz_response_types.go +++ b/sdk/storage/azfile/internal/generated/zz_response_types.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package generated @@ -137,34 +136,38 @@ type DirectoryClientGetPropertiesResponse struct { // DirectoryClientListFilesAndDirectoriesSegmentResponse contains the response from method DirectoryClient.NewListFilesAndDirectoriesSegmentPager. type DirectoryClientListFilesAndDirectoriesSegmentResponse struct { + // An enumeration of directories and files. ListFilesAndDirectoriesSegmentResponse + // ContentType contains the information returned from the Content-Type header response. - ContentType *string `xml:"ContentType"` + ContentType *string // Date contains the information returned from the Date header response. - Date *time.Time `xml:"Date"` + Date *time.Time // RequestID contains the information returned from the x-ms-request-id header response. - RequestID *string `xml:"RequestID"` + RequestID *string // Version contains the information returned from the x-ms-version header response. - Version *string `xml:"Version"` + Version *string } // DirectoryClientListHandlesResponse contains the response from method DirectoryClient.ListHandles. type DirectoryClientListHandlesResponse struct { + // An enumeration of handles. ListHandlesResponse + // ContentType contains the information returned from the Content-Type header response. - ContentType *string `xml:"ContentType"` + ContentType *string // Date contains the information returned from the Date header response. - Date *time.Time `xml:"Date"` + Date *time.Time // RequestID contains the information returned from the x-ms-request-id header response. - RequestID *string `xml:"RequestID"` + RequestID *string // Version contains the information returned from the x-ms-version header response. - Version *string `xml:"Version"` + Version *string } // DirectoryClientRenameResponse contains the response from method DirectoryClient.Rename. @@ -631,40 +634,44 @@ type FileClientGetPropertiesResponse struct { // FileClientGetRangeListResponse contains the response from method FileClient.GetRangeList. type FileClientGetRangeListResponse struct { + // The list of file ranges ShareFileRangeList + // Date contains the information returned from the Date header response. - Date *time.Time `xml:"Date"` + Date *time.Time // ETag contains the information returned from the ETag header response. - ETag *azcore.ETag `xml:"ETag"` + ETag *azcore.ETag // FileContentLength contains the information returned from the x-ms-content-length header response. - FileContentLength *int64 `xml:"FileContentLength"` + FileContentLength *int64 // LastModified contains the information returned from the Last-Modified header response. - LastModified *time.Time `xml:"LastModified"` + LastModified *time.Time // RequestID contains the information returned from the x-ms-request-id header response. - RequestID *string `xml:"RequestID"` + RequestID *string // Version contains the information returned from the x-ms-version header response. - Version *string `xml:"Version"` + Version *string } // FileClientListHandlesResponse contains the response from method FileClient.ListHandles. type FileClientListHandlesResponse struct { + // An enumeration of handles. ListHandlesResponse + // ContentType contains the information returned from the Content-Type header response. - ContentType *string `xml:"ContentType"` + ContentType *string // Date contains the information returned from the Date header response. - Date *time.Time `xml:"Date"` + Date *time.Time // RequestID contains the information returned from the x-ms-request-id header response. - RequestID *string `xml:"RequestID"` + RequestID *string // Version contains the information returned from the x-ms-version header response. - Version *string `xml:"Version"` + Version *string } // FileClientReleaseLeaseResponse contains the response from method FileClient.ReleaseLease. @@ -876,22 +883,26 @@ type FileClientUploadRangeResponse struct { // ServiceClientGetPropertiesResponse contains the response from method ServiceClient.GetProperties. type ServiceClientGetPropertiesResponse struct { + // Storage service properties. StorageServiceProperties + // RequestID contains the information returned from the x-ms-request-id header response. - RequestID *string `xml:"RequestID"` + RequestID *string // Version contains the information returned from the x-ms-version header response. - Version *string `xml:"Version"` + Version *string } // ServiceClientListSharesSegmentResponse contains the response from method ServiceClient.NewListSharesSegmentPager. type ServiceClientListSharesSegmentResponse struct { + // An enumeration of shares. ListSharesResponse + // RequestID contains the information returned from the x-ms-request-id header response. - RequestID *string `xml:"RequestID"` + RequestID *string // Version contains the information returned from the x-ms-version header response. - Version *string `xml:"Version"` + Version *string } // ServiceClientSetPropertiesResponse contains the response from method ServiceClient.SetProperties. @@ -1047,27 +1058,29 @@ type ShareClientDeleteResponse struct { // ShareClientGetAccessPolicyResponse contains the response from method ShareClient.GetAccessPolicy. type ShareClientGetAccessPolicyResponse struct { // Date contains the information returned from the Date header response. - Date *time.Time `xml:"Date"` + Date *time.Time // ETag contains the information returned from the ETag header response. - ETag *azcore.ETag `xml:"ETag"` + ETag *azcore.ETag // LastModified contains the information returned from the Last-Modified header response. - LastModified *time.Time `xml:"LastModified"` + LastModified *time.Time // RequestID contains the information returned from the x-ms-request-id header response. - RequestID *string `xml:"RequestID"` + RequestID *string // A collection of signed identifiers. SignedIdentifiers []*SignedIdentifier `xml:"SignedIdentifier"` // Version contains the information returned from the x-ms-version header response. - Version *string `xml:"Version"` + Version *string } // ShareClientGetPermissionResponse contains the response from method ShareClient.GetPermission. type ShareClientGetPermissionResponse struct { + // A permission (a security descriptor) at the share level. SharePermission + // Date contains the information returned from the Date header response. Date *time.Time @@ -1144,21 +1157,23 @@ type ShareClientGetPropertiesResponse struct { // ShareClientGetStatisticsResponse contains the response from method ShareClient.GetStatistics. type ShareClientGetStatisticsResponse struct { + // Stats for the share. ShareStats + // Date contains the information returned from the Date header response. - Date *time.Time `xml:"Date"` + Date *time.Time // ETag contains the information returned from the ETag header response. - ETag *azcore.ETag `xml:"ETag"` + ETag *azcore.ETag // LastModified contains the information returned from the Last-Modified header response. - LastModified *time.Time `xml:"LastModified"` + LastModified *time.Time // RequestID contains the information returned from the x-ms-request-id header response. - RequestID *string `xml:"RequestID"` + RequestID *string // Version contains the information returned from the x-ms-version header response. - Version *string `xml:"Version"` + Version *string } // ShareClientReleaseLeaseResponse contains the response from method ShareClient.ReleaseLease. diff --git a/sdk/storage/azfile/internal/generated/zz_service_client.go b/sdk/storage/azfile/internal/generated/zz_service_client.go index fc0cf80a4f2c..436dc845336e 100644 --- a/sdk/storage/azfile/internal/generated/zz_service_client.go +++ b/sdk/storage/azfile/internal/generated/zz_service_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package generated @@ -34,18 +33,21 @@ type ServiceClient struct { // Generated from API version 2023-11-03 // - options - ServiceClientGetPropertiesOptions contains the optional parameters for the ServiceClient.GetProperties method. func (client *ServiceClient) GetProperties(ctx context.Context, options *ServiceClientGetPropertiesOptions) (ServiceClientGetPropertiesResponse, error) { + var err error req, err := client.getPropertiesCreateRequest(ctx, options) if err != nil { return ServiceClientGetPropertiesResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ServiceClientGetPropertiesResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServiceClientGetPropertiesResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServiceClientGetPropertiesResponse{}, err } - return client.getPropertiesHandleResponse(resp) + resp, err := client.getPropertiesHandleResponse(httpResp) + return resp, err } // getPropertiesCreateRequest creates the GetProperties request. @@ -140,18 +142,21 @@ func (client *ServiceClient) ListSharesSegmentHandleResponse(resp *http.Response // - storageServiceProperties - The StorageService properties. // - options - ServiceClientSetPropertiesOptions contains the optional parameters for the ServiceClient.SetProperties method. func (client *ServiceClient) SetProperties(ctx context.Context, storageServiceProperties StorageServiceProperties, options *ServiceClientSetPropertiesOptions) (ServiceClientSetPropertiesResponse, error) { + var err error req, err := client.setPropertiesCreateRequest(ctx, storageServiceProperties, options) if err != nil { return ServiceClientSetPropertiesResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ServiceClientSetPropertiesResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted) { - return ServiceClientSetPropertiesResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return ServiceClientSetPropertiesResponse{}, err } - return client.setPropertiesHandleResponse(resp) + resp, err := client.setPropertiesHandleResponse(httpResp) + return resp, err } // setPropertiesCreateRequest creates the SetProperties request. diff --git a/sdk/storage/azfile/internal/generated/zz_share_client.go b/sdk/storage/azfile/internal/generated/zz_share_client.go index 83a3092cd292..9ef788133d07 100644 --- a/sdk/storage/azfile/internal/generated/zz_share_client.go +++ b/sdk/storage/azfile/internal/generated/zz_share_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package generated @@ -40,18 +39,21 @@ type ShareClient struct { // renew or change. // - options - ShareClientAcquireLeaseOptions contains the optional parameters for the ShareClient.AcquireLease method. func (client *ShareClient) AcquireLease(ctx context.Context, duration int32, options *ShareClientAcquireLeaseOptions) (ShareClientAcquireLeaseResponse, error) { + var err error req, err := client.acquireLeaseCreateRequest(ctx, duration, options) if err != nil { return ShareClientAcquireLeaseResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ShareClientAcquireLeaseResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusCreated) { - return ShareClientAcquireLeaseResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return ShareClientAcquireLeaseResponse{}, err } - return client.acquireLeaseHandleResponse(resp) + resp, err := client.acquireLeaseHandleResponse(httpResp) + return resp, err } // acquireLeaseCreateRequest creates the AcquireLease request. @@ -86,6 +88,16 @@ func (client *ShareClient) acquireLeaseCreateRequest(ctx context.Context, durati // acquireLeaseHandleResponse handles the AcquireLease response. func (client *ShareClient) acquireLeaseHandleResponse(resp *http.Response) (ShareClientAcquireLeaseResponse, error) { result := ShareClientAcquireLeaseResponse{} + if val := resp.Header.Get("x-ms-client-request-id"); val != "" { + result.ClientRequestID = &val + } + if val := resp.Header.Get("Date"); val != "" { + date, err := time.Parse(time.RFC1123, val) + if err != nil { + return ShareClientAcquireLeaseResponse{}, err + } + result.Date = &date + } if val := resp.Header.Get("ETag"); val != "" { result.ETag = (*azcore.ETag)(&val) } @@ -99,22 +111,12 @@ func (client *ShareClient) acquireLeaseHandleResponse(resp *http.Response) (Shar if val := resp.Header.Get("x-ms-lease-id"); val != "" { result.LeaseID = &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 ShareClientAcquireLeaseResponse{}, err - } - result.Date = &date - } return result, nil } @@ -126,18 +128,21 @@ func (client *ShareClient) acquireLeaseHandleResponse(resp *http.Response) (Shar // - options - ShareClientBreakLeaseOptions contains the optional parameters for the ShareClient.BreakLease method. // - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ShareClient.GetProperties method. func (client *ShareClient) BreakLease(ctx context.Context, options *ShareClientBreakLeaseOptions, leaseAccessConditions *LeaseAccessConditions) (ShareClientBreakLeaseResponse, error) { + var err error req, err := client.breakLeaseCreateRequest(ctx, options, leaseAccessConditions) if err != nil { return ShareClientBreakLeaseResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ShareClientBreakLeaseResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted) { - return ShareClientBreakLeaseResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return ShareClientBreakLeaseResponse{}, err } - return client.breakLeaseHandleResponse(resp) + resp, err := client.breakLeaseHandleResponse(httpResp) + return resp, err } // breakLeaseCreateRequest creates the BreakLease request. @@ -174,6 +179,16 @@ func (client *ShareClient) breakLeaseCreateRequest(ctx context.Context, options // breakLeaseHandleResponse handles the BreakLease response. func (client *ShareClient) breakLeaseHandleResponse(resp *http.Response) (ShareClientBreakLeaseResponse, error) { result := ShareClientBreakLeaseResponse{} + if val := resp.Header.Get("x-ms-client-request-id"); val != "" { + result.ClientRequestID = &val + } + if val := resp.Header.Get("Date"); val != "" { + date, err := time.Parse(time.RFC1123, val) + if err != nil { + return ShareClientBreakLeaseResponse{}, err + } + result.Date = &date + } if val := resp.Header.Get("ETag"); val != "" { result.ETag = (*azcore.ETag)(&val) } @@ -184,6 +199,9 @@ func (client *ShareClient) breakLeaseHandleResponse(resp *http.Response) (ShareC } result.LastModified = &lastModified } + if val := resp.Header.Get("x-ms-lease-id"); val != "" { + result.LeaseID = &val + } if val := resp.Header.Get("x-ms-lease-time"); val != "" { leaseTime32, err := strconv.ParseInt(val, 10, 32) leaseTime := int32(leaseTime32) @@ -192,25 +210,12 @@ func (client *ShareClient) breakLeaseHandleResponse(resp *http.Response) (ShareC } result.LeaseTime = &leaseTime } - if val := resp.Header.Get("x-ms-lease-id"); val != "" { - result.LeaseID = &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 ShareClientBreakLeaseResponse{}, err - } - result.Date = &date - } return result, nil } @@ -222,18 +227,21 @@ func (client *ShareClient) breakLeaseHandleResponse(resp *http.Response) (ShareC // - leaseID - Specifies the current lease ID on the resource. // - options - ShareClientChangeLeaseOptions contains the optional parameters for the ShareClient.ChangeLease method. func (client *ShareClient) ChangeLease(ctx context.Context, leaseID string, options *ShareClientChangeLeaseOptions) (ShareClientChangeLeaseResponse, error) { + var err error req, err := client.changeLeaseCreateRequest(ctx, leaseID, options) if err != nil { return ShareClientChangeLeaseResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ShareClientChangeLeaseResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ShareClientChangeLeaseResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ShareClientChangeLeaseResponse{}, err } - return client.changeLeaseHandleResponse(resp) + resp, err := client.changeLeaseHandleResponse(httpResp) + return resp, err } // changeLeaseCreateRequest creates the ChangeLease request. @@ -268,6 +276,16 @@ func (client *ShareClient) changeLeaseCreateRequest(ctx context.Context, leaseID // changeLeaseHandleResponse handles the ChangeLease response. func (client *ShareClient) changeLeaseHandleResponse(resp *http.Response) (ShareClientChangeLeaseResponse, error) { result := ShareClientChangeLeaseResponse{} + if val := resp.Header.Get("x-ms-client-request-id"); val != "" { + result.ClientRequestID = &val + } + if val := resp.Header.Get("Date"); val != "" { + date, err := time.Parse(time.RFC1123, val) + if err != nil { + return ShareClientChangeLeaseResponse{}, err + } + result.Date = &date + } if val := resp.Header.Get("ETag"); val != "" { result.ETag = (*azcore.ETag)(&val) } @@ -281,22 +299,12 @@ func (client *ShareClient) changeLeaseHandleResponse(resp *http.Response) (Share if val := resp.Header.Get("x-ms-lease-id"); val != "" { result.LeaseID = &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 ShareClientChangeLeaseResponse{}, err - } - result.Date = &date - } return result, nil } @@ -307,18 +315,21 @@ func (client *ShareClient) changeLeaseHandleResponse(resp *http.Response) (Share // Generated from API version 2023-11-03 // - options - ShareClientCreateOptions contains the optional parameters for the ShareClient.Create method. func (client *ShareClient) Create(ctx context.Context, options *ShareClientCreateOptions) (ShareClientCreateResponse, error) { + var err error req, err := client.createCreateRequest(ctx, options) if err != nil { return ShareClientCreateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ShareClientCreateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusCreated) { - return ShareClientCreateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return ShareClientCreateResponse{}, err } - return client.createHandleResponse(resp) + resp, err := client.createHandleResponse(httpResp) + return resp, err } // createCreateRequest creates the Create request. @@ -360,6 +371,13 @@ func (client *ShareClient) createCreateRequest(ctx context.Context, options *Sha // createHandleResponse handles the Create response. func (client *ShareClient) createHandleResponse(resp *http.Response) (ShareClientCreateResponse, error) { result := ShareClientCreateResponse{} + if val := resp.Header.Get("Date"); val != "" { + date, err := time.Parse(time.RFC1123, val) + if err != nil { + return ShareClientCreateResponse{}, err + } + result.Date = &date + } if val := resp.Header.Get("ETag"); val != "" { result.ETag = (*azcore.ETag)(&val) } @@ -376,13 +394,6 @@ func (client *ShareClient) createHandleResponse(resp *http.Response) (ShareClien 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 ShareClientCreateResponse{}, err - } - result.Date = &date - } return result, nil } @@ -393,18 +404,21 @@ func (client *ShareClient) createHandleResponse(resp *http.Response) (ShareClien // - sharePermission - A permission (a security descriptor) at the share level. // - options - ShareClientCreatePermissionOptions contains the optional parameters for the ShareClient.CreatePermission method. func (client *ShareClient) CreatePermission(ctx context.Context, sharePermission SharePermission, options *ShareClientCreatePermissionOptions) (ShareClientCreatePermissionResponse, error) { + var err error req, err := client.createPermissionCreateRequest(ctx, sharePermission, options) if err != nil { return ShareClientCreatePermissionResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ShareClientCreatePermissionResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusCreated) { - return ShareClientCreatePermissionResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return ShareClientCreatePermissionResponse{}, err } - return client.createPermissionHandleResponse(resp) + resp, err := client.createPermissionHandleResponse(httpResp) + return resp, err } // createPermissionCreateRequest creates the CreatePermission request. @@ -434,12 +448,6 @@ func (client *ShareClient) createPermissionCreateRequest(ctx context.Context, sh // createPermissionHandleResponse handles the CreatePermission response. func (client *ShareClient) createPermissionHandleResponse(resp *http.Response) (ShareClientCreatePermissionResponse, error) { result := ShareClientCreatePermissionResponse{} - 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 { @@ -450,6 +458,12 @@ func (client *ShareClient) createPermissionHandleResponse(resp *http.Response) ( if val := resp.Header.Get("x-ms-file-permission-key"); val != "" { result.FilePermissionKey = &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 } @@ -459,18 +473,21 @@ func (client *ShareClient) createPermissionHandleResponse(resp *http.Response) ( // Generated from API version 2023-11-03 // - options - ShareClientCreateSnapshotOptions contains the optional parameters for the ShareClient.CreateSnapshot method. func (client *ShareClient) CreateSnapshot(ctx context.Context, options *ShareClientCreateSnapshotOptions) (ShareClientCreateSnapshotResponse, error) { + var err error req, err := client.createSnapshotCreateRequest(ctx, options) if err != nil { return ShareClientCreateSnapshotResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ShareClientCreateSnapshotResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusCreated) { - return ShareClientCreateSnapshotResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return ShareClientCreateSnapshotResponse{}, err } - return client.createSnapshotHandleResponse(resp) + resp, err := client.createSnapshotHandleResponse(httpResp) + return resp, err } // createSnapshotCreateRequest creates the CreateSnapshot request. @@ -501,8 +518,12 @@ func (client *ShareClient) createSnapshotCreateRequest(ctx context.Context, opti // createSnapshotHandleResponse handles the CreateSnapshot response. func (client *ShareClient) createSnapshotHandleResponse(resp *http.Response) (ShareClientCreateSnapshotResponse, error) { result := ShareClientCreateSnapshotResponse{} - if val := resp.Header.Get("x-ms-snapshot"); val != "" { - result.Snapshot = &val + if val := resp.Header.Get("Date"); val != "" { + date, err := time.Parse(time.RFC1123, val) + if err != nil { + return ShareClientCreateSnapshotResponse{}, err + } + result.Date = &date } if val := resp.Header.Get("ETag"); val != "" { result.ETag = (*azcore.ETag)(&val) @@ -517,16 +538,12 @@ func (client *ShareClient) createSnapshotHandleResponse(resp *http.Response) (Sh if val := resp.Header.Get("x-ms-request-id"); val != "" { result.RequestID = &val } + if val := resp.Header.Get("x-ms-snapshot"); val != "" { + result.Snapshot = &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 ShareClientCreateSnapshotResponse{}, err - } - result.Date = &date - } return result, nil } @@ -538,18 +555,21 @@ func (client *ShareClient) createSnapshotHandleResponse(resp *http.Response) (Sh // - options - ShareClientDeleteOptions contains the optional parameters for the ShareClient.Delete method. // - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ShareClient.GetProperties method. func (client *ShareClient) Delete(ctx context.Context, options *ShareClientDeleteOptions, leaseAccessConditions *LeaseAccessConditions) (ShareClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, options, leaseAccessConditions) if err != nil { return ShareClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ShareClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted) { - return ShareClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return ShareClientDeleteResponse{}, err } - return client.deleteHandleResponse(resp) + resp, err := client.deleteHandleResponse(httpResp) + return resp, err } // deleteCreateRequest creates the Delete request. @@ -581,12 +601,6 @@ func (client *ShareClient) deleteCreateRequest(ctx context.Context, options *Sha // deleteHandleResponse handles the Delete response. func (client *ShareClient) deleteHandleResponse(resp *http.Response) (ShareClientDeleteResponse, error) { result := ShareClientDeleteResponse{} - 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 { @@ -594,6 +608,12 @@ func (client *ShareClient) deleteHandleResponse(resp *http.Response) (ShareClien } 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 + } return result, nil } @@ -604,18 +624,21 @@ func (client *ShareClient) deleteHandleResponse(resp *http.Response) (ShareClien // - options - ShareClientGetAccessPolicyOptions contains the optional parameters for the ShareClient.GetAccessPolicy method. // - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ShareClient.GetProperties method. func (client *ShareClient) GetAccessPolicy(ctx context.Context, options *ShareClientGetAccessPolicyOptions, leaseAccessConditions *LeaseAccessConditions) (ShareClientGetAccessPolicyResponse, error) { + var err error req, err := client.getAccessPolicyCreateRequest(ctx, options, leaseAccessConditions) if err != nil { return ShareClientGetAccessPolicyResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ShareClientGetAccessPolicyResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ShareClientGetAccessPolicyResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ShareClientGetAccessPolicyResponse{}, err } - return client.getAccessPolicyHandleResponse(resp) + resp, err := client.getAccessPolicyHandleResponse(httpResp) + return resp, err } // getAccessPolicyCreateRequest creates the GetAccessPolicy request. @@ -642,6 +665,13 @@ func (client *ShareClient) getAccessPolicyCreateRequest(ctx context.Context, opt // getAccessPolicyHandleResponse handles the GetAccessPolicy response. func (client *ShareClient) getAccessPolicyHandleResponse(resp *http.Response) (ShareClientGetAccessPolicyResponse, error) { result := ShareClientGetAccessPolicyResponse{} + if val := resp.Header.Get("Date"); val != "" { + date, err := time.Parse(time.RFC1123, val) + if err != nil { + return ShareClientGetAccessPolicyResponse{}, err + } + result.Date = &date + } if val := resp.Header.Get("ETag"); val != "" { result.ETag = (*azcore.ETag)(&val) } @@ -658,13 +688,6 @@ func (client *ShareClient) getAccessPolicyHandleResponse(resp *http.Response) (S 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 ShareClientGetAccessPolicyResponse{}, err - } - result.Date = &date - } if err := runtime.UnmarshalAsXML(resp, &result); err != nil { return ShareClientGetAccessPolicyResponse{}, err } @@ -678,18 +701,21 @@ func (client *ShareClient) getAccessPolicyHandleResponse(resp *http.Response) (S // - filePermissionKey - Key of the permission to be set for the directory/file. // - options - ShareClientGetPermissionOptions contains the optional parameters for the ShareClient.GetPermission method. func (client *ShareClient) GetPermission(ctx context.Context, filePermissionKey string, options *ShareClientGetPermissionOptions) (ShareClientGetPermissionResponse, error) { + var err error req, err := client.getPermissionCreateRequest(ctx, filePermissionKey, options) if err != nil { return ShareClientGetPermissionResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ShareClientGetPermissionResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ShareClientGetPermissionResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ShareClientGetPermissionResponse{}, err } - return client.getPermissionHandleResponse(resp) + resp, err := client.getPermissionHandleResponse(httpResp) + return resp, err } // getPermissionCreateRequest creates the GetPermission request. @@ -717,12 +743,6 @@ func (client *ShareClient) getPermissionCreateRequest(ctx context.Context, fileP // getPermissionHandleResponse handles the GetPermission response. func (client *ShareClient) getPermissionHandleResponse(resp *http.Response) (ShareClientGetPermissionResponse, error) { result := ShareClientGetPermissionResponse{} - 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 { @@ -730,6 +750,12 @@ func (client *ShareClient) getPermissionHandleResponse(resp *http.Response) (Sha } result.Date = &date } + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.RequestID = &val + } + if val := resp.Header.Get("x-ms-version"); val != "" { + result.Version = &val + } if err := runtime.UnmarshalAsJSON(resp, &result.SharePermission); err != nil { return ShareClientGetPermissionResponse{}, err } @@ -744,18 +770,21 @@ func (client *ShareClient) getPermissionHandleResponse(resp *http.Response) (Sha // - options - ShareClientGetPropertiesOptions contains the optional parameters for the ShareClient.GetProperties method. // - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ShareClient.GetProperties method. func (client *ShareClient) GetProperties(ctx context.Context, options *ShareClientGetPropertiesOptions, leaseAccessConditions *LeaseAccessConditions) (ShareClientGetPropertiesResponse, error) { + var err error req, err := client.getPropertiesCreateRequest(ctx, options, leaseAccessConditions) if err != nil { return ShareClientGetPropertiesResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ShareClientGetPropertiesResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ShareClientGetPropertiesResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ShareClientGetPropertiesResponse{}, err } - return client.getPropertiesHandleResponse(resp) + resp, err := client.getPropertiesHandleResponse(httpResp) + return resp, err } // getPropertiesCreateRequest creates the GetProperties request. @@ -784,29 +813,18 @@ func (client *ShareClient) getPropertiesCreateRequest(ctx context.Context, optio // getPropertiesHandleResponse handles the GetProperties response. func (client *ShareClient) getPropertiesHandleResponse(resp *http.Response) (ShareClientGetPropertiesResponse, error) { result := ShareClientGetPropertiesResponse{} - for hh := range resp.Header { - if len(hh) > len("x-ms-meta-") && strings.EqualFold(hh[:len("x-ms-meta-")], "x-ms-meta-") { - if result.Metadata == nil { - result.Metadata = map[string]*string{} - } - result.Metadata[hh[len("x-ms-meta-"):]] = to.Ptr(resp.Header.Get(hh)) - } - } - if val := resp.Header.Get("ETag"); val != "" { - result.ETag = (*azcore.ETag)(&val) + if val := resp.Header.Get("x-ms-access-tier"); val != "" { + result.AccessTier = &val } - if val := resp.Header.Get("Last-Modified"); val != "" { - lastModified, err := time.Parse(time.RFC1123, val) + if val := resp.Header.Get("x-ms-access-tier-change-time"); val != "" { + accessTierChangeTime, err := time.Parse(time.RFC1123, val) if err != nil { return ShareClientGetPropertiesResponse{}, err } - result.LastModified = &lastModified - } - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.RequestID = &val + result.AccessTierChangeTime = &accessTierChangeTime } - if val := resp.Header.Get("x-ms-version"); val != "" { - result.Version = &val + if val := resp.Header.Get("x-ms-access-tier-transition-state"); val != "" { + result.AccessTierTransitionState = &val } if val := resp.Header.Get("Date"); val != "" { date, err := time.Parse(time.RFC1123, val) @@ -815,29 +833,50 @@ func (client *ShareClient) getPropertiesHandleResponse(resp *http.Response) (Sha } result.Date = &date } - if val := resp.Header.Get("x-ms-share-quota"); val != "" { - quota32, err := strconv.ParseInt(val, 10, 32) - quota := int32(quota32) + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = (*azcore.ETag)(&val) + } + if val := resp.Header.Get("x-ms-enabled-protocols"); val != "" { + result.EnabledProtocols = &val + } + if val := resp.Header.Get("Last-Modified"); val != "" { + lastModified, err := time.Parse(time.RFC1123, val) if err != nil { return ShareClientGetPropertiesResponse{}, err } - result.Quota = "a + result.LastModified = &lastModified } - if val := resp.Header.Get("x-ms-share-provisioned-iops"); val != "" { - provisionedIops32, err := strconv.ParseInt(val, 10, 32) - provisionedIops := int32(provisionedIops32) + if val := resp.Header.Get("x-ms-lease-duration"); val != "" { + result.LeaseDuration = (*LeaseDurationType)(&val) + } + if val := resp.Header.Get("x-ms-lease-state"); val != "" { + result.LeaseState = (*LeaseStateType)(&val) + } + if val := resp.Header.Get("x-ms-lease-status"); val != "" { + result.LeaseStatus = (*LeaseStatusType)(&val) + } + for hh := range resp.Header { + if len(hh) > len("x-ms-meta-") && strings.EqualFold(hh[:len("x-ms-meta-")], "x-ms-meta-") { + if result.Metadata == nil { + result.Metadata = map[string]*string{} + } + result.Metadata[hh[len("x-ms-meta-"):]] = to.Ptr(resp.Header.Get(hh)) + } + } + if val := resp.Header.Get("x-ms-share-next-allowed-quota-downgrade-time"); val != "" { + nextAllowedQuotaDowngradeTime, err := time.Parse(time.RFC1123, val) if err != nil { return ShareClientGetPropertiesResponse{}, err } - result.ProvisionedIops = &provisionedIops + result.NextAllowedQuotaDowngradeTime = &nextAllowedQuotaDowngradeTime } - if val := resp.Header.Get("x-ms-share-provisioned-ingress-mbps"); val != "" { - provisionedIngressMBps32, err := strconv.ParseInt(val, 10, 32) - provisionedIngressMBps := int32(provisionedIngressMBps32) + if val := resp.Header.Get("x-ms-share-provisioned-bandwidth-mibps"); val != "" { + provisionedBandwidthMiBps32, err := strconv.ParseInt(val, 10, 32) + provisionedBandwidthMiBps := int32(provisionedBandwidthMiBps32) if err != nil { return ShareClientGetPropertiesResponse{}, err } - result.ProvisionedIngressMBps = &provisionedIngressMBps + result.ProvisionedBandwidthMiBps = &provisionedBandwidthMiBps } if val := resp.Header.Get("x-ms-share-provisioned-egress-mbps"); val != "" { provisionedEgressMBps32, err := strconv.ParseInt(val, 10, 32) @@ -847,49 +886,39 @@ func (client *ShareClient) getPropertiesHandleResponse(resp *http.Response) (Sha } result.ProvisionedEgressMBps = &provisionedEgressMBps } - if val := resp.Header.Get("x-ms-share-next-allowed-quota-downgrade-time"); val != "" { - nextAllowedQuotaDowngradeTime, err := time.Parse(time.RFC1123, val) + if val := resp.Header.Get("x-ms-share-provisioned-ingress-mbps"); val != "" { + provisionedIngressMBps32, err := strconv.ParseInt(val, 10, 32) + provisionedIngressMBps := int32(provisionedIngressMBps32) if err != nil { return ShareClientGetPropertiesResponse{}, err } - result.NextAllowedQuotaDowngradeTime = &nextAllowedQuotaDowngradeTime + result.ProvisionedIngressMBps = &provisionedIngressMBps } - if val := resp.Header.Get("x-ms-share-provisioned-bandwidth-mibps"); val != "" { - provisionedBandwidthMiBps32, err := strconv.ParseInt(val, 10, 32) - provisionedBandwidthMiBps := int32(provisionedBandwidthMiBps32) + if val := resp.Header.Get("x-ms-share-provisioned-iops"); val != "" { + provisionedIops32, err := strconv.ParseInt(val, 10, 32) + provisionedIops := int32(provisionedIops32) if err != nil { return ShareClientGetPropertiesResponse{}, err } - result.ProvisionedBandwidthMiBps = &provisionedBandwidthMiBps - } - if val := resp.Header.Get("x-ms-lease-duration"); val != "" { - result.LeaseDuration = (*LeaseDurationType)(&val) - } - if val := resp.Header.Get("x-ms-lease-state"); val != "" { - result.LeaseState = (*LeaseStateType)(&val) - } - if val := resp.Header.Get("x-ms-lease-status"); val != "" { - result.LeaseStatus = (*LeaseStatusType)(&val) - } - if val := resp.Header.Get("x-ms-access-tier"); val != "" { - result.AccessTier = &val + result.ProvisionedIops = &provisionedIops } - if val := resp.Header.Get("x-ms-access-tier-change-time"); val != "" { - accessTierChangeTime, err := time.Parse(time.RFC1123, val) + if val := resp.Header.Get("x-ms-share-quota"); val != "" { + quota32, err := strconv.ParseInt(val, 10, 32) + quota := int32(quota32) if err != nil { return ShareClientGetPropertiesResponse{}, err } - result.AccessTierChangeTime = &accessTierChangeTime - } - if val := resp.Header.Get("x-ms-access-tier-transition-state"); val != "" { - result.AccessTierTransitionState = &val + result.Quota = "a } - if val := resp.Header.Get("x-ms-enabled-protocols"); val != "" { - result.EnabledProtocols = &val + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.RequestID = &val } if val := resp.Header.Get("x-ms-root-squash"); val != "" { result.RootSquash = (*ShareRootSquash)(&val) } + if val := resp.Header.Get("x-ms-version"); val != "" { + result.Version = &val + } return result, nil } @@ -900,18 +929,21 @@ func (client *ShareClient) getPropertiesHandleResponse(resp *http.Response) (Sha // - options - ShareClientGetStatisticsOptions contains the optional parameters for the ShareClient.GetStatistics method. // - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ShareClient.GetProperties method. func (client *ShareClient) GetStatistics(ctx context.Context, options *ShareClientGetStatisticsOptions, leaseAccessConditions *LeaseAccessConditions) (ShareClientGetStatisticsResponse, error) { + var err error req, err := client.getStatisticsCreateRequest(ctx, options, leaseAccessConditions) if err != nil { return ShareClientGetStatisticsResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ShareClientGetStatisticsResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ShareClientGetStatisticsResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ShareClientGetStatisticsResponse{}, err } - return client.getStatisticsHandleResponse(resp) + resp, err := client.getStatisticsHandleResponse(httpResp) + return resp, err } // getStatisticsCreateRequest creates the GetStatistics request. @@ -938,6 +970,13 @@ func (client *ShareClient) getStatisticsCreateRequest(ctx context.Context, optio // getStatisticsHandleResponse handles the GetStatistics response. func (client *ShareClient) getStatisticsHandleResponse(resp *http.Response) (ShareClientGetStatisticsResponse, error) { result := ShareClientGetStatisticsResponse{} + if val := resp.Header.Get("Date"); val != "" { + date, err := time.Parse(time.RFC1123, val) + if err != nil { + return ShareClientGetStatisticsResponse{}, err + } + result.Date = &date + } if val := resp.Header.Get("ETag"); val != "" { result.ETag = (*azcore.ETag)(&val) } @@ -954,13 +993,6 @@ func (client *ShareClient) getStatisticsHandleResponse(resp *http.Response) (Sha 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 ShareClientGetStatisticsResponse{}, err - } - result.Date = &date - } if err := runtime.UnmarshalAsXML(resp, &result.ShareStats); err != nil { return ShareClientGetStatisticsResponse{}, err } @@ -975,18 +1007,21 @@ func (client *ShareClient) getStatisticsHandleResponse(resp *http.Response) (Sha // - leaseID - Specifies the current lease ID on the resource. // - options - ShareClientReleaseLeaseOptions contains the optional parameters for the ShareClient.ReleaseLease method. func (client *ShareClient) ReleaseLease(ctx context.Context, leaseID string, options *ShareClientReleaseLeaseOptions) (ShareClientReleaseLeaseResponse, error) { + var err error req, err := client.releaseLeaseCreateRequest(ctx, leaseID, options) if err != nil { return ShareClientReleaseLeaseResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ShareClientReleaseLeaseResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ShareClientReleaseLeaseResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ShareClientReleaseLeaseResponse{}, err } - return client.releaseLeaseHandleResponse(resp) + resp, err := client.releaseLeaseHandleResponse(httpResp) + return resp, err } // releaseLeaseCreateRequest creates the ReleaseLease request. @@ -1018,6 +1053,16 @@ func (client *ShareClient) releaseLeaseCreateRequest(ctx context.Context, leaseI // releaseLeaseHandleResponse handles the ReleaseLease response. func (client *ShareClient) releaseLeaseHandleResponse(resp *http.Response) (ShareClientReleaseLeaseResponse, error) { result := ShareClientReleaseLeaseResponse{} + if val := resp.Header.Get("x-ms-client-request-id"); val != "" { + result.ClientRequestID = &val + } + if val := resp.Header.Get("Date"); val != "" { + date, err := time.Parse(time.RFC1123, val) + if err != nil { + return ShareClientReleaseLeaseResponse{}, err + } + result.Date = &date + } if val := resp.Header.Get("ETag"); val != "" { result.ETag = (*azcore.ETag)(&val) } @@ -1028,22 +1073,12 @@ func (client *ShareClient) releaseLeaseHandleResponse(resp *http.Response) (Shar } 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 ShareClientReleaseLeaseResponse{}, err - } - result.Date = &date - } return result, nil } @@ -1055,18 +1090,21 @@ func (client *ShareClient) releaseLeaseHandleResponse(resp *http.Response) (Shar // - leaseID - Specifies the current lease ID on the resource. // - options - ShareClientRenewLeaseOptions contains the optional parameters for the ShareClient.RenewLease method. func (client *ShareClient) RenewLease(ctx context.Context, leaseID string, options *ShareClientRenewLeaseOptions) (ShareClientRenewLeaseResponse, error) { + var err error req, err := client.renewLeaseCreateRequest(ctx, leaseID, options) if err != nil { return ShareClientRenewLeaseResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ShareClientRenewLeaseResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ShareClientRenewLeaseResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ShareClientRenewLeaseResponse{}, err } - return client.renewLeaseHandleResponse(resp) + resp, err := client.renewLeaseHandleResponse(httpResp) + return resp, err } // renewLeaseCreateRequest creates the RenewLease request. @@ -1098,6 +1136,16 @@ func (client *ShareClient) renewLeaseCreateRequest(ctx context.Context, leaseID // renewLeaseHandleResponse handles the RenewLease response. func (client *ShareClient) renewLeaseHandleResponse(resp *http.Response) (ShareClientRenewLeaseResponse, error) { result := ShareClientRenewLeaseResponse{} + if val := resp.Header.Get("x-ms-client-request-id"); val != "" { + result.ClientRequestID = &val + } + if val := resp.Header.Get("Date"); val != "" { + date, err := time.Parse(time.RFC1123, val) + if err != nil { + return ShareClientRenewLeaseResponse{}, err + } + result.Date = &date + } if val := resp.Header.Get("ETag"); val != "" { result.ETag = (*azcore.ETag)(&val) } @@ -1111,22 +1159,12 @@ func (client *ShareClient) renewLeaseHandleResponse(resp *http.Response) (ShareC if val := resp.Header.Get("x-ms-lease-id"); val != "" { result.LeaseID = &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 ShareClientRenewLeaseResponse{}, err - } - result.Date = &date - } return result, nil } @@ -1136,18 +1174,21 @@ func (client *ShareClient) renewLeaseHandleResponse(resp *http.Response) (ShareC // Generated from API version 2023-11-03 // - options - ShareClientRestoreOptions contains the optional parameters for the ShareClient.Restore method. func (client *ShareClient) Restore(ctx context.Context, options *ShareClientRestoreOptions) (ShareClientRestoreResponse, error) { + var err error req, err := client.restoreCreateRequest(ctx, options) if err != nil { return ShareClientRestoreResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ShareClientRestoreResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusCreated) { - return ShareClientRestoreResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return ShareClientRestoreResponse{}, err } - return client.restoreHandleResponse(resp) + resp, err := client.restoreHandleResponse(httpResp) + return resp, err } // restoreCreateRequest creates the Restore request. @@ -1180,6 +1221,16 @@ func (client *ShareClient) restoreCreateRequest(ctx context.Context, options *Sh // restoreHandleResponse handles the Restore response. func (client *ShareClient) restoreHandleResponse(resp *http.Response) (ShareClientRestoreResponse, error) { result := ShareClientRestoreResponse{} + if val := resp.Header.Get("x-ms-client-request-id"); val != "" { + result.ClientRequestID = &val + } + if val := resp.Header.Get("Date"); val != "" { + date, err := time.Parse(time.RFC1123, val) + if err != nil { + return ShareClientRestoreResponse{}, err + } + result.Date = &date + } if val := resp.Header.Get("ETag"); val != "" { result.ETag = (*azcore.ETag)(&val) } @@ -1193,19 +1244,9 @@ func (client *ShareClient) restoreHandleResponse(resp *http.Response) (ShareClie 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("Date"); val != "" { - date, err := time.Parse(time.RFC1123, val) - if err != nil { - return ShareClientRestoreResponse{}, err - } - result.Date = &date - } return result, nil } @@ -1217,18 +1258,21 @@ func (client *ShareClient) restoreHandleResponse(resp *http.Response) (ShareClie // - options - ShareClientSetAccessPolicyOptions contains the optional parameters for the ShareClient.SetAccessPolicy method. // - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ShareClient.GetProperties method. func (client *ShareClient) SetAccessPolicy(ctx context.Context, shareACL []*SignedIdentifier, options *ShareClientSetAccessPolicyOptions, leaseAccessConditions *LeaseAccessConditions) (ShareClientSetAccessPolicyResponse, error) { + var err error req, err := client.setAccessPolicyCreateRequest(ctx, shareACL, options, leaseAccessConditions) if err != nil { return ShareClientSetAccessPolicyResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ShareClientSetAccessPolicyResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ShareClientSetAccessPolicyResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ShareClientSetAccessPolicyResponse{}, err } - return client.setAccessPolicyHandleResponse(resp) + resp, err := client.setAccessPolicyHandleResponse(httpResp) + return resp, err } // setAccessPolicyCreateRequest creates the SetAccessPolicy request. @@ -1262,6 +1306,13 @@ func (client *ShareClient) setAccessPolicyCreateRequest(ctx context.Context, sha // setAccessPolicyHandleResponse handles the SetAccessPolicy response. func (client *ShareClient) setAccessPolicyHandleResponse(resp *http.Response) (ShareClientSetAccessPolicyResponse, error) { result := ShareClientSetAccessPolicyResponse{} + if val := resp.Header.Get("Date"); val != "" { + date, err := time.Parse(time.RFC1123, val) + if err != nil { + return ShareClientSetAccessPolicyResponse{}, err + } + result.Date = &date + } if val := resp.Header.Get("ETag"); val != "" { result.ETag = (*azcore.ETag)(&val) } @@ -1278,13 +1329,6 @@ func (client *ShareClient) setAccessPolicyHandleResponse(resp *http.Response) (S 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 ShareClientSetAccessPolicyResponse{}, err - } - result.Date = &date - } return result, nil } @@ -1295,18 +1339,21 @@ func (client *ShareClient) setAccessPolicyHandleResponse(resp *http.Response) (S // - options - ShareClientSetMetadataOptions contains the optional parameters for the ShareClient.SetMetadata method. // - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ShareClient.GetProperties method. func (client *ShareClient) SetMetadata(ctx context.Context, options *ShareClientSetMetadataOptions, leaseAccessConditions *LeaseAccessConditions) (ShareClientSetMetadataResponse, error) { + var err error req, err := client.setMetadataCreateRequest(ctx, options, leaseAccessConditions) if err != nil { return ShareClientSetMetadataResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ShareClientSetMetadataResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ShareClientSetMetadataResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ShareClientSetMetadataResponse{}, err } - return client.setMetadataHandleResponse(resp) + resp, err := client.setMetadataHandleResponse(httpResp) + return resp, err } // setMetadataCreateRequest creates the SetMetadata request. @@ -1340,6 +1387,13 @@ func (client *ShareClient) setMetadataCreateRequest(ctx context.Context, options // setMetadataHandleResponse handles the SetMetadata response. func (client *ShareClient) setMetadataHandleResponse(resp *http.Response) (ShareClientSetMetadataResponse, error) { result := ShareClientSetMetadataResponse{} + if val := resp.Header.Get("Date"); val != "" { + date, err := time.Parse(time.RFC1123, val) + if err != nil { + return ShareClientSetMetadataResponse{}, err + } + result.Date = &date + } if val := resp.Header.Get("ETag"); val != "" { result.ETag = (*azcore.ETag)(&val) } @@ -1356,13 +1410,6 @@ func (client *ShareClient) setMetadataHandleResponse(resp *http.Response) (Share 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 ShareClientSetMetadataResponse{}, err - } - result.Date = &date - } return result, nil } @@ -1373,18 +1420,21 @@ func (client *ShareClient) setMetadataHandleResponse(resp *http.Response) (Share // - options - ShareClientSetPropertiesOptions contains the optional parameters for the ShareClient.SetProperties method. // - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ShareClient.GetProperties method. func (client *ShareClient) SetProperties(ctx context.Context, options *ShareClientSetPropertiesOptions, leaseAccessConditions *LeaseAccessConditions) (ShareClientSetPropertiesResponse, error) { + var err error req, err := client.setPropertiesCreateRequest(ctx, options, leaseAccessConditions) if err != nil { return ShareClientSetPropertiesResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ShareClientSetPropertiesResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ShareClientSetPropertiesResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ShareClientSetPropertiesResponse{}, err } - return client.setPropertiesHandleResponse(resp) + resp, err := client.setPropertiesHandleResponse(httpResp) + return resp, err } // setPropertiesCreateRequest creates the SetProperties request. @@ -1420,6 +1470,13 @@ func (client *ShareClient) setPropertiesCreateRequest(ctx context.Context, optio // setPropertiesHandleResponse handles the SetProperties response. func (client *ShareClient) setPropertiesHandleResponse(resp *http.Response) (ShareClientSetPropertiesResponse, error) { result := ShareClientSetPropertiesResponse{} + if val := resp.Header.Get("Date"); val != "" { + date, err := time.Parse(time.RFC1123, val) + if err != nil { + return ShareClientSetPropertiesResponse{}, err + } + result.Date = &date + } if val := resp.Header.Get("ETag"); val != "" { result.ETag = (*azcore.ETag)(&val) } @@ -1436,12 +1493,5 @@ func (client *ShareClient) setPropertiesHandleResponse(resp *http.Response) (Sha 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 ShareClientSetPropertiesResponse{}, err - } - result.Date = &date - } return result, nil } diff --git a/sdk/storage/azfile/internal/generated/zz_time_rfc1123.go b/sdk/storage/azfile/internal/generated/zz_time_rfc1123.go index 4b4d51aa3994..586650329724 100644 --- a/sdk/storage/azfile/internal/generated/zz_time_rfc1123.go +++ b/sdk/storage/azfile/internal/generated/zz_time_rfc1123.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package generated @@ -15,29 +14,29 @@ import ( ) const ( - rfc1123JSON = `"` + time.RFC1123 + `"` + dateTimeRFC1123JSON = `"` + time.RFC1123 + `"` ) -type timeRFC1123 time.Time +type dateTimeRFC1123 time.Time -func (t timeRFC1123) MarshalJSON() ([]byte, error) { - b := []byte(time.Time(t).Format(rfc1123JSON)) +func (t dateTimeRFC1123) MarshalJSON() ([]byte, error) { + b := []byte(time.Time(t).Format(dateTimeRFC1123JSON)) return b, nil } -func (t timeRFC1123) MarshalText() ([]byte, error) { +func (t dateTimeRFC1123) 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) +func (t *dateTimeRFC1123) UnmarshalJSON(data []byte) error { + p, err := time.Parse(dateTimeRFC1123JSON, strings.ToUpper(string(data))) + *t = dateTimeRFC1123(p) return err } -func (t *timeRFC1123) UnmarshalText(data []byte) error { +func (t *dateTimeRFC1123) UnmarshalText(data []byte) error { p, err := time.Parse(time.RFC1123, string(data)) - *t = timeRFC1123(p) + *t = dateTimeRFC1123(p) return err } diff --git a/sdk/storage/azfile/internal/generated/zz_time_rfc3339.go b/sdk/storage/azfile/internal/generated/zz_time_rfc3339.go index 1ce9d621164e..82b370133fac 100644 --- a/sdk/storage/azfile/internal/generated/zz_time_rfc3339.go +++ b/sdk/storage/azfile/internal/generated/zz_time_rfc3339.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package generated @@ -15,45 +14,45 @@ import ( "time" ) -const ( - utcLayoutJSON = `"2006-01-02T15:04:05.999999999"` - utcLayout = "2006-01-02T15:04:05.999999999" - rfc3339JSON = `"` + time.RFC3339Nano + `"` -) - // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) -type timeRFC3339 time.Time +const ( + utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` + utcDateTime = "2006-01-02T15:04:05.999999999" + dateTimeJSON = `"` + time.RFC3339Nano + `"` +) + +type dateTimeRFC3339 time.Time -func (t timeRFC3339) MarshalJSON() (json []byte, err error) { +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { tt := time.Time(t) return tt.MarshalJSON() } -func (t timeRFC3339) MarshalText() (text []byte, err error) { +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { tt := time.Time(t) return tt.MarshalText() } -func (t *timeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcLayoutJSON +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + layout := utcDateTimeJSON if tzOffsetRegex.Match(data) { - layout = rfc3339JSON + layout = dateTimeJSON } return t.Parse(layout, string(data)) } -func (t *timeRFC3339) UnmarshalText(data []byte) (err error) { - layout := utcLayout +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + layout := utcDateTime if tzOffsetRegex.Match(data) { layout = time.RFC3339Nano } return t.Parse(layout, string(data)) } -func (t *timeRFC3339) Parse(layout, value string) error { +func (t *dateTimeRFC3339) Parse(layout, value string) error { p, err := time.Parse(layout, strings.ToUpper(value)) - *t = timeRFC3339(p) + *t = dateTimeRFC3339(p) return err } diff --git a/sdk/storage/azfile/internal/generated/zz_xml_helper.go b/sdk/storage/azfile/internal/generated/zz_xml_helper.go index 144ea18e1aba..1bd0e4de05a8 100644 --- a/sdk/storage/azfile/internal/generated/zz_xml_helper.go +++ b/sdk/storage/azfile/internal/generated/zz_xml_helper.go @@ -3,14 +3,16 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package generated import ( "encoding/xml" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "io" "strings" ) @@ -19,22 +21,32 @@ type additionalProperties map[string]*string // UnmarshalXML implements the xml.Unmarshaler interface for additionalProperties. func (ap *additionalProperties) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { tokName := "" - for t, err := d.Token(); err == nil; t, err = d.Token() { + tokValue := "" + for { + t, err := d.Token() + if errors.Is(err, io.EOF) { + break + } else if err != nil { + return err + } switch tt := t.(type) { case xml.StartElement: tokName = strings.ToLower(tt.Name.Local) - break + tokValue = "" case xml.CharData: + if tokName == "" { + continue + } + tokValue = string(tt) + case xml.EndElement: if tokName == "" { continue } if *ap == nil { *ap = additionalProperties{} } - s := string(tt) - (*ap)[tokName] = &s + (*ap)[tokName] = to.Ptr(tokValue) tokName = "" - break } } return nil