def list_namespaces(self): ''' List the service bus namespaces defined on the account. ''' response = self._perform_get(self._get_path('services/serviceBus/Namespaces/', None), None) return _convert_response_to_feeds(response, _ServiceBusManagementXmlSerializer.xml_to_namespace)
def query_tables(self, table_name=None, top=None, next_table_name=None): ''' Returns a list of tables under the specified account. table_name: Optional. The specific table to query. top: Optional. Maximum number of tables to return. next_table_name: Optional. When top is used, the next table name is stored in result.x_ms_continuation['NextTableName'] ''' request = HTTPRequest() request.method = 'GET' request.host = self._get_host() if table_name is not None: uri_part_table_name = "('" + table_name + "')" else: uri_part_table_name = "" request.path = '/Tables' + uri_part_table_name + '' request.query = [('$top', _int_or_none(top)), ('NextTableName', _str_or_none(next_table_name))] request.path, request.query = _update_request_uri_query_local_storage( request, self.use_local_storage) request.headers = _update_storage_table_header(request) response = self._perform_request(request) return _convert_response_to_feeds(response, _convert_xml_to_table)
def query_entities(self, table_name, filter=None, select=None, top=None, next_partition_key=None, next_row_key=None): """ Get entities in a table; includes the $filter and $select options. table_name: Table to query. filter: Optional. Filter as described at http://msdn.microsoft.com/en-us/library/windowsazure/dd894031.aspx select: Optional. Property names to select from the entities. top: Optional. Maximum number of entities to return. next_partition_key: Optional. When top is used, the next partition key is stored in result.x_ms_continuation['NextPartitionKey'] next_row_key: Optional. When top is used, the next partition key is stored in result.x_ms_continuation['NextRowKey'] """ _validate_not_none('table_name', table_name) request = HTTPRequest() request.method = 'GET' request.host = self._get_host() request.path = '/' + _str(table_name) + '()' request.query = [ ('$filter', _str_or_none(filter)), ('$select', _str_or_none(select)), ('$top', _int_or_none(top)), ('NextPartitionKey', _str_or_none(next_partition_key)), ('NextRowKey', _str_or_none(next_row_key)) ] request.path, request.query = _update_request_uri_query_local_storage( request, self.use_local_storage) request.headers = _update_storage_table_header(request) response = self._perform_request(request) return _convert_response_to_feeds(response, _convert_xml_to_entity)
def query_tables(self, table_name = None, top=None, next_table_name=None): ''' Returns a list of tables under the specified account. table_name: Optional. The specific table to query. top: Optional. Maximum number of tables to return. next_table_name: Optional. When top is used, the next table name is stored in result.x_ms_continuation['NextTableName'] ''' request = HTTPRequest() request.method = 'GET' request.host = self._get_host() if table_name is not None: uri_part_table_name = "('" + table_name + "')" else: uri_part_table_name = "" request.path = '/Tables' + uri_part_table_name + '' request.query = [ ('$top', _int_or_none(top)), ('NextTableName', _str_or_none(next_table_name)) ] request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage) request.headers = _update_storage_table_header(request) response = self._perform_request(request) return _convert_response_to_feeds(response, _convert_xml_to_table)
def query_entities(self, table_name, filter=None, select=None, top=None, next_partition_key=None, next_row_key=None): ''' Get entities in a table; includes the $filter and $select options. table_name: the table to query filter: a filter as described at http://msdn.microsoft.com/en-us/library/windowsazure/dd894031.aspx select: the property names to select from the entities top: the maximum number of entities to return ''' _validate_not_none('table_name', table_name) request = HTTPRequest() request.method = 'GET' request.host = self._get_host() request.path = '/' + str(table_name) + '()' request.query = [ ('$filter', _str_or_none(filter)), ('$select', _str_or_none(select)), ('$top', _int_or_none(top)), ('NextPartitionKey', _str_or_none(next_partition_key)), ('NextRowKey', _str_or_none(next_row_key)) ] request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage) request.headers = _update_storage_table_header(request) response = self._perform_request(request) return _convert_response_to_feeds(response, _convert_xml_to_entity)
def query_entities(self, table_name, filter=None, select=None, top=None, next_partition_key=None, next_row_key=None): ''' Get entities in a table; includes the $filter and $select options. table_name: the table to query filter: a filter as described at http://msdn.microsoft.com/en-us/library/windowsazure/dd894031.aspx select: the property names to select from the entities top: the maximum number of entities to return ''' _validate_not_none('table_name', table_name) request = HTTPRequest() request.method = 'GET' request.host = _get_table_host(self.account_name, self.use_local_storage) request.path = '/' + str(table_name) + '()' request.query = [ ('$filter', _str_or_none(filter)), ('$select', _str_or_none(select)), ('$top', _int_or_none(top)), ('NextPartitionKey', _str_or_none(next_partition_key)), ('NextRowKey', _str_or_none(next_row_key)) ] request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage) request.headers = _update_storage_table_header(request) response = self._perform_request(request) return _convert_response_to_feeds(response, _convert_xml_to_entity)
def get_regions(self): ''' Get list of available service bus regions. ''' response = self._perform_get(self._get_path('services/serviceBus/Regions/', None), None) return _convert_response_to_feeds(response, _ServiceBusManagementXmlSerializer.xml_to_region)
def get_regions(self): ''' Get list of available service bus regions. ''' response = self._perform_get( self._get_path('services/serviceBus/Regions/', None), None) return _convert_response_to_feeds( response, _ServiceBusManagementXmlSerializer.xml_to_region)
def list_namespaces(self): ''' List the service bus namespaces defined on the account. ''' response = self._perform_get( self._get_path('services/serviceBus/Namespaces/', None), None) return _convert_response_to_feeds( response, _ServiceBusManagementXmlSerializer.xml_to_namespace)
def list_relays(self, name): ''' Retrieves the relays in the service namespace. name: Name of the service bus namespace. ''' response = self._perform_get(self._get_list_relays_path(name), None) return _convert_response_to_feeds(response, RelayDescription)
def list_notification_hubs(self, name): ''' Retrieves the notification hubs in the service namespace. name: Name of the service bus namespace. ''' response = self._perform_get( self._get_list_notification_hubs_path(name), None) return _convert_response_to_feeds(response, NotificationHubDescription)
def list_queues(self, name): ''' Enumerates the queues in the service namespace. name: Name of the service bus namespace. ''' _validate_not_none('name', name) response = self._perform_get(self._get_list_queues_path(name), None) return _convert_response_to_feeds(response, QueueDescription)
def list_relays(self, name): ''' Retrieves the relays in the service namespace. name: Name of the service bus namespace. ''' response = self._perform_get( self._get_list_relays_path(name), None) return _convert_response_to_feeds(response, RelayDescription)
def list_relays(self, name): ''' Retrieves the relays in the service namespace. name: Name of the service bus namespace. ''' response = self._perform_get(self._get_list_relays_path(name), None) return _convert_response_to_feeds( response, partial(_convert_xml_to_windows_azure_object, azure_type=RelayDescription))
def list_relays(self, name): ''' Retrieves the relays in the service namespace. name: Name of the service bus namespace. ''' response = self._perform_get( self._get_list_relays_path(name), None) return _convert_response_to_feeds(response, partial(_convert_xml_to_windows_azure_object, azure_type=RelayDescription))
def list_queues(self): ''' Enumerates the queues in the service namespace. ''' request = HTTPRequest() request.method = 'GET' request.host = self._get_host() request.path = '/$Resources/Queues' request.path, request.query = _update_request_uri_query(request) request.headers = self._update_service_bus_header(request) response = self._perform_request(request) return _convert_response_to_feeds(response, _convert_xml_to_queue)
def list_topics(self): ''' Retrieves the topics in the service namespace. ''' request = HTTPRequest() request.method = 'GET' request.host = self.service_namespace + SERVICE_BUS_HOST_BASE request.path = '/$Resources/Topics' request.path, request.query = _update_request_uri_query(request) request.headers = _update_service_bus_header(request, self.account_key, self.issuer) response = self._perform_request(request) return _convert_response_to_feeds(response, _convert_xml_to_topic)
def list_queues(self, name): ''' Enumerates the queues in the service namespace. name: Name of the service bus namespace. ''' _validate_not_none('name', name) response = self._perform_get( self._get_list_queues_path(name), None) return _convert_response_to_feeds(response, QueueDescription)
def list_queues(self): ''' Enumerates the queues in the service namespace. ''' request = HTTPRequest() request.method = 'GET' request.host = self.service_namespace + SERVICE_BUS_HOST_BASE request.path = '/$Resources/Queues' request.path, request.query = _update_request_uri_query(request) request.headers = _update_service_bus_header(request, self.account_key, self.issuer) response = self._perform_request(request) return _convert_response_to_feeds(response, _convert_xml_to_queue)
def list_topics(self): ''' Retrieves the topics in the service namespace. ''' request = HTTPRequest() request.method = 'GET' request.host = self._get_host() request.path = '/$Resources/Topics' request.path, request.query = _update_request_uri_query(request) request.headers = _update_service_bus_header(request, self.account_key, self.issuer) response = self._perform_request(request) return _convert_response_to_feeds(response, _convert_xml_to_topic)
def list_topics(self): ''' Retrieves the topics in the service namespace. ''' request = HTTPRequest() request.method = 'GET' request.host = self._get_host() request.path = '/$Resources/Topics' request.path, request.query = _update_request_uri_query(request) request.headers = self._update_service_bus_header(request) response = self._perform_request(request) return _convert_response_to_feeds(response, _convert_xml_to_topic)
def get_supported_metrics_notification_hub(self, name, hub_name): ''' Retrieves the list of supported metrics for this namespace and topic name: Name of the service bus namespace. hub_name: Name of the service bus notification hub in this namespace. ''' response = self._perform_get( self._get_get_supported_metrics_hub_path(name, hub_name), None) return _convert_response_to_feeds(response, partial(_ServiceBusManagementXmlSerializer.xml_to_metrics, object_type=MetricProperties))
def list_queues(self, name): ''' Enumerates the queues in the service namespace. name: Name of the service bus namespace. ''' _validate_not_none('name', name) response = self._perform_get(self._get_list_queues_path(name), None) return _convert_response_to_feeds( response, partial(_convert_xml_to_windows_azure_object, azure_type=QueueDescription))
def get_supported_metrics_relay(self, name, relay_name): ''' Retrieves the list of supported metrics for this namespace and relay name: Name of the service bus namespace. relay_name: Name of the service bus relay in this namespace. ''' response = self._perform_get( self._get_get_supported_metrics_relay_path(name, relay_name), None) return _convert_response_to_feeds( response, partial(_ServiceBusManagementXmlSerializer.xml_to_metrics, object_type=MetricProperties))
def get_supported_metrics_relay(self, name, relay_name): ''' Retrieves the list of supported metrics for this namespace and relay name: Name of the service bus namespace. relay_name: Name of the service bus relay in this namespace. ''' response = self._perform_get( self._get_get_supported_metrics_relay_path(name, relay_name), None) return _convert_response_to_feeds(response, partial(_ServiceBusManagementXmlSerializer.xml_to_metrics, object_type=MetricProperties))
def get_supported_metrics_notification_hub(self, name, hub_name): ''' Retrieves the list of supported metrics for this namespace and topic name: Name of the service bus namespace. hub_name: Name of the service bus notification hub in this namespace. ''' response = self._perform_get( self._get_get_supported_metrics_hub_path(name, hub_name), None) return _convert_response_to_feeds( response, partial(_ServiceBusManagementXmlSerializer.xml_to_metrics, object_type=MetricProperties))
def list_queues(self): ''' Enumerates the queues in the service namespace. ''' request = HTTPRequest() request.method = 'GET' request.host = self._get_host() request.path = '/$Resources/Queues' request.path, request.query = _update_request_uri_query(request) request.headers = _update_service_bus_header(request, self.account_key, self.issuer) response = self._perform_request(request) return _convert_response_to_feeds(response, _convert_xml_to_queue)
def list_queues(self, name): ''' Enumerates the queues in the service namespace. name: Name of the service bus namespace. ''' _validate_not_none('name', name) response = self._perform_get( self._get_list_queues_path(name), None) return _convert_response_to_feeds(response, partial(_convert_xml_to_windows_azure_object, azure_type=QueueDescription))
def list_subscriptions(self, topic_name): ''' Retrieves the subscriptions in the specified topic. topic_name: the 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 = _update_request_uri_query(request) request.headers = _update_service_bus_header(request, self.account_key, self.issuer) response = self._perform_request(request) return _convert_response_to_feeds(response, _convert_xml_to_subscription)
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 = _update_request_uri_query(request) request.headers = self._update_service_bus_header(request) response = self._perform_request(request) return _convert_response_to_feeds(response, _convert_xml_to_subscription)
def list_subscriptions(self, topic_name): ''' Retrieves the subscriptions in the specified topic. topic_name: the name of the topic ''' _validate_not_none('topic_name', topic_name) request = HTTPRequest() request.method = 'GET' request.host = self.service_namespace + SERVICE_BUS_HOST_BASE request.path = '/' + str(topic_name) + '/subscriptions/' request.path, request.query = _update_request_uri_query(request) request.headers = _update_service_bus_header(request, self.account_key, self.issuer) response = self._perform_request(request) return _convert_response_to_feeds(response, _convert_xml_to_subscription)
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: Name of the service bus namespace. relay_name: Name of the service bus relay in this namespace. metric: name of a supported metric ''' response = self._perform_get( self._get_get_metrics_rollup_relay_path(name, relay_name, metric), None) return _convert_response_to_feeds(response, partial(_ServiceBusManagementXmlSerializer.xml_to_metrics, object_type=MetricRollups))
def get_metrics_data_relay(self, name, relay_name, metric, rollup, filter_expresssion): ''' Retrieves the list of supported metrics for this namespace and relay name: Name of the service bus namespace. relay_name: Name of the service bus relay in this namespace. metric: name of a supported metric rollup: name of a supported rollup filter_expression: filter, for instance "$filter=Timestamp gt datetime'2014-10-01T00:00:00Z'" ''' response = self._perform_get( self._get_get_metrics_data_relay_path(name, relay_name, metric, rollup, filter_expresssion), None) return _convert_response_to_feeds(response, partial(_ServiceBusManagementXmlSerializer.xml_to_metrics, object_type=MetricValues))
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: Name of the service bus namespace. relay_name: Name of the service bus relay in this namespace. metric: name of a supported metric ''' response = self._perform_get( self._get_get_metrics_rollup_relay_path(name, relay_name, metric), None) return _convert_response_to_feeds( response, partial(_ServiceBusManagementXmlSerializer.xml_to_metrics, object_type=MetricRollups))
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/' request.path, request.query = _update_request_uri_query(request) request.headers = self._update_service_bus_header(request) response = self._perform_request(request) return _convert_response_to_feeds(response, _convert_xml_to_rule)
def list_rules(self, topic_name, subscription_name): ''' Retrieves the rules that exist under the specified subscription. topic_name: the name of the topic subscription_name: the 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.service_namespace + SERVICE_BUS_HOST_BASE request.path = '/' + str(topic_name) + '/subscriptions/' + str(subscription_name) + '/rules/' request.path, request.query = _update_request_uri_query(request) request.headers = _update_service_bus_header(request, self.account_key, self.issuer) response = self._perform_request(request) return _convert_response_to_feeds(response, _convert_xml_to_rule)
def get_metrics_data_notification_hub(self, name, hub_name, metric, rollup, filter_expresssion): ''' Retrieves the list of supported metrics for this namespace and topic name: Name of the service bus namespace. hub_name: Name of the service bus notification hub in this namespace. metric: name of a supported metric rollup: name of a supported rollup filter_expression: filter, for instance "$filter=Timestamp gt datetime'2014-10-01T00:00:00Z'" ''' response = self._perform_get( self._get_get_metrics_data_hub_path(name, hub_name, metric, rollup, filter_expresssion), None) return _convert_response_to_feeds( response, partial(_ServiceBusManagementXmlSerializer.xml_to_metrics, object_type=MetricValues))
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/' request.path, request.query = _update_request_uri_query(request) request.headers = _update_service_bus_header(request, self.account_key, self.issuer) response = self._perform_request(request) return _convert_response_to_feeds(response, _convert_xml_to_rule)
def query_tables(self, table_name = None, top=None): ''' Returns a list of tables under the specified account. table_name: optional, the specific table to query top: the maximum number of tables to return ''' request = HTTPRequest() request.method = 'GET' request.host = _get_table_host(self.account_name, self.use_local_storage) if table_name is not None: uri_part_table_name = "('" + table_name + "')" else: uri_part_table_name = "" request.path = '/Tables' + uri_part_table_name + '' request.query = [('$top', _int_or_none(top))] request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage) request.headers = _update_storage_table_header(request) response = self._perform_request(request) return _convert_response_to_feeds(response, _convert_xml_to_table)
def query_tables(self, table_name=None, top=None): ''' Returns a list of tables under the specified account. table_name: optional, the specific table to query top: the maximum number of tables to return ''' request = HTTPRequest() request.method = 'GET' request.host = _get_table_host(self.account_name, self.use_local_storage) if table_name is not None: uri_part_table_name = "('" + table_name + "')" else: uri_part_table_name = "" request.path = '/Tables' + uri_part_table_name + '' request.query = [('$top', _int_or_none(top))] request.path, request.query = _update_request_uri_query_local_storage( request, self.use_local_storage) request.headers = _update_storage_table_header(request) response = self._perform_request(request) return _convert_response_to_feeds(response, _convert_xml_to_table)