public CognitoSyncManager(CognitoAWSCredentials cognitoCredentials, RegionEndpoint endpoint)
     : this(cognitoCredentials, new AmazonCognitoSyncConfig
     {
         RegionEndpoint = endpoint
     })
 {
 }
        /// <summary>
        /// Generate a presigned URL based on a <see cref="SynthesizeSpeechRequest"/>.
        /// </summary>
        /// <param name="credentials">The credentials to use in the presigned URL.</param>
        /// <param name="region">The region for the URL.</param>
        /// <param name="request">The request to base the presigned URL on.</param>
        /// <returns></returns>
        public static string GeneratePresignedUrl(AWSCredentials credentials, RegionEndpoint region, SynthesizeSpeechRequest request)
        {
            if (credentials == null)
                throw new ArgumentNullException("credentials");

            if (region == null)
                throw new ArgumentNullException("region");

            if (request == null)
                throw new ArgumentNullException("request");

            // Marshall this request and prepare it to be signed
            var marshaller = new SynthesizeSpeechRequestMarshaller();
            var iRequest = marshaller.Marshall(request);
            iRequest.UseQueryString = true;
            iRequest.HttpMethod = HTTPGet;
            iRequest.Endpoint = new UriBuilder(HTTPS, region.GetEndpointForService(PollyServiceName).Hostname).Uri;
            iRequest.Parameters[XAmzExpires] = ((int)FifteenMinutes.TotalSeconds).ToString(CultureInfo.InvariantCulture);

            if (request.IsSetLexiconNames())
            {
                var sortedLexiconNames = new List<string>(request.LexiconNames);
                sortedLexiconNames.Sort(StringComparer.Ordinal);
                iRequest.Parameters[LexiconNamesParameter] = JsonMapper.ToJson(sortedLexiconNames);
            }

            if (request.IsSetOutputFormat())
                iRequest.Parameters["OutputFormat"] = request.OutputFormat.ToString();

            if (request.IsSetSampleRate())
                iRequest.Parameters["SampleRate"] = request.SampleRate.ToString();

            if (request.IsSetText())
                iRequest.Parameters["Text"] = request.Text;

            if (request.IsSetTextType())
                iRequest.Parameters["TextType"] = request.TextType.ToString();

            if (request.IsSetVoiceId())
                iRequest.Parameters["VoiceId"] = request.VoiceId;

            var immutableCredentials = credentials.GetCredentials();
            if (immutableCredentials.UseToken)
            {
                // Don't use HeaderKeys.XAmzSecurityTokenHeader because Polly treats this as case-sensitive
                iRequest.Parameters["X-Amz-Security-Token"] = immutableCredentials.Token;
            }

            // Only the host header should be signed, and the signer adds that.
            // So clear out headers.
            iRequest.Headers.Clear();

            // Create presigned URL and assign it
            var signingResult = SynthesizeSpeechPresignedUrlSigner.SignSynthesizeSpeechRequest(iRequest, new RequestMetrics(),
                immutableCredentials.AccessKey, immutableCredentials.SecretKey, PollyServiceName, region.SystemName);

            var authorization = "&" + signingResult.ForQueryParameters;

            return ComposeUrl(iRequest).AbsoluteUri + authorization;
        }
Exemple #3
0
        /// <summary>
        /// Constructor of <see cref="Amazon.MobileAnalytics.MobileAnalyticsManager.Internal.DeliveryClient"/> class.
        /// </summary>
        /// <param name="policyFactory">An instance of IDeliveryPolicyFactory. <see cref="Amazon.MobileAnalytics.MobileAnalyticsManager.Internal.IDeliveryPolicyFactory"/></param>
        /// <param name="maConfig">Mobile Analytics Manager configuration. <see cref="Amazon.MobileAnalytics.MobileAnalyticsManager.MobileAnalyticsManagerConfig"/></param>
        /// <param name="clientContext">An instance of ClientContext. <see cref="Amazon.Runtime.Internal.ClientContext"/></param>
        /// <param name="credentials">An instance of Credentials. <see cref="Amazon.Runtime.AWSCredentials"/></param>
        /// <param name="regionEndPoint">Region endpoint. <see cref="Amazon.RegionEndpoint"/></param>
        public DeliveryClient(IDeliveryPolicyFactory policyFactory, MobileAnalyticsManagerConfig maConfig, ClientContext clientContext, AWSCredentials credentials, RegionEndpoint regionEndPoint)
        {
            _policyFactory = policyFactory;
            _deliveryPolicies = new List<IDeliveryPolicy>();
            _deliveryPolicies.Add(_policyFactory.NewConnectivityPolicy());

            _clientContext = clientContext;
            _appID = clientContext.AppID;
            _maConfig = maConfig;
            _eventStore = new SQLiteEventStore(maConfig);

#if PCL
            _mobileAnalyticsLowLevelClient = new AmazonMobileAnalyticsClient(credentials, regionEndPoint);
#elif BCL
            if (null == credentials && null == regionEndPoint)
            {
                _mobileAnalyticsLowLevelClient = new AmazonMobileAnalyticsClient();
            }
            else if (null == credentials)
            {
                _mobileAnalyticsLowLevelClient = new AmazonMobileAnalyticsClient(regionEndPoint);
            }
            else if (null == regionEndPoint)
            {
                _mobileAnalyticsLowLevelClient = new AmazonMobileAnalyticsClient(credentials);
            }
            else
            {
                _mobileAnalyticsLowLevelClient = new AmazonMobileAnalyticsClient(credentials, regionEndPoint);
            }
#endif
        }
 internal void UseClient(ICoreAmazonS3 client, RegionEndpoint region)
 {
     if (this.clientsByRegion.ContainsKey(region.SystemName))
     {
         this.clientsByRegion.Remove(region.SystemName);
     }
     this.clientsByRegion.Add(region.SystemName, client);
 }
        /// <summary>
        /// Gets or creates Mobile Analytics Manager instance. If the instance already exists, returns the instance; otherwise
        /// creates new instance and returns it.
        /// </summary>
        /// <param name="appID">Amazon Mobile Analytics Application ID.</param>
        /// <param name="regionEndpoint">Region endpoint.</param>
        /// <returns>Mobile Analytics Manager instance. </returns>
        public static MobileAnalyticsManager GetOrCreateInstance(string appID, RegionEndpoint regionEndpoint)
        {
            if (string.IsNullOrEmpty(appID))
                throw new ArgumentNullException("appID");
            if (null == regionEndpoint)
                throw new ArgumentNullException("regionEndpoint");

            return GetOrCreateInstanceHelper(appID, null, regionEndpoint, null);
        }
