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