Analyze Document
Analyzes an input document for relationships between detected items
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
image_file | str, None | None | filepath (or object name) of image file |
json_file | str, None | None | filepath to resulting json file |
bucket_name | str, None | None | if given then using image_file from the bucket |
model | bool | False | set True to return Textract Document model, default False |
param image_file: | |
---|---|
filepath (or object name) of image file | |
param json_file: | |
filepath to resulting json file | |
param bucket_name: | |
if given then using image_file from the bucket | |
param model: | set True to return Textract Document model, default False |
return: | analysis response in json or TextractDocument model |
Examples
${response} Analyze Document ${filename} model=True
FOR ${page} IN @{response.pages}
Log Many ${page.tables}
Log Many ${page.form}
Log Lines ${page.lines}
Log Many ${page}
Log ${page}
Log ${page.form}
END
Assume Role
Returns a set of temporary security credentials that you can use to access Amazon Web Services resources that you might not normally have access to. These temporary credentials consist of an access key ID, a secret access key, and a security token. Typically, you use Assume Role within your account or for cross-account access.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
role_arn | str | null | The Amazon Resource Name (ARN) of the role to assume. |
role_session_name | str | null | An identifier for the assumed role session. |
policy_arns | List[Dict], None | None | The Amazon Resource Names (ARNs) of the IAM managed policies that you want to use as managed session policies. The policies must exist in the same account as the role. |
policy | str, None | None | An IAM policy in JSON format that you want to use as an inline session policy. |
duration | int | 900 | The duration, in seconds, of the role session. The value specified can range from 900 seconds (15 minutes and the default) up to the maximum session duration set for the role. |
tags | List[Dict], None | None | A list of session tags that you want to pass. Each session tag consists of a key name and an associated value. |
transitive_tag_keys | List[str], None | None | A list of keys for session tags that you want to set as transitive. If you set a tag key as transitive, the corresponding key and value passes to subsequent sessions in a role chain. |
external_id | str, None | None | A unique identifier that might be required when you assume a role in another account. If the administrator of the account to which the role belongs provided you with an external ID, then provide that value in this parameter. |
serial_number | str, None | None | The identification number of the MFA device that is associated with the user who is making the using the assume_role keyword. |
token_code | str, None | None | The value provided by the MFA device, if the trust policy of the role being assumed requires MFA. |
source_identity | str, None | None | The source identity specified by the principal that is using the assume_role keyword. |
The credentials are returned as a dictionary with data structure similar to the following JSON:
{ "Credentials": { "AccessKeyId": "string", "SecretAccessKey": "string", "SessionToken": "string", "Expiration": "2015-01-01" }, "AssumedRoleUser": { "AssumedRoleId": "string", "Arn": "string" }, "PackedPolicySize": 123, "SourceIdentity": "string" }
These credentials can be used to re-initialize services available in this library with the assumed role instead of the original role.
NOTE: For detailed information on the available arguments to this keyword, please see the Boto3 STS documentation.
param role_arn: | The Amazon Resource Name (ARN) of the role to assume. |
---|---|
param role_session_name: | |
An identifier for the assumed role session. | |
param policy_arns: | |
The Amazon Resource Names (ARNs) of the IAM managed policies that you want to use as managed session policies. The policies must exist in the same account as the role. | |
param policy: | An IAM policy in JSON format that you want to use as an inline session policy. |
param duration: | The duration, in seconds, of the role session. The value specified can range from 900 seconds (15 minutes and the default) up to the maximum session duration set for the role. |
param tags: | A list of session tags that you want to pass. Each session tag consists of a key name and an associated value. |
param transitive_tag_keys: | |
A list of keys for session tags that you want to set as transitive. If you set a tag key as transitive, the corresponding key and value passes to subsequent sessions in a role chain. | |
param external_id: | |
A unique identifier that might be required when you assume a role in another account. If the administrator of the account to which the role belongs provided you with an external ID, then provide that value in this parameter. | |
param serial_number: | |
The identification number of the MFA device that is associated with the user who is making the using the assume_role keyword. | |
param token_code: | |
The value provided by the MFA device, if the trust policy of the role being assumed requires MFA. | |
param source_identity: | |
The source identity specified by the principal that is using the assume_role keyword. |
Convert Textract Response To Model
Convert AWS Textract JSON response into TextractDocument object, which has following structure:
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
response | null | JSON response from AWS Textract service |
- Document
- Page
- Tables
- Rows
- Cells
- Lines
- Words
- Form
- Field
param response: | JSON response from AWS Textract service |
---|---|
return: | TextractDocument object |
Examples
${response} Analyze Document ${filename}
${model}= Convert Textract Response To Model ${response}
FOR ${page} IN @{model.pages}
Log Many ${page.tables}
Log Many ${page.form}
Log Lines ${page.lines}
Log Many ${page}
Log ${page}
Log ${page.form}
END
Create Bucket
Create S3 bucket with name
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
bucket_name | str, None | None | name for the bucket |
kwargs | null |
note This keyword accepts additional parameters in key=value format
More info on additional parameters.
param bucket_name: | |
---|---|
name for the bucket | |
return: | boolean indicating status of operation |
Robot Framework example:
Create Bucket public-bucket ACL=public-read-write
Create Queue
Create queue with name
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
queue_name | str, None | None | [description], defaults to None |
param queue_name: | |
---|---|
[description], defaults to None | |
return: | create queue response as dict |
Create Redshift Statement Parameters
Returns a formatted dictionary to be used in Redshift Data Api SQL statements.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
params | null |
Example:
Assume the ${SQL} statement has the parameters :id and :name:
*** Tasks ***
${params}= Create sql parameters id=123 name=Nokia
# params produces a data structure like so:
# Which can be used for the 'parameters' argument.
${response}= Execute redshift statement ${SQL} ${params}
Delete Bucket
Delete S3 bucket with name
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
bucket_name | str, None | None | name for the bucket |
param bucket_name: | |
---|---|
name for the bucket | |
return: | boolean indicating status of operation |
Delete Files
Delete files in the bucket
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
bucket_name | str, None | None | name for the bucket |
files | list, None | None | list of files to delete |
kwargs | null |
note This keyword accepts additional parameters in key=value format
More info on additional parameters.
param bucket_name: | |
---|---|
name for the bucket | |
param files: | list of files to delete |
return: | number of files deleted or False |
Delete Message
Delete message in the queue
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
receipt_handle | str, None | None | message handle to delete |
param receipt_handle: | |
---|---|
message handle to delete | |
return: | delete message response as dict |
Delete Queue
Delete queue with name
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
queue_name | str, None | None | [description], defaults to None |
param queue_name: | |
---|---|
[description], defaults to None | |
return: | delete queue response as dict |
Describe Redshift Table
Describes the detailed information about a table from metadata in the cluster. The information includes its columns.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
database | str | null | The name of the database that contains the tables to be described. If ommitted, will use the connected Database. |
schema | str, None | None | The schema that contains the table. If no schema is specified, then matching tables for all schemas are returned. |
table | str, None | None | The table name. If no table is specified, then all tables for all matching schemas are returned. If no table and no schema is specified, then all tables for all schemas in the database are returned |
If schema and/or table is not provided, the API searches all schemas for the provided table, or returns all tables in the schema or entire database.
The response object is provided as a list of table meta data objects, utilize dot-notation or the RPA.JSON library to access members:
{ "ColumnList": [ { "columnDefault": "string", "isCaseSensitive": true, "isCurrency": false, "isSigned": false, "label": "string", "length": 123, "name": "string", "nullable": 123, "precision": 123, "scale": 123, "schemaName": "string", "tableName": "string", "typeName": "string" }, ], "TableName": "string" }
param database: | The name of the database that contains the tables to be described. If ommitted, will use the connected Database. |
---|---|
param schema: | The schema that contains the table. If no schema is specified, then matching tables for all schemas are returned. |
param table: | The table name. If no table is specified, then all tables for all matching schemas are returned. If no table and no schema is specified, then all tables for all schemas in the database are returned |
Detect Document Text
Detects text in the input document.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
image_file | str, None | None | filepath (or object name) of image file |
json_file | str, None | None | filepath to resulting json file |
bucket_name | str, None | None | if given then using image_file from the bucket |
param image_file: | |
---|---|
filepath (or object name) of image file | |
param json_file: | |
filepath to resulting json file | |
param bucket_name: | |
if given then using image_file from the bucket | |
return: | analysis response in json |
Detect Entities
Inspects text for named entities, and returns information about them
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
text | str, None | None | A UTF-8 text string. Each string must contain fewer that 5,000 bytes of UTF-8 encoded characters |
lang | en | language code of the text, defaults to "en" |
param text: | A UTF-8 text string. Each string must contain fewer that 5,000 bytes of UTF-8 encoded characters |
---|---|
param lang: | language code of the text, defaults to "en" |
Detect Sentiment
Inspects text and returns an inference of the prevailing sentiment
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
text | str, None | None | A UTF-8 text string. Each string must contain fewer that 5,000 bytes of UTF-8 encoded characters |
lang | en | language code of the text, defaults to "en" |
param text: | A UTF-8 text string. Each string must contain fewer that 5,000 bytes of UTF-8 encoded characters |
---|---|
param lang: | language code of the text, defaults to "en" |
Download Files
Download files from bucket to local filesystem
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
bucket_name | str, None | None | name for the bucket |
files | list, None | None | list of S3 object names |
target_directory | str, None | None | location for the downloaded files, default current directory |
kwargs | null |
note This keyword accepts additional parameters in key=value format.
More info on additional parameters.
param bucket_name: | |
---|---|
name for the bucket | |
param files: | list of S3 object names |
param target_directory: | |
location for the downloaded files, default current directory | |
return: | number of files downloaded |
Execute Redshift Statement
Runs an SQL statement, which can be data manipulation language (DML) or data definition language (DDL). This statement must be a single SQL statement.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
sql | str | null | The SQL statement text to run. |
parameters | list, None | None | The parameters for the SQL statement. Must consist of a list of dictionaries with two keys: name and value. |
statement_name | str, None | None | The name of the SQL statement. You can name the SQL statement when you create it to identify the query. |
with_event | bool | False | A value that indicates whether to send an event to the Amazon EventBridge event bus after the SQL statement runs. |
timeout | int | 40 | Used to calculate the maximum wait. Exact timing depends on system variability becuase the underlying waiter does not utilize a timeout directly. |
SQL statements can be parameterized with named parameters through the use of the parameters argument. Parameters must be dictionaries with the following two keys:
- name: The name of the parameter. In the SQL statement this will be referenced as :name.
- value: The value of the parameter. Amazon Redshift implicitly converts to the proper data type. For more information, see Data types in the Amazon Redshift Database Developer Guide.
For simplicity, a helper keyword, Create redshift statement parameters, is available and can be used more naturally in Robot Framework contexts.
If tabular data is returned, this keyword tries to return it as a table (see RPA.Tables), if RPA.Tables is not available in the keyword's scope, the data will be returned as a list of dictionaries. Other types of data (SQL errors and result statements) are returned as strings.
NOTE: You may modify the max built-in wait time by providing a timeout in seconds (default 40 seconds)
Robot framework example:
*** Tasks ***
${SQL}= Set variable insert into mytable values (:id, :address)
${params}= Create redshift statement parameters
... id=1
... address=Seattle
${response}= Execute redshift statement ${SQL} ${params}
Log ${response}
Python example:
sql = "insert into mytable values (:id, :address)"
parameters = [
{"name": "id", "value": "1"},
{"name": "address", "value": "Seattle"},
]
response = aws.execute_redshift_statement(sql, parameters)
print(response)
param parameters: | |
---|---|
The parameters for the SQL statement. Must consist of a list of dictionaries with two keys: name and value. | |
param sql: | The SQL statement text to run. |
param statement_name: | |
The name of the SQL statement. You can name the SQL statement when you create it to identify the query. | |
param with_event: | |
A value that indicates whether to send an event to the Amazon EventBridge event bus after the SQL statement runs. | |
param timeout: | Used to calculate the maximum wait. Exact timing depends on system variability becuase the underlying waiter does not utilize a timeout directly. |
Execute Redshift Statement Asyncronously
Submit a sql statement for Redshift to execute asyncronously. Returns the statement ID which can be used to retrieve statement results later.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
sql | str | null | The SQL statement text to run. |
parameters | list, None | None | The parameters for the SQL statement. Must consist of a list of dictionaries with two keys: name and value. |
statement_name | str, None | None | The name of the SQL statement. You can name the SQL statement when you create it to identify the query. |
with_event | bool | False | A value that indicates whether to send an event to the Amazon EventBridge event bus after the SQL statement runs. |
param parameters: | |
---|---|
The parameters for the SQL statement. Must consist of a list of dictionaries with two keys: name and value. | |
param sql: | The SQL statement text to run. |
param statement_name: | |
The name of the SQL statement. You can name the SQL statement when you create it to identify the query. | |
param with_event: | |
A value that indicates whether to send an event to the Amazon EventBridge event bus after the SQL statement runs. |
Generate Presigned Url
Generate presigned URL for the file.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
bucket_name | str | null | name for the bucket |
object_name | str | null | name of the file in the bucket |
expires_in | int, None | None | optional expiration time for the url (in seconds). The default expiration time is 3600 seconds (one hour). |
extra_params | null | allows setting any extra Params |
param bucket_name: | |
---|---|
name for the bucket | |
param object_name: | |
name of the file in the bucket | |
param expires_in: | |
optional expiration time for the url (in seconds). The default expiration time is 3600 seconds (one hour). | |
param extra_params: | |
allows setting any extra Params | |
return: | URL for accessing the file |
Get Cells
Get parsed cells from the response
return: | cells |
---|
Get Document Analysis
Get the results of Textract asynchronous Document Analysis operation
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
job_id | str, None | None | job identifier, defaults to None |
max_results | int | 1000 | number of blocks to get at a time, defaults to 1000 |
next_token | str, None | None | pagination token for getting next set of results, defaults to None |
collect_all_results | bool | False | when set to True will wait until analysis is complete and returns all blocks of the analysis result, by default (False) the all blocks need to be specifically collected using next_token variable |
param job_id: | job identifier, defaults to None |
---|---|
param max_results: | |
number of blocks to get at a time, defaults to 1000 | |
param next_token: | |
pagination token for getting next set of results, defaults to None | |
param collect_all_results: | |
when set to True will wait until analysis is complete and returns all blocks of the analysis result, by default (False) the all blocks need to be specifically collected using next_token variable | |
return: | dictionary |
Response dictionary has key JobStatus with value SUCCEEDED when analysis has been completed.
Examples
Init Textract Client %{AWS_KEY_ID} %{AWS_KEY_SECRET} %{AWS_REGION}
${jobid}= Start Document Analysis s3bucket_name invoice.pdf
# Wait for job completion and collect all blocks
${response}= Get Document Analysis ${jobid} collect_all_results=True
# Model will contain all pages of the invoice.pdf
${model}= Convert Textract Response To Model ${response}
Get Document Text Detection
Get the results of Textract asynchronous Document Text Detection operation
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
job_id | str, None | None | job identifier, defaults to None |
max_results | int | 1000 | number of blocks to get at a time, defaults to 1000 |
next_token | str, None | None | pagination token for getting next set of results, defaults to None |
collect_all_results | bool | False | when set to True will wait until analysis is complete and returns all blocks of the analysis result, by default (False) the all blocks need to be specifically collected using next_token variable |
param job_id: | job identifier, defaults to None |
---|---|
param max_results: | |
number of blocks to get at a time, defaults to 1000 | |
param next_token: | |
pagination token for getting next set of results, defaults to None | |
param collect_all_results: | |
when set to True will wait until analysis is complete and returns all blocks of the analysis result, by default (False) the all blocks need to be specifically collected using next_token variable | |
return: | dictionary |
Response dictionary has key JobStatus with value SUCCEEDED when analysis has been completed.
Examples
Init Textract Client %{AWS_KEY_ID} %{AWS_KEY_SECRET} %{AWS_REGION}
${jobid}= Start Document Text Detection s3bucket_name invoice.pdf
# Wait for job completion and collect all blocks
${response}= Get Document Text Detection ${jobid} collect_all_results=True
# Model will contain all pages of the invoice.pdf
${model}= Convert Textract Response To Model ${response}
Get Pages And Text
Get pages and text out of Textract response json
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
textract_response | dict | null | JSON from Textract |
param textract_response: | |
---|---|
JSON from Textract | |
return: | dictionary, page numbers as keys and value is a list of text lines |
Get Redshift Statement Results
Retrieve the results of a SQL statement previously submitted to Redshift. If that statement has not yet completed, this keyword will wait for results. See Execute Redshift Statement for additional information.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
statement_id | str | null | The statement id to use to retreive results. |
timeout | int | 40 | An integer used to calculate the maximum wait. Exact timing depends on system variability becuase the underlying waiter does not utilize a timeout directly. Defaults to 40. |
If the statement has tabular results, this keyword returns them as a table from RPA.Tables if that library is available, or as a list of dictionaries if not. If the statement does not have tabular results, it will return the number of rows affected.
param statement_id: | |
---|---|
The statement id to use to retreive results. | |
param timeout: | An integer used to calculate the maximum wait. Exact timing depends on system variability becuase the underlying waiter does not utilize a timeout directly. Defaults to 40. |
Get Tables
Get parsed tables from the response
Returns RPA.Tables.Table if possible otherwise returns an dictionary.
return: | tables |
---|
Get Words
Get parsed words from the response
return: | words |
---|
Init Comprehend Client
Initialize AWS Comprehend client
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
aws_key_id | str, None | None | access key ID |
aws_key | str, None | None | secret access key |
region | str, None | None | AWS region |
use_robocorp_vault | bool | False | use secret stored in Robocorp Vault |
session_token | str, None | None | a session token associated with temporary credentials, such as from Assume Role. |
param aws_key_id: | |
---|---|
access key ID | |
param aws_key: | secret access key |
param region: | AWS region |
param use_robocorp_vault: | |
use secret stored in Robocorp Vault | |
param session_token: | |
a session token associated with temporary credentials, such as from Assume Role. |
Init Redshift Data Client
Initialize AWS Redshift Data API client
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
aws_key_id | str, None | None | access key ID |
aws_key | str, None | None | secret access key |
region | str, None | None | AWS region |
cluster_identifier | str, None | None | The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials. |
database | str, None | None | The name of the database. This parameter is required when authenticating using either Secrets Manager or temporary credentials. |
database_user | str, None | None | The database user name. This parameter is required when connecting to a cluster and authenticating using temporary credentials. |
secret_arn | str, None | None | The name or ARN of the secret that enables access to the database. This parameter is required when authenticating using Secrets Manager. |
use_robocorp_vault | bool | False | use secret stored in Robocorp Vault |
session_token | str, None | None | a session token associated with temporary credentials, such as from Assume Role. |
param aws_key_id: | |
---|---|
access key ID | |
param aws_key: | secret access key |
param region: | AWS region |
param cluster_identifier: | |
The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials. | |
param database: | The name of the database. This parameter is required when authenticating using either Secrets Manager or temporary credentials. |
param database_user: | |
The database user name. This parameter is required when connecting to a cluster and authenticating using temporary credentials. | |
param secret_arn: | |
The name or ARN of the secret that enables access to the database. This parameter is required when authenticating using Secrets Manager. | |
param use_robocorp_vault: | |
use secret stored in Robocorp Vault | |
param session_token: | |
a session token associated with temporary credentials, such as from Assume Role. |
Init S3 Client
Initialize AWS S3 client
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
aws_key_id | str, None | None | access key ID |
aws_key | str, None | None | secret access key |
region | str, None | None | AWS region |
use_robocorp_vault | bool | False | use secret stored in Robocorp Vault |
session_token | str, None | None | a session token associated with temporary credentials, such as from Assume Role. |
param aws_key_id: | |
---|---|
access key ID | |
param aws_key: | secret access key |
param region: | AWS region |
param use_robocorp_vault: | |
use secret stored in Robocorp Vault | |
param session_token: | |
a session token associated with temporary credentials, such as from Assume Role. |
Init Sqs Client
Initialize AWS SQS client
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
aws_key_id | str, None | None | access key ID |
aws_key | str, None | None | secret access key |
region | str, None | None | AWS region |
queue_url | str, None | None | SQS queue url |
use_robocorp_vault | bool | False | use secret stored into Robocorp Vault |
session_token | str, None | None | a session token associated with temporary credentials, such as from Assume Role. |
param aws_key_id: | |
---|---|
access key ID | |
param aws_key: | secret access key |
param region: | AWS region |
param queue_url: | |
SQS queue url | |
param use_robocorp_vault: | |
use secret stored into Robocorp Vault | |
param session_token: | |
a session token associated with temporary credentials, such as from Assume Role. |
Init Sts Client
Initialize AWS STS client.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
aws_key_id | str, None | None | access key ID |
aws_key | str, None | None | secret access key |
region | str, None | None | AWS region |
use_robocorp_vault | bool | False | use secret stored in Robocorp Vault |
session_token | str, None | None | a session token associated with temporary credentials, such as from Assume Role. |
param aws_key_id: | |
---|---|
access key ID | |
param aws_key: | secret access key |
param region: | AWS region |
param use_robocorp_vault: | |
use secret stored in Robocorp Vault | |
param session_token: | |
a session token associated with temporary credentials, such as from Assume Role. |
Init Textract Client
Initialize AWS Textract client
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
aws_key_id | str, None | None | access key ID |
aws_key | str, None | None | secret access key |
region | str, None | None | AWS region |
use_robocorp_vault | bool | False | use secret stored in Robocorp Vault |
session_token | str, None | None | a session token associated with temporary credentials, such as from Assume Role. |
param aws_key_id: | |
---|---|
access key ID | |
param aws_key: | secret access key |
param region: | AWS region |
param use_robocorp_vault: | |
use secret stored in Robocorp Vault | |
param session_token: | |
a session token associated with temporary credentials, such as from Assume Role. |
List Buckets
List all buckets for this account
return: | list of buckets |
---|
List Files
List files in the bucket
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
bucket_name | str | null | name for the bucket |
limit | int, None | None | limits the response to maximum number of items |
search | str, None | None | JMESPATH expression to filter objects |
prefix | str, None | None | limits the response to keys that begin with the specified prefix |
kwargs | null | allows setting all extra parameters for list_objects_v2 method |
note This keyword accepts additional parameters in key=value format
More info on additional parameters.
param bucket_name: | |
---|---|
name for the bucket | |
param limit: | limits the response to maximum number of items |
param search: | JMESPATH expression to filter objects |
param prefix: | limits the response to keys that begin with the specified prefix |
param kwargs: | allows setting all extra parameters for list_objects_v2 method |
return: | list of files |
Python examples
# List all files in a bucket
files = AWSlibrary.list_files("bucket_name")
# List files in a bucket matching .yaml
files = AWSlibrary.list_files(
"bucket_name", search="Contents[?contains(Key, '.yaml')]"
)
# List files in a bucket matching .png and limit results to max 3
files = AWSlibrary.list_files(
"bucket_name", limit=3, search="Contents[?contains(Key, '.png')]"
)
# List files in a bucket prefixed with special and get only 1
files = AWSlibrary.list_files(
"bucket_name", prefix="special", limit=1
)
Robot Framework examples
# List all files in a bucket
@{files}= List Files bucket-name
# List files in a bucket matching .yaml
@{files}= List Files
... bucket-name
... search=Contents[?contains(Key, '.yaml')]
# List files in a bucket matching .png and limit results to max 3
@{files}= List Files
... bucket-name
... limit=3
... search=Contents[?contains(Key, '.png')]
# List files in a bucket prefixed with special and get only 1
@{files}= List Files
... bucket-name
... prefix=special
... limit=1
)
List Redshift Databases
List the databases in a cluster.
Database names are returned as a list of strings.
List Redshift Schemas
Lists the schemas in a database.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
database | str, None | None | The name of the database that contains the schemas to list. If ommitted, will use the connected Database. |
schema_pattern | str, None | None | A pattern to filter results by schema name. Within a schema pattern, "%" means match any substring of 0 or more characters and "_" means match any one character. Only schema name entries matching the search pattern are returned. If schema_pattern is not specified, then all schemas are returned. |
Schema names are returned as a list of strings.
param database: | The name of the database that contains the schemas to list. If ommitted, will use the connected Database. |
---|---|
param schema_pattern: | |
A pattern to filter results by schema name. Within a schema pattern, "%" means match any substring of 0 or more characters and "_" means match any one character. Only schema name entries matching the search pattern are returned. If schema_pattern is not specified, then all schemas are returned. |
List Redshift Tables
List the tables in a database. If neither schema_pattern nor table_pattern are specified, then all tables in the database are returned.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
database | str, None | None | The name of the database that contains the tables to be described. If ommitted, will use the connected Database. |
schema_pattern | str, None | None | A pattern to filter results by schema name. Within a schema pattern, "%" means match any substring of 0 or more characters and "_" means match any one character. Only schema name entries matching the search pattern are returned. If schema_pattern is not specified, then all tables that match table_pattern are returned. If neither schema_pattern or table_pattern are specified, then all tables are returned. |
table_pattern | str, None | None | A pattern to filter results by table name. Within a table pattern, "%" means match any substring of 0 or more characters and "_" means match any one character. Only table name entries matching the search pattern are returned. If table_pattern is not specified, then all tables that match schema_pattern are returned. If neither schema_pattern or table_pattern are specified, then all tables are returned. |
Returned objects are structured like the below JSON in a list:
{ "name": "string", "schema": "string", "type": "string" }
param database: | The name of the database that contains the tables to be described. If ommitted, will use the connected Database. |
---|---|
param schema_pattern: | |
A pattern to filter results by schema name. Within a schema pattern, "%" means match any substring of 0 or more characters and "_" means match any one character. Only schema name entries matching the search pattern are returned. If schema_pattern is not specified, then all tables that match table_pattern are returned. If neither schema_pattern or table_pattern are specified, then all tables are returned. | |
param table_pattern: | |
A pattern to filter results by table name. Within a table pattern, "%" means match any substring of 0 or more characters and "_" means match any one character. Only table name entries matching the search pattern are returned. If table_pattern is not specified, then all tables that match schema_pattern are returned. If neither schema_pattern or table_pattern are specified, then all tables are returned. |
Receive Message
Receive message from queue
return: | message as dict |
---|
Send Message
Send message to the queue
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
message | str, None | None | body of the message |
message_attributes | dict, None | None | attributes of the message |
param message: | body of the message |
---|---|
param message_attributes: | |
attributes of the message | |
return: | send message response as dict |
Set Robocorp Vault
Set Robocorp Vault name
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
vault_name | null | Robocorp Vault name |
param vault_name: | |
---|---|
Robocorp Vault name |
Start Document Analysis
Starts the asynchronous analysis of an input document for relationships between detected items such as key-value pairs, tables, and selection elements.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
bucket_name_in | str, None | None | name of the S3 bucket for the input object, defaults to None |
object_name_in | str, None | None | name of the input object, defaults to None |
object_version_in | str, None | None | version of the input object, defaults to None |
bucket_name_out | str, None | None | name of the S3 bucket where to save analysis result object, defaults to None |
prefix_object_out | str | textract_output | name of the S3 bucket for the analysis result object, |
param bucket_name_in: | |
---|---|
name of the S3 bucket for the input object, defaults to None | |
param object_name_in: | |
name of the input object, defaults to None | |
param object_version_in: | |
version of the input object, defaults to None | |
param bucket_name_out: | |
name of the S3 bucket where to save analysis result object, defaults to None | |
param prefix_object_out: | |
name of the S3 bucket for the analysis result object, | |
return: | job identifier |
Input object can be in JPEG, PNG or PDF format. Documents should be located in the Amazon S3 bucket.
By default Amazon Textract will save the analysis result internally to be accessed by keyword Get Document Analysis. This can be overridden by giving parameter bucket_name_out.
Start Document Text Detection
Starts the asynchronous detection of text in a document. Amazon Textract can detect lines of text and the words that make up a line of text.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
bucket_name_in | str, None | None | name of the S3 bucket for the input object, defaults to None |
object_name_in | str, None | None | name of the input object, defaults to None |
object_version_in | str, None | None | version of the input object, defaults to None |
bucket_name_out | str, None | None | name of the S3 bucket where to save analysis result object, defaults to None |
prefix_object_out | str | textract_output | name of the S3 bucket for the analysis result object, |
param bucket_name_in: | |
---|---|
name of the S3 bucket for the input object, defaults to None | |
param object_name_in: | |
name of the input object, defaults to None | |
param object_version_in: | |
version of the input object, defaults to None | |
param bucket_name_out: | |
name of the S3 bucket where to save analysis result object, defaults to None | |
param prefix_object_out: | |
name of the S3 bucket for the analysis result object, | |
return: | job identifier |
Input object can be in JPEG, PNG or PDF format. Documents should be located in the Amazon S3 bucket.
By default Amazon Textract will save the analysis result internally to be accessed by keyword Get Document Text Detection. This can be overridden by giving parameter bucket_name_out.
Upload File
Upload single file into bucket
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
bucket_name | str, None | None | name for the bucket |
filename | str, None | None | filepath for the file to be uploaded |
object_name | str, None | None | name of the object in the bucket, defaults to None |
kwargs | null |
param bucket_name: | |
---|---|
name for the bucket | |
param filename: | filepath for the file to be uploaded |
param object_name: | |
name of the object in the bucket, defaults to None | |
return: | tuple of upload status and error |
If object_name is not given then basename of the file is used as object_name.
note This keyword accepts additional parameters in key=value format (see below code example).
More info on additional parameters.
Robot Framework example:
&{extras}= Evaluate {'ContentType': 'image/png'}
${uploaded} ${error}= Upload File
... mybucket
... ${CURDIR}${/}image.png
... image.png
... ExtraArgs=${extras}
Upload Files
Upload multiple files into bucket
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
bucket_name | str, None | None | name for the bucket |
files | list, None | None | list of files (2 possible ways, see above) |
kwargs | null |
param bucket_name: | |
---|---|
name for the bucket | |
param files: | list of files (2 possible ways, see above) |
return: | number of files uploaded |
- Giving files as list of filepaths:
- ['/path/to/file1.txt', '/path/to/file2.txt']
- Giving files as list of dictionaries (including filepath and object name):
- [{'filename':'/path/to/file1.txt', 'object_name': 'file1.txt'}, {'filename': '/path/to/file2.txt', 'object_name': 'file2.txt'}]
note This keyword accepts additional parameters in key=value format (see below code example).
More info on additional parameters.
Python example (passing ExtraArgs):
upload_files = [
{
"filename": "./image.png",
"object_name": "image.png",
"ExtraArgs": {"ContentType": "image/png", "Metadata": {"importance": "1"}},
},
{
"filename": "./doc.pdf",
"object_name": "doc.pdf",
"ExtraArgs": {"ContentType": "application/pdf"},
},
]
awslibrary.upload_files("mybucket", files=upload_files)