Skip to content

SQS

The SQS resource provides access to AWS Simple Queue Service queues.

Usage

from cmq.aws.session import profile

# List all SQS queues
profile().sqs().list()

SQS

Bases: AWSResource

Inherited from ResourceInterface

Bases: NodeInterface

attr(*args)

Adds a selection operation to the pipeline that will select the specified attributes.

Parameters:

Name Type Description Default
*args list[str]

The attributes to be selected.

()

Returns:

Name Type Description
ResourceInterface Resource

The updated resource object.

calculate(key, func)

Adds a calculation operation to the pipeline that will calculate a new attribute.

Parameters:

Name Type Description Default
key str

The new key of the attribute.

required
func callable

The calculation function to be used.

required

Returns:

Name Type Description
ResourceInterface Resource

The updated resource object.

contains(key, value)

Adds a "contains" filter to the resource.

Parameters:

Name Type Description Default
key str

The key of the attribute to compare.

required
value Any

The value to check for containment.

required

Returns:

Name Type Description
ResourceInterface Resource

The updated resource object.

ends_with(key, value)

Adds an "ends with" filter to the resource.

Parameters:

Name Type Description Default
key str

The key of the attribute to compare.

required
value str

The value to check for ending with.

required

Returns:

Name Type Description
ResourceInterface Resource

The updated resource object.

eq(key, value)

Adds an equality filter to the resource.

Parameters:

Name Type Description Default
key str

The key of the attribute to compare.

required
value Any

The value to compare against.

required

Returns:

Name Type Description
ResourceInterface Resource

The updated resource object.

filter(func)

Adds a filter operation to the pipeline that will filter resources based on the given function.

Parameters:

Name Type Description Default
func callable

The filter function to be added.

required

Returns:

Name Type Description
ResourceInterface Resource

The updated resource object.

gt(key, value)

Adds a "greater than" filter to the resource.

Parameters:

Name Type Description Default
key str

The key of the attribute to compare.

required
value Any

The value to compare against.

required

Returns:

Name Type Description
ResourceInterface Resource

The updated resource object.

in_(key, value)

Adds an "in" filter to the resource.

Parameters:

Name Type Description Default
key str

The key of the attribute to compare.

required
value list

The list of values to check for inclusion.

required

Returns:

Name Type Description
ResourceInterface Resource

The updated resource object.

lt(key, value)

Adds a "less than" filter to the resource.

Parameters:

Name Type Description Default
key str

The key of the attribute to compare.

required
value Any

The value to compare against.

required

Returns:

Name Type Description
ResourceInterface Resource

The updated resource object.

ne(key, value)

Adds a not-equal filter to the resource.

Parameters:

Name Type Description Default
key str

The key of the attribute to compare.

required
value Any

The value to compare against.

required

Returns:

Name Type Description
ResourceInterface Resource

The updated resource object.

not_contains(key, value)

Adds a "not contains" filter to the resource.

Parameters:

Name Type Description Default
key str

The key of the attribute to compare.

required
value Any

The value to check for non-containment.

required

Returns:

Name Type Description
ResourceInterface Resource

The updated resource object.

starts_with(key, value)

Adds a "starts with" filter to the resource.

Parameters:

Name Type Description Default
key str

The key of the attribute to compare.

required
value str

The value to check for starting with.

required

Returns:

Name Type Description
ResourceInterface Resource

The updated resource object.

transform(key, func)

Adds a transformation operation to the pipeline that will transform the specified attribute.

Parameters:

Name Type Description Default
key str

The key of the attribute to transform.

required
func callable

The transformation function to be added.

required

Returns:

Name Type Description
ResourceInterface Resource

The updated resource object.

Inherited from Resource

Bases: PagedResourceInterface, ResourcePlugin

csv(flat=False)

Retrieves a list of resources based on the applied filters and returns them in CSV format.

Parameters:

Name Type Description Default
flat bool

Specifies whether the dictionaries should be flattened or not. Defaults to False.

False

Returns:

Name Type Description
str str

List of resources in CSV format.

dict()

Retrieves a dictionary of resources based on the applied filters.

Returns:

Name Type Description
dict dict

A dictionary of resource objects.

do(action)

Performs a custom action on the resources.

Parameters:

Name Type Description Default
action callable

The action to be performed.

required

list()

Retrieves a list of resources based on the applied filters.

Returns:

Name Type Description
list list

A list of resource objects.