File: api_op_CreateDBInstance.go

package info (click to toggle)
golang-github-aws-aws-sdk-go-v2 1.17.1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 384,244 kB
  • sloc: java: 13,538; makefile: 400; sh: 137
file content (338 lines) | stat: -rw-r--r-- 11,847 bytes parent folder | download
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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
// Code generated by smithy-go-codegen DO NOT EDIT.

package neptune

import (
	"context"
	awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
	"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
	"github.com/aws/aws-sdk-go-v2/service/neptune/types"
	"github.com/aws/smithy-go/middleware"
	smithyhttp "github.com/aws/smithy-go/transport/http"
)

// Creates a new DB instance.
func (c *Client) CreateDBInstance(ctx context.Context, params *CreateDBInstanceInput, optFns ...func(*Options)) (*CreateDBInstanceOutput, error) {
	if params == nil {
		params = &CreateDBInstanceInput{}
	}

	result, metadata, err := c.invokeOperation(ctx, "CreateDBInstance", params, optFns, c.addOperationCreateDBInstanceMiddlewares)
	if err != nil {
		return nil, err
	}

	out := result.(*CreateDBInstanceOutput)
	out.ResultMetadata = metadata
	return out, nil
}

type CreateDBInstanceInput struct {

	// The compute and memory capacity of the DB instance, for example, db.m4.large.
	// Not all DB instance classes are available in all Amazon Regions.
	//
	// This member is required.
	DBInstanceClass *string

	// The DB instance identifier. This parameter is stored as a lowercase string.
	// Constraints:
	//
	// * Must contain from 1 to 63 letters, numbers, or hyphens.
	//
	// * First
	// character must be a letter.
	//
	// * Cannot end with a hyphen or contain two
	// consecutive hyphens.
	//
	// Example: mydbinstance
	//
	// This member is required.
	DBInstanceIdentifier *string

	// The name of the database engine to be used for this instance. Valid Values:
	// neptune
	//
	// This member is required.
	Engine *string

	// Not supported by Neptune.
	AllocatedStorage *int32

	// Indicates that minor engine upgrades are applied automatically to the DB
	// instance during the maintenance window. Default: true
	AutoMinorVersionUpgrade *bool

	// The EC2 Availability Zone that the DB instance is created in Default: A random,
	// system-chosen Availability Zone in the endpoint's Amazon Region. Example:
	// us-east-1d Constraint: The AvailabilityZone parameter can't be specified if the
	// MultiAZ parameter is set to true. The specified Availability Zone must be in the
	// same Amazon Region as the current endpoint.
	AvailabilityZone *string

	// The number of days for which automated backups are retained. Not applicable. The
	// retention period for automated backups is managed by the DB cluster. For more
	// information, see CreateDBCluster. Default: 1 Constraints:
	//
	// * Must be a value
	// from 0 to 35
	//
	// * Cannot be set to 0 if the DB instance is a source to Read
	// Replicas
	BackupRetentionPeriod *int32

	// (Not supported by Neptune)
	CharacterSetName *string

	// True to copy all tags from the DB instance to snapshots of the DB instance, and
	// otherwise false. The default is false.
	CopyTagsToSnapshot *bool

	// The identifier of the DB cluster that the instance will belong to. For
	// information on creating a DB cluster, see CreateDBCluster. Type: String
	DBClusterIdentifier *string

	// Not supported.
	DBName *string

	// The name of the DB parameter group to associate with this DB instance. If this
	// argument is omitted, the default DBParameterGroup for the specified engine is
	// used. Constraints:
	//
	// * Must be 1 to 255 letters, numbers, or hyphens.
	//
	// * First
	// character must be a letter
	//
	// * Cannot end with a hyphen or contain two
	// consecutive hyphens
	DBParameterGroupName *string

	// A list of DB security groups to associate with this DB instance. Default: The
	// default DB security group for the database engine.
	DBSecurityGroups []string

	// A DB subnet group to associate with this DB instance. If there is no DB subnet
	// group, then it is a non-VPC DB instance.
	DBSubnetGroupName *string

	// A value that indicates whether the DB instance has deletion protection enabled.
	// The database can't be deleted when deletion protection is enabled. By default,
	// deletion protection is disabled. See Deleting a DB Instance
	// (https://docs.aws.amazon.com/neptune/latest/userguide/manage-console-instances-delete.html).
	// DB instances in a DB cluster can be deleted even when deletion protection is
	// enabled in their parent DB cluster.
	DeletionProtection *bool

	// Specify the Active Directory Domain to create the instance in.
	Domain *string

	// Specify the name of the IAM role to be used when making API calls to the
	// Directory Service.
	DomainIAMRoleName *string

	// The list of log types that need to be enabled for exporting to CloudWatch Logs.
	EnableCloudwatchLogsExports []string

	// Not supported by Neptune (ignored).
	EnableIAMDatabaseAuthentication *bool

	// (Not supported by Neptune)
	EnablePerformanceInsights *bool

	// The version number of the database engine to use. Currently, setting this
	// parameter has no effect.
	EngineVersion *string

	// The amount of Provisioned IOPS (input/output operations per second) to be
	// initially allocated for the DB instance.
	Iops *int32

	// The Amazon KMS key identifier for an encrypted DB instance. The KMS key
	// identifier is the Amazon Resource Name (ARN) for the KMS encryption key. If you
	// are creating a DB instance with the same Amazon account that owns the KMS
	// encryption key used to encrypt the new DB instance, then you can use the KMS key
	// alias instead of the ARN for the KM encryption key. Not applicable. The KMS key
	// identifier is managed by the DB cluster. For more information, see
	// CreateDBCluster. If the StorageEncrypted parameter is true, and you do not
	// specify a value for the KmsKeyId parameter, then Amazon Neptune will use your
	// default encryption key. Amazon KMS creates the default encryption key for your
	// Amazon account. Your Amazon account has a different default encryption key for
	// each Amazon Region.
	KmsKeyId *string

	// License model information for this DB instance. Valid values: license-included |
	// bring-your-own-license | general-public-license
	LicenseModel *string

	// Not supported by Neptune.
	MasterUserPassword *string

	// Not supported by Neptune.
	MasterUsername *string

	// The interval, in seconds, between points when Enhanced Monitoring metrics are
	// collected for the DB instance. To disable collecting Enhanced Monitoring
	// metrics, specify 0. The default is 0. If MonitoringRoleArn is specified, then
	// you must also set MonitoringInterval to a value other than 0. Valid Values: 0,
	// 1, 5, 10, 15, 30, 60
	MonitoringInterval *int32

	// The ARN for the IAM role that permits Neptune to send enhanced monitoring
	// metrics to Amazon CloudWatch Logs. For example,
	// arn:aws:iam:123456789012:role/emaccess. If MonitoringInterval is set to a value
	// other than 0, then you must supply a MonitoringRoleArn value.
	MonitoringRoleArn *string

	// Specifies if the DB instance is a Multi-AZ deployment. You can't set the
	// AvailabilityZone parameter if the MultiAZ parameter is set to true.
	MultiAZ *bool

	// (Not supported by Neptune)
	OptionGroupName *string

	// (Not supported by Neptune)
	PerformanceInsightsKMSKeyId *string

	// The port number on which the database accepts connections. Not applicable. The
	// port is managed by the DB cluster. For more information, see CreateDBCluster.
	// Default: 8182 Type: Integer
	Port *int32

	// The daily time range during which automated backups are created. Not applicable.
	// The daily time range for creating automated backups is managed by the DB
	// cluster. For more information, see CreateDBCluster.
	PreferredBackupWindow *string

	// The time range each week during which system maintenance can occur, in Universal
	// Coordinated Time (UTC). Format: ddd:hh24:mi-ddd:hh24:mi The default is a
	// 30-minute window selected at random from an 8-hour block of time for each Amazon
	// Region, occurring on a random day of the week. Valid Days: Mon, Tue, Wed, Thu,
	// Fri, Sat, Sun. Constraints: Minimum 30-minute window.
	PreferredMaintenanceWindow *string

	// A value that specifies the order in which an Read Replica is promoted to the
	// primary instance after a failure of the existing primary instance. Default: 1
	// Valid Values: 0 - 15
	PromotionTier *int32

	// This flag should no longer be used.
	//
	// Deprecated: This member has been deprecated.
	PubliclyAccessible *bool

	// Specifies whether the DB instance is encrypted. Not applicable. The encryption
	// for DB instances is managed by the DB cluster. For more information, see
	// CreateDBCluster. Default: false
	StorageEncrypted *bool

	// Specifies the storage type to be associated with the DB instance. Not
	// applicable. Storage is managed by the DB Cluster.
	StorageType *string

	// The tags to assign to the new instance.
	Tags []types.Tag

	// The ARN from the key store with which to associate the instance for TDE
	// encryption.
	TdeCredentialArn *string

	// The password for the given ARN from the key store in order to access the device.
	TdeCredentialPassword *string

	// The time zone of the DB instance.
	Timezone *string

	// A list of EC2 VPC security groups to associate with this DB instance. Not
	// applicable. The associated list of EC2 VPC security groups is managed by the DB
	// cluster. For more information, see CreateDBCluster. Default: The default EC2 VPC
	// security group for the DB subnet group's VPC.
	VpcSecurityGroupIds []string

	noSmithyDocumentSerde
}

