1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package kms 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/kms/types" 10 "github.com/aws/smithy-go/middleware" 11 smithyhttp "github.com/aws/smithy-go/transport/http" 12) 13 14// Returns all tags on the specified customer master key (CMK). For general 15// information about tags, including the format and syntax, see Tagging AWS 16// resources (https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html) in 17// the Amazon Web Services General Reference. For information about using tags in 18// AWS KMS, see Tagging keys 19// (https://docs.aws.amazon.com/kms/latest/developerguide/tagging-keys.html). 20// Cross-account use: No. You cannot perform this operation on a CMK in a different 21// AWS account. Required permissions: kms:ListResourceTags 22// (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) 23// (key policy) Related operations: 24// 25// * TagResource 26// 27// * UntagResource 28func (c *Client) ListResourceTags(ctx context.Context, params *ListResourceTagsInput, optFns ...func(*Options)) (*ListResourceTagsOutput, error) { 29 if params == nil { 30 params = &ListResourceTagsInput{} 31 } 32 33 result, metadata, err := c.invokeOperation(ctx, "ListResourceTags", params, optFns, addOperationListResourceTagsMiddlewares) 34 if err != nil { 35 return nil, err 36 } 37 38 out := result.(*ListResourceTagsOutput) 39 out.ResultMetadata = metadata 40 return out, nil 41} 42 43type ListResourceTagsInput struct { 44 45 // A unique identifier for the customer master key (CMK). Specify the key ID or the 46 // Amazon Resource Name (ARN) of the CMK. For example: 47 // 48 // * Key ID: 49 // 1234abcd-12ab-34cd-56ef-1234567890ab 50 // 51 // * Key ARN: 52 // arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab 53 // 54 // To 55 // get the key ID and key ARN for a CMK, use ListKeys or DescribeKey. 56 // 57 // This member is required. 58 KeyId *string 59 60 // Use this parameter to specify the maximum number of items to return. When this 61 // value is present, AWS KMS does not return more than the specified number of 62 // items, but it might return fewer. This value is optional. If you include a 63 // value, it must be between 1 and 50, inclusive. If you do not include a value, it 64 // defaults to 50. 65 Limit *int32 66 67 // Use this parameter in a subsequent request after you receive a response with 68 // truncated results. Set it to the value of NextMarker from the truncated response 69 // you just received. Do not attempt to construct this value. Use only the value of 70 // NextMarker from the truncated response you just received. 71 Marker *string 72} 73 74type ListResourceTagsOutput struct { 75 76 // When Truncated is true, this element is present and contains the value to use 77 // for the Marker parameter in a subsequent request. Do not assume or infer any 78 // information from this value. 79 NextMarker *string 80 81 // A list of tags. Each tag consists of a tag key and a tag value. 82 Tags []types.Tag 83 84 // A flag that indicates whether there are more items in the list. When this value 85 // is true, the list in this response is truncated. To get more items, pass the 86 // value of the NextMarker element in thisresponse to the Marker parameter in a 87 // subsequent request. 88 Truncated bool 89 90 // Metadata pertaining to the operation's result. 91 ResultMetadata middleware.Metadata 92} 93 94func addOperationListResourceTagsMiddlewares(stack *middleware.Stack, options Options) (err error) { 95 err = stack.Serialize.Add(&awsAwsjson11_serializeOpListResourceTags{}, middleware.After) 96 if err != nil { 97 return err 98 } 99 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpListResourceTags{}, middleware.After) 100 if err != nil { 101 return err 102 } 103 if err = addSetLoggerMiddleware(stack, options); err != nil { 104 return err 105 } 106 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 107 return err 108 } 109 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 110 return err 111 } 112 if err = addResolveEndpointMiddleware(stack, options); err != nil { 113 return err 114 } 115 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 116 return err 117 } 118 if err = addRetryMiddlewares(stack, options); err != nil { 119 return err 120 } 121 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 122 return err 123 } 124 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 125 return err 126 } 127 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 128 return err 129 } 130 if err = addClientUserAgent(stack); err != nil { 131 return err 132 } 133 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 134 return err 135 } 136 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 137 return err 138 } 139 if err = addOpListResourceTagsValidationMiddleware(stack); err != nil { 140 return err 141 } 142 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListResourceTags(options.Region), middleware.Before); err != nil { 143 return err 144 } 145 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 146 return err 147 } 148 if err = addResponseErrorMiddleware(stack); err != nil { 149 return err 150 } 151 if err = addRequestResponseLogging(stack, options); err != nil { 152 return err 153 } 154 return nil 155} 156 157func newServiceMetadataMiddleware_opListResourceTags(region string) *awsmiddleware.RegisterServiceMetadata { 158 return &awsmiddleware.RegisterServiceMetadata{ 159 Region: region, 160 ServiceID: ServiceID, 161 SigningName: "kms", 162 OperationName: "ListResourceTags", 163 } 164} 165