1package job
2
3// Copyright (c) Microsoft and contributors.  All rights reserved.
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13//
14// See the License for the specific language governing permissions and
15// limitations under the License.
16//
17// Code generated by Microsoft (R) AutoRest Code Generator.
18// Changes may cause incorrect behavior and will be lost if the code is regenerated.
19
20import (
21	"encoding/json"
22	"github.com/Azure/go-autorest/autorest"
23	"github.com/Azure/go-autorest/autorest/date"
24	"github.com/Azure/go-autorest/autorest/to"
25	"github.com/satori/go.uuid"
26	"net/http"
27)
28
29// CompileMode enumerates the values for compile mode.
30type CompileMode string
31
32const (
33	// Full ...
34	Full CompileMode = "Full"
35	// Semantic ...
36	Semantic CompileMode = "Semantic"
37	// SingleBox ...
38	SingleBox CompileMode = "SingleBox"
39)
40
41// PossibleCompileModeValues returns an array of possible values for the CompileMode const type.
42func PossibleCompileModeValues() []CompileMode {
43	return []CompileMode{Full, Semantic, SingleBox}
44}
45
46// ResourceType enumerates the values for resource type.
47type ResourceType string
48
49const (
50	// JobManagerResource ...
51	JobManagerResource ResourceType = "JobManagerResource"
52	// JobManagerResourceInUserFolder ...
53	JobManagerResourceInUserFolder ResourceType = "JobManagerResourceInUserFolder"
54	// StatisticsResource ...
55	StatisticsResource ResourceType = "StatisticsResource"
56	// StatisticsResourceInUserFolder ...
57	StatisticsResourceInUserFolder ResourceType = "StatisticsResourceInUserFolder"
58	// VertexResource ...
59	VertexResource ResourceType = "VertexResource"
60	// VertexResourceInUserFolder ...
61	VertexResourceInUserFolder ResourceType = "VertexResourceInUserFolder"
62)
63
64// PossibleResourceTypeValues returns an array of possible values for the ResourceType const type.
65func PossibleResourceTypeValues() []ResourceType {
66	return []ResourceType{JobManagerResource, JobManagerResourceInUserFolder, StatisticsResource, StatisticsResourceInUserFolder, VertexResource, VertexResourceInUserFolder}
67}
68
69// Result enumerates the values for result.
70type Result string
71
72const (
73	// Cancelled ...
74	Cancelled Result = "Cancelled"
75	// Failed ...
76	Failed Result = "Failed"
77	// None ...
78	None Result = "None"
79	// Succeeded ...
80	Succeeded Result = "Succeeded"
81)
82
83// PossibleResultValues returns an array of possible values for the Result const type.
84func PossibleResultValues() []Result {
85	return []Result{Cancelled, Failed, None, Succeeded}
86}
87
88// SeverityTypes enumerates the values for severity types.
89type SeverityTypes string
90
91const (
92	// Deprecated ...
93	Deprecated SeverityTypes = "Deprecated"
94	// Error ...
95	Error SeverityTypes = "Error"
96	// Info ...
97	Info SeverityTypes = "Info"
98	// SevereWarning ...
99	SevereWarning SeverityTypes = "SevereWarning"
100	// UserWarning ...
101	UserWarning SeverityTypes = "UserWarning"
102	// Warning ...
103	Warning SeverityTypes = "Warning"
104)
105
106// PossibleSeverityTypesValues returns an array of possible values for the SeverityTypes const type.
107func PossibleSeverityTypesValues() []SeverityTypes {
108	return []SeverityTypes{Deprecated, Error, Info, SevereWarning, UserWarning, Warning}
109}
110
111// State enumerates the values for state.
112type State string
113
114const (
115	// StateAccepted ...
116	StateAccepted State = "Accepted"
117	// StateCompiling ...
118	StateCompiling State = "Compiling"
119	// StateEnded ...
120	StateEnded State = "Ended"
121	// StateNew ...
122	StateNew State = "New"
123	// StatePaused ...
124	StatePaused State = "Paused"
125	// StateQueued ...
126	StateQueued State = "Queued"
127	// StateRunning ...
128	StateRunning State = "Running"
129	// StateScheduling ...
130	StateScheduling State = "Scheduling"
131	// StateStarting ...
132	StateStarting State = "Starting"
133	// StateWaitingForCapacity ...
134	StateWaitingForCapacity State = "WaitingForCapacity"
135)
136
137// PossibleStateValues returns an array of possible values for the State const type.
138func PossibleStateValues() []State {
139	return []State{StateAccepted, StateCompiling, StateEnded, StateNew, StatePaused, StateQueued, StateRunning, StateScheduling, StateStarting, StateWaitingForCapacity}
140}
141
142// Type enumerates the values for type.
143type Type string
144
145const (
146	// TypeHive ...
147	TypeHive Type = "Hive"
148	// TypeJobProperties ...
149	TypeJobProperties Type = "JobProperties"
150	// TypeUSQL ...
151	TypeUSQL Type = "USql"
152)
153
154// PossibleTypeValues returns an array of possible values for the Type const type.
155func PossibleTypeValues() []Type {
156	return []Type{TypeHive, TypeJobProperties, TypeUSQL}
157}
158
159// TypeBasicCreateJobProperties enumerates the values for type basic create job properties.
160type TypeBasicCreateJobProperties string
161
162const (
163	// TypeBasicCreateJobPropertiesTypeCreateJobProperties ...
164	TypeBasicCreateJobPropertiesTypeCreateJobProperties TypeBasicCreateJobProperties = "CreateJobProperties"
165	// TypeBasicCreateJobPropertiesTypeUSQL ...
166	TypeBasicCreateJobPropertiesTypeUSQL TypeBasicCreateJobProperties = "USql"
167)
168
169// PossibleTypeBasicCreateJobPropertiesValues returns an array of possible values for the TypeBasicCreateJobProperties const type.
170func PossibleTypeBasicCreateJobPropertiesValues() []TypeBasicCreateJobProperties {
171	return []TypeBasicCreateJobProperties{TypeBasicCreateJobPropertiesTypeCreateJobProperties, TypeBasicCreateJobPropertiesTypeUSQL}
172}
173
174// TypeEnum enumerates the values for type enum.
175type TypeEnum string
176
177const (
178	// Hive ...
179	Hive TypeEnum = "Hive"
180	// USQL ...
181	USQL TypeEnum = "USql"
182)
183
184// PossibleTypeEnumValues returns an array of possible values for the TypeEnum const type.
185func PossibleTypeEnumValues() []TypeEnum {
186	return []TypeEnum{Hive, USQL}
187}
188
189// BaseJobParameters data Lake Analytics Job Parameters base class for build and submit.
190type BaseJobParameters struct {
191	// Type - the job type of the current job (Hive or USql). Possible values include: 'USQL', 'Hive'
192	Type TypeEnum `json:"type,omitempty"`
193	// Properties - the job specific properties.
194	Properties BasicCreateJobProperties `json:"properties,omitempty"`
195}
196
197// UnmarshalJSON is the custom unmarshaler for BaseJobParameters struct.
198func (bjp *BaseJobParameters) UnmarshalJSON(body []byte) error {
199	var m map[string]*json.RawMessage
200	err := json.Unmarshal(body, &m)
201	if err != nil {
202		return err
203	}
204	for k, v := range m {
205		switch k {
206		case "type":
207			if v != nil {
208				var typeVar TypeEnum
209				err = json.Unmarshal(*v, &typeVar)
210				if err != nil {
211					return err
212				}
213				bjp.Type = typeVar
214			}
215		case "properties":
216			if v != nil {
217				properties, err := unmarshalBasicCreateJobProperties(*v)
218				if err != nil {
219					return err
220				}
221				bjp.Properties = properties
222			}
223		}
224	}
225
226	return nil
227}
228
229// BuildJobParameters the parameters used to build a new Data Lake Analytics job.
230type BuildJobParameters struct {
231	// Name - the friendly name of the job to build.
232	Name *string `json:"name,omitempty"`
233	// Type - the job type of the current job (Hive or USql). Possible values include: 'USQL', 'Hive'
234	Type TypeEnum `json:"type,omitempty"`
235	// Properties - the job specific properties.
236	Properties BasicCreateJobProperties `json:"properties,omitempty"`
237}
238
239// UnmarshalJSON is the custom unmarshaler for BuildJobParameters struct.
240func (bjp *BuildJobParameters) UnmarshalJSON(body []byte) error {
241	var m map[string]*json.RawMessage
242	err := json.Unmarshal(body, &m)
243	if err != nil {
244		return err
245	}
246	for k, v := range m {
247		switch k {
248		case "name":
249			if v != nil {
250				var name string
251				err = json.Unmarshal(*v, &name)
252				if err != nil {
253					return err
254				}
255				bjp.Name = &name
256			}
257		case "type":
258			if v != nil {
259				var typeVar TypeEnum
260				err = json.Unmarshal(*v, &typeVar)
261				if err != nil {
262					return err
263				}
264				bjp.Type = typeVar
265			}
266		case "properties":
267			if v != nil {
268				properties, err := unmarshalBasicCreateJobProperties(*v)
269				if err != nil {
270					return err
271				}
272				bjp.Properties = properties
273			}
274		}
275	}
276
277	return nil
278}
279
280// CreateJobParameters the parameters used to submit a new Data Lake Analytics job.
281type CreateJobParameters struct {
282	// Name - the friendly name of the job to submit.
283	Name *string `json:"name,omitempty"`
284	// DegreeOfParallelism - the degree of parallelism to use for this job. This must be greater than 0, if set to less than 0 it will default to 1.
285	DegreeOfParallelism *int32 `json:"degreeOfParallelism,omitempty"`
286	// 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.
287	Priority *int32 `json:"priority,omitempty"`
288	// 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
289	LogFilePatterns *[]string `json:"logFilePatterns,omitempty"`
290	// Related - the recurring job relationship information properties.
291	Related *RelationshipProperties `json:"related,omitempty"`
292	// Type - the job type of the current job (Hive or USql). Possible values include: 'USQL', 'Hive'
293	Type TypeEnum `json:"type,omitempty"`
294	// Properties - the job specific properties.
295	Properties BasicCreateJobProperties `json:"properties,omitempty"`
296}
297
298// UnmarshalJSON is the custom unmarshaler for CreateJobParameters struct.
299func (cjp *CreateJobParameters) UnmarshalJSON(body []byte) error {
300	var m map[string]*json.RawMessage
301	err := json.Unmarshal(body, &m)
302	if err != nil {
303		return err
304	}
305	for k, v := range m {
306		switch k {
307		case "name":
308			if v != nil {
309				var name string
310				err = json.Unmarshal(*v, &name)
311				if err != nil {
312					return err
313				}
314				cjp.Name = &name
315			}
316		case "degreeOfParallelism":
317			if v != nil {
318				var degreeOfParallelism int32
319				err = json.Unmarshal(*v, &degreeOfParallelism)
320				if err != nil {
321					return err
322				}
323				cjp.DegreeOfParallelism = &degreeOfParallelism
324			}
325		case "priority":
326			if v != nil {
327				var priority int32
328				err = json.Unmarshal(*v, &priority)
329				if err != nil {
330					return err
331				}
332				cjp.Priority = &priority
333			}
334		case "logFilePatterns":
335			if v != nil {
336				var logFilePatterns []string
337				err = json.Unmarshal(*v, &logFilePatterns)
338				if err != nil {
339					return err
340				}
341				cjp.LogFilePatterns = &logFilePatterns
342			}
343		case "related":
344			if v != nil {
345				var related RelationshipProperties
346				err = json.Unmarshal(*v, &related)
347				if err != nil {
348					return err
349				}
350				cjp.Related = &related
351			}
352		case "type":
353			if v != nil {
354				var typeVar TypeEnum
355				err = json.Unmarshal(*v, &typeVar)
356				if err != nil {
357					return err
358				}
359				cjp.Type = typeVar
360			}
361		case "properties":
362			if v != nil {
363				properties, err := unmarshalBasicCreateJobProperties(*v)
364				if err != nil {
365					return err
366				}
367				cjp.Properties = properties
368			}
369		}
370	}
371
372	return nil
373}
374
375// BasicCreateJobProperties the common Data Lake Analytics job properties for job submission.
376type BasicCreateJobProperties interface {
377	AsCreateUSQLJobProperties() (*CreateUSQLJobProperties, bool)
378	AsCreateJobProperties() (*CreateJobProperties, bool)
379}
380
381// CreateJobProperties the common Data Lake Analytics job properties for job submission.
382type CreateJobProperties struct {
383	// RuntimeVersion - the runtime version of the Data Lake Analytics engine to use for the specific type of job being run.
384	RuntimeVersion *string `json:"runtimeVersion,omitempty"`
385	// Script - the script to run. Please note that the maximum script size is 3 MB.
386	Script *string `json:"script,omitempty"`
387	// Type - Possible values include: 'TypeBasicCreateJobPropertiesTypeCreateJobProperties', 'TypeBasicCreateJobPropertiesTypeUSQL'
388	Type TypeBasicCreateJobProperties `json:"type,omitempty"`
389}
390
391func unmarshalBasicCreateJobProperties(body []byte) (BasicCreateJobProperties, error) {
392	var m map[string]interface{}
393	err := json.Unmarshal(body, &m)
394	if err != nil {
395		return nil, err
396	}
397
398	switch m["type"] {
399	case string(TypeBasicCreateJobPropertiesTypeUSQL):
400		var cusjp CreateUSQLJobProperties
401		err := json.Unmarshal(body, &cusjp)
402		return cusjp, err
403	default:
404		var cjp CreateJobProperties
405		err := json.Unmarshal(body, &cjp)
406		return cjp, err
407	}
408}
409func unmarshalBasicCreateJobPropertiesArray(body []byte) ([]BasicCreateJobProperties, error) {
410	var rawMessages []*json.RawMessage
411	err := json.Unmarshal(body, &rawMessages)
412	if err != nil {
413		return nil, err
414	}
415
416	cjpArray := make([]BasicCreateJobProperties, len(rawMessages))
417
418	for index, rawMessage := range rawMessages {
419		cjp, err := unmarshalBasicCreateJobProperties(*rawMessage)
420		if err != nil {
421			return nil, err
422		}
423		cjpArray[index] = cjp
424	}
425	return cjpArray, nil
426}
427
428// MarshalJSON is the custom marshaler for CreateJobProperties.
429func (cjp CreateJobProperties) MarshalJSON() ([]byte, error) {
430	cjp.Type = TypeBasicCreateJobPropertiesTypeCreateJobProperties
431	objectMap := make(map[string]interface{})
432	if cjp.RuntimeVersion != nil {
433		objectMap["runtimeVersion"] = cjp.RuntimeVersion
434	}
435	if cjp.Script != nil {
436		objectMap["script"] = cjp.Script
437	}
438	if cjp.Type != "" {
439		objectMap["type"] = cjp.Type
440	}
441	return json.Marshal(objectMap)
442}
443
444// AsCreateUSQLJobProperties is the BasicCreateJobProperties implementation for CreateJobProperties.
445func (cjp CreateJobProperties) AsCreateUSQLJobProperties() (*CreateUSQLJobProperties, bool) {
446	return nil, false
447}
448
449// AsCreateJobProperties is the BasicCreateJobProperties implementation for CreateJobProperties.
450func (cjp CreateJobProperties) AsCreateJobProperties() (*CreateJobProperties, bool) {
451	return &cjp, true
452}
453
454// AsBasicCreateJobProperties is the BasicCreateJobProperties implementation for CreateJobProperties.
455func (cjp CreateJobProperties) AsBasicCreateJobProperties() (BasicCreateJobProperties, bool) {
456	return &cjp, true
457}
458
459// CreateUSQLJobProperties u-SQL job properties used when submitting U-SQL jobs.
460type CreateUSQLJobProperties struct {
461	// 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'
462	CompileMode CompileMode `json:"compileMode,omitempty"`
463	// RuntimeVersion - the runtime version of the Data Lake Analytics engine to use for the specific type of job being run.
464	RuntimeVersion *string `json:"runtimeVersion,omitempty"`
465	// Script - the script to run. Please note that the maximum script size is 3 MB.
466	Script *string `json:"script,omitempty"`
467	// Type - Possible values include: 'TypeBasicCreateJobPropertiesTypeCreateJobProperties', 'TypeBasicCreateJobPropertiesTypeUSQL'
468	Type TypeBasicCreateJobProperties `json:"type,omitempty"`
469}
470
471// MarshalJSON is the custom marshaler for CreateUSQLJobProperties.
472func (cusjp CreateUSQLJobProperties) MarshalJSON() ([]byte, error) {
473	cusjp.Type = TypeBasicCreateJobPropertiesTypeUSQL
474	objectMap := make(map[string]interface{})
475	if cusjp.CompileMode != "" {
476		objectMap["compileMode"] = cusjp.CompileMode
477	}
478	if cusjp.RuntimeVersion != nil {
479		objectMap["runtimeVersion"] = cusjp.RuntimeVersion
480	}
481	if cusjp.Script != nil {
482		objectMap["script"] = cusjp.Script
483	}
484	if cusjp.Type != "" {
485		objectMap["type"] = cusjp.Type
486	}
487	return json.Marshal(objectMap)
488}
489
490// AsCreateUSQLJobProperties is the BasicCreateJobProperties implementation for CreateUSQLJobProperties.
491func (cusjp CreateUSQLJobProperties) AsCreateUSQLJobProperties() (*CreateUSQLJobProperties, bool) {
492	return &cusjp, true
493}
494
495// AsCreateJobProperties is the BasicCreateJobProperties implementation for CreateUSQLJobProperties.
496func (cusjp CreateUSQLJobProperties) AsCreateJobProperties() (*CreateJobProperties, bool) {
497	return nil, false
498}
499
500// AsBasicCreateJobProperties is the BasicCreateJobProperties implementation for CreateUSQLJobProperties.
501func (cusjp CreateUSQLJobProperties) AsBasicCreateJobProperties() (BasicCreateJobProperties, bool) {
502	return &cusjp, true
503}
504
505// DataPath a Data Lake Analytics job data path item.
506type DataPath struct {
507	autorest.Response `json:"-"`
508	// JobID - the id of the job this data is for.
509	JobID *uuid.UUID `json:"jobId,omitempty"`
510	// Command - the command that this job data relates to.
511	Command *string `json:"command,omitempty"`
512	// Paths - the list of paths to all of the job data.
513	Paths *[]string `json:"paths,omitempty"`
514}
515
516// Diagnostics error diagnostic information for failed jobs.
517type Diagnostics struct {
518	// ColumnNumber - the column where the error occured.
519	ColumnNumber *int32 `json:"columnNumber,omitempty"`
520	// End - the ending index of the error.
521	End *int32 `json:"end,omitempty"`
522	// LineNumber - the line number the error occured on.
523	LineNumber *int32 `json:"lineNumber,omitempty"`
524	// Message - the error message.
525	Message *string `json:"message,omitempty"`
526	// Severity - the severity of the error. Possible values include: 'Warning', 'Error', 'Info', 'SevereWarning', 'Deprecated', 'UserWarning'
527	Severity SeverityTypes `json:"severity,omitempty"`
528	// Start - the starting index of the error.
529	Start *int32 `json:"start,omitempty"`
530}
531
532// ErrorDetails the Data Lake Analytics job error details.
533type ErrorDetails struct {
534	// Description - the error message description
535	Description *string `json:"description,omitempty"`
536	// Details - the details of the error message.
537	Details *string `json:"details,omitempty"`
538	// EndOffset - the end offset in the job where the error was found.
539	EndOffset *int32 `json:"endOffset,omitempty"`
540	// ErrorID - the specific identifier for the type of error encountered in the job.
541	ErrorID *string `json:"errorId,omitempty"`
542	// FilePath - the path to any supplemental error files, if any.
543	FilePath *string `json:"filePath,omitempty"`
544	// HelpLink - the link to MSDN or Azure help for this type of error, if any.
545	HelpLink *string `json:"helpLink,omitempty"`
546	// InternalDiagnostics - 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.
547	InternalDiagnostics *string `json:"internalDiagnostics,omitempty"`
548	// LineNumber - the specific line number in the job where the error occured.
549	LineNumber *int32 `json:"lineNumber,omitempty"`
550	// Message - the user friendly error message for the failure.
551	Message *string `json:"message,omitempty"`
552	// Resolution - the recommended resolution for the failure, if any.
553	Resolution *string `json:"resolution,omitempty"`
554	// InnerError - the inner error of this specific job error message, if any.
555	InnerError *InnerError `json:"innerError,omitempty"`
556	// Severity - the severity level of the failure. Possible values include: 'Warning', 'Error', 'Info', 'SevereWarning', 'Deprecated', 'UserWarning'
557	Severity SeverityTypes `json:"severity,omitempty"`
558	// Source - the ultimate source of the failure (usually either SYSTEM or USER).
559	Source *string `json:"source,omitempty"`
560	// StartOffset - the start offset in the job where the error was found
561	StartOffset *int32 `json:"startOffset,omitempty"`
562}
563
564// HiveJobProperties hive job properties used when retrieving Hive jobs.
565type HiveJobProperties struct {
566	// LogsLocation - the Hive logs location
567	LogsLocation *string `json:"logsLocation,omitempty"`
568	// OutputLocation - the location of Hive job output files (both execution output and results)
569	OutputLocation *string `json:"outputLocation,omitempty"`
570	// StatementCount - the number of statements that will be run based on the script
571	StatementCount *int32 `json:"statementCount,omitempty"`
572	// ExecutedStatementCount - the number of statements that have been run based on the script
573	ExecutedStatementCount *int32 `json:"executedStatementCount,omitempty"`
574	// RuntimeVersion - the runtime version of the Data Lake Analytics engine to use for the specific type of job being run.
575	RuntimeVersion *string `json:"runtimeVersion,omitempty"`
576	// Script - the script to run. Please note that the maximum script size is 3 MB.
577	Script *string `json:"script,omitempty"`
578	// Type - Possible values include: 'TypeJobProperties', 'TypeUSQL', 'TypeHive'
579	Type Type `json:"type,omitempty"`
580}
581
582// MarshalJSON is the custom marshaler for HiveJobProperties.
583func (hjp HiveJobProperties) MarshalJSON() ([]byte, error) {
584	hjp.Type = TypeHive
585	objectMap := make(map[string]interface{})
586	if hjp.LogsLocation != nil {
587		objectMap["logsLocation"] = hjp.LogsLocation
588	}
589	if hjp.OutputLocation != nil {
590		objectMap["outputLocation"] = hjp.OutputLocation
591	}
592	if hjp.StatementCount != nil {
593		objectMap["statementCount"] = hjp.StatementCount
594	}
595	if hjp.ExecutedStatementCount != nil {
596		objectMap["executedStatementCount"] = hjp.ExecutedStatementCount
597	}
598	if hjp.RuntimeVersion != nil {
599		objectMap["runtimeVersion"] = hjp.RuntimeVersion
600	}
601	if hjp.Script != nil {
602		objectMap["script"] = hjp.Script
603	}
604	if hjp.Type != "" {
605		objectMap["type"] = hjp.Type
606	}
607	return json.Marshal(objectMap)
608}
609
610// AsUSQLJobProperties is the BasicProperties implementation for HiveJobProperties.
611func (hjp HiveJobProperties) AsUSQLJobProperties() (*USQLJobProperties, bool) {
612	return nil, false
613}
614
615// AsHiveJobProperties is the BasicProperties implementation for HiveJobProperties.
616func (hjp HiveJobProperties) AsHiveJobProperties() (*HiveJobProperties, bool) {
617	return &hjp, true
618}
619
620// AsProperties is the BasicProperties implementation for HiveJobProperties.
621func (hjp HiveJobProperties) AsProperties() (*Properties, bool) {
622	return nil, false
623}
624
625// AsBasicProperties is the BasicProperties implementation for HiveJobProperties.
626func (hjp HiveJobProperties) AsBasicProperties() (BasicProperties, bool) {
627	return &hjp, true
628}
629
630// InfoListResult list of JobInfo items.
631type InfoListResult struct {
632	autorest.Response `json:"-"`
633	// Value - the list of JobInfo items.
634	Value *[]InformationBasic `json:"value,omitempty"`
635	// NextLink - the link (url) to the next page of results.
636	NextLink *string `json:"nextLink,omitempty"`
637}
638
639// InfoListResultIterator provides access to a complete listing of InformationBasic values.
640type InfoListResultIterator struct {
641	i    int
642	page InfoListResultPage
643}
644
645// Next advances to the next value.  If there was an error making
646// the request the iterator does not advance and the error is returned.
647func (iter *InfoListResultIterator) Next() error {
648	iter.i++
649	if iter.i < len(iter.page.Values()) {
650		return nil
651	}
652	err := iter.page.Next()
653	if err != nil {
654		iter.i--
655		return err
656	}
657	iter.i = 0
658	return nil
659}
660
661// NotDone returns true if the enumeration should be started or is not yet complete.
662func (iter InfoListResultIterator) NotDone() bool {
663	return iter.page.NotDone() && iter.i < len(iter.page.Values())
664}
665
666// Response returns the raw server response from the last page request.
667func (iter InfoListResultIterator) Response() InfoListResult {
668	return iter.page.Response()
669}
670
671// Value returns the current value or a zero-initialized value if the
672// iterator has advanced beyond the end of the collection.
673func (iter InfoListResultIterator) Value() InformationBasic {
674	if !iter.page.NotDone() {
675		return InformationBasic{}
676	}
677	return iter.page.Values()[iter.i]
678}
679
680// IsEmpty returns true if the ListResult contains no values.
681func (ilr InfoListResult) IsEmpty() bool {
682	return ilr.Value == nil || len(*ilr.Value) == 0
683}
684
685// infoListResultPreparer prepares a request to retrieve the next set of results.
686// It returns nil if no more results exist.
687func (ilr InfoListResult) infoListResultPreparer() (*http.Request, error) {
688	if ilr.NextLink == nil || len(to.String(ilr.NextLink)) < 1 {
689		return nil, nil
690	}
691	return autorest.Prepare(&http.Request{},
692		autorest.AsJSON(),
693		autorest.AsGet(),
694		autorest.WithBaseURL(to.String(ilr.NextLink)))
695}
696
697// InfoListResultPage contains a page of InformationBasic values.
698type InfoListResultPage struct {
699	fn  func(InfoListResult) (InfoListResult, error)
700	ilr InfoListResult
701}
702
703// Next advances to the next page of values.  If there was an error making
704// the request the page does not advance and the error is returned.
705func (page *InfoListResultPage) Next() error {
706	next, err := page.fn(page.ilr)
707	if err != nil {
708		return err
709	}
710	page.ilr = next
711	return nil
712}
713
714// NotDone returns true if the page enumeration should be started or is not yet complete.
715func (page InfoListResultPage) NotDone() bool {
716	return !page.ilr.IsEmpty()
717}
718
719// Response returns the raw server response from the last page request.
720func (page InfoListResultPage) Response() InfoListResult {
721	return page.ilr
722}
723
724// Values returns the slice of values for the current page or nil if there are no values.
725func (page InfoListResultPage) Values() []InformationBasic {
726	if page.ilr.IsEmpty() {
727		return nil
728	}
729	return *page.ilr.Value
730}
731
732// Information the extended Data Lake Analytics job information properties returned when retrieving a specific job.
733type Information struct {
734	autorest.Response `json:"-"`
735	// ErrorMessage - the error message details for the job, if the job failed.
736	ErrorMessage *[]ErrorDetails `json:"errorMessage,omitempty"`
737	// StateAuditRecords - the job state audit records, indicating when various operations have been performed on this job.
738	StateAuditRecords *[]StateAuditRecord `json:"stateAuditRecords,omitempty"`
739	// Properties - the job specific properties.
740	Properties BasicProperties `json:"properties,omitempty"`
741	// JobID - the job's unique identifier (a GUID).
742	JobID *uuid.UUID `json:"jobId,omitempty"`
743	// Name - the friendly name of the job.
744	Name *string `json:"name,omitempty"`
745	// Type - the job type of the current job (Hive or USql). Possible values include: 'USQL', 'Hive'
746	Type TypeEnum `json:"type,omitempty"`
747	// Submitter - the user or account that submitted the job.
748	Submitter *string `json:"submitter,omitempty"`
749	// DegreeOfParallelism - the degree of parallelism used for this job. This must be greater than 0, if set to less than 0 it will default to 1.
750	DegreeOfParallelism *int32 `json:"degreeOfParallelism,omitempty"`
751	// Priority - the priority value 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.
752	Priority *int32 `json:"priority,omitempty"`
753	// SubmitTime - the time the job was submitted to the service.
754	SubmitTime *date.Time `json:"submitTime,omitempty"`
755	// StartTime - the start time of the job.
756	StartTime *date.Time `json:"startTime,omitempty"`
757	// EndTime - the completion time of the job.
758	EndTime *date.Time `json:"endTime,omitempty"`
759	// State - the job state. When the job is in the Ended state, refer to Result and ErrorMessage for details. Possible values include: 'StateAccepted', 'StateCompiling', 'StateEnded', 'StateNew', 'StateQueued', 'StateRunning', 'StateScheduling', 'StateStarting', 'StatePaused', 'StateWaitingForCapacity'
760	State State `json:"state,omitempty"`
761	// Result - the result of job execution or the current result of the running job. Possible values include: 'None', 'Succeeded', 'Cancelled', 'Failed'
762	Result Result `json:"result,omitempty"`
763	// LogFolder - the log folder path to use in the following format: adl://<accountName>.azuredatalakestore.net/system/jobservice/jobs/Usql/2016/03/13/17/18/5fe51957-93bc-4de0-8ddc-c5a4753b068b/logs/.
764	LogFolder *string `json:"logFolder,omitempty"`
765	// 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
766	LogFilePatterns *[]string `json:"logFilePatterns,omitempty"`
767	// Related - the recurring job relationship information properties.
768	Related *RelationshipProperties `json:"related,omitempty"`
769}
770
771// UnmarshalJSON is the custom unmarshaler for Information struct.
772func (i *Information) UnmarshalJSON(body []byte) error {
773	var m map[string]*json.RawMessage
774	err := json.Unmarshal(body, &m)
775	if err != nil {
776		return err
777	}
778	for k, v := range m {
779		switch k {
780		case "errorMessage":
781			if v != nil {
782				var errorMessage []ErrorDetails
783				err = json.Unmarshal(*v, &errorMessage)
784				if err != nil {
785					return err
786				}
787				i.ErrorMessage = &errorMessage
788			}
789		case "stateAuditRecords":
790			if v != nil {
791				var stateAuditRecords []StateAuditRecord
792				err = json.Unmarshal(*v, &stateAuditRecords)
793				if err != nil {
794					return err
795				}
796				i.StateAuditRecords = &stateAuditRecords
797			}
798		case "properties":
799			if v != nil {
800				properties, err := unmarshalBasicProperties(*v)
801				if err != nil {
802					return err
803				}
804				i.Properties = properties
805			}
806		case "jobId":
807			if v != nil {
808				var jobID uuid.UUID
809				err = json.Unmarshal(*v, &jobID)
810				if err != nil {
811					return err
812				}
813				i.JobID = &jobID
814			}
815		case "name":
816			if v != nil {
817				var name string
818				err = json.Unmarshal(*v, &name)
819				if err != nil {
820					return err
821				}
822				i.Name = &name
823			}
824		case "type":
825			if v != nil {
826				var typeVar TypeEnum
827				err = json.Unmarshal(*v, &typeVar)
828				if err != nil {
829					return err
830				}
831				i.Type = typeVar
832			}
833		case "submitter":
834			if v != nil {
835				var submitter string
836				err = json.Unmarshal(*v, &submitter)
837				if err != nil {
838					return err
839				}
840				i.Submitter = &submitter
841			}
842		case "degreeOfParallelism":
843			if v != nil {
844				var degreeOfParallelism int32
845				err = json.Unmarshal(*v, &degreeOfParallelism)
846				if err != nil {
847					return err
848				}
849				i.DegreeOfParallelism = &degreeOfParallelism
850			}
851		case "priority":
852			if v != nil {
853				var priority int32
854				err = json.Unmarshal(*v, &priority)
855				if err != nil {
856					return err
857				}
858				i.Priority = &priority
859			}
860		case "submitTime":
861			if v != nil {
862				var submitTime date.Time
863				err = json.Unmarshal(*v, &submitTime)
864				if err != nil {
865					return err
866				}
867				i.SubmitTime = &submitTime
868			}
869		case "startTime":
870			if v != nil {
871				var startTime date.Time
872				err = json.Unmarshal(*v, &startTime)
873				if err != nil {
874					return err
875				}
876				i.StartTime = &startTime
877			}
878		case "endTime":
879			if v != nil {
880				var endTime date.Time
881				err = json.Unmarshal(*v, &endTime)
882				if err != nil {
883					return err
884				}
885				i.EndTime = &endTime
886			}
887		case "state":
888			if v != nil {
889				var state State
890				err = json.Unmarshal(*v, &state)
891				if err != nil {
892					return err
893				}
894				i.State = state
895			}
896		case "result":
897			if v != nil {
898				var resultVar Result
899				err = json.Unmarshal(*v, &resultVar)
900				if err != nil {
901					return err
902				}
903				i.Result = resultVar
904			}
905		case "logFolder":
906			if v != nil {
907				var logFolder string
908				err = json.Unmarshal(*v, &logFolder)
909				if err != nil {
910					return err
911				}
912				i.LogFolder = &logFolder
913			}
914		case "logFilePatterns":
915			if v != nil {
916				var logFilePatterns []string
917				err = json.Unmarshal(*v, &logFilePatterns)
918				if err != nil {
919					return err
920				}
921				i.LogFilePatterns = &logFilePatterns
922			}
923		case "related":
924			if v != nil {
925				var related RelationshipProperties
926				err = json.Unmarshal(*v, &related)
927				if err != nil {
928					return err
929				}
930				i.Related = &related
931			}
932		}
933	}
934
935	return nil
936}
937
938// InformationBasic the common Data Lake Analytics job information properties.
939type InformationBasic struct {
940	// JobID - the job's unique identifier (a GUID).
941	JobID *uuid.UUID `json:"jobId,omitempty"`
942	// Name - the friendly name of the job.
943	Name *string `json:"name,omitempty"`
944	// Type - the job type of the current job (Hive or USql). Possible values include: 'USQL', 'Hive'
945	Type TypeEnum `json:"type,omitempty"`
946	// Submitter - the user or account that submitted the job.
947	Submitter *string `json:"submitter,omitempty"`
948	// DegreeOfParallelism - the degree of parallelism used for this job. This must be greater than 0, if set to less than 0 it will default to 1.
949	DegreeOfParallelism *int32 `json:"degreeOfParallelism,omitempty"`
950	// Priority - the priority value 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.
951	Priority *int32 `json:"priority,omitempty"`
952	// SubmitTime - the time the job was submitted to the service.
953	SubmitTime *date.Time `json:"submitTime,omitempty"`
954	// StartTime - the start time of the job.
955	StartTime *date.Time `json:"startTime,omitempty"`
956	// EndTime - the completion time of the job.
957	EndTime *date.Time `json:"endTime,omitempty"`
958	// State - the job state. When the job is in the Ended state, refer to Result and ErrorMessage for details. Possible values include: 'StateAccepted', 'StateCompiling', 'StateEnded', 'StateNew', 'StateQueued', 'StateRunning', 'StateScheduling', 'StateStarting', 'StatePaused', 'StateWaitingForCapacity'
959	State State `json:"state,omitempty"`
960	// Result - the result of job execution or the current result of the running job. Possible values include: 'None', 'Succeeded', 'Cancelled', 'Failed'
961	Result Result `json:"result,omitempty"`
962	// LogFolder - the log folder path to use in the following format: adl://<accountName>.azuredatalakestore.net/system/jobservice/jobs/Usql/2016/03/13/17/18/5fe51957-93bc-4de0-8ddc-c5a4753b068b/logs/.
963	LogFolder *string `json:"logFolder,omitempty"`
964	// 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
965	LogFilePatterns *[]string `json:"logFilePatterns,omitempty"`
966	// Related - the recurring job relationship information properties.
967	Related *RelationshipProperties `json:"related,omitempty"`
968}
969
970// InnerError the Data Lake Analytics job error details.
971type InnerError struct {
972	// DiagnosticCode - the diagnostic error code.
973	DiagnosticCode *int32 `json:"diagnosticCode,omitempty"`
974	// Severity - the severity level of the failure. Possible values include: 'Warning', 'Error', 'Info', 'SevereWarning', 'Deprecated', 'UserWarning'
975	Severity SeverityTypes `json:"severity,omitempty"`
976	// Details - the details of the error message.
977	Details *string `json:"details,omitempty"`
978	// Component - the component that failed.
979	Component *string `json:"component,omitempty"`
980	// ErrorID - the specific identifier for the type of error encountered in the job.
981	ErrorID *string `json:"errorId,omitempty"`
982	// HelpLink - the link to MSDN or Azure help for this type of error, if any.
983	HelpLink *string `json:"helpLink,omitempty"`
984	// InternalDiagnostics - 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.
985	InternalDiagnostics *string `json:"internalDiagnostics,omitempty"`
986	// Message - the user friendly error message for the failure.
987	Message *string `json:"message,omitempty"`
988	// Resolution - the recommended resolution for the failure, if any.
989	Resolution *string `json:"resolution,omitempty"`
990	// Source - the ultimate source of the failure (usually either SYSTEM or USER).
991	Source *string `json:"source,omitempty"`
992	// Description - the error message description
993	Description *string `json:"description,omitempty"`
994	// InnerError - the inner error of this specific job error message, if any.
995	InnerError *InnerError `json:"innerError,omitempty"`
996}
997
998// PipelineInformation job Pipeline Information, showing the relationship of jobs and recurrences of those jobs in
999// a pipeline.
1000type PipelineInformation struct {
1001	autorest.Response `json:"-"`
1002	// PipelineID - the job relationship pipeline identifier (a GUID).
1003	PipelineID *uuid.UUID `json:"pipelineId,omitempty"`
1004	// PipelineName - the friendly name of the job relationship pipeline, which does not need to be unique.
1005	PipelineName *string `json:"pipelineName,omitempty"`
1006	// PipelineURI - the pipeline uri, unique, links to the originating service for this pipeline.
1007	PipelineURI *string `json:"pipelineUri,omitempty"`
1008	// NumJobsFailed - the number of jobs in this pipeline that have failed.
1009	NumJobsFailed *int32 `json:"numJobsFailed,omitempty"`
1010	// NumJobsCanceled - the number of jobs in this pipeline that have been canceled.
1011	NumJobsCanceled *int32 `json:"numJobsCanceled,omitempty"`
1012	// NumJobsSucceeded - the number of jobs in this pipeline that have succeeded.
1013	NumJobsSucceeded *int32 `json:"numJobsSucceeded,omitempty"`
1014	// AuHoursFailed - the number of job execution hours that resulted in failed jobs.
1015	AuHoursFailed *float64 `json:"auHoursFailed,omitempty"`
1016	// AuHoursCanceled - the number of job execution hours that resulted in canceled jobs.
1017	AuHoursCanceled *float64 `json:"auHoursCanceled,omitempty"`
1018	// AuHoursSucceeded - the number of job execution hours that resulted in successful jobs.
1019	AuHoursSucceeded *float64 `json:"auHoursSucceeded,omitempty"`
1020	// LastSubmitTime - the last time a job in this pipeline was submitted.
1021	LastSubmitTime *date.Time `json:"lastSubmitTime,omitempty"`
1022	// Runs - the list of run identifiers representing each run of this pipeline.
1023	Runs *[]PipelineRunInformation `json:"runs,omitempty"`
1024	// Recurrences - the list of recurrence identifiers representing each recurrence in this pipeline.
1025	Recurrences *[]uuid.UUID `json:"recurrences,omitempty"`
1026}
1027
1028// PipelineInformationListResult list of job pipeline information items.
1029type PipelineInformationListResult struct {
1030	autorest.Response `json:"-"`
1031	// Value - the list of job pipeline information items.
1032	Value *[]PipelineInformation `json:"value,omitempty"`
1033	// NextLink - the link (url) to the next page of results.
1034	NextLink *string `json:"nextLink,omitempty"`
1035}
1036
1037// PipelineInformationListResultIterator provides access to a complete listing of PipelineInformation values.
1038type PipelineInformationListResultIterator struct {
1039	i    int
1040	page PipelineInformationListResultPage
1041}
1042
1043// Next advances to the next value.  If there was an error making
1044// the request the iterator does not advance and the error is returned.
1045func (iter *PipelineInformationListResultIterator) Next() error {
1046	iter.i++
1047	if iter.i < len(iter.page.Values()) {
1048		return nil
1049	}
1050	err := iter.page.Next()
1051	if err != nil {
1052		iter.i--
1053		return err
1054	}
1055	iter.i = 0
1056	return nil
1057}
1058
1059// NotDone returns true if the enumeration should be started or is not yet complete.
1060func (iter PipelineInformationListResultIterator) NotDone() bool {
1061	return iter.page.NotDone() && iter.i < len(iter.page.Values())
1062}
1063
1064// Response returns the raw server response from the last page request.
1065func (iter PipelineInformationListResultIterator) Response() PipelineInformationListResult {
1066	return iter.page.Response()
1067}
1068
1069// Value returns the current value or a zero-initialized value if the
1070// iterator has advanced beyond the end of the collection.
1071func (iter PipelineInformationListResultIterator) Value() PipelineInformation {
1072	if !iter.page.NotDone() {
1073		return PipelineInformation{}
1074	}
1075	return iter.page.Values()[iter.i]
1076}
1077
1078// IsEmpty returns true if the ListResult contains no values.
1079func (pilr PipelineInformationListResult) IsEmpty() bool {
1080	return pilr.Value == nil || len(*pilr.Value) == 0
1081}
1082
1083// pipelineInformationListResultPreparer prepares a request to retrieve the next set of results.
1084// It returns nil if no more results exist.
1085func (pilr PipelineInformationListResult) pipelineInformationListResultPreparer() (*http.Request, error) {
1086	if pilr.NextLink == nil || len(to.String(pilr.NextLink)) < 1 {
1087		return nil, nil
1088	}
1089	return autorest.Prepare(&http.Request{},
1090		autorest.AsJSON(),
1091		autorest.AsGet(),
1092		autorest.WithBaseURL(to.String(pilr.NextLink)))
1093}
1094
1095// PipelineInformationListResultPage contains a page of PipelineInformation values.
1096type PipelineInformationListResultPage struct {
1097	fn   func(PipelineInformationListResult) (PipelineInformationListResult, error)
1098	pilr PipelineInformationListResult
1099}
1100
1101// Next advances to the next page of values.  If there was an error making
1102// the request the page does not advance and the error is returned.
1103func (page *PipelineInformationListResultPage) Next() error {
1104	next, err := page.fn(page.pilr)
1105	if err != nil {
1106		return err
1107	}
1108	page.pilr = next
1109	return nil
1110}
1111
1112// NotDone returns true if the page enumeration should be started or is not yet complete.
1113func (page PipelineInformationListResultPage) NotDone() bool {
1114	return !page.pilr.IsEmpty()
1115}
1116
1117// Response returns the raw server response from the last page request.
1118func (page PipelineInformationListResultPage) Response() PipelineInformationListResult {
1119	return page.pilr
1120}
1121
1122// Values returns the slice of values for the current page or nil if there are no values.
1123func (page PipelineInformationListResultPage) Values() []PipelineInformation {
1124	if page.pilr.IsEmpty() {
1125		return nil
1126	}
1127	return *page.pilr.Value
1128}
1129
1130// PipelineRunInformation run info for a specific job pipeline.
1131type PipelineRunInformation struct {
1132	// RunID - the run identifier of an instance of pipeline executions (a GUID).
1133	RunID *uuid.UUID `json:"runId,omitempty"`
1134	// LastSubmitTime - the time this instance was last submitted.
1135	LastSubmitTime *date.Time `json:"lastSubmitTime,omitempty"`
1136}
1137
1138// BasicProperties the common Data Lake Analytics job properties.
1139type BasicProperties interface {
1140	AsUSQLJobProperties() (*USQLJobProperties, bool)
1141	AsHiveJobProperties() (*HiveJobProperties, bool)
1142	AsProperties() (*Properties, bool)
1143}
1144
1145// Properties the common Data Lake Analytics job properties.
1146type Properties struct {
1147	// RuntimeVersion - the runtime version of the Data Lake Analytics engine to use for the specific type of job being run.
1148	RuntimeVersion *string `json:"runtimeVersion,omitempty"`
1149	// Script - the script to run. Please note that the maximum script size is 3 MB.
1150	Script *string `json:"script,omitempty"`
1151	// Type - Possible values include: 'TypeJobProperties', 'TypeUSQL', 'TypeHive'
1152	Type Type `json:"type,omitempty"`
1153}
1154
1155func unmarshalBasicProperties(body []byte) (BasicProperties, error) {
1156	var m map[string]interface{}
1157	err := json.Unmarshal(body, &m)
1158	if err != nil {
1159		return nil, err
1160	}
1161
1162	switch m["type"] {
1163	case string(TypeUSQL):
1164		var usjp USQLJobProperties
1165		err := json.Unmarshal(body, &usjp)
1166		return usjp, err
1167	case string(TypeHive):
1168		var hjp HiveJobProperties
1169		err := json.Unmarshal(body, &hjp)
1170		return hjp, err
1171	default:
1172		var p Properties
1173		err := json.Unmarshal(body, &p)
1174		return p, err
1175	}
1176}
1177func unmarshalBasicPropertiesArray(body []byte) ([]BasicProperties, error) {
1178	var rawMessages []*json.RawMessage
1179	err := json.Unmarshal(body, &rawMessages)
1180	if err != nil {
1181		return nil, err
1182	}
1183
1184	pArray := make([]BasicProperties, len(rawMessages))
1185
1186	for index, rawMessage := range rawMessages {
1187		p, err := unmarshalBasicProperties(*rawMessage)
1188		if err != nil {
1189			return nil, err
1190		}
1191		pArray[index] = p
1192	}
1193	return pArray, nil
1194}
1195
1196// MarshalJSON is the custom marshaler for Properties.
1197func (p Properties) MarshalJSON() ([]byte, error) {
1198	p.Type = TypeJobProperties
1199	objectMap := make(map[string]interface{})
1200	if p.RuntimeVersion != nil {
1201		objectMap["runtimeVersion"] = p.RuntimeVersion
1202	}
1203	if p.Script != nil {
1204		objectMap["script"] = p.Script
1205	}
1206	if p.Type != "" {
1207		objectMap["type"] = p.Type
1208	}
1209	return json.Marshal(objectMap)
1210}
1211
1212// AsUSQLJobProperties is the BasicProperties implementation for Properties.
1213func (p Properties) AsUSQLJobProperties() (*USQLJobProperties, bool) {
1214	return nil, false
1215}
1216
1217// AsHiveJobProperties is the BasicProperties implementation for Properties.
1218func (p Properties) AsHiveJobProperties() (*HiveJobProperties, bool) {
1219	return nil, false
1220}
1221
1222// AsProperties is the BasicProperties implementation for Properties.
1223func (p Properties) AsProperties() (*Properties, bool) {
1224	return &p, true
1225}
1226
1227// AsBasicProperties is the BasicProperties implementation for Properties.
1228func (p Properties) AsBasicProperties() (BasicProperties, bool) {
1229	return &p, true
1230}
1231
1232// RecurrenceInformation recurrence job information for a specific recurrence.
1233type RecurrenceInformation struct {
1234	autorest.Response `json:"-"`
1235	// RecurrenceID - the recurrence identifier (a GUID), unique per activity/script, regardless of iterations. This is something to link different occurrences of the same job together.
1236	RecurrenceID *uuid.UUID `json:"recurrenceId,omitempty"`
1237	// RecurrenceName - the recurrence name, user friendly name for the correlation between jobs.
1238	RecurrenceName *string `json:"recurrenceName,omitempty"`
1239	// NumJobsFailed - the number of jobs in this recurrence that have failed.
1240	NumJobsFailed *int32 `json:"numJobsFailed,omitempty"`
1241	// NumJobsCanceled - the number of jobs in this recurrence that have been canceled.
1242	NumJobsCanceled *int32 `json:"numJobsCanceled,omitempty"`
1243	// NumJobsSucceeded - the number of jobs in this recurrence that have succeeded.
1244	NumJobsSucceeded *int32 `json:"numJobsSucceeded,omitempty"`
1245	// AuHoursFailed - the number of job execution hours that resulted in failed jobs.
1246	AuHoursFailed *float64 `json:"auHoursFailed,omitempty"`
1247	// AuHoursCanceled - the number of job execution hours that resulted in canceled jobs.
1248	AuHoursCanceled *float64 `json:"auHoursCanceled,omitempty"`
1249	// AuHoursSucceeded - the number of job execution hours that resulted in successful jobs.
1250	AuHoursSucceeded *float64 `json:"auHoursSucceeded,omitempty"`
1251	// LastSubmitTime - the last time a job in this recurrence was submitted.
1252	LastSubmitTime *date.Time `json:"lastSubmitTime,omitempty"`
1253}
1254
1255// RecurrenceInformationListResult list of job recurrence information items.
1256type RecurrenceInformationListResult struct {
1257	autorest.Response `json:"-"`
1258	// Value - the list of job recurrence information items.
1259	Value *[]RecurrenceInformation `json:"value,omitempty"`
1260	// NextLink - the link (url) to the next page of results.
1261	NextLink *string `json:"nextLink,omitempty"`
1262}
1263
1264// RecurrenceInformationListResultIterator provides access to a complete listing of RecurrenceInformation values.
1265type RecurrenceInformationListResultIterator struct {
1266	i    int
1267	page RecurrenceInformationListResultPage
1268}
1269
1270// Next advances to the next value.  If there was an error making
1271// the request the iterator does not advance and the error is returned.
1272func (iter *RecurrenceInformationListResultIterator) Next() error {
1273	iter.i++
1274	if iter.i < len(iter.page.Values()) {
1275		return nil
1276	}
1277	err := iter.page.Next()
1278	if err != nil {
1279		iter.i--
1280		return err
1281	}
1282	iter.i = 0
1283	return nil
1284}
1285
1286// NotDone returns true if the enumeration should be started or is not yet complete.
1287func (iter RecurrenceInformationListResultIterator) NotDone() bool {
1288	return iter.page.NotDone() && iter.i < len(iter.page.Values())
1289}
1290
1291// Response returns the raw server response from the last page request.
1292func (iter RecurrenceInformationListResultIterator) Response() RecurrenceInformationListResult {
1293	return iter.page.Response()
1294}
1295
1296// Value returns the current value or a zero-initialized value if the
1297// iterator has advanced beyond the end of the collection.
1298func (iter RecurrenceInformationListResultIterator) Value() RecurrenceInformation {
1299	if !iter.page.NotDone() {
1300		return RecurrenceInformation{}
1301	}
1302	return iter.page.Values()[iter.i]
1303}
1304
1305// IsEmpty returns true if the ListResult contains no values.
1306func (rilr RecurrenceInformationListResult) IsEmpty() bool {
1307	return rilr.Value == nil || len(*rilr.Value) == 0
1308}
1309
1310// recurrenceInformationListResultPreparer prepares a request to retrieve the next set of results.
1311// It returns nil if no more results exist.
1312func (rilr RecurrenceInformationListResult) recurrenceInformationListResultPreparer() (*http.Request, error) {
1313	if rilr.NextLink == nil || len(to.String(rilr.NextLink)) < 1 {
1314		return nil, nil
1315	}
1316	return autorest.Prepare(&http.Request{},
1317		autorest.AsJSON(),
1318		autorest.AsGet(),
1319		autorest.WithBaseURL(to.String(rilr.NextLink)))
1320}
1321
1322// RecurrenceInformationListResultPage contains a page of RecurrenceInformation values.
1323type RecurrenceInformationListResultPage struct {
1324	fn   func(RecurrenceInformationListResult) (RecurrenceInformationListResult, error)
1325	rilr RecurrenceInformationListResult
1326}
1327
1328// Next advances to the next page of values.  If there was an error making
1329// the request the page does not advance and the error is returned.
1330func (page *RecurrenceInformationListResultPage) Next() error {
1331	next, err := page.fn(page.rilr)
1332	if err != nil {
1333		return err
1334	}
1335	page.rilr = next
1336	return nil
1337}
1338
1339// NotDone returns true if the page enumeration should be started or is not yet complete.
1340func (page RecurrenceInformationListResultPage) NotDone() bool {
1341	return !page.rilr.IsEmpty()
1342}
1343
1344// Response returns the raw server response from the last page request.
1345func (page RecurrenceInformationListResultPage) Response() RecurrenceInformationListResult {
1346	return page.rilr
1347}
1348
1349// Values returns the slice of values for the current page or nil if there are no values.
1350func (page RecurrenceInformationListResultPage) Values() []RecurrenceInformation {
1351	if page.rilr.IsEmpty() {
1352		return nil
1353	}
1354	return *page.rilr.Value
1355}
1356
1357// RelationshipProperties job relationship information properties including pipeline information, correlation
1358// information, etc.
1359type RelationshipProperties struct {
1360	// PipelineID - the job relationship pipeline identifier (a GUID).
1361	PipelineID *uuid.UUID `json:"pipelineId,omitempty"`
1362	// PipelineName - the friendly name of the job relationship pipeline, which does not need to be unique.
1363	PipelineName *string `json:"pipelineName,omitempty"`
1364	// PipelineURI - the pipeline uri, unique, links to the originating service for this pipeline.
1365	PipelineURI *string `json:"pipelineUri,omitempty"`
1366	// RunID - the run identifier (a GUID), unique identifier of the iteration of this pipeline.
1367	RunID *uuid.UUID `json:"runId,omitempty"`
1368	// RecurrenceID - the recurrence identifier (a GUID), unique per activity/script, regardless of iterations. This is something to link different occurrences of the same job together.
1369	RecurrenceID *uuid.UUID `json:"recurrenceId,omitempty"`
1370	// RecurrenceName - the recurrence name, user friendly name for the correlation between jobs.
1371	RecurrenceName *string `json:"recurrenceName,omitempty"`
1372}
1373
1374// Resource the Data Lake Analytics job resources.
1375type Resource struct {
1376	// Name - the name of the resource.
1377	Name *string `json:"name,omitempty"`
1378	// ResourcePath - the path to the resource.
1379	ResourcePath *string `json:"resourcePath,omitempty"`
1380	// Type - the job resource type. Possible values include: 'VertexResource', 'JobManagerResource', 'StatisticsResource', 'VertexResourceInUserFolder', 'JobManagerResourceInUserFolder', 'StatisticsResourceInUserFolder'
1381	Type ResourceType `json:"type,omitempty"`
1382}
1383
1384// StateAuditRecord the Data Lake Analytics job state audit records for tracking the lifecycle of a job.
1385type StateAuditRecord struct {
1386	// NewState - the new state the job is in.
1387	NewState *string `json:"newState,omitempty"`
1388	// TimeStamp - the time stamp that the state change took place.
1389	TimeStamp *date.Time `json:"timeStamp,omitempty"`
1390	// RequestedByUser - the user who requests the change.
1391	RequestedByUser *string `json:"requestedByUser,omitempty"`
1392	// Details - the details of the audit log.
1393	Details *string `json:"details,omitempty"`
1394}
1395
1396// Statistics the Data Lake Analytics job execution statistics.
1397type Statistics struct {
1398	autorest.Response `json:"-"`
1399	// LastUpdateTimeUtc - the last update time for the statistics.
1400	LastUpdateTimeUtc *date.Time `json:"lastUpdateTimeUtc,omitempty"`
1401	// FinalizingTimeUtc - the job finalizing start time.
1402	FinalizingTimeUtc *date.Time `json:"finalizingTimeUtc,omitempty"`
1403	// Stages - the list of stages for the job.
1404	Stages *[]StatisticsVertexStage `json:"stages,omitempty"`
1405}
1406
1407// StatisticsVertexStage the Data Lake Analytics job statistics vertex stage information.
1408type StatisticsVertexStage struct {
1409	// DataRead - the amount of data read, in bytes.
1410	DataRead *int64 `json:"dataRead,omitempty"`
1411	// DataReadCrossPod - the amount of data read across multiple pods, in bytes.
1412	DataReadCrossPod *int64 `json:"dataReadCrossPod,omitempty"`
1413	// DataReadIntraPod - the amount of data read in one pod, in bytes.
1414	DataReadIntraPod *int64 `json:"dataReadIntraPod,omitempty"`
1415	// DataToRead - the amount of data remaining to be read, in bytes.
1416	DataToRead *int64 `json:"dataToRead,omitempty"`
1417	// DataWritten - the amount of data written, in bytes.
1418	DataWritten *int64 `json:"dataWritten,omitempty"`
1419	// DuplicateDiscardCount - the number of duplicates that were discarded.
1420	DuplicateDiscardCount *int32 `json:"duplicateDiscardCount,omitempty"`
1421	// FailedCount - the number of failures that occured in this stage.
1422	FailedCount *int32 `json:"failedCount,omitempty"`
1423	// MaxVertexDataRead - the maximum amount of data read in a single vertex, in bytes.
1424	MaxVertexDataRead *int64 `json:"maxVertexDataRead,omitempty"`
1425	// MinVertexDataRead - the minimum amount of data read in a single vertex, in bytes.
1426	MinVertexDataRead *int64 `json:"minVertexDataRead,omitempty"`
1427	// ReadFailureCount - the number of read failures in this stage.
1428	ReadFailureCount *int32 `json:"readFailureCount,omitempty"`
1429	// RevocationCount - the number of vertices that were revoked during this stage.
1430	RevocationCount *int32 `json:"revocationCount,omitempty"`
1431	// RunningCount - the number of currently running vertices in this stage.
1432	RunningCount *int32 `json:"runningCount,omitempty"`
1433	// ScheduledCount - the number of currently scheduled vertices in this stage
1434	ScheduledCount *int32 `json:"scheduledCount,omitempty"`
1435	// StageName - the name of this stage in job execution.
1436	StageName *string `json:"stageName,omitempty"`
1437	// SucceededCount - the number of vertices that succeeded in this stage.
1438	SucceededCount *int32 `json:"succeededCount,omitempty"`
1439	// TempDataWritten - the amount of temporary data written, in bytes.
1440	TempDataWritten *int64 `json:"tempDataWritten,omitempty"`
1441	// TotalCount - the total vertex count for this stage.
1442	TotalCount *int32 `json:"totalCount,omitempty"`
1443	// TotalFailedTime - the amount of time that failed vertices took up in this stage.
1444	TotalFailedTime *string `json:"totalFailedTime,omitempty"`
1445	// TotalProgress - the current progress of this stage, as a percentage.
1446	TotalProgress *int32 `json:"totalProgress,omitempty"`
1447	// TotalSucceededTime - the amount of time all successful vertices took in this stage.
1448	TotalSucceededTime *string `json:"totalSucceededTime,omitempty"`
1449}
1450
1451// USQLJobProperties u-SQL job properties used when retrieving U-SQL jobs.
1452type USQLJobProperties struct {
1453	// Resources - the list of resources that are required by the job
1454	Resources *[]Resource `json:"resources,omitempty"`
1455	// Statistics - the job specific statistics.
1456	Statistics *Statistics `json:"statistics,omitempty"`
1457	// DebugData - the job specific debug data locations.
1458	DebugData *DataPath `json:"debugData,omitempty"`
1459	// Diagnostics - the diagnostics for the job.
1460	Diagnostics *[]Diagnostics `json:"diagnostics,omitempty"`
1461	// AlgebraFilePath - the algebra file path after the job has completed
1462	AlgebraFilePath *string `json:"algebraFilePath,omitempty"`
1463	// TotalCompilationTime - the total time this job spent compiling. This value should not be set by the user and will be ignored if it is.
1464	TotalCompilationTime *string `json:"totalCompilationTime,omitempty"`
1465	// TotalPauseTime - the total time this job spent paused. This value should not be set by the user and will be ignored if it is.
1466	TotalPauseTime *string `json:"totalPauseTime,omitempty"`
1467	// TotalQueuedTime - the total time this job spent queued. This value should not be set by the user and will be ignored if it is.
1468	TotalQueuedTime *string `json:"totalQueuedTime,omitempty"`
1469	// TotalRunningTime - the total time this job spent executing. This value should not be set by the user and will be ignored if it is.
1470	TotalRunningTime *string `json:"totalRunningTime,omitempty"`
1471	// RootProcessNodeID - the ID used to identify the job manager coordinating job execution. This value should not be set by the user and will be ignored if it is.
1472	RootProcessNodeID *string `json:"rootProcessNodeId,omitempty"`
1473	// YarnApplicationID - the ID used to identify the yarn application executing the job. This value should not be set by the user and will be ignored if it is.
1474	YarnApplicationID *string `json:"yarnApplicationId,omitempty"`
1475	// YarnApplicationTimeStamp - the timestamp (in ticks) for the yarn application executing the job. This value should not be set by the user and will be ignored if it is.
1476	YarnApplicationTimeStamp *int64 `json:"yarnApplicationTimeStamp,omitempty"`
1477	// 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'
1478	CompileMode CompileMode `json:"compileMode,omitempty"`
1479	// RuntimeVersion - the runtime version of the Data Lake Analytics engine to use for the specific type of job being run.
1480	RuntimeVersion *string `json:"runtimeVersion,omitempty"`
1481	// Script - the script to run. Please note that the maximum script size is 3 MB.
1482	Script *string `json:"script,omitempty"`
1483	// Type - Possible values include: 'TypeJobProperties', 'TypeUSQL', 'TypeHive'
1484	Type Type `json:"type,omitempty"`
1485}
1486
1487// MarshalJSON is the custom marshaler for USQLJobProperties.
1488func (usjp USQLJobProperties) MarshalJSON() ([]byte, error) {
1489	usjp.Type = TypeUSQL
1490	objectMap := make(map[string]interface{})
1491	if usjp.Resources != nil {
1492		objectMap["resources"] = usjp.Resources
1493	}
1494	if usjp.Statistics != nil {
1495		objectMap["statistics"] = usjp.Statistics
1496	}
1497	if usjp.DebugData != nil {
1498		objectMap["debugData"] = usjp.DebugData
1499	}
1500	if usjp.Diagnostics != nil {
1501		objectMap["diagnostics"] = usjp.Diagnostics
1502	}
1503	if usjp.AlgebraFilePath != nil {
1504		objectMap["algebraFilePath"] = usjp.AlgebraFilePath
1505	}
1506	if usjp.TotalCompilationTime != nil {
1507		objectMap["totalCompilationTime"] = usjp.TotalCompilationTime
1508	}
1509	if usjp.TotalPauseTime != nil {
1510		objectMap["totalPauseTime"] = usjp.TotalPauseTime
1511	}
1512	if usjp.TotalQueuedTime != nil {
1513		objectMap["totalQueuedTime"] = usjp.TotalQueuedTime
1514	}
1515	if usjp.TotalRunningTime != nil {
1516		objectMap["totalRunningTime"] = usjp.TotalRunningTime
1517	}
1518	if usjp.RootProcessNodeID != nil {
1519		objectMap["rootProcessNodeId"] = usjp.RootProcessNodeID
1520	}
1521	if usjp.YarnApplicationID != nil {
1522		objectMap["yarnApplicationId"] = usjp.YarnApplicationID
1523	}
1524	if usjp.YarnApplicationTimeStamp != nil {
1525		objectMap["yarnApplicationTimeStamp"] = usjp.YarnApplicationTimeStamp
1526	}
1527	if usjp.CompileMode != "" {
1528		objectMap["compileMode"] = usjp.CompileMode
1529	}
1530	if usjp.RuntimeVersion != nil {
1531		objectMap["runtimeVersion"] = usjp.RuntimeVersion
1532	}
1533	if usjp.Script != nil {
1534		objectMap["script"] = usjp.Script
1535	}
1536	if usjp.Type != "" {
1537		objectMap["type"] = usjp.Type
1538	}
1539	return json.Marshal(objectMap)
1540}
1541
1542// AsUSQLJobProperties is the BasicProperties implementation for USQLJobProperties.
1543func (usjp USQLJobProperties) AsUSQLJobProperties() (*USQLJobProperties, bool) {
1544	return &usjp, true
1545}
1546
1547// AsHiveJobProperties is the BasicProperties implementation for USQLJobProperties.
1548func (usjp USQLJobProperties) AsHiveJobProperties() (*HiveJobProperties, bool) {
1549	return nil, false
1550}
1551
1552// AsProperties is the BasicProperties implementation for USQLJobProperties.
1553func (usjp USQLJobProperties) AsProperties() (*Properties, bool) {
1554	return nil, false
1555}
1556
1557// AsBasicProperties is the BasicProperties implementation for USQLJobProperties.
1558func (usjp USQLJobProperties) AsBasicProperties() (BasicProperties, bool) {
1559	return &usjp, true
1560}
1561