type CreateDBInstanceOutput struct {

	// Contains the details of an Amazon Neptune DB instance. This data type is used as
	// a response element in the DescribeDBInstances action.
	DBInstance *types.DBInstance

	// Metadata pertaining to the operation's result.
	ResultMetadata middleware.Metadata

	noSmithyDocumentSerde
}

func (c *Client) addOperationCreateDBInstanceMiddlewares(stack *middleware.Stack, options Options) (err error) {
	err = stack.Serialize.Add(&awsAwsquery_serializeOpCreateDBInstance{}, middleware.After)
	if err != nil {
		return err
	}
	err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCreateDBInstance{}, middleware.After)
	if err != nil {
		return err
	}
	if err = addSetLoggerMiddleware(stack, options); err != nil {
		return err
	}
	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
		return err
	}
	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
		return err
	}
	if err = addResolveEndpointMiddleware(stack, options); err != nil {
		return err
	}
	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
		return err
	}
	if err = addRetryMiddlewares(stack, options); err != nil {
		return err
	}
	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
		return err
	}
	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
		return err
	}
	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
		return err
	}
	if err = addClientUserAgent(stack); err != nil {
		return err
	}
	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
		return err
	}
	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
		return err
	}
	if err = addOpCreateDBInstanceValidationMiddleware(stack); err != nil {
		return err
	}
	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateDBInstance(options.Region), middleware.Before); 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
	}
	return nil
}

func newServiceMetadataMiddleware_opCreateDBInstance(region string) *awsmiddleware.RegisterServiceMetadata {
	return &awsmiddleware.RegisterServiceMetadata{
		Region:        region,
		ServiceID:     ServiceID,
		SigningName:   "rds",
		OperationName: "CreateDBInstance",
	}
}