Class: AWSCDK::CloudTrail::CfnTrail::AdvancedFieldSelectorProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
cloud_trail/cfn_trail.rb

Overview

A single selector statement in an advanced event selector.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(field:, ends_with: nil, equal_to: nil, not_ends_with: nil, not_equals: nil, not_starts_with: nil, starts_with: nil) ⇒ AdvancedFieldSelectorProperty

Returns a new instance of AdvancedFieldSelectorProperty.

Parameters:

  • field (String)

    A field in a CloudTrail event record on which to filter events to be logged.

  • ends_with (Array<String>, nil) (defaults to: nil)

    An operator that includes events that match the last few characters of the event record field specified as the value of Field .

  • equal_to (Array<String>, nil) (defaults to: nil)

    An operator that includes events that match the exact value of the event record field specified as the value of Field .

  • not_ends_with (Array<String>, nil) (defaults to: nil)

    An operator that excludes events that match the last few characters of the event record field specified as the value of Field .

  • not_equals (Array<String>, nil) (defaults to: nil)

    An operator that excludes events that match the exact value of the event record field specified as the value of Field .

  • not_starts_with (Array<String>, nil) (defaults to: nil)

    An operator that excludes events that match the first few characters of the event record field specified as the value of Field .

  • starts_with (Array<String>, nil) (defaults to: nil)

    An operator that includes events that match the first few characters of the event record field specified as the value of Field .



851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
# File 'cloud_trail/cfn_trail.rb', line 851

def initialize(field:, ends_with: nil, equal_to: nil, not_ends_with: nil, not_equals: nil, not_starts_with: nil, starts_with: nil)
  @field = field
  Jsii::Type.check_type(@field, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "field")
  @ends_with = ends_with
  Jsii::Type.check_type(@ends_with, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "endsWith") unless @ends_with.nil?
  @equal_to = equal_to
  Jsii::Type.check_type(@equal_to, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "equalTo") unless @equal_to.nil?
  @not_ends_with = not_ends_with
  Jsii::Type.check_type(@not_ends_with, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "notEndsWith") unless @not_ends_with.nil?
  @not_equals = not_equals
  Jsii::Type.check_type(@not_equals, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "notEquals") unless @not_equals.nil?
  @not_starts_with = not_starts_with
  Jsii::Type.check_type(@not_starts_with, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "notStartsWith") unless @not_starts_with.nil?
  @starts_with = starts_with
  Jsii::Type.check_type(@starts_with, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "startsWith") unless @starts_with.nil?
end

Instance Attribute Details

#ends_withArray<String>? (readonly)

An operator that includes events that match the last few characters of the event record field specified as the value of Field .



930
931
932
# File 'cloud_trail/cfn_trail.rb', line 930

def ends_with
  @ends_with
end

#equal_toArray<String>? (readonly)

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 read_only , event_category , and resources.type fields.



937
938
939
# File 'cloud_trail/cfn_trail.rb', line 937

def equal_to
  @equal_to
end

#fieldString (readonly)

A field in a CloudTrail event record on which to filter events to be logged.

For event data stores for CloudTrail Insights events, AWS Config configuration items, Audit Manager evidence, or events outside of AWS , the field is used only for selecting events as filtering is not supported.

For CloudTrail management events, supported fields include event_category (required), event_source , and read_only . The following additional fields are available for event data stores: event_name , event_type , session_credential_from_console , and userIdentity.arn .

For CloudTrail data events, supported fields include event_category (required), event_name , event_source , event_type , resources.type (required), read_only , resources.ARN , session_credential_from_console , and userIdentity.arn .

For CloudTrail network activity events, supported fields include event_category (required), event_source (required), event_name , error_code , and vpc_endpoint_id .

For event data stores for CloudTrail Insights events, AWS Config configuration items, Audit Manager evidence, or events outside of AWS , the only supported field is event_category .

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 event field.

  • read_only - This is an optional field that is only used for management events and data events. This field can be set to Equals with a value of true or false . If you do not add this field, CloudTrail logs both read and write events. A value of true logs only read events. A value of false logs only write events.
  • event_source - This field is only used for management events, data events, and network activity events.

For management events for trails, this is an optional field that can be set to NotEquals kms.amazonaws.com to exclude KMS management events, or NotEquals rdsdata.amazonaws.com to exclude RDS management events.

For data events for trails, this is an optional field that you can use to include or exclude any event source and can use any operator.

For management and data events for event data stores, this is an optional field that you can use to include or exclude any event source and can use any operator.

