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