1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
|
// Code generated by smithy-go-codegen DO NOT EDIT.
package computeoptimizer
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/computeoptimizer/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns the recommendation preferences that are in effect for a given resource,
// such as enhanced infrastructure metrics. Considers all applicable preferences
// that you might have set at the resource, account, and organization level. When
// you create a recommendation preference, you can set its status to Active or
// Inactive . Use this action to view the recommendation preferences that are in
// effect, or Active .
func (c *Client) GetEffectiveRecommendationPreferences(ctx context.Context, params *GetEffectiveRecommendationPreferencesInput, optFns ...func(*Options)) (*GetEffectiveRecommendationPreferencesOutput, error) {
if params == nil {
params = &GetEffectiveRecommendationPreferencesInput{}
}
result, metadata, err := c.invokeOperation(ctx, "GetEffectiveRecommendationPreferences", params, optFns, c.addOperationGetEffectiveRecommendationPreferencesMiddlewares)
if err != nil {
return nil, err
}
out := result.(*GetEffectiveRecommendationPreferencesOutput)
out.ResultMetadata = metadata
return out, nil
}
type GetEffectiveRecommendationPreferencesInput struct {
// The Amazon Resource Name (ARN) of the resource for which to confirm effective
// recommendation preferences. Only EC2 instance and Auto Scaling group ARNs are
// currently supported.
//
// This member is required.
ResourceArn *string
noSmithyDocumentSerde
}
type GetEffectiveRecommendationPreferencesOutput struct {
// The status of the enhanced infrastructure metrics recommendation preference.
// Considers all applicable preferences that you might have set at the resource,
// account, and organization level. A status of Active confirms that the
// preference is applied in the latest recommendation refresh, and a status of
// Inactive confirms that it's not yet applied to recommendations. To validate
// whether the preference is applied to your last generated set of recommendations,
// review the effectiveRecommendationPreferences value in the response of the
// GetAutoScalingGroupRecommendations and GetEC2InstanceRecommendations actions.
// For more information, see Enhanced infrastructure metrics (https://docs.aws.amazon.com/compute-optimizer/latest/ug/enhanced-infrastructure-metrics.html)
// in the Compute Optimizer User Guide.
EnhancedInfrastructureMetrics types.EnhancedInfrastructureMetrics
// The provider of the external metrics recommendation preference. Considers all
// applicable preferences that you might have set at the account and organization
// level. If the preference is applied in the latest recommendation refresh, an
// object with a valid source value appears in the response. If the preference
// isn't applied to the recommendations already, then this object doesn't appear in
// the response. To validate whether the preference is applied to your last
// generated set of recommendations, review the effectiveRecommendationPreferences
// value in the response of the GetEC2InstanceRecommendations actions. For more
// information, see Enhanced infrastructure metrics (https://docs.aws.amazon.com/compute-optimizer/latest/ug/external-metrics-ingestion.html)
// in the Compute Optimizer User Guide.
ExternalMetricsPreference *types.ExternalMetricsPreference
// The number of days the utilization metrics of the Amazon Web Services resource
// are analyzed. To validate that the preference is applied to your last generated
// set of recommendations, review the effectiveRecommendationPreferences value in
// the response of the GetAutoScalingGroupRecommendations or
// GetEC2InstanceRecommendations actions.
LookBackPeriod types.LookBackPeriodPreference
// The resource type values that are considered as candidates when generating
// rightsizing recommendations. This object resolves any wildcard expressions and
// returns the effective list of candidate resource type values. It also considers
// all applicable preferences that you set at the resource, account, and
// organization level. To validate that the preference is applied to your last
// generated set of recommendations, review the effectiveRecommendationPreferences
// value in the response of the GetAutoScalingGroupRecommendations or
// GetEC2InstanceRecommendations actions.
PreferredResources []types.EffectivePreferredResource
// The resource’s CPU utilization threshold preferences, such as threshold and
// headroom, that were used to generate rightsizing recommendations. It considers
// all applicable preferences that you set at the resource, account, and
// organization level. To validate that the preference is applied to your last
// generated set of recommendations, review the effectiveRecommendationPreferences
// value in the response of the GetAutoScalingGroupRecommendations or
// GetEC2InstanceRecommendations actions.
UtilizationPreferences []types.UtilizationPreference
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationGetEffectiveRecommendationPreferencesMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson10_serializeOpGetEffectiveRecommendationPreferences{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson10_deserializeOpGetEffectiveRecommendationPreferences{}, middleware.After)
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "GetEffectiveRecommendationPreferences"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpGetEffectiveRecommendationPreferencesValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetEffectiveRecommendationPreferences(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opGetEffectiveRecommendationPreferences(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
OperationName: "GetEffectiveRecommendationPreferences",
}
}
|