1package job 2 3// Copyright (c) Microsoft and contributors. All rights reserved. 4// 5// Licensed under the Apache License, Version 2.0 (the "License"); 6// you may not use this file except in compliance with the License. 7// You may obtain a copy of the License at 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// 14// See the License for the specific language governing permissions and 15// limitations under the License. 16// 17// Code generated by Microsoft (R) AutoRest Code Generator. 18// Changes may cause incorrect behavior and will be lost if the code is regenerated. 19 20import ( 21 "context" 22 "github.com/Azure/go-autorest/autorest" 23 "github.com/Azure/go-autorest/autorest/azure" 24 "github.com/Azure/go-autorest/autorest/validation" 25 "github.com/Azure/go-autorest/tracing" 26 "github.com/satori/go.uuid" 27 "net/http" 28) 29 30// Client is the creates an Azure Data Lake Analytics job client. 31type Client struct { 32 BaseClient 33} 34 35// NewClient creates an instance of the Client client. 36func NewClient() Client { 37 return Client{New()} 38} 39 40// Build builds (compiles) the specified job in the specified Data Lake Analytics account for job correctness and 41// validation. 42// Parameters: 43// accountName - the Azure Data Lake Analytics account to execute job operations on. 44// parameters - the parameters to build a job. 45func (client Client) Build(ctx context.Context, accountName string, parameters Information) (result Information, err error) { 46 if tracing.IsEnabled() { 47 ctx = tracing.StartSpan(ctx, fqdn+"/Client.Build") 48 defer func() { 49 sc := -1 50 if result.Response.Response != nil { 51 sc = result.Response.Response.StatusCode 52 } 53 tracing.EndSpan(ctx, sc, err) 54 }() 55 } 56 if err := validation.Validate([]validation.Validation{ 57 {TargetValue: parameters, 58 Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, 59 {Target: "parameters.Properties", Name: validation.Null, Rule: true, 60 Chain: []validation.Constraint{{Target: "parameters.Properties.Script", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { 61 return result, validation.NewError("job.Client", "Build", err.Error()) 62 } 63 64 req, err := client.BuildPreparer(ctx, accountName, parameters) 65 if err != nil { 66 err = autorest.NewErrorWithError(err, "job.Client", "Build", nil, "Failure preparing request") 67 return 68 } 69 70 resp, err := client.BuildSender(req) 71 if err != nil { 72 result.Response = autorest.Response{Response: resp} 73 err = autorest.NewErrorWithError(err, "job.Client", "Build", resp, "Failure sending request") 74 return 75 } 76 77 result, err = client.BuildResponder(resp) 78 if err != nil { 79 err = autorest.NewErrorWithError(err, "job.Client", "Build", resp, "Failure responding to request") 80 } 81 82 return 83} 84 85// BuildPreparer prepares the Build request. 86func (client Client) BuildPreparer(ctx context.Context, accountName string, parameters Information) (*http.Request, error) { 87 urlParameters := map[string]interface{}{ 88 "accountName": accountName, 89 "adlaJobDnsSuffix": client.AdlaJobDNSSuffix, 90 } 91 92 const APIVersion = "2015-11-01-preview" 93 queryParameters := map[string]interface{}{ 94 "api-version": APIVersion, 95 } 96 97 parameters.ErrorMessage = nil 98 parameters.SubmitTime = nil 99 parameters.StartTime = nil 100 parameters.EndTime = nil 101 parameters.State = "" 102 parameters.Result = "" 103 parameters.StateAuditRecords = nil 104 parameters.HierarchyQueueNode = nil 105 preparer := autorest.CreatePreparer( 106 autorest.AsContentType("application/json; charset=utf-8"), 107 autorest.AsPost(), 108 autorest.WithCustomBaseURL("https://{accountName}.{adlaJobDnsSuffix}", urlParameters), 109 autorest.WithPath("/BuildJob"), 110 autorest.WithJSON(parameters), 111 autorest.WithQueryParameters(queryParameters)) 112 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 113} 114 115// BuildSender sends the Build request. The method will close the 116// http.Response Body if it receives an error. 117func (client Client) BuildSender(req *http.Request) (*http.Response, error) { 118 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 119} 120 121// BuildResponder handles the response to the Build request. The method always 122// closes the http.Response Body. 123func (client Client) BuildResponder(resp *http.Response) (result Information, err error) { 124 err = autorest.Respond( 125 resp, 126 client.ByInspecting(), 127 azure.WithErrorUnlessStatusCode(http.StatusOK), 128 autorest.ByUnmarshallingJSON(&result), 129 autorest.ByClosing()) 130 result.Response = autorest.Response{Response: resp} 131 return 132} 133 134// Cancel cancels the running job specified by the job ID. 135// Parameters: 136// accountName - the Azure Data Lake Analytics account to execute job operations on. 137// jobIdentity - jobInfo ID to cancel. 138func (client Client) Cancel(ctx context.Context, accountName string, jobIdentity uuid.UUID) (result autorest.Response, err error) { 139 if tracing.IsEnabled() { 140 ctx = tracing.StartSpan(ctx, fqdn+"/Client.Cancel") 141 defer func() { 142 sc := -1 143 if result.Response != nil { 144 sc = result.Response.StatusCode 145 } 146 tracing.EndSpan(ctx, sc, err) 147 }() 148 } 149 req, err := client.CancelPreparer(ctx, accountName, jobIdentity) 150 if err != nil { 151 err = autorest.NewErrorWithError(err, "job.Client", "Cancel", nil, "Failure preparing request") 152 return 153 } 154 155 resp, err := client.CancelSender(req) 156 if err != nil { 157 result.Response = resp 158 err = autorest.NewErrorWithError(err, "job.Client", "Cancel", resp, "Failure sending request") 159 return 160 } 161 162 result, err = client.CancelResponder(resp) 163 if err != nil { 164 err = autorest.NewErrorWithError(err, "job.Client", "Cancel", resp, "Failure responding to request") 165 } 166 167 return 168} 169 170// CancelPreparer prepares the Cancel request. 171func (client Client) CancelPreparer(ctx context.Context, accountName string, jobIdentity uuid.UUID) (*http.Request, error) { 172 urlParameters := map[string]interface{}{ 173 "accountName": accountName, 174 "adlaJobDnsSuffix": client.AdlaJobDNSSuffix, 175 } 176 177 pathParameters := map[string]interface{}{ 178 "jobIdentity": autorest.Encode("path", jobIdentity), 179 } 180 181 const APIVersion = "2015-11-01-preview" 182 queryParameters := map[string]interface{}{ 183 "api-version": APIVersion, 184 } 185 186 preparer := autorest.CreatePreparer( 187 autorest.AsPost(), 188 autorest.WithCustomBaseURL("https://{accountName}.{adlaJobDnsSuffix}", urlParameters), 189 autorest.WithPathParameters("/Jobs/{jobIdentity}/CancelJob", pathParameters), 190 autorest.WithQueryParameters(queryParameters)) 191 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 192} 193 194// CancelSender sends the Cancel request. The method will close the 195// http.Response Body if it receives an error. 196func (client Client) CancelSender(req *http.Request) (*http.Response, error) { 197 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 198} 199 200// CancelResponder handles the response to the Cancel request. The method always 201// closes the http.Response Body. 202func (client Client) CancelResponder(resp *http.Response) (result autorest.Response, err error) { 203 err = autorest.Respond( 204 resp, 205 client.ByInspecting(), 206 azure.WithErrorUnlessStatusCode(http.StatusOK), 207 autorest.ByClosing()) 208 result.Response = resp 209 return 210} 211 212// Create submits a job to the specified Data Lake Analytics account. 213// Parameters: 214// accountName - the Azure Data Lake Analytics account to execute job operations on. 215// jobIdentity - the job ID (a GUID) for the job being submitted. 216// parameters - the parameters to submit a job. 217func (client Client) Create(ctx context.Context, accountName string, jobIdentity uuid.UUID, parameters Information) (result Information, err error) { 218 if tracing.IsEnabled() { 219 ctx = tracing.StartSpan(ctx, fqdn+"/Client.Create") 220 defer func() { 221 sc := -1 222 if result.Response.Response != nil { 223 sc = result.Response.Response.StatusCode 224 } 225 tracing.EndSpan(ctx, sc, err) 226 }() 227 } 228 if err := validation.Validate([]validation.Validation{ 229 {TargetValue: parameters, 230 Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, 231 {Target: "parameters.Properties", Name: validation.Null, Rule: true, 232 Chain: []validation.Constraint{{Target: "parameters.Properties.Script", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { 233 return result, validation.NewError("job.Client", "Create", err.Error()) 234 } 235 236 req, err := client.CreatePreparer(ctx, accountName, jobIdentity, parameters) 237 if err != nil { 238 err = autorest.NewErrorWithError(err, "job.Client", "Create", nil, "Failure preparing request") 239 return 240 } 241 242 resp, err := client.CreateSender(req) 243 if err != nil { 244 result.Response = autorest.Response{Response: resp} 245 err = autorest.NewErrorWithError(err, "job.Client", "Create", resp, "Failure sending request") 246 return 247 } 248 249 result, err = client.CreateResponder(resp) 250 if err != nil { 251 err = autorest.NewErrorWithError(err, "job.Client", "Create", resp, "Failure responding to request") 252 } 253 254 return 255} 256 257// CreatePreparer prepares the Create request. 258func (client Client) CreatePreparer(ctx context.Context, accountName string, jobIdentity uuid.UUID, parameters Information) (*http.Request, error) { 259 urlParameters := map[string]interface{}{ 260 "accountName": accountName, 261 "adlaJobDnsSuffix": client.AdlaJobDNSSuffix, 262 } 263 264 pathParameters := map[string]interface{}{ 265 "jobIdentity": autorest.Encode("path", jobIdentity), 266 } 267 268 const APIVersion = "2015-11-01-preview" 269 queryParameters := map[string]interface{}{ 270 "api-version": APIVersion, 271 } 272 273 parameters.ErrorMessage = nil 274 parameters.SubmitTime = nil 275 parameters.StartTime = nil 276 parameters.EndTime = nil 277 parameters.State = "" 278 parameters.Result = "" 279 parameters.StateAuditRecords = nil 280 parameters.HierarchyQueueNode = nil 281 preparer := autorest.CreatePreparer( 282 autorest.AsContentType("application/json; charset=utf-8"), 283 autorest.AsPut(), 284 autorest.WithCustomBaseURL("https://{accountName}.{adlaJobDnsSuffix}", urlParameters), 285 autorest.WithPathParameters("/Jobs/{jobIdentity}", pathParameters), 286 autorest.WithJSON(parameters), 287 autorest.WithQueryParameters(queryParameters)) 288 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 289} 290 291// CreateSender sends the Create request. The method will close the 292// http.Response Body if it receives an error. 293func (client Client) CreateSender(req *http.Request) (*http.Response, error) { 294 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 295} 296 297// CreateResponder handles the response to the Create request. The method always 298// closes the http.Response Body. 299func (client Client) CreateResponder(resp *http.Response) (result Information, err error) { 300 err = autorest.Respond( 301 resp, 302 client.ByInspecting(), 303 azure.WithErrorUnlessStatusCode(http.StatusOK), 304 autorest.ByUnmarshallingJSON(&result), 305 autorest.ByClosing()) 306 result.Response = autorest.Response{Response: resp} 307 return 308} 309 310// Get gets the job information for the specified job ID. 311// Parameters: 312// accountName - the Azure Data Lake Analytics account to execute job operations on. 313// jobIdentity - jobInfo ID. 314func (client Client) Get(ctx context.Context, accountName string, jobIdentity uuid.UUID) (result Information, err error) { 315 if tracing.IsEnabled() { 316 ctx = tracing.StartSpan(ctx, fqdn+"/Client.Get") 317 defer func() { 318 sc := -1 319 if result.Response.Response != nil { 320 sc = result.Response.Response.StatusCode 321 } 322 tracing.EndSpan(ctx, sc, err) 323 }() 324 } 325 req, err := client.GetPreparer(ctx, accountName, jobIdentity) 326 if err != nil { 327 err = autorest.NewErrorWithError(err, "job.Client", "Get", nil, "Failure preparing request") 328 return 329 } 330 331 resp, err := client.GetSender(req) 332 if err != nil { 333 result.Response = autorest.Response{Response: resp} 334 err = autorest.NewErrorWithError(err, "job.Client", "Get", resp, "Failure sending request") 335 return 336 } 337 338 result, err = client.GetResponder(resp) 339 if err != nil { 340 err = autorest.NewErrorWithError(err, "job.Client", "Get", resp, "Failure responding to request") 341 } 342 343 return 344} 345 346// GetPreparer prepares the Get request. 347func (client Client) GetPreparer(ctx context.Context, accountName string, jobIdentity uuid.UUID) (*http.Request, error) { 348 urlParameters := map[string]interface{}{ 349 "accountName": accountName, 350 "adlaJobDnsSuffix": client.AdlaJobDNSSuffix, 351 } 352 353 pathParameters := map[string]interface{}{ 354 "jobIdentity": autorest.Encode("path", jobIdentity), 355 } 356 357 const APIVersion = "2015-11-01-preview" 358 queryParameters := map[string]interface{}{ 359 "api-version": APIVersion, 360 } 361 362 preparer := autorest.CreatePreparer( 363 autorest.AsGet(), 364 autorest.WithCustomBaseURL("https://{accountName}.{adlaJobDnsSuffix}", urlParameters), 365 autorest.WithPathParameters("/Jobs/{jobIdentity}", pathParameters), 366 autorest.WithQueryParameters(queryParameters)) 367 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 368} 369 370// GetSender sends the Get request. The method will close the 371// http.Response Body if it receives an error. 372func (client Client) GetSender(req *http.Request) (*http.Response, error) { 373 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 374} 375 376// GetResponder handles the response to the Get request. The method always 377// closes the http.Response Body. 378func (client Client) GetResponder(resp *http.Response) (result Information, err error) { 379 err = autorest.Respond( 380 resp, 381 client.ByInspecting(), 382 azure.WithErrorUnlessStatusCode(http.StatusOK), 383 autorest.ByUnmarshallingJSON(&result), 384 autorest.ByClosing()) 385 result.Response = autorest.Response{Response: resp} 386 return 387} 388 389// GetDebugDataPath gets the U-SQL job debug data information specified by the job ID. 390// Parameters: 391// accountName - the Azure Data Lake Analytics account to execute job operations on. 392// jobIdentity - jobInfo ID. 393func (client Client) GetDebugDataPath(ctx context.Context, accountName string, jobIdentity uuid.UUID) (result DataPath, err error) { 394 if tracing.IsEnabled() { 395 ctx = tracing.StartSpan(ctx, fqdn+"/Client.GetDebugDataPath") 396 defer func() { 397 sc := -1 398 if result.Response.Response != nil { 399 sc = result.Response.Response.StatusCode 400 } 401 tracing.EndSpan(ctx, sc, err) 402 }() 403 } 404 req, err := client.GetDebugDataPathPreparer(ctx, accountName, jobIdentity) 405 if err != nil { 406 err = autorest.NewErrorWithError(err, "job.Client", "GetDebugDataPath", nil, "Failure preparing request") 407 return 408 } 409 410 resp, err := client.GetDebugDataPathSender(req) 411 if err != nil { 412 result.Response = autorest.Response{Response: resp} 413 err = autorest.NewErrorWithError(err, "job.Client", "GetDebugDataPath", resp, "Failure sending request") 414 return 415 } 416 417 result, err = client.GetDebugDataPathResponder(resp) 418 if err != nil { 419 err = autorest.NewErrorWithError(err, "job.Client", "GetDebugDataPath", resp, "Failure responding to request") 420 } 421 422 return 423} 424 425// GetDebugDataPathPreparer prepares the GetDebugDataPath request. 426func (client Client) GetDebugDataPathPreparer(ctx context.Context, accountName string, jobIdentity uuid.UUID) (*http.Request, error) { 427 urlParameters := map[string]interface{}{ 428 "accountName": accountName, 429 "adlaJobDnsSuffix": client.AdlaJobDNSSuffix, 430 } 431 432 pathParameters := map[string]interface{}{ 433 "jobIdentity": autorest.Encode("path", jobIdentity), 434 } 435 436 const APIVersion = "2015-11-01-preview" 437 queryParameters := map[string]interface{}{ 438 "api-version": APIVersion, 439 } 440 441 preparer := autorest.CreatePreparer( 442 autorest.AsPost(), 443 autorest.WithCustomBaseURL("https://{accountName}.{adlaJobDnsSuffix}", urlParameters), 444 autorest.WithPathParameters("/Jobs/{jobIdentity}/GetDebugDataPath", pathParameters), 445 autorest.WithQueryParameters(queryParameters)) 446 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 447} 448 449// GetDebugDataPathSender sends the GetDebugDataPath request. The method will close the 450// http.Response Body if it receives an error. 451func (client Client) GetDebugDataPathSender(req *http.Request) (*http.Response, error) { 452 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 453} 454 455// GetDebugDataPathResponder handles the response to the GetDebugDataPath request. The method always 456// closes the http.Response Body. 457func (client Client) GetDebugDataPathResponder(resp *http.Response) (result DataPath, err error) { 458 err = autorest.Respond( 459 resp, 460 client.ByInspecting(), 461 azure.WithErrorUnlessStatusCode(http.StatusOK), 462 autorest.ByUnmarshallingJSON(&result), 463 autorest.ByClosing()) 464 result.Response = autorest.Response{Response: resp} 465 return 466} 467 468// GetStatistics gets statistics of the specified job. 469// Parameters: 470// accountName - the Azure Data Lake Analytics account to execute job operations on. 471// jobIdentity - jobInfo ID. 472func (client Client) GetStatistics(ctx context.Context, accountName string, jobIdentity uuid.UUID) (result Statistics, err error) { 473 if tracing.IsEnabled() { 474 ctx = tracing.StartSpan(ctx, fqdn+"/Client.GetStatistics") 475 defer func() { 476 sc := -1 477 if result.Response.Response != nil { 478 sc = result.Response.Response.StatusCode 479 } 480 tracing.EndSpan(ctx, sc, err) 481 }() 482 } 483 req, err := client.GetStatisticsPreparer(ctx, accountName, jobIdentity) 484 if err != nil { 485 err = autorest.NewErrorWithError(err, "job.Client", "GetStatistics", nil, "Failure preparing request") 486 return 487 } 488 489 resp, err := client.GetStatisticsSender(req) 490 if err != nil { 491 result.Response = autorest.Response{Response: resp} 492 err = autorest.NewErrorWithError(err, "job.Client", "GetStatistics", resp, "Failure sending request") 493 return 494 } 495 496 result, err = client.GetStatisticsResponder(resp) 497 if err != nil { 498 err = autorest.NewErrorWithError(err, "job.Client", "GetStatistics", resp, "Failure responding to request") 499 } 500 501 return 502} 503 504// GetStatisticsPreparer prepares the GetStatistics request. 505func (client Client) GetStatisticsPreparer(ctx context.Context, accountName string, jobIdentity uuid.UUID) (*http.Request, error) { 506 urlParameters := map[string]interface{}{ 507 "accountName": accountName, 508 "adlaJobDnsSuffix": client.AdlaJobDNSSuffix, 509 } 510 511 pathParameters := map[string]interface{}{ 512 "jobIdentity": autorest.Encode("path", jobIdentity), 513 } 514 515 const APIVersion = "2015-11-01-preview" 516 queryParameters := map[string]interface{}{ 517 "api-version": APIVersion, 518 } 519 520 preparer := autorest.CreatePreparer( 521 autorest.AsPost(), 522 autorest.WithCustomBaseURL("https://{accountName}.{adlaJobDnsSuffix}", urlParameters), 523 autorest.WithPathParameters("/Jobs/{jobIdentity}/GetStatistics", pathParameters), 524 autorest.WithQueryParameters(queryParameters)) 525 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 526} 527 528// GetStatisticsSender sends the GetStatistics request. The method will close the 529// http.Response Body if it receives an error. 530func (client Client) GetStatisticsSender(req *http.Request) (*http.Response, error) { 531 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 532} 533 534// GetStatisticsResponder handles the response to the GetStatistics request. The method always 535// closes the http.Response Body. 536func (client Client) GetStatisticsResponder(resp *http.Response) (result Statistics, err error) { 537 err = autorest.Respond( 538 resp, 539 client.ByInspecting(), 540 azure.WithErrorUnlessStatusCode(http.StatusOK), 541 autorest.ByUnmarshallingJSON(&result), 542 autorest.ByClosing()) 543 result.Response = autorest.Response{Response: resp} 544 return 545} 546 547// List lists the jobs, if any, associated with the specified Data Lake Analytics account. The response includes a link 548// to the next page of results, if any. 549// Parameters: 550// accountName - the Azure Data Lake Analytics account to execute job operations on. 551// filter - oData filter. Optional. 552// top - the number of items to return. Optional. 553// skip - the number of items to skip over before returning elements. Optional. 554// expand - oData expansion. Expand related resources in line with the retrieved resources, e.g. 555// Categories/$expand=Products would expand Product data in line with each Category entry. Optional. 556// selectParameter - oData Select statement. Limits the properties on each entry to just those requested, e.g. 557// Categories?$select=CategoryName,Description. Optional. 558// orderby - orderBy clause. One or more comma-separated expressions with an optional "asc" (the default) or 559// "desc" depending on the order you'd like the values sorted, e.g. Categories?$orderby=CategoryName desc. 560// Optional. 561// count - the Boolean value of true or false to request a count of the matching resources included with the 562// resources in the response, e.g. Categories?$count=true. Optional. 563// search - a free form search. A free-text search expression to match for whether a particular entry should be 564// included in the feed, e.g. Categories?$search=blue OR green. Optional. 565// formatParameter - the return format. Return the response in particular format without access to request 566// headers for standard content-type negotiation (e.g Orders?$format=json). Optional. 567func (client Client) List(ctx context.Context, accountName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool, search string, formatParameter string) (result InfoListResultPage, err error) { 568 if tracing.IsEnabled() { 569 ctx = tracing.StartSpan(ctx, fqdn+"/Client.List") 570 defer func() { 571 sc := -1 572 if result.ilr.Response.Response != nil { 573 sc = result.ilr.Response.Response.StatusCode 574 } 575 tracing.EndSpan(ctx, sc, err) 576 }() 577 } 578 result.fn = client.listNextResults 579 req, err := client.ListPreparer(ctx, accountName, filter, top, skip, expand, selectParameter, orderby, count, search, formatParameter) 580 if err != nil { 581 err = autorest.NewErrorWithError(err, "job.Client", "List", nil, "Failure preparing request") 582 return 583 } 584 585 resp, err := client.ListSender(req) 586 if err != nil { 587 result.ilr.Response = autorest.Response{Response: resp} 588 err = autorest.NewErrorWithError(err, "job.Client", "List", resp, "Failure sending request") 589 return 590 } 591 592 result.ilr, err = client.ListResponder(resp) 593 if err != nil { 594 err = autorest.NewErrorWithError(err, "job.Client", "List", resp, "Failure responding to request") 595 } 596 597 return 598} 599 600// ListPreparer prepares the List request. 601func (client Client) ListPreparer(ctx context.Context, accountName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool, search string, formatParameter string) (*http.Request, error) { 602 urlParameters := map[string]interface{}{ 603 "accountName": accountName, 604 "adlaJobDnsSuffix": client.AdlaJobDNSSuffix, 605 } 606 607 const APIVersion = "2015-11-01-preview" 608 queryParameters := map[string]interface{}{ 609 "api-version": APIVersion, 610 } 611 if len(filter) > 0 { 612 queryParameters["$filter"] = autorest.Encode("query", filter) 613 } 614 if top != nil { 615 queryParameters["$top"] = autorest.Encode("query", *top) 616 } 617 if skip != nil { 618 queryParameters["$skip"] = autorest.Encode("query", *skip) 619 } 620 if len(expand) > 0 { 621 queryParameters["$expand"] = autorest.Encode("query", expand) 622 } 623 if len(selectParameter) > 0 { 624 queryParameters["$select"] = autorest.Encode("query", selectParameter) 625 } 626 if len(orderby) > 0 { 627 queryParameters["$orderby"] = autorest.Encode("query", orderby) 628 } 629 if count != nil { 630 queryParameters["$count"] = autorest.Encode("query", *count) 631 } 632 if len(search) > 0 { 633 queryParameters["$search"] = autorest.Encode("query", search) 634 } 635 if len(formatParameter) > 0 { 636 queryParameters["$format"] = autorest.Encode("query", formatParameter) 637 } 638 639 preparer := autorest.CreatePreparer( 640 autorest.AsGet(), 641 autorest.WithCustomBaseURL("https://{accountName}.{adlaJobDnsSuffix}", urlParameters), 642 autorest.WithPath("/Jobs"), 643 autorest.WithQueryParameters(queryParameters)) 644 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 645} 646 647// ListSender sends the List request. The method will close the 648// http.Response Body if it receives an error. 649func (client Client) ListSender(req *http.Request) (*http.Response, error) { 650 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 651} 652 653// ListResponder handles the response to the List request. The method always 654// closes the http.Response Body. 655func (client Client) ListResponder(resp *http.Response) (result InfoListResult, err error) { 656 err = autorest.Respond( 657 resp, 658 client.ByInspecting(), 659 azure.WithErrorUnlessStatusCode(http.StatusOK), 660 autorest.ByUnmarshallingJSON(&result), 661 autorest.ByClosing()) 662 result.Response = autorest.Response{Response: resp} 663 return 664} 665 666// listNextResults retrieves the next set of results, if any. 667func (client Client) listNextResults(ctx context.Context, lastResults InfoListResult) (result InfoListResult, err error) { 668 req, err := lastResults.infoListResultPreparer(ctx) 669 if err != nil { 670 return result, autorest.NewErrorWithError(err, "job.Client", "listNextResults", nil, "Failure preparing next results request") 671 } 672 if req == nil { 673 return 674 } 675 resp, err := client.ListSender(req) 676 if err != nil { 677 result.Response = autorest.Response{Response: resp} 678 return result, autorest.NewErrorWithError(err, "job.Client", "listNextResults", resp, "Failure sending next results request") 679 } 680 result, err = client.ListResponder(resp) 681 if err != nil { 682 err = autorest.NewErrorWithError(err, "job.Client", "listNextResults", resp, "Failure responding to next results request") 683 } 684 return 685} 686 687// ListComplete enumerates all values, automatically crossing page boundaries as required. 688func (client Client) ListComplete(ctx context.Context, accountName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool, search string, formatParameter string) (result InfoListResultIterator, err error) { 689 if tracing.IsEnabled() { 690 ctx = tracing.StartSpan(ctx, fqdn+"/Client.List") 691 defer func() { 692 sc := -1 693 if result.Response().Response.Response != nil { 694 sc = result.page.Response().Response.Response.StatusCode 695 } 696 tracing.EndSpan(ctx, sc, err) 697 }() 698 } 699 result.page, err = client.List(ctx, accountName, filter, top, skip, expand, selectParameter, orderby, count, search, formatParameter) 700 return 701} 702