/// <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); }
public AWS() { if (_creator == null) { _creator = new AmazonServiceCreator(); } }
/// <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); }