Exemple #6
0
 internal void UseClient(AmazonS3Client client, RegionEndpoint region)
 {
     if (this.clientsByRegion.ContainsKey(region.SystemName))
     {
         this.clientsByRegion.Remove(region.SystemName);
         this.transferUtilitiesByRegion.Remove(region.SystemName);
     }
     this.clientsByRegion.Add(region.SystemName, client);
     this.transferUtilitiesByRegion.Add(region.SystemName, new TransferUtility(client));
 }
Exemple #7
0
 internal AmazonS3Client GetClient(RegionEndpoint region)
 {
     AmazonS3Client output;
     if (!this.clientsByRegion.TryGetValue(region.SystemName, out output))
     {
         output = new AmazonS3Client(this.credentials, this.config);
         this.clientsByRegion.Add(region.SystemName, output);
     }
     return output;
 }
Exemple #8
0
 internal TransferUtility GetTransferUtility(RegionEndpoint region)
 {
     TransferUtility output;
     if (!this.transferUtilitiesByRegion.TryGetValue(region.SystemName, out output))
     {
         output = new TransferUtility(this.GetClient(region));
         this.transferUtilitiesByRegion.Add(region.SystemName, output);
     }
     return output;
 }
 internal ICoreAmazonS3 GetClient(RegionEndpoint region)
 {
     ICoreAmazonS3 output;
     if (!this.clientsByRegion.TryGetValue(region.SystemName, out output))
     {
         output = ServiceClientHelpers.CreateServiceFromAssembly<ICoreAmazonS3>(ServiceClientHelpers.S3_ASSEMBLY_NAME, ServiceClientHelpers.S3_SERVICE_CLASS_NAME, this.ddbClient);
         this.clientsByRegion.Add(region.SystemName, output);
     }
     return output;
 }
 /// <summary>
 /// Constructor of <see cref="Amazon.MobileAnalytics.MobileAnalyticsManager.DeliveryClient"/> class.
 /// </summary>
 /// <param name="isDataAllowed">An instance of IDeliveryPolicyFactory <see cref="Amazon.MobileAnalytics.MobileAnalyticsManager.Internal.IDeliveryPolicyFactory"/></param>
 /// <param name="clientContext">An instance of ClientContext <see cref="Amazon.MobileAnalytics.MobileAnalyticsManager.Internal.ClientContext"/></param>
 /// <param name="credentials">An instance of Credentials <see cref="Amazon.Runtime.AWSCredentials"/></param>
 /// <param name="regionEndPoint">Region end point <see cref="Amazon.RegionEndpoint"/></param>
 public DeliveryClient(IDeliveryPolicyFactory policyFactory, ClientContext clientContext, AWSCredentials credentials, RegionEndpoint regionEndPoint)
 {
     _policyFactory = policyFactory;
     _mobileAnalyticsLowLevelClient = new AmazonMobileAnalyticsClient(credentials, regionEndPoint);
     _clientContext = clientContext;
     _appId = clientContext.Config.AppId;
     _eventStore = new SQLiteEventStore(AWSConfigsMobileAnalytics.MaxDBSize, AWSConfigsMobileAnalytics.DBWarningThreshold);
     _deliveryPolicies = new List<IDeliveryPolicy>();
     _deliveryPolicies.Add(_policyFactory.NewConnectivityPolicy());
     _deliveryPolicies.Add(_policyFactory.NewBackgroundSubmissionPolicy());
 }
 /// <summary>
 /// Deletes the image file artifacts associated with the specified conversion task.
 /// If the task is still active, ignoreActiveTask must be set true to enable artifact
 /// deletion, which will cause the task to fail. Use this option at your own risk.
 /// </summary>
 /// <param name="awsCredentials">
 /// Credentials to use to instantiate the Amazon EC2 and Amazon S3 clients needed to
 /// complete the operation.
 /// </param>
 /// <param name="region">
 /// The region containing the bucket where the image file artifacts were stored
 /// </param>
 /// <param name="conversionTaskId">
 /// The ID of the conversion task that used the image file
 /// </param>
 /// <param name="ignoreActiveTask">
 /// If true the artifacts are deleted even if the conversion task is still in progress
 /// </param>
 /// <param name="progressCallback">Optional progress callback</param>
 public static void DeleteImageArtifacts(AWSCredentials awsCredentials, 
                                         RegionEndpoint region, 
                                         string conversionTaskId, 
                                         bool ignoreActiveTask,
                                         CleanupProgressCallback progressCallback)
 {
     DeleteImageArtifacts(new AmazonEC2Client(awsCredentials, region), 
                          new AmazonS3Client(awsCredentials, region), 
                          conversionTaskId, 
                          ignoreActiveTask,
                          progressCallback);                        
 }
 /// <summary>
 /// Deletes the image file artifacts associated with the specified conversion task.
 /// If the task is still active, ignoreActiveTask must be set true to enable artifact
 /// deletion, which will cause the task to fail. Use this option at your own risk.
 /// </summary>
 /// <param name="awsCredentials">
 /// Credentials to use to instantiate the Amazon EC2 and Amazon S3 clients needed to
 /// complete the operation.
 /// </param>
 /// <param name="region">
 /// The region containing the bucket where the image file artifacts were stored
 /// </param>
 /// <param name="conversionTaskId">
 /// The ID of the conversion task that used the image file
 /// </param>
 /// <param name="ignoreActiveTask">
 /// If true the artifacts are deleted even if the conversion task is still in progress
 /// </param>
 /// <param name="progressCallback">Optional progress callback</param>
 public static void DeleteImageArtifacts(AWSCredentials awsCredentials, 
                                         RegionEndpoint region, 
                                         string conversionTaskId, 
                                         bool ignoreActiveTask,
                                         CleanupProgressCallback progressCallback)
 {
     DeleteImageArtifacts(new AmazonEC2Client(awsCredentials, region),
                          ServiceClientHelpers.CreateServiceFromAssembly<ICoreAmazonS3>(ServiceClientHelpers.S3_ASSEMBLY_NAME, ServiceClientHelpers.S3_SERVICE_CLASS_NAME, awsCredentials, region),
                          conversionTaskId, 
                          ignoreActiveTask,
                          progressCallback);                        
 }
        /// <summary>
        /// Gets or creates Mobile Analytics Manager instance. If the instance already exists, returns the instance; otherwise
        /// creates new instance and returns it.
        /// </summary>
        /// <param name="appID">Amazon Mobile Analytics Application ID.</param>
        /// <param name="credentials">AWS Credentials.</param>
        /// <param name="regionEndpoint">Region endpoint.</param>
        /// <returns>Mobile Analytics Manager instance.</returns>
        public static MobileAnalyticsManager GetOrCreateInstance(string appID, AWSCredentials credentials, RegionEndpoint regionEndpoint)
        {
            if (string.IsNullOrEmpty(appID))
                throw new ArgumentNullException("appID");
            if (null == credentials)
                throw new ArgumentNullException("credentials");
            if (null == regionEndpoint)
                throw new ArgumentNullException("regionEndpoint");

            MobileAnalyticsManagerConfig maConfig = new MobileAnalyticsManagerConfig();
            return GetOrCreateInstanceHelper(appID, credentials, regionEndpoint, maConfig);
        }
 /// <summary>
 /// Constructor of <see cref="Amazon.MobileAnalytics.MobileAnalyticsManager.Internal.DeliveryClient"/> class.
 /// </summary>
 /// <param name="policyFactory">An instance of IDeliveryPolicyFactory <see cref="Amazon.MobileAnalytics.MobileAnalyticsManager.Internal.IDeliveryPolicyFactory"/></param>
 /// <param name="maConfig"></param>
 /// <param name="maManager"></param>
 /// <param name="clientContext">An instance of ClientContext <see cref="Amazon.Runtime.Internal.ClientContext"/></param>
 /// <param name="credentials">An instance of Credentials <see cref="Amazon.Runtime.AWSCredentials"/></param>
 /// <param name="regionEndPoint">Region end point <see cref="Amazon.RegionEndpoint"/></param>
 public DeliveryClient(IDeliveryPolicyFactory policyFactory, MobileAnalyticsManagerConfig maConfig, ClientContext clientContext, AWSCredentials credentials, RegionEndpoint regionEndPoint, MobileAnalyticsManager maManager)
 {
     _policyFactory = policyFactory;
     _mobileAnalyticsLowLevelClient = new AmazonMobileAnalyticsClient(credentials, regionEndPoint);
     _clientContext = clientContext;
     _appID = clientContext.AppID;
     _maConfig = maConfig;
     _maManager = maManager;
     _eventStore = new SQLiteEventStore(maConfig);
     _deliveryPolicies = new List<IDeliveryPolicy>();
     _deliveryPolicies.Add(_policyFactory.NewConnectivityPolicy());
 }
        /// <summary>
        /// Gets the or creates Mobile Analytics Manager instance. If the instance already exists, returns the instance; otherwise
        /// creates new instance and returns it.
        /// </summary>
        /// <returns>Mobile Analytics Manager instance.</returns>
        /// <param name="credentials">AWS Credentials.</param>
        /// <param name="regionEndpoint">Region endpoint.</param>
        /// <param name="appId">Amazon Mobile Analytics Application ID.</param>
        public static MobileAnalyticsManager GetOrCreateInstance(AWSCredentials credential,
                                                                 RegionEndpoint regionEndpoint,
                                                                 string appId)
        {
            if (credential == null)
                throw new ArgumentNullException("credential");
            if (regionEndpoint == null)
                throw new ArgumentNullException("regionEndpoint");
            if (string.IsNullOrEmpty(appId))
                throw new ArgumentNullException("appId");

            return MobileAnalyticsManager.GetOrCreateInstanceHelper(appId, credential, regionEndpoint);
        }
        /// <summary>
        ///  Given a policy and AWS credentials, produce a S3PostUploadSignedPolicy.
        /// </summary>
        /// <param name="policy">JSON string representing the policy to sign</param>
        /// <param name="credentials">Credentials to sign the policy with</param>
        /// <param name="region">Service region endpoint.</param>
        /// <returns>A signed policy object for use with an S3PostUploadRequest.</returns>
        public static S3PostUploadSignedPolicy GetSignedPolicyV4(string policy, AWSCredentials credentials, RegionEndpoint region)
        {
            var signedAt = AWSSDKUtils.CorrectedUtcNow;

            ImmutableCredentials iCreds = credentials.GetCredentials();
            var algorithm = "AWS4-HMAC-SHA256";
            var dateStamp = Runtime.Internal.Auth.AWS4Signer.FormatDateTime(signedAt, AWSSDKUtils.ISO8601BasicDateFormat);
            var dateTimeStamp = Runtime.Internal.Auth.AWS4Signer.FormatDateTime(signedAt, AWSSDKUtils.ISO8601BasicDateTimeFormat);
            var credentialString = string.Format(CultureInfo.InvariantCulture, "{0}/{1}/{2}/{3}/{4}/", iCreds.AccessKey, dateStamp, region.SystemName, "s3", Runtime.Internal.Auth.AWS4Signer.Terminator);

            Dictionary<string, string> extraConditions = new Dictionary<string, string> {
                { S3Constants.PostFormDataXAmzCredential, credentialString },
                { S3Constants.PostFormDataXAmzAlgorithm, algorithm },
                { S3Constants.PostFormDataXAmzDate, dateTimeStamp }
            };
            if (iCreds.UseToken) { extraConditions[S3Constants.PostFormDataSecurityToken] = iCreds.Token; }

            var policyBytes = addConditionsToPolicy(policy, extraConditions);

            var base64Policy = Convert.ToBase64String(policyBytes);

            var signingKey = Runtime.Internal.Auth.AWS4Signer.ComposeSigningKey(iCreds.SecretKey, region.SystemName, dateStamp, "s3");

            var signature = AWSSDKUtils.ToHex(Runtime.Internal.Auth.AWS4Signer.ComputeKeyedHash(SigningAlgorithm.HmacSHA256, signingKey, base64Policy), true);

            return new S3PostUploadSignedPolicy
            {
                Policy = base64Policy,
                Signature = signature,
                AccessKeyId = iCreds.AccessKey,
                SecurityToken = iCreds.Token,
                SignatureVersion = "4",
                Algorithm = algorithm,
                Date = dateTimeStamp,
                Credential = credentialString
            };
        }
        /// <summary>
        /// Sends a request to the AWS Storage Gateway server running at the
        /// specified address, and returns the activation key for that server.
        /// </summary>
        /// <param name="gatewayAddress">The DNS name or IP address of a running AWS Storage Gateway</param>
        /// <param name="activationRegion">The region in which the gateway will be activated.</param>
        /// <param name="maxRetries">The maximum number of retries to attempt on failure</param>
        /// <param name="maxBackoff">The maximum backoff time, in milliseconds, for retry attempts. Backoff times between retries rise exponentially until they hit this ceiling.</param>
        /// <returns>The activation key required for some API calls to AWS Storage Gateway.</returns>
        public static string GetActivationKey(string gatewayAddress, RegionEndpoint activationRegion, int maxRetries, int maxBackoff)
        {
            if (maxRetries <= 1)
                maxRetries = defaultMaxRetries;
            if (maxBackoff <= 0)
                maxBackoff = defaultMaxBackoff;

            int retries = 0;
            while (retries < maxRetries)
            {
                try
                {
                    string uri = "http://" + gatewayAddress;
                    if (activationRegion != null)
                        uri = uri + "/?activationRegion=" + activationRegion.SystemName;
                    string locationHeader = GetHeader(uri);
                    var parameters = AWSSDKUtils.ParseQueryParameters(locationHeader);
                    string activationKey;
                    if (parameters.TryGetValue(activationKeyName, out activationKey) && !string.IsNullOrEmpty(activationKey))
                        return activationKey;

                    throw new AmazonStorageGatewayException("Unable to get activation key from : " + uri);
                }
                catch (WebException)
                {
                    retries++;
                    if (retries == maxRetries)
                        break;
                }

                int delay = (int)(Math.Pow(4, retries) * 100);
                delay = Math.Min(delay, maxBackoff);
                AWSSDKUtils.Sleep(delay);
            }

            throw new AmazonStorageGatewayException("Unable to get activation key; retries exhausted");
        }
        /// <summary>
        /// Initializes the provider by pulling the config info from the web.config and validate/create the DynamoDB table.
        /// If the table is being created this method will block until the table is active.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="config"></param>
        public override void Initialize(string name, NameValueCollection config)
        {
            _logger.InfoFormat("Initialize : Initializing Session provider {0}", name);

            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            base.Initialize(name, config);

            GetConfigSettings(config);


            RegionEndpoint region = null;

            if (!string.IsNullOrEmpty(this._regionName))
            {
                region = RegionEndpoint.GetBySystemName(this._regionName);
            }

            AWSCredentials credentials = null;

            if (!string.IsNullOrEmpty(this._accessKey))
            {
                credentials = new BasicAWSCredentials(this._accessKey, this._secretKey);
            }
            else if (!string.IsNullOrEmpty(this._profileName))
            {
                if (string.IsNullOrEmpty(this._profilesLocation))
                {
                    credentials = new StoredProfileAWSCredentials(this._profileName);
                }
                else
                {
                    credentials = new StoredProfileAWSCredentials(this._profileName, this._profilesLocation);
                }
            }

            AmazonDynamoDBConfig ddbConfig = new AmazonDynamoDBConfig();

            if (region != null)
            {
                ddbConfig.RegionEndpoint = region;
            }
            if (!string.IsNullOrEmpty(this._serviceURL))
            {
                ddbConfig.ServiceURL = this._serviceURL;
            }

            if (credentials != null)
            {
                this._ddbClient = new AmazonDynamoDBClient(credentials, ddbConfig);
            }
            else
            {
                this._ddbClient = new AmazonDynamoDBClient(ddbConfig);
            }

            ((AmazonDynamoDBClient)this._ddbClient).BeforeRequestEvent += DynamoDBSessionStateStore_BeforeRequestEvent;

            SetupTable();
        }
