Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go: RDS get started with instances scenario #5030

Merged
merged 2 commits into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 128 additions & 0 deletions .doc_gen/metadata/rds_metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ rds_Hello:
- description:
snippet_tags:
- RDS.dotnetv3.HelloRds
Go:
versions:
- sdk_version: 2
github: gov2/rds
excerpts:
- description:
snippet_tags:
- gov2.rds.Hello
services:
rds: {DescribeDBInstances}
rds_CreateDBInstance:
Expand All @@ -31,6 +39,15 @@ rds_CreateDBInstance:
- description:
snippet_tags:
- RDS.dotnetv3.CreateDBInstance
Go:
versions:
- sdk_version: 2
github: gov2/rds
excerpts:
- description:
snippet_tags:
- gov2.rds.DbInstances.struct
- gov2.rds.CreateDBInstance
Kotlin:
versions:
- sdk_version: 1
Expand Down Expand Up @@ -86,6 +103,15 @@ rds_DeleteDBInstance:
- description:
snippet_tags:
- RDS.dotnetv3.DeleteDBInstance
Go:
versions:
- sdk_version: 2
github: gov2/rds
excerpts:
- description:
snippet_tags:
- gov2.rds.DbInstances.struct
- gov2.rds.DeleteDBInstance
Kotlin:
versions:
- sdk_version: 1
Expand Down Expand Up @@ -167,6 +193,15 @@ rds_DescribeDBInstances:
- description:
snippet_tags:
- RDS.dotnetv3.DescribeDbInstances
Go:
versions:
- sdk_version: 2
github: gov2/rds
excerpts:
- description:
snippet_tags:
- gov2.rds.DbInstances.struct
- gov2.rds.DescribeDBInstances
Kotlin:
versions:
- sdk_version: 1
Expand Down Expand Up @@ -282,6 +317,15 @@ rds_DescribeDBParameterGroups:
- description:
snippet_tags:
- RDS.dotnetv3.DescribeDBParameterGroups
Go:
versions:
- sdk_version: 2
github: gov2/rds
excerpts:
- description:
snippet_tags:
- gov2.rds.DbInstances.struct
- gov2.rds.DescribeDBParameterGroups
Python:
versions:
- sdk_version: 3
Expand Down Expand Up @@ -339,6 +383,15 @@ rds_CreateDBParameterGroup:
- description:
snippet_tags:
- RDS.dotnetv3.CreateDBParameterGroup
Go:
versions:
- sdk_version: 2
github: gov2/rds
excerpts:
- description:
snippet_tags:
- gov2.rds.DbInstances.struct
- gov2.rds.CreateDBParameterGroup
Python:
versions:
- sdk_version: 3
Expand Down Expand Up @@ -386,6 +439,15 @@ rds_DeleteDBParameterGroup:
- description:
snippet_tags:
- RDS.dotnetv3.DeleteDBParameterGroup
Go:
versions:
- sdk_version: 2
github: gov2/rds
excerpts:
- description:
snippet_tags:
- gov2.rds.DbInstances.struct
- gov2.rds.DeleteDBParameterGroup
Python:
versions:
- sdk_version: 3
Expand Down Expand Up @@ -433,6 +495,15 @@ rds_DescribeDBParameters:
- description:
snippet_tags:
- RDS.dotnetv3.DescribeDBParameters
Go:
versions:
- sdk_version: 2
github: gov2/rds
excerpts:
- description:
snippet_tags:
- gov2.rds.DbInstances.struct
- gov2.rds.DescribeDBParameters
Python:
versions:
- sdk_version: 3
Expand Down Expand Up @@ -489,6 +560,15 @@ rds_ModifyDBParameterGroup:
- description:
snippet_tags:
- RDS.dotnetv3.ModifyDBParameterGroup
Go:
versions:
- sdk_version: 2
github: gov2/rds
excerpts:
- description:
snippet_tags:
- gov2.rds.DbInstances.struct
- gov2.rds.ModifyDBParameterGroup
Python:
versions:
- sdk_version: 3
Expand Down Expand Up @@ -536,6 +616,15 @@ rds_CreateDBSnapshot:
- description:
snippet_tags:
- RDS.dotnetv3.CreateDBSnapshot
Go:
versions:
- sdk_version: 2
github: gov2/rds
excerpts:
- description:
snippet_tags:
- gov2.rds.DbInstances.struct
- gov2.rds.CreateDBSnapshot
Python:
versions:
- sdk_version: 3
Expand Down Expand Up @@ -583,6 +672,15 @@ rds_DescribeDBSnapshots:
- description:
snippet_tags:
- RDS.dotnetv3.DescribeDBSnapshots
Go:
versions:
- sdk_version: 2
github: gov2/rds
excerpts:
- description:
snippet_tags:
- gov2.rds.DbInstances.struct
- gov2.rds.DescribeDBSnapshots
Python:
versions:
- sdk_version: 3
Expand Down Expand Up @@ -639,6 +737,15 @@ rds_DescribeDBEngineVersions:
- description:
snippet_tags:
- RDS.dotnetv3.DescribeDBEngineVersions
Go:
versions:
- sdk_version: 2
github: gov2/rds
excerpts:
- description:
snippet_tags:
- gov2.rds.DbInstances.struct
- gov2.rds.DescribeDBEngineVersions
Python:
versions:
- sdk_version: 3
Expand Down Expand Up @@ -686,6 +793,15 @@ rds_DescribeOrderableDBInstanceOptions:
- description:
snippet_tags:
- RDS.dotnetv3.DescribeOrderableDBInstanceOptions
Go:
versions:
- sdk_version: 2
github: gov2/rds
excerpts:
- description:
snippet_tags:
- gov2.rds.DbInstances.struct
- gov2.rds.DescribeOrderableDBInstanceOptions
Python:
versions:
- sdk_version: 3
Expand Down Expand Up @@ -773,6 +889,18 @@ rds_Scenario_GetStartedInstances:
- description: Wrapper methods used by the scenario for DB snapshot actions.
snippet_tags:
- RDS.dotnetv3.RdsInstanceWrapperSnapshots
Go:
versions:
- sdk_version: 2
github: gov2/rds
excerpts:
- description: Run an interactive scenario at a command prompt.
snippet_tags:
- gov2.rds.Scenario_GetStartedInstances
- description: Define functions that are called by the scenario to
manage &RDS; actions.
snippet_tags:
- gov2.rds.DbInstances.complete
Python:
versions:
- sdk_version: 3
Expand Down
129 changes: 129 additions & 0 deletions gov2/rds/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
<!--Generated by WRITEME on 2023-06-28 22:20:08.375942 (UTC)-->
# Amazon RDS code examples for the SDK for Go V2

