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 event selectors that you configured for your 15// trail. The information returned for your event selectors includes the 16// following: 17// 18// * If your event selector includes read-only events, write-only 19// events, or all events. This applies to both management events and data 20// events. 21// 22// * If your event selector includes management events. 23// 24// * If your event 25// selector includes data events, the Amazon S3 objects or AWS Lambda functions 26// that you are logging for data events. 27// 28// For more information, see Logging Data 29// and Management Events for Trails 30// (https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-management-and-data-events-with-cloudtrail.html) 31// in the AWS CloudTrail User Guide. 32func (c *Client) GetEventSelectors(ctx context.Context, params *GetEventSelectorsInput, optFns ...func(*Options)) (*GetEventSelectorsOutput, error) { 33 if params == nil { 34 params = &GetEventSelectorsInput{} 35 } 36 37 result, metadata, err := c.invokeOperation(ctx, "GetEventSelectors", params, optFns, addOperationGetEventSelectorsMiddlewares) 38 if err != nil { 39 return nil, err 40 } 41 42 out := result.(*GetEventSelectorsOutput) 43 out.ResultMetadata = metadata 44 return out, nil 45} 46 47type GetEventSelectorsInput struct { 48 49 // Specifies the name of the trail or trail ARN. If you specify a trail name, the 50 // string must meet the following requirements: 51 // 52 // * Contain only ASCII letters (a-z, 53 // A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-) 54 // 55 // * Start with a 56 // letter or number, and end with a letter or number 57 // 58 // * Be between 3 and 128 59 // characters 60 // 61 // * Have no adjacent periods, underscores or dashes. Names like 62 // my-_namespace and my--namespace are not valid. 63 // 64 // * Not be in IP address format 65 // (for example, 192.168.5.4) 66 // 67 // If you specify a trail ARN, it must be in the 68 // format: arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail 69 // 70 // This member is required. 71 TrailName *string 72} 73 74type GetEventSelectorsOutput struct { 75 76 // The advanced event selectors that are configured for the trail. 77 AdvancedEventSelectors []types.AdvancedEventSelector 78 79 // The event selectors that are configured for the trail. 80 EventSelectors []types.EventSelector 81 82 // The specified trail ARN that has the event selectors. 83 TrailARN *string 84 85 // Metadata pertaining to the operation's result. 86 ResultMetadata middleware.Metadata 87} 88 89func addOperationGetEventSelectorsMiddlewares(stack *middleware.Stack, options Options) (err error) { 90 err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetEventSelectors{}, middleware.After) 91 if err != nil { 92 return err 93 } 94 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetEventSelectors{}, middleware.After) 95 if err != nil { 96 return err 97 } 98 if err = addSetLoggerMiddleware(stack, options); err != nil { 99 return err 100 } 101 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 102 return err 103 } 104 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 105 return err 106 } 107 if err = addResolveEndpointMiddleware(stack, options); err != nil { 108 return err 109 } 110 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 111 return err 112 } 113 if err = addRetryMiddlewares(stack, options); err != nil { 114 return err 115 } 116 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 117 return err 118 } 119 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 120 return err 121 } 122 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 123 return err 124 } 125 if err = addClientUserAgent(stack); err != nil { 126 return err 127 } 128 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 129 return err 130 } 131 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 132 return err 133 } 134 if err = addOpGetEventSelectorsValidationMiddleware(stack); err != nil { 135 return err 136 } 137 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetEventSelectors(options.Region), middleware.Before); err != nil { 138 return err 139 } 140 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 141 return err 142 } 143 if err = addResponseErrorMiddleware(stack); err != nil { 144 return err 145 } 146 if err = addRequestResponseLogging(stack, options); err != nil { 147 return err 148 } 149 return nil 150} 151 152func newServiceMetadataMiddleware_opGetEventSelectors(region string) *awsmiddleware.RegisterServiceMetadata { 153 return &awsmiddleware.RegisterServiceMetadata{ 154 Region: region, 155 ServiceID: ServiceID, 156 SigningName: "cloudtrail", 157 OperationName: "GetEventSelectors", 158 } 159} 160