Exemple #19
0
 /// <summary>
 /// Constructs AmazonImportExportClient with AWS Access Key ID and AWS Secret Key
 /// </summary>
 /// <param name="awsAccessKeyId">AWS Access Key ID</param>
 /// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
 /// <param name="awsSessionToken">AWS Session Token</param>
 /// <param name="region">The region to connect.</param>
 public AmazonImportExportClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, RegionEndpoint region)
     : this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonImportExportConfig {
     RegionEndpoint = region
 })
 {
 }
 /// <summary>
 /// Constructs AmazonRedshiftDataAPIServiceClient with AWS Credentials
 /// </summary>
 /// <param name="credentials">AWS Credentials</param>
 /// <param name="region">The region to connect.</param>
 public AmazonRedshiftDataAPIServiceClient(AWSCredentials credentials, RegionEndpoint region)
     : this(credentials, new AmazonRedshiftDataAPIServiceConfig {
     RegionEndpoint = region
 })
 {
 }
Exemple #21
0
 /// <summary>
 /// Constructs AmazonKinesisVideoSignalingChannelsClient with AWS Credentials
 /// </summary>
 /// <param name="credentials">AWS Credentials</param>
 /// <param name="region">The region to connect.</param>
 public AmazonKinesisVideoSignalingChannelsClient(AWSCredentials credentials, RegionEndpoint region)
     : this(credentials, new AmazonKinesisVideoSignalingChannelsConfig {
     RegionEndpoint = region
 })
 {
 }
