api_op_GetContainerServiceMetricData.go raw

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