Skip to content

SQSServiceResource

Index > SQS > SQSServiceResource

Auto-generated documentation for SQS type annotations stubs module mypy-boto3-sqs.

SQSServiceResource

Type annotations and code completion for boto3.resource("sqs"), included resources and collections. boto3 documentation

Usage example
from mypy_boto3_sqs.service_resource import SQSServiceResource

def get_sqs_resource() -> SQSServiceResource:
    return boto3.resource("sqs")

Attributes

Collections

ServiceResourceQueuesCollection

Provides access to Queue resource.

Type annotations and code completion for boto3.resource("sqs").queues collection. boto3 documentation

Usage example
from mypy_boto3_sqs.service_resource import ServiceResourceQueuesCollection

def get_collection() -> ServiceResourceQueuesCollection:
    return boto3.resource("sqs").queues

Methods

SQSServiceResource.Message method

Creates a Message resource.

Type annotations and code completion for boto3.resource("sqs").Message method. boto3 documentation

Method definition
def Message(
    self,
    queue_url: str,
    receipt_handle: str,
) -> Message:
    ...
Usage example with kwargs
kwargs: ServiceResourceMessageRequestTypeDef = {  # (1)
    "queue_url": ...,
    "receipt_handle": ...,
}

parent.Message(**kwargs)
  1. See ServiceResourceMessageRequestTypeDef

SQSServiceResource.Queue method

Creates a Queue resource.

Type annotations and code completion for boto3.resource("sqs").Queue method. boto3 documentation

Method definition
def Queue(
    self,
    url: str,
) -> Queue:
    ...
Usage example with kwargs
kwargs: ServiceResourceQueueRequestTypeDef = {  # (1)
    "url": ...,
}

parent.Queue(**kwargs)
  1. See ServiceResourceQueueRequestTypeDef

SQSServiceResource.create_queue method

Creates a new standard or FIFO queue.

Type annotations and code completion for boto3.resource("sqs").create_queue method. boto3 documentation

Method definition
def create_queue(
    self,
    *,
    QueueName: str,
    Attributes: Mapping[QueueAttributeNameType, str] = ...,  # (1)
    tags: Mapping[str, str] = ...,
) -> Queue:
    ...
  1. See QueueAttributeNameType
Usage example with kwargs
kwargs: CreateQueueRequestServiceResourceCreateQueueTypeDef = {  # (1)
    "QueueName": ...,
}

parent.create_queue(**kwargs)
  1. See CreateQueueRequestServiceResourceCreateQueueTypeDef

SQSServiceResource.get_available_subresources method

Returns a list of all the available sub-resources for this Resource.

Type annotations and code completion for boto3.resource("sqs").get_available_subresources method. boto3 documentation

Method definition
def get_available_subresources(
    self,
) -> Sequence[str]:
    ...

SQSServiceResource.get_queue_by_name method

Returns the URL of an existing Amazon SQS queue.

Type annotations and code completion for boto3.resource("sqs").get_queue_by_name method. boto3 documentation

Method definition
def get_queue_by_name(
    self,
    *,
    QueueName: str,
    QueueOwnerAWSAccountId: str = ...,
) -> Queue:
    ...
Usage example with kwargs
kwargs: GetQueueUrlRequestServiceResourceGetQueueByNameTypeDef = {  # (1)
    "QueueName": ...,
}

parent.get_queue_by_name(**kwargs)
  1. See GetQueueUrlRequestServiceResourceGetQueueByNameTypeDef

Message

Type annotations and code completion for boto3.resource("sqs").Message class. boto3 documentation

Usage example
from mypy_boto3_sqs.service_resource import Message

def get_resource() -> Message:
    return boto3.resource("sqs").Message(...)

Message attributes

Message methods

Message.Queue method

Creates a Queue resource.

Type annotations and code completion for boto3.resource("sqs").Queue method. boto3 documentation

Method definition
def Queue(
    self,
) -> Queue:
    ...

Message.change_visibility method

Changes the visibility timeout of a specified message in a queue to a new value.

Type annotations and code completion for boto3.resource("sqs").change_visibility method. boto3 documentation

Method definition
def change_visibility(
    self,
    *,
    VisibilityTimeout: int,
) -> None:
    ...
Usage example with kwargs
kwargs: ChangeMessageVisibilityRequestMessageChangeVisibilityTypeDef = {  # (1)
    "VisibilityTimeout": ...,
}

parent.change_visibility(**kwargs)
  1. See ChangeMessageVisibilityRequestMessageChangeVisibilityTypeDef

Message.delete method

Deletes the specified message from the specified queue.