Exemple #22
0
 /// <summary>
 /// Constructs AmazonQLDBSessionClient with the credentials loaded from the application's
 /// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
 ///
 /// Example App.config with credentials set.
 /// <code>
 /// &lt;?xml version="1.0" encoding="utf-8" ?&gt;
 /// &lt;configuration&gt;
 ///     &lt;appSettings&gt;
 ///         &lt;add key="AWSProfileName" value="AWS Default"/&gt;
 ///     &lt;/appSettings&gt;
 /// &lt;/configuration&gt;
 /// </code>
 ///
 /// </summary>
 /// <param name="region">The region to connect.</param>
 public AmazonQLDBSessionClient(RegionEndpoint region)
     : base(FallbackCredentialsFactory.GetCredentials(), new AmazonQLDBSessionConfig {
     RegionEndpoint = region
 })
 {
 }
Exemple #23
0
 /// <summary>
 /// Constructs AmazonAWSMarketplaceMeteringClient with AWS Credentials
 /// </summary>
 /// <param name="credentials">AWS Credentials</param>
 /// <param name="region">The region to connect.</param>
 public AmazonAWSMarketplaceMeteringClient(AWSCredentials credentials, RegionEndpoint region)
     : this(credentials, new AmazonAWSMarketplaceMeteringConfig {
     RegionEndpoint = region
 })
 {
 }
