-
Notifications
You must be signed in to change notification settings - Fork 814
/
path.go
1327 lines (1246 loc) · 72.1 KB
/
path.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package storagedatalake
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
import (
"context"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"github.com/Azure/go-autorest/tracing"
"io"
"net/http"
)
// PathClient is the azure Data Lake Storage provides storage for Hadoop and other big data workloads.
type PathClient struct {
BaseClient
}
// NewPathClient creates an instance of the PathClient client.
func NewPathClient(xMsVersion string, accountName string) PathClient {
return PathClient{New(xMsVersion, accountName)}
}
// Create create or rename a file or directory. By default, the destination is overwritten and if the destination
// already exists and has a lease the lease is broken. This operation supports conditional HTTP requests. For more
// information, see [Specifying Conditional Headers for Blob Service
// Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations).
// To fail if the destination already exists, use a conditional request with If-None-Match: "*".
// Parameters:
// filesystem - the filesystem identifier.
// pathParameter - the file or directory path.
// resource - required only for Create File and Create Directory. The value must be "file" or "directory".
// continuation - optional. When renaming a directory, the number of paths that are renamed with each
// invocation is limited. If the number of paths to be renamed exceeds this limit, a continuation token is
// returned in this response header. When a continuation token is returned in the response, it must be
// specified in a subsequent invocation of the rename operation to continue renaming the directory.
// mode - optional. Valid only when namespace is enabled. This parameter determines the behavior of the rename
// operation. The value must be "legacy" or "posix", and the default value will be "posix".
// cacheControl - optional. The service stores this value and includes it in the "Cache-Control" response
// header for "Read File" operations for "Read File" operations.
// contentEncoding - optional. Specifies which content encodings have been applied to the file. This value is
// returned to the client when the "Read File" operation is performed.
// contentLanguage - optional. Specifies the natural language used by the intended audience for the file.
// contentDisposition - optional. The service stores this value and includes it in the "Content-Disposition"
// response header for "Read File" operations.
// xMsCacheControl - optional. The service stores this value and includes it in the "Cache-Control" response
// header for "Read File" operations.
// xMsContentType - optional. The service stores this value and includes it in the "Content-Type" response
// header for "Read File" operations.
// xMsContentEncoding - optional. The service stores this value and includes it in the "Content-Encoding"
// response header for "Read File" operations.
// xMsContentLanguage - optional. The service stores this value and includes it in the "Content-Language"
// response header for "Read File" operations.
// xMsContentDisposition - optional. The service stores this value and includes it in the
// "Content-Disposition" response header for "Read File" operations.
// xMsRenameSource - an optional file or directory to be renamed. The value must have the following format:
// "/{filesystem}/{path}". If "x-ms-properties" is specified, the properties will overwrite the existing
// properties; otherwise, the existing properties will be preserved.
// xMsLeaseID - optional. A lease ID for the path specified in the URI. The path to be overwritten must have
// an active lease and the lease ID must match.
// xMsProposedLeaseID - optional for create operations. Required when "x-ms-lease-action" is used. A lease
// will be acquired using the proposed ID when the resource is created.
// xMsSourceLeaseID - optional for rename operations. A lease ID for the source path. The source path must
// have an active lease and the lease ID must match.
// xMsProperties - optional. User-defined properties to be stored with the file or directory, in the format of
// a comma-separated list of name and value pairs "n1=v1, n2=v2, ...", where each value is base64 encoded.
// xMsPermissions - optional and only valid if Hierarchical Namespace is enabled for the account. Sets POSIX
// access permissions for the file owner, the file owning group, and others. Each class may be granted read,
// write, or execute permission. The sticky bit is also supported. Both symbolic (rwxrw-rw-) and 4-digit
// octal notation (e.g. 0766) are supported.
// ifMatch - optional. An ETag value. Specify this header to perform the operation only if the resource's ETag
// matches the value specified. The ETag must be specified in quotes.
// ifNoneMatch - optional. An ETag value or the special wildcard ("*") value. Specify this header to perform
// the operation only if the resource's ETag does not match the value specified. The ETag must be specified in
// quotes.
// ifModifiedSince - optional. A date and time value. Specify this header to perform the operation only if the
// resource has been modified since the specified date and time.
// ifUnmodifiedSince - optional. A date and time value. Specify this header to perform the operation only if
// the resource has not been modified since the specified date and time.
// xMsSourceIfMatch - optional. An ETag value. Specify this header to perform the rename operation only if the
// source's ETag matches the value specified. The ETag must be specified in quotes.
// xMsSourceIfNoneMatch - optional. An ETag value or the special wildcard ("*") value. Specify this header to
// perform the rename operation only if the source's ETag does not match the value specified. The ETag must be
// specified in quotes.
// xMsSourceIfModifiedSince - optional. A date and time value. Specify this header to perform the rename
// operation only if the source has been modified since the specified date and time.
// xMsSourceIfUnmodifiedSince - optional. A date and time value. Specify this header to perform the rename
// operation only if the source has not been modified since the specified date and time.
// xMsClientRequestID - a UUID recorded in the analytics logs for troubleshooting and correlation.
// timeout - an optional operation timeout value in seconds. The period begins when the request is received by
// the service. If the timeout value elapses before the operation completes, the operation fails.
// xMsDate - specifies the Coordinated Universal Time (UTC) for the request. This is required when using
// shared key authorization.
func (client PathClient) Create(ctx context.Context, filesystem string, pathParameter string, resource PathResourceType, continuation string, mode PathRenameMode, cacheControl string, contentEncoding string, contentLanguage string, contentDisposition string, xMsCacheControl string, xMsContentType string, xMsContentEncoding string, xMsContentLanguage string, xMsContentDisposition string, xMsRenameSource string, xMsLeaseID string, xMsProposedLeaseID string, xMsSourceLeaseID string, xMsProperties string, xMsPermissions string, ifMatch string, ifNoneMatch string, ifModifiedSince string, ifUnmodifiedSince string, xMsSourceIfMatch string, xMsSourceIfNoneMatch string, xMsSourceIfModifiedSince string, xMsSourceIfUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (result autorest.Response, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/PathClient.Create")
defer func() {
sc := -1
if result.Response != nil {
sc = result.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: xMsLeaseID,
Constraints: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Empty, Rule: false,
Chain: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
{TargetValue: xMsProposedLeaseID,
Constraints: []validation.Constraint{{Target: "xMsProposedLeaseID", Name: validation.Empty, Rule: false,
Chain: []validation.Constraint{{Target: "xMsProposedLeaseID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
{TargetValue: xMsSourceLeaseID,
Constraints: []validation.Constraint{{Target: "xMsSourceLeaseID", Name: validation.Empty, Rule: false,
Chain: []validation.Constraint{{Target: "xMsSourceLeaseID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
{TargetValue: filesystem,
Constraints: []validation.Constraint{{Target: "filesystem", Name: validation.MaxLength, Rule: 63, Chain: nil},
{Target: "filesystem", Name: validation.MinLength, Rule: 3, Chain: nil}}},
{TargetValue: xMsClientRequestID,
Constraints: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Empty, Rule: false,
Chain: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
{TargetValue: timeout,
Constraints: []validation.Constraint{{Target: "timeout", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "timeout", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}}); err != nil {
return result, validation.NewError("storagedatalake.PathClient", "Create", err.Error())
}
req, err := client.CreatePreparer(ctx, filesystem, pathParameter, resource, continuation, mode, cacheControl, contentEncoding, contentLanguage, contentDisposition, xMsCacheControl, xMsContentType, xMsContentEncoding, xMsContentLanguage, xMsContentDisposition, xMsRenameSource, xMsLeaseID, xMsProposedLeaseID, xMsSourceLeaseID, xMsProperties, xMsPermissions, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince, xMsSourceIfMatch, xMsSourceIfNoneMatch, xMsSourceIfModifiedSince, xMsSourceIfUnmodifiedSince, xMsClientRequestID, timeout, xMsDate)
if err != nil {
err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Create", nil, "Failure preparing request")
return
}
resp, err := client.CreateSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Create", resp, "Failure sending request")
return
}
result, err = client.CreateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Create", resp, "Failure responding to request")
return
}
return
}
// CreatePreparer prepares the Create request.
func (client PathClient) CreatePreparer(ctx context.Context, filesystem string, pathParameter string, resource PathResourceType, continuation string, mode PathRenameMode, cacheControl string, contentEncoding string, contentLanguage string, contentDisposition string, xMsCacheControl string, xMsContentType string, xMsContentEncoding string, xMsContentLanguage string, xMsContentDisposition string, xMsRenameSource string, xMsLeaseID string, xMsProposedLeaseID string, xMsSourceLeaseID string, xMsProperties string, xMsPermissions string, ifMatch string, ifNoneMatch string, ifModifiedSince string, ifUnmodifiedSince string, xMsSourceIfMatch string, xMsSourceIfNoneMatch string, xMsSourceIfModifiedSince string, xMsSourceIfUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (*http.Request, error) {
urlParameters := map[string]interface{}{
"accountName": client.AccountName,
"dnsSuffix": client.DNSSuffix,
}
pathParameters := map[string]interface{}{
"filesystem": autorest.Encode("path", filesystem),
"path": autorest.Encode("path", pathParameter),
}
queryParameters := map[string]interface{}{}
if len(string(resource)) > 0 {
queryParameters["resource"] = autorest.Encode("query", resource)
}
if len(continuation) > 0 {
queryParameters["continuation"] = autorest.Encode("query", continuation)
}
if len(string(mode)) > 0 {
queryParameters["mode"] = autorest.Encode("query", mode)
}
if timeout != nil {
queryParameters["timeout"] = autorest.Encode("query", *timeout)
}
preparer := autorest.CreatePreparer(
autorest.AsPut(),
autorest.WithCustomBaseURL("https://{accountName}.{dnsSuffix}", urlParameters),
autorest.WithPathParameters("/{filesystem}/{path}", pathParameters),
autorest.WithQueryParameters(queryParameters))
if len(cacheControl) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("Cache-Control", autorest.String(cacheControl)))
}
if len(contentEncoding) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("Content-Encoding", autorest.String(contentEncoding)))
}
if len(contentLanguage) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("Content-Language", autorest.String(contentLanguage)))
}
if len(contentDisposition) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("Content-Disposition", autorest.String(contentDisposition)))
}
if len(xMsCacheControl) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-cache-control", autorest.String(xMsCacheControl)))
}
if len(xMsContentType) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-content-type", autorest.String(xMsContentType)))
}
if len(xMsContentEncoding) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-content-encoding", autorest.String(xMsContentEncoding)))
}
if len(xMsContentLanguage) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-content-language", autorest.String(xMsContentLanguage)))
}
if len(xMsContentDisposition) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-content-disposition", autorest.String(xMsContentDisposition)))
}
if len(xMsRenameSource) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-rename-source", autorest.String(xMsRenameSource)))
}
if len(xMsLeaseID) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-lease-id", autorest.String(xMsLeaseID)))
}
if len(xMsProposedLeaseID) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-proposed-lease-id", autorest.String(xMsProposedLeaseID)))
}
if len(xMsSourceLeaseID) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-source-lease-id", autorest.String(xMsSourceLeaseID)))
}
if len(xMsProperties) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-properties", autorest.String(xMsProperties)))
}
if len(xMsPermissions) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-permissions", autorest.String(xMsPermissions)))
}
if len(ifMatch) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("If-Match", autorest.String(ifMatch)))
}
if len(ifNoneMatch) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch)))
}
if len(ifModifiedSince) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince)))
}
if len(ifUnmodifiedSince) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince)))
}
if len(xMsSourceIfMatch) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-source-if-match", autorest.String(xMsSourceIfMatch)))
}
if len(xMsSourceIfNoneMatch) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-source-if-none-match", autorest.String(xMsSourceIfNoneMatch)))
}
if len(xMsSourceIfModifiedSince) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-source-if-modified-since", autorest.String(xMsSourceIfModifiedSince)))
}
if len(xMsSourceIfUnmodifiedSince) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-source-if-unmodified-since", autorest.String(xMsSourceIfUnmodifiedSince)))
}
if len(xMsClientRequestID) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-client-request-id", autorest.String(xMsClientRequestID)))
}
if len(xMsDate) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-date", autorest.String(xMsDate)))
}
if len(client.XMsVersion) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-version", autorest.String(client.XMsVersion)))
}
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// CreateSender sends the Create request. The method will close the
// http.Response Body if it receives an error.
func (client PathClient) CreateSender(req *http.Request) (*http.Response, error) {
return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
}
// CreateResponder handles the response to the Create request. The method always
// closes the http.Response Body.
func (client PathClient) CreateResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
autorest.ByClosing())
result.Response = resp
return
}
// Delete delete the file or directory. This operation supports conditional HTTP requests. For more information, see
// [Specifying Conditional Headers for Blob Service
// Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations).
// Parameters:
// filesystem - the filesystem identifier.
// pathParameter - the file or directory path.
// recursive - required and valid only when the resource is a directory. If "true", all paths beneath the
// directory will be deleted. If "false" and the directory is non-empty, an error occurs.
// continuation - optional. When deleting a directory, the number of paths that are deleted with each
// invocation is limited. If the number of paths to be deleted exceeds this limit, a continuation token is
// returned in this response header. When a continuation token is returned in the response, it must be
// specified in a subsequent invocation of the delete operation to continue deleting the directory.
// xMsLeaseID - the lease ID must be specified if there is an active lease.
// ifMatch - optional. An ETag value. Specify this header to perform the operation only if the resource's ETag
// matches the value specified. The ETag must be specified in quotes.
// ifNoneMatch - optional. An ETag value or the special wildcard ("*") value. Specify this header to perform
// the operation only if the resource's ETag does not match the value specified. The ETag must be specified in
// quotes.
// ifModifiedSince - optional. A date and time value. Specify this header to perform the operation only if the
// resource has been modified since the specified date and time.
// ifUnmodifiedSince - optional. A date and time value. Specify this header to perform the operation only if
// the resource has not been modified since the specified date and time.
// xMsClientRequestID - a UUID recorded in the analytics logs for troubleshooting and correlation.
// timeout - an optional operation timeout value in seconds. The period begins when the request is received by
// the service. If the timeout value elapses before the operation completes, the operation fails.
// xMsDate - specifies the Coordinated Universal Time (UTC) for the request. This is required when using
// shared key authorization.
func (client PathClient) Delete(ctx context.Context, filesystem string, pathParameter string, recursive *bool, continuation string, xMsLeaseID string, ifMatch string, ifNoneMatch string, ifModifiedSince string, ifUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (result autorest.Response, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/PathClient.Delete")
defer func() {
sc := -1
if result.Response != nil {
sc = result.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: xMsLeaseID,
Constraints: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Empty, Rule: false,
Chain: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
{TargetValue: filesystem,
Constraints: []validation.Constraint{{Target: "filesystem", Name: validation.MaxLength, Rule: 63, Chain: nil},
{Target: "filesystem", Name: validation.MinLength, Rule: 3, Chain: nil}}},
{TargetValue: xMsClientRequestID,
Constraints: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Empty, Rule: false,
Chain: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
{TargetValue: timeout,
Constraints: []validation.Constraint{{Target: "timeout", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "timeout", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}}); err != nil {
return result, validation.NewError("storagedatalake.PathClient", "Delete", err.Error())
}
req, err := client.DeletePreparer(ctx, filesystem, pathParameter, recursive, continuation, xMsLeaseID, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince, xMsClientRequestID, timeout, xMsDate)
if err != nil {
err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Delete", resp, "Failure sending request")
return
}
result, err = client.DeleteResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Delete", resp, "Failure responding to request")
return
}
return
}
// DeletePreparer prepares the Delete request.
func (client PathClient) DeletePreparer(ctx context.Context, filesystem string, pathParameter string, recursive *bool, continuation string, xMsLeaseID string, ifMatch string, ifNoneMatch string, ifModifiedSince string, ifUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (*http.Request, error) {
urlParameters := map[string]interface{}{
"accountName": client.AccountName,
"dnsSuffix": client.DNSSuffix,
}
pathParameters := map[string]interface{}{
"filesystem": autorest.Encode("path", filesystem),
"path": autorest.Encode("path", pathParameter),
}
queryParameters := map[string]interface{}{}
if recursive != nil {
queryParameters["recursive"] = autorest.Encode("query", *recursive)
}
if len(continuation) > 0 {
queryParameters["continuation"] = autorest.Encode("query", continuation)
}
if timeout != nil {
queryParameters["timeout"] = autorest.Encode("query", *timeout)
}
preparer := autorest.CreatePreparer(
autorest.AsDelete(),
autorest.WithCustomBaseURL("https://{accountName}.{dnsSuffix}", urlParameters),
autorest.WithPathParameters("/{filesystem}/{path}", pathParameters),
autorest.WithQueryParameters(queryParameters))
if len(xMsLeaseID) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-lease-id", autorest.String(xMsLeaseID)))
}
if len(ifMatch) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("If-Match", autorest.String(ifMatch)))
}
if len(ifNoneMatch) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch)))
}
if len(ifModifiedSince) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince)))
}
if len(ifUnmodifiedSince) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince)))
}
if len(xMsClientRequestID) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-client-request-id", autorest.String(xMsClientRequestID)))
}
if len(xMsDate) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-date", autorest.String(xMsDate)))
}
if len(client.XMsVersion) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-version", autorest.String(client.XMsVersion)))
}
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error.
func (client PathClient) DeleteSender(req *http.Request) (*http.Response, error) {
return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
}
// DeleteResponder handles the response to the Delete request. The method always
// closes the http.Response Body.
func (client PathClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByClosing())
result.Response = resp
return
}
// GetProperties get the properties for a file or directory, and optionally include the access control list. This
// operation supports conditional HTTP requests. For more information, see [Specifying Conditional Headers for Blob
// Service
// Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations).
// Parameters:
// filesystem - the filesystem identifier.
// pathParameter - the file or directory path.
// action - optional. If the value is "getAccessControl" the access control list is returned in the response
// headers (Hierarchical Namespace must be enabled for the account).
// ifMatch - optional. An ETag value. Specify this header to perform the operation only if the resource's ETag
// matches the value specified. The ETag must be specified in quotes.
// ifNoneMatch - optional. An ETag value or the special wildcard ("*") value. Specify this header to perform
// the operation only if the resource's ETag does not match the value specified. The ETag must be specified in
// quotes.
// ifModifiedSince - optional. A date and time value. Specify this header to perform the operation only if the
// resource has been modified since the specified date and time.
// ifUnmodifiedSince - optional. A date and time value. Specify this header to perform the operation only if
// the resource has not been modified since the specified date and time.
// xMsClientRequestID - a UUID recorded in the analytics logs for troubleshooting and correlation.
// timeout - an optional operation timeout value in seconds. The period begins when the request is received by
// the service. If the timeout value elapses before the operation completes, the operation fails.
// xMsDate - specifies the Coordinated Universal Time (UTC) for the request. This is required when using
// shared key authorization.
func (client PathClient) GetProperties(ctx context.Context, filesystem string, pathParameter string, action PathGetPropertiesAction, ifMatch string, ifNoneMatch string, ifModifiedSince string, ifUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (result autorest.Response, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/PathClient.GetProperties")
defer func() {
sc := -1
if result.Response != nil {
sc = result.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: filesystem,
Constraints: []validation.Constraint{{Target: "filesystem", Name: validation.MaxLength, Rule: 63, Chain: nil},
{Target: "filesystem", Name: validation.MinLength, Rule: 3, Chain: nil}}},
{TargetValue: xMsClientRequestID,
Constraints: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Empty, Rule: false,
Chain: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
{TargetValue: timeout,
Constraints: []validation.Constraint{{Target: "timeout", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "timeout", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}}); err != nil {
return result, validation.NewError("storagedatalake.PathClient", "GetProperties", err.Error())
}
req, err := client.GetPropertiesPreparer(ctx, filesystem, pathParameter, action, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince, xMsClientRequestID, timeout, xMsDate)
if err != nil {
err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "GetProperties", nil, "Failure preparing request")
return
}
resp, err := client.GetPropertiesSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "GetProperties", resp, "Failure sending request")
return
}
result, err = client.GetPropertiesResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "GetProperties", resp, "Failure responding to request")
return
}
return
}
// GetPropertiesPreparer prepares the GetProperties request.
func (client PathClient) GetPropertiesPreparer(ctx context.Context, filesystem string, pathParameter string, action PathGetPropertiesAction, ifMatch string, ifNoneMatch string, ifModifiedSince string, ifUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (*http.Request, error) {
urlParameters := map[string]interface{}{
"accountName": client.AccountName,
"dnsSuffix": client.DNSSuffix,
}
pathParameters := map[string]interface{}{
"filesystem": autorest.Encode("path", filesystem),
"path": autorest.Encode("path", pathParameter),
}
queryParameters := map[string]interface{}{}
if len(string(action)) > 0 {
queryParameters["action"] = autorest.Encode("query", action)
}
if timeout != nil {
queryParameters["timeout"] = autorest.Encode("query", *timeout)
}
preparer := autorest.CreatePreparer(
autorest.AsHead(),
autorest.WithCustomBaseURL("https://{accountName}.{dnsSuffix}", urlParameters),
autorest.WithPathParameters("/{filesystem}/{path}", pathParameters),
autorest.WithQueryParameters(queryParameters))
if len(ifMatch) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("If-Match", autorest.String(ifMatch)))
}
if len(ifNoneMatch) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch)))
}
if len(ifModifiedSince) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince)))
}
if len(ifUnmodifiedSince) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince)))
}
if len(xMsClientRequestID) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-client-request-id", autorest.String(xMsClientRequestID)))
}
if len(xMsDate) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-date", autorest.String(xMsDate)))
}
if len(client.XMsVersion) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-version", autorest.String(client.XMsVersion)))
}
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// GetPropertiesSender sends the GetProperties request. The method will close the
// http.Response Body if it receives an error.
func (client PathClient) GetPropertiesSender(req *http.Request) (*http.Response, error) {
return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
}
// GetPropertiesResponder handles the response to the GetProperties request. The method always
// closes the http.Response Body.
func (client PathClient) GetPropertiesResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByClosing())
result.Response = resp
return
}
// Lease create and manage a lease to restrict write and delete access to the path. This operation supports conditional
// HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service
// Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations).
// Parameters:
// xMsLeaseAction - there are five lease actions: "acquire", "break", "change", "renew", and "release". Use
// "acquire" and specify the "x-ms-proposed-lease-id" and "x-ms-lease-duration" to acquire a new lease. Use
// "break" to break an existing lease. When a lease is broken, the lease break period is allowed to elapse,
// during which time no lease operation except break and release can be performed on the file. When a lease is
// successfully broken, the response indicates the interval in seconds until a new lease can be acquired. Use
// "change" and specify the current lease ID in "x-ms-lease-id" and the new lease ID in
// "x-ms-proposed-lease-id" to change the lease ID of an active lease. Use "renew" and specify the
// "x-ms-lease-id" to renew an existing lease. Use "release" and specify the "x-ms-lease-id" to release a
// lease.
// filesystem - the filesystem identifier.
// pathParameter - the file or directory path.
// xMsLeaseDuration - the lease duration is required to acquire a lease, and specifies the duration of the
// lease in seconds. The lease duration must be between 15 and 60 seconds or -1 for infinite lease.
// xMsLeaseBreakPeriod - the lease break period duration is optional to break a lease, and specifies the break
// period of the lease in seconds. The lease break duration must be between 0 and 60 seconds.
// xMsLeaseID - required when "x-ms-lease-action" is "renew", "change" or "release". For the renew and release
// actions, this must match the current lease ID.
// xMsProposedLeaseID - required when "x-ms-lease-action" is "acquire" or "change". A lease will be acquired
// with this lease ID if the operation is successful.
// ifMatch - optional. An ETag value. Specify this header to perform the operation only if the resource's ETag
// matches the value specified. The ETag must be specified in quotes.
// ifNoneMatch - optional. An ETag value or the special wildcard ("*") value. Specify this header to perform
// the operation only if the resource's ETag does not match the value specified. The ETag must be specified in
// quotes.
// ifModifiedSince - optional. A date and time value. Specify this header to perform the operation only if the
// resource has been modified since the specified date and time.
// ifUnmodifiedSince - optional. A date and time value. Specify this header to perform the operation only if
// the resource has not been modified since the specified date and time.
// xMsClientRequestID - a UUID recorded in the analytics logs for troubleshooting and correlation.
// timeout - an optional operation timeout value in seconds. The period begins when the request is received by
// the service. If the timeout value elapses before the operation completes, the operation fails.
// xMsDate - specifies the Coordinated Universal Time (UTC) for the request. This is required when using
// shared key authorization.
func (client PathClient) Lease(ctx context.Context, xMsLeaseAction PathLeaseAction, filesystem string, pathParameter string, xMsLeaseDuration *int32, xMsLeaseBreakPeriod *int32, xMsLeaseID string, xMsProposedLeaseID string, ifMatch string, ifNoneMatch string, ifModifiedSince string, ifUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (result autorest.Response, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/PathClient.Lease")
defer func() {
sc := -1
if result.Response != nil {
sc = result.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: xMsLeaseID,
Constraints: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Empty, Rule: false,
Chain: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
{TargetValue: xMsProposedLeaseID,
Constraints: []validation.Constraint{{Target: "xMsProposedLeaseID", Name: validation.Empty, Rule: false,
Chain: []validation.Constraint{{Target: "xMsProposedLeaseID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
{TargetValue: filesystem,
Constraints: []validation.Constraint{{Target: "filesystem", Name: validation.MaxLength, Rule: 63, Chain: nil},
{Target: "filesystem", Name: validation.MinLength, Rule: 3, Chain: nil}}},
{TargetValue: xMsClientRequestID,
Constraints: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Empty, Rule: false,
Chain: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
{TargetValue: timeout,
Constraints: []validation.Constraint{{Target: "timeout", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "timeout", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}}); err != nil {
return result, validation.NewError("storagedatalake.PathClient", "Lease", err.Error())
}
req, err := client.LeasePreparer(ctx, xMsLeaseAction, filesystem, pathParameter, xMsLeaseDuration, xMsLeaseBreakPeriod, xMsLeaseID, xMsProposedLeaseID, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince, xMsClientRequestID, timeout, xMsDate)
if err != nil {
err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Lease", nil, "Failure preparing request")
return
}
resp, err := client.LeaseSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Lease", resp, "Failure sending request")
return
}
result, err = client.LeaseResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Lease", resp, "Failure responding to request")
return
}
return
}
// LeasePreparer prepares the Lease request.
func (client PathClient) LeasePreparer(ctx context.Context, xMsLeaseAction PathLeaseAction, filesystem string, pathParameter string, xMsLeaseDuration *int32, xMsLeaseBreakPeriod *int32, xMsLeaseID string, xMsProposedLeaseID string, ifMatch string, ifNoneMatch string, ifModifiedSince string, ifUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (*http.Request, error) {
urlParameters := map[string]interface{}{
"accountName": client.AccountName,
"dnsSuffix": client.DNSSuffix,
}
pathParameters := map[string]interface{}{
"filesystem": autorest.Encode("path", filesystem),
"path": autorest.Encode("path", pathParameter),
}
queryParameters := map[string]interface{}{}
if timeout != nil {
queryParameters["timeout"] = autorest.Encode("query", *timeout)
}
preparer := autorest.CreatePreparer(
autorest.AsPost(),
autorest.WithCustomBaseURL("https://{accountName}.{dnsSuffix}", urlParameters),
autorest.WithPathParameters("/{filesystem}/{path}", pathParameters),
autorest.WithQueryParameters(queryParameters),
autorest.WithHeader("x-ms-lease-action", autorest.String(xMsLeaseAction)))
if xMsLeaseDuration != nil {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-lease-duration", autorest.String(*xMsLeaseDuration)))
}
if xMsLeaseBreakPeriod != nil {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-lease-break-period", autorest.String(*xMsLeaseBreakPeriod)))
}
if len(xMsLeaseID) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-lease-id", autorest.String(xMsLeaseID)))
}
if len(xMsProposedLeaseID) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-proposed-lease-id", autorest.String(xMsProposedLeaseID)))
}
if len(ifMatch) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("If-Match", autorest.String(ifMatch)))
}
if len(ifNoneMatch) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch)))
}
if len(ifModifiedSince) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince)))
}
if len(ifUnmodifiedSince) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince)))
}
if len(xMsClientRequestID) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-client-request-id", autorest.String(xMsClientRequestID)))
}
if len(xMsDate) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-date", autorest.String(xMsDate)))
}
if len(client.XMsVersion) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-version", autorest.String(client.XMsVersion)))
}
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// LeaseSender sends the Lease request. The method will close the
// http.Response Body if it receives an error.
func (client PathClient) LeaseSender(req *http.Request) (*http.Response, error) {
return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
}
// LeaseResponder handles the response to the Lease request. The method always
// closes the http.Response Body.
func (client PathClient) LeaseResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted),
autorest.ByClosing())
result.Response = resp
return
}
// List list filesystem paths and their properties.
// Parameters:
// recursive - if "true", all paths are listed; otherwise, only paths at the root of the filesystem are listed.
// If "directory" is specified, the list will only include paths that share the same root.
// filesystem - the filesystem identifier. The value must start and end with a letter or number and must
// contain only letters, numbers, and the dash (-) character. Consecutive dashes are not permitted. All
// letters must be lowercase. The value must have between 3 and 63 characters.
// directory - filters results to paths within the specified directory. An error occurs if the directory does
// not exist.
// continuation - the number of paths returned with each invocation is limited. If the number of paths to be
// returned exceeds this limit, a continuation token is returned in the response header x-ms-continuation. When
// a continuation token is returned in the response, it must be specified in a subsequent invocation of the
// list operation to continue listing the paths.
// maxResults - an optional value that specifies the maximum number of items to return. If omitted or greater
// than 5,000, the response will include up to 5,000 items.
// xMsClientRequestID - a UUID recorded in the analytics logs for troubleshooting and correlation.
// timeout - an optional operation timeout value in seconds. The period begins when the request is received by
// the service. If the timeout value elapses before the operation completes, the operation fails.
// xMsDate - specifies the Coordinated Universal Time (UTC) for the request. This is required when using
// shared key authorization.
func (client PathClient) List(ctx context.Context, recursive bool, filesystem string, directory string, continuation string, maxResults *int32, xMsClientRequestID string, timeout *int32, xMsDate string) (result PathList, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/PathClient.List")
defer func() {
sc := -1
if result.Response.Response != nil {
sc = result.Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: maxResults,
Constraints: []validation.Constraint{{Target: "maxResults", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "maxResults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}},
{TargetValue: xMsClientRequestID,
Constraints: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Empty, Rule: false,
Chain: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
{TargetValue: timeout,
Constraints: []validation.Constraint{{Target: "timeout", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "timeout", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}}); err != nil {
return result, validation.NewError("storagedatalake.PathClient", "List", err.Error())
}
req, err := client.ListPreparer(ctx, recursive, filesystem, directory, continuation, maxResults, xMsClientRequestID, timeout, xMsDate)
if err != nil {
err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "List", nil, "Failure preparing request")
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "List", resp, "Failure sending request")
return
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "List", resp, "Failure responding to request")
return
}
return
}
// ListPreparer prepares the List request.
func (client PathClient) ListPreparer(ctx context.Context, recursive bool, filesystem string, directory string, continuation string, maxResults *int32, xMsClientRequestID string, timeout *int32, xMsDate string) (*http.Request, error) {
urlParameters := map[string]interface{}{
"accountName": client.AccountName,
"dnsSuffix": client.DNSSuffix,
}
pathParameters := map[string]interface{}{
"filesystem": autorest.Encode("path", filesystem),
}
queryParameters := map[string]interface{}{
"recursive": autorest.Encode("query", recursive),
"resource": autorest.Encode("query", "filesystem"),
}
if len(directory) > 0 {
queryParameters["directory"] = autorest.Encode("query", directory)
}
if len(continuation) > 0 {
queryParameters["continuation"] = autorest.Encode("query", continuation)
}
if maxResults != nil {
queryParameters["maxResults"] = autorest.Encode("query", *maxResults)
}
if timeout != nil {
queryParameters["timeout"] = autorest.Encode("query", *timeout)
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithCustomBaseURL("https://{accountName}.{dnsSuffix}", urlParameters),
autorest.WithPathParameters("/{filesystem}", pathParameters),
autorest.WithQueryParameters(queryParameters))
if len(xMsClientRequestID) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-client-request-id", autorest.String(xMsClientRequestID)))
}
if len(xMsDate) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-date", autorest.String(xMsDate)))
}
if len(client.XMsVersion) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-version", autorest.String(client.XMsVersion)))
}
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client PathClient) ListSender(req *http.Request) (*http.Response, error) {
return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
}
// ListResponder handles the response to the List request. The method always
// closes the http.Response Body.
func (client PathClient) ListResponder(resp *http.Response) (result PathList, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// Read read the contents of a file. For read operations, range requests are supported. This operation supports
// conditional HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service
// Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations).
// Parameters:
// filesystem - the filesystem identifier.
// pathParameter - the file or directory path.
// rangeParameter - the HTTP Range request header specifies one or more byte ranges of the resource to be
// retrieved.
// ifMatch - optional. An ETag value. Specify this header to perform the operation only if the resource's ETag
// matches the value specified. The ETag must be specified in quotes.
// ifNoneMatch - optional. An ETag value or the special wildcard ("*") value. Specify this header to perform
// the operation only if the resource's ETag does not match the value specified. The ETag must be specified in
// quotes.
// ifModifiedSince - optional. A date and time value. Specify this header to perform the operation only if the
// resource has been modified since the specified date and time.
// ifUnmodifiedSince - optional. A date and time value. Specify this header to perform the operation only if
// the resource has not been modified since the specified date and time.
// xMsClientRequestID - a UUID recorded in the analytics logs for troubleshooting and correlation.
// timeout - an optional operation timeout value in seconds. The period begins when the request is received by
// the service. If the timeout value elapses before the operation completes, the operation fails.
// xMsDate - specifies the Coordinated Universal Time (UTC) for the request. This is required when using
// shared key authorization.
func (client PathClient) Read(ctx context.Context, filesystem string, pathParameter string, rangeParameter string, ifMatch string, ifNoneMatch string, ifModifiedSince string, ifUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (result ReadCloser, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/PathClient.Read")
defer func() {
sc := -1
if result.Response.Response != nil {
sc = result.Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: filesystem,
Constraints: []validation.Constraint{{Target: "filesystem", Name: validation.MaxLength, Rule: 63, Chain: nil},
{Target: "filesystem", Name: validation.MinLength, Rule: 3, Chain: nil}}},
{TargetValue: xMsClientRequestID,
Constraints: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Empty, Rule: false,
Chain: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
{TargetValue: timeout,
Constraints: []validation.Constraint{{Target: "timeout", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "timeout", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}}); err != nil {
return result, validation.NewError("storagedatalake.PathClient", "Read", err.Error())
}
req, err := client.ReadPreparer(ctx, filesystem, pathParameter, rangeParameter, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince, xMsClientRequestID, timeout, xMsDate)
if err != nil {
err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Read", nil, "Failure preparing request")
return
}
resp, err := client.ReadSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Read", resp, "Failure sending request")
return
}
result, err = client.ReadResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Read", resp, "Failure responding to request")
return
}
return
}
// ReadPreparer prepares the Read request.
func (client PathClient) ReadPreparer(ctx context.Context, filesystem string, pathParameter string, rangeParameter string, ifMatch string, ifNoneMatch string, ifModifiedSince string, ifUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (*http.Request, error) {
urlParameters := map[string]interface{}{
"accountName": client.AccountName,
"dnsSuffix": client.DNSSuffix,
}
pathParameters := map[string]interface{}{
"filesystem": autorest.Encode("path", filesystem),
"path": autorest.Encode("path", pathParameter),
}
queryParameters := map[string]interface{}{}
if timeout != nil {
queryParameters["timeout"] = autorest.Encode("query", *timeout)
}
preparer := autorest.CreatePreparer(