## Overview

Shows how to use the AWS SDK for Go V2 to work with Amazon Relational Database Service (Amazon RDS).

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

*Amazon RDS is a web service that makes it easier to set up, operate, and scale a relational database in the cloud.*

## ⚠ Important

* Running this code might result in charges to your AWS account.
* Running the tests might result in charges to your AWS account.
* We recommend that you grant your code least privilege. At most, grant only the minimum permissions required to perform the task. For more information, see [Grant least privilege](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#grant-least-privilege).
* This code is not tested in every AWS Region. For more information, see [AWS Regional Services](https://aws.amazon.com/about-aws/global-infrastructure/regional-product-services).

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

## Code examples

### Prerequisites

For prerequisites, see the [README](../README.md#Prerequisites) in the `gov2` folder.


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


### Get started

* [Hello Amazon RDS](hello/hello.go#L4) (`DescribeDBInstances`)

### Single actions

Code excerpts that show you how to call individual service functions.

* [Create a DB instance](actions/instances.go#L172) (`CreateDBInstance`)
* [Create a DB parameter group](actions/instances.go#L46) (`CreateDBParameterGroup`)
* [Create a snapshot of a DB instance](actions/instances.go#L135) (`CreateDBSnapshot`)
* [Delete a DB instance](actions/instances.go#L226) (`DeleteDBInstance`)
* [Delete a DB parameter group](actions/instances.go#L70) (`DeleteDBParameterGroup`)
* [Describe DB instances](actions/instances.go#L201) (`DescribeDBInstances`)
* [Describe DB parameter groups](actions/instances.go#L21) (`DescribeDBParameterGroups`)
* [Describe database engine versions](actions/instances.go#L245) (`DescribeDBEngineVersions`)
* [Describe options for DB instances](actions/instances.go#L266) (`DescribeOrderableDBInstanceOptions`)
* [Describe parameters in a DB parameter group](actions/instances.go#L88) (`DescribeDBParameters`)
* [Describe snapshots of DB instances](actions/instances.go#L154) (`DescribeDBSnapshots`)
* [Update parameters in a DB parameter group](actions/instances.go#L116) (`ModifyDBParameterGroup`)

### Scenarios

Code examples that show you how to accomplish a specific task by calling multiple
functions within the same service.

* [Get started with DB instances](scenarios/get_started_instances.go)

## Run the examples

### Instructions


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

#### Hello Amazon RDS

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

```
go run ./hello
```

#### Run a scenario

All scenarios can be run with the `cmd` runner. To get a list of scenarios
and to get help for running a scenario, use the following command:

```
go run ./cmd -h
```

#### Get started with DB instances

This example shows you how to do the following:

* Create a custom DB parameter group and set parameter values.
* Create a DB instance that's configured to use the parameter group. The DB instance also contains a database.
* Take a snapshot of the instance.
* Delete the instance and parameter group.

<!--custom.scenario_prereqs.rds_Scenario_GetStartedInstances.start-->
<!--custom.scenario_prereqs.rds_Scenario_GetStartedInstances.end-->


<!--custom.scenarios.rds_Scenario_GetStartedInstances.start-->
<!--custom.scenarios.rds_Scenario_GetStartedInstances.end-->

### Tests

⚠ Running tests might result in charges to your AWS account.


To find instructions for running these tests, see the [README](../README.md#Tests)
in the `gov2` folder.



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

## Additional resources

* [Amazon RDS User Guide](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Welcome.html)
* [Amazon RDS API Reference](https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/Welcome.html)
* [SDK for Go V2 Amazon RDS reference](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/rds)

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

---

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0
Loading