1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package computeoptimizer 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/computeoptimizer/types" 10 "github.com/aws/smithy-go/middleware" 11 smithyhttp "github.com/aws/smithy-go/transport/http" 12) 13 14// Exports optimization recommendations for Auto Scaling groups. Recommendations 15// are exported in a comma-separated values (.csv) file, and its metadata in a 16// JavaScript Object Notation (.json) file, to an existing Amazon Simple Storage 17// Service (Amazon S3) bucket that you specify. For more information, see Exporting 18// Recommendations 19// (https://docs.aws.amazon.com/compute-optimizer/latest/ug/exporting-recommendations.html) 20// in the Compute Optimizer User Guide. You can have only one Auto Scaling group 21// export job in progress per AWS Region. 22func (c *Client) ExportAutoScalingGroupRecommendations(ctx context.Context, params *ExportAutoScalingGroupRecommendationsInput, optFns ...func(*Options)) (*ExportAutoScalingGroupRecommendationsOutput, error) { 23 if params == nil { 24 params = &ExportAutoScalingGroupRecommendationsInput{} 25 } 26 27 result, metadata, err := c.invokeOperation(ctx, "ExportAutoScalingGroupRecommendations", params, optFns, addOperationExportAutoScalingGroupRecommendationsMiddlewares) 28 if err != nil { 29 return nil, err 30 } 31 32 out := result.(*ExportAutoScalingGroupRecommendationsOutput) 33 out.ResultMetadata = metadata 34 return out, nil 35} 36 37type ExportAutoScalingGroupRecommendationsInput struct { 38 39 // An object to specify the destination Amazon Simple Storage Service (Amazon S3) 40 // bucket name and key prefix for the export job. You must create the destination 41 // Amazon S3 bucket for your recommendations export before you create the export 42 // job. Compute Optimizer does not create the S3 bucket for you. After you create 43 // the S3 bucket, ensure that it has the required permission policy to allow 44 // Compute Optimizer to write the export file to it. If you plan to specify an 45 // object prefix when you create the export job, you must include the object prefix 46 // in the policy that you add to the S3 bucket. For more information, see Amazon S3 47 // Bucket Policy for Compute Optimizer 48 // (https://docs.aws.amazon.com/compute-optimizer/latest/ug/create-s3-bucket-policy-for-compute-optimizer.html) 49 // in the Compute Optimizer user guide. 50 // 51 // This member is required. 52 S3DestinationConfig *types.S3DestinationConfig 53 54 // The IDs of the AWS accounts for which to export Auto Scaling group 55 // recommendations. If your account is the management account of an organization, 56 // use this parameter to specify the member account for which you want to export 57 // recommendations. This parameter cannot be specified together with the include 58 // member accounts parameter. The parameters are mutually exclusive. 59 // Recommendations for member accounts are not included in the export if this 60 // parameter, or the include member accounts parameter, is omitted. You can specify 61 // multiple account IDs per request. 62 AccountIds []string 63 64 // The recommendations data to include in the export file. For more information 65 // about the fields that can be exported, see Exported files 66 // (https://docs.aws.amazon.com/compute-optimizer/latest/ug/exporting-recommendations.html#exported-files) 67 // in the Compute Optimizer User Guide. 68 FieldsToExport []types.ExportableAutoScalingGroupField 69 70 // The format of the export file. The only export file format currently supported 71 // is Csv. 72 FileFormat types.FileFormat 73 74 // An array of objects that describe a filter to export a more specific set of Auto 75 // Scaling group recommendations. 76 Filters []types.Filter 77 78 // Indicates whether to include recommendations for resources in all member 79 // accounts of the organization if your account is the management account of an 80 // organization. The member accounts must also be opted in to Compute Optimizer. 81 // Recommendations for member accounts of the organization are not included in the 82 // export file if this parameter is omitted. This parameter cannot be specified 83 // together with the account IDs parameter. The parameters are mutually exclusive. 84 // Recommendations for member accounts are not included in the export if this 85 // parameter, or the account IDs parameter, is omitted. 86 IncludeMemberAccounts bool 87} 88 89type ExportAutoScalingGroupRecommendationsOutput struct { 90 91 // The identification number of the export job. Use the 92 // DescribeRecommendationExportJobs action, and specify the job ID to view the 93 // status of an export job. 94 JobId *string 95 96 // An object that describes the destination Amazon S3 bucket of a recommendations 97 // export file. 98 S3Destination *types.S3Destination 99 100 // Metadata pertaining to the operation's result. 101 ResultMetadata middleware.Metadata 102} 103 104func addOperationExportAutoScalingGroupRecommendationsMiddlewares(stack *middleware.Stack, options Options) (err error) { 105 err = stack.Serialize.Add(&awsAwsjson10_serializeOpExportAutoScalingGroupRecommendations{}, middleware.After) 106 if err != nil { 107 return err 108 } 109 err = stack.Deserialize.Add(&awsAwsjson10_deserializeOpExportAutoScalingGroupRecommendations{}, middleware.After) 110 if err != nil { 111 return err 112 } 113 if err = addSetLoggerMiddleware(stack, options); err != nil { 114 return err 115 } 116 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 117 return err 118 } 119 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 120 return err 121 } 122 if err = addResolveEndpointMiddleware(stack, options); err != nil { 123 return err 124 } 125 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 126 return err 127 } 128 if err = addRetryMiddlewares(stack, options); err != nil { 129 return err 130 } 131 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 132 return err 133 } 134 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 135 return err 136 } 137 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 138 return err 139 } 140 if err = addClientUserAgent(stack); err != nil { 141 return err 142 } 143 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 144 return err 145 } 146 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 147 return err 148 } 149 if err = addOpExportAutoScalingGroupRecommendationsValidationMiddleware(stack); err != nil { 150 return err 151 } 152 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opExportAutoScalingGroupRecommendations(options.Region), middleware.Before); err != nil { 153 return err 154 } 155 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 156 return err 157 } 158 if err = addResponseErrorMiddleware(stack); err != nil { 159 return err 160 } 161 if err = addRequestResponseLogging(stack, options); err != nil { 162 return err 163 } 164 return nil 165} 166 167func newServiceMetadataMiddleware_opExportAutoScalingGroupRecommendations(region string) *awsmiddleware.RegisterServiceMetadata { 168 return &awsmiddleware.RegisterServiceMetadata{ 169 Region: region, 170 ServiceID: ServiceID, 171 SigningName: "compute-optimizer", 172 OperationName: "ExportAutoScalingGroupRecommendations", 173 } 174} 175