forked from Azure/azure-sdk-for-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.go
2244 lines (2068 loc) · 87.6 KB
/
models.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
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
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
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
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
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
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
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
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package job
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
import (
"context"
"encoding/json"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/date"
"github.com/Azure/go-autorest/autorest/to"
"github.com/Azure/go-autorest/tracing"
"github.com/satori/go.uuid"
"net/http"
)
// The package's fully qualified name.
const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/datalake/analytics/2017-09-01-preview/job"
// CompileMode enumerates the values for compile mode.
type CompileMode string
const (
// Full ...
Full CompileMode = "Full"
// Semantic ...
Semantic CompileMode = "Semantic"
// SingleBox ...
SingleBox CompileMode = "SingleBox"
)
// PossibleCompileModeValues returns an array of possible values for the CompileMode const type.
func PossibleCompileModeValues() []CompileMode {
return []CompileMode{Full, Semantic, SingleBox}
}
// ResourceType enumerates the values for resource type.
type ResourceType string
const (
// JobManagerResource ...
JobManagerResource ResourceType = "JobManagerResource"
// JobManagerResourceInUserFolder ...
JobManagerResourceInUserFolder ResourceType = "JobManagerResourceInUserFolder"
// StatisticsResource ...
StatisticsResource ResourceType = "StatisticsResource"
// StatisticsResourceInUserFolder ...
StatisticsResourceInUserFolder ResourceType = "StatisticsResourceInUserFolder"
// VertexResource ...
VertexResource ResourceType = "VertexResource"
// VertexResourceInUserFolder ...
VertexResourceInUserFolder ResourceType = "VertexResourceInUserFolder"
)
// PossibleResourceTypeValues returns an array of possible values for the ResourceType const type.
func PossibleResourceTypeValues() []ResourceType {
return []ResourceType{JobManagerResource, JobManagerResourceInUserFolder, StatisticsResource, StatisticsResourceInUserFolder, VertexResource, VertexResourceInUserFolder}
}
// Result enumerates the values for result.
type Result string
const (
// Cancelled ...
Cancelled Result = "Cancelled"
// Failed ...
Failed Result = "Failed"
// None ...
None Result = "None"
// Succeeded ...
Succeeded Result = "Succeeded"
)
// PossibleResultValues returns an array of possible values for the Result const type.
func PossibleResultValues() []Result {
return []Result{Cancelled, Failed, None, Succeeded}
}
// SeverityTypes enumerates the values for severity types.
type SeverityTypes string
const (
// Deprecated ...
Deprecated SeverityTypes = "Deprecated"
// Error ...
Error SeverityTypes = "Error"
// Info ...
Info SeverityTypes = "Info"
// SevereWarning ...
SevereWarning SeverityTypes = "SevereWarning"
// UserWarning ...
UserWarning SeverityTypes = "UserWarning"
// Warning ...
Warning SeverityTypes = "Warning"
)
// PossibleSeverityTypesValues returns an array of possible values for the SeverityTypes const type.
func PossibleSeverityTypesValues() []SeverityTypes {
return []SeverityTypes{Deprecated, Error, Info, SevereWarning, UserWarning, Warning}
}
// State enumerates the values for state.
type State string
const (
// StateAccepted ...
StateAccepted State = "Accepted"
// StateCompiling ...
StateCompiling State = "Compiling"
// StateEnded ...
StateEnded State = "Ended"
// StateFinalizing ...
StateFinalizing State = "Finalizing"
// StateNew ...
StateNew State = "New"
// StatePaused ...
StatePaused State = "Paused"
// StateQueued ...
StateQueued State = "Queued"
// StateRunning ...
StateRunning State = "Running"
// StateScheduling ...
StateScheduling State = "Scheduling"
// StateStarting ...
StateStarting State = "Starting"
// StateWaitingForCapacity ...
StateWaitingForCapacity State = "WaitingForCapacity"
// StateYielded ...
StateYielded State = "Yielded"
)
// PossibleStateValues returns an array of possible values for the State const type.
func PossibleStateValues() []State {
return []State{StateAccepted, StateCompiling, StateEnded, StateFinalizing, StateNew, StatePaused, StateQueued, StateRunning, StateScheduling, StateStarting, StateWaitingForCapacity, StateYielded}
}
// Type enumerates the values for type.
type Type string
const (
// TypeHive ...
TypeHive Type = "Hive"
// TypeJobProperties ...
TypeJobProperties Type = "JobProperties"
// TypeScope ...
TypeScope Type = "Scope"
// TypeUSQL ...
TypeUSQL Type = "USql"
)
// PossibleTypeValues returns an array of possible values for the Type const type.
func PossibleTypeValues() []Type {
return []Type{TypeHive, TypeJobProperties, TypeScope, TypeUSQL}
}
// TypeBasicCreateJobProperties enumerates the values for type basic create job properties.
type TypeBasicCreateJobProperties string
const (
// TypeBasicCreateJobPropertiesTypeCreateJobProperties ...
TypeBasicCreateJobPropertiesTypeCreateJobProperties TypeBasicCreateJobProperties = "CreateJobProperties"
// TypeBasicCreateJobPropertiesTypeScope ...
TypeBasicCreateJobPropertiesTypeScope TypeBasicCreateJobProperties = "Scope"
// TypeBasicCreateJobPropertiesTypeUSQL ...
TypeBasicCreateJobPropertiesTypeUSQL TypeBasicCreateJobProperties = "USql"
)
// PossibleTypeBasicCreateJobPropertiesValues returns an array of possible values for the TypeBasicCreateJobProperties const type.
func PossibleTypeBasicCreateJobPropertiesValues() []TypeBasicCreateJobProperties {
return []TypeBasicCreateJobProperties{TypeBasicCreateJobPropertiesTypeCreateJobProperties, TypeBasicCreateJobPropertiesTypeScope, TypeBasicCreateJobPropertiesTypeUSQL}
}
// TypeEnum enumerates the values for type enum.
type TypeEnum string
const (
// Hive ...
Hive TypeEnum = "Hive"
// Scope ...
Scope TypeEnum = "Scope"
// USQL ...
USQL TypeEnum = "USql"
)
// PossibleTypeEnumValues returns an array of possible values for the TypeEnum const type.
func PossibleTypeEnumValues() []TypeEnum {
return []TypeEnum{Hive, Scope, USQL}
}
// BaseJobParameters data Lake Analytics Job Parameters base class for build and submit.
type BaseJobParameters struct {
// Type - The job type of the current job (Hive, USql, or Scope (for internal use only)). Possible values include: 'USQL', 'Hive', 'Scope'
Type TypeEnum `json:"type,omitempty"`
// Properties - The job specific properties.
Properties BasicCreateJobProperties `json:"properties,omitempty"`
}
// UnmarshalJSON is the custom unmarshaler for BaseJobParameters struct.
func (bjp *BaseJobParameters) UnmarshalJSON(body []byte) error {
var m map[string]*json.RawMessage
err := json.Unmarshal(body, &m)
if err != nil {
return err
}
for k, v := range m {
switch k {
case "type":
if v != nil {
var typeVar TypeEnum
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
bjp.Type = typeVar
}
case "properties":
if v != nil {
properties, err := unmarshalBasicCreateJobProperties(*v)
if err != nil {
return err
}
bjp.Properties = properties
}
}
}
return nil
}
// BuildJobParameters the parameters used to build a new Data Lake Analytics job.
type BuildJobParameters struct {
// Name - The friendly name of the job to build.
Name *string `json:"name,omitempty"`
// Type - The job type of the current job (Hive, USql, or Scope (for internal use only)). Possible values include: 'USQL', 'Hive', 'Scope'
Type TypeEnum `json:"type,omitempty"`
// Properties - The job specific properties.
Properties BasicCreateJobProperties `json:"properties,omitempty"`
}
// UnmarshalJSON is the custom unmarshaler for BuildJobParameters struct.
func (bjp *BuildJobParameters) UnmarshalJSON(body []byte) error {
var m map[string]*json.RawMessage
err := json.Unmarshal(body, &m)
if err != nil {
return err
}
for k, v := range m {
switch k {
case "name":
if v != nil {
var name string
err = json.Unmarshal(*v, &name)
if err != nil {
return err
}
bjp.Name = &name
}
case "type":
if v != nil {
var typeVar TypeEnum
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
bjp.Type = typeVar
}
case "properties":
if v != nil {
properties, err := unmarshalBasicCreateJobProperties(*v)
if err != nil {
return err
}
bjp.Properties = properties
}
}
}
return nil
}
// CancelFuture an abstraction for monitoring and retrieving the results of a long-running operation.
type CancelFuture struct {
azure.Future
}
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
func (future *CancelFuture) Result(client Client) (ar autorest.Response, err error) {
var done bool
done, err = future.DoneWithContext(context.Background(), client)
if err != nil {
err = autorest.NewErrorWithError(err, "job.CancelFuture", "Result", future.Response(), "Polling failure")
return
}
if !done {
err = azure.NewAsyncOpIncompleteError("job.CancelFuture")
return
}
ar.Response = future.Response()
return
}
// CreateJobParameters the parameters used to submit a new Data Lake Analytics job.
type CreateJobParameters struct {
// Name - The friendly name of the job to submit.
Name *string `json:"name,omitempty"`
// DegreeOfParallelism - The degree of parallelism to use for this job. At most one of degreeOfParallelism and degreeOfParallelismPercent should be specified. If none, a default value of 1 will be used for degreeOfParallelism.
DegreeOfParallelism *int32 `json:"degreeOfParallelism,omitempty"`
// DegreeOfParallelismPercent - the degree of parallelism in percentage used for this job. At most one of degreeOfParallelism and degreeOfParallelismPercent should be specified. If none, a default value of 1 will be used for degreeOfParallelism.
DegreeOfParallelismPercent *float64 `json:"degreeOfParallelismPercent,omitempty"`
// Priority - The priority value to use for the current job. Lower numbers have a higher priority. By default, a job has a priority of 1000. This must be greater than 0.
Priority *int32 `json:"priority,omitempty"`
// LogFilePatterns - The list of log file name patterns to find in the logFolder. '*' is the only matching character allowed. Example format: jobExecution*.log or *mylog*.txt
LogFilePatterns *[]string `json:"logFilePatterns,omitempty"`
// Related - The recurring job relationship information properties.
Related *RelationshipProperties `json:"related,omitempty"`
// Type - The job type of the current job (Hive, USql, or Scope (for internal use only)). Possible values include: 'USQL', 'Hive', 'Scope'
Type TypeEnum `json:"type,omitempty"`
// Properties - The job specific properties.
Properties BasicCreateJobProperties `json:"properties,omitempty"`
}
// UnmarshalJSON is the custom unmarshaler for CreateJobParameters struct.
func (cjp *CreateJobParameters) UnmarshalJSON(body []byte) error {
var m map[string]*json.RawMessage
err := json.Unmarshal(body, &m)
if err != nil {
return err
}
for k, v := range m {
switch k {
case "name":
if v != nil {
var name string
err = json.Unmarshal(*v, &name)
if err != nil {
return err
}
cjp.Name = &name
}
case "degreeOfParallelism":
if v != nil {
var degreeOfParallelism int32
err = json.Unmarshal(*v, °reeOfParallelism)
if err != nil {
return err
}
cjp.DegreeOfParallelism = °reeOfParallelism
}
case "degreeOfParallelismPercent":
if v != nil {
var degreeOfParallelismPercent float64
err = json.Unmarshal(*v, °reeOfParallelismPercent)
if err != nil {
return err
}
cjp.DegreeOfParallelismPercent = °reeOfParallelismPercent
}
case "priority":
if v != nil {
var priority int32
err = json.Unmarshal(*v, &priority)
if err != nil {
return err
}
cjp.Priority = &priority
}
case "logFilePatterns":
if v != nil {
var logFilePatterns []string
err = json.Unmarshal(*v, &logFilePatterns)
if err != nil {
return err
}
cjp.LogFilePatterns = &logFilePatterns
}
case "related":
if v != nil {
var related RelationshipProperties
err = json.Unmarshal(*v, &related)
if err != nil {
return err
}
cjp.Related = &related
}
case "type":
if v != nil {
var typeVar TypeEnum
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
cjp.Type = typeVar
}
case "properties":
if v != nil {
properties, err := unmarshalBasicCreateJobProperties(*v)
if err != nil {
return err
}
cjp.Properties = properties
}
}
}
return nil
}
// BasicCreateJobProperties the common Data Lake Analytics job properties for job submission.
type BasicCreateJobProperties interface {
AsCreateUSQLJobProperties() (*CreateUSQLJobProperties, bool)
AsCreateScopeJobProperties() (*CreateScopeJobProperties, bool)
AsCreateJobProperties() (*CreateJobProperties, bool)
}
// CreateJobProperties the common Data Lake Analytics job properties for job submission.
type CreateJobProperties struct {
// RuntimeVersion - The runtime version of the Data Lake Analytics engine to use for the specific type of job being run.
RuntimeVersion *string `json:"runtimeVersion,omitempty"`
// Script - The script to run. Please note that the maximum script size is 3 MB.
Script *string `json:"script,omitempty"`
// Type - Possible values include: 'TypeBasicCreateJobPropertiesTypeCreateJobProperties', 'TypeBasicCreateJobPropertiesTypeUSQL', 'TypeBasicCreateJobPropertiesTypeScope'
Type TypeBasicCreateJobProperties `json:"type,omitempty"`
}
func unmarshalBasicCreateJobProperties(body []byte) (BasicCreateJobProperties, error) {
var m map[string]interface{}
err := json.Unmarshal(body, &m)
if err != nil {
return nil, err
}
switch m["type"] {
case string(TypeBasicCreateJobPropertiesTypeUSQL):
var cusjp CreateUSQLJobProperties
err := json.Unmarshal(body, &cusjp)
return cusjp, err
case string(TypeBasicCreateJobPropertiesTypeScope):
var csjp CreateScopeJobProperties
err := json.Unmarshal(body, &csjp)
return csjp, err
default:
var cjp CreateJobProperties
err := json.Unmarshal(body, &cjp)
return cjp, err
}
}
func unmarshalBasicCreateJobPropertiesArray(body []byte) ([]BasicCreateJobProperties, error) {
var rawMessages []*json.RawMessage
err := json.Unmarshal(body, &rawMessages)
if err != nil {
return nil, err
}
cjpArray := make([]BasicCreateJobProperties, len(rawMessages))
for index, rawMessage := range rawMessages {
cjp, err := unmarshalBasicCreateJobProperties(*rawMessage)
if err != nil {
return nil, err
}
cjpArray[index] = cjp
}
return cjpArray, nil
}
// MarshalJSON is the custom marshaler for CreateJobProperties.
func (cjp CreateJobProperties) MarshalJSON() ([]byte, error) {
cjp.Type = TypeBasicCreateJobPropertiesTypeCreateJobProperties
objectMap := make(map[string]interface{})
if cjp.RuntimeVersion != nil {
objectMap["runtimeVersion"] = cjp.RuntimeVersion
}
if cjp.Script != nil {
objectMap["script"] = cjp.Script
}
if cjp.Type != "" {
objectMap["type"] = cjp.Type
}
return json.Marshal(objectMap)
}
// AsCreateUSQLJobProperties is the BasicCreateJobProperties implementation for CreateJobProperties.
func (cjp CreateJobProperties) AsCreateUSQLJobProperties() (*CreateUSQLJobProperties, bool) {
return nil, false
}
// AsCreateScopeJobProperties is the BasicCreateJobProperties implementation for CreateJobProperties.
func (cjp CreateJobProperties) AsCreateScopeJobProperties() (*CreateScopeJobProperties, bool) {
return nil, false
}
// AsCreateJobProperties is the BasicCreateJobProperties implementation for CreateJobProperties.
func (cjp CreateJobProperties) AsCreateJobProperties() (*CreateJobProperties, bool) {
return &cjp, true
}
// AsBasicCreateJobProperties is the BasicCreateJobProperties implementation for CreateJobProperties.
func (cjp CreateJobProperties) AsBasicCreateJobProperties() (BasicCreateJobProperties, bool) {
return &cjp, true
}
// CreateScopeJobParameters the parameters used to submit a new Data Lake Analytics Scope job. (Only for
// use internally with Scope job type.)
type CreateScopeJobParameters struct {
// Tags - The key-value pairs used to add additional metadata to the job information.
Tags map[string]*string `json:"tags"`
// Name - The friendly name of the job to submit.
Name *string `json:"name,omitempty"`
// DegreeOfParallelism - The degree of parallelism to use for this job. At most one of degreeOfParallelism and degreeOfParallelismPercent should be specified. If none, a default value of 1 will be used for degreeOfParallelism.
DegreeOfParallelism *int32 `json:"degreeOfParallelism,omitempty"`
// DegreeOfParallelismPercent - the degree of parallelism in percentage used for this job. At most one of degreeOfParallelism and degreeOfParallelismPercent should be specified. If none, a default value of 1 will be used for degreeOfParallelism.
DegreeOfParallelismPercent *float64 `json:"degreeOfParallelismPercent,omitempty"`
// Priority - The priority value to use for the current job. Lower numbers have a higher priority. By default, a job has a priority of 1000. This must be greater than 0.
Priority *int32 `json:"priority,omitempty"`
// LogFilePatterns - The list of log file name patterns to find in the logFolder. '*' is the only matching character allowed. Example format: jobExecution*.log or *mylog*.txt
LogFilePatterns *[]string `json:"logFilePatterns,omitempty"`
// Related - The recurring job relationship information properties.
Related *RelationshipProperties `json:"related,omitempty"`
// Type - The job type of the current job (Hive, USql, or Scope (for internal use only)). Possible values include: 'USQL', 'Hive', 'Scope'
Type TypeEnum `json:"type,omitempty"`
// Properties - The job specific properties.
Properties BasicCreateJobProperties `json:"properties,omitempty"`
}
// MarshalJSON is the custom marshaler for CreateScopeJobParameters.
func (csjp CreateScopeJobParameters) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if csjp.Tags != nil {
objectMap["tags"] = csjp.Tags
}
if csjp.Name != nil {
objectMap["name"] = csjp.Name
}
if csjp.DegreeOfParallelism != nil {
objectMap["degreeOfParallelism"] = csjp.DegreeOfParallelism
}
if csjp.DegreeOfParallelismPercent != nil {
objectMap["degreeOfParallelismPercent"] = csjp.DegreeOfParallelismPercent
}
if csjp.Priority != nil {
objectMap["priority"] = csjp.Priority
}
if csjp.LogFilePatterns != nil {
objectMap["logFilePatterns"] = csjp.LogFilePatterns
}
if csjp.Related != nil {
objectMap["related"] = csjp.Related
}
if csjp.Type != "" {
objectMap["type"] = csjp.Type
}
objectMap["properties"] = csjp.Properties
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for CreateScopeJobParameters struct.
func (csjp *CreateScopeJobParameters) UnmarshalJSON(body []byte) error {
var m map[string]*json.RawMessage
err := json.Unmarshal(body, &m)
if err != nil {
return err
}
for k, v := range m {
switch k {
case "tags":
if v != nil {
var tags map[string]*string
err = json.Unmarshal(*v, &tags)
if err != nil {
return err
}
csjp.Tags = tags
}
case "name":
if v != nil {
var name string
err = json.Unmarshal(*v, &name)
if err != nil {
return err
}
csjp.Name = &name
}
case "degreeOfParallelism":
if v != nil {
var degreeOfParallelism int32
err = json.Unmarshal(*v, °reeOfParallelism)
if err != nil {
return err
}
csjp.DegreeOfParallelism = °reeOfParallelism
}
case "degreeOfParallelismPercent":
if v != nil {
var degreeOfParallelismPercent float64
err = json.Unmarshal(*v, °reeOfParallelismPercent)
if err != nil {
return err
}
csjp.DegreeOfParallelismPercent = °reeOfParallelismPercent
}
case "priority":
if v != nil {
var priority int32
err = json.Unmarshal(*v, &priority)
if err != nil {
return err
}
csjp.Priority = &priority
}
case "logFilePatterns":
if v != nil {
var logFilePatterns []string
err = json.Unmarshal(*v, &logFilePatterns)
if err != nil {
return err
}
csjp.LogFilePatterns = &logFilePatterns
}
case "related":
if v != nil {
var related RelationshipProperties
err = json.Unmarshal(*v, &related)
if err != nil {
return err
}
csjp.Related = &related
}
case "type":
if v != nil {
var typeVar TypeEnum
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
csjp.Type = typeVar
}
case "properties":
if v != nil {
properties, err := unmarshalBasicCreateJobProperties(*v)
if err != nil {
return err
}
csjp.Properties = properties
}
}
}
return nil
}
// CreateScopeJobProperties scope job properties used when submitting Scope jobs. (Only for use internally
// with Scope job type.)
type CreateScopeJobProperties struct {
// Resources - The list of resources that are required by the job.
Resources *[]ScopeJobResource `json:"resources,omitempty"`
// Notifier - The list of email addresses, separated by semi-colons, to notify when the job reaches a terminal state.
Notifier *string `json:"notifier,omitempty"`
// RuntimeVersion - The runtime version of the Data Lake Analytics engine to use for the specific type of job being run.
RuntimeVersion *string `json:"runtimeVersion,omitempty"`
// Script - The script to run. Please note that the maximum script size is 3 MB.
Script *string `json:"script,omitempty"`
// Type - Possible values include: 'TypeBasicCreateJobPropertiesTypeCreateJobProperties', 'TypeBasicCreateJobPropertiesTypeUSQL', 'TypeBasicCreateJobPropertiesTypeScope'
Type TypeBasicCreateJobProperties `json:"type,omitempty"`
}
// MarshalJSON is the custom marshaler for CreateScopeJobProperties.
func (csjp CreateScopeJobProperties) MarshalJSON() ([]byte, error) {
csjp.Type = TypeBasicCreateJobPropertiesTypeScope
objectMap := make(map[string]interface{})
if csjp.Resources != nil {
objectMap["resources"] = csjp.Resources
}
if csjp.Notifier != nil {
objectMap["notifier"] = csjp.Notifier
}
if csjp.RuntimeVersion != nil {
objectMap["runtimeVersion"] = csjp.RuntimeVersion
}
if csjp.Script != nil {
objectMap["script"] = csjp.Script
}
if csjp.Type != "" {
objectMap["type"] = csjp.Type
}
return json.Marshal(objectMap)
}
// AsCreateUSQLJobProperties is the BasicCreateJobProperties implementation for CreateScopeJobProperties.
func (csjp CreateScopeJobProperties) AsCreateUSQLJobProperties() (*CreateUSQLJobProperties, bool) {
return nil, false
}
// AsCreateScopeJobProperties is the BasicCreateJobProperties implementation for CreateScopeJobProperties.
func (csjp CreateScopeJobProperties) AsCreateScopeJobProperties() (*CreateScopeJobProperties, bool) {
return &csjp, true
}
// AsCreateJobProperties is the BasicCreateJobProperties implementation for CreateScopeJobProperties.
func (csjp CreateScopeJobProperties) AsCreateJobProperties() (*CreateJobProperties, bool) {
return nil, false
}
// AsBasicCreateJobProperties is the BasicCreateJobProperties implementation for CreateScopeJobProperties.
func (csjp CreateScopeJobProperties) AsBasicCreateJobProperties() (BasicCreateJobProperties, bool) {
return &csjp, true
}
// CreateUSQLJobProperties u-SQL job properties used when submitting U-SQL jobs.
type CreateUSQLJobProperties struct {
// CompileMode - The specific compilation mode for the job used during execution. If this is not specified during submission, the server will determine the optimal compilation mode. Possible values include: 'Semantic', 'Full', 'SingleBox'
CompileMode CompileMode `json:"compileMode,omitempty"`
// RuntimeVersion - The runtime version of the Data Lake Analytics engine to use for the specific type of job being run.
RuntimeVersion *string `json:"runtimeVersion,omitempty"`
// Script - The script to run. Please note that the maximum script size is 3 MB.
Script *string `json:"script,omitempty"`
// Type - Possible values include: 'TypeBasicCreateJobPropertiesTypeCreateJobProperties', 'TypeBasicCreateJobPropertiesTypeUSQL', 'TypeBasicCreateJobPropertiesTypeScope'
Type TypeBasicCreateJobProperties `json:"type,omitempty"`
}
// MarshalJSON is the custom marshaler for CreateUSQLJobProperties.
func (cusjp CreateUSQLJobProperties) MarshalJSON() ([]byte, error) {
cusjp.Type = TypeBasicCreateJobPropertiesTypeUSQL
objectMap := make(map[string]interface{})
if cusjp.CompileMode != "" {
objectMap["compileMode"] = cusjp.CompileMode
}
if cusjp.RuntimeVersion != nil {
objectMap["runtimeVersion"] = cusjp.RuntimeVersion
}
if cusjp.Script != nil {
objectMap["script"] = cusjp.Script
}
if cusjp.Type != "" {
objectMap["type"] = cusjp.Type
}
return json.Marshal(objectMap)
}
// AsCreateUSQLJobProperties is the BasicCreateJobProperties implementation for CreateUSQLJobProperties.
func (cusjp CreateUSQLJobProperties) AsCreateUSQLJobProperties() (*CreateUSQLJobProperties, bool) {
return &cusjp, true
}
// AsCreateScopeJobProperties is the BasicCreateJobProperties implementation for CreateUSQLJobProperties.
func (cusjp CreateUSQLJobProperties) AsCreateScopeJobProperties() (*CreateScopeJobProperties, bool) {
return nil, false
}
// AsCreateJobProperties is the BasicCreateJobProperties implementation for CreateUSQLJobProperties.
func (cusjp CreateUSQLJobProperties) AsCreateJobProperties() (*CreateJobProperties, bool) {
return nil, false
}
// AsBasicCreateJobProperties is the BasicCreateJobProperties implementation for CreateUSQLJobProperties.
func (cusjp CreateUSQLJobProperties) AsBasicCreateJobProperties() (BasicCreateJobProperties, bool) {
return &cusjp, true
}
// DataPath a Data Lake Analytics job data path item.
type DataPath struct {
autorest.Response `json:"-"`
// JobID - READ-ONLY; The ID of the job this data is for.
JobID *uuid.UUID `json:"jobId,omitempty"`
// Command - READ-ONLY; The command that this job data relates to.
Command *string `json:"command,omitempty"`
// Paths - READ-ONLY; The list of paths to all of the job data.
Paths *[]string `json:"paths,omitempty"`
}
// Diagnostics error diagnostic information for failed jobs.
type Diagnostics struct {
// Message - READ-ONLY; The error message.
Message *string `json:"message,omitempty"`
// Severity - READ-ONLY; The severity of the error. Possible values include: 'Warning', 'Error', 'Info', 'SevereWarning', 'Deprecated', 'UserWarning'
Severity SeverityTypes `json:"severity,omitempty"`
// LineNumber - READ-ONLY; The line number the error occurred on.
LineNumber *int32 `json:"lineNumber,omitempty"`
// ColumnNumber - READ-ONLY; The column where the error occurred.
ColumnNumber *int32 `json:"columnNumber,omitempty"`
// Start - READ-ONLY; The starting index of the error.
Start *int32 `json:"start,omitempty"`
// End - READ-ONLY; The ending index of the error.
End *int32 `json:"end,omitempty"`
}
// ErrorDetails the Data Lake Analytics job error details.
type ErrorDetails struct {
// ErrorID - READ-ONLY; The specific identifier for the type of error encountered in the job.
ErrorID *string `json:"errorId,omitempty"`
// Severity - READ-ONLY; The severity level of the failure. Possible values include: 'Warning', 'Error', 'Info', 'SevereWarning', 'Deprecated', 'UserWarning'
Severity SeverityTypes `json:"severity,omitempty"`
// Source - READ-ONLY; The ultimate source of the failure (usually either SYSTEM or USER).
Source *string `json:"source,omitempty"`
// Message - READ-ONLY; The user friendly error message for the failure.
Message *string `json:"message,omitempty"`
// Description - READ-ONLY; The error message description.
Description *string `json:"description,omitempty"`
// Details - READ-ONLY; The details of the error message.
Details *string `json:"details,omitempty"`
// LineNumber - READ-ONLY; The specific line number in the job where the error occurred.
LineNumber *int32 `json:"lineNumber,omitempty"`
// StartOffset - READ-ONLY; The start offset in the job where the error was found
StartOffset *int32 `json:"startOffset,omitempty"`
// EndOffset - READ-ONLY; The end offset in the job where the error was found.
EndOffset *int32 `json:"endOffset,omitempty"`
// Resolution - READ-ONLY; The recommended resolution for the failure, if any.
Resolution *string `json:"resolution,omitempty"`
// FilePath - READ-ONLY; The path to any supplemental error files, if any.
FilePath *string `json:"filePath,omitempty"`
// HelpLink - READ-ONLY; The link to MSDN or Azure help for this type of error, if any.
HelpLink *string `json:"helpLink,omitempty"`
// InternalDiagnostics - READ-ONLY; The internal diagnostic stack trace if the user requesting the job error details has sufficient permissions it will be retrieved, otherwise it will be empty.
InternalDiagnostics *string `json:"internalDiagnostics,omitempty"`
// InnerError - READ-ONLY; The inner error of this specific job error message, if any.
InnerError *InnerError `json:"innerError,omitempty"`
}
// HiveJobProperties hive job properties used when retrieving Hive jobs.
type HiveJobProperties struct {
// LogsLocation - READ-ONLY; The Hive logs location.
LogsLocation *string `json:"logsLocation,omitempty"`
// OutputLocation - READ-ONLY; The location of Hive job output files (both execution output and results).
OutputLocation *string `json:"outputLocation,omitempty"`
// StatementCount - READ-ONLY; The number of statements that will be run based on the script.
StatementCount *int32 `json:"statementCount,omitempty"`
// ExecutedStatementCount - READ-ONLY; The number of statements that have been run based on the script.
ExecutedStatementCount *int32 `json:"executedStatementCount,omitempty"`
// RuntimeVersion - The runtime version of the Data Lake Analytics engine to use for the specific type of job being run.
RuntimeVersion *string `json:"runtimeVersion,omitempty"`
// Script - The script to run. Please note that the maximum script size is 3 MB.
Script *string `json:"script,omitempty"`
// Type - Possible values include: 'TypeJobProperties', 'TypeUSQL', 'TypeHive', 'TypeScope'
Type Type `json:"type,omitempty"`
}
// MarshalJSON is the custom marshaler for HiveJobProperties.
func (hjp HiveJobProperties) MarshalJSON() ([]byte, error) {
hjp.Type = TypeHive
objectMap := make(map[string]interface{})
if hjp.RuntimeVersion != nil {
objectMap["runtimeVersion"] = hjp.RuntimeVersion
}
if hjp.Script != nil {
objectMap["script"] = hjp.Script
}
if hjp.Type != "" {
objectMap["type"] = hjp.Type
}
return json.Marshal(objectMap)
}
// AsUSQLJobProperties is the BasicProperties implementation for HiveJobProperties.
func (hjp HiveJobProperties) AsUSQLJobProperties() (*USQLJobProperties, bool) {
return nil, false
}
// AsHiveJobProperties is the BasicProperties implementation for HiveJobProperties.
func (hjp HiveJobProperties) AsHiveJobProperties() (*HiveJobProperties, bool) {
return &hjp, true
}
// AsScopeJobProperties is the BasicProperties implementation for HiveJobProperties.
func (hjp HiveJobProperties) AsScopeJobProperties() (*ScopeJobProperties, bool) {
return nil, false
}
// AsProperties is the BasicProperties implementation for HiveJobProperties.
func (hjp HiveJobProperties) AsProperties() (*Properties, bool) {
return nil, false
}
// AsBasicProperties is the BasicProperties implementation for HiveJobProperties.
func (hjp HiveJobProperties) AsBasicProperties() (BasicProperties, bool) {
return &hjp, true
}
// InfoListResult list of JobInfo items.
type InfoListResult struct {
autorest.Response `json:"-"`
// Value - READ-ONLY; The list of JobInfo items.
Value *[]InformationBasic `json:"value,omitempty"`
// NextLink - READ-ONLY; The link (url) to the next page of results.
NextLink *string `json:"nextLink,omitempty"`
}
// InfoListResultIterator provides access to a complete listing of InformationBasic values.
type InfoListResultIterator struct {
i int
page InfoListResultPage
}
// NextWithContext advances to the next value. If there was an error making
// the request the iterator does not advance and the error is returned.
func (iter *InfoListResultIterator) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/InfoListResultIterator.NextWithContext")
defer func() {
sc := -1
if iter.Response().Response.Response != nil {
sc = iter.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
iter.i++
if iter.i < len(iter.page.Values()) {
return nil
}
err = iter.page.NextWithContext(ctx)
if err != nil {
iter.i--
return err
}
iter.i = 0
return nil
}
// Next advances to the next value. If there was an error making
// the request the iterator does not advance and the error is returned.
// Deprecated: Use NextWithContext() instead.
func (iter *InfoListResultIterator) Next() error {
return iter.NextWithContext(context.Background())
}
// NotDone returns true if the enumeration should be started or is not yet complete.
func (iter InfoListResultIterator) NotDone() bool {
return iter.page.NotDone() && iter.i < len(iter.page.Values())
}
// Response returns the raw server response from the last page request.
func (iter InfoListResultIterator) Response() InfoListResult {
return iter.page.Response()
}
// Value returns the current value or a zero-initialized value if the
// iterator has advanced beyond the end of the collection.
func (iter InfoListResultIterator) Value() InformationBasic {
if !iter.page.NotDone() {
return InformationBasic{}
}
return iter.page.Values()[iter.i]
}
// Creates a new instance of the InfoListResultIterator type.
func NewInfoListResultIterator(page InfoListResultPage) InfoListResultIterator {
return InfoListResultIterator{page: page}
}
// IsEmpty returns true if the ListResult contains no values.
func (ilr InfoListResult) IsEmpty() bool {
return ilr.Value == nil || len(*ilr.Value) == 0
}
// infoListResultPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func (ilr InfoListResult) infoListResultPreparer(ctx context.Context) (*http.Request, error) {
if ilr.NextLink == nil || len(to.String(ilr.NextLink)) < 1 {
return nil, nil
}
return autorest.Prepare((&http.Request{}).WithContext(ctx),
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(ilr.NextLink)))
}
// InfoListResultPage contains a page of InformationBasic values.
type InfoListResultPage struct {
fn func(context.Context, InfoListResult) (InfoListResult, error)
ilr InfoListResult
}
// NextWithContext advances to the next page of values. If there was an error making
// the request the page does not advance and the error is returned.
func (page *InfoListResultPage) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/InfoListResultPage.NextWithContext")
defer func() {
sc := -1
if page.Response().Response.Response != nil {
sc = page.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}