Exemple #1
0
        /// <summary>
        /// Initial AWS client creator by provided region and aws profile file.
        /// </summary>
        /// <param name="region"></param>
        /// <param name="profileLocation"></param>
        /// <param name="profileName"></param>
        public static void LoadAwsCredentialsProfile(RegionEndpoint region, string profileLocation, string profileName)
        {
            try
            {
                if (region == null)
                {
                    throw new Exception("Invalid Amazon Region !");
                }

                if (string.IsNullOrEmpty(profileLocation))
                {
                    throw new Exception("Invalid profile file location!");
                }

                if (!File.Exists(profileLocation))
                {
                    throw new Exception("AWS profile file not found !");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            _creator = AmazonServiceCreator.WithCredentialProfile(region, profileLocation, profileName);
        }
Exemple #2
0
 public AWS()
 {
     if (_creator == null)
     {
         _creator = new AmazonServiceCreator();
     }
 }
Exemple #3
0
        /// <summary>
        /// Initial AWS Client creator by provided region, access key & region key.
        /// </summary>
        /// <param name="region"></param>
        /// <param name="accessKey"></param>
        /// <param name="secretKey"></param>
        public static void LoadAWSBasicCredentials(RegionEndpoint region, string accessKey, string secretKey)
        {
            try
            {
                if (region == null)
                {
                    throw new Exception("Invalid Amazon Region !");
                }

                if (string.IsNullOrEmpty(accessKey) || string.IsNullOrEmpty(secretKey))
                {
                    throw new Exception("Invalid Access Key or Secret Key !");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            _creator = AmazonServiceCreator.WithAWSKeys(region, accessKey, secretKey);
        }