1 package job
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 "github.com/gofrs/uuid"
16 "net/http"
17 )
18
19
20 type Client struct {
21 BaseClient
22 }
23
24
25 func NewClient() Client {
26 return Client{New()}
27 }
28
29
30
31
32
33
34 func (client Client) Build(ctx context.Context, accountName string, parameters BuildJobParameters) (result Information, err error) {
35 if tracing.IsEnabled() {
36 ctx = tracing.StartSpan(ctx, fqdn+"/Client.Build")
37 defer func() {
38 sc := -1
39 if result.Response.Response != nil {
40 sc = result.Response.Response.StatusCode
41 }
42 tracing.EndSpan(ctx, sc, err)
43 }()
44 }
45 req, err := client.BuildPreparer(ctx, accountName, parameters)
46 if err != nil {
47 err = autorest.NewErrorWithError(err, "job.Client", "Build", nil, "Failure preparing request")
48 return
49 }
50
51 resp, err := client.BuildSender(req)
52 if err != nil {
53 result.Response = autorest.Response{Response: resp}
54 err = autorest.NewErrorWithError(err, "job.Client", "Build", resp, "Failure sending request")
55 return
56 }
57
58 result, err = client.BuildResponder(resp)
59 if err != nil {
60 err = autorest.NewErrorWithError(err, "job.Client", "Build", resp, "Failure responding to request")
61 return
62 }
63
64 return
65 }
66
67
68 func (client Client) BuildPreparer(ctx context.Context, accountName string, parameters BuildJobParameters) (*http.Request, error) {
69 urlParameters := map[string]interface{}{
70 "accountName": accountName,
71 "adlaJobDnsSuffix": client.AdlaJobDNSSuffix,
72 }
73
74 const APIVersion = "2017-09-01-preview"
75 queryParameters := map[string]interface{}{
76 "api-version": APIVersion,
77 }
78
79 preparer := autorest.CreatePreparer(
80 autorest.AsContentType("application/json; charset=utf-8"),
81 autorest.AsPost(),
82 autorest.WithCustomBaseURL("https://{accountName}.{adlaJobDnsSuffix}", urlParameters),
83 autorest.WithPath("/buildJob"),
84 autorest.WithJSON(parameters),
85 autorest.WithQueryParameters(queryParameters))
86 return preparer.Prepare((&http.Request{}).WithContext(ctx))
87 }
88
89
90
91 func (client Client) BuildSender(req *http.Request) (*http.Response, error) {
92 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
93 }
94
95
96
97 func (client Client) BuildResponder(resp *http.Response) (result Information, err error) {
98 err = autorest.Respond(
99 resp,
100 azure.WithErrorUnlessStatusCode(http.StatusOK),
101 autorest.ByUnmarshallingJSON(&result),
102 autorest.ByClosing())
103 result.Response = autorest.Response{Response: resp}
104 return
105 }
106
107
108
109
110
111 func (client Client) Cancel(ctx context.Context, accountName string, jobIdentity uuid.UUID) (result CancelFuture, err error) {
112 if tracing.IsEnabled() {
113 ctx = tracing.StartSpan(ctx, fqdn+"/Client.Cancel")
114 defer func() {
115 sc := -1
116 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
117 sc = result.FutureAPI.Response().StatusCode
118 }
119 tracing.EndSpan(ctx, sc, err)
120 }()
121 }
122 req, err := client.CancelPreparer(ctx, accountName, jobIdentity)
123 if err != nil {
124 err = autorest.NewErrorWithError(err, "job.Client", "Cancel", nil, "Failure preparing request")
125 return
126 }
127
128 result, err = client.CancelSender(req)
129 if err != nil {
130 err = autorest.NewErrorWithError(err, "job.Client", "Cancel", nil, "Failure sending request")
131 return
132 }
133
134 return
135 }
136
137
138 func (client Client) CancelPreparer(ctx context.Context, accountName string, jobIdentity uuid.UUID) (*http.Request, error) {
139 urlParameters := map[string]interface{}{
140 "accountName": accountName,
141 "adlaJobDnsSuffix": client.AdlaJobDNSSuffix,
142 }
143
144 pathParameters := map[string]interface{}{
145 "jobIdentity": autorest.Encode("path", jobIdentity),
146 }
147
148 const APIVersion = "2017-09-01-preview"
149 queryParameters := map[string]interface{}{
150 "api-version": APIVersion,
151 }
152
153 preparer := autorest.CreatePreparer(
154 autorest.AsPost(),
155 autorest.WithCustomBaseURL("https://{accountName}.{adlaJobDnsSuffix}", urlParameters),
156 autorest.WithPathParameters("/jobs/{jobIdentity}/CancelJob", pathParameters),
157 autorest.WithQueryParameters(queryParameters))
158 return preparer.Prepare((&http.Request{}).WithContext(ctx))
159 }
160
161
162
163 func (client Client) CancelSender(req *http.Request) (future CancelFuture, err error) {
164 var resp *http.Response
165 resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
166 if err != nil {
167 return
168 }
169 var azf azure.Future
170 azf, err = azure.NewFutureFromResponse(resp)
171 future.FutureAPI = &azf
172 future.Result = future.result
173 return
174 }
175
176
177
178 func (client Client) CancelResponder(resp *http.Response) (result autorest.Response, err error) {
179 err = autorest.Respond(
180 resp,
181 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
182 autorest.ByClosing())
183 result.Response = resp
184 return
185 }
186
187
188
189
190
191
192 func (client Client) Create(ctx context.Context, accountName string, jobIdentity uuid.UUID, parameters CreateJobParameters) (result Information, err error) {
193 if tracing.IsEnabled() {
194 ctx = tracing.StartSpan(ctx, fqdn+"/Client.Create")
195 defer func() {
196 sc := -1
197 if result.Response.Response != nil {
198 sc = result.Response.Response.StatusCode
199 }
200 tracing.EndSpan(ctx, sc, err)
201 }()
202 }
203 if err := validation.Validate([]validation.Validation{
204 {TargetValue: parameters,
205 Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil},
206 {Target: "parameters.Related", Name: validation.Null, Rule: false,
207 Chain: []validation.Constraint{{Target: "parameters.Related.PipelineName", Name: validation.Null, Rule: false,
208 Chain: []validation.Constraint{{Target: "parameters.Related.PipelineName", Name: validation.MaxLength, Rule: 260, Chain: nil}}},
209 {Target: "parameters.Related.RecurrenceID", Name: validation.Null, Rule: true, Chain: nil},
210 {Target: "parameters.Related.RecurrenceName", Name: validation.Null, Rule: false,
211 Chain: []validation.Constraint{{Target: "parameters.Related.RecurrenceName", Name: validation.MaxLength, Rule: 260, Chain: nil}}},
212 }}}}}); err != nil {
213 return result, validation.NewError("job.Client", "Create", err.Error())
214 }
215
216 req, err := client.CreatePreparer(ctx, accountName, jobIdentity, parameters)
217 if err != nil {
218 err = autorest.NewErrorWithError(err, "job.Client", "Create", nil, "Failure preparing request")
219 return
220 }
221
222 resp, err := client.CreateSender(req)
223 if err != nil {
224 result.Response = autorest.Response{Response: resp}
225 err = autorest.NewErrorWithError(err, "job.Client", "Create", resp, "Failure sending request")
226 return
227 }
228
229 result, err = client.CreateResponder(resp)
230 if err != nil {
231 err = autorest.NewErrorWithError(err, "job.Client", "Create", resp, "Failure responding to request")
232 return
233 }
234
235 return
236 }
237
238
239 func (client Client) CreatePreparer(ctx context.Context, accountName string, jobIdentity uuid.UUID, parameters CreateJobParameters) (*http.Request, error) {
240 urlParameters := map[string]interface{}{
241 "accountName": accountName,
242 "adlaJobDnsSuffix": client.AdlaJobDNSSuffix,
243 }
244
245 pathParameters := map[string]interface{}{
246 "jobIdentity": autorest.Encode("path", jobIdentity),
247 }
248
249 const APIVersion = "2017-09-01-preview"
250 queryParameters := map[string]interface{}{
251 "api-version": APIVersion,
252 }
253
254 preparer := autorest.CreatePreparer(
255 autorest.AsContentType("application/json; charset=utf-8"),
256 autorest.AsPut(),
257 autorest.WithCustomBaseURL("https://{accountName}.{adlaJobDnsSuffix}", urlParameters),
258 autorest.WithPathParameters("/jobs/{jobIdentity}", pathParameters),
259 autorest.WithJSON(parameters),
260 autorest.WithQueryParameters(queryParameters))
261 return preparer.Prepare((&http.Request{}).WithContext(ctx))
262 }
263
264
265
266 func (client Client) CreateSender(req *http.Request) (*http.Response, error) {
267 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
268 }
269
270
271
272 func (client Client) CreateResponder(resp *http.Response) (result Information, err error) {
273 err = autorest.Respond(
274 resp,
275 azure.WithErrorUnlessStatusCode(http.StatusOK),
276 autorest.ByUnmarshallingJSON(&result),
277 autorest.ByClosing())
278 result.Response = autorest.Response{Response: resp}
279 return
280 }
281
282
283
284
285
286 func (client Client) Get(ctx context.Context, accountName string, jobIdentity uuid.UUID) (result Information, err error) {
287 if tracing.IsEnabled() {
288 ctx = tracing.StartSpan(ctx, fqdn+"/Client.Get")
289 defer func() {
290 sc := -1
291 if result.Response.Response != nil {
292 sc = result.Response.Response.StatusCode
293 }
294 tracing.EndSpan(ctx, sc, err)
295 }()
296 }
297 req, err := client.GetPreparer(ctx, accountName, jobIdentity)
298 if err != nil {
299 err = autorest.NewErrorWithError(err, "job.Client", "Get", nil, "Failure preparing request")
300 return
301 }
302
303 resp, err := client.GetSender(req)
304 if err != nil {
305 result.Response = autorest.Response{Response: resp}
306 err = autorest.NewErrorWithError(err, "job.Client", "Get", resp, "Failure sending request")
307 return
308 }
309
310 result, err = client.GetResponder(resp)
311 if err != nil {
312 err = autorest.NewErrorWithError(err, "job.Client", "Get", resp, "Failure responding to request")
313 return
314 }
315
316 return
317 }
318
319
320 func (client Client) GetPreparer(ctx context.Context, accountName string, jobIdentity uuid.UUID) (*http.Request, error) {
321 urlParameters := map[string]interface{}{
322 "accountName": accountName,
323 "adlaJobDnsSuffix": client.AdlaJobDNSSuffix,
324 }
325
326 pathParameters := map[string]interface{}{
327 "jobIdentity": autorest.Encode("path", jobIdentity),
328 }
329
330 const APIVersion = "2017-09-01-preview"
331 queryParameters := map[string]interface{}{
332 "api-version": APIVersion,
333 }
334
335 preparer := autorest.CreatePreparer(
336 autorest.AsGet(),
337 autorest.WithCustomBaseURL("https://{accountName}.{adlaJobDnsSuffix}", urlParameters),
338 autorest.WithPathParameters("/jobs/{jobIdentity}", pathParameters),
339 autorest.WithQueryParameters(queryParameters))
340 return preparer.Prepare((&http.Request{}).WithContext(ctx))
341 }
342
343
344
345 func (client Client) GetSender(req *http.Request) (*http.Response, error) {
346 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
347 }
348
349
350
351 func (client Client) GetResponder(resp *http.Response) (result Information, err error) {
352 err = autorest.Respond(
353 resp,
354 azure.WithErrorUnlessStatusCode(http.StatusOK),
355 autorest.ByUnmarshallingJSON(&result),
356 autorest.ByClosing())
357 result.Response = autorest.Response{Response: resp}
358 return
359 }
360
361
362
363
364
365 func (client Client) GetDebugDataPath(ctx context.Context, accountName string, jobIdentity uuid.UUID) (result DataPath, err error) {
366 if tracing.IsEnabled() {
367 ctx = tracing.StartSpan(ctx, fqdn+"/Client.GetDebugDataPath")
368 defer func() {
369 sc := -1
370 if result.Response.Response != nil {
371 sc = result.Response.Response.StatusCode
372 }
373 tracing.EndSpan(ctx, sc, err)
374 }()
375 }
376 req, err := client.GetDebugDataPathPreparer(ctx, accountName, jobIdentity)
377 if err != nil {
378 err = autorest.NewErrorWithError(err, "job.Client", "GetDebugDataPath", nil, "Failure preparing request")
379 return
380 }
381
382 resp, err := client.GetDebugDataPathSender(req)
383 if err != nil {
384 result.Response = autorest.Response{Response: resp}
385 err = autorest.NewErrorWithError(err, "job.Client", "GetDebugDataPath", resp, "Failure sending request")
386 return
387 }
388
389 result, err = client.GetDebugDataPathResponder(resp)
390 if err != nil {
391 err = autorest.NewErrorWithError(err, "job.Client", "GetDebugDataPath", resp, "Failure responding to request")
392 return
393 }
394
395 return
396 }
397
398
399 func (client Client) GetDebugDataPathPreparer(ctx context.Context, accountName string, jobIdentity uuid.UUID) (*http.Request, error) {
400 urlParameters := map[string]interface{}{
401 "accountName": accountName,
402 "adlaJobDnsSuffix": client.AdlaJobDNSSuffix,
403 }
404
405 pathParameters := map[string]interface{}{
406 "jobIdentity": autorest.Encode("path", jobIdentity),
407 }
408
409 const APIVersion = "2017-09-01-preview"
410 queryParameters := map[string]interface{}{
411 "api-version": APIVersion,
412 }
413
414 preparer := autorest.CreatePreparer(
415 autorest.AsGet(),
416 autorest.WithCustomBaseURL("https://{accountName}.{adlaJobDnsSuffix}", urlParameters),
417 autorest.WithPathParameters("/jobs/{jobIdentity}/GetDebugDataPath", pathParameters),
418 autorest.WithQueryParameters(queryParameters))
419 return preparer.Prepare((&http.Request{}).WithContext(ctx))
420 }
421
422
423
424 func (client Client) GetDebugDataPathSender(req *http.Request) (*http.Response, error) {
425 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
426 }
427
428
429
430 func (client Client) GetDebugDataPathResponder(resp *http.Response) (result DataPath, err error) {
431 err = autorest.Respond(
432 resp,
433 azure.WithErrorUnlessStatusCode(http.StatusOK),
434 autorest.ByUnmarshallingJSON(&result),
435 autorest.ByClosing())
436 result.Response = autorest.Response{Response: resp}
437 return
438 }
439
440
441
442
443
444 func (client Client) GetStatistics(ctx context.Context, accountName string, jobIdentity uuid.UUID) (result Statistics, err error) {
445 if tracing.IsEnabled() {
446 ctx = tracing.StartSpan(ctx, fqdn+"/Client.GetStatistics")
447 defer func() {
448 sc := -1
449 if result.Response.Response != nil {
450 sc = result.Response.Response.StatusCode
451 }
452 tracing.EndSpan(ctx, sc, err)
453 }()
454 }
455 req, err := client.GetStatisticsPreparer(ctx, accountName, jobIdentity)
456 if err != nil {
457 err = autorest.NewErrorWithError(err, "job.Client", "GetStatistics", nil, "Failure preparing request")
458 return
459 }
460
461 resp, err := client.GetStatisticsSender(req)
462 if err != nil {
463 result.Response = autorest.Response{Response: resp}
464 err = autorest.NewErrorWithError(err, "job.Client", "GetStatistics", resp, "Failure sending request")
465 return
466 }
467
468 result, err = client.GetStatisticsResponder(resp)
469 if err != nil {
470 err = autorest.NewErrorWithError(err, "job.Client", "GetStatistics", resp, "Failure responding to request")
471 return
472 }
473
474 return
475 }
476
477
478 func (client Client) GetStatisticsPreparer(ctx context.Context, accountName string, jobIdentity uuid.UUID) (*http.Request, error) {
479 urlParameters := map[string]interface{}{
480 "accountName": accountName,
481 "adlaJobDnsSuffix": client.AdlaJobDNSSuffix,
482 }
483
484 pathParameters := map[string]interface{}{
485 "jobIdentity": autorest.Encode("path", jobIdentity),
486 }
487
488 const APIVersion = "2017-09-01-preview"
489 queryParameters := map[string]interface{}{
490 "api-version": APIVersion,
491 }
492
493 preparer := autorest.CreatePreparer(
494 autorest.AsGet(),
495 autorest.WithCustomBaseURL("https://{accountName}.{adlaJobDnsSuffix}", urlParameters),
496 autorest.WithPathParameters("/jobs/{jobIdentity}/GetStatistics", pathParameters),
497 autorest.WithQueryParameters(queryParameters))
498 return preparer.Prepare((&http.Request{}).WithContext(ctx))
499 }
500
501
502
503 func (client Client) GetStatisticsSender(req *http.Request) (*http.Response, error) {
504 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
505 }
506
507
508
509 func (client Client) GetStatisticsResponder(resp *http.Response) (result Statistics, err error) {
510 err = autorest.Respond(
511 resp,
512 azure.WithErrorUnlessStatusCode(http.StatusOK),
513 autorest.ByUnmarshallingJSON(&result),
514 autorest.ByClosing())
515 result.Response = autorest.Response{Response: resp}
516 return
517 }
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533 func (client Client) List(ctx context.Context, accountName string, filter string, top *int32, skip *int32, selectParameter string, orderby string, count *bool) (result InfoListResultPage, err error) {
534 if tracing.IsEnabled() {
535 ctx = tracing.StartSpan(ctx, fqdn+"/Client.List")
536 defer func() {
537 sc := -1
538 if result.ilr.Response.Response != nil {
539 sc = result.ilr.Response.Response.StatusCode
540 }
541 tracing.EndSpan(ctx, sc, err)
542 }()
543 }
544 if err := validation.Validate([]validation.Validation{
545 {TargetValue: top,
546 Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false,
547 Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}},
548 {TargetValue: skip,
549 Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false,
550 Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}}); err != nil {
551 return result, validation.NewError("job.Client", "List", err.Error())
552 }
553
554 result.fn = client.listNextResults
555 req, err := client.ListPreparer(ctx, accountName, filter, top, skip, selectParameter, orderby, count)
556 if err != nil {
557 err = autorest.NewErrorWithError(err, "job.Client", "List", nil, "Failure preparing request")
558 return
559 }
560
561 resp, err := client.ListSender(req)
562 if err != nil {
563 result.ilr.Response = autorest.Response{Response: resp}
564 err = autorest.NewErrorWithError(err, "job.Client", "List", resp, "Failure sending request")
565 return
566 }
567
568 result.ilr, err = client.ListResponder(resp)
569 if err != nil {
570 err = autorest.NewErrorWithError(err, "job.Client", "List", resp, "Failure responding to request")
571 return
572 }
573 if result.ilr.hasNextLink() && result.ilr.IsEmpty() {
574 err = result.NextWithContext(ctx)
575 return
576 }
577
578 return
579 }
580
581
582 func (client Client) ListPreparer(ctx context.Context, accountName string, filter string, top *int32, skip *int32, selectParameter string, orderby string, count *bool) (*http.Request, error) {
583 urlParameters := map[string]interface{}{
584 "accountName": accountName,
585 "adlaJobDnsSuffix": client.AdlaJobDNSSuffix,
586 }
587
588 const APIVersion = "2017-09-01-preview"
589 queryParameters := map[string]interface{}{
590 "api-version": APIVersion,
591 }
592 if len(filter) > 0 {
593 queryParameters["$filter"] = autorest.Encode("query", filter)
594 }
595 if top != nil {
596 queryParameters["$top"] = autorest.Encode("query", *top)
597 }
598 if skip != nil {
599 queryParameters["$skip"] = autorest.Encode("query", *skip)
600 }
601 if len(selectParameter) > 0 {
602 queryParameters["$select"] = autorest.Encode("query", selectParameter)
603 }
604 if len(orderby) > 0 {
605 queryParameters["$orderby"] = autorest.Encode("query", orderby)
606 }
607 if count != nil {
608 queryParameters["$count"] = autorest.Encode("query", *count)
609 }
610
611 preparer := autorest.CreatePreparer(
612 autorest.AsGet(),
613 autorest.WithCustomBaseURL("https://{accountName}.{adlaJobDnsSuffix}", urlParameters),
614 autorest.WithPath("/jobs"),
615 autorest.WithQueryParameters(queryParameters))
616 return preparer.Prepare((&http.Request{}).WithContext(ctx))
617 }
618
619
620
621 func (client Client) ListSender(req *http.Request) (*http.Response, error) {
622 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
623 }
624
625
626
627 func (client Client) ListResponder(resp *http.Response) (result InfoListResult, err error) {
628 err = autorest.Respond(
629 resp,
630 azure.WithErrorUnlessStatusCode(http.StatusOK),
631 autorest.ByUnmarshallingJSON(&result),
632 autorest.ByClosing())
633 result.Response = autorest.Response{Response: resp}
634 return
635 }
636
637
638 func (client Client) listNextResults(ctx context.Context, lastResults InfoListResult) (result InfoListResult, err error) {
639 req, err := lastResults.infoListResultPreparer(ctx)
640 if err != nil {
641 return result, autorest.NewErrorWithError(err, "job.Client", "listNextResults", nil, "Failure preparing next results request")
642 }
643 if req == nil {
644 return
645 }
646 resp, err := client.ListSender(req)
647 if err != nil {
648 result.Response = autorest.Response{Response: resp}
649 return result, autorest.NewErrorWithError(err, "job.Client", "listNextResults", resp, "Failure sending next results request")
650 }
651 result, err = client.ListResponder(resp)
652 if err != nil {
653 err = autorest.NewErrorWithError(err, "job.Client", "listNextResults", resp, "Failure responding to next results request")
654 }
655 return
656 }
657
658
659 func (client Client) ListComplete(ctx context.Context, accountName string, filter string, top *int32, skip *int32, selectParameter string, orderby string, count *bool) (result InfoListResultIterator, err error) {
660 if tracing.IsEnabled() {
661 ctx = tracing.StartSpan(ctx, fqdn+"/Client.List")
662 defer func() {
663 sc := -1
664 if result.Response().Response.Response != nil {
665 sc = result.page.Response().Response.Response.StatusCode
666 }
667 tracing.EndSpan(ctx, sc, err)
668 }()
669 }
670 result.page, err = client.List(ctx, accountName, filter, top, skip, selectParameter, orderby, count)
671 return
672 }
673
674
675
676
677
678
679 func (client Client) Update(ctx context.Context, accountName string, jobIdentity uuid.UUID, parameters *UpdateJobParameters) (result UpdateFuture, err error) {
680 if tracing.IsEnabled() {
681 ctx = tracing.StartSpan(ctx, fqdn+"/Client.Update")
682 defer func() {
683 sc := -1
684 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
685 sc = result.FutureAPI.Response().StatusCode
686 }
687 tracing.EndSpan(ctx, sc, err)
688 }()
689 }
690 req, err := client.UpdatePreparer(ctx, accountName, jobIdentity, parameters)
691 if err != nil {
692 err = autorest.NewErrorWithError(err, "job.Client", "Update", nil, "Failure preparing request")
693 return
694 }
695
696 result, err = client.UpdateSender(req)
697 if err != nil {
698 err = autorest.NewErrorWithError(err, "job.Client", "Update", nil, "Failure sending request")
699 return
700 }
701
702 return
703 }
704
705
706 func (client Client) UpdatePreparer(ctx context.Context, accountName string, jobIdentity uuid.UUID, parameters *UpdateJobParameters) (*http.Request, error) {
707 urlParameters := map[string]interface{}{
708 "accountName": accountName,
709 "adlaJobDnsSuffix": client.AdlaJobDNSSuffix,
710 }
711
712 pathParameters := map[string]interface{}{
713 "jobIdentity": autorest.Encode("path", jobIdentity),
714 }
715
716 const APIVersion = "2017-09-01-preview"
717 queryParameters := map[string]interface{}{
718 "api-version": APIVersion,
719 }
720
721 preparer := autorest.CreatePreparer(
722 autorest.AsContentType("application/json; charset=utf-8"),
723 autorest.AsPatch(),
724 autorest.WithCustomBaseURL("https://{accountName}.{adlaJobDnsSuffix}", urlParameters),
725 autorest.WithPathParameters("/jobs/{jobIdentity}", pathParameters),
726 autorest.WithQueryParameters(queryParameters))
727 if parameters != nil {
728 preparer = autorest.DecoratePreparer(preparer,
729 autorest.WithJSON(parameters))
730 }
731 return preparer.Prepare((&http.Request{}).WithContext(ctx))
732 }
733
734
735
736 func (client Client) UpdateSender(req *http.Request) (future UpdateFuture, err error) {
737 var resp *http.Response
738 resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
739 if err != nil {
740 return
741 }
742 var azf azure.Future
743 azf, err = azure.NewFutureFromResponse(resp)
744 future.FutureAPI = &azf
745 future.Result = future.result
746 return
747 }
748
749
750
751 func (client Client) UpdateResponder(resp *http.Response) (result Information, err error) {
752 err = autorest.Respond(
753 resp,
754 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted),
755 autorest.ByUnmarshallingJSON(&result),
756 autorest.ByClosing())
757 result.Response = autorest.Response{Response: resp}
758 return
759 }
760
761
762
763
764
765
766 func (client Client) Yield(ctx context.Context, accountName string, jobIdentity uuid.UUID) (result YieldFuture, err error) {
767 if tracing.IsEnabled() {
768 ctx = tracing.StartSpan(ctx, fqdn+"/Client.Yield")
769 defer func() {
770 sc := -1
771 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
772 sc = result.FutureAPI.Response().StatusCode
773 }
774 tracing.EndSpan(ctx, sc, err)
775 }()
776 }
777 req, err := client.YieldPreparer(ctx, accountName, jobIdentity)
778 if err != nil {
779 err = autorest.NewErrorWithError(err, "job.Client", "Yield", nil, "Failure preparing request")
780 return
781 }
782
783 result, err = client.YieldSender(req)
784 if err != nil {
785 err = autorest.NewErrorWithError(err, "job.Client", "Yield", nil, "Failure sending request")
786 return
787 }
788
789 return
790 }
791
792
793 func (client Client) YieldPreparer(ctx context.Context, accountName string, jobIdentity uuid.UUID) (*http.Request, error) {
794 urlParameters := map[string]interface{}{
795 "accountName": accountName,
796 "adlaJobDnsSuffix": client.AdlaJobDNSSuffix,
797 }
798
799 pathParameters := map[string]interface{}{
800 "jobIdentity": autorest.Encode("path", jobIdentity),
801 }
802
803 const APIVersion = "2017-09-01-preview"
804 queryParameters := map[string]interface{}{
805 "api-version": APIVersion,
806 }
807
808 preparer := autorest.CreatePreparer(
809 autorest.AsPost(),
810 autorest.WithCustomBaseURL("https://{accountName}.{adlaJobDnsSuffix}", urlParameters),
811 autorest.WithPathParameters("/jobs/{jobIdentity}/YieldJob", pathParameters),
812 autorest.WithQueryParameters(queryParameters))
813 return preparer.Prepare((&http.Request{}).WithContext(ctx))
814 }
815
816
817
818 func (client Client) YieldSender(req *http.Request) (future YieldFuture, err error) {
819 var resp *http.Response
820 resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
821 if err != nil {
822 return
823 }
824 var azf azure.Future
825 azf, err = azure.NewFutureFromResponse(resp)
826 future.FutureAPI = &azf
827 future.Result = future.result
828 return
829 }
830
831
832
833 func (client Client) YieldResponder(resp *http.Response) (result autorest.Response, err error) {
834 err = autorest.Respond(
835 resp,
836 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
837 autorest.ByClosing())
838 result.Response = resp
839 return
840 }
841
View as plain text