Exemple #24
0
        private void UploadToCdn()
        {
            try
            {
                // one thread only
                if (Interlocked.CompareExchange(ref work, 1, 0) == 0)
                {
                    var @continue = false;
                    try
                    {
                        CdnItem item;
                        if (queue.TryDequeue(out item))
                        {
                            @continue = true;

                            var cdnpath     = GetCdnPath(item.Bundle.Path);
                            var key         = new Uri(cdnpath).PathAndQuery.TrimStart('/');
                            var content     = Encoding.UTF8.GetBytes(item.Response.Content);
                            var inputStream = new MemoryStream();

                            if (ClientSettings.GZipEnabled)
                            {
                                using (var zip = new GZipStream(inputStream, CompressionMode.Compress, true))
                                {
                                    zip.Write(content, 0, content.Length);
                                    zip.Flush();
                                }
                            }
                            else
                            {
                                inputStream.Write(content, 0, content.Length);
                            }
                            inputStream.Position = 0;
                            var checksum = AmazonS3Util.GenerateChecksumForContent(item.Response.Content, true);

                            var config = new AmazonS3Config
                            {
                                RegionEndpoint = RegionEndpoint.GetBySystemName(s3region),
                                UseHttp        = true
                            };
                            using (var s3 = new AmazonS3Client(s3publickey, s3privatekey, config))
                            {
                                var upload = false;
                                try
                                {
                                    var request = new GetObjectMetadataRequest
                                    {
                                        BucketName = s3bucket,
                                        Key        = key,
                                    };
                                    var response = s3.GetObjectMetadata(request);
                                    upload = !string.Equals(checksum, response.Metadata["x-amz-meta-etag"], StringComparison.InvariantCultureIgnoreCase);
                                }
                                catch (AmazonS3Exception ex)
                                {
                                    if (ex.StatusCode == HttpStatusCode.NotFound)
                                    {
                                        upload = true;
                                    }
                                    else
                                    {
                                        throw;
                                    }
                                }

                                if (upload)
                                {
                                    var request = new PutObjectRequest
                                    {
                                        BucketName  = s3bucket,
                                        CannedACL   = S3CannedACL.PublicRead,
                                        Key         = key,
                                        ContentType = AmazonS3Util.MimeTypeFromExtension(Path.GetExtension(key).ToLowerInvariant())
                                    };

                                    request.InputStream = inputStream;
                                    if (ClientSettings.GZipEnabled)
                                    {
                                        request.Headers.ContentEncoding = "gzip";
                                    }

                                    var cache = TimeSpan.FromDays(365);
                                    request.Headers.CacheControl       = string.Format("public, maxage={0}", (int)cache.TotalSeconds);
                                    request.Headers.Expires            = DateTime.UtcNow.Add(cache);
                                    request.Headers["x-amz-meta-etag"] = checksum;

                                    s3.PutObject(request);
                                }

                                item.Bundle.CdnPath = cdnpath;
                            }
                        }
                    }
                    catch (Exception err)
                    {
                        log.Error(err);
                    }
                    finally
                    {
                        work = 0;
                        if (@continue)
                        {
                            Action upload = () => UploadToCdn();
                            upload.BeginInvoke(null, null);
                        }
                    }
                }
            }
            catch (Exception fatal)
            {
                log.Fatal(fatal);
            }
        }
 /// <summary>
 /// Constructs AmazonComputeOptimizerClient with AWS Access Key ID and AWS Secret Key
 /// </summary>
 /// <param name="awsAccessKeyId">AWS Access Key ID</param>
 /// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
 /// <param name="awsSessionToken">AWS Session Token</param>
 /// <param name="region">The region to connect.</param>
 public AmazonComputeOptimizerClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, RegionEndpoint region)
     : this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonComputeOptimizerConfig {
     RegionEndpoint = region
 })
 {
 }
Exemple #26
0
 /// <summary>
 /// Constructs AmazonImportExportClient with AWS Credentials
 /// </summary>
 /// <param name="credentials">AWS Credentials</param>
 /// <param name="region">The region to connect.</param>
 public AmazonImportExportClient(AWSCredentials credentials, RegionEndpoint region)
     : this(credentials, new AmazonImportExportConfig {
     RegionEndpoint = region
 })
 {
 }
 /// <summary>
 /// Constructs AmazonTextractClient with AWS Credentials
 /// </summary>
 /// <param name="credentials">AWS Credentials</param>
 /// <param name="region">The region to connect.</param>
 public AmazonTextractClient(AWSCredentials credentials, RegionEndpoint region)
     : this(credentials, new AmazonTextractConfig {
     RegionEndpoint = region
 })
 {
 }
Exemple #28
0
 public static void DeleteTopicIfItAlreadyExists(string regionEndpointName, string topicName)
 {
     DeleteTopicIfItAlreadyExists(RegionEndpoint.GetBySystemName(regionEndpointName), topicName);
 }
Exemple #29
0
        protected static bool TryGetTopic(RegionEndpoint regionEndpoint, string topicName, out Topic topic)
        {
            topic = GetAllTopics(regionEndpoint, topicName).SingleOrDefault();

            return(topic != null);
        }
