AWS redshift documentation change
Summary
Removed 'Get started' code examples for DescribeClusters API across multiple SDKs
Security assessment
Content removal of non-security-related code samples. No security context, vulnerabilities, or security features mentioned in the deleted content. Routine documentation maintenance.
Diff
diff --git a/redshift/latest/mgmt/service_code_examples.md b/redshift/latest/mgmt/service_code_examples.md index ac885925d..cfe33df92 100644 --- a//redshift/latest/mgmt/service_code_examples.md +++ b//redshift/latest/mgmt/service_code_examples.md @@ -19,218 +18,0 @@ For a complete list of AWS SDK developer guides and code examples, see [Using th -**Get started** - -The following code examples show how to get started using Amazon Redshift. - -.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/Redshift#code-examples). - - - /// <summary> - /// Main method to run the Hello Amazon Redshift example. - /// </summary> - /// <param name="args">Command line arguments (not used).</param> - public static async Task Main(string[] args) - { - var redshiftClient = new AmazonRedshiftClient(); - - Console.WriteLine("Hello, Amazon Redshift! Let's list available clusters:"); - - var clusters = new List<Cluster>(); - - try - { - // Use pagination to retrieve all clusters. - var clustersPaginator = redshiftClient.Paginators.DescribeClusters(new DescribeClustersRequest()); - - await foreach (var response in clustersPaginator.Responses) - { - if (response.Clusters != null) - clusters.AddRange(response.Clusters); - } - - Console.WriteLine($"{clusters.Count} cluster(s) retrieved."); - - foreach (var cluster in clusters) - { - Console.WriteLine($"\t{cluster.ClusterIdentifier} (Status: {cluster.ClusterStatus})"); - } - } - catch (AmazonRedshiftException ex) - { - Console.WriteLine($"Couldn't list clusters. Here's why: {ex.Message}"); - } - catch (Exception ex) - { - Console.WriteLine($"An error occurred: {ex.Message}"); - } - } - - - - * For API details, see [DescribeClusters](https://docs.aws.amazon.com/goto/DotNetSDKV4/redshift-2012-12-01/DescribeClusters) in _AWS SDK for .NET API Reference_. - - - - -Go - - -**SDK for Go V2** - - -###### 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/gov2/redshift#code-examples). - - - package main - - import ( - "context" - "fmt" - - "github.com/aws/aws-sdk-go-v2/aws" - "github.com/aws/aws-sdk-go-v2/config" - "github.com/aws/aws-sdk-go-v2/service/redshift" - ) - - // main uses the AWS SDK for Go V2 to create a Redshift client - // and list up to 10 clusters in your account. - // This example uses the default settings specified in your shared credentials - // and config files. - func main() { - ctx := context.Background() - sdkConfig, err := config.LoadDefaultConfig(ctx) - if err != nil { - fmt.Println("Couldn't load default configuration. Have you set up your AWS account?") - fmt.Println(err) - return - } - redshiftClient := redshift.NewFromConfig(sdkConfig) - count := 20 - fmt.Printf("Let's list up to %v clusters for your account.\n", count) - result, err := redshiftClient.DescribeClusters(ctx, &redshift.DescribeClustersInput{ - MaxRecords: aws.Int32(int32(count)), - }) - if err != nil { - fmt.Printf("Couldn't list clusters for your account. Here's why: %v\n", err) - return - } - if len(result.Clusters) == 0 { - fmt.Println("You don't have any clusters!") - return - } - for _, cluster := range result.Clusters { - fmt.Printf("\t%v : %v\n", *cluster.ClusterIdentifier, *cluster.ClusterStatus) - } - } - - - - - * For API details, see [DescribeClusters](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/redshift#Client.DescribeClusters) in _AWS SDK for Go API Reference_. - - - - -Java - - -**SDK for Java 2.x** - - -###### 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/javav2/example_code/redshift#code-examples). - - - import software.amazon.awssdk.regions.Region; - import software.amazon.awssdk.services.redshift.RedshiftClient; - import software.amazon.awssdk.services.redshift.paginators.DescribeClustersIterable; - - /** - * Before running this Java V2 code example, set up your development - * environment, including your credentials. - * - * For more information, see the following documentation topic: - * - * https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/get-started.html - */ - public class HelloRedshift { - public static void main(String[] args) { - Region region = Region.US_EAST_1; - RedshiftClient redshiftClient = RedshiftClient.builder() - .region(region) - .build(); - - listClustersPaginator(redshiftClient); - } - - public static void listClustersPaginator(RedshiftClient redshiftClient) { - DescribeClustersIterable clustersIterable = redshiftClient.describeClustersPaginator(); - clustersIterable.stream() - .flatMap(r -> r.clusters().stream()) - .forEach(cluster -> System.out - .println(" Cluster identifier: " + cluster.clusterIdentifier() + " status = " + cluster.clusterStatus())); - } - } - - - - * For API details, see [DescribeClusters](https://docs.aws.amazon.com/goto/SdkForJavaV2/redshift-2012-12-01/DescribeClusters) in _AWS SDK for Java 2.x API Reference_. - - - - -Python - - -**SDK for Python (Boto3)** - - -###### 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/python/example_code/redshift#code-examples). - - - import boto3 - - - def hello_redshift(redshift_client): - """ - Use the AWS SDK for Python (Boto3) to create an Amazon Redshift client and list - the clusters in your account. This list might be empty if you haven't created - any clusters. - This example uses the default settings specified in your shared credentials - and config files. - - :param redshift_client: A Boto3 Redshift Client object.