1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package ec2 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/ec2/types" 10 "github.com/aws/smithy-go/middleware" 11 smithyhttp "github.com/aws/smithy-go/transport/http" 12) 13 14// Describes the specified attribute of the specified instance. You can specify 15// only one attribute at a time. Valid attribute values are: instanceType | kernel 16// | ramdisk | userData | disableApiTermination | instanceInitiatedShutdownBehavior 17// | rootDeviceName | blockDeviceMapping | productCodes | sourceDestCheck | 18// groupSet | ebsOptimized | sriovNetSupport 19func (c *Client) DescribeInstanceAttribute(ctx context.Context, params *DescribeInstanceAttributeInput, optFns ...func(*Options)) (*DescribeInstanceAttributeOutput, error) { 20 if params == nil { 21 params = &DescribeInstanceAttributeInput{} 22 } 23 24 result, metadata, err := c.invokeOperation(ctx, "DescribeInstanceAttribute", params, optFns, addOperationDescribeInstanceAttributeMiddlewares) 25 if err != nil { 26 return nil, err 27 } 28 29 out := result.(*DescribeInstanceAttributeOutput) 30 out.ResultMetadata = metadata 31 return out, nil 32} 33 34type DescribeInstanceAttributeInput struct { 35 36 // The instance attribute. Note: The enaSupport attribute is not supported at this 37 // time. 38 // 39 // This member is required. 40 Attribute types.InstanceAttributeName 41 42 // The ID of the instance. 43 // 44 // This member is required. 45 InstanceId *string 46 47 // Checks whether you have the required permissions for the action, without 48 // actually making the request, and provides an error response. If you have the 49 // required permissions, the error response is DryRunOperation. Otherwise, it is 50 // UnauthorizedOperation. 51 DryRun bool 52} 53 54// Describes an instance attribute. 55type DescribeInstanceAttributeOutput struct { 56 57 // The block device mapping of the instance. 58 BlockDeviceMappings []types.InstanceBlockDeviceMapping 59 60 // If the value is true, you can't terminate the instance through the Amazon EC2 61 // console, CLI, or API; otherwise, you can. 62 DisableApiTermination *types.AttributeBooleanValue 63 64 // Indicates whether the instance is optimized for Amazon EBS I/O. 65 EbsOptimized *types.AttributeBooleanValue 66 67 // Indicates whether enhanced networking with ENA is enabled. 68 EnaSupport *types.AttributeBooleanValue 69 70 // To enable the instance for AWS Nitro Enclaves, set this parameter to true; 71 // otherwise, set it to false. 72 EnclaveOptions *types.EnclaveOptions 73 74 // The security groups associated with the instance. 75 Groups []types.GroupIdentifier 76 77 // The ID of the instance. 78 InstanceId *string 79 80 // Indicates whether an instance stops or terminates when you initiate shutdown 81 // from the instance (using the operating system command for system shutdown). 82 InstanceInitiatedShutdownBehavior *types.AttributeValue 83 84 // The instance type. 85 InstanceType *types.AttributeValue 86 87 // The kernel ID. 88 KernelId *types.AttributeValue 89 90 // A list of product codes. 91 ProductCodes []types.ProductCode 92 93 // The RAM disk ID. 94 RamdiskId *types.AttributeValue 95 96 // The device name of the root device volume (for example, /dev/sda1). 97 RootDeviceName *types.AttributeValue 98 99 // Indicates whether source/destination checking is enabled. A value of true means 100 // that checking is enabled, and false means that checking is disabled. This value 101 // must be false for a NAT instance to perform NAT. 102 SourceDestCheck *types.AttributeBooleanValue 103 104 // Indicates whether enhanced networking with the Intel 82599 Virtual Function 105 // interface is enabled. 106 SriovNetSupport *types.AttributeValue 107 108 // The user data. 109 UserData *types.AttributeValue 110 111 // Metadata pertaining to the operation's result. 112 ResultMetadata middleware.Metadata 113} 114 115func addOperationDescribeInstanceAttributeMiddlewares(stack *middleware.Stack, options Options) (err error) { 116 err = stack.Serialize.Add(&awsEc2query_serializeOpDescribeInstanceAttribute{}, middleware.After) 117 if err != nil { 118 return err 119 } 120 err = stack.Deserialize.Add(&awsEc2query_deserializeOpDescribeInstanceAttribute{}, middleware.After) 121 if err != nil { 122 return err 123 } 124 if err = addSetLoggerMiddleware(stack, options); err != nil { 125 return err 126 } 127 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 128 return err 129 } 130 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 131 return err 132 } 133 if err = addResolveEndpointMiddleware(stack, options); err != nil { 134 return err 135 } 136 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 137 return err 138 } 139 if err = addRetryMiddlewares(stack, options); err != nil { 140 return err 141 } 142 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 143 return err 144 } 145 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 146 return err 147 } 148 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 149 return err 150 } 151 if err = addClientUserAgent(stack); err != nil { 152 return err 153 } 154 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 155 return err 156 } 157 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 158 return err 159 } 160 if err = addOpDescribeInstanceAttributeValidationMiddleware(stack); err != nil { 161 return err 162 } 163 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeInstanceAttribute(options.Region), middleware.Before); err != nil { 164 return err 165 } 166 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 167 return err 168 } 169 if err = addResponseErrorMiddleware(stack); err != nil { 170 return err 171 } 172 if err = addRequestResponseLogging(stack, options); err != nil { 173 return err 174 } 175 return nil 176} 177 178func newServiceMetadataMiddleware_opDescribeInstanceAttribute(region string) *awsmiddleware.RegisterServiceMetadata { 179 return &awsmiddleware.RegisterServiceMetadata{ 180 Region: region, 181 ServiceID: ServiceID, 182 SigningName: "ec2", 183 OperationName: "DescribeInstanceAttribute", 184 } 185} 186