api_op_UpdateRelationalDatabase.go raw

   1  // Code generated by smithy-go-codegen DO NOT EDIT.
   2  
   3  package lightsail
   4  
   5  import (
   6  	"context"
   7  	"fmt"
   8  	awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
   9  	"github.com/aws/aws-sdk-go-v2/service/lightsail/types"
  10  	"github.com/aws/smithy-go/middleware"
  11  	smithyhttp "github.com/aws/smithy-go/transport/http"
  12  )
  13  
  14  // Allows the update of one or more attributes of a database in Amazon Lightsail.
  15  //
  16  // Updates are applied immediately, or in cases where the updates could result in
  17  // an outage, are applied during the database's predefined maintenance window.
  18  //
  19  // The update relational database operation supports tag-based access control via
  20  // resource tags applied to the resource identified by relationalDatabaseName. For
  21  // more information, see the [Amazon Lightsail Developer Guide].
  22  //
  23  // [Amazon Lightsail Developer Guide]: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-controlling-access-using-tags
  24  func (c *Client) UpdateRelationalDatabase(ctx context.Context, params *UpdateRelationalDatabaseInput, optFns ...func(*Options)) (*UpdateRelationalDatabaseOutput, error) {
  25  	if params == nil {
  26  		params = &UpdateRelationalDatabaseInput{}
  27  	}
  28  
  29  	result, metadata, err := c.invokeOperation(ctx, "UpdateRelationalDatabase", params, optFns, c.addOperationUpdateRelationalDatabaseMiddlewares)
  30  	if err != nil {
  31  		return nil, err
  32  	}
  33  
  34  	out := result.(*UpdateRelationalDatabaseOutput)
  35  	out.ResultMetadata = metadata
  36  	return out, nil
  37  }
  38  
  39  type UpdateRelationalDatabaseInput struct {
  40  
  41  	// The name of your Lightsail database resource to update.
  42  	//
  43  	// This member is required.
  44  	RelationalDatabaseName *string
  45  
  46  	// When true , applies changes immediately. When false , applies changes during the
  47  	// preferred maintenance window. Some changes may cause an outage.
  48  	//
  49  	// Default: false
  50  	ApplyImmediately *bool
  51  
  52  	// Indicates the certificate that needs to be associated with the database.
  53  	CaCertificateIdentifier *string
  54  
  55  	// When true , disables automated backup retention for your database.
  56  	//
  57  	// Disabling backup retention deletes all automated database backups. Before
  58  	// disabling this, you may want to create a snapshot of your database using the
  59  	// create relational database snapshot operation.
  60  	//
  61  	// Updates are applied during the next maintenance window because this can result
  62  	// in an outage.
  63  	DisableBackupRetention *bool
  64  
  65  	// When true , enables automated backup retention for your database.
  66  	//
  67  	// Updates are applied during the next maintenance window because this can result
  68  	// in an outage.
  69  	EnableBackupRetention *bool
  70  
  71  	// The password for the master user. The password can include any printable ASCII
  72  	// character except "/", """, or "@".
  73  	//
  74  	// MySQL
  75  	//
  76  	// Constraints: Must contain from 8 to 41 characters.
  77  	//
  78  	// PostgreSQL
  79  	//
  80  	// Constraints: Must contain from 8 to 128 characters.
  81  	MasterUserPassword *string
  82  
  83  	// The daily time range during which automated backups are created for your
  84  	// database if automated backups are enabled.
  85  	//
  86  	// Constraints:
  87  	//
  88  	//   - Must be in the hh24:mi-hh24:mi format.
  89  	//
  90  	// Example: 16:00-16:30
  91  	//
  92  	//   - Specified in Coordinated Universal Time (UTC).
  93  	//
  94  	//   - Must not conflict with the preferred maintenance window.
  95  	//
  96  	//   - Must be at least 30 minutes.
  97  	PreferredBackupWindow *string
  98  
  99  	// The weekly time range during which system maintenance can occur on your
 100  	// database.
 101  	//
 102  	// The default is a 30-minute window selected at random from an 8-hour block of
 103  	// time for each Amazon Web Services Region, occurring on a random day of the week.
 104  	//
 105  	// Constraints:
 106  	//
 107  	//   - Must be in the ddd:hh24:mi-ddd:hh24:mi format.
 108  	//
 109  	//   - Valid days: Mon, Tue, Wed, Thu, Fri, Sat, Sun.
 110  	//
 111  	//   - Must be at least 30 minutes.
 112  	//
 113  	//   - Specified in Coordinated Universal Time (UTC).
 114  	//
 115  	//   - Example: Tue:17:00-Tue:17:30
 116  	PreferredMaintenanceWindow *string
 117  
 118  	// Specifies the accessibility options for your database. A value of true
 119  	// specifies a database that is available to resources outside of your Lightsail
 120  	// account. A value of false specifies a database that is available only to your
 121  	// Lightsail resources in the same region as your database.
 122  	PubliclyAccessible *bool
 123  
 124  	// This parameter is used to update the major version of the database. Enter the
 125  	// blueprintId for the major version that you want to update to.
 126  	//
 127  	// Use the [GetRelationalDatabaseBlueprints] action to get a list of available blueprint IDs.
 128  	//
 129  	// [GetRelationalDatabaseBlueprints]: https://docs.aws.amazon.com/lightsail/2016-11-28/api-reference/API_GetRelationalDatabaseBlueprints.html
 130  	RelationalDatabaseBlueprintId *string
 131  
 132  	// When true , the master user password is changed to a new strong password
 133  	// generated by Lightsail.
 134  	//
 135  	// Use the get relational database master user password operation to get the new
 136  	// password.
 137  	RotateMasterUserPassword *bool
 138  
 139  	noSmithyDocumentSerde
 140  }
 141  
 142  type UpdateRelationalDatabaseOutput struct {
 143  
 144  	// An array of objects that describe the result of the action, such as the status
 145  	// of the request, the timestamp of the request, and the resources affected by the
 146  	// request.
 147  	Operations []types.Operation
 148  
 149  	// Metadata pertaining to the operation's result.
 150  	ResultMetadata middleware.Metadata
 151  
 152  	noSmithyDocumentSerde
 153  }
 154  
 155  func (c *Client) addOperationUpdateRelationalDatabaseMiddlewares(stack *middleware.Stack, options Options) (err error) {
 156  	if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
 157  		return err
 158  	}
 159  	err = stack.Serialize.Add(&awsAwsjson11_serializeOpUpdateRelationalDatabase{}, middleware.After)
 160  	if err != nil {
 161  		return err
 162  	}
 163  	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpUpdateRelationalDatabase{}, middleware.After)
 164  	if err != nil {
 165  		return err
 166  	}
 167  	if err := addProtocolFinalizerMiddlewares(stack, options, "UpdateRelationalDatabase"); err != nil {
 168  		return fmt.Errorf("add protocol finalizers: %v", err)
 169  	}
 170  
 171  	if err = addlegacyEndpointContextSetter(stack, options); err != nil {
 172  		return err
 173  	}
 174  	if err = addSetLoggerMiddleware(stack, options); err != nil {
 175  		return err
 176  	}
 177  	if err = addClientRequestID(stack); err != nil {
 178  		return err
 179  	}
 180  	if err = addComputeContentLength(stack); err != nil {
 181  		return err
 182  	}
 183  	if err = addResolveEndpointMiddleware(stack, options); err != nil {
 184  		return err
 185  	}
 186  	if err = addComputePayloadSHA256(stack); err != nil {
 187  		return err
 188  	}
 189  	if err = addRetry(stack, options); err != nil {
 190  		return err
 191  	}
 192  	if err = addRawResponseToMetadata(stack); err != nil {
 193  		return err
 194  	}
 195  	if err = addRecordResponseTiming(stack); err != nil {
 196  		return err
 197  	}
 198  	if err = addSpanRetryLoop(stack, options); err != nil {
 199  		return err
 200  	}
 201  	if err = addClientUserAgent(stack, options); err != nil {
 202  		return err
 203  	}
 204  	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
 205  		return err
 206  	}
 207  	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
 208  		return err
 209  	}
 210  	if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
 211  		return err
 212  	}
 213  	if err = addTimeOffsetBuild(stack, c); err != nil {
 214  		return err
 215  	}
 216  	if err = addUserAgentRetryMode(stack, options); err != nil {
 217  		return err
 218  	}
 219  	if err = addCredentialSource(stack, options); err != nil {
 220  		return err
 221  	}
 222  	if err = addOpUpdateRelationalDatabaseValidationMiddleware(stack); err != nil {
 223  		return err
 224  	}
 225  	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateRelationalDatabase(options.Region), middleware.Before); err != nil {
 226  		return err
 227  	}
 228  	if err = addRecursionDetection(stack); err != nil {
 229  		return err
 230  	}
 231  	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
 232  		return err
 233  	}
 234  	if err = addResponseErrorMiddleware(stack); err != nil {
 235  		return err
 236  	}
 237  	if err = addRequestResponseLogging(stack, options); err != nil {
 238  		return err
 239  	}
 240  	if err = addDisableHTTPSMiddleware(stack, options); err != nil {
 241  		return err
 242  	}
 243  	if err = addInterceptBeforeRetryLoop(stack, options); err != nil {
 244  		return err
 245  	}
 246  	if err = addInterceptAttempt(stack, options); err != nil {
 247  		return err
 248  	}
 249  	if err = addInterceptors(stack, options); err != nil {
 250  		return err
 251  	}
 252  	return nil
 253  }
 254  
 255  func newServiceMetadataMiddleware_opUpdateRelationalDatabase(region string) *awsmiddleware.RegisterServiceMetadata {
 256  	return &awsmiddleware.RegisterServiceMetadata{
 257  		Region:        region,
 258  		ServiceID:     ServiceID,
 259  		OperationName: "UpdateRelationalDatabase",
 260  	}
 261  }
 262