1# coding=utf-8 2# -------------------------------------------------------------------------- 3# Copyright (c) Microsoft Corporation. All rights reserved. 4# Licensed under the MIT License. See License.txt in the project root for 5# license information. 6# 7# Code generated by Microsoft (R) AutoRest Code Generator. 8# Changes may cause incorrect behavior and will be lost if the code is 9# regenerated. 10# -------------------------------------------------------------------------- 11 12import uuid 13from msrest.pipeline import ClientRawResponse 14 15from .. import models 16 17 18class JobScheduleOperations(object): 19 """JobScheduleOperations operations. 20 21 You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. 22 23 :param client: Client for service requests. 24 :param config: Configuration of service client. 25 :param serializer: An object model serializer. 26 :param deserializer: An object model deserializer. 27 :ivar api_version: The API version to use for the request. Constant value: "2021-06-01.14.0". 28 """ 29 30 models = models 31 32 def __init__(self, client, config, serializer, deserializer): 33 34 self._client = client 35 self._serialize = serializer 36 self._deserialize = deserializer 37 self.api_version = "2021-06-01.14.0" 38 39 self.config = config 40 41 def exists( 42 self, job_schedule_id, job_schedule_exists_options=None, custom_headers=None, raw=False, **operation_config): 43 """Checks the specified Job Schedule exists. 44 45 :param job_schedule_id: The ID of the Job Schedule which you want to 46 check. 47 :type job_schedule_id: str 48 :param job_schedule_exists_options: Additional parameters for the 49 operation 50 :type job_schedule_exists_options: 51 ~azure.batch.models.JobScheduleExistsOptions 52 :param dict custom_headers: headers that will be added to the request 53 :param bool raw: returns the direct response alongside the 54 deserialized response 55 :param operation_config: :ref:`Operation configuration 56 overrides<msrest:optionsforoperations>`. 57 :return: bool or ClientRawResponse if raw=true 58 :rtype: bool or ~msrest.pipeline.ClientRawResponse 59 :raises: 60 :class:`BatchErrorException<azure.batch.models.BatchErrorException>` 61 """ 62 timeout = None 63 if job_schedule_exists_options is not None: 64 timeout = job_schedule_exists_options.timeout 65 client_request_id = None 66 if job_schedule_exists_options is not None: 67 client_request_id = job_schedule_exists_options.client_request_id 68 return_client_request_id = None 69 if job_schedule_exists_options is not None: 70 return_client_request_id = job_schedule_exists_options.return_client_request_id 71 ocp_date = None 72 if job_schedule_exists_options is not None: 73 ocp_date = job_schedule_exists_options.ocp_date 74 if_match = None 75 if job_schedule_exists_options is not None: 76 if_match = job_schedule_exists_options.if_match 77 if_none_match = None 78 if job_schedule_exists_options is not None: 79 if_none_match = job_schedule_exists_options.if_none_match 80 if_modified_since = None 81 if job_schedule_exists_options is not None: 82 if_modified_since = job_schedule_exists_options.if_modified_since 83 if_unmodified_since = None 84 if job_schedule_exists_options is not None: 85 if_unmodified_since = job_schedule_exists_options.if_unmodified_since 86 87 # Construct URL 88 url = self.exists.metadata['url'] 89 path_format_arguments = { 90 'batchUrl': self._serialize.url("self.config.batch_url", self.config.batch_url, 'str', skip_quote=True), 91 'jobScheduleId': self._serialize.url("job_schedule_id", job_schedule_id, 'str') 92 } 93 url = self._client.format_url(url, **path_format_arguments) 94 95 # Construct parameters 96 query_parameters = {} 97 query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') 98 if timeout is not None: 99 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int') 100 101 # Construct headers 102 header_parameters = {} 103 if self.config.generate_client_request_id: 104 header_parameters['client-request-id'] = str(uuid.uuid1()) 105 if custom_headers: 106 header_parameters.update(custom_headers) 107 if self.config.accept_language is not None: 108 header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') 109 if client_request_id is not None: 110 header_parameters['client-request-id'] = self._serialize.header("client_request_id", client_request_id, 'str') 111 if return_client_request_id is not None: 112 header_parameters['return-client-request-id'] = self._serialize.header("return_client_request_id", return_client_request_id, 'bool') 113 if ocp_date is not None: 114 header_parameters['ocp-date'] = self._serialize.header("ocp_date", ocp_date, 'rfc-1123') 115 if if_match is not None: 116 header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') 117 if if_none_match is not None: 118 header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') 119 if if_modified_since is not None: 120 header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123') 121 if if_unmodified_since is not None: 122 header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') 123 124 # Construct and send request 125 request = self._client.head(url, query_parameters, header_parameters) 126 response = self._client.send(request, stream=False, **operation_config) 127 128 if response.status_code not in [200, 404]: 129 raise models.BatchErrorException(self._deserialize, response) 130 131 deserialized = (response.status_code == 200) 132 if raw: 133 client_raw_response = ClientRawResponse(deserialized, response) 134 client_raw_response.add_headers({ 135 'client-request-id': 'str', 136 'request-id': 'str', 137 'ETag': 'str', 138 'Last-Modified': 'rfc-1123', 139 }) 140 return client_raw_response 141 return deserialized 142 exists.metadata = {'url': '/jobschedules/{jobScheduleId}'} 143 144 def delete( 145 self, job_schedule_id, job_schedule_delete_options=None, custom_headers=None, raw=False, **operation_config): 146 """Deletes a Job Schedule from the specified Account. 147 148 When you delete a Job Schedule, this also deletes all Jobs and Tasks 149 under that schedule. When Tasks are deleted, all the files in their 150 working directories on the Compute Nodes are also deleted (the 151 retention period is ignored). The Job Schedule statistics are no longer 152 accessible once the Job Schedule is deleted, though they are still 153 counted towards Account lifetime statistics. 154 155 :param job_schedule_id: The ID of the Job Schedule to delete. 156 :type job_schedule_id: str 157 :param job_schedule_delete_options: Additional parameters for the 158 operation 159 :type job_schedule_delete_options: 160 ~azure.batch.models.JobScheduleDeleteOptions 161 :param dict custom_headers: headers that will be added to the request 162 :param bool raw: returns the direct response alongside the 163 deserialized response 164 :param operation_config: :ref:`Operation configuration 165 overrides<msrest:optionsforoperations>`. 166 :return: None or ClientRawResponse if raw=true 167 :rtype: None or ~msrest.pipeline.ClientRawResponse 168 :raises: 169 :class:`BatchErrorException<azure.batch.models.BatchErrorException>` 170 """ 171 timeout = None 172 if job_schedule_delete_options is not None: 173 timeout = job_schedule_delete_options.timeout 174 client_request_id = None 175 if job_schedule_delete_options is not None: 176 client_request_id = job_schedule_delete_options.client_request_id 177 return_client_request_id = None 178 if job_schedule_delete_options is not None: 179 return_client_request_id = job_schedule_delete_options.return_client_request_id 180 ocp_date = None 181 if job_schedule_delete_options is not None: 182 ocp_date = job_schedule_delete_options.ocp_date 183 if_match = None 184 if job_schedule_delete_options is not None: 185 if_match = job_schedule_delete_options.if_match 186 if_none_match = None 187 if job_schedule_delete_options is not None: 188 if_none_match = job_schedule_delete_options.if_none_match 189 if_modified_since = None 190 if job_schedule_delete_options is not None: 191 if_modified_since = job_schedule_delete_options.if_modified_since 192 if_unmodified_since = None 193 if job_schedule_delete_options is not None: 194 if_unmodified_since = job_schedule_delete_options.if_unmodified_since 195 196 # Construct URL 197 url = self.delete.metadata['url'] 198 path_format_arguments = { 199 'batchUrl': self._serialize.url("self.config.batch_url", self.config.batch_url, 'str', skip_quote=True), 200 'jobScheduleId': self._serialize.url("job_schedule_id", job_schedule_id, 'str') 201 } 202 url = self._client.format_url(url, **path_format_arguments) 203 204 # Construct parameters 205 query_parameters = {} 206 query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') 207 if timeout is not None: 208 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int') 209 210 # Construct headers 211 header_parameters = {} 212 if self.config.generate_client_request_id: 213 header_parameters['client-request-id'] = str(uuid.uuid1()) 214 if custom_headers: 215 header_parameters.update(custom_headers) 216 if self.config.accept_language is not None: 217 header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') 218 if client_request_id is not None: 219 header_parameters['client-request-id'] = self._serialize.header("client_request_id", client_request_id, 'str') 220 if return_client_request_id is not None: 221 header_parameters['return-client-request-id'] = self._serialize.header("return_client_request_id", return_client_request_id, 'bool') 222 if ocp_date is not None: 223 header_parameters['ocp-date'] = self._serialize.header("ocp_date", ocp_date, 'rfc-1123') 224 if if_match is not None: 225 header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') 226 if if_none_match is not None: 227 header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') 228 if if_modified_since is not None: 229 header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123') 230 if if_unmodified_since is not None: 231 header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') 232 233 # Construct and send request 234 request = self._client.delete(url, query_parameters, header_parameters) 235 response = self._client.send(request, stream=False, **operation_config) 236 237 if response.status_code not in [202]: 238 raise models.BatchErrorException(self._deserialize, response) 239 240 if raw: 241 client_raw_response = ClientRawResponse(None, response) 242 client_raw_response.add_headers({ 243 'client-request-id': 'str', 244 'request-id': 'str', 245 }) 246 return client_raw_response 247 delete.metadata = {'url': '/jobschedules/{jobScheduleId}'} 248 249 def get( 250 self, job_schedule_id, job_schedule_get_options=None, custom_headers=None, raw=False, **operation_config): 251 """Gets information about the specified Job Schedule. 252 253 :param job_schedule_id: The ID of the Job Schedule to get. 254 :type job_schedule_id: str 255 :param job_schedule_get_options: Additional parameters for the 256 operation 257 :type job_schedule_get_options: 258 ~azure.batch.models.JobScheduleGetOptions 259 :param dict custom_headers: headers that will be added to the request 260 :param bool raw: returns the direct response alongside the 261 deserialized response 262 :param operation_config: :ref:`Operation configuration 263 overrides<msrest:optionsforoperations>`. 264 :return: CloudJobSchedule or ClientRawResponse if raw=true 265 :rtype: ~azure.batch.models.CloudJobSchedule or 266 ~msrest.pipeline.ClientRawResponse 267 :raises: 268 :class:`BatchErrorException<azure.batch.models.BatchErrorException>` 269 """ 270 select = None 271 if job_schedule_get_options is not None: 272 select = job_schedule_get_options.select 273 expand = None 274 if job_schedule_get_options is not None: 275 expand = job_schedule_get_options.expand 276 timeout = None 277 if job_schedule_get_options is not None: 278 timeout = job_schedule_get_options.timeout 279 client_request_id = None 280 if job_schedule_get_options is not None: 281 client_request_id = job_schedule_get_options.client_request_id 282 return_client_request_id = None 283 if job_schedule_get_options is not None: 284 return_client_request_id = job_schedule_get_options.return_client_request_id 285 ocp_date = None 286 if job_schedule_get_options is not None: 287 ocp_date = job_schedule_get_options.ocp_date 288 if_match = None 289 if job_schedule_get_options is not None: 290 if_match = job_schedule_get_options.if_match 291 if_none_match = None 292 if job_schedule_get_options is not None: 293 if_none_match = job_schedule_get_options.if_none_match 294 if_modified_since = None 295 if job_schedule_get_options is not None: 296 if_modified_since = job_schedule_get_options.if_modified_since 297 if_unmodified_since = None 298 if job_schedule_get_options is not None: 299 if_unmodified_since = job_schedule_get_options.if_unmodified_since 300 301 # Construct URL 302 url = self.get.metadata['url'] 303 path_format_arguments = { 304 'batchUrl': self._serialize.url("self.config.batch_url", self.config.batch_url, 'str', skip_quote=True), 305 'jobScheduleId': self._serialize.url("job_schedule_id", job_schedule_id, 'str') 306 } 307 url = self._client.format_url(url, **path_format_arguments) 308 309 # Construct parameters 310 query_parameters = {} 311 query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') 312 if select is not None: 313 query_parameters['$select'] = self._serialize.query("select", select, 'str') 314 if expand is not None: 315 query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') 316 if timeout is not None: 317 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int') 318 319 # Construct headers 320 header_parameters = {} 321 header_parameters['Accept'] = 'application/json' 322 if self.config.generate_client_request_id: 323 header_parameters['client-request-id'] = str(uuid.uuid1()) 324 if custom_headers: 325 header_parameters.update(custom_headers) 326 if self.config.accept_language is not None: 327 header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') 328 if client_request_id is not None: 329 header_parameters['client-request-id'] = self._serialize.header("client_request_id", client_request_id, 'str') 330 if return_client_request_id is not None: 331 header_parameters['return-client-request-id'] = self._serialize.header("return_client_request_id", return_client_request_id, 'bool') 332 if ocp_date is not None: 333 header_parameters['ocp-date'] = self._serialize.header("ocp_date", ocp_date, 'rfc-1123') 334 if if_match is not None: 335 header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') 336 if if_none_match is not None: 337 header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') 338 if if_modified_since is not None: 339 header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123') 340 if if_unmodified_since is not None: 341 header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') 342 343 # Construct and send request 344 request = self._client.get(url, query_parameters, header_parameters) 345 response = self._client.send(request, stream=False, **operation_config) 346 347 if response.status_code not in [200]: 348 raise models.BatchErrorException(self._deserialize, response) 349 350 header_dict = {} 351 deserialized = None 352 if response.status_code == 200: 353 deserialized = self._deserialize('CloudJobSchedule', response) 354 header_dict = { 355 'client-request-id': 'str', 356 'request-id': 'str', 357 'ETag': 'str', 358 'Last-Modified': 'rfc-1123', 359 } 360 361 if raw: 362 client_raw_response = ClientRawResponse(deserialized, response) 363 client_raw_response.add_headers(header_dict) 364 return client_raw_response 365 366 return deserialized 367 get.metadata = {'url': '/jobschedules/{jobScheduleId}'} 368 369 def patch( 370 self, job_schedule_id, job_schedule_patch_parameter, job_schedule_patch_options=None, custom_headers=None, raw=False, **operation_config): 371 """Updates the properties of the specified Job Schedule. 372 373 This replaces only the Job Schedule properties specified in the 374 request. For example, if the schedule property is not specified with 375 this request, then the Batch service will keep the existing schedule. 376 Changes to a Job Schedule only impact Jobs created by the schedule 377 after the update has taken place; currently running Jobs are 378 unaffected. 379 380 :param job_schedule_id: The ID of the Job Schedule to update. 381 :type job_schedule_id: str 382 :param job_schedule_patch_parameter: The parameters for the request. 383 :type job_schedule_patch_parameter: 384 ~azure.batch.models.JobSchedulePatchParameter 385 :param job_schedule_patch_options: Additional parameters for the 386 operation 387 :type job_schedule_patch_options: 388 ~azure.batch.models.JobSchedulePatchOptions 389 :param dict custom_headers: headers that will be added to the request 390 :param bool raw: returns the direct response alongside the 391 deserialized response 392 :param operation_config: :ref:`Operation configuration 393 overrides<msrest:optionsforoperations>`. 394 :return: None or ClientRawResponse if raw=true 395 :rtype: None or ~msrest.pipeline.ClientRawResponse 396 :raises: 397 :class:`BatchErrorException<azure.batch.models.BatchErrorException>` 398 """ 399 timeout = None 400 if job_schedule_patch_options is not None: 401 timeout = job_schedule_patch_options.timeout 402 client_request_id = None 403 if job_schedule_patch_options is not None: 404 client_request_id = job_schedule_patch_options.client_request_id 405 return_client_request_id = None 406 if job_schedule_patch_options is not None: 407 return_client_request_id = job_schedule_patch_options.return_client_request_id 408 ocp_date = None 409 if job_schedule_patch_options is not None: 410 ocp_date = job_schedule_patch_options.ocp_date 411 if_match = None 412 if job_schedule_patch_options is not None: 413 if_match = job_schedule_patch_options.if_match 414 if_none_match = None 415 if job_schedule_patch_options is not None: 416 if_none_match = job_schedule_patch_options.if_none_match 417 if_modified_since = None 418 if job_schedule_patch_options is not None: 419 if_modified_since = job_schedule_patch_options.if_modified_since 420 if_unmodified_since = None 421 if job_schedule_patch_options is not None: 422 if_unmodified_since = job_schedule_patch_options.if_unmodified_since 423 424 # Construct URL 425 url = self.patch.metadata['url'] 426 path_format_arguments = { 427 'batchUrl': self._serialize.url("self.config.batch_url", self.config.batch_url, 'str', skip_quote=True), 428 'jobScheduleId': self._serialize.url("job_schedule_id", job_schedule_id, 'str') 429 } 430 url = self._client.format_url(url, **path_format_arguments) 431 432 # Construct parameters 433 query_parameters = {} 434 query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') 435 if timeout is not None: 436 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int') 437 438 # Construct headers 439 header_parameters = {} 440 header_parameters['Content-Type'] = 'application/json; odata=minimalmetadata; charset=utf-8' 441 if self.config.generate_client_request_id: 442 header_parameters['client-request-id'] = str(uuid.uuid1()) 443 if custom_headers: 444 header_parameters.update(custom_headers) 445 if self.config.accept_language is not None: 446 header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') 447 if client_request_id is not None: 448 header_parameters['client-request-id'] = self._serialize.header("client_request_id", client_request_id, 'str') 449 if return_client_request_id is not None: 450 header_parameters['return-client-request-id'] = self._serialize.header("return_client_request_id", return_client_request_id, 'bool') 451 if ocp_date is not None: 452 header_parameters['ocp-date'] = self._serialize.header("ocp_date", ocp_date, 'rfc-1123') 453 if if_match is not None: 454 header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') 455 if if_none_match is not None: 456 header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') 457 if if_modified_since is not None: 458 header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123') 459 if if_unmodified_since is not None: 460 header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') 461 462 # Construct body 463 body_content = self._serialize.body(job_schedule_patch_parameter, 'JobSchedulePatchParameter') 464 465 # Construct and send request 466 request = self._client.patch(url, query_parameters, header_parameters, body_content) 467 response = self._client.send(request, stream=False, **operation_config) 468 469 if response.status_code not in [200]: 470 raise models.BatchErrorException(self._deserialize, response) 471 472 if raw: 473 client_raw_response = ClientRawResponse(None, response) 474 client_raw_response.add_headers({ 475 'client-request-id': 'str', 476 'request-id': 'str', 477 'ETag': 'str', 478 'Last-Modified': 'rfc-1123', 479 'DataServiceId': 'str', 480 }) 481 return client_raw_response 482 patch.metadata = {'url': '/jobschedules/{jobScheduleId}'} 483 484 def update( 485 self, job_schedule_id, job_schedule_update_parameter, job_schedule_update_options=None, custom_headers=None, raw=False, **operation_config): 486 """Updates the properties of the specified Job Schedule. 487 488 This fully replaces all the updatable properties of the Job Schedule. 489 For example, if the schedule property is not specified with this 490 request, then the Batch service will remove the existing schedule. 491 Changes to a Job Schedule only impact Jobs created by the schedule 492 after the update has taken place; currently running Jobs are 493 unaffected. 494 495 :param job_schedule_id: The ID of the Job Schedule to update. 496 :type job_schedule_id: str 497 :param job_schedule_update_parameter: The parameters for the request. 498 :type job_schedule_update_parameter: 499 ~azure.batch.models.JobScheduleUpdateParameter 500 :param job_schedule_update_options: Additional parameters for the 501 operation 502 :type job_schedule_update_options: 503 ~azure.batch.models.JobScheduleUpdateOptions 504 :param dict custom_headers: headers that will be added to the request 505 :param bool raw: returns the direct response alongside the 506 deserialized response 507 :param operation_config: :ref:`Operation configuration 508 overrides<msrest:optionsforoperations>`. 509 :return: None or ClientRawResponse if raw=true 510 :rtype: None or ~msrest.pipeline.ClientRawResponse 511 :raises: 512 :class:`BatchErrorException<azure.batch.models.BatchErrorException>` 513 """ 514 timeout = None 515 if job_schedule_update_options is not None: 516 timeout = job_schedule_update_options.timeout 517 client_request_id = None 518 if job_schedule_update_options is not None: 519 client_request_id = job_schedule_update_options.client_request_id 520 return_client_request_id = None 521 if job_schedule_update_options is not None: 522 return_client_request_id = job_schedule_update_options.return_client_request_id 523 ocp_date = None 524 if job_schedule_update_options is not None: 525 ocp_date = job_schedule_update_options.ocp_date 526 if_match = None 527 if job_schedule_update_options is not None: 528 if_match = job_schedule_update_options.if_match 529 if_none_match = None 530 if job_schedule_update_options is not None: 531 if_none_match = job_schedule_update_options.if_none_match 532 if_modified_since = None 533 if job_schedule_update_options is not None: 534 if_modified_since = job_schedule_update_options.if_modified_since 535 if_unmodified_since = None 536 if job_schedule_update_options is not None: 537 if_unmodified_since = job_schedule_update_options.if_unmodified_since 538 539 # Construct URL 540 url = self.update.metadata['url'] 541 path_format_arguments = { 542 'batchUrl': self._serialize.url("self.config.batch_url", self.config.batch_url, 'str', skip_quote=True), 543 'jobScheduleId': self._serialize.url("job_schedule_id", job_schedule_id, 'str') 544 } 545 url = self._client.format_url(url, **path_format_arguments) 546 547 # Construct parameters 548 query_parameters = {} 549 query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') 550 if timeout is not None: 551 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int') 552 553 # Construct headers 554 header_parameters = {} 555 header_parameters['Content-Type'] = 'application/json; odata=minimalmetadata; charset=utf-8' 556 if self.config.generate_client_request_id: 557 header_parameters['client-request-id'] = str(uuid.uuid1()) 558 if custom_headers: 559 header_parameters.update(custom_headers) 560 if self.config.accept_language is not None: 561 header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') 562 if client_request_id is not None: 563 header_parameters['client-request-id'] = self._serialize.header("client_request_id", client_request_id, 'str') 564 if return_client_request_id is not None: 565 header_parameters['return-client-request-id'] = self._serialize.header("return_client_request_id", return_client_request_id, 'bool') 566 if ocp_date is not None: 567 header_parameters['ocp-date'] = self._serialize.header("ocp_date", ocp_date, 'rfc-1123') 568 if if_match is not None: 569 header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') 570 if if_none_match is not None: 571 header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') 572 if if_modified_since is not None: 573 header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123') 574 if if_unmodified_since is not None: 575 header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') 576 577 # Construct body 578 body_content = self._serialize.body(job_schedule_update_parameter, 'JobScheduleUpdateParameter') 579 580 # Construct and send request 581 request = self._client.put(url, query_parameters, header_parameters, body_content) 582 response = self._client.send(request, stream=False, **operation_config) 583 584 if response.status_code not in [200]: 585 raise models.BatchErrorException(self._deserialize, response) 586 587 if raw: 588 client_raw_response = ClientRawResponse(None, response) 589 client_raw_response.add_headers({ 590 'client-request-id': 'str', 591 'request-id': 'str', 592 'ETag': 'str', 593 'Last-Modified': 'rfc-1123', 594 'DataServiceId': 'str', 595 }) 596 return client_raw_response 597 update.metadata = {'url': '/jobschedules/{jobScheduleId}'} 598 599 def disable( 600 self, job_schedule_id, job_schedule_disable_options=None, custom_headers=None, raw=False, **operation_config): 601 """Disables a Job Schedule. 602 603 No new Jobs will be created until the Job Schedule is enabled again. 604 605 :param job_schedule_id: The ID of the Job Schedule to disable. 606 :type job_schedule_id: str 607 :param job_schedule_disable_options: Additional parameters for the 608 operation 609 :type job_schedule_disable_options: 610 ~azure.batch.models.JobScheduleDisableOptions 611 :param dict custom_headers: headers that will be added to the request 612 :param bool raw: returns the direct response alongside the 613 deserialized response 614 :param operation_config: :ref:`Operation configuration 615 overrides<msrest:optionsforoperations>`. 616 :return: None or ClientRawResponse if raw=true 617 :rtype: None or ~msrest.pipeline.ClientRawResponse 618 :raises: 619 :class:`BatchErrorException<azure.batch.models.BatchErrorException>` 620 """ 621 timeout = None 622 if job_schedule_disable_options is not None: 623 timeout = job_schedule_disable_options.timeout 624 client_request_id = None 625 if job_schedule_disable_options is not None: 626 client_request_id = job_schedule_disable_options.client_request_id 627 return_client_request_id = None 628 if job_schedule_disable_options is not None: 629 return_client_request_id = job_schedule_disable_options.return_client_request_id 630 ocp_date = None 631 if job_schedule_disable_options is not None: 632 ocp_date = job_schedule_disable_options.ocp_date 633 if_match = None 634 if job_schedule_disable_options is not None: 635 if_match = job_schedule_disable_options.if_match 636 if_none_match = None 637 if job_schedule_disable_options is not None: 638 if_none_match = job_schedule_disable_options.if_none_match 639 if_modified_since = None 640 if job_schedule_disable_options is not None: 641 if_modified_since = job_schedule_disable_options.if_modified_since 642 if_unmodified_since = None 643 if job_schedule_disable_options is not None: 644 if_unmodified_since = job_schedule_disable_options.if_unmodified_since 645 646 # Construct URL 647 url = self.disable.metadata['url'] 648 path_format_arguments = { 649 'batchUrl': self._serialize.url("self.config.batch_url", self.config.batch_url, 'str', skip_quote=True), 650 'jobScheduleId': self._serialize.url("job_schedule_id", job_schedule_id, 'str') 651 } 652 url = self._client.format_url(url, **path_format_arguments) 653 654 # Construct parameters 655 query_parameters = {} 656 query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') 657 if timeout is not None: 658 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int') 659 660 # Construct headers 661 header_parameters = {} 662 if self.config.generate_client_request_id: 663 header_parameters['client-request-id'] = str(uuid.uuid1()) 664 if custom_headers: 665 header_parameters.update(custom_headers) 666 if self.config.accept_language is not None: 667 header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') 668 if client_request_id is not None: 669 header_parameters['client-request-id'] = self._serialize.header("client_request_id", client_request_id, 'str') 670 if return_client_request_id is not None: 671 header_parameters['return-client-request-id'] = self._serialize.header("return_client_request_id", return_client_request_id, 'bool') 672 if ocp_date is not None: 673 header_parameters['ocp-date'] = self._serialize.header("ocp_date", ocp_date, 'rfc-1123') 674 if if_match is not None: 675 header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') 676 if if_none_match is not None: 677 header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') 678 if if_modified_since is not None: 679 header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123') 680 if if_unmodified_since is not None: 681 header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') 682 683 # Construct and send request 684 request = self._client.post(url, query_parameters, header_parameters) 685 response = self._client.send(request, stream=False, **operation_config) 686 687 if response.status_code not in [204]: 688 raise models.BatchErrorException(self._deserialize, response) 689 690 if raw: 691 client_raw_response = ClientRawResponse(None, response) 692 client_raw_response.add_headers({ 693 'client-request-id': 'str', 694 'request-id': 'str', 695 'ETag': 'str', 696 'Last-Modified': 'rfc-1123', 697 'DataServiceId': 'str', 698 }) 699 return client_raw_response 700 disable.metadata = {'url': '/jobschedules/{jobScheduleId}/disable'} 701 702 def enable( 703 self, job_schedule_id, job_schedule_enable_options=None, custom_headers=None, raw=False, **operation_config): 704 """Enables a Job Schedule. 705 706 :param job_schedule_id: The ID of the Job Schedule to enable. 707 :type job_schedule_id: str 708 :param job_schedule_enable_options: Additional parameters for the 709 operation 710 :type job_schedule_enable_options: 711 ~azure.batch.models.JobScheduleEnableOptions 712 :param dict custom_headers: headers that will be added to the request 713 :param bool raw: returns the direct response alongside the 714 deserialized response 715 :param operation_config: :ref:`Operation configuration 716 overrides<msrest:optionsforoperations>`. 717 :return: None or ClientRawResponse if raw=true 718 :rtype: None or ~msrest.pipeline.ClientRawResponse 719 :raises: 720 :class:`BatchErrorException<azure.batch.models.BatchErrorException>` 721 """ 722 timeout = None 723 if job_schedule_enable_options is not None: 724 timeout = job_schedule_enable_options.timeout 725 client_request_id = None 726 if job_schedule_enable_options is not None: 727 client_request_id = job_schedule_enable_options.client_request_id 728 return_client_request_id = None 729 if job_schedule_enable_options is not None: 730 return_client_request_id = job_schedule_enable_options.return_client_request_id 731 ocp_date = None 732 if job_schedule_enable_options is not None: 733 ocp_date = job_schedule_enable_options.ocp_date 734 if_match = None 735 if job_schedule_enable_options is not None: 736 if_match = job_schedule_enable_options.if_match 737 if_none_match = None 738 if job_schedule_enable_options is not None: 739 if_none_match = job_schedule_enable_options.if_none_match 740 if_modified_since = None 741 if job_schedule_enable_options is not None: 742 if_modified_since = job_schedule_enable_options.if_modified_since 743 if_unmodified_since = None 744 if job_schedule_enable_options is not None: 745 if_unmodified_since = job_schedule_enable_options.if_unmodified_since 746 747 # Construct URL 748 url = self.enable.metadata['url'] 749 path_format_arguments = { 750 'batchUrl': self._serialize.url("self.config.batch_url", self.config.batch_url, 'str', skip_quote=True), 751 'jobScheduleId': self._serialize.url("job_schedule_id", job_schedule_id, 'str') 752 } 753 url = self._client.format_url(url, **path_format_arguments) 754 755 # Construct parameters 756 query_parameters = {} 757 query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') 758 if timeout is not None: 759 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int') 760 761 # Construct headers 762 header_parameters = {} 763 if self.config.generate_client_request_id: 764 header_parameters['client-request-id'] = str(uuid.uuid1()) 765 if custom_headers: 766 header_parameters.update(custom_headers) 767 if self.config.accept_language is not None: 768 header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') 769 if client_request_id is not None: 770 header_parameters['client-request-id'] = self._serialize.header("client_request_id", client_request_id, 'str') 771 if return_client_request_id is not None: 772 header_parameters['return-client-request-id'] = self._serialize.header("return_client_request_id", return_client_request_id, 'bool') 773 if ocp_date is not None: 774 header_parameters['ocp-date'] = self._serialize.header("ocp_date", ocp_date, 'rfc-1123') 775 if if_match is not None: 776 header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') 777 if if_none_match is not None: 778 header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') 779 if if_modified_since is not None: 780 header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123') 781 if if_unmodified_since is not None: 782 header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') 783 784 # Construct and send request 785 request = self._client.post(url, query_parameters, header_parameters) 786 response = self._client.send(request, stream=False, **operation_config) 787 788 if response.status_code not in [204]: 789 raise models.BatchErrorException(self._deserialize, response) 790 791 if raw: 792 client_raw_response = ClientRawResponse(None, response) 793 client_raw_response.add_headers({ 794 'client-request-id': 'str', 795 'request-id': 'str', 796 'ETag': 'str', 797 'Last-Modified': 'rfc-1123', 798 'DataServiceId': 'str', 799 }) 800 return client_raw_response 801 enable.metadata = {'url': '/jobschedules/{jobScheduleId}/enable'} 802 803 def terminate( 804 self, job_schedule_id, job_schedule_terminate_options=None, custom_headers=None, raw=False, **operation_config): 805 """Terminates a Job Schedule. 806 807 :param job_schedule_id: The ID of the Job Schedule to terminates. 808 :type job_schedule_id: str 809 :param job_schedule_terminate_options: Additional parameters for the 810 operation 811 :type job_schedule_terminate_options: 812 ~azure.batch.models.JobScheduleTerminateOptions 813 :param dict custom_headers: headers that will be added to the request 814 :param bool raw: returns the direct response alongside the 815 deserialized response 816 :param operation_config: :ref:`Operation configuration 817 overrides<msrest:optionsforoperations>`. 818 :return: None or ClientRawResponse if raw=true 819 :rtype: None or ~msrest.pipeline.ClientRawResponse 820 :raises: 821 :class:`BatchErrorException<azure.batch.models.BatchErrorException>` 822 """ 823 timeout = None 824 if job_schedule_terminate_options is not None: 825 timeout = job_schedule_terminate_options.timeout 826 client_request_id = None 827 if job_schedule_terminate_options is not None: 828 client_request_id = job_schedule_terminate_options.client_request_id 829 return_client_request_id = None 830 if job_schedule_terminate_options is not None: 831 return_client_request_id = job_schedule_terminate_options.return_client_request_id 832 ocp_date = None 833 if job_schedule_terminate_options is not None: 834 ocp_date = job_schedule_terminate_options.ocp_date 835 if_match = None 836 if job_schedule_terminate_options is not None: 837 if_match = job_schedule_terminate_options.if_match 838 if_none_match = None 839 if job_schedule_terminate_options is not None: 840 if_none_match = job_schedule_terminate_options.if_none_match 841 if_modified_since = None 842 if job_schedule_terminate_options is not None: 843 if_modified_since = job_schedule_terminate_options.if_modified_since 844 if_unmodified_since = None 845 if job_schedule_terminate_options is not None: 846 if_unmodified_since = job_schedule_terminate_options.if_unmodified_since 847 848 # Construct URL 849 url = self.terminate.metadata['url'] 850 path_format_arguments = { 851 'batchUrl': self._serialize.url("self.config.batch_url", self.config.batch_url, 'str', skip_quote=True), 852 'jobScheduleId': self._serialize.url("job_schedule_id", job_schedule_id, 'str') 853 } 854 url = self._client.format_url(url, **path_format_arguments) 855 856 # Construct parameters 857 query_parameters = {} 858 query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') 859 if timeout is not None: 860 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int') 861 862 # Construct headers 863 header_parameters = {} 864 if self.config.generate_client_request_id: 865 header_parameters['client-request-id'] = str(uuid.uuid1()) 866 if custom_headers: 867 header_parameters.update(custom_headers) 868 if self.config.accept_language is not None: 869 header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') 870 if client_request_id is not None: 871 header_parameters['client-request-id'] = self._serialize.header("client_request_id", client_request_id, 'str') 872 if return_client_request_id is not None: 873 header_parameters['return-client-request-id'] = self._serialize.header("return_client_request_id", return_client_request_id, 'bool') 874 if ocp_date is not None: 875 header_parameters['ocp-date'] = self._serialize.header("ocp_date", ocp_date, 'rfc-1123') 876 if if_match is not None: 877 header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') 878 if if_none_match is not None: 879 header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') 880 if if_modified_since is not None: 881 header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123') 882 if if_unmodified_since is not None: 883 header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') 884 885 # Construct and send request 886 request = self._client.post(url, query_parameters, header_parameters) 887 response = self._client.send(request, stream=False, **operation_config) 888 889 if response.status_code not in [202]: 890 raise models.BatchErrorException(self._deserialize, response) 891 892 if raw: 893 client_raw_response = ClientRawResponse(None, response) 894 client_raw_response.add_headers({ 895 'client-request-id': 'str', 896 'request-id': 'str', 897 'ETag': 'str', 898 'Last-Modified': 'rfc-1123', 899 'DataServiceId': 'str', 900 }) 901 return client_raw_response 902 terminate.metadata = {'url': '/jobschedules/{jobScheduleId}/terminate'} 903 904 def add( 905 self, cloud_job_schedule, job_schedule_add_options=None, custom_headers=None, raw=False, **operation_config): 906 """Adds a Job Schedule to the specified Account. 907 908 :param cloud_job_schedule: The Job Schedule to be added. 909 :type cloud_job_schedule: ~azure.batch.models.JobScheduleAddParameter 910 :param job_schedule_add_options: Additional parameters for the 911 operation 912 :type job_schedule_add_options: 913 ~azure.batch.models.JobScheduleAddOptions 914 :param dict custom_headers: headers that will be added to the request 915 :param bool raw: returns the direct response alongside the 916 deserialized response 917 :param operation_config: :ref:`Operation configuration 918 overrides<msrest:optionsforoperations>`. 919 :return: None or ClientRawResponse if raw=true 920 :rtype: None or ~msrest.pipeline.ClientRawResponse 921 :raises: 922 :class:`BatchErrorException<azure.batch.models.BatchErrorException>` 923 """ 924 timeout = None 925 if job_schedule_add_options is not None: 926 timeout = job_schedule_add_options.timeout 927 client_request_id = None 928 if job_schedule_add_options is not None: 929 client_request_id = job_schedule_add_options.client_request_id 930 return_client_request_id = None 931 if job_schedule_add_options is not None: 932 return_client_request_id = job_schedule_add_options.return_client_request_id 933 ocp_date = None 934 if job_schedule_add_options is not None: 935 ocp_date = job_schedule_add_options.ocp_date 936 937 # Construct URL 938 url = self.add.metadata['url'] 939 path_format_arguments = { 940 'batchUrl': self._serialize.url("self.config.batch_url", self.config.batch_url, 'str', skip_quote=True) 941 } 942 url = self._client.format_url(url, **path_format_arguments) 943 944 # Construct parameters 945 query_parameters = {} 946 query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') 947 if timeout is not None: 948 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int') 949 950 # Construct headers 951 header_parameters = {} 952 header_parameters['Content-Type'] = 'application/json; odata=minimalmetadata; charset=utf-8' 953 if self.config.generate_client_request_id: 954 header_parameters['client-request-id'] = str(uuid.uuid1()) 955 if custom_headers: 956 header_parameters.update(custom_headers) 957 if self.config.accept_language is not None: 958 header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') 959 if client_request_id is not None: 960 header_parameters['client-request-id'] = self._serialize.header("client_request_id", client_request_id, 'str') 961 if return_client_request_id is not None: 962 header_parameters['return-client-request-id'] = self._serialize.header("return_client_request_id", return_client_request_id, 'bool') 963 if ocp_date is not None: 964 header_parameters['ocp-date'] = self._serialize.header("ocp_date", ocp_date, 'rfc-1123') 965 966 # Construct body 967 body_content = self._serialize.body(cloud_job_schedule, 'JobScheduleAddParameter') 968 969 # Construct and send request 970 request = self._client.post(url, query_parameters, header_parameters, body_content) 971 response = self._client.send(request, stream=False, **operation_config) 972 973 if response.status_code not in [201]: 974 raise models.BatchErrorException(self._deserialize, response) 975 976 if raw: 977 client_raw_response = ClientRawResponse(None, response) 978 client_raw_response.add_headers({ 979 'client-request-id': 'str', 980 'request-id': 'str', 981 'ETag': 'str', 982 'Last-Modified': 'rfc-1123', 983 'DataServiceId': 'str', 984 }) 985 return client_raw_response 986 add.metadata = {'url': '/jobschedules'} 987 988 def list( 989 self, job_schedule_list_options=None, custom_headers=None, raw=False, **operation_config): 990 """Lists all of the Job Schedules in the specified Account. 991 992 :param job_schedule_list_options: Additional parameters for the 993 operation 994 :type job_schedule_list_options: 995 ~azure.batch.models.JobScheduleListOptions 996 :param dict custom_headers: headers that will be added to the request 997 :param bool raw: returns the direct response alongside the 998 deserialized response 999 :param operation_config: :ref:`Operation configuration 1000 overrides<msrest:optionsforoperations>`. 1001 :return: An iterator like instance of CloudJobSchedule 1002 :rtype: 1003 ~azure.batch.models.CloudJobSchedulePaged[~azure.batch.models.CloudJobSchedule] 1004 :raises: 1005 :class:`BatchErrorException<azure.batch.models.BatchErrorException>` 1006 """ 1007 filter = None 1008 if job_schedule_list_options is not None: 1009 filter = job_schedule_list_options.filter 1010 select = None 1011 if job_schedule_list_options is not None: 1012 select = job_schedule_list_options.select 1013 expand = None 1014 if job_schedule_list_options is not None: 1015 expand = job_schedule_list_options.expand 1016 max_results = None 1017 if job_schedule_list_options is not None: 1018 max_results = job_schedule_list_options.max_results 1019 timeout = None 1020 if job_schedule_list_options is not None: 1021 timeout = job_schedule_list_options.timeout 1022 client_request_id = None 1023 if job_schedule_list_options is not None: 1024 client_request_id = job_schedule_list_options.client_request_id 1025 return_client_request_id = None 1026 if job_schedule_list_options is not None: 1027 return_client_request_id = job_schedule_list_options.return_client_request_id 1028 ocp_date = None 1029 if job_schedule_list_options is not None: 1030 ocp_date = job_schedule_list_options.ocp_date 1031 1032 def prepare_request(next_link=None): 1033 if not next_link: 1034 # Construct URL 1035 url = self.list.metadata['url'] 1036 path_format_arguments = { 1037 'batchUrl': self._serialize.url("self.config.batch_url", self.config.batch_url, 'str', skip_quote=True) 1038 } 1039 url = self._client.format_url(url, **path_format_arguments) 1040 1041 # Construct parameters 1042 query_parameters = {} 1043 query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') 1044 if filter is not None: 1045 query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') 1046 if select is not None: 1047 query_parameters['$select'] = self._serialize.query("select", select, 'str') 1048 if expand is not None: 1049 query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') 1050 if max_results is not None: 1051 query_parameters['maxresults'] = self._serialize.query("max_results", max_results, 'int', maximum=1000, minimum=1) 1052 if timeout is not None: 1053 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int') 1054 1055 else: 1056 url = next_link 1057 query_parameters = {} 1058 1059 # Construct headers 1060 header_parameters = {} 1061 header_parameters['Accept'] = 'application/json' 1062 if self.config.generate_client_request_id: 1063 header_parameters['client-request-id'] = str(uuid.uuid1()) 1064 if custom_headers: 1065 header_parameters.update(custom_headers) 1066 if self.config.accept_language is not None: 1067 header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') 1068 if client_request_id is not None: 1069 header_parameters['client-request-id'] = self._serialize.header("client_request_id", client_request_id, 'str') 1070 if return_client_request_id is not None: 1071 header_parameters['return-client-request-id'] = self._serialize.header("return_client_request_id", return_client_request_id, 'bool') 1072 if ocp_date is not None: 1073 header_parameters['ocp-date'] = self._serialize.header("ocp_date", ocp_date, 'rfc-1123') 1074 1075 # Construct and send request 1076 request = self._client.get(url, query_parameters, header_parameters) 1077 return request 1078 1079 def internal_paging(next_link=None): 1080 request = prepare_request(next_link) 1081 1082 response = self._client.send(request, stream=False, **operation_config) 1083 1084 if response.status_code not in [200]: 1085 raise models.BatchErrorException(self._deserialize, response) 1086 1087 return response 1088 1089 # Deserialize response 1090 header_dict = None 1091 if raw: 1092 header_dict = {} 1093 deserialized = models.CloudJobSchedulePaged(internal_paging, self._deserialize.dependencies, header_dict) 1094 1095 return deserialized 1096 list.metadata = {'url': '/jobschedules'} 1097