diff --git a/.doc_gen/metadata/rds_metadata.yaml b/.doc_gen/metadata/rds_metadata.yaml index da52d6af26f..be8513d2dde 100644 --- a/.doc_gen/metadata/rds_metadata.yaml +++ b/.doc_gen/metadata/rds_metadata.yaml @@ -1,4 +1,21 @@ # zexi 0.4.0 +rds_Hello: + title: Hello &RDS; + title_abbrev: Hello &RDS; + synopsis: get started using &RDS;. + category: Hello + languages: + .NET: + versions: + - sdk_version: 3 + github: dotnetv3/RDS + sdkguide: + excerpts: + - description: + snippet_tags: + - RDS.dotnetv3.HelloRds + services: + rds: {DescribeDBInstances} rds_CreateDBInstance: title: Create an &RDS; DB instance using an &AWS; SDK title_abbrev: Create a DB instance diff --git a/dotnetv3/RDS/Actions/HelloRDS.cs b/dotnetv3/RDS/Actions/HelloRDS.cs new file mode 100644 index 00000000000..036284220c3 --- /dev/null +++ b/dotnetv3/RDS/Actions/HelloRDS.cs @@ -0,0 +1,38 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +// snippet-start:[RDS.dotnetv3.HelloRds] +using System; +using System.Threading.Tasks; +using Amazon.RDS; +using Amazon.RDS.Model; + +namespace RDSActions; + +public static class HelloRds +{ + static async Task Main(string[] args) + { + var rdsClient = new AmazonRDSClient(); + + Console.WriteLine($"Hello Amazon RDS! Following are some of your DB instances:"); + Console.WriteLine(); + + // You can use await and any of the async methods to get a response. + // Let's get the first twenty DB instances. + var response = await rdsClient.DescribeDBInstancesAsync( + new DescribeDBInstancesRequest() + { + MaxRecords = 20 // Must be between 20 and 100. + }); + + foreach (var instance in response.DBInstances) + { + Console.WriteLine($"\tDB name: {instance.DBName}"); + Console.WriteLine($"\tArn: {instance.DBInstanceArn}"); + Console.WriteLine($"\tIdentifier: {instance.DBInstanceIdentifier}"); + Console.WriteLine(); + } + } +} +// snippet-end:[RDS.dotnetv3.HelloRds] \ No newline at end of file diff --git a/dotnetv3/RDS/Actions/RDSActions.csproj b/dotnetv3/RDS/Actions/RDSActions.csproj index b2e0f42954c..fd4d38425ca 100644 --- a/dotnetv3/RDS/Actions/RDSActions.csproj +++ b/dotnetv3/RDS/Actions/RDSActions.csproj @@ -1,7 +1,7 @@  - Library + Exe net6.0 diff --git a/dotnetv3/RDS/README.md b/dotnetv3/RDS/README.md index d1613c4a72d..a05b16333d7 100644 --- a/dotnetv3/RDS/README.md +++ b/dotnetv3/RDS/README.md @@ -1,4 +1,4 @@ - + # Amazon RDS code examples for the SDK for .NET ## Overview @@ -30,6 +30,11 @@ For prerequisites, see the [README](../README.md#Prerequisites) in the `dotnetv3 + +### Get started + +* [Hello Amazon RDS](Actions/HelloRDS.cs#L4) (`DescribeDBInstances`) + ### Single actions Code excerpts that show you how to call individual service functions. @@ -65,11 +70,13 @@ Sample applications that work across multiple AWS services. ### Instructions -For general instructions to run the examples, see the [README](../README.md#building-and-running-the-code-examples) in the `dotnetv3` folder. +For general instructions to run the examples, see the +[README](../README.md#building-and-running-the-code-examples) in the `dotnetv3` folder. Some projects might include a settings.json file. Before compiling the project, -you can change these values to match your own account and resources. Alternatively, add a settings.local.json file with -your local settings, which will be loaded automatically when the application runs. +you can change these values to match your own account and resources. Alternatively, +add a settings.local.json file with your local settings, which will be loaded automatically +when the application runs. After the example compiles, you can run it from the command line. To do so, navigate to the folder that contains the .csproj file and run the following command: @@ -77,12 +84,16 @@ the folder that contains the .csproj file and run the following command: ``` dotnet run ``` -Alternatively, you can run the example from within your IDE. +Alternatively, you can run the example from within your IDE. +#### Hello Amazon RDS + +This example shows you how to get started using Amazon RDS. + #### Get started with DB instances