Profile
The profile session will execute queries based on the list of profiles defined in your local configuration.
Usage
from cmq.aws.session import profile
# List all profiles starting with "test"
profile(name="test").list()
# List RDS resources in all profiles
profile().rds().list()
Profile
Bases: Session
flowchart TD
cmq.aws.session.profile.profile[profile]
cmq.base.Session[Session]
cmq.base.Resource[Resource]
cmq.base.PagedResourceInterface[PagedResourceInterface]
cmq.base.ResourceInterface[ResourceInterface]
cmq.base.NodeInterface[NodeInterface]
cmq.plugin.ResourcePlugin[ResourcePlugin]
cmq.plugin.SessionPlugin[SessionPlugin]
cmq.plugin.ResourceLoader[ResourceLoader]
cmq.base.Session --> cmq.aws.session.profile.profile
cmq.base.Resource --> cmq.base.Session
cmq.base.PagedResourceInterface --> cmq.base.Resource
cmq.base.ResourceInterface --> cmq.base.PagedResourceInterface
cmq.base.NodeInterface --> cmq.base.ResourceInterface
cmq.plugin.ResourcePlugin --> cmq.base.Resource
cmq.plugin.ResourceLoader --> cmq.plugin.ResourcePlugin
cmq.plugin.SessionPlugin --> cmq.base.Session
cmq.plugin.ResourceLoader --> cmq.plugin.SessionPlugin
click cmq.aws.session.profile.profile href "" "cmq.aws.session.profile.profile"
click cmq.base.Session href "" "cmq.base.Session"
click cmq.base.Resource href "" "cmq.base.Resource"
click cmq.base.PagedResourceInterface href "" "cmq.base.PagedResourceInterface"
click cmq.base.ResourceInterface href "" "cmq.base.ResourceInterface"
click cmq.base.NodeInterface href "" "cmq.base.NodeInterface"
click cmq.plugin.ResourcePlugin href "" "cmq.plugin.ResourcePlugin"
click cmq.plugin.SessionPlugin href "" "cmq.plugin.SessionPlugin"
click cmq.plugin.ResourceLoader href "" "cmq.plugin.ResourceLoader"
__init__(parent=None, name=None, **kwargs)
Initialize a new Profile object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
object
|
The parent object. Defaults to None. |
None
|
name
|
str | None
|
The name of the profile. Defaults to None. |
None
|
**kwargs
|
dict[str, Any]
|
Additional keyword arguments. |
{}
|
Inherited from ResourceInterface
Bases: NodeInterface
flowchart TD
cmq.base.ResourceInterface[ResourceInterface]
cmq.base.NodeInterface[NodeInterface]
cmq.base.NodeInterface --> cmq.base.ResourceInterface
click cmq.base.ResourceInterface href "" "cmq.base.ResourceInterface"
click cmq.base.NodeInterface href "" "cmq.base.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
flowchart TD
cmq.base.Resource[Resource]
cmq.base.PagedResourceInterface[PagedResourceInterface]
cmq.base.ResourceInterface[ResourceInterface]
cmq.base.NodeInterface[NodeInterface]
cmq.plugin.ResourcePlugin[ResourcePlugin]
cmq.plugin.ResourceLoader[ResourceLoader]
cmq.base.PagedResourceInterface --> cmq.base.Resource
cmq.base.ResourceInterface --> cmq.base.PagedResourceInterface
cmq.base.NodeInterface --> cmq.base.ResourceInterface
cmq.plugin.ResourcePlugin --> cmq.base.Resource
cmq.plugin.ResourceLoader --> cmq.plugin.ResourcePlugin
click cmq.base.Resource href "" "cmq.base.Resource"
click cmq.base.PagedResourceInterface href "" "cmq.base.PagedResourceInterface"
click cmq.base.ResourceInterface href "" "cmq.base.ResourceInterface"
click cmq.base.NodeInterface href "" "cmq.base.NodeInterface"
click cmq.plugin.ResourcePlugin href "" "cmq.plugin.ResourcePlugin"
click cmq.plugin.ResourceLoader href "" "cmq.plugin.ResourceLoader"
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. |