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