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/smithy-go/middleware"
10	smithyhttp "github.com/aws/smithy-go/transport/http"
11)
12
13// Returns information about the cache of a gateway. This operation is only
14// supported in the cached volume, tape, and file gateway types. The response
15// includes disk IDs that are configured as cache, and it includes the amount of
16// cache allocated and used.
17func (c *Client) DescribeCache(ctx context.Context, params *DescribeCacheInput, optFns ...func(*Options)) (*DescribeCacheOutput, error) {
18	if params == nil {
19		params = &DescribeCacheInput{}
20	}
21
22	result, metadata, err := c.invokeOperation(ctx, "DescribeCache", params, optFns, addOperationDescribeCacheMiddlewares)
23	if err != nil {
24		return nil, err
25	}
26
27	out := result.(*DescribeCacheOutput)
28	out.ResultMetadata = metadata
29	return out, nil
30}
31
32type DescribeCacheInput struct {
33
34	// The Amazon Resource Name (ARN) of the gateway. Use the ListGateways operation to
35	// return a list of gateways for your account and AWS Region.
36	//
37	// This member is required.
38	GatewayARN *string
39}
40
41type DescribeCacheOutput struct {
42
43	// The amount of cache in bytes allocated to a gateway.
44	CacheAllocatedInBytes int64
45
46	// The file share's contribution to the overall percentage of the gateway's cache
47	// that has not been persisted to AWS. The sample is taken at the end of the
48	// reporting period.
49	CacheDirtyPercentage float64
50
51	// Percent of application read operations from the file shares that are served from
52	// cache. The sample is taken at the end of the reporting period.
53	CacheHitPercentage float64
54
55	// Percent of application read operations from the file shares that are not served
56	// from cache. The sample is taken at the end of the reporting period.
57	CacheMissPercentage float64
58
59	// Percent use of the gateway's cache storage. This metric applies only to the
60	// gateway-cached volume setup. The sample is taken at the end of the reporting
61	// period.
62	CacheUsedPercentage float64
63
64	// An array of strings that identify disks that are to be configured as working
65	// storage. Each string has a minimum length of 1 and maximum length of 300. You
66	// can get the disk IDs from the ListLocalDisks API.
67	DiskIds []string
68
69	// The Amazon Resource Name (ARN) of the gateway. Use the ListGateways operation to
70	// return a list of gateways for your account and AWS Region.
71	GatewayARN *string
72
73	// Metadata pertaining to the operation's result.
74	ResultMetadata middleware.Metadata
75}
76
77func addOperationDescribeCacheMiddlewares(stack *middleware.Stack, options Options) (err error) {
78	err = stack.Serialize.Add(&awsAwsjson11_serializeOpDescribeCache{}, middleware.After)
79	if err != nil {
80		return err
81	}
82	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDescribeCache{}, middleware.After)
83	if err != nil {
84		return err
85	}
86	if err = addSetLoggerMiddleware(stack, options); err != nil {
87		return err
88	}
89	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
90		return err
91	}
92	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
93		return err
94	}
95	if err = addResolveEndpointMiddleware(stack, options); err != nil {
96		return err
97	}
98	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
99		return err
100	}
101	if err = addRetryMiddlewares(stack, options); err != nil {
102		return err
103	}
104	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
105		return err
106	}
107	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
108		return err
109	}
110	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
111		return err
112	}
113	if err = addClientUserAgent(stack); err != nil {
114		return err
115	}
116	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
117		return err
118	}
119	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
120		return err
121	}
122	if err = addOpDescribeCacheValidationMiddleware(stack); err != nil {
123		return err
124	}
125	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeCache(options.Region), middleware.Before); err != nil {
126		return err
127	}
128	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
129		return err
130	}
131	if err = addResponseErrorMiddleware(stack); err != nil {
132		return err
133	}
134	if err = addRequestResponseLogging(stack, options); err != nil {
135		return err
136	}
137	return nil
138}
139
140func newServiceMetadataMiddleware_opDescribeCache(region string) *awsmiddleware.RegisterServiceMetadata {
141	return &awsmiddleware.RegisterServiceMetadata{
142		Region:        region,
143		ServiceID:     ServiceID,
144		SigningName:   "storagegateway",
145		OperationName: "DescribeCache",
146	}
147}
148