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, 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
51// Contains the Amazon S3 Glacier response to your request.
52type ListTagsForVaultOutput struct {
53
54	// The tags attached to the vault. Each tag is composed of a key and a value.
55	Tags map[string]string
56
57	// Metadata pertaining to the operation's result.
58	ResultMetadata middleware.Metadata
59}
60
61func addOperationListTagsForVaultMiddlewares(stack *middleware.Stack, options Options) (err error) {
62	err = stack.Serialize.Add(&awsRestjson1_serializeOpListTagsForVault{}, middleware.After)
63	if err != nil {
64		return err
65	}
66	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListTagsForVault{}, middleware.After)
67	if err != nil {
68		return err
69	}
70	if err = addSetLoggerMiddleware(stack, options); err != nil {
71		return err
72	}
73	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
74		return err
75	}
76	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
77		return err
78	}
79	if err = addResolveEndpointMiddleware(stack, options); err != nil {
80		return err
81	}
82	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
83		return err
84	}
85	if err = addRetryMiddlewares(stack, options); err != nil {
86		return err
87	}
88	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
89		return err
90	}
91	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
92		return err
93	}
94	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
95		return err
96	}
97	if err = addClientUserAgent(stack); err != nil {
98		return err
99	}
100	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
101		return err
102	}
103	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
104		return err
105	}
106	if err = addOpListTagsForVaultValidationMiddleware(stack); err != nil {
107		return err
108	}
109	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListTagsForVault(options.Region), middleware.Before); err != nil {
110		return err
111	}
112	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
113		return err
114	}
115	if err = addResponseErrorMiddleware(stack); err != nil {
116		return err
117	}
118	if err = glaciercust.AddTreeHashMiddleware(stack); err != nil {
119		return err
120	}
121	if err = glaciercust.AddGlacierAPIVersionMiddleware(stack, ServiceAPIVersion); err != nil {
122		return err
123	}
124	if err = glaciercust.AddDefaultAccountIDMiddleware(stack, setDefaultAccountID); err != nil {
125		return err
126	}
127	if err = addRequestResponseLogging(stack, options); err != nil {
128		return err
129	}
130	return nil
131}
132
133func newServiceMetadataMiddleware_opListTagsForVault(region string) *awsmiddleware.RegisterServiceMetadata {
134	return &awsmiddleware.RegisterServiceMetadata{
135		Region:        region,
136		ServiceID:     ServiceID,
137		SigningName:   "glacier",
138		OperationName: "ListTagsForVault",
139	}
140}
141