...

Source file src/github.com/Azure/azure-sdk-for-go/services/preview/storage/datalake/2018-06-17/storagedatalake/path.go

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

View as plain text