1 package job
2
3
4
5
6
7
8
9 import (
10 "context"
11 "encoding/json"
12 "github.com/Azure/go-autorest/autorest"
13 "github.com/Azure/go-autorest/autorest/date"
14 "github.com/Azure/go-autorest/autorest/to"
15 "github.com/Azure/go-autorest/tracing"
16 "github.com/gofrs/uuid"
17 "net/http"
18 )
19
20
21 const fqdn = "github.com/Azure/azure-sdk-for-go/services/datalake/analytics/2016-11-01/job"
22
23
24 type BaseJobParameters struct {
25
26 Type TypeEnum `json:"type,omitempty"`
27
28 Properties BasicCreateJobProperties `json:"properties,omitempty"`
29 }
30
31
32 func (bjp *BaseJobParameters) UnmarshalJSON(body []byte) error {
33 var m map[string]*json.RawMessage
34 err := json.Unmarshal(body, &m)
35 if err != nil {
36 return err
37 }
38 for k, v := range m {
39 switch k {
40 case "type":
41 if v != nil {
42 var typeVar TypeEnum
43 err = json.Unmarshal(*v, &typeVar)
44 if err != nil {
45 return err
46 }
47 bjp.Type = typeVar
48 }
49 case "properties":
50 if v != nil {
51 properties, err := unmarshalBasicCreateJobProperties(*v)
52 if err != nil {
53 return err
54 }
55 bjp.Properties = properties
56 }
57 }
58 }
59
60 return nil
61 }
62
63
64 type BuildJobParameters struct {
65
66 Name *string `json:"name,omitempty"`
67
68 Type TypeEnum `json:"type,omitempty"`
69
70 Properties BasicCreateJobProperties `json:"properties,omitempty"`
71 }
72
73
74 func (bjp *BuildJobParameters) UnmarshalJSON(body []byte) error {
75 var m map[string]*json.RawMessage
76 err := json.Unmarshal(body, &m)
77 if err != nil {
78 return err
79 }
80 for k, v := range m {
81 switch k {
82 case "name":
83 if v != nil {
84 var name string
85 err = json.Unmarshal(*v, &name)
86 if err != nil {
87 return err
88 }
89 bjp.Name = &name
90 }
91 case "type":
92 if v != nil {
93 var typeVar TypeEnum
94 err = json.Unmarshal(*v, &typeVar)
95 if err != nil {
96 return err
97 }
98 bjp.Type = typeVar
99 }
100 case "properties":
101 if v != nil {
102 properties, err := unmarshalBasicCreateJobProperties(*v)
103 if err != nil {
104 return err
105 }
106 bjp.Properties = properties
107 }
108 }
109 }
110
111 return nil
112 }
113
114
115 type CreateJobParameters struct {
116
117 Name *string `json:"name,omitempty"`
118
119 DegreeOfParallelism *int32 `json:"degreeOfParallelism,omitempty"`
120
121 DegreeOfParallelismPercent *float64 `json:"degreeOfParallelismPercent,omitempty"`
122
123 Priority *int32 `json:"priority,omitempty"`
124
125 LogFilePatterns *[]string `json:"logFilePatterns,omitempty"`
126
127 Related *RelationshipProperties `json:"related,omitempty"`
128
129 Type TypeEnum `json:"type,omitempty"`
130
131 Properties BasicCreateJobProperties `json:"properties,omitempty"`
132 }
133
134
135 func (cjp *CreateJobParameters) UnmarshalJSON(body []byte) error {
136 var m map[string]*json.RawMessage
137 err := json.Unmarshal(body, &m)
138 if err != nil {
139 return err
140 }
141 for k, v := range m {
142 switch k {
143 case "name":
144 if v != nil {
145 var name string
146 err = json.Unmarshal(*v, &name)
147 if err != nil {
148 return err
149 }
150 cjp.Name = &name
151 }
152 case "degreeOfParallelism":
153 if v != nil {
154 var degreeOfParallelism int32
155 err = json.Unmarshal(*v, °reeOfParallelism)
156 if err != nil {
157 return err
158 }
159 cjp.DegreeOfParallelism = °reeOfParallelism
160 }
161 case "degreeOfParallelismPercent":
162 if v != nil {
163 var degreeOfParallelismPercent float64
164 err = json.Unmarshal(*v, °reeOfParallelismPercent)
165 if err != nil {
166 return err
167 }
168 cjp.DegreeOfParallelismPercent = °reeOfParallelismPercent
169 }
170 case "priority":
171 if v != nil {
172 var priority int32
173 err = json.Unmarshal(*v, &priority)
174 if err != nil {
175 return err
176 }
177 cjp.Priority = &priority
178 }
179 case "logFilePatterns":
180 if v != nil {
181 var logFilePatterns []string
182 err = json.Unmarshal(*v, &logFilePatterns)
183 if err != nil {
184 return err
185 }
186 cjp.LogFilePatterns = &logFilePatterns
187 }
188 case "related":
189 if v != nil {
190 var related RelationshipProperties
191 err = json.Unmarshal(*v, &related)
192 if err != nil {
193 return err
194 }
195 cjp.Related = &related
196 }
197 case "type":
198 if v != nil {
199 var typeVar TypeEnum
200 err = json.Unmarshal(*v, &typeVar)
201 if err != nil {
202 return err
203 }
204 cjp.Type = typeVar
205 }
206 case "properties":
207 if v != nil {
208 properties, err := unmarshalBasicCreateJobProperties(*v)
209 if err != nil {
210 return err
211 }
212 cjp.Properties = properties
213 }
214 }
215 }
216
217 return nil
218 }
219
220
221 type BasicCreateJobProperties interface {
222 AsCreateUSQLJobProperties() (*CreateUSQLJobProperties, bool)
223 AsCreateJobProperties() (*CreateJobProperties, bool)
224 }
225
226
227 type CreateJobProperties struct {
228
229 RuntimeVersion *string `json:"runtimeVersion,omitempty"`
230
231 Script *string `json:"script,omitempty"`
232
233 Type TypeBasicCreateJobProperties `json:"type,omitempty"`
234 }
235
236 func unmarshalBasicCreateJobProperties(body []byte) (BasicCreateJobProperties, error) {
237 var m map[string]interface{}
238 err := json.Unmarshal(body, &m)
239 if err != nil {
240 return nil, err
241 }
242
243 switch m["type"] {
244 case string(TypeBasicCreateJobPropertiesTypeUSQL):
245 var cusjp CreateUSQLJobProperties
246 err := json.Unmarshal(body, &cusjp)
247 return cusjp, err
248 default:
249 var cjp CreateJobProperties
250 err := json.Unmarshal(body, &cjp)
251 return cjp, err
252 }
253 }
254 func unmarshalBasicCreateJobPropertiesArray(body []byte) ([]BasicCreateJobProperties, error) {
255 var rawMessages []*json.RawMessage
256 err := json.Unmarshal(body, &rawMessages)
257 if err != nil {
258 return nil, err
259 }
260
261 cjpArray := make([]BasicCreateJobProperties, len(rawMessages))
262
263 for index, rawMessage := range rawMessages {
264 cjp, err := unmarshalBasicCreateJobProperties(*rawMessage)
265 if err != nil {
266 return nil, err
267 }
268 cjpArray[index] = cjp
269 }
270 return cjpArray, nil
271 }
272
273
274 func (cjp CreateJobProperties) MarshalJSON() ([]byte, error) {
275 cjp.Type = TypeBasicCreateJobPropertiesTypeCreateJobProperties
276 objectMap := make(map[string]interface{})
277 if cjp.RuntimeVersion != nil {
278 objectMap["runtimeVersion"] = cjp.RuntimeVersion
279 }
280 if cjp.Script != nil {
281 objectMap["script"] = cjp.Script
282 }
283 if cjp.Type != "" {
284 objectMap["type"] = cjp.Type
285 }
286 return json.Marshal(objectMap)
287 }
288
289
290 func (cjp CreateJobProperties) AsCreateUSQLJobProperties() (*CreateUSQLJobProperties, bool) {
291 return nil, false
292 }
293
294
295 func (cjp CreateJobProperties) AsCreateJobProperties() (*CreateJobProperties, bool) {
296 return &cjp, true
297 }
298
299
300 func (cjp CreateJobProperties) AsBasicCreateJobProperties() (BasicCreateJobProperties, bool) {
301 return &cjp, true
302 }
303
304
305 type CreateUSQLJobProperties struct {
306
307 CompileMode CompileMode `json:"compileMode,omitempty"`
308
309 RuntimeVersion *string `json:"runtimeVersion,omitempty"`
310
311 Script *string `json:"script,omitempty"`
312
313 Type TypeBasicCreateJobProperties `json:"type,omitempty"`
314 }
315
316
317 func (cusjp CreateUSQLJobProperties) MarshalJSON() ([]byte, error) {
318 cusjp.Type = TypeBasicCreateJobPropertiesTypeUSQL
319 objectMap := make(map[string]interface{})
320 if cusjp.CompileMode != "" {
321 objectMap["compileMode"] = cusjp.CompileMode
322 }
323 if cusjp.RuntimeVersion != nil {
324 objectMap["runtimeVersion"] = cusjp.RuntimeVersion
325 }
326 if cusjp.Script != nil {
327 objectMap["script"] = cusjp.Script
328 }
329 if cusjp.Type != "" {
330 objectMap["type"] = cusjp.Type
331 }
332 return json.Marshal(objectMap)
333 }
334
335
336 func (cusjp CreateUSQLJobProperties) AsCreateUSQLJobProperties() (*CreateUSQLJobProperties, bool) {
337 return &cusjp, true
338 }
339
340
341 func (cusjp CreateUSQLJobProperties) AsCreateJobProperties() (*CreateJobProperties, bool) {
342 return nil, false
343 }
344
345
346 func (cusjp CreateUSQLJobProperties) AsBasicCreateJobProperties() (BasicCreateJobProperties, bool) {
347 return &cusjp, true
348 }
349
350
351 type DataPath struct {
352 autorest.Response `json:"-"`
353
354 JobID *uuid.UUID `json:"jobId,omitempty"`
355
356 Command *string `json:"command,omitempty"`
357
358 Paths *[]string `json:"paths,omitempty"`
359 }
360
361
362 func (dp DataPath) MarshalJSON() ([]byte, error) {
363 objectMap := make(map[string]interface{})
364 return json.Marshal(objectMap)
365 }
366
367
368 type Diagnostics struct {
369
370 ColumnNumber *int32 `json:"columnNumber,omitempty"`
371
372 End *int32 `json:"end,omitempty"`
373
374 LineNumber *int32 `json:"lineNumber,omitempty"`
375
376 Message *string `json:"message,omitempty"`
377
378 Severity SeverityTypes `json:"severity,omitempty"`
379
380 Start *int32 `json:"start,omitempty"`
381 }
382
383
384 func (d Diagnostics) MarshalJSON() ([]byte, error) {
385 objectMap := make(map[string]interface{})
386 return json.Marshal(objectMap)
387 }
388
389
390 type ErrorDetails struct {
391
392 Description *string `json:"description,omitempty"`
393
394 Details *string `json:"details,omitempty"`
395
396 EndOffset *int32 `json:"endOffset,omitempty"`
397
398 ErrorID *string `json:"errorId,omitempty"`
399
400 FilePath *string `json:"filePath,omitempty"`
401
402 HelpLink *string `json:"helpLink,omitempty"`
403
404 InternalDiagnostics *string `json:"internalDiagnostics,omitempty"`
405
406 LineNumber *int32 `json:"lineNumber,omitempty"`
407
408 Message *string `json:"message,omitempty"`
409
410 Resolution *string `json:"resolution,omitempty"`
411
412 InnerError *InnerError `json:"innerError,omitempty"`
413
414 Severity SeverityTypes `json:"severity,omitempty"`
415
416 Source *string `json:"source,omitempty"`
417
418 StartOffset *int32 `json:"startOffset,omitempty"`
419 }
420
421
422 func (ed ErrorDetails) MarshalJSON() ([]byte, error) {
423 objectMap := make(map[string]interface{})
424 return json.Marshal(objectMap)
425 }
426
427
428 type HiveJobProperties struct {
429
430 LogsLocation *string `json:"logsLocation,omitempty"`
431
432 OutputLocation *string `json:"outputLocation,omitempty"`
433
434 StatementCount *int32 `json:"statementCount,omitempty"`
435
436 ExecutedStatementCount *int32 `json:"executedStatementCount,omitempty"`
437
438 RuntimeVersion *string `json:"runtimeVersion,omitempty"`
439
440 Script *string `json:"script,omitempty"`
441
442 Type Type `json:"type,omitempty"`
443 }
444
445
446 func (hjp HiveJobProperties) MarshalJSON() ([]byte, error) {
447 hjp.Type = TypeHive
448 objectMap := make(map[string]interface{})
449 if hjp.Script != nil {
450 objectMap["script"] = hjp.Script
451 }
452 if hjp.Type != "" {
453 objectMap["type"] = hjp.Type
454 }
455 return json.Marshal(objectMap)
456 }
457
458
459 func (hjp HiveJobProperties) AsUSQLJobProperties() (*USQLJobProperties, bool) {
460 return nil, false
461 }
462
463
464 func (hjp HiveJobProperties) AsHiveJobProperties() (*HiveJobProperties, bool) {
465 return &hjp, true
466 }
467
468
469 func (hjp HiveJobProperties) AsProperties() (*Properties, bool) {
470 return nil, false
471 }
472
473
474 func (hjp HiveJobProperties) AsBasicProperties() (BasicProperties, bool) {
475 return &hjp, true
476 }
477
478
479 type InfoListResult struct {
480 autorest.Response `json:"-"`
481
482 Value *[]InformationBasic `json:"value,omitempty"`
483
484 NextLink *string `json:"nextLink,omitempty"`
485 }
486
487
488 func (ilr InfoListResult) MarshalJSON() ([]byte, error) {
489 objectMap := make(map[string]interface{})
490 return json.Marshal(objectMap)
491 }
492
493
494 type InfoListResultIterator struct {
495 i int
496 page InfoListResultPage
497 }
498
499
500
501 func (iter *InfoListResultIterator) NextWithContext(ctx context.Context) (err error) {
502 if tracing.IsEnabled() {
503 ctx = tracing.StartSpan(ctx, fqdn+"/InfoListResultIterator.NextWithContext")
504 defer func() {
505 sc := -1
506 if iter.Response().Response.Response != nil {
507 sc = iter.Response().Response.Response.StatusCode
508 }
509 tracing.EndSpan(ctx, sc, err)
510 }()
511 }
512 iter.i++
513 if iter.i < len(iter.page.Values()) {
514 return nil
515 }
516 err = iter.page.NextWithContext(ctx)
517 if err != nil {
518 iter.i--
519 return err
520 }
521 iter.i = 0
522 return nil
523 }
524
525
526
527
528 func (iter *InfoListResultIterator) Next() error {
529 return iter.NextWithContext(context.Background())
530 }
531
532
533 func (iter InfoListResultIterator) NotDone() bool {
534 return iter.page.NotDone() && iter.i < len(iter.page.Values())
535 }
536
537
538 func (iter InfoListResultIterator) Response() InfoListResult {
539 return iter.page.Response()
540 }
541
542
543
544 func (iter InfoListResultIterator) Value() InformationBasic {
545 if !iter.page.NotDone() {
546 return InformationBasic{}
547 }
548 return iter.page.Values()[iter.i]
549 }
550
551
552 func NewInfoListResultIterator(page InfoListResultPage) InfoListResultIterator {
553 return InfoListResultIterator{page: page}
554 }
555
556
557 func (ilr InfoListResult) IsEmpty() bool {
558 return ilr.Value == nil || len(*ilr.Value) == 0
559 }
560
561
562 func (ilr InfoListResult) hasNextLink() bool {
563 return ilr.NextLink != nil && len(*ilr.NextLink) != 0
564 }
565
566
567
568 func (ilr InfoListResult) infoListResultPreparer(ctx context.Context) (*http.Request, error) {
569 if !ilr.hasNextLink() {
570 return nil, nil
571 }
572 return autorest.Prepare((&http.Request{}).WithContext(ctx),
573 autorest.AsJSON(),
574 autorest.AsGet(),
575 autorest.WithBaseURL(to.String(ilr.NextLink)))
576 }
577
578
579 type InfoListResultPage struct {
580 fn func(context.Context, InfoListResult) (InfoListResult, error)
581 ilr InfoListResult
582 }
583
584
585
586 func (page *InfoListResultPage) NextWithContext(ctx context.Context) (err error) {
587 if tracing.IsEnabled() {
588 ctx = tracing.StartSpan(ctx, fqdn+"/InfoListResultPage.NextWithContext")
589 defer func() {
590 sc := -1
591 if page.Response().Response.Response != nil {
592 sc = page.Response().Response.Response.StatusCode
593 }
594 tracing.EndSpan(ctx, sc, err)
595 }()
596 }
597 for {
598 next, err := page.fn(ctx, page.ilr)
599 if err != nil {
600 return err
601 }
602 page.ilr = next
603 if !next.hasNextLink() || !next.IsEmpty() {
604 break
605 }
606 }
607 return nil
608 }
609
610
611
612
613 func (page *InfoListResultPage) Next() error {
614 return page.NextWithContext(context.Background())
615 }
616
617
618 func (page InfoListResultPage) NotDone() bool {
619 return !page.ilr.IsEmpty()
620 }
621
622
623 func (page InfoListResultPage) Response() InfoListResult {
624 return page.ilr
625 }
626
627
628 func (page InfoListResultPage) Values() []InformationBasic {
629 if page.ilr.IsEmpty() {
630 return nil
631 }
632 return *page.ilr.Value
633 }
634
635
636 func NewInfoListResultPage(cur InfoListResult, getNextPage func(context.Context, InfoListResult) (InfoListResult, error)) InfoListResultPage {
637 return InfoListResultPage{
638 fn: getNextPage,
639 ilr: cur,
640 }
641 }
642
643
644
645 type Information struct {
646 autorest.Response `json:"-"`
647
648 ErrorMessage *[]ErrorDetails `json:"errorMessage,omitempty"`
649
650 StateAuditRecords *[]StateAuditRecord `json:"stateAuditRecords,omitempty"`
651
652 Properties BasicProperties `json:"properties,omitempty"`
653
654 JobID *uuid.UUID `json:"jobId,omitempty"`
655
656 Name *string `json:"name,omitempty"`
657
658 Type TypeEnum `json:"type,omitempty"`
659
660 Submitter *string `json:"submitter,omitempty"`
661
662 DegreeOfParallelism *int32 `json:"degreeOfParallelism,omitempty"`
663
664 DegreeOfParallelismPercent *float64 `json:"degreeOfParallelismPercent,omitempty"`
665
666 Priority *int32 `json:"priority,omitempty"`
667
668 SubmitTime *date.Time `json:"submitTime,omitempty"`
669
670 StartTime *date.Time `json:"startTime,omitempty"`
671
672 EndTime *date.Time `json:"endTime,omitempty"`
673
674 State State `json:"state,omitempty"`
675
676 Result Result `json:"result,omitempty"`
677
678 LogFolder *string `json:"logFolder,omitempty"`
679
680 LogFilePatterns *[]string `json:"logFilePatterns,omitempty"`
681
682 Related *RelationshipProperties `json:"related,omitempty"`
683
684 HierarchyQueueNode *string `json:"hierarchyQueueNode,omitempty"`
685 }
686
687
688 func (i Information) MarshalJSON() ([]byte, error) {
689 objectMap := make(map[string]interface{})
690 objectMap["properties"] = i.Properties
691 if i.Name != nil {
692 objectMap["name"] = i.Name
693 }
694 if i.Type != "" {
695 objectMap["type"] = i.Type
696 }
697 if i.Related != nil {
698 objectMap["related"] = i.Related
699 }
700 return json.Marshal(objectMap)
701 }
702
703
704 func (i *Information) UnmarshalJSON(body []byte) error {
705 var m map[string]*json.RawMessage
706 err := json.Unmarshal(body, &m)
707 if err != nil {
708 return err
709 }
710 for k, v := range m {
711 switch k {
712 case "errorMessage":
713 if v != nil {
714 var errorMessage []ErrorDetails
715 err = json.Unmarshal(*v, &errorMessage)
716 if err != nil {
717 return err
718 }
719 i.ErrorMessage = &errorMessage
720 }
721 case "stateAuditRecords":
722 if v != nil {
723 var stateAuditRecords []StateAuditRecord
724 err = json.Unmarshal(*v, &stateAuditRecords)
725 if err != nil {
726 return err
727 }
728 i.StateAuditRecords = &stateAuditRecords
729 }
730 case "properties":
731 if v != nil {
732 properties, err := unmarshalBasicProperties(*v)
733 if err != nil {
734 return err
735 }
736 i.Properties = properties
737 }
738 case "jobId":
739 if v != nil {
740 var jobID uuid.UUID
741 err = json.Unmarshal(*v, &jobID)
742 if err != nil {
743 return err
744 }
745 i.JobID = &jobID
746 }
747 case "name":
748 if v != nil {
749 var name string
750 err = json.Unmarshal(*v, &name)
751 if err != nil {
752 return err
753 }
754 i.Name = &name
755 }
756 case "type":
757 if v != nil {
758 var typeVar TypeEnum
759 err = json.Unmarshal(*v, &typeVar)
760 if err != nil {
761 return err
762 }
763 i.Type = typeVar
764 }
765 case "submitter":
766 if v != nil {
767 var submitter string
768 err = json.Unmarshal(*v, &submitter)
769 if err != nil {
770 return err
771 }
772 i.Submitter = &submitter
773 }
774 case "degreeOfParallelism":
775 if v != nil {
776 var degreeOfParallelism int32
777 err = json.Unmarshal(*v, °reeOfParallelism)
778 if err != nil {
779 return err
780 }
781 i.DegreeOfParallelism = °reeOfParallelism
782 }
783 case "degreeOfParallelismPercent":
784 if v != nil {
785 var degreeOfParallelismPercent float64
786 err = json.Unmarshal(*v, °reeOfParallelismPercent)
787 if err != nil {
788 return err
789 }
790 i.DegreeOfParallelismPercent = °reeOfParallelismPercent
791 }
792 case "priority":
793 if v != nil {
794 var priority int32
795 err = json.Unmarshal(*v, &priority)
796 if err != nil {
797 return err
798 }
799 i.Priority = &priority
800 }
801 case "submitTime":
802 if v != nil {
803 var submitTime date.Time
804 err = json.Unmarshal(*v, &submitTime)
805 if err != nil {
806 return err
807 }
808 i.SubmitTime = &submitTime
809 }
810 case "startTime":
811 if v != nil {
812 var startTime date.Time
813 err = json.Unmarshal(*v, &startTime)
814 if err != nil {
815 return err
816 }
817 i.StartTime = &startTime
818 }
819 case "endTime":
820 if v != nil {
821 var endTime date.Time
822 err = json.Unmarshal(*v, &endTime)
823 if err != nil {
824 return err
825 }
826 i.EndTime = &endTime
827 }
828 case "state":
829 if v != nil {
830 var state State
831 err = json.Unmarshal(*v, &state)
832 if err != nil {
833 return err
834 }
835 i.State = state
836 }
837 case "result":
838 if v != nil {
839 var resultVar Result
840 err = json.Unmarshal(*v, &resultVar)
841 if err != nil {
842 return err
843 }
844 i.Result = resultVar
845 }
846 case "logFolder":
847 if v != nil {
848 var logFolder string
849 err = json.Unmarshal(*v, &logFolder)
850 if err != nil {
851 return err
852 }
853 i.LogFolder = &logFolder
854 }
855 case "logFilePatterns":
856 if v != nil {
857 var logFilePatterns []string
858 err = json.Unmarshal(*v, &logFilePatterns)
859 if err != nil {
860 return err
861 }
862 i.LogFilePatterns = &logFilePatterns
863 }
864 case "related":
865 if v != nil {
866 var related RelationshipProperties
867 err = json.Unmarshal(*v, &related)
868 if err != nil {
869 return err
870 }
871 i.Related = &related
872 }
873 case "hierarchyQueueNode":
874 if v != nil {
875 var hierarchyQueueNode string
876 err = json.Unmarshal(*v, &hierarchyQueueNode)
877 if err != nil {
878 return err
879 }
880 i.HierarchyQueueNode = &hierarchyQueueNode
881 }
882 }
883 }
884
885 return nil
886 }
887
888
889 type InformationBasic struct {
890
891 JobID *uuid.UUID `json:"jobId,omitempty"`
892
893 Name *string `json:"name,omitempty"`
894
895 Type TypeEnum `json:"type,omitempty"`
896
897 Submitter *string `json:"submitter,omitempty"`
898
899 DegreeOfParallelism *int32 `json:"degreeOfParallelism,omitempty"`
900
901 DegreeOfParallelismPercent *float64 `json:"degreeOfParallelismPercent,omitempty"`
902
903 Priority *int32 `json:"priority,omitempty"`
904
905 SubmitTime *date.Time `json:"submitTime,omitempty"`
906
907 StartTime *date.Time `json:"startTime,omitempty"`
908
909 EndTime *date.Time `json:"endTime,omitempty"`
910
911 State State `json:"state,omitempty"`
912
913 Result Result `json:"result,omitempty"`
914
915 LogFolder *string `json:"logFolder,omitempty"`
916
917 LogFilePatterns *[]string `json:"logFilePatterns,omitempty"`
918
919 Related *RelationshipProperties `json:"related,omitempty"`
920
921 HierarchyQueueNode *string `json:"hierarchyQueueNode,omitempty"`
922 }
923
924
925 func (ib InformationBasic) MarshalJSON() ([]byte, error) {
926 objectMap := make(map[string]interface{})
927 if ib.Name != nil {
928 objectMap["name"] = ib.Name
929 }
930 if ib.Type != "" {
931 objectMap["type"] = ib.Type
932 }
933 if ib.Related != nil {
934 objectMap["related"] = ib.Related
935 }
936 return json.Marshal(objectMap)
937 }
938
939
940 type InnerError struct {
941
942 DiagnosticCode *int32 `json:"diagnosticCode,omitempty"`
943
944 Severity SeverityTypes `json:"severity,omitempty"`
945
946 Details *string `json:"details,omitempty"`
947
948 Component *string `json:"component,omitempty"`
949
950 ErrorID *string `json:"errorId,omitempty"`
951
952 HelpLink *string `json:"helpLink,omitempty"`
953
954 InternalDiagnostics *string `json:"internalDiagnostics,omitempty"`
955
956 Message *string `json:"message,omitempty"`
957
958 Resolution *string `json:"resolution,omitempty"`
959
960 Source *string `json:"source,omitempty"`
961
962 Description *string `json:"description,omitempty"`
963
964 InnerError *InnerError `json:"innerError,omitempty"`
965 }
966
967
968 func (ie InnerError) MarshalJSON() ([]byte, error) {
969 objectMap := make(map[string]interface{})
970 return json.Marshal(objectMap)
971 }
972
973
974
975 type PipelineInformation struct {
976 autorest.Response `json:"-"`
977
978 PipelineID *uuid.UUID `json:"pipelineId,omitempty"`
979
980 PipelineName *string `json:"pipelineName,omitempty"`
981
982 PipelineURI *string `json:"pipelineUri,omitempty"`
983
984 NumJobsFailed *int32 `json:"numJobsFailed,omitempty"`
985
986 NumJobsCanceled *int32 `json:"numJobsCanceled,omitempty"`
987
988 NumJobsSucceeded *int32 `json:"numJobsSucceeded,omitempty"`
989
990 AuHoursFailed *float64 `json:"auHoursFailed,omitempty"`
991
992 AuHoursCanceled *float64 `json:"auHoursCanceled,omitempty"`
993
994 AuHoursSucceeded *float64 `json:"auHoursSucceeded,omitempty"`
995
996 LastSubmitTime *date.Time `json:"lastSubmitTime,omitempty"`
997
998 Runs *[]PipelineRunInformation `json:"runs,omitempty"`
999
1000 Recurrences *[]uuid.UUID `json:"recurrences,omitempty"`
1001 }
1002
1003
1004 func (pi PipelineInformation) MarshalJSON() ([]byte, error) {
1005 objectMap := make(map[string]interface{})
1006 return json.Marshal(objectMap)
1007 }
1008
1009
1010 type PipelineInformationListResult struct {
1011 autorest.Response `json:"-"`
1012
1013 Value *[]PipelineInformation `json:"value,omitempty"`
1014
1015 NextLink *string `json:"nextLink,omitempty"`
1016 }
1017
1018
1019 func (pilr PipelineInformationListResult) MarshalJSON() ([]byte, error) {
1020 objectMap := make(map[string]interface{})
1021 return json.Marshal(objectMap)
1022 }
1023
1024
1025
1026 type PipelineInformationListResultIterator struct {
1027 i int
1028 page PipelineInformationListResultPage
1029 }
1030
1031
1032
1033 func (iter *PipelineInformationListResultIterator) NextWithContext(ctx context.Context) (err error) {
1034 if tracing.IsEnabled() {
1035 ctx = tracing.StartSpan(ctx, fqdn+"/PipelineInformationListResultIterator.NextWithContext")
1036 defer func() {
1037 sc := -1
1038 if iter.Response().Response.Response != nil {
1039 sc = iter.Response().Response.Response.StatusCode
1040 }
1041 tracing.EndSpan(ctx, sc, err)
1042 }()
1043 }
1044 iter.i++
1045 if iter.i < len(iter.page.Values()) {
1046 return nil
1047 }
1048 err = iter.page.NextWithContext(ctx)
1049 if err != nil {
1050 iter.i--
1051 return err
1052 }
1053 iter.i = 0
1054 return nil
1055 }
1056
1057
1058
1059
1060 func (iter *PipelineInformationListResultIterator) Next() error {
1061 return iter.NextWithContext(context.Background())
1062 }
1063
1064
1065 func (iter PipelineInformationListResultIterator) NotDone() bool {
1066 return iter.page.NotDone() && iter.i < len(iter.page.Values())
1067 }
1068
1069
1070 func (iter PipelineInformationListResultIterator) Response() PipelineInformationListResult {
1071 return iter.page.Response()
1072 }
1073
1074
1075
1076 func (iter PipelineInformationListResultIterator) Value() PipelineInformation {
1077 if !iter.page.NotDone() {
1078 return PipelineInformation{}
1079 }
1080 return iter.page.Values()[iter.i]
1081 }
1082
1083
1084 func NewPipelineInformationListResultIterator(page PipelineInformationListResultPage) PipelineInformationListResultIterator {
1085 return PipelineInformationListResultIterator{page: page}
1086 }
1087
1088
1089 func (pilr PipelineInformationListResult) IsEmpty() bool {
1090 return pilr.Value == nil || len(*pilr.Value) == 0
1091 }
1092
1093
1094 func (pilr PipelineInformationListResult) hasNextLink() bool {
1095 return pilr.NextLink != nil && len(*pilr.NextLink) != 0
1096 }
1097
1098
1099
1100 func (pilr PipelineInformationListResult) pipelineInformationListResultPreparer(ctx context.Context) (*http.Request, error) {
1101 if !pilr.hasNextLink() {
1102 return nil, nil
1103 }
1104 return autorest.Prepare((&http.Request{}).WithContext(ctx),
1105 autorest.AsJSON(),
1106 autorest.AsGet(),
1107 autorest.WithBaseURL(to.String(pilr.NextLink)))
1108 }
1109
1110
1111 type PipelineInformationListResultPage struct {
1112 fn func(context.Context, PipelineInformationListResult) (PipelineInformationListResult, error)
1113 pilr PipelineInformationListResult
1114 }
1115
1116
1117
1118 func (page *PipelineInformationListResultPage) NextWithContext(ctx context.Context) (err error) {
1119 if tracing.IsEnabled() {
1120 ctx = tracing.StartSpan(ctx, fqdn+"/PipelineInformationListResultPage.NextWithContext")
1121 defer func() {
1122 sc := -1
1123 if page.Response().Response.Response != nil {
1124 sc = page.Response().Response.Response.StatusCode
1125 }
1126 tracing.EndSpan(ctx, sc, err)
1127 }()
1128 }
1129 for {
1130 next, err := page.fn(ctx, page.pilr)
1131 if err != nil {
1132 return err
1133 }
1134 page.pilr = next
1135 if !next.hasNextLink() || !next.IsEmpty() {
1136 break
1137 }
1138 }
1139 return nil
1140 }
1141
1142
1143
1144
1145 func (page *PipelineInformationListResultPage) Next() error {
1146 return page.NextWithContext(context.Background())
1147 }
1148
1149
1150 func (page PipelineInformationListResultPage) NotDone() bool {
1151 return !page.pilr.IsEmpty()
1152 }
1153
1154
1155 func (page PipelineInformationListResultPage) Response() PipelineInformationListResult {
1156 return page.pilr
1157 }
1158
1159
1160 func (page PipelineInformationListResultPage) Values() []PipelineInformation {
1161 if page.pilr.IsEmpty() {
1162 return nil
1163 }
1164 return *page.pilr.Value
1165 }
1166
1167
1168 func NewPipelineInformationListResultPage(cur PipelineInformationListResult, getNextPage func(context.Context, PipelineInformationListResult) (PipelineInformationListResult, error)) PipelineInformationListResultPage {
1169 return PipelineInformationListResultPage{
1170 fn: getNextPage,
1171 pilr: cur,
1172 }
1173 }
1174
1175
1176 type PipelineRunInformation struct {
1177
1178 RunID *uuid.UUID `json:"runId,omitempty"`
1179
1180 LastSubmitTime *date.Time `json:"lastSubmitTime,omitempty"`
1181 }
1182
1183
1184 func (pri PipelineRunInformation) MarshalJSON() ([]byte, error) {
1185 objectMap := make(map[string]interface{})
1186 return json.Marshal(objectMap)
1187 }
1188
1189
1190 type BasicProperties interface {
1191 AsUSQLJobProperties() (*USQLJobProperties, bool)
1192 AsHiveJobProperties() (*HiveJobProperties, bool)
1193 AsProperties() (*Properties, bool)
1194 }
1195
1196
1197 type Properties struct {
1198
1199 RuntimeVersion *string `json:"runtimeVersion,omitempty"`
1200
1201 Script *string `json:"script,omitempty"`
1202
1203 Type Type `json:"type,omitempty"`
1204 }
1205
1206 func unmarshalBasicProperties(body []byte) (BasicProperties, error) {
1207 var m map[string]interface{}
1208 err := json.Unmarshal(body, &m)
1209 if err != nil {
1210 return nil, err
1211 }
1212
1213 switch m["type"] {
1214 case string(TypeUSQL):
1215 var usjp USQLJobProperties
1216 err := json.Unmarshal(body, &usjp)
1217 return usjp, err
1218 case string(TypeHive):
1219 var hjp HiveJobProperties
1220 err := json.Unmarshal(body, &hjp)
1221 return hjp, err
1222 default:
1223 var p Properties
1224 err := json.Unmarshal(body, &p)
1225 return p, err
1226 }
1227 }
1228 func unmarshalBasicPropertiesArray(body []byte) ([]BasicProperties, error) {
1229 var rawMessages []*json.RawMessage
1230 err := json.Unmarshal(body, &rawMessages)
1231 if err != nil {
1232 return nil, err
1233 }
1234
1235 pArray := make([]BasicProperties, len(rawMessages))
1236
1237 for index, rawMessage := range rawMessages {
1238 p, err := unmarshalBasicProperties(*rawMessage)
1239 if err != nil {
1240 return nil, err
1241 }
1242 pArray[index] = p
1243 }
1244 return pArray, nil
1245 }
1246
1247
1248 func (p Properties) MarshalJSON() ([]byte, error) {
1249 p.Type = TypeJobProperties
1250 objectMap := make(map[string]interface{})
1251 if p.Script != nil {
1252 objectMap["script"] = p.Script
1253 }
1254 if p.Type != "" {
1255 objectMap["type"] = p.Type
1256 }
1257 return json.Marshal(objectMap)
1258 }
1259
1260
1261 func (p Properties) AsUSQLJobProperties() (*USQLJobProperties, bool) {
1262 return nil, false
1263 }
1264
1265
1266 func (p Properties) AsHiveJobProperties() (*HiveJobProperties, bool) {
1267 return nil, false
1268 }
1269
1270
1271 func (p Properties) AsProperties() (*Properties, bool) {
1272 return &p, true
1273 }
1274
1275
1276 func (p Properties) AsBasicProperties() (BasicProperties, bool) {
1277 return &p, true
1278 }
1279
1280
1281 type RecurrenceInformation struct {
1282 autorest.Response `json:"-"`
1283
1284 RecurrenceID *uuid.UUID `json:"recurrenceId,omitempty"`
1285
1286 RecurrenceName *string `json:"recurrenceName,omitempty"`
1287
1288 NumJobsFailed *int32 `json:"numJobsFailed,omitempty"`
1289
1290 NumJobsCanceled *int32 `json:"numJobsCanceled,omitempty"`
1291
1292 NumJobsSucceeded *int32 `json:"numJobsSucceeded,omitempty"`
1293
1294 AuHoursFailed *float64 `json:"auHoursFailed,omitempty"`
1295
1296 AuHoursCanceled *float64 `json:"auHoursCanceled,omitempty"`
1297
1298 AuHoursSucceeded *float64 `json:"auHoursSucceeded,omitempty"`
1299
1300 LastSubmitTime *date.Time `json:"lastSubmitTime,omitempty"`
1301 }
1302
1303
1304 func (ri RecurrenceInformation) MarshalJSON() ([]byte, error) {
1305 objectMap := make(map[string]interface{})
1306 return json.Marshal(objectMap)
1307 }
1308
1309
1310 type RecurrenceInformationListResult struct {
1311 autorest.Response `json:"-"`
1312
1313 Value *[]RecurrenceInformation `json:"value,omitempty"`
1314
1315 NextLink *string `json:"nextLink,omitempty"`
1316 }
1317
1318
1319 func (rilr RecurrenceInformationListResult) MarshalJSON() ([]byte, error) {
1320 objectMap := make(map[string]interface{})
1321 return json.Marshal(objectMap)
1322 }
1323
1324
1325
1326 type RecurrenceInformationListResultIterator struct {
1327 i int
1328 page RecurrenceInformationListResultPage
1329 }
1330
1331
1332
1333 func (iter *RecurrenceInformationListResultIterator) NextWithContext(ctx context.Context) (err error) {
1334 if tracing.IsEnabled() {
1335 ctx = tracing.StartSpan(ctx, fqdn+"/RecurrenceInformationListResultIterator.NextWithContext")
1336 defer func() {
1337 sc := -1
1338 if iter.Response().Response.Response != nil {
1339 sc = iter.Response().Response.Response.StatusCode
1340 }
1341 tracing.EndSpan(ctx, sc, err)
1342 }()
1343 }
1344 iter.i++
1345 if iter.i < len(iter.page.Values()) {
1346 return nil
1347 }
1348 err = iter.page.NextWithContext(ctx)
1349 if err != nil {
1350 iter.i--
1351 return err
1352 }
1353 iter.i = 0
1354 return nil
1355 }
1356
1357
1358
1359
1360 func (iter *RecurrenceInformationListResultIterator) Next() error {
1361 return iter.NextWithContext(context.Background())
1362 }
1363
1364
1365 func (iter RecurrenceInformationListResultIterator) NotDone() bool {
1366 return iter.page.NotDone() && iter.i < len(iter.page.Values())
1367 }
1368
1369
1370 func (iter RecurrenceInformationListResultIterator) Response() RecurrenceInformationListResult {
1371 return iter.page.Response()
1372 }
1373
1374
1375
1376 func (iter RecurrenceInformationListResultIterator) Value() RecurrenceInformation {
1377 if !iter.page.NotDone() {
1378 return RecurrenceInformation{}
1379 }
1380 return iter.page.Values()[iter.i]
1381 }
1382
1383
1384 func NewRecurrenceInformationListResultIterator(page RecurrenceInformationListResultPage) RecurrenceInformationListResultIterator {
1385 return RecurrenceInformationListResultIterator{page: page}
1386 }
1387
1388
1389 func (rilr RecurrenceInformationListResult) IsEmpty() bool {
1390 return rilr.Value == nil || len(*rilr.Value) == 0
1391 }
1392
1393
1394 func (rilr RecurrenceInformationListResult) hasNextLink() bool {
1395 return rilr.NextLink != nil && len(*rilr.NextLink) != 0
1396 }
1397
1398
1399
1400 func (rilr RecurrenceInformationListResult) recurrenceInformationListResultPreparer(ctx context.Context) (*http.Request, error) {
1401 if !rilr.hasNextLink() {
1402 return nil, nil
1403 }
1404 return autorest.Prepare((&http.Request{}).WithContext(ctx),
1405 autorest.AsJSON(),
1406 autorest.AsGet(),
1407 autorest.WithBaseURL(to.String(rilr.NextLink)))
1408 }
1409
1410
1411 type RecurrenceInformationListResultPage struct {
1412 fn func(context.Context, RecurrenceInformationListResult) (RecurrenceInformationListResult, error)
1413 rilr RecurrenceInformationListResult
1414 }
1415
1416
1417
1418 func (page *RecurrenceInformationListResultPage) NextWithContext(ctx context.Context) (err error) {
1419 if tracing.IsEnabled() {
1420 ctx = tracing.StartSpan(ctx, fqdn+"/RecurrenceInformationListResultPage.NextWithContext")
1421 defer func() {
1422 sc := -1
1423 if page.Response().Response.Response != nil {
1424 sc = page.Response().Response.Response.StatusCode
1425 }
1426 tracing.EndSpan(ctx, sc, err)
1427 }()
1428 }
1429 for {
1430 next, err := page.fn(ctx, page.rilr)
1431 if err != nil {
1432 return err
1433 }
1434 page.rilr = next
1435 if !next.hasNextLink() || !next.IsEmpty() {
1436 break
1437 }
1438 }
1439 return nil
1440 }
1441
1442
1443
1444
1445 func (page *RecurrenceInformationListResultPage) Next() error {
1446 return page.NextWithContext(context.Background())
1447 }
1448
1449
1450 func (page RecurrenceInformationListResultPage) NotDone() bool {
1451 return !page.rilr.IsEmpty()
1452 }
1453
1454
1455 func (page RecurrenceInformationListResultPage) Response() RecurrenceInformationListResult {
1456 return page.rilr
1457 }
1458
1459
1460 func (page RecurrenceInformationListResultPage) Values() []RecurrenceInformation {
1461 if page.rilr.IsEmpty() {
1462 return nil
1463 }
1464 return *page.rilr.Value
1465 }
1466
1467
1468 func NewRecurrenceInformationListResultPage(cur RecurrenceInformationListResult, getNextPage func(context.Context, RecurrenceInformationListResult) (RecurrenceInformationListResult, error)) RecurrenceInformationListResultPage {
1469 return RecurrenceInformationListResultPage{
1470 fn: getNextPage,
1471 rilr: cur,
1472 }
1473 }
1474
1475
1476
1477 type RelationshipProperties struct {
1478
1479 PipelineID *uuid.UUID `json:"pipelineId,omitempty"`
1480
1481 PipelineName *string `json:"pipelineName,omitempty"`
1482
1483 PipelineURI *string `json:"pipelineUri,omitempty"`
1484
1485 RunID *uuid.UUID `json:"runId,omitempty"`
1486
1487 RecurrenceID *uuid.UUID `json:"recurrenceId,omitempty"`
1488
1489 RecurrenceName *string `json:"recurrenceName,omitempty"`
1490 }
1491
1492
1493 type Resource struct {
1494
1495 Name *string `json:"name,omitempty"`
1496
1497 ResourcePath *string `json:"resourcePath,omitempty"`
1498
1499 Type ResourceType `json:"type,omitempty"`
1500 }
1501
1502
1503 type StateAuditRecord struct {
1504
1505 NewState *string `json:"newState,omitempty"`
1506
1507 TimeStamp *date.Time `json:"timeStamp,omitempty"`
1508
1509 RequestedByUser *string `json:"requestedByUser,omitempty"`
1510
1511 Details *string `json:"details,omitempty"`
1512 }
1513
1514
1515 func (sar StateAuditRecord) MarshalJSON() ([]byte, error) {
1516 objectMap := make(map[string]interface{})
1517 return json.Marshal(objectMap)
1518 }
1519
1520
1521 type Statistics struct {
1522 autorest.Response `json:"-"`
1523
1524 LastUpdateTimeUtc *date.Time `json:"lastUpdateTimeUtc,omitempty"`
1525
1526 FinalizingTimeUtc *date.Time `json:"finalizingTimeUtc,omitempty"`
1527
1528 Stages *[]StatisticsVertexStage `json:"stages,omitempty"`
1529 }
1530
1531
1532 func (s Statistics) MarshalJSON() ([]byte, error) {
1533 objectMap := make(map[string]interface{})
1534 return json.Marshal(objectMap)
1535 }
1536
1537
1538 type StatisticsVertexStage struct {
1539
1540 DataRead *int64 `json:"dataRead,omitempty"`
1541
1542 DataReadCrossPod *int64 `json:"dataReadCrossPod,omitempty"`
1543
1544 DataReadIntraPod *int64 `json:"dataReadIntraPod,omitempty"`
1545
1546 DataToRead *int64 `json:"dataToRead,omitempty"`
1547
1548 DataWritten *int64 `json:"dataWritten,omitempty"`
1549
1550 DuplicateDiscardCount *int32 `json:"duplicateDiscardCount,omitempty"`
1551
1552 FailedCount *int32 `json:"failedCount,omitempty"`
1553
1554 MaxVertexDataRead *int64 `json:"maxVertexDataRead,omitempty"`
1555
1556 MinVertexDataRead *int64 `json:"minVertexDataRead,omitempty"`
1557
1558 ReadFailureCount *int32 `json:"readFailureCount,omitempty"`
1559
1560 RevocationCount *int32 `json:"revocationCount,omitempty"`
1561
1562 RunningCount *int32 `json:"runningCount,omitempty"`
1563
1564 ScheduledCount *int32 `json:"scheduledCount,omitempty"`
1565
1566 StageName *string `json:"stageName,omitempty"`
1567
1568 SucceededCount *int32 `json:"succeededCount,omitempty"`
1569
1570 TempDataWritten *int64 `json:"tempDataWritten,omitempty"`
1571
1572 TotalCount *int32 `json:"totalCount,omitempty"`
1573
1574 TotalFailedTime *string `json:"totalFailedTime,omitempty"`
1575
1576 TotalProgress *int32 `json:"totalProgress,omitempty"`
1577
1578 TotalSucceededTime *string `json:"totalSucceededTime,omitempty"`
1579 }
1580
1581
1582 func (svs StatisticsVertexStage) MarshalJSON() ([]byte, error) {
1583 objectMap := make(map[string]interface{})
1584 return json.Marshal(objectMap)
1585 }
1586
1587
1588 type USQLJobProperties struct {
1589
1590 Resources *[]Resource `json:"resources,omitempty"`
1591
1592 Statistics *Statistics `json:"statistics,omitempty"`
1593
1594 DebugData *DataPath `json:"debugData,omitempty"`
1595
1596 Diagnostics *[]Diagnostics `json:"diagnostics,omitempty"`
1597
1598 AlgebraFilePath *string `json:"algebraFilePath,omitempty"`
1599
1600 TotalCompilationTime *string `json:"totalCompilationTime,omitempty"`
1601
1602 TotalPauseTime *string `json:"totalPauseTime,omitempty"`
1603
1604 TotalQueuedTime *string `json:"totalQueuedTime,omitempty"`
1605
1606 TotalRunningTime *string `json:"totalRunningTime,omitempty"`
1607
1608 RootProcessNodeID *string `json:"rootProcessNodeId,omitempty"`
1609
1610 YarnApplicationID *string `json:"yarnApplicationId,omitempty"`
1611
1612 YarnApplicationTimeStamp *int64 `json:"yarnApplicationTimeStamp,omitempty"`
1613
1614 CompileMode CompileMode `json:"compileMode,omitempty"`
1615
1616 RuntimeVersion *string `json:"runtimeVersion,omitempty"`
1617
1618 Script *string `json:"script,omitempty"`
1619
1620 Type Type `json:"type,omitempty"`
1621 }
1622
1623
1624 func (usjp USQLJobProperties) MarshalJSON() ([]byte, error) {
1625 usjp.Type = TypeUSQL
1626 objectMap := make(map[string]interface{})
1627 if usjp.Statistics != nil {
1628 objectMap["statistics"] = usjp.Statistics
1629 }
1630 if usjp.DebugData != nil {
1631 objectMap["debugData"] = usjp.DebugData
1632 }
1633 if usjp.Script != nil {
1634 objectMap["script"] = usjp.Script
1635 }
1636 if usjp.Type != "" {
1637 objectMap["type"] = usjp.Type
1638 }
1639 return json.Marshal(objectMap)
1640 }
1641
1642
1643 func (usjp USQLJobProperties) AsUSQLJobProperties() (*USQLJobProperties, bool) {
1644 return &usjp, true
1645 }
1646
1647
1648 func (usjp USQLJobProperties) AsHiveJobProperties() (*HiveJobProperties, bool) {
1649 return nil, false
1650 }
1651
1652
1653 func (usjp USQLJobProperties) AsProperties() (*Properties, bool) {
1654 return nil, false
1655 }
1656
1657
1658 func (usjp USQLJobProperties) AsBasicProperties() (BasicProperties, bool) {
1659 return &usjp, true
1660 }
1661
View as plain text