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 used for this job. At most one of degreeOfParallelism and degreeOfParallelismPercent should be specified. If none, a default value of 1 will be used. 285 DegreeOfParallelism *int32 `json:"degreeOfParallelism,omitempty"` 286 // 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. 287 DegreeOfParallelismPercent *float64 `json:"degreeOfParallelismPercent,omitempty"` 288 // 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. 289 Priority *int32 `json:"priority,omitempty"` 290 // 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 291 LogFilePatterns *[]string `json:"logFilePatterns,omitempty"` 292 // Related - the recurring job relationship information properties. 293 Related *RelationshipProperties `json:"related,omitempty"` 294 // Type - the job type of the current job (Hive or USql). Possible values include: 'USQL', 'Hive' 295 Type TypeEnum `json:"type,omitempty"` 296 // Properties - the job specific properties. 297 Properties BasicCreateJobProperties `json:"properties,omitempty"` 298} 299 300// UnmarshalJSON is the custom unmarshaler for CreateJobParameters struct. 301func (cjp *CreateJobParameters) UnmarshalJSON(body []byte) error { 302 var m map[string]*json.RawMessage 303 err := json.Unmarshal(body, &m) 304 if err != nil { 305 return err 306 } 307 for k, v := range m { 308 switch k { 309 case "name": 310 if v != nil { 311 var name string 312 err = json.Unmarshal(*v, &name) 313 if err != nil { 314 return err 315 } 316 cjp.Name = &name 317 } 318 case "degreeOfParallelism": 319 if v != nil { 320 var degreeOfParallelism int32 321 err = json.Unmarshal(*v, °reeOfParallelism) 322 if err != nil { 323 return err 324 } 325 cjp.DegreeOfParallelism = °reeOfParallelism 326 } 327 case "degreeOfParallelismPercent": 328 if v != nil { 329 var degreeOfParallelismPercent float64 330 err = json.Unmarshal(*v, °reeOfParallelismPercent) 331 if err != nil { 332 return err 333 } 334 cjp.DegreeOfParallelismPercent = °reeOfParallelismPercent 335 } 336 case "priority": 337 if v != nil { 338 var priority int32 339 err = json.Unmarshal(*v, &priority) 340 if err != nil { 341 return err 342 } 343 cjp.Priority = &priority 344 } 345 case "logFilePatterns": 346 if v != nil { 347 var logFilePatterns []string 348 err = json.Unmarshal(*v, &logFilePatterns) 349 if err != nil { 350 return err 351 } 352 cjp.LogFilePatterns = &logFilePatterns 353 } 354 case "related": 355 if v != nil { 356 var related RelationshipProperties 357 err = json.Unmarshal(*v, &related) 358 if err != nil { 359 return err 360 } 361 cjp.Related = &related 362 } 363 case "type": 364 if v != nil { 365 var typeVar TypeEnum 366 err = json.Unmarshal(*v, &typeVar) 367 if err != nil { 368 return err 369 } 370 cjp.Type = typeVar 371 } 372 case "properties": 373 if v != nil { 374 properties, err := unmarshalBasicCreateJobProperties(*v) 375 if err != nil { 376 return err 377 } 378 cjp.Properties = properties 379 } 380 } 381 } 382 383 return nil 384} 385 386// BasicCreateJobProperties the common Data Lake Analytics job properties for job submission. 387type BasicCreateJobProperties interface { 388 AsCreateUSQLJobProperties() (*CreateUSQLJobProperties, bool) 389 AsCreateJobProperties() (*CreateJobProperties, bool) 390} 391 392// CreateJobProperties the common Data Lake Analytics job properties for job submission. 393type CreateJobProperties struct { 394 // RuntimeVersion - the runtime version of the Data Lake Analytics engine to use for the specific type of job being run. 395 RuntimeVersion *string `json:"runtimeVersion,omitempty"` 396 // Script - the script to run. Please note that the maximum script size is 3 MB. 397 Script *string `json:"script,omitempty"` 398 // Type - Possible values include: 'TypeBasicCreateJobPropertiesTypeCreateJobProperties', 'TypeBasicCreateJobPropertiesTypeUSQL' 399 Type TypeBasicCreateJobProperties `json:"type,omitempty"` 400} 401 402func unmarshalBasicCreateJobProperties(body []byte) (BasicCreateJobProperties, error) { 403 var m map[string]interface{} 404 err := json.Unmarshal(body, &m) 405 if err != nil { 406 return nil, err 407 } 408 409 switch m["type"] { 410 case string(TypeBasicCreateJobPropertiesTypeUSQL): 411 var cusjp CreateUSQLJobProperties 412 err := json.Unmarshal(body, &cusjp) 413 return cusjp, err 414 default: 415 var cjp CreateJobProperties 416 err := json.Unmarshal(body, &cjp) 417 return cjp, err 418 } 419} 420func unmarshalBasicCreateJobPropertiesArray(body []byte) ([]BasicCreateJobProperties, error) { 421 var rawMessages []*json.RawMessage 422 err := json.Unmarshal(body, &rawMessages) 423 if err != nil { 424 return nil, err 425 } 426 427 cjpArray := make([]BasicCreateJobProperties, len(rawMessages)) 428 429 for index, rawMessage := range rawMessages { 430 cjp, err := unmarshalBasicCreateJobProperties(*rawMessage) 431 if err != nil { 432 return nil, err 433 } 434 cjpArray[index] = cjp 435 } 436 return cjpArray, nil 437} 438 439// MarshalJSON is the custom marshaler for CreateJobProperties. 440func (cjp CreateJobProperties) MarshalJSON() ([]byte, error) { 441 cjp.Type = TypeBasicCreateJobPropertiesTypeCreateJobProperties 442 objectMap := make(map[string]interface{}) 443 if cjp.RuntimeVersion != nil { 444 objectMap["runtimeVersion"] = cjp.RuntimeVersion 445 } 446 if cjp.Script != nil { 447 objectMap["script"] = cjp.Script 448 } 449 if cjp.Type != "" { 450 objectMap["type"] = cjp.Type 451 } 452 return json.Marshal(objectMap) 453} 454 455// AsCreateUSQLJobProperties is the BasicCreateJobProperties implementation for CreateJobProperties. 456func (cjp CreateJobProperties) AsCreateUSQLJobProperties() (*CreateUSQLJobProperties, bool) { 457 return nil, false 458} 459 460// AsCreateJobProperties is the BasicCreateJobProperties implementation for CreateJobProperties. 461func (cjp CreateJobProperties) AsCreateJobProperties() (*CreateJobProperties, bool) { 462 return &cjp, true 463} 464 465// AsBasicCreateJobProperties is the BasicCreateJobProperties implementation for CreateJobProperties. 466func (cjp CreateJobProperties) AsBasicCreateJobProperties() (BasicCreateJobProperties, bool) { 467 return &cjp, true 468} 469 470// CreateUSQLJobProperties u-SQL job properties used when submitting U-SQL jobs. 471type CreateUSQLJobProperties struct { 472 // 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' 473 CompileMode CompileMode `json:"compileMode,omitempty"` 474 // RuntimeVersion - the runtime version of the Data Lake Analytics engine to use for the specific type of job being run. 475 RuntimeVersion *string `json:"runtimeVersion,omitempty"` 476 // Script - the script to run. Please note that the maximum script size is 3 MB. 477 Script *string `json:"script,omitempty"` 478 // Type - Possible values include: 'TypeBasicCreateJobPropertiesTypeCreateJobProperties', 'TypeBasicCreateJobPropertiesTypeUSQL' 479 Type TypeBasicCreateJobProperties `json:"type,omitempty"` 480} 481 482// MarshalJSON is the custom marshaler for CreateUSQLJobProperties. 483func (cusjp CreateUSQLJobProperties) MarshalJSON() ([]byte, error) { 484 cusjp.Type = TypeBasicCreateJobPropertiesTypeUSQL 485 objectMap := make(map[string]interface{}) 486 if cusjp.CompileMode != "" { 487 objectMap["compileMode"] = cusjp.CompileMode 488 } 489 if cusjp.RuntimeVersion != nil { 490 objectMap["runtimeVersion"] = cusjp.RuntimeVersion 491 } 492 if cusjp.Script != nil { 493 objectMap["script"] = cusjp.Script 494 } 495 if cusjp.Type != "" { 496 objectMap["type"] = cusjp.Type 497 } 498 return json.Marshal(objectMap) 499} 500 501// AsCreateUSQLJobProperties is the BasicCreateJobProperties implementation for CreateUSQLJobProperties. 502func (cusjp CreateUSQLJobProperties) AsCreateUSQLJobProperties() (*CreateUSQLJobProperties, bool) { 503 return &cusjp, true 504} 505 506// AsCreateJobProperties is the BasicCreateJobProperties implementation for CreateUSQLJobProperties. 507func (cusjp CreateUSQLJobProperties) AsCreateJobProperties() (*CreateJobProperties, bool) { 508 return nil, false 509} 510 511// AsBasicCreateJobProperties is the BasicCreateJobProperties implementation for CreateUSQLJobProperties. 512func (cusjp CreateUSQLJobProperties) AsBasicCreateJobProperties() (BasicCreateJobProperties, bool) { 513 return &cusjp, true 514} 515 516// DataPath a Data Lake Analytics job data path item. 517type DataPath struct { 518 autorest.Response `json:"-"` 519 // JobID - the id of the job this data is for. 520 JobID *uuid.UUID `json:"jobId,omitempty"` 521 // Command - the command that this job data relates to. 522 Command *string `json:"command,omitempty"` 523 // Paths - the list of paths to all of the job data. 524 Paths *[]string `json:"paths,omitempty"` 525} 526 527// Diagnostics error diagnostic information for failed jobs. 528type Diagnostics struct { 529 // ColumnNumber - the column where the error occured. 530 ColumnNumber *int32 `json:"columnNumber,omitempty"` 531 // End - the ending index of the error. 532 End *int32 `json:"end,omitempty"` 533 // LineNumber - the line number the error occured on. 534 LineNumber *int32 `json:"lineNumber,omitempty"` 535 // Message - the error message. 536 Message *string `json:"message,omitempty"` 537 // Severity - the severity of the error. Possible values include: 'Warning', 'Error', 'Info', 'SevereWarning', 'Deprecated', 'UserWarning' 538 Severity SeverityTypes `json:"severity,omitempty"` 539 // Start - the starting index of the error. 540 Start *int32 `json:"start,omitempty"` 541} 542 543// ErrorDetails the Data Lake Analytics job error details. 544type ErrorDetails struct { 545 // Description - the error message description 546 Description *string `json:"description,omitempty"` 547 // Details - the details of the error message. 548 Details *string `json:"details,omitempty"` 549 // EndOffset - the end offset in the job where the error was found. 550 EndOffset *int32 `json:"endOffset,omitempty"` 551 // ErrorID - the specific identifier for the type of error encountered in the job. 552 ErrorID *string `json:"errorId,omitempty"` 553 // FilePath - the path to any supplemental error files, if any. 554 FilePath *string `json:"filePath,omitempty"` 555 // HelpLink - the link to MSDN or Azure help for this type of error, if any. 556 HelpLink *string `json:"helpLink,omitempty"` 557 // 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. 558 InternalDiagnostics *string `json:"internalDiagnostics,omitempty"` 559 // LineNumber - the specific line number in the job where the error occured. 560 LineNumber *int32 `json:"lineNumber,omitempty"` 561 // Message - the user friendly error message for the failure. 562 Message *string `json:"message,omitempty"` 563 // Resolution - the recommended resolution for the failure, if any. 564 Resolution *string `json:"resolution,omitempty"` 565 // InnerError - the inner error of this specific job error message, if any. 566 InnerError *InnerError `json:"innerError,omitempty"` 567 // Severity - the severity level of the failure. Possible values include: 'Warning', 'Error', 'Info', 'SevereWarning', 'Deprecated', 'UserWarning' 568 Severity SeverityTypes `json:"severity,omitempty"` 569 // Source - the ultimate source of the failure (usually either SYSTEM or USER). 570 Source *string `json:"source,omitempty"` 571 // StartOffset - the start offset in the job where the error was found 572 StartOffset *int32 `json:"startOffset,omitempty"` 573} 574 575// HiveJobProperties hive job properties used when retrieving Hive jobs. 576type HiveJobProperties struct { 577 // LogsLocation - the Hive logs location 578 LogsLocation *string `json:"logsLocation,omitempty"` 579 // OutputLocation - the location of Hive job output files (both execution output and results) 580 OutputLocation *string `json:"outputLocation,omitempty"` 581 // StatementCount - the number of statements that will be run based on the script 582 StatementCount *int32 `json:"statementCount,omitempty"` 583 // ExecutedStatementCount - the number of statements that have been run based on the script 584 ExecutedStatementCount *int32 `json:"executedStatementCount,omitempty"` 585 // RuntimeVersion - the runtime version of the Data Lake Analytics engine to use for the specific type of job being run. 586 RuntimeVersion *string `json:"runtimeVersion,omitempty"` 587 // Script - the script to run. Please note that the maximum script size is 3 MB. 588 Script *string `json:"script,omitempty"` 589 // Type - Possible values include: 'TypeJobProperties', 'TypeUSQL', 'TypeHive' 590 Type Type `json:"type,omitempty"` 591} 592 593// MarshalJSON is the custom marshaler for HiveJobProperties. 594func (hjp HiveJobProperties) MarshalJSON() ([]byte, error) { 595 hjp.Type = TypeHive 596 objectMap := make(map[string]interface{}) 597 if hjp.LogsLocation != nil { 598 objectMap["logsLocation"] = hjp.LogsLocation 599 } 600 if hjp.OutputLocation != nil { 601 objectMap["outputLocation"] = hjp.OutputLocation 602 } 603 if hjp.StatementCount != nil { 604 objectMap["statementCount"] = hjp.StatementCount 605 } 606 if hjp.ExecutedStatementCount != nil { 607 objectMap["executedStatementCount"] = hjp.ExecutedStatementCount 608 } 609 if hjp.RuntimeVersion != nil { 610 objectMap["runtimeVersion"] = hjp.RuntimeVersion 611 } 612 if hjp.Script != nil { 613 objectMap["script"] = hjp.Script 614 } 615 if hjp.Type != "" { 616 objectMap["type"] = hjp.Type 617 } 618 return json.Marshal(objectMap) 619} 620 621// AsUSQLJobProperties is the BasicProperties implementation for HiveJobProperties. 622func (hjp HiveJobProperties) AsUSQLJobProperties() (*USQLJobProperties, bool) { 623 return nil, false 624} 625 626// AsHiveJobProperties is the BasicProperties implementation for HiveJobProperties. 627func (hjp HiveJobProperties) AsHiveJobProperties() (*HiveJobProperties, bool) { 628 return &hjp, true 629} 630 631// AsProperties is the BasicProperties implementation for HiveJobProperties. 632func (hjp HiveJobProperties) AsProperties() (*Properties, bool) { 633 return nil, false 634} 635 636// AsBasicProperties is the BasicProperties implementation for HiveJobProperties. 637func (hjp HiveJobProperties) AsBasicProperties() (BasicProperties, bool) { 638 return &hjp, true 639} 640 641// InfoListResult list of JobInfo items. 642type InfoListResult struct { 643 autorest.Response `json:"-"` 644 // Value - the list of JobInfo items. 645 Value *[]InformationBasic `json:"value,omitempty"` 646 // NextLink - the link (url) to the next page of results. 647 NextLink *string `json:"nextLink,omitempty"` 648} 649 650// InfoListResultIterator provides access to a complete listing of InformationBasic values. 651type InfoListResultIterator struct { 652 i int 653 page InfoListResultPage 654} 655 656// Next advances to the next value. If there was an error making 657// the request the iterator does not advance and the error is returned. 658func (iter *InfoListResultIterator) Next() error { 659 iter.i++ 660 if iter.i < len(iter.page.Values()) { 661 return nil 662 } 663 err := iter.page.Next() 664 if err != nil { 665 iter.i-- 666 return err 667 } 668 iter.i = 0 669 return nil 670} 671 672// NotDone returns true if the enumeration should be started or is not yet complete. 673func (iter InfoListResultIterator) NotDone() bool { 674 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 675} 676 677// Response returns the raw server response from the last page request. 678func (iter InfoListResultIterator) Response() InfoListResult { 679 return iter.page.Response() 680} 681 682// Value returns the current value or a zero-initialized value if the 683// iterator has advanced beyond the end of the collection. 684func (iter InfoListResultIterator) Value() InformationBasic { 685 if !iter.page.NotDone() { 686 return InformationBasic{} 687 } 688 return iter.page.Values()[iter.i] 689} 690 691// IsEmpty returns true if the ListResult contains no values. 692func (ilr InfoListResult) IsEmpty() bool { 693 return ilr.Value == nil || len(*ilr.Value) == 0 694} 695 696// infoListResultPreparer prepares a request to retrieve the next set of results. 697// It returns nil if no more results exist. 698func (ilr InfoListResult) infoListResultPreparer() (*http.Request, error) { 699 if ilr.NextLink == nil || len(to.String(ilr.NextLink)) < 1 { 700 return nil, nil 701 } 702 return autorest.Prepare(&http.Request{}, 703 autorest.AsJSON(), 704 autorest.AsGet(), 705 autorest.WithBaseURL(to.String(ilr.NextLink))) 706} 707 708// InfoListResultPage contains a page of InformationBasic values. 709type InfoListResultPage struct { 710 fn func(InfoListResult) (InfoListResult, error) 711 ilr InfoListResult 712} 713 714// Next advances to the next page of values. If there was an error making 715// the request the page does not advance and the error is returned. 716func (page *InfoListResultPage) Next() error { 717 next, err := page.fn(page.ilr) 718 if err != nil { 719 return err 720 } 721 page.ilr = next 722 return nil 723} 724 725// NotDone returns true if the page enumeration should be started or is not yet complete. 726func (page InfoListResultPage) NotDone() bool { 727 return !page.ilr.IsEmpty() 728} 729 730// Response returns the raw server response from the last page request. 731func (page InfoListResultPage) Response() InfoListResult { 732 return page.ilr 733} 734 735// Values returns the slice of values for the current page or nil if there are no values. 736func (page InfoListResultPage) Values() []InformationBasic { 737 if page.ilr.IsEmpty() { 738 return nil 739 } 740 return *page.ilr.Value 741} 742 743// Information the extended Data Lake Analytics job information properties returned when retrieving a specific job. 744type Information struct { 745 autorest.Response `json:"-"` 746 // ErrorMessage - the error message details for the job, if the job failed. 747 ErrorMessage *[]ErrorDetails `json:"errorMessage,omitempty"` 748 // StateAuditRecords - the job state audit records, indicating when various operations have been performed on this job. 749 StateAuditRecords *[]StateAuditRecord `json:"stateAuditRecords,omitempty"` 750 // Properties - the job specific properties. 751 Properties BasicProperties `json:"properties,omitempty"` 752 // JobID - the job's unique identifier (a GUID). 753 JobID *uuid.UUID `json:"jobId,omitempty"` 754 // Name - the friendly name of the job. 755 Name *string `json:"name,omitempty"` 756 // Type - the job type of the current job (Hive or USql). Possible values include: 'USQL', 'Hive' 757 Type TypeEnum `json:"type,omitempty"` 758 // Submitter - the user or account that submitted the job. 759 Submitter *string `json:"submitter,omitempty"` 760 // DegreeOfParallelism - the degree of parallelism used for this job. 761 DegreeOfParallelism *int32 `json:"degreeOfParallelism,omitempty"` 762 // DegreeOfParallelismPercent - the degree of parallelism in percentage used for this job. 763 DegreeOfParallelismPercent *float64 `json:"degreeOfParallelismPercent,omitempty"` 764 // 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. 765 Priority *int32 `json:"priority,omitempty"` 766 // SubmitTime - the time the job was submitted to the service. 767 SubmitTime *date.Time `json:"submitTime,omitempty"` 768 // StartTime - the start time of the job. 769 StartTime *date.Time `json:"startTime,omitempty"` 770 // EndTime - the completion time of the job. 771 EndTime *date.Time `json:"endTime,omitempty"` 772 // 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' 773 State State `json:"state,omitempty"` 774 // Result - the result of job execution or the current result of the running job. Possible values include: 'None', 'Succeeded', 'Cancelled', 'Failed' 775 Result Result `json:"result,omitempty"` 776 // 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/. 777 LogFolder *string `json:"logFolder,omitempty"` 778 // 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 779 LogFilePatterns *[]string `json:"logFilePatterns,omitempty"` 780 // Related - the recurring job relationship information properties. 781 Related *RelationshipProperties `json:"related,omitempty"` 782 // HierarchyQueueNode - the name of hierarchy queue node this job is assigned to, null if job has not been assigned yet or the account doesn't have hierarchy queue. 783 HierarchyQueueNode *string `json:"hierarchyQueueNode,omitempty"` 784} 785 786// UnmarshalJSON is the custom unmarshaler for Information struct. 787func (i *Information) UnmarshalJSON(body []byte) error { 788 var m map[string]*json.RawMessage 789 err := json.Unmarshal(body, &m) 790 if err != nil { 791 return err 792 } 793 for k, v := range m { 794 switch k { 795 case "errorMessage": 796 if v != nil { 797 var errorMessage []ErrorDetails 798 err = json.Unmarshal(*v, &errorMessage) 799 if err != nil { 800 return err 801 } 802 i.ErrorMessage = &errorMessage 803 } 804 case "stateAuditRecords": 805 if v != nil { 806 var stateAuditRecords []StateAuditRecord 807 err = json.Unmarshal(*v, &stateAuditRecords) 808 if err != nil { 809 return err 810 } 811 i.StateAuditRecords = &stateAuditRecords 812 } 813 case "properties": 814 if v != nil { 815 properties, err := unmarshalBasicProperties(*v) 816 if err != nil { 817 return err 818 } 819 i.Properties = properties 820 } 821 case "jobId": 822 if v != nil { 823 var jobID uuid.UUID 824 err = json.Unmarshal(*v, &jobID) 825 if err != nil { 826 return err 827 } 828 i.JobID = &jobID 829 } 830 case "name": 831 if v != nil { 832 var name string 833 err = json.Unmarshal(*v, &name) 834 if err != nil { 835 return err 836 } 837 i.Name = &name 838 } 839 case "type": 840 if v != nil { 841 var typeVar TypeEnum 842 err = json.Unmarshal(*v, &typeVar) 843 if err != nil { 844 return err 845 } 846 i.Type = typeVar 847 } 848 case "submitter": 849 if v != nil { 850 var submitter string 851 err = json.Unmarshal(*v, &submitter) 852 if err != nil { 853 return err 854 } 855 i.Submitter = &submitter 856 } 857 case "degreeOfParallelism": 858 if v != nil { 859 var degreeOfParallelism int32 860 err = json.Unmarshal(*v, °reeOfParallelism) 861 if err != nil { 862 return err 863 } 864 i.DegreeOfParallelism = °reeOfParallelism 865 } 866 case "degreeOfParallelismPercent": 867 if v != nil { 868 var degreeOfParallelismPercent float64 869 err = json.Unmarshal(*v, °reeOfParallelismPercent) 870 if err != nil { 871 return err 872 } 873 i.DegreeOfParallelismPercent = °reeOfParallelismPercent 874 } 875 case "priority": 876 if v != nil { 877 var priority int32 878 err = json.Unmarshal(*v, &priority) 879 if err != nil { 880 return err 881 } 882 i.Priority = &priority 883 } 884 case "submitTime": 885 if v != nil { 886 var submitTime date.Time 887 err = json.Unmarshal(*v, &submitTime) 888 if err != nil { 889 return err 890 } 891 i.SubmitTime = &submitTime 892 } 893 case "startTime": 894 if v != nil { 895 var startTime date.Time 896 err = json.Unmarshal(*v, &startTime) 897 if err != nil { 898 return err 899 } 900 i.StartTime = &startTime 901 } 902 case "endTime": 903 if v != nil { 904 var endTime date.Time 905 err = json.Unmarshal(*v, &endTime) 906 if err != nil { 907 return err 908 } 909 i.EndTime = &endTime 910 } 911 case "state": 912 if v != nil { 913 var state State 914 err = json.Unmarshal(*v, &state) 915 if err != nil { 916 return err 917 } 918 i.State = state 919 } 920 case "result": 921 if v != nil { 922 var resultVar Result 923 err = json.Unmarshal(*v, &resultVar) 924 if err != nil { 925 return err 926 } 927 i.Result = resultVar 928 } 929 case "logFolder": 930 if v != nil { 931 var logFolder string 932 err = json.Unmarshal(*v, &logFolder) 933 if err != nil { 934 return err 935 } 936 i.LogFolder = &logFolder 937 } 938 case "logFilePatterns": 939 if v != nil { 940 var logFilePatterns []string 941 err = json.Unmarshal(*v, &logFilePatterns) 942 if err != nil { 943 return err 944 } 945 i.LogFilePatterns = &logFilePatterns 946 } 947 case "related": 948 if v != nil { 949 var related RelationshipProperties 950 err = json.Unmarshal(*v, &related) 951 if err != nil { 952 return err 953 } 954 i.Related = &related 955 } 956 case "hierarchyQueueNode": 957 if v != nil { 958 var hierarchyQueueNode string 959 err = json.Unmarshal(*v, &hierarchyQueueNode) 960 if err != nil { 961 return err 962 } 963 i.HierarchyQueueNode = &hierarchyQueueNode 964 } 965 } 966 } 967 968 return nil 969} 970 971// InformationBasic the common Data Lake Analytics job information properties. 972type InformationBasic struct { 973 // JobID - the job's unique identifier (a GUID). 974 JobID *uuid.UUID `json:"jobId,omitempty"` 975 // Name - the friendly name of the job. 976 Name *string `json:"name,omitempty"` 977 // Type - the job type of the current job (Hive or USql). Possible values include: 'USQL', 'Hive' 978 Type TypeEnum `json:"type,omitempty"` 979 // Submitter - the user or account that submitted the job. 980 Submitter *string `json:"submitter,omitempty"` 981 // DegreeOfParallelism - the degree of parallelism used for this job. 982 DegreeOfParallelism *int32 `json:"degreeOfParallelism,omitempty"` 983 // DegreeOfParallelismPercent - the degree of parallelism in percentage used for this job. 984 DegreeOfParallelismPercent *float64 `json:"degreeOfParallelismPercent,omitempty"` 985 // 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. 986 Priority *int32 `json:"priority,omitempty"` 987 // SubmitTime - the time the job was submitted to the service. 988 SubmitTime *date.Time `json:"submitTime,omitempty"` 989 // StartTime - the start time of the job. 990 StartTime *date.Time `json:"startTime,omitempty"` 991 // EndTime - the completion time of the job. 992 EndTime *date.Time `json:"endTime,omitempty"` 993 // 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' 994 State State `json:"state,omitempty"` 995 // Result - the result of job execution or the current result of the running job. Possible values include: 'None', 'Succeeded', 'Cancelled', 'Failed' 996 Result Result `json:"result,omitempty"` 997 // 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/. 998 LogFolder *string `json:"logFolder,omitempty"` 999 // 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 1000 LogFilePatterns *[]string `json:"logFilePatterns,omitempty"` 1001 // Related - the recurring job relationship information properties. 1002 Related *RelationshipProperties `json:"related,omitempty"` 1003 // HierarchyQueueNode - the name of hierarchy queue node this job is assigned to, null if job has not been assigned yet or the account doesn't have hierarchy queue. 1004 HierarchyQueueNode *string `json:"hierarchyQueueNode,omitempty"` 1005} 1006 1007// InnerError the Data Lake Analytics job error details. 1008type InnerError struct { 1009 // DiagnosticCode - the diagnostic error code. 1010 DiagnosticCode *int32 `json:"diagnosticCode,omitempty"` 1011 // Severity - the severity level of the failure. Possible values include: 'Warning', 'Error', 'Info', 'SevereWarning', 'Deprecated', 'UserWarning' 1012 Severity SeverityTypes `json:"severity,omitempty"` 1013 // Details - the details of the error message. 1014 Details *string `json:"details,omitempty"` 1015 // Component - the component that failed. 1016 Component *string `json:"component,omitempty"` 1017 // ErrorID - the specific identifier for the type of error encountered in the job. 1018 ErrorID *string `json:"errorId,omitempty"` 1019 // HelpLink - the link to MSDN or Azure help for this type of error, if any. 1020 HelpLink *string `json:"helpLink,omitempty"` 1021 // 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. 1022 InternalDiagnostics *string `json:"internalDiagnostics,omitempty"` 1023 // Message - the user friendly error message for the failure. 1024 Message *string `json:"message,omitempty"` 1025 // Resolution - the recommended resolution for the failure, if any. 1026 Resolution *string `json:"resolution,omitempty"` 1027 // Source - the ultimate source of the failure (usually either SYSTEM or USER). 1028 Source *string `json:"source,omitempty"` 1029 // Description - the error message description 1030 Description *string `json:"description,omitempty"` 1031 // InnerError - the inner error of this specific job error message, if any. 1032 InnerError *InnerError `json:"innerError,omitempty"` 1033} 1034 1035// PipelineInformation job Pipeline Information, showing the relationship of jobs and recurrences of those jobs in 1036// a pipeline. 1037type PipelineInformation struct { 1038 autorest.Response `json:"-"` 1039 // PipelineID - the job relationship pipeline identifier (a GUID). 1040 PipelineID *uuid.UUID `json:"pipelineId,omitempty"` 1041 // PipelineName - the friendly name of the job relationship pipeline, which does not need to be unique. 1042 PipelineName *string `json:"pipelineName,omitempty"` 1043 // PipelineURI - the pipeline uri, unique, links to the originating service for this pipeline. 1044 PipelineURI *string `json:"pipelineUri,omitempty"` 1045 // NumJobsFailed - the number of jobs in this pipeline that have failed. 1046 NumJobsFailed *int32 `json:"numJobsFailed,omitempty"` 1047 // NumJobsCanceled - the number of jobs in this pipeline that have been canceled. 1048 NumJobsCanceled *int32 `json:"numJobsCanceled,omitempty"` 1049 // NumJobsSucceeded - the number of jobs in this pipeline that have succeeded. 1050 NumJobsSucceeded *int32 `json:"numJobsSucceeded,omitempty"` 1051 // AuHoursFailed - the number of job execution hours that resulted in failed jobs. 1052 AuHoursFailed *float64 `json:"auHoursFailed,omitempty"` 1053 // AuHoursCanceled - the number of job execution hours that resulted in canceled jobs. 1054 AuHoursCanceled *float64 `json:"auHoursCanceled,omitempty"` 1055 // AuHoursSucceeded - the number of job execution hours that resulted in successful jobs. 1056 AuHoursSucceeded *float64 `json:"auHoursSucceeded,omitempty"` 1057 // LastSubmitTime - the last time a job in this pipeline was submitted. 1058 LastSubmitTime *date.Time `json:"lastSubmitTime,omitempty"` 1059 // Runs - the list of run identifiers representing each run of this pipeline. 1060 Runs *[]PipelineRunInformation `json:"runs,omitempty"` 1061 // Recurrences - the list of recurrence identifiers representing each recurrence in this pipeline. 1062 Recurrences *[]uuid.UUID `json:"recurrences,omitempty"` 1063} 1064 1065// PipelineInformationListResult list of job pipeline information items. 1066type PipelineInformationListResult struct { 1067 autorest.Response `json:"-"` 1068 // Value - the list of job pipeline information items. 1069 Value *[]PipelineInformation `json:"value,omitempty"` 1070 // NextLink - the link (url) to the next page of results. 1071 NextLink *string `json:"nextLink,omitempty"` 1072} 1073 1074// PipelineInformationListResultIterator provides access to a complete listing of PipelineInformation values. 1075type PipelineInformationListResultIterator struct { 1076 i int 1077 page PipelineInformationListResultPage 1078} 1079 1080// Next advances to the next value. If there was an error making 1081// the request the iterator does not advance and the error is returned. 1082func (iter *PipelineInformationListResultIterator) Next() error { 1083 iter.i++ 1084 if iter.i < len(iter.page.Values()) { 1085 return nil 1086 } 1087 err := iter.page.Next() 1088 if err != nil { 1089 iter.i-- 1090 return err 1091 } 1092 iter.i = 0 1093 return nil 1094} 1095 1096// NotDone returns true if the enumeration should be started or is not yet complete. 1097func (iter PipelineInformationListResultIterator) NotDone() bool { 1098 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1099} 1100 1101// Response returns the raw server response from the last page request. 1102func (iter PipelineInformationListResultIterator) Response() PipelineInformationListResult { 1103 return iter.page.Response() 1104} 1105 1106// Value returns the current value or a zero-initialized value if the 1107// iterator has advanced beyond the end of the collection. 1108func (iter PipelineInformationListResultIterator) Value() PipelineInformation { 1109 if !iter.page.NotDone() { 1110 return PipelineInformation{} 1111 } 1112 return iter.page.Values()[iter.i] 1113} 1114 1115// IsEmpty returns true if the ListResult contains no values. 1116func (pilr PipelineInformationListResult) IsEmpty() bool { 1117 return pilr.Value == nil || len(*pilr.Value) == 0 1118} 1119 1120// pipelineInformationListResultPreparer prepares a request to retrieve the next set of results. 1121// It returns nil if no more results exist. 1122func (pilr PipelineInformationListResult) pipelineInformationListResultPreparer() (*http.Request, error) { 1123 if pilr.NextLink == nil || len(to.String(pilr.NextLink)) < 1 { 1124 return nil, nil 1125 } 1126 return autorest.Prepare(&http.Request{}, 1127 autorest.AsJSON(), 1128 autorest.AsGet(), 1129 autorest.WithBaseURL(to.String(pilr.NextLink))) 1130} 1131 1132// PipelineInformationListResultPage contains a page of PipelineInformation values. 1133type PipelineInformationListResultPage struct { 1134 fn func(PipelineInformationListResult) (PipelineInformationListResult, error) 1135 pilr PipelineInformationListResult 1136} 1137 1138// Next advances to the next page of values. If there was an error making 1139// the request the page does not advance and the error is returned. 1140func (page *PipelineInformationListResultPage) Next() error { 1141 next, err := page.fn(page.pilr) 1142 if err != nil { 1143 return err 1144 } 1145 page.pilr = next 1146 return nil 1147} 1148 1149// NotDone returns true if the page enumeration should be started or is not yet complete. 1150func (page PipelineInformationListResultPage) NotDone() bool { 1151 return !page.pilr.IsEmpty() 1152} 1153 1154// Response returns the raw server response from the last page request. 1155func (page PipelineInformationListResultPage) Response() PipelineInformationListResult { 1156 return page.pilr 1157} 1158 1159// Values returns the slice of values for the current page or nil if there are no values. 1160func (page PipelineInformationListResultPage) Values() []PipelineInformation { 1161 if page.pilr.IsEmpty() { 1162 return nil 1163 } 1164 return *page.pilr.Value 1165} 1166 1167// PipelineRunInformation run info for a specific job pipeline. 1168type PipelineRunInformation struct { 1169 // RunID - the run identifier of an instance of pipeline executions (a GUID). 1170 RunID *uuid.UUID `json:"runId,omitempty"` 1171 // LastSubmitTime - the time this instance was last submitted. 1172 LastSubmitTime *date.Time `json:"lastSubmitTime,omitempty"` 1173} 1174 1175// BasicProperties the common Data Lake Analytics job properties. 1176type BasicProperties interface { 1177 AsUSQLJobProperties() (*USQLJobProperties, bool) 1178 AsHiveJobProperties() (*HiveJobProperties, bool) 1179 AsProperties() (*Properties, bool) 1180} 1181 1182// Properties the common Data Lake Analytics job properties. 1183type Properties struct { 1184 // RuntimeVersion - the runtime version of the Data Lake Analytics engine to use for the specific type of job being run. 1185 RuntimeVersion *string `json:"runtimeVersion,omitempty"` 1186 // Script - the script to run. Please note that the maximum script size is 3 MB. 1187 Script *string `json:"script,omitempty"` 1188 // Type - Possible values include: 'TypeJobProperties', 'TypeUSQL', 'TypeHive' 1189 Type Type `json:"type,omitempty"` 1190} 1191 1192func unmarshalBasicProperties(body []byte) (BasicProperties, error) { 1193 var m map[string]interface{} 1194 err := json.Unmarshal(body, &m) 1195 if err != nil { 1196 return nil, err 1197 } 1198 1199 switch m["type"] { 1200 case string(TypeUSQL): 1201 var usjp USQLJobProperties 1202 err := json.Unmarshal(body, &usjp) 1203 return usjp, err 1204 case string(TypeHive): 1205 var hjp HiveJobProperties 1206 err := json.Unmarshal(body, &hjp) 1207 return hjp, err 1208 default: 1209 var p Properties 1210 err := json.Unmarshal(body, &p) 1211 return p, err 1212 } 1213} 1214func unmarshalBasicPropertiesArray(body []byte) ([]BasicProperties, error) { 1215 var rawMessages []*json.RawMessage 1216 err := json.Unmarshal(body, &rawMessages) 1217 if err != nil { 1218 return nil, err 1219 } 1220 1221 pArray := make([]BasicProperties, len(rawMessages)) 1222 1223 for index, rawMessage := range rawMessages { 1224 p, err := unmarshalBasicProperties(*rawMessage) 1225 if err != nil { 1226 return nil, err 1227 } 1228 pArray[index] = p 1229 } 1230 return pArray, nil 1231} 1232 1233// MarshalJSON is the custom marshaler for Properties. 1234func (p Properties) MarshalJSON() ([]byte, error) { 1235 p.Type = TypeJobProperties 1236 objectMap := make(map[string]interface{}) 1237 if p.RuntimeVersion != nil { 1238 objectMap["runtimeVersion"] = p.RuntimeVersion 1239 } 1240 if p.Script != nil { 1241 objectMap["script"] = p.Script 1242 } 1243 if p.Type != "" { 1244 objectMap["type"] = p.Type 1245 } 1246 return json.Marshal(objectMap) 1247} 1248 1249// AsUSQLJobProperties is the BasicProperties implementation for Properties. 1250func (p Properties) AsUSQLJobProperties() (*USQLJobProperties, bool) { 1251 return nil, false 1252} 1253 1254// AsHiveJobProperties is the BasicProperties implementation for Properties. 1255func (p Properties) AsHiveJobProperties() (*HiveJobProperties, bool) { 1256 return nil, false 1257} 1258 1259// AsProperties is the BasicProperties implementation for Properties. 1260func (p Properties) AsProperties() (*Properties, bool) { 1261 return &p, true 1262} 1263 1264// AsBasicProperties is the BasicProperties implementation for Properties. 1265func (p Properties) AsBasicProperties() (BasicProperties, bool) { 1266 return &p, true 1267} 1268 1269// RecurrenceInformation recurrence job information for a specific recurrence. 1270type RecurrenceInformation struct { 1271 autorest.Response `json:"-"` 1272 // 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. 1273 RecurrenceID *uuid.UUID `json:"recurrenceId,omitempty"` 1274 // RecurrenceName - the recurrence name, user friendly name for the correlation between jobs. 1275 RecurrenceName *string `json:"recurrenceName,omitempty"` 1276 // NumJobsFailed - the number of jobs in this recurrence that have failed. 1277 NumJobsFailed *int32 `json:"numJobsFailed,omitempty"` 1278 // NumJobsCanceled - the number of jobs in this recurrence that have been canceled. 1279 NumJobsCanceled *int32 `json:"numJobsCanceled,omitempty"` 1280 // NumJobsSucceeded - the number of jobs in this recurrence that have succeeded. 1281 NumJobsSucceeded *int32 `json:"numJobsSucceeded,omitempty"` 1282 // AuHoursFailed - the number of job execution hours that resulted in failed jobs. 1283 AuHoursFailed *float64 `json:"auHoursFailed,omitempty"` 1284 // AuHoursCanceled - the number of job execution hours that resulted in canceled jobs. 1285 AuHoursCanceled *float64 `json:"auHoursCanceled,omitempty"` 1286 // AuHoursSucceeded - the number of job execution hours that resulted in successful jobs. 1287 AuHoursSucceeded *float64 `json:"auHoursSucceeded,omitempty"` 1288 // LastSubmitTime - the last time a job in this recurrence was submitted. 1289 LastSubmitTime *date.Time `json:"lastSubmitTime,omitempty"` 1290} 1291 1292// RecurrenceInformationListResult list of job recurrence information items. 1293type RecurrenceInformationListResult struct { 1294 autorest.Response `json:"-"` 1295 // Value - the list of job recurrence information items. 1296 Value *[]RecurrenceInformation `json:"value,omitempty"` 1297 // NextLink - the link (url) to the next page of results. 1298 NextLink *string `json:"nextLink,omitempty"` 1299} 1300 1301// RecurrenceInformationListResultIterator provides access to a complete listing of RecurrenceInformation values. 1302type RecurrenceInformationListResultIterator struct { 1303 i int 1304 page RecurrenceInformationListResultPage 1305} 1306 1307// Next advances to the next value. If there was an error making 1308// the request the iterator does not advance and the error is returned. 1309func (iter *RecurrenceInformationListResultIterator) Next() error { 1310 iter.i++ 1311 if iter.i < len(iter.page.Values()) { 1312 return nil 1313 } 1314 err := iter.page.Next() 1315 if err != nil { 1316 iter.i-- 1317 return err 1318 } 1319 iter.i = 0 1320 return nil 1321} 1322 1323// NotDone returns true if the enumeration should be started or is not yet complete. 1324func (iter RecurrenceInformationListResultIterator) NotDone() bool { 1325 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1326} 1327 1328// Response returns the raw server response from the last page request. 1329func (iter RecurrenceInformationListResultIterator) Response() RecurrenceInformationListResult { 1330 return iter.page.Response() 1331} 1332 1333// Value returns the current value or a zero-initialized value if the 1334// iterator has advanced beyond the end of the collection. 1335func (iter RecurrenceInformationListResultIterator) Value() RecurrenceInformation { 1336 if !iter.page.NotDone() { 1337 return RecurrenceInformation{} 1338 } 1339 return iter.page.Values()[iter.i] 1340} 1341 1342// IsEmpty returns true if the ListResult contains no values. 1343func (rilr RecurrenceInformationListResult) IsEmpty() bool { 1344 return rilr.Value == nil || len(*rilr.Value) == 0 1345} 1346 1347// recurrenceInformationListResultPreparer prepares a request to retrieve the next set of results. 1348// It returns nil if no more results exist. 1349func (rilr RecurrenceInformationListResult) recurrenceInformationListResultPreparer() (*http.Request, error) { 1350 if rilr.NextLink == nil || len(to.String(rilr.NextLink)) < 1 { 1351 return nil, nil 1352 } 1353 return autorest.Prepare(&http.Request{}, 1354 autorest.AsJSON(), 1355 autorest.AsGet(), 1356 autorest.WithBaseURL(to.String(rilr.NextLink))) 1357} 1358 1359// RecurrenceInformationListResultPage contains a page of RecurrenceInformation values. 1360type RecurrenceInformationListResultPage struct { 1361 fn func(RecurrenceInformationListResult) (RecurrenceInformationListResult, error) 1362 rilr RecurrenceInformationListResult 1363} 1364 1365// Next advances to the next page of values. If there was an error making 1366// the request the page does not advance and the error is returned. 1367func (page *RecurrenceInformationListResultPage) Next() error { 1368 next, err := page.fn(page.rilr) 1369 if err != nil { 1370 return err 1371 } 1372 page.rilr = next 1373 return nil 1374} 1375 1376// NotDone returns true if the page enumeration should be started or is not yet complete. 1377func (page RecurrenceInformationListResultPage) NotDone() bool { 1378 return !page.rilr.IsEmpty() 1379} 1380 1381// Response returns the raw server response from the last page request. 1382func (page RecurrenceInformationListResultPage) Response() RecurrenceInformationListResult { 1383 return page.rilr 1384} 1385 1386// Values returns the slice of values for the current page or nil if there are no values. 1387func (page RecurrenceInformationListResultPage) Values() []RecurrenceInformation { 1388 if page.rilr.IsEmpty() { 1389 return nil 1390 } 1391 return *page.rilr.Value 1392} 1393 1394// RelationshipProperties job relationship information properties including pipeline information, correlation 1395// information, etc. 1396type RelationshipProperties struct { 1397 // PipelineID - the job relationship pipeline identifier (a GUID). 1398 PipelineID *uuid.UUID `json:"pipelineId,omitempty"` 1399 // PipelineName - the friendly name of the job relationship pipeline, which does not need to be unique. 1400 PipelineName *string `json:"pipelineName,omitempty"` 1401 // PipelineURI - the pipeline uri, unique, links to the originating service for this pipeline. 1402 PipelineURI *string `json:"pipelineUri,omitempty"` 1403 // RunID - the run identifier (a GUID), unique identifier of the iteration of this pipeline. 1404 RunID *uuid.UUID `json:"runId,omitempty"` 1405 // 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. 1406 RecurrenceID *uuid.UUID `json:"recurrenceId,omitempty"` 1407 // RecurrenceName - the recurrence name, user friendly name for the correlation between jobs. 1408 RecurrenceName *string `json:"recurrenceName,omitempty"` 1409} 1410 1411// Resource the Data Lake Analytics job resources. 1412type Resource struct { 1413 // Name - the name of the resource. 1414 Name *string `json:"name,omitempty"` 1415 // ResourcePath - the path to the resource. 1416 ResourcePath *string `json:"resourcePath,omitempty"` 1417 // Type - the job resource type. Possible values include: 'VertexResource', 'JobManagerResource', 'StatisticsResource', 'VertexResourceInUserFolder', 'JobManagerResourceInUserFolder', 'StatisticsResourceInUserFolder' 1418 Type ResourceType `json:"type,omitempty"` 1419} 1420 1421// StateAuditRecord the Data Lake Analytics job state audit records for tracking the lifecycle of a job. 1422type StateAuditRecord struct { 1423 // NewState - the new state the job is in. 1424 NewState *string `json:"newState,omitempty"` 1425 // TimeStamp - the time stamp that the state change took place. 1426 TimeStamp *date.Time `json:"timeStamp,omitempty"` 1427 // RequestedByUser - the user who requests the change. 1428 RequestedByUser *string `json:"requestedByUser,omitempty"` 1429 // Details - the details of the audit log. 1430 Details *string `json:"details,omitempty"` 1431} 1432 1433// Statistics the Data Lake Analytics job execution statistics. 1434type Statistics struct { 1435 autorest.Response `json:"-"` 1436 // LastUpdateTimeUtc - the last update time for the statistics. 1437 LastUpdateTimeUtc *date.Time `json:"lastUpdateTimeUtc,omitempty"` 1438 // FinalizingTimeUtc - the job finalizing start time. 1439 FinalizingTimeUtc *date.Time `json:"finalizingTimeUtc,omitempty"` 1440 // Stages - the list of stages for the job. 1441 Stages *[]StatisticsVertexStage `json:"stages,omitempty"` 1442} 1443 1444// StatisticsVertexStage the Data Lake Analytics job statistics vertex stage information. 1445type StatisticsVertexStage struct { 1446 // DataRead - the amount of data read, in bytes. 1447 DataRead *int64 `json:"dataRead,omitempty"` 1448 // DataReadCrossPod - the amount of data read across multiple pods, in bytes. 1449 DataReadCrossPod *int64 `json:"dataReadCrossPod,omitempty"` 1450 // DataReadIntraPod - the amount of data read in one pod, in bytes. 1451 DataReadIntraPod *int64 `json:"dataReadIntraPod,omitempty"` 1452 // DataToRead - the amount of data remaining to be read, in bytes. 1453 DataToRead *int64 `json:"dataToRead,omitempty"` 1454 // DataWritten - the amount of data written, in bytes. 1455 DataWritten *int64 `json:"dataWritten,omitempty"` 1456 // DuplicateDiscardCount - the number of duplicates that were discarded. 1457 DuplicateDiscardCount *int32 `json:"duplicateDiscardCount,omitempty"` 1458 // FailedCount - the number of failures that occured in this stage. 1459 FailedCount *int32 `json:"failedCount,omitempty"` 1460 // MaxVertexDataRead - the maximum amount of data read in a single vertex, in bytes. 1461 MaxVertexDataRead *int64 `json:"maxVertexDataRead,omitempty"` 1462 // MinVertexDataRead - the minimum amount of data read in a single vertex, in bytes. 1463 MinVertexDataRead *int64 `json:"minVertexDataRead,omitempty"` 1464 // ReadFailureCount - the number of read failures in this stage. 1465 ReadFailureCount *int32 `json:"readFailureCount,omitempty"` 1466 // RevocationCount - the number of vertices that were revoked during this stage. 1467 RevocationCount *int32 `json:"revocationCount,omitempty"` 1468 // RunningCount - the number of currently running vertices in this stage. 1469 RunningCount *int32 `json:"runningCount,omitempty"` 1470 // ScheduledCount - the number of currently scheduled vertices in this stage 1471 ScheduledCount *int32 `json:"scheduledCount,omitempty"` 1472 // StageName - the name of this stage in job execution. 1473 StageName *string `json:"stageName,omitempty"` 1474 // SucceededCount - the number of vertices that succeeded in this stage. 1475 SucceededCount *int32 `json:"succeededCount,omitempty"` 1476 // TempDataWritten - the amount of temporary data written, in bytes. 1477 TempDataWritten *int64 `json:"tempDataWritten,omitempty"` 1478 // TotalCount - the total vertex count for this stage. 1479 TotalCount *int32 `json:"totalCount,omitempty"` 1480 // TotalFailedTime - the amount of time that failed vertices took up in this stage. 1481 TotalFailedTime *string `json:"totalFailedTime,omitempty"` 1482 // TotalProgress - the current progress of this stage, as a percentage. 1483 TotalProgress *int32 `json:"totalProgress,omitempty"` 1484 // TotalSucceededTime - the amount of time all successful vertices took in this stage. 1485 TotalSucceededTime *string `json:"totalSucceededTime,omitempty"` 1486} 1487 1488// USQLJobProperties u-SQL job properties used when retrieving U-SQL jobs. 1489type USQLJobProperties struct { 1490 // Resources - the list of resources that are required by the job 1491 Resources *[]Resource `json:"resources,omitempty"` 1492 // Statistics - the job specific statistics. 1493 Statistics *Statistics `json:"statistics,omitempty"` 1494 // DebugData - the job specific debug data locations. 1495 DebugData *DataPath `json:"debugData,omitempty"` 1496 // Diagnostics - the diagnostics for the job. 1497 Diagnostics *[]Diagnostics `json:"diagnostics,omitempty"` 1498 // AlgebraFilePath - the algebra file path after the job has completed 1499 AlgebraFilePath *string `json:"algebraFilePath,omitempty"` 1500 // TotalCompilationTime - the total time this job spent compiling. This value should not be set by the user and will be ignored if it is. 1501 TotalCompilationTime *string `json:"totalCompilationTime,omitempty"` 1502 // TotalPauseTime - the total time this job spent paused. This value should not be set by the user and will be ignored if it is. 1503 TotalPauseTime *string `json:"totalPauseTime,omitempty"` 1504 // TotalQueuedTime - the total time this job spent queued. This value should not be set by the user and will be ignored if it is. 1505 TotalQueuedTime *string `json:"totalQueuedTime,omitempty"` 1506 // TotalRunningTime - the total time this job spent executing. This value should not be set by the user and will be ignored if it is. 1507 TotalRunningTime *string `json:"totalRunningTime,omitempty"` 1508 // 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. 1509 RootProcessNodeID *string `json:"rootProcessNodeId,omitempty"` 1510 // 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. 1511 YarnApplicationID *string `json:"yarnApplicationId,omitempty"` 1512 // 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. 1513 YarnApplicationTimeStamp *int64 `json:"yarnApplicationTimeStamp,omitempty"` 1514 // 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' 1515 CompileMode CompileMode `json:"compileMode,omitempty"` 1516 // RuntimeVersion - the runtime version of the Data Lake Analytics engine to use for the specific type of job being run. 1517 RuntimeVersion *string `json:"runtimeVersion,omitempty"` 1518 // Script - the script to run. Please note that the maximum script size is 3 MB. 1519 Script *string `json:"script,omitempty"` 1520 // Type - Possible values include: 'TypeJobProperties', 'TypeUSQL', 'TypeHive' 1521 Type Type `json:"type,omitempty"` 1522} 1523 1524// MarshalJSON is the custom marshaler for USQLJobProperties. 1525func (usjp USQLJobProperties) MarshalJSON() ([]byte, error) { 1526 usjp.Type = TypeUSQL 1527 objectMap := make(map[string]interface{}) 1528 if usjp.Resources != nil { 1529 objectMap["resources"] = usjp.Resources 1530 } 1531 if usjp.Statistics != nil { 1532 objectMap["statistics"] = usjp.Statistics 1533 } 1534 if usjp.DebugData != nil { 1535 objectMap["debugData"] = usjp.DebugData 1536 } 1537 if usjp.Diagnostics != nil { 1538 objectMap["diagnostics"] = usjp.Diagnostics 1539 } 1540 if usjp.AlgebraFilePath != nil { 1541 objectMap["algebraFilePath"] = usjp.AlgebraFilePath 1542 } 1543 if usjp.TotalCompilationTime != nil { 1544 objectMap["totalCompilationTime"] = usjp.TotalCompilationTime 1545 } 1546 if usjp.TotalPauseTime != nil { 1547 objectMap["totalPauseTime"] = usjp.TotalPauseTime 1548 } 1549 if usjp.TotalQueuedTime != nil { 1550 objectMap["totalQueuedTime"] = usjp.TotalQueuedTime 1551 } 1552 if usjp.TotalRunningTime != nil { 1553 objectMap["totalRunningTime"] = usjp.TotalRunningTime 1554 } 1555 if usjp.RootProcessNodeID != nil { 1556 objectMap["rootProcessNodeId"] = usjp.RootProcessNodeID 1557 } 1558 if usjp.YarnApplicationID != nil { 1559 objectMap["yarnApplicationId"] = usjp.YarnApplicationID 1560 } 1561 if usjp.YarnApplicationTimeStamp != nil { 1562 objectMap["yarnApplicationTimeStamp"] = usjp.YarnApplicationTimeStamp 1563 } 1564 if usjp.CompileMode != "" { 1565 objectMap["compileMode"] = usjp.CompileMode 1566 } 1567 if usjp.RuntimeVersion != nil { 1568 objectMap["runtimeVersion"] = usjp.RuntimeVersion 1569 } 1570 if usjp.Script != nil { 1571 objectMap["script"] = usjp.Script 1572 } 1573 if usjp.Type != "" { 1574 objectMap["type"] = usjp.Type 1575 } 1576 return json.Marshal(objectMap) 1577} 1578 1579// AsUSQLJobProperties is the BasicProperties implementation for USQLJobProperties. 1580func (usjp USQLJobProperties) AsUSQLJobProperties() (*USQLJobProperties, bool) { 1581 return &usjp, true 1582} 1583 1584// AsHiveJobProperties is the BasicProperties implementation for USQLJobProperties. 1585func (usjp USQLJobProperties) AsHiveJobProperties() (*HiveJobProperties, bool) { 1586 return nil, false 1587} 1588 1589// AsProperties is the BasicProperties implementation for USQLJobProperties. 1590func (usjp USQLJobProperties) AsProperties() (*Properties, bool) { 1591 return nil, false 1592} 1593 1594// AsBasicProperties is the BasicProperties implementation for USQLJobProperties. 1595func (usjp USQLJobProperties) AsBasicProperties() (BasicProperties, bool) { 1596 return &usjp, true 1597} 1598