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