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 one or more virtual tapes. You write data to the virtual tapes and then 15// archive the tapes. This operation is only supported in the tape gateway type. 16// Cache storage must be allocated to the gateway before you can create virtual 17// tapes. Use the AddCache operation to add cache storage to a gateway. 18func (c *Client) CreateTapes(ctx context.Context, params *CreateTapesInput, optFns ...func(*Options)) (*CreateTapesOutput, error) { 19 if params == nil { 20 params = &CreateTapesInput{} 21 } 22 23 result, metadata, err := c.invokeOperation(ctx, "CreateTapes", params, optFns, addOperationCreateTapesMiddlewares) 24 if err != nil { 25 return nil, err 26 } 27 28 out := result.(*CreateTapesOutput) 29 out.ResultMetadata = metadata 30 return out, nil 31} 32 33// CreateTapesInput 34type CreateTapesInput struct { 35 36 // A unique identifier that you use to retry a request. If you retry a request, use 37 // the same ClientToken you specified in the initial request. Using the same 38 // ClientToken prevents creating the tape multiple times. 39 // 40 // This member is required. 41 ClientToken *string 42 43 // The unique Amazon Resource Name (ARN) that represents the gateway to associate 44 // the virtual tapes with. Use the ListGateways operation to return a list of 45 // gateways for your account and AWS Region. 46 // 47 // This member is required. 48 GatewayARN *string 49 50 // The number of virtual tapes that you want to create. 51 // 52 // This member is required. 53 NumTapesToCreate *int32 54 55 // A prefix that you append to the barcode of the virtual tape you are creating. 56 // This prefix makes the barcode unique. The prefix must be 1 to 4 characters in 57 // length and must be one of the uppercase letters from A to Z. 58 // 59 // This member is required. 60 TapeBarcodePrefix *string 61 62 // The size, in bytes, of the virtual tapes that you want to create. The size must 63 // be aligned by gigabyte (102410241024 bytes). 64 // 65 // This member is required. 66 TapeSizeInBytes *int64 67 68 // Set to true to use Amazon S3 server-side encryption with your own AWS KMS key, 69 // or false to use a key managed by Amazon S3. Optional. Valid Values: true | false 70 KMSEncrypted *bool 71 72 // The Amazon Resource Name (ARN) of a symmetric customer master key (CMK) used for 73 // Amazon S3 server-side encryption. Storage Gateway does not support asymmetric 74 // CMKs. This value can only be set when KMSEncrypted is true. Optional. 75 KMSKey *string 76 77 // The ID of the pool that you want to add your tape to for archiving. The tape in 78 // this pool is archived in the S3 storage class that is associated with the pool. 79 // When you use your backup application to eject the tape, the tape is archived 80 // directly into the storage class (S3 Glacier or S3 Glacier Deep Archive) that 81 // corresponds to the pool. Valid Values: GLACIER | DEEP_ARCHIVE 82 PoolId *string 83 84 // A list of up to 50 tags that can be assigned to a virtual tape. Each tag is a 85 // key-value pair. Valid characters for key and value are letters, spaces, and 86 // numbers representable in UTF-8 format, and the following special characters: + - 87 // = . _ : / @. The maximum length of a tag's key is 128 characters, and the 88 // maximum length for a tag's value is 256. 89 Tags []types.Tag 90 91 // Set to TRUE if the tape you are creating is to be configured as a 92 // write-once-read-many (WORM) tape. 93 Worm bool 94} 95 96// CreateTapeOutput 97type CreateTapesOutput struct { 98 99 // A list of unique Amazon Resource Names (ARNs) that represents the virtual tapes 100 // that were created. 101 TapeARNs []string 102 103 // Metadata pertaining to the operation's result. 104 ResultMetadata middleware.Metadata 105} 106 107func addOperationCreateTapesMiddlewares(stack *middleware.Stack, options Options) (err error) { 108 err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateTapes{}, middleware.After) 109 if err != nil { 110 return err 111 } 112 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateTapes{}, middleware.After) 113 if err != nil { 114 return err 115 } 116 if err = addSetLoggerMiddleware(stack, options); err != nil { 117 return err 118 } 119 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 120 return err 121 } 122 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 123 return err 124 } 125 if err = addResolveEndpointMiddleware(stack, options); err != nil { 126 return err 127 } 128 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 129 return err 130 } 131 if err = addRetryMiddlewares(stack, options); err != nil { 132 return err 133 } 134 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 135 return err 136 } 137 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 138 return err 139 } 140 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 141 return err 142 } 143 if err = addClientUserAgent(stack); err != nil { 144 return err 145 } 146 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 147 return err 148 } 149 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 150 return err 151 } 152 if err = addOpCreateTapesValidationMiddleware(stack); err != nil { 153 return err 154 } 155 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateTapes(options.Region), middleware.Before); err != nil { 156 return err 157 } 158 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 159 return err 160 } 161 if err = addResponseErrorMiddleware(stack); err != nil { 162 return err 163 } 164 if err = addRequestResponseLogging(stack, options); err != nil { 165 return err 166 } 167 return nil 168} 169 170func newServiceMetadataMiddleware_opCreateTapes(region string) *awsmiddleware.RegisterServiceMetadata { 171 return &awsmiddleware.RegisterServiceMetadata{ 172 Region: region, 173 ServiceID: ServiceID, 174 SigningName: "storagegateway", 175 OperationName: "CreateTapes", 176 } 177} 178