def get307( self, custom_headers={}, raw=False, **operation_config): """ Redirect get with 307, resulting in a 200 success :param dict custom_headers: headers that will be added to the request :param boolean raw: returns the direct response alongside the deserialized response :rtype: None or (None, requests.response) or concurrent.futures.Future """ # Construct URL url = '/http/redirect/307' # Construct parameters query_parameters = {} # Construct headers header_parameters = {} header_parameters['Content-Type'] = 'application/json; charset=utf-8' if custom_headers: header_parameters.update(custom_headers) # 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, 307]: raise models.ErrorException(self._deserialize, response) if raw: client_raw_response = ClientRawResponse(None, response) client_raw_response.add_headers({ 'Location': 'str', }) return client_raw_response
def response_existing_key( self, custom_headers={}, raw=False, **operation_config): """ Get a response with header value "User-Agent": "overwrite" :param dict custom_headers: headers that will be added to the request :param boolean raw: returns the direct response alongside the deserialized response :rtype: None or msrest.pipeline.ClientRawResponse """ # Construct URL url = '/header/response/existingkey' # Construct parameters query_parameters = {} # Construct headers header_parameters = {} header_parameters['Content-Type'] = 'application/json; charset=utf-8' if custom_headers: header_parameters.update(custom_headers) # 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 [200]: raise models.ErrorException(self._deserialize, response) if raw: client_raw_response = ClientRawResponse(None, response) client_raw_response.add_headers({ 'User-Agent': 'str', }) return client_raw_response
def get_entity_tag( self, resource_group_name, service_name, identity_provider_name, custom_headers=None, raw=False, **operation_config): """Gets the entity state (Etag) version of the identityProvider specified by its identifier. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param service_name: The name of the API Management service. :type service_name: str :param identity_provider_name: Identity Provider Type identifier. Possible values include: 'facebook', 'google', 'microsoft', 'twitter', 'aad', 'aadB2C' :type identity_provider_name: str or ~azure.mgmt.apimanagement.models.IdentityProviderType :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<msrest:optionsforoperations>`. :return: None or ClientRawResponse if raw=true :rtype: None or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException<azure.mgmt.apimanagement.models.ErrorResponseException>` """ # Construct URL url = self.get_entity_tag.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str', max_length=50, min_length=1, pattern=r'^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$'), 'identityProviderName': self._serialize.url("identity_provider_name", identity_provider_name, 'str'), 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_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') # Construct headers header_parameters = {} 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.head(url, query_parameters, header_parameters) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) if raw: client_raw_response = ClientRawResponse(None, response) client_raw_response.add_headers({ 'ETag': 'str', }) return client_raw_response
def get_long_running_output(response): if raw: client_raw_response = ClientRawResponse(None, response) client_raw_response.add_headers({ 'location': 'str', }) return client_raw_response
def response_protected_key(self, custom_headers={}, raw=False, **operation_config): """ Get a response with header value "Content-Type": "text/html" :param dict custom_headers: headers that will be added to the request :param boolean raw: returns the direct response alongside the deserialized response :rtype: None or (None, requests.response) or concurrent.futures.Future """ # Construct URL url = "/header/response/protectedkey" # Construct parameters query_parameters = {} # Construct headers header_parameters = {} header_parameters["Content-Type"] = "application/json; charset=utf-8" if custom_headers: header_parameters.update(custom_headers) # 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 [200]: raise models.ErrorException(self._deserialize, response) if raw: client_raw_response = ClientRawResponse(None, response) client_raw_response.add_headers({"Content-Type": "str"}) return client_raw_response
def get_entity_tag( self, resource_group_name, service_name, api_id, custom_headers=None, raw=False, **operation_config): """Gets the entity state (Etag) version of the API policy specified by its identifier. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param service_name: The name of the API Management service. :type service_name: str :param api_id: API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. :type api_id: 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<msrest:optionsforoperations>`. :return: None or ClientRawResponse if raw=true :rtype: None or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException<azure.mgmt.apimanagement.models.ErrorResponseException>` """ # Construct URL url = self.get_entity_tag.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str', max_length=50, min_length=1, pattern=r'^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$'), 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), 'policyId': self._serialize.url("self.policy_id", self.policy_id, 'str'), 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_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') # Construct headers header_parameters = {} 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.head(url, query_parameters, header_parameters) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) if raw: client_raw_response = ClientRawResponse(None, response) client_raw_response.add_headers({ 'ETag': 'str', }) return client_raw_response
def head300( self, custom_headers={}, raw=False, **operation_config): """ Return 300 status code and redirect to /http/success/200 :param dict custom_headers: headers that will be added to the request :param boolean raw: returns the direct response alongside the deserialized response :rtype: None or msrest.pipeline.ClientRawResponse """ # Construct URL url = '/http/redirect/300' # Construct parameters query_parameters = {} # Construct headers header_parameters = {} header_parameters['Content-Type'] = 'application/json; charset=utf-8' if custom_headers: header_parameters.update(custom_headers) # Construct and send request request = self._client.head(url, query_parameters) response = self._client.send(request, header_parameters, **operation_config) if response.status_code not in [200, 300]: raise models.ErrorException(self._deserialize, response) if raw: client_raw_response = ClientRawResponse(None, response) client_raw_response.add_headers({ 'Location': 'str', }) return client_raw_response
def get_long_running_output(response): if response.status_code not in [200, 202]: exp = CloudError(response) exp.request_id = response.headers.get('x-ms-request-id') raise exp deserialized = None header_dict = {} if response.status_code == 200: deserialized = self._deserialize('Product', response) header_dict = { 'Location': 'str', 'Retry-After': 'int', } if response.status_code == 202: deserialized = self._deserialize('Product', response) header_dict = { 'Location': 'str', 'Retry-After': 'int', } if raw: client_raw_response = ClientRawResponse(deserialized, response) client_raw_response.add_headers(header_dict) return client_raw_response return deserialized
def _update_initial( self, resource_group_name, storage_sync_service_name, sync_group_name, server_endpoint_name, parameters=None, custom_headers=None, raw=False, **operation_config): # Construct URL url = self.update.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), 'serverEndpointName': self._serialize.url("server_endpoint_name", server_endpoint_name, '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', min_length=1) # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' 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 if parameters is not None: body_content = self._serialize.body(parameters, 'ServerEndpointUpdateParameters') else: body_content = None # Construct and send request request = self._client.patch(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200, 202]: raise models.StorageSyncErrorException(self._deserialize, response) deserialized = None header_dict = {} if response.status_code == 200: deserialized = self._deserialize('ServerEndpoint', response) header_dict = { 'x-ms-request-id': 'str', 'x-ms-correlation-request-id': 'str', 'Azure-AsyncOperation': 'str', 'Location': 'str', } if raw: client_raw_response = ClientRawResponse(deserialized, response) client_raw_response.add_headers(header_dict) return client_raw_response return deserialized
def _create_or_update_initial( self, resource_group_name, service_name, api_id, parameters, if_match=None, custom_headers=None, raw=False, **operation_config): # Construct URL url = self.create_or_update.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str', max_length=50, min_length=1, pattern=r'^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$'), 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_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') # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' 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 if_match is not None: header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') 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, 'ApiCreateOrUpdateParameter') # Construct and send request request = self._client.put(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200, 201, 202]: raise models.ErrorResponseException(self._deserialize, response) deserialized = None header_dict = {} if response.status_code == 200: deserialized = self._deserialize('ApiContract', response) header_dict = { 'ETag': 'str', } if response.status_code == 201: deserialized = self._deserialize('ApiContract', response) header_dict = { 'ETag': 'str', } if raw: client_raw_response = ClientRawResponse(deserialized, response) client_raw_response.add_headers(header_dict) return client_raw_response return deserialized
def delete( self, resource_group_name, storage_sync_service_name, sync_group_name, custom_headers=None, raw=False, **operation_config): """Delete a given SyncGroup. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param storage_sync_service_name: Name of Storage Sync Service resource. :type storage_sync_service_name: str :param sync_group_name: Name of Sync Group resource. :type sync_group_name: 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<msrest:optionsforoperations>`. :return: None or ClientRawResponse if raw=true :rtype: None or ~msrest.pipeline.ClientRawResponse :raises: :class:`StorageSyncErrorException<azure.mgmt.storagesync.models.StorageSyncErrorException>` """ # Construct URL url = self.delete.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, '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', min_length=1) # Construct headers header_parameters = {} 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.delete(url, query_parameters, header_parameters) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200, 204]: raise models.StorageSyncErrorException(self._deserialize, response) if raw: client_raw_response = ClientRawResponse(None, response) client_raw_response.add_headers({ 'x-ms-request-id': 'str', 'x-ms-correlation-request-id': 'str', }) return client_raw_response
def query( self, query_specification, custom_headers=None, raw=False, **operation_config): """Query the device enrollment records. :param query_specification: The query specification. :type query_specification: ~serviceswagger.models.QuerySpecification :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<msrest:optionsforoperations>`. :return: list or ClientRawResponse if raw=true :rtype: list[~serviceswagger.models.IndividualEnrollment] or ~msrest.pipeline.ClientRawResponse :raises: :class:`ProvisioningServiceErrorDetailsException<serviceswagger.models.ProvisioningServiceErrorDetailsException>` """ # Construct URL url = '/enrollments/query' # Construct parameters query_parameters = {} query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') # Construct headers header_parameters = {} header_parameters['Content-Type'] = 'application/json; charset=utf-8' if custom_headers: header_parameters.update(custom_headers) # Construct body body_content = self._serialize.body(query_specification, 'QuerySpecification') # 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, 400, 401, 404, 415, 429, 500]: raise models.ProvisioningServiceErrorDetailsException(self._deserialize, response) deserialized = None header_dict = {} if response.status_code == 200: deserialized = self._deserialize('[IndividualEnrollment]', response) header_dict = { 'x-ms-continuation': 'str', 'x-ms-max-item-count': 'int', 'x-ms-item-type': 'str', } if raw: client_raw_response = ClientRawResponse(deserialized, response) client_raw_response.add_headers(header_dict) return client_raw_response return deserialized
def custom_named_request_id_param_grouping( self, header_custom_named_request_id_param_grouping_parameters, custom_headers=None, raw=False, **operation_config): """Send foo-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in the header of the request, via a parameter group. :param header_custom_named_request_id_param_grouping_parameters: Additional parameters for the operation :type header_custom_named_request_id_param_grouping_parameters: :class:`HeaderCustomNamedRequestIdParamGroupingParameters <fixtures.acceptancetestsazurespecials.models.HeaderCustomNamedRequestIdParamGroupingParameters>` :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<msrest:optionsforoperations>`. :return: None or :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` if raw=true :rtype: None or :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` :raises: :class:`ErrorException<fixtures.acceptancetestsazurespecials.models.ErrorException>` """ foo_client_request_id = None if header_custom_named_request_id_param_grouping_parameters is not None: foo_client_request_id = header_custom_named_request_id_param_grouping_parameters.foo_client_request_id # Construct URL url = '/azurespecials/customNamedRequestIdParamGrouping' # Construct parameters query_parameters = {} # Construct headers header_parameters = {} header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self.config.generate_client_request_id: header_parameters['foo-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') header_parameters['foo-client-request-id'] = self._serialize.header("foo_client_request_id", foo_client_request_id, 'str') # 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 [200]: raise models.ErrorException(self._deserialize, response) if raw: client_raw_response = ClientRawResponse(None, response) client_raw_response.add_headers({ 'foo-request-id': 'str', }) return client_raw_response
def get_long_running_output(response): if raw: client_raw_response = ClientRawResponse(None, response) client_raw_response.add_headers({ 'x-ms-request-id': 'str', 'x-ms-correlation-request-id': 'str', 'Location': 'str', }) return client_raw_response
def _create_initial( self, resource_group_name, account_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = self.create.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[-\w\._]+$'), 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_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') # 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, 'BatchAccountCreateParameters') # Construct and send request request = self._client.put(url, query_parameters) response = self._client.send( request, header_parameters, body_content, stream=False, **operation_config) if response.status_code not in [200, 202]: exp = CloudError(response) exp.request_id = response.headers.get('x-ms-request-id') raise exp deserialized = None header_dict = {} if response.status_code == 200: deserialized = self._deserialize('BatchAccount', response) header_dict = { 'Location': 'str', 'Retry-After': 'int', } if raw: client_raw_response = ClientRawResponse(deserialized, response) try: client_raw_response.add_headers(header_dict) except DeserializationError: pass # Deserialization of Headers here can fail return client_raw_response return deserialized
def get_details( self, operation_id, custom_headers=None, raw=False, **operation_config): """Gets details of a specific long running operation. :param operation_id: Operation id. :type operation_id: 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<msrest:optionsforoperations>`. :return: Operation or ClientRawResponse if raw=true :rtype: ~azure.cognitiveservices.knowledge.qnamaker.models.Operation or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException<azure.cognitiveservices.knowledge.qnamaker.models.ErrorResponseException>` """ # Construct URL url = self.get_details.metadata['url'] path_format_arguments = { 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'operationId': self._serialize.url("operation_id", operation_id, 'str') } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if custom_headers: header_parameters.update(custom_headers) # Construct and send request request = self._client.get(url, query_parameters, header_parameters) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) deserialized = None header_dict = {} if response.status_code == 200: deserialized = self._deserialize('Operation', response) header_dict = { 'RetryAfter': 'int', } if raw: client_raw_response = ClientRawResponse(deserialized, response) client_raw_response.add_headers(header_dict) return client_raw_response return deserialized
def _create_or_update_initial( self, resource_group_name, rollout_name, rollout_request=None, custom_headers=None, raw=False, **operation_config): # Construct URL url = self.create_or_update.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'rolloutName': self._serialize.url("rollout_name", rollout_name, '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') # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' 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 if rollout_request is not None: body_content = self._serialize.body(rollout_request, 'RolloutRequest') else: body_content = None # Construct and send request request = self._client.put(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [201]: exp = CloudError(response) exp.request_id = response.headers.get('x-ms-request-id') raise exp deserialized = None header_dict = {} if response.status_code == 201: deserialized = self._deserialize('RolloutRequest', response) header_dict = { 'Azure-AsyncOperation': 'str', } if raw: client_raw_response = ClientRawResponse(deserialized, response) client_raw_response.add_headers(header_dict) return client_raw_response return deserialized
def get_long_running_output(response): if response.status_code not in [202]: exp = CloudError(response) exp.request_id = response.headers.get("x-ms-request-id") raise exp if raw: client_raw_response = ClientRawResponse(None, response) client_raw_response.add_headers({"Location": "str", "Retry-After": "int"}) return client_raw_response
def get_long_running_output(response): if response.status_code not in [202, 204]: raise models.ErrorResponseWrapperException(self._deserialize, response) if raw: client_raw_response = ClientRawResponse(None, response) client_raw_response.add_headers({ 'Location': 'str', }) return client_raw_response
def get_long_running_output(response): header_dict = { 'Azure-AsyncOperation': 'str', } deserialized = self._deserialize('ServiceUnitResource', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) client_raw_response.add_headers(header_dict) return client_raw_response return deserialized
def get_long_running_output(response): if response.status_code not in [200, 202]: raise models.ErrorBodyException(self._deserialize, response) if raw: client_raw_response = ClientRawResponse(None, response) client_raw_response.add_headers({ 'Location': 'str', 'Retry-After': 'int', }) return client_raw_response
def get_long_running_output(response): header_dict = { 'ETag': 'str', } deserialized = self._deserialize('ApiContract', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) client_raw_response.add_headers(header_dict) return client_raw_response return deserialized
def post303( self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """Post true Boolean value in request returns 303. This request should be automatically redirected usign a get, ultimately returning a 200 status code. :param boolean_value: Simple boolean value true :type boolean_value: bool :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<msrest:optionsforoperations>`. :return: None or :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` if raw=true :rtype: None or :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` :raises: :class:`ErrorException<fixtures.acceptancetestshttp.models.ErrorException>` """ # Construct URL url = '/http/redirect/303' # Construct parameters query_parameters = {} # Construct headers header_parameters = {} header_parameters['Content-Type'] = 'application/json; charset=utf-8' if custom_headers: header_parameters.update(custom_headers) # Construct body if boolean_value is not None: body_content = self._serialize.body(boolean_value, 'bool') else: body_content = None # 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, 303]: raise models.ErrorException(self._deserialize, response) if raw: client_raw_response = ClientRawResponse(None, response) client_raw_response.add_headers({ 'Location': 'str', }) return client_raw_response
def generate( self, custom_headers=None, raw=False, **operation_config): """Initiates the recommendation generation or computation process for a subscription. This operation is asynchronous. The generated recommendations are stored in a cache in the Advisor service. :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<msrest:optionsforoperations>`. :return: None or ClientRawResponse if raw=true :rtype: None or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>` """ # Construct URL url = '/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/generateRecommendations' path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_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') # 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.post(url, query_parameters) response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [202]: exp = CloudError(response) exp.request_id = response.headers.get('x-ms-request-id') raise exp if raw: client_raw_response = ClientRawResponse(None, response) client_raw_response.add_headers({ 'Location': 'str', 'Retry-After': 'str', }) return client_raw_response
def test_raw_response(self): response = mock.create_autospec(requests.Response) response.headers = {} response.headers["my-test"] = '1999-12-31T23:59:59-23:59' response.headers["colour"] = "red" raw = ClientRawResponse([], response) raw.add_headers({'my-test': 'iso-8601', 'another_header': 'str', 'colour': TestClientResponse.Colors}) self.assertIsInstance(raw.headers['my-test'], datetime.datetime)
def get_long_running_output(response): header_dict = { 'Location': 'str', 'Retry-After': 'int', } deserialized = self._deserialize('SubscriptionCreationResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) client_raw_response.add_headers(header_dict) return client_raw_response return deserialized
def get300( self, custom_headers=None, raw=False, **operation_config): """Return 300 status code and redirect to /http/success/200. :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<msrest:optionsforoperations>`. :return: list of str or :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` if raw=true :rtype: list of str or :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` :raises: :class:`ErrorException<fixtures.acceptancetestshttp.models.ErrorException>` """ # Construct URL url = '/http/redirect/300' # Construct parameters query_parameters = {} # Construct headers header_parameters = {} header_parameters['Content-Type'] = 'application/json; charset=utf-8' if custom_headers: header_parameters.update(custom_headers) # 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, 300]: raise models.ErrorException(self._deserialize, response) deserialized = None header_dict = {} if response.status_code == 300: deserialized = self._deserialize('[str]', response) header_dict = { 'Location': 'str', } if raw: client_raw_response = ClientRawResponse(deserialized, response) client_raw_response.add_headers(header_dict) return client_raw_response return deserialized
def _create_subscription_initial( self, billing_account_name, invoice_section_name, body, custom_headers=None, raw=False, **operation_config): # Construct URL url = self.create_subscription.metadata['url'] path_format_arguments = { 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, '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') # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' 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(body, 'SubscriptionCreationParameters') # Construct and send request request = self._client.post(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200, 202]: raise models.ErrorResponseException(self._deserialize, response) deserialized = None header_dict = {} if response.status_code == 200: deserialized = self._deserialize('SubscriptionCreationResult', response) header_dict = { 'Location': 'str', 'Retry-After': 'int', } if raw: client_raw_response = ClientRawResponse(deserialized, response) client_raw_response.add_headers(header_dict) return client_raw_response return deserialized
def get_long_running_output(response): if response.status_code not in [202]: exp = CloudError(response) exp.request_id = response.headers.get('x-ms-request-id') raise exp if raw: client_raw_response = ClientRawResponse(None, response) client_raw_response.add_headers({ 'Location': 'str', 'Retry-After': 'int', }) return client_raw_response
def patch302( self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """ Patch true Boolean value in request returns 302. This request should not be automatically redirected, but should return the received 302 to the caller for evaluation :param boolean_value: Simple boolean value true :type boolean_value: bool :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<msrest:optionsforoperations>`. :rtype: None :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` if raw=true """ # Construct URL url = '/http/redirect/302' # Construct parameters query_parameters = {} # Construct headers header_parameters = {} header_parameters['Content-Type'] = 'application/json; charset=utf-8' if custom_headers: header_parameters.update(custom_headers) # Construct body if boolean_value is not None: body_content = self._serialize.body(boolean_value, 'bool') else: body_content = None # Construct and send request request = self._client.patch(url, query_parameters) response = self._client.send( request, header_parameters, body_content, **operation_config) if response.status_code not in [302]: raise models.ErrorException(self._deserialize, response) if raw: client_raw_response = ClientRawResponse(None, response) client_raw_response.add_headers({ 'Location': 'str', }) return client_raw_response
def get_long_running_output(response): if response.status_code not in [200]: exp = CloudError(response) exp.request_id = response.headers.get('x-ms-request-id') raise exp deserialized = None header_dict = {} if response.status_code == 200: deserialized = self._deserialize('Product', response) header_dict = { 'Azure-AsyncOperation': 'str', 'Location': 'str', 'Retry-After': 'int', } if raw: client_raw_response = ClientRawResponse(deserialized, response) client_raw_response.add_headers(header_dict) return client_raw_response return deserialized
def response_existing_key( self, custom_headers={}, raw=False, **operation_config): """ Get a response with header value "User-Agent": "overwrite" :param dict custom_headers: headers that will be added to the request :param boolean raw: returns the direct response alongside the deserialized response :rtype: None :rtype: msrest.pipeline.ClientRawResponse if raw=True """ # Construct URL url = '/header/response/existingkey' # Construct parameters query_parameters = {} # Construct headers header_parameters = {} header_parameters['Content-Type'] = 'application/json; charset=utf-8' if custom_headers: header_parameters.update(custom_headers) # 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 [200]: raise models.ErrorException(self._deserialize, response) if raw: client_raw_response = ClientRawResponse(None, response) client_raw_response.add_headers({ 'User-Agent': 'str', }) return client_raw_response
def add(self, certificate, certificate_add_options=None, custom_headers=None, raw=False, **operation_config): """Adds a certificate to the specified account. :param certificate: The certificate to be added. :type certificate: :class:`CertificateAddParameter <azure.batch.models.CertificateAddParameter>` :param certificate_add_options: Additional parameters for the operation :type certificate_add_options: :class:`CertificateAddOptions <azure.batch.models.CertificateAddOptions>` :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<msrest:optionsforoperations>`. :return: None or :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` if raw=true :rtype: None or :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` :raises: :class:`BatchErrorException<azure.batch.models.BatchErrorException>` """ timeout = None if certificate_add_options is not None: timeout = certificate_add_options.timeout client_request_id = None if certificate_add_options is not None: client_request_id = certificate_add_options.client_request_id return_client_request_id = None if certificate_add_options is not None: return_client_request_id = certificate_add_options.return_client_request_id ocp_date = None if certificate_add_options is not None: ocp_date = certificate_add_options.ocp_date # Construct URL url = '/certificates' # Construct parameters query_parameters = {} query_parameters['api-version'] = self._serialize.query( "self.api_version", self.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') # Construct body body_content = self._serialize.body(certificate, 'CertificateAddParameter') # 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 [201]: 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
def instrumentation(self, body, custom_headers=None, raw=False, **operation_config): """Report the user action on a critique. ### Scenarios * User ignores the critique * User accepts the critique suggestion . :param body: Instrumentation API request V1 :type body: ~microsoft.swagger.codegen.editorservice.models.InstrumentationRequestV1 :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<msrest:optionsforoperations>`. :return: None or ClientRawResponse if raw=true :rtype: None or ~msrest.pipeline.ClientRawResponse :raises: :class:`HttpOperationError<msrest.exceptions.HttpOperationError>` """ # Construct URL url = self.instrumentation.metadata['url'] # Construct parameters query_parameters = {} # Construct headers header_parameters = {} header_parameters['Content-Type'] = 'application/json; charset=utf-8' if custom_headers: header_parameters.update(custom_headers) if self.config.x_correlation_id is not None: header_parameters['X-CorrelationId'] = self._serialize.header( "self.config.x_correlation_id", self.config.x_correlation_id, 'str') if self.config.x_user_session_id is not None: header_parameters['X-UserSessionId'] = self._serialize.header( "self.config.x_user_session_id", self.config.x_user_session_id, 'str') if self.config.x_user_id is not None: header_parameters['X-UserId'] = self._serialize.header( "self.config.x_user_id", self.config.x_user_id, 'str') # Construct body body_content = self._serialize.body(body, 'InstrumentationRequestV1') # Construct and send request request = self._client.post(url, query_parameters) response = self._client.send(request, header_parameters, body_content, stream=False, **operation_config) if response.status_code not in [200, 400, 500]: raise HttpOperationError(self._deserialize, response) if raw: client_raw_response = ClientRawResponse(None, response) client_raw_response.add_headers({ 'X-CorrelationId': 'str', }) return client_raw_response
def post_check(self, body, custom_headers=None, raw=False, **operation_config): """Check text not previously tagged; can provide better suggestions (CloudSuggest). :param body: Check API request V1 :type body: ~microsoft.swagger.codegen.editorservice.models.CheckRequestV1 :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<msrest:optionsforoperations>`. :return: CheckResponseV1 or ClientRawResponse if raw=true :rtype: ~microsoft.swagger.codegen.editorservice.models.CheckResponseV1 or ~msrest.pipeline.ClientRawResponse :raises: :class:`HttpOperationError<msrest.exceptions.HttpOperationError>` """ # Construct URL url = self.post_check.metadata['url'] # Construct parameters query_parameters = {} # Construct headers header_parameters = {} header_parameters['Content-Type'] = 'application/json; charset=utf-8' if custom_headers: header_parameters.update(custom_headers) if self.config.x_correlation_id is not None: header_parameters['X-CorrelationId'] = self._serialize.header( "self.config.x_correlation_id", self.config.x_correlation_id, 'str') if self.config.x_user_session_id is not None: header_parameters['X-UserSessionId'] = self._serialize.header( "self.config.x_user_session_id", self.config.x_user_session_id, 'str') if self.config.x_user_id is not None: header_parameters['X-UserId'] = self._serialize.header( "self.config.x_user_id", self.config.x_user_id, 'str') # Construct body body_content = self._serialize.body(body, 'CheckRequestV1') # Construct and send request request = self._client.post(url, query_parameters) response = self._client.send(request, header_parameters, body_content, stream=False, **operation_config) if response.status_code not in [200, 400, 500]: raise HttpOperationError(self._deserialize, response) deserialized = None header_dict = {} if response.status_code == 200: deserialized = self._deserialize('CheckResponseV1', response) header_dict = { 'X-CorrelationId': 'str', } if raw: client_raw_response = ClientRawResponse(deserialized, response) client_raw_response.add_headers(header_dict) return client_raw_response return deserialized
def list_subtasks( self, job_id, task_id, task_list_subtasks_options=None, custom_headers=None, raw=False, **operation_config): """Lists all of the subtasks that are associated with the specified multi-instance Task. If the Task is not a multi-instance Task then this returns an empty collection. :param job_id: The ID of the Job. :type job_id: str :param task_id: The ID of the Task. :type task_id: str :param task_list_subtasks_options: Additional parameters for the operation :type task_list_subtasks_options: ~azure.batch.models.TaskListSubtasksOptions :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<msrest:optionsforoperations>`. :return: CloudTaskListSubtasksResult or ClientRawResponse if raw=true :rtype: ~azure.batch.models.CloudTaskListSubtasksResult or ~msrest.pipeline.ClientRawResponse :raises: :class:`BatchErrorException<azure.batch.models.BatchErrorException>` """ select = None if task_list_subtasks_options is not None: select = task_list_subtasks_options.select timeout = None if task_list_subtasks_options is not None: timeout = task_list_subtasks_options.timeout client_request_id = None if task_list_subtasks_options is not None: client_request_id = task_list_subtasks_options.client_request_id return_client_request_id = None if task_list_subtasks_options is not None: return_client_request_id = task_list_subtasks_options.return_client_request_id ocp_date = None if task_list_subtasks_options is not None: ocp_date = task_list_subtasks_options.ocp_date # Construct URL url = self.list_subtasks.metadata['url'] path_format_arguments = { 'batchUrl': self._serialize.url("self.config.batch_url", self.config.batch_url, 'str', skip_quote=True), '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.api_version", self.api_version, 'str') if select is not None: query_parameters['$select'] = self._serialize.query("select", select, 'str') if timeout is not None: query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int') # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' 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') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.BatchErrorException(self._deserialize, response) header_dict = {} deserialized = None if response.status_code == 200: deserialized = self._deserialize('CloudTaskListSubtasksResult', response) header_dict = { 'client-request-id': 'str', 'request-id': 'str', 'ETag': 'str', 'Last-Modified': 'rfc-1123', } if raw: client_raw_response = ClientRawResponse(deserialized, response) client_raw_response.add_headers(header_dict) return client_raw_response return deserialized
def create(self, resource_group_name, storage_sync_service_name, sync_group_name, properties=None, custom_headers=None, raw=False, **operation_config): """Create a new SyncGroup. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param storage_sync_service_name: Name of Storage Sync Service resource. :type storage_sync_service_name: str :param sync_group_name: Name of Sync Group resource. :type sync_group_name: str :param properties: The parameters used to create the sync group :type properties: object :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<msrest:optionsforoperations>`. :return: SyncGroup or ClientRawResponse if raw=true :rtype: ~azure.mgmt.storagesync.models.SyncGroup or ~msrest.pipeline.ClientRawResponse :raises: :class:`StorageSyncErrorException<azure.mgmt.storagesync.models.StorageSyncErrorException>` """ parameters = models.SyncGroupCreateParameters(properties=properties) # Construct URL url = self.create.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, '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', min_length=1) # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' 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, 'SyncGroupCreateParameters') # Construct and send request request = self._client.put(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.StorageSyncErrorException(self._deserialize, response) deserialized = None header_dict = {} if response.status_code == 200: deserialized = self._deserialize('SyncGroup', response) header_dict = { 'x-ms-request-id': 'str', 'x-ms-correlation-request-id': 'str', } if raw: client_raw_response = ClientRawResponse(deserialized, response) client_raw_response.add_headers(header_dict) return client_raw_response return deserialized
def add_collection( self, job_id, value, task_add_collection_options=None, custom_headers=None, raw=False, **operation_config): """Adds a collection of Tasks to the specified Job. Note that each Task must have a unique ID. The Batch service may not return the results for each Task in the same order the Tasks were submitted in this request. If the server times out or the connection is closed during the request, the request may have been partially or fully processed, or not at all. In such cases, the user should re-issue the request. Note that it is up to the user to correctly handle failures when re-issuing a request. For example, you should use the same Task IDs during a retry so that if the prior operation succeeded, the retry will not create extra Tasks unexpectedly. If the response contains any Tasks which failed to add, a client can retry the request. In a retry, it is most efficient to resubmit only Tasks that failed to add, and to omit Tasks that were successfully added on the first attempt. The maximum lifetime of a Task from addition to completion is 180 days. If a Task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time. :param job_id: The ID of the Job to which the Task collection is to be added. :type job_id: str :param value: The collection of Tasks to add. The maximum count of Tasks is 100. The total serialized size of this collection must be less than 1MB. If it is greater than 1MB (for example if each Task has 100's of resource files or environment variables), the request will fail with code 'RequestBodyTooLarge' and should be retried again with fewer Tasks. :type value: list[~azure.batch.models.TaskAddParameter] :param task_add_collection_options: Additional parameters for the operation :type task_add_collection_options: ~azure.batch.models.TaskAddCollectionOptions :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<msrest:optionsforoperations>`. :return: TaskAddCollectionResult or ClientRawResponse if raw=true :rtype: ~azure.batch.models.TaskAddCollectionResult or ~msrest.pipeline.ClientRawResponse :raises: :class:`BatchErrorException<azure.batch.models.BatchErrorException>` """ timeout = None if task_add_collection_options is not None: timeout = task_add_collection_options.timeout client_request_id = None if task_add_collection_options is not None: client_request_id = task_add_collection_options.client_request_id return_client_request_id = None if task_add_collection_options is not None: return_client_request_id = task_add_collection_options.return_client_request_id ocp_date = None if task_add_collection_options is not None: ocp_date = task_add_collection_options.ocp_date task_collection = models.TaskAddCollectionParameter(value=value) # Construct URL url = self.add_collection.metadata['url'] path_format_arguments = { 'batchUrl': self._serialize.url("self.config.batch_url", self.config.batch_url, 'str', skip_quote=True), 'jobId': self._serialize.url("job_id", job_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') if timeout is not None: query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int') # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' 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') # Construct body body_content = self._serialize.body(task_collection, 'TaskAddCollectionParameter') # Construct and send request request = self._client.post(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.BatchErrorException(self._deserialize, response) header_dict = {} deserialized = None if response.status_code == 200: deserialized = self._deserialize('TaskAddCollectionResult', response) header_dict = { 'client-request-id': 'str', 'request-id': 'str', } if raw: client_raw_response = ClientRawResponse(deserialized, response) client_raw_response.add_headers(header_dict) return client_raw_response return deserialized
def get( self, job_id, task_id, task_get_options=None, custom_headers=None, raw=False, **operation_config): """Gets information about the specified Task. For multi-instance Tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary Task. Use the list subtasks API to retrieve information about subtasks. :param job_id: The ID of the Job that contains the Task. :type job_id: str :param task_id: The ID of the Task to get information about. :type task_id: str :param task_get_options: Additional parameters for the operation :type task_get_options: ~azure.batch.models.TaskGetOptions :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<msrest:optionsforoperations>`. :return: CloudTask or ClientRawResponse if raw=true :rtype: ~azure.batch.models.CloudTask or ~msrest.pipeline.ClientRawResponse :raises: :class:`BatchErrorException<azure.batch.models.BatchErrorException>` """ select = None if task_get_options is not None: select = task_get_options.select expand = None if task_get_options is not None: expand = task_get_options.expand timeout = None if task_get_options is not None: timeout = task_get_options.timeout client_request_id = None if task_get_options is not None: client_request_id = task_get_options.client_request_id return_client_request_id = None if task_get_options is not None: return_client_request_id = task_get_options.return_client_request_id ocp_date = None if task_get_options is not None: ocp_date = task_get_options.ocp_date if_match = None if task_get_options is not None: if_match = task_get_options.if_match if_none_match = None if task_get_options is not None: if_none_match = task_get_options.if_none_match if_modified_since = None if task_get_options is not None: if_modified_since = task_get_options.if_modified_since if_unmodified_since = None if task_get_options is not None: if_unmodified_since = task_get_options.if_unmodified_since # Construct URL url = self.get.metadata['url'] path_format_arguments = { 'batchUrl': self._serialize.url("self.config.batch_url", self.config.batch_url, 'str', skip_quote=True), '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.api_version", self.api_version, 'str') if select is not None: query_parameters['$select'] = self._serialize.query("select", select, 'str') if expand is not None: query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') if timeout is not None: query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int') # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' 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.get(url, query_parameters, header_parameters) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.BatchErrorException(self._deserialize, response) header_dict = {} deserialized = None if response.status_code == 200: deserialized = self._deserialize('CloudTask', response) header_dict = { 'client-request-id': 'str', 'request-id': 'str', 'ETag': 'str', 'Last-Modified': 'rfc-1123', 'DataServiceId': 'str', } if raw: client_raw_response = ClientRawResponse(deserialized, response) client_raw_response.add_headers(header_dict) return client_raw_response return deserialized
def update_digital_twin(self, id, digital_twin_patch, if_match=None, custom_headers=None, raw=False, **operation_config): """Updates a digital twin. :param id: Digital Twin ID. :type id: str :param digital_twin_patch: json-patch contents to update. :type digital_twin_patch: list[object] :param if_match: :type if_match: 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<msrest:optionsforoperations>`. :return: None or ClientRawResponse if raw=true :rtype: None or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>` """ # Construct URL url = self.update_digital_twin.metadata['url'] path_format_arguments = {'id': self._serialize.url("id", 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') # 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 if_match is not None: header_parameters['If-Match'] = self._serialize.header( "if_match", if_match, 'str') 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(digital_twin_patch, '[object]') # Construct and send request request = self._client.patch(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [202]: exp = CloudError(response) exp.request_id = response.headers.get('x-ms-request-id') raise exp if raw: client_raw_response = ClientRawResponse(None, response) client_raw_response.add_headers({ 'ETag': 'str', 'Location': 'str', }) return client_raw_response
def invoke_component_command(self, id, component_path, command_name, payload, connect_timeout_in_seconds=None, response_timeout_in_seconds=None, custom_headers=None, raw=False, **operation_config): """Invoke a digital twin command. Invoke a digital twin command. :param id: :type id: str :param component_path: :type component_path: str :param command_name: :type command_name: str :param payload: :type payload: object :param connect_timeout_in_seconds: Maximum interval of time, in seconds, that the digital twin command will wait for the answer. :type connect_timeout_in_seconds: int :param response_timeout_in_seconds: Maximum interval of time, in seconds, that the digital twin command will wait for the answer. :type response_timeout_in_seconds: int :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<msrest:optionsforoperations>`. :return: object or ClientRawResponse if raw=true :rtype: object or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>` """ # Construct URL url = self.invoke_component_command.metadata['url'] path_format_arguments = { 'id': self._serialize.url("id", id, 'str'), 'componentPath': self._serialize.url("component_path", component_path, 'str'), 'commandName': self._serialize.url("command_name", command_name, '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') if connect_timeout_in_seconds is not None: query_parameters[ 'connectTimeoutInSeconds'] = self._serialize.query( "connect_timeout_in_seconds", connect_timeout_in_seconds, 'int') if response_timeout_in_seconds is not None: query_parameters[ 'responseTimeoutInSeconds'] = self._serialize.query( "response_timeout_in_seconds", response_timeout_in_seconds, 'int') # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' 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(payload, 'object') # Construct and send request request = self._client.post(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) exp.request_id = response.headers.get('x-ms-request-id') raise exp deserialized = None header_dict = {} if response.status_code == 200: deserialized = self._deserialize('object', response) header_dict = { 'x-ms-command-statuscode': 'int', 'x-ms-request-id': 'str', } if raw: client_raw_response = ClientRawResponse(deserialized, response) client_raw_response.add_headers(header_dict) return client_raw_response return deserialized
def reactivate( self, job_id, task_id, task_reactivate_options=None, custom_headers=None, raw=False, **operation_config): """Reactivates a Task, allowing it to run again even if its retry count has been exhausted. Reactivation makes a Task eligible to be retried again up to its maximum retry count. The Task's state is changed to active. As the Task is no longer in the completed state, any previous exit code or failure information is no longer available after reactivation. Each time a Task is reactivated, its retry count is reset to 0. Reactivation will fail for Tasks that are not completed or that previously completed successfully (with an exit code of 0). Additionally, it 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: ~azure.batch.models.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<msrest:optionsforoperations>`. :return: None or ClientRawResponse if raw=true :rtype: None or ~msrest.pipeline.ClientRawResponse :raises: :class:`BatchErrorException<azure.batch.models.BatchErrorException>` """ 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 = self.reactivate.metadata['url'] path_format_arguments = { 'batchUrl': self._serialize.url("self.config.batch_url", self.config.batch_url, 'str', skip_quote=True), '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.api_version", self.api_version, 'str') if timeout is not None: query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int') # Construct headers header_parameters = {} 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, header_parameters) response = self._client.send(request, stream=False, **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
def create(self, subscription_id, resource_group_name, workspace, image_request, custom_headers=None, raw=False, **operation_config): """Create an Image. :param subscription_id: The Azure Subscription ID. :type subscription_id: str :param resource_group_name: Name of the resource group in which the workspace is located. :type resource_group_name: str :param workspace: The name of the workspace. :type workspace: str :param image_request: :type image_request: ~_restclient.models.ImageRequestBase :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<msrest:optionsforoperations>`. :return: None or ClientRawResponse if raw=true :rtype: None or ~msrest.pipeline.ClientRawResponse :raises: :class:`ModelErrorResponseException<_restclient.models.ModelErrorResponseException>` """ # Construct URL url = self.create.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'workspace': self._serialize.url("workspace", workspace, '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') # Construct headers header_parameters = {} header_parameters['Content-Type'] = 'application/json; charset=utf-8' if custom_headers: header_parameters.update(custom_headers) # Construct body body_content = self._serialize.body(image_request, 'ImageRequestBase') # Construct and send request request = self._client.post(url, query_parameters) response = self._client.send(request, header_parameters, body_content, stream=False, **operation_config) if response.status_code not in [202]: raise models.ModelErrorResponseException(self._deserialize, response) if raw: client_raw_response = ClientRawResponse(None, response) client_raw_response.add_headers({ 'Operation-Location': 'str', }) return client_raw_response
def delete_from_compute_node( self, pool_id, node_id, file_name, recursive=None, file_delete_from_compute_node_options=None, custom_headers=None, raw=False, **operation_config): """Deletes the specified task file from the compute node. :param pool_id: The id of the pool that contains the compute node. :type pool_id: str :param node_id: The id of the compute node from which you want to delete the file. :type node_id: str :param file_name: The path to the file that you want to delete. :type file_name: str :param recursive: Whether to delete children of a directory. If the fileName parameter represents a directory instead of a file, you can set Recursive to true to delete the directory and all of the files and subdirectories in it. If Recursive is false then the directory must be empty or deletion will fail. :type recursive: bool :param file_delete_from_compute_node_options: Additional parameters for the operation :type file_delete_from_compute_node_options: :class:`FileDeleteFromComputeNodeOptions <azure.batch.models.FileDeleteFromComputeNodeOptions>` :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<msrest:optionsforoperations>`. :rtype: None :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` if raw=true """ timeout = None if file_delete_from_compute_node_options is not None: timeout = file_delete_from_compute_node_options.timeout client_request_id = None if file_delete_from_compute_node_options is not None: client_request_id = file_delete_from_compute_node_options.client_request_id return_client_request_id = None if file_delete_from_compute_node_options is not None: return_client_request_id = file_delete_from_compute_node_options.return_client_request_id ocp_date = None if file_delete_from_compute_node_options is not None: ocp_date = file_delete_from_compute_node_options.ocp_date # Construct URL url = '/pools/{poolId}/nodes/{nodeId}/files/{fileName}' path_format_arguments = { 'poolId': self._serialize.url("pool_id", pool_id, 'str'), 'nodeId': self._serialize.url("node_id", node_id, 'str'), 'fileName': self._serialize.url("file_name", file_name, 'str') } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} if recursive is not None: query_parameters['recursive'] = self._serialize.query("recursive", recursive, 'bool') 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') # Construct and send request request = self._client.delete(url, query_parameters) response = self._client.send(request, header_parameters, **operation_config) if response.status_code not in [200]: 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', }) return client_raw_response
def create_or_update( self, resource_group_name, service_name, authsid, parameters, if_match=None, custom_headers=None, raw=False, **operation_config): """Creates new authorization server or updates an existing authorization server. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param service_name: The name of the API Management service. :type service_name: str :param authsid: Identifier of the authorization server. :type authsid: str :param parameters: Create or update parameters. :type parameters: ~azure.mgmt.apimanagement.models.AuthorizationServerContract :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. :type if_match: 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<msrest:optionsforoperations>`. :return: AuthorizationServerContract or ClientRawResponse if raw=true :rtype: ~azure.mgmt.apimanagement.models.AuthorizationServerContract or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException<azure.mgmt.apimanagement.models.ErrorResponseException>` """ # Construct URL url = self.create_or_update.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str', max_length=50, min_length=1, pattern=r'^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$'), 'authsid': self._serialize.url("authsid", authsid, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_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') # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' 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 if_match is not None: header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') 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, 'AuthorizationServerContract') # Construct and send request request = self._client.put(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200, 201]: raise models.ErrorResponseException(self._deserialize, response) header_dict = {} deserialized = None if response.status_code == 200: deserialized = self._deserialize('AuthorizationServerContract', response) header_dict = { 'ETag': 'str', } if response.status_code == 201: deserialized = self._deserialize('AuthorizationServerContract', response) header_dict = { 'ETag': 'str', } if raw: client_raw_response = ClientRawResponse(deserialized, response) client_raw_response.add_headers(header_dict) return client_raw_response return deserialized
def delete(self, resource_group_name, storage_sync_service_name, sync_group_name, custom_headers=None, raw=False, **operation_config): """Delete a given SyncGroup. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param storage_sync_service_name: Name of Storage Sync Service resource. :type storage_sync_service_name: str :param sync_group_name: Name of Sync Group resource. :type sync_group_name: 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<msrest:optionsforoperations>`. :return: None or ClientRawResponse if raw=true :rtype: None or ~msrest.pipeline.ClientRawResponse :raises: :class:`StorageSyncErrorException<azure.mgmt.storagesync.models.StorageSyncErrorException>` """ # Construct URL url = self.delete.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, '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', min_length=1) # Construct headers header_parameters = {} 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.delete(url, query_parameters, header_parameters) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200, 204]: raise models.StorageSyncErrorException(self._deserialize, response) if raw: client_raw_response = ClientRawResponse(None, response) client_raw_response.add_headers({ 'x-ms-request-id': 'str', 'x-ms-correlation-request-id': 'str', }) return client_raw_response
def delete(self, thumbprint_algorithm, thumbprint, certificate_delete_options=None, custom_headers=None, raw=False, **operation_config): """Deletes a certificate from the specified account. You cannot delete a certificate if a resource (pool or compute node) is using it. Before you can delete a certificate, you must therefore make sure that the certificate is not associated with any existing pools, the certificate is not installed on any compute nodes (even if you remove a certificate from a pool, it is not removed from existing compute nodes in that pool until they restart), and no running tasks depend on the certificate. If you try to delete a certificate that is in use, the deletion fails. The certificate status changes to deleteFailed. You can use Cancel Delete Certificate to set the status back to active if you decide that you want to continue using the certificate. :param thumbprint_algorithm: The algorithm used to derive the thumbprint parameter. This must be sha1. :type thumbprint_algorithm: str :param thumbprint: The thumbprint of the certificate to be deleted. :type thumbprint: str :param certificate_delete_options: Additional parameters for the operation :type certificate_delete_options: :class:`CertificateDeleteOptions <azure.batch.models.CertificateDeleteOptions>` :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<msrest:optionsforoperations>`. :return: None or :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` if raw=true :rtype: None or :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` :raises: :class:`BatchErrorException<azure.batch.models.BatchErrorException>` """ timeout = None if certificate_delete_options is not None: timeout = certificate_delete_options.timeout client_request_id = None if certificate_delete_options is not None: client_request_id = certificate_delete_options.client_request_id return_client_request_id = None if certificate_delete_options is not None: return_client_request_id = certificate_delete_options.return_client_request_id ocp_date = None if certificate_delete_options is not None: ocp_date = certificate_delete_options.ocp_date # Construct URL url = '/certificates(thumbprintAlgorithm={thumbprintAlgorithm},thumbprint={thumbprint})' path_format_arguments = { 'thumbprintAlgorithm': self._serialize.url("thumbprint_algorithm", thumbprint_algorithm, 'str'), 'thumbprint': self._serialize.url("thumbprint", thumbprint, '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') 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') # Construct and send request request = self._client.delete(url, query_parameters) response = self._client.send(request, header_parameters, **operation_config) if response.status_code not in [202]: 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', }) return client_raw_response
def get_digital_twin(self, id, custom_headers=None, raw=False, **operation_config): """Gets a digital twin. :param id: Digital Twin ID. :type id: 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<msrest:optionsforoperations>`. :return: object or ClientRawResponse if raw=true :rtype: object or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>` """ # Construct URL url = self.get_digital_twin.metadata['url'] path_format_arguments = {'id': self._serialize.url("id", 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') # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' 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, header_parameters) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) exp.request_id = response.headers.get('x-ms-request-id') raise exp deserialized = None header_dict = {} if response.status_code == 200: deserialized = self._deserialize('object', response) header_dict = { 'ETag': 'str', } if raw: client_raw_response = ClientRawResponse(deserialized, response) client_raw_response.add_headers(header_dict) return client_raw_response return deserialized
def get(self, thumbprint_algorithm, thumbprint, certificate_get_options=None, custom_headers=None, raw=False, **operation_config): """Gets information about the specified certificate. :param thumbprint_algorithm: The algorithm used to derive the thumbprint parameter. This must be sha1. :type thumbprint_algorithm: str :param thumbprint: The thumbprint of the certificate to get. :type thumbprint: str :param certificate_get_options: Additional parameters for the operation :type certificate_get_options: :class:`CertificateGetOptions <azure.batch.models.CertificateGetOptions>` :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<msrest:optionsforoperations>`. :return: :class:`Certificate <azure.batch.models.Certificate>` or :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` if raw=true :rtype: :class:`Certificate <azure.batch.models.Certificate>` or :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` :raises: :class:`BatchErrorException<azure.batch.models.BatchErrorException>` """ select = None if certificate_get_options is not None: select = certificate_get_options.select timeout = None if certificate_get_options is not None: timeout = certificate_get_options.timeout client_request_id = None if certificate_get_options is not None: client_request_id = certificate_get_options.client_request_id return_client_request_id = None if certificate_get_options is not None: return_client_request_id = certificate_get_options.return_client_request_id ocp_date = None if certificate_get_options is not None: ocp_date = certificate_get_options.ocp_date # Construct URL url = '/certificates(thumbprintAlgorithm={thumbprintAlgorithm},thumbprint={thumbprint})' path_format_arguments = { 'thumbprintAlgorithm': self._serialize.url("thumbprint_algorithm", thumbprint_algorithm, 'str'), 'thumbprint': self._serialize.url("thumbprint", thumbprint, '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') if select is not None: query_parameters['$select'] = self._serialize.query( "select", select, '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') # 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.BatchErrorException(self._deserialize, response) deserialized = None header_dict = {} if response.status_code == 200: deserialized = self._deserialize('Certificate', response) header_dict = { 'client-request-id': 'str', 'request-id': 'str', 'ETag': 'str', 'Last-Modified': 'rfc-1123', } if raw: client_raw_response = ClientRawResponse(deserialized, response) client_raw_response.add_headers(header_dict) return client_raw_response return deserialized
def get_check(self, app_id, text, language_id, app_version=None, descriptors0_name=None, descriptors0_value=None, descriptors1_name=None, descriptors1_value=None, language_ux_id=None, run_on_profile_id=None, length=None, start=None, request_id=None, text_unit=None, custom_headers=None, raw=False, **operation_config): """Check text not previously tagged; can provide better suggestions (CloudSuggest). Documented for the sake of completeness. Using the GET method is not recommended as it is very cumbersome to describe arrays of complex objects such as Descriptors or CliengSuggestions in the query string. . :param app_id: Id of the calling app, the supported ones are the following: * LinkedIn * NLServiceTestAutomation - Id used by automated tests * OAM - Id used by the probes * OneNote_Online, PowerPoint_Online, Word_Online - WAC * Testing_Client - Use for testing and prototyping . Possible values include: 'LinkedIn', 'NLServiceTestAutomation', 'OAM', 'OneNote_Online', 'Testing_Client', 'PowerPoint_Online', 'Word_Online' :type app_id: str :param text: Text to be checked. :type text: str :param language_id: :type language_id: str :param app_version: Version of the calling application. :type app_version: str :param descriptors0_name: Name of descriptor at index 0. :type descriptors0_name: str :param descriptors0_value: Value of descriptor at index 0. :type descriptors0_value: str :param descriptors1_name: Name of descriptor at index 1. :type descriptors1_name: str :param descriptors1_value: Value of descriptor at index 1. :type descriptors1_value: str :param language_ux_id: User current UX language ISO ID. Example: fr-fr for French (France) Default: the LanguageId (Not supported yet!)." :type language_ux_id: str :param run_on_profile_id: Profile ID assigned by NLX team. The default is the one selected for the specified AppID. Contact NLX team for more details. :type run_on_profile_id: str :param length: Length of the text to be checked. Default: The entire content of Text. :type length: int :param start: Init index for the text to be checked. :type start: int :param request_id: Unique call identifier generated by the caller. Deprecated - use X-CorrelationId instead. :type request_id: str :param text_unit: Unit(s) of text flags: * Default = 0x0000, // Default value * Word = 0x0001, // Unigram * Phrase = 0x0002, // 7-gram * Sentence = 0x0004, // Linguistically accurate sentence * Paragraph = 0x0008, // Text terminated by paragraph marker(s) * Page = 0x0010, // A visible page, slide, equivalent unit. * Section = 0x0020, // Section of document/presentation * Chapter = 0x0040, // Chapter if such a concept exists in model * Document = 0x0100, // Full document contents. * RawChars = 0x4000, // Special purpose for scenarios that need raw content access . Possible values include: 'Default', 'Word', 'Phrase', 'Sentence', 'Paragraph', 'Page', 'Section', 'Chapter', 'Document', 'RawChars' :type text_unit: 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<msrest:optionsforoperations>`. :return: CheckResponseV1 or ClientRawResponse if raw=true :rtype: ~microsoft.swagger.codegen.editorservice.models.CheckResponseV1 or ~msrest.pipeline.ClientRawResponse :raises: :class:`HttpOperationError<msrest.exceptions.HttpOperationError>` """ # Construct URL url = self.get_check.metadata['url'] # Construct parameters query_parameters = {} query_parameters['AppId'] = self._serialize.query( "app_id", app_id, 'str') query_parameters['Text'] = self._serialize.query("text", text, 'str') query_parameters['LanguageId'] = self._serialize.query( "language_id", language_id, 'str') if app_version is not None: query_parameters['AppVersion'] = self._serialize.query( "app_version", app_version, 'str') if descriptors0_name is not None: query_parameters['Descriptors[0].Name'] = self._serialize.query( "descriptors0_name", descriptors0_name, 'str') if descriptors0_value is not None: query_parameters['Descriptors[0].Value'] = self._serialize.query( "descriptors0_value", descriptors0_value, 'str') if descriptors1_name is not None: query_parameters['Descriptors[1].Name'] = self._serialize.query( "descriptors1_name", descriptors1_name, 'str') if descriptors1_value is not None: query_parameters['Descriptors[1].Value'] = self._serialize.query( "descriptors1_value", descriptors1_value, 'str') if language_ux_id is not None: query_parameters['LanguageUXId'] = self._serialize.query( "language_ux_id", language_ux_id, 'str') if run_on_profile_id is not None: query_parameters['RunOnProfileId'] = self._serialize.query( "run_on_profile_id", run_on_profile_id, 'str') if length is not None: query_parameters['Length'] = self._serialize.query( "length", length, 'int') if start is not None: query_parameters['Start'] = self._serialize.query( "start", start, 'int') if request_id is not None: query_parameters['RequestId'] = self._serialize.query( "request_id", request_id, 'str') if text_unit is not None: query_parameters['TextUnit'] = self._serialize.query( "text_unit", text_unit, 'str') # Construct headers header_parameters = {} header_parameters['Content-Type'] = 'application/json; charset=utf-8' if custom_headers: header_parameters.update(custom_headers) if self.config.x_correlation_id is not None: header_parameters['X-CorrelationId'] = self._serialize.header( "self.config.x_correlation_id", self.config.x_correlation_id, 'str') if self.config.x_user_session_id is not None: header_parameters['X-UserSessionId'] = self._serialize.header( "self.config.x_user_session_id", self.config.x_user_session_id, 'str') if self.config.x_user_id is not None: header_parameters['X-UserId'] = self._serialize.header( "self.config.x_user_id", self.config.x_user_id, 'str') # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200, 400, 500]: raise HttpOperationError(self._deserialize, response) deserialized = None header_dict = {} if response.status_code == 200: deserialized = self._deserialize('CheckResponseV1', response) header_dict = { 'X-CorrelationId': 'str', } if raw: client_raw_response = ClientRawResponse(deserialized, response) client_raw_response.add_headers(header_dict) return client_raw_response return deserialized
def add( self, job_id, task, task_add_options=None, custom_headers=None, raw=False, **operation_config): """Adds a Task to the specified Job. The maximum lifetime of a Task from addition to completion is 180 days. If a Task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time. :param job_id: The ID of the Job to which the Task is to be added. :type job_id: str :param task: The Task to be added. :type task: ~azure.batch.models.TaskAddParameter :param task_add_options: Additional parameters for the operation :type task_add_options: ~azure.batch.models.TaskAddOptions :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<msrest:optionsforoperations>`. :return: None or ClientRawResponse if raw=true :rtype: None or ~msrest.pipeline.ClientRawResponse :raises: :class:`BatchErrorException<azure.batch.models.BatchErrorException>` """ timeout = None if task_add_options is not None: timeout = task_add_options.timeout client_request_id = None if task_add_options is not None: client_request_id = task_add_options.client_request_id return_client_request_id = None if task_add_options is not None: return_client_request_id = task_add_options.return_client_request_id ocp_date = None if task_add_options is not None: ocp_date = task_add_options.ocp_date # Construct URL url = self.add.metadata['url'] path_format_arguments = { 'batchUrl': self._serialize.url("self.config.batch_url", self.config.batch_url, 'str', skip_quote=True), 'jobId': self._serialize.url("job_id", job_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') 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') # Construct body body_content = self._serialize.body(task, 'TaskAddParameter') # Construct and send request request = self._client.post(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [201]: 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
def config_v2(self, body, custom_headers=None, raw=False, **operation_config): """Fetch all the available critique types for a particular language and Profile ID. This API is designed to fetch all the available critique types for a particular language and Profile ID and some factors defined in the Descriptors (i.e. haveSubscriptionLicense, audience). * The Config API only supports fetching the information for only one language at a time. If it is required to pre-fetch critique type information for multiple languages, it is recommended to send multiple calls in parallel. * All Available critique type values are inherited from Win32 Grammar&More writing styles. Please contact us to modify the default behaviors. ### Scenarios * Whenever the client wants to draw the proofing option dialog, where the customer can turn on/off critique types, the Config API would be called to fetch all the required info to draw the dialog. * Once the customer changes the proofing language from one to another, another Config API would be required for the new language, if it is not pre-fetched and cached. . :param body: Config API request V2 :type body: ~microsoft.swagger.codegen.editorservice.models.ConfigRequestV2 :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<msrest:optionsforoperations>`. :return: ConfigResponseV2 or ClientRawResponse if raw=true :rtype: ~microsoft.swagger.codegen.editorservice.models.ConfigResponseV2 or ~msrest.pipeline.ClientRawResponse :raises: :class:`HttpOperationError<msrest.exceptions.HttpOperationError>` """ # Construct URL url = self.config_v2.metadata['url'] # Construct parameters query_parameters = {} # Construct headers header_parameters = {} header_parameters['Content-Type'] = 'application/json; charset=utf-8' if custom_headers: header_parameters.update(custom_headers) if self.config.x_correlation_id is not None: header_parameters['X-CorrelationId'] = self._serialize.header( "self.config.x_correlation_id", self.config.x_correlation_id, 'str') if self.config.x_user_session_id is not None: header_parameters['X-UserSessionId'] = self._serialize.header( "self.config.x_user_session_id", self.config.x_user_session_id, 'str') if self.config.x_user_id is not None: header_parameters['X-UserId'] = self._serialize.header( "self.config.x_user_id", self.config.x_user_id, 'str') # Construct body body_content = self._serialize.body(body, 'ConfigRequestV2') # Construct and send request request = self._client.post(url, query_parameters) response = self._client.send(request, header_parameters, body_content, stream=False, **operation_config) if response.status_code not in [200, 400, 500]: raise HttpOperationError(self._deserialize, response) deserialized = None header_dict = {} if response.status_code == 200: deserialized = self._deserialize('ConfigResponseV2', response) header_dict = { 'X-CorrelationId': 'str', } if raw: client_raw_response = ClientRawResponse(deserialized, response) client_raw_response.add_headers(header_dict) return client_raw_response return deserialized
def update( self, job_id, task_id, constraints=None, task_update_options=None, custom_headers=None, raw=False, **operation_config): """Updates the properties of the specified Task. :param job_id: The ID of the Job containing the Task. :type job_id: str :param task_id: The ID of the Task to update. :type task_id: str :param constraints: Constraints that apply to this Task. If omitted, the Task is given the default constraints. For multi-instance Tasks, updating the retention time applies only to the primary Task and not subtasks. :type constraints: ~azure.batch.models.TaskConstraints :param task_update_options: Additional parameters for the operation :type task_update_options: ~azure.batch.models.TaskUpdateOptions :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<msrest:optionsforoperations>`. :return: None or ClientRawResponse if raw=true :rtype: None or ~msrest.pipeline.ClientRawResponse :raises: :class:`BatchErrorException<azure.batch.models.BatchErrorException>` """ timeout = None if task_update_options is not None: timeout = task_update_options.timeout client_request_id = None if task_update_options is not None: client_request_id = task_update_options.client_request_id return_client_request_id = None if task_update_options is not None: return_client_request_id = task_update_options.return_client_request_id ocp_date = None if task_update_options is not None: ocp_date = task_update_options.ocp_date if_match = None if task_update_options is not None: if_match = task_update_options.if_match if_none_match = None if task_update_options is not None: if_none_match = task_update_options.if_none_match if_modified_since = None if task_update_options is not None: if_modified_since = task_update_options.if_modified_since if_unmodified_since = None if task_update_options is not None: if_unmodified_since = task_update_options.if_unmodified_since task_update_parameter = models.TaskUpdateParameter(constraints=constraints) # Construct URL url = self.update.metadata['url'] path_format_arguments = { 'batchUrl': self._serialize.url("self.config.batch_url", self.config.batch_url, 'str', skip_quote=True), '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.api_version", self.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 body body_content = self._serialize.body(task_update_parameter, 'TaskUpdateParameter') # Construct and send request request = self._client.put(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: 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
def languageinfo(self, body, custom_headers=None, raw=False, **operation_config): """Load the language support for the client given the UX language. Load the language support for the client given the UX language. This API will pass all the info on the language list including the localized strings to render in the UI Example: * French (France) - Post reform * French (France) - Pre reform * French (France) - Both reforms ### Scenarios When initialized/launched, the app makes a service call requesting the list of available language for the current UX language ID, the selected editing language (if only one language is required). Service replies with the info on the supported languages or on the specific language. . :param body: Language Info API request V1 :type body: ~microsoft.swagger.codegen.editorservice.models.LanguageInfoRequestV1 :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<msrest:optionsforoperations>`. :return: LanguageInfoResponseV1 or ClientRawResponse if raw=true :rtype: ~microsoft.swagger.codegen.editorservice.models.LanguageInfoResponseV1 or ~msrest.pipeline.ClientRawResponse :raises: :class:`HttpOperationError<msrest.exceptions.HttpOperationError>` """ # Construct URL url = self.languageinfo.metadata['url'] # Construct parameters query_parameters = {} # Construct headers header_parameters = {} header_parameters['Content-Type'] = 'application/json; charset=utf-8' if custom_headers: header_parameters.update(custom_headers) if self.config.x_correlation_id is not None: header_parameters['X-CorrelationId'] = self._serialize.header( "self.config.x_correlation_id", self.config.x_correlation_id, 'str') if self.config.x_user_session_id is not None: header_parameters['X-UserSessionId'] = self._serialize.header( "self.config.x_user_session_id", self.config.x_user_session_id, 'str') if self.config.x_user_id is not None: header_parameters['X-UserId'] = self._serialize.header( "self.config.x_user_id", self.config.x_user_id, 'str') # Construct body body_content = self._serialize.body(body, 'LanguageInfoRequestV1') # Construct and send request request = self._client.post(url, query_parameters) response = self._client.send(request, header_parameters, body_content, stream=False, **operation_config) if response.status_code not in [200, 400, 500]: raise HttpOperationError(self._deserialize, response) deserialized = None header_dict = {} if response.status_code == 200: deserialized = self._deserialize('LanguageInfoResponseV1', response) header_dict = { 'X-CorrelationId': 'str', } if raw: client_raw_response = ClientRawResponse(deserialized, response) client_raw_response.add_headers(header_dict) return client_raw_response return deserialized
def terminate( self, job_id, task_id, task_terminate_options=None, custom_headers=None, raw=False, **operation_config): """Terminates the specified Task. When the Task has been terminated, it moves to the completed state. For multi-instance Tasks, the terminate Task operation applies synchronously to the primary task; subtasks are then terminated asynchronously in the background. :param job_id: The ID of the Job containing the Task. :type job_id: str :param task_id: The ID of the Task to terminate. :type task_id: str :param task_terminate_options: Additional parameters for the operation :type task_terminate_options: ~azure.batch.models.TaskTerminateOptions :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<msrest:optionsforoperations>`. :return: None or ClientRawResponse if raw=true :rtype: None or ~msrest.pipeline.ClientRawResponse :raises: :class:`BatchErrorException<azure.batch.models.BatchErrorException>` """ timeout = None if task_terminate_options is not None: timeout = task_terminate_options.timeout client_request_id = None if task_terminate_options is not None: client_request_id = task_terminate_options.client_request_id return_client_request_id = None if task_terminate_options is not None: return_client_request_id = task_terminate_options.return_client_request_id ocp_date = None if task_terminate_options is not None: ocp_date = task_terminate_options.ocp_date if_match = None if task_terminate_options is not None: if_match = task_terminate_options.if_match if_none_match = None if task_terminate_options is not None: if_none_match = task_terminate_options.if_none_match if_modified_since = None if task_terminate_options is not None: if_modified_since = task_terminate_options.if_modified_since if_unmodified_since = None if task_terminate_options is not None: if_unmodified_since = task_terminate_options.if_unmodified_since # Construct URL url = self.terminate.metadata['url'] path_format_arguments = { 'batchUrl': self._serialize.url("self.config.batch_url", self.config.batch_url, 'str', skip_quote=True), '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.api_version", self.api_version, 'str') if timeout is not None: query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int') # Construct headers header_parameters = {} 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, header_parameters) response = self._client.send(request, stream=False, **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
def get(self, application_id, application_get_options=None, custom_headers=None, raw=False, **operation_config): """Gets information about the specified application. This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. :param application_id: The ID of the application. :type application_id: str :param application_get_options: Additional parameters for the operation :type application_get_options: ~azure.batch.models.ApplicationGetOptions :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<msrest:optionsforoperations>`. :return: ApplicationSummary or ClientRawResponse if raw=true :rtype: ~azure.batch.models.ApplicationSummary or ~msrest.pipeline.ClientRawResponse :raises: :class:`BatchErrorException<azure.batch.models.BatchErrorException>` """ timeout = None if application_get_options is not None: timeout = application_get_options.timeout client_request_id = None if application_get_options is not None: client_request_id = application_get_options.client_request_id return_client_request_id = None if application_get_options is not None: return_client_request_id = application_get_options.return_client_request_id ocp_date = None if application_get_options is not None: ocp_date = application_get_options.ocp_date # Construct URL url = self.get.metadata['url'] path_format_arguments = { 'applicationId': self._serialize.url("application_id", application_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') if timeout is not None: query_parameters['timeout'] = self._serialize.query( "timeout", timeout, 'int') # Construct headers header_parameters = {} header_parameters['Content-Type'] = 'application/json; 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') # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: raise models.BatchErrorException(self._deserialize, response) deserialized = None header_dict = {} if response.status_code == 200: deserialized = self._deserialize('ApplicationSummary', response) header_dict = { 'client-request-id': 'str', 'request-id': 'str', 'ETag': 'str', 'Last-Modified': 'rfc-1123', } if raw: client_raw_response = ClientRawResponse(deserialized, response) client_raw_response.add_headers(header_dict) return client_raw_response return deserialized
def get_from_task( self, job_id, task_id, file_name, file_get_from_task_options=None, custom_headers=None, raw=False, callback=None, **operation_config): """Returns the content of the specified task file. :param job_id: The id of the job that contains the task. :type job_id: str :param task_id: The id of the task whose file you want to retrieve. :type task_id: str :param file_name: The path to the task file that you want to get the content of. :type file_name: str :param file_get_from_task_options: Additional parameters for the operation :type file_get_from_task_options: :class:`FileGetFromTaskOptions <azure.batch.models.FileGetFromTaskOptions>` :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param callback: When specified, will be called with each chunk of data that is streamed. The callback should take two arguments, the bytes of the current chunk of data and the response object. If the data is uploading, response will be None. :type callback: Callable[Bytes, response=None] :param operation_config: :ref:`Operation configuration overrides<msrest:optionsforoperations>`. :rtype: Generator :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` if raw=true """ timeout = None if file_get_from_task_options is not None: timeout = file_get_from_task_options.timeout client_request_id = None if file_get_from_task_options is not None: client_request_id = file_get_from_task_options.client_request_id return_client_request_id = None if file_get_from_task_options is not None: return_client_request_id = file_get_from_task_options.return_client_request_id ocp_date = None if file_get_from_task_options is not None: ocp_date = file_get_from_task_options.ocp_date ocp_range = None if file_get_from_task_options is not None: ocp_range = file_get_from_task_options.ocp_range if_modified_since = None if file_get_from_task_options is not None: if_modified_since = file_get_from_task_options.if_modified_since if_unmodified_since = None if file_get_from_task_options is not None: if_unmodified_since = file_get_from_task_options.if_unmodified_since # Construct URL url = '/jobs/{jobId}/tasks/{taskId}/files/{fileName}' path_format_arguments = { 'jobId': self._serialize.url("job_id", job_id, 'str'), 'taskId': self._serialize.url("task_id", task_id, 'str'), 'fileName': self._serialize.url("file_name", file_name, '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 ocp_range is not None: header_parameters['ocp-range'] = self._serialize.header("ocp_range", ocp_range, '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.get(url, query_parameters) response = self._client.send(request, header_parameters, **operation_config) if response.status_code not in [200]: raise models.BatchErrorException(self._deserialize, response) deserialized = None header_dict = {} if response.status_code == 200: deserialized = self._client.stream_download(response, callback) header_dict = { 'client-request-id': 'str', 'request-id': 'str', 'ETag': 'str', 'Last-Modified': 'rfc-1123', 'ocp-creation-time': 'rfc-1123', 'ocp-batch-file-isdirectory': 'bool', 'ocp-batch-file-url': 'str', 'ocp-batch-file-mode': 'str', 'Content-Type': 'str', 'Content-Length': 'long', } if raw: client_raw_response = ClientRawResponse(deserialized, response) client_raw_response.add_headers(header_dict) return client_raw_response return deserialized
def stop_resize( self, resource_group_name, account_name, pool_name, custom_headers=None, raw=False, **operation_config): """Stops an ongoing resize operation on the pool. This does not restore the pool to its previous state before the resize operation: it only stops any further changes being made, and the pool maintains its current state. After stopping, the pool stabilizes at the number of nodes it was at when the stop operation was done. During the stop operation, the pool allocation state changes first to stopping and then to steady. A resize operation need not be an explicit resize pool request; this API can also be used to halt the initial sizing of the pool when it is created. :param resource_group_name: The name of the resource group that contains the Batch account. :type resource_group_name: str :param account_name: The name of the Batch account. :type account_name: str :param pool_name: The pool name. This must be unique within the account. :type pool_name: 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<msrest:optionsforoperations>`. :return: Pool or ClientRawResponse if raw=true :rtype: ~azure.mgmt.batch.models.Pool or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>` """ # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}/stopResize' path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[-\w\._]+$'), 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_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') # 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.post(url, query_parameters) response = self._client.send(request, header_parameters, **operation_config) if response.status_code not in [200]: exp = CloudError(response) exp.request_id = response.headers.get('x-ms-request-id') raise exp deserialized = None header_dict = {} if response.status_code == 200: deserialized = self._deserialize('Pool', response) header_dict = { 'ETag': 'str', } if raw: client_raw_response = ClientRawResponse(deserialized, response) client_raw_response.add_headers(header_dict) return client_raw_response return deserialized
def get_node_file_properties_from_compute_node( self, pool_id, node_id, file_name, file_get_node_file_properties_from_compute_node_options=None, custom_headers=None, raw=False, **operation_config): """Gets the properties of the specified compute node file. :param pool_id: The id of the pool that contains the compute node. :type pool_id: str :param node_id: The id of the compute node that contains the file. :type node_id: str :param file_name: The path to the compute node file that you want to get the properties of. :type file_name: str :param file_get_node_file_properties_from_compute_node_options: Additional parameters for the operation :type file_get_node_file_properties_from_compute_node_options: :class:`FileGetNodeFilePropertiesFromComputeNodeOptions <azure.batch.models.FileGetNodeFilePropertiesFromComputeNodeOptions>` :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<msrest:optionsforoperations>`. :rtype: None :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` if raw=true """ timeout = None if file_get_node_file_properties_from_compute_node_options is not None: timeout = file_get_node_file_properties_from_compute_node_options.timeout client_request_id = None if file_get_node_file_properties_from_compute_node_options is not None: client_request_id = file_get_node_file_properties_from_compute_node_options.client_request_id return_client_request_id = None if file_get_node_file_properties_from_compute_node_options is not None: return_client_request_id = file_get_node_file_properties_from_compute_node_options.return_client_request_id ocp_date = None if file_get_node_file_properties_from_compute_node_options is not None: ocp_date = file_get_node_file_properties_from_compute_node_options.ocp_date if_modified_since = None if file_get_node_file_properties_from_compute_node_options is not None: if_modified_since = file_get_node_file_properties_from_compute_node_options.if_modified_since if_unmodified_since = None if file_get_node_file_properties_from_compute_node_options is not None: if_unmodified_since = file_get_node_file_properties_from_compute_node_options.if_unmodified_since # Construct URL url = '/pools/{poolId}/nodes/{nodeId}/files/{fileName}' path_format_arguments = { 'poolId': self._serialize.url("pool_id", pool_id, 'str'), 'nodeId': self._serialize.url("node_id", node_id, 'str'), 'fileName': self._serialize.url("file_name", file_name, '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_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.head(url, query_parameters) response = self._client.send(request, header_parameters, **operation_config) if response.status_code not in [200]: 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', 'ocp-creation-time': 'rfc-1123', 'ocp-batch-file-isdirectory': 'bool', 'ocp-batch-file-url': 'str', 'ocp-batch-file-mode': 'str', 'Content-Type': 'str', 'Content-Length': 'long', }) return client_raw_response
def get_entity_tag(self, resource_group_name, service_name, custom_headers=None, raw=False, **operation_config): """Gets the entity state (Etag) version of the DelegationSettings. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param service_name: The name of the API Management service. :type service_name: 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<msrest:optionsforoperations>`. :return: None or ClientRawResponse if raw=true :rtype: None or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException<azure.mgmt.apimanagement.models.ErrorResponseException>` """ # Construct URL url = self.get_entity_tag.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url( "service_name", service_name, 'str', max_length=50, min_length=1, pattern=r'^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$'), 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_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') # Construct headers header_parameters = {} 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.head(url, query_parameters, header_parameters) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) if raw: client_raw_response = ClientRawResponse(None, response) client_raw_response.add_headers({ 'ETag': 'str', }) return client_raw_response