1package spark
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)
25
26// The package's fully qualified name.
27const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/synapse/2019-11-01-preview/spark"
28
29// BatchJob ...
30type BatchJob struct {
31	autorest.Response `json:"-"`
32	LivyInfo          *BatchJobState `json:"livyInfo,omitempty"`
33	// Name - The batch name.
34	Name *string `json:"name,omitempty"`
35	// WorkspaceName - The workspace name.
36	WorkspaceName *string `json:"workspaceName,omitempty"`
37	// SparkPoolName - The Spark pool name.
38	SparkPoolName *string `json:"sparkPoolName,omitempty"`
39	// SubmitterName - The submitter name.
40	SubmitterName *string `json:"submitterName,omitempty"`
41	// SubmitterID - The submitter identifier.
42	SubmitterID *string `json:"submitterId,omitempty"`
43	// ArtifactID - The artifact identifier.
44	ArtifactID *string `json:"artifactId,omitempty"`
45	// JobType - The job type. Possible values include: 'SparkBatch', 'SparkSession'
46	JobType JobType `json:"jobType,omitempty"`
47	// Result - The Spark batch job result. Possible values include: 'Uncertain', 'Succeeded', 'Failed', 'Cancelled'
48	Result BatchJobResultType `json:"result,omitempty"`
49	// Scheduler - The scheduler information.
50	Scheduler *Scheduler `json:"schedulerInfo,omitempty"`
51	// Plugin - The plugin information.
52	Plugin *ServicePlugin `json:"pluginInfo,omitempty"`
53	// Errors - The error information.
54	Errors *[]ServiceError `json:"errorInfo,omitempty"`
55	// Tags - The tags.
56	Tags map[string]*string `json:"tags"`
57	// ID - The session Id.
58	ID *int32 `json:"id,omitempty"`
59	// AppID - The application id of this session
60	AppID *string `json:"appId,omitempty"`
61	// AppInfo - The detailed application info.
62	AppInfo map[string]*string `json:"appInfo"`
63	// State - The batch state
64	State *string `json:"state,omitempty"`
65	// LogLines - The log lines.
66	LogLines *[]string `json:"log,omitempty"`
67}
68
69// MarshalJSON is the custom marshaler for BatchJob.
70func (bj BatchJob) MarshalJSON() ([]byte, error) {
71	objectMap := make(map[string]interface{})
72	if bj.LivyInfo != nil {
73		objectMap["livyInfo"] = bj.LivyInfo
74	}
75	if bj.Name != nil {
76		objectMap["name"] = bj.Name
77	}
78	if bj.WorkspaceName != nil {
79		objectMap["workspaceName"] = bj.WorkspaceName
80	}
81	if bj.SparkPoolName != nil {
82		objectMap["sparkPoolName"] = bj.SparkPoolName
83	}
84	if bj.SubmitterName != nil {
85		objectMap["submitterName"] = bj.SubmitterName
86	}
87	if bj.SubmitterID != nil {
88		objectMap["submitterId"] = bj.SubmitterID
89	}
90	if bj.ArtifactID != nil {
91		objectMap["artifactId"] = bj.ArtifactID
92	}
93	if bj.JobType != "" {
94		objectMap["jobType"] = bj.JobType
95	}
96	if bj.Result != "" {
97		objectMap["result"] = bj.Result
98	}
99	if bj.Scheduler != nil {
100		objectMap["schedulerInfo"] = bj.Scheduler
101	}
102	if bj.Plugin != nil {
103		objectMap["pluginInfo"] = bj.Plugin
104	}
105	if bj.Errors != nil {
106		objectMap["errorInfo"] = bj.Errors
107	}
108	if bj.Tags != nil {
109		objectMap["tags"] = bj.Tags
110	}
111	if bj.ID != nil {
112		objectMap["id"] = bj.ID
113	}
114	if bj.AppID != nil {
115		objectMap["appId"] = bj.AppID
116	}
117	if bj.AppInfo != nil {
118		objectMap["appInfo"] = bj.AppInfo
119	}
120	if bj.State != nil {
121		objectMap["state"] = bj.State
122	}
123	if bj.LogLines != nil {
124		objectMap["log"] = bj.LogLines
125	}
126	return json.Marshal(objectMap)
127}
128
129// BatchJobCollection response for batch list operation.
130type BatchJobCollection struct {
131	autorest.Response `json:"-"`
132	// From - The start index of fetched sessions.
133	From *int32 `json:"from,omitempty"`
134	// Total - Number of sessions fetched.
135	Total *int32 `json:"total,omitempty"`
136	// Sessions - Batch list
137	Sessions *[]BatchJob `json:"sessions,omitempty"`
138}
139
140// BatchJobOptions ...
141type BatchJobOptions struct {
142	Tags           map[string]*string `json:"tags"`
143	ArtifactID     *string            `json:"artifactId,omitempty"`
144	Name           *string            `json:"name,omitempty"`
145	File           *string            `json:"file,omitempty"`
146	ClassName      *string            `json:"className,omitempty"`
147	Arguments      *[]string          `json:"args,omitempty"`
148	Jars           *[]string          `json:"jars,omitempty"`
149	PythonFiles    *[]string          `json:"pyFiles,omitempty"`
150	Files          *[]string          `json:"files,omitempty"`
151	Archives       *[]string          `json:"archives,omitempty"`
152	Configuration  map[string]*string `json:"conf"`
153	DriverMemory   *string            `json:"driverMemory,omitempty"`
154	DriverCores    *int32             `json:"driverCores,omitempty"`
155	ExecutorMemory *string            `json:"executorMemory,omitempty"`
156	ExecutorCores  *int32             `json:"executorCores,omitempty"`
157	ExecutorCount  *int32             `json:"numExecutors,omitempty"`
158}
159
160// MarshalJSON is the custom marshaler for BatchJobOptions.
161func (bjo BatchJobOptions) MarshalJSON() ([]byte, error) {
162	objectMap := make(map[string]interface{})
163	if bjo.Tags != nil {
164		objectMap["tags"] = bjo.Tags
165	}
166	if bjo.ArtifactID != nil {
167		objectMap["artifactId"] = bjo.ArtifactID
168	}
169	if bjo.Name != nil {
170		objectMap["name"] = bjo.Name
171	}
172	if bjo.File != nil {
173		objectMap["file"] = bjo.File
174	}
175	if bjo.ClassName != nil {
176		objectMap["className"] = bjo.ClassName
177	}
178	if bjo.Arguments != nil {
179		objectMap["args"] = bjo.Arguments
180	}
181	if bjo.Jars != nil {
182		objectMap["jars"] = bjo.Jars
183	}
184	if bjo.PythonFiles != nil {
185		objectMap["pyFiles"] = bjo.PythonFiles
186	}
187	if bjo.Files != nil {
188		objectMap["files"] = bjo.Files
189	}
190	if bjo.Archives != nil {
191		objectMap["archives"] = bjo.Archives
192	}
193	if bjo.Configuration != nil {
194		objectMap["conf"] = bjo.Configuration
195	}
196	if bjo.DriverMemory != nil {
197		objectMap["driverMemory"] = bjo.DriverMemory
198	}
199	if bjo.DriverCores != nil {
200		objectMap["driverCores"] = bjo.DriverCores
201	}
202	if bjo.ExecutorMemory != nil {
203		objectMap["executorMemory"] = bjo.ExecutorMemory
204	}
205	if bjo.ExecutorCores != nil {
206		objectMap["executorCores"] = bjo.ExecutorCores
207	}
208	if bjo.ExecutorCount != nil {
209		objectMap["numExecutors"] = bjo.ExecutorCount
210	}
211	return json.Marshal(objectMap)
212}
213
214// BatchJobState ...
215type BatchJobState struct {
216	// NotStartedAt - the time that at which "not_started" livy state was first seen.
217	NotStartedAt *date.Time `json:"notStartedAt,omitempty"`
218	// StartingAt - the time that at which "starting" livy state was first seen.
219	StartingAt *date.Time `json:"startingAt,omitempty"`
220	// RunningAt - the time that at which "running" livy state was first seen.
221	RunningAt *date.Time `json:"runningAt,omitempty"`
222	// DeadAt - time that at which "dead" livy state was first seen.
223	DeadAt *date.Time `json:"deadAt,omitempty"`
224	// SuccessAt - the time that at which "success" livy state was first seen.
225	SuccessAt *date.Time `json:"successAt,omitempty"`
226	// TerminatedAt - the time that at which "killed" livy state was first seen.
227	TerminatedAt *date.Time `json:"killedAt,omitempty"`
228	// RecoveringAt - the time that at which "recovering" livy state was first seen.
229	RecoveringAt *date.Time `json:"recoveringAt,omitempty"`
230	// CurrentState - the Spark job state.
231	CurrentState       *string  `json:"currentState,omitempty"`
232	JobCreationRequest *Request `json:"jobCreationRequest,omitempty"`
233}
234
235// Request ...
236type Request struct {
237	Name           *string            `json:"name,omitempty"`
238	File           *string            `json:"file,omitempty"`
239	ClassName      *string            `json:"className,omitempty"`
240	Arguments      *[]string          `json:"args,omitempty"`
241	Jars           *[]string          `json:"jars,omitempty"`
242	PythonFiles    *[]string          `json:"pyFiles,omitempty"`
243	Files          *[]string          `json:"files,omitempty"`
244	Archives       *[]string          `json:"archives,omitempty"`
245	Configuration  map[string]*string `json:"conf"`
246	DriverMemory   *string            `json:"driverMemory,omitempty"`
247	DriverCores    *int32             `json:"driverCores,omitempty"`
248	ExecutorMemory *string            `json:"executorMemory,omitempty"`
249	ExecutorCores  *int32             `json:"executorCores,omitempty"`
250	ExecutorCount  *int32             `json:"numExecutors,omitempty"`
251}
252
253// MarshalJSON is the custom marshaler for Request.
254func (r Request) MarshalJSON() ([]byte, error) {
255	objectMap := make(map[string]interface{})
256	if r.Name != nil {
257		objectMap["name"] = r.Name
258	}
259	if r.File != nil {
260		objectMap["file"] = r.File
261	}
262	if r.ClassName != nil {
263		objectMap["className"] = r.ClassName
264	}
265	if r.Arguments != nil {
266		objectMap["args"] = r.Arguments
267	}
268	if r.Jars != nil {
269		objectMap["jars"] = r.Jars
270	}
271	if r.PythonFiles != nil {
272		objectMap["pyFiles"] = r.PythonFiles
273	}
274	if r.Files != nil {
275		objectMap["files"] = r.Files
276	}
277	if r.Archives != nil {
278		objectMap["archives"] = r.Archives
279	}
280	if r.Configuration != nil {
281		objectMap["conf"] = r.Configuration
282	}
283	if r.DriverMemory != nil {
284		objectMap["driverMemory"] = r.DriverMemory
285	}
286	if r.DriverCores != nil {
287		objectMap["driverCores"] = r.DriverCores
288	}
289	if r.ExecutorMemory != nil {
290		objectMap["executorMemory"] = r.ExecutorMemory
291	}
292	if r.ExecutorCores != nil {
293		objectMap["executorCores"] = r.ExecutorCores
294	}
295	if r.ExecutorCount != nil {
296		objectMap["numExecutors"] = r.ExecutorCount
297	}
298	return json.Marshal(objectMap)
299}
300
301// Scheduler ...
302type Scheduler struct {
303	SubmittedAt             *date.Time `json:"submittedAt,omitempty"`
304	ScheduledAt             *date.Time `json:"scheduledAt,omitempty"`
305	EndedAt                 *date.Time `json:"endedAt,omitempty"`
306	CancellationRequestedAt *date.Time `json:"cancellationRequestedAt,omitempty"`
307	// CurrentState - Possible values include: 'SchedulerCurrentStateQueued', 'SchedulerCurrentStateScheduled', 'SchedulerCurrentStateEnded'
308	CurrentState SchedulerCurrentState `json:"currentState,omitempty"`
309}
310
311// ServiceError ...
312type ServiceError struct {
313	Message   *string `json:"message,omitempty"`
314	ErrorCode *string `json:"errorCode,omitempty"`
315	// Source - Possible values include: 'System', 'User', 'Unknown', 'Dependency'
316	Source ErrorSource `json:"source,omitempty"`
317}
318
319// ServicePlugin ...
320type ServicePlugin struct {
321	PreparationStartedAt         *date.Time `json:"preparationStartedAt,omitempty"`
322	ResourceAcquisitionStartedAt *date.Time `json:"resourceAcquisitionStartedAt,omitempty"`
323	SubmissionStartedAt          *date.Time `json:"submissionStartedAt,omitempty"`
324	MonitoringStartedAt          *date.Time `json:"monitoringStartedAt,omitempty"`
325	CleanupStartedAt             *date.Time `json:"cleanupStartedAt,omitempty"`
326	// CurrentState - Possible values include: 'Preparation', 'ResourceAcquisition', 'Queued', 'Submission', 'Monitoring', 'Cleanup', 'Ended'
327	CurrentState PluginCurrentState `json:"currentState,omitempty"`
328}
329
330// Session ...
331type Session struct {
332	autorest.Response `json:"-"`
333	LivyInfo          *SessionState `json:"livyInfo,omitempty"`
334	Name              *string       `json:"name,omitempty"`
335	WorkspaceName     *string       `json:"workspaceName,omitempty"`
336	SparkPoolName     *string       `json:"sparkPoolName,omitempty"`
337	SubmitterName     *string       `json:"submitterName,omitempty"`
338	SubmitterID       *string       `json:"submitterId,omitempty"`
339	ArtifactID        *string       `json:"artifactId,omitempty"`
340	// JobType - Possible values include: 'SparkBatch', 'SparkSession'
341	JobType JobType `json:"jobType,omitempty"`
342	// Result - Possible values include: 'SessionResultTypeUncertain', 'SessionResultTypeSucceeded', 'SessionResultTypeFailed', 'SessionResultTypeCancelled'
343	Result    SessionResultType  `json:"result,omitempty"`
344	Scheduler *Scheduler         `json:"schedulerInfo,omitempty"`
345	Plugin    *ServicePlugin     `json:"pluginInfo,omitempty"`
346	Errors    *[]ServiceError    `json:"errorInfo,omitempty"`
347	Tags      map[string]*string `json:"tags"`
348	ID        *int32             `json:"id,omitempty"`
349	AppID     *string            `json:"appId,omitempty"`
350	AppInfo   map[string]*string `json:"appInfo"`
351	State     *string            `json:"state,omitempty"`
352	LogLines  *[]string          `json:"log,omitempty"`
353}
354
355// MarshalJSON is the custom marshaler for Session.
356func (s Session) MarshalJSON() ([]byte, error) {
357	objectMap := make(map[string]interface{})
358	if s.LivyInfo != nil {
359		objectMap["livyInfo"] = s.LivyInfo
360	}
361	if s.Name != nil {
362		objectMap["name"] = s.Name
363	}
364	if s.WorkspaceName != nil {
365		objectMap["workspaceName"] = s.WorkspaceName
366	}
367	if s.SparkPoolName != nil {
368		objectMap["sparkPoolName"] = s.SparkPoolName
369	}
370	if s.SubmitterName != nil {
371		objectMap["submitterName"] = s.SubmitterName
372	}
373	if s.SubmitterID != nil {
374		objectMap["submitterId"] = s.SubmitterID
375	}
376	if s.ArtifactID != nil {
377		objectMap["artifactId"] = s.ArtifactID
378	}
379	if s.JobType != "" {
380		objectMap["jobType"] = s.JobType
381	}
382	if s.Result != "" {
383		objectMap["result"] = s.Result
384	}
385	if s.Scheduler != nil {
386		objectMap["schedulerInfo"] = s.Scheduler
387	}
388	if s.Plugin != nil {
389		objectMap["pluginInfo"] = s.Plugin
390	}
391	if s.Errors != nil {
392		objectMap["errorInfo"] = s.Errors
393	}
394	if s.Tags != nil {
395		objectMap["tags"] = s.Tags
396	}
397	if s.ID != nil {
398		objectMap["id"] = s.ID
399	}
400	if s.AppID != nil {
401		objectMap["appId"] = s.AppID
402	}
403	if s.AppInfo != nil {
404		objectMap["appInfo"] = s.AppInfo
405	}
406	if s.State != nil {
407		objectMap["state"] = s.State
408	}
409	if s.LogLines != nil {
410		objectMap["log"] = s.LogLines
411	}
412	return json.Marshal(objectMap)
413}
414
415// SessionCollection ...
416type SessionCollection struct {
417	autorest.Response `json:"-"`
418	From              *int32     `json:"from,omitempty"`
419	Total             *int32     `json:"total,omitempty"`
420	Sessions          *[]Session `json:"sessions,omitempty"`
421}
422
423// SessionOptions ...
424type SessionOptions struct {
425	Tags           map[string]*string `json:"tags"`
426	ArtifactID     *string            `json:"artifactId,omitempty"`
427	Name           *string            `json:"name,omitempty"`
428	File           *string            `json:"file,omitempty"`
429	ClassName      *string            `json:"className,omitempty"`
430	Arguments      *[]string          `json:"args,omitempty"`
431	Jars           *[]string          `json:"jars,omitempty"`
432	PythonFiles    *[]string          `json:"pyFiles,omitempty"`
433	Files          *[]string          `json:"files,omitempty"`
434	Archives       *[]string          `json:"archives,omitempty"`
435	Configuration  map[string]*string `json:"conf"`
436	DriverMemory   *string            `json:"driverMemory,omitempty"`
437	DriverCores    *int32             `json:"driverCores,omitempty"`
438	ExecutorMemory *string            `json:"executorMemory,omitempty"`
439	ExecutorCores  *int32             `json:"executorCores,omitempty"`
440	ExecutorCount  *int32             `json:"numExecutors,omitempty"`
441}
442
443// MarshalJSON is the custom marshaler for SessionOptions.
444func (so SessionOptions) MarshalJSON() ([]byte, error) {
445	objectMap := make(map[string]interface{})
446	if so.Tags != nil {
447		objectMap["tags"] = so.Tags
448	}
449	if so.ArtifactID != nil {
450		objectMap["artifactId"] = so.ArtifactID
451	}
452	if so.Name != nil {
453		objectMap["name"] = so.Name
454	}
455	if so.File != nil {
456		objectMap["file"] = so.File
457	}
458	if so.ClassName != nil {
459		objectMap["className"] = so.ClassName
460	}
461	if so.Arguments != nil {
462		objectMap["args"] = so.Arguments
463	}
464	if so.Jars != nil {
465		objectMap["jars"] = so.Jars
466	}
467	if so.PythonFiles != nil {
468		objectMap["pyFiles"] = so.PythonFiles
469	}
470	if so.Files != nil {
471		objectMap["files"] = so.Files
472	}
473	if so.Archives != nil {
474		objectMap["archives"] = so.Archives
475	}
476	if so.Configuration != nil {
477		objectMap["conf"] = so.Configuration
478	}
479	if so.DriverMemory != nil {
480		objectMap["driverMemory"] = so.DriverMemory
481	}
482	if so.DriverCores != nil {
483		objectMap["driverCores"] = so.DriverCores
484	}
485	if so.ExecutorMemory != nil {
486		objectMap["executorMemory"] = so.ExecutorMemory
487	}
488	if so.ExecutorCores != nil {
489		objectMap["executorCores"] = so.ExecutorCores
490	}
491	if so.ExecutorCount != nil {
492		objectMap["numExecutors"] = so.ExecutorCount
493	}
494	return json.Marshal(objectMap)
495}
496
497// SessionState ...
498type SessionState struct {
499	NotStartedAt       *date.Time `json:"notStartedAt,omitempty"`
500	StartingAt         *date.Time `json:"startingAt,omitempty"`
501	IdleAt             *date.Time `json:"idleAt,omitempty"`
502	DeadAt             *date.Time `json:"deadAt,omitempty"`
503	ShuttingDownAt     *date.Time `json:"shuttingDownAt,omitempty"`
504	TerminatedAt       *date.Time `json:"killedAt,omitempty"`
505	RecoveringAt       *date.Time `json:"recoveringAt,omitempty"`
506	BusyAt             *date.Time `json:"busyAt,omitempty"`
507	ErrorAt            *date.Time `json:"errorAt,omitempty"`
508	CurrentState       *string    `json:"currentState,omitempty"`
509	JobCreationRequest *Request   `json:"jobCreationRequest,omitempty"`
510}
511
512// Statement ...
513type Statement struct {
514	autorest.Response `json:"-"`
515	ID                *int32           `json:"id,omitempty"`
516	Code              *string          `json:"code,omitempty"`
517	State             *string          `json:"state,omitempty"`
518	Output            *StatementOutput `json:"output,omitempty"`
519}
520
521// StatementCancellationResult ...
522type StatementCancellationResult struct {
523	autorest.Response `json:"-"`
524	Msg               *string `json:"msg,omitempty"`
525}
526
527// StatementCollection ...
528type StatementCollection struct {
529	autorest.Response `json:"-"`
530	Total             *int32       `json:"total_statements,omitempty"`
531	Statements        *[]Statement `json:"statements,omitempty"`
532}
533
534// StatementOptions ...
535type StatementOptions struct {
536	Code *string `json:"code,omitempty"`
537	// Kind - Possible values include: 'Spark', 'Pyspark', 'Dotnetspark', 'SQL'
538	Kind StatementLanguageType `json:"kind,omitempty"`
539}
540
541// StatementOutput ...
542type StatementOutput struct {
543	Status         *string     `json:"status,omitempty"`
544	ExecutionCount *int32      `json:"execution_count,omitempty"`
545	Data           interface{} `json:"data,omitempty"`
546	ErrorName      *string     `json:"ename,omitempty"`
547	ErrorValue     *string     `json:"evalue,omitempty"`
548	Traceback      *[]string   `json:"traceback,omitempty"`
549}
550