示例#1
0
文件: Function.cs 项目: bgkyer/Chat
        //--- Methods ---
        public override async Task InitializeAsync(LambdaConfig config)
        {
            // read configuration settings
            _cloudfrontDistributionId = config.ReadText("WebsiteCloudFront");

            // initialize AWS clients
            _cloudfrontClient = new AmazonCloudFrontClient();
        }
        /// <summary>
        /// Constructs an instance with a preconfigured S3 client. This can be used for testing the outside of the Lambda environment.
        /// </summary>
        /// <param name="s3Client"></param>
        public Function(IAmazonS3 s3Client, IAmazonCloudFront cfClient)
        {
            this.S3Client = s3Client;

            if (cfClient != null)
            {
                this.cfClient = cfClient;
            }
        }
 public CloudFrontOperations()
 {
     client = new AmazonCloudFrontClient(credentials, Amazon.RegionEndpoint.USWest1);
     S3Origin origin = new S3Origin {
     }
     client.CreateDistribution(new CreateDistributionRequest {
         DistributionConfig = new DistributionConfig {
             Origins = new Origins {
             }
         }
     })
 }
示例#4
0
 public S3StaticWebsiteService(IAmazonS3 amazonS3,
                               IAmazonCloudFront cloudFrontService,
                               ILogger <S3StaticWebsiteService> logger,
                               AWSConfig awsConfig,
                               EnvironmentConfig environmentConfig,
                               CloudFrontConfig cloudFrontConfig)
 {
     _amazonS3          = amazonS3;
     _logger            = logger;
     _awsConfig         = awsConfig;
     _cloudFrontService = cloudFrontService;
     _environmentConfig = environmentConfig;
     _cloudFrontConfig  = cloudFrontConfig;
 }
示例#5
0
        public AwsS3Storage(
            [NotNull] string accessKey,
            [NotNull] string secretKey,
            [NotNull] string bucketName,
            [NotNull] string region,
            [CanBeNull] string cloudFrontDistributionId = null,
            bool supportAcl = true)
        {
            var regionEndpoint = RegionEndpoint.GetBySystemName(region);

            myS3Client                 = new AmazonS3Client(accessKey, secretKey, regionEndpoint);
            myCloudFrontClient         = new AmazonCloudFrontClient(accessKey, secretKey, regionEndpoint);
            myBucketName               = bucketName ?? throw new ArgumentNullException(nameof(bucketName));
            myCloudFrontDistributionId = cloudFrontDistributionId;
            mySupportAcl               = supportAcl;
        }
 private Amazon.CloudFront.Model.TestFunctionResponse CallAWSServiceOperation(IAmazonCloudFront client, Amazon.CloudFront.Model.TestFunctionRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon CloudFront", "TestFunction");
     try
     {
         #if DESKTOP
         return(client.TestFunction(request));
         #elif CORECLR
         return(client.TestFunctionAsync(request).GetAwaiter().GetResult());
         #else
                 #error "Unknown build edition"
         #endif
     }
     catch (AmazonServiceException exc)
     {
         var webException = exc.InnerException as System.Net.WebException;
         if (webException != null)
         {
             throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException);
         }
         throw;
     }
 }
示例#7
0
 internal CloudFrontPaginatorFactory(IAmazonCloudFront client)
 {
     this.client = client;
 }
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            Client = CreateClient(_CurrentCredentials, _RegionEndpoint);
        }
示例#9
0
 internal ListDistributionsPaginator(IAmazonCloudFront client, ListDistributionsRequest request)
 {
     this._client  = client;
     this._request = request;
 }
示例#10
0
 internal ListCloudFrontOriginAccessIdentitiesPaginator(IAmazonCloudFront client, ListCloudFrontOriginAccessIdentitiesRequest request)
 {
     this._client  = client;
     this._request = request;
 }
 public CloudFrontInvalidator(IAmazonCloudFront cloudFrontClient)
 {
     this.cloudFrontClient = cloudFrontClient;
 }
 public CloudFrontHelper(IAmazonCloudFront cloudFrontClient)
 {
     _cloudFrontClient = cloudFrontClient;
 }
示例#13
0
 public InvalidateCloudFrontFunction(IAmazonCloudFront cloudFrontClient)
 {
     CloudFrontClient = cloudFrontClient;
 }
示例#14
0
 public CloudFrontSource(IAmazonCloudFront amazonCloudFront)
 {
     _amazonCloudFront = amazonCloudFront;
 }
示例#15
0
 public UrlSigner(IAmazonCloudFront cfClient, string privateKey, string keyPairId)
 {
     _cfClient   = cfClient;
     _privateKey = privateKey;
     _keyPairId  = keyPairId;
 }
示例#16
0
 public CloudfrontService(IAmazonCloudFront amazonCloudFront, ILogger <CloudfrontService> logger)
 {
     _amazonCloudFront = amazonCloudFront;
     _logger           = logger;
 }