...

Source file src/github.com/Azure/azure-sdk-for-go/services/preview/datalake/store/2015-10-01-preview/filesystem/filesystem.go

Documentation: github.com/Azure/azure-sdk-for-go/services/preview/datalake/store/2015-10-01-preview/filesystem

     1  package filesystem
     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  // Client is the creates an Azure Data Lake Store filesystem client.
    20  type Client struct {
    21  	BaseClient
    22  }
    23  
    24  // NewClient creates an instance of the Client client.
    25  func NewClient() Client {
    26  	return Client{New()}
    27  }
    28  
    29  // Append appends to the specified file. This method does not support multiple concurrent appends to the file. NOTE:
    30  // Concurrent append and normal (serial) append CANNOT be used interchangeably. Once a file has been appended to using
    31  // either append option, it can only be appended to using that append option. Use the ConcurrentAppend option if you
    32  // would like support for concurrent appends.
    33  // Parameters:
    34  // accountName - the Azure Data Lake Store account to execute filesystem operations on.
    35  // directFilePath - the Data Lake Store path (starting with '/') of the file to which to append.
    36  // streamContents - the file contents to include when appending to the file.  The maximum content size is 4MB.
    37  // For content larger than 4MB you must append the content in 4MB chunks.
    38  // offset - the optional offset in the stream to begin the append operation. Default is to append at the end of
    39  // the stream.
    40  func (client Client) Append(ctx context.Context, accountName string, directFilePath string, streamContents io.ReadCloser, offset *int64) (result autorest.Response, err error) {
    41  	if tracing.IsEnabled() {
    42  		ctx = tracing.StartSpan(ctx, fqdn+"/Client.Append")
    43  		defer func() {
    44  			sc := -1
    45  			if result.Response != nil {
    46  				sc = result.Response.StatusCode
    47  			}
    48  			tracing.EndSpan(ctx, sc, err)
    49  		}()
    50  	}
    51  	req, err := client.AppendPreparer(ctx, accountName, directFilePath, streamContents, offset)
    52  	if err != nil {
    53  		err = autorest.NewErrorWithError(err, "filesystem.Client", "Append", nil, "Failure preparing request")
    54  		return
    55  	}
    56  
    57  	resp, err := client.AppendSender(req)
    58  	if err != nil {
    59  		result.Response = resp
    60  		err = autorest.NewErrorWithError(err, "filesystem.Client", "Append", resp, "Failure sending request")
    61  		return
    62  	}
    63  
    64  	result, err = client.AppendResponder(resp)
    65  	if err != nil {
    66  		err = autorest.NewErrorWithError(err, "filesystem.Client", "Append", resp, "Failure responding to request")
    67  		return
    68  	}
    69  
    70  	return
    71  }
    72  
    73  // AppendPreparer prepares the Append request.
    74  func (client Client) AppendPreparer(ctx context.Context, accountName string, directFilePath string, streamContents io.ReadCloser, offset *int64) (*http.Request, error) {
    75  	urlParameters := map[string]interface{}{
    76  		"accountName":             accountName,
    77  		"adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix,
    78  	}
    79  
    80  	pathParameters := map[string]interface{}{
    81  		"directFilePath": autorest.Encode("path", directFilePath),
    82  	}
    83  
    84  	const APIVersion = "2015-10-01-preview"
    85  	queryParameters := map[string]interface{}{
    86  		"api-version": APIVersion,
    87  		"append":      autorest.Encode("query", "true"),
    88  		"op":          autorest.Encode("query", "APPEND"),
    89  	}
    90  	if offset != nil {
    91  		queryParameters["offset"] = autorest.Encode("query", *offset)
    92  	}
    93  
    94  	preparer := autorest.CreatePreparer(
    95  		autorest.AsContentType("application/octet-stream"),
    96  		autorest.AsPost(),
    97  		autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters),
    98  		autorest.WithPathParameters("/webhdfs/v1/{directFilePath}", pathParameters),
    99  		autorest.WithFile(streamContents),
   100  		autorest.WithQueryParameters(queryParameters))
   101  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   102  }
   103  
   104  // AppendSender sends the Append request. The method will close the
   105  // http.Response Body if it receives an error.
   106  func (client Client) AppendSender(req *http.Request) (*http.Response, error) {
   107  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   108  }
   109  
   110  // AppendResponder handles the response to the Append request. The method always
   111  // closes the http.Response Body.
   112  func (client Client) AppendResponder(resp *http.Response) (result autorest.Response, err error) {
   113  	err = autorest.Respond(
   114  		resp,
   115  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   116  		autorest.ByClosing())
   117  	result.Response = resp
   118  	return
   119  }
   120  
   121  // CheckAccess checks if the specified access is available at the given path.
   122  // Parameters:
   123  // accountName - the Azure Data Lake Store account to execute filesystem operations on.
   124  // pathParameter - the Data Lake Store path (starting with '/') of the file or directory for which to check
   125  // access.
   126  // fsaction - file system operation read/write/execute in string form, matching regex pattern '[rwx-]{3}'
   127  func (client Client) CheckAccess(ctx context.Context, accountName string, pathParameter string, fsaction string) (result autorest.Response, err error) {
   128  	if tracing.IsEnabled() {
   129  		ctx = tracing.StartSpan(ctx, fqdn+"/Client.CheckAccess")
   130  		defer func() {
   131  			sc := -1
   132  			if result.Response != nil {
   133  				sc = result.Response.StatusCode
   134  			}
   135  			tracing.EndSpan(ctx, sc, err)
   136  		}()
   137  	}
   138  	req, err := client.CheckAccessPreparer(ctx, accountName, pathParameter, fsaction)
   139  	if err != nil {
   140  		err = autorest.NewErrorWithError(err, "filesystem.Client", "CheckAccess", nil, "Failure preparing request")
   141  		return
   142  	}
   143  
   144  	resp, err := client.CheckAccessSender(req)
   145  	if err != nil {
   146  		result.Response = resp
   147  		err = autorest.NewErrorWithError(err, "filesystem.Client", "CheckAccess", resp, "Failure sending request")
   148  		return
   149  	}
   150  
   151  	result, err = client.CheckAccessResponder(resp)
   152  	if err != nil {
   153  		err = autorest.NewErrorWithError(err, "filesystem.Client", "CheckAccess", resp, "Failure responding to request")
   154  		return
   155  	}
   156  
   157  	return
   158  }
   159  
   160  // CheckAccessPreparer prepares the CheckAccess request.
   161  func (client Client) CheckAccessPreparer(ctx context.Context, accountName string, pathParameter string, fsaction string) (*http.Request, error) {
   162  	urlParameters := map[string]interface{}{
   163  		"accountName":             accountName,
   164  		"adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix,
   165  	}
   166  
   167  	pathParameters := map[string]interface{}{
   168  		"path": autorest.Encode("path", pathParameter),
   169  	}
   170  
   171  	const APIVersion = "2015-10-01-preview"
   172  	queryParameters := map[string]interface{}{
   173  		"api-version": APIVersion,
   174  		"op":          autorest.Encode("query", "CHECKACCESS"),
   175  	}
   176  	if len(fsaction) > 0 {
   177  		queryParameters["fsaction"] = autorest.Encode("query", fsaction)
   178  	}
   179  
   180  	preparer := autorest.CreatePreparer(
   181  		autorest.AsGet(),
   182  		autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters),
   183  		autorest.WithPathParameters("/webhdfs/v1/{path}", pathParameters),
   184  		autorest.WithQueryParameters(queryParameters))
   185  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   186  }
   187  
   188  // CheckAccessSender sends the CheckAccess request. The method will close the
   189  // http.Response Body if it receives an error.
   190  func (client Client) CheckAccessSender(req *http.Request) (*http.Response, error) {
   191  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   192  }
   193  
   194  // CheckAccessResponder handles the response to the CheckAccess request. The method always
   195  // closes the http.Response Body.
   196  func (client Client) CheckAccessResponder(resp *http.Response) (result autorest.Response, err error) {
   197  	err = autorest.Respond(
   198  		resp,
   199  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   200  		autorest.ByClosing())
   201  	result.Response = resp
   202  	return
   203  }
   204  
   205  // Concat concatenates the list of source files into the destination file, removing all source files upon success.
   206  // This operation has been deprecated, please use operation FileSystem_MsConcat instead.
   207  // Parameters:
   208  // accountName - the Azure Data Lake Store account to execute filesystem operations on.
   209  // destinationPath - the Data Lake Store path (starting with '/') of the destination file resulting from the
   210  // concatenation.
   211  // sources - a list of comma separated Data Lake Store paths (starting with '/') of the files to concatenate,
   212  // in the order in which they should be concatenated.
   213  func (client Client) Concat(ctx context.Context, accountName string, destinationPath string, sources []string) (result autorest.Response, err error) {
   214  	if tracing.IsEnabled() {
   215  		ctx = tracing.StartSpan(ctx, fqdn+"/Client.Concat")
   216  		defer func() {
   217  			sc := -1
   218  			if result.Response != nil {
   219  				sc = result.Response.StatusCode
   220  			}
   221  			tracing.EndSpan(ctx, sc, err)
   222  		}()
   223  	}
   224  	if err := validation.Validate([]validation.Validation{
   225  		{TargetValue: sources,
   226  			Constraints: []validation.Constraint{{Target: "sources", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
   227  		return result, validation.NewError("filesystem.Client", "Concat", err.Error())
   228  	}
   229  
   230  	req, err := client.ConcatPreparer(ctx, accountName, destinationPath, sources)
   231  	if err != nil {
   232  		err = autorest.NewErrorWithError(err, "filesystem.Client", "Concat", nil, "Failure preparing request")
   233  		return
   234  	}
   235  
   236  	resp, err := client.ConcatSender(req)
   237  	if err != nil {
   238  		result.Response = resp
   239  		err = autorest.NewErrorWithError(err, "filesystem.Client", "Concat", resp, "Failure sending request")
   240  		return
   241  	}
   242  
   243  	result, err = client.ConcatResponder(resp)
   244  	if err != nil {
   245  		err = autorest.NewErrorWithError(err, "filesystem.Client", "Concat", resp, "Failure responding to request")
   246  		return
   247  	}
   248  
   249  	return
   250  }
   251  
   252  // ConcatPreparer prepares the Concat request.
   253  func (client Client) ConcatPreparer(ctx context.Context, accountName string, destinationPath string, sources []string) (*http.Request, error) {
   254  	urlParameters := map[string]interface{}{
   255  		"accountName":             accountName,
   256  		"adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix,
   257  	}
   258  
   259  	pathParameters := map[string]interface{}{
   260  		"destinationPath": autorest.Encode("path", destinationPath),
   261  	}
   262  
   263  	const APIVersion = "2015-10-01-preview"
   264  	queryParameters := map[string]interface{}{
   265  		"api-version": APIVersion,
   266  		"op":          autorest.Encode("query", "CONCAT"),
   267  		"sources":     autorest.Encode("query", sources, ","),
   268  	}
   269  
   270  	preparer := autorest.CreatePreparer(
   271  		autorest.AsPost(),
   272  		autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters),
   273  		autorest.WithPathParameters("/webhdfs/v1/{destinationPath}", pathParameters),
   274  		autorest.WithQueryParameters(queryParameters))
   275  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   276  }
   277  
   278  // ConcatSender sends the Concat request. The method will close the
   279  // http.Response Body if it receives an error.
   280  func (client Client) ConcatSender(req *http.Request) (*http.Response, error) {
   281  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   282  }
   283  
   284  // ConcatResponder handles the response to the Concat request. The method always
   285  // closes the http.Response Body.
   286  func (client Client) ConcatResponder(resp *http.Response) (result autorest.Response, err error) {
   287  	err = autorest.Respond(
   288  		resp,
   289  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   290  		autorest.ByClosing())
   291  	result.Response = resp
   292  	return
   293  }
   294  
   295  // ConcurrentAppend appends to the specified file. This method supports multiple concurrent appends to the file. NOTE:
   296  // ConcurrentAppend and normal (serial) Append CANNOT be used interchangeably; once a file has been appended to using
   297  // either of these append options, it can only be appended to using that append option. ConcurrentAppend DOES NOT
   298  // guarantee order and can result in duplicated data landing in the target file. In order to close a file after using
   299  // ConcurrentAppend, call the Flush method.
   300  // Parameters:
   301  // accountName - the Azure Data Lake Store account to execute filesystem operations on.
   302  // filePath - the Data Lake Store path (starting with '/') of the file to which to append using concurrent
   303  // append.
   304  // streamContents - the file contents to include when appending to the file.  The maximum content size is 4MB.
   305  // For content larger than 4MB you must append the content in 4MB chunks.
   306  // appendMode - indicates the concurrent append call should create the file if it doesn't exist or just open
   307  // the existing file for append
   308  func (client Client) ConcurrentAppend(ctx context.Context, accountName string, filePath string, streamContents io.ReadCloser, appendMode AppendModeType) (result autorest.Response, err error) {
   309  	if tracing.IsEnabled() {
   310  		ctx = tracing.StartSpan(ctx, fqdn+"/Client.ConcurrentAppend")
   311  		defer func() {
   312  			sc := -1
   313  			if result.Response != nil {
   314  				sc = result.Response.StatusCode
   315  			}
   316  			tracing.EndSpan(ctx, sc, err)
   317  		}()
   318  	}
   319  	req, err := client.ConcurrentAppendPreparer(ctx, accountName, filePath, streamContents, appendMode)
   320  	if err != nil {
   321  		err = autorest.NewErrorWithError(err, "filesystem.Client", "ConcurrentAppend", nil, "Failure preparing request")
   322  		return
   323  	}
   324  
   325  	resp, err := client.ConcurrentAppendSender(req)
   326  	if err != nil {
   327  		result.Response = resp
   328  		err = autorest.NewErrorWithError(err, "filesystem.Client", "ConcurrentAppend", resp, "Failure sending request")
   329  		return
   330  	}
   331  
   332  	result, err = client.ConcurrentAppendResponder(resp)
   333  	if err != nil {
   334  		err = autorest.NewErrorWithError(err, "filesystem.Client", "ConcurrentAppend", resp, "Failure responding to request")
   335  		return
   336  	}
   337  
   338  	return
   339  }
   340  
   341  // ConcurrentAppendPreparer prepares the ConcurrentAppend request.
   342  func (client Client) ConcurrentAppendPreparer(ctx context.Context, accountName string, filePath string, streamContents io.ReadCloser, appendMode AppendModeType) (*http.Request, error) {
   343  	urlParameters := map[string]interface{}{
   344  		"accountName":             accountName,
   345  		"adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix,
   346  	}
   347  
   348  	pathParameters := map[string]interface{}{
   349  		"filePath": autorest.Encode("path", filePath),
   350  	}
   351  
   352  	const APIVersion = "2015-10-01-preview"
   353  	queryParameters := map[string]interface{}{
   354  		"api-version": APIVersion,
   355  		"op":          autorest.Encode("query", "CONCURRENTAPPEND"),
   356  	}
   357  	if len(string(appendMode)) > 0 {
   358  		queryParameters["appendMode"] = autorest.Encode("query", appendMode)
   359  	}
   360  
   361  	preparer := autorest.CreatePreparer(
   362  		autorest.AsContentType("application/octet-stream"),
   363  		autorest.AsPost(),
   364  		autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters),
   365  		autorest.WithPathParameters("/WebHdfsExt/{filePath}", pathParameters),
   366  		autorest.WithFile(streamContents),
   367  		autorest.WithQueryParameters(queryParameters),
   368  		autorest.WithHeader("Transfer-Encoding", "chunked"))
   369  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   370  }
   371  
   372  // ConcurrentAppendSender sends the ConcurrentAppend request. The method will close the
   373  // http.Response Body if it receives an error.
   374  func (client Client) ConcurrentAppendSender(req *http.Request) (*http.Response, error) {
   375  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   376  }
   377  
   378  // ConcurrentAppendResponder handles the response to the ConcurrentAppend request. The method always
   379  // closes the http.Response Body.
   380  func (client Client) ConcurrentAppendResponder(resp *http.Response) (result autorest.Response, err error) {
   381  	err = autorest.Respond(
   382  		resp,
   383  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   384  		autorest.ByClosing())
   385  	result.Response = resp
   386  	return
   387  }
   388  
   389  // Create creates a file with optionally specified content.
   390  // Parameters:
   391  // accountName - the Azure Data Lake Store account to execute filesystem operations on.
   392  // directFilePath - the Data Lake Store path (starting with '/') of the file to create.
   393  // streamContents - the file contents to include when creating the file. This parameter is optional, resulting
   394  // in an empty file if not specified.  The maximum content size is 4MB.  For content larger than 4MB you must
   395  // append the content in 4MB chunks.
   396  // overwrite - the indication of if the file should be overwritten.
   397  func (client Client) Create(ctx context.Context, accountName string, directFilePath string, streamContents io.ReadCloser, overwrite *bool) (result autorest.Response, err error) {
   398  	if tracing.IsEnabled() {
   399  		ctx = tracing.StartSpan(ctx, fqdn+"/Client.Create")
   400  		defer func() {
   401  			sc := -1
   402  			if result.Response != nil {
   403  				sc = result.Response.StatusCode
   404  			}
   405  			tracing.EndSpan(ctx, sc, err)
   406  		}()
   407  	}
   408  	req, err := client.CreatePreparer(ctx, accountName, directFilePath, streamContents, overwrite)
   409  	if err != nil {
   410  		err = autorest.NewErrorWithError(err, "filesystem.Client", "Create", nil, "Failure preparing request")
   411  		return
   412  	}
   413  
   414  	resp, err := client.CreateSender(req)
   415  	if err != nil {
   416  		result.Response = resp
   417  		err = autorest.NewErrorWithError(err, "filesystem.Client", "Create", resp, "Failure sending request")
   418  		return
   419  	}
   420  
   421  	result, err = client.CreateResponder(resp)
   422  	if err != nil {
   423  		err = autorest.NewErrorWithError(err, "filesystem.Client", "Create", resp, "Failure responding to request")
   424  		return
   425  	}
   426  
   427  	return
   428  }
   429  
   430  // CreatePreparer prepares the Create request.
   431  func (client Client) CreatePreparer(ctx context.Context, accountName string, directFilePath string, streamContents io.ReadCloser, overwrite *bool) (*http.Request, error) {
   432  	urlParameters := map[string]interface{}{
   433  		"accountName":             accountName,
   434  		"adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix,
   435  	}
   436  
   437  	pathParameters := map[string]interface{}{
   438  		"directFilePath": autorest.Encode("path", directFilePath),
   439  	}
   440  
   441  	const APIVersion = "2015-10-01-preview"
   442  	queryParameters := map[string]interface{}{
   443  		"api-version": APIVersion,
   444  		"op":          autorest.Encode("query", "CREATE"),
   445  		"write":       autorest.Encode("query", "true"),
   446  	}
   447  	if overwrite != nil {
   448  		queryParameters["overwrite"] = autorest.Encode("query", *overwrite)
   449  	}
   450  
   451  	preparer := autorest.CreatePreparer(
   452  		autorest.AsContentType("application/octet-stream"),
   453  		autorest.AsPut(),
   454  		autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters),
   455  		autorest.WithPathParameters("/webhdfs/v1/{directFilePath}", pathParameters),
   456  		autorest.WithQueryParameters(queryParameters))
   457  	if streamContents != nil {
   458  		preparer = autorest.DecoratePreparer(preparer,
   459  			autorest.WithFile(streamContents))
   460  	}
   461  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   462  }
   463  
   464  // CreateSender sends the Create request. The method will close the
   465  // http.Response Body if it receives an error.
   466  func (client Client) CreateSender(req *http.Request) (*http.Response, error) {
   467  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   468  }
   469  
   470  // CreateResponder handles the response to the Create request. The method always
   471  // closes the http.Response Body.
   472  func (client Client) CreateResponder(resp *http.Response) (result autorest.Response, err error) {
   473  	err = autorest.Respond(
   474  		resp,
   475  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
   476  		autorest.ByClosing())
   477  	result.Response = resp
   478  	return
   479  }
   480  
   481  // Delete deletes the requested file or directory, optionally recursively.
   482  // Parameters:
   483  // accountName - the Azure Data Lake Store account to execute filesystem operations on.
   484  // filePath - the Data Lake Store path (starting with '/') of the file or directory to delete.
   485  // recursive - the optional switch indicating if the delete should be recursive
   486  func (client Client) Delete(ctx context.Context, accountName string, filePath string, recursive *bool) (result FileOperationResult, err error) {
   487  	if tracing.IsEnabled() {
   488  		ctx = tracing.StartSpan(ctx, fqdn+"/Client.Delete")
   489  		defer func() {
   490  			sc := -1
   491  			if result.Response.Response != nil {
   492  				sc = result.Response.Response.StatusCode
   493  			}
   494  			tracing.EndSpan(ctx, sc, err)
   495  		}()
   496  	}
   497  	req, err := client.DeletePreparer(ctx, accountName, filePath, recursive)
   498  	if err != nil {
   499  		err = autorest.NewErrorWithError(err, "filesystem.Client", "Delete", nil, "Failure preparing request")
   500  		return
   501  	}
   502  
   503  	resp, err := client.DeleteSender(req)
   504  	if err != nil {
   505  		result.Response = autorest.Response{Response: resp}
   506  		err = autorest.NewErrorWithError(err, "filesystem.Client", "Delete", resp, "Failure sending request")
   507  		return
   508  	}
   509  
   510  	result, err = client.DeleteResponder(resp)
   511  	if err != nil {
   512  		err = autorest.NewErrorWithError(err, "filesystem.Client", "Delete", resp, "Failure responding to request")
   513  		return
   514  	}
   515  
   516  	return
   517  }
   518  
   519  // DeletePreparer prepares the Delete request.
   520  func (client Client) DeletePreparer(ctx context.Context, accountName string, filePath string, recursive *bool) (*http.Request, error) {
   521  	urlParameters := map[string]interface{}{
   522  		"accountName":             accountName,
   523  		"adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix,
   524  	}
   525  
   526  	pathParameters := map[string]interface{}{
   527  		"filePath": autorest.Encode("path", filePath),
   528  	}
   529  
   530  	const APIVersion = "2015-10-01-preview"
   531  	queryParameters := map[string]interface{}{
   532  		"api-version": APIVersion,
   533  		"op":          autorest.Encode("query", "DELETE"),
   534  	}
   535  	if recursive != nil {
   536  		queryParameters["recursive"] = autorest.Encode("query", *recursive)
   537  	}
   538  
   539  	preparer := autorest.CreatePreparer(
   540  		autorest.AsDelete(),
   541  		autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters),
   542  		autorest.WithPathParameters("/webhdfs/v1/{filePath}", pathParameters),
   543  		autorest.WithQueryParameters(queryParameters))
   544  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   545  }
   546  
   547  // DeleteSender sends the Delete request. The method will close the
   548  // http.Response Body if it receives an error.
   549  func (client Client) DeleteSender(req *http.Request) (*http.Response, error) {
   550  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   551  }
   552  
   553  // DeleteResponder handles the response to the Delete request. The method always
   554  // closes the http.Response Body.
   555  func (client Client) DeleteResponder(resp *http.Response) (result FileOperationResult, err error) {
   556  	err = autorest.Respond(
   557  		resp,
   558  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   559  		autorest.ByUnmarshallingJSON(&result),
   560  		autorest.ByClosing())
   561  	result.Response = autorest.Response{Response: resp}
   562  	return
   563  }
   564  
   565  // Flush flushes the specified file to the store. This forces an update to the metadata of the file (returned from
   566  // GetFileStatus), and is required by ConcurrentAppend once the file is done to populate finalized metadata.
   567  // Parameters:
   568  // accountName - the Azure Data Lake Store account to execute filesystem operations on.
   569  // flushFilePath - the Data Lake Store path (starting with '/') of the file to which to flush.
   570  func (client Client) Flush(ctx context.Context, accountName string, flushFilePath string) (result autorest.Response, err error) {
   571  	if tracing.IsEnabled() {
   572  		ctx = tracing.StartSpan(ctx, fqdn+"/Client.Flush")
   573  		defer func() {
   574  			sc := -1
   575  			if result.Response != nil {
   576  				sc = result.Response.StatusCode
   577  			}
   578  			tracing.EndSpan(ctx, sc, err)
   579  		}()
   580  	}
   581  	req, err := client.FlushPreparer(ctx, accountName, flushFilePath)
   582  	if err != nil {
   583  		err = autorest.NewErrorWithError(err, "filesystem.Client", "Flush", nil, "Failure preparing request")
   584  		return
   585  	}
   586  
   587  	resp, err := client.FlushSender(req)
   588  	if err != nil {
   589  		result.Response = resp
   590  		err = autorest.NewErrorWithError(err, "filesystem.Client", "Flush", resp, "Failure sending request")
   591  		return
   592  	}
   593  
   594  	result, err = client.FlushResponder(resp)
   595  	if err != nil {
   596  		err = autorest.NewErrorWithError(err, "filesystem.Client", "Flush", resp, "Failure responding to request")
   597  		return
   598  	}
   599  
   600  	return
   601  }
   602  
   603  // FlushPreparer prepares the Flush request.
   604  func (client Client) FlushPreparer(ctx context.Context, accountName string, flushFilePath string) (*http.Request, error) {
   605  	urlParameters := map[string]interface{}{
   606  		"accountName":             accountName,
   607  		"adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix,
   608  	}
   609  
   610  	pathParameters := map[string]interface{}{
   611  		"flushFilePath": autorest.Encode("path", flushFilePath),
   612  	}
   613  
   614  	const APIVersion = "2015-10-01-preview"
   615  	queryParameters := map[string]interface{}{
   616  		"api-version": APIVersion,
   617  		"append":      autorest.Encode("query", "true"),
   618  		"flush":       autorest.Encode("query", "true"),
   619  		"op":          autorest.Encode("query", "APPEND"),
   620  	}
   621  
   622  	preparer := autorest.CreatePreparer(
   623  		autorest.AsPost(),
   624  		autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters),
   625  		autorest.WithPathParameters("/webhdfs/v1/{flushFilePath}", pathParameters),
   626  		autorest.WithQueryParameters(queryParameters))
   627  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   628  }
   629  
   630  // FlushSender sends the Flush request. The method will close the
   631  // http.Response Body if it receives an error.
   632  func (client Client) FlushSender(req *http.Request) (*http.Response, error) {
   633  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   634  }
   635  
   636  // FlushResponder handles the response to the Flush request. The method always
   637  // closes the http.Response Body.
   638  func (client Client) FlushResponder(resp *http.Response) (result autorest.Response, err error) {
   639  	err = autorest.Respond(
   640  		resp,
   641  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   642  		autorest.ByClosing())
   643  	result.Response = resp
   644  	return
   645  }
   646  
   647  // GetACLStatus gets Access Control List (ACL) entries for the specified file or directory.
   648  // Parameters:
   649  // accountName - the Azure Data Lake Store account to execute filesystem operations on.
   650  // ACLFilePath - the Data Lake Store path (starting with '/') of the file or directory for which to get the
   651  // ACL.
   652  func (client Client) GetACLStatus(ctx context.Context, accountName string, ACLFilePath string) (result ACLStatusResult, err error) {
   653  	if tracing.IsEnabled() {
   654  		ctx = tracing.StartSpan(ctx, fqdn+"/Client.GetACLStatus")
   655  		defer func() {
   656  			sc := -1
   657  			if result.Response.Response != nil {
   658  				sc = result.Response.Response.StatusCode
   659  			}
   660  			tracing.EndSpan(ctx, sc, err)
   661  		}()
   662  	}
   663  	req, err := client.GetACLStatusPreparer(ctx, accountName, ACLFilePath)
   664  	if err != nil {
   665  		err = autorest.NewErrorWithError(err, "filesystem.Client", "GetACLStatus", nil, "Failure preparing request")
   666  		return
   667  	}
   668  
   669  	resp, err := client.GetACLStatusSender(req)
   670  	if err != nil {
   671  		result.Response = autorest.Response{Response: resp}
   672  		err = autorest.NewErrorWithError(err, "filesystem.Client", "GetACLStatus", resp, "Failure sending request")
   673  		return
   674  	}
   675  
   676  	result, err = client.GetACLStatusResponder(resp)
   677  	if err != nil {
   678  		err = autorest.NewErrorWithError(err, "filesystem.Client", "GetACLStatus", resp, "Failure responding to request")
   679  		return
   680  	}
   681  
   682  	return
   683  }
   684  
   685  // GetACLStatusPreparer prepares the GetACLStatus request.
   686  func (client Client) GetACLStatusPreparer(ctx context.Context, accountName string, ACLFilePath string) (*http.Request, error) {
   687  	urlParameters := map[string]interface{}{
   688  		"accountName":             accountName,
   689  		"adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix,
   690  	}
   691  
   692  	pathParameters := map[string]interface{}{
   693  		"aclFilePath": autorest.Encode("path", ACLFilePath),
   694  	}
   695  
   696  	const APIVersion = "2015-10-01-preview"
   697  	queryParameters := map[string]interface{}{
   698  		"api-version": APIVersion,
   699  		"op":          autorest.Encode("query", "MSGETACLSTATUS"),
   700  	}
   701  
   702  	preparer := autorest.CreatePreparer(
   703  		autorest.AsGet(),
   704  		autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters),
   705  		autorest.WithPathParameters("/webhdfs/v1/{aclFilePath}", pathParameters),
   706  		autorest.WithQueryParameters(queryParameters))
   707  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   708  }
   709  
   710  // GetACLStatusSender sends the GetACLStatus request. The method will close the
   711  // http.Response Body if it receives an error.
   712  func (client Client) GetACLStatusSender(req *http.Request) (*http.Response, error) {
   713  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   714  }
   715  
   716  // GetACLStatusResponder handles the response to the GetACLStatus request. The method always
   717  // closes the http.Response Body.
   718  func (client Client) GetACLStatusResponder(resp *http.Response) (result ACLStatusResult, err error) {
   719  	err = autorest.Respond(
   720  		resp,
   721  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   722  		autorest.ByUnmarshallingJSON(&result),
   723  		autorest.ByClosing())
   724  	result.Response = autorest.Response{Response: resp}
   725  	return
   726  }
   727  
   728  // GetContentSummary gets the file content summary object specified by the file path.
   729  // Parameters:
   730  // accountName - the Azure Data Lake Store account to execute filesystem operations on.
   731  // getContentSummaryFilePath - the Data Lake Store path (starting with '/') of the file for which to retrieve
   732  // the summary.
   733  func (client Client) GetContentSummary(ctx context.Context, accountName string, getContentSummaryFilePath string) (result ContentSummaryResult, err error) {
   734  	if tracing.IsEnabled() {
   735  		ctx = tracing.StartSpan(ctx, fqdn+"/Client.GetContentSummary")
   736  		defer func() {
   737  			sc := -1
   738  			if result.Response.Response != nil {
   739  				sc = result.Response.Response.StatusCode
   740  			}
   741  			tracing.EndSpan(ctx, sc, err)
   742  		}()
   743  	}
   744  	req, err := client.GetContentSummaryPreparer(ctx, accountName, getContentSummaryFilePath)
   745  	if err != nil {
   746  		err = autorest.NewErrorWithError(err, "filesystem.Client", "GetContentSummary", nil, "Failure preparing request")
   747  		return
   748  	}
   749  
   750  	resp, err := client.GetContentSummarySender(req)
   751  	if err != nil {
   752  		result.Response = autorest.Response{Response: resp}
   753  		err = autorest.NewErrorWithError(err, "filesystem.Client", "GetContentSummary", resp, "Failure sending request")
   754  		return
   755  	}
   756  
   757  	result, err = client.GetContentSummaryResponder(resp)
   758  	if err != nil {
   759  		err = autorest.NewErrorWithError(err, "filesystem.Client", "GetContentSummary", resp, "Failure responding to request")
   760  		return
   761  	}
   762  
   763  	return
   764  }
   765  
   766  // GetContentSummaryPreparer prepares the GetContentSummary request.
   767  func (client Client) GetContentSummaryPreparer(ctx context.Context, accountName string, getContentSummaryFilePath string) (*http.Request, error) {
   768  	urlParameters := map[string]interface{}{
   769  		"accountName":             accountName,
   770  		"adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix,
   771  	}
   772  
   773  	pathParameters := map[string]interface{}{
   774  		"getContentSummaryFilePath": autorest.Encode("path", getContentSummaryFilePath),
   775  	}
   776  
   777  	const APIVersion = "2015-10-01-preview"
   778  	queryParameters := map[string]interface{}{
   779  		"api-version": APIVersion,
   780  		"op":          autorest.Encode("query", "GETCONTENTSUMMARY"),
   781  	}
   782  
   783  	preparer := autorest.CreatePreparer(
   784  		autorest.AsGet(),
   785  		autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters),
   786  		autorest.WithPathParameters("/webhdfs/va/{getContentSummaryFilePath}", pathParameters),
   787  		autorest.WithQueryParameters(queryParameters))
   788  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   789  }
   790  
   791  // GetContentSummarySender sends the GetContentSummary request. The method will close the
   792  // http.Response Body if it receives an error.
   793  func (client Client) GetContentSummarySender(req *http.Request) (*http.Response, error) {
   794  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   795  }
   796  
   797  // GetContentSummaryResponder handles the response to the GetContentSummary request. The method always
   798  // closes the http.Response Body.
   799  func (client Client) GetContentSummaryResponder(resp *http.Response) (result ContentSummaryResult, err error) {
   800  	err = autorest.Respond(
   801  		resp,
   802  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   803  		autorest.ByUnmarshallingJSON(&result),
   804  		autorest.ByClosing())
   805  	result.Response = autorest.Response{Response: resp}
   806  	return
   807  }
   808  
   809  // GetFileStatus get the file status object specified by the file path.
   810  // Parameters:
   811  // accountName - the Azure Data Lake Store account to execute filesystem operations on.
   812  // getFilePath - the Data Lake Store path (starting with '/') of the file or directory for which to retrieve
   813  // the status.
   814  func (client Client) GetFileStatus(ctx context.Context, accountName string, getFilePath string) (result FileStatusResult, err error) {
   815  	if tracing.IsEnabled() {
   816  		ctx = tracing.StartSpan(ctx, fqdn+"/Client.GetFileStatus")
   817  		defer func() {
   818  			sc := -1
   819  			if result.Response.Response != nil {
   820  				sc = result.Response.Response.StatusCode
   821  			}
   822  			tracing.EndSpan(ctx, sc, err)
   823  		}()
   824  	}
   825  	req, err := client.GetFileStatusPreparer(ctx, accountName, getFilePath)
   826  	if err != nil {
   827  		err = autorest.NewErrorWithError(err, "filesystem.Client", "GetFileStatus", nil, "Failure preparing request")
   828  		return
   829  	}
   830  
   831  	resp, err := client.GetFileStatusSender(req)
   832  	if err != nil {
   833  		result.Response = autorest.Response{Response: resp}
   834  		err = autorest.NewErrorWithError(err, "filesystem.Client", "GetFileStatus", resp, "Failure sending request")
   835  		return
   836  	}
   837  
   838  	result, err = client.GetFileStatusResponder(resp)
   839  	if err != nil {
   840  		err = autorest.NewErrorWithError(err, "filesystem.Client", "GetFileStatus", resp, "Failure responding to request")
   841  		return
   842  	}
   843  
   844  	return
   845  }
   846  
   847  // GetFileStatusPreparer prepares the GetFileStatus request.
   848  func (client Client) GetFileStatusPreparer(ctx context.Context, accountName string, getFilePath string) (*http.Request, error) {
   849  	urlParameters := map[string]interface{}{
   850  		"accountName":             accountName,
   851  		"adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix,
   852  	}
   853  
   854  	pathParameters := map[string]interface{}{
   855  		"getFilePath": autorest.Encode("path", getFilePath),
   856  	}
   857  
   858  	const APIVersion = "2015-10-01-preview"
   859  	queryParameters := map[string]interface{}{
   860  		"api-version": APIVersion,
   861  		"op":          autorest.Encode("query", "MSGETFILESTATUS"),
   862  	}
   863  
   864  	preparer := autorest.CreatePreparer(
   865  		autorest.AsGet(),
   866  		autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters),
   867  		autorest.WithPathParameters("/webhdfs/v1/{getFilePath}", pathParameters),
   868  		autorest.WithQueryParameters(queryParameters))
   869  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   870  }
   871  
   872  // GetFileStatusSender sends the GetFileStatus request. The method will close the
   873  // http.Response Body if it receives an error.
   874  func (client Client) GetFileStatusSender(req *http.Request) (*http.Response, error) {
   875  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   876  }
   877  
   878  // GetFileStatusResponder handles the response to the GetFileStatus request. The method always
   879  // closes the http.Response Body.
   880  func (client Client) GetFileStatusResponder(resp *http.Response) (result FileStatusResult, err error) {
   881  	err = autorest.Respond(
   882  		resp,
   883  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   884  		autorest.ByUnmarshallingJSON(&result),
   885  		autorest.ByClosing())
   886  	result.Response = autorest.Response{Response: resp}
   887  	return
   888  }
   889  
   890  // ListFileStatus get the list of file status objects specified by the file path, with optional pagination parameters
   891  // Parameters:
   892  // accountName - the Azure Data Lake Store account to execute filesystem operations on.
   893  // listFilePath - the Data Lake Store path (starting with '/') of the directory to list.
   894  // listSize - gets or sets the number of items to return. Optional.
   895  // listAfter - gets or sets the item or lexicographical index after which to begin returning results. For
   896  // example, a file list of 'a','b','d' and listAfter='b' will return 'd', and a listAfter='c' will also return
   897  // 'd'. Optional.
   898  // listBefore - gets or sets the item or lexicographical index before which to begin returning results. For
   899  // example, a file list of 'a','b','d' and listBefore='d' will return 'a','b', and a listBefore='c' will also
   900  // return 'a','b'. Optional.
   901  func (client Client) ListFileStatus(ctx context.Context, accountName string, listFilePath string, listSize *int32, listAfter string, listBefore string) (result FileStatusesResult, err error) {
   902  	if tracing.IsEnabled() {
   903  		ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListFileStatus")
   904  		defer func() {
   905  			sc := -1
   906  			if result.Response.Response != nil {
   907  				sc = result.Response.Response.StatusCode
   908  			}
   909  			tracing.EndSpan(ctx, sc, err)
   910  		}()
   911  	}
   912  	req, err := client.ListFileStatusPreparer(ctx, accountName, listFilePath, listSize, listAfter, listBefore)
   913  	if err != nil {
   914  		err = autorest.NewErrorWithError(err, "filesystem.Client", "ListFileStatus", nil, "Failure preparing request")
   915  		return
   916  	}
   917  
   918  	resp, err := client.ListFileStatusSender(req)
   919  	if err != nil {
   920  		result.Response = autorest.Response{Response: resp}
   921  		err = autorest.NewErrorWithError(err, "filesystem.Client", "ListFileStatus", resp, "Failure sending request")
   922  		return
   923  	}
   924  
   925  	result, err = client.ListFileStatusResponder(resp)
   926  	if err != nil {
   927  		err = autorest.NewErrorWithError(err, "filesystem.Client", "ListFileStatus", resp, "Failure responding to request")
   928  		return
   929  	}
   930  
   931  	return
   932  }
   933  
   934  // ListFileStatusPreparer prepares the ListFileStatus request.
   935  func (client Client) ListFileStatusPreparer(ctx context.Context, accountName string, listFilePath string, listSize *int32, listAfter string, listBefore string) (*http.Request, error) {
   936  	urlParameters := map[string]interface{}{
   937  		"accountName":             accountName,
   938  		"adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix,
   939  	}
   940  
   941  	pathParameters := map[string]interface{}{
   942  		"listFilePath": autorest.Encode("path", listFilePath),
   943  	}
   944  
   945  	const APIVersion = "2015-10-01-preview"
   946  	queryParameters := map[string]interface{}{
   947  		"api-version": APIVersion,
   948  		"op":          autorest.Encode("query", "MSLISTSTATUS"),
   949  	}
   950  	if listSize != nil {
   951  		queryParameters["listSize"] = autorest.Encode("query", *listSize)
   952  	}
   953  	if len(listAfter) > 0 {
   954  		queryParameters["listAfter"] = autorest.Encode("query", listAfter)
   955  	}
   956  	if len(listBefore) > 0 {
   957  		queryParameters["listBefore"] = autorest.Encode("query", listBefore)
   958  	}
   959  
   960  	preparer := autorest.CreatePreparer(
   961  		autorest.AsGet(),
   962  		autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters),
   963  		autorest.WithPathParameters("/webhdfs/v1/{listFilePath}", pathParameters),
   964  		autorest.WithQueryParameters(queryParameters))
   965  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   966  }
   967  
   968  // ListFileStatusSender sends the ListFileStatus request. The method will close the
   969  // http.Response Body if it receives an error.
   970  func (client Client) ListFileStatusSender(req *http.Request) (*http.Response, error) {
   971  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   972  }
   973  
   974  // ListFileStatusResponder handles the response to the ListFileStatus request. The method always
   975  // closes the http.Response Body.
   976  func (client Client) ListFileStatusResponder(resp *http.Response) (result FileStatusesResult, err error) {
   977  	err = autorest.Respond(
   978  		resp,
   979  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   980  		autorest.ByUnmarshallingJSON(&result),
   981  		autorest.ByClosing())
   982  	result.Response = autorest.Response{Response: resp}
   983  	return
   984  }
   985  
   986  // Mkdirs creates a directory.
   987  // Parameters:
   988  // accountName - the Azure Data Lake Store account to execute filesystem operations on.
   989  // pathParameter - the Data Lake Store path (starting with '/') of the directory to create.
   990  func (client Client) Mkdirs(ctx context.Context, accountName string, pathParameter string) (result FileOperationResult, err error) {
   991  	if tracing.IsEnabled() {
   992  		ctx = tracing.StartSpan(ctx, fqdn+"/Client.Mkdirs")
   993  		defer func() {
   994  			sc := -1
   995  			if result.Response.Response != nil {
   996  				sc = result.Response.Response.StatusCode
   997  			}
   998  			tracing.EndSpan(ctx, sc, err)
   999  		}()
  1000  	}
  1001  	req, err := client.MkdirsPreparer(ctx, accountName, pathParameter)
  1002  	if err != nil {
  1003  		err = autorest.NewErrorWithError(err, "filesystem.Client", "Mkdirs", nil, "Failure preparing request")
  1004  		return
  1005  	}
  1006  
  1007  	resp, err := client.MkdirsSender(req)
  1008  	if err != nil {
  1009  		result.Response = autorest.Response{Response: resp}
  1010  		err = autorest.NewErrorWithError(err, "filesystem.Client", "Mkdirs", resp, "Failure sending request")
  1011  		return
  1012  	}
  1013  
  1014  	result, err = client.MkdirsResponder(resp)
  1015  	if err != nil {
  1016  		err = autorest.NewErrorWithError(err, "filesystem.Client", "Mkdirs", resp, "Failure responding to request")
  1017  		return
  1018  	}
  1019  
  1020  	return
  1021  }
  1022  
  1023  // MkdirsPreparer prepares the Mkdirs request.
  1024  func (client Client) MkdirsPreparer(ctx context.Context, accountName string, pathParameter string) (*http.Request, error) {
  1025  	urlParameters := map[string]interface{}{
  1026  		"accountName":             accountName,
  1027  		"adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix,
  1028  	}
  1029  
  1030  	pathParameters := map[string]interface{}{
  1031  		"path": autorest.Encode("path", pathParameter),
  1032  	}
  1033  
  1034  	const APIVersion = "2015-10-01-preview"
  1035  	queryParameters := map[string]interface{}{
  1036  		"api-version": APIVersion,
  1037  		"op":          autorest.Encode("query", "MKDIRS"),
  1038  	}
  1039  
  1040  	preparer := autorest.CreatePreparer(
  1041  		autorest.AsPut(),
  1042  		autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters),
  1043  		autorest.WithPathParameters("/webhdfs/v1/{path}", pathParameters),
  1044  		autorest.WithQueryParameters(queryParameters))
  1045  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1046  }
  1047  
  1048  // MkdirsSender sends the Mkdirs request. The method will close the
  1049  // http.Response Body if it receives an error.
  1050  func (client Client) MkdirsSender(req *http.Request) (*http.Response, error) {
  1051  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1052  }
  1053  
  1054  // MkdirsResponder handles the response to the Mkdirs request. The method always
  1055  // closes the http.Response Body.
  1056  func (client Client) MkdirsResponder(resp *http.Response) (result FileOperationResult, err error) {
  1057  	err = autorest.Respond(
  1058  		resp,
  1059  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1060  		autorest.ByUnmarshallingJSON(&result),
  1061  		autorest.ByClosing())
  1062  	result.Response = autorest.Response{Response: resp}
  1063  	return
  1064  }
  1065  
  1066  // ModifyACLEntries modifies existing Access Control List (ACL) entries on a file or folder.
  1067  // Parameters:
  1068  // accountName - the Azure Data Lake Store account to execute filesystem operations on.
  1069  // modifyACLFilePath - the Data Lake Store path (starting with '/') of the file or directory with the ACL being
  1070  // modified.
  1071  // aclspec - the ACL specification included in ACL modification operations in the format
  1072  // '[default:]user|group|other::r|-w|-x|-'
  1073  func (client Client) ModifyACLEntries(ctx context.Context, accountName string, modifyACLFilePath string, aclspec string) (result autorest.Response, err error) {
  1074  	if tracing.IsEnabled() {
  1075  		ctx = tracing.StartSpan(ctx, fqdn+"/Client.ModifyACLEntries")
  1076  		defer func() {
  1077  			sc := -1
  1078  			if result.Response != nil {
  1079  				sc = result.Response.StatusCode
  1080  			}
  1081  			tracing.EndSpan(ctx, sc, err)
  1082  		}()
  1083  	}
  1084  	req, err := client.ModifyACLEntriesPreparer(ctx, accountName, modifyACLFilePath, aclspec)
  1085  	if err != nil {
  1086  		err = autorest.NewErrorWithError(err, "filesystem.Client", "ModifyACLEntries", nil, "Failure preparing request")
  1087  		return
  1088  	}
  1089  
  1090  	resp, err := client.ModifyACLEntriesSender(req)
  1091  	if err != nil {
  1092  		result.Response = resp
  1093  		err = autorest.NewErrorWithError(err, "filesystem.Client", "ModifyACLEntries", resp, "Failure sending request")
  1094  		return
  1095  	}
  1096  
  1097  	result, err = client.ModifyACLEntriesResponder(resp)
  1098  	if err != nil {
  1099  		err = autorest.NewErrorWithError(err, "filesystem.Client", "ModifyACLEntries", resp, "Failure responding to request")
  1100  		return
  1101  	}
  1102  
  1103  	return
  1104  }
  1105  
  1106  // ModifyACLEntriesPreparer prepares the ModifyACLEntries request.
  1107  func (client Client) ModifyACLEntriesPreparer(ctx context.Context, accountName string, modifyACLFilePath string, aclspec string) (*http.Request, error) {
  1108  	urlParameters := map[string]interface{}{
  1109  		"accountName":             accountName,
  1110  		"adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix,
  1111  	}
  1112  
  1113  	pathParameters := map[string]interface{}{
  1114  		"modifyAclFilePath": autorest.Encode("path", modifyACLFilePath),
  1115  	}
  1116  
  1117  	const APIVersion = "2015-10-01-preview"
  1118  	queryParameters := map[string]interface{}{
  1119  		"aclspec":     autorest.Encode("query", aclspec),
  1120  		"api-version": APIVersion,
  1121  		"op":          autorest.Encode("query", "MODIFYACLENTRIES"),
  1122  	}
  1123  
  1124  	preparer := autorest.CreatePreparer(
  1125  		autorest.AsPut(),
  1126  		autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters),
  1127  		autorest.WithPathParameters("/webhdfs/v1/{modifyAclFilePath}", pathParameters),
  1128  		autorest.WithQueryParameters(queryParameters))
  1129  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1130  }
  1131  
  1132  // ModifyACLEntriesSender sends the ModifyACLEntries request. The method will close the
  1133  // http.Response Body if it receives an error.
  1134  func (client Client) ModifyACLEntriesSender(req *http.Request) (*http.Response, error) {
  1135  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1136  }
  1137  
  1138  // ModifyACLEntriesResponder handles the response to the ModifyACLEntries request. The method always
  1139  // closes the http.Response Body.
  1140  func (client Client) ModifyACLEntriesResponder(resp *http.Response) (result autorest.Response, err error) {
  1141  	err = autorest.Respond(
  1142  		resp,
  1143  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1144  		autorest.ByClosing())
  1145  	result.Response = resp
  1146  	return
  1147  }
  1148  
  1149  // MsConcat concatenates the list of source files into the destination file, deleting all source files upon success.
  1150  // This method accepts more source file paths than the Concat method. This method and the parameters it accepts are
  1151  // subject to change for usability in an upcoming version.
  1152  // Parameters:
  1153  // accountName - the Azure Data Lake Store account to execute filesystem operations on.
  1154  // msConcatDestinationPath - the Data Lake Store path (starting with '/') of the destination file resulting
  1155  // from the concatenation.
  1156  // streamContents - a list of Data Lake Store paths (starting with '/') of the source files. Must be in the
  1157  // format: sources=<comma separated list>
  1158  // deleteSourceDirectory - indicates that as an optimization instead of deleting each individual source stream,
  1159  // delete the source stream folder if all streams are in the same folder instead. This results in a substantial
  1160  // performance improvement when the only streams in the folder are part of the concatenation operation.
  1161  // WARNING: This includes the deletion of any other files that are not source files. Only set this to true when
  1162  // source files are the only files in the source directory.
  1163  func (client Client) MsConcat(ctx context.Context, accountName string, msConcatDestinationPath string, streamContents io.ReadCloser, deleteSourceDirectory *bool) (result autorest.Response, err error) {
  1164  	if tracing.IsEnabled() {
  1165  		ctx = tracing.StartSpan(ctx, fqdn+"/Client.MsConcat")
  1166  		defer func() {
  1167  			sc := -1
  1168  			if result.Response != nil {
  1169  				sc = result.Response.StatusCode
  1170  			}
  1171  			tracing.EndSpan(ctx, sc, err)
  1172  		}()
  1173  	}
  1174  	req, err := client.MsConcatPreparer(ctx, accountName, msConcatDestinationPath, streamContents, deleteSourceDirectory)
  1175  	if err != nil {
  1176  		err = autorest.NewErrorWithError(err, "filesystem.Client", "MsConcat", nil, "Failure preparing request")
  1177  		return
  1178  	}
  1179  
  1180  	resp, err := client.MsConcatSender(req)
  1181  	if err != nil {
  1182  		result.Response = resp
  1183  		err = autorest.NewErrorWithError(err, "filesystem.Client", "MsConcat", resp, "Failure sending request")
  1184  		return
  1185  	}
  1186  
  1187  	result, err = client.MsConcatResponder(resp)
  1188  	if err != nil {
  1189  		err = autorest.NewErrorWithError(err, "filesystem.Client", "MsConcat", resp, "Failure responding to request")
  1190  		return
  1191  	}
  1192  
  1193  	return
  1194  }
  1195  
  1196  // MsConcatPreparer prepares the MsConcat request.
  1197  func (client Client) MsConcatPreparer(ctx context.Context, accountName string, msConcatDestinationPath string, streamContents io.ReadCloser, deleteSourceDirectory *bool) (*http.Request, error) {
  1198  	urlParameters := map[string]interface{}{
  1199  		"accountName":             accountName,
  1200  		"adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix,
  1201  	}
  1202  
  1203  	pathParameters := map[string]interface{}{
  1204  		"msConcatDestinationPath": autorest.Encode("path", msConcatDestinationPath),
  1205  	}
  1206  
  1207  	const APIVersion = "2015-10-01-preview"
  1208  	queryParameters := map[string]interface{}{
  1209  		"api-version": APIVersion,
  1210  		"op":          autorest.Encode("query", "MSCONCAT"),
  1211  	}
  1212  	if deleteSourceDirectory != nil {
  1213  		queryParameters["deleteSourceDirectory"] = autorest.Encode("query", *deleteSourceDirectory)
  1214  	}
  1215  
  1216  	preparer := autorest.CreatePreparer(
  1217  		autorest.AsContentType("application/octet-stream"),
  1218  		autorest.AsPost(),
  1219  		autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters),
  1220  		autorest.WithPathParameters("/webhdfs/v1/{msConcatDestinationPath}", pathParameters),
  1221  		autorest.WithFile(streamContents),
  1222  		autorest.WithQueryParameters(queryParameters))
  1223  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1224  }
  1225  
  1226  // MsConcatSender sends the MsConcat request. The method will close the
  1227  // http.Response Body if it receives an error.
  1228  func (client Client) MsConcatSender(req *http.Request) (*http.Response, error) {
  1229  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1230  }
  1231  
  1232  // MsConcatResponder handles the response to the MsConcat request. The method always
  1233  // closes the http.Response Body.
  1234  func (client Client) MsConcatResponder(resp *http.Response) (result autorest.Response, err error) {
  1235  	err = autorest.Respond(
  1236  		resp,
  1237  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1238  		autorest.ByClosing())
  1239  	result.Response = resp
  1240  	return
  1241  }
  1242  
  1243  // Open opens and reads from the specified file.
  1244  // Parameters:
  1245  // accountName - the Azure Data Lake Store account to execute filesystem operations on.
  1246  // directFilePath - the Data Lake Store path (starting with '/') of the file to open.
  1247  func (client Client) Open(ctx context.Context, accountName string, directFilePath string, length *int64, offset *int64) (result ReadCloser, err error) {
  1248  	if tracing.IsEnabled() {
  1249  		ctx = tracing.StartSpan(ctx, fqdn+"/Client.Open")
  1250  		defer func() {
  1251  			sc := -1
  1252  			if result.Response.Response != nil {
  1253  				sc = result.Response.Response.StatusCode
  1254  			}
  1255  			tracing.EndSpan(ctx, sc, err)
  1256  		}()
  1257  	}
  1258  	req, err := client.OpenPreparer(ctx, accountName, directFilePath, length, offset)
  1259  	if err != nil {
  1260  		err = autorest.NewErrorWithError(err, "filesystem.Client", "Open", nil, "Failure preparing request")
  1261  		return
  1262  	}
  1263  
  1264  	resp, err := client.OpenSender(req)
  1265  	if err != nil {
  1266  		result.Response = autorest.Response{Response: resp}
  1267  		err = autorest.NewErrorWithError(err, "filesystem.Client", "Open", resp, "Failure sending request")
  1268  		return
  1269  	}
  1270  
  1271  	result, err = client.OpenResponder(resp)
  1272  	if err != nil {
  1273  		err = autorest.NewErrorWithError(err, "filesystem.Client", "Open", resp, "Failure responding to request")
  1274  		return
  1275  	}
  1276  
  1277  	return
  1278  }
  1279  
  1280  // OpenPreparer prepares the Open request.
  1281  func (client Client) OpenPreparer(ctx context.Context, accountName string, directFilePath string, length *int64, offset *int64) (*http.Request, error) {
  1282  	urlParameters := map[string]interface{}{
  1283  		"accountName":             accountName,
  1284  		"adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix,
  1285  	}
  1286  
  1287  	pathParameters := map[string]interface{}{
  1288  		"directFilePath": autorest.Encode("path", directFilePath),
  1289  	}
  1290  
  1291  	const APIVersion = "2015-10-01-preview"
  1292  	queryParameters := map[string]interface{}{
  1293  		"api-version": APIVersion,
  1294  		"op":          autorest.Encode("query", "OPEN"),
  1295  		"read":        autorest.Encode("query", "true"),
  1296  	}
  1297  	if length != nil {
  1298  		queryParameters["length"] = autorest.Encode("query", *length)
  1299  	}
  1300  	if offset != nil {
  1301  		queryParameters["offset"] = autorest.Encode("query", *offset)
  1302  	}
  1303  
  1304  	preparer := autorest.CreatePreparer(
  1305  		autorest.AsGet(),
  1306  		autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters),
  1307  		autorest.WithPathParameters("/webhdfs/v1/{directFilePath}", pathParameters),
  1308  		autorest.WithQueryParameters(queryParameters))
  1309  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1310  }
  1311  
  1312  // OpenSender sends the Open request. The method will close the
  1313  // http.Response Body if it receives an error.
  1314  func (client Client) OpenSender(req *http.Request) (*http.Response, error) {
  1315  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1316  }
  1317  
  1318  // OpenResponder handles the response to the Open request. The method always
  1319  // closes the http.Response Body.
  1320  func (client Client) OpenResponder(resp *http.Response) (result ReadCloser, err error) {
  1321  	result.Value = &resp.Body
  1322  	err = autorest.Respond(
  1323  		resp,
  1324  		azure.WithErrorUnlessStatusCode(http.StatusOK))
  1325  	result.Response = autorest.Response{Response: resp}
  1326  	return
  1327  }
  1328  
  1329  // RemoveACL removes the existing Access Control List (ACL) of the specified file or directory.
  1330  // Parameters:
  1331  // accountName - the Azure Data Lake Store account to execute filesystem operations on.
  1332  // ACLFilePath - the Data Lake Store path (starting with '/') of the file or directory with the ACL being
  1333  // removed.
  1334  func (client Client) RemoveACL(ctx context.Context, accountName string, ACLFilePath string) (result autorest.Response, err error) {
  1335  	if tracing.IsEnabled() {
  1336  		ctx = tracing.StartSpan(ctx, fqdn+"/Client.RemoveACL")
  1337  		defer func() {
  1338  			sc := -1
  1339  			if result.Response != nil {
  1340  				sc = result.Response.StatusCode
  1341  			}
  1342  			tracing.EndSpan(ctx, sc, err)
  1343  		}()
  1344  	}
  1345  	req, err := client.RemoveACLPreparer(ctx, accountName, ACLFilePath)
  1346  	if err != nil {
  1347  		err = autorest.NewErrorWithError(err, "filesystem.Client", "RemoveACL", nil, "Failure preparing request")
  1348  		return
  1349  	}
  1350  
  1351  	resp, err := client.RemoveACLSender(req)
  1352  	if err != nil {
  1353  		result.Response = resp
  1354  		err = autorest.NewErrorWithError(err, "filesystem.Client", "RemoveACL", resp, "Failure sending request")
  1355  		return
  1356  	}
  1357  
  1358  	result, err = client.RemoveACLResponder(resp)
  1359  	if err != nil {
  1360  		err = autorest.NewErrorWithError(err, "filesystem.Client", "RemoveACL", resp, "Failure responding to request")
  1361  		return
  1362  	}
  1363  
  1364  	return
  1365  }
  1366  
  1367  // RemoveACLPreparer prepares the RemoveACL request.
  1368  func (client Client) RemoveACLPreparer(ctx context.Context, accountName string, ACLFilePath string) (*http.Request, error) {
  1369  	urlParameters := map[string]interface{}{
  1370  		"accountName":             accountName,
  1371  		"adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix,
  1372  	}
  1373  
  1374  	pathParameters := map[string]interface{}{
  1375  		"aclFilePath": autorest.Encode("path", ACLFilePath),
  1376  	}
  1377  
  1378  	const APIVersion = "2015-10-01-preview"
  1379  	queryParameters := map[string]interface{}{
  1380  		"api-version": APIVersion,
  1381  		"op":          autorest.Encode("query", "REMOVEACL"),
  1382  	}
  1383  
  1384  	preparer := autorest.CreatePreparer(
  1385  		autorest.AsPut(),
  1386  		autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters),
  1387  		autorest.WithPathParameters("/webhdfs/v1/{aclFilePath}", pathParameters),
  1388  		autorest.WithQueryParameters(queryParameters))
  1389  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1390  }
  1391  
  1392  // RemoveACLSender sends the RemoveACL request. The method will close the
  1393  // http.Response Body if it receives an error.
  1394  func (client Client) RemoveACLSender(req *http.Request) (*http.Response, error) {
  1395  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1396  }
  1397  
  1398  // RemoveACLResponder handles the response to the RemoveACL request. The method always
  1399  // closes the http.Response Body.
  1400  func (client Client) RemoveACLResponder(resp *http.Response) (result autorest.Response, err error) {
  1401  	err = autorest.Respond(
  1402  		resp,
  1403  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1404  		autorest.ByClosing())
  1405  	result.Response = resp
  1406  	return
  1407  }
  1408  
  1409  // RemoveACLEntries removes existing Access Control List (ACL) entries for a file or folder.
  1410  // Parameters:
  1411  // accountName - the Azure Data Lake Store account to execute filesystem operations on.
  1412  // removeACLFilePath - the Data Lake Store path (starting with '/') of the file or directory with the ACL being
  1413  // removed.
  1414  // aclspec - the ACL spec included in ACL removal operations in the format '[default:]user|group|other'
  1415  func (client Client) RemoveACLEntries(ctx context.Context, accountName string, removeACLFilePath string, aclspec string) (result autorest.Response, err error) {
  1416  	if tracing.IsEnabled() {
  1417  		ctx = tracing.StartSpan(ctx, fqdn+"/Client.RemoveACLEntries")
  1418  		defer func() {
  1419  			sc := -1
  1420  			if result.Response != nil {
  1421  				sc = result.Response.StatusCode
  1422  			}
  1423  			tracing.EndSpan(ctx, sc, err)
  1424  		}()
  1425  	}
  1426  	req, err := client.RemoveACLEntriesPreparer(ctx, accountName, removeACLFilePath, aclspec)
  1427  	if err != nil {
  1428  		err = autorest.NewErrorWithError(err, "filesystem.Client", "RemoveACLEntries", nil, "Failure preparing request")
  1429  		return
  1430  	}
  1431  
  1432  	resp, err := client.RemoveACLEntriesSender(req)
  1433  	if err != nil {
  1434  		result.Response = resp
  1435  		err = autorest.NewErrorWithError(err, "filesystem.Client", "RemoveACLEntries", resp, "Failure sending request")
  1436  		return
  1437  	}
  1438  
  1439  	result, err = client.RemoveACLEntriesResponder(resp)
  1440  	if err != nil {
  1441  		err = autorest.NewErrorWithError(err, "filesystem.Client", "RemoveACLEntries", resp, "Failure responding to request")
  1442  		return
  1443  	}
  1444  
  1445  	return
  1446  }
  1447  
  1448  // RemoveACLEntriesPreparer prepares the RemoveACLEntries request.
  1449  func (client Client) RemoveACLEntriesPreparer(ctx context.Context, accountName string, removeACLFilePath string, aclspec string) (*http.Request, error) {
  1450  	urlParameters := map[string]interface{}{
  1451  		"accountName":             accountName,
  1452  		"adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix,
  1453  	}
  1454  
  1455  	pathParameters := map[string]interface{}{
  1456  		"removeAclFilePath": autorest.Encode("path", removeACLFilePath),
  1457  	}
  1458  
  1459  	const APIVersion = "2015-10-01-preview"
  1460  	queryParameters := map[string]interface{}{
  1461  		"aclspec":     autorest.Encode("query", aclspec),
  1462  		"api-version": APIVersion,
  1463  		"op":          autorest.Encode("query", "REMOVEACLENTRIES"),
  1464  	}
  1465  
  1466  	preparer := autorest.CreatePreparer(
  1467  		autorest.AsPut(),
  1468  		autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters),
  1469  		autorest.WithPathParameters("/webhdfs/v1/{removeAclFilePath}", pathParameters),
  1470  		autorest.WithQueryParameters(queryParameters))
  1471  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1472  }
  1473  
  1474  // RemoveACLEntriesSender sends the RemoveACLEntries request. The method will close the
  1475  // http.Response Body if it receives an error.
  1476  func (client Client) RemoveACLEntriesSender(req *http.Request) (*http.Response, error) {
  1477  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1478  }
  1479  
  1480  // RemoveACLEntriesResponder handles the response to the RemoveACLEntries request. The method always
  1481  // closes the http.Response Body.
  1482  func (client Client) RemoveACLEntriesResponder(resp *http.Response) (result autorest.Response, err error) {
  1483  	err = autorest.Respond(
  1484  		resp,
  1485  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1486  		autorest.ByClosing())
  1487  	result.Response = resp
  1488  	return
  1489  }
  1490  
  1491  // RemoveDefaultACL removes the existing Default Access Control List (ACL) of the specified directory.
  1492  // Parameters:
  1493  // accountName - the Azure Data Lake Store account to execute filesystem operations on.
  1494  // defaultACLFilePath - the Data Lake Store path (starting with '/') of the directory with the default ACL
  1495  // being removed.
  1496  func (client Client) RemoveDefaultACL(ctx context.Context, accountName string, defaultACLFilePath string) (result autorest.Response, err error) {
  1497  	if tracing.IsEnabled() {
  1498  		ctx = tracing.StartSpan(ctx, fqdn+"/Client.RemoveDefaultACL")
  1499  		defer func() {
  1500  			sc := -1
  1501  			if result.Response != nil {
  1502  				sc = result.Response.StatusCode
  1503  			}
  1504  			tracing.EndSpan(ctx, sc, err)
  1505  		}()
  1506  	}
  1507  	req, err := client.RemoveDefaultACLPreparer(ctx, accountName, defaultACLFilePath)
  1508  	if err != nil {
  1509  		err = autorest.NewErrorWithError(err, "filesystem.Client", "RemoveDefaultACL", nil, "Failure preparing request")
  1510  		return
  1511  	}
  1512  
  1513  	resp, err := client.RemoveDefaultACLSender(req)
  1514  	if err != nil {
  1515  		result.Response = resp
  1516  		err = autorest.NewErrorWithError(err, "filesystem.Client", "RemoveDefaultACL", resp, "Failure sending request")
  1517  		return
  1518  	}
  1519  
  1520  	result, err = client.RemoveDefaultACLResponder(resp)
  1521  	if err != nil {
  1522  		err = autorest.NewErrorWithError(err, "filesystem.Client", "RemoveDefaultACL", resp, "Failure responding to request")
  1523  		return
  1524  	}
  1525  
  1526  	return
  1527  }
  1528  
  1529  // RemoveDefaultACLPreparer prepares the RemoveDefaultACL request.
  1530  func (client Client) RemoveDefaultACLPreparer(ctx context.Context, accountName string, defaultACLFilePath string) (*http.Request, error) {
  1531  	urlParameters := map[string]interface{}{
  1532  		"accountName":             accountName,
  1533  		"adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix,
  1534  	}
  1535  
  1536  	pathParameters := map[string]interface{}{
  1537  		"defaultAclFilePath": autorest.Encode("path", defaultACLFilePath),
  1538  	}
  1539  
  1540  	const APIVersion = "2015-10-01-preview"
  1541  	queryParameters := map[string]interface{}{
  1542  		"api-version": APIVersion,
  1543  		"op":          autorest.Encode("query", "REMOVEDEFAULTACL"),
  1544  	}
  1545  
  1546  	preparer := autorest.CreatePreparer(
  1547  		autorest.AsPut(),
  1548  		autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters),
  1549  		autorest.WithPathParameters("/webhdfs/v1/{defaultAclFilePath}", pathParameters),
  1550  		autorest.WithQueryParameters(queryParameters))
  1551  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1552  }
  1553  
  1554  // RemoveDefaultACLSender sends the RemoveDefaultACL request. The method will close the
  1555  // http.Response Body if it receives an error.
  1556  func (client Client) RemoveDefaultACLSender(req *http.Request) (*http.Response, error) {
  1557  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1558  }
  1559  
  1560  // RemoveDefaultACLResponder handles the response to the RemoveDefaultACL request. The method always
  1561  // closes the http.Response Body.
  1562  func (client Client) RemoveDefaultACLResponder(resp *http.Response) (result autorest.Response, err error) {
  1563  	err = autorest.Respond(
  1564  		resp,
  1565  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1566  		autorest.ByClosing())
  1567  	result.Response = resp
  1568  	return
  1569  }
  1570  
  1571  // Rename rename a file or directory.
  1572  // Parameters:
  1573  // accountName - the Azure Data Lake Store account to execute filesystem operations on.
  1574  // renameFilePath - the Data Lake Store path (starting with '/') of the file or directory to move/rename.
  1575  // destination - the path to move/rename the file or folder to
  1576  func (client Client) Rename(ctx context.Context, accountName string, renameFilePath string, destination string) (result FileOperationResult, err error) {
  1577  	if tracing.IsEnabled() {
  1578  		ctx = tracing.StartSpan(ctx, fqdn+"/Client.Rename")
  1579  		defer func() {
  1580  			sc := -1
  1581  			if result.Response.Response != nil {
  1582  				sc = result.Response.Response.StatusCode
  1583  			}
  1584  			tracing.EndSpan(ctx, sc, err)
  1585  		}()
  1586  	}
  1587  	req, err := client.RenamePreparer(ctx, accountName, renameFilePath, destination)
  1588  	if err != nil {
  1589  		err = autorest.NewErrorWithError(err, "filesystem.Client", "Rename", nil, "Failure preparing request")
  1590  		return
  1591  	}
  1592  
  1593  	resp, err := client.RenameSender(req)
  1594  	if err != nil {
  1595  		result.Response = autorest.Response{Response: resp}
  1596  		err = autorest.NewErrorWithError(err, "filesystem.Client", "Rename", resp, "Failure sending request")
  1597  		return
  1598  	}
  1599  
  1600  	result, err = client.RenameResponder(resp)
  1601  	if err != nil {
  1602  		err = autorest.NewErrorWithError(err, "filesystem.Client", "Rename", resp, "Failure responding to request")
  1603  		return
  1604  	}
  1605  
  1606  	return
  1607  }
  1608  
  1609  // RenamePreparer prepares the Rename request.
  1610  func (client Client) RenamePreparer(ctx context.Context, accountName string, renameFilePath string, destination string) (*http.Request, error) {
  1611  	urlParameters := map[string]interface{}{
  1612  		"accountName":             accountName,
  1613  		"adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix,
  1614  	}
  1615  
  1616  	pathParameters := map[string]interface{}{
  1617  		"renameFilePath": autorest.Encode("path", renameFilePath),
  1618  	}
  1619  
  1620  	const APIVersion = "2015-10-01-preview"
  1621  	queryParameters := map[string]interface{}{
  1622  		"api-version": APIVersion,
  1623  		"destination": autorest.Encode("query", destination),
  1624  		"op":          autorest.Encode("query", "RENAME"),
  1625  	}
  1626  
  1627  	preparer := autorest.CreatePreparer(
  1628  		autorest.AsPut(),
  1629  		autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters),
  1630  		autorest.WithPathParameters("/webhdfs/v1/{renameFilePath}", pathParameters),
  1631  		autorest.WithQueryParameters(queryParameters))
  1632  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1633  }
  1634  
  1635  // RenameSender sends the Rename request. The method will close the
  1636  // http.Response Body if it receives an error.
  1637  func (client Client) RenameSender(req *http.Request) (*http.Response, error) {
  1638  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1639  }
  1640  
  1641  // RenameResponder handles the response to the Rename request. The method always
  1642  // closes the http.Response Body.
  1643  func (client Client) RenameResponder(resp *http.Response) (result FileOperationResult, err error) {
  1644  	err = autorest.Respond(
  1645  		resp,
  1646  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1647  		autorest.ByUnmarshallingJSON(&result),
  1648  		autorest.ByClosing())
  1649  	result.Response = autorest.Response{Response: resp}
  1650  	return
  1651  }
  1652  
  1653  // SetACL sets the Access Control List (ACL) for a file or folder.
  1654  // Parameters:
  1655  // accountName - the Azure Data Lake Store account to execute filesystem operations on.
  1656  // setACLFilePath - the Data Lake Store path (starting with '/') of the file or directory on which to set the
  1657  // ACL.
  1658  // aclspec - the ACL spec included in ACL creation operations in the format
  1659  // '[default:]user|group|other::r|-w|-x|-'
  1660  func (client Client) SetACL(ctx context.Context, accountName string, setACLFilePath string, aclspec string) (result autorest.Response, err error) {
  1661  	if tracing.IsEnabled() {
  1662  		ctx = tracing.StartSpan(ctx, fqdn+"/Client.SetACL")
  1663  		defer func() {
  1664  			sc := -1
  1665  			if result.Response != nil {
  1666  				sc = result.Response.StatusCode
  1667  			}
  1668  			tracing.EndSpan(ctx, sc, err)
  1669  		}()
  1670  	}
  1671  	req, err := client.SetACLPreparer(ctx, accountName, setACLFilePath, aclspec)
  1672  	if err != nil {
  1673  		err = autorest.NewErrorWithError(err, "filesystem.Client", "SetACL", nil, "Failure preparing request")
  1674  		return
  1675  	}
  1676  
  1677  	resp, err := client.SetACLSender(req)
  1678  	if err != nil {
  1679  		result.Response = resp
  1680  		err = autorest.NewErrorWithError(err, "filesystem.Client", "SetACL", resp, "Failure sending request")
  1681  		return
  1682  	}
  1683  
  1684  	result, err = client.SetACLResponder(resp)
  1685  	if err != nil {
  1686  		err = autorest.NewErrorWithError(err, "filesystem.Client", "SetACL", resp, "Failure responding to request")
  1687  		return
  1688  	}
  1689  
  1690  	return
  1691  }
  1692  
  1693  // SetACLPreparer prepares the SetACL request.
  1694  func (client Client) SetACLPreparer(ctx context.Context, accountName string, setACLFilePath string, aclspec string) (*http.Request, error) {
  1695  	urlParameters := map[string]interface{}{
  1696  		"accountName":             accountName,
  1697  		"adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix,
  1698  	}
  1699  
  1700  	pathParameters := map[string]interface{}{
  1701  		"setAclFilePath": autorest.Encode("path", setACLFilePath),
  1702  	}
  1703  
  1704  	const APIVersion = "2015-10-01-preview"
  1705  	queryParameters := map[string]interface{}{
  1706  		"aclspec":     autorest.Encode("query", aclspec),
  1707  		"api-version": APIVersion,
  1708  		"op":          autorest.Encode("query", "SETACL"),
  1709  	}
  1710  
  1711  	preparer := autorest.CreatePreparer(
  1712  		autorest.AsPut(),
  1713  		autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters),
  1714  		autorest.WithPathParameters("/webhdfs/v1/{setAclFilePath}", pathParameters),
  1715  		autorest.WithQueryParameters(queryParameters))
  1716  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1717  }
  1718  
  1719  // SetACLSender sends the SetACL request. The method will close the
  1720  // http.Response Body if it receives an error.
  1721  func (client Client) SetACLSender(req *http.Request) (*http.Response, error) {
  1722  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1723  }
  1724  
  1725  // SetACLResponder handles the response to the SetACL request. The method always
  1726  // closes the http.Response Body.
  1727  func (client Client) SetACLResponder(resp *http.Response) (result autorest.Response, err error) {
  1728  	err = autorest.Respond(
  1729  		resp,
  1730  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1731  		autorest.ByClosing())
  1732  	result.Response = resp
  1733  	return
  1734  }
  1735  
  1736  // SetFileExpiry sets or removes the expiration time on the specified file. This operation can only be executed against
  1737  // files. Folders are not supported.
  1738  // Parameters:
  1739  // accountName - the Azure Data Lake Store account to execute filesystem operations on.
  1740  // filePath - the Data Lake Store path (starting with '/') of the file on which to set or remove the expiration
  1741  // time.
  1742  // expiryOption - indicates the type of expiration to use for the file: 1. NeverExpire: ExpireTime is ignored.
  1743  // 2. RelativeToNow: ExpireTime is an integer in milliseconds representing the expiration date relative to when
  1744  // file expiration is updated. 3. RelativeToCreationDate: ExpireTime is an integer in milliseconds representing
  1745  // the expiration date relative to file creation. 4. Absolute: ExpireTime is an integer in milliseconds, as a
  1746  // Unix timestamp relative to 1/1/1970 00:00:00.
  1747  // expireTime - the time that the file will expire, corresponding to the ExpiryOption that was set.
  1748  func (client Client) SetFileExpiry(ctx context.Context, accountName string, filePath string, expiryOption ExpiryOptionType, expireTime *int64) (result autorest.Response, err error) {
  1749  	if tracing.IsEnabled() {
  1750  		ctx = tracing.StartSpan(ctx, fqdn+"/Client.SetFileExpiry")
  1751  		defer func() {
  1752  			sc := -1
  1753  			if result.Response != nil {
  1754  				sc = result.Response.StatusCode
  1755  			}
  1756  			tracing.EndSpan(ctx, sc, err)
  1757  		}()
  1758  	}
  1759  	req, err := client.SetFileExpiryPreparer(ctx, accountName, filePath, expiryOption, expireTime)
  1760  	if err != nil {
  1761  		err = autorest.NewErrorWithError(err, "filesystem.Client", "SetFileExpiry", nil, "Failure preparing request")
  1762  		return
  1763  	}
  1764  
  1765  	resp, err := client.SetFileExpirySender(req)
  1766  	if err != nil {
  1767  		result.Response = resp
  1768  		err = autorest.NewErrorWithError(err, "filesystem.Client", "SetFileExpiry", resp, "Failure sending request")
  1769  		return
  1770  	}
  1771  
  1772  	result, err = client.SetFileExpiryResponder(resp)
  1773  	if err != nil {
  1774  		err = autorest.NewErrorWithError(err, "filesystem.Client", "SetFileExpiry", resp, "Failure responding to request")
  1775  		return
  1776  	}
  1777  
  1778  	return
  1779  }
  1780  
  1781  // SetFileExpiryPreparer prepares the SetFileExpiry request.
  1782  func (client Client) SetFileExpiryPreparer(ctx context.Context, accountName string, filePath string, expiryOption ExpiryOptionType, expireTime *int64) (*http.Request, error) {
  1783  	urlParameters := map[string]interface{}{
  1784  		"accountName":             accountName,
  1785  		"adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix,
  1786  	}
  1787  
  1788  	pathParameters := map[string]interface{}{
  1789  		"filePath": autorest.Encode("path", filePath),
  1790  	}
  1791  
  1792  	const APIVersion = "2015-10-01-preview"
  1793  	queryParameters := map[string]interface{}{
  1794  		"api-version":  APIVersion,
  1795  		"expiryOption": autorest.Encode("query", expiryOption),
  1796  		"op":           autorest.Encode("query", "SETEXPIRY"),
  1797  	}
  1798  	if expireTime != nil {
  1799  		queryParameters["expireTime"] = autorest.Encode("query", *expireTime)
  1800  	}
  1801  
  1802  	preparer := autorest.CreatePreparer(
  1803  		autorest.AsPut(),
  1804  		autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters),
  1805  		autorest.WithPathParameters("/WebHdfsExt/{filePath}", pathParameters),
  1806  		autorest.WithQueryParameters(queryParameters))
  1807  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1808  }
  1809  
  1810  // SetFileExpirySender sends the SetFileExpiry request. The method will close the
  1811  // http.Response Body if it receives an error.
  1812  func (client Client) SetFileExpirySender(req *http.Request) (*http.Response, error) {
  1813  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1814  }
  1815  
  1816  // SetFileExpiryResponder handles the response to the SetFileExpiry request. The method always
  1817  // closes the http.Response Body.
  1818  func (client Client) SetFileExpiryResponder(resp *http.Response) (result autorest.Response, err error) {
  1819  	err = autorest.Respond(
  1820  		resp,
  1821  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1822  		autorest.ByClosing())
  1823  	result.Response = resp
  1824  	return
  1825  }
  1826  
  1827  // SetOwner sets the owner of a file or directory.
  1828  // Parameters:
  1829  // accountName - the Azure Data Lake Store account to execute filesystem operations on.
  1830  // setOwnerFilePath - the Data Lake Store path (starting with '/') of the file or directory for which to set
  1831  // the owner.
  1832  // owner - the AAD Object ID of the user owner of the file or directory. If empty, the property will remain
  1833  // unchanged.
  1834  // group - the AAD Object ID of the group owner of the file or directory. If empty, the property will remain
  1835  // unchanged.
  1836  func (client Client) SetOwner(ctx context.Context, accountName string, setOwnerFilePath string, owner string, group string) (result autorest.Response, err error) {
  1837  	if tracing.IsEnabled() {
  1838  		ctx = tracing.StartSpan(ctx, fqdn+"/Client.SetOwner")
  1839  		defer func() {
  1840  			sc := -1
  1841  			if result.Response != nil {
  1842  				sc = result.Response.StatusCode
  1843  			}
  1844  			tracing.EndSpan(ctx, sc, err)
  1845  		}()
  1846  	}
  1847  	req, err := client.SetOwnerPreparer(ctx, accountName, setOwnerFilePath, owner, group)
  1848  	if err != nil {
  1849  		err = autorest.NewErrorWithError(err, "filesystem.Client", "SetOwner", nil, "Failure preparing request")
  1850  		return
  1851  	}
  1852  
  1853  	resp, err := client.SetOwnerSender(req)
  1854  	if err != nil {
  1855  		result.Response = resp
  1856  		err = autorest.NewErrorWithError(err, "filesystem.Client", "SetOwner", resp, "Failure sending request")
  1857  		return
  1858  	}
  1859  
  1860  	result, err = client.SetOwnerResponder(resp)
  1861  	if err != nil {
  1862  		err = autorest.NewErrorWithError(err, "filesystem.Client", "SetOwner", resp, "Failure responding to request")
  1863  		return
  1864  	}
  1865  
  1866  	return
  1867  }
  1868  
  1869  // SetOwnerPreparer prepares the SetOwner request.
  1870  func (client Client) SetOwnerPreparer(ctx context.Context, accountName string, setOwnerFilePath string, owner string, group string) (*http.Request, error) {
  1871  	urlParameters := map[string]interface{}{
  1872  		"accountName":             accountName,
  1873  		"adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix,
  1874  	}
  1875  
  1876  	pathParameters := map[string]interface{}{
  1877  		"setOwnerFilePath": autorest.Encode("path", setOwnerFilePath),
  1878  	}
  1879  
  1880  	const APIVersion = "2015-10-01-preview"
  1881  	queryParameters := map[string]interface{}{
  1882  		"api-version": APIVersion,
  1883  		"op":          autorest.Encode("query", "SETOWNER"),
  1884  	}
  1885  	if len(owner) > 0 {
  1886  		queryParameters["owner"] = autorest.Encode("query", owner)
  1887  	}
  1888  	if len(group) > 0 {
  1889  		queryParameters["group"] = autorest.Encode("query", group)
  1890  	}
  1891  
  1892  	preparer := autorest.CreatePreparer(
  1893  		autorest.AsPut(),
  1894  		autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters),
  1895  		autorest.WithPathParameters("/webhdfs/v1/{setOwnerFilePath}", pathParameters),
  1896  		autorest.WithQueryParameters(queryParameters))
  1897  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1898  }
  1899  
  1900  // SetOwnerSender sends the SetOwner request. The method will close the
  1901  // http.Response Body if it receives an error.
  1902  func (client Client) SetOwnerSender(req *http.Request) (*http.Response, error) {
  1903  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1904  }
  1905  
  1906  // SetOwnerResponder handles the response to the SetOwner request. The method always
  1907  // closes the http.Response Body.
  1908  func (client Client) SetOwnerResponder(resp *http.Response) (result autorest.Response, err error) {
  1909  	err = autorest.Respond(
  1910  		resp,
  1911  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1912  		autorest.ByClosing())
  1913  	result.Response = resp
  1914  	return
  1915  }
  1916  
  1917  // SetPermission sets the permission of the file or folder.
  1918  // Parameters:
  1919  // accountName - the Azure Data Lake Store account to execute filesystem operations on.
  1920  // setPermissionFilePath - the Data Lake Store path (starting with '/') of the file or directory for which to
  1921  // set the permission.
  1922  // permission - a string representation of the permission (i.e 'rwx'). If empty, this property remains
  1923  // unchanged.
  1924  func (client Client) SetPermission(ctx context.Context, accountName string, setPermissionFilePath string, permission string) (result autorest.Response, err error) {
  1925  	if tracing.IsEnabled() {
  1926  		ctx = tracing.StartSpan(ctx, fqdn+"/Client.SetPermission")
  1927  		defer func() {
  1928  			sc := -1
  1929  			if result.Response != nil {
  1930  				sc = result.Response.StatusCode
  1931  			}
  1932  			tracing.EndSpan(ctx, sc, err)
  1933  		}()
  1934  	}
  1935  	req, err := client.SetPermissionPreparer(ctx, accountName, setPermissionFilePath, permission)
  1936  	if err != nil {
  1937  		err = autorest.NewErrorWithError(err, "filesystem.Client", "SetPermission", nil, "Failure preparing request")
  1938  		return
  1939  	}
  1940  
  1941  	resp, err := client.SetPermissionSender(req)
  1942  	if err != nil {
  1943  		result.Response = resp
  1944  		err = autorest.NewErrorWithError(err, "filesystem.Client", "SetPermission", resp, "Failure sending request")
  1945  		return
  1946  	}
  1947  
  1948  	result, err = client.SetPermissionResponder(resp)
  1949  	if err != nil {
  1950  		err = autorest.NewErrorWithError(err, "filesystem.Client", "SetPermission", resp, "Failure responding to request")
  1951  		return
  1952  	}
  1953  
  1954  	return
  1955  }
  1956  
  1957  // SetPermissionPreparer prepares the SetPermission request.
  1958  func (client Client) SetPermissionPreparer(ctx context.Context, accountName string, setPermissionFilePath string, permission string) (*http.Request, error) {
  1959  	urlParameters := map[string]interface{}{
  1960  		"accountName":             accountName,
  1961  		"adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix,
  1962  	}
  1963  
  1964  	pathParameters := map[string]interface{}{
  1965  		"setPermissionFilePath": autorest.Encode("path", setPermissionFilePath),
  1966  	}
  1967  
  1968  	const APIVersion = "2015-10-01-preview"
  1969  	queryParameters := map[string]interface{}{
  1970  		"api-version": APIVersion,
  1971  		"op":          autorest.Encode("query", "SETPERMISSION"),
  1972  	}
  1973  	if len(permission) > 0 {
  1974  		queryParameters["permission"] = autorest.Encode("query", permission)
  1975  	}
  1976  
  1977  	preparer := autorest.CreatePreparer(
  1978  		autorest.AsPut(),
  1979  		autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters),
  1980  		autorest.WithPathParameters("/webhdfs/v1/{setPermissionFilePath}", pathParameters),
  1981  		autorest.WithQueryParameters(queryParameters))
  1982  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1983  }
  1984  
  1985  // SetPermissionSender sends the SetPermission request. The method will close the
  1986  // http.Response Body if it receives an error.
  1987  func (client Client) SetPermissionSender(req *http.Request) (*http.Response, error) {
  1988  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1989  }
  1990  
  1991  // SetPermissionResponder handles the response to the SetPermission request. The method always
  1992  // closes the http.Response Body.
  1993  func (client Client) SetPermissionResponder(resp *http.Response) (result autorest.Response, err error) {
  1994  	err = autorest.Respond(
  1995  		resp,
  1996  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1997  		autorest.ByClosing())
  1998  	result.Response = resp
  1999  	return
  2000  }
  2001  

View as plain text