repo_name
stringclasses
4 values
method_name
stringlengths
3
72
method_code
stringlengths
87
3.59k
method_summary
stringlengths
12
196
original_method_code
stringlengths
129
8.98k
method_path
stringlengths
15
136
Azure/azure-sdk-for-python
ServiceBusManagementService.get_metrics_rollups_relay
def get_metrics_rollups_relay(self, name, relay_name, metric): response = self._perform_get( self._get_get_metrics_rollup_relay_path(name, relay_name, metric), None) return _MinidomXmlToObject.convert_response_to_feeds( response, partial( ...
This operation gets rollup data for Service Bus metrics relay. Rollup data includes the time granularity for the telemetry aggregation as well as the retention settings for each time granularity.
def get_metrics_rollups_relay(self, name, relay_name, metric): ''' This operation gets rollup data for Service Bus metrics relay. Rollup data includes the time granularity for the telemetry aggregation as well as the retention settings for each time granularity. name: ...
azure-servicemanagement-legacy/azure/servicemanagement/servicebusmanagementservice.py
Azure/azure-sdk-for-python
create
def create(env_dir, system_site_packages=False, clear=False, symlinks=False, with_pip=False, prompt=None): builder = ExtendedEnvBuilder(system_site_packages=system_site_packages, clear=clear, symlinks=symlinks, with_pip=with_pip, ...
Create a virtual environment in a directory.
def create(env_dir, system_site_packages=False, clear=False, symlinks=False, with_pip=False, prompt=None): """Create a virtual environment in a directory.""" builder = ExtendedEnvBuilder(system_site_packages=system_site_packages, clear=clear, symlinks=symlink...
azure-sdk-tools/packaging_tools/venvtools.py
Azure/azure-sdk-for-python
create_venv_with_package
def create_venv_with_package(packages): with tempfile.TemporaryDirectory() as tempdir: myenv = create(tempdir, with_pip=True) pip_call = [ myenv.env_exe, "-m", "pip", "install", ] subprocess.check_call(pip_call + ['-U', 'pip']) ...
Create a venv with these packages in a temp dir and yielf the env. packages should be an iterable of pip version instructio (e.g. package~=1.2.3)
def create_venv_with_package(packages): """Create a venv with these packages in a temp dir and yielf the env. packages should be an iterable of pip version instructio (e.g. package~=1.2.3) """ with tempfile.TemporaryDirectory() as tempdir: myenv = create(tempdir, with_pip=True) pip_call...
azure-sdk-tools/packaging_tools/venvtools.py
Azure/azure-sdk-for-python
SqlDatabaseManagementService.create_server
def create_server(self, admin_login, admin_password, location): _validate_not_none('admin_login', admin_login) _validate_not_none('admin_password', admin_password) _validate_not_none('location', location) response = self.perform_post( self._get_servers_path(), _Sq...
Create a new Azure SQL Database server.
def create_server(self, admin_login, admin_password, location): ''' Create a new Azure SQL Database server. admin_login: The administrator login name for the new server. admin_password: The administrator login password for the new server. location: ...
azure-servicemanagement-legacy/azure/servicemanagement/sqldatabasemanagementservice.py
Azure/azure-sdk-for-python
SqlDatabaseManagementService.set_server_admin_password
def set_server_admin_password(self, server_name, admin_password): _validate_not_none('server_name', server_name) _validate_not_none('admin_password', admin_password) return self._perform_post( self._get_servers_path(server_name) + '?op=ResetPassword', _SqlManagementXmlSer...
Reset the administrator password for a server.
def set_server_admin_password(self, server_name, admin_password): ''' Reset the administrator password for a server. server_name: Name of the server to change the password. admin_password: The new administrator password for the server. ''' _valida...
azure-servicemanagement-legacy/azure/servicemanagement/sqldatabasemanagementservice.py
Azure/azure-sdk-for-python
SqlDatabaseManagementService.list_quotas
def list_quotas(self, server_name): _validate_not_none('server_name', server_name) response = self._perform_get(self._get_quotas_path(server_name), None) return _MinidomXmlToObject.parse_service_resources_response( response, ServerQuota)
Gets quotas for an Azure SQL Database Server.
def list_quotas(self, server_name): ''' Gets quotas for an Azure SQL Database Server. server_name: Name of the server. ''' _validate_not_none('server_name', server_name) response = self._perform_get(self._get_quotas_path(server_name), ...
azure-servicemanagement-legacy/azure/servicemanagement/sqldatabasemanagementservice.py
Azure/azure-sdk-for-python
SqlDatabaseManagementService.get_server_event_logs
def get_server_event_logs(self, server_name, start_date, interval_size_in_minutes, event_types=''): _validate_not_none('server_name', server_name) _validate_not_none('start_date', start_date) _validate_not_none('interval_size_in_minutes', interval_size_in_minutes) ...
Gets the event logs for an Azure SQL Database Server.
def get_server_event_logs(self, server_name, start_date, interval_size_in_minutes, event_types=''): ''' Gets the event logs for an Azure SQL Database Server. server_name: Name of the server to retrieve the event logs from. start_date: ...
azure-servicemanagement-legacy/azure/servicemanagement/sqldatabasemanagementservice.py
Azure/azure-sdk-for-python
SqlDatabaseManagementService.create_firewall_rule
def create_firewall_rule(self, server_name, name, start_ip_address, end_ip_address): _validate_not_none('server_name', server_name) _validate_not_none('name', name) _validate_not_none('start_ip_address', start_ip_address) _validate_not_none('end_ip_address', ...
Creates an Azure SQL Database server firewall rule.
def create_firewall_rule(self, server_name, name, start_ip_address, end_ip_address): ''' Creates an Azure SQL Database server firewall rule. server_name: Name of the server to set the firewall rule on. name: The name of the new firew...
azure-servicemanagement-legacy/azure/servicemanagement/sqldatabasemanagementservice.py
Azure/azure-sdk-for-python
SqlDatabaseManagementService.update_firewall_rule
def update_firewall_rule(self, server_name, name, start_ip_address, end_ip_address): _validate_not_none('server_name', server_name) _validate_not_none('name', name) _validate_not_none('start_ip_address', start_ip_address) _validate_not_none('end_ip_address', ...
Update a firewall rule for an Azure SQL Database server.
def update_firewall_rule(self, server_name, name, start_ip_address, end_ip_address): ''' Update a firewall rule for an Azure SQL Database server. server_name: Name of the server to set the firewall rule on. name: The name of the fire...
azure-servicemanagement-legacy/azure/servicemanagement/sqldatabasemanagementservice.py
Azure/azure-sdk-for-python
SqlDatabaseManagementService.delete_firewall_rule
def delete_firewall_rule(self, server_name, name): _validate_not_none('server_name', server_name) _validate_not_none('name', name) return self._perform_delete( self._get_firewall_rules_path(server_name, name))
Deletes an Azure SQL Database server firewall rule.
def delete_firewall_rule(self, server_name, name): ''' Deletes an Azure SQL Database server firewall rule. server_name: Name of the server with the firewall rule you want to delete. name: Name of the firewall rule you want to delete. ''' _validate...
azure-servicemanagement-legacy/azure/servicemanagement/sqldatabasemanagementservice.py
Azure/azure-sdk-for-python
SqlDatabaseManagementService.list_firewall_rules
def list_firewall_rules(self, server_name): _validate_not_none('server_name', server_name) response = self._perform_get(self._get_firewall_rules_path(server_name), None) return _MinidomXmlToObject.parse_service_resources_response( response, Firewa...
Retrieves the set of firewall rules for an Azure SQL Database Server.
def list_firewall_rules(self, server_name): ''' Retrieves the set of firewall rules for an Azure SQL Database Server. server_name: Name of the server. ''' _validate_not_none('server_name', server_name) response = self._perform_get(self._get_firewall_rules_pat...
azure-servicemanagement-legacy/azure/servicemanagement/sqldatabasemanagementservice.py
Azure/azure-sdk-for-python
SqlDatabaseManagementService.list_service_level_objectives
def list_service_level_objectives(self, server_name): _validate_not_none('server_name', server_name) response = self._perform_get( self._get_service_objectives_path(server_name), None) return _MinidomXmlToObject.parse_service_resources_response( response, ServiceObjective...
Gets the service level objectives for an Azure SQL Database server.
def list_service_level_objectives(self, server_name): ''' Gets the service level objectives for an Azure SQL Database server. server_name: Name of the server. ''' _validate_not_none('server_name', server_name) response = self._perform_get( self._g...
azure-servicemanagement-legacy/azure/servicemanagement/sqldatabasemanagementservice.py
Azure/azure-sdk-for-python
SqlDatabaseManagementService.create_database
def create_database(self, server_name, name, service_objective_id, edition=None, collation_name=None, max_size_bytes=None): _validate_not_none('server_name', server_name) _validate_not_none('name', name) _validate_not_none('service_objective_id', s...
Creates a new Azure SQL Database.
def create_database(self, server_name, name, service_objective_id, edition=None, collation_name=None, max_size_bytes=None): ''' Creates a new Azure SQL Database. server_name: Name of the server to contain the new database. name...
azure-servicemanagement-legacy/azure/servicemanagement/sqldatabasemanagementservice.py
Azure/azure-sdk-for-python
SqlDatabaseManagementService.update_database
def update_database(self, server_name, name, new_database_name=None, service_objective_id=None, edition=None, max_size_bytes=None): _validate_not_none('server_name', server_name) _validate_not_none('name', name) return self._perform_put( ...
Updates existing database details.
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. ...
azure-servicemanagement-legacy/azure/servicemanagement/sqldatabasemanagementservice.py
Azure/azure-sdk-for-python
SqlDatabaseManagementService.delete_database
def delete_database(self, server_name, name): return self._perform_delete(self._get_databases_path(server_name, name))
Deletes an Azure SQL Database.
def delete_database(self, server_name, name): ''' Deletes an Azure SQL Database. server_name: Name of the server where the database is located. name: Name of the database to delete. ''' return self._perform_delete(self._get_databases_path(server_n...
azure-servicemanagement-legacy/azure/servicemanagement/sqldatabasemanagementservice.py
Azure/azure-sdk-for-python
SqlDatabaseManagementService.list_databases
def list_databases(self, name): response = self._perform_get(self._get_list_databases_path(name), None) return _MinidomXmlToObject.parse_service_resources_response( response, Database)
List the SQL databases defined on the specified server name
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), None) return _MinidomXmlToObject.parse_service_resources_response( ...
azure-servicemanagement-legacy/azure/servicemanagement/sqldatabasemanagementservice.py
Azure/azure-sdk-for-python
TopLevelDomainsOperations.list_agreements
def list_agreements( self, name, include_privacy=None, for_transfer=None, custom_headers=None, raw=False, **operation_config): agreement_option = models.TopLevelDomainAgreementOption(include_privacy=include_privacy, for_transfer=for_transfer) def internal_paging(next_link=None, raw=False): ...
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.
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 ...
azure-mgmt-web/azure/mgmt/web/operations/top_level_domains_operations.py
Azure/azure-sdk-for-python
SessionReceiver.get_session_state
async def get_session_state(self): await self._can_run() response = await self._mgmt_request_response( REQUEST_RESPONSE_GET_SESSION_STATE_OPERATION, {'session-id': self.session_id}, mgmt_handlers.default) session_state = response.get(b'session-state') ...
Get the session state.
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-befor...
azure-servicebus/azure/servicebus/aio/async_receive_handler.py
Azure/azure-sdk-for-python
SessionReceiver.set_session_state
async def set_session_state(self, state): await self._can_run() state = state.encode(self.encoding) if isinstance(state, six.text_type) else state return await self._mgmt_request_response( REQUEST_RESPONSE_SET_SESSION_STATE_OPERATION, {'session-id': self.session_id, 'sess...
Set the session state.
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] ...
azure-servicebus/azure/servicebus/aio/async_receive_handler.py
Azure/azure-sdk-for-python
ReservationOperations.merge
def merge( self, reservation_order_id, sources=None, custom_headers=None, raw=False, polling=True, **operation_config): raw_result = self._merge_initial( reservation_order_id=reservation_order_id, sources=sources, custom_headers=custom_headers, raw=Tru...
Merges two `Reservation`s. Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged must have same properties.
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. ...
azure-mgmt-reservations/azure/mgmt/reservations/operations/reservation_operations.py
Azure/azure-sdk-for-python
HttpBearerChallenge._validate_challenge
def _validate_challenge(self, challenge): bearer_string = 'Bearer ' if not challenge: raise ValueError('Challenge cannot be empty') challenge = challenge.strip() if not challenge.startswith(bearer_string): raise ValueError('Challenge is not Bearer') retu...
Verifies that the challenge is a Bearer challenge and returns the key=value pairs.
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() if not challen...
azure-keyvault/azure/keyvault/http_bearer_challenge.py
Azure/azure-sdk-for-python
WorkspacesOperations.purge
def purge( self, resource_group_name, workspace_name, table, filters, custom_headers=None, raw=False, polling=True, **operation_config): raw_result = self._purge_initial( resource_group_name=resource_group_name, workspace_name=workspace_name, table=table, ...
Purges data in an Log Analytics workspace by a set of user-defined filters.
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. ...
azure-mgmt-loganalytics/azure/mgmt/loganalytics/operations/workspaces_operations.py
Azure/azure-sdk-for-python
_error_handler
def _error_handler(error): if error.condition == b'com.microsoft:server-busy': return errors.ErrorAction(retry=True, backoff=4) if error.condition == b'com.microsoft:timeout': return errors.ErrorAction(retry=True, backoff=2) if error.condition == b'com.microsoft:operation-cancelled': ...
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.
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 ...
azure-servicebus/azure/servicebus/common/errors.py
Azure/azure-sdk-for-python
ServiceBusService.create_queue
def create_queue(self, queue_name, queue=None, fail_on_exist=False): _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(_co...
Creates a new queue. Once created, this queue's resource manifest is immutable.
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: ...
azure-servicebus/azure/servicebus/control_client/servicebusservice.py
Azure/azure-sdk-for-python
ServiceBusService.delete_queue
def delete_queue(self, queue_name, fail_not_exist=False): _validate_not_none('queue_name', queue_name) request = HTTPRequest() request.method = 'DELETE' request.host = self._get_host() request.path = '/' + _str(queue_name) + '' request.path, request.query = self._httpclie...
Deletes an existing queue. This operation will also remove all associated state including messages in the queue.
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 thro...
azure-servicebus/azure/servicebus/control_client/servicebusservice.py
Azure/azure-sdk-for-python
ServiceBusService.get_queue
def get_queue(self, queue_name): _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 = self._httpclient._update_request_uri_query...
Retrieves an existing queue.
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.pa...
azure-servicebus/azure/servicebus/control_client/servicebusservice.py
Azure/azure-sdk-for-python
ServiceBusService.create_topic
def create_topic(self, topic_name, topic=None, fail_on_exist=False): _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(_co...
Creates a new topic. Once created, this topic resource manifest is immutable.
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: ...
azure-servicebus/azure/servicebus/control_client/servicebusservice.py
Azure/azure-sdk-for-python
ServiceBusService.get_topic
def get_topic(self, topic_name): _validate_not_none('topic_name', topic_name) request = HTTPRequest() request.method = 'GET' request.host = self._get_host() request.path = '/' + _str(topic_name) + '' request.path, request.query = self._httpclient._update_request_uri_query...
Retrieves the description for the specified topic.
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_hos...
azure-servicebus/azure/servicebus/control_client/servicebusservice.py
Azure/azure-sdk-for-python
ServiceBusService.create_rule
def create_rule(self, topic_name, subscription_name, rule_name, rule=None, fail_on_exist=False): _validate_not_none('topic_name', topic_name) _validate_not_none('subscription_name', subscription_name) _validate_not_none('rule_name', rule_name) request = HTTPRequest() ...
Creates a new rule. Once created, this rule's resource manifest is immutable.
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 o...
azure-servicebus/azure/servicebus/control_client/servicebusservice.py
Azure/azure-sdk-for-python
ServiceBusService.get_rule
def get_rule(self, topic_name, subscription_name, rule_name): _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 = s...
Retrieves the description for the specified rule.
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. ''' _v...
azure-servicebus/azure/servicebus/control_client/servicebusservice.py
Azure/azure-sdk-for-python
ServiceBusService.list_rules
def list_rules(self, topic_name, subscription_name): _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 = '/' + \ _...
Retrieves the rules that exist under the specified subscription.
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) ...
azure-servicebus/azure/servicebus/control_client/servicebusservice.py
Azure/azure-sdk-for-python
ServiceBusService.create_subscription
def create_subscription(self, topic_name, subscription_name, subscription=None, fail_on_exist=False): _validate_not_none('topic_name', topic_name) _validate_not_none('subscription_name', subscription_name) request = HTTPRequest() request.method = 'PUT' ...
Creates a new subscription. Once created, this subscription resource manifest is immutable.
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. subscripti...
azure-servicebus/azure/servicebus/control_client/servicebusservice.py
Azure/azure-sdk-for-python
ServiceBusService.get_subscription
def get_subscription(self, topic_name, subscription_name): _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 = '/' + \ ...
Gets an existing subscription.
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('...
azure-servicebus/azure/servicebus/control_client/servicebusservice.py
Azure/azure-sdk-for-python
ServiceBusService.list_subscriptions
def list_subscriptions(self, topic_name): _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._...
Retrieves the subscriptions in the specified topic.
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 = sel...
azure-servicebus/azure/servicebus/control_client/servicebusservice.py
Azure/azure-sdk-for-python
ServiceBusService.receive_queue_message
def receive_queue_message(self, queue_name, peek_lock=True, timeout=60): if peek_lock: return self.peek_lock_queue_message(queue_name, timeout) return self.read_delete_queue_message(queue_name, timeout)
Receive a message from a queue for processing.
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...
azure-servicebus/azure/servicebus/control_client/servicebusservice.py
Azure/azure-sdk-for-python
ServiceBusService.receive_subscription_message
def receive_subscription_message(self, topic_name, subscription_name, peek_lock=True, timeout=60): if peek_lock: return self.peek_lock_subscription_message(topic_name, subscription_name, ...
Receive a message from a subscription for processing.
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 subscri...
azure-servicebus/azure/servicebus/control_client/servicebusservice.py
Azure/azure-sdk-for-python
ServiceBusService.create_event_hub
def create_event_hub(self, hub_name, hub=None, fail_on_exist=False): _validate_not_none('hub_name', hub_name) request = HTTPRequest() request.method = 'PUT' request.host = self._get_host() request.path = '/' + _str(hub_name) + '?api-version=2014-01' request.body = _get_re...
Creates a new Event Hub.
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 re...
azure-servicebus/azure/servicebus/control_client/servicebusservice.py
Azure/azure-sdk-for-python
ServiceBusService.update_event_hub
def update_event_hub(self, hub_name, hub=None): _validate_not_none('hub_name', hub_name) request = HTTPRequest() request.method = 'PUT' request.host = self._get_host() request.path = '/' + _str(hub_name) + '?api-version=2014-01' request.body = _get_request_body(_convert_e...
Updates an Event Hub.
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...
azure-servicebus/azure/servicebus/control_client/servicebusservice.py
Azure/azure-sdk-for-python
ServiceBusService.get_event_hub
def get_event_hub(self, hub_name): _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 = self._httpclient._update_request_uri_query(req...
Retrieves an existing event hub.
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() reques...
azure-servicebus/azure/servicebus/control_client/servicebusservice.py
Azure/azure-sdk-for-python
ServiceBusService.send_event
def send_event(self, hub_name, message, device_id=None, broker_properties=None): _validate_not_none('hub_name', hub_name) request = HTTPRequest() request.method = 'POST' request.host = self._get_host() if device_id: request.path = '/{0}/publishers/{...
Sends a new message event to an Event Hub.
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...
azure-servicebus/azure/servicebus/control_client/servicebusservice.py
Azure/azure-sdk-for-python
ServiceBusService._update_service_bus_header
def _update_service_bus_header(self, request): if request.method in ['PUT', 'POST', 'MERGE', 'DELETE']: request.headers.append(('Content-Length', str(len(request.body)))) if not request.method in ['GET', 'HEAD']: for name, _ in request.headers: if name.l...
Add additional headers for Service Bus.
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. ...
azure-servicebus/azure/servicebus/control_client/servicebusservice.py
Azure/azure-sdk-for-python
ServiceBusWrapTokenAuthentication._get_authorization
def _get_authorization(self, request, httpclient): return 'WRAP access_token="' + \ self._get_token(request.host, request.path, httpclient) + '"'
return the signed string with token.
def _get_authorization(self, request, httpclient): ''' return the signed string with token. ''' return 'WRAP access_token="' + \ self._get_token(request.host, request.path, httpclient) + '"'
azure-servicebus/azure/servicebus/control_client/servicebusservice.py
Azure/azure-sdk-for-python
ServiceBusWrapTokenAuthentication._token_is_expired
def _token_is_expired(self, token): 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]) time_now = time.mktime(time.localtime()) return (token...
Check if token expires or not.
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]) time_...
azure-servicebus/azure/servicebus/control_client/servicebusservice.py
Azure/azure-sdk-for-python
ManagedClustersOperations.reset_service_principal_profile
def reset_service_principal_profile( self, resource_group_name, resource_name, client_id, secret=None, custom_headers=None, raw=False, polling=True, **operation_config): raw_result = self._reset_service_principal_profile_initial( resource_group_name=resource_group_name, resou...
Reset Service Principal Profile of a managed cluster. Update the service principal Profile for a managed cluster.
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. ...
azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/operations/managed_clusters_operations.py
Azure/azure-sdk-for-python
Message.delete
def delete(self): if self._queue_name: self.service_bus_service.delete_queue_message( self._queue_name, self.broker_properties['SequenceNumber'], self.broker_properties['LockToken']) elif self._topic_name and self._subscription_name: ...
Deletes itself if find queue name or topic name and subscription name.
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'], self.broker...
azure-servicebus/azure/servicebus/control_client/models.py
Azure/azure-sdk-for-python
Message.unlock
def unlock(self): if self._queue_name: self.service_bus_service.unlock_queue_message( self._queue_name, self.broker_properties['SequenceNumber'], self.broker_properties['LockToken']) elif self._topic_name and self._subscription_name: ...
Unlocks itself if find queue name or topic name and subscription name.
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'], self.broker...
azure-servicebus/azure/servicebus/control_client/models.py
Azure/azure-sdk-for-python
Message.renew_lock
def renew_lock(self): if self._queue_name: self.service_bus_service.renew_lock_queue_message( self._queue_name, self.broker_properties['SequenceNumber'], self.broker_properties['LockToken']) elif self._topic_name and self._subscription_name: ...
Renew lock on itself if find queue name or topic name and subscription name.
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'], ...
azure-servicebus/azure/servicebus/control_client/models.py
Azure/azure-sdk-for-python
Message.add_headers
def add_headers(self, request): if self.custom_properties: for name, value in self.custom_properties.items(): request.headers.append((name, self._serialize_escaped_properties_value(value))) request.headers.append(('Content-Type', self.type)) ...
add addtional headers to request for message request.
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(...
azure-servicebus/azure/servicebus/control_client/models.py
Azure/azure-sdk-for-python
Message.as_batch_body
def as_batch_body(self): if sys.version_info >= (3,) and isinstance(self.body, bytes): body = self.body.decode('utf-8') else: body = self.body result = {'Body': body} if self.custom_properties: result['UserProperties...
return the current message as expected by batch body format
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 ...
azure-servicebus/azure/servicebus/control_client/models.py
Azure/azure-sdk-for-python
ServiceFabricClientAPIs.get_repair_task_list
def get_repair_task_list( self, task_id_filter=None, state_filter=None, executor_filter=None, custom_headers=None, raw=False, **operation_config): api_version = "6.0" url = self.get_repair_task_list.metadata['url'] query_parameters = {} query_parameters['a...
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.
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 dir...
azure-servicefabric/azure/servicefabric/service_fabric_client_ap_is.py
Azure/azure-sdk-for-python
ServiceFabricClientAPIs.submit_property_batch
def submit_property_batch( self, name_id, timeout=60, operations=None, custom_headers=None, raw=False, **operation_config): property_batch_description_list = models.PropertyBatchDescriptionList(operations=operations) api_version = "6.0" url = self.submit_property_batch.met...
Submits a property batch. Submits a batch of property operations. Either all or none of the operations will be committed.
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 Servi...
azure-servicefabric/azure/servicefabric/service_fabric_client_ap_is.py
Azure/azure-sdk-for-python
_general_error_handler
def _general_error_handler(http_error): message = str(http_error) if http_error.respbody is not None: message += '\n' + http_error.respbody.decode('utf-8-sig') raise AzureHttpError(message, http_error.status)
Simple error handler for azure.
def _general_error_handler(http_error): ''' Simple error handler for azure.''' message = str(http_error) if http_error.respbody is not None: message += '\n' + http_error.respbody.decode('utf-8-sig') raise AzureHttpError(message, http_error.status)
azure-servicemanagement-legacy/azure/servicemanagement/_common_error.py
Azure/azure-sdk-for-python
WebAppsOperations.start_web_site_network_trace_operation
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): raw_result = self._start_web_site_network_trace_operation_initial( resource_group...
Start capturing network packets for the site. Start capturing network packets for the site.
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...
azure-mgmt-web/azure/mgmt/web/operations/web_apps_operations.py
Azure/azure-sdk-for-python
WebAppsOperations.list_slot_differences_slot
def list_slot_differences_slot( self, resource_group_name, name, slot, target_slot, preserve_vnet, custom_headers=None, raw=False, **operation_config): slot_swap_entity = models.CsmSlotEntity(target_slot=target_slot, preserve_vnet=preserve_vnet) def internal_paging(next_link=None, raw=False...
Get the difference in configuration settings between two web app slots. Get the difference in configuration settings between two web app slots.
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...
azure-mgmt-web/azure/mgmt/web/operations/web_apps_operations.py
Azure/azure-sdk-for-python
WebAppsOperations.swap_slot_slot
def swap_slot_slot( self, resource_group_name, name, slot, target_slot, preserve_vnet, custom_headers=None, raw=False, polling=True, **operation_config): raw_result = self._swap_slot_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, ...
Swaps two deployment slots of an app. Swaps two deployment slots of an app.
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 ...
azure-mgmt-web/azure/mgmt/web/operations/web_apps_operations.py
Azure/azure-sdk-for-python
EventsOperations.get_by_type
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): url = self.get_by_type.metadata['url'] path_format_arguments ...
Execute OData query. Executes an OData query for events.
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. ...
azure-applicationinsights/azure/applicationinsights/operations/events_operations.py
Azure/azure-sdk-for-python
LargeFaceListOperations.add_face_from_stream
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): url = self.add_face_from_stream.metadata['url'] path_format_arguments = { 'Endpoint': self._serialize.url("sel...
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.
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 persistedFace...
azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/large_face_list_operations.py
Azure/azure-sdk-for-python
KeyVaultAuthBase._handle_redirect
def _handle_redirect(self, r, **kwargs): if r.is_redirect: self._thread_local.auth_attempted = False
Reset auth_attempted on redirects.
def _handle_redirect(self, r, **kwargs): """Reset auth_attempted on redirects.""" if r.is_redirect: self._thread_local.auth_attempted = False
azure-keyvault/azure/keyvault/key_vault_authentication.py
Azure/azure-sdk-for-python
MigrationConfigsOperations.create_and_start_migration
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): raw_result = self._create_and_start_migration_initial( resource_group_name=resource_group_name, ...
Creates Migration configuration and starts migration of entities from Standard to Premium namespace.
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. ...
azure-mgmt-servicebus/azure/mgmt/servicebus/operations/migration_configs_operations.py
Azure/azure-sdk-for-python
EventGridClient.publish_events
def publish_events( self, topic_hostname, events, custom_headers=None, raw=False, **operation_config): url = self.publish_events.metadata['url'] path_format_arguments = { 'topicHostname': self._serialize.url("topic_hostname", topic_hostname, 'str', skip_quote=True) ...
Publishes a batch of events to an Azure Event Grid topic.
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_hostn...
azure-eventgrid/azure/eventgrid/event_grid_client.py
Azure/azure-sdk-for-python
DefaultProfile.use
def use(self, profile): if not isinstance(profile, (KnownProfiles, ProfileDefinition)): raise ValueError("Can only set as default a ProfileDefinition or a KnownProfiles") type(self).profile = profile
Define a new default profile.
def use(self, profile): """Define a new default profile.""" if not isinstance(profile, (KnownProfiles, ProfileDefinition)): raise ValueError("Can only set as default a ProfileDefinition or a KnownProfiles") type(self).profile = profile
azure-common/azure/profiles/__init__.py
Azure/azure-sdk-for-python
PolicyTrackedResourcesOperations.list_query_results_for_management_group
def list_query_results_for_management_group( self, management_group_name, query_options=None, custom_headers=None, raw=False, **operation_config): top = None if query_options is not None: top = query_options.top filter = None if query_options is not None: ...
Queries policy tracked resources under the management group.
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_gr...
azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/policy_tracked_resources_operations.py
Azure/azure-sdk-for-python
ServiceBusMixin.create_queue
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_detec...
Create a queue entity.
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_detec...
azure-servicebus/azure/servicebus/common/mixins.py
Azure/azure-sdk-for-python
ServiceBusMixin.delete_queue
def delete_queue(self, queue_name, fail_not_exist=False): try: return self.mgmt_client.delete_queue(queue_name, fail_not_exist=fail_not_exist) except requests.exceptions.ConnectionError as e: raise ServiceBusConnectionError("Namespace: {} not found".format(self.service_namespace)...
Delete a queue entity.
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 ServiceBusResour...
azure-servicebus/azure/servicebus/common/mixins.py
Azure/azure-sdk-for-python
ServiceBusMixin.create_topic
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): topic_properties = Topic( m...
Create a topic entity.
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. :par...
azure-servicebus/azure/servicebus/common/mixins.py
Azure/azure-sdk-for-python
ServiceBusMixin.delete_topic
def delete_topic(self, topic_name, fail_not_exist=False): try: return self.mgmt_client.delete_topic(topic_name, fail_not_exist=fail_not_exist) except requests.exceptions.ConnectionError as e: raise ServiceBusConnectionError("Namespace: {} not found".format(self.service_namespace)...
Delete a topic entity.
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 ServiceBusResour...
azure-servicebus/azure/servicebus/common/mixins.py
Azure/azure-sdk-for-python
ServiceBusMixin.create_subscription
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...
Create a subscription entity.
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...
azure-servicebus/azure/servicebus/common/mixins.py
Azure/azure-sdk-for-python
BaseClient.from_connection_string
def from_connection_string(cls, conn_str, name=None, **kwargs): address, policy, key, entity = parse_conn_str(conn_str) entity = name or entity address = build_uri(address, entity) name = address.split('/')[-1] return cls(address, name, shared_access_key_name=policy, shared_acces...
Create a Client from a Service Bus connection string.
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 connecti...
azure-servicebus/azure/servicebus/common/mixins.py
Azure/azure-sdk-for-python
BaseClient.get_properties
def get_properties(self): try: self.entity = self._get_entity() self.properties = dict(self.entity) if hasattr(self.entity, 'requires_session'): self.requires_session = self.entity.requires_session return self.properties except AzureService...
Perform an operation to update the properties of the entity.
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: ~az...
azure-servicebus/azure/servicebus/common/mixins.py
Azure/azure-sdk-for-python
SessionMixin.expired
def expired(self): if self.locked_until and self.locked_until <= datetime.datetime.now(): return True return False
Whether the receivers lock on a particular session has expired.
def expired(self): """Whether the receivers lock on a particular session has expired. :rtype: bool """ if self.locked_until and self.locked_until <= datetime.datetime.now(): return True return False
azure-servicebus/azure/servicebus/common/mixins.py
Azure/azure-sdk-for-python
SessionOperations.create
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): raw_result = self._create_initial( reso...
Creates a session for a node.
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 re...
azure-mgmt-servermanager/azure/mgmt/servermanager/operations/session_operations.py
Azure/azure-sdk-for-python
SubscriptionFactoryOperations.create_subscription
def create_subscription( self, billing_account_name, invoice_section_name, body, custom_headers=None, raw=False, polling=True, **operation_config): raw_result = self._create_subscription_initial( billing_account_name=billing_account_name, invoice_section_name=invoice_section_...
Creates an Azure subscription.
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_ac...
azure-mgmt-subscription/azure/mgmt/subscription/operations/subscription_factory_operations.py
Azure/azure-sdk-for-python
LogAnalyticsOperations.export_request_rate_by_interval
def export_request_rate_by_interval( self, parameters, location, custom_headers=None, raw=False, polling=True, **operation_config): raw_result = self._export_request_rate_by_interval_initial( parameters=parameters, location=location, custom_headers=custom_headers,...
Export logs that show Api requests made by this subscription in the given time window to show throttling activities.
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 s...
azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/log_analytics_operations.py
Azure/azure-sdk-for-python
_handle_output
def _handle_output(results_queue): results = [] while results_queue: queue_item = results_queue.pop() results.append(queue_item) return results
Scan output for exceptions If there is an output from an add task collection call add it to the results.
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 :rt...
azure-batch/azure/batch/custom/patch.py
Azure/azure-sdk-for-python
_TaskWorkflowManager._bulk_add_tasks
def _bulk_add_tasks(self, results_queue, chunk_tasks_to_add): try: add_collection_response = self._original_add_collection( self._client, self._job_id, chunk_tasks_to_add, self._task_add_collection_options, self._custom_...
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.
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 resu...
azure-batch/azure/batch/custom/patch.py
Azure/azure-sdk-for-python
_TaskWorkflowManager.task_collection_thread_handler
def task_collection_thread_handler(self, results_queue): while self.tasks_to_add and not self.errors: max_tasks = self._max_tasks_per_request chunk_tasks_to_add = [] with self._pending_queue_lock: while len(chunk_tasks_to_add) < max_tasks and self.t...
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.
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 ...
azure-batch/azure/batch/custom/patch.py
Azure/azure-sdk-for-python
build_config
def build_config(config : Dict[str, Any]) -> Dict[str, str]: result = config.copy() is_stable = result.pop("is_stable", False) if is_stable: result["classifier"] = "Development Status :: 5 - Production/Stable" else: result["classifier"] = "Development Status :: 4 - Beta" pa...
Will build the actual config for Jinja2, based on SDK config.
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...
azure-sdk-tools/packaging_tools/__init__.py
Azure/azure-sdk-for-python
GlobalUsersOperations.reset_password
def reset_password( self, user_name, reset_password_payload, custom_headers=None, raw=False, polling=True, **operation_config): raw_result = self._reset_password_initial( user_name=user_name, reset_password_payload=reset_password_payload, custom_headers=custom_hea...
Resets the user password on an environment This operation can take a while to complete.
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:...
azure-mgmt-labservices/azure/mgmt/labservices/operations/global_users_operations.py
Azure/azure-sdk-for-python
GlobalUsersOperations.start_environment
def start_environment( self, user_name, environment_id, custom_headers=None, raw=False, polling=True, **operation_config): raw_result = self._start_environment_initial( user_name=user_name, environment_id=environment_id, custom_headers=custom_headers, ...
Starts an environment by starting all resources inside the environment. This operation can take a while to complete.
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. ...
azure-mgmt-labservices/azure/mgmt/labservices/operations/global_users_operations.py
Azure/azure-sdk-for-python
_create_message
def _create_message(response, service_instance): respbody = response.body custom_properties = {} broker_properties = None message_type = None message_location = None for name, value in response.headers: if name.lower() == 'brokerproperties': broker_properties = json.loa...
Create message from response.
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...
azure-servicebus/azure/servicebus/control_client/_serialization.py
Azure/azure-sdk-for-python
_convert_etree_element_to_rule
def _convert_etree_element_to_rule(entry_element): 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) if filter_element is n...
Converts entry element to rule object. The format of xml for
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...
azure-servicebus/azure/servicebus/control_client/_serialization.py
Azure/azure-sdk-for-python
_convert_etree_element_to_queue
def _convert_etree_element_to_queue(entry_element): queue = 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', 'lock_duration', None),...
Converts entry element to queue object. The format of xml response for
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>PT5...
azure-servicebus/azure/servicebus/control_client/_serialization.py
Azure/azure-sdk-for-python
_convert_etree_element_to_topic
def _convert_etree_element_to_topic(entry_element): 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...
Converts entry element to topic The xml format for
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.micro...
azure-servicebus/azure/servicebus/control_client/_serialization.py
Azure/azure-sdk-for-python
_convert_etree_element_to_subscription
def _convert_etree_element_to_subscription(entry_element): 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', ...
Converts entry element to subscription The xml format for
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" ...
azure-servicebus/azure/servicebus/control_client/_serialization.py
Azure/azure-sdk-for-python
CertificateOperations.create
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): raw_result = self._create_initial( resource_group_name=resource_group_name, account_name=account_name, ...
Creates a new certificate inside the specified account.
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 th...
azure-mgmt-batch/azure/mgmt/batch/operations/certificate_operations.py
Azure/azure-sdk-for-python
CertificateOperations.delete
def delete( self, resource_group_name, account_name, certificate_name, custom_headers=None, raw=False, **operation_config): raw_result = self._delete_initial( resource_group_name=resource_group_name, account_name=account_name, certificate_name=certificate_name, ...
Deletes the specified certificate.
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...
azure-mgmt-batch/azure/mgmt/batch/operations/certificate_operations.py
Azure/azure-sdk-for-python
get_client_from_cli_profile
def get_client_from_cli_profile(client_class, **kwargs): 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(r...
Return a SDK client initialized with current CLI credentials, CLI default subscription and CLI default cloud. This method will fill automatically the following client
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 p...
azure-common/azure/common/client_factory.py
Azure/azure-sdk-for-python
get_client_from_json_dict
def get_client_from_json_dict(client_class, config_dict, **kwargs): is_graphrbac = client_class.__name__ == 'GraphRbacManagementClient' parameters = { 'subscription_id': config_dict.get('subscriptionId'), 'base_url': config_dict.get('resourceManagerEndpointUrl'), 'tenant_id': config_dict...
Return a SDK client initialized with a JSON auth dict. The easiest way to obtain this content is to call the following CLI
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 t...
azure-common/azure/common/client_factory.py
Azure/azure-sdk-for-python
get_client_from_auth_file
def get_client_from_auth_file(client_class, auth_path=None, **kwargs): auth_path = auth_path or os.environ['AZURE_AUTH_LOCATION'] with io.open(auth_path, 'r', encoding='utf-8-sig') as auth_fd: config_dict = json.load(auth_fd) return get_client_from_json_dict(client_class, config_dict, **kwargs)
Return a SDK client initialized with auth file. The easiest way to obtain this file is to call the following CLI
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 ...
azure-common/azure/common/client_factory.py
Azure/azure-sdk-for-python
_ETreeXmlToObject.get_entry_properties_from_element
def get_entry_properties_from_element(element, include_id, id_prefix_to_skip=None, use_title_as_id=False): 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 up...
get properties from element tree element
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 no...
azure-servicebus/azure/servicebus/control_client/_common_serialization.py
Azure/azure-sdk-for-python
DpsCertificateOperations.delete
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, ...
Delete the Provisioning Service Certificate. Deletes the specified certificate assosciated with the Provisioning Service.
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, ...
azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/operations/dps_certificate_operations.py
Azure/azure-sdk-for-python
ServiceBusClient.get_queue
def get_queue(self, queue_name): try: queue = self.mgmt_client.get_queue(queue_name) except requests.exceptions.ConnectionError as e: raise ServiceBusConnectionError("Namespace: {} not found".format(self.service_namespace), e) except AzureServiceBusResourceNotFound: ...
Get a client for a queue entity.
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...
azure-servicebus/azure/servicebus/servicebus_client.py
Azure/azure-sdk-for-python
ServiceBusClient.list_queues
def list_queues(self): try: queues = self.mgmt_client.list_queues() except requests.exceptions.ConnectionError as e: raise ServiceBusConnectionError("Namespace: {} not found".format(self.service_namespace), e) queue_clients = [] for queue in queues: qu...
Get clients for all queue entities in the namespace.
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:: ../exa...
azure-servicebus/azure/servicebus/servicebus_client.py
Azure/azure-sdk-for-python
ServiceBusClient.get_topic
def get_topic(self, topic_name): try: topic = self.mgmt_client.get_topic(topic_name) except requests.exceptions.ConnectionError as e: raise ServiceBusConnectionError("Namespace: {} not found".format(self.service_namespace), e) except AzureServiceBusResourceNotFound: ...
Get a client for a topic entity.
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...
azure-servicebus/azure/servicebus/servicebus_client.py
Azure/azure-sdk-for-python
ServiceBusClient.list_topics
def list_topics(self): try: topics = self.mgmt_client.list_topics() except requests.exceptions.ConnectionError as e: raise ServiceBusConnectionError("Namespace: {} not found".format(self.service_namespace), e) topic_clients = [] for topic in topics: to...
Get a client for all topic entities in the namespace.
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:: ../ex...
azure-servicebus/azure/servicebus/servicebus_client.py
Azure/azure-sdk-for-python
ReceiveClientMixin.settle_deferred_messages
def settle_deferred_messages(self, settlement, messages, **kwargs): 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...
Settle messages that have been previously deferred.
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 settlemen...
azure-servicebus/azure/servicebus/servicebus_client.py
Azure/azure-sdk-for-python
WebsiteManagementService.get_site
def get_site(self, webspace_name, website_name): return self._perform_get(self._get_sites_details_path(webspace_name, website_name), Site)
List the web sites defined on this webspace.
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. ''' return self._perform_get(self._get_sites_details_path(webspace_na...
azure-servicemanagement-legacy/azure/servicemanagement/websitemanagementservice.py
Azure/azure-sdk-for-python
WebsiteManagementService.create_site
def create_site(self, webspace_name, website_name, geo_region, host_names, plan='VirtualDedicatedPlan', compute_mode='Shared', server_farm=None, site_mode=None): xml = _XmlSerializer.create_website_to_xml(webspace_name, website_name, geo_region, plan, host_names, compute_...
Create a website.
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_na...
azure-servicemanagement-legacy/azure/servicemanagement/websitemanagementservice.py
Azure/azure-sdk-for-python
WebsiteManagementService.delete_site
def delete_site(self, webspace_name, website_name, delete_empty_server_farm=False, delete_metrics=False): path = self._get_sites_details_path(webspace_name, website_name) query = '' if delete_empty_server_farm: query += '&deleteEmptyServerFarm=true' if del...
Delete a website.
def delete_site(self, webspace_name, website_name, delete_empty_server_farm=False, delete_metrics=False): ''' Delete a website. webspace_name: The name of the webspace. website_name: The name of the website. delete_empty_server_farm: ...
azure-servicemanagement-legacy/azure/servicemanagement/websitemanagementservice.py
Azure/azure-sdk-for-python
WebsiteManagementService.update_site
def update_site(self, webspace_name, website_name, state=None): xml = _XmlSerializer.update_website_to_xml(state) return self._perform_put( self._get_sites_details_path(webspace_name, website_name), xml, as_async=True)
Update a web site.
def update_site(self, webspace_name, website_name, state=None): ''' Update a web site. webspace_name: The name of the webspace. website_name: The name of the website. state: The wanted state ('Running' or 'Stopped' accepted) ''' ...
azure-servicemanagement-legacy/azure/servicemanagement/websitemanagementservice.py