1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package lightsail 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/lightsail/types" 10 "github.com/aws/smithy-go/middleware" 11 smithyhttp "github.com/aws/smithy-go/transport/http" 12 "time" 13) 14 15// Returns the data points of a specific metric of your Amazon Lightsail container 16// service. Metrics report the utilization of your resources. Monitor and collect 17// metric data regularly to maintain the reliability, availability, and performance 18// of your resources. 19func (c *Client) GetContainerServiceMetricData(ctx context.Context, params *GetContainerServiceMetricDataInput, optFns ...func(*Options)) (*GetContainerServiceMetricDataOutput, error) { 20 if params == nil { 21 params = &GetContainerServiceMetricDataInput{} 22 } 23 24 result, metadata, err := c.invokeOperation(ctx, "GetContainerServiceMetricData", params, optFns, addOperationGetContainerServiceMetricDataMiddlewares) 25 if err != nil { 26 return nil, err 27 } 28 29 out := result.(*GetContainerServiceMetricDataOutput) 30 out.ResultMetadata = metadata 31 return out, nil 32} 33 34type GetContainerServiceMetricDataInput struct { 35 36 // The end time of the time period. 37 // 38 // This member is required. 39 EndTime *time.Time 40 41 // The metric for which you want to return information. Valid container service 42 // metric names are listed below, along with the most useful statistics to include 43 // in your request, and the published unit value. 44 // 45 // * CPUUtilization - The average 46 // percentage of compute units that are currently in use across all nodes of the 47 // container service. This metric identifies the processing power required to run 48 // containers on each node of the container service. Statistics: The most useful 49 // statistics are Maximum and Average. Unit: The published unit is Percent. 50 // 51 // * 52 // MemoryUtilization - The average percentage of available memory that is currently 53 // in use across all nodes of the container service. This metric identifies the 54 // memory required to run containers on each node of the container service. 55 // Statistics: The most useful statistics are Maximum and Average. Unit: The 56 // published unit is Percent. 57 // 58 // This member is required. 59 MetricName types.ContainerServiceMetricName 60 61 // The granularity, in seconds, of the returned data points. All container service 62 // metric data is available in 5-minute (300 seconds) granularity. 63 // 64 // This member is required. 65 Period int32 66 67 // The name of the container service for which to get metric data. 68 // 69 // This member is required. 70 ServiceName *string 71 72 // The start time of the time period. 73 // 74 // This member is required. 75 StartTime *time.Time 76 77 // The statistic for the metric. The following statistics are available: 78 // 79 // * Minimum 80 // - The lowest value observed during the specified period. Use this value to 81 // determine low volumes of activity for your application. 82 // 83 // * Maximum - The highest 84 // value observed during the specified period. Use this value to determine high 85 // volumes of activity for your application. 86 // 87 // * Sum - All values submitted for the 88 // matching metric added together. You can use this statistic to determine the 89 // total volume of a metric. 90 // 91 // * Average - The value of Sum / SampleCount during the 92 // specified period. By comparing this statistic with the Minimum and Maximum 93 // values, you can determine the full scope of a metric and how close the average 94 // use is to the Minimum and Maximum values. This comparison helps you to know when 95 // to increase or decrease your resources. 96 // 97 // * SampleCount - The count, or number, 98 // of data points used for the statistical calculation. 99 // 100 // This member is required. 101 Statistics []types.MetricStatistic 102} 103 104type GetContainerServiceMetricDataOutput struct { 105 106 // An array of objects that describe the metric data returned. 107 MetricData []types.MetricDatapoint 108 109 // The name of the metric returned. 110 MetricName types.ContainerServiceMetricName 111 112 // Metadata pertaining to the operation's result. 113 ResultMetadata middleware.Metadata 114} 115 116func addOperationGetContainerServiceMetricDataMiddlewares(stack *middleware.Stack, options Options) (err error) { 117 err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetContainerServiceMetricData{}, middleware.After) 118 if err != nil { 119 return err 120 } 121 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetContainerServiceMetricData{}, middleware.After) 122 if err != nil { 123 return err 124 } 125 if err = addSetLoggerMiddleware(stack, options); err != nil { 126 return err 127 } 128 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 129 return err 130 } 131 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 132 return err 133 } 134 if err = addResolveEndpointMiddleware(stack, options); err != nil { 135 return err 136 } 137 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 138 return err 139 } 140 if err = addRetryMiddlewares(stack, options); err != nil { 141 return err 142 } 143 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 144 return err 145 } 146 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 147 return err 148 } 149 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 150 return err 151 } 152 if err = addClientUserAgent(stack); err != nil { 153 return err 154 } 155 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 156 return err 157 } 158 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 159 return err 160 } 161 if err = addOpGetContainerServiceMetricDataValidationMiddleware(stack); err != nil { 162 return err 163 } 164 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetContainerServiceMetricData(options.Region), middleware.Before); err != nil { 165 return err 166 } 167 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 168 return err 169 } 170 if err = addResponseErrorMiddleware(stack); err != nil { 171 return err 172 } 173 if err = addRequestResponseLogging(stack, options); err != nil { 174 return err 175 } 176 return nil 177} 178 179func newServiceMetadataMiddleware_opGetContainerServiceMetricData(region string) *awsmiddleware.RegisterServiceMetadata { 180 return &awsmiddleware.RegisterServiceMetadata{ 181 Region: region, 182 ServiceID: ServiceID, 183 SigningName: "lightsail", 184 OperationName: "GetContainerServiceMetricData", 185 } 186} 187