示例#1
0
#pragma warning restore CS8618, CS0649

            public Task Setup()
            {
                var logger        = Substitute.For <ILogger <StartDatabaseHandler> >();
                var configuration = new OptionsWrapper <LambdaConfiguration>(new LambdaConfiguration
                {
                    WaitForDatabaseAvailabilityRuleName = waitForDatabaseAvailabilityRuleName,
                    NotificationQueueUrl   = queueUrl,
                    DequeueEventSourceUUID = dequeueEventSourceUuid
                });

                LambdaClient.GetEventSourceMappingAsync(null).ReturnsForAnyArgs(new GetEventSourceMappingResponse
                {
                    State = "Disabled"
                });

                StartDatabaseHandler = new StartDatabaseHandler(RdsClient, SnsClient, EventBridgeClient, SqsClient, LambdaClient, logger, configuration);
                return(Task.CompletedTask);
            }
示例#2
0
 private Amazon.Lambda.Model.GetEventSourceMappingResponse CallAWSServiceOperation(IAmazonLambda client, Amazon.Lambda.Model.GetEventSourceMappingRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Lambda", "GetEventSourceMapping");
     try
     {
         #if DESKTOP
         return(client.GetEventSourceMapping(request));
         #elif CORECLR
         return(client.GetEventSourceMappingAsync(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;
     }
 }