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 func (client PathClient) GetProperties(ctx context.Context, filesystem string, pathParameter string, action PathGetPropertiesAction, upn *bool, xMsLeaseID string, ifMatch string, ifNoneMatch string, ifModifiedSince string, ifUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (result autorest.Response, err error) {
502 if tracing.IsEnabled() {
503 ctx = tracing.StartSpan(ctx, fqdn+"/PathClient.GetProperties")
504 defer func() {
505 sc := -1
506 if result.Response != nil {
507 sc = result.Response.StatusCode
508 }
509 tracing.EndSpan(ctx, sc, err)
510 }()
511 }
512 if err := validation.Validate([]validation.Validation{
513 {TargetValue: xMsLeaseID,
514 Constraints: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Empty, Rule: false,
515 Chain: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
516 {TargetValue: filesystem,
517 Constraints: []validation.Constraint{{Target: "filesystem", Name: validation.MaxLength, Rule: 63, Chain: nil},
518 {Target: "filesystem", Name: validation.MinLength, Rule: 3, Chain: nil}}},
519 {TargetValue: xMsClientRequestID,
520 Constraints: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Empty, Rule: false,
521 Chain: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
522 {TargetValue: timeout,
523 Constraints: []validation.Constraint{{Target: "timeout", Name: validation.Null, Rule: false,
524 Chain: []validation.Constraint{{Target: "timeout", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}}); err != nil {
525 return result, validation.NewError("storagedatalake.PathClient", "GetProperties", err.Error())
526 }
527
528 req, err := client.GetPropertiesPreparer(ctx, filesystem, pathParameter, action, upn, xMsLeaseID, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince, xMsClientRequestID, timeout, xMsDate)
529 if err != nil {
530 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "GetProperties", nil, "Failure preparing request")
531 return
532 }
533
534 resp, err := client.GetPropertiesSender(req)
535 if err != nil {
536 result.Response = resp
537 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "GetProperties", resp, "Failure sending request")
538 return
539 }
540
541 result, err = client.GetPropertiesResponder(resp)
542 if err != nil {
543 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "GetProperties", resp, "Failure responding to request")
544 return
545 }
546
547 return
548 }
549
550
551 func (client PathClient) GetPropertiesPreparer(ctx context.Context, filesystem string, pathParameter string, action PathGetPropertiesAction, upn *bool, xMsLeaseID string, ifMatch string, ifNoneMatch string, ifModifiedSince string, ifUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (*http.Request, error) {
552 urlParameters := map[string]interface{}{
553 "accountName": client.AccountName,
554 "dnsSuffix": client.DNSSuffix,
555 }
556
557 pathParameters := map[string]interface{}{
558 "filesystem": autorest.Encode("path", filesystem),
559 "path": autorest.Encode("path", pathParameter),
560 }
561
562 queryParameters := map[string]interface{}{}
563 if len(string(action)) > 0 {
564 queryParameters["action"] = autorest.Encode("query", action)
565 }
566 if upn != nil {
567 queryParameters["upn"] = autorest.Encode("query", *upn)
568 }
569 if timeout != nil {
570 queryParameters["timeout"] = autorest.Encode("query", *timeout)
571 }
572
573 preparer := autorest.CreatePreparer(
574 autorest.AsHead(),
575 autorest.WithCustomBaseURL("https://{accountName}.{dnsSuffix}", urlParameters),
576 autorest.WithPathParameters("/{filesystem}/{path}", pathParameters),
577 autorest.WithQueryParameters(queryParameters))
578 if len(xMsLeaseID) > 0 {
579 preparer = autorest.DecoratePreparer(preparer,
580 autorest.WithHeader("x-ms-lease-id", autorest.String(xMsLeaseID)))
581 }
582 if len(ifMatch) > 0 {
583 preparer = autorest.DecoratePreparer(preparer,
584 autorest.WithHeader("If-Match", autorest.String(ifMatch)))
585 }
586 if len(ifNoneMatch) > 0 {
587 preparer = autorest.DecoratePreparer(preparer,
588 autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch)))
589 }
590 if len(ifModifiedSince) > 0 {
591 preparer = autorest.DecoratePreparer(preparer,
592 autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince)))
593 }
594 if len(ifUnmodifiedSince) > 0 {
595 preparer = autorest.DecoratePreparer(preparer,
596 autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince)))
597 }
598 if len(xMsClientRequestID) > 0 {
599 preparer = autorest.DecoratePreparer(preparer,
600 autorest.WithHeader("x-ms-client-request-id", autorest.String(xMsClientRequestID)))
601 }
602 if len(xMsDate) > 0 {
603 preparer = autorest.DecoratePreparer(preparer,
604 autorest.WithHeader("x-ms-date", autorest.String(xMsDate)))
605 }
606 if len(client.XMsVersion) > 0 {
607 preparer = autorest.DecoratePreparer(preparer,
608 autorest.WithHeader("x-ms-version", autorest.String(client.XMsVersion)))
609 }
610 return preparer.Prepare((&http.Request{}).WithContext(ctx))
611 }
612
613
614
615 func (client PathClient) GetPropertiesSender(req *http.Request) (*http.Response, error) {
616 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
617 }
618
619
620
621 func (client PathClient) GetPropertiesResponder(resp *http.Response) (result autorest.Response, err error) {
622 err = autorest.Respond(
623 resp,
624 azure.WithErrorUnlessStatusCode(http.StatusOK),
625 autorest.ByClosing())
626 result.Response = resp
627 return
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 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) {
668 if tracing.IsEnabled() {
669 ctx = tracing.StartSpan(ctx, fqdn+"/PathClient.Lease")
670 defer func() {
671 sc := -1
672 if result.Response != nil {
673 sc = result.Response.StatusCode
674 }
675 tracing.EndSpan(ctx, sc, err)
676 }()
677 }
678 if err := validation.Validate([]validation.Validation{
679 {TargetValue: xMsLeaseID,
680 Constraints: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Empty, Rule: false,
681 Chain: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
682 {TargetValue: xMsProposedLeaseID,
683 Constraints: []validation.Constraint{{Target: "xMsProposedLeaseID", Name: validation.Empty, Rule: false,
684 Chain: []validation.Constraint{{Target: "xMsProposedLeaseID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
685 {TargetValue: filesystem,
686 Constraints: []validation.Constraint{{Target: "filesystem", Name: validation.MaxLength, Rule: 63, Chain: nil},
687 {Target: "filesystem", Name: validation.MinLength, Rule: 3, Chain: nil}}},
688 {TargetValue: xMsClientRequestID,
689 Constraints: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Empty, Rule: false,
690 Chain: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
691 {TargetValue: timeout,
692 Constraints: []validation.Constraint{{Target: "timeout", Name: validation.Null, Rule: false,
693 Chain: []validation.Constraint{{Target: "timeout", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}}); err != nil {
694 return result, validation.NewError("storagedatalake.PathClient", "Lease", err.Error())
695 }
696
697 req, err := client.LeasePreparer(ctx, xMsLeaseAction, filesystem, pathParameter, xMsLeaseDuration, xMsLeaseBreakPeriod, xMsLeaseID, xMsProposedLeaseID, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince, xMsClientRequestID, timeout, xMsDate)
698 if err != nil {
699 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Lease", nil, "Failure preparing request")
700 return
701 }
702
703 resp, err := client.LeaseSender(req)
704 if err != nil {
705 result.Response = resp
706 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Lease", resp, "Failure sending request")
707 return
708 }
709
710 result, err = client.LeaseResponder(resp)
711 if err != nil {
712 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Lease", resp, "Failure responding to request")
713 return
714 }
715
716 return
717 }
718
719
720 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) {
721 urlParameters := map[string]interface{}{
722 "accountName": client.AccountName,
723 "dnsSuffix": client.DNSSuffix,
724 }
725
726 pathParameters := map[string]interface{}{
727 "filesystem": autorest.Encode("path", filesystem),
728 "path": autorest.Encode("path", pathParameter),
729 }
730
731 queryParameters := map[string]interface{}{}
732 if timeout != nil {
733 queryParameters["timeout"] = autorest.Encode("query", *timeout)
734 }
735
736 preparer := autorest.CreatePreparer(
737 autorest.AsPost(),
738 autorest.WithCustomBaseURL("https://{accountName}.{dnsSuffix}", urlParameters),
739 autorest.WithPathParameters("/{filesystem}/{path}", pathParameters),
740 autorest.WithQueryParameters(queryParameters),
741 autorest.WithHeader("x-ms-lease-action", autorest.String(xMsLeaseAction)))
742 if xMsLeaseDuration != nil {
743 preparer = autorest.DecoratePreparer(preparer,
744 autorest.WithHeader("x-ms-lease-duration", autorest.String(*xMsLeaseDuration)))
745 }
746 if xMsLeaseBreakPeriod != nil {
747 preparer = autorest.DecoratePreparer(preparer,
748 autorest.WithHeader("x-ms-lease-break-period", autorest.String(*xMsLeaseBreakPeriod)))
749 }
750 if len(xMsLeaseID) > 0 {
751 preparer = autorest.DecoratePreparer(preparer,
752 autorest.WithHeader("x-ms-lease-id", autorest.String(xMsLeaseID)))
753 }
754 if len(xMsProposedLeaseID) > 0 {
755 preparer = autorest.DecoratePreparer(preparer,
756 autorest.WithHeader("x-ms-proposed-lease-id", autorest.String(xMsProposedLeaseID)))
757 }
758 if len(ifMatch) > 0 {
759 preparer = autorest.DecoratePreparer(preparer,
760 autorest.WithHeader("If-Match", autorest.String(ifMatch)))
761 }
762 if len(ifNoneMatch) > 0 {
763 preparer = autorest.DecoratePreparer(preparer,
764 autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch)))
765 }
766 if len(ifModifiedSince) > 0 {
767 preparer = autorest.DecoratePreparer(preparer,
768 autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince)))
769 }
770 if len(ifUnmodifiedSince) > 0 {
771 preparer = autorest.DecoratePreparer(preparer,
772 autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince)))
773 }
774 if len(xMsClientRequestID) > 0 {
775 preparer = autorest.DecoratePreparer(preparer,
776 autorest.WithHeader("x-ms-client-request-id", autorest.String(xMsClientRequestID)))
777 }
778 if len(xMsDate) > 0 {
779 preparer = autorest.DecoratePreparer(preparer,
780 autorest.WithHeader("x-ms-date", autorest.String(xMsDate)))
781 }
782 if len(client.XMsVersion) > 0 {
783 preparer = autorest.DecoratePreparer(preparer,
784 autorest.WithHeader("x-ms-version", autorest.String(client.XMsVersion)))
785 }
786 return preparer.Prepare((&http.Request{}).WithContext(ctx))
787 }
788
789
790
791 func (client PathClient) LeaseSender(req *http.Request) (*http.Response, error) {
792 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
793 }
794
795
796
797 func (client PathClient) LeaseResponder(resp *http.Response) (result autorest.Response, err error) {
798 err = autorest.Respond(
799 resp,
800 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted),
801 autorest.ByClosing())
802 result.Response = resp
803 return
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 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) {
832 if tracing.IsEnabled() {
833 ctx = tracing.StartSpan(ctx, fqdn+"/PathClient.List")
834 defer func() {
835 sc := -1
836 if result.Response.Response != nil {
837 sc = result.Response.Response.StatusCode
838 }
839 tracing.EndSpan(ctx, sc, err)
840 }()
841 }
842 if err := validation.Validate([]validation.Validation{
843 {TargetValue: maxResults,
844 Constraints: []validation.Constraint{{Target: "maxResults", Name: validation.Null, Rule: false,
845 Chain: []validation.Constraint{{Target: "maxResults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}},
846 {TargetValue: filesystem,
847 Constraints: []validation.Constraint{{Target: "filesystem", Name: validation.MaxLength, Rule: 63, Chain: nil},
848 {Target: "filesystem", Name: validation.MinLength, Rule: 3, Chain: nil}}},
849 {TargetValue: xMsClientRequestID,
850 Constraints: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Empty, Rule: false,
851 Chain: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
852 {TargetValue: timeout,
853 Constraints: []validation.Constraint{{Target: "timeout", Name: validation.Null, Rule: false,
854 Chain: []validation.Constraint{{Target: "timeout", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}}); err != nil {
855 return result, validation.NewError("storagedatalake.PathClient", "List", err.Error())
856 }
857
858 req, err := client.ListPreparer(ctx, recursive, filesystem, directory, continuation, maxResults, upn, xMsClientRequestID, timeout, xMsDate)
859 if err != nil {
860 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "List", nil, "Failure preparing request")
861 return
862 }
863
864 resp, err := client.ListSender(req)
865 if err != nil {
866 result.Response = autorest.Response{Response: resp}
867 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "List", resp, "Failure sending request")
868 return
869 }
870
871 result, err = client.ListResponder(resp)
872 if err != nil {
873 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "List", resp, "Failure responding to request")
874 return
875 }
876
877 return
878 }
879
880
881 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) {
882 urlParameters := map[string]interface{}{
883 "accountName": client.AccountName,
884 "dnsSuffix": client.DNSSuffix,
885 }
886
887 pathParameters := map[string]interface{}{
888 "filesystem": autorest.Encode("path", filesystem),
889 }
890
891 queryParameters := map[string]interface{}{
892 "recursive": autorest.Encode("query", recursive),
893 "resource": autorest.Encode("query", "filesystem"),
894 }
895 if len(directory) > 0 {
896 queryParameters["directory"] = autorest.Encode("query", directory)
897 }
898 if len(continuation) > 0 {
899 queryParameters["continuation"] = autorest.Encode("query", continuation)
900 }
901 if maxResults != nil {
902 queryParameters["maxResults"] = autorest.Encode("query", *maxResults)
903 }
904 if upn != nil {
905 queryParameters["upn"] = autorest.Encode("query", *upn)
906 }
907 if timeout != nil {
908 queryParameters["timeout"] = autorest.Encode("query", *timeout)
909 }
910
911 preparer := autorest.CreatePreparer(
912 autorest.AsGet(),
913 autorest.WithCustomBaseURL("https://{accountName}.{dnsSuffix}", urlParameters),
914 autorest.WithPathParameters("/{filesystem}", pathParameters),
915 autorest.WithQueryParameters(queryParameters))
916 if len(xMsClientRequestID) > 0 {
917 preparer = autorest.DecoratePreparer(preparer,
918 autorest.WithHeader("x-ms-client-request-id", autorest.String(xMsClientRequestID)))
919 }
920 if len(xMsDate) > 0 {
921 preparer = autorest.DecoratePreparer(preparer,
922 autorest.WithHeader("x-ms-date", autorest.String(xMsDate)))
923 }
924 if len(client.XMsVersion) > 0 {
925 preparer = autorest.DecoratePreparer(preparer,
926 autorest.WithHeader("x-ms-version", autorest.String(client.XMsVersion)))
927 }
928 return preparer.Prepare((&http.Request{}).WithContext(ctx))
929 }
930
931
932
933 func (client PathClient) ListSender(req *http.Request) (*http.Response, error) {
934 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
935 }
936
937
938
939 func (client PathClient) ListResponder(resp *http.Response) (result PathList, err error) {
940 err = autorest.Respond(
941 resp,
942 azure.WithErrorUnlessStatusCode(http.StatusOK),
943 autorest.ByUnmarshallingJSON(&result),
944 autorest.ByClosing())
945 result.Response = autorest.Response{Response: resp}
946 return
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 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) {
980 if tracing.IsEnabled() {
981 ctx = tracing.StartSpan(ctx, fqdn+"/PathClient.Read")
982 defer func() {
983 sc := -1
984 if result.Response.Response != nil {
985 sc = result.Response.Response.StatusCode
986 }
987 tracing.EndSpan(ctx, sc, err)
988 }()
989 }
990 if err := validation.Validate([]validation.Validation{
991 {TargetValue: xMsLeaseID,
992 Constraints: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Empty, Rule: false,
993 Chain: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
994 {TargetValue: filesystem,
995 Constraints: []validation.Constraint{{Target: "filesystem", Name: validation.MaxLength, Rule: 63, Chain: nil},
996 {Target: "filesystem", Name: validation.MinLength, Rule: 3, Chain: nil}}},
997 {TargetValue: xMsClientRequestID,
998 Constraints: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Empty, Rule: false,
999 Chain: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
1000 {TargetValue: timeout,
1001 Constraints: []validation.Constraint{{Target: "timeout", Name: validation.Null, Rule: false,
1002 Chain: []validation.Constraint{{Target: "timeout", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}}); err != nil {
1003 return result, validation.NewError("storagedatalake.PathClient", "Read", err.Error())
1004 }
1005
1006 req, err := client.ReadPreparer(ctx, filesystem, pathParameter, rangeParameter, xMsLeaseID, xMsRangeGetContentMd5, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince, xMsClientRequestID, timeout, xMsDate)
1007 if err != nil {
1008 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Read", nil, "Failure preparing request")
1009 return
1010 }
1011
1012 resp, err := client.ReadSender(req)
1013 if err != nil {
1014 result.Response = autorest.Response{Response: resp}
1015 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Read", resp, "Failure sending request")
1016 return
1017 }
1018
1019 result, err = client.ReadResponder(resp)
1020 if err != nil {
1021 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Read", resp, "Failure responding to request")
1022 return
1023 }
1024
1025 return
1026 }
1027
1028
1029 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) {
1030 urlParameters := map[string]interface{}{
1031 "accountName": client.AccountName,
1032 "dnsSuffix": client.DNSSuffix,
1033 }
1034
1035 pathParameters := map[string]interface{}{
1036 "filesystem": autorest.Encode("path", filesystem),
1037 "path": autorest.Encode("path", pathParameter),
1038 }
1039
1040 queryParameters := map[string]interface{}{}
1041 if timeout != nil {
1042 queryParameters["timeout"] = autorest.Encode("query", *timeout)
1043 }
1044
1045 preparer := autorest.CreatePreparer(
1046 autorest.AsGet(),
1047 autorest.WithCustomBaseURL("https://{accountName}.{dnsSuffix}", urlParameters),
1048 autorest.WithPathParameters("/{filesystem}/{path}", pathParameters),
1049 autorest.WithQueryParameters(queryParameters))
1050 if len(rangeParameter) > 0 {
1051 preparer = autorest.DecoratePreparer(preparer,
1052 autorest.WithHeader("Range", autorest.String(rangeParameter)))
1053 }
1054 if len(xMsLeaseID) > 0 {
1055 preparer = autorest.DecoratePreparer(preparer,
1056 autorest.WithHeader("x-ms-lease-id", autorest.String(xMsLeaseID)))
1057 }
1058 if xMsRangeGetContentMd5 != nil {
1059 preparer = autorest.DecoratePreparer(preparer,
1060 autorest.WithHeader("x-ms-range-get-content-md5", autorest.String(xMsRangeGetContentMd5)))
1061 }
1062 if len(ifMatch) > 0 {
1063 preparer = autorest.DecoratePreparer(preparer,
1064 autorest.WithHeader("If-Match", autorest.String(ifMatch)))
1065 }
1066 if len(ifNoneMatch) > 0 {
1067 preparer = autorest.DecoratePreparer(preparer,
1068 autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch)))
1069 }
1070 if len(ifModifiedSince) > 0 {
1071 preparer = autorest.DecoratePreparer(preparer,
1072 autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince)))
1073 }
1074 if len(ifUnmodifiedSince) > 0 {
1075 preparer = autorest.DecoratePreparer(preparer,
1076 autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince)))
1077 }
1078 if len(xMsClientRequestID) > 0 {
1079 preparer = autorest.DecoratePreparer(preparer,
1080 autorest.WithHeader("x-ms-client-request-id", autorest.String(xMsClientRequestID)))
1081 }
1082 if len(xMsDate) > 0 {
1083 preparer = autorest.DecoratePreparer(preparer,
1084 autorest.WithHeader("x-ms-date", autorest.String(xMsDate)))
1085 }
1086 if len(client.XMsVersion) > 0 {
1087 preparer = autorest.DecoratePreparer(preparer,
1088 autorest.WithHeader("x-ms-version", autorest.String(client.XMsVersion)))
1089 }
1090 return preparer.Prepare((&http.Request{}).WithContext(ctx))
1091 }
1092
1093
1094
1095 func (client PathClient) ReadSender(req *http.Request) (*http.Response, error) {
1096 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1097 }
1098
1099
1100
1101 func (client PathClient) ReadResponder(resp *http.Response) (result ReadCloser, err error) {
1102 result.Value = &resp.Body
1103 err = autorest.Respond(
1104 resp,
1105 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusPartialContent))
1106 result.Response = autorest.Response{Response: resp}
1107 return
1108 }
1109
1110
1111
1112
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 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) {
1217 if tracing.IsEnabled() {
1218 ctx = tracing.StartSpan(ctx, fqdn+"/PathClient.Update")
1219 defer func() {
1220 sc := -1
1221 if result.Response != nil {
1222 sc = result.Response.StatusCode
1223 }
1224 tracing.EndSpan(ctx, sc, err)
1225 }()
1226 }
1227 if err := validation.Validate([]validation.Validation{
1228 {TargetValue: contentLength,
1229 Constraints: []validation.Constraint{{Target: "contentLength", Name: validation.Null, Rule: false,
1230 Chain: []validation.Constraint{{Target: "contentLength", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}},
1231 {TargetValue: xMsLeaseID,
1232 Constraints: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Empty, Rule: false,
1233 Chain: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
1234 {TargetValue: filesystem,
1235 Constraints: []validation.Constraint{{Target: "filesystem", Name: validation.MaxLength, Rule: 63, Chain: nil},
1236 {Target: "filesystem", Name: validation.MinLength, Rule: 3, Chain: nil}}},
1237 {TargetValue: xMsClientRequestID,
1238 Constraints: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Empty, Rule: false,
1239 Chain: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
1240 {TargetValue: timeout,
1241 Constraints: []validation.Constraint{{Target: "timeout", Name: validation.Null, Rule: false,
1242 Chain: []validation.Constraint{{Target: "timeout", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}}); err != nil {
1243 return result, validation.NewError("storagedatalake.PathClient", "Update", err.Error())
1244 }
1245
1246 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)
1247 if err != nil {
1248 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Update", nil, "Failure preparing request")
1249 return
1250 }
1251
1252 resp, err := client.UpdateSender(req)
1253 if err != nil {
1254 result.Response = resp
1255 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Update", resp, "Failure sending request")
1256 return
1257 }
1258
1259 result, err = client.UpdateResponder(resp)
1260 if err != nil {
1261 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Update", resp, "Failure responding to request")
1262 return
1263 }
1264
1265 return
1266 }
1267
1268
1269 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) {
1270 urlParameters := map[string]interface{}{
1271 "accountName": client.AccountName,
1272 "dnsSuffix": client.DNSSuffix,
1273 }
1274
1275 pathParameters := map[string]interface{}{
1276 "filesystem": autorest.Encode("path", filesystem),
1277 "path": autorest.Encode("path", pathParameter),
1278 }
1279
1280 queryParameters := map[string]interface{}{
1281 "action": autorest.Encode("query", action),
1282 }
1283 if position != nil {
1284 queryParameters["position"] = autorest.Encode("query", *position)
1285 }
1286 if retainUncommittedData != nil {
1287 queryParameters["retainUncommittedData"] = autorest.Encode("query", *retainUncommittedData)
1288 }
1289 if closeParameter != nil {
1290 queryParameters["close"] = autorest.Encode("query", *closeParameter)
1291 }
1292 if timeout != nil {
1293 queryParameters["timeout"] = autorest.Encode("query", *timeout)
1294 }
1295
1296 preparer := autorest.CreatePreparer(
1297 autorest.AsContentType("application/octet-stream"),
1298 autorest.AsPatch(),
1299 autorest.WithCustomBaseURL("https://{accountName}.{dnsSuffix}", urlParameters),
1300 autorest.WithPathParameters("/{filesystem}/{path}", pathParameters),
1301 autorest.WithQueryParameters(queryParameters))
1302 if requestBody != nil {
1303 preparer = autorest.DecoratePreparer(preparer,
1304 autorest.WithFile(requestBody))
1305 }
1306 if contentLength != nil {
1307 preparer = autorest.DecoratePreparer(preparer,
1308 autorest.WithHeader("Content-Length", autorest.String(*contentLength)))
1309 }
1310 if len(contentMD5) > 0 {
1311 preparer = autorest.DecoratePreparer(preparer,
1312 autorest.WithHeader("Content-MD5", autorest.String(contentMD5)))
1313 }
1314 if len(xMsLeaseID) > 0 {
1315 preparer = autorest.DecoratePreparer(preparer,
1316 autorest.WithHeader("x-ms-lease-id", autorest.String(xMsLeaseID)))
1317 }
1318 if len(xMsCacheControl) > 0 {
1319 preparer = autorest.DecoratePreparer(preparer,
1320 autorest.WithHeader("x-ms-cache-control", autorest.String(xMsCacheControl)))
1321 }
1322 if len(xMsContentType) > 0 {
1323 preparer = autorest.DecoratePreparer(preparer,
1324 autorest.WithHeader("x-ms-content-type", autorest.String(xMsContentType)))
1325 }
1326 if len(xMsContentDisposition) > 0 {
1327 preparer = autorest.DecoratePreparer(preparer,
1328 autorest.WithHeader("x-ms-content-disposition", autorest.String(xMsContentDisposition)))
1329 }
1330 if len(xMsContentEncoding) > 0 {
1331 preparer = autorest.DecoratePreparer(preparer,
1332 autorest.WithHeader("x-ms-content-encoding", autorest.String(xMsContentEncoding)))
1333 }
1334 if len(xMsContentLanguage) > 0 {
1335 preparer = autorest.DecoratePreparer(preparer,
1336 autorest.WithHeader("x-ms-content-language", autorest.String(xMsContentLanguage)))
1337 }
1338 if len(xMsContentMd5) > 0 {
1339 preparer = autorest.DecoratePreparer(preparer,
1340 autorest.WithHeader("x-ms-content-md5", autorest.String(xMsContentMd5)))
1341 }
1342 if len(xMsProperties) > 0 {
1343 preparer = autorest.DecoratePreparer(preparer,
1344 autorest.WithHeader("x-ms-properties", autorest.String(xMsProperties)))
1345 }
1346 if len(xMsOwner) > 0 {
1347 preparer = autorest.DecoratePreparer(preparer,
1348 autorest.WithHeader("x-ms-owner", autorest.String(xMsOwner)))
1349 }
1350 if len(xMsGroup) > 0 {
1351 preparer = autorest.DecoratePreparer(preparer,
1352 autorest.WithHeader("x-ms-group", autorest.String(xMsGroup)))
1353 }
1354 if len(xMsPermissions) > 0 {
1355 preparer = autorest.DecoratePreparer(preparer,
1356 autorest.WithHeader("x-ms-permissions", autorest.String(xMsPermissions)))
1357 }
1358 if len(xMsACL) > 0 {
1359 preparer = autorest.DecoratePreparer(preparer,
1360 autorest.WithHeader("x-ms-acl", autorest.String(xMsACL)))
1361 }
1362 if len(ifMatch) > 0 {
1363 preparer = autorest.DecoratePreparer(preparer,
1364 autorest.WithHeader("If-Match", autorest.String(ifMatch)))
1365 }
1366 if len(ifNoneMatch) > 0 {
1367 preparer = autorest.DecoratePreparer(preparer,
1368 autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch)))
1369 }
1370 if len(ifModifiedSince) > 0 {
1371 preparer = autorest.DecoratePreparer(preparer,
1372 autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince)))
1373 }
1374 if len(ifUnmodifiedSince) > 0 {
1375 preparer = autorest.DecoratePreparer(preparer,
1376 autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince)))
1377 }
1378 if len(xMsClientRequestID) > 0 {
1379 preparer = autorest.DecoratePreparer(preparer,
1380 autorest.WithHeader("x-ms-client-request-id", autorest.String(xMsClientRequestID)))
1381 }
1382 if len(xMsDate) > 0 {
1383 preparer = autorest.DecoratePreparer(preparer,
1384 autorest.WithHeader("x-ms-date", autorest.String(xMsDate)))
1385 }
1386 if len(client.XMsVersion) > 0 {
1387 preparer = autorest.DecoratePreparer(preparer,
1388 autorest.WithHeader("x-ms-version", autorest.String(client.XMsVersion)))
1389 }
1390 return preparer.Prepare((&http.Request{}).WithContext(ctx))
1391 }
1392
1393
1394
1395 func (client PathClient) UpdateSender(req *http.Request) (*http.Response, error) {
1396 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1397 }
1398
1399
1400
1401 func (client PathClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) {
1402 err = autorest.Respond(
1403 resp,
1404 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
1405 autorest.ByClosing())
1406 result.Response = resp
1407 return
1408 }
1409
View as plain text