1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224
|
// Code generated by smithy-go-codegen DO NOT EDIT.
package rds
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/service/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes a previously provisioned DB instance. When you delete a DB instance,
// all automated backups for that instance are deleted and can't be recovered.
// However, manual DB snapshots of the DB instance aren't deleted.
//
// If you request a final DB snapshot, the status of the Amazon RDS DB instance is
// deleting until the DB snapshot is created. This operation can't be canceled or
// reverted after it begins. To monitor the status of this operation, use
// DescribeDBInstance .
//
// When a DB instance is in a failure state and has a status of failed ,
// incompatible-restore , or incompatible-network , you can only delete it when you
// skip creation of the final snapshot with the SkipFinalSnapshot parameter.
//
// If the specified DB instance is part of an Amazon Aurora DB cluster, you can't
// delete the DB instance if both of the following conditions are true:
//
// - The DB cluster is a read replica of another Amazon Aurora DB cluster.
//
// - The DB instance is the only instance in the DB cluster.
//
// To delete a DB instance in this case, first use the PromoteReadReplicaDBCluster
// operation to promote the DB cluster so that it's no longer a read replica. After
// the promotion completes, use the DeleteDBInstance operation to delete the final
// instance in the DB cluster.
//
// For RDS Custom DB instances, deleting the DB instance permanently deletes the
// EC2 instance and the associated EBS volumes. Make sure that you don't terminate
// or delete these resources before you delete the DB instance. Otherwise, deleting
// the DB instance and creation of the final snapshot might fail.
func (c *Client) DeleteDBInstance(ctx context.Context, params *DeleteDBInstanceInput, optFns ...func(*Options)) (*DeleteDBInstanceOutput, error) {
if params == nil {
params = &DeleteDBInstanceInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteDBInstance", params, optFns, c.addOperationDeleteDBInstanceMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteDBInstanceOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteDBInstanceInput struct {
// The DB instance identifier for the DB instance to be deleted. This parameter
// isn't case-sensitive.
//
// Constraints:
//
// - Must match the name of an existing DB instance.
//
// This member is required.
DBInstanceIdentifier *string
// Specifies whether to remove automated backups immediately after the DB instance
// is deleted. This parameter isn't case-sensitive. The default is to remove
// automated backups immediately after the DB instance is deleted.
DeleteAutomatedBackups *bool
// The DBSnapshotIdentifier of the new DBSnapshot created when the
// SkipFinalSnapshot parameter is disabled.
//
// If you enable this parameter and also enable SkipFinalShapshot, the command
// results in an error.
//
// This setting doesn't apply to RDS Custom.
//
// Constraints:
//
// - Must be 1 to 255 letters or numbers.
//
// - First character must be a letter.
//
// - Can't end with a hyphen or contain two consecutive hyphens.
//
// - Can't be specified when deleting a read replica.
FinalDBSnapshotIdentifier *string
// Specifies whether to skip the creation of a final DB snapshot before deleting
// the instance. If you enable this parameter, RDS doesn't create a DB snapshot. If
// you don't enable this parameter, RDS creates a DB snapshot before the DB
// instance is deleted. By default, skip isn't enabled, and the DB snapshot is
// created.
//
// If you don't enable this parameter, you must specify the
// FinalDBSnapshotIdentifier parameter.
//
// When a DB instance is in a failure state and has a status of failed ,
// incompatible-restore , or incompatible-network , RDS can delete the instance
// only if you enable this parameter.
//
// If you delete a read replica or an RDS Custom instance, you must enable this
// setting.
//
// This setting is required for RDS Custom.
SkipFinalSnapshot *bool
noSmithyDocumentSerde
}
type DeleteDBInstanceOutput struct {
// Contains the details of an Amazon RDS DB instance.
//
// This data type is used as a response element in the operations CreateDBInstance
// , CreateDBInstanceReadReplica , DeleteDBInstance , DescribeDBInstances ,
// ModifyDBInstance , PromoteReadReplica , RebootDBInstance ,
// RestoreDBInstanceFromDBSnapshot , RestoreDBInstanceFromS3 ,
// RestoreDBInstanceToPointInTime , StartDBInstance , and StopDBInstance .
DBInstance *types.DBInstance
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteDBInstanceMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsquery_serializeOpDeleteDBInstance{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDeleteDBInstance{}, middleware.After)
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteDBInstance"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = addClientRequestID(stack); err != nil {
return err
}
if err = addComputeContentLength(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = addComputePayloadSHA256(stack); err != nil {
return err
}
if err = addRetry(stack, options); err != nil {
return err
}
if err = addRawResponseToMetadata(stack); err != nil {
return err
}
if err = addRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addTimeOffsetBuild(stack, c); err != nil {
return err
}
if err = addUserAgentRetryMode(stack, options); err != nil {
return err
}
if err = addOpDeleteDBInstanceValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteDBInstance(options.Region), middleware.Before); err != nil {
return err
}
if err = addRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opDeleteDBInstance(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
OperationName: "DeleteDBInstance",
}
}
|