For network activity events, this is a required field that only uses the Equals operator. Set this field to the event source for which you want to log network activity events. If you want to log network activity events for multiple event sources, you must create a separate field selector for each event source. For a list of services supporting network activity events, see Logging network activity events in the AWS CloudTrail User Guide .

  • event_name - This is an optional field that is only used for data events, management events (for event data stores only), and network activity events. You can use any operator with event_name . You can use it to filter in or filter out specific events. You can have multiple values for this field, separated by commas.
  • event_category - This field is required and must be set to Equals .
  • For CloudTrail management events, the value must be Management .
  • For CloudTrail data events, the value must be Data .
  • For CloudTrail network activity events, the value must be NetworkActivity .

The following are used only for event data stores:

  • For CloudTrail Insights events, the value must be Insight .
  • For AWS Config configuration items, the value must be ConfigurationItem .
  • For Audit Manager evidence, the value must be Evidence .
  • For events outside of AWS , the value must be ActivityAuditLog .
  • event_type - For event data stores, this is an optional field available for event data stores to filter management and data events on the event type. For trails, this is an optional field to filter data events on the event type. For information about available event types, see CloudTrail record contents in the AWS CloudTrail user guide .
  • error_code - This field is only used to filter CloudTrail network activity events and is optional. This is the error code to filter on. Currently, the only valid error_code is VpceAccessDenied . error_code can only use the Equals operator.
  • session_credential_from_console - For event data stores, this is an optional field used to filter management and data events based on whether the events originated from an AWS Management Console session. For trails, this is an optional field used to filter data events. session_credential_from_console can only use the Equals and NotEquals operators.
  • resources.type - This field is required for CloudTrail data events. resources.type can only use the Equals operator.

For a list of available resource types for data events, see Data events in the AWS CloudTrail User Guide .

You can have only one resources.type field per selector. To log events on more than one resource type, add another selector.

  • resources.ARN - The resources.ARN is an optional field for data events. You can use any operator with resources.ARN , but if you use Equals or NotEquals , the value must exactly match the ARN of a valid resource of the type you've specified in the template as the value of resources.type. To log all data events for all objects in a specific S3 bucket, use the StartsWith operator, and include only the bucket ARN as the matching value.

For more information about the ARN formats of data event resources, see Actions, resources, and condition keys for AWS services in the Service Authorization Reference .

You can't use the resources.ARN field to filter resource types that do not have ARNs.

  • userIdentity.arn - For event data stores, this is an optional field used to filter management and data events for actions taken by specific IAM identities. For trails, this is an optional field used to filter data events. You can use any operator with userIdentity.arn . For more information on the userIdentity element, see CloudTrail userIdentity element in the AWS CloudTrail User Guide .
  • vpc_endpoint_id - This field is only used to filter CloudTrail network activity events and is optional. This field identifies the VPC endpoint that the request passed through. You can use any operator with vpc_endpoint_id .


925
926
927
# File 'cloud_trail/cfn_trail.rb', line 925

def field
  @field
end

#not_ends_withArray<String>? (readonly)

An operator that excludes events that match the last few characters of the event record field specified as the value of Field .



942
943
944
# File 'cloud_trail/cfn_trail.rb', line 942

def not_ends_with
  @not_ends_with
end

#not_equalsArray<String>? (readonly)

An operator that excludes events that match the exact value of the event record field specified as the value of Field .



947
948
949
# File 'cloud_trail/cfn_trail.rb', line 947

def not_equals
  @not_equals
end

#not_starts_withArray<String>? (readonly)

An operator that excludes events that match the first few characters of the event record field specified as the value of Field .



952
953
954
# File 'cloud_trail/cfn_trail.rb', line 952

def not_starts_with
  @not_starts_with
end

#starts_withArray<String>? (readonly)

An operator that includes events that match the first few characters of the event record field specified as the value of Field .



957
958
959
# File 'cloud_trail/cfn_trail.rb', line 957

def starts_with
  @starts_with
end

Class Method Details

.jsii_propertiesObject



959
960
961
962
963
964
965
966
967
968
969
# File 'cloud_trail/cfn_trail.rb', line 959

def self.jsii_properties
  {
    :field => "field",
    :ends_with => "endsWith",
    :equal_to => "equalTo",
    :not_ends_with => "notEndsWith",
    :not_equals => "notEquals",
    :not_starts_with => "notStartsWith",
    :starts_with => "startsWith",
  }
end

Instance Method Details

#to_jsiiObject



971
972
973
974
975
976
977
978
979
980
981
982
983
# File 'cloud_trail/cfn_trail.rb', line 971

def to_jsii
  result = {}
  result.merge!({
    "field" => @field,
    "endsWith" => @ends_with,
    "equalTo" => @equal_to,
    "notEndsWith" => @not_ends_with,
    "notEquals" => @not_equals,
    "notStartsWith" => @not_starts_with,
    "startsWith" => @starts_with,
  })
  result.compact
end