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 cached volume on a specified cached volume gateway. This operation is 15// only supported in the cached volume gateway type. Cache storage must be 16// allocated to the gateway before you can create a cached volume. Use the AddCache 17// operation to add cache storage to a gateway. In the request, you must specify 18// the gateway, size of the volume in bytes, the iSCSI target name, an IP address 19// on which to expose the target, and a unique client token. In response, the 20// gateway creates the volume and returns information about it. This information 21// includes the volume Amazon Resource Name (ARN), its size, and the iSCSI target 22// ARN that initiators can use to connect to the volume target. Optionally, you can 23// provide the ARN for an existing volume as the SourceVolumeARN for this cached 24// volume, which creates an exact copy of the existing volume’s latest recovery 25// point. The VolumeSizeInBytes value must be equal to or larger than the size of 26// the copied volume, in bytes. 27func (c *Client) CreateCachediSCSIVolume(ctx context.Context, params *CreateCachediSCSIVolumeInput, optFns ...func(*Options)) (*CreateCachediSCSIVolumeOutput, error) { 28 if params == nil { 29 params = &CreateCachediSCSIVolumeInput{} 30 } 31 32 result, metadata, err := c.invokeOperation(ctx, "CreateCachediSCSIVolume", params, optFns, addOperationCreateCachediSCSIVolumeMiddlewares) 33 if err != nil { 34 return nil, err 35 } 36 37 out := result.(*CreateCachediSCSIVolumeOutput) 38 out.ResultMetadata = metadata 39 return out, nil 40} 41 42type CreateCachediSCSIVolumeInput struct { 43 44 // A unique identifier that you use to retry a request. If you retry a request, use 45 // the same ClientToken you specified in the initial request. 46 // 47 // This member is required. 48 ClientToken *string 49 50 // The Amazon Resource Name (ARN) of the gateway. Use the ListGateways operation to 51 // return a list of gateways for your account and AWS Region. 52 // 53 // This member is required. 54 GatewayARN *string 55 56 // The network interface of the gateway on which to expose the iSCSI target. Only 57 // IPv4 addresses are accepted. Use DescribeGatewayInformation to get a list of the 58 // network interfaces available on a gateway. Valid Values: A valid IP address. 59 // 60 // This member is required. 61 NetworkInterfaceId *string 62 63 // The name of the iSCSI target used by an initiator to connect to a volume and 64 // used as a suffix for the target ARN. For example, specifying TargetName as 65 // myvolume results in the target ARN of 66 // arn:aws:storagegateway:us-east-2:111122223333:gateway/sgw-12A3456B/target/iqn.1997-05.com.amazon:myvolume. 67 // The target name must be unique across all volumes on a gateway. If you don't 68 // specify a value, Storage Gateway uses the value that was previously used for 69 // this volume as the new target name. 70 // 71 // This member is required. 72 TargetName *string 73 74 // The size of the volume in bytes. 75 // 76 // This member is required. 77 VolumeSizeInBytes int64 78 79 // Set to true to use Amazon S3 server-side encryption with your own AWS KMS key, 80 // or false to use a key managed by Amazon S3. Optional. Valid Values: true | false 81 KMSEncrypted *bool 82 83 // The Amazon Resource Name (ARN) of a symmetric customer master key (CMK) used for 84 // Amazon S3 server-side encryption. Storage Gateway does not support asymmetric 85 // CMKs. This value can only be set when KMSEncrypted is true. Optional. 86 KMSKey *string 87 88 // The snapshot ID (e.g. "snap-1122aabb") of the snapshot to restore as the new 89 // cached volume. Specify this field if you want to create the iSCSI storage volume 90 // from a snapshot; otherwise, do not include this field. To list snapshots for 91 // your account use DescribeSnapshots 92 // (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSnapshots.html) 93 // in the Amazon Elastic Compute Cloud API Reference. 94 SnapshotId *string 95 96 // The ARN for an existing volume. Specifying this ARN makes the new volume into an 97 // exact copy of the specified existing volume's latest recovery point. The 98 // VolumeSizeInBytes value for this new volume must be equal to or larger than the 99 // size of the existing volume, in bytes. 100 SourceVolumeARN *string 101 102 // A list of up to 50 tags that you can assign to a cached volume. Each tag is a 103 // key-value pair. Valid characters for key and value are letters, spaces, and 104 // numbers that you can represent in UTF-8 format, and the following special 105 // characters: + - = . _ : / @. The maximum length of a tag's key is 128 106 // characters, and the maximum length for a tag's value is 256 characters. 107 Tags []types.Tag 108} 109 110type CreateCachediSCSIVolumeOutput struct { 111 112 // The Amazon Resource Name (ARN) of the volume target, which includes the iSCSI 113 // name that initiators can use to connect to the target. 114 TargetARN *string 115 116 // The Amazon Resource Name (ARN) of the configured volume. 117 VolumeARN *string 118 119 // Metadata pertaining to the operation's result. 120 ResultMetadata middleware.Metadata 121} 122 123func addOperationCreateCachediSCSIVolumeMiddlewares(stack *middleware.Stack, options Options) (err error) { 124 err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateCachediSCSIVolume{}, middleware.After) 125 if err != nil { 126 return err 127 } 128 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateCachediSCSIVolume{}, middleware.After) 129 if err != nil { 130 return err 131 } 132 if err = addSetLoggerMiddleware(stack, options); err != nil { 133 return err 134 } 135 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 136 return err 137 } 138 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 139 return err 140 } 141 if err = addResolveEndpointMiddleware(stack, options); err != nil { 142 return err 143 } 144 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 145 return err 146 } 147 if err = addRetryMiddlewares(stack, options); err != nil { 148 return err 149 } 150 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 151 return err 152 } 153 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 154 return err 155 } 156 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 157 return err 158 } 159 if err = addClientUserAgent(stack); err != nil { 160 return err 161 } 162 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 163 return err 164 } 165 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 166 return err 167 } 168 if err = addOpCreateCachediSCSIVolumeValidationMiddleware(stack); err != nil { 169 return err 170 } 171 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateCachediSCSIVolume(options.Region), middleware.Before); err != nil { 172 return err 173 } 174 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 175 return err 176 } 177 if err = addResponseErrorMiddleware(stack); err != nil { 178 return err 179 } 180 if err = addRequestResponseLogging(stack, options); err != nil { 181 return err 182 } 183 return nil 184} 185 186func newServiceMetadataMiddleware_opCreateCachediSCSIVolume(region string) *awsmiddleware.RegisterServiceMetadata { 187 return &awsmiddleware.RegisterServiceMetadata{ 188 Region: region, 189 ServiceID: ServiceID, 190 SigningName: "storagegateway", 191 OperationName: "CreateCachediSCSIVolume", 192 } 193} 194