...

Source file src/github.com/Azure/azure-sdk-for-go/services/storage/datalake/2019-10-31/storagedatalake/path.go

Documentation: github.com/Azure/azure-sdk-for-go/services/storage/datalake/2019-10-31/storagedatalake

     1  package storagedatalake
     2  
     3  // Copyright (c) Microsoft Corporation. All rights reserved.
     4  // Licensed under the MIT License. See License.txt in the project root for license information.
     5  //
     6  // Code generated by Microsoft (R) AutoRest Code Generator.
     7  // Changes may cause incorrect behavior and will be lost if the code is regenerated.
     8  
     9  import (
    10  	"context"
    11  	"github.com/Azure/go-autorest/autorest"
    12  	"github.com/Azure/go-autorest/autorest/azure"
    13  	"github.com/Azure/go-autorest/autorest/validation"
    14  	"github.com/Azure/go-autorest/tracing"
    15  	"io"
    16  	"net/http"
    17  )
    18  
    19  // PathClient is the azure Data Lake Storage provides storage for Hadoop and other big data workloads.
    20  type PathClient struct {
    21  	BaseClient
    22  }
    23  
    24  // NewPathClient creates an instance of the PathClient client.
    25  func NewPathClient(xMsVersion string, accountName string) PathClient {
    26  	return PathClient{New(xMsVersion, accountName)}
    27  }
    28  
    29  // Create create or rename a file or directory.    By default, the destination is overwritten and if the destination
    30  // already exists and has a lease the lease is broken.  This operation supports conditional HTTP requests.  For more
    31  // information, see [Specifying Conditional Headers for Blob Service
    32  // Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations).
    33  // To fail if the destination already exists, use a conditional request with If-None-Match: "*".
    34  // Parameters:
    35  // filesystem - the filesystem identifier.
    36  // pathParameter - the file or directory path.
    37  // resource - required only for Create File and Create Directory. The value must be "file" or "directory".
    38  // continuation - optional.  When renaming a directory, the number of paths that are renamed with each
    39  // invocation is limited.  If the number of paths to be renamed exceeds this limit, a continuation token is
    40  // returned in this response header.  When a continuation token is returned in the response, it must be
    41  // specified in a subsequent invocation of the rename operation to continue renaming the directory.
    42  // mode - optional. Valid only when namespace is enabled. This parameter determines the behavior of the rename
    43  // operation. The value must be "legacy" or "posix", and the default value will be "posix".
    44  // cacheControl - optional.  The service stores this value and includes it in the "Cache-Control" response
    45  // header for "Read File" operations for "Read File" operations.
    46  // contentEncoding - optional.  Specifies which content encodings have been applied to the file. This value is
    47  // returned to the client when the "Read File" operation is performed.
    48  // contentLanguage - optional.  Specifies the natural language used by the intended audience for the file.
    49  // contentDisposition - optional.  The service stores this value and includes it in the "Content-Disposition"
    50  // response header for "Read File" operations.
    51  // xMsCacheControl - optional.  The service stores this value and includes it in the "Cache-Control" response
    52  // header for "Read File" operations.
    53  // xMsContentType - optional.  The service stores this value and includes it in the "Content-Type" response
    54  // header for "Read File" operations.
    55  // xMsContentEncoding - optional.  The service stores this value and includes it in the "Content-Encoding"
    56  // response header for "Read File" operations.
    57  // xMsContentLanguage - optional.  The service stores this value and includes it in the "Content-Language"
    58  // response header for "Read File" operations.
    59  // xMsContentDisposition - optional.  The service stores this value and includes it in the
    60  // "Content-Disposition" response header for "Read File" operations.
    61  // xMsRenameSource - an optional file or directory to be renamed.  The value must have the following format:
    62  // "/{filesystem}/{path}".  If "x-ms-properties" is specified, the properties will overwrite the existing
    63  // properties; otherwise, the existing properties will be preserved. This value must be a URL percent-encoded
    64  // string. Note that the string may only contain ASCII characters in the ISO-8859-1 character set.
    65  // xMsLeaseID - optional.  A lease ID for the path specified in the URI.  The path to be overwritten must have
    66  // an active lease and the lease ID must match.
    67  // xMsSourceLeaseID - optional for rename operations.  A lease ID for the source path.  The source path must
    68  // have an active lease and the lease ID must match.
    69  // xMsProperties - optional.  User-defined properties to be stored with the file or directory, in the format of
    70  // a comma-separated list of name and value pairs "n1=v1, n2=v2, ...", where each value is a base64 encoded
    71  // string. Note that the string may only contain ASCII characters in the ISO-8859-1 character set.
    72  // xMsPermissions - optional and only valid if Hierarchical Namespace is enabled for the account. Sets POSIX
    73  // access permissions for the file owner, the file owning group, and others. Each class may be granted read,
    74  // write, or execute permission.  The sticky bit is also supported.  Both symbolic (rwxrw-rw-) and 4-digit
    75  // octal notation (e.g. 0766) are supported.
    76  // xMsUmask - optional and only valid if Hierarchical Namespace is enabled for the account. When creating a
    77  // file or directory and the parent folder does not have a default ACL, the umask restricts the permissions of
    78  // the file or directory to be created.  The resulting permission is given by p & ^u, where p is the permission
    79  // and u is the umask.  For example, if p is 0777 and u is 0057, then the resulting permission is 0720.  The
    80  // default permission is 0777 for a directory and 0666 for a file.  The default umask is 0027.  The umask must
    81  // be specified in 4-digit octal notation (e.g. 0766).
    82  // ifMatch - optional.  An ETag value. Specify this header to perform the operation only if the resource's ETag
    83  // matches the value specified. The ETag must be specified in quotes.
    84  // ifNoneMatch - optional.  An ETag value or the special wildcard ("*") value. Specify this header to perform
    85  // the operation only if the resource's ETag does not match the value specified. The ETag must be specified in
    86  // quotes.
    87  // ifModifiedSince - optional. A date and time value. Specify this header to perform the operation only if the
    88  // resource has been modified since the specified date and time.
    89  // ifUnmodifiedSince - optional. A date and time value. Specify this header to perform the operation only if
    90  // the resource has not been modified since the specified date and time.
    91  // xMsSourceIfMatch - optional.  An ETag value. Specify this header to perform the rename operation only if the
    92  // source's ETag matches the value specified. The ETag must be specified in quotes.
    93  // xMsSourceIfNoneMatch - optional.  An ETag value or the special wildcard ("*") value. Specify this header to
    94  // perform the rename operation only if the source's ETag does not match the value specified. The ETag must be
    95  // specified in quotes.
    96  // xMsSourceIfModifiedSince - optional. A date and time value. Specify this header to perform the rename
    97  // operation only if the source has been modified since the specified date and time.
    98  // xMsSourceIfUnmodifiedSince - optional. A date and time value. Specify this header to perform the rename
    99  // operation only if the source has not been modified since the specified date and time.
   100  // xMsClientRequestID - a UUID recorded in the analytics logs for troubleshooting and correlation.
   101  // timeout - an optional operation timeout value in seconds. The period begins when the request is received by
   102  // the service. If the timeout value elapses before the operation completes, the operation fails.
   103  // xMsDate - specifies the Coordinated Universal Time (UTC) for the request.  This is required when using
   104  // shared key authorization.
   105  func (client PathClient) Create(ctx context.Context, filesystem string, pathParameter string, resource PathResourceType, continuation string, mode PathRenameMode, cacheControl string, contentEncoding string, contentLanguage string, contentDisposition string, xMsCacheControl string, xMsContentType string, xMsContentEncoding string, xMsContentLanguage string, xMsContentDisposition string, xMsRenameSource string, xMsLeaseID string, xMsSourceLeaseID string, xMsProperties string, xMsPermissions string, xMsUmask string, ifMatch string, ifNoneMatch string, ifModifiedSince string, ifUnmodifiedSince string, xMsSourceIfMatch string, xMsSourceIfNoneMatch string, xMsSourceIfModifiedSince string, xMsSourceIfUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (result autorest.Response, err error) {
   106  	if tracing.IsEnabled() {
   107  		ctx = tracing.StartSpan(ctx, fqdn+"/PathClient.Create")
   108  		defer func() {
   109  			sc := -1
   110  			if result.Response != nil {
   111  				sc = result.Response.StatusCode
   112  			}
   113  			tracing.EndSpan(ctx, sc, err)
   114  		}()
   115  	}
   116  	if err := validation.Validate([]validation.Validation{
   117  		{TargetValue: xMsLeaseID,
   118  			Constraints: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Empty, Rule: false,
   119  				Chain: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
   120  		{TargetValue: xMsSourceLeaseID,
   121  			Constraints: []validation.Constraint{{Target: "xMsSourceLeaseID", Name: validation.Empty, Rule: false,
   122  				Chain: []validation.Constraint{{Target: "xMsSourceLeaseID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
   123  		{TargetValue: filesystem,
   124  			Constraints: []validation.Constraint{{Target: "filesystem", Name: validation.MaxLength, Rule: 63, Chain: nil},
   125  				{Target: "filesystem", Name: validation.MinLength, Rule: 3, Chain: nil}}},
   126  		{TargetValue: xMsClientRequestID,
   127  			Constraints: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Empty, Rule: false,
   128  				Chain: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
   129  		{TargetValue: timeout,
   130  			Constraints: []validation.Constraint{{Target: "timeout", Name: validation.Null, Rule: false,
   131  				Chain: []validation.Constraint{{Target: "timeout", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}}); err != nil {
   132  		return result, validation.NewError("storagedatalake.PathClient", "Create", err.Error())
   133  	}
   134  
   135  	req, err := client.CreatePreparer(ctx, filesystem, pathParameter, resource, continuation, mode, cacheControl, contentEncoding, contentLanguage, contentDisposition, xMsCacheControl, xMsContentType, xMsContentEncoding, xMsContentLanguage, xMsContentDisposition, xMsRenameSource, xMsLeaseID, xMsSourceLeaseID, xMsProperties, xMsPermissions, xMsUmask, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince, xMsSourceIfMatch, xMsSourceIfNoneMatch, xMsSourceIfModifiedSince, xMsSourceIfUnmodifiedSince, xMsClientRequestID, timeout, xMsDate)
   136  	if err != nil {
   137  		err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Create", nil, "Failure preparing request")
   138  		return
   139  	}
   140  
   141  	resp, err := client.CreateSender(req)
   142  	if err != nil {
   143  		result.Response = resp
   144  		err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Create", resp, "Failure sending request")
   145  		return
   146  	}
   147  
   148  	result, err = client.CreateResponder(resp)
   149  	if err != nil {
   150  		err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Create", resp, "Failure responding to request")
   151  		return
   152  	}
   153  
   154  	return
   155  }
   156  
   157  // CreatePreparer prepares the Create request.
   158  func (client PathClient) CreatePreparer(ctx context.Context, filesystem string, pathParameter string, resource PathResourceType, continuation string, mode PathRenameMode, cacheControl string, contentEncoding string, contentLanguage string, contentDisposition string, xMsCacheControl string, xMsContentType string, xMsContentEncoding string, xMsContentLanguage string, xMsContentDisposition string, xMsRenameSource string, xMsLeaseID string, xMsSourceLeaseID string, xMsProperties string, xMsPermissions string, xMsUmask string, ifMatch string, ifNoneMatch string, ifModifiedSince string, ifUnmodifiedSince string, xMsSourceIfMatch string, xMsSourceIfNoneMatch string, xMsSourceIfModifiedSince string, xMsSourceIfUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (*http.Request, error) {
   159  	urlParameters := map[string]interface{}{
   160  		"accountName": client.AccountName,
   161  		"dnsSuffix":   client.DNSSuffix,
   162  	}
   163  
   164  	pathParameters := map[string]interface{}{
   165  		"filesystem": autorest.Encode("path", filesystem),
   166  		"path":       autorest.Encode("path", pathParameter),
   167  	}
   168  
   169  	queryParameters := map[string]interface{}{}
   170  	if len(string(resource)) > 0 {
   171  		queryParameters["resource"] = autorest.Encode("query", resource)
   172  	}
   173  	if len(continuation) > 0 {
   174  		queryParameters["continuation"] = autorest.Encode("query", continuation)
   175  	}
   176  	if len(string(mode)) > 0 {
   177  		queryParameters["mode"] = autorest.Encode("query", mode)
   178  	}
   179  	if timeout != nil {
   180  		queryParameters["timeout"] = autorest.Encode("query", *timeout)
   181  	}
   182  
   183  	preparer := autorest.CreatePreparer(
   184  		autorest.AsPut(),
   185  		autorest.WithCustomBaseURL("https://{accountName}.{dnsSuffix}", urlParameters),
   186  		autorest.WithPathParameters("/{filesystem}/{path}", pathParameters),
   187  		autorest.WithQueryParameters(queryParameters))
   188  	if len(cacheControl) > 0 {
   189  		preparer = autorest.DecoratePreparer(preparer,
   190  			autorest.WithHeader("Cache-Control", autorest.String(cacheControl)))
   191  	}
   192  	if len(contentEncoding) > 0 {
   193  		preparer = autorest.DecoratePreparer(preparer,
   194  			autorest.WithHeader("Content-Encoding", autorest.String(contentEncoding)))
   195  	}
   196  	if len(contentLanguage) > 0 {
   197  		preparer = autorest.DecoratePreparer(preparer,
   198  			autorest.WithHeader("Content-Language", autorest.String(contentLanguage)))
   199  	}
   200  	if len(contentDisposition) > 0 {
   201  		preparer = autorest.DecoratePreparer(preparer,
   202  			autorest.WithHeader("Content-Disposition", autorest.String(contentDisposition)))
   203  	}
   204  	if len(xMsCacheControl) > 0 {
   205  		preparer = autorest.DecoratePreparer(preparer,
   206  			autorest.WithHeader("x-ms-cache-control", autorest.String(xMsCacheControl)))
   207  	}
   208  	if len(xMsContentType) > 0 {
   209  		preparer = autorest.DecoratePreparer(preparer,
   210  			autorest.WithHeader("x-ms-content-type", autorest.String(xMsContentType)))
   211  	}
   212  	if len(xMsContentEncoding) > 0 {
   213  		preparer = autorest.DecoratePreparer(preparer,
   214  			autorest.WithHeader("x-ms-content-encoding", autorest.String(xMsContentEncoding)))
   215  	}
   216  	if len(xMsContentLanguage) > 0 {
   217  		preparer = autorest.DecoratePreparer(preparer,
   218  			autorest.WithHeader("x-ms-content-language", autorest.String(xMsContentLanguage)))
   219  	}
   220  	if len(xMsContentDisposition) > 0 {
   221  		preparer = autorest.DecoratePreparer(preparer,
   222  			autorest.WithHeader("x-ms-content-disposition", autorest.String(xMsContentDisposition)))
   223  	}
   224  	if len(xMsRenameSource) > 0 {
   225  		preparer = autorest.DecoratePreparer(preparer,
   226  			autorest.WithHeader("x-ms-rename-source", autorest.String(xMsRenameSource)))
   227  	}
   228  	if len(xMsLeaseID) > 0 {
   229  		preparer = autorest.DecoratePreparer(preparer,
   230  			autorest.WithHeader("x-ms-lease-id", autorest.String(xMsLeaseID)))
   231  	}
   232  	if len(xMsSourceLeaseID) > 0 {
   233  		preparer = autorest.DecoratePreparer(preparer,
   234  			autorest.WithHeader("x-ms-source-lease-id", autorest.String(xMsSourceLeaseID)))
   235  	}
   236  	if len(xMsProperties) > 0 {
   237  		preparer = autorest.DecoratePreparer(preparer,
   238  			autorest.WithHeader("x-ms-properties", autorest.String(xMsProperties)))
   239  	}
   240  	if len(xMsPermissions) > 0 {
   241  		preparer = autorest.DecoratePreparer(preparer,
   242  			autorest.WithHeader("x-ms-permissions", autorest.String(xMsPermissions)))
   243  	}
   244  	if len(xMsUmask) > 0 {
   245  		preparer = autorest.DecoratePreparer(preparer,
   246  			autorest.WithHeader("x-ms-umask", autorest.String(xMsUmask)))
   247  	}
   248  	if len(ifMatch) > 0 {
   249  		preparer = autorest.DecoratePreparer(preparer,
   250  			autorest.WithHeader("If-Match", autorest.String(ifMatch)))
   251  	}
   252  	if len(ifNoneMatch) > 0 {
   253  		preparer = autorest.DecoratePreparer(preparer,
   254  			autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch)))
   255  	}
   256  	if len(ifModifiedSince) > 0 {
   257  		preparer = autorest.DecoratePreparer(preparer,
   258  			autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince)))
   259  	}
   260  	if len(ifUnmodifiedSince) > 0 {
   261  		preparer = autorest.DecoratePreparer(preparer,
   262  			autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince)))
   263  	}
   264  	if len(xMsSourceIfMatch) > 0 {
   265  		preparer = autorest.DecoratePreparer(preparer,
   266  			autorest.WithHeader("x-ms-source-if-match", autorest.String(xMsSourceIfMatch)))
   267  	}
   268  	if len(xMsSourceIfNoneMatch) > 0 {
   269  		preparer = autorest.DecoratePreparer(preparer,
   270  			autorest.WithHeader("x-ms-source-if-none-match", autorest.String(xMsSourceIfNoneMatch)))
   271  	}
   272  	if len(xMsSourceIfModifiedSince) > 0 {
   273  		preparer = autorest.DecoratePreparer(preparer,
   274  			autorest.WithHeader("x-ms-source-if-modified-since", autorest.String(xMsSourceIfModifiedSince)))
   275  	}
   276  	if len(xMsSourceIfUnmodifiedSince) > 0 {
   277  		preparer = autorest.DecoratePreparer(preparer,
   278  			autorest.WithHeader("x-ms-source-if-unmodified-since", autorest.String(xMsSourceIfUnmodifiedSince)))
   279  	}
   280  	if len(xMsClientRequestID) > 0 {
   281  		preparer = autorest.DecoratePreparer(preparer,
   282  			autorest.WithHeader("x-ms-client-request-id", autorest.String(xMsClientRequestID)))
   283  	}
   284  	if len(xMsDate) > 0 {
   285  		preparer = autorest.DecoratePreparer(preparer,
   286  			autorest.WithHeader("x-ms-date", autorest.String(xMsDate)))
   287  	}
   288  	if len(client.XMsVersion) > 0 {
   289  		preparer = autorest.DecoratePreparer(preparer,
   290  			autorest.WithHeader("x-ms-version", autorest.String(client.XMsVersion)))
   291  	}
   292  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   293  }
   294  
   295  // CreateSender sends the Create request. The method will close the
   296  // http.Response Body if it receives an error.
   297  func (client PathClient) CreateSender(req *http.Request) (*http.Response, error) {
   298  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   299  }
   300  
   301  // CreateResponder handles the response to the Create request. The method always
   302  // closes the http.Response Body.
   303  func (client PathClient) CreateResponder(resp *http.Response) (result autorest.Response, err error) {
   304  	err = autorest.Respond(
   305  		resp,
   306  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
   307  		autorest.ByClosing())
   308  	result.Response = resp
   309  	return
   310  }
   311  
   312  // Delete delete the file or directory. This operation supports conditional HTTP requests.  For more information, see
   313  // [Specifying Conditional Headers for Blob Service
   314  // Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations).
   315  // Parameters:
   316  // filesystem - the filesystem identifier.
   317  // pathParameter - the file or directory path.
   318  // recursive - required and valid only when the resource is a directory.  If "true", all paths beneath the
   319  // directory will be deleted. If "false" and the directory is non-empty, an error occurs.
   320  // continuation - optional.  When deleting a directory, the number of paths that are deleted with each
   321  // invocation is limited.  If the number of paths to be deleted exceeds this limit, a continuation token is
   322  // returned in this response header.  When a continuation token is returned in the response, it must be
   323  // specified in a subsequent invocation of the delete operation to continue deleting the directory.
   324  // xMsLeaseID - the lease ID must be specified if there is an active lease.
   325  // ifMatch - optional.  An ETag value. Specify this header to perform the operation only if the resource's ETag
   326  // matches the value specified. The ETag must be specified in quotes.
   327  // ifNoneMatch - optional.  An ETag value or the special wildcard ("*") value. Specify this header to perform
   328  // the operation only if the resource's ETag does not match the value specified. The ETag must be specified in
   329  // quotes.
   330  // ifModifiedSince - optional. A date and time value. Specify this header to perform the operation only if the
   331  // resource has been modified since the specified date and time.
   332  // ifUnmodifiedSince - optional. A date and time value. Specify this header to perform the operation only if
   333  // the resource has not been modified since the specified date and time.
   334  // xMsClientRequestID - a UUID recorded in the analytics logs for troubleshooting and correlation.
   335  // timeout - an optional operation timeout value in seconds. The period begins when the request is received by
   336  // the service. If the timeout value elapses before the operation completes, the operation fails.
   337  // xMsDate - specifies the Coordinated Universal Time (UTC) for the request.  This is required when using
   338  // shared key authorization.
   339  func (client PathClient) Delete(ctx context.Context, filesystem string, pathParameter string, recursive *bool, continuation string, xMsLeaseID string, ifMatch string, ifNoneMatch string, ifModifiedSince string, ifUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (result autorest.Response, err error) {
   340  	if tracing.IsEnabled() {
   341  		ctx = tracing.StartSpan(ctx, fqdn+"/PathClient.Delete")
   342  		defer func() {
   343  			sc := -1
   344  			if result.Response != nil {
   345  				sc = result.Response.StatusCode
   346  			}
   347  			tracing.EndSpan(ctx, sc, err)
   348  		}()
   349  	}
   350  	if err := validation.Validate([]validation.Validation{
   351  		{TargetValue: xMsLeaseID,
   352  			Constraints: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Empty, Rule: false,
   353  				Chain: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
   354  		{TargetValue: filesystem,
   355  			Constraints: []validation.Constraint{{Target: "filesystem", Name: validation.MaxLength, Rule: 63, Chain: nil},
   356  				{Target: "filesystem", Name: validation.MinLength, Rule: 3, Chain: nil}}},
   357  		{TargetValue: xMsClientRequestID,
   358  			Constraints: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Empty, Rule: false,
   359  				Chain: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
   360  		{TargetValue: timeout,
   361  			Constraints: []validation.Constraint{{Target: "timeout", Name: validation.Null, Rule: false,
   362  				Chain: []validation.Constraint{{Target: "timeout", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}}); err != nil {
   363  		return result, validation.NewError("storagedatalake.PathClient", "Delete", err.Error())
   364  	}
   365  
   366  	req, err := client.DeletePreparer(ctx, filesystem, pathParameter, recursive, continuation, xMsLeaseID, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince, xMsClientRequestID, timeout, xMsDate)
   367  	if err != nil {
   368  		err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Delete", nil, "Failure preparing request")
   369  		return
   370  	}
   371  
   372  	resp, err := client.DeleteSender(req)
   373  	if err != nil {
   374  		result.Response = resp
   375  		err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Delete", resp, "Failure sending request")
   376  		return
   377  	}
   378  
   379  	result, err = client.DeleteResponder(resp)
   380  	if err != nil {
   381  		err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Delete", resp, "Failure responding to request")
   382  		return
   383  	}
   384  
   385  	return
   386  }
   387  
   388  // DeletePreparer prepares the Delete request.
   389  func (client PathClient) DeletePreparer(ctx context.Context, filesystem string, pathParameter string, recursive *bool, continuation string, xMsLeaseID string, ifMatch string, ifNoneMatch string, ifModifiedSince string, ifUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (*http.Request, error) {
   390  	urlParameters := map[string]interface{}{
   391  		"accountName": client.AccountName,
   392  		"dnsSuffix":   client.DNSSuffix,
   393  	}
   394  
   395  	pathParameters := map[string]interface{}{
   396  		"filesystem": autorest.Encode("path", filesystem),
   397  		"path":       autorest.Encode("path", pathParameter),
   398  	}
   399  
   400  	queryParameters := map[string]interface{}{}
   401  	if recursive != nil {
   402  		queryParameters["recursive"] = autorest.Encode("query", *recursive)
   403  	}
   404  	if len(continuation) > 0 {
   405  		queryParameters["continuation"] = autorest.Encode("query", continuation)
   406  	}
   407  	if timeout != nil {
   408  		queryParameters["timeout"] = autorest.Encode("query", *timeout)
   409  	}
   410  
   411  	preparer := autorest.CreatePreparer(
   412  		autorest.AsDelete(),
   413  		autorest.WithCustomBaseURL("https://{accountName}.{dnsSuffix}", urlParameters),
   414  		autorest.WithPathParameters("/{filesystem}/{path}", pathParameters),
   415  		autorest.WithQueryParameters(queryParameters))
   416  	if len(xMsLeaseID) > 0 {
   417  		preparer = autorest.DecoratePreparer(preparer,
   418  			autorest.WithHeader("x-ms-lease-id", autorest.String(xMsLeaseID)))
   419  	}
   420  	if len(ifMatch) > 0 {
   421  		preparer = autorest.DecoratePreparer(preparer,
   422  			autorest.WithHeader("If-Match", autorest.String(ifMatch)))
   423  	}
   424  	if len(ifNoneMatch) > 0 {
   425  		preparer = autorest.DecoratePreparer(preparer,
   426  			autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch)))
   427  	}
   428  	if len(ifModifiedSince) > 0 {
   429  		preparer = autorest.DecoratePreparer(preparer,
   430  			autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince)))
   431  	}
   432  	if len(ifUnmodifiedSince) > 0 {
   433  		preparer = autorest.DecoratePreparer(preparer,
   434  			autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince)))
   435  	}
   436  	if len(xMsClientRequestID) > 0 {
   437  		preparer = autorest.DecoratePreparer(preparer,
   438  			autorest.WithHeader("x-ms-client-request-id", autorest.String(xMsClientRequestID)))
   439  	}
   440  	if len(xMsDate) > 0 {
   441  		preparer = autorest.DecoratePreparer(preparer,
   442  			autorest.WithHeader("x-ms-date", autorest.String(xMsDate)))
   443  	}
   444  	if len(client.XMsVersion) > 0 {
   445  		preparer = autorest.DecoratePreparer(preparer,
   446  			autorest.WithHeader("x-ms-version", autorest.String(client.XMsVersion)))
   447  	}
   448  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   449  }
   450  
   451  // DeleteSender sends the Delete request. The method will close the
   452  // http.Response Body if it receives an error.
   453  func (client PathClient) DeleteSender(req *http.Request) (*http.Response, error) {
   454  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   455  }
   456  
   457  // DeleteResponder handles the response to the Delete request. The method always
   458  // closes the http.Response Body.
   459  func (client PathClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
   460  	err = autorest.Respond(
   461  		resp,
   462  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   463  		autorest.ByClosing())
   464  	result.Response = resp
   465  	return
   466  }
   467  
   468  // GetProperties get Properties returns all system and user defined properties for a path. Get Status returns all
   469  // system defined properties for a path. Get Access Control List returns the access control list for a path. This
   470  // operation supports conditional HTTP requests.  For more information, see [Specifying Conditional Headers for Blob
   471  // Service
   472  // Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations).
   473  // Parameters:
   474  // filesystem - the filesystem identifier.
   475  // pathParameter - the file or directory path.
   476  // action - optional. If the value is "getStatus" only the system defined properties for the path are returned.
   477  // If the value is "getAccessControl" the access control list is returned in the response headers (Hierarchical
   478  // Namespace must be enabled for the account), otherwise the properties are returned.
   479  // upn - optional. Valid only when Hierarchical Namespace is enabled for the account. If "true", the user
   480  // identity values returned in the x-ms-owner, x-ms-group, and x-ms-acl response headers will be transformed
   481  // from Azure Active Directory Object IDs to User Principal Names.  If "false", the values will be returned as
   482  // Azure Active Directory Object IDs. The default value is false. Note that group and application Object IDs
   483  // are not translated because they do not have unique friendly names.
   484  // fsAction - required only for check access action. Valid only when Hierarchical Namespace is enabled for the
   485  // account. File system operation read/write/execute in string form, matching regex pattern '[rwx-]{3}'
   486  // xMsLeaseID - optional. If this header is specified, the operation will be performed only if both of the
   487  // following conditions are met: i) the path's lease is currently active and ii) the lease ID specified in the
   488  // request matches that of the path.
   489  // ifMatch - optional.  An ETag value. Specify this header to perform the operation only if the resource's ETag
   490  // matches the value specified. The ETag must be specified in quotes.
   491  // ifNoneMatch - optional.  An ETag value or the special wildcard ("*") value. Specify this header to perform
   492  // the operation only if the resource's ETag does not match the value specified. The ETag must be specified in
   493  // quotes.
   494  // ifModifiedSince - optional. A date and time value. Specify this header to perform the operation only if the
   495  // resource has been modified since the specified date and time.
   496  // ifUnmodifiedSince - optional. A date and time value. Specify this header to perform the operation only if
   497  // the resource has not been modified since the specified date and time.
   498  // xMsClientRequestID - a UUID recorded in the analytics logs for troubleshooting and correlation.
   499  // timeout - an optional operation timeout value in seconds. The period begins when the request is received by
   500  // the service. If the timeout value elapses before the operation completes, the operation fails.
   501  // xMsDate - specifies the Coordinated Universal Time (UTC) for the request.  This is required when using
   502  // shared key authorization.
   503  func (client PathClient) GetProperties(ctx context.Context, filesystem string, pathParameter string, action PathGetPropertiesAction, upn *bool, fsAction string, xMsLeaseID string, ifMatch string, ifNoneMatch string, ifModifiedSince string, ifUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (result autorest.Response, err error) {
   504  	if tracing.IsEnabled() {
   505  		ctx = tracing.StartSpan(ctx, fqdn+"/PathClient.GetProperties")
   506  		defer func() {
   507  			sc := -1
   508  			if result.Response != nil {
   509  				sc = result.Response.StatusCode
   510  			}
   511  			tracing.EndSpan(ctx, sc, err)
   512  		}()
   513  	}
   514  	if err := validation.Validate([]validation.Validation{
   515  		{TargetValue: xMsLeaseID,
   516  			Constraints: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Empty, Rule: false,
   517  				Chain: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
   518  		{TargetValue: filesystem,
   519  			Constraints: []validation.Constraint{{Target: "filesystem", Name: validation.MaxLength, Rule: 63, Chain: nil},
   520  				{Target: "filesystem", Name: validation.MinLength, Rule: 3, Chain: nil}}},
   521  		{TargetValue: xMsClientRequestID,
   522  			Constraints: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Empty, Rule: false,
   523  				Chain: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
   524  		{TargetValue: timeout,
   525  			Constraints: []validation.Constraint{{Target: "timeout", Name: validation.Null, Rule: false,
   526  				Chain: []validation.Constraint{{Target: "timeout", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}}); err != nil {
   527  		return result, validation.NewError("storagedatalake.PathClient", "GetProperties", err.Error())
   528  	}
   529  
   530  	req, err := client.GetPropertiesPreparer(ctx, filesystem, pathParameter, action, upn, fsAction, xMsLeaseID, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince, xMsClientRequestID, timeout, xMsDate)
   531  	if err != nil {
   532  		err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "GetProperties", nil, "Failure preparing request")
   533  		return
   534  	}
   535  
   536  	resp, err := client.GetPropertiesSender(req)
   537  	if err != nil {
   538  		result.Response = resp
   539  		err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "GetProperties", resp, "Failure sending request")
   540  		return
   541  	}
   542  
   543  	result, err = client.GetPropertiesResponder(resp)
   544  	if err != nil {
   545  		err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "GetProperties", resp, "Failure responding to request")
   546  		return
   547  	}
   548  
   549  	return
   550  }
   551  
   552  // GetPropertiesPreparer prepares the GetProperties request.
   553  func (client PathClient) GetPropertiesPreparer(ctx context.Context, filesystem string, pathParameter string, action PathGetPropertiesAction, upn *bool, fsAction string, xMsLeaseID string, ifMatch string, ifNoneMatch string, ifModifiedSince string, ifUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (*http.Request, error) {
   554  	urlParameters := map[string]interface{}{
   555  		"accountName": client.AccountName,
   556  		"dnsSuffix":   client.DNSSuffix,
   557  	}
   558  
   559  	pathParameters := map[string]interface{}{
   560  		"filesystem": autorest.Encode("path", filesystem),
   561  		"path":       autorest.Encode("path", pathParameter),
   562  	}
   563  
   564  	queryParameters := map[string]interface{}{}
   565  	if len(string(action)) > 0 {
   566  		queryParameters["action"] = autorest.Encode("query", action)
   567  	}
   568  	if upn != nil {
   569  		queryParameters["upn"] = autorest.Encode("query", *upn)
   570  	}
   571  	if len(fsAction) > 0 {
   572  		queryParameters["fsAction"] = autorest.Encode("query", fsAction)
   573  	}
   574  	if timeout != nil {
   575  		queryParameters["timeout"] = autorest.Encode("query", *timeout)
   576  	}
   577  
   578  	preparer := autorest.CreatePreparer(
   579  		autorest.AsHead(),
   580  		autorest.WithCustomBaseURL("https://{accountName}.{dnsSuffix}", urlParameters),
   581  		autorest.WithPathParameters("/{filesystem}/{path}", pathParameters),
   582  		autorest.WithQueryParameters(queryParameters))
   583  	if len(xMsLeaseID) > 0 {
   584  		preparer = autorest.DecoratePreparer(preparer,
   585  			autorest.WithHeader("x-ms-lease-id", autorest.String(xMsLeaseID)))
   586  	}
   587  	if len(ifMatch) > 0 {
   588  		preparer = autorest.DecoratePreparer(preparer,
   589  			autorest.WithHeader("If-Match", autorest.String(ifMatch)))
   590  	}
   591  	if len(ifNoneMatch) > 0 {
   592  		preparer = autorest.DecoratePreparer(preparer,
   593  			autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch)))
   594  	}
   595  	if len(ifModifiedSince) > 0 {
   596  		preparer = autorest.DecoratePreparer(preparer,
   597  			autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince)))
   598  	}
   599  	if len(ifUnmodifiedSince) > 0 {
   600  		preparer = autorest.DecoratePreparer(preparer,
   601  			autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince)))
   602  	}
   603  	if len(xMsClientRequestID) > 0 {
   604  		preparer = autorest.DecoratePreparer(preparer,
   605  			autorest.WithHeader("x-ms-client-request-id", autorest.String(xMsClientRequestID)))
   606  	}
   607  	if len(xMsDate) > 0 {
   608  		preparer = autorest.DecoratePreparer(preparer,
   609  			autorest.WithHeader("x-ms-date", autorest.String(xMsDate)))
   610  	}
   611  	if len(client.XMsVersion) > 0 {
   612  		preparer = autorest.DecoratePreparer(preparer,
   613  			autorest.WithHeader("x-ms-version", autorest.String(client.XMsVersion)))
   614  	}
   615  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   616  }
   617  
   618  // GetPropertiesSender sends the GetProperties request. The method will close the
   619  // http.Response Body if it receives an error.
   620  func (client PathClient) GetPropertiesSender(req *http.Request) (*http.Response, error) {
   621  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   622  }
   623  
   624  // GetPropertiesResponder handles the response to the GetProperties request. The method always
   625  // closes the http.Response Body.
   626  func (client PathClient) GetPropertiesResponder(resp *http.Response) (result autorest.Response, err error) {
   627  	err = autorest.Respond(
   628  		resp,
   629  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   630  		autorest.ByClosing())
   631  	result.Response = resp
   632  	return
   633  }
   634  
   635  // Lease create and manage a lease to restrict write and delete access to the path. This operation supports conditional
   636  // HTTP requests.  For more information, see [Specifying Conditional Headers for Blob Service
   637  // Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations).
   638  // Parameters:
   639  // xMsLeaseAction - there are five lease actions: "acquire", "break", "change", "renew", and "release". Use
   640  // "acquire" and specify the "x-ms-proposed-lease-id" and "x-ms-lease-duration" to acquire a new lease. Use
   641  // "break" to break an existing lease. When a lease is broken, the lease break period is allowed to elapse,
   642  // during which time no lease operation except break and release can be performed on the file. When a lease is
   643  // successfully broken, the response indicates the interval in seconds until a new lease can be acquired. Use
   644  // "change" and specify the current lease ID in "x-ms-lease-id" and the new lease ID in
   645  // "x-ms-proposed-lease-id" to change the lease ID of an active lease. Use "renew" and specify the
   646  // "x-ms-lease-id" to renew an existing lease. Use "release" and specify the "x-ms-lease-id" to release a
   647  // lease.
   648  // filesystem - the filesystem identifier.
   649  // pathParameter - the file or directory path.
   650  // xMsLeaseDuration - the lease duration is required to acquire a lease, and specifies the duration of the
   651  // lease in seconds.  The lease duration must be between 15 and 60 seconds or -1 for infinite lease.
   652  // xMsLeaseBreakPeriod - the lease break period duration is optional to break a lease, and  specifies the break
   653  // period of the lease in seconds.  The lease break  duration must be between 0 and 60 seconds.
   654  // xMsLeaseID - required when "x-ms-lease-action" is "renew", "change" or "release". For the renew and release
   655  // actions, this must match the current lease ID.
   656  // xMsProposedLeaseID - required when "x-ms-lease-action" is "acquire" or "change".  A lease will be acquired
   657  // with this lease ID if the operation is successful.
   658  // ifMatch - optional.  An ETag value. Specify this header to perform the operation only if the resource's ETag
   659  // matches the value specified. The ETag must be specified in quotes.
   660  // ifNoneMatch - optional.  An ETag value or the special wildcard ("*") value. Specify this header to perform
   661  // the operation only if the resource's ETag does not match the value specified. The ETag must be specified in
   662  // quotes.
   663  // ifModifiedSince - optional. A date and time value. Specify this header to perform the operation only if the
   664  // resource has been modified since the specified date and time.
   665  // ifUnmodifiedSince - optional. A date and time value. Specify this header to perform the operation only if
   666  // the resource has not been modified since the specified date and time.
   667  // xMsClientRequestID - a UUID recorded in the analytics logs for troubleshooting and correlation.
   668  // timeout - an optional operation timeout value in seconds. The period begins when the request is received by
   669  // the service. If the timeout value elapses before the operation completes, the operation fails.
   670  // xMsDate - specifies the Coordinated Universal Time (UTC) for the request.  This is required when using
   671  // shared key authorization.
   672  func (client PathClient) Lease(ctx context.Context, xMsLeaseAction PathLeaseAction, filesystem string, pathParameter string, xMsLeaseDuration *int32, xMsLeaseBreakPeriod *int32, xMsLeaseID string, xMsProposedLeaseID string, ifMatch string, ifNoneMatch string, ifModifiedSince string, ifUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (result autorest.Response, err error) {
   673  	if tracing.IsEnabled() {
   674  		ctx = tracing.StartSpan(ctx, fqdn+"/PathClient.Lease")
   675  		defer func() {
   676  			sc := -1
   677  			if result.Response != nil {
   678  				sc = result.Response.StatusCode
   679  			}
   680  			tracing.EndSpan(ctx, sc, err)
   681  		}()
   682  	}
   683  	if err := validation.Validate([]validation.Validation{
   684  		{TargetValue: xMsLeaseID,
   685  			Constraints: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Empty, Rule: false,
   686  				Chain: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
   687  		{TargetValue: xMsProposedLeaseID,
   688  			Constraints: []validation.Constraint{{Target: "xMsProposedLeaseID", Name: validation.Empty, Rule: false,
   689  				Chain: []validation.Constraint{{Target: "xMsProposedLeaseID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
   690  		{TargetValue: filesystem,
   691  			Constraints: []validation.Constraint{{Target: "filesystem", Name: validation.MaxLength, Rule: 63, Chain: nil},
   692  				{Target: "filesystem", Name: validation.MinLength, Rule: 3, Chain: nil}}},
   693  		{TargetValue: xMsClientRequestID,
   694  			Constraints: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Empty, Rule: false,
   695  				Chain: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
   696  		{TargetValue: timeout,
   697  			Constraints: []validation.Constraint{{Target: "timeout", Name: validation.Null, Rule: false,
   698  				Chain: []validation.Constraint{{Target: "timeout", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}}); err != nil {
   699  		return result, validation.NewError("storagedatalake.PathClient", "Lease", err.Error())
   700  	}
   701  
   702  	req, err := client.LeasePreparer(ctx, xMsLeaseAction, filesystem, pathParameter, xMsLeaseDuration, xMsLeaseBreakPeriod, xMsLeaseID, xMsProposedLeaseID, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince, xMsClientRequestID, timeout, xMsDate)
   703  	if err != nil {
   704  		err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Lease", nil, "Failure preparing request")
   705  		return
   706  	}
   707  
   708  	resp, err := client.LeaseSender(req)
   709  	if err != nil {
   710  		result.Response = resp
   711  		err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Lease", resp, "Failure sending request")
   712  		return
   713  	}
   714  
   715  	result, err = client.LeaseResponder(resp)
   716  	if err != nil {
   717  		err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Lease", resp, "Failure responding to request")
   718  		return
   719  	}
   720  
   721  	return
   722  }
   723  
   724  // LeasePreparer prepares the Lease request.
   725  func (client PathClient) LeasePreparer(ctx context.Context, xMsLeaseAction PathLeaseAction, filesystem string, pathParameter string, xMsLeaseDuration *int32, xMsLeaseBreakPeriod *int32, xMsLeaseID string, xMsProposedLeaseID string, ifMatch string, ifNoneMatch string, ifModifiedSince string, ifUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (*http.Request, error) {
   726  	urlParameters := map[string]interface{}{
   727  		"accountName": client.AccountName,
   728  		"dnsSuffix":   client.DNSSuffix,
   729  	}
   730  
   731  	pathParameters := map[string]interface{}{
   732  		"filesystem": autorest.Encode("path", filesystem),
   733  		"path":       autorest.Encode("path", pathParameter),
   734  	}
   735  
   736  	queryParameters := map[string]interface{}{}
   737  	if timeout != nil {
   738  		queryParameters["timeout"] = autorest.Encode("query", *timeout)
   739  	}
   740  
   741  	preparer := autorest.CreatePreparer(
   742  		autorest.AsPost(),
   743  		autorest.WithCustomBaseURL("https://{accountName}.{dnsSuffix}", urlParameters),
   744  		autorest.WithPathParameters("/{filesystem}/{path}", pathParameters),
   745  		autorest.WithQueryParameters(queryParameters),
   746  		autorest.WithHeader("x-ms-lease-action", autorest.String(xMsLeaseAction)))
   747  	if xMsLeaseDuration != nil {
   748  		preparer = autorest.DecoratePreparer(preparer,
   749  			autorest.WithHeader("x-ms-lease-duration", autorest.String(*xMsLeaseDuration)))
   750  	}
   751  	if xMsLeaseBreakPeriod != nil {
   752  		preparer = autorest.DecoratePreparer(preparer,
   753  			autorest.WithHeader("x-ms-lease-break-period", autorest.String(*xMsLeaseBreakPeriod)))
   754  	}
   755  	if len(xMsLeaseID) > 0 {
   756  		preparer = autorest.DecoratePreparer(preparer,
   757  			autorest.WithHeader("x-ms-lease-id", autorest.String(xMsLeaseID)))
   758  	}
   759  	if len(xMsProposedLeaseID) > 0 {
   760  		preparer = autorest.DecoratePreparer(preparer,
   761  			autorest.WithHeader("x-ms-proposed-lease-id", autorest.String(xMsProposedLeaseID)))
   762  	}
   763  	if len(ifMatch) > 0 {
   764  		preparer = autorest.DecoratePreparer(preparer,
   765  			autorest.WithHeader("If-Match", autorest.String(ifMatch)))
   766  	}
   767  	if len(ifNoneMatch) > 0 {
   768  		preparer = autorest.DecoratePreparer(preparer,
   769  			autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch)))
   770  	}
   771  	if len(ifModifiedSince) > 0 {
   772  		preparer = autorest.DecoratePreparer(preparer,
   773  			autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince)))
   774  	}
   775  	if len(ifUnmodifiedSince) > 0 {
   776  		preparer = autorest.DecoratePreparer(preparer,
   777  			autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince)))
   778  	}
   779  	if len(xMsClientRequestID) > 0 {
   780  		preparer = autorest.DecoratePreparer(preparer,
   781  			autorest.WithHeader("x-ms-client-request-id", autorest.String(xMsClientRequestID)))
   782  	}
   783  	if len(xMsDate) > 0 {
   784  		preparer = autorest.DecoratePreparer(preparer,
   785  			autorest.WithHeader("x-ms-date", autorest.String(xMsDate)))
   786  	}
   787  	if len(client.XMsVersion) > 0 {
   788  		preparer = autorest.DecoratePreparer(preparer,
   789  			autorest.WithHeader("x-ms-version", autorest.String(client.XMsVersion)))
   790  	}
   791  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   792  }
   793  
   794  // LeaseSender sends the Lease request. The method will close the
   795  // http.Response Body if it receives an error.
   796  func (client PathClient) LeaseSender(req *http.Request) (*http.Response, error) {
   797  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   798  }
   799  
   800  // LeaseResponder handles the response to the Lease request. The method always
   801  // closes the http.Response Body.
   802  func (client PathClient) LeaseResponder(resp *http.Response) (result autorest.Response, err error) {
   803  	err = autorest.Respond(
   804  		resp,
   805  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted),
   806  		autorest.ByClosing())
   807  	result.Response = resp
   808  	return
   809  }
   810  
   811  // List list filesystem paths and their properties.
   812  // Parameters:
   813  // recursive - if "true", all paths are listed; otherwise, only paths at the root of the filesystem are listed.
   814  // If "directory" is specified, the list will only include paths that share the same root.
   815  // filesystem - the filesystem identifier.  The value must start and end with a letter or number and must
   816  // contain only letters, numbers, and the dash (-) character.  Consecutive dashes are not permitted.  All
   817  // letters must be lowercase.  The value must have between 3 and 63 characters.
   818  // directory - filters results to paths within the specified directory. An error occurs if the directory does
   819  // not exist.
   820  // continuation - the number of paths returned with each invocation is limited. If the number of paths to be
   821  // returned exceeds this limit, a continuation token is returned in the response header x-ms-continuation. When
   822  // a continuation token is  returned in the response, it must be specified in a subsequent invocation of the
   823  // list operation to continue listing the paths.
   824  // maxResults - an optional value that specifies the maximum number of items to return. If omitted or greater
   825  // than 5,000, the response will include up to 5,000 items.
   826  // upn - optional. Valid only when Hierarchical Namespace is enabled for the account. If "true", the user
   827  // identity values returned in the owner and group fields of each list entry will be transformed from Azure
   828  // Active Directory Object IDs to User Principal Names.  If "false", the values will be returned as Azure
   829  // Active Directory Object IDs. The default value is false. Note that group and application Object IDs are not
   830  // translated because they do not have unique friendly names.
   831  // xMsClientRequestID - a UUID recorded in the analytics logs for troubleshooting and correlation.
   832  // timeout - an optional operation timeout value in seconds. The period begins when the request is received by
   833  // the service. If the timeout value elapses before the operation completes, the operation fails.
   834  // xMsDate - specifies the Coordinated Universal Time (UTC) for the request.  This is required when using
   835  // shared key authorization.
   836  func (client PathClient) List(ctx context.Context, recursive bool, filesystem string, directory string, continuation string, maxResults *int32, upn *bool, xMsClientRequestID string, timeout *int32, xMsDate string) (result PathList, err error) {
   837  	if tracing.IsEnabled() {
   838  		ctx = tracing.StartSpan(ctx, fqdn+"/PathClient.List")
   839  		defer func() {
   840  			sc := -1
   841  			if result.Response.Response != nil {
   842  				sc = result.Response.Response.StatusCode
   843  			}
   844  			tracing.EndSpan(ctx, sc, err)
   845  		}()
   846  	}
   847  	if err := validation.Validate([]validation.Validation{
   848  		{TargetValue: maxResults,
   849  			Constraints: []validation.Constraint{{Target: "maxResults", Name: validation.Null, Rule: false,
   850  				Chain: []validation.Constraint{{Target: "maxResults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}},
   851  		{TargetValue: filesystem,
   852  			Constraints: []validation.Constraint{{Target: "filesystem", Name: validation.MaxLength, Rule: 63, Chain: nil},
   853  				{Target: "filesystem", Name: validation.MinLength, Rule: 3, Chain: nil}}},
   854  		{TargetValue: xMsClientRequestID,
   855  			Constraints: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Empty, Rule: false,
   856  				Chain: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
   857  		{TargetValue: timeout,
   858  			Constraints: []validation.Constraint{{Target: "timeout", Name: validation.Null, Rule: false,
   859  				Chain: []validation.Constraint{{Target: "timeout", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}}); err != nil {
   860  		return result, validation.NewError("storagedatalake.PathClient", "List", err.Error())
   861  	}
   862  
   863  	req, err := client.ListPreparer(ctx, recursive, filesystem, directory, continuation, maxResults, upn, xMsClientRequestID, timeout, xMsDate)
   864  	if err != nil {
   865  		err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "List", nil, "Failure preparing request")
   866  		return
   867  	}
   868  
   869  	resp, err := client.ListSender(req)
   870  	if err != nil {
   871  		result.Response = autorest.Response{Response: resp}
   872  		err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "List", resp, "Failure sending request")
   873  		return
   874  	}
   875  
   876  	result, err = client.ListResponder(resp)
   877  	if err != nil {
   878  		err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "List", resp, "Failure responding to request")
   879  		return
   880  	}
   881  
   882  	return
   883  }
   884  
   885  // ListPreparer prepares the List request.
   886  func (client PathClient) ListPreparer(ctx context.Context, recursive bool, filesystem string, directory string, continuation string, maxResults *int32, upn *bool, xMsClientRequestID string, timeout *int32, xMsDate string) (*http.Request, error) {
   887  	urlParameters := map[string]interface{}{
   888  		"accountName": client.AccountName,
   889  		"dnsSuffix":   client.DNSSuffix,
   890  	}
   891  
   892  	pathParameters := map[string]interface{}{
   893  		"filesystem": autorest.Encode("path", filesystem),
   894  	}
   895  
   896  	queryParameters := map[string]interface{}{
   897  		"recursive": autorest.Encode("query", recursive),
   898  		"resource":  autorest.Encode("query", "filesystem"),
   899  	}
   900  	if len(directory) > 0 {
   901  		queryParameters["directory"] = autorest.Encode("query", directory)
   902  	}
   903  	if len(continuation) > 0 {
   904  		queryParameters["continuation"] = autorest.Encode("query", continuation)
   905  	}
   906  	if maxResults != nil {
   907  		queryParameters["maxResults"] = autorest.Encode("query", *maxResults)
   908  	}
   909  	if upn != nil {
   910  		queryParameters["upn"] = autorest.Encode("query", *upn)
   911  	}
   912  	if timeout != nil {
   913  		queryParameters["timeout"] = autorest.Encode("query", *timeout)
   914  	}
   915  
   916  	preparer := autorest.CreatePreparer(
   917  		autorest.AsGet(),
   918  		autorest.WithCustomBaseURL("https://{accountName}.{dnsSuffix}", urlParameters),
   919  		autorest.WithPathParameters("/{filesystem}", pathParameters),
   920  		autorest.WithQueryParameters(queryParameters))
   921  	if len(xMsClientRequestID) > 0 {
   922  		preparer = autorest.DecoratePreparer(preparer,
   923  			autorest.WithHeader("x-ms-client-request-id", autorest.String(xMsClientRequestID)))
   924  	}
   925  	if len(xMsDate) > 0 {
   926  		preparer = autorest.DecoratePreparer(preparer,
   927  			autorest.WithHeader("x-ms-date", autorest.String(xMsDate)))
   928  	}
   929  	if len(client.XMsVersion) > 0 {
   930  		preparer = autorest.DecoratePreparer(preparer,
   931  			autorest.WithHeader("x-ms-version", autorest.String(client.XMsVersion)))
   932  	}
   933  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   934  }
   935  
   936  // ListSender sends the List request. The method will close the
   937  // http.Response Body if it receives an error.
   938  func (client PathClient) ListSender(req *http.Request) (*http.Response, error) {
   939  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   940  }
   941  
   942  // ListResponder handles the response to the List request. The method always
   943  // closes the http.Response Body.
   944  func (client PathClient) ListResponder(resp *http.Response) (result PathList, err error) {
   945  	err = autorest.Respond(
   946  		resp,
   947  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   948  		autorest.ByUnmarshallingJSON(&result),
   949  		autorest.ByClosing())
   950  	result.Response = autorest.Response{Response: resp}
   951  	return
   952  }
   953  
   954  // Read read the contents of a file.  For read operations, range requests are supported. This operation supports
   955  // conditional HTTP requests.  For more information, see [Specifying Conditional Headers for Blob Service
   956  // Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations).
   957  // Parameters:
   958  // filesystem - the filesystem identifier.
   959  // pathParameter - the file or directory path.
   960  // rangeParameter - the HTTP Range request header specifies one or more byte ranges of the resource to be
   961  // retrieved.
   962  // xMsLeaseID - optional. If this header is specified, the operation will be performed only if both of the
   963  // following conditions are met: i) the path's lease is currently active and ii) the lease ID specified in the
   964  // request matches that of the path.
   965  // xMsRangeGetContentMd5 - optional. When this header is set to "true" and specified together with the Range
   966  // header, the service returns the MD5 hash for the range, as long as the range is less than or equal to 4MB in
   967  // size. If this header is specified without the Range header, the service returns status code 400 (Bad
   968  // Request). If this header is set to true when the range exceeds 4 MB in size, the service returns status code
   969  // 400 (Bad Request).
   970  // ifMatch - optional.  An ETag value. Specify this header to perform the operation only if the resource's ETag
   971  // matches the value specified. The ETag must be specified in quotes.
   972  // ifNoneMatch - optional.  An ETag value or the special wildcard ("*") value. Specify this header to perform
   973  // the operation only if the resource's ETag does not match the value specified. The ETag must be specified in
   974  // quotes.
   975  // ifModifiedSince - optional. A date and time value. Specify this header to perform the operation only if the
   976  // resource has been modified since the specified date and time.
   977  // ifUnmodifiedSince - optional. A date and time value. Specify this header to perform the operation only if
   978  // the resource has not been modified since the specified date and time.
   979  // xMsClientRequestID - a UUID recorded in the analytics logs for troubleshooting and correlation.
   980  // timeout - an optional operation timeout value in seconds. The period begins when the request is received by
   981  // the service. If the timeout value elapses before the operation completes, the operation fails.
   982  // xMsDate - specifies the Coordinated Universal Time (UTC) for the request.  This is required when using
   983  // shared key authorization.
   984  func (client PathClient) Read(ctx context.Context, filesystem string, pathParameter string, rangeParameter string, xMsLeaseID string, xMsRangeGetContentMd5 *bool, ifMatch string, ifNoneMatch string, ifModifiedSince string, ifUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (result ReadCloser, err error) {
   985  	if tracing.IsEnabled() {
   986  		ctx = tracing.StartSpan(ctx, fqdn+"/PathClient.Read")
   987  		defer func() {
   988  			sc := -1
   989  			if result.Response.Response != nil {
   990  				sc = result.Response.Response.StatusCode
   991  			}
   992  			tracing.EndSpan(ctx, sc, err)
   993  		}()
   994  	}
   995  	if err := validation.Validate([]validation.Validation{
   996  		{TargetValue: xMsLeaseID,
   997  			Constraints: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Empty, Rule: false,
   998  				Chain: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
   999  		{TargetValue: filesystem,
  1000  			Constraints: []validation.Constraint{{Target: "filesystem", Name: validation.MaxLength, Rule: 63, Chain: nil},
  1001  				{Target: "filesystem", Name: validation.MinLength, Rule: 3, Chain: nil}}},
  1002  		{TargetValue: xMsClientRequestID,
  1003  			Constraints: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Empty, Rule: false,
  1004  				Chain: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
  1005  		{TargetValue: timeout,
  1006  			Constraints: []validation.Constraint{{Target: "timeout", Name: validation.Null, Rule: false,
  1007  				Chain: []validation.Constraint{{Target: "timeout", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}}); err != nil {
  1008  		return result, validation.NewError("storagedatalake.PathClient", "Read", err.Error())
  1009  	}
  1010  
  1011  	req, err := client.ReadPreparer(ctx, filesystem, pathParameter, rangeParameter, xMsLeaseID, xMsRangeGetContentMd5, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince, xMsClientRequestID, timeout, xMsDate)
  1012  	if err != nil {
  1013  		err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Read", nil, "Failure preparing request")
  1014  		return
  1015  	}
  1016  
  1017  	resp, err := client.ReadSender(req)
  1018  	if err != nil {
  1019  		result.Response = autorest.Response{Response: resp}
  1020  		err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Read", resp, "Failure sending request")
  1021  		return
  1022  	}
  1023  
  1024  	result, err = client.ReadResponder(resp)
  1025  	if err != nil {
  1026  		err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Read", resp, "Failure responding to request")
  1027  		return
  1028  	}
  1029  
  1030  	return
  1031  }
  1032  
  1033  // ReadPreparer prepares the Read request.
  1034  func (client PathClient) ReadPreparer(ctx context.Context, filesystem string, pathParameter string, rangeParameter string, xMsLeaseID string, xMsRangeGetContentMd5 *bool, ifMatch string, ifNoneMatch string, ifModifiedSince string, ifUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (*http.Request, error) {
  1035  	urlParameters := map[string]interface{}{
  1036  		"accountName": client.AccountName,
  1037  		"dnsSuffix":   client.DNSSuffix,
  1038  	}
  1039  
  1040  	pathParameters := map[string]interface{}{
  1041  		"filesystem": autorest.Encode("path", filesystem),
  1042  		"path":       autorest.Encode("path", pathParameter),
  1043  	}
  1044  
  1045  	queryParameters := map[string]interface{}{}
  1046  	if timeout != nil {
  1047  		queryParameters["timeout"] = autorest.Encode("query", *timeout)
  1048  	}
  1049  
  1050  	preparer := autorest.CreatePreparer(
  1051  		autorest.AsGet(),
  1052  		autorest.WithCustomBaseURL("https://{accountName}.{dnsSuffix}", urlParameters),
  1053  		autorest.WithPathParameters("/{filesystem}/{path}", pathParameters),
  1054  		autorest.WithQueryParameters(queryParameters))
  1055  	if len(rangeParameter) > 0 {
  1056  		preparer = autorest.DecoratePreparer(preparer,
  1057  			autorest.WithHeader("Range", autorest.String(rangeParameter)))
  1058  	}
  1059  	if len(xMsLeaseID) > 0 {
  1060  		preparer = autorest.DecoratePreparer(preparer,
  1061  			autorest.WithHeader("x-ms-lease-id", autorest.String(xMsLeaseID)))
  1062  	}
  1063  	if xMsRangeGetContentMd5 != nil {
  1064  		preparer = autorest.DecoratePreparer(preparer,
  1065  			autorest.WithHeader("x-ms-range-get-content-md5", autorest.String(xMsRangeGetContentMd5)))
  1066  	}
  1067  	if len(ifMatch) > 0 {
  1068  		preparer = autorest.DecoratePreparer(preparer,
  1069  			autorest.WithHeader("If-Match", autorest.String(ifMatch)))
  1070  	}
  1071  	if len(ifNoneMatch) > 0 {
  1072  		preparer = autorest.DecoratePreparer(preparer,
  1073  			autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch)))
  1074  	}
  1075  	if len(ifModifiedSince) > 0 {
  1076  		preparer = autorest.DecoratePreparer(preparer,
  1077  			autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince)))
  1078  	}
  1079  	if len(ifUnmodifiedSince) > 0 {
  1080  		preparer = autorest.DecoratePreparer(preparer,
  1081  			autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince)))
  1082  	}
  1083  	if len(xMsClientRequestID) > 0 {
  1084  		preparer = autorest.DecoratePreparer(preparer,
  1085  			autorest.WithHeader("x-ms-client-request-id", autorest.String(xMsClientRequestID)))
  1086  	}
  1087  	if len(xMsDate) > 0 {
  1088  		preparer = autorest.DecoratePreparer(preparer,
  1089  			autorest.WithHeader("x-ms-date", autorest.String(xMsDate)))
  1090  	}
  1091  	if len(client.XMsVersion) > 0 {
  1092  		preparer = autorest.DecoratePreparer(preparer,
  1093  			autorest.WithHeader("x-ms-version", autorest.String(client.XMsVersion)))
  1094  	}
  1095  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1096  }
  1097  
  1098  // ReadSender sends the Read request. The method will close the
  1099  // http.Response Body if it receives an error.
  1100  func (client PathClient) ReadSender(req *http.Request) (*http.Response, error) {
  1101  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1102  }
  1103  
  1104  // ReadResponder handles the response to the Read request. The method always
  1105  // closes the http.Response Body.
  1106  func (client PathClient) ReadResponder(resp *http.Response) (result ReadCloser, err error) {
  1107  	result.Value = &resp.Body
  1108  	err = autorest.Respond(
  1109  		resp,
  1110  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusPartialContent))
  1111  	result.Response = autorest.Response{Response: resp}
  1112  	return
  1113  }
  1114  
  1115  // Update uploads data to be appended to a file, flushes (writes) previously uploaded data to a file, sets properties
  1116  // for a file or directory, or sets access control for a file or directory. Data can only be appended to a file. This
  1117  // operation supports conditional HTTP requests. For more information, see [Specifying Conditional Headers for Blob
  1118  // Service
  1119  // Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations).
  1120  // Parameters:
  1121  // action - the action must be "append" to upload data to be appended to a file, "flush" to flush previously
  1122  // uploaded data to a file, "setProperties" to set the properties of a file or directory, or "setAccessControl"
  1123  // to set the owner, group, permissions, or access control list for a file or directory.  Note that
  1124  // Hierarchical Namespace must be enabled for the account in order to use access control.  Also note that the
  1125  // Access Control List (ACL) includes permissions for the owner, owning group, and others, so the
  1126  // x-ms-permissions and x-ms-acl request headers are mutually exclusive.
  1127  // filesystem - the filesystem identifier.
  1128  // pathParameter - the file or directory path.
  1129  // position - this parameter allows the caller to upload data in parallel and control the order in which it is
  1130  // appended to the file.  It is required when uploading data to be appended to the file and when flushing
  1131  // previously uploaded data to the file.  The value must be the position where the data is to be appended.
  1132  // Uploaded data is not immediately flushed, or written, to the file.  To flush, the previously uploaded data
  1133  // must be contiguous, the position parameter must be specified and equal to the length of the file after all
  1134  // data has been written, and there must not be a request entity body included with the request.
  1135  // retainUncommittedData - valid only for flush operations.  If "true", uncommitted data is retained after the
  1136  // flush operation completes; otherwise, the uncommitted data is deleted after the flush operation.  The
  1137  // default is false.  Data at offsets less than the specified position are written to the file when flush
  1138  // succeeds, but this optional parameter allows data after the flush position to be retained for a future flush
  1139  // operation.
  1140  // closeParameter - azure Storage Events allow applications to receive notifications when files change. When
  1141  // Azure Storage Events are enabled, a file changed event is raised. This event has a property indicating
  1142  // whether this is the final change to distinguish the difference between an intermediate flush to a file
  1143  // stream and the final close of a file stream. The close query parameter is valid only when the action is
  1144  // "flush" and change notifications are enabled. If the value of close is "true" and the flush operation
  1145  // completes successfully, the service raises a file change notification with a property indicating that this
  1146  // is the final update (the file stream has been closed). If "false" a change notification is raised indicating
  1147  // the file has changed. The default is false. This query parameter is set to true by the Hadoop ABFS driver to
  1148  // indicate that the file stream has been closed."
  1149  // contentLength - required for "Append Data" and "Flush Data".  Must be 0 for "Flush Data".  Must be the
  1150  // length of the request content in bytes for "Append Data".
  1151  // contentMD5 - optional. An MD5 hash of the request content. This header is valid on "Append" and "Flush"
  1152  // operations. This hash is used to verify the integrity of the request content during transport. When this
  1153  // header is specified, the storage service compares the hash of the content that has arrived with this header
  1154  // value. If the two hashes do not match, the operation will fail with error code 400 (Bad Request). Note that
  1155  // this MD5 hash is not stored with the file. This header is associated with the request content, and not with
  1156  // the stored content of the file itself.
  1157  // xMsLeaseID - the lease ID must be specified if there is an active lease.
  1158  // xMsCacheControl - optional and only valid for flush and set properties operations.  The service stores this
  1159  // value and includes it in the "Cache-Control" response header for "Read File" operations.
  1160  // xMsContentType - optional and only valid for flush and set properties operations.  The service stores this
  1161  // value and includes it in the "Content-Type" response header for "Read File" operations.
  1162  // xMsContentDisposition - optional and only valid for flush and set properties operations.  The service stores
  1163  // this value and includes it in the "Content-Disposition" response header for "Read File" operations.
  1164  // xMsContentEncoding - optional and only valid for flush and set properties operations.  The service stores
  1165  // this value and includes it in the "Content-Encoding" response header for "Read File" operations.
  1166  // xMsContentLanguage - optional and only valid for flush and set properties operations.  The service stores
  1167  // this value and includes it in the "Content-Language" response header for "Read File" operations.
  1168  // xMsContentMd5 - optional and only valid for "Flush & Set Properties" operations.  The service stores this
  1169  // value and includes it in the "Content-Md5" response header for "Read & Get Properties" operations. If this
  1170  // property is not specified on the request, then the property will be cleared for the file. Subsequent calls
  1171  // to "Read & Get Properties" will not return this property unless it is explicitly set on that file again.
  1172  // xMsProperties - optional.  User-defined properties to be stored with the file or directory, in the format of
  1173  // a comma-separated list of name and value pairs "n1=v1, n2=v2, ...", where each value is a base64 encoded
  1174  // string. Note that the string may only contain ASCII characters in the ISO-8859-1 character set. Valid only
  1175  // for the setProperties operation. If the file or directory exists, any properties not included in the list
  1176  // will be removed.  All properties are removed if the header is omitted.  To merge new and existing
  1177  // properties, first get all existing properties and the current E-Tag, then make a conditional request with
  1178  // the E-Tag and include values for all properties.
  1179  // xMsOwner - optional and valid only for the setAccessControl operation. Sets the owner of the file or
  1180  // directory.
  1181  // xMsGroup - optional and valid only for the setAccessControl operation. Sets the owning group of the file or
  1182  // directory.
  1183  // xMsPermissions - optional and only valid if Hierarchical Namespace is enabled for the account. Sets POSIX
  1184  // access permissions for the file owner, the file owning group, and others. Each class may be granted read,
  1185  // write, or execute permission.  The sticky bit is also supported.  Both symbolic (rwxrw-rw-) and 4-digit
  1186  // octal notation (e.g. 0766) are supported. Invalid in conjunction with x-ms-acl.
  1187  // xMsACL - optional and valid only for the setAccessControl operation. Sets POSIX access control rights on
  1188  // files and directories. The value is a comma-separated list of access control entries that fully replaces the
  1189  // existing access control list (ACL).  Each access control entry (ACE) consists of a scope, a type, a user or
  1190  // group identifier, and permissions in the format "[scope:][type]:[id]:[permissions]". The scope must be
  1191  // "default" to indicate the ACE belongs to the default ACL for a directory; otherwise scope is implicit and
  1192  // the ACE belongs to the access ACL.  There are four ACE types: "user" grants rights to the owner or a named
  1193  // user, "group" grants rights to the owning group or a named group, "mask" restricts rights granted to named
  1194  // users and the members of groups, and "other" grants rights to all users not found in any of the other
  1195  // entries. The user or group identifier is omitted for entries of type "mask" and "other".  The user or group
  1196  // identifier is also omitted for the owner and owning group.  The permission field is a 3-character sequence
  1197  // where the first character is 'r' to grant read access, the second character is 'w' to grant write access,
  1198  // and the third character is 'x' to grant execute permission.  If access is not granted, the '-' character is
  1199  // used to denote that the permission is denied. For example, the following ACL grants read, write, and execute
  1200  // rights to the file owner and john.doe@contoso, the read right to the owning group, and nothing to everyone
  1201  // else: "user::rwx,user:john.doe@contoso:rwx,group::r--,other::---,mask=rwx". Invalid in conjunction with
  1202  // x-ms-permissions.
  1203  // ifMatch - optional for Flush Data and Set Properties, but invalid for Append Data.  An ETag value. Specify
  1204  // this header to perform the operation only if the resource's ETag matches the value specified. The ETag must
  1205  // be specified in quotes.
  1206  // ifNoneMatch - optional for Flush Data and Set Properties, but invalid for Append Data.  An ETag value or the
  1207  // special wildcard ("*") value. Specify this header to perform the operation only if the resource's ETag does
  1208  // not match the value specified. The ETag must be specified in quotes.
  1209  // ifModifiedSince - optional for Flush Data and Set Properties, but invalid for Append Data. A date and time
  1210  // value. Specify this header to perform the operation only if the resource has been modified since the
  1211  // specified date and time.
  1212  // ifUnmodifiedSince - optional for Flush Data and Set Properties, but invalid for Append Data. A date and time
  1213  // value. Specify this header to perform the operation only if the resource has not been modified since the
  1214  // specified date and time.
  1215  // requestBody - valid only for append operations.  The data to be uploaded and appended to the file.
  1216  // xMsClientRequestID - a UUID recorded in the analytics logs for troubleshooting and correlation.
  1217  // timeout - an optional operation timeout value in seconds. The period begins when the request is received by
  1218  // the service. If the timeout value elapses before the operation completes, the operation fails.
  1219  // xMsDate - specifies the Coordinated Universal Time (UTC) for the request.  This is required when using
  1220  // shared key authorization.
  1221  func (client PathClient) Update(ctx context.Context, action PathUpdateAction, filesystem string, pathParameter string, position *int64, retainUncommittedData *bool, closeParameter *bool, contentLength *int64, contentMD5 string, xMsLeaseID string, xMsCacheControl string, xMsContentType string, xMsContentDisposition string, xMsContentEncoding string, xMsContentLanguage string, xMsContentMd5 string, xMsProperties string, xMsOwner string, xMsGroup string, xMsPermissions string, xMsACL string, ifMatch string, ifNoneMatch string, ifModifiedSince string, ifUnmodifiedSince string, requestBody io.ReadCloser, xMsClientRequestID string, timeout *int32, xMsDate string) (result autorest.Response, err error) {
  1222  	if tracing.IsEnabled() {
  1223  		ctx = tracing.StartSpan(ctx, fqdn+"/PathClient.Update")
  1224  		defer func() {
  1225  			sc := -1
  1226  			if result.Response != nil {
  1227  				sc = result.Response.StatusCode
  1228  			}
  1229  			tracing.EndSpan(ctx, sc, err)
  1230  		}()
  1231  	}
  1232  	if err := validation.Validate([]validation.Validation{
  1233  		{TargetValue: contentLength,
  1234  			Constraints: []validation.Constraint{{Target: "contentLength", Name: validation.Null, Rule: false,
  1235  				Chain: []validation.Constraint{{Target: "contentLength", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}},
  1236  		{TargetValue: xMsLeaseID,
  1237  			Constraints: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Empty, Rule: false,
  1238  				Chain: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
  1239  		{TargetValue: filesystem,
  1240  			Constraints: []validation.Constraint{{Target: "filesystem", Name: validation.MaxLength, Rule: 63, Chain: nil},
  1241  				{Target: "filesystem", Name: validation.MinLength, Rule: 3, Chain: nil}}},
  1242  		{TargetValue: xMsClientRequestID,
  1243  			Constraints: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Empty, Rule: false,
  1244  				Chain: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
  1245  		{TargetValue: timeout,
  1246  			Constraints: []validation.Constraint{{Target: "timeout", Name: validation.Null, Rule: false,
  1247  				Chain: []validation.Constraint{{Target: "timeout", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}}); err != nil {
  1248  		return result, validation.NewError("storagedatalake.PathClient", "Update", err.Error())
  1249  	}
  1250  
  1251  	req, err := client.UpdatePreparer(ctx, action, filesystem, pathParameter, position, retainUncommittedData, closeParameter, contentLength, contentMD5, xMsLeaseID, xMsCacheControl, xMsContentType, xMsContentDisposition, xMsContentEncoding, xMsContentLanguage, xMsContentMd5, xMsProperties, xMsOwner, xMsGroup, xMsPermissions, xMsACL, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince, requestBody, xMsClientRequestID, timeout, xMsDate)
  1252  	if err != nil {
  1253  		err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Update", nil, "Failure preparing request")
  1254  		return
  1255  	}
  1256  
  1257  	resp, err := client.UpdateSender(req)
  1258  	if err != nil {
  1259  		result.Response = resp
  1260  		err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Update", resp, "Failure sending request")
  1261  		return
  1262  	}
  1263  
  1264  	result, err = client.UpdateResponder(resp)
  1265  	if err != nil {
  1266  		err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Update", resp, "Failure responding to request")
  1267  		return
  1268  	}
  1269  
  1270  	return
  1271  }
  1272  
  1273  // UpdatePreparer prepares the Update request.
  1274  func (client PathClient) UpdatePreparer(ctx context.Context, action PathUpdateAction, filesystem string, pathParameter string, position *int64, retainUncommittedData *bool, closeParameter *bool, contentLength *int64, contentMD5 string, xMsLeaseID string, xMsCacheControl string, xMsContentType string, xMsContentDisposition string, xMsContentEncoding string, xMsContentLanguage string, xMsContentMd5 string, xMsProperties string, xMsOwner string, xMsGroup string, xMsPermissions string, xMsACL string, ifMatch string, ifNoneMatch string, ifModifiedSince string, ifUnmodifiedSince string, requestBody io.ReadCloser, xMsClientRequestID string, timeout *int32, xMsDate string) (*http.Request, error) {
  1275  	urlParameters := map[string]interface{}{
  1276  		"accountName": client.AccountName,
  1277  		"dnsSuffix":   client.DNSSuffix,
  1278  	}
  1279  
  1280  	pathParameters := map[string]interface{}{
  1281  		"filesystem": autorest.Encode("path", filesystem),
  1282  		"path":       autorest.Encode("path", pathParameter),
  1283  	}
  1284  
  1285  	queryParameters := map[string]interface{}{
  1286  		"action": autorest.Encode("query", action),
  1287  	}
  1288  	if position != nil {
  1289  		queryParameters["position"] = autorest.Encode("query", *position)
  1290  	}
  1291  	if retainUncommittedData != nil {
  1292  		queryParameters["retainUncommittedData"] = autorest.Encode("query", *retainUncommittedData)
  1293  	}
  1294  	if closeParameter != nil {
  1295  		queryParameters["close"] = autorest.Encode("query", *closeParameter)
  1296  	}
  1297  	if timeout != nil {
  1298  		queryParameters["timeout"] = autorest.Encode("query", *timeout)
  1299  	}
  1300  
  1301  	preparer := autorest.CreatePreparer(
  1302  		autorest.AsContentType("application/octet-stream"),
  1303  		autorest.AsPatch(),
  1304  		autorest.WithCustomBaseURL("https://{accountName}.{dnsSuffix}", urlParameters),
  1305  		autorest.WithPathParameters("/{filesystem}/{path}", pathParameters),
  1306  		autorest.WithQueryParameters(queryParameters))
  1307  	if requestBody != nil {
  1308  		preparer = autorest.DecoratePreparer(preparer,
  1309  			autorest.WithFile(requestBody))
  1310  	}
  1311  	if contentLength != nil {
  1312  		preparer = autorest.DecoratePreparer(preparer,
  1313  			autorest.WithHeader("Content-Length", autorest.String(*contentLength)))
  1314  	}
  1315  	if len(contentMD5) > 0 {
  1316  		preparer = autorest.DecoratePreparer(preparer,
  1317  			autorest.WithHeader("Content-MD5", autorest.String(contentMD5)))
  1318  	}
  1319  	if len(xMsLeaseID) > 0 {
  1320  		preparer = autorest.DecoratePreparer(preparer,
  1321  			autorest.WithHeader("x-ms-lease-id", autorest.String(xMsLeaseID)))
  1322  	}
  1323  	if len(xMsCacheControl) > 0 {
  1324  		preparer = autorest.DecoratePreparer(preparer,
  1325  			autorest.WithHeader("x-ms-cache-control", autorest.String(xMsCacheControl)))
  1326  	}
  1327  	if len(xMsContentType) > 0 {
  1328  		preparer = autorest.DecoratePreparer(preparer,
  1329  			autorest.WithHeader("x-ms-content-type", autorest.String(xMsContentType)))
  1330  	}
  1331  	if len(xMsContentDisposition) > 0 {
  1332  		preparer = autorest.DecoratePreparer(preparer,
  1333  			autorest.WithHeader("x-ms-content-disposition", autorest.String(xMsContentDisposition)))
  1334  	}
  1335  	if len(xMsContentEncoding) > 0 {
  1336  		preparer = autorest.DecoratePreparer(preparer,
  1337  			autorest.WithHeader("x-ms-content-encoding", autorest.String(xMsContentEncoding)))
  1338  	}
  1339  	if len(xMsContentLanguage) > 0 {
  1340  		preparer = autorest.DecoratePreparer(preparer,
  1341  			autorest.WithHeader("x-ms-content-language", autorest.String(xMsContentLanguage)))
  1342  	}
  1343  	if len(xMsContentMd5) > 0 {
  1344  		preparer = autorest.DecoratePreparer(preparer,
  1345  			autorest.WithHeader("x-ms-content-md5", autorest.String(xMsContentMd5)))
  1346  	}
  1347  	if len(xMsProperties) > 0 {
  1348  		preparer = autorest.DecoratePreparer(preparer,
  1349  			autorest.WithHeader("x-ms-properties", autorest.String(xMsProperties)))
  1350  	}
  1351  	if len(xMsOwner) > 0 {
  1352  		preparer = autorest.DecoratePreparer(preparer,
  1353  			autorest.WithHeader("x-ms-owner", autorest.String(xMsOwner)))
  1354  	}
  1355  	if len(xMsGroup) > 0 {
  1356  		preparer = autorest.DecoratePreparer(preparer,
  1357  			autorest.WithHeader("x-ms-group", autorest.String(xMsGroup)))
  1358  	}
  1359  	if len(xMsPermissions) > 0 {
  1360  		preparer = autorest.DecoratePreparer(preparer,
  1361  			autorest.WithHeader("x-ms-permissions", autorest.String(xMsPermissions)))
  1362  	}
  1363  	if len(xMsACL) > 0 {
  1364  		preparer = autorest.DecoratePreparer(preparer,
  1365  			autorest.WithHeader("x-ms-acl", autorest.String(xMsACL)))
  1366  	}
  1367  	if len(ifMatch) > 0 {
  1368  		preparer = autorest.DecoratePreparer(preparer,
  1369  			autorest.WithHeader("If-Match", autorest.String(ifMatch)))
  1370  	}
  1371  	if len(ifNoneMatch) > 0 {
  1372  		preparer = autorest.DecoratePreparer(preparer,
  1373  			autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch)))
  1374  	}
  1375  	if len(ifModifiedSince) > 0 {
  1376  		preparer = autorest.DecoratePreparer(preparer,
  1377  			autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince)))
  1378  	}
  1379  	if len(ifUnmodifiedSince) > 0 {
  1380  		preparer = autorest.DecoratePreparer(preparer,
  1381  			autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince)))
  1382  	}
  1383  	if len(xMsClientRequestID) > 0 {
  1384  		preparer = autorest.DecoratePreparer(preparer,
  1385  			autorest.WithHeader("x-ms-client-request-id", autorest.String(xMsClientRequestID)))
  1386  	}
  1387  	if len(xMsDate) > 0 {
  1388  		preparer = autorest.DecoratePreparer(preparer,
  1389  			autorest.WithHeader("x-ms-date", autorest.String(xMsDate)))
  1390  	}
  1391  	if len(client.XMsVersion) > 0 {
  1392  		preparer = autorest.DecoratePreparer(preparer,
  1393  			autorest.WithHeader("x-ms-version", autorest.String(client.XMsVersion)))
  1394  	}
  1395  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1396  }
  1397  
  1398  // UpdateSender sends the Update request. The method will close the
  1399  // http.Response Body if it receives an error.
  1400  func (client PathClient) UpdateSender(req *http.Request) (*http.Response, error) {
  1401  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1402  }
  1403  
  1404  // UpdateResponder handles the response to the Update request. The method always
  1405  // closes the http.Response Body.
  1406  func (client PathClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) {
  1407  	err = autorest.Respond(
  1408  		resp,
  1409  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
  1410  		autorest.ByClosing())
  1411  	result.Response = resp
  1412  	return
  1413  }
  1414  

View as plain text