AWS eventbridge documentation change
Summary
Updated AWS SDK client initialization from constructor syntax to fromEnvironment() method and improved JSON policy formatting in code examples
Security assessment
The changes focus on code style improvements and SDK client initialization patterns rather than addressing security vulnerabilities. The fromEnvironment() method change appears to be a best practice update for credential loading, but doesn't directly address any specific security flaw. The JSON policy formatting improvements enhance readability but don't modify security permissions or introduce new security controls.
Diff
diff --git a/eventbridge/latest/userguide/example_eventbridge_Scenario_GettingStarted_section.md b/eventbridge/latest/userguide/example_eventbridge_Scenario_GettingStarted_section.md index 181cd8884..4a2be2328 100644 --- a//eventbridge/latest/userguide/example_eventbridge_Scenario_GettingStarted_section.md +++ b//eventbridge/latest/userguide/example_eventbridge_Scenario_GettingStarted_section.md @@ -2050 +2050 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - IamClient { region = "us-east-1" }.use { iam -> + IamClient.fromEnvironment { region = "us-east-1" }.use { iam -> @@ -2071 +2071 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - S3Client { region = "us-east-1" }.use { s3Client -> + S3Client.fromEnvironment { region = "us-east-1" }.use { s3Client -> @@ -2115 +2115 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - SnsClient { region = "us-east-1" }.use { snsClient -> + SnsClient.fromEnvironment { region = "us-east-1" }.use { snsClient -> @@ -2126 +2126 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - EventBridgeClient { region = "us-east-1" }.use { eventBrClient -> + EventBridgeClient.fromEnvironment { region = "us-east-1" }.use { eventBrClient -> @@ -2139 +2139 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - EventBridgeClient { region = "us-east-1" }.use { eventBrClient -> + EventBridgeClient.fromEnvironment { region = "us-east-1" }.use { eventBrClient -> @@ -2178 +2178 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - EventBridgeClient { region = "us-east-1" }.use { eventBrClient -> + EventBridgeClient.fromEnvironment { region = "us-east-1" }.use { eventBrClient -> @@ -2208 +2208 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - EventBridgeClient { region = "us-east-1" }.use { eventBrClient -> + EventBridgeClient.fromEnvironment { region = "us-east-1" }.use { eventBrClient -> @@ -2226 +2226 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - EventBridgeClient { region = "us-east-1" }.use { eventBrClient -> + EventBridgeClient.fromEnvironment { region = "us-east-1" }.use { eventBrClient -> @@ -2260 +2260 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - EventBridgeClient { region = "us-east-1" }.use { eventBrClient -> + EventBridgeClient.fromEnvironment { region = "us-east-1" }.use { eventBrClient -> @@ -2271 +2271 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - EventBridgeClient { region = "us-east-1" }.use { eventBrClient -> + EventBridgeClient.fromEnvironment { region = "us-east-1" }.use { eventBrClient -> @@ -2296 +2296 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - EventBridgeClient { region = "us-east-1" }.use { eventBrClient -> + EventBridgeClient.fromEnvironment { region = "us-east-1" }.use { eventBrClient -> @@ -2320 +2320 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - S3Client { region = "us-east-1" }.use { s3Client -> + S3Client.fromEnvironment { region = "us-east-1" }.use { s3Client -> @@ -2331 +2331 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - EventBridgeClient { region = "us-east-1" }.use { eventBrClient -> + EventBridgeClient.fromEnvironment { region = "us-east-1" }.use { eventBrClient -> @@ -2345 +2345 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - EventBridgeClient { region = "us-east-1" }.use { eventBrClient -> + EventBridgeClient.fromEnvironment { region = "us-east-1" }.use { eventBrClient -> @@ -2378 +2378 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - EventBridgeClient { region = "us-east-1" }.use { eventBrClient -> + EventBridgeClient.fromEnvironment { region = "us-east-1" }.use { eventBrClient -> @@ -2396 +2396 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - SnsClient { region = "us-east-1" }.use { snsClient -> + SnsClient.fromEnvironment { region = "us-east-1" }.use { snsClient -> @@ -2403,13 +2403,16 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - val topicPolicy = - "{" + - "\"Version\": \"2012-10-17\"," + - "\"Statement\": [{" + - "\"Sid\": \"EventBridgePublishTopic\"," + - "\"Effect\": \"Allow\"," + - "\"Principal\": {" + - "\"Service\": \"events.amazonaws.com\"" + - "}," + - "\"Resource\": \"*\"," + - "\"Action\": \"sns:Publish\"" + - "}]" + - "}" + val topicPolicy = """ + { + "Version": "2012-10-17", + "Statement": [ + { + "Sid": "EventBridgePublishTopic", + "Effect": "Allow", + "Principal": { + "Service": "events.amazonaws.com" + }, + "Resource": "*", + "Action": "sns:Publish" + } + ] + } + """.trimIndent() @@ -2426 +2429 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - SnsClient { region = "us-east-1" }.use { snsClient -> + SnsClient.fromEnvironment { region = "us-east-1" }.use { snsClient -> @@ -2440 +2443 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - EventBridgeClient { region = "us-east-1" }.use { eventBrClient -> + EventBridgeClient.fromEnvironment { region = "us-east-1" }.use { eventBrClient -> @@ -2455 +2458,2 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - val pattern = """{ + val pattern = """ + { @@ -2463 +2467,2 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - }""" + } + """.trimIndent() @@ -2473 +2478 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - EventBridgeClient { region = "us-east-1" }.use { eventBrClient -> + EventBridgeClient.fromEnvironment { region = "us-east-1" }.use { eventBrClient -> @@ -2497 +2502 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - S3Client { region = "us-east-1" }.use { s3Client -> + S3Client.fromEnvironment { region = "us-east-1" }.use { s3Client -> @@ -2510 +2515 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - S3Client { region = "us-east-1" }.use { s3 -> + S3Client.fromEnvironment { region = "us-east-1" }.use { s3 -> @@ -2527 +2532 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - S3Client { region = "us-east-1" }.use { s3Client -> + S3Client.fromEnvironment { region = "us-east-1" }.use { s3Client -> @@ -2554 +2559 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - IamClient { region = "us-east-1" }.use { iam -> + IamClient.fromEnvironment { region = "us-east-1" }.use { iam ->