_id
stringlengths
2
7
title
stringlengths
1
88
partition
stringclasses
3 values
text
stringlengths
31
13.1k
language
stringclasses
1 value
meta_information
dict
q267500
SqlDatabaseManagementService.update_database
test
def update_database(self, server_name, name, new_database_name=None, service_objective_id=None, edition=None, max_size_bytes=None): ''' Updates existing database details. server_name: Name of the server to contain the new database. name: Required. The name for the new database. See Naming Requirements in Azure SQL Database General Guidelines and Limitations and Database Identifiers for more information. new_database_name: Optional. The new name for the new database. service_objective_id: Optional. The new service level to apply to the database. For more information about service levels, see Azure SQL Database Service Tiers and Performance Levels. Use List Service Level Objectives to get the correct ID for the desired service objective. edition: Optional. The new edition for the new database. max_size_bytes: Optional. The new size of the database in
python
{ "resource": "" }
q267501
SqlDatabaseManagementService.delete_database
test
def delete_database(self, server_name, name): ''' Deletes an Azure SQL Database. server_name: Name of the
python
{ "resource": "" }
q267502
SqlDatabaseManagementService.list_databases
test
def list_databases(self, name): ''' List the SQL databases defined on the specified server name ''' response = self._perform_get(self._get_list_databases_path(name),
python
{ "resource": "" }
q267503
TopLevelDomainsOperations.list_agreements
test
def list_agreements( self, name, include_privacy=None, for_transfer=None, custom_headers=None, raw=False, **operation_config): """Gets all legal agreements that user needs to accept before purchasing a domain. Gets all legal agreements that user needs to accept before purchasing a domain. :param name: Name of the top-level domain. :type name: str :param include_privacy: If <code>true</code>, then the list of agreements will include agreements for domain privacy as well; otherwise, <code>false</code>. :type include_privacy: bool :param for_transfer: If <code>true</code>, then the list of agreements will include agreements for domain transfer as well; otherwise, <code>false</code>. :type for_transfer: 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: An iterator like instance of TldLegalAgreement :rtype: ~azure.mgmt.web.models.TldLegalAgreementPaged[~azure.mgmt.web.models.TldLegalAgreement] :raises: :class:`DefaultErrorResponseException<azure.mgmt.web.models.DefaultErrorResponseException>` """ agreement_option = models.TopLevelDomainAgreementOption(include_privacy=include_privacy, for_transfer=for_transfer) def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL url = self.list_agreements.metadata['url'] path_format_arguments = { 'name': self._serialize.url("name", 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') else: url = next_link query_parameters = {}
python
{ "resource": "" }
q267504
BaseHandler.close
test
async def close(self, exception=None): """Close down the handler connection. If the handler has already closed, this operation will do nothing. An optional exception can be passed in to indicate that the handler was shutdown due to error. It is recommended to open a handler within a context manager as opposed to calling the method directly. .. note:: This operation is not thread-safe. :param exception: An optional exception if the handler is closing due to an error.
python
{ "resource": "" }
q267505
Receiver.close
test
async def close(self, exception=None): """Close down the receiver connection. If the receiver has already closed, this operation will do nothing. An optional exception can be passed in to indicate that the handler was shutdown due to error. It is recommended to open a handler within a context manager as opposed to calling the method directly. The receiver will be implicitly closed on completion of the message iterator, however this method will need to be called explicitly if the message iterator is not run to completion. .. note:: This operation is not thread-safe. :param exception: An optional exception if the handler is closing due to an error. :type exception: Exception
python
{ "resource": "" }
q267506
SessionReceiver.get_session_state
test
async def get_session_state(self): """Get the session state. Returns None if no state has been set. :rtype: str Example: .. literalinclude:: ../examples/async_examples/test_examples_async.py :start-after: [START set_session_state] :end-before: [END set_session_state] :language: python :dedent: 4 :caption: Getting and setting the state of a session. """ await self._can_run() response
python
{ "resource": "" }
q267507
SessionReceiver.set_session_state
test
async def set_session_state(self, state): """Set the session state. :param state: The state value. :type state: str or bytes or bytearray Example: .. literalinclude:: ../examples/async_examples/test_examples_async.py :start-after: [START set_session_state] :end-before: [END set_session_state] :language: python :dedent: 4 :caption: Getting and setting the state of a session. """
python
{ "resource": "" }
q267508
SessionReceiver.receive_deferred_messages
test
async def receive_deferred_messages(self, sequence_numbers, mode=ReceiveSettleMode.PeekLock): """Receive messages that have previously been deferred. This operation can only receive deferred messages from the current session. When receiving deferred messages from a partitioned entity, all of the supplied sequence numbers must be messages from the same partition. :param sequence_numbers: A list of the sequence numbers of messages that have been deferred. :type sequence_numbers: list[int] :param mode: The receive mode, default value is PeekLock. :type mode: ~azure.servicebus.common.constants.ReceiveSettleMode :rtype: list[~azure.servicebus.aio.async_message.DeferredMessage] Example: .. literalinclude:: ../examples/async_examples/test_examples_async.py :start-after: [START receiver_defer_session_messages] :end-before: [END receiver_defer_session_messages] :language: python :dedent: 8 :caption: Defer messages, then retrieve them by sequence number. """ if not sequence_numbers: raise ValueError("At least one sequence number must be specified.")
python
{ "resource": "" }
q267509
ReservationOperations.merge
test
def merge( self, reservation_order_id, sources=None, custom_headers=None, raw=False, polling=True, **operation_config): """Merges two `Reservation`s. Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged must have same properties. :param reservation_order_id: Order Id of the reservation :type reservation_order_id: str :param sources: Format of the resource id should be /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} :type sources: list[str] :param dict custom_headers: headers that will be added to the request :param bool raw: The poller return type is ClientRawResponse, the direct response alongside the deserialized response :param polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :return: An instance of LROPoller that returns list or ClientRawResponse<list> if raw==True :rtype: ~msrestazure.azure_operation.AzureOperationPoller[list[~azure.mgmt.reservations.models.ReservationResponse]] or ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[list[~azure.mgmt.reservations.models.ReservationResponse]]] :raises: :class:`ErrorException<azure.mgmt.reservations.models.ErrorException>` """ raw_result = self._merge_initial( reservation_order_id=reservation_order_id, sources=sources, custom_headers=custom_headers,
python
{ "resource": "" }
q267510
HttpBearerChallenge._validate_challenge
test
def _validate_challenge(self, challenge): """ Verifies that the challenge is a Bearer challenge and returns the key=value pairs. """ bearer_string = 'Bearer ' if not challenge: raise ValueError('Challenge cannot be empty') challenge = challenge.strip()
python
{ "resource": "" }
q267511
WorkspacesOperations.purge
test
def purge( self, resource_group_name, workspace_name, table, filters, custom_headers=None, raw=False, polling=True, **operation_config): """Purges data in an Log Analytics workspace by a set of user-defined filters. :param resource_group_name: The name of the resource group to get. The name is case insensitive. :type resource_group_name: str :param workspace_name: Log Analytics workspace name :type workspace_name: str :param table: Table from which to purge data. :type table: str :param filters: The set of columns and filters (queries) to run over them to purge the resulting data. :type filters: list[~azure.mgmt.loganalytics.models.WorkspacePurgeBodyFilters] :param dict custom_headers: headers that will be added to the request :param bool raw: The poller return type is ClientRawResponse, the direct response alongside the deserialized response :param polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :return: An instance of LROPoller that returns object or ClientRawResponse<object> if raw==True :rtype: ~msrestazure.azure_operation.AzureOperationPoller[object] or ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[object]] :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>` """ raw_result = self._purge_initial( resource_group_name=resource_group_name, workspace_name=workspace_name, table=table,
python
{ "resource": "" }
q267512
_error_handler
test
def _error_handler(error): """Handle connection and service errors. Called internally when an event has failed to send so we can parse the error to determine whether we should attempt to retry sending the event again. Returns the action to take according to error type. :param error: The error received in the send attempt. :type error: Exception :rtype: ~uamqp.errors.ErrorAction """ if error.condition == b'com.microsoft:server-busy': return errors.ErrorAction(retry=True, backoff=4) if error.condition == b'com.microsoft:timeout':
python
{ "resource": "" }
q267513
ServiceBusService.create_queue
test
def create_queue(self, queue_name, queue=None, fail_on_exist=False): ''' Creates a new queue. Once created, this queue's resource manifest is immutable. queue_name: Name of the queue to create. queue: Queue object to create. fail_on_exist: Specify whether to throw an exception when the queue exists. ''' _validate_not_none('queue_name', queue_name) request = HTTPRequest() request.method = 'PUT' request.host = self._get_host() request.path = '/' + _str(queue_name) + '' request.body = _get_request_body(_convert_queue_to_xml(queue)) request.path, request.query = self._httpclient._update_request_uri_query(request) # pylint: disable=protected-access request.headers
python
{ "resource": "" }
q267514
ServiceBusService.delete_queue
test
def delete_queue(self, queue_name, fail_not_exist=False): ''' Deletes an existing queue. This operation will also remove all associated state including messages in the queue. queue_name: Name of the queue to delete. fail_not_exist: Specify whether to throw an exception if the queue doesn't exist. ''' _validate_not_none('queue_name', queue_name) request = HTTPRequest()
python
{ "resource": "" }
q267515
ServiceBusService.get_queue
test
def get_queue(self, queue_name): ''' Retrieves an existing queue. queue_name: Name of the queue. ''' _validate_not_none('queue_name', queue_name) request = HTTPRequest() request.method = 'GET' request.host = self._get_host() request.path = '/' + _str(queue_name) + '' request.path, request.query
python
{ "resource": "" }
q267516
ServiceBusService.create_topic
test
def create_topic(self, topic_name, topic=None, fail_on_exist=False): ''' Creates a new topic. Once created, this topic resource manifest is immutable. topic_name: Name of the topic to create. topic: Topic object to create. fail_on_exist: Specify whether to throw an exception when the topic exists. ''' _validate_not_none('topic_name', topic_name) request = HTTPRequest() request.method = 'PUT' request.host = self._get_host() request.path = '/' + _str(topic_name) + '' request.body = _get_request_body(_convert_topic_to_xml(topic)) request.path, request.query = self._httpclient._update_request_uri_query(request) # pylint: disable=protected-access request.headers
python
{ "resource": "" }
q267517
ServiceBusService.get_topic
test
def get_topic(self, topic_name): ''' Retrieves the description for the specified topic. topic_name: Name of the topic. ''' _validate_not_none('topic_name', topic_name) request = HTTPRequest() request.method = 'GET' request.host = self._get_host() request.path = '/' + _str(topic_name) + ''
python
{ "resource": "" }
q267518
ServiceBusService.create_rule
test
def create_rule(self, topic_name, subscription_name, rule_name, rule=None, fail_on_exist=False): ''' Creates a new rule. Once created, this rule's resource manifest is immutable. topic_name: Name of the topic. subscription_name: Name of the subscription. rule_name: Name of the rule. fail_on_exist: Specify whether to throw an exception when the rule exists. ''' _validate_not_none('topic_name', topic_name) _validate_not_none('subscription_name', subscription_name) _validate_not_none('rule_name', rule_name) request = HTTPRequest() request.method = 'PUT' request.host = self._get_host() request.path = '/' + _str(topic_name) + '/subscriptions/' + \ _str(subscription_name)
python
{ "resource": "" }
q267519
ServiceBusService.get_rule
test
def get_rule(self, topic_name, subscription_name, rule_name): ''' Retrieves the description for the specified rule. topic_name: Name of the topic. subscription_name: Name of the subscription. rule_name: Name of the rule. ''' _validate_not_none('topic_name', topic_name) _validate_not_none('subscription_name', subscription_name) _validate_not_none('rule_name', rule_name) request = HTTPRequest() request.method = 'GET' request.host = self._get_host() request.path = '/' + _str(topic_name) + '/subscriptions/' + \ _str(subscription_name)
python
{ "resource": "" }
q267520
ServiceBusService.list_rules
test
def list_rules(self, topic_name, subscription_name): ''' Retrieves the rules that exist under the specified subscription. topic_name: Name of the topic. subscription_name: Name of the subscription. ''' _validate_not_none('topic_name', topic_name) _validate_not_none('subscription_name', subscription_name) request = HTTPRequest() request.method = 'GET' request.host = self._get_host() request.path = '/' + \ _str(topic_name) + '/subscriptions/' + \ _str(subscription_name) + '/rules/'
python
{ "resource": "" }
q267521
ServiceBusService.create_subscription
test
def create_subscription(self, topic_name, subscription_name, subscription=None, fail_on_exist=False): ''' Creates a new subscription. Once created, this subscription resource manifest is immutable. topic_name: Name of the topic. subscription_name: Name of the subscription. fail_on_exist: Specify whether throw exception when subscription exists. ''' _validate_not_none('topic_name', topic_name) _validate_not_none('subscription_name', subscription_name) request = HTTPRequest() request.method = 'PUT' request.host = self._get_host() request.path = '/' + \ _str(topic_name) + '/subscriptions/' + _str(subscription_name) + ''
python
{ "resource": "" }
q267522
ServiceBusService.get_subscription
test
def get_subscription(self, topic_name, subscription_name): ''' Gets an existing subscription. topic_name: Name of the topic. subscription_name: Name of the subscription. ''' _validate_not_none('topic_name', topic_name) _validate_not_none('subscription_name', subscription_name) request = HTTPRequest() request.method = 'GET' request.host = self._get_host() request.path = '/' + \ _str(topic_name) + '/subscriptions/' + _str(subscription_name) + ''
python
{ "resource": "" }
q267523
ServiceBusService.list_subscriptions
test
def list_subscriptions(self, topic_name): ''' Retrieves the subscriptions in the specified topic. topic_name: Name of the topic. ''' _validate_not_none('topic_name', topic_name) request = HTTPRequest() request.method = 'GET' request.host = self._get_host() request.path = '/' + _str(topic_name) + '/subscriptions/' request.path, request.query = self._httpclient._update_request_uri_query(request) # pylint: disable=protected-access
python
{ "resource": "" }
q267524
ServiceBusService.send_topic_message
test
def send_topic_message(self, topic_name, message=None): ''' Enqueues a message into the specified topic. The limit to the number of messages which may be present in the topic is governed by the message size in MaxTopicSizeInBytes. If this message causes the topic to exceed its quota, a quota exceeded error is returned and the message will be rejected. topic_name: Name of the topic. message: Message object containing message body and properties. ''' _validate_not_none('topic_name', topic_name) _validate_not_none('message', message) request = HTTPRequest() request.method = 'POST'
python
{ "resource": "" }
q267525
ServiceBusService.unlock_subscription_message
test
def unlock_subscription_message(self, topic_name, subscription_name, sequence_number, lock_token): ''' Unlock a message for processing by other receivers on a given subscription. This operation deletes the lock object, causing the message to be unlocked. A message must have first been locked by a receiver before this operation is called. topic_name: Name of the topic. subscription_name: Name of the subscription. sequence_number: The sequence number of the message to be unlocked as returned in BrokerProperties['SequenceNumber'] by the Peek Message operation.
python
{ "resource": "" }
q267526
ServiceBusService.send_queue_message_batch
test
def send_queue_message_batch(self, queue_name, messages=None): ''' Sends a batch of messages into the specified queue. The limit to the number of messages which may be present in the topic is governed by the message size the MaxTopicSizeInMegaBytes. If this message will cause the queue to exceed its quota, a quota exceeded error is returned and the message will be rejected. queue_name: Name of the queue. messages: List of message objects containing message body and properties. ''' _validate_not_none('queue_name', queue_name) _validate_not_none('messages', messages) request = HTTPRequest() request.method = 'POST' request.host = self._get_host()
python
{ "resource": "" }
q267527
ServiceBusService.unlock_queue_message
test
def unlock_queue_message(self, queue_name, sequence_number, lock_token): ''' Unlocks a message for processing by other receivers on a given queue. This operation deletes the lock object, causing the message to be unlocked. A message must have first been locked by a receiver before this operation is called. queue_name: Name of the queue. sequence_number: The sequence number of the message to be unlocked as returned in BrokerProperties['SequenceNumber'] by the Peek Message operation. lock_token: The ID of the lock as returned by the Peek Message operation in BrokerProperties['LockToken'] ''' _validate_not_none('queue_name', queue_name)
python
{ "resource": "" }
q267528
ServiceBusService.receive_queue_message
test
def receive_queue_message(self, queue_name, peek_lock=True, timeout=60): ''' Receive a message from a queue for processing. queue_name: Name of the queue. peek_lock: Optional. True to retrieve and lock the message. False to read and delete the message. Default is True (lock).
python
{ "resource": "" }
q267529
ServiceBusService.receive_subscription_message
test
def receive_subscription_message(self, topic_name, subscription_name, peek_lock=True, timeout=60): ''' Receive a message from a subscription for processing. topic_name: Name of the topic. subscription_name: Name of the subscription. peek_lock: Optional. True to retrieve and lock the message. False to read and delete the message. Default is True (lock). timeout: Optional. The timeout parameter is expressed in seconds. ''' if peek_lock:
python
{ "resource": "" }
q267530
ServiceBusService.create_event_hub
test
def create_event_hub(self, hub_name, hub=None, fail_on_exist=False): ''' Creates a new Event Hub. hub_name: Name of event hub. hub: Optional. Event hub properties. Instance of EventHub class. hub.message_retention_in_days: Number of days to retain the events for this Event Hub. hub.status: Status of the Event Hub (enabled or disabled). hub.user_metadata: User metadata. hub.partition_count: Number of shards on the Event Hub. fail_on_exist: Specify whether to throw an exception when the event hub exists. ''' _validate_not_none('hub_name', hub_name) request = HTTPRequest() request.method = 'PUT' request.host = self._get_host()
python
{ "resource": "" }
q267531
ServiceBusService.update_event_hub
test
def update_event_hub(self, hub_name, hub=None): ''' Updates an Event Hub. hub_name: Name of event hub. hub: Optional. Event hub properties. Instance of EventHub class. hub.message_retention_in_days: Number of days to retain the events for this Event Hub. ''' _validate_not_none('hub_name', hub_name)
python
{ "resource": "" }
q267532
ServiceBusService.get_event_hub
test
def get_event_hub(self, hub_name): ''' Retrieves an existing event hub. hub_name: Name of the event hub. ''' _validate_not_none('hub_name', hub_name) request = HTTPRequest() request.method = 'GET' request.host = self._get_host() request.path = '/' + _str(hub_name) + '' request.path, request.query
python
{ "resource": "" }
q267533
ServiceBusService.send_event
test
def send_event(self, hub_name, message, device_id=None, broker_properties=None): ''' Sends a new message event to an Event Hub. ''' _validate_not_none('hub_name', hub_name) request = HTTPRequest() request.method = 'POST' request.host = self._get_host() if device_id: request.path = '/{0}/publishers/{1}/messages?api-version=2014-01'.format(hub_name, device_id)
python
{ "resource": "" }
q267534
ServiceBusService._update_service_bus_header
test
def _update_service_bus_header(self, request): ''' Add additional headers for Service Bus. ''' if request.method in ['PUT', 'POST', 'MERGE', 'DELETE']: request.headers.append(('Content-Length', str(len(request.body)))) # if it is not GET or HEAD request, must set content-type. if not request.method in ['GET', 'HEAD']: for name, _ in request.headers: if name.lower() == 'content-type': break
python
{ "resource": "" }
q267535
ServiceBusWrapTokenAuthentication._get_authorization
test
def _get_authorization(self, request, httpclient): ''' return the signed string with token. ''' return 'WRAP access_token="' + \
python
{ "resource": "" }
q267536
ServiceBusWrapTokenAuthentication._token_is_expired
test
def _token_is_expired(self, token): # pylint: disable=no-self-use ''' Check if token expires or not. ''' time_pos_begin = token.find('ExpiresOn=') + len('ExpiresOn=') time_pos_end = token.find('&', time_pos_begin) token_expire_time = int(token[time_pos_begin:time_pos_end])
python
{ "resource": "" }
q267537
ServiceBusWrapTokenAuthentication._get_token
test
def _get_token(self, host, path, httpclient): ''' Returns token for the request. host: the Service Bus service request. path: the Service Bus service request. ''' wrap_scope = 'http://' + host + path + self.issuer + self.account_key # Check whether has unexpired cache, return cached token if it is still # usable. if wrap_scope in _tokens: token = _tokens[wrap_scope] if not self._token_is_expired(token): return token # get token from accessconstrol server request = HTTPRequest() request.protocol_override = 'https' request.host = host.replace('.servicebus.', '-sb.accesscontrol.') request.method = 'POST' request.path = '/WRAPv0.9'
python
{ "resource": "" }
q267538
_HTTPClient._update_request_uri_query
test
def _update_request_uri_query(self, request): '''pulls the query string out of the URI and moves it into the query portion of the request object. If there are already query parameters on the request the parameters in the URI will appear after the existing parameters''' if '?' in request.path: request.path, _, query_string = request.path.partition('?') if query_string: query_params =
python
{ "resource": "" }
q267539
ManagedClustersOperations.reset_service_principal_profile
test
def reset_service_principal_profile( self, resource_group_name, resource_name, client_id, secret=None, custom_headers=None, raw=False, polling=True, **operation_config): """Reset Service Principal Profile of a managed cluster. Update the service principal Profile for a managed cluster. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param resource_name: The name of the managed cluster resource. :type resource_name: str :param client_id: The ID for the service principal. :type client_id: str :param secret: The secret password associated with the service principal in plain text. :type secret: str :param dict custom_headers: headers that will be added to the request :param bool raw: The poller return type is ClientRawResponse, the direct response alongside the deserialized response :param polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :return: An instance of LROPoller that returns None or ClientRawResponse<None> if raw==True :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>` """ raw_result = self._reset_service_principal_profile_initial( resource_group_name=resource_group_name, resource_name=resource_name,
python
{ "resource": "" }
q267540
Message.delete
test
def delete(self): ''' Deletes itself if find queue name or topic name and subscription name. ''' if self._queue_name: self.service_bus_service.delete_queue_message( self._queue_name, self.broker_properties['SequenceNumber'],
python
{ "resource": "" }
q267541
Message.unlock
test
def unlock(self): ''' Unlocks itself if find queue name or topic name and subscription name. ''' if self._queue_name: self.service_bus_service.unlock_queue_message( self._queue_name, self.broker_properties['SequenceNumber'],
python
{ "resource": "" }
q267542
Message.renew_lock
test
def renew_lock(self): ''' Renew lock on itself if find queue name or topic name and subscription name. ''' if self._queue_name: self.service_bus_service.renew_lock_queue_message( self._queue_name, self.broker_properties['SequenceNumber'],
python
{ "resource": "" }
q267543
Message.add_headers
test
def add_headers(self, request): ''' add addtional headers to request for message request.''' # Adds custom properties if self.custom_properties: for name, value in self.custom_properties.items(): request.headers.append((name, self._serialize_escaped_properties_value(value))) # Adds content-type request.headers.append(('Content-Type', self.type))
python
{ "resource": "" }
q267544
Message.as_batch_body
test
def as_batch_body(self): ''' return the current message as expected by batch body format''' if sys.version_info >= (3,) and isinstance(self.body, bytes): # It HAS to be string to be serialized in JSON body = self.body.decode('utf-8') else: # Python 2.7 people handle this themself body = self.body result = {'Body': body} # Adds custom
python
{ "resource": "" }
q267545
ServiceFabricClientAPIs.get_cluster_health
test
def get_cluster_health( self, nodes_health_state_filter=0, applications_health_state_filter=0, events_health_state_filter=0, exclude_health_statistics=False, include_system_application_health_statistics=False, timeout=60, custom_headers=None, raw=False, **operation_config): """Gets the health of a Service Fabric cluster. Use EventsHealthStateFilter to filter the collection of health events reported on the cluster based on the health state. Similarly, use NodesHealthStateFilter and ApplicationsHealthStateFilter to filter the collection of nodes and applications returned based on their aggregated health state. :param nodes_health_state_filter: Allows filtering of the node health state objects returned in the result of cluster health query based on their health state. The possible values for this parameter include integer value of one of the following health states. Only nodes that match the filter are returned. All nodes are used to evaluate the aggregated health state. If not specified, all entries are returned. The state values are flag-based enumeration, so the value could be a combination of these values obtained using bitwise 'OR' operator. For example, if the provided value is 6 then health state of nodes with HealthState value of OK (2) and Warning (4) are returned. - Default - Default value. Matches any HealthState. The value is zero. - None - Filter that doesn't match any HealthState value. Used in order to return no results on a given collection of states. The value is 1. - Ok - Filter that matches input with HealthState value Ok. The value is 2. - Warning - Filter that matches input with HealthState value Warning. The value is 4. - Error - Filter that matches input with HealthState value Error. The value is 8. - All - Filter that matches input with any HealthState value. The value is 65535. :type nodes_health_state_filter: int :param applications_health_state_filter: Allows filtering of the application health state objects returned in the result of cluster health query based on their health state. The possible values for this parameter include integer value obtained from members or bitwise operations on members of HealthStateFilter enumeration. Only applications that match the filter are returned. All applications are used to evaluate the aggregated health state. If not specified, all entries are returned. The state values are flag-based enumeration, so the value could be a combination of these values obtained using bitwise 'OR' operator. For example, if the provided value is 6 then health state of applications with HealthState value of OK (2) and Warning (4) are returned. - Default - Default value. Matches any HealthState. The value is zero. - None - Filter that doesn't match any HealthState value. Used in order to return no results on a given collection of states. The value is 1. - Ok - Filter that matches input with HealthState value Ok. The value is 2. - Warning - Filter that matches input with HealthState value Warning. The value is 4. - Error - Filter that matches input with HealthState value Error. The value is 8. - All - Filter that matches input with any HealthState value. The value is 65535. :type applications_health_state_filter: int :param events_health_state_filter: Allows filtering the collection of HealthEvent objects returned based on health state. The possible values for this parameter include integer value of one of the following health states. Only events that match the filter are returned. All events are used to evaluate the aggregated health state. If not specified, all entries are returned. The state values are flag-based enumeration, so the value could be a combination of these values, obtained using the bitwise 'OR' operator. For example, If the provided value is 6 then all of the events with HealthState value of OK (2) and Warning (4) are returned. - Default - Default value. Matches any HealthState. The value is zero. - None - Filter that doesn't match any HealthState value. Used in order to return no results on a given collection of states. The value is 1. - Ok - Filter that matches input with HealthState value Ok. The value is 2. - Warning - Filter that matches input with HealthState value Warning. The value is 4. - Error - Filter that matches input with HealthState value Error. The value is 8. - All - Filter that matches input with any HealthState value. The value is 65535. :type events_health_state_filter: int :param exclude_health_statistics: Indicates whether the health statistics should be returned as part of the query result. False by default. The statistics show the number of children entities in health state Ok, Warning, and Error. :type exclude_health_statistics: bool :param include_system_application_health_statistics: Indicates whether the health statistics should include the fabric:/System application health statistics. False by default. If IncludeSystemApplicationHealthStatistics is set to true, the health statistics include the entities that belong to the fabric:/System
python
{ "resource": "" }
q267546
ServiceFabricClientAPIs.get_cluster_health_using_policy
test
def get_cluster_health_using_policy( self, nodes_health_state_filter=0, applications_health_state_filter=0, events_health_state_filter=0, exclude_health_statistics=False, include_system_application_health_statistics=False, timeout=60, application_health_policy_map=None, cluster_health_policy=None, custom_headers=None, raw=False, **operation_config): """Gets the health of a Service Fabric cluster using the specified policy. Use EventsHealthStateFilter to filter the collection of health events reported on the cluster based on the health state. Similarly, use NodesHealthStateFilter and ApplicationsHealthStateFilter to filter the collection of nodes and applications returned based on their aggregated health state. Use ClusterHealthPolicies to override the health policies used to evaluate the health. :param nodes_health_state_filter: Allows filtering of the node health state objects returned in the result of cluster health query based on their health state. The possible values for this parameter include integer value of one of the following health states. Only nodes that match the filter are returned. All nodes are used to evaluate the aggregated health state. If not specified, all entries are returned. The state values are flag-based enumeration, so the value could be a combination of these values obtained using bitwise 'OR' operator. For example, if the provided value is 6 then health state of nodes with HealthState value of OK (2) and Warning (4) are returned. - Default - Default value. Matches any HealthState. The value is zero. - None - Filter that doesn't match any HealthState value. Used in order to return no results on a given collection of states. The value is 1. - Ok - Filter that matches input with HealthState value Ok. The value is 2. - Warning - Filter that matches input with HealthState value Warning. The value is 4. - Error - Filter that matches input with HealthState value Error. The value is 8. - All - Filter that matches input with any HealthState value. The value is 65535. :type nodes_health_state_filter: int :param applications_health_state_filter: Allows filtering of the application health state objects returned in the result of cluster health query based on their health state. The possible values for this parameter include integer value obtained from members or bitwise operations on members of HealthStateFilter enumeration. Only applications that match the filter are returned. All applications are used to evaluate the aggregated health state. If not specified, all entries are returned. The state values are flag-based enumeration, so the value could be a combination of these values obtained using bitwise 'OR' operator. For example, if the provided value is 6 then health state of applications with HealthState value of OK (2) and Warning (4) are returned. - Default - Default value. Matches any HealthState. The value is zero. - None - Filter that doesn't match any HealthState value. Used in order to return no results on a given collection of states. The value is 1. - Ok - Filter that matches input with HealthState value Ok. The value is 2. - Warning - Filter that matches input with HealthState value Warning. The value is 4. - Error - Filter that matches input with HealthState value Error. The value is 8. - All - Filter that matches input with any HealthState value. The value is 65535. :type applications_health_state_filter: int :param events_health_state_filter: Allows filtering the collection of HealthEvent objects returned based on health state. The possible values for this parameter include integer value of one of the following health states. Only events that match the filter are returned. All events are used to evaluate the aggregated health state. If not specified, all entries are returned. The state values are flag-based enumeration, so the value could be a combination of these values, obtained using the bitwise 'OR' operator. For example, If the provided value is 6 then all of the events with HealthState value of OK (2) and Warning (4) are returned. - Default - Default value. Matches any HealthState. The value is zero. - None - Filter that doesn't match any HealthState value. Used in order to return no results on a given collection of states. The value is 1. - Ok - Filter that matches input with HealthState value Ok. The value is 2. - Warning - Filter that matches input with HealthState value Warning. The value is 4. - Error - Filter that matches input with HealthState value Error. The value is 8. - All - Filter that matches input with any HealthState value. The value is 65535. :type events_health_state_filter: int :param exclude_health_statistics: Indicates whether the health statistics should be returned as part of the query result. False by default. The statistics show the number of children entities in health state Ok, Warning, and Error. :type exclude_health_statistics: bool :param include_system_application_health_statistics: Indicates whether the health statistics should include the fabric:/System application health statistics. False by default. If IncludeSystemApplicationHealthStatistics is set to true, the health statistics include the entities that belong to the fabric:/System application. Otherwise, the query result includes health statistics only for user applications. The health statistics must be included in the query result for this parameter to be applied. :type include_system_application_health_statistics: bool :param timeout: The server timeout for performing the operation in seconds. This timeout specifies the time duration that the client is willing to wait for the requested
python
{ "resource": "" }
q267547
ServiceFabricClientAPIs.unprovision_application_type
test
def unprovision_application_type( self, application_type_name, application_type_version, timeout=60, async_parameter=None, custom_headers=None, raw=False, **operation_config): """Removes or unregisters a Service Fabric application type from the cluster. This operation can only be performed if all application instances of the application type have been deleted. Once the application type is unregistered, no new application instances can be created for this particular application type. :param application_type_name: The name of the application type. :type application_type_name: str :param application_type_version: The version of the application type as defined in the application manifest. :type application_type_version: str :param timeout: The server timeout for performing the operation in seconds. This timeout specifies the time duration that the client is willing to wait for the requested operation to complete. The default value for this parameter is 60 seconds. :type timeout: long :param async_parameter: The flag indicating whether or not unprovision should occur asynchronously. When set to true, the unprovision operation returns when the request is accepted by the system, and the unprovision operation continues without any timeout limit. The default value is false. However, we recommend setting it to true for large application packages that were provisioned. :type async_parameter: 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 ClientRawResponse if raw=true :rtype: None or ~msrest.pipeline.ClientRawResponse :raises: :class:`FabricErrorException<azure.servicefabric.models.FabricErrorException>` """
python
{ "resource": "" }
q267548
ServiceFabricClientAPIs.get_repair_task_list
test
def get_repair_task_list( self, task_id_filter=None, state_filter=None, executor_filter=None, custom_headers=None, raw=False, **operation_config): """Gets a list of repair tasks matching the given filters. This API supports the Service Fabric platform; it is not meant to be used directly from your code. :param task_id_filter: The repair task ID prefix to be matched. :type task_id_filter: str :param state_filter: A bitwise-OR of the following values, specifying which task states should be included in the result list. - 1 - Created - 2 - Claimed - 4 - Preparing - 8 - Approved - 16 - Executing - 32 - Restoring - 64 - Completed :type state_filter: int :param executor_filter: The name of the repair executor whose claimed tasks should be included in the list. :type executor_filter: 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: list or ClientRawResponse if raw=true :rtype: list[~azure.servicefabric.models.RepairTask] or ~msrest.pipeline.ClientRawResponse :raises: :class:`FabricErrorException<azure.servicefabric.models.FabricErrorException>` """ api_version = "6.0" # Construct URL url = self.get_repair_task_list.metadata['url'] # Construct parameters query_parameters = {} query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') if task_id_filter is not None:
python
{ "resource": "" }
q267549
ServiceFabricClientAPIs.submit_property_batch
test
def submit_property_batch( self, name_id, timeout=60, operations=None, custom_headers=None, raw=False, **operation_config): """Submits a property batch. Submits a batch of property operations. Either all or none of the operations will be committed. :param name_id: The Service Fabric name, without the 'fabric:' URI scheme. :type name_id: str :param timeout: The server timeout for performing the operation in seconds. This timeout specifies the time duration that the client is willing to wait for the requested operation to complete. The default value for this parameter is 60 seconds. :type timeout: long :param operations: A list of the property batch operations to be executed. :type operations: list[~azure.servicefabric.models.PropertyBatchOperation] :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: PropertyBatchInfo or ClientRawResponse if raw=true :rtype: ~azure.servicefabric.models.PropertyBatchInfo or ~msrest.pipeline.ClientRawResponse :raises: :class:`FabricErrorException<azure.servicefabric.models.FabricErrorException>` """ property_batch_description_list = models.PropertyBatchDescriptionList(operations=operations) api_version = "6.0" # Construct URL url = self.submit_property_batch.metadata['url'] path_format_arguments = { 'nameId': self._serialize.url("name_id", name_id, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {}
python
{ "resource": "" }
q267550
_general_error_handler
test
def _general_error_handler(http_error): ''' Simple error handler for azure.''' message = str(http_error) if http_error.respbody is not None: message
python
{ "resource": "" }
q267551
WebAppsOperations.start_web_site_network_trace_operation
test
def start_web_site_network_trace_operation( self, resource_group_name, name, duration_in_seconds=None, max_frame_length=None, sas_url=None, custom_headers=None, raw=False, polling=True, **operation_config): """Start capturing network packets for the site. Start capturing network packets for the site. :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str :param duration_in_seconds: The duration to keep capturing in seconds. :type duration_in_seconds: int :param max_frame_length: The maximum frame length in bytes (Optional). :type max_frame_length: int :param sas_url: The Blob URL to store capture file. :type sas_url: str :param dict custom_headers: headers that will be added to the request :param bool raw: The poller return type is ClientRawResponse, the direct response alongside the deserialized response :param polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :return: An instance of LROPoller that returns list or ClientRawResponse<list> if raw==True :rtype: ~msrestazure.azure_operation.AzureOperationPoller[list[~azure.mgmt.web.models.NetworkTrace]] or ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[list[~azure.mgmt.web.models.NetworkTrace]]] :raises: :class:`DefaultErrorResponseException<azure.mgmt.web.models.DefaultErrorResponseException>` """ raw_result = self._start_web_site_network_trace_operation_initial( resource_group_name=resource_group_name,
python
{ "resource": "" }
q267552
WebAppsOperations.list_slot_differences_slot
test
def list_slot_differences_slot( self, resource_group_name, name, slot, target_slot, preserve_vnet, custom_headers=None, raw=False, **operation_config): """Get the difference in configuration settings between two web app slots. Get the difference in configuration settings between two web app slots. :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param slot: Name of the source slot. If a slot is not specified, the production slot is used as the source slot. :type slot: str :param target_slot: Destination deployment slot during swap operation. :type target_slot: str :param preserve_vnet: <code>true</code> to preserve Virtual Network to the slot during swap; otherwise, <code>false</code>. :type preserve_vnet: 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: An iterator like instance of SlotDifference :rtype: ~azure.mgmt.web.models.SlotDifferencePaged[~azure.mgmt.web.models.SlotDifference] :raises: :class:`DefaultErrorResponseException<azure.mgmt.web.models.DefaultErrorResponseException>` """ slot_swap_entity = models.CsmSlotEntity(target_slot=target_slot, preserve_vnet=preserve_vnet) def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL url = self.list_slot_differences_slot.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'), 'name': self._serialize.url("name", name, 'str'), 'slot': self._serialize.url("slot", slot, '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') else:
python
{ "resource": "" }
q267553
WebAppsOperations.swap_slot_slot
test
def swap_slot_slot( self, resource_group_name, name, slot, target_slot, preserve_vnet, custom_headers=None, raw=False, polling=True, **operation_config): """Swaps two deployment slots of an app. Swaps two deployment slots of an app. :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: Name of the app. :type name: str :param slot: Name of the source slot. If a slot is not specified, the production slot is used as the source slot. :type slot: str :param target_slot: Destination deployment slot during swap operation. :type target_slot: str :param preserve_vnet: <code>true</code> to preserve Virtual Network to the slot during swap; otherwise, <code>false</code>. :type preserve_vnet: bool :param dict custom_headers: headers that will be added to the request :param bool raw: The poller return type is ClientRawResponse, the direct response alongside the deserialized response :param polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :return: An instance of LROPoller that returns None or ClientRawResponse<None> if raw==True :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>` """ raw_result = self._swap_slot_slot_initial( resource_group_name=resource_group_name,
python
{ "resource": "" }
q267554
EventsOperations.get_by_type
test
def get_by_type( self, app_id, event_type, timespan=None, filter=None, search=None, orderby=None, select=None, skip=None, top=None, format=None, count=None, apply=None, custom_headers=None, raw=False, **operation_config): """Execute OData query. Executes an OData query for events. :param app_id: ID of the application. This is Application ID from the API Access settings blade in the Azure portal. :type app_id: str :param event_type: The type of events to query; either a standard event type (`traces`, `customEvents`, `pageViews`, `requests`, `dependencies`, `exceptions`, `availabilityResults`) or `$all` to query across all event types. Possible values include: '$all', 'traces', 'customEvents', 'pageViews', 'browserTimings', 'requests', 'dependencies', 'exceptions', 'availabilityResults', 'performanceCounters', 'customMetrics' :type event_type: str or ~azure.applicationinsights.models.EventType :param timespan: Optional. The timespan over which to retrieve events. This is an ISO8601 time period value. This timespan is applied in addition to any that are specified in the Odata expression. :type timespan: str :param filter: An expression used to filter the returned events :type filter: str :param search: A free-text search expression to match for whether a particular event should be returned :type search: str :param orderby: A comma-separated list of properties with \\"asc\\" (the default) or \\"desc\\" to control the order of returned events :type orderby: str :param select: Limits the properties to just those requested on each returned event :type select: str :param skip: The number of items to skip over before returning events :type skip: int :param top: The number of events to return :type top: int :param format: Format for the returned events :type format: str :param count: Request a count of matching items included with the returned events :type count: bool :param apply: An expression used for aggregation over returned events :type apply: 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: EventsResults or ClientRawResponse if raw=true :rtype: ~azure.applicationinsights.models.EventsResults or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException<azure.applicationinsights.models.ErrorResponseException>` """ # Construct URL url = self.get_by_type.metadata['url'] path_format_arguments = { 'appId': self._serialize.url("app_id", app_id, 'str'), 'eventType': self._serialize.url("event_type", event_type, 'str') } url = self._client.format_url(url, **path_format_arguments) # Construct parameters
python
{ "resource": "" }
q267555
LargeFaceListOperations.add_face_from_stream
test
def add_face_from_stream( self, large_face_list_id, image, user_data=None, target_face=None, custom_headers=None, raw=False, callback=None, **operation_config): """Add a face to a large face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire. :param large_face_list_id: Id referencing a particular large face list. :type large_face_list_id: str :param image: An image stream. :type image: Generator :param user_data: User-specified data about the face for any purpose. The maximum length is 1KB. :type user_data: str :param target_face: A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. :type target_face: list[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 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
python
{ "resource": "" }
q267556
KeyVaultAuthBase._handle_redirect
test
def _handle_redirect(self, r, **kwargs): """Reset auth_attempted on
python
{ "resource": "" }
q267557
MigrationConfigsOperations.create_and_start_migration
test
def create_and_start_migration( self, resource_group_name, namespace_name, target_namespace, post_migration_name, custom_headers=None, raw=False, polling=True, **operation_config): """Creates Migration configuration and starts migration of entities from Standard to Premium namespace. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str :param namespace_name: The namespace name :type namespace_name: str :param target_namespace: Existing premium Namespace ARM Id name which has no entities, will be used for migration :type target_namespace: str :param post_migration_name: Name to access Standard Namespace after migration :type post_migration_name: str :param dict custom_headers: headers that will be added to the request :param bool raw: The poller return type is ClientRawResponse, the direct response alongside the deserialized response :param polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :return: An instance of LROPoller that returns MigrationConfigProperties or ClientRawResponse<MigrationConfigProperties> if raw==True :rtype: ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.servicebus.models.MigrationConfigProperties] or ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.servicebus.models.MigrationConfigProperties]] :raises: :class:`ErrorResponseException<azure.mgmt.servicebus.models.ErrorResponseException>` """ raw_result = self._create_and_start_migration_initial( resource_group_name=resource_group_name,
python
{ "resource": "" }
q267558
EventGridClient.publish_events
test
def publish_events( self, topic_hostname, events, custom_headers=None, raw=False, **operation_config): """Publishes a batch of events to an Azure Event Grid topic. :param topic_hostname: The host name of the topic, e.g. topic1.westus2-1.eventgrid.azure.net :type topic_hostname: str :param events: An array of events to be published to Event Grid. :type events: list[~azure.eventgrid.models.EventGridEvent] :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.publish_events.metadata['url'] path_format_arguments = { 'topicHostname': self._serialize.url("topic_hostname", topic_hostname, 'str', skip_quote=True) } 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
python
{ "resource": "" }
q267559
ResourcesOperations.move_resources
test
def move_resources( self, source_resource_group_name, resources=None, target_resource_group=None, custom_headers=None, raw=False, polling=True, **operation_config): """Moves resources from one resource group to another resource group. The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. . :param source_resource_group_name: The name of the resource group containing the resources to move. :type source_resource_group_name: str :param resources: The IDs of the resources. :type resources: list[str] :param target_resource_group: The target resource group. :type target_resource_group: str :param dict custom_headers: headers that will be added to the request :param bool raw: The poller return type is ClientRawResponse, the direct response alongside the deserialized response :param polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :return: An instance of LROPoller that returns None or ClientRawResponse<None> if raw==True :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>` """ raw_result
python
{ "resource": "" }
q267560
DefaultProfile.use
test
def use(self, profile): """Define a new default profile.""" if not isinstance(profile, (KnownProfiles, ProfileDefinition)): raise ValueError("Can only set as
python
{ "resource": "" }
q267561
PolicyTrackedResourcesOperations.list_query_results_for_management_group
test
def list_query_results_for_management_group( self, management_group_name, query_options=None, custom_headers=None, raw=False, **operation_config): """Queries policy tracked resources under the management group. :param management_group_name: Management group name. :type management_group_name: str :param query_options: Additional parameters for the operation :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions :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: An iterator like instance of PolicyTrackedResource :rtype: ~azure.mgmt.policyinsights.models.PolicyTrackedResourcePaged[~azure.mgmt.policyinsights.models.PolicyTrackedResource] :raises: :class:`QueryFailureException<azure.mgmt.policyinsights.models.QueryFailureException>` """ top = None if query_options is not None: top = query_options.top filter = None if query_options is not None: filter = query_options.filter def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL url = self.list_query_results_for_management_group.metadata['url'] path_format_arguments = { 'managementGroupsNamespace': self._serialize.url("self.management_groups_namespace", self.management_groups_namespace, 'str'), 'managementGroupName': self._serialize.url("management_group_name", management_group_name, 'str'), 'policyTrackedResourcesResource': self._serialize.url("self.policy_tracked_resources_resource", self.policy_tracked_resources_resource, '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 top is not None: query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=0) if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') else: url = next_link query_parameters =
python
{ "resource": "" }
q267562
ServiceBusMixin.create_queue
test
def create_queue( self, queue_name, lock_duration=30, max_size_in_megabytes=None, requires_duplicate_detection=False, requires_session=False, default_message_time_to_live=None, dead_lettering_on_message_expiration=False, duplicate_detection_history_time_window=None, max_delivery_count=None, enable_batched_operations=None): """Create a queue entity. :param queue_name: The name of the new queue. :type queue_name: str :param lock_duration: The lock durection in seconds for each message in the queue. :type lock_duration: int :param max_size_in_megabytes: The max size to allow the queue to grow to. :type max_size_in_megabytes: int :param requires_duplicate_detection: Whether the queue will require every message with a specified time frame to have a unique ID. Non-unique messages will be discarded. Default value is False. :type requires_duplicate_detection: bool :param requires_session: Whether the queue will be sessionful, and therefore require all message to have a Session ID and be received by a sessionful receiver. Default value is False. :type requires_session: bool :param default_message_time_to_live: The length of time a message will remain in the queue before it is either discarded or moved to the dead letter queue. :type default_message_time_to_live: ~datetime.timedelta :param dead_lettering_on_message_expiration: Whether to move expired messages to the dead letter queue. Default value is False. :type dead_lettering_on_message_expiration: bool :param duplicate_detection_history_time_window: The period within which all incoming messages must have a unique message ID. :type duplicate_detection_history_time_window: ~datetime.timedelta :param max_delivery_count: The maximum number of times a message
python
{ "resource": "" }
q267563
ServiceBusMixin.delete_queue
test
def delete_queue(self, queue_name, fail_not_exist=False): """Delete a queue entity. :param queue_name: The name of the queue to delete. :type queue_name: str :param fail_not_exist: Whether to raise an exception if the named queue is not found. If set to True, a ServiceBusResourceNotFound will be raised. Default value is False. :type fail_not_exist: bool :raises: ~azure.servicebus.common.errors.ServiceBusConnectionError if the namesapce is
python
{ "resource": "" }
q267564
ServiceBusMixin.create_topic
test
def create_topic( self, topic_name, default_message_time_to_live=None, max_size_in_megabytes=None, requires_duplicate_detection=None, duplicate_detection_history_time_window=None, enable_batched_operations=None): """Create a topic entity. :param topic_name: The name of the new topic. :type topic_name: str :param max_size_in_megabytes: The max size to allow the topic to grow to. :type max_size_in_megabytes: int :param requires_duplicate_detection: Whether the topic will require every message with a specified time frame to have a unique ID. Non-unique messages will be discarded. Default value is False. :type requires_duplicate_detection: bool :param default_message_time_to_live: The length of time a message will remain in the topic before it
python
{ "resource": "" }
q267565
ServiceBusMixin.delete_topic
test
def delete_topic(self, topic_name, fail_not_exist=False): """Delete a topic entity. :param topic_name: The name of the topic to delete. :type topic_name: str :param fail_not_exist: Whether to raise an exception if the named topic is not found. If set to True, a ServiceBusResourceNotFound will be raised. Default value is False. :type fail_not_exist: bool :raises: ~azure.servicebus.common.errors.ServiceBusConnectionError if the namesapce is
python
{ "resource": "" }
q267566
ServiceBusMixin.create_subscription
test
def create_subscription( self, topic_name, subscription_name, lock_duration=30, requires_session=None, default_message_time_to_live=None, dead_lettering_on_message_expiration=None, dead_lettering_on_filter_evaluation_exceptions=None, enable_batched_operations=None, max_delivery_count=None): """Create a subscription entity. :param topic_name: The name of the topic under which to create the subscription. :param subscription_name: The name of the new subscription. :type subscription_name: str :param lock_duration: The lock durection in seconds for each message in the subscription. :type lock_duration: int :param requires_session: Whether the subscription will be sessionful, and therefore require all message to have a Session ID and be received by a sessionful receiver. Default value is False. :type requires_session: bool :param default_message_time_to_live: The length of time a message will remain in the subscription before it is either discarded or moved to the dead letter queue. :type default_message_time_to_live: ~datetime.timedelta :param dead_lettering_on_message_expiration: Whether to move expired messages to the dead letter queue. Default value is False. :type dead_lettering_on_message_expiration: bool :param dead_lettering_on_filter_evaluation_exceptions: Whether to move messages that error on filtering into the dead letter queue. Default is False, and the messages will be discarded. :type dead_lettering_on_filter_evaluation_exceptions: bool :param max_delivery_count: The maximum number of times a message will attempt to be delivered before it is moved to the dead letter queue. :type max_delivery_count:
python
{ "resource": "" }
q267567
BaseClient.from_connection_string
test
def from_connection_string(cls, conn_str, name=None, **kwargs): """Create a Client from a Service Bus connection string. :param conn_str: The connection string. :type conn_str: str :param name: The name of the entity, if the 'EntityName' property is not included in the connection string. """
python
{ "resource": "" }
q267568
BaseClient.get_properties
test
def get_properties(self): """Perform an operation to update the properties of the entity. :returns: The properties of the entity as a dictionary. :rtype: dict[str, Any] :raises: ~azure.servicebus.common.errors.ServiceBusResourceNotFound if the entity does not exist. :raises: ~azure.servicebus.common.errors.ServiceBusConnectionError if the endpoint cannot be reached. :raises: ~azure.common.AzureHTTPError if the credentials are invalid. """ try: self.entity = self._get_entity() self.properties = dict(self.entity) if hasattr(self.entity, 'requires_session'):
python
{ "resource": "" }
q267569
SessionMixin.expired
test
def expired(self): """Whether the receivers lock on a particular session has expired. :rtype: bool """
python
{ "resource": "" }
q267570
SessionOperations.create
test
def create( self, resource_group_name, node_name, session, user_name=None, password=None, retention_period=None, credential_data_format=None, encryption_certificate_thumbprint=None, custom_headers=None, raw=False, polling=True, **operation_config): """Creates a session for a node. :param resource_group_name: The resource group name uniquely identifies the resource group within the user subscriptionId. :type resource_group_name: str :param node_name: The node name (256 characters maximum). :type node_name: str :param session: The sessionId from the user. :type session: str :param user_name: Encrypted User name to be used to connect to node. :type user_name: str :param password: Encrypted Password associated with user name. :type password: str :param retention_period: Session retention period. Possible values include: 'Session', 'Persistent' :type retention_period: str or ~azure.mgmt.servermanager.models.RetentionPeriod :param credential_data_format: Credential data format. Possible values include: 'RsaEncrypted' :type credential_data_format: str or ~azure.mgmt.servermanager.models.CredentialDataFormat :param encryption_certificate_thumbprint: Encryption certificate thumbprint. :type encryption_certificate_thumbprint: str :param dict custom_headers: headers that will be added to the request :param bool raw: The poller return type is ClientRawResponse, the direct response alongside the deserialized response :param polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :return: An instance of LROPoller that returns SessionResource or ClientRawResponse<SessionResource> if raw==True :rtype: ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.servermanager.models.SessionResource] or
python
{ "resource": "" }
q267571
SubscriptionFactoryOperations.create_subscription
test
def create_subscription( self, billing_account_name, invoice_section_name, body, custom_headers=None, raw=False, polling=True, **operation_config): """Creates an Azure subscription. :param billing_account_name: The name of the commerce root billing account. :type billing_account_name: str :param invoice_section_name: The name of the invoice section. :type invoice_section_name: str :param body: The subscription creation parameters. :type body: ~azure.mgmt.subscription.models.SubscriptionCreationParameters :param dict custom_headers: headers that will be added to the request :param bool raw: The poller return type is ClientRawResponse, the direct response alongside the deserialized response :param polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :return: An instance of LROPoller that returns SubscriptionCreationResult or ClientRawResponse<SubscriptionCreationResult> if raw==True :rtype: ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.subscription.models.SubscriptionCreationResult] or ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.subscription.models.SubscriptionCreationResult]] :raises: :class:`ErrorResponseException<azure.mgmt.subscription.models.ErrorResponseException>` """ raw_result = self._create_subscription_initial( billing_account_name=billing_account_name, invoice_section_name=invoice_section_name, body=body, custom_headers=custom_headers, raw=True,
python
{ "resource": "" }
q267572
LogAnalyticsOperations.export_request_rate_by_interval
test
def export_request_rate_by_interval( self, parameters, location, custom_headers=None, raw=False, polling=True, **operation_config): """Export logs that show Api requests made by this subscription in the given time window to show throttling activities. :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. :type parameters: ~azure.mgmt.compute.v2018_04_01.models.RequestRateByIntervalInput :param location: The location upon which virtual-machine-sizes is queried. :type location: str :param dict custom_headers: headers that will be added to the request :param bool raw: The poller return type is ClientRawResponse, the direct response alongside the deserialized response :param polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :return: An instance of LROPoller that returns LogAnalyticsOperationResult or ClientRawResponse<LogAnalyticsOperationResult> if raw==True :rtype: ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.compute.v2018_04_01.models.LogAnalyticsOperationResult] or ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.compute.v2018_04_01.models.LogAnalyticsOperationResult]] :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>` """ raw_result = self._export_request_rate_by_interval_initial( parameters=parameters, location=location, custom_headers=custom_headers, raw=True,
python
{ "resource": "" }
q267573
_handle_output
test
def _handle_output(results_queue): """Scan output for exceptions If there is an output from an add task collection call add it to the results. :param results_queue: Queue containing results of attempted add_collection's :type results_queue: collections.deque :return: list of TaskAddResults
python
{ "resource": "" }
q267574
_TaskWorkflowManager._bulk_add_tasks
test
def _bulk_add_tasks(self, results_queue, chunk_tasks_to_add): """Adds a chunk of tasks to the job Retry chunk if body exceeds the maximum request size and retry tasks if failed due to server errors. :param results_queue: Queue to place the return value of the request :type results_queue: collections.deque :param chunk_tasks_to_add: Chunk of at most 100 tasks with retry details :type chunk_tasks_to_add: list[~TrackedCloudTask] """ try: add_collection_response = self._original_add_collection( self._client, self._job_id, chunk_tasks_to_add, self._task_add_collection_options, self._custom_headers, self._raw) except BatchErrorException as e: # In case of a chunk exceeding the MaxMessageSize split chunk in half # and resubmit smaller chunk requests # TODO: Replace string with constant variable once available in SDK if e.error.code == "RequestBodyTooLarge": # pylint: disable=no-member # In this case the task is misbehaved and will not be able to be added due to: # 1) The task exceeding the max message size # 2) A single cell of the task exceeds the per-cell limit, or # 3) Sum of all cells exceeds max row limit if len(chunk_tasks_to_add) == 1: failed_task = chunk_tasks_to_add.pop() self.errors.appendleft(e) _LOGGER.error("Failed to add task with ID %s due to the body" " exceeding the maximum request size", failed_task.id) else: # Assumption: Tasks are relatively close in size therefore if one batch exceeds size limit # we should decrease the initial task collection size to avoid repeating the error # Midpoint is lower bounded by 1 due to above base case midpoint = int(len(chunk_tasks_to_add) / 2) # Restrict one thread at a time to do this compare and set, # therefore forcing max_tasks_per_request to be strictly decreasing with self._max_tasks_lock: if midpoint < self._max_tasks_per_request: self._max_tasks_per_request = midpoint _LOGGER.info("Amount of tasks per request reduced from %s to %s due to the" " request body being too large", str(self._max_tasks_per_request), str(midpoint)) # Not the most efficient solution for all cases, but the goal of this is to handle this # exception and have it work in all cases where tasks are well behaved # Behavior retries as a smaller chunk and # appends extra tasks to queue to be picked up by another thread . self.tasks_to_add.extendleft(chunk_tasks_to_add[midpoint:]) self._bulk_add_tasks(results_queue, chunk_tasks_to_add[:midpoint]) # Retry server side errors elif 500 <= e.response.status_code <= 599: self.tasks_to_add.extendleft(chunk_tasks_to_add) else: # Re-add to pending queue as unknown status /
python
{ "resource": "" }
q267575
_TaskWorkflowManager.task_collection_thread_handler
test
def task_collection_thread_handler(self, results_queue): """Main method for worker to run Pops a chunk of tasks off the collection of pending tasks to be added and submits them to be added. :param collections.deque results_queue: Queue for worker to output results to """ # Add tasks until either we run out or we run into an unexpected error while self.tasks_to_add and not self.errors: max_tasks = self._max_tasks_per_request # local copy chunk_tasks_to_add = [] with self._pending_queue_lock:
python
{ "resource": "" }
q267576
build_config
test
def build_config(config : Dict[str, Any]) -> Dict[str, str]: """Will build the actual config for Jinja2, based on SDK config. """ result = config.copy() # Manage the classifier stable/beta is_stable = result.pop("is_stable", False) if is_stable: result["classifier"] = "Development Status :: 5 - Production/Stable" else: result["classifier"] = "Development Status :: 4 - Beta" # Manage the nspkg package_name = result["package_name"] result["package_nspkg"] = result.pop( "package_nspkg", package_name[:package_name.rindex('-')]+"-nspkg" ) # ARM? result['is_arm'] = result.pop("is_arm", True) # Do I need msrestazure for this package? result['need_msrestazure'] = result.pop("need_msrestazure", True) # Pre-compute some Jinja variable that are complicated
python
{ "resource": "" }
q267577
GlobalUsersOperations.reset_password
test
def reset_password( self, user_name, reset_password_payload, custom_headers=None, raw=False, polling=True, **operation_config): """Resets the user password on an environment This operation can take a while to complete. :param user_name: The name of the user. :type user_name: str :param reset_password_payload: Represents the payload for resetting passwords. :type reset_password_payload: ~azure.mgmt.labservices.models.ResetPasswordPayload :param dict custom_headers: headers that will be added to the request :param bool raw: The poller return type is ClientRawResponse, the direct response alongside the deserialized response :param polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :return: An instance of LROPoller that returns None or ClientRawResponse<None> if raw==True :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>` """ raw_result = self._reset_password_initial( user_name=user_name, reset_password_payload=reset_password_payload, custom_headers=custom_headers, raw=True,
python
{ "resource": "" }
q267578
GlobalUsersOperations.start_environment
test
def start_environment( self, user_name, environment_id, custom_headers=None, raw=False, polling=True, **operation_config): """Starts an environment by starting all resources inside the environment. This operation can take a while to complete. :param user_name: The name of the user. :type user_name: str :param environment_id: The resourceId of the environment :type environment_id: str :param dict custom_headers: headers that will be added to the request :param bool raw: The poller return type is ClientRawResponse, the direct response alongside the deserialized response :param polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :return: An instance of LROPoller that returns None or ClientRawResponse<None> if raw==True :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>` """ raw_result = self._start_environment_initial( user_name=user_name, environment_id=environment_id, custom_headers=custom_headers, raw=True, **operation_config )
python
{ "resource": "" }
q267579
_create_message
test
def _create_message(response, service_instance): ''' Create message from response. response: response from Service Bus cloud server. service_instance: the Service Bus client. ''' respbody = response.body custom_properties = {} broker_properties = None message_type = None message_location = None # gets all information from respheaders. for name, value in response.headers: if name.lower() == 'brokerproperties': broker_properties = json.loads(value) elif name.lower() == 'content-type': message_type = value elif name.lower() == 'location': message_location = value # Exclude common HTTP headers to avoid noise. List # is not exhaustive. At worst, custom properties will contains # an unexpected content generated by the webserver and not the customer. elif name.lower() not in ['transfer-encoding', 'server', 'date', 'strict-transport-security']: # Follow the spec: # https://docs.microsoft.com/rest/api/servicebus/message-headers-and-properties if '"' in value: value = value[1:-1].replace('\\"', '"') try: custom_properties[name] = datetime.strptime( value, '%a, %d %b %Y %H:%M:%S GMT') except ValueError: custom_properties[name] = value elif value.lower() == 'true': custom_properties[name] = True elif value.lower() == 'false': custom_properties[name] = False else: # in theory, only int or float try:
python
{ "resource": "" }
q267580
_convert_etree_element_to_rule
test
def _convert_etree_element_to_rule(entry_element): ''' Converts entry element to rule object. The format of xml for rule: <entry xmlns='http://www.w3.org/2005/Atom'> <content type='application/xml'> <RuleDescription xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect"> <Filter i:type="SqlFilterExpression"> <SqlExpression>MyProperty='XYZ'</SqlExpression> </Filter> <Action i:type="SqlFilterAction"> <SqlExpression>set MyProperty2 = 'ABC'</SqlExpression> </Action> </RuleDescription> </content> </entry> ''' rule = Rule() rule_element = entry_element.find('./atom:content/sb:RuleDescription', _etree_sb_feed_namespaces) if rule_element is not None: filter_element = rule_element.find('./sb:Filter', _etree_sb_feed_namespaces)
python
{ "resource": "" }
q267581
_convert_etree_element_to_queue
test
def _convert_etree_element_to_queue(entry_element): ''' Converts entry element to queue object. The format of xml response for queue: <QueueDescription xmlns=\"http://schemas.microsoft.com/netservices/2010/10/servicebus/connect\"> <MaxSizeInBytes>10000</MaxSizeInBytes> <DefaultMessageTimeToLive>PT5M</DefaultMessageTimeToLive> <LockDuration>PT2M</LockDuration> <RequiresGroupedReceives>False</RequiresGroupedReceives> <SupportsDuplicateDetection>False</SupportsDuplicateDetection> ... </QueueDescription> ''' queue = Queue() # get node for each attribute in Queue class, if nothing found then the # response is not valid xml for Queue. invalid_queue = True queue_element = entry_element.find('./atom:content/sb:QueueDescription', _etree_sb_feed_namespaces) if queue_element is not None: mappings = [ ('LockDuration',
python
{ "resource": "" }
q267582
_convert_etree_element_to_topic
test
def _convert_etree_element_to_topic(entry_element): '''Converts entry element to topic The xml format for topic: <entry xmlns='http://www.w3.org/2005/Atom'> <content type='application/xml'> <TopicDescription xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect"> <DefaultMessageTimeToLive>P10675199DT2H48M5.4775807S</DefaultMessageTimeToLive> <MaxSizeInMegabytes>1024</MaxSizeInMegabytes> <RequiresDuplicateDetection>false</RequiresDuplicateDetection> <DuplicateDetectionHistoryTimeWindow>P7D</DuplicateDetectionHistoryTimeWindow> <DeadLetteringOnFilterEvaluationExceptions>true</DeadLetteringOnFilterEvaluationExceptions> </TopicDescription> </content> </entry> ''' topic = Topic() invalid_topic = True topic_element = entry_element.find('./atom:content/sb:TopicDescription', _etree_sb_feed_namespaces) if topic_element is not None: mappings = [ ('DefaultMessageTimeToLive', 'default_message_time_to_live', None),
python
{ "resource": "" }
q267583
_convert_etree_element_to_subscription
test
def _convert_etree_element_to_subscription(entry_element): '''Converts entry element to subscription The xml format for subscription: <entry xmlns='http://www.w3.org/2005/Atom'> <content type='application/xml'> <SubscriptionDescription xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect"> <LockDuration>PT5M</LockDuration> <RequiresSession>false</RequiresSession> <DefaultMessageTimeToLive>P10675199DT2H48M5.4775807S</DefaultMessageTimeToLive> <DeadLetteringOnMessageExpiration>false</DeadLetteringOnMessageExpiration> <DeadLetteringOnFilterEvaluationExceptions>true</DeadLetteringOnFilterEvaluationExceptions> </SubscriptionDescription> </content> </entry> ''' subscription = Subscription() subscription_element = entry_element.find('./atom:content/sb:SubscriptionDescription', _etree_sb_feed_namespaces) if subscription_element is not None: mappings = [ ('LockDuration', 'lock_duration', None), ('RequiresSession', 'requires_session', _parse_bool),
python
{ "resource": "" }
q267584
CertificateOperations.create
test
def create( self, resource_group_name, account_name, certificate_name, parameters, if_match=None, if_none_match=None, custom_headers=None, raw=False, **operation_config): """Creates a new certificate inside the specified account. :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 certificate_name: The identifier for the certificate. This must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. :type certificate_name: str :param parameters: Additional parameters for certificate creation. :type parameters: ~azure.mgmt.batch.models.CertificateCreateOrUpdateParameters :param if_match: The entity state (ETag) version of the certificate to update. A value of "*" can be used to apply the operation only if the certificate already exists. If omitted, this operation will always be applied. :type if_match: str :param if_none_match: Set to '*' to allow a new certificate to be created, but to prevent updating an existing certificate. Other values will be ignored. :type if_none_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 :return: An instance of AzureOperationPoller that returns Certificate or ClientRawResponse if raw=true :rtype: ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.batch.models.Certificate] or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>` """ raw_result = self._create_initial( resource_group_name=resource_group_name, account_name=account_name, certificate_name=certificate_name, parameters=parameters, if_match=if_match, if_none_match=if_none_match, custom_headers=custom_headers, raw=True, **operation_config ) if raw: return raw_result # Construct and send request def long_running_send(): return raw_result.response
python
{ "resource": "" }
q267585
CertificateOperations.delete
test
def delete( self, resource_group_name, account_name, certificate_name, custom_headers=None, raw=False, **operation_config): """Deletes the specified certificate. :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 certificate_name: The identifier for the certificate. This must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. :type certificate_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 :return: An instance of AzureOperationPoller that returns None or ClientRawResponse if raw=true :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>` """ raw_result = self._delete_initial(
python
{ "resource": "" }
q267586
get_client_from_cli_profile
test
def get_client_from_cli_profile(client_class, **kwargs): """Return a SDK client initialized with current CLI credentials, CLI default subscription and CLI default cloud. This method will fill automatically the following client parameters: - credentials - subscription_id - base_url Parameters provided in kwargs will override CLI parameters and be passed directly to the client. :Example: .. code:: python from azure.common.client_factory import get_client_from_cli_profile from azure.mgmt.compute import ComputeManagementClient client = get_client_from_cli_profile(ComputeManagementClient) .. versionadded:: 1.1.6 :param client_class: A SDK client class :return: An instantiated client :raises: ImportError if azure-cli-core package is not available """ cloud = get_cli_active_cloud() parameters = {} if 'credentials' not in kwargs or 'subscription_id' not in kwargs: resource, _ = _client_resource(client_class, cloud) credentials, subscription_id, tenant_id = get_azure_cli_credentials(resource=resource, with_tenant=True) parameters.update({ 'credentials': kwargs.get('credentials', credentials),
python
{ "resource": "" }
q267587
get_client_from_json_dict
test
def get_client_from_json_dict(client_class, config_dict, **kwargs): """Return a SDK client initialized with a JSON auth dict. The easiest way to obtain this content is to call the following CLI commands: .. code:: bash az ad sp create-for-rbac --sdk-auth This method will fill automatically the following client parameters: - credentials - subscription_id - base_url - tenant_id Parameters provided in kwargs will override parameters and be passed directly to the client. :Example: .. code:: python from azure.common.client_factory import get_client_from_auth_file from azure.mgmt.compute import ComputeManagementClient config_dict = { "clientId": "ad735158-65ca-11e7-ba4d-ecb1d756380e", "clientSecret": "b70bb224-65ca-11e7-810c-ecb1d756380e", "subscriptionId": "bfc42d3a-65ca-11e7-95cf-ecb1d756380e", "tenantId": "c81da1d8-65ca-11e7-b1d1-ecb1d756380e", "activeDirectoryEndpointUrl": "https://login.microsoftonline.com", "resourceManagerEndpointUrl": "https://management.azure.com/", "activeDirectoryGraphResourceId": "https://graph.windows.net/", "sqlManagementEndpointUrl": "https://management.core.windows.net:8443/", "galleryEndpointUrl": "https://gallery.azure.com/", "managementEndpointUrl": "https://management.core.windows.net/" } client = get_client_from_json_dict(ComputeManagementClient, config_dict) .. versionadded:: 1.1.7 :param client_class: A SDK client class :param dict config_dict: A config dict. :return: An instantiated client """ is_graphrbac = client_class.__name__ == 'GraphRbacManagementClient' parameters = { 'subscription_id': config_dict.get('subscriptionId'), 'base_url': config_dict.get('resourceManagerEndpointUrl'), 'tenant_id': config_dict.get('tenantId') # GraphRbac } if is_graphrbac: parameters['base_url'] = config_dict['activeDirectoryGraphResourceId'] if 'credentials' not in kwargs:
python
{ "resource": "" }
q267588
get_client_from_auth_file
test
def get_client_from_auth_file(client_class, auth_path=None, **kwargs): """Return a SDK client initialized with auth file. The easiest way to obtain this file is to call the following CLI commands: .. code:: bash az ad sp create-for-rbac --sdk-auth You can specific the file path directly, or fill the environment variable AZURE_AUTH_LOCATION. File must be UTF-8. This method will fill automatically the following client parameters: - credentials - subscription_id - base_url Parameters provided in kwargs will override parameters and be passed directly to the client. :Example: .. code:: python from azure.common.client_factory import get_client_from_auth_file from azure.mgmt.compute import ComputeManagementClient client = get_client_from_auth_file(ComputeManagementClient) Example of file: .. code:: json { "clientId": "ad735158-65ca-11e7-ba4d-ecb1d756380e",
python
{ "resource": "" }
q267589
_ETreeXmlToObject.parse_enum_results_list
test
def parse_enum_results_list(response, return_type, resp_type, item_type): """resp_body is the XML we received resp_type is a string, such as Containers, return_type is the type we're constructing, such as ContainerEnumResults item_type is the type object of the item to be created, such as Container This function then returns a ContainerEnumResults object with the containers member populated with the results. """ # parsing something like: # <EnumerationResults ... > # <Queues> # <Queue> # <Something /> # <SomethingElse /> # </Queue> # </Queues> # </EnumerationResults> return_obj = return_type() root = ETree.fromstring(response.body) items = [] for container_element in root.findall(resp_type): for item_element in container_element.findall(resp_type[:-1]): items.append(_ETreeXmlToObject.fill_instance_element(item_element, item_type))
python
{ "resource": "" }
q267590
_ETreeXmlToObject.get_entry_properties_from_element
test
def get_entry_properties_from_element(element, include_id, id_prefix_to_skip=None, use_title_as_id=False): ''' get properties from element tree element ''' properties = {} etag = element.attrib.get(_make_etree_ns_attr_name(_etree_entity_feed_namespaces['m'], 'etag'), None) if etag is not None: properties['etag'] = etag updated = element.findtext('./atom:updated', '', _etree_entity_feed_namespaces) if updated: properties['updated'] = updated author_name = element.findtext('./atom:author/atom:name', '', _etree_entity_feed_namespaces) if author_name: properties['author'] = author_name if include_id:
python
{ "resource": "" }
q267591
DpsCertificateOperations.delete
test
def delete( self, resource_group_name, if_match, provisioning_service_name, certificate_name, certificatename=None, certificateraw_bytes=None, certificateis_verified=None, certificatepurpose=None, certificatecreated=None, certificatelast_updated=None, certificatehas_private_key=None, certificatenonce=None, custom_headers=None, raw=False, **operation_config): """Delete the Provisioning Service Certificate. Deletes the specified certificate assosciated with the Provisioning Service. :param resource_group_name: Resource group identifier. :type resource_group_name: str :param if_match: ETag of the certificate :type if_match: str :param provisioning_service_name: The name of the provisioning service. :type provisioning_service_name: str :param certificate_name: This is a mandatory field, and is the logical name of the certificate that the provisioning service will access by. :type certificate_name: str :param certificatename: This is optional, and it is the Common Name of the certificate. :type certificatename: str :param certificateraw_bytes: Raw data within the certificate. :type certificateraw_bytes: bytearray :param certificateis_verified: Indicates if certificate has been verified by owner of the private key. :type certificateis_verified: bool :param certificatepurpose: A description that mentions the purpose of the certificate. Possible values include: 'clientAuthentication', 'serverAuthentication' :type certificatepurpose: str or ~azure.mgmt.iothubprovisioningservices.models.CertificatePurpose :param certificatecreated: Time the certificate is created. :type certificatecreated: datetime :param certificatelast_updated: Time the certificate is last updated. :type certificatelast_updated: datetime :param certificatehas_private_key: Indicates if the certificate contains a private key. :type certificatehas_private_key: bool :param certificatenonce: Random number generated to indicate Proof of Possession. :type certificatenonce: 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:`ErrorDetailsException<azure.mgmt.iothubprovisioningservices.models.ErrorDetailsException>` """ # Construct URL url = self.delete.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'), 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'), 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str') } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} if certificatename is not None: query_parameters['certificate.name'] = self._serialize.query("certificatename", certificatename, 'str') if certificateraw_bytes is not None: query_parameters['certificate.rawBytes'] = self._serialize.query("certificateraw_bytes", certificateraw_bytes, 'bytearray') if certificateis_verified is not None:
python
{ "resource": "" }
q267592
ServiceBusClient.get_queue
test
def get_queue(self, queue_name): """Get a client for a queue entity. :param queue_name: The name of the queue. :type queue_name: str :rtype: ~azure.servicebus.servicebus_client.QueueClient :raises: ~azure.servicebus.common.errors.ServiceBusConnectionError if the namespace is not found. :raises: ~azure.servicebus.common.errors.ServiceBusResourceNotFound if the queue is not found. Example: .. literalinclude:: ../examples/test_examples.py :start-after: [START get_queue_client]
python
{ "resource": "" }
q267593
ServiceBusClient.list_queues
test
def list_queues(self): """Get clients for all queue entities in the namespace. :rtype: list[~azure.servicebus.servicebus_client.QueueClient] :raises: ~azure.servicebus.common.errors.ServiceBusConnectionError if the namespace is not found. Example: .. literalinclude:: ../examples/test_examples.py :start-after: [START list_queues] :end-before: [END list_queues] :language: python :dedent: 4 :caption: List the queues from Service Bus client """ try: queues = self.mgmt_client.list_queues()
python
{ "resource": "" }
q267594
ServiceBusClient.get_topic
test
def get_topic(self, topic_name): """Get a client for a topic entity. :param topic_name: The name of the topic. :type topic_name: str :rtype: ~azure.servicebus.servicebus_client.TopicClient :raises: ~azure.servicebus.common.errors.ServiceBusConnectionError if the namespace is not found. :raises: ~azure.servicebus.common.errors.ServiceBusResourceNotFound if the topic is not found. Example: .. literalinclude:: ../examples/test_examples.py :start-after: [START get_topic_client]
python
{ "resource": "" }
q267595
ServiceBusClient.list_topics
test
def list_topics(self): """Get a client for all topic entities in the namespace. :rtype: list[~azure.servicebus.servicebus_client.TopicClient] :raises: ~azure.servicebus.common.errors.ServiceBusConnectionError if the namespace is not found. Example: .. literalinclude:: ../examples/test_examples.py :start-after: [START list_topics] :end-before: [END list_topics] :language: python :dedent: 4 :caption: List the topics from Service Bus client """ try:
python
{ "resource": "" }
q267596
ReceiveClientMixin.receive_deferred_messages
test
def receive_deferred_messages(self, sequence_numbers, mode=ReceiveSettleMode.PeekLock, **kwargs): """Receive messages by sequence number that have been previously deferred. When receiving deferred messages from a partitioned entity, all of the supplied sequence numbers must be messages from the same partition. :param sequence_numbers: A list of the sequence numbers of messages that have been deferred. :type sequence_numbers: list[int] :param mode: The mode with which messages will be retrieved from the entity. The two options are PeekLock and ReceiveAndDelete. Messages received with PeekLock must be settled within a given lock period before they will be removed from the queue. Messages received with ReceiveAndDelete will be immediately removed from the queue, and cannot be subsequently rejected or re-received if the client fails to process the message. The default mode is PeekLock. :type mode: ~azure.servicebus.common.constants.ReceiveSettleMode :rtype: list[~azure.servicebus.common.message.Message] Example: .. literalinclude:: ../examples/test_examples.py :start-after: [START receive_deferred_messages_service_bus] :end-before: [END receive_deferred_messages_service_bus] :language: python :dedent: 8 :caption: Get the messages which were deferred using their sequence numbers """
python
{ "resource": "" }
q267597
ReceiveClientMixin.settle_deferred_messages
test
def settle_deferred_messages(self, settlement, messages, **kwargs): """Settle messages that have been previously deferred. :param settlement: How the messages are to be settled. This must be a string of one of the following values: 'completed', 'suspended', 'abandoned'. :type settlement: str :param messages: A list of deferred messages to be settled. :type messages: list[~azure.servicebus.common.message.DeferredMessage] Example: .. literalinclude:: ../examples/test_examples.py :start-after: [START settle_deferred_messages_service_bus] :end-before: [END settle_deferred_messages_service_bus] :language: python :dedent: 8 :caption: Settle deferred messages. """ if (self.entity and self.requires_session) or kwargs.get('session'): raise ValueError("Sessionful deferred messages can only be settled within a locked receive session.") if settlement.lower() not in ['completed', 'suspended', 'abandoned']: raise ValueError("Settlement must be one of: 'completed', 'suspended', 'abandoned'")
python
{ "resource": "" }
q267598
WebsiteManagementService.get_site
test
def get_site(self, webspace_name, website_name): ''' List the web sites defined on this webspace. webspace_name: The name of the webspace. website_name: The name of the website. '''
python
{ "resource": "" }
q267599
WebsiteManagementService.create_site
test
def create_site(self, webspace_name, website_name, geo_region, host_names, plan='VirtualDedicatedPlan', compute_mode='Shared', server_farm=None, site_mode=None): ''' Create a website. webspace_name: The name of the webspace. website_name: The name of the website. geo_region: The geographical region of the webspace that will be created. host_names: An array of fully qualified domain names for website. Only one hostname can be specified in the azurewebsites.net domain. The hostname should match the name of the website. Custom domains can only be specified for Shared or Standard websites. plan: This value must be 'VirtualDedicatedPlan'. compute_mode: This value should be 'Shared' for the Free or Paid Shared offerings, or 'Dedicated' for the Standard offering. The default value is 'Shared'. If you set it to 'Dedicated', you must specify a value for the server_farm parameter. server_farm:
python
{ "resource": "" }