public CloudWatchService(IOptions <AwsDevCredentials> credentials) { string accessKey = credentials.Value.AwsAccessKeyId; string secretKey = credentials.Value.AwsSecretAccessKey; _cloudWatchClient = new AmazonCloudWatchEventsClient(accessKey, secretKey, RegionEndpoint.EUCentral1); }
//--- Constructors --- /// <summary> /// Create new instance of <see cref="LambdaFunctionDependencyProvider"/>, which provides the implementation for the required dependencies for <see cref="ALambdaFunction"/>. /// </summary> /// <param name="utcNowCallback">A function that return the current <c>DateTime</c> in UTC timezone. Defaults to <see cref="DateTime.UtcNow"/> when <c>null</c>.</param> /// <param name="logCallback">An action that logs a string message. Defaults to <see cref="LambdaLogger.Log"/> when <c>null</c>.</param> /// <param name="configSource">A <see cref="ILambdaConfigSource"/> instance from which the Lambda function configuration is read. Defaults to <see cref="LambdaSystemEnvironmentSource"/> instance when <c>null</c>.</param> /// <param name="jsonSerializer">A <see cref="ILambdaSerializer"/> instance for serializing and deserializing JSON data. Defaults to <see cref="LambdaLogger.Log"/> when <c>null</c>.</param> /// <param name="kmsClient">A <see cref="IAmazonKeyManagementService"/> client instance. Defaults to <see cref="AmazonKeyManagementServiceClient"/> when <c>null</c>.</param> /// <param name="sqsClient">A <see cref="IAmazonSQS"/> client instance. Defaults to <see cref="AmazonSQSClient"/> when <c>null</c>.</param> /// <param name="eventsClient">A <see cref="IAmazonCloudWatchEvents"/> client instance. Defaults to <see cref="AmazonCloudWatchEventsClient"/> when <c>null</c>.</param> /// <param name="debugLoggingEnabled">A boolean indicating if debug logging is enabled.</param> public LambdaFunctionDependencyProvider( Func <DateTime> utcNowCallback = null, Action <string> logCallback = null, ILambdaConfigSource configSource = null, ILambdaSerializer jsonSerializer = null, IAmazonKeyManagementService kmsClient = null, IAmazonSQS sqsClient = null, IAmazonCloudWatchEvents eventsClient = null, bool?debugLoggingEnabled = null ) { _nowCallback = utcNowCallback ?? (() => DateTime.UtcNow); _logCallback = logCallback ?? LambdaLogger.Log; ConfigSource = configSource ?? new LambdaSystemEnvironmentSource(); JsonSerializer = jsonSerializer ?? new LambdaJsonSerializer(); KmsClient = kmsClient ?? new AmazonKeyManagementServiceClient(); SqsClient = sqsClient ?? new AmazonSQSClient(); EventsClient = eventsClient ?? new AmazonCloudWatchEventsClient(); // determine if debug logging is enabled if (debugLoggingEnabled.HasValue) { _debugLoggingEnabled = debugLoggingEnabled.Value; } else { // read environment variable to determine if request/response messages should be serialized to the log for debugging purposes var value = System.Environment.GetEnvironmentVariable("DEBUG_LOGGING_ENABLED") ?? "false"; _debugLoggingEnabled = value.Equals("true", StringComparison.OrdinalIgnoreCase); } }
public ScopedUpdatingService(ILogger <ScopedUpdatingService> logger, PlatformResourcesContext context, IAmazonEC2 EC2Client, IAmazonCloudWatch cloudwatchClient, IAmazonCloudWatchEvents cloudwatcheventsClient, IAmazonCloudWatchLogs cloudwatchlogsClient) { _logger = logger; this.context = context; ec2Client = EC2Client; cwClient = cloudwatchClient; cweClient = cloudwatcheventsClient; cwlClient = cloudwatchlogsClient; }
public IndexModel( ILogger logger, IAmazonCloudWatchEvents cloudWatchEvents, IAmazonSimpleSystemsManagement ssm) { _logger = logger; _cloudWatchEvents = cloudWatchEvents; _ssm = ssm; }
private Amazon.CloudWatchEvents.Model.DescribeRuleResponse CallAWSServiceOperation(IAmazonCloudWatchEvents client, Amazon.CloudWatchEvents.Model.DescribeRuleRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon CloudWatch Events", "DescribeRule"); try { #if DESKTOP return(client.DescribeRule(request)); #elif CORECLR return(client.DescribeRuleAsync(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; } }
protected override void ProcessRecord() { base.ProcessRecord(); Client = CreateClient(_CurrentCredentials, _RegionEndpoint); }
public PlatformLogsController(PlatformResourcesContext context, UserManager <IdentityUser> userManager, IAmazonCloudWatch cloudwatchClient, IAmazonCloudWatchEvents cloudwatcheventsClient, IAmazonCloudWatchLogs cloudwatchLogsClient) { this._context = context; this.CloudwatchClient = cloudwatchClient; this.CloudwatchEventsClient = cloudwatcheventsClient; this.CloudwatchLogsClient = cloudwatchLogsClient; this._userManager = userManager; }
public SendMessageController(IAmazonCloudWatchEvents client, ILogger <SendMessageController> logger) { _client = client ?? throw new ArgumentNullException(nameof(client)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); }