Class: Aws::CloudTrail::Client

Inherits:
Seahorse::Client::Base
  • Object
show all
Includes:
Aws::ClientStubs
Defined in:
lib/aws-sdk-cloudtrail/client.rb

Overview

An API client for CloudTrail. To construct a client, you need to configure a ‘:region` and `:credentials`.

client = Aws::CloudTrail::Client.new(
  region: region_name,
  credentials: credentials,
  # ...
)

For details on configuring region and credentials see the [developer guide](/sdk-for-ruby/v3/developer-guide/setup-config.html).

See #initialize for a full list of supported configuration options.

Class Attribute Summary collapse

API Operations collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Client

Returns a new instance of Client.

Parameters:

  • options (Hash)

Options Hash (options):

  • :plugins (Array<Seahorse::Client::Plugin>) — default: []]

    A list of plugins to apply to the client. Each plugin is either a class name or an instance of a plugin class.

  • :credentials (required, Aws::CredentialProvider)

    Your AWS credentials. This can be an instance of any one of the following classes:

    • ‘Aws::Credentials` - Used for configuring static, non-refreshing credentials.

    • ‘Aws::SharedCredentials` - Used for loading static credentials from a shared file, such as `~/.aws/config`.

    • ‘Aws::AssumeRoleCredentials` - Used when you need to assume a role.

    • ‘Aws::AssumeRoleWebIdentityCredentials` - Used when you need to assume a role after providing credentials via the web.

    • ‘Aws::SSOCredentials` - Used for loading credentials from AWS SSO using an access token generated from `aws login`.

    • ‘Aws::ProcessCredentials` - Used for loading credentials from a process that outputs to stdout.

    • ‘Aws::InstanceProfileCredentials` - Used for loading credentials from an EC2 IMDS on an EC2 instance.

    • ‘Aws::ECSCredentials` - Used for loading credentials from instances running in ECS.

    • ‘Aws::CognitoIdentityCredentials` - Used for loading credentials from the Cognito Identity service.

    When ‘:credentials` are not configured directly, the following locations will be searched for credentials:

    • Aws.config`

    • The ‘:access_key_id`, `:secret_access_key`, `:session_token`, and `:account_id` options.

    • ENV, ENV, ENV, and ENV

    • ‘~/.aws/credentials`

    • ‘~/.aws/config`

    • EC2/ECS IMDS instance profile - When used by default, the timeouts are very aggressive. Construct and pass an instance of ‘Aws::InstanceProfileCredentials` or `Aws::ECSCredentials` to enable retries and extended timeouts. Instance profile credential fetching can be disabled by setting ENV to true.

  • :region (required, String)

    The AWS region to connect to. The configured ‘:region` is used to determine the service `:endpoint`. When not passed, a default `:region` is searched for in the following locations:

  • :access_key_id (String)
  • :account_id (String)
  • :active_endpoint_cache (Boolean) — default: false

    When set to ‘true`, a thread polling for endpoints will be running in the background every 60 secs (default). Defaults to `false`.

  • :adaptive_retry_wait_to_fill (Boolean) — default: true

    Used only in ‘adaptive` retry mode. When true, the request will sleep until there is sufficent client side capacity to retry the request. When false, the request will raise a `RetryCapacityNotAvailableError` and will not retry instead of sleeping.

  • :client_side_monitoring (Boolean) — default: false

    When ‘true`, client-side metrics will be collected for all API requests from this client.

  • :client_side_monitoring_client_id (String) — default: ""

    Allows you to provide an identifier for this client which will be attached to all generated client side metrics. Defaults to an empty string.

  • :client_side_monitoring_host (String) — default: "127.0.0.1"

    Allows you to specify the DNS hostname or IPv4 or IPv6 address that the client side monitoring agent is running on, where client metrics will be published via UDP.

  • :client_side_monitoring_port (Integer) — default: 31000

    Required for publishing client metrics. The port that the client side monitoring agent is running on, where client metrics will be published via UDP.

  • :client_side_monitoring_publisher (Aws::ClientSideMonitoring::Publisher) — default: Aws::ClientSideMonitoring::Publisher

    Allows you to provide a custom client-side monitoring publisher class. By default, will use the Client Side Monitoring Agent Publisher.

  • :convert_params (Boolean) — default: true

    When ‘true`, an attempt is made to coerce request parameters into the required types.

  • :correct_clock_skew (Boolean) — default: true

    Used only in ‘standard` and adaptive retry modes. Specifies whether to apply a clock skew correction and retry requests with skewed client clocks.

  • :defaults_mode (String) — default: "legacy"

    See DefaultsModeConfiguration for a list of the accepted modes and the configuration defaults that are included.

  • :disable_host_prefix_injection (Boolean) — default: false

    Set to true to disable SDK automatically adding host prefix to default service endpoint when available.

  • :disable_request_compression (Boolean) — default: false

    When set to ‘true’ the request body will not be compressed for supported operations.

  • :endpoint (String, URI::HTTPS, URI::HTTP)

    Normally you should not configure the ‘:endpoint` option directly. This is normally constructed from the `:region` option. Configuring `:endpoint` is normally reserved for connecting to test or custom endpoints. The endpoint should be a URI formatted like:

    'http://example.com'
    'https://example.com'
    'http://example.com:123'
    
  • :endpoint_cache_max_entries (Integer) — default: 1000

    Used for the maximum size limit of the LRU cache storing endpoints data for endpoint discovery enabled operations. Defaults to 1000.

  • :endpoint_cache_max_threads (Integer) — default: 10

    Used for the maximum threads in use for polling endpoints to be cached, defaults to 10.

  • :endpoint_cache_poll_interval (Integer) — default: 60

    When :endpoint_discovery and :active_endpoint_cache is enabled, Use this option to config the time interval in seconds for making requests fetching endpoints information. Defaults to 60 sec.

  • :endpoint_discovery (Boolean) — default: false

    When set to ‘true`, endpoint discovery will be enabled for operations when available.

  • :ignore_configured_endpoint_urls (Boolean)

    Setting to true disables use of endpoint URLs provided via environment variables and the shared configuration file.

  • :log_formatter (Aws::Log::Formatter) — default: Aws::Log::Formatter.default

    The log formatter.

  • :log_level (Symbol) — default: :info

    The log level to send messages to the ‘:logger` at.

  • :logger (Logger)

    The Logger instance to send log messages to. If this option is not set, logging will be disabled.

  • :max_attempts (Integer) — default: 3

    An integer representing the maximum number attempts that will be made for a single request, including the initial attempt. For example, setting this value to 5 will result in a request being retried up to 4 times. Used in ‘standard` and `adaptive` retry modes.

  • :profile (String) — default: "default"

    Used when loading credentials from the shared credentials file at HOME/.aws/credentials. When not specified, ‘default’ is used.

  • :request_min_compression_size_bytes (Integer) — default: 10240

    The minimum size in bytes that triggers compression for request bodies. The value must be non-negative integer value between 0 and 10485780 bytes inclusive.

  • :retry_backoff (Proc)

    A proc or lambda used for backoff. Defaults to 2**retries * retry_base_delay. This option is only used in the ‘legacy` retry mode.

  • :retry_base_delay (Float) — default: 0.3

    The base delay in seconds used by the default backoff function. This option is only used in the ‘legacy` retry mode.

  • :retry_jitter (Symbol) — default: :none

    A delay randomiser function used by the default backoff function. Some predefined functions can be referenced by name - :none, :equal, :full, otherwise a Proc that takes and returns a number. This option is only used in the ‘legacy` retry mode.

    @see www.awsarchitectureblog.com/2015/03/backoff.html

  • :retry_limit (Integer) — default: 3

    The maximum number of times to retry failed requests. Only ~ 500 level server errors and certain ~ 400 level client errors are retried. Generally, these are throttling errors, data checksum errors, networking errors, timeout errors, auth errors, endpoint discovery, and errors from expired credentials. This option is only used in the ‘legacy` retry mode.

  • :retry_max_delay (Integer) — default: 0

    The maximum number of seconds to delay between retries (0 for no limit) used by the default backoff function. This option is only used in the ‘legacy` retry mode.

  • :retry_mode (String) — default: "legacy"

    Specifies which retry algorithm to use. Values are:

    • ‘legacy` - The pre-existing retry behavior. This is default value if no retry mode is provided.

    • ‘standard` - A standardized set of retry rules across the AWS SDKs. This includes support for retry quotas, which limit the number of unsuccessful retries a client can make.

    • ‘adaptive` - An experimental retry mode that includes all the functionality of `standard` mode along with automatic client side throttling. This is a provisional mode that may change behavior in the future.

  • :sdk_ua_app_id (String)

    A unique and opaque application ID that is appended to the User-Agent header as app/sdk_ua_app_id. It should have a maximum length of 50. This variable is sourced from environment variable AWS_SDK_UA_APP_ID or the shared config profile attribute sdk_ua_app_id.

  • :secret_access_key (String)
  • :session_token (String)
  • :sigv4a_signing_region_set (Array)

    A list of regions that should be signed with SigV4a signing. When not passed, a default ‘:sigv4a_signing_region_set` is searched for in the following locations:

  • :simple_json (Boolean) — default: false

    Disables request parameter conversion, validation, and formatting. Also disables response data type conversions. The request parameters hash must be formatted exactly as the API expects.This option is useful when you want to ensure the highest level of performance by avoiding overhead of walking request parameters and response data structures.

  • :stub_responses (Boolean) — default: false

    Causes the client to return stubbed responses. By default fake responses are generated and returned. You can specify the response data to return or errors to raise by calling ClientStubs#stub_responses. See ClientStubs for more information.

    ** Please note ** When response stubbing is enabled, no HTTP requests are made, and retries are disabled.

  • :telemetry_provider (Aws::Telemetry::TelemetryProviderBase) — default: Aws::Telemetry::NoOpTelemetryProvider

    Allows you to provide a telemetry provider, which is used to emit telemetry data. By default, uses ‘NoOpTelemetryProvider` which will not record or emit any telemetry data. The SDK supports the following telemetry providers:

    • OpenTelemetry (OTel) - To use the OTel provider, install and require the

    ‘opentelemetry-sdk` gem and then, pass in an instance of a `Aws::Telemetry::OTelProvider` for telemetry provider.

  • :token_provider (Aws::TokenProvider)

    A Bearer Token Provider. This can be an instance of any one of the following classes:

    • ‘Aws::StaticTokenProvider` - Used for configuring static, non-refreshing tokens.

    • ‘Aws::SSOTokenProvider` - Used for loading tokens from AWS SSO using an access token generated from `aws login`.

    When ‘:token_provider` is not configured directly, the `Aws::TokenProviderChain` will be used to search for tokens configured for your profile in shared configuration files.

  • :use_dualstack_endpoint (Boolean)

    When set to ‘true`, dualstack enabled endpoints (with `.aws` TLD) will be used if available.

  • :use_fips_endpoint (Boolean)

    When set to ‘true`, fips compatible endpoints will be used if available. When a `fips` region is used, the region is normalized and this config is set to `true`.

  • :validate_params (Boolean) — default: true

    When ‘true`, request parameters are validated before sending the request.

  • :endpoint_provider (Aws::CloudTrail::EndpointProvider)

    The endpoint provider used to resolve endpoints. Any object that responds to ‘#resolve_endpoint(parameters)` where `parameters` is a Struct similar to `Aws::CloudTrail::EndpointParameters`.

  • :http_continue_timeout (Float) — default: 1

    The number of seconds to wait for a 100-continue response before sending the request body. This option has no effect unless the request has “Expect” header set to “100-continue”. Defaults to ‘nil` which disables this behaviour. This value can safely be set per request on the session.

  • :http_idle_timeout (Float) — default: 5

    The number of seconds a connection is allowed to sit idle before it is considered stale. Stale connections are closed and removed from the pool before making a request.

  • :http_open_timeout (Float) — default: 15

    The default number of seconds to wait for response data. This value can safely be set per-request on the session.

  • :http_proxy (URI::HTTP, String)

    A proxy to send requests through. Formatted like ‘proxy.com:123’.

  • :http_read_timeout (Float) — default: 60

    The default number of seconds to wait for response data. This value can safely be set per-request on the session.

  • :http_wire_trace (Boolean) — default: false

    When ‘true`, HTTP debug output will be sent to the `:logger`.

  • :on_chunk_received (Proc)

    When a Proc object is provided, it will be used as callback when each chunk of the response body is received. It provides three arguments: the chunk, the number of bytes received, and the total number of bytes in the response (or nil if the server did not send a ‘content-length`).

  • :on_chunk_sent (Proc)

    When a Proc object is provided, it will be used as callback when each chunk of the request body is sent. It provides three arguments: the chunk, the number of bytes read from the body, and the total number of bytes in the body.

  • :raise_response_errors (Boolean) — default: true

    When ‘true`, response errors are raised.

  • :ssl_ca_bundle (String)

    Full path to the SSL certificate authority bundle file that should be used when verifying peer certificates. If you do not pass ‘:ssl_ca_bundle` or `:ssl_ca_directory` the the system default will be used if available.

  • :ssl_ca_directory (String)

    Full path of the directory that contains the unbundled SSL certificate authority files for verifying peer certificates. If you do not pass ‘:ssl_ca_bundle` or `:ssl_ca_directory` the the system default will be used if available.

  • :ssl_ca_store (String)

    Sets the X509::Store to verify peer certificate.

  • :ssl_cert (OpenSSL::X509::Certificate)

    Sets a client certificate when creating http connections.

  • :ssl_key (OpenSSL::PKey)

    Sets a client key when creating http connections.

  • :ssl_timeout (Float)

    Sets the SSL timeout in seconds

  • :ssl_verify_peer (Boolean) — default: true

    When ‘true`, SSL peer certificates are verified when establishing a connection.



451
452
453
# File 'lib/aws-sdk-cloudtrail/client.rb', line 451

def initialize(*args)
  super
end

Class Attribute Details

.identifierObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



4529
4530
4531
# File 'lib/aws-sdk-cloudtrail/client.rb', line 4529

def identifier
  @identifier
end

Class Method Details

.errors_moduleObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



4532
4533
4534
# File 'lib/aws-sdk-cloudtrail/client.rb', line 4532

def errors_module
  Errors
end

Instance Method Details

#add_tags(params = {}) ⇒ Struct

Adds one or more tags to a trail, event data store, dashboard, or channel, up to a limit of 50. Overwrites an existing tag’s value when a new value is specified for an existing tag key. Tag key names must be unique; you cannot have two keys with the same name but different values. If you specify a key without a value, the tag will be created with the specified key and a value of null. You can tag a trail or event data store that applies to all Amazon Web Services Regions only from the Region in which the trail or event data store was created (also known as its home Region).

Examples:

Request syntax with placeholder values


resp = client.add_tags({
  resource_id: "String", # required
  tags_list: [ # required
    {
      key: "TagKey", # required
      value: "TagValue",
    },
  ],
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :resource_id (required, String)

    Specifies the ARN of the trail, event data store, dashboard, or channel to which one or more tags will be added.

    The format of a trail ARN is: ‘arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail`

    The format of an event data store ARN is: ‘arn:aws:cloudtrail:us-east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f-8bd1-bcf6cEXAMPLE`

    The format of a dashboard ARN is: ‘arn:aws:cloudtrail:us-east-1:123456789012:dashboard/exampleDash`

    The format of a channel ARN is: ‘arn:aws:cloudtrail:us-east-2:123456789012:channel/01234567890`

  • :tags_list (required, Array<Types::Tag>)

    Contains a list of tags, up to a limit of 50

Returns:

  • (Struct)

    Returns an empty response.

See Also:



504
505
506
507
# File 'lib/aws-sdk-cloudtrail/client.rb', line 504

def add_tags(params = {}, options = {})
  req = build_request(:add_tags, params)
  req.send_request(options)
end

#build_request(operation_name, params = {}) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • params ({}) (defaults to: {})


4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
# File 'lib/aws-sdk-cloudtrail/client.rb', line 4502

def build_request(operation_name, params = {})
  handlers = @handlers.for(operation_name)
  tracer = config.telemetry_provider.tracer_provider.tracer(
    Aws::Telemetry.module_to_tracer_name('Aws::CloudTrail')
  )
  context = Seahorse::Client::RequestContext.new(
    operation_name: operation_name,
    operation: config.api.operation(operation_name),
    client: self,
    params: params,
    config: config,
    tracer: tracer
  )
  context[:gem_name] = 'aws-sdk-cloudtrail'
  context[:gem_version] = '1.96.0'
  Seahorse::Client::Request.new(handlers, context)
end

#cancel_query(params = {}) ⇒ Types::CancelQueryResponse

Cancels a query if the query is not in a terminated state, such as ‘CANCELLED`, `FAILED`, `TIMED_OUT`, or `FINISHED`. You must specify an ARN value for `EventDataStore`. The ID of the query that you want to cancel is also required. When you run `CancelQuery`, the query status might show as `CANCELLED` even if the operation is not yet finished.

Examples:

Request syntax with placeholder values


resp = client.cancel_query({
  event_data_store: "EventDataStoreArn",
  query_id: "UUID", # required
  event_data_store_owner_account_id: "AccountId",
})

Response structure


resp.query_id #=> String
resp.query_status #=> String, one of "QUEUED", "RUNNING", "FINISHED", "FAILED", "CANCELLED", "TIMED_OUT"
resp. #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :event_data_store (String)

    The ARN (or the ID suffix of the ARN) of an event data store on which the specified query is running.

  • :query_id (required, String)

    The ID of the query that you want to cancel. The ‘QueryId` comes from the response of a `StartQuery` operation.

  • :event_data_store_owner_account_id (String)

    The account ID of the event data store owner.

Returns:

See Also:



550
551
552
553
# File 'lib/aws-sdk-cloudtrail/client.rb', line 550

def cancel_query(params = {}, options = {})
  req = build_request(:cancel_query, params)
  req.send_request(options)
end

#create_channel(params = {}) ⇒ Types::CreateChannelResponse

Creates a channel for CloudTrail to ingest events from a partner or external source. After you create a channel, a CloudTrail Lake event data store can log events from the partner or source that you specify.

Examples:

Request syntax with placeholder values


resp = client.create_channel({
  name: "ChannelName", # required
  source: "Source", # required
  destinations: [ # required
    {
      type: "EVENT_DATA_STORE", # required, accepts EVENT_DATA_STORE, AWS_SERVICE
      location: "Location", # required
    },
  ],
  tags: [
    {
      key: "TagKey", # required
      value: "TagValue",
    },
  ],
})

Response structure


resp.channel_arn #=> String
resp.name #=> String
resp.source #=> String
resp.destinations #=> Array
resp.destinations[0].type #=> String, one of "EVENT_DATA_STORE", "AWS_SERVICE"
resp.destinations[0].location #=> String
resp.tags #=> Array
resp.tags[0].key #=> String
resp.tags[0].value #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :name (required, String)

    The name of the channel.

  • :source (required, String)

    The name of the partner or external event source. You cannot change this name after you create the channel. A maximum of one channel is allowed per source.

    A source can be either ‘Custom` for all valid non-Amazon Web Services events, or the name of a partner event source. For information about the source names for available partners, see [Additional information about integration partners] in the CloudTrail User Guide.

    [1]: docs.aws.amazon.com/awscloudtrail/latest/userguide/query-event-data-store-integration.html#cloudtrail-lake-partner-information

  • :destinations (required, Array<Types::Destination>)

    One or more event data stores to which events arriving through a channel will be logged.

  • :tags (Array<Types::Tag>)

    A list of tags.

Returns:

See Also:



626
627
628
629
# File 'lib/aws-sdk-cloudtrail/client.rb', line 626

def create_channel(params = {}, options = {})
  req = build_request(:create_channel, params)
  req.send_request(options)
end

#create_dashboard(params = {}) ⇒ Types::CreateDashboardResponse

Creates a custom dashboard or the Highlights dashboard.

  • **Custom dashboards** - Custom dashboards allow you to query events in any event data store type. You can add up to 10 widgets to a custom dashboard. You can manually refresh a custom dashboard, or you can set a refresh schedule.

  • **Highlights dashboard** - You can create the Highlights dashboard to see a summary of key user activities and API usage across all your event data stores. CloudTrail Lake manages the Highlights dashboard and refreshes the dashboard every 6 hours. To create the Highlights dashboard, you must set and enable a refresh schedule.

CloudTrail runs queries to populate the dashboard’s widgets during a manual or scheduled refresh. CloudTrail must be granted permissions to run the ‘StartQuery` operation on your behalf. To provide permissions, run the `PutResourcePolicy` operation to attach a resource-based policy to each event data store. For more information, see [Example: Allow CloudTrail to run queries to populate a dashboard] in the *CloudTrail User Guide*.

To set a refresh schedule, CloudTrail must be granted permissions to run the ‘StartDashboardRefresh` operation to refresh the dashboard on your behalf. To provide permissions, run the `PutResourcePolicy` operation to attach a resource-based policy to the dashboard. For more information, see [ Resource-based policy example for a dashboard] in the *CloudTrail User Guide*.

For more information about dashboards, see [CloudTrail Lake dashboards] in the *CloudTrail User Guide*.

[1]: docs.aws.amazon.com/awscloudtrail/latest/userguide/security_iam_resource-based-policy-examples.html#security_iam_resource-based-policy-examples-eds-dashboard [2]: docs.aws.amazon.com/awscloudtrail/latest/userguide/security_iam_resource-based-policy-examples.html#security_iam_resource-based-policy-examples-dashboards [3]: docs.aws.amazon.com/awscloudtrail/latest/userguide/lake-dashboard.html

Examples:

Request syntax with placeholder values


resp = client.create_dashboard({
  name: "DashboardName", # required
  refresh_schedule: {
    frequency: {
      unit: "HOURS", # accepts HOURS, DAYS
      value: 1,
    },
    status: "ENABLED", # accepts ENABLED, DISABLED
    time_of_day: "TimeOfDay",
  },
  tags_list: [
    {
      key: "TagKey", # required
      value: "TagValue",
    },
  ],
  termination_protection_enabled: false,
  widgets: [
    {
      query_statement: "QueryStatement", # required
      query_parameters: ["QueryParameter"],
      view_properties: { # required
        "ViewPropertiesKey" => "ViewPropertiesValue",
      },
    },
  ],
})

Response structure


resp.dashboard_arn #=> String
resp.name #=> String
resp.type #=> String, one of "MANAGED", "CUSTOM"
resp.widgets #=> Array
resp.widgets[0].query_alias #=> String
resp.widgets[0].query_statement #=> String
resp.widgets[0].query_parameters #=> Array
resp.widgets[0].query_parameters[0] #=> String
resp.widgets[0].view_properties #=> Hash
resp.widgets[0].view_properties["ViewPropertiesKey"] #=> String
resp.tags_list #=> Array
resp.tags_list[0].key #=> String
resp.tags_list[0].value #=> String
resp.refresh_schedule.frequency.unit #=> String, one of "HOURS", "DAYS"
resp.refresh_schedule.frequency.value #=> Integer
resp.refresh_schedule.status #=> String, one of "ENABLED", "DISABLED"
resp.refresh_schedule.time_of_day #=> String
resp.termination_protection_enabled #=> Boolean

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :name (required, String)

    The name of the dashboard. The name must be unique to your account.

    To create the Highlights dashboard, the name must be ‘AWSCloudTrail-Highlights`.

  • :refresh_schedule (Types::RefreshSchedule)

    The refresh schedule configuration for the dashboard.

    To create the Highlights dashboard, you must set a refresh schedule and set the ‘Status` to `ENABLED`. The `Unit` for the refresh schedule must be `HOURS` and the `Value` must be `6`.

  • :tags_list (Array<Types::Tag>)

    A list of tags.

  • :termination_protection_enabled (Boolean)

    Specifies whether termination protection is enabled for the dashboard. If termination protection is enabled, you cannot delete the dashboard until termination protection is disabled.

  • :widgets (Array<Types::RequestWidget>)

    An array of widgets for a custom dashboard. A custom dashboard can have a maximum of ten widgets.

    You do not need to specify widgets for the Highlights dashboard.

Returns:

See Also:



760
761
762
763
# File 'lib/aws-sdk-cloudtrail/client.rb', line 760

def create_dashboard(params = {}, options = {})
  req = build_request(:create_dashboard, params)
  req.send_request(options)
end

#create_event_data_store(params = {}) ⇒ Types::CreateEventDataStoreResponse

Creates a new event data store.

Examples:

Request syntax with placeholder values


resp = client.create_event_data_store({
  name: "EventDataStoreName", # required
  advanced_event_selectors: [
    {
      name: "SelectorName",
      field_selectors: [ # required
        {
          field: "SelectorField", # required
          equals: ["OperatorValue"],
          starts_with: ["OperatorValue"],
          ends_with: ["OperatorValue"],
          not_equals: ["OperatorValue"],
          not_starts_with: ["OperatorValue"],
          not_ends_with: ["OperatorValue"],
        },
      ],
    },
  ],
  multi_region_enabled: false,
  organization_enabled: false,
  retention_period: 1,
  termination_protection_enabled: false,
  tags_list: [
    {
      key: "TagKey", # required
      value: "TagValue",
    },
  ],
  kms_key_id: "EventDataStoreKmsKeyId",
  start_ingestion: false,
  billing_mode: "EXTENDABLE_RETENTION_PRICING", # accepts EXTENDABLE_RETENTION_PRICING, FIXED_RETENTION_PRICING
})

Response structure


resp.event_data_store_arn #=> String
resp.name #=> String
resp.status #=> String, one of "CREATED", "ENABLED", "PENDING_DELETION", "STARTING_INGESTION", "STOPPING_INGESTION", "STOPPED_INGESTION"
resp.advanced_event_selectors #=> Array
resp.advanced_event_selectors[0].name #=> String
resp.advanced_event_selectors[0].field_selectors #=> Array
resp.advanced_event_selectors[0].field_selectors[0].field #=> String
resp.advanced_event_selectors[0].field_selectors[0].equals #=> Array
resp.advanced_event_selectors[0].field_selectors[0].equals[0] #=> String
resp.advanced_event_selectors[0].field_selectors[0].starts_with #=> Array
resp.advanced_event_selectors[0].field_selectors[0].starts_with[0] #=> String
resp.advanced_event_selectors[0].field_selectors[0].ends_with #=> Array
resp.advanced_event_selectors[0].field_selectors[0].ends_with[0] #=> String
resp.advanced_event_selectors[0].field_selectors[0].not_equals #=> Array
resp.advanced_event_selectors[0].field_selectors[0].not_equals[0] #=> String
resp.advanced_event_selectors[0].field_selectors[0].not_starts_with #=> Array
resp.advanced_event_selectors[0].field_selectors[0].not_starts_with[0] #=> String
resp.advanced_event_selectors[0].field_selectors[0].not_ends_with #=> Array
resp.advanced_event_selectors[0].field_selectors[0].not_ends_with[0] #=> String
resp.multi_region_enabled #=> Boolean
resp.organization_enabled #=> Boolean
resp.retention_period #=> Integer
resp.termination_protection_enabled #=> Boolean
resp.tags_list #=> Array
resp.tags_list[0].key #=> String
resp.tags_list[0].value #=> String
resp.created_timestamp #=> Time
resp.updated_timestamp #=> Time
resp.kms_key_id #=> String
resp.billing_mode #=> String, one of "EXTENDABLE_RETENTION_PRICING", "FIXED_RETENTION_PRICING"

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :name (required, String)

    The name of the event data store.

  • :advanced_event_selectors (Array<Types::AdvancedEventSelector>)

    The advanced event selectors to use to select the events for the data store. You can configure up to five advanced event selectors for each event data store.

    For more information about how to use advanced event selectors to log CloudTrail events, see [Log events by using advanced event selectors] in the CloudTrail User Guide.

    For more information about how to use advanced event selectors to include Config configuration items in your event data store, see

    Create an event data store for Config configuration items][2

    in the

    CloudTrail User Guide.

    For more information about how to use advanced event selectors to include events outside of Amazon Web Services events in your event data store, see [Create an integration to log events from outside Amazon Web Services] in the CloudTrail User Guide.

    [1]: docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-data-events-with-cloudtrail.html#creating-data-event-selectors-advanced [2]: docs.aws.amazon.com/awscloudtrail/latest/userguide/lake-eds-cli.html#lake-cli-create-eds-config [3]: docs.aws.amazon.com/awscloudtrail/latest/userguide/lake-integrations-cli.html#lake-cli-create-integration

  • :multi_region_enabled (Boolean)

    Specifies whether the event data store includes events from all Regions, or only from the Region in which the event data store is created.

  • :organization_enabled (Boolean)

    Specifies whether an event data store collects events logged for an organization in Organizations.

  • :retention_period (Integer)

    The retention period of the event data store, in days. If ‘BillingMode` is set to `EXTENDABLE_RETENTION_PRICING`, you can set a retention period of up to 3653 days, the equivalent of 10 years. If `BillingMode` is set to `FIXED_RETENTION_PRICING`, you can set a retention period of up to 2557 days, the equivalent of seven years.

    CloudTrail Lake determines whether to retain an event by checking if the ‘eventTime` of the event is within the specified retention period. For example, if you set a retention period of 90 days, CloudTrail will remove events when the `eventTime` is older than 90 days.

    <note markdown=“1”> If you plan to copy trail events to this event data store, we recommend that you consider both the age of the events that you want to copy as well as how long you want to keep the copied events in your event data store. For example, if you copy trail events that are 5 years old and specify a retention period of 7 years, the event data store will retain those events for two years.

    </note>
    
  • :termination_protection_enabled (Boolean)

    Specifies whether termination protection is enabled for the event data store. If termination protection is enabled, you cannot delete the event data store until termination protection is disabled.

  • :tags_list (Array<Types::Tag>)

    A list of tags.

  • :kms_key_id (String)

    Specifies the KMS key ID to use to encrypt the events delivered by CloudTrail. The value can be an alias name prefixed by ‘alias/`, a fully specified ARN to an alias, a fully specified ARN to a key, or a globally unique identifier.

    Disabling or deleting the KMS key, or removing CloudTrail permissions on the key, prevents CloudTrail from logging events to the event data store, and prevents users from querying the data in the event data store that was encrypted with the key. After you associate an event data store with a KMS key, the KMS key cannot be removed or changed. Before you disable or delete a KMS key that you are using with an event data store, delete or back up your event data store.

    CloudTrail also supports KMS multi-Region keys. For more information about multi-Region keys, see [Using multi-Region keys] in the *Key Management Service Developer Guide*.

    Examples:

    • ‘alias/MyAliasName`

    • ‘arn:aws:kms:us-east-2:123456789012:alias/MyAliasName`

    • ‘arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012`

    • ‘12345678-1234-1234-1234-123456789012`

    [1]: docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html

  • :start_ingestion (Boolean)

    Specifies whether the event data store should start ingesting live events. The default is true.

  • :billing_mode (String)

    The billing mode for the event data store determines the cost for ingesting events and the default and maximum retention period for the event data store.

    The following are the possible values:

    • ‘EXTENDABLE_RETENTION_PRICING` - This billing mode is generally recommended if you want a flexible retention period of up to 3653 days (about 10 years). The default retention period for this billing mode is 366 days.

    • ‘FIXED_RETENTION_PRICING` - This billing mode is recommended if you expect to ingest more than 25 TB of event data per month and need a retention period of up to 2557 days (about 7 years). The default retention period for this billing mode is 2557 days.

    The default value is ‘EXTENDABLE_RETENTION_PRICING`.

    For more information about CloudTrail pricing, see [CloudTrail Pricing] and [Managing CloudTrail Lake costs].

    [1]: aws.amazon.com/cloudtrail/pricing/ [2]: docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-lake-manage-costs.html

Returns:

See Also:



984
985
986
987
# File 'lib/aws-sdk-cloudtrail/client.rb', line 984

def create_event_data_store(params = {}, options = {})
  req = build_request(:create_event_data_store, params)
  req.send_request(options)
end

#create_trail(params = {}) ⇒ Types::CreateTrailResponse

Creates a trail that specifies the settings for delivery of log data to an Amazon S3 bucket.

Examples:

Request syntax with placeholder values


resp = client.create_trail({
  name: "String", # required
  s3_bucket_name: "String", # required
  s3_key_prefix: "String",
  sns_topic_name: "String",
  include_global_service_events: false,
  is_multi_region_trail: false,
  enable_log_file_validation: false,
  cloud_watch_logs_log_group_arn: "String",
  cloud_watch_logs_role_arn: "String",
  kms_key_id: "String",
  is_organization_trail: false,
  tags_list: [
    {
      key: "TagKey", # required
      value: "TagValue",
    },
  ],
})

Response structure


resp.name #=> String
resp.s3_bucket_name #=> String
resp.s3_key_prefix #=> String
resp.sns_topic_name #=> String
resp.sns_topic_arn #=> String
resp.include_global_service_events #=> Boolean
resp.is_multi_region_trail #=> Boolean
resp.trail_arn #=> String
resp.log_file_validation_enabled #=> Boolean
resp.cloud_watch_logs_log_group_arn #=> String
resp.cloud_watch_logs_role_arn #=> String
resp.kms_key_id #=> String
resp.is_organization_trail #=> Boolean

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :name (required, String)

    Specifies the name of the trail. The name 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)

  • :s3_bucket_name (required, String)

    Specifies the name of the Amazon S3 bucket designated for publishing log files. For information about bucket naming rules, see [Bucket naming rules] in the *Amazon Simple Storage Service User Guide*.

    [1]: docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html

  • :s3_key_prefix (String)

    Specifies the Amazon S3 key prefix that comes after the name of the bucket you have designated for log file delivery. For more information, see [Finding Your CloudTrail Log Files]. The maximum length is 200 characters.

    [1]: docs.aws.amazon.com/awscloudtrail/latest/userguide/get-and-view-cloudtrail-log-files.html#cloudtrail-find-log-files

  • :sns_topic_name (String)

    Specifies the name of the Amazon SNS topic defined for notification of log file delivery. The maximum length is 256 characters.

  • :include_global_service_events (Boolean)

    Specifies whether the trail is publishing events from global services such as IAM to the log files.

  • :is_multi_region_trail (Boolean)

    Specifies whether the trail is created in the current Region or in all Regions. The default is false, which creates a trail only in the Region where you are signed in. As a best practice, consider creating trails that log events in all Regions.

  • :enable_log_file_validation (Boolean)

    Specifies whether log file integrity validation is enabled. The default is false.

    <note markdown=“1”> When you disable log file integrity validation, the chain of digest files is broken after one hour. CloudTrail does not create digest files for log files that were delivered during a period in which log file integrity validation was disabled. For example, if you enable log file integrity validation at noon on January 1, disable it at noon on January 2, and re-enable it at noon on January 10, digest files will not be created for the log files delivered from noon on January 2 to noon on January 10. The same applies whenever you stop CloudTrail logging or delete a trail.

    </note>
    
  • :cloud_watch_logs_log_group_arn (String)

    Specifies a log group name using an Amazon Resource Name (ARN), a unique identifier that represents the log group to which CloudTrail logs will be delivered. You must use a log group that exists in your account.

    Not required unless you specify ‘CloudWatchLogsRoleArn`.

  • :cloud_watch_logs_role_arn (String)

    Specifies the role for the CloudWatch Logs endpoint to assume to write to a user’s log group. You must use a role that exists in your account.

  • :kms_key_id (String)

    Specifies the KMS key ID to use to encrypt the logs delivered by CloudTrail. The value can be an alias name prefixed by ‘alias/`, a fully specified ARN to an alias, a fully specified ARN to a key, or a globally unique identifier.

    CloudTrail also supports KMS multi-Region keys. For more information about multi-Region keys, see [Using multi-Region keys] in the *Key Management Service Developer Guide*.

    Examples:

    • ‘alias/MyAliasName`

    • ‘arn:aws:kms:us-east-2:123456789012:alias/MyAliasName`

    • ‘arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012`

    • ‘12345678-1234-1234-1234-123456789012`

    [1]: docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html

  • :is_organization_trail (Boolean)

    Specifies whether the trail is created for all accounts in an organization in Organizations, or only for the current Amazon Web Services account. The default is false, and cannot be true unless the call is made on behalf of an Amazon Web Services account that is the management account or delegated administrator account for an organization in Organizations.

  • :tags_list (Array<Types::Tag>)

    A list of tags.

