Exemple #1
0
    def peek_messages(self, queue_name, numofmessages=None):
        '''
        Retrieves one or more messages from the front of the queue, but does not alter 
        the visibility of the message. 
        
        queue_name: Name of the queue.
        numofmessages:
            Optional. A nonzero integer value that specifies the number of 
            messages to peek from the queue, up to a maximum of 32. By default, 
            a single message is peeked from the queue with this operation.
        '''
        _validate_not_none('queue_name', queue_name)
        request = HTTPRequest()
        request.method = 'GET'
        request.host = self._get_host()
        request.path = '/' + _str(queue_name) + '/messages?peekonly=true'
        request.query = [('numofmessages', _str_or_none(numofmessages))]
        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)
        response = self._perform_request(request)

        return _parse_response(response, QueueMessagesList)
Exemple #2
0
    def get_messages(self,
                     queue_name,
                     numofmessages=None,
                     visibilitytimeout=None):
        '''
        Retrieves one or more messages from the front of the queue.
        
        queue_name: name of the queue.
        numofmessages: Optional. A nonzero integer value that specifies the number of 
        		messages to retrieve from the queue, up to a maximum of 32. If fewer are
        		visible, the visible messages are returned. By default, a single message
        		is retrieved from the queue with this operation.
        visibilitytimeout: Required. Specifies the new visibility timeout value, in 
        		seconds, relative to server time. The new value must be larger than or 
        		equal to 1 second, and cannot be larger than 7 days, or larger than 2 
        		hours on REST protocol versions prior to version 2011-08-18. The visibility
        		timeout of a message can be set to a value later than the expiry time.
        '''
        _validate_not_none('queue_name', queue_name)
        request = HTTPRequest()
        request.method = 'GET'
        request.host = self._get_host()
        request.path = '/' + _str(queue_name) + '/messages'
        request.query = [('numofmessages', _str_or_none(numofmessages)),
                         ('visibilitytimeout', _str_or_none(visibilitytimeout))
                         ]
        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)
        response = self._perform_request(request)

        return _parse_response(response, QueueMessagesList)
    def _perform_get(self, path, response_type, x_ms_version=None):
        response = self.perform_get(path, x_ms_version)

        if response_type is not None:
            return _parse_response(response, response_type)

        return response
    def get_messages(self, queue_name, numofmessages=None, visibilitytimeout=None):
        """
        Retrieves one or more messages from the front of the queue.
        
        queue_name: name of the queue.
        numofmessages: Optional. A nonzero integer value that specifies the number of 
        		messages to retrieve from the queue, up to a maximum of 32. If fewer are
        		visible, the visible messages are returned. By default, a single message
        		is retrieved from the queue with this operation.
        visibilitytimeout: Required. Specifies the new visibility timeout value, in 
        		seconds, relative to server time. The new value must be larger than or 
        		equal to 1 second, and cannot be larger than 7 days, or larger than 2 
        		hours on REST protocol versions prior to version 2011-08-18. The visibility
        		timeout of a message can be set to a value later than the expiry time.
        """
        _validate_not_none("queue_name", queue_name)
        request = HTTPRequest()
        request.method = "GET"
        request.host = self._get_host()
        request.path = "/" + str(queue_name) + "/messages"
        request.query = [
            ("numofmessages", _str_or_none(numofmessages)),
            ("visibilitytimeout", _str_or_none(visibilitytimeout)),
        ]
        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)
        response = self._perform_request(request)

        return _parse_response(response, QueueMessagesList)
    def _perform_get(self, path, response_type, x_ms_version=None):
        response = self.perform_get(path, x_ms_version)

        if response_type is not None:
            return _parse_response(response, response_type)

        return response
    def _perform_get(self, path, response_type):
        request = HTTPRequest()
        request.method = 'GET'
        request.host = self.host
        request.path = path
        request.path, request.query = _update_request_uri_query(request)
        request.headers = _update_management_header(request)
        response = self._perform_request(request)

        if response_type is not None:
            return _parse_response(response, response_type)

        return response
    def _perform_get(self, path, response_type):
        request = HTTPRequest()
        request.method = 'GET'
        request.host = self.host
        request.path = path
        request.path, request.query = _update_request_uri_query(request)
        request.headers = _update_management_header(request)
        response = self._perform_request(request)

        if response_type is not None:
            return _parse_response(response, response_type)

        return response
Exemple #8
0
    def get_table_service_properties(self):
        '''
        Gets the properties of a storage account's Table service, including Windows Azure
        Storage Analytics.
        '''
        request = HTTPRequest()
        request.method = 'GET'
        request.host = _get_table_host(self.account_name, self.use_local_storage)
        request.path = '/?restype=service&comp=properties'
        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 _parse_response(response, StorageServiceProperties)
