Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AmazonMetadataProvider" /> with the
        /// configuration for Amazon.
        /// </summary>
        /// <param name="optionsAccessor">The accessor to the configuration for Amazon.</param>
        public AmazonMetadataProvider(IOptions <AmazonMetadataOptions> optionsAccessor)
        {
            var op  = optionsAccessor?.Value;
            var id  = op?.AWSAccessKeyId ?? Environment.GetEnvironmentVariable("AWS_ACCESS_KEY_ID");
            var key = op?.AWSSecretKey ?? Environment.GetEnvironmentVariable("AWS_SECRET_KEY");
            var tag = op?.AmazonAssociateTag ?? Environment.GetEnvironmentVariable("AMAZON_ASSOCIATE_TAG");

            if (!string.IsNullOrEmpty(id) && !string.IsNullOrEmpty(key) && !string.IsNullOrEmpty(tag))
            {
                _Queue = new AmazonMetadataProviderQueue(id, key, tag);
            }
        }
Пример #2
0
 /// <summary>
 /// Initializes a new instaince of the <see cref="AmazonMetadataProvider" /> class with AWS secrets.
 /// </summary>
 /// <param name="accessKeyId">The AWS access key id.</param>
 /// <param name="secretKey">The AWS secret key.</param>
 /// <param name="associateTag">The Amazon associate tag.</param>
 public AmazonMetadataProvider(string accessKeyId, string secretKey, string associateTag)
 {
     // TODO: support multiple queue.
     _Queue = new AmazonMetadataProviderQueue(accessKeyId, secretKey, associateTag);
 }