From eec8b5a3dc418f61ee98c8ef78225b09e2a5029c Mon Sep 17 00:00:00 2001 From: SwaggerToSDK Automation Date: Sat, 10 Sep 2016 00:19:38 +0000 Subject: [PATCH 1/2] Generated from 0eeb0c9422ec39031927aba935c258af7b194baf --- azure-batch/azure/batch/models/__init__.py | 2 + .../batch/models/task_reactivate_options.py | 55 +++++++++ .../azure/batch/operations/task_operations.py | 108 ++++++++++++++++++ 3 files changed, 165 insertions(+) create mode 100644 azure-batch/azure/batch/models/task_reactivate_options.py diff --git a/azure-batch/azure/batch/models/__init__.py b/azure-batch/azure/batch/models/__init__.py index 8f6c95a59f05..d343bab1fa3c 100644 --- a/azure-batch/azure/batch/models/__init__.py +++ b/azure-batch/azure/batch/models/__init__.py @@ -169,6 +169,7 @@ from .task_update_options import TaskUpdateOptions from .task_list_subtasks_options import TaskListSubtasksOptions from .task_terminate_options import TaskTerminateOptions +from .task_reactivate_options import TaskReactivateOptions from .compute_node_add_user_options import ComputeNodeAddUserOptions from .compute_node_delete_user_options import ComputeNodeDeleteUserOptions from .compute_node_update_user_options import ComputeNodeUpdateUserOptions @@ -382,6 +383,7 @@ 'TaskUpdateOptions', 'TaskListSubtasksOptions', 'TaskTerminateOptions', + 'TaskReactivateOptions', 'ComputeNodeAddUserOptions', 'ComputeNodeDeleteUserOptions', 'ComputeNodeUpdateUserOptions', diff --git a/azure-batch/azure/batch/models/task_reactivate_options.py b/azure-batch/azure/batch/models/task_reactivate_options.py new file mode 100644 index 000000000000..0f6a2af8e480 --- /dev/null +++ b/azure-batch/azure/batch/models/task_reactivate_options.py @@ -0,0 +1,55 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class TaskReactivateOptions(Model): + """Additional parameters for the Task_Reactivate operation. + + :param timeout: The maximum time that the server can spend processing the + request, in seconds. The default is 30 seconds. Default value: 30 . + :type timeout: int + :param client_request_id: The caller-generated request identity, in the + form of a GUID with no decoration such as curly braces, e.g. + 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + :type client_request_id: str + :param return_client_request_id: Whether the server should return the + client-request-id identifier in the response. + :type return_client_request_id: bool + :param ocp_date: The time the request was issued. If not specified, this + header will be automatically populated with the current system clock + time. + :type ocp_date: datetime + :param if_match: An ETag is specified. Specify this header to perform the + operation only if the resource's ETag is an exact match as specified. + :type if_match: str + :param if_none_match: An ETag is specified. Specify this header to + perform the operation only if the resource's ETag does not match the + specified ETag. + :type if_none_match: str + :param if_modified_since: Specify this header to perform the operation + only if the resource has been modified since the specified date/time. + :type if_modified_since: datetime + :param if_unmodified_since: Specify this header to perform the operation + only if the resource has not been modified since the specified date/time. + :type if_unmodified_since: datetime + """ + + def __init__(self, timeout=30, client_request_id=None, return_client_request_id=None, ocp_date=None, if_match=None, if_none_match=None, if_modified_since=None, if_unmodified_since=None): + self.timeout = timeout + self.client_request_id = client_request_id + self.return_client_request_id = return_client_request_id + self.ocp_date = ocp_date + self.if_match = if_match + self.if_none_match = if_none_match + self.if_modified_since = if_modified_since + self.if_unmodified_since = if_unmodified_since diff --git a/azure-batch/azure/batch/operations/task_operations.py b/azure-batch/azure/batch/operations/task_operations.py index 81d0d90e9941..4e66473846be 100644 --- a/azure-batch/azure/batch/operations/task_operations.py +++ b/azure-batch/azure/batch/operations/task_operations.py @@ -842,3 +842,111 @@ def terminate( 'DataServiceId': 'str', }) return client_raw_response + + def reactivate( + self, job_id, task_id, task_reactivate_options=None, custom_headers=None, raw=False, **operation_config): + """Reactivates the specified task. + + Reactivation makes a task eligible to be retried again up to its + maximum retry count. This will fail for tasks that are not completed + or that previously completed successfully (with an exit code of 0). + Additionally, this will fail if the job has completed (or is + terminating or deleting). + + :param job_id: The id of the job containing the task. + :type job_id: str + :param task_id: The id of the task to reactivate. + :type task_id: str + :param task_reactivate_options: Additional parameters for the + operation + :type task_reactivate_options: :class:`TaskReactivateOptions + ` + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :rtype: None + :rtype: :class:`ClientRawResponse` + if raw=true + """ + timeout = None + if task_reactivate_options is not None: + timeout = task_reactivate_options.timeout + client_request_id = None + if task_reactivate_options is not None: + client_request_id = task_reactivate_options.client_request_id + return_client_request_id = None + if task_reactivate_options is not None: + return_client_request_id = task_reactivate_options.return_client_request_id + ocp_date = None + if task_reactivate_options is not None: + ocp_date = task_reactivate_options.ocp_date + if_match = None + if task_reactivate_options is not None: + if_match = task_reactivate_options.if_match + if_none_match = None + if task_reactivate_options is not None: + if_none_match = task_reactivate_options.if_none_match + if_modified_since = None + if task_reactivate_options is not None: + if_modified_since = task_reactivate_options.if_modified_since + if_unmodified_since = None + if task_reactivate_options is not None: + if_unmodified_since = task_reactivate_options.if_unmodified_since + + # Construct URL + url = '/jobs/{jobId}/tasks/{taskId}/reactivate' + path_format_arguments = { + 'jobId': self._serialize.url("job_id", job_id, 'str'), + 'taskId': self._serialize.url("task_id", task_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str') + if timeout is not None: + query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; odata=minimalmetadata; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + if client_request_id is not None: + header_parameters['client-request-id'] = self._serialize.header("client_request_id", client_request_id, 'str') + if return_client_request_id is not None: + header_parameters['return-client-request-id'] = self._serialize.header("return_client_request_id", return_client_request_id, 'bool') + if ocp_date is not None: + header_parameters['ocp-date'] = self._serialize.header("ocp_date", ocp_date, 'rfc-1123') + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + if if_none_match is not None: + header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') + if if_modified_since is not None: + header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + + # Construct and send request + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, **operation_config) + + if response.status_code not in [204]: + raise models.BatchErrorException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + client_raw_response.add_headers({ + 'client-request-id': 'str', + 'request-id': 'str', + 'ETag': 'str', + 'Last-Modified': 'rfc-1123', + 'DataServiceId': 'str', + }) + return client_raw_response From faa98953b2d16fff89e176b72e8d45b3e640626a Mon Sep 17 00:00:00 2001 From: SwaggerToSDK Automation Date: Wed, 14 Sep 2016 14:47:25 +0000 Subject: [PATCH 2/2] Generated from 2f6c69d5c33608cf3640b5c4275a990c38965dc6 --- .../graphrbac/operations/groups_operations.py | 141 ++---------------- .../operations/objects_operations.py | 69 +-------- .../service_principals_operations.py | 71 +-------- .../graphrbac/operations/users_operations.py | 70 +-------- 4 files changed, 32 insertions(+), 319 deletions(-) diff --git a/azure-graphrbac/azure/graphrbac/operations/groups_operations.py b/azure-graphrbac/azure/graphrbac/operations/groups_operations.py index e51560dcf284..e1ae12d2fd81 100644 --- a/azure-graphrbac/azure/graphrbac/operations/groups_operations.py +++ b/azure-graphrbac/azure/graphrbac/operations/groups_operations.py @@ -354,8 +354,14 @@ def internal_paging(next_link=None, raw=False): query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: - url = next_link + url = '/{tenantID}/{nextLink}' + path_format_arguments = { + 'nextLink': self._serialize.url("next_link", next_link, 'str', skip_quote=True), + 'tenantID': self._serialize.url("self.config.tenant_id", self.config.tenant_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') # Construct headers header_parameters = {} @@ -417,8 +423,14 @@ def internal_paging(next_link=None, raw=False): query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: - url = next_link + url = '/{tenantID}/{nextLink}' + path_format_arguments = { + 'nextLink': self._serialize.url("next_link", next_link, 'str', skip_quote=True), + 'tenantID': self._serialize.url("self.config.tenant_id", self.config.tenant_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') # Construct headers header_parameters = {} @@ -576,128 +588,3 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized - - def list_next( - self, next_link, custom_headers=None, raw=False, **operation_config): - """Gets list of groups for the current tenant. - - :param next_link: Next link for list operation. - :type next_link: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :rtype: :class:`ADGroupPaged ` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = '/{tenantID}/{nextLink}' - path_format_arguments = { - 'nextLink': self._serialize.url("next_link", next_link, 'str', skip_quote=True), - 'tenantID': self._serialize.url("self.config.tenant_id", self.config.tenant_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters) - response = self._client.send( - request, header_parameters, **operation_config) - - if response.status_code not in [200]: - raise models.GraphErrorException(self._deserialize, response) - - return response - - # Deserialize response - deserialized = models.ADGroupPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.ADGroupPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - - def get_group_members_next( - self, next_link, custom_headers=None, raw=False, **operation_config): - """Gets the members of a group. - - :param next_link: Next link for list operation. - :type next_link: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :rtype: :class:`AADObjectPaged - ` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = '/{tenantID}/{nextLink}' - path_format_arguments = { - 'nextLink': self._serialize.url("next_link", next_link, 'str', skip_quote=True), - 'tenantID': self._serialize.url("self.config.tenant_id", self.config.tenant_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters) - response = self._client.send( - request, header_parameters, **operation_config) - - if response.status_code not in [200]: - raise models.GraphErrorException(self._deserialize, response) - - return response - - # Deserialize response - deserialized = models.AADObjectPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.AADObjectPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized diff --git a/azure-graphrbac/azure/graphrbac/operations/objects_operations.py b/azure-graphrbac/azure/graphrbac/operations/objects_operations.py index 2a12a9670ed6..64cf68e0a010 100644 --- a/azure-graphrbac/azure/graphrbac/operations/objects_operations.py +++ b/azure-graphrbac/azure/graphrbac/operations/objects_operations.py @@ -119,79 +119,15 @@ def internal_paging(next_link=None, raw=False): query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'GetObjectsParameters') - - # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response - - # Deserialize response - deserialized = models.AADObjectPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.AADObjectPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - - def get_objects_by_object_ids_next( - self, next_link, custom_headers=None, raw=False, **operation_config): - """Gets AD group membership by provided AD object Ids. - - :param next_link: Next link for list operation. - :type next_link: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :rtype: :class:`AADObjectPaged - ` - """ - api_version = "1.6-internal" - - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL url = '/{tenantID}/{nextLink}' path_format_arguments = { 'nextLink': self._serialize.url("next_link", next_link, 'str', skip_quote=True), 'tenantID': self._serialize.url("self.config.tenant_id", self.config.tenant_id, 'str') } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters query_parameters = {} query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - else: - url = next_link - query_parameters = {} - # Construct headers header_parameters = {} header_parameters['Content-Type'] = 'application/json; charset=utf-8' @@ -202,10 +138,13 @@ def internal_paging(next_link=None, raw=False): if self.config.accept_language is not None: header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + # Construct body + body_content = self._serialize.body(parameters, 'GetObjectsParameters') + # Construct and send request request = self._client.post(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, body_content, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-graphrbac/azure/graphrbac/operations/service_principals_operations.py b/azure-graphrbac/azure/graphrbac/operations/service_principals_operations.py index 4efc2884bec8..36f8950fd909 100644 --- a/azure-graphrbac/azure/graphrbac/operations/service_principals_operations.py +++ b/azure-graphrbac/azure/graphrbac/operations/service_principals_operations.py @@ -125,8 +125,14 @@ def internal_paging(next_link=None, raw=False): query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: - url = next_link + url = '/{tenantID}/{nextLink}' + path_format_arguments = { + 'nextLink': self._serialize.url("next_link", next_link, 'str', skip_quote=True), + 'tenantID': self._serialize.url("self.config.tenant_id", self.config.tenant_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') # Construct headers header_parameters = {} @@ -509,66 +515,3 @@ def update_password_credentials( if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response - - def list_next( - self, next_link, custom_headers=None, raw=False, **operation_config): - """Gets list of service principals from the current tenant. - - :param next_link: Next link for list operation. - :type next_link: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :rtype: :class:`ServicePrincipalPaged - ` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = '/{tenantID}/{nextLink}' - path_format_arguments = { - 'nextLink': self._serialize.url("next_link", next_link, 'str', skip_quote=True), - 'tenantID': self._serialize.url("self.config.tenant_id", self.config.tenant_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters) - response = self._client.send( - request, header_parameters, **operation_config) - - if response.status_code not in [200]: - raise models.GraphErrorException(self._deserialize, response) - - return response - - # Deserialize response - deserialized = models.ServicePrincipalPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.ServicePrincipalPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized diff --git a/azure-graphrbac/azure/graphrbac/operations/users_operations.py b/azure-graphrbac/azure/graphrbac/operations/users_operations.py index 809b4ecb7b71..7b9b23f82b65 100644 --- a/azure-graphrbac/azure/graphrbac/operations/users_operations.py +++ b/azure-graphrbac/azure/graphrbac/operations/users_operations.py @@ -125,8 +125,14 @@ def internal_paging(next_link=None, raw=False): query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: - url = next_link + url = '/{tenantID}/{nextLink}' + path_format_arguments = { + 'nextLink': self._serialize.url("next_link", next_link, 'str', skip_quote=True), + 'tenantID': self._serialize.url("self.config.tenant_id", self.config.tenant_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') # Construct headers header_parameters = {} @@ -392,65 +398,3 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized - - def list_next( - self, next_link, custom_headers=None, raw=False, **operation_config): - """Gets list of users for the current tenant. - - :param next_link: Next link for list operation. - :type next_link: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :rtype: :class:`UserPaged ` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = '/{tenantID}/{nextLink}' - path_format_arguments = { - 'nextLink': self._serialize.url("next_link", next_link, 'str', skip_quote=True), - 'tenantID': self._serialize.url("self.config.tenant_id", self.config.tenant_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters) - response = self._client.send( - request, header_parameters, **operation_config) - - if response.status_code not in [200]: - raise models.GraphErrorException(self._deserialize, response) - - return response - - # Deserialize response - deserialized = models.UserPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.UserPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized