1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package glacier
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	glaciercust "github.com/aws/aws-sdk-go-v2/service/glacier/internal/customizations"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// This operation lists all the tags attached to a vault. The operation returns an
15// empty map if there are no tags. For more information about tags, see Tagging
16// Amazon S3 Glacier Resources
17// (https://docs.aws.amazon.com/amazonglacier/latest/dev/tagging.html).
18func (c *Client) ListTagsForVault(ctx context.Context, params *ListTagsForVaultInput, optFns ...func(*Options)) (*ListTagsForVaultOutput, error) {
19	if params == nil {
20		params = &ListTagsForVaultInput{}
21	}
22
23	result, metadata, err := c.invokeOperation(ctx, "ListTagsForVault", params, optFns, c.addOperationListTagsForVaultMiddlewares)
24	if err != nil {
25		return nil, err
26	}
27
28	out := result.(*ListTagsForVaultOutput)
29	out.ResultMetadata = metadata
30	return out, nil
31}
32
33// The input value for ListTagsForVaultInput.
34type ListTagsForVaultInput struct {
35
36	// The AccountId value is the AWS account ID of the account that owns the vault.
37	// You can either specify an AWS account ID or optionally a single '-' (hyphen), in
38	// which case Amazon S3 Glacier uses the AWS account ID associated with the
39	// credentials used to sign the request. If you use an account ID, do not include
40	// any hyphens ('-') in the ID.
41	//
42	// This member is required.
43	AccountId *string
44
45	// The name of the vault.
46	//
47	// This member is required.
48	VaultName *string
49
50	noSmithyDocumentSerde
51}
52
53// Contains the Amazon S3 Glacier response to your request.
54type ListTagsForVaultOutput struct {
55
56	// The tags attached to the vault. Each tag is composed of a key and a value.
57	Tags map[string]string
58
59	// Metadata pertaining to the operation's result.
60	ResultMetadata middleware.Metadata
61
62	noSmithyDocumentSerde
63}
64
65func (c *Client) addOperationListTagsForVaultMiddlewares(stack *middleware.Stack, options Options) (err error) {
66	err = stack.Serialize.Add(&awsRestjson1_serializeOpListTagsForVault{}, middleware.After)
67	if err != nil {
68		return err
69	}
70	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListTagsForVault{}, middleware.After)
71	if err != nil {
72		return err
73	}
74	if err = addSetLoggerMiddleware(stack, options); err != nil {
75		return err
76	}
77	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
78		return err
79	}
80	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
81		return err
82	}
83	if err = addResolveEndpointMiddleware(stack, options); err != nil {
84		return err
85	}
86	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
87		return err
88	}
89	if err = addRetryMiddlewares(stack, options); err != nil {
90		return err
91	}
92	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
93		return err
94	}
95	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
96		return err
97	}
98	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
99		return err
100	}
101	if err = addClientUserAgent(stack); err != nil {
102		return err
103	}
104	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
105		return err
106	}
107	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
108		return err
109	}
110	if err = addOpListTagsForVaultValidationMiddleware(stack); err != nil {
111		return err
112	}
113	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListTagsForVault(options.Region), middleware.Before); err != nil {
114		return err
115	}
116	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
117		return err
118	}
119	if err = addResponseErrorMiddleware(stack); err != nil {
120		return err
121	}
122	if err = glaciercust.AddTreeHashMiddleware(stack); err != nil {
123		return err
124	}
125	if err = glaciercust.AddGlacierAPIVersionMiddleware(stack, ServiceAPIVersion); err != nil {
126		return err
127	}
128	if err = glaciercust.AddDefaultAccountIDMiddleware(stack, setDefaultAccountID); err != nil {
129		return err
130	}
131	if err = addRequestResponseLogging(stack, options); err != nil {
132		return err
133	}
134	return nil
135}
136
137func newServiceMetadataMiddleware_opListTagsForVault(region string) *awsmiddleware.RegisterServiceMetadata {
138	return &awsmiddleware.RegisterServiceMetadata{
139		Region:        region,
140		ServiceID:     ServiceID,
141		SigningName:   "glacier",
142		OperationName: "ListTagsForVault",
143	}
144}
145