Exemple #30
0
 /// <summary>
 /// Constructs AmazonCloud9Client with AWS Credentials
 /// </summary>
 /// <param name="credentials">AWS Credentials</param>
 /// <param name="region">The region to connect.</param>
 public AmazonCloud9Client(AWSCredentials credentials, RegionEndpoint region)
     : this(credentials, new AmazonCloud9Config {
     RegionEndpoint = region
 })
 {
 }
        private static bool ValidateAndSetOptions(CommandOptions options)
        {
            if (!options.AccessKey.HasValue())
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("AccessKey is required.");
                Console.ForegroundColor = ConsoleColor.White;
                return(false);
            }
            if (!options.SecretKey.HasValue())
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("SecretKey is required.");
                Console.ForegroundColor = ConsoleColor.White;
                return(false);
            }
            if (!options.Name.HasValue())
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Name is required.");
                Console.ForegroundColor = ConsoleColor.White;
                return(false);
            }


            AccessKey            = options.AccessKey.Value();
            SecretKey            = options.SecretKey.Value();
            Name                 = options.Name.Value();
            ShowGoodInstances    = options.ShowGoodInstances.HasValue();
            ShowUnknownInstances = options.ShowUnknownInstances.HasValue();
            IsClassic            = options.IsClassic.HasValue();

            Region        = string.IsNullOrWhiteSpace(options.Region.Value()) ? RegionEndpoint.USEast1 : RegionEndpoint.GetBySystemName(options.Region.Value());
            SecurityGroup = string.IsNullOrWhiteSpace(options.SecurityGroup.Value()) ? null : options.SecurityGroup.Value().Trim();
            return(true);
        }
Exemple #32
0
 /// <summary>
 /// Constructs AmazonAWSMarketplaceMeteringClient with AWS Access Key ID and AWS Secret Key
 /// </summary>
 /// <param name="awsAccessKeyId">AWS Access Key ID</param>
 /// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
 /// <param name="awsSessionToken">AWS Session Token</param>
 /// <param name="region">The region to connect.</param>
 public AmazonAWSMarketplaceMeteringClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, RegionEndpoint region)
     : this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonAWSMarketplaceMeteringConfig {
     RegionEndpoint = region
 })
 {
 }
 /// <summary>
 /// Constructs AmazonElasticLoadBalancingClient with AWS Access Key ID and AWS Secret Key
 /// </summary>
 /// <param name="awsAccessKeyId">AWS Access Key ID</param>
 /// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
 /// <param name="awsSessionToken">AWS Session Token</param>
 /// <param name="region">The region to connect.</param>
 public AmazonElasticLoadBalancingClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, RegionEndpoint region)
     : this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonElasticLoadBalancingConfig{RegionEndpoint = region})
 {
 }
Exemple #34
0
 /// <summary>
 /// Constructs AmazonKinesisVideoSignalingChannelsClient with the credentials loaded from the application's
 /// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
 ///
 /// Example App.config with credentials set.
 /// <code>
 /// &lt;?xml version="1.0" encoding="utf-8" ?&gt;
 /// &lt;configuration&gt;
 ///     &lt;appSettings&gt;
 ///         &lt;add key="AWSProfileName" value="AWS Default"/&gt;
 ///     &lt;/appSettings&gt;
 /// &lt;/configuration&gt;
 /// </code>
 ///
 /// </summary>
 /// <param name="region">The region to connect.</param>
 public AmazonKinesisVideoSignalingChannelsClient(RegionEndpoint region)
     : base(FallbackCredentialsFactory.GetCredentials(), new AmazonKinesisVideoSignalingChannelsConfig {
     RegionEndpoint = region
 })
 {
 }
 /// <summary>
 /// Constructs AmazonComputeOptimizerClient with the credentials loaded from the application's
 /// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
 ///
 /// Example App.config with credentials set.
 /// <code>
 /// &lt;?xml version="1.0" encoding="utf-8" ?&gt;
 /// &lt;configuration&gt;
 ///     &lt;appSettings&gt;
 ///         &lt;add key="AWSProfileName" value="AWS Default"/&gt;
 ///     &lt;/appSettings&gt;
 /// &lt;/configuration&gt;
 /// </code>
 ///
 /// </summary>
 /// <param name="region">The region to connect.</param>
 public AmazonComputeOptimizerClient(RegionEndpoint region)
     : base(FallbackCredentialsFactory.GetCredentials(), new AmazonComputeOptimizerConfig {
     RegionEndpoint = region
 })
 {
 }
Exemple #36
0
 /// <summary>
 /// Constructs AmazonKinesisVideoSignalingChannelsClient with AWS Access Key ID and AWS Secret Key
 /// </summary>
 /// <param name="awsAccessKeyId">AWS Access Key ID</param>
 /// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
 /// <param name="awsSessionToken">AWS Session Token</param>
 /// <param name="region">The region to connect.</param>
 public AmazonKinesisVideoSignalingChannelsClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, RegionEndpoint region)
     : this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonKinesisVideoSignalingChannelsConfig {
     RegionEndpoint = region
 })
 {
 }
 /// <summary>
 /// Constructs AmazonComputeOptimizerClient with AWS Credentials
 /// </summary>
 /// <param name="credentials">AWS Credentials</param>
 /// <param name="region">The region to connect.</param>
 public AmazonComputeOptimizerClient(AWSCredentials credentials, RegionEndpoint region)
     : this(credentials, new AmazonComputeOptimizerConfig {
     RegionEndpoint = region
 })
 {
 }
 /// <summary>
 /// Constructs AmazonRedshiftDataAPIServiceClient with AWS Access Key ID and AWS Secret Key
 /// </summary>
 /// <param name="awsAccessKeyId">AWS Access Key ID</param>
 /// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
 /// <param name="awsSessionToken">AWS Session Token</param>
 /// <param name="region">The region to connect.</param>
 public AmazonRedshiftDataAPIServiceClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, RegionEndpoint region)
     : this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonRedshiftDataAPIServiceConfig {
     RegionEndpoint = region
 })
 {
 }
 /// <summary>
 /// Constructs AmazonElasticTranscoderClient with AWS Credentials
 /// </summary>
 /// <param name="credentials">AWS Credentials</param>
 /// <param name="region">The region to connect.</param>
 public AmazonElasticTranscoderClient(AWSCredentials credentials, RegionEndpoint region)
     : this(credentials, new AmazonElasticTranscoderConfig{RegionEndpoint = region})
 {
 }
