Beispiel #1
0
        /// <summary>
        /// Resolves connection and credental parameters and generates a single AWSConnectionParams value.
        /// </summary>
        /// <param name="correlationId">(optional) transaction id to trace execution through call chain.</param>
        /// <returns>AWSConnectionParams value</returns>
        public async Task <AwsConnectionParams> ResolveAsync(string correlationId)
        {
            var result = new AwsConnectionParams();

            var connection = await _connectionResolver.ResolveAsync(correlationId);

            result.Append(connection);

            var credential = await _credentialResolver.LookupAsync(correlationId);

            result.Append(credential);

            // Force ARN parsing
            result.Arn = result.Arn;

            // Perform validation
            var err = result.Validate(correlationId);

            if (err != null)
            {
                throw err;
            }

            return(result);
        }
        /// <summary>
        /// Retrieves AwsConnectionParams from configuration parameters.
        /// The values are retrieves from "connection" and "credential" sections.
        /// </summary>
        /// <param name="config">configuration parameters</param>
        /// <returns>the generated AwsConnectionParams object.</returns>
        public static AwsConnectionParams FromConfig(ConfigParams config)
        {
            var result = new AwsConnectionParams();

            var credentials = CredentialParams.ManyFromConfig(config);

            foreach (var credential in credentials)
            {
                result.Append(credential);
            }

            var connections = ConnectionParams.ManyFromConfig(config);

            foreach (var connection in connections)
            {
                result.Append(connection);
            }

            return(result);
        }