1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package cloudtrail 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/cloudtrail/types" 10 "github.com/aws/smithy-go/middleware" 11 smithyhttp "github.com/aws/smithy-go/transport/http" 12) 13 14// Describes the settings for the Insights event selectors that you configured for 15// your trail. GetInsightSelectors shows if CloudTrail Insights event logging is 16// enabled on the trail, and if it is, which insight types are enabled. If you run 17// GetInsightSelectors on a trail that does not have Insights events enabled, the 18// operation throws the exception InsightNotEnabledException For more information, 19// see Logging CloudTrail Insights Events for Trails 20// (https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-insights-events-with-cloudtrail.html) 21// in the AWS CloudTrail User Guide. 22func (c *Client) GetInsightSelectors(ctx context.Context, params *GetInsightSelectorsInput, optFns ...func(*Options)) (*GetInsightSelectorsOutput, error) { 23 if params == nil { 24 params = &GetInsightSelectorsInput{} 25 } 26 27 result, metadata, err := c.invokeOperation(ctx, "GetInsightSelectors", params, optFns, addOperationGetInsightSelectorsMiddlewares) 28 if err != nil { 29 return nil, err 30 } 31 32 out := result.(*GetInsightSelectorsOutput) 33 out.ResultMetadata = metadata 34 return out, nil 35} 36 37type GetInsightSelectorsInput struct { 38 39 // Specifies the name of the trail or trail ARN. If you specify a trail name, the 40 // string must meet the following requirements: 41 // 42 // * Contain only ASCII letters (a-z, 43 // A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-) 44 // 45 // * Start with a 46 // letter or number, and end with a letter or number 47 // 48 // * Be between 3 and 128 49 // characters 50 // 51 // * Have no adjacent periods, underscores or dashes. Names like 52 // my-_namespace and my--namespace are not valid. 53 // 54 // * Not be in IP address format 55 // (for example, 192.168.5.4) 56 // 57 // If you specify a trail ARN, it must be in the 58 // format: arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail 59 // 60 // This member is required. 61 TrailName *string 62} 63 64type GetInsightSelectorsOutput struct { 65 66 // A JSON string that contains the insight types you want to log on a trail. In 67 // this release, only ApiCallRateInsight is supported as an insight type. 68 InsightSelectors []types.InsightSelector 69 70 // The Amazon Resource Name (ARN) of a trail for which you want to get Insights 71 // selectors. 72 TrailARN *string 73 74 // Metadata pertaining to the operation's result. 75 ResultMetadata middleware.Metadata 76} 77 78func addOperationGetInsightSelectorsMiddlewares(stack *middleware.Stack, options Options) (err error) { 79 err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetInsightSelectors{}, middleware.After) 80 if err != nil { 81 return err 82 } 83 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetInsightSelectors{}, middleware.After) 84 if err != nil { 85 return err 86 } 87 if err = addSetLoggerMiddleware(stack, options); err != nil { 88 return err 89 } 90 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 91 return err 92 } 93 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 94 return err 95 } 96 if err = addResolveEndpointMiddleware(stack, options); err != nil { 97 return err 98 } 99 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 100 return err 101 } 102 if err = addRetryMiddlewares(stack, options); err != nil { 103 return err 104 } 105 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 106 return err 107 } 108 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 109 return err 110 } 111 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 112 return err 113 } 114 if err = addClientUserAgent(stack); err != nil { 115 return err 116 } 117 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 118 return err 119 } 120 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 121 return err 122 } 123 if err = addOpGetInsightSelectorsValidationMiddleware(stack); err != nil { 124 return err 125 } 126 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetInsightSelectors(options.Region), middleware.Before); err != nil { 127 return err 128 } 129 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 130 return err 131 } 132 if err = addResponseErrorMiddleware(stack); err != nil { 133 return err 134 } 135 if err = addRequestResponseLogging(stack, options); err != nil { 136 return err 137 } 138 return nil 139} 140 141func newServiceMetadataMiddleware_opGetInsightSelectors(region string) *awsmiddleware.RegisterServiceMetadata { 142 return &awsmiddleware.RegisterServiceMetadata{ 143 Region: region, 144 ServiceID: ServiceID, 145 SigningName: "cloudtrail", 146 OperationName: "GetInsightSelectors", 147 } 148} 149