View Javadoc
1   // Copyright (c) Microsoft Corporation. All rights reserved.
2   // Licensed under the MIT License.
3   // Code generated by Microsoft (R) AutoRest Code Generator
4   
5   package com.microsoft.azure.batch.protocol.implementation;
6   
7   import retrofit2.Retrofit;
8   import com.microsoft.azure.batch.protocol.JobSchedules;
9   import com.google.common.base.Joiner;
10  import com.google.common.reflect.TypeToken;
11  import com.microsoft.azure.AzureServiceFuture;
12  import com.microsoft.azure.batch.protocol.models.BatchErrorException;
13  import com.microsoft.azure.batch.protocol.models.CloudJobSchedule;
14  import com.microsoft.azure.batch.protocol.models.JobScheduleAddHeaders;
15  import com.microsoft.azure.batch.protocol.models.JobScheduleAddOptions;
16  import com.microsoft.azure.batch.protocol.models.JobScheduleAddParameter;
17  import com.microsoft.azure.batch.protocol.models.JobScheduleDeleteHeaders;
18  import com.microsoft.azure.batch.protocol.models.JobScheduleDeleteOptions;
19  import com.microsoft.azure.batch.protocol.models.JobScheduleDisableHeaders;
20  import com.microsoft.azure.batch.protocol.models.JobScheduleDisableOptions;
21  import com.microsoft.azure.batch.protocol.models.JobScheduleEnableHeaders;
22  import com.microsoft.azure.batch.protocol.models.JobScheduleEnableOptions;
23  import com.microsoft.azure.batch.protocol.models.JobScheduleExistsHeaders;
24  import com.microsoft.azure.batch.protocol.models.JobScheduleExistsOptions;
25  import com.microsoft.azure.batch.protocol.models.JobScheduleGetHeaders;
26  import com.microsoft.azure.batch.protocol.models.JobScheduleGetOptions;
27  import com.microsoft.azure.batch.protocol.models.JobScheduleListHeaders;
28  import com.microsoft.azure.batch.protocol.models.JobScheduleListNextOptions;
29  import com.microsoft.azure.batch.protocol.models.JobScheduleListOptions;
30  import com.microsoft.azure.batch.protocol.models.JobSchedulePatchHeaders;
31  import com.microsoft.azure.batch.protocol.models.JobSchedulePatchOptions;
32  import com.microsoft.azure.batch.protocol.models.JobSchedulePatchParameter;
33  import com.microsoft.azure.batch.protocol.models.JobScheduleTerminateHeaders;
34  import com.microsoft.azure.batch.protocol.models.JobScheduleTerminateOptions;
35  import com.microsoft.azure.batch.protocol.models.JobScheduleUpdateHeaders;
36  import com.microsoft.azure.batch.protocol.models.JobScheduleUpdateOptions;
37  import com.microsoft.azure.batch.protocol.models.JobScheduleUpdateParameter;
38  import com.microsoft.azure.batch.protocol.models.PageImpl;
39  import com.microsoft.azure.ListOperationCallback;
40  import com.microsoft.azure.Page;
41  import com.microsoft.azure.PagedList;
42  import com.microsoft.rest.DateTimeRfc1123;
43  import com.microsoft.rest.ServiceCallback;
44  import com.microsoft.rest.ServiceFuture;
45  import com.microsoft.rest.ServiceResponseWithHeaders;
46  import com.microsoft.rest.Validator;
47  import java.io.IOException;
48  import java.util.List;
49  import java.util.UUID;
50  import okhttp3.ResponseBody;
51  import org.joda.time.DateTime;
52  import retrofit2.http.Body;
53  import retrofit2.http.GET;
54  import retrofit2.http.HEAD;
55  import retrofit2.http.Header;
56  import retrofit2.http.Headers;
57  import retrofit2.http.HTTP;
58  import retrofit2.http.PATCH;
59  import retrofit2.http.Path;
60  import retrofit2.http.POST;
61  import retrofit2.http.PUT;
62  import retrofit2.http.Query;
63  import retrofit2.http.Url;
64  import retrofit2.Response;
65  import rx.functions.Func1;
66  import rx.Observable;
67  
68  /**
69   * An instance of this class provides access to all the operations defined
70   * in JobSchedules.
71   */
72  public class JobSchedulesImpl implements JobSchedules {
73      /** The Retrofit service to perform REST calls. */
74      private JobSchedulesService service;
75      /** The service client containing this operation class. */
76      private BatchServiceClientImpl client;
77  
78      /**
79       * Initializes an instance of JobSchedulesImpl.
80       *
81       * @param retrofit the Retrofit instance built from a Retrofit Builder.
82       * @param client the instance of the service client containing this operation class.
83       */
84      public JobSchedulesImpl(Retrofit retrofit, BatchServiceClientImpl client) {
85          this.service = retrofit.create(JobSchedulesService.class);
86          this.client = client;
87      }
88  
89      /**
90       * The interface defining all the services for JobSchedules to be
91       * used by Retrofit to perform actually REST calls.
92       */
93      interface JobSchedulesService {
94          @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.JobSchedules exists" })
95          @HEAD("jobschedules/{jobScheduleId}")
96          Observable<Response<Void>> exists(@Path("jobScheduleId") String jobScheduleId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent);
97  
98          @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.JobSchedules delete" })
99          @HTTP(path = "jobschedules/{jobScheduleId}", method = "DELETE", hasBody = true)
100         Observable<Response<ResponseBody>> delete(@Path("jobScheduleId") String jobScheduleId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent);
101 
102         @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.JobSchedules get" })
103         @GET("jobschedules/{jobScheduleId}")
104         Observable<Response<ResponseBody>> get(@Path("jobScheduleId") String jobScheduleId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$select") String select, @Query("$expand") String expand, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent);
105 
106         @Headers({ "Content-Type: application/json; odata=minimalmetadata; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.JobSchedules patch" })
107         @PATCH("jobschedules/{jobScheduleId}")
108         Observable<Response<ResponseBody>> patch(@Path("jobScheduleId") String jobScheduleId, @Body JobSchedulePatchParameter jobSchedulePatchParameter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent);
109 
110         @Headers({ "Content-Type: application/json; odata=minimalmetadata; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.JobSchedules update" })
111         @PUT("jobschedules/{jobScheduleId}")
112         Observable<Response<ResponseBody>> update(@Path("jobScheduleId") String jobScheduleId, @Body JobScheduleUpdateParameter jobScheduleUpdateParameter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent);
113 
114         @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.JobSchedules disable" })
115         @POST("jobschedules/{jobScheduleId}/disable")
116         Observable<Response<ResponseBody>> disable(@Path("jobScheduleId") String jobScheduleId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent);
117 
118         @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.JobSchedules enable" })
119         @POST("jobschedules/{jobScheduleId}/enable")
120         Observable<Response<ResponseBody>> enable(@Path("jobScheduleId") String jobScheduleId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent);
121 
122         @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.JobSchedules terminate" })
123         @POST("jobschedules/{jobScheduleId}/terminate")
124         Observable<Response<ResponseBody>> terminate(@Path("jobScheduleId") String jobScheduleId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent);
125 
126         @Headers({ "Content-Type: application/json; odata=minimalmetadata; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.JobSchedules add" })
127         @POST("jobschedules")
128         Observable<Response<ResponseBody>> add(@Body JobScheduleAddParameter cloudJobSchedule, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent);
129 
130         @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.JobSchedules list" })
131         @GET("jobschedules")
132         Observable<Response<ResponseBody>> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$filter") String filter, @Query("$select") String select, @Query("$expand") String expand, @Query("maxresults") Integer maxResults, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent);
133 
134         @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.JobSchedules listNext" })
135         @GET
136         Observable<Response<ResponseBody>> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("User-Agent") String userAgent);
137 
138     }
139 
140     /**
141      * Checks the specified job schedule exists.
142      *
143      * @param jobScheduleId The ID of the job schedule which you want to check.
144      * @throws IllegalArgumentException thrown if parameters fail the validation
145      * @throws BatchErrorException thrown if the request is rejected by server
146      * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
147      * @return the boolean object if successful.
148      */
149     public boolean exists(String jobScheduleId) {
150         return existsWithServiceResponseAsync(jobScheduleId).toBlocking().single().body();
151     }
152 
153     /**
154      * Checks the specified job schedule exists.
155      *
156      * @param jobScheduleId The ID of the job schedule which you want to check.
157      * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
158      * @throws IllegalArgumentException thrown if parameters fail the validation
159      * @return the {@link ServiceFuture} object
160      */
161     public ServiceFuture<Boolean> existsAsync(String jobScheduleId, final ServiceCallback<Boolean> serviceCallback) {
162         return ServiceFuture.fromHeaderResponse(existsWithServiceResponseAsync(jobScheduleId), serviceCallback);
163     }
164 
165     /**
166      * Checks the specified job schedule exists.
167      *
168      * @param jobScheduleId The ID of the job schedule which you want to check.
169      * @throws IllegalArgumentException thrown if parameters fail the validation
170      * @return the observable to the Boolean object
171      */
172     public Observable<Boolean> existsAsync(String jobScheduleId) {
173         return existsWithServiceResponseAsync(jobScheduleId).map(new Func1<ServiceResponseWithHeaders<Boolean, JobScheduleExistsHeaders>, Boolean>() {
174             @Override
175             public Boolean call(ServiceResponseWithHeaders<Boolean, JobScheduleExistsHeaders> response) {
176                 return response.body();
177             }
178         });
179     }
180 
181     /**
182      * Checks the specified job schedule exists.
183      *
184      * @param jobScheduleId The ID of the job schedule which you want to check.
185      * @throws IllegalArgumentException thrown if parameters fail the validation
186      * @return the observable to the Boolean object
187      */
188     public Observable<ServiceResponseWithHeaders<Boolean, JobScheduleExistsHeaders>> existsWithServiceResponseAsync(String jobScheduleId) {
189         if (this.client.batchUrl() == null) {
190             throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null.");
191         }
192         if (jobScheduleId == null) {
193             throw new IllegalArgumentException("Parameter jobScheduleId is required and cannot be null.");
194         }
195         if (this.client.apiVersion() == null) {
196             throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
197         }
198         final JobScheduleExistsOptions jobScheduleExistsOptions = null;
199         Integer timeout = null;
200         UUID clientRequestId = null;
201         Boolean returnClientRequestId = null;
202         DateTime ocpDate = null;
203         String ifMatch = null;
204         String ifNoneMatch = null;
205         DateTime ifModifiedSince = null;
206         DateTime ifUnmodifiedSince = null;
207         String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl());
208         DateTimeRfc1123 ocpDateConverted = null;
209         if (ocpDate != null) {
210             ocpDateConverted = new DateTimeRfc1123(ocpDate);
211         }
212         DateTimeRfc1123 ifModifiedSinceConverted = null;
213         if (ifModifiedSince != null) {
214             ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince);
215         }
216         DateTimeRfc1123 ifUnmodifiedSinceConverted = null;
217         if (ifUnmodifiedSince != null) {
218             ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince);
219         }
220         return service.exists(jobScheduleId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent())
221             .flatMap(new Func1<Response<Void>, Observable<ServiceResponseWithHeaders<Boolean, JobScheduleExistsHeaders>>>() {
222                 @Override
223                 public Observable<ServiceResponseWithHeaders<Boolean, JobScheduleExistsHeaders>> call(Response<Void> response) {
224                     try {
225                         ServiceResponseWithHeaders<Boolean, JobScheduleExistsHeaders> clientResponse = existsDelegate(response);
226                         return Observable.just(clientResponse);
227                     } catch (Throwable t) {
228                         return Observable.error(t);
229                     }
230                 }
231             });
232     }
233 
234     /**
235      * Checks the specified job schedule exists.
236      *
237      * @param jobScheduleId The ID of the job schedule which you want to check.
238      * @param jobScheduleExistsOptions Additional parameters for the operation
239      * @throws IllegalArgumentException thrown if parameters fail the validation
240      * @throws BatchErrorException thrown if the request is rejected by server
241      * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
242      * @return the boolean object if successful.
243      */
244     public boolean exists(String jobScheduleId, JobScheduleExistsOptions jobScheduleExistsOptions) {
245         return existsWithServiceResponseAsync(jobScheduleId, jobScheduleExistsOptions).toBlocking().single().body();
246     }
247 
248     /**
249      * Checks the specified job schedule exists.
250      *
251      * @param jobScheduleId The ID of the job schedule which you want to check.
252      * @param jobScheduleExistsOptions Additional parameters for the operation
253      * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
254      * @throws IllegalArgumentException thrown if parameters fail the validation
255      * @return the {@link ServiceFuture} object
256      */
257     public ServiceFuture<Boolean> existsAsync(String jobScheduleId, JobScheduleExistsOptions jobScheduleExistsOptions, final ServiceCallback<Boolean> serviceCallback) {
258         return ServiceFuture.fromHeaderResponse(existsWithServiceResponseAsync(jobScheduleId, jobScheduleExistsOptions), serviceCallback);
259     }
260 
261     /**
262      * Checks the specified job schedule exists.
263      *
264      * @param jobScheduleId The ID of the job schedule which you want to check.
265      * @param jobScheduleExistsOptions Additional parameters for the operation
266      * @throws IllegalArgumentException thrown if parameters fail the validation
267      * @return the observable to the Boolean object
268      */
269     public Observable<Boolean> existsAsync(String jobScheduleId, JobScheduleExistsOptions jobScheduleExistsOptions) {
270         return existsWithServiceResponseAsync(jobScheduleId, jobScheduleExistsOptions).map(new Func1<ServiceResponseWithHeaders<Boolean, JobScheduleExistsHeaders>, Boolean>() {
271             @Override
272             public Boolean call(ServiceResponseWithHeaders<Boolean, JobScheduleExistsHeaders> response) {
273                 return response.body();
274             }
275         });
276     }
277 
278     /**
279      * Checks the specified job schedule exists.
280      *
281      * @param jobScheduleId The ID of the job schedule which you want to check.
282      * @param jobScheduleExistsOptions Additional parameters for the operation
283      * @throws IllegalArgumentException thrown if parameters fail the validation
284      * @return the observable to the Boolean object
285      */
286     public Observable<ServiceResponseWithHeaders<Boolean, JobScheduleExistsHeaders>> existsWithServiceResponseAsync(String jobScheduleId, JobScheduleExistsOptions jobScheduleExistsOptions) {
287         if (this.client.batchUrl() == null) {
288             throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null.");
289         }
290         if (jobScheduleId == null) {
291             throw new IllegalArgumentException("Parameter jobScheduleId is required and cannot be null.");
292         }
293         if (this.client.apiVersion() == null) {
294             throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
295         }
296         Validator.validate(jobScheduleExistsOptions);
297         Integer timeout = null;
298         if (jobScheduleExistsOptions != null) {
299             timeout = jobScheduleExistsOptions.timeout();
300         }
301         UUID clientRequestId = null;
302         if (jobScheduleExistsOptions != null) {
303             clientRequestId = jobScheduleExistsOptions.clientRequestId();
304         }
305         Boolean returnClientRequestId = null;
306         if (jobScheduleExistsOptions != null) {
307             returnClientRequestId = jobScheduleExistsOptions.returnClientRequestId();
308         }
309         DateTime ocpDate = null;
310         if (jobScheduleExistsOptions != null) {
311             ocpDate = jobScheduleExistsOptions.ocpDate();
312         }
313         String ifMatch = null;
314         if (jobScheduleExistsOptions != null) {
315             ifMatch = jobScheduleExistsOptions.ifMatch();
316         }
317         String ifNoneMatch = null;
318         if (jobScheduleExistsOptions != null) {
319             ifNoneMatch = jobScheduleExistsOptions.ifNoneMatch();
320         }
321         DateTime ifModifiedSince = null;
322         if (jobScheduleExistsOptions != null) {
323             ifModifiedSince = jobScheduleExistsOptions.ifModifiedSince();
324         }
325         DateTime ifUnmodifiedSince = null;
326         if (jobScheduleExistsOptions != null) {
327             ifUnmodifiedSince = jobScheduleExistsOptions.ifUnmodifiedSince();
328         }
329         String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl());
330         DateTimeRfc1123 ocpDateConverted = null;
331         if (ocpDate != null) {
332             ocpDateConverted = new DateTimeRfc1123(ocpDate);
333         }
334         DateTimeRfc1123 ifModifiedSinceConverted = null;
335         if (ifModifiedSince != null) {
336             ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince);
337         }
338         DateTimeRfc1123 ifUnmodifiedSinceConverted = null;
339         if (ifUnmodifiedSince != null) {
340             ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince);
341         }
342         return service.exists(jobScheduleId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent())
343             .flatMap(new Func1<Response<Void>, Observable<ServiceResponseWithHeaders<Boolean, JobScheduleExistsHeaders>>>() {
344                 @Override
345                 public Observable<ServiceResponseWithHeaders<Boolean, JobScheduleExistsHeaders>> call(Response<Void> response) {
346                     try {
347                         ServiceResponseWithHeaders<Boolean, JobScheduleExistsHeaders> clientResponse = existsDelegate(response);
348                         return Observable.just(clientResponse);
349                     } catch (Throwable t) {
350                         return Observable.error(t);
351                     }
352                 }
353             });
354     }
355 
356     private ServiceResponseWithHeaders<Boolean, JobScheduleExistsHeaders> existsDelegate(Response<Void> response) throws BatchErrorException, IOException, IllegalArgumentException {
357         return this.client.restClient().responseBuilderFactory().<Boolean, BatchErrorException>newInstance(this.client.serializerAdapter())
358                 .register(200, new TypeToken<Void>() { }.getType())
359                 .register(404, new TypeToken<Void>() { }.getType())
360                 .registerError(BatchErrorException.class)
361                 .buildEmptyWithHeaders(response, JobScheduleExistsHeaders.class);
362     }
363 
364     /**
365      * Deletes a job schedule from the specified account.
366      * When you delete a job schedule, this also deletes all jobs and tasks under that schedule. When tasks are deleted, all the files in their working directories on the compute nodes are also deleted (the retention period is ignored). The job schedule statistics are no longer accessible once the job schedule is deleted, though they are still counted towards account lifetime statistics.
367      *
368      * @param jobScheduleId The ID of the job schedule to delete.
369      * @throws IllegalArgumentException thrown if parameters fail the validation
370      * @throws BatchErrorException thrown if the request is rejected by server
371      * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
372      */
373     public void delete(String jobScheduleId) {
374         deleteWithServiceResponseAsync(jobScheduleId).toBlocking().single().body();
375     }
376 
377     /**
378      * Deletes a job schedule from the specified account.
379      * When you delete a job schedule, this also deletes all jobs and tasks under that schedule. When tasks are deleted, all the files in their working directories on the compute nodes are also deleted (the retention period is ignored). The job schedule statistics are no longer accessible once the job schedule is deleted, though they are still counted towards account lifetime statistics.
380      *
381      * @param jobScheduleId The ID of the job schedule to delete.
382      * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
383      * @throws IllegalArgumentException thrown if parameters fail the validation
384      * @return the {@link ServiceFuture} object
385      */
386     public ServiceFuture<Void> deleteAsync(String jobScheduleId, final ServiceCallback<Void> serviceCallback) {
387         return ServiceFuture.fromHeaderResponse(deleteWithServiceResponseAsync(jobScheduleId), serviceCallback);
388     }
389 
390     /**
391      * Deletes a job schedule from the specified account.
392      * When you delete a job schedule, this also deletes all jobs and tasks under that schedule. When tasks are deleted, all the files in their working directories on the compute nodes are also deleted (the retention period is ignored). The job schedule statistics are no longer accessible once the job schedule is deleted, though they are still counted towards account lifetime statistics.
393      *
394      * @param jobScheduleId The ID of the job schedule to delete.
395      * @throws IllegalArgumentException thrown if parameters fail the validation
396      * @return the {@link ServiceResponseWithHeaders} object if successful.
397      */
398     public Observable<Void> deleteAsync(String jobScheduleId) {
399         return deleteWithServiceResponseAsync(jobScheduleId).map(new Func1<ServiceResponseWithHeaders<Void, JobScheduleDeleteHeaders>, Void>() {
400             @Override
401             public Void call(ServiceResponseWithHeaders<Void, JobScheduleDeleteHeaders> response) {
402                 return response.body();
403             }
404         });
405     }
406 
407     /**
408      * Deletes a job schedule from the specified account.
409      * When you delete a job schedule, this also deletes all jobs and tasks under that schedule. When tasks are deleted, all the files in their working directories on the compute nodes are also deleted (the retention period is ignored). The job schedule statistics are no longer accessible once the job schedule is deleted, though they are still counted towards account lifetime statistics.
410      *
411      * @param jobScheduleId The ID of the job schedule to delete.
412      * @throws IllegalArgumentException thrown if parameters fail the validation
413      * @return the {@link ServiceResponseWithHeaders} object if successful.
414      */
415     public Observable<ServiceResponseWithHeaders<Void, JobScheduleDeleteHeaders>> deleteWithServiceResponseAsync(String jobScheduleId) {
416         if (this.client.batchUrl() == null) {
417             throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null.");
418         }
419         if (jobScheduleId == null) {
420             throw new IllegalArgumentException("Parameter jobScheduleId is required and cannot be null.");
421         }
422         if (this.client.apiVersion() == null) {
423             throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
424         }
425         final JobScheduleDeleteOptions jobScheduleDeleteOptions = null;
426         Integer timeout = null;
427         UUID clientRequestId = null;
428         Boolean returnClientRequestId = null;
429         DateTime ocpDate = null;
430         String ifMatch = null;
431         String ifNoneMatch = null;
432         DateTime ifModifiedSince = null;
433         DateTime ifUnmodifiedSince = null;
434         String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl());
435         DateTimeRfc1123 ocpDateConverted = null;
436         if (ocpDate != null) {
437             ocpDateConverted = new DateTimeRfc1123(ocpDate);
438         }
439         DateTimeRfc1123 ifModifiedSinceConverted = null;
440         if (ifModifiedSince != null) {
441             ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince);
442         }
443         DateTimeRfc1123 ifUnmodifiedSinceConverted = null;
444         if (ifUnmodifiedSince != null) {
445             ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince);
446         }
447         return service.delete(jobScheduleId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent())
448             .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponseWithHeaders<Void, JobScheduleDeleteHeaders>>>() {
449                 @Override
450                 public Observable<ServiceResponseWithHeaders<Void, JobScheduleDeleteHeaders>> call(Response<ResponseBody> response) {
451                     try {
452                         ServiceResponseWithHeaders<Void, JobScheduleDeleteHeaders> clientResponse = deleteDelegate(response);
453                         return Observable.just(clientResponse);
454                     } catch (Throwable t) {
455                         return Observable.error(t);
456                     }
457                 }
458             });
459     }
460 
461     /**
462      * Deletes a job schedule from the specified account.
463      * When you delete a job schedule, this also deletes all jobs and tasks under that schedule. When tasks are deleted, all the files in their working directories on the compute nodes are also deleted (the retention period is ignored). The job schedule statistics are no longer accessible once the job schedule is deleted, though they are still counted towards account lifetime statistics.
464      *
465      * @param jobScheduleId The ID of the job schedule to delete.
466      * @param jobScheduleDeleteOptions Additional parameters for the operation
467      * @throws IllegalArgumentException thrown if parameters fail the validation
468      * @throws BatchErrorException thrown if the request is rejected by server
469      * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
470      */
471     public void delete(String jobScheduleId, JobScheduleDeleteOptions jobScheduleDeleteOptions) {
472         deleteWithServiceResponseAsync(jobScheduleId, jobScheduleDeleteOptions).toBlocking().single().body();
473     }
474 
475     /**
476      * Deletes a job schedule from the specified account.
477      * When you delete a job schedule, this also deletes all jobs and tasks under that schedule. When tasks are deleted, all the files in their working directories on the compute nodes are also deleted (the retention period is ignored). The job schedule statistics are no longer accessible once the job schedule is deleted, though they are still counted towards account lifetime statistics.
478      *
479      * @param jobScheduleId The ID of the job schedule to delete.
480      * @param jobScheduleDeleteOptions Additional parameters for the operation
481      * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
482      * @throws IllegalArgumentException thrown if parameters fail the validation
483      * @return the {@link ServiceFuture} object
484      */
485     public ServiceFuture<Void> deleteAsync(String jobScheduleId, JobScheduleDeleteOptions jobScheduleDeleteOptions, final ServiceCallback<Void> serviceCallback) {
486         return ServiceFuture.fromHeaderResponse(deleteWithServiceResponseAsync(jobScheduleId, jobScheduleDeleteOptions), serviceCallback);
487     }
488 
489     /**
490      * Deletes a job schedule from the specified account.
491      * When you delete a job schedule, this also deletes all jobs and tasks under that schedule. When tasks are deleted, all the files in their working directories on the compute nodes are also deleted (the retention period is ignored). The job schedule statistics are no longer accessible once the job schedule is deleted, though they are still counted towards account lifetime statistics.
492      *
493      * @param jobScheduleId The ID of the job schedule to delete.
494      * @param jobScheduleDeleteOptions Additional parameters for the operation
495      * @throws IllegalArgumentException thrown if parameters fail the validation
496      * @return the {@link ServiceResponseWithHeaders} object if successful.
497      */
498     public Observable<Void> deleteAsync(String jobScheduleId, JobScheduleDeleteOptions jobScheduleDeleteOptions) {
499         return deleteWithServiceResponseAsync(jobScheduleId, jobScheduleDeleteOptions).map(new Func1<ServiceResponseWithHeaders<Void, JobScheduleDeleteHeaders>, Void>() {
500             @Override
501             public Void call(ServiceResponseWithHeaders<Void, JobScheduleDeleteHeaders> response) {
502                 return response.body();
503             }
504         });
505     }
506 
507     /**
508      * Deletes a job schedule from the specified account.
509      * When you delete a job schedule, this also deletes all jobs and tasks under that schedule. When tasks are deleted, all the files in their working directories on the compute nodes are also deleted (the retention period is ignored). The job schedule statistics are no longer accessible once the job schedule is deleted, though they are still counted towards account lifetime statistics.
510      *
511      * @param jobScheduleId The ID of the job schedule to delete.
512      * @param jobScheduleDeleteOptions Additional parameters for the operation
513      * @throws IllegalArgumentException thrown if parameters fail the validation
514      * @return the {@link ServiceResponseWithHeaders} object if successful.
515      */
516     public Observable<ServiceResponseWithHeaders<Void, JobScheduleDeleteHeaders>> deleteWithServiceResponseAsync(String jobScheduleId, JobScheduleDeleteOptions jobScheduleDeleteOptions) {
517         if (this.client.batchUrl() == null) {
518             throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null.");
519         }
520         if (jobScheduleId == null) {
521             throw new IllegalArgumentException("Parameter jobScheduleId is required and cannot be null.");
522         }
523         if (this.client.apiVersion() == null) {
524             throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
525         }
526         Validator.validate(jobScheduleDeleteOptions);
527         Integer timeout = null;
528         if (jobScheduleDeleteOptions != null) {
529             timeout = jobScheduleDeleteOptions.timeout();
530         }
531         UUID clientRequestId = null;
532         if (jobScheduleDeleteOptions != null) {
533             clientRequestId = jobScheduleDeleteOptions.clientRequestId();
534         }
535         Boolean returnClientRequestId = null;
536         if (jobScheduleDeleteOptions != null) {
537             returnClientRequestId = jobScheduleDeleteOptions.returnClientRequestId();
538         }
539         DateTime ocpDate = null;
540         if (jobScheduleDeleteOptions != null) {
541             ocpDate = jobScheduleDeleteOptions.ocpDate();
542         }
543         String ifMatch = null;
544         if (jobScheduleDeleteOptions != null) {
545             ifMatch = jobScheduleDeleteOptions.ifMatch();
546         }
547         String ifNoneMatch = null;
548         if (jobScheduleDeleteOptions != null) {
549             ifNoneMatch = jobScheduleDeleteOptions.ifNoneMatch();
550         }
551         DateTime ifModifiedSince = null;
552         if (jobScheduleDeleteOptions != null) {
553             ifModifiedSince = jobScheduleDeleteOptions.ifModifiedSince();
554         }
555         DateTime ifUnmodifiedSince = null;
556         if (jobScheduleDeleteOptions != null) {
557             ifUnmodifiedSince = jobScheduleDeleteOptions.ifUnmodifiedSince();
558         }
559         String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl());
560         DateTimeRfc1123 ocpDateConverted = null;
561         if (ocpDate != null) {
562             ocpDateConverted = new DateTimeRfc1123(ocpDate);
563         }
564         DateTimeRfc1123 ifModifiedSinceConverted = null;
565         if (ifModifiedSince != null) {
566             ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince);
567         }
568         DateTimeRfc1123 ifUnmodifiedSinceConverted = null;
569         if (ifUnmodifiedSince != null) {
570             ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince);
571         }
572         return service.delete(jobScheduleId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent())
573             .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponseWithHeaders<Void, JobScheduleDeleteHeaders>>>() {
574                 @Override
575                 public Observable<ServiceResponseWithHeaders<Void, JobScheduleDeleteHeaders>> call(Response<ResponseBody> response) {
576                     try {
577                         ServiceResponseWithHeaders<Void, JobScheduleDeleteHeaders> clientResponse = deleteDelegate(response);
578                         return Observable.just(clientResponse);
579                     } catch (Throwable t) {
580                         return Observable.error(t);
581                     }
582                 }
583             });
584     }
585 
586     private ServiceResponseWithHeaders<Void, JobScheduleDeleteHeaders> deleteDelegate(Response<ResponseBody> response) throws BatchErrorException, IOException, IllegalArgumentException {
587         return this.client.restClient().responseBuilderFactory().<Void, BatchErrorException>newInstance(this.client.serializerAdapter())
588                 .register(202, new TypeToken<Void>() { }.getType())
589                 .registerError(BatchErrorException.class)
590                 .buildWithHeaders(response, JobScheduleDeleteHeaders.class);
591     }
592 
593     /**
594      * Gets information about the specified job schedule.
595      *
596      * @param jobScheduleId The ID of the job schedule to get.
597      * @throws IllegalArgumentException thrown if parameters fail the validation
598      * @throws BatchErrorException thrown if the request is rejected by server
599      * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
600      * @return the CloudJobSchedule object if successful.
601      */
602     public CloudJobSchedule get(String jobScheduleId) {
603         return getWithServiceResponseAsync(jobScheduleId).toBlocking().single().body();
604     }
605 
606     /**
607      * Gets information about the specified job schedule.
608      *
609      * @param jobScheduleId The ID of the job schedule to get.
610      * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
611      * @throws IllegalArgumentException thrown if parameters fail the validation
612      * @return the {@link ServiceFuture} object
613      */
614     public ServiceFuture<CloudJobSchedule> getAsync(String jobScheduleId, final ServiceCallback<CloudJobSchedule> serviceCallback) {
615         return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(jobScheduleId), serviceCallback);
616     }
617 
618     /**
619      * Gets information about the specified job schedule.
620      *
621      * @param jobScheduleId The ID of the job schedule to get.
622      * @throws IllegalArgumentException thrown if parameters fail the validation
623      * @return the observable to the CloudJobSchedule object
624      */
625     public Observable<CloudJobSchedule> getAsync(String jobScheduleId) {
626         return getWithServiceResponseAsync(jobScheduleId).map(new Func1<ServiceResponseWithHeaders<CloudJobSchedule, JobScheduleGetHeaders>, CloudJobSchedule>() {
627             @Override
628             public CloudJobSchedule call(ServiceResponseWithHeaders<CloudJobSchedule, JobScheduleGetHeaders> response) {
629                 return response.body();
630             }
631         });
632     }
633 
634     /**
635      * Gets information about the specified job schedule.
636      *
637      * @param jobScheduleId The ID of the job schedule to get.
638      * @throws IllegalArgumentException thrown if parameters fail the validation
639      * @return the observable to the CloudJobSchedule object
640      */
641     public Observable<ServiceResponseWithHeaders<CloudJobSchedule, JobScheduleGetHeaders>> getWithServiceResponseAsync(String jobScheduleId) {
642         if (this.client.batchUrl() == null) {
643             throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null.");
644         }
645         if (jobScheduleId == null) {
646             throw new IllegalArgumentException("Parameter jobScheduleId is required and cannot be null.");
647         }
648         if (this.client.apiVersion() == null) {
649             throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
650         }
651         final JobScheduleGetOptions jobScheduleGetOptions = null;
652         String select = null;
653         String expand = null;
654         Integer timeout = null;
655         UUID clientRequestId = null;
656         Boolean returnClientRequestId = null;
657         DateTime ocpDate = null;
658         String ifMatch = null;
659         String ifNoneMatch = null;
660         DateTime ifModifiedSince = null;
661         DateTime ifUnmodifiedSince = null;
662         String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl());
663         DateTimeRfc1123 ocpDateConverted = null;
664         if (ocpDate != null) {
665             ocpDateConverted = new DateTimeRfc1123(ocpDate);
666         }
667         DateTimeRfc1123 ifModifiedSinceConverted = null;
668         if (ifModifiedSince != null) {
669             ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince);
670         }
671         DateTimeRfc1123 ifUnmodifiedSinceConverted = null;
672         if (ifUnmodifiedSince != null) {
673             ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince);
674         }
675         return service.get(jobScheduleId, this.client.apiVersion(), this.client.acceptLanguage(), select, expand, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent())
676             .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponseWithHeaders<CloudJobSchedule, JobScheduleGetHeaders>>>() {
677                 @Override
678                 public Observable<ServiceResponseWithHeaders<CloudJobSchedule, JobScheduleGetHeaders>> call(Response<ResponseBody> response) {
679                     try {
680                         ServiceResponseWithHeaders<CloudJobSchedule, JobScheduleGetHeaders> clientResponse = getDelegate(response);
681                         return Observable.just(clientResponse);
682                     } catch (Throwable t) {
683                         return Observable.error(t);
684                     }
685                 }
686             });
687     }
688 
689     /**
690      * Gets information about the specified job schedule.
691      *
692      * @param jobScheduleId The ID of the job schedule to get.
693      * @param jobScheduleGetOptions Additional parameters for the operation
694      * @throws IllegalArgumentException thrown if parameters fail the validation
695      * @throws BatchErrorException thrown if the request is rejected by server
696      * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
697      * @return the CloudJobSchedule object if successful.
698      */
699     public CloudJobSchedule get(String jobScheduleId, JobScheduleGetOptions jobScheduleGetOptions) {
700         return getWithServiceResponseAsync(jobScheduleId, jobScheduleGetOptions).toBlocking().single().body();
701     }
702 
703     /**
704      * Gets information about the specified job schedule.
705      *
706      * @param jobScheduleId The ID of the job schedule to get.
707      * @param jobScheduleGetOptions Additional parameters for the operation
708      * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
709      * @throws IllegalArgumentException thrown if parameters fail the validation
710      * @return the {@link ServiceFuture} object
711      */
712     public ServiceFuture<CloudJobSchedule> getAsync(String jobScheduleId, JobScheduleGetOptions jobScheduleGetOptions, final ServiceCallback<CloudJobSchedule> serviceCallback) {
713         return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(jobScheduleId, jobScheduleGetOptions), serviceCallback);
714     }
715 
716     /**
717      * Gets information about the specified job schedule.
718      *
719      * @param jobScheduleId The ID of the job schedule to get.
720      * @param jobScheduleGetOptions Additional parameters for the operation
721      * @throws IllegalArgumentException thrown if parameters fail the validation
722      * @return the observable to the CloudJobSchedule object
723      */
724     public Observable<CloudJobSchedule> getAsync(String jobScheduleId, JobScheduleGetOptions jobScheduleGetOptions) {
725         return getWithServiceResponseAsync(jobScheduleId, jobScheduleGetOptions).map(new Func1<ServiceResponseWithHeaders<CloudJobSchedule, JobScheduleGetHeaders>, CloudJobSchedule>() {
726             @Override
727             public CloudJobSchedule call(ServiceResponseWithHeaders<CloudJobSchedule, JobScheduleGetHeaders> response) {
728                 return response.body();
729             }
730         });
731     }
732 
733     /**
734      * Gets information about the specified job schedule.
735      *
736      * @param jobScheduleId The ID of the job schedule to get.
737      * @param jobScheduleGetOptions Additional parameters for the operation
738      * @throws IllegalArgumentException thrown if parameters fail the validation
739      * @return the observable to the CloudJobSchedule object
740      */
741     public Observable<ServiceResponseWithHeaders<CloudJobSchedule, JobScheduleGetHeaders>> getWithServiceResponseAsync(String jobScheduleId, JobScheduleGetOptions jobScheduleGetOptions) {
742         if (this.client.batchUrl() == null) {
743             throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null.");
744         }
745         if (jobScheduleId == null) {
746             throw new IllegalArgumentException("Parameter jobScheduleId is required and cannot be null.");
747         }
748         if (this.client.apiVersion() == null) {
749             throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
750         }
751         Validator.validate(jobScheduleGetOptions);
752         String select = null;
753         if (jobScheduleGetOptions != null) {
754             select = jobScheduleGetOptions.select();
755         }
756         String expand = null;
757         if (jobScheduleGetOptions != null) {
758             expand = jobScheduleGetOptions.expand();
759         }
760         Integer timeout = null;
761         if (jobScheduleGetOptions != null) {
762             timeout = jobScheduleGetOptions.timeout();
763         }
764         UUID clientRequestId = null;
765         if (jobScheduleGetOptions != null) {
766             clientRequestId = jobScheduleGetOptions.clientRequestId();
767         }
768         Boolean returnClientRequestId = null;
769         if (jobScheduleGetOptions != null) {
770             returnClientRequestId = jobScheduleGetOptions.returnClientRequestId();
771         }
772         DateTime ocpDate = null;
773         if (jobScheduleGetOptions != null) {
774             ocpDate = jobScheduleGetOptions.ocpDate();
775         }
776         String ifMatch = null;
777         if (jobScheduleGetOptions != null) {
778             ifMatch = jobScheduleGetOptions.ifMatch();
779         }
780         String ifNoneMatch = null;
781         if (jobScheduleGetOptions != null) {
782             ifNoneMatch = jobScheduleGetOptions.ifNoneMatch();
783         }
784         DateTime ifModifiedSince = null;
785         if (jobScheduleGetOptions != null) {
786             ifModifiedSince = jobScheduleGetOptions.ifModifiedSince();
787         }
788         DateTime ifUnmodifiedSince = null;
789         if (jobScheduleGetOptions != null) {
790             ifUnmodifiedSince = jobScheduleGetOptions.ifUnmodifiedSince();
791         }
792         String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl());
793         DateTimeRfc1123 ocpDateConverted = null;
794         if (ocpDate != null) {
795             ocpDateConverted = new DateTimeRfc1123(ocpDate);
796         }
797         DateTimeRfc1123 ifModifiedSinceConverted = null;
798         if (ifModifiedSince != null) {
799             ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince);
800         }
801         DateTimeRfc1123 ifUnmodifiedSinceConverted = null;
802         if (ifUnmodifiedSince != null) {
803             ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince);
804         }
805         return service.get(jobScheduleId, this.client.apiVersion(), this.client.acceptLanguage(), select, expand, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent())
806             .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponseWithHeaders<CloudJobSchedule, JobScheduleGetHeaders>>>() {
807                 @Override
808                 public Observable<ServiceResponseWithHeaders<CloudJobSchedule, JobScheduleGetHeaders>> call(Response<ResponseBody> response) {
809                     try {
810                         ServiceResponseWithHeaders<CloudJobSchedule, JobScheduleGetHeaders> clientResponse = getDelegate(response);
811                         return Observable.just(clientResponse);
812                     } catch (Throwable t) {
813                         return Observable.error(t);
814                     }
815                 }
816             });
817     }
818 
819     private ServiceResponseWithHeaders<CloudJobSchedule, JobScheduleGetHeaders> getDelegate(Response<ResponseBody> response) throws BatchErrorException, IOException, IllegalArgumentException {
820         return this.client.restClient().responseBuilderFactory().<CloudJobSchedule, BatchErrorException>newInstance(this.client.serializerAdapter())
821                 .register(200, new TypeToken<CloudJobSchedule>() { }.getType())
822                 .registerError(BatchErrorException.class)
823                 .buildWithHeaders(response, JobScheduleGetHeaders.class);
824     }
825 
826     /**
827      * Updates the properties of the specified job schedule.
828      * This replaces only the job schedule properties specified in the request. For example, if the schedule property is not specified with this request, then the Batch service will keep the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected.
829      *
830      * @param jobScheduleId The ID of the job schedule to update.
831      * @param jobSchedulePatchParameter The parameters for the request.
832      * @throws IllegalArgumentException thrown if parameters fail the validation
833      * @throws BatchErrorException thrown if the request is rejected by server
834      * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
835      */
836     public void patch(String jobScheduleId, JobSchedulePatchParameter jobSchedulePatchParameter) {
837         patchWithServiceResponseAsync(jobScheduleId, jobSchedulePatchParameter).toBlocking().single().body();
838     }
839 
840     /**
841      * Updates the properties of the specified job schedule.
842      * This replaces only the job schedule properties specified in the request. For example, if the schedule property is not specified with this request, then the Batch service will keep the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected.
843      *
844      * @param jobScheduleId The ID of the job schedule to update.
845      * @param jobSchedulePatchParameter The parameters for the request.
846      * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
847      * @throws IllegalArgumentException thrown if parameters fail the validation
848      * @return the {@link ServiceFuture} object
849      */
850     public ServiceFuture<Void> patchAsync(String jobScheduleId, JobSchedulePatchParameter jobSchedulePatchParameter, final ServiceCallback<Void> serviceCallback) {
851         return ServiceFuture.fromHeaderResponse(patchWithServiceResponseAsync(jobScheduleId, jobSchedulePatchParameter), serviceCallback);
852     }
853 
854     /**
855      * Updates the properties of the specified job schedule.
856      * This replaces only the job schedule properties specified in the request. For example, if the schedule property is not specified with this request, then the Batch service will keep the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected.
857      *
858      * @param jobScheduleId The ID of the job schedule to update.
859      * @param jobSchedulePatchParameter The parameters for the request.
860      * @throws IllegalArgumentException thrown if parameters fail the validation
861      * @return the {@link ServiceResponseWithHeaders} object if successful.
862      */
863     public Observable<Void> patchAsync(String jobScheduleId, JobSchedulePatchParameter jobSchedulePatchParameter) {
864         return patchWithServiceResponseAsync(jobScheduleId, jobSchedulePatchParameter).map(new Func1<ServiceResponseWithHeaders<Void, JobSchedulePatchHeaders>, Void>() {
865             @Override
866             public Void call(ServiceResponseWithHeaders<Void, JobSchedulePatchHeaders> response) {
867                 return response.body();
868             }
869         });
870     }
871 
872     /**
873      * Updates the properties of the specified job schedule.
874      * This replaces only the job schedule properties specified in the request. For example, if the schedule property is not specified with this request, then the Batch service will keep the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected.
875      *
876      * @param jobScheduleId The ID of the job schedule to update.
877      * @param jobSchedulePatchParameter The parameters for the request.
878      * @throws IllegalArgumentException thrown if parameters fail the validation
879      * @return the {@link ServiceResponseWithHeaders} object if successful.
880      */
881     public Observable<ServiceResponseWithHeaders<Void, JobSchedulePatchHeaders>> patchWithServiceResponseAsync(String jobScheduleId, JobSchedulePatchParameter jobSchedulePatchParameter) {
882         if (this.client.batchUrl() == null) {
883             throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null.");
884         }
885         if (jobScheduleId == null) {
886             throw new IllegalArgumentException("Parameter jobScheduleId is required and cannot be null.");
887         }
888         if (jobSchedulePatchParameter == null) {
889             throw new IllegalArgumentException("Parameter jobSchedulePatchParameter is required and cannot be null.");
890         }
891         if (this.client.apiVersion() == null) {
892             throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
893         }
894         Validator.validate(jobSchedulePatchParameter);
895         final JobSchedulePatchOptions jobSchedulePatchOptions = null;
896         Integer timeout = null;
897         UUID clientRequestId = null;
898         Boolean returnClientRequestId = null;
899         DateTime ocpDate = null;
900         String ifMatch = null;
901         String ifNoneMatch = null;
902         DateTime ifModifiedSince = null;
903         DateTime ifUnmodifiedSince = null;
904         String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl());
905         DateTimeRfc1123 ocpDateConverted = null;
906         if (ocpDate != null) {
907             ocpDateConverted = new DateTimeRfc1123(ocpDate);
908         }
909         DateTimeRfc1123 ifModifiedSinceConverted = null;
910         if (ifModifiedSince != null) {
911             ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince);
912         }
913         DateTimeRfc1123 ifUnmodifiedSinceConverted = null;
914         if (ifUnmodifiedSince != null) {
915             ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince);
916         }
917         return service.patch(jobScheduleId, jobSchedulePatchParameter, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent())
918             .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponseWithHeaders<Void, JobSchedulePatchHeaders>>>() {
919                 @Override
920                 public Observable<ServiceResponseWithHeaders<Void, JobSchedulePatchHeaders>> call(Response<ResponseBody> response) {
921                     try {
922                         ServiceResponseWithHeaders<Void, JobSchedulePatchHeaders> clientResponse = patchDelegate(response);
923                         return Observable.just(clientResponse);
924                     } catch (Throwable t) {
925                         return Observable.error(t);
926                     }
927                 }
928             });
929     }
930 
931     /**
932      * Updates the properties of the specified job schedule.
933      * This replaces only the job schedule properties specified in the request. For example, if the schedule property is not specified with this request, then the Batch service will keep the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected.
934      *
935      * @param jobScheduleId The ID of the job schedule to update.
936      * @param jobSchedulePatchParameter The parameters for the request.
937      * @param jobSchedulePatchOptions Additional parameters for the operation
938      * @throws IllegalArgumentException thrown if parameters fail the validation
939      * @throws BatchErrorException thrown if the request is rejected by server
940      * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
941      */
942     public void patch(String jobScheduleId, JobSchedulePatchParameter jobSchedulePatchParameter, JobSchedulePatchOptions jobSchedulePatchOptions) {
943         patchWithServiceResponseAsync(jobScheduleId, jobSchedulePatchParameter, jobSchedulePatchOptions).toBlocking().single().body();
944     }
945 
946     /**
947      * Updates the properties of the specified job schedule.
948      * This replaces only the job schedule properties specified in the request. For example, if the schedule property is not specified with this request, then the Batch service will keep the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected.
949      *
950      * @param jobScheduleId The ID of the job schedule to update.
951      * @param jobSchedulePatchParameter The parameters for the request.
952      * @param jobSchedulePatchOptions Additional parameters for the operation
953      * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
954      * @throws IllegalArgumentException thrown if parameters fail the validation
955      * @return the {@link ServiceFuture} object
956      */
957     public ServiceFuture<Void> patchAsync(String jobScheduleId, JobSchedulePatchParameter jobSchedulePatchParameter, JobSchedulePatchOptions jobSchedulePatchOptions, final ServiceCallback<Void> serviceCallback) {
958         return ServiceFuture.fromHeaderResponse(patchWithServiceResponseAsync(jobScheduleId, jobSchedulePatchParameter, jobSchedulePatchOptions), serviceCallback);
959     }
960 
961     /**
962      * Updates the properties of the specified job schedule.
963      * This replaces only the job schedule properties specified in the request. For example, if the schedule property is not specified with this request, then the Batch service will keep the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected.
964      *
965      * @param jobScheduleId The ID of the job schedule to update.
966      * @param jobSchedulePatchParameter The parameters for the request.
967      * @param jobSchedulePatchOptions Additional parameters for the operation
968      * @throws IllegalArgumentException thrown if parameters fail the validation
969      * @return the {@link ServiceResponseWithHeaders} object if successful.
970      */
971     public Observable<Void> patchAsync(String jobScheduleId, JobSchedulePatchParameter jobSchedulePatchParameter, JobSchedulePatchOptions jobSchedulePatchOptions) {
972         return patchWithServiceResponseAsync(jobScheduleId, jobSchedulePatchParameter, jobSchedulePatchOptions).map(new Func1<ServiceResponseWithHeaders<Void, JobSchedulePatchHeaders>, Void>() {
973             @Override
974             public Void call(ServiceResponseWithHeaders<Void, JobSchedulePatchHeaders> response) {
975                 return response.body();
976             }
977         });
978     }
979 
980     /**
981      * Updates the properties of the specified job schedule.
982      * This replaces only the job schedule properties specified in the request. For example, if the schedule property is not specified with this request, then the Batch service will keep the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected.
983      *
984      * @param jobScheduleId The ID of the job schedule to update.
985      * @param jobSchedulePatchParameter The parameters for the request.
986      * @param jobSchedulePatchOptions Additional parameters for the operation
987      * @throws IllegalArgumentException thrown if parameters fail the validation
988      * @return the {@link ServiceResponseWithHeaders} object if successful.
989      */
990     public Observable<ServiceResponseWithHeaders<Void, JobSchedulePatchHeaders>> patchWithServiceResponseAsync(String jobScheduleId, JobSchedulePatchParameter jobSchedulePatchParameter, JobSchedulePatchOptions jobSchedulePatchOptions) {
991         if (this.client.batchUrl() == null) {
992             throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null.");
993         }
994         if (jobScheduleId == null) {
995             throw new IllegalArgumentException("Parameter jobScheduleId is required and cannot be null.");
996         }
997         if (jobSchedulePatchParameter == null) {
998             throw new IllegalArgumentException("Parameter jobSchedulePatchParameter is required and cannot be null.");
999         }
1000         if (this.client.apiVersion() == null) {
1001             throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
1002         }
1003         Validator.validate(jobSchedulePatchParameter);
1004         Validator.validate(jobSchedulePatchOptions);
1005         Integer timeout = null;
1006         if (jobSchedulePatchOptions != null) {
1007             timeout = jobSchedulePatchOptions.timeout();
1008         }
1009         UUID clientRequestId = null;
1010         if (jobSchedulePatchOptions != null) {
1011             clientRequestId = jobSchedulePatchOptions.clientRequestId();
1012         }
1013         Boolean returnClientRequestId = null;
1014         if (jobSchedulePatchOptions != null) {
1015             returnClientRequestId = jobSchedulePatchOptions.returnClientRequestId();
1016         }
1017         DateTime ocpDate = null;
1018         if (jobSchedulePatchOptions != null) {
1019             ocpDate = jobSchedulePatchOptions.ocpDate();
1020         }
1021         String ifMatch = null;
1022         if (jobSchedulePatchOptions != null) {
1023             ifMatch = jobSchedulePatchOptions.ifMatch();
1024         }
1025         String ifNoneMatch = null;
1026         if (jobSchedulePatchOptions != null) {
1027             ifNoneMatch = jobSchedulePatchOptions.ifNoneMatch();
1028         }
1029         DateTime ifModifiedSince = null;
1030         if (jobSchedulePatchOptions != null) {
1031             ifModifiedSince = jobSchedulePatchOptions.ifModifiedSince();
1032         }
1033         DateTime ifUnmodifiedSince = null;
1034         if (jobSchedulePatchOptions != null) {
1035             ifUnmodifiedSince = jobSchedulePatchOptions.ifUnmodifiedSince();
1036         }
1037         String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl());
1038         DateTimeRfc1123 ocpDateConverted = null;
1039         if (ocpDate != null) {
1040             ocpDateConverted = new DateTimeRfc1123(ocpDate);
1041         }
1042         DateTimeRfc1123 ifModifiedSinceConverted = null;
1043         if (ifModifiedSince != null) {
1044             ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince);
1045         }
1046         DateTimeRfc1123 ifUnmodifiedSinceConverted = null;
1047         if (ifUnmodifiedSince != null) {
1048             ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince);
1049         }
1050         return service.patch(jobScheduleId, jobSchedulePatchParameter, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent())
1051             .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponseWithHeaders<Void, JobSchedulePatchHeaders>>>() {
1052                 @Override
1053                 public Observable<ServiceResponseWithHeaders<Void, JobSchedulePatchHeaders>> call(Response<ResponseBody> response) {
1054                     try {
1055                         ServiceResponseWithHeaders<Void, JobSchedulePatchHeaders> clientResponse = patchDelegate(response);
1056                         return Observable.just(clientResponse);
1057                     } catch (Throwable t) {
1058                         return Observable.error(t);
1059                     }
1060                 }
1061             });
1062     }
1063 
1064     private ServiceResponseWithHeaders<Void, JobSchedulePatchHeaders> patchDelegate(Response<ResponseBody> response) throws BatchErrorException, IOException, IllegalArgumentException {
1065         return this.client.restClient().responseBuilderFactory().<Void, BatchErrorException>newInstance(this.client.serializerAdapter())
1066                 .register(200, new TypeToken<Void>() { }.getType())
1067                 .registerError(BatchErrorException.class)
1068                 .buildWithHeaders(response, JobSchedulePatchHeaders.class);
1069     }
1070 
1071     /**
1072      * Updates the properties of the specified job schedule.
1073      * This fully replaces all the updatable properties of the job schedule. For example, if the schedule property is not specified with this request, then the Batch service will remove the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected.
1074      *
1075      * @param jobScheduleId The ID of the job schedule to update.
1076      * @param jobScheduleUpdateParameter The parameters for the request.
1077      * @throws IllegalArgumentException thrown if parameters fail the validation
1078      * @throws BatchErrorException thrown if the request is rejected by server
1079      * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
1080      */
1081     public void update(String jobScheduleId, JobScheduleUpdateParameter jobScheduleUpdateParameter) {
1082         updateWithServiceResponseAsync(jobScheduleId, jobScheduleUpdateParameter).toBlocking().single().body();
1083     }
1084 
1085     /**
1086      * Updates the properties of the specified job schedule.
1087      * This fully replaces all the updatable properties of the job schedule. For example, if the schedule property is not specified with this request, then the Batch service will remove the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected.
1088      *
1089      * @param jobScheduleId The ID of the job schedule to update.
1090      * @param jobScheduleUpdateParameter The parameters for the request.
1091      * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
1092      * @throws IllegalArgumentException thrown if parameters fail the validation
1093      * @return the {@link ServiceFuture} object
1094      */
1095     public ServiceFuture<Void> updateAsync(String jobScheduleId, JobScheduleUpdateParameter jobScheduleUpdateParameter, final ServiceCallback<Void> serviceCallback) {
1096         return ServiceFuture.fromHeaderResponse(updateWithServiceResponseAsync(jobScheduleId, jobScheduleUpdateParameter), serviceCallback);
1097     }
1098 
1099     /**
1100      * Updates the properties of the specified job schedule.
1101      * This fully replaces all the updatable properties of the job schedule. For example, if the schedule property is not specified with this request, then the Batch service will remove the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected.
1102      *
1103      * @param jobScheduleId The ID of the job schedule to update.
1104      * @param jobScheduleUpdateParameter The parameters for the request.
1105      * @throws IllegalArgumentException thrown if parameters fail the validation
1106      * @return the {@link ServiceResponseWithHeaders} object if successful.
1107      */
1108     public Observable<Void> updateAsync(String jobScheduleId, JobScheduleUpdateParameter jobScheduleUpdateParameter) {
1109         return updateWithServiceResponseAsync(jobScheduleId, jobScheduleUpdateParameter).map(new Func1<ServiceResponseWithHeaders<Void, JobScheduleUpdateHeaders>, Void>() {
1110             @Override
1111             public Void call(ServiceResponseWithHeaders<Void, JobScheduleUpdateHeaders> response) {
1112                 return response.body();
1113             }
1114         });
1115     }
1116 
1117     /**
1118      * Updates the properties of the specified job schedule.
1119      * This fully replaces all the updatable properties of the job schedule. For example, if the schedule property is not specified with this request, then the Batch service will remove the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected.
1120      *
1121      * @param jobScheduleId The ID of the job schedule to update.
1122      * @param jobScheduleUpdateParameter The parameters for the request.
1123      * @throws IllegalArgumentException thrown if parameters fail the validation
1124      * @return the {@link ServiceResponseWithHeaders} object if successful.
1125      */
1126     public Observable<ServiceResponseWithHeaders<Void, JobScheduleUpdateHeaders>> updateWithServiceResponseAsync(String jobScheduleId, JobScheduleUpdateParameter jobScheduleUpdateParameter) {
1127         if (this.client.batchUrl() == null) {
1128             throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null.");
1129         }
1130         if (jobScheduleId == null) {
1131             throw new IllegalArgumentException("Parameter jobScheduleId is required and cannot be null.");
1132         }
1133         if (jobScheduleUpdateParameter == null) {
1134             throw new IllegalArgumentException("Parameter jobScheduleUpdateParameter is required and cannot be null.");
1135         }
1136         if (this.client.apiVersion() == null) {
1137             throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
1138         }
1139         Validator.validate(jobScheduleUpdateParameter);
1140         final JobScheduleUpdateOptions jobScheduleUpdateOptions = null;
1141         Integer timeout = null;
1142         UUID clientRequestId = null;
1143         Boolean returnClientRequestId = null;
1144         DateTime ocpDate = null;
1145         String ifMatch = null;
1146         String ifNoneMatch = null;
1147         DateTime ifModifiedSince = null;
1148         DateTime ifUnmodifiedSince = null;
1149         String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl());
1150         DateTimeRfc1123 ocpDateConverted = null;
1151         if (ocpDate != null) {
1152             ocpDateConverted = new DateTimeRfc1123(ocpDate);
1153         }
1154         DateTimeRfc1123 ifModifiedSinceConverted = null;
1155         if (ifModifiedSince != null) {
1156             ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince);
1157         }
1158         DateTimeRfc1123 ifUnmodifiedSinceConverted = null;
1159         if (ifUnmodifiedSince != null) {
1160             ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince);
1161         }
1162         return service.update(jobScheduleId, jobScheduleUpdateParameter, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent())
1163             .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponseWithHeaders<Void, JobScheduleUpdateHeaders>>>() {
1164                 @Override
1165                 public Observable<ServiceResponseWithHeaders<Void, JobScheduleUpdateHeaders>> call(Response<ResponseBody> response) {
1166                     try {
1167                         ServiceResponseWithHeaders<Void, JobScheduleUpdateHeaders> clientResponse = updateDelegate(response);
1168                         return Observable.just(clientResponse);
1169                     } catch (Throwable t) {
1170                         return Observable.error(t);
1171                     }
1172                 }
1173             });
1174     }
1175 
1176     /**
1177      * Updates the properties of the specified job schedule.
1178      * This fully replaces all the updatable properties of the job schedule. For example, if the schedule property is not specified with this request, then the Batch service will remove the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected.
1179      *
1180      * @param jobScheduleId The ID of the job schedule to update.
1181      * @param jobScheduleUpdateParameter The parameters for the request.
1182      * @param jobScheduleUpdateOptions Additional parameters for the operation
1183      * @throws IllegalArgumentException thrown if parameters fail the validation
1184      * @throws BatchErrorException thrown if the request is rejected by server
1185      * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
1186      */
1187     public void update(String jobScheduleId, JobScheduleUpdateParameter jobScheduleUpdateParameter, JobScheduleUpdateOptions jobScheduleUpdateOptions) {
1188         updateWithServiceResponseAsync(jobScheduleId, jobScheduleUpdateParameter, jobScheduleUpdateOptions).toBlocking().single().body();
1189     }
1190 
1191     /**
1192      * Updates the properties of the specified job schedule.
1193      * This fully replaces all the updatable properties of the job schedule. For example, if the schedule property is not specified with this request, then the Batch service will remove the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected.
1194      *
1195      * @param jobScheduleId The ID of the job schedule to update.
1196      * @param jobScheduleUpdateParameter The parameters for the request.
1197      * @param jobScheduleUpdateOptions Additional parameters for the operation
1198      * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
1199      * @throws IllegalArgumentException thrown if parameters fail the validation
1200      * @return the {@link ServiceFuture} object
1201      */
1202     public ServiceFuture<Void> updateAsync(String jobScheduleId, JobScheduleUpdateParameter jobScheduleUpdateParameter, JobScheduleUpdateOptions jobScheduleUpdateOptions, final ServiceCallback<Void> serviceCallback) {
1203         return ServiceFuture.fromHeaderResponse(updateWithServiceResponseAsync(jobScheduleId, jobScheduleUpdateParameter, jobScheduleUpdateOptions), serviceCallback);
1204     }
1205 
1206     /**
1207      * Updates the properties of the specified job schedule.
1208      * This fully replaces all the updatable properties of the job schedule. For example, if the schedule property is not specified with this request, then the Batch service will remove the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected.
1209      *
1210      * @param jobScheduleId The ID of the job schedule to update.
1211      * @param jobScheduleUpdateParameter The parameters for the request.
1212      * @param jobScheduleUpdateOptions Additional parameters for the operation
1213      * @throws IllegalArgumentException thrown if parameters fail the validation
1214      * @return the {@link ServiceResponseWithHeaders} object if successful.
1215      */
1216     public Observable<Void> updateAsync(String jobScheduleId, JobScheduleUpdateParameter jobScheduleUpdateParameter, JobScheduleUpdateOptions jobScheduleUpdateOptions) {
1217         return updateWithServiceResponseAsync(jobScheduleId, jobScheduleUpdateParameter, jobScheduleUpdateOptions).map(new Func1<ServiceResponseWithHeaders<Void, JobScheduleUpdateHeaders>, Void>() {
1218             @Override
1219             public Void call(ServiceResponseWithHeaders<Void, JobScheduleUpdateHeaders> response) {
1220                 return response.body();
1221             }
1222         });
1223     }
1224 
1225     /**
1226      * Updates the properties of the specified job schedule.
1227      * This fully replaces all the updatable properties of the job schedule. For example, if the schedule property is not specified with this request, then the Batch service will remove the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected.
1228      *
1229      * @param jobScheduleId The ID of the job schedule to update.
1230      * @param jobScheduleUpdateParameter The parameters for the request.
1231      * @param jobScheduleUpdateOptions Additional parameters for the operation
1232      * @throws IllegalArgumentException thrown if parameters fail the validation
1233      * @return the {@link ServiceResponseWithHeaders} object if successful.
1234      */
1235     public Observable<ServiceResponseWithHeaders<Void, JobScheduleUpdateHeaders>> updateWithServiceResponseAsync(String jobScheduleId, JobScheduleUpdateParameter jobScheduleUpdateParameter, JobScheduleUpdateOptions jobScheduleUpdateOptions) {
1236         if (this.client.batchUrl() == null) {
1237             throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null.");
1238         }
1239         if (jobScheduleId == null) {
1240             throw new IllegalArgumentException("Parameter jobScheduleId is required and cannot be null.");
1241         }
1242         if (jobScheduleUpdateParameter == null) {
1243             throw new IllegalArgumentException("Parameter jobScheduleUpdateParameter is required and cannot be null.");
1244         }
1245         if (this.client.apiVersion() == null) {
1246             throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
1247         }
1248         Validator.validate(jobScheduleUpdateParameter);
1249         Validator.validate(jobScheduleUpdateOptions);
1250         Integer timeout = null;
1251         if (jobScheduleUpdateOptions != null) {
1252             timeout = jobScheduleUpdateOptions.timeout();
1253         }
1254         UUID clientRequestId = null;
1255         if (jobScheduleUpdateOptions != null) {
1256             clientRequestId = jobScheduleUpdateOptions.clientRequestId();
1257         }
1258         Boolean returnClientRequestId = null;
1259         if (jobScheduleUpdateOptions != null) {
1260             returnClientRequestId = jobScheduleUpdateOptions.returnClientRequestId();
1261         }
1262         DateTime ocpDate = null;
1263         if (jobScheduleUpdateOptions != null) {
1264             ocpDate = jobScheduleUpdateOptions.ocpDate();
1265         }
1266         String ifMatch = null;
1267         if (jobScheduleUpdateOptions != null) {
1268             ifMatch = jobScheduleUpdateOptions.ifMatch();
1269         }
1270         String ifNoneMatch = null;
1271         if (jobScheduleUpdateOptions != null) {
1272             ifNoneMatch = jobScheduleUpdateOptions.ifNoneMatch();
1273         }
1274         DateTime ifModifiedSince = null;
1275         if (jobScheduleUpdateOptions != null) {
1276             ifModifiedSince = jobScheduleUpdateOptions.ifModifiedSince();
1277         }
1278         DateTime ifUnmodifiedSince = null;
1279         if (jobScheduleUpdateOptions != null) {
1280             ifUnmodifiedSince = jobScheduleUpdateOptions.ifUnmodifiedSince();
1281         }
1282         String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl());
1283         DateTimeRfc1123 ocpDateConverted = null;
1284         if (ocpDate != null) {
1285             ocpDateConverted = new DateTimeRfc1123(ocpDate);
1286         }
1287         DateTimeRfc1123 ifModifiedSinceConverted = null;
1288         if (ifModifiedSince != null) {
1289             ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince);
1290         }
1291         DateTimeRfc1123 ifUnmodifiedSinceConverted = null;
1292         if (ifUnmodifiedSince != null) {
1293             ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince);
1294         }
1295         return service.update(jobScheduleId, jobScheduleUpdateParameter, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent())
1296             .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponseWithHeaders<Void, JobScheduleUpdateHeaders>>>() {
1297                 @Override
1298                 public Observable<ServiceResponseWithHeaders<Void, JobScheduleUpdateHeaders>> call(Response<ResponseBody> response) {
1299                     try {
1300                         ServiceResponseWithHeaders<Void, JobScheduleUpdateHeaders> clientResponse = updateDelegate(response);
1301                         return Observable.just(clientResponse);
1302                     } catch (Throwable t) {
1303                         return Observable.error(t);
1304                     }
1305                 }
1306             });
1307     }
1308 
1309     private ServiceResponseWithHeaders<Void, JobScheduleUpdateHeaders> updateDelegate(Response<ResponseBody> response) throws BatchErrorException, IOException, IllegalArgumentException {
1310         return this.client.restClient().responseBuilderFactory().<Void, BatchErrorException>newInstance(this.client.serializerAdapter())
1311                 .register(200, new TypeToken<Void>() { }.getType())
1312                 .registerError(BatchErrorException.class)
1313                 .buildWithHeaders(response, JobScheduleUpdateHeaders.class);
1314     }
1315 
1316     /**
1317      * Disables a job schedule.
1318      * No new jobs will be created until the job schedule is enabled again.
1319      *
1320      * @param jobScheduleId The ID of the job schedule to disable.
1321      * @throws IllegalArgumentException thrown if parameters fail the validation
1322      * @throws BatchErrorException thrown if the request is rejected by server
1323      * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
1324      */
1325     public void disable(String jobScheduleId) {
1326         disableWithServiceResponseAsync(jobScheduleId).toBlocking().single().body();
1327     }
1328 
1329     /**
1330      * Disables a job schedule.
1331      * No new jobs will be created until the job schedule is enabled again.
1332      *
1333      * @param jobScheduleId The ID of the job schedule to disable.
1334      * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
1335      * @throws IllegalArgumentException thrown if parameters fail the validation
1336      * @return the {@link ServiceFuture} object
1337      */
1338     public ServiceFuture<Void> disableAsync(String jobScheduleId, final ServiceCallback<Void> serviceCallback) {
1339         return ServiceFuture.fromHeaderResponse(disableWithServiceResponseAsync(jobScheduleId), serviceCallback);
1340     }
1341 
1342     /**
1343      * Disables a job schedule.
1344      * No new jobs will be created until the job schedule is enabled again.
1345      *
1346      * @param jobScheduleId The ID of the job schedule to disable.
1347      * @throws IllegalArgumentException thrown if parameters fail the validation
1348      * @return the {@link ServiceResponseWithHeaders} object if successful.
1349      */
1350     public Observable<Void> disableAsync(String jobScheduleId) {
1351         return disableWithServiceResponseAsync(jobScheduleId).map(new Func1<ServiceResponseWithHeaders<Void, JobScheduleDisableHeaders>, Void>() {
1352             @Override
1353             public Void call(ServiceResponseWithHeaders<Void, JobScheduleDisableHeaders> response) {
1354                 return response.body();
1355             }
1356         });
1357     }
1358 
1359     /**
1360      * Disables a job schedule.
1361      * No new jobs will be created until the job schedule is enabled again.
1362      *
1363      * @param jobScheduleId The ID of the job schedule to disable.
1364      * @throws IllegalArgumentException thrown if parameters fail the validation
1365      * @return the {@link ServiceResponseWithHeaders} object if successful.
1366      */
1367     public Observable<ServiceResponseWithHeaders<Void, JobScheduleDisableHeaders>> disableWithServiceResponseAsync(String jobScheduleId) {
1368         if (this.client.batchUrl() == null) {
1369             throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null.");
1370         }
1371         if (jobScheduleId == null) {
1372             throw new IllegalArgumentException("Parameter jobScheduleId is required and cannot be null.");
1373         }
1374         if (this.client.apiVersion() == null) {
1375             throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
1376         }
1377         final JobScheduleDisableOptions jobScheduleDisableOptions = null;
1378         Integer timeout = null;
1379         UUID clientRequestId = null;
1380         Boolean returnClientRequestId = null;
1381         DateTime ocpDate = null;
1382         String ifMatch = null;
1383         String ifNoneMatch = null;
1384         DateTime ifModifiedSince = null;
1385         DateTime ifUnmodifiedSince = null;
1386         String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl());
1387         DateTimeRfc1123 ocpDateConverted = null;
1388         if (ocpDate != null) {
1389             ocpDateConverted = new DateTimeRfc1123(ocpDate);
1390         }
1391         DateTimeRfc1123 ifModifiedSinceConverted = null;
1392         if (ifModifiedSince != null) {
1393             ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince);
1394         }
1395         DateTimeRfc1123 ifUnmodifiedSinceConverted = null;
1396         if (ifUnmodifiedSince != null) {
1397             ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince);
1398         }
1399         return service.disable(jobScheduleId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent())
1400             .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponseWithHeaders<Void, JobScheduleDisableHeaders>>>() {
1401                 @Override
1402                 public Observable<ServiceResponseWithHeaders<Void, JobScheduleDisableHeaders>> call(Response<ResponseBody> response) {
1403                     try {
1404                         ServiceResponseWithHeaders<Void, JobScheduleDisableHeaders> clientResponse = disableDelegate(response);
1405                         return Observable.just(clientResponse);
1406                     } catch (Throwable t) {
1407                         return Observable.error(t);
1408                     }
1409                 }
1410             });
1411     }
1412 
1413     /**
1414      * Disables a job schedule.
1415      * No new jobs will be created until the job schedule is enabled again.
1416      *
1417      * @param jobScheduleId The ID of the job schedule to disable.
1418      * @param jobScheduleDisableOptions Additional parameters for the operation
1419      * @throws IllegalArgumentException thrown if parameters fail the validation
1420      * @throws BatchErrorException thrown if the request is rejected by server
1421      * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
1422      */
1423     public void disable(String jobScheduleId, JobScheduleDisableOptions jobScheduleDisableOptions) {
1424         disableWithServiceResponseAsync(jobScheduleId, jobScheduleDisableOptions).toBlocking().single().body();
1425     }
1426 
1427     /**
1428      * Disables a job schedule.
1429      * No new jobs will be created until the job schedule is enabled again.
1430      *
1431      * @param jobScheduleId The ID of the job schedule to disable.
1432      * @param jobScheduleDisableOptions Additional parameters for the operation
1433      * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
1434      * @throws IllegalArgumentException thrown if parameters fail the validation
1435      * @return the {@link ServiceFuture} object
1436      */
1437     public ServiceFuture<Void> disableAsync(String jobScheduleId, JobScheduleDisableOptions jobScheduleDisableOptions, final ServiceCallback<Void> serviceCallback) {
1438         return ServiceFuture.fromHeaderResponse(disableWithServiceResponseAsync(jobScheduleId, jobScheduleDisableOptions), serviceCallback);
1439     }
1440 
1441     /**
1442      * Disables a job schedule.
1443      * No new jobs will be created until the job schedule is enabled again.
1444      *
1445      * @param jobScheduleId The ID of the job schedule to disable.
1446      * @param jobScheduleDisableOptions Additional parameters for the operation
1447      * @throws IllegalArgumentException thrown if parameters fail the validation
1448      * @return the {@link ServiceResponseWithHeaders} object if successful.
1449      */
1450     public Observable<Void> disableAsync(String jobScheduleId, JobScheduleDisableOptions jobScheduleDisableOptions) {
1451         return disableWithServiceResponseAsync(jobScheduleId, jobScheduleDisableOptions).map(new Func1<ServiceResponseWithHeaders<Void, JobScheduleDisableHeaders>, Void>() {
1452             @Override
1453             public Void call(ServiceResponseWithHeaders<Void, JobScheduleDisableHeaders> response) {
1454                 return response.body();
1455             }
1456         });
1457     }
1458 
1459     /**
1460      * Disables a job schedule.
1461      * No new jobs will be created until the job schedule is enabled again.
1462      *
1463      * @param jobScheduleId The ID of the job schedule to disable.
1464      * @param jobScheduleDisableOptions Additional parameters for the operation
1465      * @throws IllegalArgumentException thrown if parameters fail the validation
1466      * @return the {@link ServiceResponseWithHeaders} object if successful.
1467      */
1468     public Observable<ServiceResponseWithHeaders<Void, JobScheduleDisableHeaders>> disableWithServiceResponseAsync(String jobScheduleId, JobScheduleDisableOptions jobScheduleDisableOptions) {
1469         if (this.client.batchUrl() == null) {
1470             throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null.");
1471         }
1472         if (jobScheduleId == null) {
1473             throw new IllegalArgumentException("Parameter jobScheduleId is required and cannot be null.");
1474         }
1475         if (this.client.apiVersion() == null) {
1476             throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
1477         }
1478         Validator.validate(jobScheduleDisableOptions);
1479         Integer timeout = null;
1480         if (jobScheduleDisableOptions != null) {
1481             timeout = jobScheduleDisableOptions.timeout();
1482         }
1483         UUID clientRequestId = null;
1484         if (jobScheduleDisableOptions != null) {
1485             clientRequestId = jobScheduleDisableOptions.clientRequestId();
1486         }
1487         Boolean returnClientRequestId = null;
1488         if (jobScheduleDisableOptions != null) {
1489             returnClientRequestId = jobScheduleDisableOptions.returnClientRequestId();
1490         }
1491         DateTime ocpDate = null;
1492         if (jobScheduleDisableOptions != null) {
1493             ocpDate = jobScheduleDisableOptions.ocpDate();
1494         }
1495         String ifMatch = null;
1496         if (jobScheduleDisableOptions != null) {
1497             ifMatch = jobScheduleDisableOptions.ifMatch();
1498         }
1499         String ifNoneMatch = null;
1500         if (jobScheduleDisableOptions != null) {
1501             ifNoneMatch = jobScheduleDisableOptions.ifNoneMatch();
1502         }
1503         DateTime ifModifiedSince = null;
1504         if (jobScheduleDisableOptions != null) {
1505             ifModifiedSince = jobScheduleDisableOptions.ifModifiedSince();
1506         }
1507         DateTime ifUnmodifiedSince = null;
1508         if (jobScheduleDisableOptions != null) {
1509             ifUnmodifiedSince = jobScheduleDisableOptions.ifUnmodifiedSince();
1510         }
1511         String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl());
1512         DateTimeRfc1123 ocpDateConverted = null;
1513         if (ocpDate != null) {
1514             ocpDateConverted = new DateTimeRfc1123(ocpDate);
1515         }
1516         DateTimeRfc1123 ifModifiedSinceConverted = null;
1517         if (ifModifiedSince != null) {
1518             ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince);
1519         }
1520         DateTimeRfc1123 ifUnmodifiedSinceConverted = null;
1521         if (ifUnmodifiedSince != null) {
1522             ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince);
1523         }
1524         return service.disable(jobScheduleId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent())
1525             .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponseWithHeaders<Void, JobScheduleDisableHeaders>>>() {
1526                 @Override
1527                 public Observable<ServiceResponseWithHeaders<Void, JobScheduleDisableHeaders>> call(Response<ResponseBody> response) {
1528                     try {
1529                         ServiceResponseWithHeaders<Void, JobScheduleDisableHeaders> clientResponse = disableDelegate(response);
1530                         return Observable.just(clientResponse);
1531                     } catch (Throwable t) {
1532                         return Observable.error(t);
1533                     }
1534                 }
1535             });
1536     }
1537 
1538     private ServiceResponseWithHeaders<Void, JobScheduleDisableHeaders> disableDelegate(Response<ResponseBody> response) throws BatchErrorException, IOException, IllegalArgumentException {
1539         return this.client.restClient().responseBuilderFactory().<Void, BatchErrorException>newInstance(this.client.serializerAdapter())
1540                 .register(204, new TypeToken<Void>() { }.getType())
1541                 .registerError(BatchErrorException.class)
1542                 .buildWithHeaders(response, JobScheduleDisableHeaders.class);
1543     }
1544 
1545     /**
1546      * Enables a job schedule.
1547      *
1548      * @param jobScheduleId The ID of the job schedule to enable.
1549      * @throws IllegalArgumentException thrown if parameters fail the validation
1550      * @throws BatchErrorException thrown if the request is rejected by server
1551      * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
1552      */
1553     public void enable(String jobScheduleId) {
1554         enableWithServiceResponseAsync(jobScheduleId).toBlocking().single().body();
1555     }
1556 
1557     /**
1558      * Enables a job schedule.
1559      *
1560      * @param jobScheduleId The ID of the job schedule to enable.
1561      * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
1562      * @throws IllegalArgumentException thrown if parameters fail the validation
1563      * @return the {@link ServiceFuture} object
1564      */
1565     public ServiceFuture<Void> enableAsync(String jobScheduleId, final ServiceCallback<Void> serviceCallback) {
1566         return ServiceFuture.fromHeaderResponse(enableWithServiceResponseAsync(jobScheduleId), serviceCallback);
1567     }
1568 
1569     /**
1570      * Enables a job schedule.
1571      *
1572      * @param jobScheduleId The ID of the job schedule to enable.
1573      * @throws IllegalArgumentException thrown if parameters fail the validation
1574      * @return the {@link ServiceResponseWithHeaders} object if successful.
1575      */
1576     public Observable<Void> enableAsync(String jobScheduleId) {
1577         return enableWithServiceResponseAsync(jobScheduleId).map(new Func1<ServiceResponseWithHeaders<Void, JobScheduleEnableHeaders>, Void>() {
1578             @Override
1579             public Void call(ServiceResponseWithHeaders<Void, JobScheduleEnableHeaders> response) {
1580                 return response.body();
1581             }
1582         });
1583     }
1584 
1585     /**
1586      * Enables a job schedule.
1587      *
1588      * @param jobScheduleId The ID of the job schedule to enable.
1589      * @throws IllegalArgumentException thrown if parameters fail the validation
1590      * @return the {@link ServiceResponseWithHeaders} object if successful.
1591      */
1592     public Observable<ServiceResponseWithHeaders<Void, JobScheduleEnableHeaders>> enableWithServiceResponseAsync(String jobScheduleId) {
1593         if (this.client.batchUrl() == null) {
1594             throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null.");
1595         }
1596         if (jobScheduleId == null) {
1597             throw new IllegalArgumentException("Parameter jobScheduleId is required and cannot be null.");
1598         }
1599         if (this.client.apiVersion() == null) {
1600             throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
1601         }
1602         final JobScheduleEnableOptions jobScheduleEnableOptions = null;
1603         Integer timeout = null;
1604         UUID clientRequestId = null;
1605         Boolean returnClientRequestId = null;
1606         DateTime ocpDate = null;
1607         String ifMatch = null;
1608         String ifNoneMatch = null;
1609         DateTime ifModifiedSince = null;
1610         DateTime ifUnmodifiedSince = null;
1611         String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl());
1612         DateTimeRfc1123 ocpDateConverted = null;
1613         if (ocpDate != null) {
1614             ocpDateConverted = new DateTimeRfc1123(ocpDate);
1615         }
1616         DateTimeRfc1123 ifModifiedSinceConverted = null;
1617         if (ifModifiedSince != null) {
1618             ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince);
1619         }
1620         DateTimeRfc1123 ifUnmodifiedSinceConverted = null;
1621         if (ifUnmodifiedSince != null) {
1622             ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince);
1623         }
1624         return service.enable(jobScheduleId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent())
1625             .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponseWithHeaders<Void, JobScheduleEnableHeaders>>>() {
1626                 @Override
1627                 public Observable<ServiceResponseWithHeaders<Void, JobScheduleEnableHeaders>> call(Response<ResponseBody> response) {
1628                     try {
1629                         ServiceResponseWithHeaders<Void, JobScheduleEnableHeaders> clientResponse = enableDelegate(response);
1630                         return Observable.just(clientResponse);
1631                     } catch (Throwable t) {
1632                         return Observable.error(t);
1633                     }
1634                 }
1635             });
1636     }
1637 
1638     /**
1639      * Enables a job schedule.
1640      *
1641      * @param jobScheduleId The ID of the job schedule to enable.
1642      * @param jobScheduleEnableOptions Additional parameters for the operation
1643      * @throws IllegalArgumentException thrown if parameters fail the validation
1644      * @throws BatchErrorException thrown if the request is rejected by server
1645      * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
1646      */
1647     public void enable(String jobScheduleId, JobScheduleEnableOptions jobScheduleEnableOptions) {
1648         enableWithServiceResponseAsync(jobScheduleId, jobScheduleEnableOptions).toBlocking().single().body();
1649     }
1650 
1651     /**
1652      * Enables a job schedule.
1653      *
1654      * @param jobScheduleId The ID of the job schedule to enable.
1655      * @param jobScheduleEnableOptions Additional parameters for the operation
1656      * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
1657      * @throws IllegalArgumentException thrown if parameters fail the validation
1658      * @return the {@link ServiceFuture} object
1659      */
1660     public ServiceFuture<Void> enableAsync(String jobScheduleId, JobScheduleEnableOptions jobScheduleEnableOptions, final ServiceCallback<Void> serviceCallback) {
1661         return ServiceFuture.fromHeaderResponse(enableWithServiceResponseAsync(jobScheduleId, jobScheduleEnableOptions), serviceCallback);
1662     }
1663 
1664     /**
1665      * Enables a job schedule.
1666      *
1667      * @param jobScheduleId The ID of the job schedule to enable.
1668      * @param jobScheduleEnableOptions Additional parameters for the operation
1669      * @throws IllegalArgumentException thrown if parameters fail the validation
1670      * @return the {@link ServiceResponseWithHeaders} object if successful.
1671      */
1672     public Observable<Void> enableAsync(String jobScheduleId, JobScheduleEnableOptions jobScheduleEnableOptions) {
1673         return enableWithServiceResponseAsync(jobScheduleId, jobScheduleEnableOptions).map(new Func1<ServiceResponseWithHeaders<Void, JobScheduleEnableHeaders>, Void>() {
1674             @Override
1675             public Void call(ServiceResponseWithHeaders<Void, JobScheduleEnableHeaders> response) {
1676                 return response.body();
1677             }
1678         });
1679     }
1680 
1681     /**
1682      * Enables a job schedule.
1683      *
1684      * @param jobScheduleId The ID of the job schedule to enable.
1685      * @param jobScheduleEnableOptions Additional parameters for the operation
1686      * @throws IllegalArgumentException thrown if parameters fail the validation
1687      * @return the {@link ServiceResponseWithHeaders} object if successful.
1688      */
1689     public Observable<ServiceResponseWithHeaders<Void, JobScheduleEnableHeaders>> enableWithServiceResponseAsync(String jobScheduleId, JobScheduleEnableOptions jobScheduleEnableOptions) {
1690         if (this.client.batchUrl() == null) {
1691             throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null.");
1692         }
1693         if (jobScheduleId == null) {
1694             throw new IllegalArgumentException("Parameter jobScheduleId is required and cannot be null.");
1695         }
1696         if (this.client.apiVersion() == null) {
1697             throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
1698         }
1699         Validator.validate(jobScheduleEnableOptions);
1700         Integer timeout = null;
1701         if (jobScheduleEnableOptions != null) {
1702             timeout = jobScheduleEnableOptions.timeout();
1703         }
1704         UUID clientRequestId = null;
1705         if (jobScheduleEnableOptions != null) {
1706             clientRequestId = jobScheduleEnableOptions.clientRequestId();
1707         }
1708         Boolean returnClientRequestId = null;
1709         if (jobScheduleEnableOptions != null) {
1710             returnClientRequestId = jobScheduleEnableOptions.returnClientRequestId();
1711         }
1712         DateTime ocpDate = null;
1713         if (jobScheduleEnableOptions != null) {
1714             ocpDate = jobScheduleEnableOptions.ocpDate();
1715         }
1716         String ifMatch = null;
1717         if (jobScheduleEnableOptions != null) {
1718             ifMatch = jobScheduleEnableOptions.ifMatch();
1719         }
1720         String ifNoneMatch = null;
1721         if (jobScheduleEnableOptions != null) {
1722             ifNoneMatch = jobScheduleEnableOptions.ifNoneMatch();
1723         }
1724         DateTime ifModifiedSince = null;
1725         if (jobScheduleEnableOptions != null) {
1726             ifModifiedSince = jobScheduleEnableOptions.ifModifiedSince();
1727         }
1728         DateTime ifUnmodifiedSince = null;
1729         if (jobScheduleEnableOptions != null) {
1730             ifUnmodifiedSince = jobScheduleEnableOptions.ifUnmodifiedSince();
1731         }
1732         String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl());
1733         DateTimeRfc1123 ocpDateConverted = null;
1734         if (ocpDate != null) {
1735             ocpDateConverted = new DateTimeRfc1123(ocpDate);
1736         }
1737         DateTimeRfc1123 ifModifiedSinceConverted = null;
1738         if (ifModifiedSince != null) {
1739             ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince);
1740         }
1741         DateTimeRfc1123 ifUnmodifiedSinceConverted = null;
1742         if (ifUnmodifiedSince != null) {
1743             ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince);
1744         }
1745         return service.enable(jobScheduleId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent())
1746             .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponseWithHeaders<Void, JobScheduleEnableHeaders>>>() {
1747                 @Override
1748                 public Observable<ServiceResponseWithHeaders<Void, JobScheduleEnableHeaders>> call(Response<ResponseBody> response) {
1749                     try {
1750                         ServiceResponseWithHeaders<Void, JobScheduleEnableHeaders> clientResponse = enableDelegate(response);
1751                         return Observable.just(clientResponse);
1752                     } catch (Throwable t) {
1753                         return Observable.error(t);
1754                     }
1755                 }
1756             });
1757     }
1758 
1759     private ServiceResponseWithHeaders<Void, JobScheduleEnableHeaders> enableDelegate(Response<ResponseBody> response) throws BatchErrorException, IOException, IllegalArgumentException {
1760         return this.client.restClient().responseBuilderFactory().<Void, BatchErrorException>newInstance(this.client.serializerAdapter())
1761                 .register(204, new TypeToken<Void>() { }.getType())
1762                 .registerError(BatchErrorException.class)
1763                 .buildWithHeaders(response, JobScheduleEnableHeaders.class);
1764     }
1765 
1766     /**
1767      * Terminates a job schedule.
1768      *
1769      * @param jobScheduleId The ID of the job schedule to terminates.
1770      * @throws IllegalArgumentException thrown if parameters fail the validation
1771      * @throws BatchErrorException thrown if the request is rejected by server
1772      * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
1773      */
1774     public void terminate(String jobScheduleId) {
1775         terminateWithServiceResponseAsync(jobScheduleId).toBlocking().single().body();
1776     }
1777 
1778     /**
1779      * Terminates a job schedule.
1780      *
1781      * @param jobScheduleId The ID of the job schedule to terminates.
1782      * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
1783      * @throws IllegalArgumentException thrown if parameters fail the validation
1784      * @return the {@link ServiceFuture} object
1785      */
1786     public ServiceFuture<Void> terminateAsync(String jobScheduleId, final ServiceCallback<Void> serviceCallback) {
1787         return ServiceFuture.fromHeaderResponse(terminateWithServiceResponseAsync(jobScheduleId), serviceCallback);
1788     }
1789 
1790     /**
1791      * Terminates a job schedule.
1792      *
1793      * @param jobScheduleId The ID of the job schedule to terminates.
1794      * @throws IllegalArgumentException thrown if parameters fail the validation
1795      * @return the {@link ServiceResponseWithHeaders} object if successful.
1796      */
1797     public Observable<Void> terminateAsync(String jobScheduleId) {
1798         return terminateWithServiceResponseAsync(jobScheduleId).map(new Func1<ServiceResponseWithHeaders<Void, JobScheduleTerminateHeaders>, Void>() {
1799             @Override
1800             public Void call(ServiceResponseWithHeaders<Void, JobScheduleTerminateHeaders> response) {
1801                 return response.body();
1802             }
1803         });
1804     }
1805 
1806     /**
1807      * Terminates a job schedule.
1808      *
1809      * @param jobScheduleId The ID of the job schedule to terminates.
1810      * @throws IllegalArgumentException thrown if parameters fail the validation
1811      * @return the {@link ServiceResponseWithHeaders} object if successful.
1812      */
1813     public Observable<ServiceResponseWithHeaders<Void, JobScheduleTerminateHeaders>> terminateWithServiceResponseAsync(String jobScheduleId) {
1814         if (this.client.batchUrl() == null) {
1815             throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null.");
1816         }
1817         if (jobScheduleId == null) {
1818             throw new IllegalArgumentException("Parameter jobScheduleId is required and cannot be null.");
1819         }
1820         if (this.client.apiVersion() == null) {
1821             throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
1822         }
1823         final JobScheduleTerminateOptions jobScheduleTerminateOptions = null;
1824         Integer timeout = null;
1825         UUID clientRequestId = null;
1826         Boolean returnClientRequestId = null;
1827         DateTime ocpDate = null;
1828         String ifMatch = null;
1829         String ifNoneMatch = null;
1830         DateTime ifModifiedSince = null;
1831         DateTime ifUnmodifiedSince = null;
1832         String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl());
1833         DateTimeRfc1123 ocpDateConverted = null;
1834         if (ocpDate != null) {
1835             ocpDateConverted = new DateTimeRfc1123(ocpDate);
1836         }
1837         DateTimeRfc1123 ifModifiedSinceConverted = null;
1838         if (ifModifiedSince != null) {
1839             ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince);
1840         }
1841         DateTimeRfc1123 ifUnmodifiedSinceConverted = null;
1842         if (ifUnmodifiedSince != null) {
1843             ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince);
1844         }
1845         return service.terminate(jobScheduleId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent())
1846             .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponseWithHeaders<Void, JobScheduleTerminateHeaders>>>() {
1847                 @Override
1848                 public Observable<ServiceResponseWithHeaders<Void, JobScheduleTerminateHeaders>> call(Response<ResponseBody> response) {
1849                     try {
1850                         ServiceResponseWithHeaders<Void, JobScheduleTerminateHeaders> clientResponse = terminateDelegate(response);
1851                         return Observable.just(clientResponse);
1852                     } catch (Throwable t) {
1853                         return Observable.error(t);
1854                     }
1855                 }
1856             });
1857     }
1858 
1859     /**
1860      * Terminates a job schedule.
1861      *
1862      * @param jobScheduleId The ID of the job schedule to terminates.
1863      * @param jobScheduleTerminateOptions Additional parameters for the operation
1864      * @throws IllegalArgumentException thrown if parameters fail the validation
1865      * @throws BatchErrorException thrown if the request is rejected by server
1866      * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
1867      */
1868     public void terminate(String jobScheduleId, JobScheduleTerminateOptions jobScheduleTerminateOptions) {
1869         terminateWithServiceResponseAsync(jobScheduleId, jobScheduleTerminateOptions).toBlocking().single().body();
1870     }
1871 
1872     /**
1873      * Terminates a job schedule.
1874      *
1875      * @param jobScheduleId The ID of the job schedule to terminates.
1876      * @param jobScheduleTerminateOptions Additional parameters for the operation
1877      * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
1878      * @throws IllegalArgumentException thrown if parameters fail the validation
1879      * @return the {@link ServiceFuture} object
1880      */
1881     public ServiceFuture<Void> terminateAsync(String jobScheduleId, JobScheduleTerminateOptions jobScheduleTerminateOptions, final ServiceCallback<Void> serviceCallback) {
1882         return ServiceFuture.fromHeaderResponse(terminateWithServiceResponseAsync(jobScheduleId, jobScheduleTerminateOptions), serviceCallback);
1883     }
1884 
1885     /**
1886      * Terminates a job schedule.
1887      *
1888      * @param jobScheduleId The ID of the job schedule to terminates.
1889      * @param jobScheduleTerminateOptions Additional parameters for the operation
1890      * @throws IllegalArgumentException thrown if parameters fail the validation
1891      * @return the {@link ServiceResponseWithHeaders} object if successful.
1892      */
1893     public Observable<Void> terminateAsync(String jobScheduleId, JobScheduleTerminateOptions jobScheduleTerminateOptions) {
1894         return terminateWithServiceResponseAsync(jobScheduleId, jobScheduleTerminateOptions).map(new Func1<ServiceResponseWithHeaders<Void, JobScheduleTerminateHeaders>, Void>() {
1895             @Override
1896             public Void call(ServiceResponseWithHeaders<Void, JobScheduleTerminateHeaders> response) {
1897                 return response.body();
1898             }
1899         });
1900     }
1901 
1902     /**
1903      * Terminates a job schedule.
1904      *
1905      * @param jobScheduleId The ID of the job schedule to terminates.
1906      * @param jobScheduleTerminateOptions Additional parameters for the operation
1907      * @throws IllegalArgumentException thrown if parameters fail the validation
1908      * @return the {@link ServiceResponseWithHeaders} object if successful.
1909      */
1910     public Observable<ServiceResponseWithHeaders<Void, JobScheduleTerminateHeaders>> terminateWithServiceResponseAsync(String jobScheduleId, JobScheduleTerminateOptions jobScheduleTerminateOptions) {
1911         if (this.client.batchUrl() == null) {
1912             throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null.");
1913         }
1914         if (jobScheduleId == null) {
1915             throw new IllegalArgumentException("Parameter jobScheduleId is required and cannot be null.");
1916         }
1917         if (this.client.apiVersion() == null) {
1918             throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
1919         }
1920         Validator.validate(jobScheduleTerminateOptions);
1921         Integer timeout = null;
1922         if (jobScheduleTerminateOptions != null) {
1923             timeout = jobScheduleTerminateOptions.timeout();
1924         }
1925         UUID clientRequestId = null;
1926         if (jobScheduleTerminateOptions != null) {
1927             clientRequestId = jobScheduleTerminateOptions.clientRequestId();
1928         }
1929         Boolean returnClientRequestId = null;
1930         if (jobScheduleTerminateOptions != null) {
1931             returnClientRequestId = jobScheduleTerminateOptions.returnClientRequestId();
1932         }
1933         DateTime ocpDate = null;
1934         if (jobScheduleTerminateOptions != null) {
1935             ocpDate = jobScheduleTerminateOptions.ocpDate();
1936         }
1937         String ifMatch = null;
1938         if (jobScheduleTerminateOptions != null) {
1939             ifMatch = jobScheduleTerminateOptions.ifMatch();
1940         }
1941         String ifNoneMatch = null;
1942         if (jobScheduleTerminateOptions != null) {
1943             ifNoneMatch = jobScheduleTerminateOptions.ifNoneMatch();
1944         }
1945         DateTime ifModifiedSince = null;
1946         if (jobScheduleTerminateOptions != null) {
1947             ifModifiedSince = jobScheduleTerminateOptions.ifModifiedSince();
1948         }
1949         DateTime ifUnmodifiedSince = null;
1950         if (jobScheduleTerminateOptions != null) {
1951             ifUnmodifiedSince = jobScheduleTerminateOptions.ifUnmodifiedSince();
1952         }
1953         String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl());
1954         DateTimeRfc1123 ocpDateConverted = null;
1955         if (ocpDate != null) {
1956             ocpDateConverted = new DateTimeRfc1123(ocpDate);
1957         }
1958         DateTimeRfc1123 ifModifiedSinceConverted = null;
1959         if (ifModifiedSince != null) {
1960             ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince);
1961         }
1962         DateTimeRfc1123 ifUnmodifiedSinceConverted = null;
1963         if (ifUnmodifiedSince != null) {
1964             ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince);
1965         }
1966         return service.terminate(jobScheduleId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent())
1967             .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponseWithHeaders<Void, JobScheduleTerminateHeaders>>>() {
1968                 @Override
1969                 public Observable<ServiceResponseWithHeaders<Void, JobScheduleTerminateHeaders>> call(Response<ResponseBody> response) {
1970                     try {
1971                         ServiceResponseWithHeaders<Void, JobScheduleTerminateHeaders> clientResponse = terminateDelegate(response);
1972                         return Observable.just(clientResponse);
1973                     } catch (Throwable t) {
1974                         return Observable.error(t);
1975                     }
1976                 }
1977             });
1978     }
1979 
1980     private ServiceResponseWithHeaders<Void, JobScheduleTerminateHeaders> terminateDelegate(Response<ResponseBody> response) throws BatchErrorException, IOException, IllegalArgumentException {
1981         return this.client.restClient().responseBuilderFactory().<Void, BatchErrorException>newInstance(this.client.serializerAdapter())
1982                 .register(202, new TypeToken<Void>() { }.getType())
1983                 .registerError(BatchErrorException.class)
1984                 .buildWithHeaders(response, JobScheduleTerminateHeaders.class);
1985     }
1986 
1987     /**
1988      * Adds a job schedule to the specified account.
1989      *
1990      * @param cloudJobSchedule The job schedule to be added.
1991      * @throws IllegalArgumentException thrown if parameters fail the validation
1992      * @throws BatchErrorException thrown if the request is rejected by server
1993      * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
1994      */
1995     public void add(JobScheduleAddParameter cloudJobSchedule) {
1996         addWithServiceResponseAsync(cloudJobSchedule).toBlocking().single().body();
1997     }
1998 
1999     /**
2000      * Adds a job schedule to the specified account.
2001      *
2002      * @param cloudJobSchedule The job schedule to be added.
2003      * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
2004      * @throws IllegalArgumentException thrown if parameters fail the validation
2005      * @return the {@link ServiceFuture} object
2006      */
2007     public ServiceFuture<Void> addAsync(JobScheduleAddParameter cloudJobSchedule, final ServiceCallback<Void> serviceCallback) {
2008         return ServiceFuture.fromHeaderResponse(addWithServiceResponseAsync(cloudJobSchedule), serviceCallback);
2009     }
2010 
2011     /**
2012      * Adds a job schedule to the specified account.
2013      *
2014      * @param cloudJobSchedule The job schedule to be added.
2015      * @throws IllegalArgumentException thrown if parameters fail the validation
2016      * @return the {@link ServiceResponseWithHeaders} object if successful.
2017      */
2018     public Observable<Void> addAsync(JobScheduleAddParameter cloudJobSchedule) {
2019         return addWithServiceResponseAsync(cloudJobSchedule).map(new Func1<ServiceResponseWithHeaders<Void, JobScheduleAddHeaders>, Void>() {
2020             @Override
2021             public Void call(ServiceResponseWithHeaders<Void, JobScheduleAddHeaders> response) {
2022                 return response.body();
2023             }
2024         });
2025     }
2026 
2027     /**
2028      * Adds a job schedule to the specified account.
2029      *
2030      * @param cloudJobSchedule The job schedule to be added.
2031      * @throws IllegalArgumentException thrown if parameters fail the validation
2032      * @return the {@link ServiceResponseWithHeaders} object if successful.
2033      */
2034     public Observable<ServiceResponseWithHeaders<Void, JobScheduleAddHeaders>> addWithServiceResponseAsync(JobScheduleAddParameter cloudJobSchedule) {
2035         if (this.client.batchUrl() == null) {
2036             throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null.");
2037         }
2038         if (cloudJobSchedule == null) {
2039             throw new IllegalArgumentException("Parameter cloudJobSchedule is required and cannot be null.");
2040         }
2041         if (this.client.apiVersion() == null) {
2042             throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
2043         }
2044         Validator.validate(cloudJobSchedule);
2045         final JobScheduleAddOptions jobScheduleAddOptions = null;
2046         Integer timeout = null;
2047         UUID clientRequestId = null;
2048         Boolean returnClientRequestId = null;
2049         DateTime ocpDate = null;
2050         String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl());
2051         DateTimeRfc1123 ocpDateConverted = null;
2052         if (ocpDate != null) {
2053             ocpDateConverted = new DateTimeRfc1123(ocpDate);
2054         }
2055         return service.add(cloudJobSchedule, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent())
2056             .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponseWithHeaders<Void, JobScheduleAddHeaders>>>() {
2057                 @Override
2058                 public Observable<ServiceResponseWithHeaders<Void, JobScheduleAddHeaders>> call(Response<ResponseBody> response) {
2059                     try {
2060                         ServiceResponseWithHeaders<Void, JobScheduleAddHeaders> clientResponse = addDelegate(response);
2061                         return Observable.just(clientResponse);
2062                     } catch (Throwable t) {
2063                         return Observable.error(t);
2064                     }
2065                 }
2066             });
2067     }
2068 
2069     /**
2070      * Adds a job schedule to the specified account.
2071      *
2072      * @param cloudJobSchedule The job schedule to be added.
2073      * @param jobScheduleAddOptions Additional parameters for the operation
2074      * @throws IllegalArgumentException thrown if parameters fail the validation
2075      * @throws BatchErrorException thrown if the request is rejected by server
2076      * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
2077      */
2078     public void add(JobScheduleAddParameter cloudJobSchedule, JobScheduleAddOptions jobScheduleAddOptions) {
2079         addWithServiceResponseAsync(cloudJobSchedule, jobScheduleAddOptions).toBlocking().single().body();
2080     }
2081 
2082     /**
2083      * Adds a job schedule to the specified account.
2084      *
2085      * @param cloudJobSchedule The job schedule to be added.
2086      * @param jobScheduleAddOptions Additional parameters for the operation
2087      * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
2088      * @throws IllegalArgumentException thrown if parameters fail the validation
2089      * @return the {@link ServiceFuture} object
2090      */
2091     public ServiceFuture<Void> addAsync(JobScheduleAddParameter cloudJobSchedule, JobScheduleAddOptions jobScheduleAddOptions, final ServiceCallback<Void> serviceCallback) {
2092         return ServiceFuture.fromHeaderResponse(addWithServiceResponseAsync(cloudJobSchedule, jobScheduleAddOptions), serviceCallback);
2093     }
2094 
2095     /**
2096      * Adds a job schedule to the specified account.
2097      *
2098      * @param cloudJobSchedule The job schedule to be added.
2099      * @param jobScheduleAddOptions Additional parameters for the operation
2100      * @throws IllegalArgumentException thrown if parameters fail the validation
2101      * @return the {@link ServiceResponseWithHeaders} object if successful.
2102      */
2103     public Observable<Void> addAsync(JobScheduleAddParameter cloudJobSchedule, JobScheduleAddOptions jobScheduleAddOptions) {
2104         return addWithServiceResponseAsync(cloudJobSchedule, jobScheduleAddOptions).map(new Func1<ServiceResponseWithHeaders<Void, JobScheduleAddHeaders>, Void>() {
2105             @Override
2106             public Void call(ServiceResponseWithHeaders<Void, JobScheduleAddHeaders> response) {
2107                 return response.body();
2108             }
2109         });
2110     }
2111 
2112     /**
2113      * Adds a job schedule to the specified account.
2114      *
2115      * @param cloudJobSchedule The job schedule to be added.
2116      * @param jobScheduleAddOptions Additional parameters for the operation
2117      * @throws IllegalArgumentException thrown if parameters fail the validation
2118      * @return the {@link ServiceResponseWithHeaders} object if successful.
2119      */
2120     public Observable<ServiceResponseWithHeaders<Void, JobScheduleAddHeaders>> addWithServiceResponseAsync(JobScheduleAddParameter cloudJobSchedule, JobScheduleAddOptions jobScheduleAddOptions) {
2121         if (this.client.batchUrl() == null) {
2122             throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null.");
2123         }
2124         if (cloudJobSchedule == null) {
2125             throw new IllegalArgumentException("Parameter cloudJobSchedule is required and cannot be null.");
2126         }
2127         if (this.client.apiVersion() == null) {
2128             throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
2129         }
2130         Validator.validate(cloudJobSchedule);
2131         Validator.validate(jobScheduleAddOptions);
2132         Integer timeout = null;
2133         if (jobScheduleAddOptions != null) {
2134             timeout = jobScheduleAddOptions.timeout();
2135         }
2136         UUID clientRequestId = null;
2137         if (jobScheduleAddOptions != null) {
2138             clientRequestId = jobScheduleAddOptions.clientRequestId();
2139         }
2140         Boolean returnClientRequestId = null;
2141         if (jobScheduleAddOptions != null) {
2142             returnClientRequestId = jobScheduleAddOptions.returnClientRequestId();
2143         }
2144         DateTime ocpDate = null;
2145         if (jobScheduleAddOptions != null) {
2146             ocpDate = jobScheduleAddOptions.ocpDate();
2147         }
2148         String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl());
2149         DateTimeRfc1123 ocpDateConverted = null;
2150         if (ocpDate != null) {
2151             ocpDateConverted = new DateTimeRfc1123(ocpDate);
2152         }
2153         return service.add(cloudJobSchedule, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent())
2154             .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponseWithHeaders<Void, JobScheduleAddHeaders>>>() {
2155                 @Override
2156                 public Observable<ServiceResponseWithHeaders<Void, JobScheduleAddHeaders>> call(Response<ResponseBody> response) {
2157                     try {
2158                         ServiceResponseWithHeaders<Void, JobScheduleAddHeaders> clientResponse = addDelegate(response);
2159                         return Observable.just(clientResponse);
2160                     } catch (Throwable t) {
2161                         return Observable.error(t);
2162                     }
2163                 }
2164             });
2165     }
2166 
2167     private ServiceResponseWithHeaders<Void, JobScheduleAddHeaders> addDelegate(Response<ResponseBody> response) throws BatchErrorException, IOException, IllegalArgumentException {
2168         return this.client.restClient().responseBuilderFactory().<Void, BatchErrorException>newInstance(this.client.serializerAdapter())
2169                 .register(201, new TypeToken<Void>() { }.getType())
2170                 .registerError(BatchErrorException.class)
2171                 .buildWithHeaders(response, JobScheduleAddHeaders.class);
2172     }
2173 
2174     /**
2175      * Lists all of the job schedules in the specified account.
2176      *
2177      * @throws IllegalArgumentException thrown if parameters fail the validation
2178      * @throws BatchErrorException thrown if the request is rejected by server
2179      * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
2180      * @return the PagedList&lt;CloudJobSchedule&gt; object if successful.
2181      */
2182     public PagedList<CloudJobSchedule> list() {
2183         ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders> response = listSinglePageAsync().toBlocking().single();
2184         return new PagedList<CloudJobSchedule>(response.body()) {
2185             @Override
2186             public Page<CloudJobSchedule> nextPage(String nextPageLink) {
2187                 return listNextSinglePageAsync(nextPageLink, null).toBlocking().single().body();
2188             }
2189         };
2190     }
2191 
2192     /**
2193      * Lists all of the job schedules in the specified account.
2194      *
2195      * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
2196      * @throws IllegalArgumentException thrown if parameters fail the validation
2197      * @return the {@link ServiceFuture} object
2198      */
2199     public ServiceFuture<List<CloudJobSchedule>> listAsync(final ListOperationCallback<CloudJobSchedule> serviceCallback) {
2200         return AzureServiceFuture.fromHeaderPageResponse(
2201             listSinglePageAsync(),
2202             new Func1<String, Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>>>() {
2203                 @Override
2204                 public Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>> call(String nextPageLink) {
2205                     return listNextSinglePageAsync(nextPageLink, null);
2206                 }
2207             },
2208             serviceCallback);
2209     }
2210 
2211     /**
2212      * Lists all of the job schedules in the specified account.
2213      *
2214      * @throws IllegalArgumentException thrown if parameters fail the validation
2215      * @return the observable to the PagedList&lt;CloudJobSchedule&gt; object
2216      */
2217     public Observable<Page<CloudJobSchedule>> listAsync() {
2218         return listWithServiceResponseAsync()
2219             .map(new Func1<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>, Page<CloudJobSchedule>>() {
2220                 @Override
2221                 public Page<CloudJobSchedule> call(ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders> response) {
2222                     return response.body();
2223                 }
2224             });
2225     }
2226 
2227     /**
2228      * Lists all of the job schedules in the specified account.
2229      *
2230      * @throws IllegalArgumentException thrown if parameters fail the validation
2231      * @return the observable to the PagedList&lt;CloudJobSchedule&gt; object
2232      */
2233     public Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>> listWithServiceResponseAsync() {
2234         return listSinglePageAsync()
2235             .concatMap(new Func1<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>, Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>>>() {
2236                 @Override
2237                 public Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>> call(ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders> page) {
2238                     String nextPageLink = page.body().nextPageLink();
2239                     if (nextPageLink == null) {
2240                         return Observable.just(page);
2241                     }
2242                     return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, null));
2243                 }
2244             });
2245     }
2246 
2247     /**
2248      * Lists all of the job schedules in the specified account.
2249      *
2250      * @throws IllegalArgumentException thrown if parameters fail the validation
2251      * @return the PagedList&lt;CloudJobSchedule&gt; object wrapped in {@link ServiceResponseWithHeaders} if successful.
2252      */
2253     public Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>> listSinglePageAsync() {
2254         if (this.client.batchUrl() == null) {
2255             throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null.");
2256         }
2257         if (this.client.apiVersion() == null) {
2258             throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
2259         }
2260         final JobScheduleListOptions jobScheduleListOptions = null;
2261         String filter = null;
2262         String select = null;
2263         String expand = null;
2264         Integer maxResults = null;
2265         Integer timeout = null;
2266         UUID clientRequestId = null;
2267         Boolean returnClientRequestId = null;
2268         DateTime ocpDate = null;
2269         String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl());
2270         DateTimeRfc1123 ocpDateConverted = null;
2271         if (ocpDate != null) {
2272             ocpDateConverted = new DateTimeRfc1123(ocpDate);
2273         }
2274         return service.list(this.client.apiVersion(), this.client.acceptLanguage(), filter, select, expand, maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent())
2275             .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>>>() {
2276                 @Override
2277                 public Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>> call(Response<ResponseBody> response) {
2278                     try {
2279                         ServiceResponseWithHeaders<PageImpl<CloudJobSchedule>, JobScheduleListHeaders> result = listDelegate(response);
2280                         return Observable.just(new ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>(result.body(), result.headers(), result.response()));
2281                     } catch (Throwable t) {
2282                         return Observable.error(t);
2283                     }
2284                 }
2285             });
2286     }
2287 
2288     /**
2289      * Lists all of the job schedules in the specified account.
2290      *
2291      * @param jobScheduleListOptions Additional parameters for the operation
2292      * @throws IllegalArgumentException thrown if parameters fail the validation
2293      * @throws BatchErrorException thrown if the request is rejected by server
2294      * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
2295      * @return the PagedList&lt;CloudJobSchedule&gt; object if successful.
2296      */
2297     public PagedList<CloudJobSchedule> list(final JobScheduleListOptions jobScheduleListOptions) {
2298         ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders> response = listSinglePageAsync(jobScheduleListOptions).toBlocking().single();
2299         return new PagedList<CloudJobSchedule>(response.body()) {
2300             @Override
2301             public Page<CloudJobSchedule> nextPage(String nextPageLink) {
2302                 JobScheduleListNextOptions jobScheduleListNextOptions = null;
2303                 if (jobScheduleListOptions != null) {
2304                     jobScheduleListNextOptions = new JobScheduleListNextOptions();
2305                     jobScheduleListNextOptions.withClientRequestId(jobScheduleListOptions.clientRequestId());
2306                     jobScheduleListNextOptions.withReturnClientRequestId(jobScheduleListOptions.returnClientRequestId());
2307                     jobScheduleListNextOptions.withOcpDate(jobScheduleListOptions.ocpDate());
2308                 }
2309                 return listNextSinglePageAsync(nextPageLink, jobScheduleListNextOptions).toBlocking().single().body();
2310             }
2311         };
2312     }
2313 
2314     /**
2315      * Lists all of the job schedules in the specified account.
2316      *
2317      * @param jobScheduleListOptions Additional parameters for the operation
2318      * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
2319      * @throws IllegalArgumentException thrown if parameters fail the validation
2320      * @return the {@link ServiceFuture} object
2321      */
2322     public ServiceFuture<List<CloudJobSchedule>> listAsync(final JobScheduleListOptions jobScheduleListOptions, final ListOperationCallback<CloudJobSchedule> serviceCallback) {
2323         return AzureServiceFuture.fromHeaderPageResponse(
2324             listSinglePageAsync(jobScheduleListOptions),
2325             new Func1<String, Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>>>() {
2326                 @Override
2327                 public Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>> call(String nextPageLink) {
2328                     JobScheduleListNextOptions jobScheduleListNextOptions = null;
2329                     if (jobScheduleListOptions != null) {
2330                         jobScheduleListNextOptions = new JobScheduleListNextOptions();
2331                         jobScheduleListNextOptions.withClientRequestId(jobScheduleListOptions.clientRequestId());
2332                         jobScheduleListNextOptions.withReturnClientRequestId(jobScheduleListOptions.returnClientRequestId());
2333                         jobScheduleListNextOptions.withOcpDate(jobScheduleListOptions.ocpDate());
2334                     }
2335                     return listNextSinglePageAsync(nextPageLink, jobScheduleListNextOptions);
2336                 }
2337             },
2338             serviceCallback);
2339     }
2340 
2341     /**
2342      * Lists all of the job schedules in the specified account.
2343      *
2344      * @param jobScheduleListOptions Additional parameters for the operation
2345      * @throws IllegalArgumentException thrown if parameters fail the validation
2346      * @return the observable to the PagedList&lt;CloudJobSchedule&gt; object
2347      */
2348     public Observable<Page<CloudJobSchedule>> listAsync(final JobScheduleListOptions jobScheduleListOptions) {
2349         return listWithServiceResponseAsync(jobScheduleListOptions)
2350             .map(new Func1<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>, Page<CloudJobSchedule>>() {
2351                 @Override
2352                 public Page<CloudJobSchedule> call(ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders> response) {
2353                     return response.body();
2354                 }
2355             });
2356     }
2357 
2358     /**
2359      * Lists all of the job schedules in the specified account.
2360      *
2361      * @param jobScheduleListOptions Additional parameters for the operation
2362      * @throws IllegalArgumentException thrown if parameters fail the validation
2363      * @return the observable to the PagedList&lt;CloudJobSchedule&gt; object
2364      */
2365     public Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>> listWithServiceResponseAsync(final JobScheduleListOptions jobScheduleListOptions) {
2366         return listSinglePageAsync(jobScheduleListOptions)
2367             .concatMap(new Func1<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>, Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>>>() {
2368                 @Override
2369                 public Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>> call(ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders> page) {
2370                     String nextPageLink = page.body().nextPageLink();
2371                     if (nextPageLink == null) {
2372                         return Observable.just(page);
2373                     }
2374                     JobScheduleListNextOptions jobScheduleListNextOptions = null;
2375                     if (jobScheduleListOptions != null) {
2376                         jobScheduleListNextOptions = new JobScheduleListNextOptions();
2377                         jobScheduleListNextOptions.withClientRequestId(jobScheduleListOptions.clientRequestId());
2378                         jobScheduleListNextOptions.withReturnClientRequestId(jobScheduleListOptions.returnClientRequestId());
2379                         jobScheduleListNextOptions.withOcpDate(jobScheduleListOptions.ocpDate());
2380                     }
2381                     return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, jobScheduleListNextOptions));
2382                 }
2383             });
2384     }
2385 
2386     /**
2387      * Lists all of the job schedules in the specified account.
2388      *
2389     ServiceResponseWithHeaders<PageImpl<CloudJobSchedule>, JobScheduleListHeaders> * @param jobScheduleListOptions Additional parameters for the operation
2390      * @throws IllegalArgumentException thrown if parameters fail the validation
2391      * @return the PagedList&lt;CloudJobSchedule&gt; object wrapped in {@link ServiceResponseWithHeaders} if successful.
2392      */
2393     public Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>> listSinglePageAsync(final JobScheduleListOptions jobScheduleListOptions) {
2394         if (this.client.batchUrl() == null) {
2395             throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null.");
2396         }
2397         if (this.client.apiVersion() == null) {
2398             throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
2399         }
2400         Validator.validate(jobScheduleListOptions);
2401         String filter = null;
2402         if (jobScheduleListOptions != null) {
2403             filter = jobScheduleListOptions.filter();
2404         }
2405         String select = null;
2406         if (jobScheduleListOptions != null) {
2407             select = jobScheduleListOptions.select();
2408         }
2409         String expand = null;
2410         if (jobScheduleListOptions != null) {
2411             expand = jobScheduleListOptions.expand();
2412         }
2413         Integer maxResults = null;
2414         if (jobScheduleListOptions != null) {
2415             maxResults = jobScheduleListOptions.maxResults();
2416         }
2417         Integer timeout = null;
2418         if (jobScheduleListOptions != null) {
2419             timeout = jobScheduleListOptions.timeout();
2420         }
2421         UUID clientRequestId = null;
2422         if (jobScheduleListOptions != null) {
2423             clientRequestId = jobScheduleListOptions.clientRequestId();
2424         }
2425         Boolean returnClientRequestId = null;
2426         if (jobScheduleListOptions != null) {
2427             returnClientRequestId = jobScheduleListOptions.returnClientRequestId();
2428         }
2429         DateTime ocpDate = null;
2430         if (jobScheduleListOptions != null) {
2431             ocpDate = jobScheduleListOptions.ocpDate();
2432         }
2433         String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl());
2434         DateTimeRfc1123 ocpDateConverted = null;
2435         if (ocpDate != null) {
2436             ocpDateConverted = new DateTimeRfc1123(ocpDate);
2437         }
2438         return service.list(this.client.apiVersion(), this.client.acceptLanguage(), filter, select, expand, maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent())
2439             .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>>>() {
2440                 @Override
2441                 public Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>> call(Response<ResponseBody> response) {
2442                     try {
2443                         ServiceResponseWithHeaders<PageImpl<CloudJobSchedule>, JobScheduleListHeaders> result = listDelegate(response);
2444                         return Observable.just(new ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>(result.body(), result.headers(), result.response()));
2445                     } catch (Throwable t) {
2446                         return Observable.error(t);
2447                     }
2448                 }
2449             });
2450     }
2451 
2452     private ServiceResponseWithHeaders<PageImpl<CloudJobSchedule>, JobScheduleListHeaders> listDelegate(Response<ResponseBody> response) throws BatchErrorException, IOException, IllegalArgumentException {
2453         return this.client.restClient().responseBuilderFactory().<PageImpl<CloudJobSchedule>, BatchErrorException>newInstance(this.client.serializerAdapter())
2454                 .register(200, new TypeToken<PageImpl<CloudJobSchedule>>() { }.getType())
2455                 .registerError(BatchErrorException.class)
2456                 .buildWithHeaders(response, JobScheduleListHeaders.class);
2457     }
2458 
2459     /**
2460      * Lists all of the job schedules in the specified account.
2461      *
2462      * @param nextPageLink The NextLink from the previous successful call to List operation.
2463      * @throws IllegalArgumentException thrown if parameters fail the validation
2464      * @throws BatchErrorException thrown if the request is rejected by server
2465      * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
2466      * @return the PagedList&lt;CloudJobSchedule&gt; object if successful.
2467      */
2468     public PagedList<CloudJobSchedule> listNext(final String nextPageLink) {
2469         ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders> response = listNextSinglePageAsync(nextPageLink).toBlocking().single();
2470         return new PagedList<CloudJobSchedule>(response.body()) {
2471             @Override
2472             public Page<CloudJobSchedule> nextPage(String nextPageLink) {
2473                 return listNextSinglePageAsync(nextPageLink, null).toBlocking().single().body();
2474             }
2475         };
2476     }
2477 
2478     /**
2479      * Lists all of the job schedules in the specified account.
2480      *
2481      * @param nextPageLink The NextLink from the previous successful call to List operation.
2482      * @param serviceFuture the ServiceFuture object tracking the Retrofit calls
2483      * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
2484      * @throws IllegalArgumentException thrown if parameters fail the validation
2485      * @return the {@link ServiceFuture} object
2486      */
2487     public ServiceFuture<List<CloudJobSchedule>> listNextAsync(final String nextPageLink, final ServiceFuture<List<CloudJobSchedule>> serviceFuture, final ListOperationCallback<CloudJobSchedule> serviceCallback) {
2488         return AzureServiceFuture.fromHeaderPageResponse(
2489             listNextSinglePageAsync(nextPageLink),
2490             new Func1<String, Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>>>() {
2491                 @Override
2492                 public Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>> call(String nextPageLink) {
2493                     return listNextSinglePageAsync(nextPageLink, null);
2494                 }
2495             },
2496             serviceCallback);
2497     }
2498 
2499     /**
2500      * Lists all of the job schedules in the specified account.
2501      *
2502      * @param nextPageLink The NextLink from the previous successful call to List operation.
2503      * @throws IllegalArgumentException thrown if parameters fail the validation
2504      * @return the observable to the PagedList&lt;CloudJobSchedule&gt; object
2505      */
2506     public Observable<Page<CloudJobSchedule>> listNextAsync(final String nextPageLink) {
2507         return listNextWithServiceResponseAsync(nextPageLink)
2508             .map(new Func1<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>, Page<CloudJobSchedule>>() {
2509                 @Override
2510                 public Page<CloudJobSchedule> call(ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders> response) {
2511                     return response.body();
2512                 }
2513             });
2514     }
2515 
2516     /**
2517      * Lists all of the job schedules in the specified account.
2518      *
2519      * @param nextPageLink The NextLink from the previous successful call to List operation.
2520      * @throws IllegalArgumentException thrown if parameters fail the validation
2521      * @return the observable to the PagedList&lt;CloudJobSchedule&gt; object
2522      */
2523     public Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>> listNextWithServiceResponseAsync(final String nextPageLink) {
2524         return listNextSinglePageAsync(nextPageLink)
2525             .concatMap(new Func1<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>, Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>>>() {
2526                 @Override
2527                 public Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>> call(ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders> page) {
2528                     String nextPageLink = page.body().nextPageLink();
2529                     if (nextPageLink == null) {
2530                         return Observable.just(page);
2531                     }
2532                     return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, null));
2533                 }
2534             });
2535     }
2536 
2537     /**
2538      * Lists all of the job schedules in the specified account.
2539      *
2540      * @param nextPageLink The NextLink from the previous successful call to List operation.
2541      * @throws IllegalArgumentException thrown if parameters fail the validation
2542      * @return the PagedList&lt;CloudJobSchedule&gt; object wrapped in {@link ServiceResponseWithHeaders} if successful.
2543      */
2544     public Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>> listNextSinglePageAsync(final String nextPageLink) {
2545         if (nextPageLink == null) {
2546             throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.");
2547         }
2548         final JobScheduleListNextOptions jobScheduleListNextOptions = null;
2549         UUID clientRequestId = null;
2550         Boolean returnClientRequestId = null;
2551         DateTime ocpDate = null;
2552         DateTimeRfc1123 ocpDateConverted = null;
2553         if (ocpDate != null) {
2554             ocpDateConverted = new DateTimeRfc1123(ocpDate);
2555         }
2556         String nextUrl = String.format("%s", nextPageLink);
2557         return service.listNext(nextUrl, this.client.acceptLanguage(), clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent())
2558             .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>>>() {
2559                 @Override
2560                 public Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>> call(Response<ResponseBody> response) {
2561                     try {
2562                         ServiceResponseWithHeaders<PageImpl<CloudJobSchedule>, JobScheduleListHeaders> result = listNextDelegate(response);
2563                         return Observable.just(new ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>(result.body(), result.headers(), result.response()));
2564                     } catch (Throwable t) {
2565                         return Observable.error(t);
2566                     }
2567                 }
2568             });
2569     }
2570 
2571     /**
2572      * Lists all of the job schedules in the specified account.
2573      *
2574      * @param nextPageLink The NextLink from the previous successful call to List operation.
2575      * @param jobScheduleListNextOptions Additional parameters for the operation
2576      * @throws IllegalArgumentException thrown if parameters fail the validation
2577      * @throws BatchErrorException thrown if the request is rejected by server
2578      * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
2579      * @return the PagedList&lt;CloudJobSchedule&gt; object if successful.
2580      */
2581     public PagedList<CloudJobSchedule> listNext(final String nextPageLink, final JobScheduleListNextOptions jobScheduleListNextOptions) {
2582         ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders> response = listNextSinglePageAsync(nextPageLink, jobScheduleListNextOptions).toBlocking().single();
2583         return new PagedList<CloudJobSchedule>(response.body()) {
2584             @Override
2585             public Page<CloudJobSchedule> nextPage(String nextPageLink) {
2586                 return listNextSinglePageAsync(nextPageLink, jobScheduleListNextOptions).toBlocking().single().body();
2587             }
2588         };
2589     }
2590 
2591     /**
2592      * Lists all of the job schedules in the specified account.
2593      *
2594      * @param nextPageLink The NextLink from the previous successful call to List operation.
2595      * @param jobScheduleListNextOptions Additional parameters for the operation
2596      * @param serviceFuture the ServiceFuture object tracking the Retrofit calls
2597      * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
2598      * @throws IllegalArgumentException thrown if parameters fail the validation
2599      * @return the {@link ServiceFuture} object
2600      */
2601     public ServiceFuture<List<CloudJobSchedule>> listNextAsync(final String nextPageLink, final JobScheduleListNextOptions jobScheduleListNextOptions, final ServiceFuture<List<CloudJobSchedule>> serviceFuture, final ListOperationCallback<CloudJobSchedule> serviceCallback) {
2602         return AzureServiceFuture.fromHeaderPageResponse(
2603             listNextSinglePageAsync(nextPageLink, jobScheduleListNextOptions),
2604             new Func1<String, Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>>>() {
2605                 @Override
2606                 public Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>> call(String nextPageLink) {
2607                     return listNextSinglePageAsync(nextPageLink, jobScheduleListNextOptions);
2608                 }
2609             },
2610             serviceCallback);
2611     }
2612 
2613     /**
2614      * Lists all of the job schedules in the specified account.
2615      *
2616      * @param nextPageLink The NextLink from the previous successful call to List operation.
2617      * @param jobScheduleListNextOptions Additional parameters for the operation
2618      * @throws IllegalArgumentException thrown if parameters fail the validation
2619      * @return the observable to the PagedList&lt;CloudJobSchedule&gt; object
2620      */
2621     public Observable<Page<CloudJobSchedule>> listNextAsync(final String nextPageLink, final JobScheduleListNextOptions jobScheduleListNextOptions) {
2622         return listNextWithServiceResponseAsync(nextPageLink, jobScheduleListNextOptions)
2623             .map(new Func1<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>, Page<CloudJobSchedule>>() {
2624                 @Override
2625                 public Page<CloudJobSchedule> call(ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders> response) {
2626                     return response.body();
2627                 }
2628             });
2629     }
2630 
2631     /**
2632      * Lists all of the job schedules in the specified account.
2633      *
2634      * @param nextPageLink The NextLink from the previous successful call to List operation.
2635      * @param jobScheduleListNextOptions Additional parameters for the operation
2636      * @throws IllegalArgumentException thrown if parameters fail the validation
2637      * @return the observable to the PagedList&lt;CloudJobSchedule&gt; object
2638      */
2639     public Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>> listNextWithServiceResponseAsync(final String nextPageLink, final JobScheduleListNextOptions jobScheduleListNextOptions) {
2640         return listNextSinglePageAsync(nextPageLink, jobScheduleListNextOptions)
2641             .concatMap(new Func1<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>, Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>>>() {
2642                 @Override
2643                 public Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>> call(ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders> page) {
2644                     String nextPageLink = page.body().nextPageLink();
2645                     if (nextPageLink == null) {
2646                         return Observable.just(page);
2647                     }
2648                     return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, jobScheduleListNextOptions));
2649                 }
2650             });
2651     }
2652 
2653     /**
2654      * Lists all of the job schedules in the specified account.
2655      *
2656     ServiceResponseWithHeaders<PageImpl<CloudJobSchedule>, JobScheduleListHeaders> * @param nextPageLink The NextLink from the previous successful call to List operation.
2657     ServiceResponseWithHeaders<PageImpl<CloudJobSchedule>, JobScheduleListHeaders> * @param jobScheduleListNextOptions Additional parameters for the operation
2658      * @throws IllegalArgumentException thrown if parameters fail the validation
2659      * @return the PagedList&lt;CloudJobSchedule&gt; object wrapped in {@link ServiceResponseWithHeaders} if successful.
2660      */
2661     public Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>> listNextSinglePageAsync(final String nextPageLink, final JobScheduleListNextOptions jobScheduleListNextOptions) {
2662         if (nextPageLink == null) {
2663             throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.");
2664         }
2665         Validator.validate(jobScheduleListNextOptions);
2666         UUID clientRequestId = null;
2667         if (jobScheduleListNextOptions != null) {
2668             clientRequestId = jobScheduleListNextOptions.clientRequestId();
2669         }
2670         Boolean returnClientRequestId = null;
2671         if (jobScheduleListNextOptions != null) {
2672             returnClientRequestId = jobScheduleListNextOptions.returnClientRequestId();
2673         }
2674         DateTime ocpDate = null;
2675         if (jobScheduleListNextOptions != null) {
2676             ocpDate = jobScheduleListNextOptions.ocpDate();
2677         }
2678         DateTimeRfc1123 ocpDateConverted = null;
2679         if (ocpDate != null) {
2680             ocpDateConverted = new DateTimeRfc1123(ocpDate);
2681         }
2682         String nextUrl = String.format("%s", nextPageLink);
2683         return service.listNext(nextUrl, this.client.acceptLanguage(), clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent())
2684             .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>>>() {
2685                 @Override
2686                 public Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>> call(Response<ResponseBody> response) {
2687                     try {
2688                         ServiceResponseWithHeaders<PageImpl<CloudJobSchedule>, JobScheduleListHeaders> result = listNextDelegate(response);
2689                         return Observable.just(new ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>(result.body(), result.headers(), result.response()));
2690                     } catch (Throwable t) {
2691                         return Observable.error(t);
2692                     }
2693                 }
2694             });
2695     }
2696 
2697     private ServiceResponseWithHeaders<PageImpl<CloudJobSchedule>, JobScheduleListHeaders> listNextDelegate(Response<ResponseBody> response) throws BatchErrorException, IOException, IllegalArgumentException {
2698         return this.client.restClient().responseBuilderFactory().<PageImpl<CloudJobSchedule>, BatchErrorException>newInstance(this.client.serializerAdapter())
2699                 .register(200, new TypeToken<PageImpl<CloudJobSchedule>>() { }.getType())
2700                 .registerError(BatchErrorException.class)
2701                 .buildWithHeaders(response, JobScheduleListHeaders.class);
2702     }
2703 
2704 }