1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package storagegateway
4
5import (
6	"context"
7	awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
8	"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
9	"github.com/aws/aws-sdk-go-v2/service/storagegateway/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Creates a virtual tape by using your own barcode. You write data to the virtual
15// tape and then archive the tape. A barcode is unique and cannot be reused if it
16// has already been used on a tape. This applies to barcodes used on deleted tapes.
17// This operation is only supported in the tape gateway type. Cache storage must be
18// allocated to the gateway before you can create a virtual tape. Use the AddCache
19// operation to add cache storage to a gateway.
20func (c *Client) CreateTapeWithBarcode(ctx context.Context, params *CreateTapeWithBarcodeInput, optFns ...func(*Options)) (*CreateTapeWithBarcodeOutput, error) {
21	if params == nil {
22		params = &CreateTapeWithBarcodeInput{}
23	}
24
25	result, metadata, err := c.invokeOperation(ctx, "CreateTapeWithBarcode", params, optFns, addOperationCreateTapeWithBarcodeMiddlewares)
26	if err != nil {
27		return nil, err
28	}
29
30	out := result.(*CreateTapeWithBarcodeOutput)
31	out.ResultMetadata = metadata
32	return out, nil
33}
34
35// CreateTapeWithBarcodeInput
36type CreateTapeWithBarcodeInput struct {
37
38	// The unique Amazon Resource Name (ARN) that represents the gateway to associate
39	// the virtual tape with. Use the ListGateways operation to return a list of
40	// gateways for your account and AWS Region.
41	//
42	// This member is required.
43	GatewayARN *string
44
45	// The barcode that you want to assign to the tape. Barcodes cannot be reused. This
46	// includes barcodes used for tapes that have been deleted.
47	//
48	// This member is required.
49	TapeBarcode *string
50
51	// The size, in bytes, of the virtual tape that you want to create. The size must
52	// be aligned by gigabyte (102410241024 bytes).
53	//
54	// This member is required.
55	TapeSizeInBytes *int64
56
57	// Set to true to use Amazon S3 server-side encryption with your own AWS KMS key,
58	// or false to use a key managed by Amazon S3. Optional. Valid Values: true | false
59	KMSEncrypted *bool
60
61	// The Amazon Resource Name (ARN) of a symmetric customer master key (CMK) used for
62	// Amazon S3 server-side encryption. Storage Gateway does not support asymmetric
63	// CMKs. This value can only be set when KMSEncrypted is true. Optional.
64	KMSKey *string
65
66	// The ID of the pool that you want to add your tape to for archiving. The tape in
67	// this pool is archived in the S3 storage class that is associated with the pool.
68	// When you use your backup application to eject the tape, the tape is archived
69	// directly into the storage class (S3 Glacier or S3 Deep Archive) that corresponds
70	// to the pool. Valid Values: GLACIER | DEEP_ARCHIVE
71	PoolId *string
72
73	// A list of up to 50 tags that can be assigned to a virtual tape that has a
74	// barcode. Each tag is a key-value pair. Valid characters for key and value are
75	// letters, spaces, and numbers representable in UTF-8 format, and the following
76	// special characters: + - = . _ : / @. The maximum length of a tag's key is 128
77	// characters, and the maximum length for a tag's value is 256.
78	Tags []types.Tag
79
80	// Set to TRUE if the tape you are creating is to be configured as a
81	// write-once-read-many (WORM) tape.
82	Worm bool
83}
84
85// CreateTapeOutput
86type CreateTapeWithBarcodeOutput struct {
87
88	// A unique Amazon Resource Name (ARN) that represents the virtual tape that was
89	// created.
90	TapeARN *string
91
92	// Metadata pertaining to the operation's result.
93	ResultMetadata middleware.Metadata
94}
95
96func addOperationCreateTapeWithBarcodeMiddlewares(stack *middleware.Stack, options Options) (err error) {
97	err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateTapeWithBarcode{}, middleware.After)
98	if err != nil {
99		return err
100	}
101	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateTapeWithBarcode{}, middleware.After)
102	if err != nil {
103		return err
104	}
105	if err = addSetLoggerMiddleware(stack, options); err != nil {
106		return err
107	}
108	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
109		return err
110	}
111	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
112		return err
113	}
114	if err = addResolveEndpointMiddleware(stack, options); err != nil {
115		return err
116	}
117	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
118		return err
119	}
120	if err = addRetryMiddlewares(stack, options); err != nil {
121		return err
122	}
123	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
124		return err
125	}
126	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
127		return err
128	}
129	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
130		return err
131	}
132	if err = addClientUserAgent(stack); err != nil {
133		return err
134	}
135	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
136		return err
137	}
138	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
139		return err
140	}
141	if err = addOpCreateTapeWithBarcodeValidationMiddleware(stack); err != nil {
142		return err
143	}
144	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateTapeWithBarcode(options.Region), middleware.Before); err != nil {
145		return err
146	}
147	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
148		return err
149	}
150	if err = addResponseErrorMiddleware(stack); err != nil {
151		return err
152	}
153	if err = addRequestResponseLogging(stack, options); err != nil {
154		return err
155	}
156	return nil
157}
158
159func newServiceMetadataMiddleware_opCreateTapeWithBarcode(region string) *awsmiddleware.RegisterServiceMetadata {
160	return &awsmiddleware.RegisterServiceMetadata{
161		Region:        region,
162		ServiceID:     ServiceID,
163		SigningName:   "storagegateway",
164		OperationName: "CreateTapeWithBarcode",
165	}
166}
167