{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/amazon-cloudtrail/json-schema/amazon-cloudtrail-put-event-selectors-request-schema.json",
  "title": "PutEventSelectorsRequest",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/amazon-cloudtrail-operations-api-openapi.yml#/components/schemas/PutEventSelectorsRequest",
  "type": "object",
  "properties": {
    "TrailName": {
      "type": "string",
      "description": "Specifies the name of the trail or trail ARN. If you specify a trail name, the string must meet the following requirements: Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-) Start with a letter or number, and end with a letter or number Be between 3 and 128 characters Have no adjacent periods, underscores or dashes. Names like my-_namespace and my--namespace are not valid. Not be in IP address format (for example, 192.168.5.4) If you specify a trail ARN, it must be in the following format. arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail"
    },
    "EventSelectors": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/EventSelector"
      },
      "description": "Specifies the settings for your event selectors. You can use event selectors to log management events and data events for the following resource types: AWS::DynamoDB::Table AWS::Lambda::Function AWS::S3::Object You can't use event selectors to log network activity events. You can configure up to five event selectors for a trail. You can use either EventSelectors or AdvancedEventSelectors in a PutEventSelectors request, but not both. If you apply EventSelectors to a trail, any existing AdvancedEventSelectors are overwritten."
    },
    "AdvancedEventSelectors": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/AdvancedEventSelector"
      },
      "description": "Specifies the settings for advanced event selectors. You can use advanced event selectors to log management events, data events for all resource types, and network activity events. You can add advanced event selectors, and conditions for your advanced event selectors, up to a maximum of 500 values for all conditions and selectors on a trail. You can use either AdvancedEventSelectors or EventSelectors, but not both. If you apply AdvancedEventSelectors to a trail, any existing EventSelectors are overwritten. For more information about advanced event selectors, see Logging data events and Logging"
    }
  },
  "required": [
    "TrailName"
  ],
  "$defs": {
    "AdvancedEventSelector": {
      "type": "object",
      "properties": {
        "Name": {
          "type": "string",
          "description": "An optional, descriptive name for an advanced event selector, such as \"Log data events for only two S3 buckets\"."
        },
        "FieldSelectors": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AdvancedFieldSelector"
          },
          "description": "Contains all selector statements in an advanced event selector."
        }
      },
      "required": [
        "FieldSelectors"
      ]
    },
    "AdvancedFieldSelector": {
      "type": "object",
      "properties": {
        "Field": {
          "type": "string",
          "description": "A field in a CloudTrail event record on which to filter events to be logged. For event data stores for CloudTrail Insights events, Config configuration items, Audit Manager evidence, or events outside of Amazon Web Services, the field is used only for selecting events as filtering is not supported. For more information, see AdvancedFieldSelector in the CloudTrail API Reference. Selectors don't support the use of wildcards like * . To match multiple values with a single condition, you may use StartsWith, EndsWith, NotStartsWith, or NotEndsWith to explicitly match the beginning or end of the eve"
        },
        "Equals": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "An operator that includes events that match the exact value of the event record field specified as the value of Field. This is the only valid operator that you can use with the readOnly, eventCategory, and resources.type fields."
        },
        "StartsWith": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "An operator that includes events that match the first few characters of the event record field specified as the value of Field."
        },
        "EndsWith": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "An operator that includes events that match the last few characters of the event record field specified as the value of Field."
        },
        "NotEquals": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "An operator that excludes events that match the exact value of the event record field specified as the value of Field."
        },
        "NotStartsWith": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "An operator that excludes events that match the first few characters of the event record field specified as the value of Field."
        },
        "NotEndsWith": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "An operator that excludes events that match the last few characters of the event record field specified as the value of Field."
        }
      },
      "required": [
        "Field"
      ]
    },
    "DataResource": {
      "type": "object",
      "properties": {
        "Type": {
          "type": "string",
          "description": "The resource type in which you want to log data events. You can specify the following basic event selector resource types: AWS::DynamoDB::Table AWS::Lambda::Function AWS::S3::Object Additional resource types are available through advanced event selectors. For more information, see AdvancedEventSelector."
        },
        "Values": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "An array of Amazon Resource Name (ARN) strings or partial ARN strings for the specified resource type. To log data events for all objects in all S3 buckets in your Amazon Web Services account, specify the prefix as arn:aws:s3. This also enables logging of data event activity performed by any user or role in your Amazon Web Services account, even if that activity is performed on a bucket that belongs to another Amazon Web Services account. To log data events for all objects in an S3 bucket, specify the bucket and an empty object prefix such as arn:aws:s3:::amzn-s3-demo-bucket1/. The trail logs "
        }
      }
    },
    "EventSelector": {
      "type": "object",
      "properties": {
        "ReadWriteType": {
          "type": "string",
          "enum": [
            "ReadOnly",
            "WriteOnly",
            "All"
          ],
          "description": "Specify if you want your trail to log read-only events, write-only events, or all. For example, the EC2 GetConsoleOutput is a read-only API operation and RunInstances is a write-only API operation. By default, the value is All."
        },
        "IncludeManagementEvents": {
          "type": "boolean",
          "description": "Specify if you want your event selector to include management events for your trail. For more information, see Management Events in the CloudTrail User Guide. By default, the value is true. The first copy of management events is free. You are charged for additional copies of management events that you are logging on any subsequent trail in the same Region. For more information about CloudTrail pricing, see CloudTrail Pricing."
        },
        "DataResources": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DataResource"
          },
          "description": "CloudTrail supports data event logging for Amazon S3 objects in standard S3 buckets, Lambda functions, and Amazon DynamoDB tables with basic event selectors. You can specify up to 250 resources for an individual event selector, but the total number of data resources cannot exceed 250 across all event selectors in a trail. This limit does not apply if you configure resource logging for all data events. For more information, see Data Events and Limits in CloudTrail in the CloudTrail User Guide. To log data events for all other resource types including objects stored in directory buckets, you mus"
        },
        "ExcludeManagementEventSources": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "An optional list of service event sources from which you do not want management events to be logged on your trail. In this release, the list can be empty (disables the filter), or it can filter out Key Management Service or Amazon RDS Data API events by containing kms.amazonaws.com or rdsdata.amazonaws.com. By default, ExcludeManagementEventSources is empty, and KMS and Amazon RDS Data API events are logged to your trail. You can exclude management event sources only in Regions that support the event source."
        }
      }
    }
  }
}