1 package storagedatalake
2
3
4
5
6
7
8
9 import (
10 "context"
11 "github.com/Azure/go-autorest/autorest"
12 "github.com/Azure/go-autorest/autorest/azure"
13 "github.com/Azure/go-autorest/autorest/validation"
14 "github.com/Azure/go-autorest/tracing"
15 "io"
16 "net/http"
17 )
18
19
20 type PathClient struct {
21 BaseClient
22 }
23
24
25 func NewPathClient(xMsVersion string, accountName string) PathClient {
26 return PathClient{New(xMsVersion, accountName)}
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 func (client PathClient) Create(ctx context.Context, filesystem string, pathParameter string, resource PathResourceType, continuation string, mode PathRenameMode, cacheControl string, contentEncoding string, contentLanguage string, contentDisposition string, xMsCacheControl string, xMsContentType string, xMsContentEncoding string, xMsContentLanguage string, xMsContentDisposition string, xMsRenameSource string, xMsLeaseID string, xMsSourceLeaseID string, xMsProperties string, xMsPermissions string, xMsUmask string, ifMatch string, ifNoneMatch string, ifModifiedSince string, ifUnmodifiedSince string, xMsSourceIfMatch string, xMsSourceIfNoneMatch string, xMsSourceIfModifiedSince string, xMsSourceIfUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (result autorest.Response, err error) {
106 if tracing.IsEnabled() {
107 ctx = tracing.StartSpan(ctx, fqdn+"/PathClient.Create")
108 defer func() {
109 sc := -1
110 if result.Response != nil {
111 sc = result.Response.StatusCode
112 }
113 tracing.EndSpan(ctx, sc, err)
114 }()
115 }
116 if err := validation.Validate([]validation.Validation{
117 {TargetValue: xMsLeaseID,
118 Constraints: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Empty, Rule: false,
119 Chain: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
120 {TargetValue: xMsSourceLeaseID,
121 Constraints: []validation.Constraint{{Target: "xMsSourceLeaseID", Name: validation.Empty, Rule: false,
122 Chain: []validation.Constraint{{Target: "xMsSourceLeaseID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
123 {TargetValue: filesystem,
124 Constraints: []validation.Constraint{{Target: "filesystem", Name: validation.MaxLength, Rule: 63, Chain: nil},
125 {Target: "filesystem", Name: validation.MinLength, Rule: 3, Chain: nil}}},
126 {TargetValue: xMsClientRequestID,
127 Constraints: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Empty, Rule: false,
128 Chain: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
129 {TargetValue: timeout,
130 Constraints: []validation.Constraint{{Target: "timeout", Name: validation.Null, Rule: false,
131 Chain: []validation.Constraint{{Target: "timeout", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}}); err != nil {
132 return result, validation.NewError("storagedatalake.PathClient", "Create", err.Error())
133 }
134
135 req, err := client.CreatePreparer(ctx, filesystem, pathParameter, resource, continuation, mode, cacheControl, contentEncoding, contentLanguage, contentDisposition, xMsCacheControl, xMsContentType, xMsContentEncoding, xMsContentLanguage, xMsContentDisposition, xMsRenameSource, xMsLeaseID, xMsSourceLeaseID, xMsProperties, xMsPermissions, xMsUmask, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince, xMsSourceIfMatch, xMsSourceIfNoneMatch, xMsSourceIfModifiedSince, xMsSourceIfUnmodifiedSince, xMsClientRequestID, timeout, xMsDate)
136 if err != nil {
137 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Create", nil, "Failure preparing request")
138 return
139 }
140
141 resp, err := client.CreateSender(req)
142 if err != nil {
143 result.Response = resp
144 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Create", resp, "Failure sending request")
145 return
146 }
147
148 result, err = client.CreateResponder(resp)
149 if err != nil {
150 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Create", resp, "Failure responding to request")
151 return
152 }
153
154 return
155 }
156
157
158 func (client PathClient) CreatePreparer(ctx context.Context, filesystem string, pathParameter string, resource PathResourceType, continuation string, mode PathRenameMode, cacheControl string, contentEncoding string, contentLanguage string, contentDisposition string, xMsCacheControl string, xMsContentType string, xMsContentEncoding string, xMsContentLanguage string, xMsContentDisposition string, xMsRenameSource string, xMsLeaseID string, xMsSourceLeaseID string, xMsProperties string, xMsPermissions string, xMsUmask string, ifMatch string, ifNoneMatch string, ifModifiedSince string, ifUnmodifiedSince string, xMsSourceIfMatch string, xMsSourceIfNoneMatch string, xMsSourceIfModifiedSince string, xMsSourceIfUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (*http.Request, error) {
159 urlParameters := map[string]interface{}{
160 "accountName": client.AccountName,
161 "dnsSuffix": client.DNSSuffix,
162 }
163
164 pathParameters := map[string]interface{}{
165 "filesystem": autorest.Encode("path", filesystem),
166 "path": autorest.Encode("path", pathParameter),
167 }
168
169 queryParameters := map[string]interface{}{}
170 if len(string(resource)) > 0 {
171 queryParameters["resource"] = autorest.Encode("query", resource)
172 }
173 if len(continuation) > 0 {
174 queryParameters["continuation"] = autorest.Encode("query", continuation)
175 }
176 if len(string(mode)) > 0 {
177 queryParameters["mode"] = autorest.Encode("query", mode)
178 }
179 if timeout != nil {
180 queryParameters["timeout"] = autorest.Encode("query", *timeout)
181 }
182
183 preparer := autorest.CreatePreparer(
184 autorest.AsPut(),
185 autorest.WithCustomBaseURL("https://{accountName}.{dnsSuffix}", urlParameters),
186 autorest.WithPathParameters("/{filesystem}/{path}", pathParameters),
187 autorest.WithQueryParameters(queryParameters))
188 if len(cacheControl) > 0 {
189 preparer = autorest.DecoratePreparer(preparer,
190 autorest.WithHeader("Cache-Control", autorest.String(cacheControl)))
191 }
192 if len(contentEncoding) > 0 {
193 preparer = autorest.DecoratePreparer(preparer,
194 autorest.WithHeader("Content-Encoding", autorest.String(contentEncoding)))
195 }
196 if len(contentLanguage) > 0 {
197 preparer = autorest.DecoratePreparer(preparer,
198 autorest.WithHeader("Content-Language", autorest.String(contentLanguage)))
199 }
200 if len(contentDisposition) > 0 {
201 preparer = autorest.DecoratePreparer(preparer,
202 autorest.WithHeader("Content-Disposition", autorest.String(contentDisposition)))
203 }
204 if len(xMsCacheControl) > 0 {
205 preparer = autorest.DecoratePreparer(preparer,
206 autorest.WithHeader("x-ms-cache-control", autorest.String(xMsCacheControl)))
207 }
208 if len(xMsContentType) > 0 {
209 preparer = autorest.DecoratePreparer(preparer,
210 autorest.WithHeader("x-ms-content-type", autorest.String(xMsContentType)))
211 }
212 if len(xMsContentEncoding) > 0 {
213 preparer = autorest.DecoratePreparer(preparer,
214 autorest.WithHeader("x-ms-content-encoding", autorest.String(xMsContentEncoding)))
215 }
216 if len(xMsContentLanguage) > 0 {
217 preparer = autorest.DecoratePreparer(preparer,
218 autorest.WithHeader("x-ms-content-language", autorest.String(xMsContentLanguage)))
219 }
220 if len(xMsContentDisposition) > 0 {
221 preparer = autorest.DecoratePreparer(preparer,
222 autorest.WithHeader("x-ms-content-disposition", autorest.String(xMsContentDisposition)))
223 }
224 if len(xMsRenameSource) > 0 {
225 preparer = autorest.DecoratePreparer(preparer,
226 autorest.WithHeader("x-ms-rename-source", autorest.String(xMsRenameSource)))
227 }
228 if len(xMsLeaseID) > 0 {
229 preparer = autorest.DecoratePreparer(preparer,
230 autorest.WithHeader("x-ms-lease-id", autorest.String(xMsLeaseID)))
231 }
232 if len(xMsSourceLeaseID) > 0 {
233 preparer = autorest.DecoratePreparer(preparer,
234 autorest.WithHeader("x-ms-source-lease-id", autorest.String(xMsSourceLeaseID)))
235 }
236 if len(xMsProperties) > 0 {
237 preparer = autorest.DecoratePreparer(preparer,
238 autorest.WithHeader("x-ms-properties", autorest.String(xMsProperties)))
239 }
240 if len(xMsPermissions) > 0 {
241 preparer = autorest.DecoratePreparer(preparer,
242 autorest.WithHeader("x-ms-permissions", autorest.String(xMsPermissions)))
243 }
244 if len(xMsUmask) > 0 {
245 preparer = autorest.DecoratePreparer(preparer,
246 autorest.WithHeader("x-ms-umask", autorest.String(xMsUmask)))
247 }
248 if len(ifMatch) > 0 {
249 preparer = autorest.DecoratePreparer(preparer,
250 autorest.WithHeader("If-Match", autorest.String(ifMatch)))
251 }
252 if len(ifNoneMatch) > 0 {
253 preparer = autorest.DecoratePreparer(preparer,
254 autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch)))
255 }
256 if len(ifModifiedSince) > 0 {
257 preparer = autorest.DecoratePreparer(preparer,
258 autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince)))
259 }
260 if len(ifUnmodifiedSince) > 0 {
261 preparer = autorest.DecoratePreparer(preparer,
262 autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince)))
263 }
264 if len(xMsSourceIfMatch) > 0 {
265 preparer = autorest.DecoratePreparer(preparer,
266 autorest.WithHeader("x-ms-source-if-match", autorest.String(xMsSourceIfMatch)))
267 }
268 if len(xMsSourceIfNoneMatch) > 0 {
269 preparer = autorest.DecoratePreparer(preparer,
270 autorest.WithHeader("x-ms-source-if-none-match", autorest.String(xMsSourceIfNoneMatch)))
271 }
272 if len(xMsSourceIfModifiedSince) > 0 {
273 preparer = autorest.DecoratePreparer(preparer,
274 autorest.WithHeader("x-ms-source-if-modified-since", autorest.String(xMsSourceIfModifiedSince)))
275 }
276 if len(xMsSourceIfUnmodifiedSince) > 0 {
277 preparer = autorest.DecoratePreparer(preparer,
278 autorest.WithHeader("x-ms-source-if-unmodified-since", autorest.String(xMsSourceIfUnmodifiedSince)))
279 }
280 if len(xMsClientRequestID) > 0 {
281 preparer = autorest.DecoratePreparer(preparer,
282 autorest.WithHeader("x-ms-client-request-id", autorest.String(xMsClientRequestID)))
283 }
284 if len(xMsDate) > 0 {
285 preparer = autorest.DecoratePreparer(preparer,
286 autorest.WithHeader("x-ms-date", autorest.String(xMsDate)))
287 }
288 if len(client.XMsVersion) > 0 {
289 preparer = autorest.DecoratePreparer(preparer,
290 autorest.WithHeader("x-ms-version", autorest.String(client.XMsVersion)))
291 }
292 return preparer.Prepare((&http.Request{}).WithContext(ctx))
293 }
294
295
296
297 func (client PathClient) CreateSender(req *http.Request) (*http.Response, error) {
298 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
299 }
300
301
302
303 func (client PathClient) CreateResponder(resp *http.Response) (result autorest.Response, err error) {
304 err = autorest.Respond(
305 resp,
306 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
307 autorest.ByClosing())
308 result.Response = resp
309 return
310 }
311
312
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 func (client PathClient) Delete(ctx context.Context, filesystem string, pathParameter string, recursive *bool, continuation string, xMsLeaseID string, ifMatch string, ifNoneMatch string, ifModifiedSince string, ifUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (result autorest.Response, err error) {
340 if tracing.IsEnabled() {
341 ctx = tracing.StartSpan(ctx, fqdn+"/PathClient.Delete")
342 defer func() {
343 sc := -1
344 if result.Response != nil {
345 sc = result.Response.StatusCode
346 }
347 tracing.EndSpan(ctx, sc, err)
348 }()
349 }
350 if err := validation.Validate([]validation.Validation{
351 {TargetValue: xMsLeaseID,
352 Constraints: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Empty, Rule: false,
353 Chain: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
354 {TargetValue: filesystem,
355 Constraints: []validation.Constraint{{Target: "filesystem", Name: validation.MaxLength, Rule: 63, Chain: nil},
356 {Target: "filesystem", Name: validation.MinLength, Rule: 3, Chain: nil}}},
357 {TargetValue: xMsClientRequestID,
358 Constraints: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Empty, Rule: false,
359 Chain: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
360 {TargetValue: timeout,
361 Constraints: []validation.Constraint{{Target: "timeout", Name: validation.Null, Rule: false,
362 Chain: []validation.Constraint{{Target: "timeout", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}}); err != nil {
363 return result, validation.NewError("storagedatalake.PathClient", "Delete", err.Error())
364 }
365
366 req, err := client.DeletePreparer(ctx, filesystem, pathParameter, recursive, continuation, xMsLeaseID, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince, xMsClientRequestID, timeout, xMsDate)
367 if err != nil {
368 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Delete", nil, "Failure preparing request")
369 return
370 }
371
372 resp, err := client.DeleteSender(req)
373 if err != nil {
374 result.Response = resp
375 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Delete", resp, "Failure sending request")
376 return
377 }
378
379 result, err = client.DeleteResponder(resp)
380 if err != nil {
381 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Delete", resp, "Failure responding to request")
382 return
383 }
384
385 return
386 }
387
388
389 func (client PathClient) DeletePreparer(ctx context.Context, filesystem string, pathParameter string, recursive *bool, continuation string, xMsLeaseID string, ifMatch string, ifNoneMatch string, ifModifiedSince string, ifUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (*http.Request, error) {
390 urlParameters := map[string]interface{}{
391 "accountName": client.AccountName,
392 "dnsSuffix": client.DNSSuffix,
393 }
394
395 pathParameters := map[string]interface{}{
396 "filesystem": autorest.Encode("path", filesystem),
397 "path": autorest.Encode("path", pathParameter),
398 }
399
400 queryParameters := map[string]interface{}{}
401 if recursive != nil {
402 queryParameters["recursive"] = autorest.Encode("query", *recursive)
403 }
404 if len(continuation) > 0 {
405 queryParameters["continuation"] = autorest.Encode("query", continuation)
406 }
407 if timeout != nil {
408 queryParameters["timeout"] = autorest.Encode("query", *timeout)
409 }
410
411 preparer := autorest.CreatePreparer(
412 autorest.AsDelete(),
413 autorest.WithCustomBaseURL("https://{accountName}.{dnsSuffix}", urlParameters),
414 autorest.WithPathParameters("/{filesystem}/{path}", pathParameters),
415 autorest.WithQueryParameters(queryParameters))
416 if len(xMsLeaseID) > 0 {
417 preparer = autorest.DecoratePreparer(preparer,
418 autorest.WithHeader("x-ms-lease-id", autorest.String(xMsLeaseID)))
419 }
420 if len(ifMatch) > 0 {
421 preparer = autorest.DecoratePreparer(preparer,
422 autorest.WithHeader("If-Match", autorest.String(ifMatch)))
423 }
424 if len(ifNoneMatch) > 0 {
425 preparer = autorest.DecoratePreparer(preparer,
426 autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch)))
427 }
428 if len(ifModifiedSince) > 0 {
429 preparer = autorest.DecoratePreparer(preparer,
430 autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince)))
431 }
432 if len(ifUnmodifiedSince) > 0 {
433 preparer = autorest.DecoratePreparer(preparer,
434 autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince)))
435 }
436 if len(xMsClientRequestID) > 0 {
437 preparer = autorest.DecoratePreparer(preparer,
438 autorest.WithHeader("x-ms-client-request-id", autorest.String(xMsClientRequestID)))
439 }
440 if len(xMsDate) > 0 {
441 preparer = autorest.DecoratePreparer(preparer,
442 autorest.WithHeader("x-ms-date", autorest.String(xMsDate)))
443 }
444 if len(client.XMsVersion) > 0 {
445 preparer = autorest.DecoratePreparer(preparer,
446 autorest.WithHeader("x-ms-version", autorest.String(client.XMsVersion)))
447 }
448 return preparer.Prepare((&http.Request{}).WithContext(ctx))
449 }
450
451
452
453 func (client PathClient) DeleteSender(req *http.Request) (*http.Response, error) {
454 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
455 }
456
457
458
459 func (client PathClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
460 err = autorest.Respond(
461 resp,
462 azure.WithErrorUnlessStatusCode(http.StatusOK),
463 autorest.ByClosing())
464 result.Response = resp
465 return
466 }
467
468
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 func (client PathClient) GetProperties(ctx context.Context, filesystem string, pathParameter string, action PathGetPropertiesAction, upn *bool, fsAction string, xMsLeaseID string, ifMatch string, ifNoneMatch string, ifModifiedSince string, ifUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (result autorest.Response, err error) {
504 if tracing.IsEnabled() {
505 ctx = tracing.StartSpan(ctx, fqdn+"/PathClient.GetProperties")
506 defer func() {
507 sc := -1
508 if result.Response != nil {
509 sc = result.Response.StatusCode
510 }
511 tracing.EndSpan(ctx, sc, err)
512 }()
513 }
514 if err := validation.Validate([]validation.Validation{
515 {TargetValue: xMsLeaseID,
516 Constraints: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Empty, Rule: false,
517 Chain: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
518 {TargetValue: filesystem,
519 Constraints: []validation.Constraint{{Target: "filesystem", Name: validation.MaxLength, Rule: 63, Chain: nil},
520 {Target: "filesystem", Name: validation.MinLength, Rule: 3, Chain: nil}}},
521 {TargetValue: xMsClientRequestID,
522 Constraints: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Empty, Rule: false,
523 Chain: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
524 {TargetValue: timeout,
525 Constraints: []validation.Constraint{{Target: "timeout", Name: validation.Null, Rule: false,
526 Chain: []validation.Constraint{{Target: "timeout", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}}); err != nil {
527 return result, validation.NewError("storagedatalake.PathClient", "GetProperties", err.Error())
528 }
529
530 req, err := client.GetPropertiesPreparer(ctx, filesystem, pathParameter, action, upn, fsAction, xMsLeaseID, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince, xMsClientRequestID, timeout, xMsDate)
531 if err != nil {
532 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "GetProperties", nil, "Failure preparing request")
533 return
534 }
535
536 resp, err := client.GetPropertiesSender(req)
537 if err != nil {
538 result.Response = resp
539 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "GetProperties", resp, "Failure sending request")
540 return
541 }
542
543 result, err = client.GetPropertiesResponder(resp)
544 if err != nil {
545 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "GetProperties", resp, "Failure responding to request")
546 return
547 }
548
549 return
550 }
551
552
553 func (client PathClient) GetPropertiesPreparer(ctx context.Context, filesystem string, pathParameter string, action PathGetPropertiesAction, upn *bool, fsAction string, xMsLeaseID string, ifMatch string, ifNoneMatch string, ifModifiedSince string, ifUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (*http.Request, error) {
554 urlParameters := map[string]interface{}{
555 "accountName": client.AccountName,
556 "dnsSuffix": client.DNSSuffix,
557 }
558
559 pathParameters := map[string]interface{}{
560 "filesystem": autorest.Encode("path", filesystem),
561 "path": autorest.Encode("path", pathParameter),
562 }
563
564 queryParameters := map[string]interface{}{}
565 if len(string(action)) > 0 {
566 queryParameters["action"] = autorest.Encode("query", action)
567 }
568 if upn != nil {
569 queryParameters["upn"] = autorest.Encode("query", *upn)
570 }
571 if len(fsAction) > 0 {
572 queryParameters["fsAction"] = autorest.Encode("query", fsAction)
573 }
574 if timeout != nil {
575 queryParameters["timeout"] = autorest.Encode("query", *timeout)
576 }
577
578 preparer := autorest.CreatePreparer(
579 autorest.AsHead(),
580 autorest.WithCustomBaseURL("https://{accountName}.{dnsSuffix}", urlParameters),
581 autorest.WithPathParameters("/{filesystem}/{path}", pathParameters),
582 autorest.WithQueryParameters(queryParameters))
583 if len(xMsLeaseID) > 0 {
584 preparer = autorest.DecoratePreparer(preparer,
585 autorest.WithHeader("x-ms-lease-id", autorest.String(xMsLeaseID)))
586 }
587 if len(ifMatch) > 0 {
588 preparer = autorest.DecoratePreparer(preparer,
589 autorest.WithHeader("If-Match", autorest.String(ifMatch)))
590 }
591 if len(ifNoneMatch) > 0 {
592 preparer = autorest.DecoratePreparer(preparer,
593 autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch)))
594 }
595 if len(ifModifiedSince) > 0 {
596 preparer = autorest.DecoratePreparer(preparer,
597 autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince)))
598 }
599 if len(ifUnmodifiedSince) > 0 {
600 preparer = autorest.DecoratePreparer(preparer,
601 autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince)))
602 }
603 if len(xMsClientRequestID) > 0 {
604 preparer = autorest.DecoratePreparer(preparer,
605 autorest.WithHeader("x-ms-client-request-id", autorest.String(xMsClientRequestID)))
606 }
607 if len(xMsDate) > 0 {
608 preparer = autorest.DecoratePreparer(preparer,
609 autorest.WithHeader("x-ms-date", autorest.String(xMsDate)))
610 }
611 if len(client.XMsVersion) > 0 {
612 preparer = autorest.DecoratePreparer(preparer,
613 autorest.WithHeader("x-ms-version", autorest.String(client.XMsVersion)))
614 }
615 return preparer.Prepare((&http.Request{}).WithContext(ctx))
616 }
617
618
619
620 func (client PathClient) GetPropertiesSender(req *http.Request) (*http.Response, error) {
621 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
622 }
623
624
625
626 func (client PathClient) GetPropertiesResponder(resp *http.Response) (result autorest.Response, err error) {
627 err = autorest.Respond(
628 resp,
629 azure.WithErrorUnlessStatusCode(http.StatusOK),
630 autorest.ByClosing())
631 result.Response = resp
632 return
633 }
634
635
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 func (client PathClient) Lease(ctx context.Context, xMsLeaseAction PathLeaseAction, filesystem string, pathParameter string, xMsLeaseDuration *int32, xMsLeaseBreakPeriod *int32, xMsLeaseID string, xMsProposedLeaseID string, ifMatch string, ifNoneMatch string, ifModifiedSince string, ifUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (result autorest.Response, err error) {
673 if tracing.IsEnabled() {
674 ctx = tracing.StartSpan(ctx, fqdn+"/PathClient.Lease")
675 defer func() {
676 sc := -1
677 if result.Response != nil {
678 sc = result.Response.StatusCode
679 }
680 tracing.EndSpan(ctx, sc, err)
681 }()
682 }
683 if err := validation.Validate([]validation.Validation{
684 {TargetValue: xMsLeaseID,
685 Constraints: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Empty, Rule: false,
686 Chain: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
687 {TargetValue: xMsProposedLeaseID,
688 Constraints: []validation.Constraint{{Target: "xMsProposedLeaseID", Name: validation.Empty, Rule: false,
689 Chain: []validation.Constraint{{Target: "xMsProposedLeaseID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
690 {TargetValue: filesystem,
691 Constraints: []validation.Constraint{{Target: "filesystem", Name: validation.MaxLength, Rule: 63, Chain: nil},
692 {Target: "filesystem", Name: validation.MinLength, Rule: 3, Chain: nil}}},
693 {TargetValue: xMsClientRequestID,
694 Constraints: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Empty, Rule: false,
695 Chain: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
696 {TargetValue: timeout,
697 Constraints: []validation.Constraint{{Target: "timeout", Name: validation.Null, Rule: false,
698 Chain: []validation.Constraint{{Target: "timeout", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}}); err != nil {
699 return result, validation.NewError("storagedatalake.PathClient", "Lease", err.Error())
700 }
701
702 req, err := client.LeasePreparer(ctx, xMsLeaseAction, filesystem, pathParameter, xMsLeaseDuration, xMsLeaseBreakPeriod, xMsLeaseID, xMsProposedLeaseID, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince, xMsClientRequestID, timeout, xMsDate)
703 if err != nil {
704 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Lease", nil, "Failure preparing request")
705 return
706 }
707
708 resp, err := client.LeaseSender(req)
709 if err != nil {
710 result.Response = resp
711 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Lease", resp, "Failure sending request")
712 return
713 }
714
715 result, err = client.LeaseResponder(resp)
716 if err != nil {
717 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Lease", resp, "Failure responding to request")
718 return
719 }
720
721 return
722 }
723
724
725 func (client PathClient) LeasePreparer(ctx context.Context, xMsLeaseAction PathLeaseAction, filesystem string, pathParameter string, xMsLeaseDuration *int32, xMsLeaseBreakPeriod *int32, xMsLeaseID string, xMsProposedLeaseID string, ifMatch string, ifNoneMatch string, ifModifiedSince string, ifUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (*http.Request, error) {
726 urlParameters := map[string]interface{}{
727 "accountName": client.AccountName,
728 "dnsSuffix": client.DNSSuffix,
729 }
730
731 pathParameters := map[string]interface{}{
732 "filesystem": autorest.Encode("path", filesystem),
733 "path": autorest.Encode("path", pathParameter),
734 }
735
736 queryParameters := map[string]interface{}{}
737 if timeout != nil {
738 queryParameters["timeout"] = autorest.Encode("query", *timeout)
739 }
740
741 preparer := autorest.CreatePreparer(
742 autorest.AsPost(),
743 autorest.WithCustomBaseURL("https://{accountName}.{dnsSuffix}", urlParameters),
744 autorest.WithPathParameters("/{filesystem}/{path}", pathParameters),
745 autorest.WithQueryParameters(queryParameters),
746 autorest.WithHeader("x-ms-lease-action", autorest.String(xMsLeaseAction)))
747 if xMsLeaseDuration != nil {
748 preparer = autorest.DecoratePreparer(preparer,
749 autorest.WithHeader("x-ms-lease-duration", autorest.String(*xMsLeaseDuration)))
750 }
751 if xMsLeaseBreakPeriod != nil {
752 preparer = autorest.DecoratePreparer(preparer,
753 autorest.WithHeader("x-ms-lease-break-period", autorest.String(*xMsLeaseBreakPeriod)))
754 }
755 if len(xMsLeaseID) > 0 {
756 preparer = autorest.DecoratePreparer(preparer,
757 autorest.WithHeader("x-ms-lease-id", autorest.String(xMsLeaseID)))
758 }
759 if len(xMsProposedLeaseID) > 0 {
760 preparer = autorest.DecoratePreparer(preparer,
761 autorest.WithHeader("x-ms-proposed-lease-id", autorest.String(xMsProposedLeaseID)))
762 }
763 if len(ifMatch) > 0 {
764 preparer = autorest.DecoratePreparer(preparer,
765 autorest.WithHeader("If-Match", autorest.String(ifMatch)))
766 }
767 if len(ifNoneMatch) > 0 {
768 preparer = autorest.DecoratePreparer(preparer,
769 autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch)))
770 }
771 if len(ifModifiedSince) > 0 {
772 preparer = autorest.DecoratePreparer(preparer,
773 autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince)))
774 }
775 if len(ifUnmodifiedSince) > 0 {
776 preparer = autorest.DecoratePreparer(preparer,
777 autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince)))
778 }
779 if len(xMsClientRequestID) > 0 {
780 preparer = autorest.DecoratePreparer(preparer,
781 autorest.WithHeader("x-ms-client-request-id", autorest.String(xMsClientRequestID)))
782 }
783 if len(xMsDate) > 0 {
784 preparer = autorest.DecoratePreparer(preparer,
785 autorest.WithHeader("x-ms-date", autorest.String(xMsDate)))
786 }
787 if len(client.XMsVersion) > 0 {
788 preparer = autorest.DecoratePreparer(preparer,
789 autorest.WithHeader("x-ms-version", autorest.String(client.XMsVersion)))
790 }
791 return preparer.Prepare((&http.Request{}).WithContext(ctx))
792 }
793
794
795
796 func (client PathClient) LeaseSender(req *http.Request) (*http.Response, error) {
797 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
798 }
799
800
801
802 func (client PathClient) LeaseResponder(resp *http.Response) (result autorest.Response, err error) {
803 err = autorest.Respond(
804 resp,
805 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted),
806 autorest.ByClosing())
807 result.Response = resp
808 return
809 }
810
811
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 func (client PathClient) List(ctx context.Context, recursive bool, filesystem string, directory string, continuation string, maxResults *int32, upn *bool, xMsClientRequestID string, timeout *int32, xMsDate string) (result PathList, err error) {
837 if tracing.IsEnabled() {
838 ctx = tracing.StartSpan(ctx, fqdn+"/PathClient.List")
839 defer func() {
840 sc := -1
841 if result.Response.Response != nil {
842 sc = result.Response.Response.StatusCode
843 }
844 tracing.EndSpan(ctx, sc, err)
845 }()
846 }
847 if err := validation.Validate([]validation.Validation{
848 {TargetValue: maxResults,
849 Constraints: []validation.Constraint{{Target: "maxResults", Name: validation.Null, Rule: false,
850 Chain: []validation.Constraint{{Target: "maxResults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}},
851 {TargetValue: filesystem,
852 Constraints: []validation.Constraint{{Target: "filesystem", Name: validation.MaxLength, Rule: 63, Chain: nil},
853 {Target: "filesystem", Name: validation.MinLength, Rule: 3, Chain: nil}}},
854 {TargetValue: xMsClientRequestID,
855 Constraints: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Empty, Rule: false,
856 Chain: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
857 {TargetValue: timeout,
858 Constraints: []validation.Constraint{{Target: "timeout", Name: validation.Null, Rule: false,
859 Chain: []validation.Constraint{{Target: "timeout", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}}); err != nil {
860 return result, validation.NewError("storagedatalake.PathClient", "List", err.Error())
861 }
862
863 req, err := client.ListPreparer(ctx, recursive, filesystem, directory, continuation, maxResults, upn, xMsClientRequestID, timeout, xMsDate)
864 if err != nil {
865 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "List", nil, "Failure preparing request")
866 return
867 }
868
869 resp, err := client.ListSender(req)
870 if err != nil {
871 result.Response = autorest.Response{Response: resp}
872 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "List", resp, "Failure sending request")
873 return
874 }
875
876 result, err = client.ListResponder(resp)
877 if err != nil {
878 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "List", resp, "Failure responding to request")
879 return
880 }
881
882 return
883 }
884
885
886 func (client PathClient) ListPreparer(ctx context.Context, recursive bool, filesystem string, directory string, continuation string, maxResults *int32, upn *bool, xMsClientRequestID string, timeout *int32, xMsDate string) (*http.Request, error) {
887 urlParameters := map[string]interface{}{
888 "accountName": client.AccountName,
889 "dnsSuffix": client.DNSSuffix,
890 }
891
892 pathParameters := map[string]interface{}{
893 "filesystem": autorest.Encode("path", filesystem),
894 }
895
896 queryParameters := map[string]interface{}{
897 "recursive": autorest.Encode("query", recursive),
898 "resource": autorest.Encode("query", "filesystem"),
899 }
900 if len(directory) > 0 {
901 queryParameters["directory"] = autorest.Encode("query", directory)
902 }
903 if len(continuation) > 0 {
904 queryParameters["continuation"] = autorest.Encode("query", continuation)
905 }
906 if maxResults != nil {
907 queryParameters["maxResults"] = autorest.Encode("query", *maxResults)
908 }
909 if upn != nil {
910 queryParameters["upn"] = autorest.Encode("query", *upn)
911 }
912 if timeout != nil {
913 queryParameters["timeout"] = autorest.Encode("query", *timeout)
914 }
915
916 preparer := autorest.CreatePreparer(
917 autorest.AsGet(),
918 autorest.WithCustomBaseURL("https://{accountName}.{dnsSuffix}", urlParameters),
919 autorest.WithPathParameters("/{filesystem}", pathParameters),
920 autorest.WithQueryParameters(queryParameters))
921 if len(xMsClientRequestID) > 0 {
922 preparer = autorest.DecoratePreparer(preparer,
923 autorest.WithHeader("x-ms-client-request-id", autorest.String(xMsClientRequestID)))
924 }
925 if len(xMsDate) > 0 {
926 preparer = autorest.DecoratePreparer(preparer,
927 autorest.WithHeader("x-ms-date", autorest.String(xMsDate)))
928 }
929 if len(client.XMsVersion) > 0 {
930 preparer = autorest.DecoratePreparer(preparer,
931 autorest.WithHeader("x-ms-version", autorest.String(client.XMsVersion)))
932 }
933 return preparer.Prepare((&http.Request{}).WithContext(ctx))
934 }
935
936
937
938 func (client PathClient) ListSender(req *http.Request) (*http.Response, error) {
939 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
940 }
941
942
943
944 func (client PathClient) ListResponder(resp *http.Response) (result PathList, err error) {
945 err = autorest.Respond(
946 resp,
947 azure.WithErrorUnlessStatusCode(http.StatusOK),
948 autorest.ByUnmarshallingJSON(&result),
949 autorest.ByClosing())
950 result.Response = autorest.Response{Response: resp}
951 return
952 }
953
954
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 func (client PathClient) Read(ctx context.Context, filesystem string, pathParameter string, rangeParameter string, xMsLeaseID string, xMsRangeGetContentMd5 *bool, ifMatch string, ifNoneMatch string, ifModifiedSince string, ifUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (result ReadCloser, err error) {
985 if tracing.IsEnabled() {
986 ctx = tracing.StartSpan(ctx, fqdn+"/PathClient.Read")
987 defer func() {
988 sc := -1
989 if result.Response.Response != nil {
990 sc = result.Response.Response.StatusCode
991 }
992 tracing.EndSpan(ctx, sc, err)
993 }()
994 }
995 if err := validation.Validate([]validation.Validation{
996 {TargetValue: xMsLeaseID,
997 Constraints: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Empty, Rule: false,
998 Chain: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
999 {TargetValue: filesystem,
1000 Constraints: []validation.Constraint{{Target: "filesystem", Name: validation.MaxLength, Rule: 63, Chain: nil},
1001 {Target: "filesystem", Name: validation.MinLength, Rule: 3, Chain: nil}}},
1002 {TargetValue: xMsClientRequestID,
1003 Constraints: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Empty, Rule: false,
1004 Chain: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
1005 {TargetValue: timeout,
1006 Constraints: []validation.Constraint{{Target: "timeout", Name: validation.Null, Rule: false,
1007 Chain: []validation.Constraint{{Target: "timeout", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}}); err != nil {
1008 return result, validation.NewError("storagedatalake.PathClient", "Read", err.Error())
1009 }
1010
1011 req, err := client.ReadPreparer(ctx, filesystem, pathParameter, rangeParameter, xMsLeaseID, xMsRangeGetContentMd5, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince, xMsClientRequestID, timeout, xMsDate)
1012 if err != nil {
1013 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Read", nil, "Failure preparing request")
1014 return
1015 }
1016
1017 resp, err := client.ReadSender(req)
1018 if err != nil {
1019 result.Response = autorest.Response{Response: resp}
1020 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Read", resp, "Failure sending request")
1021 return
1022 }
1023
1024 result, err = client.ReadResponder(resp)
1025 if err != nil {
1026 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Read", resp, "Failure responding to request")
1027 return
1028 }
1029
1030 return
1031 }
1032
1033
1034 func (client PathClient) ReadPreparer(ctx context.Context, filesystem string, pathParameter string, rangeParameter string, xMsLeaseID string, xMsRangeGetContentMd5 *bool, ifMatch string, ifNoneMatch string, ifModifiedSince string, ifUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (*http.Request, error) {
1035 urlParameters := map[string]interface{}{
1036 "accountName": client.AccountName,
1037 "dnsSuffix": client.DNSSuffix,
1038 }
1039
1040 pathParameters := map[string]interface{}{
1041 "filesystem": autorest.Encode("path", filesystem),
1042 "path": autorest.Encode("path", pathParameter),
1043 }
1044
1045 queryParameters := map[string]interface{}{}
1046 if timeout != nil {
1047 queryParameters["timeout"] = autorest.Encode("query", *timeout)
1048 }
1049
1050 preparer := autorest.CreatePreparer(
1051 autorest.AsGet(),
1052 autorest.WithCustomBaseURL("https://{accountName}.{dnsSuffix}", urlParameters),
1053 autorest.WithPathParameters("/{filesystem}/{path}", pathParameters),
1054 autorest.WithQueryParameters(queryParameters))
1055 if len(rangeParameter) > 0 {
1056 preparer = autorest.DecoratePreparer(preparer,
1057 autorest.WithHeader("Range", autorest.String(rangeParameter)))
1058 }
1059 if len(xMsLeaseID) > 0 {
1060 preparer = autorest.DecoratePreparer(preparer,
1061 autorest.WithHeader("x-ms-lease-id", autorest.String(xMsLeaseID)))
1062 }
1063 if xMsRangeGetContentMd5 != nil {
1064 preparer = autorest.DecoratePreparer(preparer,
1065 autorest.WithHeader("x-ms-range-get-content-md5", autorest.String(xMsRangeGetContentMd5)))
1066 }
1067 if len(ifMatch) > 0 {
1068 preparer = autorest.DecoratePreparer(preparer,
1069 autorest.WithHeader("If-Match", autorest.String(ifMatch)))
1070 }
1071 if len(ifNoneMatch) > 0 {
1072 preparer = autorest.DecoratePreparer(preparer,
1073 autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch)))
1074 }
1075 if len(ifModifiedSince) > 0 {
1076 preparer = autorest.DecoratePreparer(preparer,
1077 autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince)))
1078 }
1079 if len(ifUnmodifiedSince) > 0 {
1080 preparer = autorest.DecoratePreparer(preparer,
1081 autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince)))
1082 }
1083 if len(xMsClientRequestID) > 0 {
1084 preparer = autorest.DecoratePreparer(preparer,
1085 autorest.WithHeader("x-ms-client-request-id", autorest.String(xMsClientRequestID)))
1086 }
1087 if len(xMsDate) > 0 {
1088 preparer = autorest.DecoratePreparer(preparer,
1089 autorest.WithHeader("x-ms-date", autorest.String(xMsDate)))
1090 }
1091 if len(client.XMsVersion) > 0 {
1092 preparer = autorest.DecoratePreparer(preparer,
1093 autorest.WithHeader("x-ms-version", autorest.String(client.XMsVersion)))
1094 }
1095 return preparer.Prepare((&http.Request{}).WithContext(ctx))
1096 }
1097
1098
1099
1100 func (client PathClient) ReadSender(req *http.Request) (*http.Response, error) {
1101 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1102 }
1103
1104
1105
1106 func (client PathClient) ReadResponder(resp *http.Response) (result ReadCloser, err error) {
1107 result.Value = &resp.Body
1108 err = autorest.Respond(
1109 resp,
1110 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusPartialContent))
1111 result.Response = autorest.Response{Response: resp}
1112 return
1113 }
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221 func (client PathClient) Update(ctx context.Context, action PathUpdateAction, filesystem string, pathParameter string, position *int64, retainUncommittedData *bool, closeParameter *bool, contentLength *int64, contentMD5 string, xMsLeaseID string, xMsCacheControl string, xMsContentType string, xMsContentDisposition string, xMsContentEncoding string, xMsContentLanguage string, xMsContentMd5 string, xMsProperties string, xMsOwner string, xMsGroup string, xMsPermissions string, xMsACL string, ifMatch string, ifNoneMatch string, ifModifiedSince string, ifUnmodifiedSince string, requestBody io.ReadCloser, xMsClientRequestID string, timeout *int32, xMsDate string) (result autorest.Response, err error) {
1222 if tracing.IsEnabled() {
1223 ctx = tracing.StartSpan(ctx, fqdn+"/PathClient.Update")
1224 defer func() {
1225 sc := -1
1226 if result.Response != nil {
1227 sc = result.Response.StatusCode
1228 }
1229 tracing.EndSpan(ctx, sc, err)
1230 }()
1231 }
1232 if err := validation.Validate([]validation.Validation{
1233 {TargetValue: contentLength,
1234 Constraints: []validation.Constraint{{Target: "contentLength", Name: validation.Null, Rule: false,
1235 Chain: []validation.Constraint{{Target: "contentLength", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}},
1236 {TargetValue: xMsLeaseID,
1237 Constraints: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Empty, Rule: false,
1238 Chain: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
1239 {TargetValue: filesystem,
1240 Constraints: []validation.Constraint{{Target: "filesystem", Name: validation.MaxLength, Rule: 63, Chain: nil},
1241 {Target: "filesystem", Name: validation.MinLength, Rule: 3, Chain: nil}}},
1242 {TargetValue: xMsClientRequestID,
1243 Constraints: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Empty, Rule: false,
1244 Chain: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
1245 {TargetValue: timeout,
1246 Constraints: []validation.Constraint{{Target: "timeout", Name: validation.Null, Rule: false,
1247 Chain: []validation.Constraint{{Target: "timeout", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}}); err != nil {
1248 return result, validation.NewError("storagedatalake.PathClient", "Update", err.Error())
1249 }
1250
1251 req, err := client.UpdatePreparer(ctx, action, filesystem, pathParameter, position, retainUncommittedData, closeParameter, contentLength, contentMD5, xMsLeaseID, xMsCacheControl, xMsContentType, xMsContentDisposition, xMsContentEncoding, xMsContentLanguage, xMsContentMd5, xMsProperties, xMsOwner, xMsGroup, xMsPermissions, xMsACL, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince, requestBody, xMsClientRequestID, timeout, xMsDate)
1252 if err != nil {
1253 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Update", nil, "Failure preparing request")
1254 return
1255 }
1256
1257 resp, err := client.UpdateSender(req)
1258 if err != nil {
1259 result.Response = resp
1260 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Update", resp, "Failure sending request")
1261 return
1262 }
1263
1264 result, err = client.UpdateResponder(resp)
1265 if err != nil {
1266 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Update", resp, "Failure responding to request")
1267 return
1268 }
1269
1270 return
1271 }
1272
1273
1274 func (client PathClient) UpdatePreparer(ctx context.Context, action PathUpdateAction, filesystem string, pathParameter string, position *int64, retainUncommittedData *bool, closeParameter *bool, contentLength *int64, contentMD5 string, xMsLeaseID string, xMsCacheControl string, xMsContentType string, xMsContentDisposition string, xMsContentEncoding string, xMsContentLanguage string, xMsContentMd5 string, xMsProperties string, xMsOwner string, xMsGroup string, xMsPermissions string, xMsACL string, ifMatch string, ifNoneMatch string, ifModifiedSince string, ifUnmodifiedSince string, requestBody io.ReadCloser, xMsClientRequestID string, timeout *int32, xMsDate string) (*http.Request, error) {
1275 urlParameters := map[string]interface{}{
1276 "accountName": client.AccountName,
1277 "dnsSuffix": client.DNSSuffix,
1278 }
1279
1280 pathParameters := map[string]interface{}{
1281 "filesystem": autorest.Encode("path", filesystem),
1282 "path": autorest.Encode("path", pathParameter),
1283 }
1284
1285 queryParameters := map[string]interface{}{
1286 "action": autorest.Encode("query", action),
1287 }
1288 if position != nil {
1289 queryParameters["position"] = autorest.Encode("query", *position)
1290 }
1291 if retainUncommittedData != nil {
1292 queryParameters["retainUncommittedData"] = autorest.Encode("query", *retainUncommittedData)
1293 }
1294 if closeParameter != nil {
1295 queryParameters["close"] = autorest.Encode("query", *closeParameter)
1296 }
1297 if timeout != nil {
1298 queryParameters["timeout"] = autorest.Encode("query", *timeout)
1299 }
1300
1301 preparer := autorest.CreatePreparer(
1302 autorest.AsContentType("application/octet-stream"),
1303 autorest.AsPatch(),
1304 autorest.WithCustomBaseURL("https://{accountName}.{dnsSuffix}", urlParameters),
1305 autorest.WithPathParameters("/{filesystem}/{path}", pathParameters),
1306 autorest.WithQueryParameters(queryParameters))
1307 if requestBody != nil {
1308 preparer = autorest.DecoratePreparer(preparer,
1309 autorest.WithFile(requestBody))
1310 }
1311 if contentLength != nil {
1312 preparer = autorest.DecoratePreparer(preparer,
1313 autorest.WithHeader("Content-Length", autorest.String(*contentLength)))
1314 }
1315 if len(contentMD5) > 0 {
1316 preparer = autorest.DecoratePreparer(preparer,
1317 autorest.WithHeader("Content-MD5", autorest.String(contentMD5)))
1318 }
1319 if len(xMsLeaseID) > 0 {
1320 preparer = autorest.DecoratePreparer(preparer,
1321 autorest.WithHeader("x-ms-lease-id", autorest.String(xMsLeaseID)))
1322 }
1323 if len(xMsCacheControl) > 0 {
1324 preparer = autorest.DecoratePreparer(preparer,
1325 autorest.WithHeader("x-ms-cache-control", autorest.String(xMsCacheControl)))
1326 }
1327 if len(xMsContentType) > 0 {
1328 preparer = autorest.DecoratePreparer(preparer,
1329 autorest.WithHeader("x-ms-content-type", autorest.String(xMsContentType)))
1330 }
1331 if len(xMsContentDisposition) > 0 {
1332 preparer = autorest.DecoratePreparer(preparer,
1333 autorest.WithHeader("x-ms-content-disposition", autorest.String(xMsContentDisposition)))
1334 }
1335 if len(xMsContentEncoding) > 0 {
1336 preparer = autorest.DecoratePreparer(preparer,
1337 autorest.WithHeader("x-ms-content-encoding", autorest.String(xMsContentEncoding)))
1338 }
1339 if len(xMsContentLanguage) > 0 {
1340 preparer = autorest.DecoratePreparer(preparer,
1341 autorest.WithHeader("x-ms-content-language", autorest.String(xMsContentLanguage)))
1342 }
1343 if len(xMsContentMd5) > 0 {
1344 preparer = autorest.DecoratePreparer(preparer,
1345 autorest.WithHeader("x-ms-content-md5", autorest.String(xMsContentMd5)))
1346 }
1347 if len(xMsProperties) > 0 {
1348 preparer = autorest.DecoratePreparer(preparer,
1349 autorest.WithHeader("x-ms-properties", autorest.String(xMsProperties)))
1350 }
1351 if len(xMsOwner) > 0 {
1352 preparer = autorest.DecoratePreparer(preparer,
1353 autorest.WithHeader("x-ms-owner", autorest.String(xMsOwner)))
1354 }
1355 if len(xMsGroup) > 0 {
1356 preparer = autorest.DecoratePreparer(preparer,
1357 autorest.WithHeader("x-ms-group", autorest.String(xMsGroup)))
1358 }
1359 if len(xMsPermissions) > 0 {
1360 preparer = autorest.DecoratePreparer(preparer,
1361 autorest.WithHeader("x-ms-permissions", autorest.String(xMsPermissions)))
1362 }
1363 if len(xMsACL) > 0 {
1364 preparer = autorest.DecoratePreparer(preparer,
1365 autorest.WithHeader("x-ms-acl", autorest.String(xMsACL)))
1366 }
1367 if len(ifMatch) > 0 {
1368 preparer = autorest.DecoratePreparer(preparer,
1369 autorest.WithHeader("If-Match", autorest.String(ifMatch)))
1370 }
1371 if len(ifNoneMatch) > 0 {
1372 preparer = autorest.DecoratePreparer(preparer,
1373 autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch)))
1374 }
1375 if len(ifModifiedSince) > 0 {
1376 preparer = autorest.DecoratePreparer(preparer,
1377 autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince)))
1378 }
1379 if len(ifUnmodifiedSince) > 0 {
1380 preparer = autorest.DecoratePreparer(preparer,
1381 autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince)))
1382 }
1383 if len(xMsClientRequestID) > 0 {
1384 preparer = autorest.DecoratePreparer(preparer,
1385 autorest.WithHeader("x-ms-client-request-id", autorest.String(xMsClientRequestID)))
1386 }
1387 if len(xMsDate) > 0 {
1388 preparer = autorest.DecoratePreparer(preparer,
1389 autorest.WithHeader("x-ms-date", autorest.String(xMsDate)))
1390 }
1391 if len(client.XMsVersion) > 0 {
1392 preparer = autorest.DecoratePreparer(preparer,
1393 autorest.WithHeader("x-ms-version", autorest.String(client.XMsVersion)))
1394 }
1395 return preparer.Prepare((&http.Request{}).WithContext(ctx))
1396 }
1397
1398
1399
1400 func (client PathClient) UpdateSender(req *http.Request) (*http.Response, error) {
1401 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1402 }
1403
1404
1405
1406 func (client PathClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) {
1407 err = autorest.Respond(
1408 resp,
1409 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
1410 autorest.ByClosing())
1411 result.Response = resp
1412 return
1413 }
1414
View as plain text