Exemplo n.º 1
0
 /// <summary>Default constructor is private.</summary>
 private AccountInfo()
 {
     this.BucketName = S3ObjectInfoProvider.GetBucketName("~");
     if (string.IsNullOrEmpty(this.BucketName))
     {
         throw new InvalidOperationException($"Amazon S3 bucket name could not be found. You must specify it in Settings by {SettingsKeyNames.AmazonS3BucketName} setting key.");
     }
     this.mS3Client = new AmazonS3ClientFactory().Create(this.BucketName);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Gets end point and public access from web.config and sets properties.
 /// </summary>
 private static void GetEndPointAndAccess()
 {
     mEndPoint = ValidationHelper.GetString(SettingsHelper.AppSettings["CMSAmazonEndPoint"], null);
     if (mEndPoint == null)
     {
         mEndPoint     = $"http://{S3ObjectInfoProvider.GetBucketName("~")}.s3.amazonaws.com";
         mPublicAccess = new bool?(ValidationHelper.GetBoolean(SettingsHelper.AppSettings["CMSAmazonPublicAccess"], false));
     }
     else
     {
         mEndPoint     = URLHelper.AddHTTPToUrl(mEndPoint);
         mPublicAccess = new bool?(ValidationHelper.GetBoolean(SettingsHelper.AppSettings["CMSAmazonPublicAccess"], true));
     }
 }