Type annotations and code completion for boto3.resource("sqs").delete method. boto3 documentation

Method definition
def delete(
    self,
) -> None:
    ...

Message.get_available_subresources method

Returns a list of all the available sub-resources for this Resource.

Type annotations and code completion for boto3.resource("sqs").get_available_subresources method. boto3 documentation

Method definition
def get_available_subresources(
    self,
) -> Sequence[str]:
    ...

Queue

Type annotations and code completion for boto3.resource("sqs").Queue class. boto3 documentation

Usage example
from mypy_boto3_sqs.service_resource import Queue

def get_resource() -> Queue:
    return boto3.resource("sqs").Queue(...)

Queue attributes

Queue collections

Queue.dead_letter_source_queues

Provides access to Queue resource.

Type annotations and code completion for boto3.resource("sqs").Queue(...).dead_letter_source_queues collection. boto3 documentation

Usage example
from mypy_boto3_sqs.service_resource import QueueDeadLetterSourceQueuesCollection

def get_collection() -> QueueDeadLetterSourceQueuesCollection:
    resource = boto3.resource("sqs").Queue(...)
    return resource.dead_letter_source_queues

Queue methods

Queue.Message method

Creates a Message resource.

Type annotations and code completion for boto3.resource("sqs").Message method. boto3 documentation

Method definition
def Message(
    self,
    receipt_handle: str,
) -> Message:
    ...
Usage example with kwargs
kwargs: QueueMessageRequestTypeDef = {  # (1)
    "receipt_handle": ...,
}

parent.Message(**kwargs)
  1. See QueueMessageRequestTypeDef

Queue.add_permission method

Adds a permission to a queue for a specific principal_.

Type annotations and code completion for boto3.resource("sqs").add_permission method. boto3 documentation

Method definition
def add_permission(
    self,
    *,
    Label: str,
    AWSAccountIds: Sequence[str],
    Actions: Sequence[str],
) -> None:
    ...
Usage example with kwargs
kwargs: AddPermissionRequestQueueAddPermissionTypeDef = {  # (1)
    "Label": ...,
    "AWSAccountIds": ...,
    "Actions": ...,
}

parent.add_permission(**kwargs)
  1. See AddPermissionRequestQueueAddPermissionTypeDef

Queue.change_message_visibility_batch method

Changes the visibility timeout of multiple messages.

Type annotations and code completion for boto3.resource("sqs").change_message_visibility_batch method. boto3 documentation

Method definition
def change_message_visibility_batch(
    self,
    *,
    Entries: Sequence[ChangeMessageVisibilityBatchRequestEntryTypeDef],  # (1)
) -> ChangeMessageVisibilityBatchResultTypeDef:  # (2)
    ...
  1. See ChangeMessageVisibilityBatchRequestEntryTypeDef
  2. See ChangeMessageVisibilityBatchResultTypeDef
Usage example with kwargs
kwargs: ChangeMessageVisibilityBatchRequestQueueChangeMessageVisibilityBatchTypeDef = {  # (1)
    "Entries": ...,
}

parent.change_message_visibility_batch(**kwargs)
  1. See ChangeMessageVisibilityBatchRequestQueueChangeMessageVisibilityBatchTypeDef

Queue.delete method

Deletes the queue specified by the QueueUrl , regardless of the queue's contents.

Type annotations and code completion for boto3.resource("sqs").delete method. boto3 documentation

Method definition
def delete(
    self,
) -> None:
    ...

Queue.delete_messages method

Deletes up to ten messages from the specified queue.

Type annotations and code completion for boto3.resource("sqs").delete_messages method. boto3 documentation

Method definition
def delete_messages(
    self,
    *,
    Entries: Sequence[DeleteMessageBatchRequestEntryTypeDef],  # (1)
) -> DeleteMessageBatchResultTypeDef:  # (2)
    ...
  1. See DeleteMessageBatchRequestEntryTypeDef
  2. See DeleteMessageBatchResultTypeDef
Usage example with kwargs
kwargs: DeleteMessageBatchRequestQueueDeleteMessagesTypeDef = {  # (1)
    "Entries": ...,
}

parent.delete_messages(**kwargs)
  1. See DeleteMessageBatchRequestQueueDeleteMessagesTypeDef

Queue.get_available_subresources method

Returns a list of all the available sub-resources for this Resource.

Type annotations and code completion for boto3.resource("sqs").get_available_subresources method. boto3 documentation

Method definition
def get_available_subresources(
    self,
) -> Sequence[str]:
    ...

Queue.load method

Calls πŸ‡΅πŸ‡Ύmeth:SQS.Client.get_queue_attributes to update the attributes of the Queue resource.