Returns:

See Also:



1163
1164
1165
1166
# File 'lib/aws-sdk-cloudtrail/client.rb', line 1163

def create_trail(params = {}, options = {})
  req = build_request(:create_trail, params)
  req.send_request(options)
end

#delete_channel(params = {}) ⇒ Struct

Deletes a channel.

Examples:

Request syntax with placeholder values


resp = client.delete_channel({
  channel: "ChannelArn", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :channel (required, String)

    The ARN or the ‘UUID` value of the channel that you want to delete.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



1185
1186
1187
1188
# File 'lib/aws-sdk-cloudtrail/client.rb', line 1185

def delete_channel(params = {}, options = {})
  req = build_request(:delete_channel, params)
  req.send_request(options)
end

#delete_dashboard(params = {}) ⇒ Struct

Deletes the specified dashboard. You cannot delete a dashboard that has termination protection enabled.

Examples:

Request syntax with placeholder values


resp = client.delete_dashboard({
  dashboard_id: "DashboardArn", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :dashboard_id (required, String)

    The name or ARN for the dashboard.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



1208
1209
1210
1211
# File 'lib/aws-sdk-cloudtrail/client.rb', line 1208

def delete_dashboard(params = {}, options = {})
  req = build_request(:delete_dashboard, params)
  req.send_request(options)
end

#delete_event_data_store(params = {}) ⇒ Struct

Disables the event data store specified by ‘EventDataStore`, which accepts an event data store ARN. After you run `DeleteEventDataStore`, the event data store enters a `PENDING_DELETION` state, and is automatically deleted after a wait period of seven days. `TerminationProtectionEnabled` must be set to `False` on the event data store and the `FederationStatus` must be `DISABLED`. You cannot delete an event data store if `TerminationProtectionEnabled` is `True` or the `FederationStatus` is `ENABLED`.

After you run ‘DeleteEventDataStore` on an event data store, you cannot run `ListQueries`, `DescribeQuery`, or `GetQueryResults` on queries that are using an event data store in a `PENDING_DELETION` state. An event data store in the `PENDING_DELETION` state does not incur costs.

Examples:

Request syntax with placeholder values


resp = client.delete_event_data_store({
  event_data_store: "EventDataStoreArn", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :event_data_store (required, String)

    The ARN (or the ID suffix of the ARN) of the event data store to delete.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



1244
1245
1246
1247
# File 'lib/aws-sdk-cloudtrail/client.rb', line 1244

def delete_event_data_store(params = {}, options = {})
  req = build_request(:delete_event_data_store, params)
  req.send_request(options)
end

#delete_resource_policy(params = {}) ⇒ Struct

Deletes the resource-based policy attached to the CloudTrail event data store, dashboard, or channel.

Examples:

Request syntax with placeholder values


resp = client.delete_resource_policy({
  resource_arn: "ResourceArn", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :resource_arn (required, String)

    The Amazon Resource Name (ARN) of the CloudTrail event data store, dashboard, or channel you’re deleting the resource-based policy from.

    Example event data store ARN format: ‘arn:aws:cloudtrail:us-east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f-8bd1-bcf6cEXAMPLE`

    Example dashboard ARN format: ‘arn:aws:cloudtrail:us-east-1:123456789012:dashboard/exampleDash`

    Example channel ARN format: ‘arn:aws:cloudtrail:us-east-2:123456789012:channel/01234567890`

Returns:

  • (Struct)

    Returns an empty response.

See Also:



1277
1278
1279
1280
# File 'lib/aws-sdk-cloudtrail/client.rb', line 1277

def delete_resource_policy(params = {}, options = {})
  req = build_request(:delete_resource_policy, params)
  req.send_request(options)
end

#delete_trail(params = {}) ⇒ Struct

Deletes a trail. This operation must be called from the Region in which the trail was created. ‘DeleteTrail` cannot be called on the shadow trails (replicated trails in other Regions) of a trail that is enabled in all Regions.

Examples:

Request syntax with placeholder values


resp = client.delete_trail({
  name: "String", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :name (required, String)

    Specifies the name or the CloudTrail ARN of the trail to be deleted. The following is the format of a trail ARN. ‘arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail`

Returns:

  • (Struct)

    Returns an empty response.

See Also:



1304
1305
1306
1307
# File 'lib/aws-sdk-cloudtrail/client.rb', line 1304

def delete_trail(params = {}, options = {})
  req = build_request(:delete_trail, params)
  req.send_request(options)
end

#deregister_organization_delegated_admin(params = {}) ⇒ Struct

Removes CloudTrail delegated administrator permissions from a member account in an organization.

Examples:

Request syntax with placeholder values


resp = client.deregister_organization_delegated_admin({
  delegated_admin_account_id: "AccountId", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :delegated_admin_account_id (required, String)

    A delegated administrator account ID. This is a member account in an organization that is currently designated as a delegated administrator.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



1329
1330
1331
1332
# File 'lib/aws-sdk-cloudtrail/client.rb', line 1329

def deregister_organization_delegated_admin(params = {}, options = {})
  req = build_request(:deregister_organization_delegated_admin, params)
  req.send_request(options)
end

#describe_query(params = {}) ⇒ Types::DescribeQueryResponse

Returns metadata about a query, including query run time in milliseconds, number of events scanned and matched, and query status. If the query results were delivered to an S3 bucket, the response also provides the S3 URI and the delivery status.

You must specify either ‘QueryId` or `QueryAlias`. Specifying the `QueryAlias` parameter returns information about the last query run for the alias. You can provide `RefreshId` along with `QueryAlias` to view the query results of a dashboard query for the specified `RefreshId`.

Examples:

Request syntax with placeholder values


resp = client.describe_query({
  event_data_store: "EventDataStoreArn",
  query_id: "UUID",
  query_alias: "QueryAlias",
  refresh_id: "RefreshId",
  event_data_store_owner_account_id: "AccountId",
})

Response structure


resp.query_id #=> String
resp.query_string #=> String
resp.query_status #=> String, one of "QUEUED", "RUNNING", "FINISHED", "FAILED", "CANCELLED", "TIMED_OUT"
resp.query_statistics.events_matched #=> Integer
resp.query_statistics.events_scanned #=> Integer
resp.query_statistics.bytes_scanned #=> Integer
resp.query_statistics.execution_time_in_millis #=> Integer
resp.query_statistics.creation_time #=> Time
resp.error_message #=> String
resp.delivery_s3_uri #=> String
resp.delivery_status #=> String, one of "SUCCESS", "FAILED", "FAILED_SIGNING_FILE", "PENDING", "RESOURCE_NOT_FOUND", "ACCESS_DENIED", "ACCESS_DENIED_SIGNING_FILE", "CANCELLED", "UNKNOWN"
resp.prompt #=> String
resp. #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :event_data_store (String)

    The ARN (or the ID suffix of the ARN) of an event data store on which the specified query was run.

  • :query_id (String)

    The query ID.

  • :query_alias (String)

    The alias that identifies a query template.

  • :refresh_id (String)

    The ID of the dashboard refresh.

  • :event_data_store_owner_account_id (String)

    The account ID of the event data store owner.

Returns:

See Also:



1403
1404
1405
1406
# File 'lib/aws-sdk-cloudtrail/client.rb', line 1403

def describe_query(params = {}, options = {})
  req = build_request(:describe_query, params)
  req.send_request(options)
end

#describe_trails(params = {}) ⇒ Types::DescribeTrailsResponse

Retrieves settings for one or more trails associated with the current Region for your account.

Examples:

Request syntax with placeholder values


resp = client.describe_trails({
  trail_name_list: ["String"],
  include_shadow_trails: false,
})

Response structure


resp.trail_list #=> Array
resp.trail_list[0].name #=> String
resp.trail_list[0].s3_bucket_name #=> String
resp.trail_list[0].s3_key_prefix #=> String
resp.trail_list[0].sns_topic_name #=> String
resp.trail_list[0].sns_topic_arn #=> String
resp.trail_list[0].include_global_service_events #=> Boolean
resp.trail_list[0].is_multi_region_trail #=> Boolean
resp.trail_list[0].home_region #=> String
resp.trail_list[0].trail_arn #=> String
resp.trail_list[0].log_file_validation_enabled #=> Boolean
resp.trail_list[0].cloud_watch_logs_log_group_arn #=> String
resp.trail_list[0].cloud_watch_logs_role_arn #=> String
resp.trail_list[0].kms_key_id #=> String
resp.trail_list[0].has_custom_event_selectors #=> Boolean
resp.trail_list[0].has_insight_selectors #=> Boolean
resp.trail_list[0].is_organization_trail #=> Boolean

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :trail_name_list (Array<String>)

    Specifies a list of trail names, trail ARNs, or both, of the trails to describe. The format of a trail ARN is:

    ‘arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail`

    If an empty list is specified, information for the trail in the current Region is returned.

    • If an empty list is specified and ‘IncludeShadowTrails` is false, then information for all trails in the current Region is returned.

    • If an empty list is specified and IncludeShadowTrails is null or true, then information for all trails in the current Region and any associated shadow trails in other Regions is returned.

    <note markdown=“1”> If one or more trail names are specified, information is returned only if the names match the names of trails belonging only to the current Region and current account. To return information about a trail in another Region, you must specify its trail ARN.

    </note>
    
  • :include_shadow_trails (Boolean)

    Specifies whether to include shadow trails in the response. A shadow trail is the replication in a Region of a trail that was created in a different Region, or in the case of an organization trail, the replication of an organization trail in member accounts. If you do not include shadow trails, organization trails in a member account and Region replication trails will not be returned. The default is true.

Returns:

See Also:



1477
1478
1479
1480
# File 'lib/aws-sdk-cloudtrail/client.rb', line 1477

def describe_trails(params = {}, options = {})
  req = build_request(:describe_trails, params)
  req.send_request(options)
end

#disable_federation(params = {}) ⇒ Types::DisableFederationResponse

Disables Lake query federation on the specified event data store. When you disable federation, CloudTrail disables the integration with Glue, Lake Formation, and Amazon Athena. After disabling Lake query federation, you can no longer query your event data in Amazon Athena.

No CloudTrail Lake data is deleted when you disable federation and you can continue to run queries in CloudTrail Lake.

Examples:

Request syntax with placeholder values


resp = client.disable_federation({
  event_data_store: "EventDataStoreArn", # required
})

Response structure


resp.event_data_store_arn #=> String
resp.federation_status #=> String, one of "ENABLING", "ENABLED", "DISABLING", "DISABLED"

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :event_data_store (required, String)

    The ARN (or ID suffix of the ARN) of the event data store for which you want to disable Lake query federation.

Returns:

See Also:



1514
1515
1516
1517
# File 'lib/aws-sdk-cloudtrail/client.rb', line 1514

def disable_federation(params = {}, options = {})
  req = build_request(:disable_federation, params)
  req.send_request(options)
end

#enable_federation(params = {}) ⇒ Types::EnableFederationResponse

Enables Lake query federation on the specified event data store. Federating an event data store lets you view the metadata associated with the event data store in the Glue [Data Catalog] and run SQL queries against your event data using Amazon Athena. The table metadata stored in the Glue Data Catalog lets the Athena query engine know how to find, read, and process the data that you want to query.

When you enable Lake query federation, CloudTrail creates a managed database named ‘aws:cloudtrail` (if the database doesn’t already exist) and a managed federated table in the Glue Data Catalog. The event data store ID is used for the table name. CloudTrail registers the role ARN and event data store in [Lake Formation], the service responsible for allowing fine-grained access control of the federated resources in the Glue Data Catalog.

For more information about Lake query federation, see [Federate an event data store].

[1]: docs.aws.amazon.com/glue/latest/dg/components-overview.html#data-catalog-intro [2]: docs.aws.amazon.com/awscloudtrail/latest/userguide/query-federation-lake-formation.html [3]: docs.aws.amazon.com/awscloudtrail/latest/userguide/query-federation.html

Examples:

Request syntax with placeholder values


resp = client.enable_federation({
  event_data_store: "EventDataStoreArn", # required
  federation_role_arn: "FederationRoleArn", # required
})

Response structure


resp.event_data_store_arn #=> String
resp.federation_status #=> String, one of "ENABLING", "ENABLED", "DISABLING", "DISABLED"
resp.federation_role_arn #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :event_data_store (required, String)

    The ARN (or ID suffix of the ARN) of the event data store for which you want to enable Lake query federation.

  • :federation_role_arn (required, String)

    The ARN of the federation role to use for the event data store. Amazon Web Services services like Lake Formation use this federation role to access data for the federated event data store. The federation role must exist in your account and provide the [required minimum permissions].

    [1]: docs.aws.amazon.com/awscloudtrail/latest/userguide/query-federation.html#query-federation-permissions-role

Returns:

See Also:



1581
1582
1583
1584
# File 'lib/aws-sdk-cloudtrail/client.rb', line 1581

def enable_federation(params = {}, options = {})
  req = build_request(:enable_federation, params)
  req.send_request(options)
end

#generate_query(params = {}) ⇒ Types::GenerateQueryResponse

Generates a query from a natural language prompt. This operation uses generative artificial intelligence (generative AI) to produce a ready-to-use SQL query from the prompt.

The prompt can be a question or a statement about the event data in your event data store. For example, you can enter prompts like “What are my top errors in the past month?” and “Give me a list of users that used SNS.”

The prompt must be in English. For information about limitations, permissions, and supported Regions, see [Create CloudTrail Lake queries from natural language prompts] in the CloudTrail user guide.

<note markdown=“1”> Do not include any personally identifying, confidential, or sensitive information in your prompts.

This feature uses generative AI large language models (LLMs); we

recommend double-checking the LLM response.

</note>

[1]: docs.aws.amazon.com/awscloudtrail/latest/userguide/lake-query-generator.html

Examples:

Request syntax with placeholder values


resp = client.generate_query({
  event_data_stores: ["EventDataStoreArn"], # required
  prompt: "Prompt", # required
})

Response structure


resp.query_statement #=> String
resp.query_alias #=> String
resp. #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

Returns:

See Also:



1648
1649
1650
1651
# File 'lib/aws-sdk-cloudtrail/client.rb', line 1648

def generate_query(params = {}, options = {})
  req = build_request(:generate_query, params)
  req.send_request(options)
end

#get_channel(params = {}) ⇒ Types::GetChannelResponse

Returns information about a specific channel.

Examples:

Request syntax with placeholder values


resp = client.get_channel({
  channel: "ChannelArn", # required
})

Response structure


resp.channel_arn #=> String
resp.name #=> String
resp.source #=> String
resp.source_config.apply_to_all_regions #=> Boolean
resp.source_config.advanced_event_selectors #=> Array
resp.source_config.advanced_event_selectors[0].name #=> String
resp.source_config.advanced_event_selectors[0].field_selectors #=> Array
resp.source_config.advanced_event_selectors[0].field_selectors[0].field #=> String
resp.source_config.advanced_event_selectors[0].field_selectors[0].equals #=> Array
resp.source_config.advanced_event_selectors[0].field_selectors[0].equals[0] #=> String
resp.source_config.advanced_event_selectors[0].field_selectors[0].starts_with #=> Array
resp.source_config.advanced_event_selectors[0].field_selectors[0].starts_with[0] #=> String
resp.source_config.advanced_event_selectors[0].field_selectors[0].ends_with #=> Array
resp.source_config.advanced_event_selectors[0].field_selectors[0].ends_with[0] #=> String
resp.source_config.advanced_event_selectors[0].field_selectors[0].not_equals #=> Array
resp.source_config.advanced_event_selectors[0].field_selectors[0].not_equals[0] #=> String
resp.source_config.advanced_event_selectors[0].field_selectors[0].not_starts_with #=> Array
resp.source_config.advanced_event_selectors[0].field_selectors[0].not_starts_with[0] #=> String
resp.source_config.advanced_event_selectors[0].field_selectors[0].not_ends_with #=> Array
resp.source_config.advanced_event_selectors[0].field_selectors[0].not_ends_with[0] #=> String
resp.destinations #=> Array
resp.destinations[0].type #=> String, one of "EVENT_DATA_STORE", "AWS_SERVICE"
resp.destinations[0].location #=> String
resp.ingestion_status.latest_ingestion_success_time #=> Time
resp.ingestion_status.latest_ingestion_success_event_id #=> String
resp.ingestion_status.latest_ingestion_error_code #=> String
resp.ingestion_status.latest_ingestion_attempt_time #=> Time
resp.ingestion_status.latest_ingestion_attempt_event_id #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :channel (required, String)

    The ARN or ‘UUID` of a channel.

Returns:

See Also:



1708
1709
1710
1711
# File 'lib/aws-sdk-cloudtrail/client.rb', line 1708

def get_channel(params = {}, options = {})
  req = build_request(:get_channel, params)
  req.send_request(options)
end

#get_dashboard(params = {}) ⇒ Types::GetDashboardResponse

Returns the specified dashboard.

Examples:

Request syntax with placeholder values


resp = client.get_dashboard({
  dashboard_id: "DashboardArn", # required
})

Response structure


resp.dashboard_arn #=> String
resp.type #=> String, one of "MANAGED", "CUSTOM"
resp.status #=> String, one of "CREATING", "CREATED", "UPDATING", "UPDATED", "DELETING"
resp.widgets #=> Array
resp.widgets[0].query_alias #=> String
resp.widgets[0].query_statement #=> String
resp.widgets[0].query_parameters #=> Array
resp.widgets[0].query_parameters[0] #=> String
resp.widgets[0].view_properties #=> Hash
resp.widgets[0].view_properties["ViewPropertiesKey"] #=> String
resp.refresh_schedule.frequency.unit #=> String, one of "HOURS", "DAYS"
resp.refresh_schedule.frequency.value #=> Integer
resp.refresh_schedule.status #=> String, one of "ENABLED", "DISABLED"
resp.refresh_schedule.time_of_day #=> String
resp.created_timestamp #=> Time
resp.updated_timestamp #=> Time
resp.last_refresh_id #=> String
resp.last_refresh_failure_reason #=> String
resp.termination_protection_enabled #=> Boolean

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :dashboard_id (required, String)

    The name or ARN for the dashboard.

Returns:

See Also:



1763
1764
1765
1766
# File 'lib/aws-sdk-cloudtrail/client.rb', line 1763

def get_dashboard(params = {}, options = {})
  req = build_request(:get_dashboard, params)
  req.send_request(options)
end

#get_event_data_store(params = {}) ⇒ Types::GetEventDataStoreResponse

Returns information about an event data store specified as either an ARN or the ID portion of the ARN.

Examples:

Request syntax with placeholder values


resp = client.get_event_data_store({
  event_data_store: "EventDataStoreArn", # required
})

Response structure


resp.event_data_store_arn #=> String
resp.name #=> String
resp.status #=> String, one of "CREATED", "ENABLED", "PENDING_DELETION", "STARTING_INGESTION", "STOPPING_INGESTION", "STOPPED_INGESTION"
resp.advanced_event_selectors #=> Array
resp.advanced_event_selectors[0].name #=> String
resp.advanced_event_selectors[0].field_selectors #=> Array
resp.advanced_event_selectors[0].field_selectors[0].field #=> String
resp.advanced_event_selectors[0].field_selectors[0].equals #=> Array
resp.advanced_event_selectors[0].field_selectors[0].equals[0] #=> String
resp.advanced_event_selectors[0].field_selectors[0].starts_with #=> Array
resp.advanced_event_selectors[0].field_selectors[0].starts_with[0] #=> String
resp.advanced_event_selectors[0].field_selectors[0].ends_with #=> Array
resp.advanced_event_selectors[0].field_selectors[0].ends_with[0] #=> String
resp.advanced_event_selectors[0].field_selectors[0].not_equals #=> Array
resp.advanced_event_selectors[0].field_selectors[0].not_equals[0] #=> String
resp.advanced_event_selectors[0].field_selectors[0].not_starts_with #=> Array
resp.advanced_event_selectors[0].field_selectors[0].not_starts_with[0] #=> String
resp.advanced_event_selectors[0].field_selectors[0].not_ends_with #=> Array
resp.advanced_event_selectors[0].field_selectors[0].not_ends_with[0] #=> String
resp.multi_region_enabled #=> Boolean
resp.organization_enabled #=> Boolean
resp.retention_period #=> Integer
resp.termination_protection_enabled #=> Boolean
resp.created_timestamp #=> Time
resp.updated_timestamp #=> Time
resp.kms_key_id #=> String
resp.billing_mode #=> String, one of "EXTENDABLE_RETENTION_PRICING", "FIXED_RETENTION_PRICING"
resp.federation_status #=> String, one of "ENABLING", "ENABLED", "DISABLING", "DISABLED"
resp.federation_role_arn #=> String
resp.partition_keys #=> Array
resp.partition_keys[0].name #=> String
resp.partition_keys[0].type #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :event_data_store (required, String)

    The ARN (or ID suffix of the ARN) of the event data store about which you want information.

Returns:

See Also:



1838
1839
1840
1841
# File 'lib/aws-sdk-cloudtrail/client.rb', line 1838

def get_event_data_store(params = {}, options = {})
  req = build_request(:get_event_data_store, params)
  req.send_request(options)
end

#get_event_selectors(params = {}) ⇒ Types::GetEventSelectorsResponse

Describes the settings for the event selectors that you configured for your trail. The information returned for your event selectors includes the following:

  • If your event selector includes read-only events, write-only events, or all events. This applies to management events, data events, and network activity events.

  • If your event selector includes management events.

  • If your event selector includes network activity events, the event sources for which you are logging network activity events.

  • If your event selector includes data events, the resources on which you are logging data events.

For more information about logging management, data, and network activity events, see the following topics in the *CloudTrail User Guide*:

  • Logging management events][1
  • Logging data events][2
  • Logging network activity events][3

[1]: docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-management-events-with-cloudtrail.html [2]: docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-data-events-with-cloudtrail.html [3]: docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-network-events-with-cloudtrail.html

Examples:

Request syntax with placeholder values


resp = client.get_event_selectors({
  trail_name: "String", # required
})

Response structure


resp.trail_arn #=> String
resp.event_selectors #=> Array
resp.event_selectors[0].read_write_type #=> String, one of "ReadOnly", "WriteOnly", "All"
resp.event_selectors[0].include_management_events #=> Boolean
resp.event_selectors[0].data_resources #=> Array
resp.event_selectors[0].data_resources[0].type #=> String
resp.event_selectors[0].data_resources[0].values #=> Array
resp.event_selectors[0].data_resources[0].values[0] #=> String
resp.event_selectors[0].exclude_management_event_sources #=> Array
resp.event_selectors[0].exclude_management_event_sources[0] #=> String
resp.advanced_event_selectors #=> Array
resp.advanced_event_selectors[0].name #=> String
resp.advanced_event_selectors[0].field_selectors #=> Array
resp.advanced_event_selectors[0].field_selectors[0].field #=> String
resp.advanced_event_selectors[0].field_selectors[0].equals #=> Array
resp.advanced_event_selectors[0].field_selectors[0].equals[0] #=> String
resp.advanced_event_selectors[0].field_selectors[0].starts_with #=> Array
resp.advanced_event_selectors[0].field_selectors[0].starts_with[0] #=> String
resp.advanced_event_selectors[0].field_selectors[0].ends_with #=> Array
resp.advanced_event_selectors[0].field_selectors[0].ends_with[0] #=> String
resp.advanced_event_selectors[0].field_selectors[0].not_equals #=> Array
resp.advanced_event_selectors[0].field_selectors[0].not_equals[0] #=> String
resp.advanced_event_selectors[0].field_selectors[0].not_starts_with #=> Array
resp.advanced_event_selectors[0].field_selectors[0].not_starts_with[0] #=> String
resp.advanced_event_selectors[0].field_selectors[0].not_ends_with #=> Array
resp.advanced_event_selectors[0].field_selectors[0].not_ends_with[0] #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :trail_name (required, String)

    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 format:

    ‘arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail`

Returns:

See Also:



1940
1941
1942
1943
# File 'lib/aws-sdk-cloudtrail/client.rb', line 1940

def get_event_selectors(params = {}, options = {})
  req = build_request(:get_event_selectors, params)
  req.send_request(options)
end

#get_import(params = {}) ⇒ Types::GetImportResponse

Returns information about a specific import.

Examples:

Request syntax with placeholder values


resp = client.get_import({
  import_id: "UUID", # required
})

Response structure


resp.import_id #=> String
resp.destinations #=> Array
resp.destinations[0] #=> String
resp.import_source.s3.s3_location_uri #=> String
resp.import_source.s3.s3_bucket_region #=> String
resp.import_source.s3.s3_bucket_access_role_arn #=> String
resp.start_event_time #=> Time
resp.end_event_time #=> Time
resp.import_status #=> String, one of "INITIALIZING", "IN_PROGRESS", "FAILED", "STOPPED", "COMPLETED"
resp.created_timestamp #=> Time
resp.updated_timestamp #=> Time
resp.import_statistics.prefixes_found #=> Integer
resp.import_statistics.prefixes_completed #=> Integer
resp.import_statistics.files_completed #=> Integer
resp.import_statistics.events_completed #=> Integer
resp.import_statistics.failed_entries #=> Integer

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :import_id (required, String)

    The ID for the import.

Returns:

See Also:



1991
1992
1993
1994
# File 'lib/aws-sdk-cloudtrail/client.rb', line 1991

def get_import(params = {}, options = {})
  req = build_request(:get_import, params)
  req.send_request(options)
end

#get_insight_selectors(params = {}) ⇒ Types::GetInsightSelectorsResponse

Describes the settings for the Insights event selectors that you configured for your trail or event data store. ‘GetInsightSelectors` shows if CloudTrail Insights event logging is enabled on the trail or event data store, and if it is, which Insights types are enabled. If you run `GetInsightSelectors` on a trail or event data store that does not have Insights events enabled, the operation throws the exception `InsightNotEnabledException`

Specify either the ‘EventDataStore` parameter to get Insights event selectors for an event data store, or the `TrailName` parameter to the get Insights event selectors for a trail. You cannot specify these parameters together.

For more information, see [Logging CloudTrail Insights events] in the *CloudTrail User Guide*.

[1]: docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-insights-events-with-cloudtrail.html

Examples:

Request syntax with placeholder values


resp = client.get_insight_selectors({
  trail_name: "String",
  event_data_store: "EventDataStoreArn",
})

Response structure


resp.trail_arn #=> String
resp.insight_selectors #=> Array
resp.insight_selectors[0].insight_type #=> String, one of "ApiCallRateInsight", "ApiErrorRateInsight"
resp.event_data_store_arn #=> String
resp.insights_destination #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :trail_name (String)

    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 format:

    ‘arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail`

    You cannot use this parameter with the ‘EventDataStore` parameter.

  • :event_data_store (String)

    Specifies the ARN (or ID suffix of the ARN) of the event data store for which you want to get Insights selectors.

    You cannot use this parameter with the ‘TrailName` parameter.

Returns:

See Also:



2070
2071
2072
2073
# File 'lib/aws-sdk-cloudtrail/client.rb', line 2070

def get_insight_selectors(params = {}, options = {})
  req = build_request(:get_insight_selectors, params)
  req.send_request(options)
end

#get_query_results(params = {}) ⇒ Types::GetQueryResultsResponse

Gets event data results of a query. You must specify the ‘QueryID` value returned by the `StartQuery` operation.

The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.

Examples:

Request syntax with placeholder values


resp = client.get_query_results({
  event_data_store: "EventDataStoreArn",
  query_id: "UUID", # required
  next_token: "PaginationToken",
  max_query_results: 1,
  event_data_store_owner_account_id: "AccountId",
})

Response structure


resp.query_status #=> String, one of "QUEUED", "RUNNING", "FINISHED", "FAILED", "CANCELLED", "TIMED_OUT"
resp.query_statistics.results_count #=> Integer
resp.query_statistics.total_results_count #=> Integer
resp.query_statistics.bytes_scanned #=> Integer
resp.query_result_rows #=> Array
resp.query_result_rows[0] #=> Array
resp.query_result_rows[0][0] #=> Hash
resp.query_result_rows[0][0]["QueryResultKey"] #=> String
resp.next_token #=> String
resp.error_message #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :event_data_store (String)

    The ARN (or ID suffix of the ARN) of the event data store against which the query was run.

  • :query_id (required, String)

    The ID of the query for which you want to get results.

  • :next_token (String)

    A token you can use to get the next page of query results.

  • :max_query_results (Integer)

    The maximum number of query results to display on a single page.

  • :event_data_store_owner_account_id (String)

    The account ID of the event data store owner.

Returns:

See Also:



2131
2132
2133
2134
# File 'lib/aws-sdk-cloudtrail/client.rb', line 2131

def get_query_results(params = {}, options = {})
  req = build_request(:get_query_results, params)
  req.send_request(options)
end

#get_resource_policy(params = {}) ⇒ Types::GetResourcePolicyResponse

Retrieves the JSON text of the resource-based policy document attached to the CloudTrail event data store, dashboard, or channel.

Examples:

Request syntax with placeholder values


resp = client.get_resource_policy({
  resource_arn: "ResourceArn", # required
})

Response structure


resp.resource_arn #=> String
resp.resource_policy #=> String
resp.delegated_admin_resource_policy #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :resource_arn (required, String)

    The Amazon Resource Name (ARN) of the CloudTrail event data store, dashboard, or channel attached to the resource-based policy.

    Example event data store ARN format: ‘arn:aws:cloudtrail:us-east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f-8bd1-bcf6cEXAMPLE`

    Example dashboard ARN format: ‘arn:aws:cloudtrail:us-east-1:123456789012:dashboard/exampleDash`

    Example channel ARN format: ‘arn:aws:cloudtrail:us-east-2:123456789012:channel/01234567890`

Returns:

See Also:



2174
2175
2176
2177
# File 'lib/aws-sdk-cloudtrail/client.rb', line 2174

def get_resource_policy(params = {}, options = {})
  req = build_request(:get_resource_policy, params)
  req.send_request(options)
end

#get_trail(params = {}) ⇒ Types::GetTrailResponse

Returns settings information for a specified trail.

Examples:

Request syntax with placeholder values


resp = client.get_trail({
  name: "String", # required
})

Response structure


resp.trail.name #=> String
resp.trail.s3_bucket_name #=> String
resp.trail.s3_key_prefix #=> String
resp.trail.sns_topic_name #=> String
resp.trail.sns_topic_arn #=> String
resp.trail.include_global_service_events #=> Boolean
resp.trail.is_multi_region_trail #=> Boolean
resp.trail.home_region #=> String
resp.trail.trail_arn #=> String
resp.trail.log_file_validation_enabled #=> Boolean
resp.trail.cloud_watch_logs_log_group_arn #=> String
resp.trail.cloud_watch_logs_role_arn #=> String
resp.trail.kms_key_id #=> String
resp.trail.has_custom_event_selectors #=> Boolean
resp.trail.has_insight_selectors #=> Boolean
resp.trail.is_organization_trail #=> Boolean

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :name (required, String)

    The name or the Amazon Resource Name (ARN) of the trail for which you want to retrieve settings information.

Returns:

See Also:



2218
2219
2220
2221
# File 'lib/aws-sdk-cloudtrail/client.rb', line 2218

def get_trail(params = {}, options = {})
  req = build_request(:get_trail, params)
  req.send_request(options)
end

#get_trail_status(params = {}) ⇒ Types::GetTrailStatusResponse

Returns a JSON-formatted list of information about the specified trail. Fields include information on delivery errors, Amazon SNS and Amazon S3 errors, and start and stop logging times for each trail. This operation returns trail status from a single Region. To return trail status from all Regions, you must call the operation on each Region.

Examples:

Request syntax with placeholder values


resp = client.get_trail_status({
  name: "String", # required
})

Response structure


resp.is_logging #=> Boolean
resp.latest_delivery_error #=> String
resp.latest_notification_error #=> String
resp.latest_delivery_time #=> Time
resp.latest_notification_time #=> Time
resp.start_logging_time #=> Time
resp.stop_logging_time #=> Time
resp.latest_cloud_watch_logs_delivery_error #=> String
resp.latest_cloud_watch_logs_delivery_time #=> Time
resp.latest_digest_delivery_time #=> Time
resp.latest_digest_delivery_error #=> String
resp.latest_delivery_attempt_time #=> String
resp.latest_notification_attempt_time #=> String
resp.latest_notification_attempt_succeeded #=> String
resp.latest_delivery_attempt_succeeded #=> String
resp.time_logging_started #=> String
resp.time_logging_stopped #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :name (required, String)

    Specifies the name or the CloudTrail ARN of the trail for which you are requesting status. To get the status of a shadow trail (a replication of the trail in another Region), you must specify its ARN.

    The following is the format of a trail ARN: ‘arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail`

    <note markdown=“1”> If the trail is an organization trail and you are a member account in the organization in Organizations, you must provide the full ARN of that trail, and not just the name.

    </note>
    

Returns:

See Also:



2294
2295
2296
2297
# File 'lib/aws-sdk-cloudtrail/client.rb', line 2294

def get_trail_status(params = {}, options = {})
  req = build_request(:get_trail_status, params)
  req.send_request(options)
end

#list_channels(params = {}) ⇒ Types::ListChannelsResponse

Lists the channels in the current account, and their source names.

The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.

Examples:

Request syntax with placeholder values


resp = client.list_channels({
  max_results: 1,
  next_token: "PaginationToken",
})

Response structure


resp.channels #=> Array
resp.channels[0].channel_arn #=> String
resp.channels[0].name #=> String
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :max_results (Integer)

    The maximum number of CloudTrail channels to display on a single page.

  • :next_token (String)

    The token to use to get the next page of results after a previous API call. This token must be passed in with the same parameters that were specified in the original call. For example, if the original call specified an AttributeKey of ‘Username’ with a value of ‘root’, the call with NextToken should include those same parameters.

Returns:

See Also:



2336
2337
2338
2339
# File 'lib/aws-sdk-cloudtrail/client.rb', line 2336

def list_channels(params = {}, options = {})
  req = build_request(:list_channels, params)
  req.send_request(options)
end

#list_dashboards(params = {}) ⇒ Types::ListDashboardsResponse

Returns information about all dashboards in the account, in the current Region.

Examples:

Request syntax with placeholder values


resp = client.list_dashboards({
  name_prefix: "DashboardName",
  type: "MANAGED", # accepts MANAGED, CUSTOM
  next_token: "PaginationToken",
  max_results: 1,
})

Response structure


resp.dashboards #=> Array
resp.dashboards[0].dashboard_arn #=> String
resp.dashboards[0].type #=> String, one of "MANAGED", "CUSTOM"
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :name_prefix (String)

    Specify a name prefix to filter on.

  • :type (String)

    Specify a dashboard type to filter on: ‘CUSTOM` or `MANAGED`.

  • :next_token (String)

    A token you can use to get the next page of dashboard results.

  • :max_results (Integer)

    The maximum number of dashboards to display on a single page.

Returns:

See Also:



2381
2382
2383
2384
# File 'lib/aws-sdk-cloudtrail/client.rb', line 2381

def list_dashboards(params = {}, options = {})
  req = build_request(:list_dashboards, params)
  req.send_request(options)
end

#list_event_data_stores(params = {}) ⇒ Types::ListEventDataStoresResponse

Returns information about all event data stores in the account, in the current Region.

The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.

Examples:

Request syntax with placeholder values


resp = client.list_event_data_stores({
  next_token: "PaginationToken",
  max_results: 1,
})

Response structure


resp.event_data_stores #=> Array
resp.event_data_stores[0].event_data_store_arn #=> String
resp.event_data_stores[0].name #=> String
resp.event_data_stores[0].termination_protection_enabled #=> Boolean
resp.event_data_stores[0].status #=> String, one of "CREATED", "ENABLED", "PENDING_DELETION", "STARTING_INGESTION", "STOPPING_INGESTION", "STOPPED_INGESTION"
resp.event_data_stores[0].advanced_event_selectors #=> Array
resp.event_data_stores[0].advanced_event_selectors[0].name #=> String
resp.event_data_stores[0].advanced_event_selectors[0].field_selectors #=> Array
resp.event_data_stores[0].advanced_event_selectors[0].field_selectors[0].field #=> String
resp.event_data_stores[0].advanced_event_selectors[0].field_selectors[0].equals #=> Array
resp.event_data_stores[0].advanced_event_selectors[0].field_selectors[0].equals[0] #=> String
resp.event_data_stores[0].advanced_event_selectors[0].field_selectors[0].starts_with #=> Array
resp.event_data_stores[0].advanced_event_selectors[0].field_selectors[0].starts_with[0] #=> String
resp.event_data_stores[0].advanced_event_selectors[0].field_selectors[0].ends_with #=> Array
resp.event_data_stores[0].advanced_event_selectors[0].field_selectors[0].ends_with[0] #=> String
resp.event_data_stores[0].advanced_event_selectors[0].field_selectors[0].not_equals #=> Array
resp.event_data_stores[0].advanced_event_selectors[0].field_selectors[0].not_equals[0] #=> String
resp.event_data_stores[0].advanced_event_selectors[0].field_selectors[0].not_starts_with #=> Array
resp.event_data_stores[0].advanced_event_selectors[0].field_selectors[0].not_starts_with[0] #=> String
resp.event_data_stores[0].advanced_event_selectors[0].field_selectors[0].not_ends_with #=> Array
resp.event_data_stores[0].advanced_event_selectors[0].field_selectors[0].not_ends_with[0] #=> String
resp.event_data_stores[0].multi_region_enabled #=> Boolean
resp.event_data_stores[0].organization_enabled #=> Boolean
resp.event_data_stores[0].retention_period #=> Integer
resp.event_data_stores[0].created_timestamp #=> Time
resp.event_data_stores[0].updated_timestamp #=> Time
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :next_token (String)

    A token you can use to get the next page of event data store results.

  • :max_results (Integer)

    The maximum number of event data stores to display on a single page.

Returns:

See Also:



2443
2444
2445
2446
# File 'lib/aws-sdk-cloudtrail/client.rb', line 2443

def list_event_data_stores(params = {}, options = {})
  req = build_request(:list_event_data_stores, params)
  req.send_request(options)
end

#list_import_failures(params = {}) ⇒ Types::ListImportFailuresResponse

Returns a list of failures for the specified import.

The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.

Examples:

Request syntax with placeholder values


resp = client.list_import_failures({
  import_id: "UUID", # required
  max_results: 1,
  next_token: "PaginationToken",
})

Response structure


resp.failures #=> Array
resp.failures[0].location #=> String
resp.failures[0].status #=> String, one of "FAILED", "RETRY", "SUCCEEDED"
resp.failures[0].error_type #=> String
resp.failures[0].error_message #=> String
resp.failures[0].last_updated_time #=> Time
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :import_id (required, String)

    The ID of the import.

  • :max_results (Integer)

    The maximum number of failures to display on a single page.

  • :next_token (String)

    A token you can use to get the next page of import failures.

Returns:

See Also:



2488
2489
2490
2491
# File 'lib/aws-sdk-cloudtrail/client.rb', line 2488

def list_import_failures(params = {}, options = {})
  req = build_request(:list_import_failures, params)
  req.send_request(options)
end

#list_imports(params = {}) ⇒ Types::ListImportsResponse

Returns information on all imports, or a select set of imports by ‘ImportStatus` or `Destination`.

The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.

Examples:

Request syntax with placeholder values


resp = client.list_imports({
  max_results: 1,
  destination: "EventDataStoreArn",
  import_status: "INITIALIZING", # accepts INITIALIZING, IN_PROGRESS, FAILED, STOPPED, COMPLETED
  next_token: "PaginationToken",
})

Response structure


resp.imports #=> Array
resp.imports[0].import_id #=> String
resp.imports[0].import_status #=> String, one of "INITIALIZING", "IN_PROGRESS", "FAILED", "STOPPED", "COMPLETED"
resp.imports[0].destinations #=> Array
resp.imports[0].destinations[0] #=> String
resp.imports[0].created_timestamp #=> Time
resp.imports[0].updated_timestamp #=> Time
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :max_results (Integer)

    The maximum number of imports to display on a single page.

  • :destination (String)

    The ARN of the destination event data store.

  • :import_status (String)

    The status of the import.

  • :next_token (String)

    A token you can use to get the next page of import results.

Returns:

See Also:



2539
2540
2541
2542
# File 'lib/aws-sdk-cloudtrail/client.rb', line 2539

def list_imports(params = {}, options = {})
  req = build_request(:list_imports, params)
  req.send_request(options)
end

#list_insights_metric_data(params = {}) ⇒ Types::ListInsightsMetricDataResponse

Returns Insights metrics data for trails that have enabled Insights. The request must include the ‘EventSource`, `EventName`, and `InsightType` parameters.

If the ‘InsightType` is set to `ApiErrorRateInsight`, the request must also include the `ErrorCode` parameter.

The following are the available time periods for ‘ListInsightsMetricData`. Each cutoff is inclusive.

  • Data points with a period of 60 seconds (1-minute) are available for 15 days.

  • Data points with a period of 300 seconds (5-minute) are available for 63 days.

  • Data points with a period of 3600 seconds (1 hour) are available for 90 days.

Access to the ‘ListInsightsMetricData` API operation is linked to the `cloudtrail:LookupEvents` action. To use this operation, you must have permissions to perform the `cloudtrail:LookupEvents` action.

The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.

Examples:

Request syntax with placeholder values


resp = client.list_insights_metric_data({
  event_source: "EventSource", # required
  event_name: "EventName", # required
  insight_type: "ApiCallRateInsight", # required, accepts ApiCallRateInsight, ApiErrorRateInsight
  error_code: "ErrorCode",
  start_time: Time.now,
  end_time: Time.now,
  period: 1,
  data_type: "FillWithZeros", # accepts FillWithZeros, NonZeroData
  max_results: 1,
  next_token: "InsightsMetricNextToken",
})

Response structure


resp.event_source #=> String
resp.event_name #=> String
resp.insight_type #=> String, one of "ApiCallRateInsight", "ApiErrorRateInsight"
resp.error_code #=> String
resp.timestamps #=> Array
resp.timestamps[0] #=> Time
resp.values #=> Array
resp.values[0] #=> Float
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :event_source (required, String)

    The Amazon Web Services service to which the request was made, such as ‘iam.amazonaws.com` or `s3.amazonaws.com`.

  • :event_name (required, String)

    The name of the event, typically the Amazon Web Services API on which unusual levels of activity were recorded.

  • :insight_type (required, String)

    The type of CloudTrail Insights event, which is either ‘ApiCallRateInsight` or `ApiErrorRateInsight`. The `ApiCallRateInsight` Insights type analyzes write-only management API calls that are aggregated per minute against a baseline API call volume. The `ApiErrorRateInsight` Insights type analyzes management API calls that result in error codes.

  • :error_code (String)

    Conditionally required if the ‘InsightType` parameter is set to `ApiErrorRateInsight`.

    If returning metrics for the ‘ApiErrorRateInsight` Insights type, this is the error to retrieve data for. For example, `AccessDenied`.

  • :start_time (Time, DateTime, Date, Integer, String)

    Specifies, in UTC, the start time for time-series data. The value specified is inclusive; results include data points with the specified time stamp.

    The default is 90 days before the time of request.

  • :end_time (Time, DateTime, Date, Integer, String)

    Specifies, in UTC, the end time for time-series data. The value specified is exclusive; results include data points up to the specified time stamp.

    The default is the time of request.

  • :period (Integer)

    Granularity of data to retrieve, in seconds. Valid values are ‘60`, `300`, and `3600`. If you specify any other value, you will get an error. The default is 3600 seconds.

  • :data_type (String)

    Type of data points to return. Valid values are ‘NonZeroData` and `FillWithZeros`. The default is `NonZeroData`.

  • :max_results (Integer)

    The maximum number of data points to return. Valid values are integers from 1 to 21600. The default value is 21600.

  • :next_token (String)

    Returned if all datapoints can’t be returned in a single call. For example, due to reaching ‘MaxResults`.

    Add this parameter to the request to continue retrieving results starting from the last evaluated point.

Returns:

See Also:



2667
2668
2669
2670
# File 'lib/aws-sdk-cloudtrail/client.rb', line 2667

def list_insights_metric_data(params = {}, options = {})
  req = build_request(:list_insights_metric_data, params)
  req.send_request(options)
end

#list_public_keys(params = {}) ⇒ Types::ListPublicKeysResponse

Returns all public keys whose private keys were used to sign the digest files within the specified time range. The public key is needed to validate digest files that were signed with its corresponding private key.

<note markdown=“1”> CloudTrail uses different private and public key pairs per Region. Each digest file is signed with a private key unique to its Region. When you validate a digest file from a specific Region, you must look in the same Region for its corresponding public key.

</note>

The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.

Examples:

Request syntax with placeholder values


resp = client.list_public_keys({
  start_time: Time.now,
  end_time: Time.now,
  next_token: "String",
})

Response structure


resp.public_key_list #=> Array
resp.public_key_list[0].value #=> String
resp.public_key_list[0].validity_start_time #=> Time
resp.public_key_list[0].validity_end_time #=> Time
resp.public_key_list[0].fingerprint #=> String
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :start_time (Time, DateTime, Date, Integer, String)

    Optionally specifies, in UTC, the start of the time range to look up public keys for CloudTrail digest files. If not specified, the current time is used, and the current public key is returned.

  • :end_time (Time, DateTime, Date, Integer, String)

    Optionally specifies, in UTC, the end of the time range to look up public keys for CloudTrail digest files. If not specified, the current time is used.

  • :next_token (String)

    Reserved for future use.

Returns:

See Also:



2725
2726
2727
2728
# File 'lib/aws-sdk-cloudtrail/client.rb', line 2725

def list_public_keys(params = {}, options = {})
  req = build_request(:list_public_keys, params)
  req.send_request(options)
end

#list_queries(params = {}) ⇒ Types::ListQueriesResponse

Returns a list of queries and query statuses for the past seven days. You must specify an ARN value for ‘EventDataStore`. Optionally, to shorten the list of results, you can specify a time range, formatted as timestamps, by adding `StartTime` and `EndTime` parameters, and a `QueryStatus` value. Valid values for `QueryStatus` include `QUEUED`, `RUNNING`, `FINISHED`, `FAILED`, `TIMED_OUT`, or `CANCELLED`.

The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.

Examples:

Request syntax with placeholder values


resp = client.list_queries({
  event_data_store: "EventDataStoreArn", # required
  next_token: "PaginationToken",
  max_results: 1,
  start_time: Time.now,
  end_time: Time.now,
  query_status: "QUEUED", # accepts QUEUED, RUNNING, FINISHED, FAILED, CANCELLED, TIMED_OUT
})

Response structure


resp.queries #=> Array
resp.queries[0].query_id #=> String
resp.queries[0].query_status #=> String, one of "QUEUED", "RUNNING", "FINISHED", "FAILED", "CANCELLED", "TIMED_OUT"
resp.queries[0].creation_time #=> Time
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :event_data_store (required, String)

    The ARN (or the ID suffix of the ARN) of an event data store on which queries were run.

  • :next_token (String)

    A token you can use to get the next page of results.

  • :max_results (Integer)

    The maximum number of queries to show on a page.

  • :start_time (Time, DateTime, Date, Integer, String)

    Use with ‘EndTime` to bound a `ListQueries` request, and limit its results to only those queries run within a specified time period.

  • :end_time (Time, DateTime, Date, Integer, String)

    Use with ‘StartTime` to bound a `ListQueries` request, and limit its results to only those queries run within a specified time period.

  • :query_status (String)

    The status of queries that you want to return in results. Valid values for ‘QueryStatus` include `QUEUED`, `RUNNING`, `FINISHED`, `FAILED`, `TIMED_OUT`, or `CANCELLED`.

Returns:

See Also:



2790
2791
2792
2793
# File 'lib/aws-sdk-cloudtrail/client.rb', line 2790

def list_queries(params = {}, options = {})
  req = build_request(:list_queries, params)
  req.send_request(options)
end

#list_tags(params = {}) ⇒ Types::ListTagsResponse

Lists the tags for the specified trails, event data stores, dashboards, or channels in the current Region.

The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.

Examples:

Request syntax with placeholder values


resp = client.list_tags({
  resource_id_list: ["String"], # required
  next_token: "String",
})

Response structure


resp.resource_tag_list #=> Array
resp.resource_tag_list[0].resource_id #=> String
resp.resource_tag_list[0].tags_list #=> Array
resp.resource_tag_list[0].tags_list[0].key #=> String
resp.resource_tag_list[0].tags_list[0].value #=> String
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :resource_id_list (required, Array<String>)

    Specifies a list of trail, event data store, dashboard, or channel ARNs whose tags will be listed. The list has a limit of 20 ARNs.

    Example trail ARN format: ‘arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail`

    Example event data store ARN format: ‘arn:aws:cloudtrail:us-east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f-8bd1-bcf6cEXAMPLE`

    Example dashboard ARN format: ‘arn:aws:cloudtrail:us-east-1:123456789012:dashboard/exampleDash`

    Example channel ARN format: ‘arn:aws:cloudtrail:us-east-2:123456789012:channel/01234567890`

  • :next_token (String)

    Reserved for future use.

Returns:

See Also:



2844
2845
2846
2847
# File 'lib/aws-sdk-cloudtrail/client.rb', line 2844

def list_tags(params = {}, options = {})
  req = build_request(:list_tags, params)
  req.send_request(options)
end

#list_trails(params = {}) ⇒ Types::ListTrailsResponse

Lists trails that are in the current account.

The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.

Examples:

Request syntax with placeholder values


resp = client.list_trails({
  next_token: "String",
})

Response structure


resp.trails #=> Array
resp.trails[0].trail_arn #=> String
resp.trails[0].name #=> String
resp.trails[0].home_region #=> String
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :next_token (String)

    The token to use to get the next page of results after a previous API call. This token must be passed in with the same parameters that were specified in the original call. For example, if the original call specified an AttributeKey of ‘Username’ with a value of ‘root’, the call with NextToken should include those same parameters.

Returns:

See Also:



2883
2884
2885
2886
# File 'lib/aws-sdk-cloudtrail/client.rb', line 2883

def list_trails(params = {}, options = {})
  req = build_request(:list_trails, params)
  req.send_request(options)
end

#lookup_events(params = {}) ⇒ Types::LookupEventsResponse

Looks up [management events] or [CloudTrail Insights events] that are captured by CloudTrail. You can look up events that occurred in a Region within the last 90 days.

<note markdown=“1”> ‘LookupEvents` returns recent Insights events for trails that enable Insights. To view Insights events for an event data store, you can run queries on your Insights event data store, and you can also view the Lake dashboard for Insights.

</note>

Lookup supports the following attributes for management events:

  • Amazon Web Services access key

  • Event ID

  • Event name

  • Event source

  • Read only

  • Resource name

  • Resource type

  • User name

Lookup supports the following attributes for Insights events:

  • Event ID

  • Event name

  • Event source

All attributes are optional. The default number of results returned is 50, with a maximum of 50 possible. The response includes a token that you can use to get the next page of results.

The rate of lookup requests is limited to two per second, per account, per Region. If this limit is exceeded, a throttling error occurs.

[1]: docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-concepts.html#cloudtrail-concepts-management-events [2]: docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-concepts.html#cloudtrail-concepts-insights-events

The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.

Examples:

Request syntax with placeholder values


resp = client.lookup_events({
  lookup_attributes: [
    {
      attribute_key: "EventId", # required, accepts EventId, EventName, ReadOnly, Username, ResourceType, ResourceName, EventSource, AccessKeyId
      attribute_value: "LookupAttributeValue", # required
    },
  ],
  start_time: Time.now,
  end_time: Time.now,
  event_category: "insight", # accepts insight
  max_results: 1,
  next_token: "NextToken",
})

Response structure


resp.events #=> Array
resp.events[0].event_id #=> String
resp.events[0].event_name #=> String
resp.events[0].read_only #=> String
resp.events[0].access_key_id #=> String
resp.events[0].event_time #=> Time
resp.events[0].event_source #=> String
resp.events[0].username #=> String
resp.events[0].resources #=> Array
resp.events[0].resources[0].resource_type #=> String
resp.events[0].resources[0].resource_name #=> String
resp.events[0].cloud_trail_event #=> String
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :lookup_attributes (Array<Types::LookupAttribute>)

    Contains a list of lookup attributes. Currently the list can contain only one item.

  • :start_time (Time, DateTime, Date, Integer, String)

    Specifies that only events that occur after or at the specified time are returned. If the specified start time is after the specified end time, an error is returned.

  • :end_time (Time, DateTime, Date, Integer, String)

    Specifies that only events that occur before or at the specified time are returned. If the specified end time is before the specified start time, an error is returned.

  • :event_category (String)

    Specifies the event category. If you do not specify an event category, events of the category are not returned in the response. For example, if you do not specify ‘insight` as the value of `EventCategory`, no Insights events are returned.

  • :max_results (Integer)

    The number of events to return. Possible values are 1 through 50. The default is 50.

  • :next_token (String)

    The token to use to get the next page of results after a previous API call. This token must be passed in with the same parameters that were specified in the original call. For example, if the original call specified an AttributeKey of ‘Username’ with a value of ‘root’, the call with NextToken should include those same parameters.

Returns:

See Also:



3011
3012
3013
3014
# File 'lib/aws-sdk-cloudtrail/client.rb', line 3011

def lookup_events(params = {}, options = {})
  req = build_request(:lookup_events, params)
  req.send_request(options)
end

#put_event_selectors(params = {}) ⇒ Types::PutEventSelectorsResponse

Configures event selectors (also referred to as *basic event selectors*) or advanced event selectors for your trail. You can use either ‘AdvancedEventSelectors` or `EventSelectors`, but not both. If you apply `AdvancedEventSelectors` to a trail, any existing `EventSelectors` are overwritten.

You can use ‘AdvancedEventSelectors` to log management events, data events for all resource types, and network activity events.

You can use ‘EventSelectors` 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 ‘EventSelectors` to log network activity events.

If you want your trail to log Insights events, be sure the event selector or advanced event selector enables logging of the Insights event types you want configured for your trail. For more information about logging Insights events, see [Logging Insights events] in the *CloudTrail User Guide*. By default, trails created without specific event selectors are configured to log all read and write management events, and no data events or network activity events.

When an event occurs in your account, CloudTrail evaluates the event selectors or advanced event selectors in all trails. For each trail, if the event matches any event selector, the trail processes and logs the event. If the event doesn’t match any event selector, the trail doesn’t log the event.

Example

  1. You create an event selector for a trail and specify that you want to log write-only events.

  2. The EC2 ‘GetConsoleOutput` and `RunInstances` API operations occur in your account.

  3. CloudTrail evaluates whether the events match your event selectors.

  4. The ‘RunInstances` is a write-only event and it matches your event selector. The trail logs the event.

  5. The ‘GetConsoleOutput` is a read-only event that doesn’t match your event selector. The trail doesn’t log the event.

The ‘PutEventSelectors` operation must be called from the Region in which the trail was created; otherwise, an `InvalidHomeRegionException` exception is thrown.

You can configure up to five event selectors for each trail.

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. For more information, see [Logging management events], [Logging data events], [Logging network activity events], and [Quotas in CloudTrail] in the *CloudTrail User Guide*.

[1]: docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-insights-events-with-cloudtrail.html [2]: docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-management-events-with-cloudtrail.html [3]: docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-data-events-with-cloudtrail.html [4]: docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-network-events-with-cloudtrail.html [5]: docs.aws.amazon.com/awscloudtrail/latest/userguide/WhatIsCloudTrail-Limits.html

Examples:

Request syntax with placeholder values


resp = client.put_event_selectors({
  trail_name: "String", # required
  event_selectors: [
    {
      read_write_type: "ReadOnly", # accepts ReadOnly, WriteOnly, All
      include_management_events: false,
      data_resources: [
        {
          type: "String",
          values: ["String"],
        },
      ],
      exclude_management_event_sources: ["String"],
    },
  ],
  advanced_event_selectors: [
    {
      name: "SelectorName",
      field_selectors: [ # required
        {
          field: "SelectorField", # required
          equals: ["OperatorValue"],
          starts_with: ["OperatorValue"],
          ends_with: ["OperatorValue"],
          not_equals: ["OperatorValue"],
          not_starts_with: ["OperatorValue"],
          not_ends_with: ["OperatorValue"],
        },
      ],
    },
  ],
})

Response structure


resp.trail_arn #=> String
resp.event_selectors #=> Array
resp.event_selectors[0].read_write_type #=> String, one of "ReadOnly", "WriteOnly", "All"
resp.event_selectors[0].include_management_events #=> Boolean
resp.event_selectors[0].data_resources #=> Array
resp.event_selectors[0].data_resources[0].type #=> String
resp.event_selectors[0].data_resources[0].values #=> Array
resp.event_selectors[0].data_resources[0].values[0] #=> String
resp.event_selectors[0].exclude_management_event_sources #=> Array
resp.event_selectors[0].exclude_management_event_sources[0] #=> String
resp.advanced_event_selectors #=> Array
resp.advanced_event_selectors[0].name #=> String
resp.advanced_event_selectors[0].field_selectors #=> Array
resp.advanced_event_selectors[0].field_selectors[0].field #=> String
resp.advanced_event_selectors[0].field_selectors[0].equals #=> Array
resp.advanced_event_selectors[0].field_selectors[0].equals[0] #=> String
resp.advanced_event_selectors[0].field_selectors[0].starts_with #=> Array
resp.advanced_event_selectors[0].field_selectors[0].starts_with[0] #=> String
resp.advanced_event_selectors[0].field_selectors[0].ends_with #=> Array
resp.advanced_event_selectors[0].field_selectors[0].ends_with[0] #=> String
resp.advanced_event_selectors[0].field_selectors[0].not_equals #=> Array
resp.advanced_event_selectors[0].field_selectors[0].not_equals[0] #=> String
resp.advanced_event_selectors[0].field_selectors[0].not_starts_with #=> Array
resp.advanced_event_selectors[0].field_selectors[0].not_starts_with[0] #=> String
resp.advanced_event_selectors[0].field_selectors[0].not_ends_with #=> Array
resp.advanced_event_selectors[0].field_selectors[0].not_ends_with[0] #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :trail_name (required, String)

    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`

  • :event_selectors (Array<Types::EventSelector>)

    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.

  • :advanced_event_selectors (Array<Types::AdvancedEventSelector>)

    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 network activity events] in the *CloudTrail User Guide*.

    [1]: docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-data-events-with-cloudtrail.html [2]: docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-network-events-with-cloudtrail.html

Returns:

See Also:



3220
3221
3222
3223
# File 'lib/aws-sdk-cloudtrail/client.rb', line 3220

def put_event_selectors(params = {}, options = {})
  req = build_request(:put_event_selectors, params)
  req.send_request(options)
end

#put_insight_selectors(params = {}) ⇒ Types::PutInsightSelectorsResponse

Lets you enable Insights event logging by specifying the Insights selectors that you want to enable on an existing trail or event data store. You also use ‘PutInsightSelectors` to turn off Insights event logging, by passing an empty list of Insights types. The valid Insights event types are `ApiErrorRateInsight` and `ApiCallRateInsight`.

To enable Insights on an event data store, you must specify the ARNs (or ID suffix of the ARNs) for the source event data store (‘EventDataStore`) and the destination event data store (`InsightsDestination`). The source event data store logs management events and enables Insights. The destination event data store logs Insights events based upon the management event activity of the source event data store. The source and destination event data stores must belong to the same Amazon Web Services account.

To log Insights events for a trail, you must specify the name (‘TrailName`) of the CloudTrail trail for which you want to change or add Insights selectors.

To log CloudTrail Insights events on API call volume, the trail or event data store must log ‘write` management events. To log CloudTrail Insights events on API error rate, the trail or event data store must log `read` or `write` management events. You can call `GetEventSelectors` on a trail to check whether the trail logs management events. You can call `GetEventDataStore` on an event data store to check whether the event data store logs management events.

For more information, see [Logging CloudTrail Insights events] in the *CloudTrail User Guide*.

[1]: docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-insights-events-with-cloudtrail.html

Examples:

Request syntax with placeholder values


resp = client.put_insight_selectors({
  trail_name: "String",
  insight_selectors: [ # required
    {
      insight_type: "ApiCallRateInsight", # accepts ApiCallRateInsight, ApiErrorRateInsight
    },
  ],
  event_data_store: "EventDataStoreArn",
  insights_destination: "EventDataStoreArn",
})

Response structure


resp.trail_arn #=> String
resp.insight_selectors #=> Array
resp.insight_selectors[0].insight_type #=> String, one of "ApiCallRateInsight", "ApiErrorRateInsight"
resp.event_data_store_arn #=> String
resp.insights_destination #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :trail_name (String)

    The name of the CloudTrail trail for which you want to change or add Insights selectors.

    You cannot use this parameter with the ‘EventDataStore` and `InsightsDestination` parameters.

  • :insight_selectors (required, Array<Types::InsightSelector>)

    A JSON string that contains the Insights types you want to log on a trail or event data store. ‘ApiCallRateInsight` and `ApiErrorRateInsight` are valid Insight types.

    The ‘ApiCallRateInsight` Insights type analyzes write-only management API calls that are aggregated per minute against a baseline API call volume.

    The ‘ApiErrorRateInsight` Insights type analyzes management API calls that result in error codes. The error is shown if the API call is unsuccessful.

  • :event_data_store (String)

    The ARN (or ID suffix of the ARN) of the source event data store for which you want to change or add Insights selectors. To enable Insights on an event data store, you must provide both the ‘EventDataStore` and `InsightsDestination` parameters.

    You cannot use this parameter with the ‘TrailName` parameter.

  • :insights_destination (String)

    The ARN (or ID suffix of the ARN) of the destination event data store that logs Insights events. To enable Insights on an event data store, you must provide both the ‘EventDataStore` and `InsightsDestination` parameters.

    You cannot use this parameter with the ‘TrailName` parameter.

Returns:

See Also:



3328
3329
3330
3331
# File 'lib/aws-sdk-cloudtrail/client.rb', line 3328

def put_insight_selectors(params = {}, options = {})
  req = build_request(:put_insight_selectors, params)
  req.send_request(options)
end

#put_resource_policy(params = {}) ⇒ Types::PutResourcePolicyResponse

Attaches a resource-based permission policy to a CloudTrail event data store, dashboard, or channel. For more information about resource-based policies, see [CloudTrail resource-based policy examples] in the *CloudTrail User Guide*.

[1]: docs.aws.amazon.com/awscloudtrail/latest/userguide/security_iam_resource-based-policy-examples.html

Examples:

Request syntax with placeholder values


resp = client.put_resource_policy({
  resource_arn: "ResourceArn", # required
  resource_policy: "ResourcePolicy", # required
})

Response structure


resp.resource_arn #=> String
resp.resource_policy #=> String
resp.delegated_admin_resource_policy #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :resource_arn (required, String)

    The Amazon Resource Name (ARN) of the CloudTrail event data store, dashboard, or channel attached to the resource-based policy.

    Example event data store ARN format: ‘arn:aws:cloudtrail:us-east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f-8bd1-bcf6cEXAMPLE`

    Example dashboard ARN format: ‘arn:aws:cloudtrail:us-east-1:123456789012:dashboard/exampleDash`

    Example channel ARN format: ‘arn:aws:cloudtrail:us-east-2:123456789012:channel/01234567890`

  • :resource_policy (required, String)

    A JSON-formatted string for an Amazon Web Services resource-based policy.

    For example resource-based policies, see [CloudTrail resource-based policy examples] in the *CloudTrail User Guide*.

    [1]: docs.aws.amazon.com/awscloudtrail/latest/userguide/security_iam_resource-based-policy-examples.html

Returns:

See Also:



3389
3390
3391
3392
# File 'lib/aws-sdk-cloudtrail/client.rb', line 3389

def put_resource_policy(params = {}, options = {})
  req = build_request(:put_resource_policy, params)
  req.send_request(options)
end

#register_organization_delegated_admin(params = {}) ⇒ Struct

Registers an organization’s member account as the CloudTrail [delegated administrator].

[1]: docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-delegated-administrator.html

Examples:

Request syntax with placeholder values


resp = client.register_organization_delegated_admin({
  member_account_id: "AccountId", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :member_account_id (required, String)

    An organization member account ID that you want to designate as a delegated administrator.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



3417
3418
3419
3420
# File 'lib/aws-sdk-cloudtrail/client.rb', line 3417

def register_organization_delegated_admin(params = {}, options = {})
  req = build_request(:register_organization_delegated_admin, params)
  req.send_request(options)
end

#remove_tags(params = {}) ⇒ Struct

Removes the specified tags from a trail, event data store, dashboard, or channel.

Examples:

Request syntax with placeholder values


resp = client.remove_tags({
  resource_id: "String", # required
  tags_list: [ # required
    {
      key: "TagKey", # required
      value: "TagValue",
    },
  ],
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :resource_id (required, String)

    Specifies the ARN of the trail, event data store, dashboard, or channel from which tags should be removed.

    Example trail ARN format: ‘arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail`

    Example event data store ARN format: ‘arn:aws:cloudtrail:us-east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f-8bd1-bcf6cEXAMPLE`

    Example dashboard ARN format: ‘arn:aws:cloudtrail:us-east-1:123456789012:dashboard/exampleDash`

    Example channel ARN format: ‘arn:aws:cloudtrail:us-east-2:123456789012:channel/01234567890`

  • :tags_list (required, Array<Types::Tag>)

    Specifies a list of tags to be removed.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



3462
3463
3464
3465
# File 'lib/aws-sdk-cloudtrail/client.rb', line 3462

def remove_tags(params = {}, options = {})
  req = build_request(:remove_tags, params)
  req.send_request(options)
end

#restore_event_data_store(params = {}) ⇒ Types::RestoreEventDataStoreResponse

Restores a deleted event data store specified by ‘EventDataStore`, which accepts an event data store ARN. You can only restore a deleted event data store within the seven-day wait period after deletion. Restoring an event data store can take several minutes, depending on the size of the event data store.

Examples:

Request syntax with placeholder values


resp = client.restore_event_data_store({
  event_data_store: "EventDataStoreArn", # required
})

Response structure


resp.event_data_store_arn #=> String
resp.name #=> String
resp.status #=> String, one of "CREATED", "ENABLED", "PENDING_DELETION", "STARTING_INGESTION", "STOPPING_INGESTION", "STOPPED_INGESTION"
resp.advanced_event_selectors #=> Array
resp.advanced_event_selectors[0].name #=> String
resp.advanced_event_selectors[0].field_selectors #=> Array
resp.advanced_event_selectors[0].field_selectors[0].field #=> String
resp.advanced_event_selectors[0].field_selectors[0].equals #=> Array
resp.advanced_event_selectors[0].field_selectors[0].equals[0] #=> String
resp.advanced_event_selectors[0].field_selectors[0].starts_with #=> Array
resp.advanced_event_selectors[0].field_selectors[0].starts_with[0] #=> String
resp.advanced_event_selectors[0].field_selectors[0].ends_with #=> Array
resp.advanced_event_selectors[0].field_selectors[0].ends_with[0] #=> String
resp.advanced_event_selectors[0].field_selectors[0].not_equals #=> Array
resp.advanced_event_selectors[0].field_selectors[0].not_equals[0] #=> String
resp.advanced_event_selectors[0].field_selectors[0].not_starts_with #=> Array
resp.advanced_event_selectors[0].field_selectors[0].not_starts_with[0] #=> String
resp.advanced_event_selectors[0].field_selectors[0].not_ends_with #=> Array
resp.advanced_event_selectors[0].field_selectors[0].not_ends_with[0] #=> String
resp.multi_region_enabled #=> Boolean
resp.organization_enabled #=> Boolean
resp.retention_period #=> Integer
resp.termination_protection_enabled #=> Boolean
resp.created_timestamp #=> Time
resp.updated_timestamp #=> Time
resp.kms_key_id #=> String
resp.billing_mode #=> String, one of "EXTENDABLE_RETENTION_PRICING", "FIXED_RETENTION_PRICING"

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :event_data_store (required, String)

    The ARN (or the ID suffix of the ARN) of the event data store that you want to restore.

Returns:

See Also:



3532
3533
3534
3535
# File 'lib/aws-sdk-cloudtrail/client.rb', line 3532

def restore_event_data_store(params = {}, options = {})
  req = build_request(:restore_event_data_store, params)
  req.send_request(options)
end

#start_dashboard_refresh(params = {}) ⇒ Types::StartDashboardRefreshResponse

Starts a refresh of the specified dashboard.

Each time a dashboard is refreshed, CloudTrail runs queries to populate the dashboard’s widgets. CloudTrail must be granted permissions to run the ‘StartQuery` operation on your behalf. To provide permissions, run the `PutResourcePolicy` operation to attach a resource-based policy to each event data store. For more information, see [Example: Allow CloudTrail to run queries to populate a dashboard] in the *CloudTrail User Guide*.

[1]: docs.aws.amazon.com/awscloudtrail/latest/userguide/security_iam_resource-based-policy-examples.html#security_iam_resource-based-policy-examples-eds-dashboard

Examples:

Request syntax with placeholder values


resp = client.start_dashboard_refresh({
  dashboard_id: "DashboardArn", # required
  query_parameter_values: {
    "QueryParameterKey" => "QueryParameterValue",
  },
})

Response structure


resp.refresh_id #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :dashboard_id (required, String)

    The name or ARN of the dashboard.

  • :query_parameter_values (Hash<String,String>)

    The query parameter values for the dashboard

    For custom dashboards, the following query parameters are valid: ‘$StartTime$`, `$EndTime$`, and `$Period$`.

    For managed dashboards, the following query parameters are valid: ‘$StartTime$`, `$EndTime$`, `$Period$`, and `$EventDataStoreId$`. The `$EventDataStoreId$` query parameter is required.

Returns:

See Also:



3585
3586
3587
3588
# File 'lib/aws-sdk-cloudtrail/client.rb', line 3585

def start_dashboard_refresh(params = {}, options = {})
  req = build_request(:start_dashboard_refresh, params)
  req.send_request(options)
end

#start_event_data_store_ingestion(params = {}) ⇒ Struct

Starts the ingestion of live events on an event data store specified as either an ARN or the ID portion of the ARN. To start ingestion, the event data store ‘Status` must be `STOPPED_INGESTION` and the `eventCategory` must be `Management`, `Data`, `NetworkActivity`, or `ConfigurationItem`.

Examples:

Request syntax with placeholder values


resp = client.start_event_data_store_ingestion({
  event_data_store: "EventDataStoreArn", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :event_data_store (required, String)

    The ARN (or ID suffix of the ARN) of the event data store for which you want to start ingestion.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



3612
3613
3614
3615
# File 'lib/aws-sdk-cloudtrail/client.rb', line 3612

def start_event_data_store_ingestion(params = {}, options = {})
  req = build_request(:start_event_data_store_ingestion, params)
  req.send_request(options)
end

#start_import(params = {}) ⇒ Types::StartImportResponse

Starts an import of logged trail events from a source S3 bucket to a destination event data store. By default, CloudTrail only imports events contained in the S3 bucket’s ‘CloudTrail` prefix and the prefixes inside the `CloudTrail` prefix, and does not check prefixes for other Amazon Web Services services. If you want to import CloudTrail events contained in another prefix, you must include the prefix in the `S3LocationUri`. For more considerations about importing trail events, see [Considerations for copying trail events] in the *CloudTrail User Guide*.

When you start a new import, the ‘Destinations` and `ImportSource` parameters are required. Before starting a new import, disable any access control lists (ACLs) attached to the source S3 bucket. For more information about disabling ACLs, see [Controlling ownership of objects and disabling ACLs for your bucket].

When you retry an import, the ‘ImportID` parameter is required.

<note markdown=“1”> If the destination event data store is for an organization, you must use the management account to import trail events. You cannot use the delegated administrator account for the organization.

</note>

[1]: docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-copy-trail-to-lake.html#cloudtrail-trail-copy-considerations [2]: docs.aws.amazon.com/AmazonS3/latest/userguide/about-object-ownership.html

Examples:

Request syntax with placeholder values


resp = client.start_import({
  destinations: ["EventDataStoreArn"],
  import_source: {
    s3: { # required
      s3_location_uri: "String", # required
      s3_bucket_region: "String", # required
      s3_bucket_access_role_arn: "String", # required
    },
  },
  start_event_time: Time.now,
  end_event_time: Time.now,
  import_id: "UUID",
})

Response structure


resp.import_id #=> String
resp.destinations #=> Array
resp.destinations[0] #=> String
resp.import_source.s3.s3_location_uri #=> String
resp.import_source.s3.s3_bucket_region #=> String
resp.import_source.s3.s3_bucket_access_role_arn #=> String
resp.start_event_time #=> Time
resp.end_event_time #=> Time
resp.import_status #=> String, one of "INITIALIZING", "IN_PROGRESS", "FAILED", "STOPPED", "COMPLETED"
resp.created_timestamp #=> Time
resp.updated_timestamp #=> Time

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :destinations (Array<String>)

    The ARN of the destination event data store. Use this parameter for a new import.

  • :import_source (Types::ImportSource)

    The source S3 bucket for the import. Use this parameter for a new import.

  • :start_event_time (Time, DateTime, Date, Integer, String)

    Use with ‘EndEventTime` to bound a `StartImport` request, and limit imported trail events to only those events logged within a specified time period. When you specify a time range, CloudTrail checks the prefix and log file names to verify the names contain a date between the specified `StartEventTime` and `EndEventTime` before attempting to import events.

  • :end_event_time (Time, DateTime, Date, Integer, String)

    Use with ‘StartEventTime` to bound a `StartImport` request, and limit imported trail events to only those events logged within a specified time period. When you specify a time range, CloudTrail checks the prefix and log file names to verify the names contain a date between the specified `StartEventTime` and `EndEventTime` before attempting to import events.

  • :import_id (String)

    The ID of the import. Use this parameter when you are retrying an import.

Returns:

See Also:



3719
3720
3721
3722
# File 'lib/aws-sdk-cloudtrail/client.rb', line 3719

def start_import(params = {}, options = {})
  req = build_request(:start_import, params)
  req.send_request(options)
end

#start_logging(params = {}) ⇒ Struct

Starts the recording of Amazon Web Services API calls and log file delivery for a trail. For a trail that is enabled in all Regions, this operation must be called from the Region in which the trail was created. This operation cannot be called on the shadow trails (replicated trails in other Regions) of a trail that is enabled in all Regions.

Examples:

Request syntax with placeholder values


resp = client.start_logging({
  name: "String", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :name (required, String)

    Specifies the name or the CloudTrail ARN of the trail for which CloudTrail logs Amazon Web Services API calls. The following is the format of a trail ARN.

    ‘arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail`

Returns:

  • (Struct)

    Returns an empty response.

See Also:



3750
3751
3752
3753
# File 'lib/aws-sdk-cloudtrail/client.rb', line 3750

def start_logging(params = {}, options = {})
  req = build_request(:start_logging, params)
  req.send_request(options)
end

#start_query(params = {}) ⇒ Types::StartQueryResponse

Starts a CloudTrail Lake query. Use the ‘QueryStatement` parameter to provide your SQL query, enclosed in single quotation marks. Use the optional `DeliveryS3Uri` parameter to deliver the query results to an S3 bucket.

‘StartQuery` requires you specify either the `QueryStatement` parameter, or a `QueryAlias` and any `QueryParameters`. In the current release, the `QueryAlias` and `QueryParameters` parameters are used only for the queries that populate the CloudTrail Lake dashboards.

Examples:

Request syntax with placeholder values


resp = client.start_query({
  query_statement: "QueryStatement",
  delivery_s3_uri: "DeliveryS3Uri",
  query_alias: "QueryAlias",
  query_parameters: ["QueryParameter"],
  event_data_store_owner_account_id: "AccountId",
})

Response structure


resp.query_id #=> String
resp. #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :query_statement (String)

    The SQL code of your query.

  • :delivery_s3_uri (String)

    The URI for the S3 bucket where CloudTrail delivers the query results.

  • :query_alias (String)

    The alias that identifies a query template.

  • :query_parameters (Array<String>)

    The query parameters for the specified ‘QueryAlias`.

  • :event_data_store_owner_account_id (String)

    The account ID of the event data store owner.

Returns:

See Also:



3804
3805
3806
3807
# File 'lib/aws-sdk-cloudtrail/client.rb', line 3804

def start_query(params = {}, options = {})
  req = build_request(:start_query, params)
  req.send_request(options)
end

#stop_event_data_store_ingestion(params = {}) ⇒ Struct

Stops the ingestion of live events on an event data store specified as either an ARN or the ID portion of the ARN. To stop ingestion, the event data store ‘Status` must be `ENABLED` and the `eventCategory` must be `Management`, `Data`, `NetworkActivity`, or `ConfigurationItem`.

Examples:

Request syntax with placeholder values


resp = client.stop_event_data_store_ingestion({
  event_data_store: "EventDataStoreArn", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :event_data_store (required, String)

    The ARN (or ID suffix of the ARN) of the event data store for which you want to stop ingestion.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



3831
3832
3833
3834
# File 'lib/aws-sdk-cloudtrail/client.rb', line 3831

def stop_event_data_store_ingestion(params = {}, options = {})
  req = build_request(:stop_event_data_store_ingestion, params)
  req.send_request(options)
end

#stop_import(params = {}) ⇒ Types::StopImportResponse

Stops a specified import.

Examples:

Request syntax with placeholder values


resp = client.stop_import({
  import_id: "UUID", # required
})

Response structure


resp.import_id #=> String
resp.import_source.s3.s3_location_uri #=> String
resp.import_source.s3.s3_bucket_region #=> String
resp.import_source.s3.s3_bucket_access_role_arn #=> String
resp.destinations #=> Array
resp.destinations[0] #=> String
resp.import_status #=> String, one of "INITIALIZING", "IN_PROGRESS", "FAILED", "STOPPED", "COMPLETED"
resp.created_timestamp #=> Time
resp.updated_timestamp #=> Time
resp.start_event_time #=> Time
resp.end_event_time #=> Time
resp.import_statistics.prefixes_found #=> Integer
resp.import_statistics.prefixes_completed #=> Integer
resp.import_statistics.files_completed #=> Integer
resp.import_statistics.events_completed #=> Integer
resp.import_statistics.failed_entries #=> Integer

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :import_id (required, String)

    The ID of the import.

Returns:

See Also:



3882
3883
3884
3885
# File 'lib/aws-sdk-cloudtrail/client.rb', line 3882

def stop_import(params = {}, options = {})
  req = build_request(:stop_import, params)
  req.send_request(options)
end

#stop_logging(params = {}) ⇒ Struct

Suspends the recording of Amazon Web Services API calls and log file delivery for the specified trail. Under most circumstances, there is no need to use this action. You can update a trail without stopping it first. This action is the only way to stop recording. For a trail enabled in all Regions, this operation must be called from the Region in which the trail was created, or an ‘InvalidHomeRegionException` will occur. This operation cannot be called on the shadow trails (replicated trails in other Regions) of a trail enabled in all Regions.

Examples:

Request syntax with placeholder values


resp = client.stop_logging({
  name: "String", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :name (required, String)

    Specifies the name or the CloudTrail ARN of the trail for which CloudTrail will stop logging Amazon Web Services API calls. The following is the format of a trail ARN.

    ‘arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail`

Returns:

  • (Struct)

    Returns an empty response.

See Also:



3916
3917
3918
3919
# File 'lib/aws-sdk-cloudtrail/client.rb', line 3916

def stop_logging(params = {}, options = {})
  req = build_request(:stop_logging, params)
  req.send_request(options)
end

#update_channel(params = {}) ⇒ Types::UpdateChannelResponse

Updates a channel specified by a required channel ARN or UUID.

Examples:

Request syntax with placeholder values


resp = client.update_channel({
  channel: "ChannelArn", # required
  destinations: [
    {
      type: "EVENT_DATA_STORE", # required, accepts EVENT_DATA_STORE, AWS_SERVICE
      location: "Location", # required
    },
  ],
  name: "ChannelName",
})

Response structure


resp.channel_arn #=> String
resp.name #=> String
resp.source #=> String
resp.destinations #=> Array
resp.destinations[0].type #=> String, one of "EVENT_DATA_STORE", "AWS_SERVICE"
resp.destinations[0].location #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :channel (required, String)

    The ARN or ID (the ARN suffix) of the channel that you want to update.

  • :destinations (Array<Types::Destination>)

    The ARNs of event data stores that you want to log events arriving through the channel.

  • :name (String)

    Changes the name of the channel.

Returns:

See Also:



3966
3967
3968
3969
# File 'lib/aws-sdk-cloudtrail/client.rb', line 3966

def update_channel(params = {}, options = {})
  req = build_request(:update_channel, params)
  req.send_request(options)
end

#update_dashboard(params = {}) ⇒ Types::UpdateDashboardResponse

Updates the specified dashboard.

To set a refresh schedule, CloudTrail must be granted permissions to run the ‘StartDashboardRefresh` operation to refresh the dashboard on your behalf. To provide permissions, run the `PutResourcePolicy` operation to attach a resource-based policy to the dashboard. For more information, see [ Resource-based policy example for a dashboard] in the *CloudTrail User Guide*.

CloudTrail runs queries to populate the dashboard’s widgets during a manual or scheduled refresh. CloudTrail must be granted permissions to run the ‘StartQuery` operation on your behalf. To provide permissions, run the `PutResourcePolicy` operation to attach a resource-based policy to each event data store. For more information, see [Example: Allow CloudTrail to run queries to populate a dashboard] in the *CloudTrail User Guide*.

[1]: docs.aws.amazon.com/awscloudtrail/latest/userguide/security_iam_resource-based-policy-examples.html#security_iam_resource-based-policy-examples-dashboards [2]: docs.aws.amazon.com/awscloudtrail/latest/userguide/security_iam_resource-based-policy-examples.html#security_iam_resource-based-policy-examples-eds-dashboard

Examples:

Request syntax with placeholder values


resp = client.update_dashboard({
  dashboard_id: "DashboardArn", # required
  widgets: [
    {
      query_statement: "QueryStatement", # required
      query_parameters: ["QueryParameter"],
      view_properties: { # required
        "ViewPropertiesKey" => "ViewPropertiesValue",
      },
    },
  ],
  refresh_schedule: {
    frequency: {
      unit: "HOURS", # accepts HOURS, DAYS
      value: 1,
    },
    status: "ENABLED", # accepts ENABLED, DISABLED
    time_of_day: "TimeOfDay",
  },
  termination_protection_enabled: false,
})

Response structure


resp.dashboard_arn #=> String
resp.name #=> String
resp.type #=> String, one of "MANAGED", "CUSTOM"
resp.widgets #=> Array
resp.widgets[0].query_alias #=> String
resp.widgets[0].query_statement #=> String
resp.widgets[0].query_parameters #=> Array
resp.widgets[0].query_parameters[0] #=> String
resp.widgets[0].view_properties #=> Hash
resp.widgets[0].view_properties["ViewPropertiesKey"] #=> String
resp.refresh_schedule.frequency.unit #=> String, one of "HOURS", "DAYS"
resp.refresh_schedule.frequency.value #=> Integer
resp.refresh_schedule.status #=> String, one of "ENABLED", "DISABLED"
resp.refresh_schedule.time_of_day #=> String
resp.termination_protection_enabled #=> Boolean
resp.created_timestamp #=> Time
resp.updated_timestamp #=> Time

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :dashboard_id (required, String)

    The name or ARN of the dashboard.

  • :widgets (Array<Types::RequestWidget>)

    An array of widgets for the dashboard. A custom dashboard can have a maximum of 10 widgets.

    To add new widgets, pass in an array that includes the existing widgets along with any new widgets. Run the ‘GetDashboard` operation to get the list of widgets for the dashboard.

    To remove widgets, pass in an array that includes the existing widgets minus the widgets you want removed.

  • :refresh_schedule (Types::RefreshSchedule)

    The refresh schedule configuration for the dashboard.

  • :termination_protection_enabled (Boolean)

    Specifies whether termination protection is enabled for the dashboard. If termination protection is enabled, you cannot delete the dashboard until termination protection is disabled.

Returns:

See Also:



4074
4075
4076
4077
# File 'lib/aws-sdk-cloudtrail/client.rb', line 4074

def update_dashboard(params = {}, options = {})
  req = build_request(:update_dashboard, params)
  req.send_request(options)
end

#update_event_data_store(params = {}) ⇒ Types::UpdateEventDataStoreResponse

Updates an event data store. The required ‘EventDataStore` value is an ARN or the ID portion of the ARN. Other parameters are optional, but at least one optional parameter must be specified, or CloudTrail throws an error. `RetentionPeriod` is in days, and valid values are integers between 7 and 3653 if the `BillingMode` is set to `EXTENDABLE_RETENTION_PRICING`, or between 7 and 2557 if `BillingMode` is set to `FIXED_RETENTION_PRICING`. By default, `TerminationProtection` is enabled.

For event data stores for CloudTrail events, ‘AdvancedEventSelectors` includes or excludes management, data, or network activity events in your event data store. For more information about `AdvancedEventSelectors`, see [AdvancedEventSelectors].

For event data stores for CloudTrail Insights events, Config configuration items, Audit Manager evidence, or non-Amazon Web Services events, ‘AdvancedEventSelectors` includes events of that type in your event data store.

[1]: docs.aws.amazon.com/awscloudtrail/latest/APIReference/API_AdvancedEventSelector.html

Examples:

Request syntax with placeholder values


resp = client.update_event_data_store({
  event_data_store: "EventDataStoreArn", # required
  name: "EventDataStoreName",
  advanced_event_selectors: [
    {
      name: "SelectorName",
      field_selectors: [ # required
        {
          field: "SelectorField", # required
          equals: ["OperatorValue"],
          starts_with: ["OperatorValue"],
          ends_with: ["OperatorValue"],
          not_equals: ["OperatorValue"],
          not_starts_with: ["OperatorValue"],
          not_ends_with: ["OperatorValue"],
        },
      ],
    },
  ],
  multi_region_enabled: false,
  organization_enabled: false,
  retention_period: 1,
  termination_protection_enabled: false,
  kms_key_id: "EventDataStoreKmsKeyId",
  billing_mode: "EXTENDABLE_RETENTION_PRICING", # accepts EXTENDABLE_RETENTION_PRICING, FIXED_RETENTION_PRICING
})

Response structure


resp.event_data_store_arn #=> String
resp.name #=> String
resp.status #=> String, one of "CREATED", "ENABLED", "PENDING_DELETION", "STARTING_INGESTION", "STOPPING_INGESTION", "STOPPED_INGESTION"
resp.advanced_event_selectors #=> Array
resp.advanced_event_selectors[0].name #=> String
resp.advanced_event_selectors[0].field_selectors #=> Array
resp.advanced_event_selectors[0].field_selectors[0].field #=> String
resp.advanced_event_selectors[0].field_selectors[0].equals #=> Array
resp.advanced_event_selectors[0].field_selectors[0].equals[0] #=> String
resp.advanced_event_selectors[0].field_selectors[0].starts_with #=> Array
resp.advanced_event_selectors[0].field_selectors[0].starts_with[0] #=> String
resp.advanced_event_selectors[0].field_selectors[0].ends_with #=> Array
resp.advanced_event_selectors[0].field_selectors[0].ends_with[0] #=> String
resp.advanced_event_selectors[0].field_selectors[0].not_equals #=> Array
resp.advanced_event_selectors[0].field_selectors[0].not_equals[0] #=> String
resp.advanced_event_selectors[0].field_selectors[0].not_starts_with #=> Array
resp.advanced_event_selectors[0].field_selectors[0].not_starts_with[0] #=> String
resp.advanced_event_selectors[0].field_selectors[0].not_ends_with #=> Array
resp.advanced_event_selectors[0].field_selectors[0].not_ends_with[0] #=> String
resp.multi_region_enabled #=> Boolean
resp.organization_enabled #=> Boolean
resp.retention_period #=> Integer
resp.termination_protection_enabled #=> Boolean
resp.created_timestamp #=> Time
resp.updated_timestamp #=> Time
resp.kms_key_id #=> String
resp.billing_mode #=> String, one of "EXTENDABLE_RETENTION_PRICING", "FIXED_RETENTION_PRICING"
resp.federation_status #=> String, one of "ENABLING", "ENABLED", "DISABLING", "DISABLED"
resp.federation_role_arn #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :event_data_store (required, String)

    The ARN (or the ID suffix of the ARN) of the event data store that you want to update.

  • :name (String)

    The event data store name.

  • :advanced_event_selectors (Array<Types::AdvancedEventSelector>)

    The advanced event selectors used to select events for the event data store. You can configure up to five advanced event selectors for each event data store.

  • :multi_region_enabled (Boolean)

    Specifies whether an event data store collects events from all Regions, or only from the Region in which it was created.

  • :organization_enabled (Boolean)

    Specifies whether an event data store collects events logged for an organization in Organizations.

    <note markdown=“1”> Only the management account for the organization can convert an organization event data store to a non-organization event data store, or convert a non-organization event data store to an organization event data store.

    </note>
    
  • :retention_period (Integer)

    The retention period of the event data store, in days. If ‘BillingMode` is set to `EXTENDABLE_RETENTION_PRICING`, you can set a retention period of up to 3653 days, the equivalent of 10 years. If `BillingMode` is set to `FIXED_RETENTION_PRICING`, you can set a retention period of up to 2557 days, the equivalent of seven years.

    CloudTrail Lake determines whether to retain an event by checking if the ‘eventTime` of the event is within the specified retention period. For example, if you set a retention period of 90 days, CloudTrail will remove events when the `eventTime` is older than 90 days.

    <note markdown=“1”> If you decrease the retention period of an event data store, CloudTrail will remove any events with an ‘eventTime` older than the new retention period. For example, if the previous retention period was 365 days and you decrease it to 100 days, CloudTrail will remove events with an `eventTime` older than 100 days.

    </note>
    
  • :termination_protection_enabled (Boolean)

    Indicates that termination protection is enabled and the event data store cannot be automatically deleted.

  • :kms_key_id (String)

    Specifies the KMS key ID to use to encrypt the events delivered by CloudTrail. The value can be an alias name prefixed by ‘alias/`, a fully specified ARN to an alias, a fully specified ARN to a key, or a globally unique identifier.

    Disabling or deleting the KMS key, or removing CloudTrail permissions on the key, prevents CloudTrail from logging events to the event data store, and prevents users from querying the data in the event data store that was encrypted with the key. After you associate an event data store with a KMS key, the KMS key cannot be removed or changed. Before you disable or delete a KMS key that you are using with an event data store, delete or back up your event data store.

    CloudTrail also supports KMS multi-Region keys. For more information about multi-Region keys, see [Using multi-Region keys] in the *Key Management Service Developer Guide*.

    Examples:

    • ‘alias/MyAliasName`

    • ‘arn:aws:kms:us-east-2:123456789012:alias/MyAliasName`

    • ‘arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012`

    • ‘12345678-1234-1234-1234-123456789012`

    [1]: docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html

  • :billing_mode (String)

    <note markdown=“1”> You can’t change the billing mode from ‘EXTENDABLE_RETENTION_PRICING` to `FIXED_RETENTION_PRICING`. If `BillingMode` is set to `EXTENDABLE_RETENTION_PRICING` and you want to use `FIXED_RETENTION_PRICING` instead, you’ll need to stop ingestion on the event data store and create a new event data store that uses ‘FIXED_RETENTION_PRICING`.

    </note>
    

    The billing mode for the event data store determines the cost for ingesting events and the default and maximum retention period for the event data store.

    The following are the possible values:

    • ‘EXTENDABLE_RETENTION_PRICING` - This billing mode is generally recommended if you want a flexible retention period of up to 3653 days (about 10 years). The default retention period for this billing mode is 366 days.

    • ‘FIXED_RETENTION_PRICING` - This billing mode is recommended if you expect to ingest more than 25 TB of event data per month and need a retention period of up to 2557 days (about 7 years). The default retention period for this billing mode is 2557 days.

    For more information about CloudTrail pricing, see [CloudTrail Pricing] and [Managing CloudTrail Lake costs].

    [1]: aws.amazon.com/cloudtrail/pricing/ [2]: docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-lake-manage-costs.html

Returns:

See Also:



4301
4302
4303
4304
# File 'lib/aws-sdk-cloudtrail/client.rb', line 4301

def update_event_data_store(params = {}, options = {})
  req = build_request(:update_event_data_store, params)
  req.send_request(options)
end

#update_trail(params = {}) ⇒ Types::UpdateTrailResponse

Updates trail settings that control what events you are logging, and how to handle log files. Changes to a trail do not require stopping the CloudTrail service. Use this action to designate an existing bucket for log delivery. If the existing bucket has previously been a target for CloudTrail log files, an IAM policy exists for the bucket. ‘UpdateTrail` must be called from the Region in which the trail was created; otherwise, an `InvalidHomeRegionException` is thrown.

Examples:

Request syntax with placeholder values


resp = client.update_trail({
  name: "String", # required
  s3_bucket_name: "String",
  s3_key_prefix: "String",
  sns_topic_name: "String",
  include_global_service_events: false,
  is_multi_region_trail: false,
  enable_log_file_validation: false,
  cloud_watch_logs_log_group_arn: "String",
  cloud_watch_logs_role_arn: "String",
  kms_key_id: "String",
  is_organization_trail: false,
})

Response structure


resp.name #=> String
resp.s3_bucket_name #=> String
resp.s3_key_prefix #=> String
resp.sns_topic_name #=> String
resp.sns_topic_arn #=> String
resp.include_global_service_events #=> Boolean
resp.is_multi_region_trail #=> Boolean
resp.trail_arn #=> String
resp.log_file_validation_enabled #=> Boolean
resp.cloud_watch_logs_log_group_arn #=> String
resp.cloud_watch_logs_role_arn #=> String
resp.kms_key_id #=> String
resp.is_organization_trail #=> Boolean

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :name (required, String)

    Specifies the name of the trail or trail ARN. If ‘Name` is 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 ‘Name` is a trail ARN, it must be in the following format.

    ‘arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail`

  • :s3_bucket_name (String)

    Specifies the name of the Amazon S3 bucket designated for publishing log files. See [Amazon S3 Bucket naming rules].

    [1]: docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html

  • :s3_key_prefix (String)

    Specifies the Amazon S3 key prefix that comes after the name of the bucket you have designated for log file delivery. For more information, see [Finding Your CloudTrail Log Files]. The maximum length is 200 characters.

    [1]: docs.aws.amazon.com/awscloudtrail/latest/userguide/get-and-view-cloudtrail-log-files.html#cloudtrail-find-log-files

  • :sns_topic_name (String)

    Specifies the name of the Amazon SNS topic defined for notification of log file delivery. The maximum length is 256 characters.

  • :include_global_service_events (Boolean)

    Specifies whether the trail is publishing events from global services such as IAM to the log files.

  • :is_multi_region_trail (Boolean)

    Specifies whether the trail applies only to the current Region or to all Regions. The default is false. If the trail exists only in the current Region and this value is set to true, shadow trails (replications of the trail) will be created in the other Regions. If the trail exists in all Regions and this value is set to false, the trail will remain in the Region where it was created, and its shadow trails in other Regions will be deleted. As a best practice, consider using trails that log events in all Regions.

  • :enable_log_file_validation (Boolean)

    Specifies whether log file validation is enabled. The default is false.

    <note markdown=“1”> When you disable log file integrity validation, the chain of digest files is broken after one hour. CloudTrail does not create digest files for log files that were delivered during a period in which log file integrity validation was disabled. For example, if you enable log file integrity validation at noon on January 1, disable it at noon on January 2, and re-enable it at noon on January 10, digest files will not be created for the log files delivered from noon on January 2 to noon on January 10. The same applies whenever you stop CloudTrail logging or delete a trail.

    </note>
    
  • :cloud_watch_logs_log_group_arn (String)

    Specifies a log group name using an Amazon Resource Name (ARN), a unique identifier that represents the log group to which CloudTrail logs are delivered. You must use a log group that exists in your account.

    Not required unless you specify ‘CloudWatchLogsRoleArn`.

  • :cloud_watch_logs_role_arn (String)

    Specifies the role for the CloudWatch Logs endpoint to assume to write to a user’s log group. You must use a role that exists in your account.

  • :kms_key_id (String)

    Specifies the KMS key ID to use to encrypt the logs delivered by CloudTrail. The value can be an alias name prefixed by “alias/”, a fully specified ARN to an alias, a fully specified ARN to a key, or a globally unique identifier.

    CloudTrail also supports KMS multi-Region keys. For more information about multi-Region keys, see [Using multi-Region keys] in the *Key Management Service Developer Guide*.

    Examples:

    • alias/MyAliasName

    • arn:aws:kms:us-east-2:123456789012:alias/MyAliasName

    • arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012

    • 12345678-1234-1234-1234-123456789012

    [1]: docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html

  • :is_organization_trail (Boolean)

    Specifies whether the trail is applied to all accounts in an organization in Organizations, or only for the current Amazon Web Services account. The default is false, and cannot be true unless the call is made on behalf of an Amazon Web Services account that is the management account for an organization in Organizations. If the trail is not an organization trail and this is set to ‘true`, the trail will be created in all Amazon Web Services accounts that belong to the organization. If the trail is an organization trail and this is set to `false`, the trail will remain in the current Amazon Web Services account but be deleted from all member accounts in the organization.

    <note markdown=“1”> Only the management account for the organization can convert an organization trail to a non-organization trail, or convert a non-organization trail to an organization trail.

    </note>
    

Returns:

See Also:



4493
4494
4495
4496
# File 'lib/aws-sdk-cloudtrail/client.rb', line 4493

def update_trail(params = {}, options = {})
  req = build_request(:update_trail, params)
  req.send_request(options)
end

#waiter_namesObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Deprecated.


4522
4523
4524
# File 'lib/aws-sdk-cloudtrail/client.rb', line 4522

def waiter_names
  []
end