Exemple #40
0
 /// <summary>
 /// Constructs AmazonAWSMarketplaceMeteringClient with the credentials loaded from the application's
 /// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
 ///
 /// Example App.config with credentials set.
 /// <code>
 /// &lt;?xml version="1.0" encoding="utf-8" ?&gt;
 /// &lt;configuration&gt;
 ///     &lt;appSettings&gt;
 ///         &lt;add key="AWSProfileName" value="AWS Default"/&gt;
 ///     &lt;/appSettings&gt;
 /// &lt;/configuration&gt;
 /// </code>
 ///
 /// </summary>
 /// <param name="region">The region to connect.</param>
 public AmazonAWSMarketplaceMeteringClient(RegionEndpoint region)
     : base(FallbackCredentialsFactory.GetCredentials(), new AmazonAWSMarketplaceMeteringConfig {
     RegionEndpoint = region
 })
 {
 }
 /// <summary>
 /// Constructs AmazonRedshiftDataAPIServiceClient with the credentials loaded from the application's
 /// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
 ///
 /// Example App.config with credentials set.
 /// <code>
 /// &lt;?xml version="1.0" encoding="utf-8" ?&gt;
 /// &lt;configuration&gt;
 ///     &lt;appSettings&gt;
 ///         &lt;add key="AWSProfileName" value="AWS Default"/&gt;
 ///     &lt;/appSettings&gt;
 /// &lt;/configuration&gt;
 /// </code>
 ///
 /// </summary>
 /// <param name="region">The region to connect.</param>
 public AmazonRedshiftDataAPIServiceClient(RegionEndpoint region)
     : base(FallbackCredentialsFactory.GetCredentials(), new AmazonRedshiftDataAPIServiceConfig {
     RegionEndpoint = region
 })
 {
 }
 /// <summary>
 /// Constructs AmazonElasticTranscoderClient with the credentials loaded from the application's
 /// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
 /// 
 /// Example App.config with credentials set. 
 /// <code>
 /// &lt;?xml version="1.0" encoding="utf-8" ?&gt;
 /// &lt;configuration&gt;
 ///     &lt;appSettings&gt;
 ///         &lt;add key="AWSProfileName" value="AWS Default"/&gt;
 ///     &lt;/appSettings&gt;
 /// &lt;/configuration&gt;
 /// </code>
 ///
 /// </summary>
 /// <param name="region">The region to connect.</param>
 public AmazonElasticTranscoderClient(RegionEndpoint region)
     : base(FallbackCredentialsFactory.GetCredentials(), new AmazonElasticTranscoderConfig{RegionEndpoint = region}) { }
 /// <summary>
 /// Constructs AmazonCognitoSyncClient with AWS Credentials
 /// </summary>
 /// <param name="credentials">AWS Credentials</param>
 /// <param name="region">The region to connect.</param>
 public AmazonCognitoSyncClient(AWSCredentials credentials, RegionEndpoint region)
     : this(credentials, new AmazonCognitoSyncConfig{RegionEndpoint = region})
 {
 }
 /// <summary>
 /// Constructs AmazonRoute53Client with AWS Access Key ID and AWS Secret Key
 /// </summary>
 /// <param name="awsAccessKeyId">AWS Access Key ID</param>
 /// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
 /// <param name="region">The region to connect.</param>
 public AmazonRoute53Client(string awsAccessKeyId, string awsSecretAccessKey, RegionEndpoint region)
     : this(awsAccessKeyId, awsSecretAccessKey, new AmazonRoute53Config() {RegionEndpoint=region})
 {
 }
 /// <summary>
 /// Constructs AmazonRDSClient with the credentials loaded from the application's
 /// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
 /// 
 /// Example App.config with credentials set. 
 /// <code>
 /// &lt;?xml version="1.0" encoding="utf-8" ?&gt;
 /// &lt;configuration&gt;
 ///     &lt;appSettings&gt;
 ///         &lt;add key="AWSAccessKey" value="********************"/&gt;
 ///         &lt;add key="AWSSecretKey" value="****************************************"/&gt;
 ///     &lt;/appSettings&gt;
 /// &lt;/configuration&gt;
 /// </code>
 ///
 /// </summary>
 /// <param name="region">The region to connect.</param>
 public AmazonRDSClient(RegionEndpoint region)
     : base(FallbackCredentialsFactory.GetCredentials(), new AmazonRDSConfig(){RegionEndpoint = region}, true, AuthenticationTypes.User | AuthenticationTypes.Session)
 {
 }
 /// <summary>
 /// Constructs AmazonSecurityTokenServiceClient with AWS Credentials
 /// </summary>
 /// <param name="credentials">AWS Credentials</param>
 /// <param name="region">The region to connect.</param>
 public AmazonSecurityTokenServiceClient(AWSCredentials credentials, RegionEndpoint region)
     : this(credentials, new AmazonSecurityTokenServiceConfig{RegionEndpoint = region})
 {
 }
Exemple #47
0
 /// <summary>
 /// Constructs AmazonImportExportClient with the credentials loaded from the application's
 /// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
 ///
 /// Example App.config with credentials set.
 /// <code>
 /// &lt;?xml version="1.0" encoding="utf-8" ?&gt;
 /// &lt;configuration&gt;
 ///     &lt;appSettings&gt;
 ///         &lt;add key="AWSProfileName" value="AWS Default"/&gt;
 ///     &lt;/appSettings&gt;
 /// &lt;/configuration&gt;
 /// </code>
 ///
 /// </summary>
 /// <param name="region">The region to connect.</param>
 public AmazonImportExportClient(RegionEndpoint region)
     : base(FallbackCredentialsFactory.GetCredentials(), new AmazonImportExportConfig {
     RegionEndpoint = region
 })
 {
 }
 /// <summary>
 /// Constructs AmazonTextractClient with AWS Access Key ID and AWS Secret Key
 /// </summary>
 /// <param name="awsAccessKeyId">AWS Access Key ID</param>
 /// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
 /// <param name="region">The region to connect.</param>
 public AmazonTextractClient(string awsAccessKeyId, string awsSecretAccessKey, RegionEndpoint region)
     : this(awsAccessKeyId, awsSecretAccessKey, new AmazonTextractConfig() { RegionEndpoint = region })
 {
 }
 /// <summary>
 /// Constructs AmazonElasticLoadBalancingClient with AWS Credentials
 /// </summary>
 /// <param name="credentials">AWS Credentials</param>
 /// <param name="region">The region to connect.</param>
 public AmazonElasticLoadBalancingClient(AWSCredentials credentials, RegionEndpoint region)
     : this(credentials, new AmazonElasticLoadBalancingConfig{RegionEndpoint = region})
 {
 }