Type annotations and code completion for boto3.resource("sqs").load method. boto3 documentation

Method definition
def load(
    self,
) -> None:
    ...

Queue.purge method

Deletes the messages in a queue specified by the QueueURL parameter.

Type annotations and code completion for boto3.resource("sqs").purge method. boto3 documentation

Method definition
def purge(
    self,
) -> None:
    ...

Queue.receive_messages method

Retrieves one or more messages (up to 10), from the specified queue.

Type annotations and code completion for boto3.resource("sqs").receive_messages method. boto3 documentation

Method definition
def receive_messages(
    self,
    *,
    AttributeNames: Sequence[QueueAttributeFilterType] = ...,  # (1)
    MessageAttributeNames: Sequence[str] = ...,
    MaxNumberOfMessages: int = ...,
    VisibilityTimeout: int = ...,
    WaitTimeSeconds: int = ...,
    ReceiveRequestAttemptId: str = ...,
) -> List[Message]:
    ...
  1. See QueueAttributeFilterType
Usage example with kwargs
kwargs: ReceiveMessageRequestQueueReceiveMessagesTypeDef = {  # (1)
    "AttributeNames": ...,
}

parent.receive_messages(**kwargs)
  1. See ReceiveMessageRequestQueueReceiveMessagesTypeDef

Queue.reload method

Calls πŸ‡΅πŸ‡Ύmeth:SQS.Client.get_queue_attributes to update the attributes of the Queue resource.

Type annotations and code completion for boto3.resource("sqs").reload method. boto3 documentation

Method definition
def reload(
    self,
) -> None:
    ...

Queue.remove_permission method

Revokes any permissions in the queue policy that matches the specified Label parameter.

Type annotations and code completion for boto3.resource("sqs").remove_permission method. boto3 documentation

Method definition
def remove_permission(
    self,
    *,
    Label: str,
) -> None:
    ...
Usage example with kwargs
kwargs: RemovePermissionRequestQueueRemovePermissionTypeDef = {  # (1)
    "Label": ...,
}

parent.remove_permission(**kwargs)
  1. See RemovePermissionRequestQueueRemovePermissionTypeDef

Queue.send_message method

Delivers a message to the specified queue.

Type annotations and code completion for boto3.resource("sqs").send_message method. boto3 documentation

Method definition
def send_message(
    self,
    *,
    MessageBody: str,
    DelaySeconds: int = ...,
    MessageAttributes: Mapping[str, MessageAttributeValueTypeDef] = ...,  # (1)
    MessageSystemAttributes: Mapping[MessageSystemAttributeNameForSendsType, MessageSystemAttributeValueTypeDef] = ...,  # (2)
    MessageDeduplicationId: str = ...,
    MessageGroupId: str = ...,
) -> SendMessageResultTypeDef:  # (3)
    ...
  1. See MessageAttributeValueTypeDef
  2. See MessageSystemAttributeNameForSendsType MessageSystemAttributeValueTypeDef
  3. See SendMessageResultTypeDef
Usage example with kwargs
kwargs: SendMessageRequestQueueSendMessageTypeDef = {  # (1)
    "MessageBody": ...,
}

parent.send_message(**kwargs)
  1. See SendMessageRequestQueueSendMessageTypeDef

Queue.send_messages method

Delivers up to ten messages to the specified queue.

Type annotations and code completion for boto3.resource("sqs").send_messages method. boto3 documentation

Method definition
def send_messages(
    self,
    *,
    Entries: Sequence[SendMessageBatchRequestEntryTypeDef],  # (1)
) -> SendMessageBatchResultTypeDef:  # (2)
    ...
  1. See SendMessageBatchRequestEntryTypeDef
  2. See SendMessageBatchResultTypeDef
Usage example with kwargs
kwargs: SendMessageBatchRequestQueueSendMessagesTypeDef = {  # (1)
    "Entries": ...,
}

parent.send_messages(**kwargs)
  1. See SendMessageBatchRequestQueueSendMessagesTypeDef

Queue.set_attributes method

Sets the value of one or more queue attributes.

Type annotations and code completion for boto3.resource("sqs").set_attributes method. boto3 documentation

Method definition
def set_attributes(
    self,
    *,
    Attributes: Mapping[QueueAttributeNameType, str],  # (1)
) -> None:
    ...
  1. See QueueAttributeNameType
Usage example with kwargs
kwargs: SetQueueAttributesRequestQueueSetAttributesTypeDef = {  # (1)
    "Attributes": ...,
}

parent.set_attributes(**kwargs)
  1. See SetQueueAttributesRequestQueueSetAttributesTypeDef