pip_services3_aws.connect package
Submodules
Module contents
- class pip_services3_aws.connect.AwsConnectionParams(values: Optional[Any] = None)
Bases:
pip_services3_commons.config.ConfigParams.ConfigParamsContains connection parameters to authenticate against Amazon Web Services (AWS) and connect to specific AWS resource.
The class is able to compose and parse AWS resource ARNs.
- ### Configuration parameters ###
access_id: application access id
client_id: alternative to access_id
access_key: application secret key
client_key: alternative to access_key
secret_key: alternative to access_key
In addition to standard parameters
CredentialParamsmay contain any number of custom parametersExample:
connection = AwsConnectionParams.from_tuples( "region", "us-east-1", "access_id", "XXXXXXXXXXXXXXX", "secret_key", "XXXXXXXXXXXXXXX", "service", "s3", "bucket", "mybucket" ) region = connection.get_region() # Result: "us-east-1" access_id = connection.get_access_id() # Result: "XXXXXXXXXXXXXXX" secret_key = connection.get_access_key() # Result: "XXXXXXXXXXXXXXX" pin = connection.get_as_nullable_string("bucket") # Result: "mybucket"
- static from_config(config: pip_services3_commons.config.ConfigParams.ConfigParams) pip_services3_aws.connect.AwsConnectionParams.AwsConnectionParams
Retrieves AwsConnectionParams from configuration parameters. The values are retrieves from “connection” and “credential” sections.
- Parameters
config – configuration parameters
- Returns
the generated AwsConnectionParams object.
- static from_string(line: str) pip_services3_aws.connect.AwsConnectionParams.AwsConnectionParams
Creates a new AwsConnectionParams object filled with key-value pairs serialized as a string.
- Parameters
line – a string with serialized key-value pairs as “key1=value1;key2=value2;…” Example: “Key1=123;Key2=ABC;Key3=2016-09-16T00:00:00.00Z”
- Returns
a new AwsConnectionParams object.
- get_access_id() str
Gets the AWS access id.
- Returns
the AWS access id.
- get_access_key() str
Gets the AWS client key.
- Returns
the AWS client key.
- get_account() str
Gets the AWS account id.
- Returns
the AWS account id.
- get_arn() str
Gets the AWS resource ARN. If the ARN is not defined it automatically generates it from other properties.
- Returns
the AWS resource ARN.
- get_partition() str
Gets the AWS partition name.
- Returns
the AWS partition name.
- get_region() str
Gets the AWS region.
- Returns
the AWS region.
- get_resource() str
Gets the AWS resource id.
- Returns
the AWS resource id.
- get_resource_type() str
Gets the AWS resource type.
- Returns
the AWS resource type.
- get_service() str
Gets the AWS service name.
- Returns
the AWS service name.
- static merge_configs(*configs: pip_services3_commons.config.ConfigParams.ConfigParams) pip_services3_aws.connect.AwsConnectionParams.AwsConnectionParams
Retrieves AwsConnectionParams from multiple configuration parameters. The values are retrieves from “connection” and “credential” sections.
- Parameters
configs – a list with configuration parameters
- Returns
the generated AwsConnectionParams object.
- set_access_id(value: str)
Sets the AWS access id.
- Parameters
value – the AWS access id.
- set_access_key(value: str)
Sets the AWS client key.
- Parameters
value – a new AWS client key.
- set_account(value: str)
Sets the AWS account id.
- Parameters
value – the AWS account id.
- set_arn(value: str)
Sets the AWS resource ARN. When it sets the value, it automatically parses the ARN and sets individual parameters.
- Parameters
value – a new AWS resource ARN.
- set_partition(value: str)
Sets the AWS partition name.
- Parameters
value – a new AWS partition name.
- set_region(value: str)
Sets the AWS region.
- Parameters
value – a new AWS region.
- set_resource(value: str)
Sets the AWS resource id.
- Parameters
value – a new AWS resource id.
- set_resource_type(value: Optional[str])
Sets the AWS resource type.
- Parameters
value – a new AWS resource type.
- set_service(value: str)
Sets the AWS service name.
- Parameters
value – a new AWS service name.
- validate(correlation_id: Optional[str])
Validates this connection parameters
- Parameters
correlation_id – (optional) transaction id to trace execution through call chain.
- class pip_services3_aws.connect.AwsConnectionResolver
Bases:
pip_services3_commons.config.IConfigurable.IConfigurable,pip_services3_commons.refer.IReferenceable.IReferenceableHelper class to retrieve AWS connection and credential parameters, validate them and compose a
AwsConnectionParamsvalue.### Configuration parameters ### - connections:
discovery_key: (optional) a key to retrieve the connection from
IDiscoveryregion: (optional) AWS region
partition: (optional) AWS partition
service: (optional) AWS service
resource_type: (optional) AWS resource type
resource: (optional) AWS resource id
arn: (optional) AWS resource ARN
- credentials:
store_key: (optional) a key to retrieve the credentials from
ICredentialStoreaccess_id: AWS access/client id
access_key: AWS access/client id
- ### References ###
*:discovery:*:*:1.0 (optional)
IDiscoveryservices to resolve connection:credential-store::*:1.0 (optional) Credential stores to resolve credentials
See
ConnectionParams(in the Pip.Services components package),IDiscovery(in the Pip.Services components package)config = ConfigParams.from_tuples( "connection.region", "us-east1", "connection.service", "s3", "connection.bucket", "mybucket", "credential.access_id", "XXXXXXXXXX", "credential.access_key", "XXXXXXXXXX" ) connection_resolver = AwsConnectionResolver() connection_resolver.configure(config) connection_resolver.set_references(references) connection_params = connection_resolver.resolve("123")
- configure(config: pip_services3_commons.config.ConfigParams.ConfigParams)
Configures component by passing configuration parameters.
- Parameters
config – configuration parameters to be set.
- resolve(correlation_id: str) pip_services3_aws.connect.AwsConnectionParams.AwsConnectionParams
Resolves connection and credential parameters and generates a single AWSConnectionParams value.
- Parameters
correlation_id – (optional) transaction id to trace execution through call chain.
- Returns
AWSConnectionParams value or error.
- set_references(references: pip_services3_commons.refer.IReferences.IReferences)
Sets references to dependent components.
- Parameters
references – references to locate the component dependencies.