Exemple #9
0
    def get_table_service_properties(self):
        '''
        Gets the properties of a storage account's Table service, including Windows Azure
        Storage Analytics.
        '''
        request = HTTPRequest()
        request.method = 'GET'
        request.host = self._get_host()
        request.path = '/?restype=service&comp=properties'
        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 _parse_response(response, StorageServiceProperties)
    def get_container_acl(self, container_name):
        '''
        Gets the permissions for the specified container.
        '''
        _validate_not_none('container_name', container_name)
        request = HTTPRequest()
        request.method = 'GET'
        request.host = self._get_host()
        request.path = '/' + _str(container_name) + '?restype=container&comp=acl'
        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)
        response = self._perform_request(request)

        return _parse_response(response, SignedIdentifiers)
Exemple #11
0
    def get_container_acl(self, container_name):
        '''
        Gets the permissions for the specified container.
        '''
        _validate_not_none('container_name', container_name)
        request = HTTPRequest()
        request.method = 'GET'
        request.host = _get_blob_host(self.account_name, self.use_local_storage)
        request.path = '/' + str(container_name) + '?restype=container&comp=acl'
        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)
        response = self._perform_request(request)

        return _parse_response(response, SignedIdentifiers)
    def get_queue_service_properties(self, timeout=None):
        '''
        Gets the properties of a storage account's Queue Service, including 
        Windows Azure Storage Analytics.
        
        timeout: Optional. The timeout parameter is expressed in seconds.
        '''
        request = HTTPRequest()
        request.method = 'GET'
        request.host = self._get_host()
        request.path = '/?restype=service&comp=properties'
        request.query = [('timeout', _int_or_none(timeout))]
        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)
        response = self._perform_request(request)

        return _parse_response(response, StorageServiceProperties)
    def get_queue_service_properties(self, timeout=None):
        """
        Gets the properties of a storage account's Queue Service, including Windows Azure 
        Storage Analytics.
        
        timeout: Optional. The timeout parameter is expressed in seconds. For example, the 
        following value sets a timeout of 30 seconds for the request: timeout=30
        """
        request = HTTPRequest()
        request.method = "GET"
        request.host = self._get_host()
        request.path = "/?restype=service&comp=properties"
        request.query = [("timeout", _int_or_none(timeout))]
        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)
        response = self._perform_request(request)

        return _parse_response(response, StorageServiceProperties)
Exemple #14
0
    def get_blob_service_properties(self, timeout=None):
        '''
        Gets the properties of a storage account's Blob service, including Windows Azure 
        Storage Analytics.
        
        timeout: Optional. The timeout parameter is expressed in seconds. For example, the 
        		following value sets a timeout of 30 seconds for the request: timeout=30.
        '''
        request = HTTPRequest()
        request.method = 'GET'
        request.host = _get_blob_host(self.account_name, self.use_local_storage)
        request.path = '/?restype=service&comp=properties'
        request.query = [('timeout', _int_or_none(timeout))]
        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)
        response = self._perform_request(request)

        return _parse_response(response, StorageServiceProperties)
    def peek_messages(self, queue_name, numofmessages=None):
        """
        Retrieves one or more messages from the front of the queue, but does not alter 
        the visibility of the message. 
        
        queue_name: name of the queue.
        numofmessages: Optional. A nonzero integer value that specifies the number of 
        		messages to peek from the queue, up to a maximum of 32. By default, 
        		a single message is peeked from the queue with this operation.
        """
        _validate_not_none("queue_name", queue_name)
        request = HTTPRequest()
        request.method = "GET"
        request.host = self._get_host()
        request.path = "/" + str(queue_name) + "/messages?peekonly=true"
        request.query = [("numofmessages", _str_or_none(numofmessages))]
        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)
        response = self._perform_request(request)

        return _parse_response(response, QueueMessagesList)
            return _parse_response_for_async_op(response)

        return None

    def _perform_post(self, path, body, response_type=None, async=False):
        request = HTTPRequest()
        request.method = 'POST'
        request.host = self.host
        request.path = path
        request.body = _get_request_body(body)
        request.path, request.query = _update_request_uri_query(request)
        request.headers = _update_management_header(request)
        response = self._perform_request(request)

        if response_type is not None:
            return _parse_response(response, response_type)

        if async:
            return _parse_response_for_async_op(response)

        return None

    def _perform_delete(self, path, async=False):
        request = HTTPRequest()
        request.method = 'DELETE'
        request.host = self.host
        request.path = path
        request.path, request.query = _update_request_uri_query(request)
        request.headers = _update_management_header(request)
        response = self._perform_request(request)
            return _parse_response_for_async_op(response)

        return None

    def _perform_post(self, path, body, response_type=None, async=False):
        request = HTTPRequest()
        request.method = 'POST'
        request.host = self.host
        request.path = path
        request.body = _get_request_body(body)
        request.path, request.query = _update_request_uri_query(request)
        request.headers = _update_management_header(request)
        response = self._perform_request(request)

        if response_type is not None:
            return _parse_response(response, response_type)

        if async:
            return _parse_response_for_async_op(response)

        return None

    def _perform_delete(self, path, async=False):
        request = HTTPRequest()
        request.method = 'DELETE'
        request.host = self.host
        request.path = path
        request.path, request.query = _update_request_uri_query(request)
        request.headers = _update_management_header(request)
        response = self._perform_request(request)