1package batch 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/date" 25 "github.com/Azure/go-autorest/autorest/validation" 26 "github.com/Azure/go-autorest/tracing" 27 "github.com/gofrs/uuid" 28 "net/http" 29) 30 31// JobScheduleClient is the a client for issuing REST requests to the Azure Batch service. 32type JobScheduleClient struct { 33 BaseClient 34} 35 36// NewJobScheduleClient creates an instance of the JobScheduleClient client. 37func NewJobScheduleClient() JobScheduleClient { 38 return NewJobScheduleClientWithBaseURI(DefaultBaseURI) 39} 40 41// NewJobScheduleClientWithBaseURI creates an instance of the JobScheduleClient client using a custom endpoint. Use 42// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). 43func NewJobScheduleClientWithBaseURI(baseURI string) JobScheduleClient { 44 return JobScheduleClient{NewWithBaseURI(baseURI)} 45} 46 47// Add sends the add request. 48// Parameters: 49// cloudJobSchedule - the job schedule to be added. 50// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 51// seconds. 52// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as 53// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. 54// returnClientRequestID - whether the server should return the client-request-id in the response. 55// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock 56// time; set it explicitly if you are calling the REST API directly. 57func (client JobScheduleClient) Add(ctx context.Context, cloudJobSchedule JobScheduleAddParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) { 58 if tracing.IsEnabled() { 59 ctx = tracing.StartSpan(ctx, fqdn+"/JobScheduleClient.Add") 60 defer func() { 61 sc := -1 62 if result.Response != nil { 63 sc = result.Response.StatusCode 64 } 65 tracing.EndSpan(ctx, sc, err) 66 }() 67 } 68 if err := validation.Validate([]validation.Validation{ 69 {TargetValue: cloudJobSchedule, 70 Constraints: []validation.Constraint{{Target: "cloudJobSchedule.ID", Name: validation.Null, Rule: true, Chain: nil}, 71 {Target: "cloudJobSchedule.Schedule", Name: validation.Null, Rule: true, Chain: nil}, 72 {Target: "cloudJobSchedule.JobSpecification", Name: validation.Null, Rule: true, 73 Chain: []validation.Constraint{{Target: "cloudJobSchedule.JobSpecification.JobManagerTask", Name: validation.Null, Rule: false, 74 Chain: []validation.Constraint{{Target: "cloudJobSchedule.JobSpecification.JobManagerTask.ID", Name: validation.Null, Rule: true, Chain: nil}, 75 {Target: "cloudJobSchedule.JobSpecification.JobManagerTask.CommandLine", Name: validation.Null, Rule: true, Chain: nil}, 76 }}, 77 {Target: "cloudJobSchedule.JobSpecification.JobPreparationTask", Name: validation.Null, Rule: false, 78 Chain: []validation.Constraint{{Target: "cloudJobSchedule.JobSpecification.JobPreparationTask.CommandLine", Name: validation.Null, Rule: true, Chain: nil}}}, 79 {Target: "cloudJobSchedule.JobSpecification.JobReleaseTask", Name: validation.Null, Rule: false, 80 Chain: []validation.Constraint{{Target: "cloudJobSchedule.JobSpecification.JobReleaseTask.CommandLine", Name: validation.Null, Rule: true, Chain: nil}}}, 81 {Target: "cloudJobSchedule.JobSpecification.PoolInfo", Name: validation.Null, Rule: true, 82 Chain: []validation.Constraint{{Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification", Name: validation.Null, Rule: false, 83 Chain: []validation.Constraint{{Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification.Pool", Name: validation.Null, Rule: false, 84 Chain: []validation.Constraint{{Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VMSize", Name: validation.Null, Rule: true, Chain: nil}, 85 {Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.CloudServiceConfiguration", Name: validation.Null, Rule: false, 86 Chain: []validation.Constraint{{Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.CloudServiceConfiguration.OsFamily", Name: validation.Null, Rule: true, Chain: nil}}}, 87 {Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration", Name: validation.Null, Rule: false, 88 Chain: []validation.Constraint{{Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ImageReference", Name: validation.Null, Rule: false, 89 Chain: []validation.Constraint{{Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ImageReference.Publisher", Name: validation.Null, Rule: true, Chain: nil}, 90 {Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ImageReference.Offer", Name: validation.Null, Rule: true, Chain: nil}, 91 {Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ImageReference.Sku", Name: validation.Null, Rule: true, Chain: nil}, 92 }}, 93 {Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.OsDisk", Name: validation.Null, Rule: false, 94 Chain: []validation.Constraint{{Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.OsDisk.ImageUris", Name: validation.Null, Rule: true, Chain: nil}}}, 95 {Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.NodeAgentSKUID", Name: validation.Null, Rule: true, Chain: nil}, 96 }}, 97 {Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.StartTask", Name: validation.Null, Rule: false, 98 Chain: []validation.Constraint{{Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.StartTask.CommandLine", Name: validation.Null, Rule: true, Chain: nil}}}, 99 }}, 100 }}, 101 }}, 102 }}}}}); err != nil { 103 return result, validation.NewError("batch.JobScheduleClient", "Add", err.Error()) 104 } 105 106 req, err := client.AddPreparer(ctx, cloudJobSchedule, timeout, clientRequestID, returnClientRequestID, ocpDate) 107 if err != nil { 108 err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Add", nil, "Failure preparing request") 109 return 110 } 111 112 resp, err := client.AddSender(req) 113 if err != nil { 114 result.Response = resp 115 err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Add", resp, "Failure sending request") 116 return 117 } 118 119 result, err = client.AddResponder(resp) 120 if err != nil { 121 err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Add", resp, "Failure responding to request") 122 return 123 } 124 125 return 126} 127 128// AddPreparer prepares the Add request. 129func (client JobScheduleClient) AddPreparer(ctx context.Context, cloudJobSchedule JobScheduleAddParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { 130 const APIVersion = "2017-05-01.5.0" 131 queryParameters := map[string]interface{}{ 132 "api-version": APIVersion, 133 } 134 if timeout != nil { 135 queryParameters["timeout"] = autorest.Encode("query", *timeout) 136 } else { 137 queryParameters["timeout"] = autorest.Encode("query", 30) 138 } 139 140 preparer := autorest.CreatePreparer( 141 autorest.AsContentType("application/json; odata=minimalmetadata; charset=utf-8"), 142 autorest.AsPost(), 143 autorest.WithBaseURL(client.BaseURI), 144 autorest.WithPath("/jobschedules"), 145 autorest.WithJSON(cloudJobSchedule), 146 autorest.WithQueryParameters(queryParameters)) 147 if clientRequestID != nil { 148 preparer = autorest.DecoratePreparer(preparer, 149 autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) 150 } 151 if returnClientRequestID != nil { 152 preparer = autorest.DecoratePreparer(preparer, 153 autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) 154 } else { 155 preparer = autorest.DecoratePreparer(preparer, 156 autorest.WithHeader("return-client-request-id", autorest.String(false))) 157 } 158 if ocpDate != nil { 159 preparer = autorest.DecoratePreparer(preparer, 160 autorest.WithHeader("ocp-date", autorest.String(ocpDate))) 161 } 162 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 163} 164 165// AddSender sends the Add request. The method will close the 166// http.Response Body if it receives an error. 167func (client JobScheduleClient) AddSender(req *http.Request) (*http.Response, error) { 168 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 169} 170 171// AddResponder handles the response to the Add request. The method always 172// closes the http.Response Body. 173func (client JobScheduleClient) AddResponder(resp *http.Response) (result autorest.Response, err error) { 174 err = autorest.Respond( 175 resp, 176 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), 177 autorest.ByClosing()) 178 result.Response = resp 179 return 180} 181 182// Delete when you delete a job schedule, this also deletes all jobs and tasks under that schedule. When tasks are 183// deleted, all the files in their working directories on the compute nodes are also deleted (the retention period is 184// ignored). The job schedule statistics are no longer accessible once the job schedule is deleted, though they are 185// still counted towards account lifetime statistics. 186// Parameters: 187// jobScheduleID - the ID of the job schedule to delete. 188// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 189// seconds. 190// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as 191// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. 192// returnClientRequestID - whether the server should return the client-request-id in the response. 193// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock 194// time; set it explicitly if you are calling the REST API directly. 195// ifMatch - an ETag value associated with the version of the resource known to the client. The operation will 196// be performed only if the resource's current ETag on the service exactly matches the value specified by the 197// client. 198// ifNoneMatch - an ETag value associated with the version of the resource known to the client. The operation 199// will be performed only if the resource's current ETag on the service does not match the value specified by 200// the client. 201// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The 202// operation will be performed only if the resource on the service has been modified since the specified time. 203// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The 204// operation will be performed only if the resource on the service has not been modified since the specified 205// time. 206func (client JobScheduleClient) Delete(ctx context.Context, jobScheduleID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) { 207 if tracing.IsEnabled() { 208 ctx = tracing.StartSpan(ctx, fqdn+"/JobScheduleClient.Delete") 209 defer func() { 210 sc := -1 211 if result.Response != nil { 212 sc = result.Response.StatusCode 213 } 214 tracing.EndSpan(ctx, sc, err) 215 }() 216 } 217 req, err := client.DeletePreparer(ctx, jobScheduleID, timeout, clientRequestID, returnClientRequestID, ocpDate, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince) 218 if err != nil { 219 err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Delete", nil, "Failure preparing request") 220 return 221 } 222 223 resp, err := client.DeleteSender(req) 224 if err != nil { 225 result.Response = resp 226 err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Delete", resp, "Failure sending request") 227 return 228 } 229 230 result, err = client.DeleteResponder(resp) 231 if err != nil { 232 err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Delete", resp, "Failure responding to request") 233 return 234 } 235 236 return 237} 238 239// DeletePreparer prepares the Delete request. 240func (client JobScheduleClient) DeletePreparer(ctx context.Context, jobScheduleID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (*http.Request, error) { 241 pathParameters := map[string]interface{}{ 242 "jobScheduleId": autorest.Encode("path", jobScheduleID), 243 } 244 245 const APIVersion = "2017-05-01.5.0" 246 queryParameters := map[string]interface{}{ 247 "api-version": APIVersion, 248 } 249 if timeout != nil { 250 queryParameters["timeout"] = autorest.Encode("query", *timeout) 251 } else { 252 queryParameters["timeout"] = autorest.Encode("query", 30) 253 } 254 255 preparer := autorest.CreatePreparer( 256 autorest.AsDelete(), 257 autorest.WithBaseURL(client.BaseURI), 258 autorest.WithPathParameters("/jobschedules/{jobScheduleId}", pathParameters), 259 autorest.WithQueryParameters(queryParameters)) 260 if clientRequestID != nil { 261 preparer = autorest.DecoratePreparer(preparer, 262 autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) 263 } 264 if returnClientRequestID != nil { 265 preparer = autorest.DecoratePreparer(preparer, 266 autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) 267 } else { 268 preparer = autorest.DecoratePreparer(preparer, 269 autorest.WithHeader("return-client-request-id", autorest.String(false))) 270 } 271 if ocpDate != nil { 272 preparer = autorest.DecoratePreparer(preparer, 273 autorest.WithHeader("ocp-date", autorest.String(ocpDate))) 274 } 275 if len(ifMatch) > 0 { 276 preparer = autorest.DecoratePreparer(preparer, 277 autorest.WithHeader("If-Match", autorest.String(ifMatch))) 278 } 279 if len(ifNoneMatch) > 0 { 280 preparer = autorest.DecoratePreparer(preparer, 281 autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) 282 } 283 if ifModifiedSince != nil { 284 preparer = autorest.DecoratePreparer(preparer, 285 autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince))) 286 } 287 if ifUnmodifiedSince != nil { 288 preparer = autorest.DecoratePreparer(preparer, 289 autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince))) 290 } 291 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 292} 293 294// DeleteSender sends the Delete request. The method will close the 295// http.Response Body if it receives an error. 296func (client JobScheduleClient) DeleteSender(req *http.Request) (*http.Response, error) { 297 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 298} 299 300// DeleteResponder handles the response to the Delete request. The method always 301// closes the http.Response Body. 302func (client JobScheduleClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { 303 err = autorest.Respond( 304 resp, 305 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 306 autorest.ByClosing()) 307 result.Response = resp 308 return 309} 310 311// Disable no new jobs will be created until the job schedule is enabled again. 312// Parameters: 313// jobScheduleID - the ID of the job schedule to disable. 314// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 315// seconds. 316// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as 317// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. 318// returnClientRequestID - whether the server should return the client-request-id in the response. 319// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock 320// time; set it explicitly if you are calling the REST API directly. 321// ifMatch - an ETag value associated with the version of the resource known to the client. The operation will 322// be performed only if the resource's current ETag on the service exactly matches the value specified by the 323// client. 324// ifNoneMatch - an ETag value associated with the version of the resource known to the client. The operation 325// will be performed only if the resource's current ETag on the service does not match the value specified by 326// the client. 327// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The 328// operation will be performed only if the resource on the service has been modified since the specified time. 329// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The 330// operation will be performed only if the resource on the service has not been modified since the specified 331// time. 332func (client JobScheduleClient) Disable(ctx context.Context, jobScheduleID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) { 333 if tracing.IsEnabled() { 334 ctx = tracing.StartSpan(ctx, fqdn+"/JobScheduleClient.Disable") 335 defer func() { 336 sc := -1 337 if result.Response != nil { 338 sc = result.Response.StatusCode 339 } 340 tracing.EndSpan(ctx, sc, err) 341 }() 342 } 343 req, err := client.DisablePreparer(ctx, jobScheduleID, timeout, clientRequestID, returnClientRequestID, ocpDate, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince) 344 if err != nil { 345 err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Disable", nil, "Failure preparing request") 346 return 347 } 348 349 resp, err := client.DisableSender(req) 350 if err != nil { 351 result.Response = resp 352 err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Disable", resp, "Failure sending request") 353 return 354 } 355 356 result, err = client.DisableResponder(resp) 357 if err != nil { 358 err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Disable", resp, "Failure responding to request") 359 return 360 } 361 362 return 363} 364 365// DisablePreparer prepares the Disable request. 366func (client JobScheduleClient) DisablePreparer(ctx context.Context, jobScheduleID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (*http.Request, error) { 367 pathParameters := map[string]interface{}{ 368 "jobScheduleId": autorest.Encode("path", jobScheduleID), 369 } 370 371 const APIVersion = "2017-05-01.5.0" 372 queryParameters := map[string]interface{}{ 373 "api-version": APIVersion, 374 } 375 if timeout != nil { 376 queryParameters["timeout"] = autorest.Encode("query", *timeout) 377 } else { 378 queryParameters["timeout"] = autorest.Encode("query", 30) 379 } 380 381 preparer := autorest.CreatePreparer( 382 autorest.AsPost(), 383 autorest.WithBaseURL(client.BaseURI), 384 autorest.WithPathParameters("/jobschedules/{jobScheduleId}/disable", pathParameters), 385 autorest.WithQueryParameters(queryParameters)) 386 if clientRequestID != nil { 387 preparer = autorest.DecoratePreparer(preparer, 388 autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) 389 } 390 if returnClientRequestID != nil { 391 preparer = autorest.DecoratePreparer(preparer, 392 autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) 393 } else { 394 preparer = autorest.DecoratePreparer(preparer, 395 autorest.WithHeader("return-client-request-id", autorest.String(false))) 396 } 397 if ocpDate != nil { 398 preparer = autorest.DecoratePreparer(preparer, 399 autorest.WithHeader("ocp-date", autorest.String(ocpDate))) 400 } 401 if len(ifMatch) > 0 { 402 preparer = autorest.DecoratePreparer(preparer, 403 autorest.WithHeader("If-Match", autorest.String(ifMatch))) 404 } 405 if len(ifNoneMatch) > 0 { 406 preparer = autorest.DecoratePreparer(preparer, 407 autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) 408 } 409 if ifModifiedSince != nil { 410 preparer = autorest.DecoratePreparer(preparer, 411 autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince))) 412 } 413 if ifUnmodifiedSince != nil { 414 preparer = autorest.DecoratePreparer(preparer, 415 autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince))) 416 } 417 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 418} 419 420// DisableSender sends the Disable request. The method will close the 421// http.Response Body if it receives an error. 422func (client JobScheduleClient) DisableSender(req *http.Request) (*http.Response, error) { 423 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 424} 425 426// DisableResponder handles the response to the Disable request. The method always 427// closes the http.Response Body. 428func (client JobScheduleClient) DisableResponder(resp *http.Response) (result autorest.Response, err error) { 429 err = autorest.Respond( 430 resp, 431 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), 432 autorest.ByClosing()) 433 result.Response = resp 434 return 435} 436 437// Enable sends the enable request. 438// Parameters: 439// jobScheduleID - the ID of the job schedule to enable. 440// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 441// seconds. 442// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as 443// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. 444// returnClientRequestID - whether the server should return the client-request-id in the response. 445// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock 446// time; set it explicitly if you are calling the REST API directly. 447// ifMatch - an ETag value associated with the version of the resource known to the client. The operation will 448// be performed only if the resource's current ETag on the service exactly matches the value specified by the 449// client. 450// ifNoneMatch - an ETag value associated with the version of the resource known to the client. The operation 451// will be performed only if the resource's current ETag on the service does not match the value specified by 452// the client. 453// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The 454// operation will be performed only if the resource on the service has been modified since the specified time. 455// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The 456// operation will be performed only if the resource on the service has not been modified since the specified 457// time. 458func (client JobScheduleClient) Enable(ctx context.Context, jobScheduleID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) { 459 if tracing.IsEnabled() { 460 ctx = tracing.StartSpan(ctx, fqdn+"/JobScheduleClient.Enable") 461 defer func() { 462 sc := -1 463 if result.Response != nil { 464 sc = result.Response.StatusCode 465 } 466 tracing.EndSpan(ctx, sc, err) 467 }() 468 } 469 req, err := client.EnablePreparer(ctx, jobScheduleID, timeout, clientRequestID, returnClientRequestID, ocpDate, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince) 470 if err != nil { 471 err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Enable", nil, "Failure preparing request") 472 return 473 } 474 475 resp, err := client.EnableSender(req) 476 if err != nil { 477 result.Response = resp 478 err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Enable", resp, "Failure sending request") 479 return 480 } 481 482 result, err = client.EnableResponder(resp) 483 if err != nil { 484 err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Enable", resp, "Failure responding to request") 485 return 486 } 487 488 return 489} 490 491// EnablePreparer prepares the Enable request. 492func (client JobScheduleClient) EnablePreparer(ctx context.Context, jobScheduleID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (*http.Request, error) { 493 pathParameters := map[string]interface{}{ 494 "jobScheduleId": autorest.Encode("path", jobScheduleID), 495 } 496 497 const APIVersion = "2017-05-01.5.0" 498 queryParameters := map[string]interface{}{ 499 "api-version": APIVersion, 500 } 501 if timeout != nil { 502 queryParameters["timeout"] = autorest.Encode("query", *timeout) 503 } else { 504 queryParameters["timeout"] = autorest.Encode("query", 30) 505 } 506 507 preparer := autorest.CreatePreparer( 508 autorest.AsPost(), 509 autorest.WithBaseURL(client.BaseURI), 510 autorest.WithPathParameters("/jobschedules/{jobScheduleId}/enable", pathParameters), 511 autorest.WithQueryParameters(queryParameters)) 512 if clientRequestID != nil { 513 preparer = autorest.DecoratePreparer(preparer, 514 autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) 515 } 516 if returnClientRequestID != nil { 517 preparer = autorest.DecoratePreparer(preparer, 518 autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) 519 } else { 520 preparer = autorest.DecoratePreparer(preparer, 521 autorest.WithHeader("return-client-request-id", autorest.String(false))) 522 } 523 if ocpDate != nil { 524 preparer = autorest.DecoratePreparer(preparer, 525 autorest.WithHeader("ocp-date", autorest.String(ocpDate))) 526 } 527 if len(ifMatch) > 0 { 528 preparer = autorest.DecoratePreparer(preparer, 529 autorest.WithHeader("If-Match", autorest.String(ifMatch))) 530 } 531 if len(ifNoneMatch) > 0 { 532 preparer = autorest.DecoratePreparer(preparer, 533 autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) 534 } 535 if ifModifiedSince != nil { 536 preparer = autorest.DecoratePreparer(preparer, 537 autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince))) 538 } 539 if ifUnmodifiedSince != nil { 540 preparer = autorest.DecoratePreparer(preparer, 541 autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince))) 542 } 543 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 544} 545 546// EnableSender sends the Enable request. The method will close the 547// http.Response Body if it receives an error. 548func (client JobScheduleClient) EnableSender(req *http.Request) (*http.Response, error) { 549 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 550} 551 552// EnableResponder handles the response to the Enable request. The method always 553// closes the http.Response Body. 554func (client JobScheduleClient) EnableResponder(resp *http.Response) (result autorest.Response, err error) { 555 err = autorest.Respond( 556 resp, 557 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), 558 autorest.ByClosing()) 559 result.Response = resp 560 return 561} 562 563// Exists sends the exists request. 564// Parameters: 565// jobScheduleID - the ID of the job schedule which you want to check. 566// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 567// seconds. 568// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as 569// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. 570// returnClientRequestID - whether the server should return the client-request-id in the response. 571// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock 572// time; set it explicitly if you are calling the REST API directly. 573// ifMatch - an ETag value associated with the version of the resource known to the client. The operation will 574// be performed only if the resource's current ETag on the service exactly matches the value specified by the 575// client. 576// ifNoneMatch - an ETag value associated with the version of the resource known to the client. The operation 577// will be performed only if the resource's current ETag on the service does not match the value specified by 578// the client. 579// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The 580// operation will be performed only if the resource on the service has been modified since the specified time. 581// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The 582// operation will be performed only if the resource on the service has not been modified since the specified 583// time. 584func (client JobScheduleClient) Exists(ctx context.Context, jobScheduleID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) { 585 if tracing.IsEnabled() { 586 ctx = tracing.StartSpan(ctx, fqdn+"/JobScheduleClient.Exists") 587 defer func() { 588 sc := -1 589 if result.Response != nil { 590 sc = result.Response.StatusCode 591 } 592 tracing.EndSpan(ctx, sc, err) 593 }() 594 } 595 req, err := client.ExistsPreparer(ctx, jobScheduleID, timeout, clientRequestID, returnClientRequestID, ocpDate, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince) 596 if err != nil { 597 err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Exists", nil, "Failure preparing request") 598 return 599 } 600 601 resp, err := client.ExistsSender(req) 602 if err != nil { 603 result.Response = resp 604 err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Exists", resp, "Failure sending request") 605 return 606 } 607 608 result, err = client.ExistsResponder(resp) 609 if err != nil { 610 err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Exists", resp, "Failure responding to request") 611 return 612 } 613 614 return 615} 616 617// ExistsPreparer prepares the Exists request. 618func (client JobScheduleClient) ExistsPreparer(ctx context.Context, jobScheduleID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (*http.Request, error) { 619 pathParameters := map[string]interface{}{ 620 "jobScheduleId": autorest.Encode("path", jobScheduleID), 621 } 622 623 const APIVersion = "2017-05-01.5.0" 624 queryParameters := map[string]interface{}{ 625 "api-version": APIVersion, 626 } 627 if timeout != nil { 628 queryParameters["timeout"] = autorest.Encode("query", *timeout) 629 } else { 630 queryParameters["timeout"] = autorest.Encode("query", 30) 631 } 632 633 preparer := autorest.CreatePreparer( 634 autorest.AsHead(), 635 autorest.WithBaseURL(client.BaseURI), 636 autorest.WithPathParameters("/jobschedules/{jobScheduleId}", pathParameters), 637 autorest.WithQueryParameters(queryParameters)) 638 if clientRequestID != nil { 639 preparer = autorest.DecoratePreparer(preparer, 640 autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) 641 } 642 if returnClientRequestID != nil { 643 preparer = autorest.DecoratePreparer(preparer, 644 autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) 645 } else { 646 preparer = autorest.DecoratePreparer(preparer, 647 autorest.WithHeader("return-client-request-id", autorest.String(false))) 648 } 649 if ocpDate != nil { 650 preparer = autorest.DecoratePreparer(preparer, 651 autorest.WithHeader("ocp-date", autorest.String(ocpDate))) 652 } 653 if len(ifMatch) > 0 { 654 preparer = autorest.DecoratePreparer(preparer, 655 autorest.WithHeader("If-Match", autorest.String(ifMatch))) 656 } 657 if len(ifNoneMatch) > 0 { 658 preparer = autorest.DecoratePreparer(preparer, 659 autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) 660 } 661 if ifModifiedSince != nil { 662 preparer = autorest.DecoratePreparer(preparer, 663 autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince))) 664 } 665 if ifUnmodifiedSince != nil { 666 preparer = autorest.DecoratePreparer(preparer, 667 autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince))) 668 } 669 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 670} 671 672// ExistsSender sends the Exists request. The method will close the 673// http.Response Body if it receives an error. 674func (client JobScheduleClient) ExistsSender(req *http.Request) (*http.Response, error) { 675 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 676} 677 678// ExistsResponder handles the response to the Exists request. The method always 679// closes the http.Response Body. 680func (client JobScheduleClient) ExistsResponder(resp *http.Response) (result autorest.Response, err error) { 681 err = autorest.Respond( 682 resp, 683 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), 684 autorest.ByClosing()) 685 result.Response = resp 686 return 687} 688 689// Get gets information about the specified job schedule. 690// Parameters: 691// jobScheduleID - the ID of the job schedule to get. 692// selectParameter - an OData $select clause. 693// expand - an OData $expand clause. 694// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 695// seconds. 696// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as 697// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. 698// returnClientRequestID - whether the server should return the client-request-id in the response. 699// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock 700// time; set it explicitly if you are calling the REST API directly. 701// ifMatch - an ETag value associated with the version of the resource known to the client. The operation will 702// be performed only if the resource's current ETag on the service exactly matches the value specified by the 703// client. 704// ifNoneMatch - an ETag value associated with the version of the resource known to the client. The operation 705// will be performed only if the resource's current ETag on the service does not match the value specified by 706// the client. 707// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The 708// operation will be performed only if the resource on the service has been modified since the specified time. 709// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The 710// operation will be performed only if the resource on the service has not been modified since the specified 711// time. 712func (client JobScheduleClient) Get(ctx context.Context, jobScheduleID string, selectParameter string, expand string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result CloudJobSchedule, err error) { 713 if tracing.IsEnabled() { 714 ctx = tracing.StartSpan(ctx, fqdn+"/JobScheduleClient.Get") 715 defer func() { 716 sc := -1 717 if result.Response.Response != nil { 718 sc = result.Response.Response.StatusCode 719 } 720 tracing.EndSpan(ctx, sc, err) 721 }() 722 } 723 req, err := client.GetPreparer(ctx, jobScheduleID, selectParameter, expand, timeout, clientRequestID, returnClientRequestID, ocpDate, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince) 724 if err != nil { 725 err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Get", nil, "Failure preparing request") 726 return 727 } 728 729 resp, err := client.GetSender(req) 730 if err != nil { 731 result.Response = autorest.Response{Response: resp} 732 err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Get", resp, "Failure sending request") 733 return 734 } 735 736 result, err = client.GetResponder(resp) 737 if err != nil { 738 err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Get", resp, "Failure responding to request") 739 return 740 } 741 742 return 743} 744 745// GetPreparer prepares the Get request. 746func (client JobScheduleClient) GetPreparer(ctx context.Context, jobScheduleID string, selectParameter string, expand string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (*http.Request, error) { 747 pathParameters := map[string]interface{}{ 748 "jobScheduleId": autorest.Encode("path", jobScheduleID), 749 } 750 751 const APIVersion = "2017-05-01.5.0" 752 queryParameters := map[string]interface{}{ 753 "api-version": APIVersion, 754 } 755 if len(selectParameter) > 0 { 756 queryParameters["$select"] = autorest.Encode("query", selectParameter) 757 } 758 if len(expand) > 0 { 759 queryParameters["$expand"] = autorest.Encode("query", expand) 760 } 761 if timeout != nil { 762 queryParameters["timeout"] = autorest.Encode("query", *timeout) 763 } else { 764 queryParameters["timeout"] = autorest.Encode("query", 30) 765 } 766 767 preparer := autorest.CreatePreparer( 768 autorest.AsGet(), 769 autorest.WithBaseURL(client.BaseURI), 770 autorest.WithPathParameters("/jobschedules/{jobScheduleId}", pathParameters), 771 autorest.WithQueryParameters(queryParameters)) 772 if clientRequestID != nil { 773 preparer = autorest.DecoratePreparer(preparer, 774 autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) 775 } 776 if returnClientRequestID != nil { 777 preparer = autorest.DecoratePreparer(preparer, 778 autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) 779 } else { 780 preparer = autorest.DecoratePreparer(preparer, 781 autorest.WithHeader("return-client-request-id", autorest.String(false))) 782 } 783 if ocpDate != nil { 784 preparer = autorest.DecoratePreparer(preparer, 785 autorest.WithHeader("ocp-date", autorest.String(ocpDate))) 786 } 787 if len(ifMatch) > 0 { 788 preparer = autorest.DecoratePreparer(preparer, 789 autorest.WithHeader("If-Match", autorest.String(ifMatch))) 790 } 791 if len(ifNoneMatch) > 0 { 792 preparer = autorest.DecoratePreparer(preparer, 793 autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) 794 } 795 if ifModifiedSince != nil { 796 preparer = autorest.DecoratePreparer(preparer, 797 autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince))) 798 } 799 if ifUnmodifiedSince != nil { 800 preparer = autorest.DecoratePreparer(preparer, 801 autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince))) 802 } 803 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 804} 805 806// GetSender sends the Get request. The method will close the 807// http.Response Body if it receives an error. 808func (client JobScheduleClient) GetSender(req *http.Request) (*http.Response, error) { 809 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 810} 811 812// GetResponder handles the response to the Get request. The method always 813// closes the http.Response Body. 814func (client JobScheduleClient) GetResponder(resp *http.Response) (result CloudJobSchedule, err error) { 815 err = autorest.Respond( 816 resp, 817 azure.WithErrorUnlessStatusCode(http.StatusOK), 818 autorest.ByUnmarshallingJSON(&result), 819 autorest.ByClosing()) 820 result.Response = autorest.Response{Response: resp} 821 return 822} 823 824// List sends the list request. 825// Parameters: 826// filter - an OData $filter clause. 827// selectParameter - an OData $select clause. 828// expand - an OData $expand clause. 829// maxResults - the maximum number of items to return in the response. A maximum of 1000 job schedules can be 830// returned. 831// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 832// seconds. 833// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as 834// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. 835// returnClientRequestID - whether the server should return the client-request-id in the response. 836// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock 837// time; set it explicitly if you are calling the REST API directly. 838func (client JobScheduleClient) List(ctx context.Context, filter string, selectParameter string, expand string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result CloudJobScheduleListResultPage, err error) { 839 if tracing.IsEnabled() { 840 ctx = tracing.StartSpan(ctx, fqdn+"/JobScheduleClient.List") 841 defer func() { 842 sc := -1 843 if result.cjslr.Response.Response != nil { 844 sc = result.cjslr.Response.Response.StatusCode 845 } 846 tracing.EndSpan(ctx, sc, err) 847 }() 848 } 849 if err := validation.Validate([]validation.Validation{ 850 {TargetValue: maxResults, 851 Constraints: []validation.Constraint{{Target: "maxResults", Name: validation.Null, Rule: false, 852 Chain: []validation.Constraint{{Target: "maxResults", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil}, 853 {Target: "maxResults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, 854 }}}}}); err != nil { 855 return result, validation.NewError("batch.JobScheduleClient", "List", err.Error()) 856 } 857 858 result.fn = client.listNextResults 859 req, err := client.ListPreparer(ctx, filter, selectParameter, expand, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) 860 if err != nil { 861 err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "List", nil, "Failure preparing request") 862 return 863 } 864 865 resp, err := client.ListSender(req) 866 if err != nil { 867 result.cjslr.Response = autorest.Response{Response: resp} 868 err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "List", resp, "Failure sending request") 869 return 870 } 871 872 result.cjslr, err = client.ListResponder(resp) 873 if err != nil { 874 err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "List", resp, "Failure responding to request") 875 return 876 } 877 if result.cjslr.hasNextLink() && result.cjslr.IsEmpty() { 878 err = result.NextWithContext(ctx) 879 return 880 } 881 882 return 883} 884 885// ListPreparer prepares the List request. 886func (client JobScheduleClient) ListPreparer(ctx context.Context, filter string, selectParameter string, expand string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { 887 const APIVersion = "2017-05-01.5.0" 888 queryParameters := map[string]interface{}{ 889 "api-version": APIVersion, 890 } 891 if len(filter) > 0 { 892 queryParameters["$filter"] = autorest.Encode("query", filter) 893 } 894 if len(selectParameter) > 0 { 895 queryParameters["$select"] = autorest.Encode("query", selectParameter) 896 } 897 if len(expand) > 0 { 898 queryParameters["$expand"] = autorest.Encode("query", expand) 899 } 900 if maxResults != nil { 901 queryParameters["maxresults"] = autorest.Encode("query", *maxResults) 902 } else { 903 queryParameters["maxresults"] = autorest.Encode("query", 1000) 904 } 905 if timeout != nil { 906 queryParameters["timeout"] = autorest.Encode("query", *timeout) 907 } else { 908 queryParameters["timeout"] = autorest.Encode("query", 30) 909 } 910 911 preparer := autorest.CreatePreparer( 912 autorest.AsGet(), 913 autorest.WithBaseURL(client.BaseURI), 914 autorest.WithPath("/jobschedules"), 915 autorest.WithQueryParameters(queryParameters)) 916 if clientRequestID != nil { 917 preparer = autorest.DecoratePreparer(preparer, 918 autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) 919 } 920 if returnClientRequestID != nil { 921 preparer = autorest.DecoratePreparer(preparer, 922 autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) 923 } else { 924 preparer = autorest.DecoratePreparer(preparer, 925 autorest.WithHeader("return-client-request-id", autorest.String(false))) 926 } 927 if ocpDate != nil { 928 preparer = autorest.DecoratePreparer(preparer, 929 autorest.WithHeader("ocp-date", autorest.String(ocpDate))) 930 } 931 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 932} 933 934// ListSender sends the List request. The method will close the 935// http.Response Body if it receives an error. 936func (client JobScheduleClient) ListSender(req *http.Request) (*http.Response, error) { 937 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 938} 939 940// ListResponder handles the response to the List request. The method always 941// closes the http.Response Body. 942func (client JobScheduleClient) ListResponder(resp *http.Response) (result CloudJobScheduleListResult, err error) { 943 err = autorest.Respond( 944 resp, 945 azure.WithErrorUnlessStatusCode(http.StatusOK), 946 autorest.ByUnmarshallingJSON(&result), 947 autorest.ByClosing()) 948 result.Response = autorest.Response{Response: resp} 949 return 950} 951 952// listNextResults retrieves the next set of results, if any. 953func (client JobScheduleClient) listNextResults(ctx context.Context, lastResults CloudJobScheduleListResult) (result CloudJobScheduleListResult, err error) { 954 req, err := lastResults.cloudJobScheduleListResultPreparer(ctx) 955 if err != nil { 956 return result, autorest.NewErrorWithError(err, "batch.JobScheduleClient", "listNextResults", nil, "Failure preparing next results request") 957 } 958 if req == nil { 959 return 960 } 961 resp, err := client.ListSender(req) 962 if err != nil { 963 result.Response = autorest.Response{Response: resp} 964 return result, autorest.NewErrorWithError(err, "batch.JobScheduleClient", "listNextResults", resp, "Failure sending next results request") 965 } 966 result, err = client.ListResponder(resp) 967 if err != nil { 968 err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "listNextResults", resp, "Failure responding to next results request") 969 } 970 return 971} 972 973// ListComplete enumerates all values, automatically crossing page boundaries as required. 974func (client JobScheduleClient) ListComplete(ctx context.Context, filter string, selectParameter string, expand string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result CloudJobScheduleListResultIterator, err error) { 975 if tracing.IsEnabled() { 976 ctx = tracing.StartSpan(ctx, fqdn+"/JobScheduleClient.List") 977 defer func() { 978 sc := -1 979 if result.Response().Response.Response != nil { 980 sc = result.page.Response().Response.Response.StatusCode 981 } 982 tracing.EndSpan(ctx, sc, err) 983 }() 984 } 985 result.page, err = client.List(ctx, filter, selectParameter, expand, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) 986 return 987} 988 989// Patch this replaces only the job schedule properties specified in the request. For example, if the schedule property 990// is not specified with this request, then the Batch service will keep the existing schedule. Changes to a job 991// schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are 992// unaffected. 993// Parameters: 994// jobScheduleID - the ID of the job schedule to update. 995// jobSchedulePatchParameter - the parameters for the request. 996// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 997// seconds. 998// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as 999// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. 1000// returnClientRequestID - whether the server should return the client-request-id in the response. 1001// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock 1002// time; set it explicitly if you are calling the REST API directly. 1003// ifMatch - an ETag value associated with the version of the resource known to the client. The operation will 1004// be performed only if the resource's current ETag on the service exactly matches the value specified by the 1005// client. 1006// ifNoneMatch - an ETag value associated with the version of the resource known to the client. The operation 1007// will be performed only if the resource's current ETag on the service does not match the value specified by 1008// the client. 1009// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The 1010// operation will be performed only if the resource on the service has been modified since the specified time. 1011// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The 1012// operation will be performed only if the resource on the service has not been modified since the specified 1013// time. 1014func (client JobScheduleClient) Patch(ctx context.Context, jobScheduleID string, jobSchedulePatchParameter JobSchedulePatchParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) { 1015 if tracing.IsEnabled() { 1016 ctx = tracing.StartSpan(ctx, fqdn+"/JobScheduleClient.Patch") 1017 defer func() { 1018 sc := -1 1019 if result.Response != nil { 1020 sc = result.Response.StatusCode 1021 } 1022 tracing.EndSpan(ctx, sc, err) 1023 }() 1024 } 1025 req, err := client.PatchPreparer(ctx, jobScheduleID, jobSchedulePatchParameter, timeout, clientRequestID, returnClientRequestID, ocpDate, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince) 1026 if err != nil { 1027 err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Patch", nil, "Failure preparing request") 1028 return 1029 } 1030 1031 resp, err := client.PatchSender(req) 1032 if err != nil { 1033 result.Response = resp 1034 err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Patch", resp, "Failure sending request") 1035 return 1036 } 1037 1038 result, err = client.PatchResponder(resp) 1039 if err != nil { 1040 err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Patch", resp, "Failure responding to request") 1041 return 1042 } 1043 1044 return 1045} 1046 1047// PatchPreparer prepares the Patch request. 1048func (client JobScheduleClient) PatchPreparer(ctx context.Context, jobScheduleID string, jobSchedulePatchParameter JobSchedulePatchParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (*http.Request, error) { 1049 pathParameters := map[string]interface{}{ 1050 "jobScheduleId": autorest.Encode("path", jobScheduleID), 1051 } 1052 1053 const APIVersion = "2017-05-01.5.0" 1054 queryParameters := map[string]interface{}{ 1055 "api-version": APIVersion, 1056 } 1057 if timeout != nil { 1058 queryParameters["timeout"] = autorest.Encode("query", *timeout) 1059 } else { 1060 queryParameters["timeout"] = autorest.Encode("query", 30) 1061 } 1062 1063 preparer := autorest.CreatePreparer( 1064 autorest.AsContentType("application/json; odata=minimalmetadata; charset=utf-8"), 1065 autorest.AsPatch(), 1066 autorest.WithBaseURL(client.BaseURI), 1067 autorest.WithPathParameters("/jobschedules/{jobScheduleId}", pathParameters), 1068 autorest.WithJSON(jobSchedulePatchParameter), 1069 autorest.WithQueryParameters(queryParameters)) 1070 if clientRequestID != nil { 1071 preparer = autorest.DecoratePreparer(preparer, 1072 autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) 1073 } 1074 if returnClientRequestID != nil { 1075 preparer = autorest.DecoratePreparer(preparer, 1076 autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) 1077 } else { 1078 preparer = autorest.DecoratePreparer(preparer, 1079 autorest.WithHeader("return-client-request-id", autorest.String(false))) 1080 } 1081 if ocpDate != nil { 1082 preparer = autorest.DecoratePreparer(preparer, 1083 autorest.WithHeader("ocp-date", autorest.String(ocpDate))) 1084 } 1085 if len(ifMatch) > 0 { 1086 preparer = autorest.DecoratePreparer(preparer, 1087 autorest.WithHeader("If-Match", autorest.String(ifMatch))) 1088 } 1089 if len(ifNoneMatch) > 0 { 1090 preparer = autorest.DecoratePreparer(preparer, 1091 autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) 1092 } 1093 if ifModifiedSince != nil { 1094 preparer = autorest.DecoratePreparer(preparer, 1095 autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince))) 1096 } 1097 if ifUnmodifiedSince != nil { 1098 preparer = autorest.DecoratePreparer(preparer, 1099 autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince))) 1100 } 1101 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1102} 1103 1104// PatchSender sends the Patch request. The method will close the 1105// http.Response Body if it receives an error. 1106func (client JobScheduleClient) PatchSender(req *http.Request) (*http.Response, error) { 1107 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1108} 1109 1110// PatchResponder handles the response to the Patch request. The method always 1111// closes the http.Response Body. 1112func (client JobScheduleClient) PatchResponder(resp *http.Response) (result autorest.Response, err error) { 1113 err = autorest.Respond( 1114 resp, 1115 azure.WithErrorUnlessStatusCode(http.StatusOK), 1116 autorest.ByClosing()) 1117 result.Response = resp 1118 return 1119} 1120 1121// Terminate sends the terminate request. 1122// Parameters: 1123// jobScheduleID - the ID of the job schedule to terminates. 1124// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 1125// seconds. 1126// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as 1127// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. 1128// returnClientRequestID - whether the server should return the client-request-id in the response. 1129// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock 1130// time; set it explicitly if you are calling the REST API directly. 1131// ifMatch - an ETag value associated with the version of the resource known to the client. The operation will 1132// be performed only if the resource's current ETag on the service exactly matches the value specified by the 1133// client. 1134// ifNoneMatch - an ETag value associated with the version of the resource known to the client. The operation 1135// will be performed only if the resource's current ETag on the service does not match the value specified by 1136// the client. 1137// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The 1138// operation will be performed only if the resource on the service has been modified since the specified time. 1139// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The 1140// operation will be performed only if the resource on the service has not been modified since the specified 1141// time. 1142func (client JobScheduleClient) Terminate(ctx context.Context, jobScheduleID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) { 1143 if tracing.IsEnabled() { 1144 ctx = tracing.StartSpan(ctx, fqdn+"/JobScheduleClient.Terminate") 1145 defer func() { 1146 sc := -1 1147 if result.Response != nil { 1148 sc = result.Response.StatusCode 1149 } 1150 tracing.EndSpan(ctx, sc, err) 1151 }() 1152 } 1153 req, err := client.TerminatePreparer(ctx, jobScheduleID, timeout, clientRequestID, returnClientRequestID, ocpDate, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince) 1154 if err != nil { 1155 err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Terminate", nil, "Failure preparing request") 1156 return 1157 } 1158 1159 resp, err := client.TerminateSender(req) 1160 if err != nil { 1161 result.Response = resp 1162 err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Terminate", resp, "Failure sending request") 1163 return 1164 } 1165 1166 result, err = client.TerminateResponder(resp) 1167 if err != nil { 1168 err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Terminate", resp, "Failure responding to request") 1169 return 1170 } 1171 1172 return 1173} 1174 1175// TerminatePreparer prepares the Terminate request. 1176func (client JobScheduleClient) TerminatePreparer(ctx context.Context, jobScheduleID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (*http.Request, error) { 1177 pathParameters := map[string]interface{}{ 1178 "jobScheduleId": autorest.Encode("path", jobScheduleID), 1179 } 1180 1181 const APIVersion = "2017-05-01.5.0" 1182 queryParameters := map[string]interface{}{ 1183 "api-version": APIVersion, 1184 } 1185 if timeout != nil { 1186 queryParameters["timeout"] = autorest.Encode("query", *timeout) 1187 } else { 1188 queryParameters["timeout"] = autorest.Encode("query", 30) 1189 } 1190 1191 preparer := autorest.CreatePreparer( 1192 autorest.AsPost(), 1193 autorest.WithBaseURL(client.BaseURI), 1194 autorest.WithPathParameters("/jobschedules/{jobScheduleId}/terminate", pathParameters), 1195 autorest.WithQueryParameters(queryParameters)) 1196 if clientRequestID != nil { 1197 preparer = autorest.DecoratePreparer(preparer, 1198 autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) 1199 } 1200 if returnClientRequestID != nil { 1201 preparer = autorest.DecoratePreparer(preparer, 1202 autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) 1203 } else { 1204 preparer = autorest.DecoratePreparer(preparer, 1205 autorest.WithHeader("return-client-request-id", autorest.String(false))) 1206 } 1207 if ocpDate != nil { 1208 preparer = autorest.DecoratePreparer(preparer, 1209 autorest.WithHeader("ocp-date", autorest.String(ocpDate))) 1210 } 1211 if len(ifMatch) > 0 { 1212 preparer = autorest.DecoratePreparer(preparer, 1213 autorest.WithHeader("If-Match", autorest.String(ifMatch))) 1214 } 1215 if len(ifNoneMatch) > 0 { 1216 preparer = autorest.DecoratePreparer(preparer, 1217 autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) 1218 } 1219 if ifModifiedSince != nil { 1220 preparer = autorest.DecoratePreparer(preparer, 1221 autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince))) 1222 } 1223 if ifUnmodifiedSince != nil { 1224 preparer = autorest.DecoratePreparer(preparer, 1225 autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince))) 1226 } 1227 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1228} 1229 1230// TerminateSender sends the Terminate request. The method will close the 1231// http.Response Body if it receives an error. 1232func (client JobScheduleClient) TerminateSender(req *http.Request) (*http.Response, error) { 1233 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1234} 1235 1236// TerminateResponder handles the response to the Terminate request. The method always 1237// closes the http.Response Body. 1238func (client JobScheduleClient) TerminateResponder(resp *http.Response) (result autorest.Response, err error) { 1239 err = autorest.Respond( 1240 resp, 1241 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 1242 autorest.ByClosing()) 1243 result.Response = resp 1244 return 1245} 1246 1247// Update this fully replaces all the updatable properties of the job schedule. For example, if the schedule property 1248// is not specified with this request, then the Batch service will remove the existing schedule. Changes to a job 1249// schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are 1250// unaffected. 1251// Parameters: 1252// jobScheduleID - the ID of the job schedule to update. 1253// jobScheduleUpdateParameter - the parameters for the request. 1254// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 1255// seconds. 1256// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as 1257// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. 1258// returnClientRequestID - whether the server should return the client-request-id in the response. 1259// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock 1260// time; set it explicitly if you are calling the REST API directly. 1261// ifMatch - an ETag value associated with the version of the resource known to the client. The operation will 1262// be performed only if the resource's current ETag on the service exactly matches the value specified by the 1263// client. 1264// ifNoneMatch - an ETag value associated with the version of the resource known to the client. The operation 1265// will be performed only if the resource's current ETag on the service does not match the value specified by 1266// the client. 1267// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The 1268// operation will be performed only if the resource on the service has been modified since the specified time. 1269// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The 1270// operation will be performed only if the resource on the service has not been modified since the specified 1271// time. 1272func (client JobScheduleClient) Update(ctx context.Context, jobScheduleID string, jobScheduleUpdateParameter JobScheduleUpdateParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) { 1273 if tracing.IsEnabled() { 1274 ctx = tracing.StartSpan(ctx, fqdn+"/JobScheduleClient.Update") 1275 defer func() { 1276 sc := -1 1277 if result.Response != nil { 1278 sc = result.Response.StatusCode 1279 } 1280 tracing.EndSpan(ctx, sc, err) 1281 }() 1282 } 1283 if err := validation.Validate([]validation.Validation{ 1284 {TargetValue: jobScheduleUpdateParameter, 1285 Constraints: []validation.Constraint{{Target: "jobScheduleUpdateParameter.Schedule", Name: validation.Null, Rule: true, Chain: nil}, 1286 {Target: "jobScheduleUpdateParameter.JobSpecification", Name: validation.Null, Rule: true, 1287 Chain: []validation.Constraint{{Target: "jobScheduleUpdateParameter.JobSpecification.JobManagerTask", Name: validation.Null, Rule: false, 1288 Chain: []validation.Constraint{{Target: "jobScheduleUpdateParameter.JobSpecification.JobManagerTask.ID", Name: validation.Null, Rule: true, Chain: nil}, 1289 {Target: "jobScheduleUpdateParameter.JobSpecification.JobManagerTask.CommandLine", Name: validation.Null, Rule: true, Chain: nil}, 1290 }}, 1291 {Target: "jobScheduleUpdateParameter.JobSpecification.JobPreparationTask", Name: validation.Null, Rule: false, 1292 Chain: []validation.Constraint{{Target: "jobScheduleUpdateParameter.JobSpecification.JobPreparationTask.CommandLine", Name: validation.Null, Rule: true, Chain: nil}}}, 1293 {Target: "jobScheduleUpdateParameter.JobSpecification.JobReleaseTask", Name: validation.Null, Rule: false, 1294 Chain: []validation.Constraint{{Target: "jobScheduleUpdateParameter.JobSpecification.JobReleaseTask.CommandLine", Name: validation.Null, Rule: true, Chain: nil}}}, 1295 {Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo", Name: validation.Null, Rule: true, 1296 Chain: []validation.Constraint{{Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification", Name: validation.Null, Rule: false, 1297 Chain: []validation.Constraint{{Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification.Pool", Name: validation.Null, Rule: false, 1298 Chain: []validation.Constraint{{Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VMSize", Name: validation.Null, Rule: true, Chain: nil}, 1299 {Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.CloudServiceConfiguration", Name: validation.Null, Rule: false, 1300 Chain: []validation.Constraint{{Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.CloudServiceConfiguration.OsFamily", Name: validation.Null, Rule: true, Chain: nil}}}, 1301 {Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration", Name: validation.Null, Rule: false, 1302 Chain: []validation.Constraint{{Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ImageReference", Name: validation.Null, Rule: false, 1303 Chain: []validation.Constraint{{Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ImageReference.Publisher", Name: validation.Null, Rule: true, Chain: nil}, 1304 {Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ImageReference.Offer", Name: validation.Null, Rule: true, Chain: nil}, 1305 {Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ImageReference.Sku", Name: validation.Null, Rule: true, Chain: nil}, 1306 }}, 1307 {Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.OsDisk", Name: validation.Null, Rule: false, 1308 Chain: []validation.Constraint{{Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.OsDisk.ImageUris", Name: validation.Null, Rule: true, Chain: nil}}}, 1309 {Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.NodeAgentSKUID", Name: validation.Null, Rule: true, Chain: nil}, 1310 }}, 1311 {Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.StartTask", Name: validation.Null, Rule: false, 1312 Chain: []validation.Constraint{{Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.StartTask.CommandLine", Name: validation.Null, Rule: true, Chain: nil}}}, 1313 }}, 1314 }}, 1315 }}, 1316 }}}}}); err != nil { 1317 return result, validation.NewError("batch.JobScheduleClient", "Update", err.Error()) 1318 } 1319 1320 req, err := client.UpdatePreparer(ctx, jobScheduleID, jobScheduleUpdateParameter, timeout, clientRequestID, returnClientRequestID, ocpDate, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince) 1321 if err != nil { 1322 err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Update", nil, "Failure preparing request") 1323 return 1324 } 1325 1326 resp, err := client.UpdateSender(req) 1327 if err != nil { 1328 result.Response = resp 1329 err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Update", resp, "Failure sending request") 1330 return 1331 } 1332 1333 result, err = client.UpdateResponder(resp) 1334 if err != nil { 1335 err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Update", resp, "Failure responding to request") 1336 return 1337 } 1338 1339 return 1340} 1341 1342// UpdatePreparer prepares the Update request. 1343func (client JobScheduleClient) UpdatePreparer(ctx context.Context, jobScheduleID string, jobScheduleUpdateParameter JobScheduleUpdateParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (*http.Request, error) { 1344 pathParameters := map[string]interface{}{ 1345 "jobScheduleId": autorest.Encode("path", jobScheduleID), 1346 } 1347 1348 const APIVersion = "2017-05-01.5.0" 1349 queryParameters := map[string]interface{}{ 1350 "api-version": APIVersion, 1351 } 1352 if timeout != nil { 1353 queryParameters["timeout"] = autorest.Encode("query", *timeout) 1354 } else { 1355 queryParameters["timeout"] = autorest.Encode("query", 30) 1356 } 1357 1358 preparer := autorest.CreatePreparer( 1359 autorest.AsContentType("application/json; odata=minimalmetadata; charset=utf-8"), 1360 autorest.AsPut(), 1361 autorest.WithBaseURL(client.BaseURI), 1362 autorest.WithPathParameters("/jobschedules/{jobScheduleId}", pathParameters), 1363 autorest.WithJSON(jobScheduleUpdateParameter), 1364 autorest.WithQueryParameters(queryParameters)) 1365 if clientRequestID != nil { 1366 preparer = autorest.DecoratePreparer(preparer, 1367 autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) 1368 } 1369 if returnClientRequestID != nil { 1370 preparer = autorest.DecoratePreparer(preparer, 1371 autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) 1372 } else { 1373 preparer = autorest.DecoratePreparer(preparer, 1374 autorest.WithHeader("return-client-request-id", autorest.String(false))) 1375 } 1376 if ocpDate != nil { 1377 preparer = autorest.DecoratePreparer(preparer, 1378 autorest.WithHeader("ocp-date", autorest.String(ocpDate))) 1379 } 1380 if len(ifMatch) > 0 { 1381 preparer = autorest.DecoratePreparer(preparer, 1382 autorest.WithHeader("If-Match", autorest.String(ifMatch))) 1383 } 1384 if len(ifNoneMatch) > 0 { 1385 preparer = autorest.DecoratePreparer(preparer, 1386 autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) 1387 } 1388 if ifModifiedSince != nil { 1389 preparer = autorest.DecoratePreparer(preparer, 1390 autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince))) 1391 } 1392 if ifUnmodifiedSince != nil { 1393 preparer = autorest.DecoratePreparer(preparer, 1394 autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince))) 1395 } 1396 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1397} 1398 1399// UpdateSender sends the Update request. The method will close the 1400// http.Response Body if it receives an error. 1401func (client JobScheduleClient) UpdateSender(req *http.Request) (*http.Response, error) { 1402 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1403} 1404 1405// UpdateResponder handles the response to the Update request. The method always 1406// closes the http.Response Body. 1407func (client JobScheduleClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { 1408 err = autorest.Respond( 1409 resp, 1410 azure.WithErrorUnlessStatusCode(http.StatusOK), 1411 autorest.ByClosing()) 1412 result.Response = resp 1413 return 1414} 1415