AWS code-library documentation change
Summary
Removed 'Get started' section containing C# code example for CloudWatch ListMetrics operation and replaced AWS CloudFormation reference with Amazon Bedrock Runtime
Security assessment
The change removes a basic code example demonstrating CloudWatch usage and updates a service reference. There is no evidence of security vulnerability remediation or security-related content addition.
Diff
diff --git a/code-library/latest/ug/csharp_3_cloudwatch_code_examples.md b/code-library/latest/ug/csharp_3_cloudwatch_code_examples.md index a27004af4..13552e49a 100644 --- a//code-library/latest/ug/csharp_3_cloudwatch_code_examples.md +++ b//code-library/latest/ug/csharp_3_cloudwatch_code_examples.md @@ -19,58 +18,0 @@ Each example includes a link to the complete source code, where you can find ins -**Get started** - -The following code examples show how to get started using CloudWatch. - -**SDK for .NET** - - -###### Note - -There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/dotnetv3/CloudWatch#code-examples). - - - using Amazon.CloudWatch; - using Amazon.CloudWatch.Model; - using Microsoft.Extensions.DependencyInjection; - using Microsoft.Extensions.Hosting; - - namespace CloudWatchActions; - - public static class HelloCloudWatch - { - static async Task Main(string[] args) - { - // Use the AWS .NET Core Setup package to set up dependency injection for the Amazon CloudWatch service. - // Use your AWS profile name, or leave it blank to use the default profile. - using var host = Host.CreateDefaultBuilder(args) - .ConfigureServices((_, services) => - services.AddAWSService<IAmazonCloudWatch>() - ).Build(); - - // Now the client is available for injection. - var cloudWatchClient = host.Services.GetRequiredService<IAmazonCloudWatch>(); - - // You can use await and any of the async methods to get a response. - var metricNamespace = "AWS/Billing"; - var response = await cloudWatchClient.ListMetricsAsync(new ListMetricsRequest - { - Namespace = metricNamespace - }); - Console.WriteLine($"Hello Amazon CloudWatch! Following are some metrics available in the {metricNamespace} namespace:"); - Console.WriteLine(); - foreach (var metric in response.Metrics.Take(5)) - { - Console.WriteLine($"\tMetric: {metric.MetricName}"); - Console.WriteLine($"\tNamespace: {metric.Namespace}"); - Console.WriteLine($"\tDimensions: {string.Join(", ", metric.Dimensions.Select(m => $"{m.Name}:{m.Value}"))}"); - Console.WriteLine(); - } - } - } - - - - * For API details, see [ListMetrics](https://docs.aws.amazon.com/goto/DotNetSDKV3/monitoring-2010-08-01/ListMetrics) in _AWS SDK for .NET API Reference_. - - - - @@ -2293 +2235 @@ To use the Amazon Web Services Documentation, Javascript must be enabled. Please -AWS CloudFormation +Amazon Bedrock Runtime