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 func (client PathClient) Create(ctx context.Context, filesystem string, pathParameter string, resource PathResourceType, continuation string, mode PathRenameMode, cacheControl string, contentEncoding string, contentLanguage string, contentDisposition string, xMsCacheControl string, xMsContentType string, xMsContentEncoding string, xMsContentLanguage string, xMsContentDisposition string, xMsRenameSource string, xMsLeaseID string, xMsProposedLeaseID string, xMsSourceLeaseID string, xMsProperties string, xMsPermissions string, ifMatch string, ifNoneMatch string, ifModifiedSince string, ifUnmodifiedSince string, xMsSourceIfMatch string, xMsSourceIfNoneMatch string, xMsSourceIfModifiedSince string, xMsSourceIfUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (result autorest.Response, err error) {
100 if tracing.IsEnabled() {
101 ctx = tracing.StartSpan(ctx, fqdn+"/PathClient.Create")
102 defer func() {
103 sc := -1
104 if result.Response != nil {
105 sc = result.Response.StatusCode
106 }
107 tracing.EndSpan(ctx, sc, err)
108 }()
109 }
110 if err := validation.Validate([]validation.Validation{
111 {TargetValue: xMsLeaseID,
112 Constraints: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Empty, Rule: false,
113 Chain: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
114 {TargetValue: xMsProposedLeaseID,
115 Constraints: []validation.Constraint{{Target: "xMsProposedLeaseID", Name: validation.Empty, Rule: false,
116 Chain: []validation.Constraint{{Target: "xMsProposedLeaseID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
117 {TargetValue: xMsSourceLeaseID,
118 Constraints: []validation.Constraint{{Target: "xMsSourceLeaseID", Name: validation.Empty, Rule: false,
119 Chain: []validation.Constraint{{Target: "xMsSourceLeaseID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
120 {TargetValue: filesystem,
121 Constraints: []validation.Constraint{{Target: "filesystem", Name: validation.MaxLength, Rule: 63, Chain: nil},
122 {Target: "filesystem", Name: validation.MinLength, Rule: 3, Chain: nil}}},
123 {TargetValue: xMsClientRequestID,
124 Constraints: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Empty, Rule: false,
125 Chain: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
126 {TargetValue: timeout,
127 Constraints: []validation.Constraint{{Target: "timeout", Name: validation.Null, Rule: false,
128 Chain: []validation.Constraint{{Target: "timeout", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}}); err != nil {
129 return result, validation.NewError("storagedatalake.PathClient", "Create", err.Error())
130 }
131
132 req, err := client.CreatePreparer(ctx, filesystem, pathParameter, resource, continuation, mode, cacheControl, contentEncoding, contentLanguage, contentDisposition, xMsCacheControl, xMsContentType, xMsContentEncoding, xMsContentLanguage, xMsContentDisposition, xMsRenameSource, xMsLeaseID, xMsProposedLeaseID, xMsSourceLeaseID, xMsProperties, xMsPermissions, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince, xMsSourceIfMatch, xMsSourceIfNoneMatch, xMsSourceIfModifiedSince, xMsSourceIfUnmodifiedSince, xMsClientRequestID, timeout, xMsDate)
133 if err != nil {
134 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Create", nil, "Failure preparing request")
135 return
136 }
137
138 resp, err := client.CreateSender(req)
139 if err != nil {
140 result.Response = resp
141 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Create", resp, "Failure sending request")
142 return
143 }
144
145 result, err = client.CreateResponder(resp)
146 if err != nil {
147 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Create", resp, "Failure responding to request")
148 return
149 }
150
151 return
152 }
153
154
155 func (client PathClient) CreatePreparer(ctx context.Context, filesystem string, pathParameter string, resource PathResourceType, continuation string, mode PathRenameMode, cacheControl string, contentEncoding string, contentLanguage string, contentDisposition string, xMsCacheControl string, xMsContentType string, xMsContentEncoding string, xMsContentLanguage string, xMsContentDisposition string, xMsRenameSource string, xMsLeaseID string, xMsProposedLeaseID string, xMsSourceLeaseID string, xMsProperties string, xMsPermissions string, ifMatch string, ifNoneMatch string, ifModifiedSince string, ifUnmodifiedSince string, xMsSourceIfMatch string, xMsSourceIfNoneMatch string, xMsSourceIfModifiedSince string, xMsSourceIfUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (*http.Request, error) {
156 urlParameters := map[string]interface{}{
157 "accountName": client.AccountName,
158 "dnsSuffix": client.DNSSuffix,
159 }
160
161 pathParameters := map[string]interface{}{
162 "filesystem": autorest.Encode("path", filesystem),
163 "path": autorest.Encode("path", pathParameter),
164 }
165
166 queryParameters := map[string]interface{}{}
167 if len(string(resource)) > 0 {
168 queryParameters["resource"] = autorest.Encode("query", resource)
169 }
170 if len(continuation) > 0 {
171 queryParameters["continuation"] = autorest.Encode("query", continuation)
172 }
173 if len(string(mode)) > 0 {
174 queryParameters["mode"] = autorest.Encode("query", mode)
175 }
176 if timeout != nil {
177 queryParameters["timeout"] = autorest.Encode("query", *timeout)
178 }
179
180 preparer := autorest.CreatePreparer(
181 autorest.AsPut(),
182 autorest.WithCustomBaseURL("https://{accountName}.{dnsSuffix}", urlParameters),
183 autorest.WithPathParameters("/{filesystem}/{path}", pathParameters),
184 autorest.WithQueryParameters(queryParameters))
185 if len(cacheControl) > 0 {
186 preparer = autorest.DecoratePreparer(preparer,
187 autorest.WithHeader("Cache-Control", autorest.String(cacheControl)))
188 }
189 if len(contentEncoding) > 0 {
190 preparer = autorest.DecoratePreparer(preparer,
191 autorest.WithHeader("Content-Encoding", autorest.String(contentEncoding)))
192 }
193 if len(contentLanguage) > 0 {
194 preparer = autorest.DecoratePreparer(preparer,
195 autorest.WithHeader("Content-Language", autorest.String(contentLanguage)))
196 }
197 if len(contentDisposition) > 0 {
198 preparer = autorest.DecoratePreparer(preparer,
199 autorest.WithHeader("Content-Disposition", autorest.String(contentDisposition)))
200 }
201 if len(xMsCacheControl) > 0 {
202 preparer = autorest.DecoratePreparer(preparer,
203 autorest.WithHeader("x-ms-cache-control", autorest.String(xMsCacheControl)))
204 }
205 if len(xMsContentType) > 0 {
206 preparer = autorest.DecoratePreparer(preparer,
207 autorest.WithHeader("x-ms-content-type", autorest.String(xMsContentType)))
208 }
209 if len(xMsContentEncoding) > 0 {
210 preparer = autorest.DecoratePreparer(preparer,
211 autorest.WithHeader("x-ms-content-encoding", autorest.String(xMsContentEncoding)))
212 }
213 if len(xMsContentLanguage) > 0 {
214 preparer = autorest.DecoratePreparer(preparer,
215 autorest.WithHeader("x-ms-content-language", autorest.String(xMsContentLanguage)))
216 }
217 if len(xMsContentDisposition) > 0 {
218 preparer = autorest.DecoratePreparer(preparer,
219 autorest.WithHeader("x-ms-content-disposition", autorest.String(xMsContentDisposition)))
220 }
221 if len(xMsRenameSource) > 0 {
222 preparer = autorest.DecoratePreparer(preparer,
223 autorest.WithHeader("x-ms-rename-source", autorest.String(xMsRenameSource)))
224 }
225 if len(xMsLeaseID) > 0 {
226 preparer = autorest.DecoratePreparer(preparer,
227 autorest.WithHeader("x-ms-lease-id", autorest.String(xMsLeaseID)))
228 }
229 if len(xMsProposedLeaseID) > 0 {
230 preparer = autorest.DecoratePreparer(preparer,
231 autorest.WithHeader("x-ms-proposed-lease-id", autorest.String(xMsProposedLeaseID)))
232 }
233 if len(xMsSourceLeaseID) > 0 {
234 preparer = autorest.DecoratePreparer(preparer,
235 autorest.WithHeader("x-ms-source-lease-id", autorest.String(xMsSourceLeaseID)))
236 }
237 if len(xMsProperties) > 0 {
238 preparer = autorest.DecoratePreparer(preparer,
239 autorest.WithHeader("x-ms-properties", autorest.String(xMsProperties)))
240 }
241 if len(xMsPermissions) > 0 {
242 preparer = autorest.DecoratePreparer(preparer,
243 autorest.WithHeader("x-ms-permissions", autorest.String(xMsPermissions)))
244 }
245 if len(ifMatch) > 0 {
246 preparer = autorest.DecoratePreparer(preparer,
247 autorest.WithHeader("If-Match", autorest.String(ifMatch)))
248 }
249 if len(ifNoneMatch) > 0 {
250 preparer = autorest.DecoratePreparer(preparer,
251 autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch)))
252 }
253 if len(ifModifiedSince) > 0 {
254 preparer = autorest.DecoratePreparer(preparer,
255 autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince)))
256 }
257 if len(ifUnmodifiedSince) > 0 {
258 preparer = autorest.DecoratePreparer(preparer,
259 autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince)))
260 }
261 if len(xMsSourceIfMatch) > 0 {
262 preparer = autorest.DecoratePreparer(preparer,
263 autorest.WithHeader("x-ms-source-if-match", autorest.String(xMsSourceIfMatch)))
264 }
265 if len(xMsSourceIfNoneMatch) > 0 {
266 preparer = autorest.DecoratePreparer(preparer,
267 autorest.WithHeader("x-ms-source-if-none-match", autorest.String(xMsSourceIfNoneMatch)))
268 }
269 if len(xMsSourceIfModifiedSince) > 0 {
270 preparer = autorest.DecoratePreparer(preparer,
271 autorest.WithHeader("x-ms-source-if-modified-since", autorest.String(xMsSourceIfModifiedSince)))
272 }
273 if len(xMsSourceIfUnmodifiedSince) > 0 {
274 preparer = autorest.DecoratePreparer(preparer,
275 autorest.WithHeader("x-ms-source-if-unmodified-since", autorest.String(xMsSourceIfUnmodifiedSince)))
276 }
277 if len(xMsClientRequestID) > 0 {
278 preparer = autorest.DecoratePreparer(preparer,
279 autorest.WithHeader("x-ms-client-request-id", autorest.String(xMsClientRequestID)))
280 }
281 if len(xMsDate) > 0 {
282 preparer = autorest.DecoratePreparer(preparer,
283 autorest.WithHeader("x-ms-date", autorest.String(xMsDate)))
284 }
285 if len(client.XMsVersion) > 0 {
286 preparer = autorest.DecoratePreparer(preparer,
287 autorest.WithHeader("x-ms-version", autorest.String(client.XMsVersion)))
288 }
289 return preparer.Prepare((&http.Request{}).WithContext(ctx))
290 }
291
292
293
294 func (client PathClient) CreateSender(req *http.Request) (*http.Response, error) {
295 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
296 }
297
298
299
300 func (client PathClient) CreateResponder(resp *http.Response) (result autorest.Response, err error) {
301 err = autorest.Respond(
302 resp,
303 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
304 autorest.ByClosing())
305 result.Response = resp
306 return
307 }
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336 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) {
337 if tracing.IsEnabled() {
338 ctx = tracing.StartSpan(ctx, fqdn+"/PathClient.Delete")
339 defer func() {
340 sc := -1
341 if result.Response != nil {
342 sc = result.Response.StatusCode
343 }
344 tracing.EndSpan(ctx, sc, err)
345 }()
346 }
347 if err := validation.Validate([]validation.Validation{
348 {TargetValue: xMsLeaseID,
349 Constraints: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Empty, Rule: false,
350 Chain: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
351 {TargetValue: filesystem,
352 Constraints: []validation.Constraint{{Target: "filesystem", Name: validation.MaxLength, Rule: 63, Chain: nil},
353 {Target: "filesystem", Name: validation.MinLength, Rule: 3, Chain: nil}}},
354 {TargetValue: xMsClientRequestID,
355 Constraints: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Empty, Rule: false,
356 Chain: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
357 {TargetValue: timeout,
358 Constraints: []validation.Constraint{{Target: "timeout", Name: validation.Null, Rule: false,
359 Chain: []validation.Constraint{{Target: "timeout", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}}); err != nil {
360 return result, validation.NewError("storagedatalake.PathClient", "Delete", err.Error())
361 }
362
363 req, err := client.DeletePreparer(ctx, filesystem, pathParameter, recursive, continuation, xMsLeaseID, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince, xMsClientRequestID, timeout, xMsDate)
364 if err != nil {
365 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Delete", nil, "Failure preparing request")
366 return
367 }
368
369 resp, err := client.DeleteSender(req)
370 if err != nil {
371 result.Response = resp
372 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Delete", resp, "Failure sending request")
373 return
374 }
375
376 result, err = client.DeleteResponder(resp)
377 if err != nil {
378 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Delete", resp, "Failure responding to request")
379 return
380 }
381
382 return
383 }
384
385
386 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) {
387 urlParameters := map[string]interface{}{
388 "accountName": client.AccountName,
389 "dnsSuffix": client.DNSSuffix,
390 }
391
392 pathParameters := map[string]interface{}{
393 "filesystem": autorest.Encode("path", filesystem),
394 "path": autorest.Encode("path", pathParameter),
395 }
396
397 queryParameters := map[string]interface{}{}
398 if recursive != nil {
399 queryParameters["recursive"] = autorest.Encode("query", *recursive)
400 }
401 if len(continuation) > 0 {
402 queryParameters["continuation"] = autorest.Encode("query", continuation)
403 }
404 if timeout != nil {
405 queryParameters["timeout"] = autorest.Encode("query", *timeout)
406 }
407
408 preparer := autorest.CreatePreparer(
409 autorest.AsDelete(),
410 autorest.WithCustomBaseURL("https://{accountName}.{dnsSuffix}", urlParameters),
411 autorest.WithPathParameters("/{filesystem}/{path}", pathParameters),
412 autorest.WithQueryParameters(queryParameters))
413 if len(xMsLeaseID) > 0 {
414 preparer = autorest.DecoratePreparer(preparer,
415 autorest.WithHeader("x-ms-lease-id", autorest.String(xMsLeaseID)))
416 }
417 if len(ifMatch) > 0 {
418 preparer = autorest.DecoratePreparer(preparer,
419 autorest.WithHeader("If-Match", autorest.String(ifMatch)))
420 }
421 if len(ifNoneMatch) > 0 {
422 preparer = autorest.DecoratePreparer(preparer,
423 autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch)))
424 }
425 if len(ifModifiedSince) > 0 {
426 preparer = autorest.DecoratePreparer(preparer,
427 autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince)))
428 }
429 if len(ifUnmodifiedSince) > 0 {
430 preparer = autorest.DecoratePreparer(preparer,
431 autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince)))
432 }
433 if len(xMsClientRequestID) > 0 {
434 preparer = autorest.DecoratePreparer(preparer,
435 autorest.WithHeader("x-ms-client-request-id", autorest.String(xMsClientRequestID)))
436 }
437 if len(xMsDate) > 0 {
438 preparer = autorest.DecoratePreparer(preparer,
439 autorest.WithHeader("x-ms-date", autorest.String(xMsDate)))
440 }
441 if len(client.XMsVersion) > 0 {
442 preparer = autorest.DecoratePreparer(preparer,
443 autorest.WithHeader("x-ms-version", autorest.String(client.XMsVersion)))
444 }
445 return preparer.Prepare((&http.Request{}).WithContext(ctx))
446 }
447
448
449
450 func (client PathClient) DeleteSender(req *http.Request) (*http.Response, error) {
451 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
452 }
453
454
455
456 func (client PathClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
457 err = autorest.Respond(
458 resp,
459 azure.WithErrorUnlessStatusCode(http.StatusOK),
460 autorest.ByClosing())
461 result.Response = resp
462 return
463 }
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488 func (client PathClient) GetProperties(ctx context.Context, filesystem string, pathParameter string, action PathGetPropertiesAction, ifMatch string, ifNoneMatch string, ifModifiedSince string, ifUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (result autorest.Response, err error) {
489 if tracing.IsEnabled() {
490 ctx = tracing.StartSpan(ctx, fqdn+"/PathClient.GetProperties")
491 defer func() {
492 sc := -1
493 if result.Response != nil {
494 sc = result.Response.StatusCode
495 }
496 tracing.EndSpan(ctx, sc, err)
497 }()
498 }
499 if err := validation.Validate([]validation.Validation{
500 {TargetValue: filesystem,
501 Constraints: []validation.Constraint{{Target: "filesystem", Name: validation.MaxLength, Rule: 63, Chain: nil},
502 {Target: "filesystem", Name: validation.MinLength, Rule: 3, Chain: nil}}},
503 {TargetValue: xMsClientRequestID,
504 Constraints: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Empty, Rule: false,
505 Chain: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
506 {TargetValue: timeout,
507 Constraints: []validation.Constraint{{Target: "timeout", Name: validation.Null, Rule: false,
508 Chain: []validation.Constraint{{Target: "timeout", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}}); err != nil {
509 return result, validation.NewError("storagedatalake.PathClient", "GetProperties", err.Error())
510 }
511
512 req, err := client.GetPropertiesPreparer(ctx, filesystem, pathParameter, action, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince, xMsClientRequestID, timeout, xMsDate)
513 if err != nil {
514 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "GetProperties", nil, "Failure preparing request")
515 return
516 }
517
518 resp, err := client.GetPropertiesSender(req)
519 if err != nil {
520 result.Response = resp
521 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "GetProperties", resp, "Failure sending request")
522 return
523 }
524
525 result, err = client.GetPropertiesResponder(resp)
526 if err != nil {
527 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "GetProperties", resp, "Failure responding to request")
528 return
529 }
530
531 return
532 }
533
534
535 func (client PathClient) GetPropertiesPreparer(ctx context.Context, filesystem string, pathParameter string, action PathGetPropertiesAction, ifMatch string, ifNoneMatch string, ifModifiedSince string, ifUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (*http.Request, error) {
536 urlParameters := map[string]interface{}{
537 "accountName": client.AccountName,
538 "dnsSuffix": client.DNSSuffix,
539 }
540
541 pathParameters := map[string]interface{}{
542 "filesystem": autorest.Encode("path", filesystem),
543 "path": autorest.Encode("path", pathParameter),
544 }
545
546 queryParameters := map[string]interface{}{}
547 if len(string(action)) > 0 {
548 queryParameters["action"] = autorest.Encode("query", action)
549 }
550 if timeout != nil {
551 queryParameters["timeout"] = autorest.Encode("query", *timeout)
552 }
553
554 preparer := autorest.CreatePreparer(
555 autorest.AsHead(),
556 autorest.WithCustomBaseURL("https://{accountName}.{dnsSuffix}", urlParameters),
557 autorest.WithPathParameters("/{filesystem}/{path}", pathParameters),
558 autorest.WithQueryParameters(queryParameters))
559 if len(ifMatch) > 0 {
560 preparer = autorest.DecoratePreparer(preparer,
561 autorest.WithHeader("If-Match", autorest.String(ifMatch)))
562 }
563 if len(ifNoneMatch) > 0 {
564 preparer = autorest.DecoratePreparer(preparer,
565 autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch)))
566 }
567 if len(ifModifiedSince) > 0 {
568 preparer = autorest.DecoratePreparer(preparer,
569 autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince)))
570 }
571 if len(ifUnmodifiedSince) > 0 {
572 preparer = autorest.DecoratePreparer(preparer,
573 autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince)))
574 }
575 if len(xMsClientRequestID) > 0 {
576 preparer = autorest.DecoratePreparer(preparer,
577 autorest.WithHeader("x-ms-client-request-id", autorest.String(xMsClientRequestID)))
578 }
579 if len(xMsDate) > 0 {
580 preparer = autorest.DecoratePreparer(preparer,
581 autorest.WithHeader("x-ms-date", autorest.String(xMsDate)))
582 }
583 if len(client.XMsVersion) > 0 {
584 preparer = autorest.DecoratePreparer(preparer,
585 autorest.WithHeader("x-ms-version", autorest.String(client.XMsVersion)))
586 }
587 return preparer.Prepare((&http.Request{}).WithContext(ctx))
588 }
589
590
591
592 func (client PathClient) GetPropertiesSender(req *http.Request) (*http.Response, error) {
593 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
594 }
595
596
597
598 func (client PathClient) GetPropertiesResponder(resp *http.Response) (result autorest.Response, err error) {
599 err = autorest.Respond(
600 resp,
601 azure.WithErrorUnlessStatusCode(http.StatusOK),
602 autorest.ByClosing())
603 result.Response = resp
604 return
605 }
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644 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) {
645 if tracing.IsEnabled() {
646 ctx = tracing.StartSpan(ctx, fqdn+"/PathClient.Lease")
647 defer func() {
648 sc := -1
649 if result.Response != nil {
650 sc = result.Response.StatusCode
651 }
652 tracing.EndSpan(ctx, sc, err)
653 }()
654 }
655 if err := validation.Validate([]validation.Validation{
656 {TargetValue: xMsLeaseID,
657 Constraints: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Empty, Rule: false,
658 Chain: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
659 {TargetValue: xMsProposedLeaseID,
660 Constraints: []validation.Constraint{{Target: "xMsProposedLeaseID", Name: validation.Empty, Rule: false,
661 Chain: []validation.Constraint{{Target: "xMsProposedLeaseID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
662 {TargetValue: filesystem,
663 Constraints: []validation.Constraint{{Target: "filesystem", Name: validation.MaxLength, Rule: 63, Chain: nil},
664 {Target: "filesystem", Name: validation.MinLength, Rule: 3, Chain: nil}}},
665 {TargetValue: xMsClientRequestID,
666 Constraints: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Empty, Rule: false,
667 Chain: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
668 {TargetValue: timeout,
669 Constraints: []validation.Constraint{{Target: "timeout", Name: validation.Null, Rule: false,
670 Chain: []validation.Constraint{{Target: "timeout", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}}); err != nil {
671 return result, validation.NewError("storagedatalake.PathClient", "Lease", err.Error())
672 }
673
674 req, err := client.LeasePreparer(ctx, xMsLeaseAction, filesystem, pathParameter, xMsLeaseDuration, xMsLeaseBreakPeriod, xMsLeaseID, xMsProposedLeaseID, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince, xMsClientRequestID, timeout, xMsDate)
675 if err != nil {
676 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Lease", nil, "Failure preparing request")
677 return
678 }
679
680 resp, err := client.LeaseSender(req)
681 if err != nil {
682 result.Response = resp
683 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Lease", resp, "Failure sending request")
684 return
685 }
686
687 result, err = client.LeaseResponder(resp)
688 if err != nil {
689 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Lease", resp, "Failure responding to request")
690 return
691 }
692
693 return
694 }
695
696
697 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) {
698 urlParameters := map[string]interface{}{
699 "accountName": client.AccountName,
700 "dnsSuffix": client.DNSSuffix,
701 }
702
703 pathParameters := map[string]interface{}{
704 "filesystem": autorest.Encode("path", filesystem),
705 "path": autorest.Encode("path", pathParameter),
706 }
707
708 queryParameters := map[string]interface{}{}
709 if timeout != nil {
710 queryParameters["timeout"] = autorest.Encode("query", *timeout)
711 }
712
713 preparer := autorest.CreatePreparer(
714 autorest.AsPost(),
715 autorest.WithCustomBaseURL("https://{accountName}.{dnsSuffix}", urlParameters),
716 autorest.WithPathParameters("/{filesystem}/{path}", pathParameters),
717 autorest.WithQueryParameters(queryParameters),
718 autorest.WithHeader("x-ms-lease-action", autorest.String(xMsLeaseAction)))
719 if xMsLeaseDuration != nil {
720 preparer = autorest.DecoratePreparer(preparer,
721 autorest.WithHeader("x-ms-lease-duration", autorest.String(*xMsLeaseDuration)))
722 }
723 if xMsLeaseBreakPeriod != nil {
724 preparer = autorest.DecoratePreparer(preparer,
725 autorest.WithHeader("x-ms-lease-break-period", autorest.String(*xMsLeaseBreakPeriod)))
726 }
727 if len(xMsLeaseID) > 0 {
728 preparer = autorest.DecoratePreparer(preparer,
729 autorest.WithHeader("x-ms-lease-id", autorest.String(xMsLeaseID)))
730 }
731 if len(xMsProposedLeaseID) > 0 {
732 preparer = autorest.DecoratePreparer(preparer,
733 autorest.WithHeader("x-ms-proposed-lease-id", autorest.String(xMsProposedLeaseID)))
734 }
735 if len(ifMatch) > 0 {
736 preparer = autorest.DecoratePreparer(preparer,
737 autorest.WithHeader("If-Match", autorest.String(ifMatch)))
738 }
739 if len(ifNoneMatch) > 0 {
740 preparer = autorest.DecoratePreparer(preparer,
741 autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch)))
742 }
743 if len(ifModifiedSince) > 0 {
744 preparer = autorest.DecoratePreparer(preparer,
745 autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince)))
746 }
747 if len(ifUnmodifiedSince) > 0 {
748 preparer = autorest.DecoratePreparer(preparer,
749 autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince)))
750 }
751 if len(xMsClientRequestID) > 0 {
752 preparer = autorest.DecoratePreparer(preparer,
753 autorest.WithHeader("x-ms-client-request-id", autorest.String(xMsClientRequestID)))
754 }
755 if len(xMsDate) > 0 {
756 preparer = autorest.DecoratePreparer(preparer,
757 autorest.WithHeader("x-ms-date", autorest.String(xMsDate)))
758 }
759 if len(client.XMsVersion) > 0 {
760 preparer = autorest.DecoratePreparer(preparer,
761 autorest.WithHeader("x-ms-version", autorest.String(client.XMsVersion)))
762 }
763 return preparer.Prepare((&http.Request{}).WithContext(ctx))
764 }
765
766
767
768 func (client PathClient) LeaseSender(req *http.Request) (*http.Response, error) {
769 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
770 }
771
772
773
774 func (client PathClient) LeaseResponder(resp *http.Response) (result autorest.Response, err error) {
775 err = autorest.Respond(
776 resp,
777 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted),
778 autorest.ByClosing())
779 result.Response = resp
780 return
781 }
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803 func (client PathClient) List(ctx context.Context, recursive bool, filesystem string, directory string, continuation string, maxResults *int32, xMsClientRequestID string, timeout *int32, xMsDate string) (result PathList, err error) {
804 if tracing.IsEnabled() {
805 ctx = tracing.StartSpan(ctx, fqdn+"/PathClient.List")
806 defer func() {
807 sc := -1
808 if result.Response.Response != nil {
809 sc = result.Response.Response.StatusCode
810 }
811 tracing.EndSpan(ctx, sc, err)
812 }()
813 }
814 if err := validation.Validate([]validation.Validation{
815 {TargetValue: maxResults,
816 Constraints: []validation.Constraint{{Target: "maxResults", Name: validation.Null, Rule: false,
817 Chain: []validation.Constraint{{Target: "maxResults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}},
818 {TargetValue: xMsClientRequestID,
819 Constraints: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Empty, Rule: false,
820 Chain: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
821 {TargetValue: timeout,
822 Constraints: []validation.Constraint{{Target: "timeout", Name: validation.Null, Rule: false,
823 Chain: []validation.Constraint{{Target: "timeout", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}}); err != nil {
824 return result, validation.NewError("storagedatalake.PathClient", "List", err.Error())
825 }
826
827 req, err := client.ListPreparer(ctx, recursive, filesystem, directory, continuation, maxResults, xMsClientRequestID, timeout, xMsDate)
828 if err != nil {
829 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "List", nil, "Failure preparing request")
830 return
831 }
832
833 resp, err := client.ListSender(req)
834 if err != nil {
835 result.Response = autorest.Response{Response: resp}
836 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "List", resp, "Failure sending request")
837 return
838 }
839
840 result, err = client.ListResponder(resp)
841 if err != nil {
842 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "List", resp, "Failure responding to request")
843 return
844 }
845
846 return
847 }
848
849
850 func (client PathClient) ListPreparer(ctx context.Context, recursive bool, filesystem string, directory string, continuation string, maxResults *int32, xMsClientRequestID string, timeout *int32, xMsDate string) (*http.Request, error) {
851 urlParameters := map[string]interface{}{
852 "accountName": client.AccountName,
853 "dnsSuffix": client.DNSSuffix,
854 }
855
856 pathParameters := map[string]interface{}{
857 "filesystem": autorest.Encode("path", filesystem),
858 }
859
860 queryParameters := map[string]interface{}{
861 "recursive": autorest.Encode("query", recursive),
862 "resource": autorest.Encode("query", "filesystem"),
863 }
864 if len(directory) > 0 {
865 queryParameters["directory"] = autorest.Encode("query", directory)
866 }
867 if len(continuation) > 0 {
868 queryParameters["continuation"] = autorest.Encode("query", continuation)
869 }
870 if maxResults != nil {
871 queryParameters["maxResults"] = autorest.Encode("query", *maxResults)
872 }
873 if timeout != nil {
874 queryParameters["timeout"] = autorest.Encode("query", *timeout)
875 }
876
877 preparer := autorest.CreatePreparer(
878 autorest.AsGet(),
879 autorest.WithCustomBaseURL("https://{accountName}.{dnsSuffix}", urlParameters),
880 autorest.WithPathParameters("/{filesystem}", pathParameters),
881 autorest.WithQueryParameters(queryParameters))
882 if len(xMsClientRequestID) > 0 {
883 preparer = autorest.DecoratePreparer(preparer,
884 autorest.WithHeader("x-ms-client-request-id", autorest.String(xMsClientRequestID)))
885 }
886 if len(xMsDate) > 0 {
887 preparer = autorest.DecoratePreparer(preparer,
888 autorest.WithHeader("x-ms-date", autorest.String(xMsDate)))
889 }
890 if len(client.XMsVersion) > 0 {
891 preparer = autorest.DecoratePreparer(preparer,
892 autorest.WithHeader("x-ms-version", autorest.String(client.XMsVersion)))
893 }
894 return preparer.Prepare((&http.Request{}).WithContext(ctx))
895 }
896
897
898
899 func (client PathClient) ListSender(req *http.Request) (*http.Response, error) {
900 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
901 }
902
903
904
905 func (client PathClient) ListResponder(resp *http.Response) (result PathList, err error) {
906 err = autorest.Respond(
907 resp,
908 azure.WithErrorUnlessStatusCode(http.StatusOK),
909 autorest.ByUnmarshallingJSON(&result),
910 autorest.ByClosing())
911 result.Response = autorest.Response{Response: resp}
912 return
913 }
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937 func (client PathClient) Read(ctx context.Context, filesystem string, pathParameter string, rangeParameter string, ifMatch string, ifNoneMatch string, ifModifiedSince string, ifUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (result ReadCloser, err error) {
938 if tracing.IsEnabled() {
939 ctx = tracing.StartSpan(ctx, fqdn+"/PathClient.Read")
940 defer func() {
941 sc := -1
942 if result.Response.Response != nil {
943 sc = result.Response.Response.StatusCode
944 }
945 tracing.EndSpan(ctx, sc, err)
946 }()
947 }
948 if err := validation.Validate([]validation.Validation{
949 {TargetValue: filesystem,
950 Constraints: []validation.Constraint{{Target: "filesystem", Name: validation.MaxLength, Rule: 63, Chain: nil},
951 {Target: "filesystem", Name: validation.MinLength, Rule: 3, Chain: nil}}},
952 {TargetValue: xMsClientRequestID,
953 Constraints: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Empty, Rule: false,
954 Chain: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
955 {TargetValue: timeout,
956 Constraints: []validation.Constraint{{Target: "timeout", Name: validation.Null, Rule: false,
957 Chain: []validation.Constraint{{Target: "timeout", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}}); err != nil {
958 return result, validation.NewError("storagedatalake.PathClient", "Read", err.Error())
959 }
960
961 req, err := client.ReadPreparer(ctx, filesystem, pathParameter, rangeParameter, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince, xMsClientRequestID, timeout, xMsDate)
962 if err != nil {
963 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Read", nil, "Failure preparing request")
964 return
965 }
966
967 resp, err := client.ReadSender(req)
968 if err != nil {
969 result.Response = autorest.Response{Response: resp}
970 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Read", resp, "Failure sending request")
971 return
972 }
973
974 result, err = client.ReadResponder(resp)
975 if err != nil {
976 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Read", resp, "Failure responding to request")
977 return
978 }
979
980 return
981 }
982
983
984 func (client PathClient) ReadPreparer(ctx context.Context, filesystem string, pathParameter string, rangeParameter string, ifMatch string, ifNoneMatch string, ifModifiedSince string, ifUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (*http.Request, error) {
985 urlParameters := map[string]interface{}{
986 "accountName": client.AccountName,
987 "dnsSuffix": client.DNSSuffix,
988 }
989
990 pathParameters := map[string]interface{}{
991 "filesystem": autorest.Encode("path", filesystem),
992 "path": autorest.Encode("path", pathParameter),
993 }
994
995 queryParameters := map[string]interface{}{}
996 if timeout != nil {
997 queryParameters["timeout"] = autorest.Encode("query", *timeout)
998 }
999
1000 preparer := autorest.CreatePreparer(
1001 autorest.AsGet(),
1002 autorest.WithCustomBaseURL("https://{accountName}.{dnsSuffix}", urlParameters),
1003 autorest.WithPathParameters("/{filesystem}/{path}", pathParameters),
1004 autorest.WithQueryParameters(queryParameters))
1005 if len(rangeParameter) > 0 {
1006 preparer = autorest.DecoratePreparer(preparer,
1007 autorest.WithHeader("Range", autorest.String(rangeParameter)))
1008 }
1009 if len(ifMatch) > 0 {
1010 preparer = autorest.DecoratePreparer(preparer,
1011 autorest.WithHeader("If-Match", autorest.String(ifMatch)))
1012 }
1013 if len(ifNoneMatch) > 0 {
1014 preparer = autorest.DecoratePreparer(preparer,
1015 autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch)))
1016 }
1017 if len(ifModifiedSince) > 0 {
1018 preparer = autorest.DecoratePreparer(preparer,
1019 autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince)))
1020 }
1021 if len(ifUnmodifiedSince) > 0 {
1022 preparer = autorest.DecoratePreparer(preparer,
1023 autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince)))
1024 }
1025 if len(xMsClientRequestID) > 0 {
1026 preparer = autorest.DecoratePreparer(preparer,
1027 autorest.WithHeader("x-ms-client-request-id", autorest.String(xMsClientRequestID)))
1028 }
1029 if len(xMsDate) > 0 {
1030 preparer = autorest.DecoratePreparer(preparer,
1031 autorest.WithHeader("x-ms-date", autorest.String(xMsDate)))
1032 }
1033 if len(client.XMsVersion) > 0 {
1034 preparer = autorest.DecoratePreparer(preparer,
1035 autorest.WithHeader("x-ms-version", autorest.String(client.XMsVersion)))
1036 }
1037 return preparer.Prepare((&http.Request{}).WithContext(ctx))
1038 }
1039
1040
1041
1042 func (client PathClient) ReadSender(req *http.Request) (*http.Response, error) {
1043 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1044 }
1045
1046
1047
1048 func (client PathClient) ReadResponder(resp *http.Response) (result ReadCloser, err error) {
1049 result.Value = &resp.Body
1050 err = autorest.Respond(
1051 resp,
1052 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusPartialContent))
1053 result.Response = autorest.Response{Response: resp}
1054 return
1055 }
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
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 func (client PathClient) Update(ctx context.Context, action PathUpdateAction, filesystem string, pathParameter string, position *int64, retainUncommittedData *bool, contentLength string, xMsLeaseAction PathUpdateLeaseAction, xMsLeaseID string, xMsCacheControl string, xMsContentType string, xMsContentDisposition string, xMsContentEncoding string, xMsContentLanguage 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) {
1146 if tracing.IsEnabled() {
1147 ctx = tracing.StartSpan(ctx, fqdn+"/PathClient.Update")
1148 defer func() {
1149 sc := -1
1150 if result.Response != nil {
1151 sc = result.Response.StatusCode
1152 }
1153 tracing.EndSpan(ctx, sc, err)
1154 }()
1155 }
1156 if err := validation.Validate([]validation.Validation{
1157 {TargetValue: xMsLeaseID,
1158 Constraints: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Empty, Rule: false,
1159 Chain: []validation.Constraint{{Target: "xMsLeaseID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
1160 {TargetValue: filesystem,
1161 Constraints: []validation.Constraint{{Target: "filesystem", Name: validation.MaxLength, Rule: 63, Chain: nil},
1162 {Target: "filesystem", Name: validation.MinLength, Rule: 3, Chain: nil}}},
1163 {TargetValue: xMsClientRequestID,
1164 Constraints: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Empty, Rule: false,
1165 Chain: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
1166 {TargetValue: timeout,
1167 Constraints: []validation.Constraint{{Target: "timeout", Name: validation.Null, Rule: false,
1168 Chain: []validation.Constraint{{Target: "timeout", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}}); err != nil {
1169 return result, validation.NewError("storagedatalake.PathClient", "Update", err.Error())
1170 }
1171
1172 req, err := client.UpdatePreparer(ctx, action, filesystem, pathParameter, position, retainUncommittedData, contentLength, xMsLeaseAction, xMsLeaseID, xMsCacheControl, xMsContentType, xMsContentDisposition, xMsContentEncoding, xMsContentLanguage, xMsProperties, xMsOwner, xMsGroup, xMsPermissions, xMsACL, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince, requestBody, xMsClientRequestID, timeout, xMsDate)
1173 if err != nil {
1174 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Update", nil, "Failure preparing request")
1175 return
1176 }
1177
1178 resp, err := client.UpdateSender(req)
1179 if err != nil {
1180 result.Response = resp
1181 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Update", resp, "Failure sending request")
1182 return
1183 }
1184
1185 result, err = client.UpdateResponder(resp)
1186 if err != nil {
1187 err = autorest.NewErrorWithError(err, "storagedatalake.PathClient", "Update", resp, "Failure responding to request")
1188 return
1189 }
1190
1191 return
1192 }
1193
1194
1195 func (client PathClient) UpdatePreparer(ctx context.Context, action PathUpdateAction, filesystem string, pathParameter string, position *int64, retainUncommittedData *bool, contentLength string, xMsLeaseAction PathUpdateLeaseAction, xMsLeaseID string, xMsCacheControl string, xMsContentType string, xMsContentDisposition string, xMsContentEncoding string, xMsContentLanguage 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) {
1196 urlParameters := map[string]interface{}{
1197 "accountName": client.AccountName,
1198 "dnsSuffix": client.DNSSuffix,
1199 }
1200
1201 pathParameters := map[string]interface{}{
1202 "filesystem": autorest.Encode("path", filesystem),
1203 "path": autorest.Encode("path", pathParameter),
1204 }
1205
1206 queryParameters := map[string]interface{}{
1207 "action": autorest.Encode("query", action),
1208 }
1209 if position != nil {
1210 queryParameters["position"] = autorest.Encode("query", *position)
1211 }
1212 if retainUncommittedData != nil {
1213 queryParameters["retainUncommittedData"] = autorest.Encode("query", *retainUncommittedData)
1214 }
1215 if timeout != nil {
1216 queryParameters["timeout"] = autorest.Encode("query", *timeout)
1217 }
1218
1219 preparer := autorest.CreatePreparer(
1220 autorest.AsContentType("application/octet-stream"),
1221 autorest.AsPatch(),
1222 autorest.WithCustomBaseURL("https://{accountName}.{dnsSuffix}", urlParameters),
1223 autorest.WithPathParameters("/{filesystem}/{path}", pathParameters),
1224 autorest.WithQueryParameters(queryParameters))
1225 if requestBody != nil {
1226 preparer = autorest.DecoratePreparer(preparer,
1227 autorest.WithFile(requestBody))
1228 }
1229 if len(contentLength) > 0 {
1230 preparer = autorest.DecoratePreparer(preparer,
1231 autorest.WithHeader("Content-Length", autorest.String(contentLength)))
1232 }
1233 if len(string(xMsLeaseAction)) > 0 {
1234 preparer = autorest.DecoratePreparer(preparer,
1235 autorest.WithHeader("x-ms-lease-action", autorest.String(xMsLeaseAction)))
1236 }
1237 if len(xMsLeaseID) > 0 {
1238 preparer = autorest.DecoratePreparer(preparer,
1239 autorest.WithHeader("x-ms-lease-id", autorest.String(xMsLeaseID)))
1240 }
1241 if len(xMsCacheControl) > 0 {
1242 preparer = autorest.DecoratePreparer(preparer,
1243 autorest.WithHeader("x-ms-cache-control", autorest.String(xMsCacheControl)))
1244 }
1245 if len(xMsContentType) > 0 {
1246 preparer = autorest.DecoratePreparer(preparer,
1247 autorest.WithHeader("x-ms-content-type", autorest.String(xMsContentType)))
1248 }
1249 if len(xMsContentDisposition) > 0 {
1250 preparer = autorest.DecoratePreparer(preparer,
1251 autorest.WithHeader("x-ms-content-disposition", autorest.String(xMsContentDisposition)))
1252 }
1253 if len(xMsContentEncoding) > 0 {
1254 preparer = autorest.DecoratePreparer(preparer,
1255 autorest.WithHeader("x-ms-content-encoding", autorest.String(xMsContentEncoding)))
1256 }
1257 if len(xMsContentLanguage) > 0 {
1258 preparer = autorest.DecoratePreparer(preparer,
1259 autorest.WithHeader("x-ms-content-language", autorest.String(xMsContentLanguage)))
1260 }
1261 if len(xMsProperties) > 0 {
1262 preparer = autorest.DecoratePreparer(preparer,
1263 autorest.WithHeader("x-ms-properties", autorest.String(xMsProperties)))
1264 }
1265 if len(xMsOwner) > 0 {
1266 preparer = autorest.DecoratePreparer(preparer,
1267 autorest.WithHeader("x-ms-owner", autorest.String(xMsOwner)))
1268 }
1269 if len(xMsGroup) > 0 {
1270 preparer = autorest.DecoratePreparer(preparer,
1271 autorest.WithHeader("x-ms-group", autorest.String(xMsGroup)))
1272 }
1273 if len(xMsPermissions) > 0 {
1274 preparer = autorest.DecoratePreparer(preparer,
1275 autorest.WithHeader("x-ms-permissions", autorest.String(xMsPermissions)))
1276 }
1277 if len(xMsACL) > 0 {
1278 preparer = autorest.DecoratePreparer(preparer,
1279 autorest.WithHeader("x-ms-acl", autorest.String(xMsACL)))
1280 }
1281 if len(ifMatch) > 0 {
1282 preparer = autorest.DecoratePreparer(preparer,
1283 autorest.WithHeader("If-Match", autorest.String(ifMatch)))
1284 }
1285 if len(ifNoneMatch) > 0 {
1286 preparer = autorest.DecoratePreparer(preparer,
1287 autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch)))
1288 }
1289 if len(ifModifiedSince) > 0 {
1290 preparer = autorest.DecoratePreparer(preparer,
1291 autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince)))
1292 }
1293 if len(ifUnmodifiedSince) > 0 {
1294 preparer = autorest.DecoratePreparer(preparer,
1295 autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince)))
1296 }
1297 if len(xMsClientRequestID) > 0 {
1298 preparer = autorest.DecoratePreparer(preparer,
1299 autorest.WithHeader("x-ms-client-request-id", autorest.String(xMsClientRequestID)))
1300 }
1301 if len(xMsDate) > 0 {
1302 preparer = autorest.DecoratePreparer(preparer,
1303 autorest.WithHeader("x-ms-date", autorest.String(xMsDate)))
1304 }
1305 if len(client.XMsVersion) > 0 {
1306 preparer = autorest.DecoratePreparer(preparer,
1307 autorest.WithHeader("x-ms-version", autorest.String(client.XMsVersion)))
1308 }
1309 return preparer.Prepare((&http.Request{}).WithContext(ctx))
1310 }
1311
1312
1313
1314 func (client PathClient) UpdateSender(req *http.Request) (*http.Response, error) {
1315 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1316 }
1317
1318
1319
1320 func (client PathClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) {
1321 err = autorest.Respond(
1322 resp,
1323 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
1324 autorest.ByClosing())
1325 result.Response = resp
1326 return
1327 }
1328
View as plain text