Documentation ¶
Index ¶
- type AwsConnectionParams
- func NewAwsConnectionParams(values map[string]string) *AwsConnectionParams
- func NewAwsConnectionParamsFromConfig(config *cconf.ConfigParams) *AwsConnectionParams
- func NewAwsConnectionParamsFromString(line string) *AwsConnectionParams
- func NewAwsConnectionParamsMergeConfigs(configs []*cconf.ConfigParams) *AwsConnectionParams
- func NewEmptyAwsConnectionParams() *AwsConnectionParams
- func (c *AwsConnectionParams) GetAccessId() string
- func (c *AwsConnectionParams) GetAccessKey() string
- func (c *AwsConnectionParams) GetAccount() string
- func (c *AwsConnectionParams) GetArn() string
- func (c *AwsConnectionParams) GetPartition() string
- func (c *AwsConnectionParams) GetRegion() string
- func (c *AwsConnectionParams) GetResource() string
- func (c *AwsConnectionParams) GetResourceType() string
- func (c *AwsConnectionParams) GetService() string
- func (c *AwsConnectionParams) SetAccessId(value string)
- func (c *AwsConnectionParams) SetAccessKey(value string)
- func (c *AwsConnectionParams) SetAccount(value string)
- func (c *AwsConnectionParams) SetArn(value string)
- func (c *AwsConnectionParams) SetPartition(value string)
- func (c *AwsConnectionParams) SetRegion(value string)
- func (c *AwsConnectionParams) SetResource(value string)
- func (c *AwsConnectionParams) SetResourceType(value string)
- func (c *AwsConnectionParams) SetService(value string)
- func (c *AwsConnectionParams) Validate(correlationId string) *cerr.ApplicationError
- type AwsConnectionResolver
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AwsConnectionParams ¶
type AwsConnectionParams struct {
*cconf.ConfigParams
}
Contains connection parameters to authenticate against Amazon Web Services (AWS) and connect to specific AWS resource.
The struct 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 CredentialParams may contain any number of custom parameters ¶
See AwsConnectionResolver ¶
### Example ###
connection := NewAwsConnectionParamsFromTuples( "region", "us-east-1", "access_id", "XXXXXXXXXXXXXXX", "secret_key", "XXXXXXXXXXXXXXX", "service", "s3", "bucket", "mybucket" ); region := connection.getRegion(); // Result: "us-east-1" accessId := connection.getAccessId(); // Result: "XXXXXXXXXXXXXXX" secretKey := connection.getAccessKey(); // Result: "XXXXXXXXXXXXXXX" pin := connection.getAsNullableString("bucket"); // Result: "mybucket"
func NewAwsConnectionParams ¶
func NewAwsConnectionParams(values map[string]string) *AwsConnectionParams
NewAwsConnectionParams creates an new instance of the connection parameters.
- values (optional) an object to be converted into key-value pairs to initialize this connection.
func NewAwsConnectionParamsFromConfig ¶
func NewAwsConnectionParamsFromConfig(config *cconf.ConfigParams) *AwsConnectionParams
Retrieves AwsConnectionParams from configuration parameters. The values are retrieves from "connection" and "credential" sections.
- config configuration parameters
Returns the generated AwsConnectionParams object. See NewAwsConnectionParamsMergeConfigs
func NewAwsConnectionParamsFromString ¶
func NewAwsConnectionParamsFromString(line string) *AwsConnectionParams
NewAwsConnectionParamsFromString creates a new AwsConnectionParams object filled with key-value pairs serialized as a string.
- 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.
func NewAwsConnectionParamsMergeConfigs ¶
func NewAwsConnectionParamsMergeConfigs(configs []*cconf.ConfigParams) *AwsConnectionParams
NewAwsConnectionParamsMergeConfigs retrieves AwsConnectionParams from multiple configuration parameters. The values are retrieves from "connection" and "credential" sections.
- configs a list with configuration parameters
Returns the generated AwsConnectionParams object. See NewAwsConnectionParamsFromConfig
func NewEmptyAwsConnectionParams ¶
func NewEmptyAwsConnectionParams() *AwsConnectionParams
NewEmptyAwsConnectionParams creates an new instance of the connection parameters.
func (*AwsConnectionParams) GetAccessId ¶
func (c *AwsConnectionParams) GetAccessId() string
GetAccessId gets the AWS access id. Returns the AWS access id.
func (*AwsConnectionParams) GetAccessKey ¶
func (c *AwsConnectionParams) GetAccessKey() string
GetAccessKey gets the AWS client key. Returns the AWS client key.
func (*AwsConnectionParams) GetAccount ¶
func (c *AwsConnectionParams) GetAccount() string
GetAccount Gets the AWS account id. Returns the AWS account id.
func (*AwsConnectionParams) GetArn ¶
func (c *AwsConnectionParams) GetArn() string
GetArn gets the AWS resource ARN. If the ARN is not defined it automatically generates it from other properties. Returns the AWS resource ARN.
func (*AwsConnectionParams) GetPartition ¶
func (c *AwsConnectionParams) GetPartition() string
GetPartition Gets the AWS partition name. Returns the AWS partition name.
func (*AwsConnectionParams) GetRegion ¶
func (c *AwsConnectionParams) GetRegion() string
GetRegion gets the AWS region. Returns the AWS region.
func (*AwsConnectionParams) GetResource ¶
func (c *AwsConnectionParams) GetResource() string
GetResource gets the AWS resource id.
Returns the AWS resource id.
func (*AwsConnectionParams) GetResourceType ¶
func (c *AwsConnectionParams) GetResourceType() string
GetResourceType gets the AWS resource type. Returns the AWS resource type.
func (*AwsConnectionParams) GetService ¶
func (c *AwsConnectionParams) GetService() string
GetService gets the AWS service name. Returns the AWS service name.
func (*AwsConnectionParams) SetAccessId ¶
func (c *AwsConnectionParams) SetAccessId(value string)
SetAccessId sets the AWS access id.
- value the AWS access id.
func (*AwsConnectionParams) SetAccessKey ¶
func (c *AwsConnectionParams) SetAccessKey(value string)
SetAccessKey sets the AWS client key.
- value a new AWS client key.
func (*AwsConnectionParams) SetAccount ¶
func (c *AwsConnectionParams) SetAccount(value string)
SetAccount Sets the AWS account id. - value the AWS account id.
func (*AwsConnectionParams) SetArn ¶
func (c *AwsConnectionParams) SetArn(value string)
SetArn sets the AWS resource ARN. When it sets the value, it automatically parses the ARN and sets individual parameters.
- value a new AWS resource ARN.
func (*AwsConnectionParams) SetPartition ¶
func (c *AwsConnectionParams) SetPartition(value string)
SetPartition Sets the AWS partition name.
- value a new AWS partition name.
func (*AwsConnectionParams) SetRegion ¶
func (c *AwsConnectionParams) SetRegion(value string)
SetRegion Sets the AWS region.
- value a new AWS region.
func (*AwsConnectionParams) SetResource ¶
func (c *AwsConnectionParams) SetResource(value string)
SetResource sets the AWS resource id.
- value a new AWS resource id.
func (*AwsConnectionParams) SetResourceType ¶
func (c *AwsConnectionParams) SetResourceType(value string)
SetResourceType sets the AWS resource type.
- value a new AWS resource type.
func (*AwsConnectionParams) SetService ¶
func (c *AwsConnectionParams) SetService(value string)
SetService sets the AWS service name.
- value a new AWS service name.
func (*AwsConnectionParams) Validate ¶
func (c *AwsConnectionParams) Validate(correlationId string) *cerr.ApplicationError
Validates this connection parameters
- correlationId (optional) transaction id to trace execution through call chain.
Returns a ConfigException or null if validation passed successfully.
type AwsConnectionResolver ¶
type AwsConnectionResolver struct {
// contains filtered or unexported fields
}
Helper class to retrieve AWS connection and credential parameters, validate them and compose a AwsConnectionParams value.
### Configuration parameters ###
- connections:
- discovery_key: (optional) a key to retrieve the connection from IDiscovery
- region: (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 ICredentialStore
- access_id: AWS access/client id
- access_key: AWS access/client id
### References ###
\*:discovery:\*:\*:1.0 (optional) IDiscovery services to resolve connections
\*:credential-store:\*:\*:1.0 (optional) Credential stores to resolve credentials
See ConnectionParams (in the Pip.Services components package) See IDiscovery (in the Pip.Services components package)
### Example ###
config := NewConfigParamsFromTuples( "connection.region", "us-east1", "connection.service", "s3", "connection.bucket", "mybucket", "credential.access_id", "XXXXXXXXXX", "credential.access_key", "XXXXXXXXXX" );
connectionResolver := NewAwsConnectionResolver(); connectionResolver.Configure(config); connectionResolver.SetReferences(references);
err, connection :=connectionResolver.Resolve("123") // Now use connection...
func NewAwsConnectionResolver ¶
func NewAwsConnectionResolver() *AwsConnectionResolver
func (*AwsConnectionResolver) Configure ¶
func (c *AwsConnectionResolver) Configure(config *cconf.ConfigParams)
Configures component by passing configuration parameters.
- config configuration parameters to be set.
func (*AwsConnectionResolver) Resolve ¶
func (c *AwsConnectionResolver) Resolve(correlationId string) (connection *AwsConnectionParams, err error)
Resolves connection and credental parameters and generates a single AWSConnectionParams value.
- correlationId (optional) transaction id to trace execution through call chain.
- callback callback function that receives AWSConnectionParams value or error.
See IDiscovery (in the Pip.Services components package)
func (*AwsConnectionResolver) SetReferences ¶
func (c *AwsConnectionResolver) SetReferences(references cref.IReferences)
Sets references to dependent components.
- references references to locate the component dependencies.