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 "context" 22 "encoding/json" 23 "github.com/Azure/go-autorest/autorest" 24 "github.com/Azure/go-autorest/autorest/date" 25 "github.com/Azure/go-autorest/autorest/to" 26 "github.com/Azure/go-autorest/tracing" 27 "github.com/satori/go.uuid" 28 "net/http" 29) 30 31// The package's fully qualified name. 32const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/datalake/analytics/2015-11-01-preview/job" 33 34// CompileMode enumerates the values for compile mode. 35type CompileMode string 36 37const ( 38 // Full ... 39 Full CompileMode = "Full" 40 // Semantic ... 41 Semantic CompileMode = "Semantic" 42 // SingleBox ... 43 SingleBox CompileMode = "SingleBox" 44) 45 46// PossibleCompileModeValues returns an array of possible values for the CompileMode const type. 47func PossibleCompileModeValues() []CompileMode { 48 return []CompileMode{Full, Semantic, SingleBox} 49} 50 51// ResourceType enumerates the values for resource type. 52type ResourceType string 53 54const ( 55 // StatisticsResource ... 56 StatisticsResource ResourceType = "StatisticsResource" 57 // VertexResource ... 58 VertexResource ResourceType = "VertexResource" 59) 60 61// PossibleResourceTypeValues returns an array of possible values for the ResourceType const type. 62func PossibleResourceTypeValues() []ResourceType { 63 return []ResourceType{StatisticsResource, VertexResource} 64} 65 66// Result enumerates the values for result. 67type Result string 68 69const ( 70 // Cancelled ... 71 Cancelled Result = "Cancelled" 72 // Failed ... 73 Failed Result = "Failed" 74 // None ... 75 None Result = "None" 76 // Succeeded ... 77 Succeeded Result = "Succeeded" 78) 79 80// PossibleResultValues returns an array of possible values for the Result const type. 81func PossibleResultValues() []Result { 82 return []Result{Cancelled, Failed, None, Succeeded} 83} 84 85// SeverityTypes enumerates the values for severity types. 86type SeverityTypes string 87 88const ( 89 // Error ... 90 Error SeverityTypes = "Error" 91 // Warning ... 92 Warning SeverityTypes = "Warning" 93) 94 95// PossibleSeverityTypesValues returns an array of possible values for the SeverityTypes const type. 96func PossibleSeverityTypesValues() []SeverityTypes { 97 return []SeverityTypes{Error, Warning} 98} 99 100// State enumerates the values for state. 101type State string 102 103const ( 104 // StateAccepted ... 105 StateAccepted State = "Accepted" 106 // StateCompiling ... 107 StateCompiling State = "Compiling" 108 // StateEnded ... 109 StateEnded State = "Ended" 110 // StateNew ... 111 StateNew State = "New" 112 // StatePaused ... 113 StatePaused State = "Paused" 114 // StateQueued ... 115 StateQueued State = "Queued" 116 // StateRunning ... 117 StateRunning State = "Running" 118 // StateScheduling ... 119 StateScheduling State = "Scheduling" 120 // StateStarting ... 121 StateStarting State = "Starting" 122 // StateWaitingForCapacity ... 123 StateWaitingForCapacity State = "WaitingForCapacity" 124) 125 126// PossibleStateValues returns an array of possible values for the State const type. 127func PossibleStateValues() []State { 128 return []State{StateAccepted, StateCompiling, StateEnded, StateNew, StatePaused, StateQueued, StateRunning, StateScheduling, StateStarting, StateWaitingForCapacity} 129} 130 131// Type enumerates the values for type. 132type Type string 133 134const ( 135 // TypeHive ... 136 TypeHive Type = "Hive" 137 // TypeJobProperties ... 138 TypeJobProperties Type = "JobProperties" 139 // TypeUSQL ... 140 TypeUSQL Type = "USql" 141) 142 143// PossibleTypeValues returns an array of possible values for the Type const type. 144func PossibleTypeValues() []Type { 145 return []Type{TypeHive, TypeJobProperties, TypeUSQL} 146} 147 148// TypeEnum enumerates the values for type enum. 149type TypeEnum string 150 151const ( 152 // Hive ... 153 Hive TypeEnum = "Hive" 154 // USQL ... 155 USQL TypeEnum = "USql" 156) 157 158// PossibleTypeEnumValues returns an array of possible values for the TypeEnum const type. 159func PossibleTypeEnumValues() []TypeEnum { 160 return []TypeEnum{Hive, USQL} 161} 162 163// DataPath a Data Lake Analytics U-SQL job data path item. 164type DataPath struct { 165 autorest.Response `json:"-"` 166 // JobID - READ-ONLY; Gets the id of the job this data is for. 167 JobID *uuid.UUID `json:"jobId,omitempty"` 168 // Command - READ-ONLY; Gets the command that this job data relates to. 169 Command *string `json:"command,omitempty"` 170 // Paths - READ-ONLY; Gets the list of paths to all of the job data. 171 Paths *[]string `json:"paths,omitempty"` 172} 173 174// ErrorDetails the Data Lake Analytics job error details. 175type ErrorDetails struct { 176 // Description - READ-ONLY; Gets the error message description 177 Description *string `json:"description,omitempty"` 178 // Details - READ-ONLY; Gets the details of the error message. 179 Details *string `json:"details,omitempty"` 180 // EndOffset - READ-ONLY; Gets the end offset in the job where the error was found. 181 EndOffset *int32 `json:"endOffset,omitempty"` 182 // ErrorID - READ-ONLY; Gets the specific identifier for the type of error encountered in the job. 183 ErrorID *string `json:"errorId,omitempty"` 184 // FilePath - READ-ONLY; Gets the path to any supplemental error files, if any. 185 FilePath *string `json:"filePath,omitempty"` 186 // HelpLink - READ-ONLY; Gets the link to MSDN or Azure help for this type of error, if any. 187 HelpLink *string `json:"helpLink,omitempty"` 188 // InternalDiagnostics - READ-ONLY; Gets 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. 189 InternalDiagnostics *string `json:"internalDiagnostics,omitempty"` 190 // LineNumber - READ-ONLY; Gets the specific line number in the job where the error occurred. 191 LineNumber *int32 `json:"lineNumber,omitempty"` 192 // Message - READ-ONLY; Gets the user friendly error message for the failure. 193 Message *string `json:"message,omitempty"` 194 // Resolution - READ-ONLY; Gets the recommended resolution for the failure, if any. 195 Resolution *string `json:"resolution,omitempty"` 196 // InnerError - READ-ONLY; Gets the inner error of this specific job error message, if any. 197 InnerError *InnerError `json:"InnerError,omitempty"` 198 // Severity - READ-ONLY; Gets the severity level of the failure. Possible values include: 'Warning', 'Error' 199 Severity SeverityTypes `json:"severity,omitempty"` 200 // Source - READ-ONLY; Gets the ultimate source of the failure (usually either SYSTEM or USER). 201 Source *string `json:"source,omitempty"` 202 // StartOffset - READ-ONLY; Gets the start offset in the job where the error was found 203 StartOffset *int32 `json:"startOffset,omitempty"` 204} 205 206// HiveJobProperties ... 207type HiveJobProperties struct { 208 // StatementInfo - Gets or sets the statement information for each statement in the script 209 StatementInfo *[]HiveJobStatementInfo `json:"statementInfo,omitempty"` 210 // LogsLocation - Gets or sets the Hive logs location 211 LogsLocation *string `json:"logsLocation,omitempty"` 212 // WarehouseLocation - Gets or sets the runtime version of the U-SQL engine to use 213 WarehouseLocation *string `json:"warehouseLocation,omitempty"` 214 // StatementCount - Gets or sets the number of statements that will be run based on the script 215 StatementCount *int32 `json:"statementCount,omitempty"` 216 // ExecutedStatementCount - Gets or sets the number of statements that have been run based on the script 217 ExecutedStatementCount *int32 `json:"executedStatementCount,omitempty"` 218 // RuntimeVersion - Gets or sets the runtime version of the U-SQL engine to use 219 RuntimeVersion *string `json:"runtimeVersion,omitempty"` 220 // Script - Gets or sets the U-SQL script to run 221 Script *string `json:"script,omitempty"` 222 // Type - Possible values include: 'TypeJobProperties', 'TypeUSQL', 'TypeHive' 223 Type Type `json:"type,omitempty"` 224} 225 226// MarshalJSON is the custom marshaler for HiveJobProperties. 227func (hjp HiveJobProperties) MarshalJSON() ([]byte, error) { 228 hjp.Type = TypeHive 229 objectMap := make(map[string]interface{}) 230 if hjp.StatementInfo != nil { 231 objectMap["statementInfo"] = hjp.StatementInfo 232 } 233 if hjp.LogsLocation != nil { 234 objectMap["logsLocation"] = hjp.LogsLocation 235 } 236 if hjp.WarehouseLocation != nil { 237 objectMap["warehouseLocation"] = hjp.WarehouseLocation 238 } 239 if hjp.StatementCount != nil { 240 objectMap["statementCount"] = hjp.StatementCount 241 } 242 if hjp.ExecutedStatementCount != nil { 243 objectMap["executedStatementCount"] = hjp.ExecutedStatementCount 244 } 245 if hjp.RuntimeVersion != nil { 246 objectMap["runtimeVersion"] = hjp.RuntimeVersion 247 } 248 if hjp.Script != nil { 249 objectMap["script"] = hjp.Script 250 } 251 if hjp.Type != "" { 252 objectMap["type"] = hjp.Type 253 } 254 return json.Marshal(objectMap) 255} 256 257// AsUSQLJobProperties is the BasicProperties implementation for HiveJobProperties. 258func (hjp HiveJobProperties) AsUSQLJobProperties() (*USQLJobProperties, bool) { 259 return nil, false 260} 261 262// AsHiveJobProperties is the BasicProperties implementation for HiveJobProperties. 263func (hjp HiveJobProperties) AsHiveJobProperties() (*HiveJobProperties, bool) { 264 return &hjp, true 265} 266 267// AsProperties is the BasicProperties implementation for HiveJobProperties. 268func (hjp HiveJobProperties) AsProperties() (*Properties, bool) { 269 return nil, false 270} 271 272// AsBasicProperties is the BasicProperties implementation for HiveJobProperties. 273func (hjp HiveJobProperties) AsBasicProperties() (BasicProperties, bool) { 274 return &hjp, true 275} 276 277// HiveJobStatementInfo ... 278type HiveJobStatementInfo struct { 279 // LogLocation - Gets or sets the log location for this statement. 280 LogLocation *string `json:"logLocation,omitempty"` 281 // ResultPreviewLocation - Gets or sets the result preview location for this statement. 282 ResultPreviewLocation *string `json:"resultPreviewLocation,omitempty"` 283 // ResultLocation - Gets or sets the result location for this statement. 284 ResultLocation *string `json:"resultLocation,omitempty"` 285 // ErrorMessage - Gets or sets the error message for this statement. 286 ErrorMessage *string `json:"errorMessage,omitempty"` 287} 288 289// InfoListResult list of jobInfo items. 290type InfoListResult struct { 291 autorest.Response `json:"-"` 292 // Value - READ-ONLY; Gets the list of jobInfo items. 293 Value *[]Information `json:"value,omitempty"` 294 // NextLink - READ-ONLY; Gets the link (url) to the next page of results. 295 NextLink *string `json:"nextLink,omitempty"` 296 // Count - READ-ONLY; Gets the total count of results that are available, but might not be returned in the current page. 297 Count *int64 `json:"count,omitempty"` 298} 299 300// InfoListResultIterator provides access to a complete listing of Information values. 301type InfoListResultIterator struct { 302 i int 303 page InfoListResultPage 304} 305 306// NextWithContext advances to the next value. If there was an error making 307// the request the iterator does not advance and the error is returned. 308func (iter *InfoListResultIterator) NextWithContext(ctx context.Context) (err error) { 309 if tracing.IsEnabled() { 310 ctx = tracing.StartSpan(ctx, fqdn+"/InfoListResultIterator.NextWithContext") 311 defer func() { 312 sc := -1 313 if iter.Response().Response.Response != nil { 314 sc = iter.Response().Response.Response.StatusCode 315 } 316 tracing.EndSpan(ctx, sc, err) 317 }() 318 } 319 iter.i++ 320 if iter.i < len(iter.page.Values()) { 321 return nil 322 } 323 err = iter.page.NextWithContext(ctx) 324 if err != nil { 325 iter.i-- 326 return err 327 } 328 iter.i = 0 329 return nil 330} 331 332// Next advances to the next value. If there was an error making 333// the request the iterator does not advance and the error is returned. 334// Deprecated: Use NextWithContext() instead. 335func (iter *InfoListResultIterator) Next() error { 336 return iter.NextWithContext(context.Background()) 337} 338 339// NotDone returns true if the enumeration should be started or is not yet complete. 340func (iter InfoListResultIterator) NotDone() bool { 341 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 342} 343 344// Response returns the raw server response from the last page request. 345func (iter InfoListResultIterator) Response() InfoListResult { 346 return iter.page.Response() 347} 348 349// Value returns the current value or a zero-initialized value if the 350// iterator has advanced beyond the end of the collection. 351func (iter InfoListResultIterator) Value() Information { 352 if !iter.page.NotDone() { 353 return Information{} 354 } 355 return iter.page.Values()[iter.i] 356} 357 358// Creates a new instance of the InfoListResultIterator type. 359func NewInfoListResultIterator(page InfoListResultPage) InfoListResultIterator { 360 return InfoListResultIterator{page: page} 361} 362 363// IsEmpty returns true if the ListResult contains no values. 364func (ilr InfoListResult) IsEmpty() bool { 365 return ilr.Value == nil || len(*ilr.Value) == 0 366} 367 368// infoListResultPreparer prepares a request to retrieve the next set of results. 369// It returns nil if no more results exist. 370func (ilr InfoListResult) infoListResultPreparer(ctx context.Context) (*http.Request, error) { 371 if ilr.NextLink == nil || len(to.String(ilr.NextLink)) < 1 { 372 return nil, nil 373 } 374 return autorest.Prepare((&http.Request{}).WithContext(ctx), 375 autorest.AsJSON(), 376 autorest.AsGet(), 377 autorest.WithBaseURL(to.String(ilr.NextLink))) 378} 379 380// InfoListResultPage contains a page of Information values. 381type InfoListResultPage struct { 382 fn func(context.Context, InfoListResult) (InfoListResult, error) 383 ilr InfoListResult 384} 385 386// NextWithContext advances to the next page of values. If there was an error making 387// the request the page does not advance and the error is returned. 388func (page *InfoListResultPage) NextWithContext(ctx context.Context) (err error) { 389 if tracing.IsEnabled() { 390 ctx = tracing.StartSpan(ctx, fqdn+"/InfoListResultPage.NextWithContext") 391 defer func() { 392 sc := -1 393 if page.Response().Response.Response != nil { 394 sc = page.Response().Response.Response.StatusCode 395 } 396 tracing.EndSpan(ctx, sc, err) 397 }() 398 } 399 next, err := page.fn(ctx, page.ilr) 400 if err != nil { 401 return err 402 } 403 page.ilr = next 404 return nil 405} 406 407// Next advances to the next page of values. If there was an error making 408// the request the page does not advance and the error is returned. 409// Deprecated: Use NextWithContext() instead. 410func (page *InfoListResultPage) Next() error { 411 return page.NextWithContext(context.Background()) 412} 413 414// NotDone returns true if the page enumeration should be started or is not yet complete. 415func (page InfoListResultPage) NotDone() bool { 416 return !page.ilr.IsEmpty() 417} 418 419// Response returns the raw server response from the last page request. 420func (page InfoListResultPage) Response() InfoListResult { 421 return page.ilr 422} 423 424// Values returns the slice of values for the current page or nil if there are no values. 425func (page InfoListResultPage) Values() []Information { 426 if page.ilr.IsEmpty() { 427 return nil 428 } 429 return *page.ilr.Value 430} 431 432// Creates a new instance of the InfoListResultPage type. 433func NewInfoListResultPage(getNextPage func(context.Context, InfoListResult) (InfoListResult, error)) InfoListResultPage { 434 return InfoListResultPage{fn: getNextPage} 435} 436 437// Information the common Data Lake Analytics job information properties. 438type Information struct { 439 autorest.Response `json:"-"` 440 // JobID - Gets or sets the job's unique identifier (a GUID). 441 JobID *uuid.UUID `json:"jobId,omitempty"` 442 // Name - Gets or sets the friendly name of the job. 443 Name *string `json:"name,omitempty"` 444 // Type - Gets or sets the job type of the current job (Hive or USql). Possible values include: 'USQL', 'Hive' 445 Type TypeEnum `json:"type,omitempty"` 446 // Submitter - Gets or sets the user or account that submitted the job. 447 Submitter *string `json:"submitter,omitempty"` 448 // ErrorMessage - READ-ONLY; Gets the error message details for the job, if the job failed. 449 ErrorMessage *[]ErrorDetails `json:"errorMessage,omitempty"` 450 // DegreeOfParallelism - Gets or sets the degree of parallelism used for this job. This must be greater than 0. 451 DegreeOfParallelism *int32 `json:"degreeOfParallelism,omitempty"` 452 // DegreeOfParallelismPercent - the degree of parallelism in percentage used for this job. 453 DegreeOfParallelismPercent *float64 `json:"degreeOfParallelismPercent,omitempty"` 454 // Priority - Gets or sets 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. 455 Priority *int32 `json:"priority,omitempty"` 456 // SubmitTime - READ-ONLY; Gets the time the job was submitted to the service. 457 SubmitTime *date.Time `json:"submitTime,omitempty"` 458 // StartTime - READ-ONLY; Gets the start time of the job. 459 StartTime *date.Time `json:"startTime,omitempty"` 460 // EndTime - READ-ONLY; Gets the completion time of the job. 461 EndTime *date.Time `json:"endTime,omitempty"` 462 // State - READ-ONLY; Gets 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' 463 State State `json:"state,omitempty"` 464 // Result - READ-ONLY; Gets the result of job execution or the current result of the running job. Possible values include: 'None', 'Succeeded', 'Cancelled', 'Failed' 465 Result Result `json:"result,omitempty"` 466 // StateAuditRecords - READ-ONLY; Gets the job state audit records, indicating when various operations have been performed on this job. 467 StateAuditRecords *[]StateAuditRecord `json:"stateAuditRecords,omitempty"` 468 // HierarchyQueueNode - READ-ONLY; 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. 469 HierarchyQueueNode *string `json:"hierarchyQueueNode,omitempty"` 470 // Properties - Gets or sets the job specific properties. 471 Properties BasicProperties `json:"properties,omitempty"` 472} 473 474// UnmarshalJSON is the custom unmarshaler for Information struct. 475func (i *Information) UnmarshalJSON(body []byte) error { 476 var m map[string]*json.RawMessage 477 err := json.Unmarshal(body, &m) 478 if err != nil { 479 return err 480 } 481 for k, v := range m { 482 switch k { 483 case "jobId": 484 if v != nil { 485 var jobID uuid.UUID 486 err = json.Unmarshal(*v, &jobID) 487 if err != nil { 488 return err 489 } 490 i.JobID = &jobID 491 } 492 case "name": 493 if v != nil { 494 var name string 495 err = json.Unmarshal(*v, &name) 496 if err != nil { 497 return err 498 } 499 i.Name = &name 500 } 501 case "type": 502 if v != nil { 503 var typeVar TypeEnum 504 err = json.Unmarshal(*v, &typeVar) 505 if err != nil { 506 return err 507 } 508 i.Type = typeVar 509 } 510 case "submitter": 511 if v != nil { 512 var submitter string 513 err = json.Unmarshal(*v, &submitter) 514 if err != nil { 515 return err 516 } 517 i.Submitter = &submitter 518 } 519 case "errorMessage": 520 if v != nil { 521 var errorMessage []ErrorDetails 522 err = json.Unmarshal(*v, &errorMessage) 523 if err != nil { 524 return err 525 } 526 i.ErrorMessage = &errorMessage 527 } 528 case "degreeOfParallelism": 529 if v != nil { 530 var degreeOfParallelism int32 531 err = json.Unmarshal(*v, °reeOfParallelism) 532 if err != nil { 533 return err 534 } 535 i.DegreeOfParallelism = °reeOfParallelism 536 } 537 case "degreeOfParallelismPercent": 538 if v != nil { 539 var degreeOfParallelismPercent float64 540 err = json.Unmarshal(*v, °reeOfParallelismPercent) 541 if err != nil { 542 return err 543 } 544 i.DegreeOfParallelismPercent = °reeOfParallelismPercent 545 } 546 case "priority": 547 if v != nil { 548 var priority int32 549 err = json.Unmarshal(*v, &priority) 550 if err != nil { 551 return err 552 } 553 i.Priority = &priority 554 } 555 case "submitTime": 556 if v != nil { 557 var submitTime date.Time 558 err = json.Unmarshal(*v, &submitTime) 559 if err != nil { 560 return err 561 } 562 i.SubmitTime = &submitTime 563 } 564 case "startTime": 565 if v != nil { 566 var startTime date.Time 567 err = json.Unmarshal(*v, &startTime) 568 if err != nil { 569 return err 570 } 571 i.StartTime = &startTime 572 } 573 case "endTime": 574 if v != nil { 575 var endTime date.Time 576 err = json.Unmarshal(*v, &endTime) 577 if err != nil { 578 return err 579 } 580 i.EndTime = &endTime 581 } 582 case "state": 583 if v != nil { 584 var state State 585 err = json.Unmarshal(*v, &state) 586 if err != nil { 587 return err 588 } 589 i.State = state 590 } 591 case "result": 592 if v != nil { 593 var resultVar Result 594 err = json.Unmarshal(*v, &resultVar) 595 if err != nil { 596 return err 597 } 598 i.Result = resultVar 599 } 600 case "stateAuditRecords": 601 if v != nil { 602 var stateAuditRecords []StateAuditRecord 603 err = json.Unmarshal(*v, &stateAuditRecords) 604 if err != nil { 605 return err 606 } 607 i.StateAuditRecords = &stateAuditRecords 608 } 609 case "hierarchyQueueNode": 610 if v != nil { 611 var hierarchyQueueNode string 612 err = json.Unmarshal(*v, &hierarchyQueueNode) 613 if err != nil { 614 return err 615 } 616 i.HierarchyQueueNode = &hierarchyQueueNode 617 } 618 case "properties": 619 if v != nil { 620 properties, err := unmarshalBasicProperties(*v) 621 if err != nil { 622 return err 623 } 624 i.Properties = properties 625 } 626 } 627 } 628 629 return nil 630} 631 632// InnerError the Data Lake Analytics job error details. 633type InnerError struct { 634 // DiagnosticCode - READ-ONLY; Gets the diagnostic error code. 635 DiagnosticCode *int32 `json:"diagnosticCode,omitempty"` 636 // Severity - READ-ONLY; Gets the severity level of the failure. Possible values include: 'Warning', 'Error' 637 Severity SeverityTypes `json:"severity,omitempty"` 638 // Details - READ-ONLY; Gets the details of the error message. 639 Details *string `json:"details,omitempty"` 640 // Component - READ-ONLY; Gets the component that failed. 641 Component *string `json:"component,omitempty"` 642 // ErrorID - READ-ONLY; Gets the specific identifier for the type of error encountered in the job. 643 ErrorID *string `json:"errorId,omitempty"` 644 // HelpLink - READ-ONLY; Gets the link to MSDN or Azure help for this type of error, if any. 645 HelpLink *string `json:"helpLink,omitempty"` 646 // InternalDiagnostics - READ-ONLY; Gets 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. 647 InternalDiagnostics *string `json:"internalDiagnostics,omitempty"` 648 // Message - READ-ONLY; Gets the user friendly error message for the failure. 649 Message *string `json:"message,omitempty"` 650 // Resolution - READ-ONLY; Gets the recommended resolution for the failure, if any. 651 Resolution *string `json:"resolution,omitempty"` 652 // Source - READ-ONLY; Gets the ultimate source of the failure (usually either SYSTEM or USER). 653 Source *string `json:"source,omitempty"` 654 // Description - READ-ONLY; Gets the error message description 655 Description *string `json:"description,omitempty"` 656} 657 658// BasicProperties the common Data Lake Analytics job properties. 659type BasicProperties interface { 660 AsUSQLJobProperties() (*USQLJobProperties, bool) 661 AsHiveJobProperties() (*HiveJobProperties, bool) 662 AsProperties() (*Properties, bool) 663} 664 665// Properties the common Data Lake Analytics job properties. 666type Properties struct { 667 // RuntimeVersion - Gets or sets the runtime version of the U-SQL engine to use 668 RuntimeVersion *string `json:"runtimeVersion,omitempty"` 669 // Script - Gets or sets the U-SQL script to run 670 Script *string `json:"script,omitempty"` 671 // Type - Possible values include: 'TypeJobProperties', 'TypeUSQL', 'TypeHive' 672 Type Type `json:"type,omitempty"` 673} 674 675func unmarshalBasicProperties(body []byte) (BasicProperties, error) { 676 var m map[string]interface{} 677 err := json.Unmarshal(body, &m) 678 if err != nil { 679 return nil, err 680 } 681 682 switch m["type"] { 683 case string(TypeUSQL): 684 var usjp USQLJobProperties 685 err := json.Unmarshal(body, &usjp) 686 return usjp, err 687 case string(TypeHive): 688 var hjp HiveJobProperties 689 err := json.Unmarshal(body, &hjp) 690 return hjp, err 691 default: 692 var p Properties 693 err := json.Unmarshal(body, &p) 694 return p, err 695 } 696} 697func unmarshalBasicPropertiesArray(body []byte) ([]BasicProperties, error) { 698 var rawMessages []*json.RawMessage 699 err := json.Unmarshal(body, &rawMessages) 700 if err != nil { 701 return nil, err 702 } 703 704 pArray := make([]BasicProperties, len(rawMessages)) 705 706 for index, rawMessage := range rawMessages { 707 p, err := unmarshalBasicProperties(*rawMessage) 708 if err != nil { 709 return nil, err 710 } 711 pArray[index] = p 712 } 713 return pArray, nil 714} 715 716// MarshalJSON is the custom marshaler for Properties. 717func (p Properties) MarshalJSON() ([]byte, error) { 718 p.Type = TypeJobProperties 719 objectMap := make(map[string]interface{}) 720 if p.RuntimeVersion != nil { 721 objectMap["runtimeVersion"] = p.RuntimeVersion 722 } 723 if p.Script != nil { 724 objectMap["script"] = p.Script 725 } 726 if p.Type != "" { 727 objectMap["type"] = p.Type 728 } 729 return json.Marshal(objectMap) 730} 731 732// AsUSQLJobProperties is the BasicProperties implementation for Properties. 733func (p Properties) AsUSQLJobProperties() (*USQLJobProperties, bool) { 734 return nil, false 735} 736 737// AsHiveJobProperties is the BasicProperties implementation for Properties. 738func (p Properties) AsHiveJobProperties() (*HiveJobProperties, bool) { 739 return nil, false 740} 741 742// AsProperties is the BasicProperties implementation for Properties. 743func (p Properties) AsProperties() (*Properties, bool) { 744 return &p, true 745} 746 747// AsBasicProperties is the BasicProperties implementation for Properties. 748func (p Properties) AsBasicProperties() (BasicProperties, bool) { 749 return &p, true 750} 751 752// Resource the Data Lake Analytics U-SQL job resources. 753type Resource struct { 754 // Name - Gets or set the name of the resource. 755 Name *string `json:"name,omitempty"` 756 // ResourcePath - Gets or sets the path to the resource. 757 ResourcePath *string `json:"resourcePath,omitempty"` 758 // Type - Gets or sets the job resource type. Possible values include: 'VertexResource', 'StatisticsResource' 759 Type ResourceType `json:"type,omitempty"` 760} 761 762// StateAuditRecord the Data Lake Analytics U-SQL job state audit records for tracking the lifecycle of a 763// job. 764type StateAuditRecord struct { 765 // NewState - READ-ONLY; Gets the new state the job is in. 766 NewState *string `json:"newState,omitempty"` 767 // TimeStamp - READ-ONLY; Gets the time stamp that the state change took place. 768 TimeStamp *date.Time `json:"timeStamp,omitempty"` 769 // RequestedByUser - READ-ONLY; Gets the user who requests the change. 770 RequestedByUser *string `json:"requestedByUser,omitempty"` 771 // Details - READ-ONLY; Gets the details of the audit log. 772 Details *string `json:"details,omitempty"` 773} 774 775// Statistics the Data Lake Analytics U-SQL job execution statistics. 776type Statistics struct { 777 autorest.Response `json:"-"` 778 // LastUpdateTimeUtc - READ-ONLY; Gets the last update time for the statistics. 779 LastUpdateTimeUtc *date.Time `json:"lastUpdateTimeUtc,omitempty"` 780 // Stages - READ-ONLY; Gets the list of stages for the job. 781 Stages *[]StatisticsVertexStage `json:"stages,omitempty"` 782} 783 784// StatisticsVertexStage the Data Lake Analytics U-SQL job statistics vertex stage information. 785type StatisticsVertexStage struct { 786 // DataRead - READ-ONLY; Gets the amount of data read, in bytes. 787 DataRead *int64 `json:"dataRead,omitempty"` 788 // DataReadCrossPod - READ-ONLY; Gets the amount of data read across multiple pods, in bytes. 789 DataReadCrossPod *int64 `json:"dataReadCrossPod,omitempty"` 790 // DataReadIntraPod - READ-ONLY; Gets the amount of data read in one pod, in bytes. 791 DataReadIntraPod *int64 `json:"dataReadIntraPod,omitempty"` 792 // DataToRead - READ-ONLY; Gets the amount of data remaining to be read, in bytes. 793 DataToRead *int64 `json:"dataToRead,omitempty"` 794 // DataWritten - READ-ONLY; Gets the amount of data written, in bytes. 795 DataWritten *int64 `json:"dataWritten,omitempty"` 796 // DuplicateDiscardCount - READ-ONLY; Gets the number of duplicates that were discarded. 797 DuplicateDiscardCount *int32 `json:"duplicateDiscardCount,omitempty"` 798 // FailedCount - READ-ONLY; Gets the number of failures that occurred in this stage. 799 FailedCount *int32 `json:"failedCount,omitempty"` 800 // MaxVertexDataRead - READ-ONLY; Gets the maximum amount of data read in a single vertex, in bytes. 801 MaxVertexDataRead *int64 `json:"maxVertexDataRead,omitempty"` 802 // MinVertexDataRead - READ-ONLY; Gets the minimum amount of data read in a single vertex, in bytes. 803 MinVertexDataRead *int64 `json:"minVertexDataRead,omitempty"` 804 // ReadFailureCount - READ-ONLY; Gets the number of read failures in this stage. 805 ReadFailureCount *int32 `json:"readFailureCount,omitempty"` 806 // RevocationCount - READ-ONLY; Gets the number of vertices that were revoked during this stage. 807 RevocationCount *int32 `json:"revocationCount,omitempty"` 808 // RunningCount - READ-ONLY; Gets the number of currently running vertices in this stage. 809 RunningCount *int32 `json:"runningCount,omitempty"` 810 // ScheduledCount - READ-ONLY; Gets the number of currently scheduled vertices in this stage 811 ScheduledCount *int32 `json:"scheduledCount,omitempty"` 812 // StageName - READ-ONLY; Gets the name of this stage in job execution. 813 StageName *string `json:"stageName,omitempty"` 814 // SucceededCount - READ-ONLY; Gets the number of vertices that succeeded in this stage. 815 SucceededCount *int32 `json:"succeededCount,omitempty"` 816 // TempDataWritten - READ-ONLY; Gets the amount of temporary data written, in bytes. 817 TempDataWritten *int64 `json:"tempDataWritten,omitempty"` 818 // TotalCount - READ-ONLY; Gets the total vertex count for this stage. 819 TotalCount *int32 `json:"totalCount,omitempty"` 820 // TotalFailedTime - READ-ONLY; Gets the amount of time that failed vertices took up in this stage. 821 TotalFailedTime *string `json:"totalFailedTime,omitempty"` 822 // TotalProgress - READ-ONLY; Gets the current progress of this stage, as a percentage. 823 TotalProgress *int32 `json:"totalProgress,omitempty"` 824 // TotalSucceededTime - READ-ONLY; Gets the amount of time all successful vertices took in this stage. 825 TotalSucceededTime *string `json:"totalSucceededTime,omitempty"` 826} 827 828// USQLJobProperties ... 829type USQLJobProperties struct { 830 // Resources - Gets or sets the list of resources that are required by the job 831 Resources *[]Resource `json:"resources,omitempty"` 832 // Statistics - Gets or sets the job specific statistics. 833 Statistics *Statistics `json:"statistics,omitempty"` 834 // DebugData - Gets or sets the job specific debug data locations. 835 DebugData *DataPath `json:"debugData,omitempty"` 836 // AlgebraFilePath - READ-ONLY; Gets the U-SQL algebra file path after the job has completed 837 AlgebraFilePath *string `json:"algebraFilePath,omitempty"` 838 // TotalCompilationTime - READ-ONLY; Gets the total time this job spent compiling. This value should not be set by the user and will be ignored if it is. 839 TotalCompilationTime *string `json:"totalCompilationTime,omitempty"` 840 // TotalPauseTime - READ-ONLY; Gets the total time this job spent paused. This value should not be set by the user and will be ignored if it is. 841 TotalPauseTime *string `json:"totalPauseTime,omitempty"` 842 // TotalQueuedTime - READ-ONLY; Gets the total time this job spent queued. This value should not be set by the user and will be ignored if it is. 843 TotalQueuedTime *string `json:"totalQueuedTime,omitempty"` 844 // TotalRunningTime - READ-ONLY; Gets the total time this job spent executing. This value should not be set by the user and will be ignored if it is. 845 TotalRunningTime *string `json:"totalRunningTime,omitempty"` 846 // RootProcessNodeID - READ-ONLY; Gets 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. 847 RootProcessNodeID *string `json:"rootProcessNodeId,omitempty"` 848 // YarnApplicationID - READ-ONLY; Gets 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. 849 YarnApplicationID *string `json:"yarnApplicationId,omitempty"` 850 // YarnApplicationTimeStamp - READ-ONLY; Gets 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. 851 YarnApplicationTimeStamp *int64 `json:"yarnApplicationTimeStamp,omitempty"` 852 // CompileMode - Gets or sets the compile mode for the job. Possible values include: 'Semantic', 'Full', 'SingleBox' 853 CompileMode CompileMode `json:"compileMode,omitempty"` 854 // RuntimeVersion - Gets or sets the runtime version of the U-SQL engine to use 855 RuntimeVersion *string `json:"runtimeVersion,omitempty"` 856 // Script - Gets or sets the U-SQL script to run 857 Script *string `json:"script,omitempty"` 858 // Type - Possible values include: 'TypeJobProperties', 'TypeUSQL', 'TypeHive' 859 Type Type `json:"type,omitempty"` 860} 861 862// MarshalJSON is the custom marshaler for USQLJobProperties. 863func (usjp USQLJobProperties) MarshalJSON() ([]byte, error) { 864 usjp.Type = TypeUSQL 865 objectMap := make(map[string]interface{}) 866 if usjp.Resources != nil { 867 objectMap["resources"] = usjp.Resources 868 } 869 if usjp.Statistics != nil { 870 objectMap["statistics"] = usjp.Statistics 871 } 872 if usjp.DebugData != nil { 873 objectMap["debugData"] = usjp.DebugData 874 } 875 if usjp.CompileMode != "" { 876 objectMap["compileMode"] = usjp.CompileMode 877 } 878 if usjp.RuntimeVersion != nil { 879 objectMap["runtimeVersion"] = usjp.RuntimeVersion 880 } 881 if usjp.Script != nil { 882 objectMap["script"] = usjp.Script 883 } 884 if usjp.Type != "" { 885 objectMap["type"] = usjp.Type 886 } 887 return json.Marshal(objectMap) 888} 889 890// AsUSQLJobProperties is the BasicProperties implementation for USQLJobProperties. 891func (usjp USQLJobProperties) AsUSQLJobProperties() (*USQLJobProperties, bool) { 892 return &usjp, true 893} 894 895// AsHiveJobProperties is the BasicProperties implementation for USQLJobProperties. 896func (usjp USQLJobProperties) AsHiveJobProperties() (*HiveJobProperties, bool) { 897 return nil, false 898} 899 900// AsProperties is the BasicProperties implementation for USQLJobProperties. 901func (usjp USQLJobProperties) AsProperties() (*Properties, bool) { 902 return nil, false 903} 904 905// AsBasicProperties is the BasicProperties implementation for USQLJobProperties. 906func (usjp USQLJobProperties) AsBasicProperties() (BasicProperties, bool) { 907 return &usjp, true 908} 909