Skip to content

Commit

Permalink
.NET (v3): Add Hello RDS example (#5029)
Browse files Browse the repository at this point in the history
  • Loading branch information
rlhagerm authored Jul 10, 2023
1 parent d886402 commit ea06992
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 6 deletions.
17 changes: 17 additions & 0 deletions .doc_gen/metadata/rds_metadata.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
38 changes: 38 additions & 0 deletions dotnetv3/RDS/Actions/HelloRDS.cs
Original file line number Diff line number Diff line change
@@ -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]
2 changes: 1 addition & 1 deletion dotnetv3/RDS/Actions/RDSActions.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Library</OutputType>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

Expand Down
21 changes: 16 additions & 5 deletions dotnetv3/RDS/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!--Generated by WRITEME on 2023-04-25 16:09:00.097747 (UTC)-->
<!--Generated by WRITEME on 2023-07-06 16:04:14.208448 (UTC)-->
# Amazon RDS code examples for the SDK for .NET

## Overview
Expand Down Expand Up @@ -30,6 +30,11 @@ For prerequisites, see the [README](../README.md#Prerequisites) in the `dotnetv3
<!--custom.prerequisites.start-->
<!--custom.prerequisites.end-->


### Get started

* [Hello Amazon RDS](Actions/HelloRDS.cs#L4) (`DescribeDBInstances`)

### Single actions

Code excerpts that show you how to call individual service functions.
Expand Down Expand Up @@ -65,24 +70,30 @@ 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:

```
dotnet run
```
Alternatively, you can run the example from within your IDE.

Alternatively, you can run the example from within your IDE.

<!--custom.instructions.start-->
<!--custom.instructions.end-->

#### Hello Amazon RDS

This example shows you how to get started using Amazon RDS.



#### Get started with DB instances
Expand Down

0 comments on commit ea06992

Please sign in to comment.