Exemple #50
0
 /// <summary>
 /// Constructs AmazonSimpleNotificationServiceClient with the credentials loaded from the application's
 /// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
 /// 
 /// Example App.config with credentials set. 
 /// <code>
 /// &lt;?xml version="1.0" encoding="utf-8" ?&gt;
 /// &lt;configuration&gt;
 ///     &lt;appSettings&gt;
 ///         &lt;add key="AWSAccessKey" value="********************"/&gt;
 ///         &lt;add key="AWSSecretKey" value="****************************************"/&gt;
 ///     &lt;/appSettings&gt;
 /// &lt;/configuration&gt;
 /// </code>
 ///
 /// </summary>
 /// <param name="region">The region to connect to.</param>
 public AmazonSimpleNotificationServiceClient(RegionEndpoint region)
     : this(FallbackCredentialsFactory.GetCredentials(), new AmazonSimpleNotificationServiceConfig() { RegionEndpoint = region }, true) { }
 /// <summary>
 /// Constructs AmazonElasticTranscoderClient with AWS Access Key ID and AWS Secret Key
 /// </summary>
 /// <param name="awsAccessKeyId">AWS Access Key ID</param>
 /// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
 /// <param name="awsSessionToken">AWS Session Token</param>
 /// <param name="region">The region to connect.</param>
 public AmazonElasticTranscoderClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, RegionEndpoint region)
     : this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonElasticTranscoderConfig{RegionEndpoint = region})
 {
 }
Exemple #52
0
 /// <summary>
 /// Constructs an AmazonSimpleNotificationServiceClient with AWS Access Key ID, AWS Secret Key and an
 /// AmazonSimpleNotificationService Configuration object
 /// </summary>
 /// <param name="awsAccessKeyId">AWS Access Key ID</param>
 /// <param name="awsSecretAccessKey">AWS Secret Access Key as a SecureString</param>
 /// <param name="region">The region to connect to.</param>
 public AmazonSimpleNotificationServiceClient(string awsAccessKeyId, SecureString awsSecretAccessKey, RegionEndpoint region)
     : this(new BasicAWSCredentials(awsAccessKeyId, awsSecretAccessKey), new AmazonSimpleNotificationServiceConfig() { RegionEndpoint = region }, true) { }
 /// <summary>
 /// Constructs AmazonCognitoSyncClient with AWS Access Key ID and AWS Secret Key
 /// </summary>
 /// <param name="awsAccessKeyId">AWS Access Key ID</param>
 /// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
 /// <param name="awsSessionToken">AWS Session Token</param>
 /// <param name="region">The region to connect.</param>
 public AmazonCognitoSyncClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, RegionEndpoint region)
     : this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonCognitoSyncConfig{RegionEndpoint = region})
 {
 }
Exemple #54
0
 /// <summary>
 /// Constructs an AmazonSimpleNotificationServiceClient with AWSCredentials
 /// </summary>
 /// <param name="credentials"></param>
 /// <param name="region">The region to connect to.</param>
 public AmazonSimpleNotificationServiceClient(AWSCredentials credentials, RegionEndpoint region)
     : this(credentials, new AmazonSimpleNotificationServiceConfig() { RegionEndpoint = region }) { }
 /// <summary>
 /// Constructs AmazonRoute53Client with AWS Credentials
 /// </summary>
 /// <param name="credentials">AWS Credentials</param>
 /// <param name="region">The region to connect.</param>
 public AmazonRoute53Client(AWSCredentials credentials, RegionEndpoint region)
     : this(credentials, new AmazonRoute53Config(){RegionEndpoint=region})
 {
 }
 /// <summary>
 /// Constructs AmazonIoTEventsDataClient with AWS Credentials
 /// </summary>
 /// <param name="credentials">AWS Credentials</param>
 /// <param name="region">The region to connect.</param>
 public AmazonIoTEventsDataClient(AWSCredentials credentials, RegionEndpoint region)
     : this(credentials, new AmazonIoTEventsDataConfig {
     RegionEndpoint = region
 })
 {
 }
 /// <summary>
 /// Constructs AmazonSecurityTokenServiceClient with the credentials loaded from the application's
 /// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
 /// 
 /// Example App.config with credentials set. 
 /// <code>
 /// &lt;?xml version="1.0" encoding="utf-8" ?&gt;
 /// &lt;configuration&gt;
 ///     &lt;appSettings&gt;
 ///         &lt;add key="AWSProfileName" value="AWS Default"/&gt;
 ///     &lt;/appSettings&gt;
 /// &lt;/configuration&gt;
 /// </code>
 ///
 /// </summary>
 /// <param name="region">The region to connect.</param>
 public AmazonSecurityTokenServiceClient(RegionEndpoint region)
     : base(FallbackCredentialsFactory.GetCredentials(), new AmazonSecurityTokenServiceConfig{RegionEndpoint = region}) { }
 /// <summary>
 /// Constructs AmazonIoTEventsDataClient with AWS Access Key ID and AWS Secret Key
 /// </summary>
 /// <param name="awsAccessKeyId">AWS Access Key ID</param>
 /// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
 /// <param name="region">The region to connect.</param>
 public AmazonIoTEventsDataClient(string awsAccessKeyId, string awsSecretAccessKey, RegionEndpoint region)
     : this(awsAccessKeyId, awsSecretAccessKey, new AmazonIoTEventsDataConfig() { RegionEndpoint = region })
 {
 }
 /// <summary>
 /// Constructs AmazonSecurityTokenServiceClient with AWS Access Key ID and AWS Secret Key
 /// </summary>
 /// <param name="awsAccessKeyId">AWS Access Key ID</param>
 /// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
 /// <param name="awsSessionToken">AWS Session Token</param>
 /// <param name="region">The region to connect.</param>
 public AmazonSecurityTokenServiceClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, RegionEndpoint region)
     : this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonSecurityTokenServiceConfig{RegionEndpoint = region})
 {
 }
Exemple #60
0
 /// <summary>
 /// Constructs AmazonKinesisAnalyticsClient with AWS Access Key ID and AWS Secret Key
 /// </summary>
 /// <param name="awsAccessKeyId">AWS Access Key ID</param>
 /// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
 /// <param name="region">The region to connect.</param>
 public AmazonKinesisAnalyticsClient(string awsAccessKeyId, string awsSecretAccessKey, RegionEndpoint region)
     : this(awsAccessKeyId, awsSecretAccessKey, new AmazonKinesisAnalyticsConfig() { RegionEndpoint = region })
 {
 }