AWS code-library documentation change
Summary
Removed the .NET SDK code example for getting started with CloudFormation, including the note about GitHub examples and the entire HelloCloudFormation implementation.
Security assessment
The change removes a general-purpose code example without any security context. The removed content included error handling for credential issues (like SSO setup), but this is standard authentication guidance, not evidence of addressing a specific vulnerability. No security advisories, vulnerability fixes, or security enhancements are referenced in the change.
Diff
diff --git a/code-library/latest/ug/cloudformation_code_examples.md b/code-library/latest/ug/cloudformation_code_examples.md index 2933bbbcb..0ba8bdcc7 100644 --- a//code-library/latest/ug/cloudformation_code_examples.md +++ b//code-library/latest/ug/cloudformation_code_examples.md @@ -28,134 +27,0 @@ _Scenarios_ are code examples that show you how to accomplish specific tasks by -**Get started** - -The following code example shows how to get started using CloudFormation. - -.NET - - -**SDK for .NET (v4)** - - -###### 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/dotnetv4/CloudFormation#code-examples). - - - using Amazon.CloudFormation; - using Amazon.CloudFormation.Model; - using Amazon.Runtime; - - namespace CloudFormationActions; - - public static class HelloCloudFormation - { - public static IAmazonCloudFormation _amazonCloudFormation = null!; - - static async Task Main(string[] args) - { - // Create the CloudFormation client - _amazonCloudFormation = new AmazonCloudFormationClient(); - Console.WriteLine($"\nIn Region: {_amazonCloudFormation.Config.RegionEndpoint}"); - - // List the resources for each stack - await ListResources(); - } - - /// <summary> - /// Method to list stack resources and other information. - /// </summary> - /// <returns>True if successful.</returns> - public static async Task<bool> ListResources() - { - try - { - Console.WriteLine("Getting CloudFormation stack information..."); - - // Get all stacks using the stack paginator. - var paginatorForDescribeStacks = - _amazonCloudFormation.Paginators.DescribeStacks( - new DescribeStacksRequest()); - if (paginatorForDescribeStacks.Stacks != null) - { - await foreach (Stack stack in paginatorForDescribeStacks.Stacks) - { - // Basic information for each stack - Console.WriteLine( - "\n------------------------------------------------"); - Console.WriteLine($"\nStack: {stack.StackName}"); - Console.WriteLine($" Status: {stack.StackStatus.Value}"); - Console.WriteLine($" Created: {stack.CreationTime}"); - - // The tags of each stack (etc.) - if (stack.Tags != null && stack.Tags.Count > 0) - { - Console.WriteLine(" Tags:"); - foreach (Tag tag in stack.Tags) - Console.WriteLine($" {tag.Key}, {tag.Value}"); - } - - // The resources of each stack - DescribeStackResourcesResponse responseDescribeResources = - await _amazonCloudFormation.DescribeStackResourcesAsync( - new DescribeStackResourcesRequest - { - StackName = stack.StackName - }); - if (responseDescribeResources.StackResources != null && responseDescribeResources.StackResources.Count > 0) - { - Console.WriteLine(" Resources:"); - foreach (StackResource resource in responseDescribeResources - .StackResources) - Console.WriteLine( - $" {resource.LogicalResourceId}: {resource.ResourceStatus}"); - } - } - } - - Console.WriteLine("\n------------------------------------------------"); - return true; - } - catch (AmazonCloudFormationException ex) - { - Console.WriteLine("Unable to get stack information:\n" + ex.Message); - return false; - } - catch (AmazonServiceException ex) - { - if (ex.Message.Contains("Unable to get IAM security credentials")) - { - Console.WriteLine(ex.Message); - Console.WriteLine("If you are usnig SSO, be sure to install" + - " the AWSSDK.SSO and AWSSDK.SSOOIDC packages."); - } - else - { - Console.WriteLine(ex.Message); - Console.WriteLine(ex.StackTrace); - } - - return false; - } - catch (ArgumentNullException ex) - { - if (ex.Message.Contains("Options property cannot be empty: ClientName")) - { - Console.WriteLine(ex.Message); - Console.WriteLine("If you are using SSO, have you logged in?"); - } - else - { - Console.WriteLine(ex.Message); - Console.WriteLine(ex.StackTrace); - } - - return false; - } - } - - - - * For API details, see [DescribeStackResources](https://docs.aws.amazon.com/goto/DotNetSDKV4/cloudformation-2010-05-15/DescribeStackResources) in _AWS SDK for .NET API Reference_. - - - -