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