awscli_interface#

ioapps.awscli_interface.exist_awspath(aws_path, resource='s3', profile=None)[source]#

DESCRIPTION:

This function queries the respective Amazon Web Services (AWS) resource bucket and object path to, using the command line interface (CLI), in order to determine whether a file/path exists; a boolean value indicating the status is returned.

Parameters:
aws_path: str

A Python string specifying the AWS resource bucket and object path within which to collect the respective contents.

Keywords:
resource: str, optional

A Python string specifying the supported AWS resource; allowable storage resources can be found at https://tinyurl.com/AWS-Storage-Resources.

profile: str, optional

A Python string specifying the AWS CLI credentials; if NoneType upon entry the AWS CLI assumes the –no-sign-request attribute; if this value is not NoneType, the credentials corresponding to the respective string must live beneath the ~/.aws/credentials path and contain the appropriate AWS aws_access_key_id and aws_secret_access_key attributes.

Returns:
exist: bool

A Python boolean valued variable specifying whether the AWS path provided upon entry exists.

Return type:

bool

ioapps.awscli_interface.list_awspath(aws_path, resource='s3', profile=None)[source]#

DESCRIPTION:

This function provides an interface to the Amazon Web Services (AWS) command line interface (CLI) application to list the specified resource bucket contents.

Parameters:
aws_path: str

A Python string specifying the AWS resource bucket and object path within which to collect the respective contents.

Keywords:
resource: str, optional

A Python string specifying the supported AWS resource; allowable storage resources can be found at https://tinyurl.com/AWS-Storage-Resources.

profile: str, optional

A Python string specifying the AWS CLI credentials; if NoneType upon entry the AWS CLI assumes the –no-sign-request attribute; if this value is not NoneType, the credentials corresponding to the respective string must live beneath the ~/.aws/credentials path and contain the appropriate AWS aws_access_key_id and aws_secret_access_key attributes.

Returns:
awspath_list: List

A Python list containing the contents of the specified AWS resource bucket and object path.

Raises:
AWSCLIInterfaceError:
  • raised if an exception is encountered while creating the list of files within the specified AWS resource bucket and object path.

Return type:

List

ioapps.awscli_interface.put_awsfile(aws_path, path, is_dir=False, is_wildcards=False, aws_exclude=None, aws_include=None, resource='s3', profile=None, errlog=None, outlog=None)[source]#

DESCRIPTION:

This function provides an interface to the Amazon Web Services (AWS) command line interface (CLI) application to stage local files within specified AWS resource bucket and object paths.

Parameters:
aws_path: str

A Python string specifying the AWS resource bucket and object path for the staged file.

path: str

A Python string specifying the path for the local file to be staged within the specified AWS resource bucket and object path (see aws_path above).

Keywords:
is_dir: bool, optional

A Python boolean valued variable specifying whether the local file path (see path above) is a directory; if True, the –recursive attribute will be invoked for the AWS CLI application.

is_wildcards: bool, optional

A Python boolean valued variable specifying whether strings with wild cards are to be included for the AWS CLI application; if True, at least aws_exclude and/or aws_include must not be NoneType.

aws_exclude: str, optional

A Python string specifying the file strings to be excluded; utilized only if is_wildcards (above) is True.

aws_include: str, optional

A Python string specifying the file strings to be included; utilized only if is_wildcards (above) is True.

resource: str, optional

A Python string specifying the supported AWS resource; allowable storage resources can be found at https://tinyurl.com/AWS-Storage-Resources.

profile: str, optional

A Python string specifying the AWS CLI credentials; if NoneType upon entry the AWS CLI assumes the –no-sign-request attribute; if this value is not NoneType, the credentials corresponding to the respective string must live beneath the ~/.aws/credentials path and contain the appropriate AWS aws_access_key_id and aws_secret_access_key attributes.

errlog: str, optional

A Python string specifying the path to which the AWS CLI application stderr should be written; if NoneType, the stderr is written to subprocess.PIPE.

outlog: str, optional

A Python string specifying the path to which the AWS CLI application stdout should be written; if NoneType, the stdout is written to subprocess.PIPE.

Raises:
AWSCLIInterfaceError:
  • raised if the parameter values specified upon entry are non-compliant with the wildcards attribute.

  • raised if an exception is countered for the AWS CLI application.

Return type:

None