def delete_queue(self, queue_name, fail_not_exist=False): """ Permanently deletes the specified queue. queue_name: name of the queue. fail_not_exist: specify whether throw exception when queue doesn't exist. """ _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 = _update_request_uri_query_local_storage(request, self.use_local_storage) request.headers = _update_storage_queue_header(request, self.account_name, self.account_key) if not fail_not_exist: try: self._perform_request(request) return True except WindowsAzureError as e: _dont_fail_not_exist(e) return False else: self._perform_request(request) return True
def delete_topic(self, topic_name, fail_not_exist=False): ''' Deletes an existing topic. This operation will also remove all associated state including associated subscriptions. topic_name: name of the topic. fail_not_exist: specify whether throw exception when topic doesn't exist. ''' _validate_not_none('topic_name', topic_name) request = HTTPRequest() request.method = 'DELETE' request.host = self.service_namespace + SERVICE_BUS_HOST_BASE request.path = '/' + str(topic_name) + '' request.path, request.query = _update_request_uri_query(request) request.headers = _update_service_bus_header(request, self.account_key, self.issuer) if not fail_not_exist: try: self._perform_request(request) return True except WindowsAzureError as e: _dont_fail_not_exist(e) return False else: self._perform_request(request) return True
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() request.method = 'DELETE' request.host = self._get_host() request.path = '/' + _str(queue_name) + '' request.path, request.query = _update_request_uri_query(request) request.headers = _update_service_bus_header(request, self.account_key, self.issuer) if not fail_not_exist: try: self._perform_request(request) return True except WindowsAzureError as e: _dont_fail_not_exist(e) return False else: self._perform_request(request) return True
def delete_queue(self, queue_name, fail_not_exist=False): ''' Permanently deletes the specified queue. queue_name: Name of the queue. fail_not_exist: Specify whether throw exception when queue doesn't exist. ''' _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 = _update_request_uri_query_local_storage( request, self.use_local_storage) request.headers = _update_storage_queue_header(request, self.account_name, self.account_key) if not fail_not_exist: try: self._perform_request(request) return True except WindowsAzureError as e: _dont_fail_not_exist(e) return False else: self._perform_request(request) return True
def delete_container(self, container_name, fail_not_exist=False): ''' Marks the specified container for deletion. fail_not_exist: specify whether to throw an exception when the container doesn't exist. ''' _validate_not_none('container_name', container_name) request = HTTPRequest() request.method = 'DELETE' request.host = self._get_host() request.path = '/' + str(container_name) + '?restype=container' request.path, request.query = _update_request_uri_query_local_storage( request, self.use_local_storage) request.headers = _update_storage_blob_header(request, self.account_name, self.account_key) if not fail_not_exist: try: self._perform_request(request) return True except WindowsAzureError as e: _dont_fail_not_exist(e) return False else: self._perform_request(request) return True
def delete_table(self, table_name, fail_not_exist=False): ''' table_name: Name of the table to delete. fail_not_exist: Specify whether throw exception when table doesn't exist. ''' _validate_not_none('table_name', table_name) request = HTTPRequest() request.method = 'DELETE' request.host = self._get_host() request.path = '/Tables(\'' + _str(table_name) + '\')' request.path, request.query = _update_request_uri_query_local_storage( request, self.use_local_storage) request.headers = _update_storage_table_header(request) if not fail_not_exist: try: self._perform_request(request) return True except WindowsAzureError as ex: _dont_fail_not_exist(ex) return False else: self._perform_request(request) return True
def delete_queue(self, queue_name, fail_not_exist=False): ''' Permanently deletes the specified queue. queue_name: Name of the queue. fail_not_exist: Specify whether throw exception when queue doesn't exist. ''' _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 = _update_request_uri_query_local_storage( request, self.use_local_storage) request.headers = _update_storage_queue_header( request, self.authentication) if not fail_not_exist: try: self._perform_request(request) return True except WindowsAzureError as ex: _dont_fail_not_exist(ex) return False else: self._perform_request(request) return True
def delete_subscription(self, topic_name, subscription_name, fail_not_exist=False): ''' Deletes an existing subscription. topic_name: the name of the topic subscription_name: the name of the subscription fail_not_exist: specify whether to throw an exception when the subscription doesn't exist. ''' _validate_not_none('topic_name', topic_name) _validate_not_none('subscription_name', subscription_name) request = HTTPRequest() request.method = 'DELETE' request.host = self.service_namespace + SERVICE_BUS_HOST_BASE request.path = '/' + str(topic_name) + '/subscriptions/' + str(subscription_name) + '' request.path, request.query = _update_request_uri_query(request) request.headers = _update_service_bus_header(request, self.account_key, self.issuer) if not fail_not_exist: try: self._perform_request(request) return True except WindowsAzureError as e: _dont_fail_not_exist(e) return False else: self._perform_request(request) return True
def delete_event_hub(self, hub_name, fail_not_exist=False): ''' Deletes an Event Hub. This operation will also remove all associated state. hub_name: Name of the event hub to delete. fail_not_exist: Specify whether to throw an exception if the event hub doesn't exist. ''' _validate_not_none('hub_name', hub_name) request = HTTPRequest() request.method = 'DELETE' request.host = self._get_host() request.path = '/' + _str(hub_name) + '?api-version=2014-01' request.path, request.query = _update_request_uri_query(request) request.headers = self._update_service_bus_header(request) if not fail_not_exist: try: self._perform_request(request) return True except WindowsAzureError as ex: _dont_fail_not_exist(ex) return False else: self._perform_request(request) return True
def delete_rule(self, topic_name, subscription_name, rule_name, fail_not_exist=False): ''' Deletes an existing rule. topic_name: Name of the topic. subscription_name: Name of the subscription. rule_name: Name of the rule to delete. DEFAULT_RULE_NAME=$Default. Use DEFAULT_RULE_NAME to delete default rule for the subscription. fail_not_exist: Specify whether throw exception when rule doesn't exist. ''' _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 = 'DELETE' request.host = self._get_host() request.path = '/' + _str(topic_name) + '/subscriptions/' + _str(subscription_name) + '/rules/' + _str(rule_name) + '' request.path, request.query = _update_request_uri_query(request) request.headers = self._update_service_bus_header(request) if not fail_not_exist: try: self._perform_request(request) return True except WindowsAzureError as e: _dont_fail_not_exist(e) return False else: self._perform_request(request) return True
def delete_topic(self, topic_name, fail_not_exist=False): ''' Deletes an existing topic. This operation will also remove all associated state including associated subscriptions. topic_name: Name of the topic to delete. fail_not_exist: Specify whether throw exception when topic doesn't exist. ''' _validate_not_none('topic_name', topic_name) request = HTTPRequest() request.method = 'DELETE' request.host = self._get_host() request.path = '/' + _str(topic_name) + '' request.path, request.query = _update_request_uri_query(request) request.headers = self._update_service_bus_header(request) if not fail_not_exist: try: self._perform_request(request) return True except WindowsAzureError as ex: _dont_fail_not_exist(ex) return False else: self._perform_request(request) return True
def delete_subscription(self, topic_name, subscription_name, fail_not_exist=False): ''' Deletes an existing subscription. topic_name: Name of the topic. subscription_name: Name of the subscription to delete. fail_not_exist: Specify whether to throw an exception when the subscription doesn't exist. ''' _validate_not_none('topic_name', topic_name) _validate_not_none('subscription_name', subscription_name) request = HTTPRequest() request.method = 'DELETE' request.host = self._get_host() request.path = '/' + \ _str(topic_name) + '/subscriptions/' + _str(subscription_name) + '' request.path, request.query = _update_request_uri_query(request) request.headers = self._update_service_bus_header(request) if not fail_not_exist: try: self._perform_request(request) return True except WindowsAzureError as ex: _dont_fail_not_exist(ex) return False else: self._perform_request(request) return True
def delete_rule(self, topic_name, subscription_name, rule_name, fail_not_exist=False): ''' Deletes an existing rule. topic_name: the name of the topic subscription_name: the name of the subscription rule_name: the name of the rule. DEFAULT_RULE_NAME=$Default. Use DEFAULT_RULE_NAME to delete default rule for the subscription. fail_not_exist: specify whether throw exception when rule doesn't exist. ''' _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 = 'DELETE' request.host = self._get_host() request.path = '/' + str(topic_name) + '/subscriptions/' + str(subscription_name) + '/rules/' + str(rule_name) + '' request.path, request.query = _update_request_uri_query(request) request.headers = _update_service_bus_header(request, self.account_key, self.issuer) if not fail_not_exist: try: self._perform_request(request) return True except WindowsAzureError as e: _dont_fail_not_exist(e) return False else: self._perform_request(request) return True
def delete_container(self, container_name, fail_not_exist=False): ''' Marks the specified container for deletion. fail_not_exist: specify whether to throw an exception when the container doesn't exist. ''' _validate_not_none('container_name', container_name) request = HTTPRequest() request.method = 'DELETE' request.host = self._get_host() request.path = '/' + _str(container_name) + '?restype=container' request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage) request.headers = _update_storage_blob_header(request, self.account_name, self.account_key) if not fail_not_exist: try: self._perform_request(request) return True except WindowsAzureError as e: _dont_fail_not_exist(e) return False else: self._perform_request(request) return True