Skip to content

AWS Provider

BalconyAWS

Provides a concise interface for using balcony's functionalities.

It can be used to reading AWS Operations, or accessing underlying ServiceNodes and ServiceReaders.

Creating a BalconyAWS obj and reading IAM Roles
baws = BalconyAWS()
roles = baws.read_resource_node('iam', 'Role', follow_pagination=True)
print(roles)

__init__(boto3_session=None)

Initializes this object with an optional boto3.session.Session object. If it's not provided, default boto3 session is created from the shell credentials.

Parameters:

Name Type Description Default
boto3_session Optional[Session]

Custom boto3 Session object. If not given, default Session will be used.

None

get_available_service_names()

Lists available AWS service namese

Returns:

Type Description
List[str]

List[str]: Available service names for current boto3.session.Session

get_service_node(service_name)

Gets or creates the ServiceNode.

Parameters:

Name Type Description Default
service_name str

Name of the AWS Service.

required

Returns:

Name Type Description
ServiceNode ServiceNode

ServiceNode object representing an AWS Service

get_service_reader(service_name)

Gets the ServiceReader obj from the ServiceNode obj.

Parameters:

Name Type Description Default
service_name str

Name of the AWS Service.

required

Returns:

Name Type Description
ServiceReader ServiceReader

ServiceReader object with the read capabilities, tied to a ServiceNode.

read_operation(service_name, resource_node_name, operation_name, match_patterns=None, refresh=False, follow_pagination=False)

Call the AWS API operation for the given service_name, resource_node_name and operation_name values.

Parameters:

Name Type Description Default
service_name str

AWS Service name.

required
resource_node_name str

AWS ResourceNode name

required
operation_name str

AWS Read opeartion name

required
match_patterns Optional[List[str]]

UNIX style patterns for generated required_parameters. Defaults to None.

None
refresh Optional[bool]

Force to re-read instead of returning the data from cache.. Defaults to False.

False
follow_pagination bool

Follow pagination tokens. If not only set True, one page call will be made.

False

Returns:

Type Description
Union[dict, bool]

Union[dict,bool]: Read Operation data, or False.

read_resource_node(service_name, resource_node_name, match_patterns=None, refresh=False, follow_pagination=False)

Reads all available Read operations of the given ResourceNode.

Parameters:

Name Type Description Default
service_name str

Name of the AWS Service

required
resource_node_name str

Name of the AWS Resource Node

required
match_patterns Optional[List[str]]

UNIX style patterns for generated required_parameters. Defaults to None.

None
refresh bool

Force to re-read instead of returning the data from cache.. Defaults to False.

False
follow_pagination bool

Follow the pagination tokens if the output is truncated. Defaults to False.

False

Returns:

Type Description
Union[dict, bool]

Union[dict,bool]: Read ResourceNode data or False