Class: AWSCDK::EventsTargets::RedshiftQueryProps

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
events_targets/redshift_query_props.rb

Overview

Configuration properties of an Amazon Redshift Query event.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(database:, sql:, db_user: nil, dead_letter_queue: nil, input: nil, role: nil, secret: nil, send_event_bridge_event: nil, statement_name: nil) ⇒ RedshiftQueryProps

Returns a new instance of RedshiftQueryProps.

Parameters:

  • database (String)

    The Amazon Redshift database to run the query against.

  • sql (Array<String>)

    The SQL queries to be executed.

  • db_user (String, nil) (defaults to: nil)

    The Amazon Redshift database user to run the query as.

  • dead_letter_queue (AWSCDK::SQS::IQueue, nil) (defaults to: nil)

    The queue to be used as dead letter queue.

  • input (AWSCDK::Events::RuleTargetInput, nil) (defaults to: nil)

    The input to the state machine execution.

  • role (AWSCDK::IAM::IRole, nil) (defaults to: nil)

    The IAM role to be used to execute the SQL statement.

  • secret (AWSCDK::SecretsManager::ISecret, nil) (defaults to: nil)

    The secret containing the password for the database user.

  • send_event_bridge_event (Boolean, nil) (defaults to: nil)

    Should an event be sent back to Event Bridge when the SQL statement is executed.

  • statement_name (String, nil) (defaults to: nil)

    The name of the SQL statement.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'events_targets/redshift_query_props.rb', line 16

def initialize(database:, sql:, db_user: nil, dead_letter_queue: nil, input: nil, role: nil, secret: nil, send_event_bridge_event: nil, statement_name: nil)
  @database = database
  Jsii::Type.check_type(@database, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "database")
  @sql = sql
  Jsii::Type.check_type(@sql, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "sql")
  @db_user = db_user
  Jsii::Type.check_type(@db_user, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "dbUser") unless @db_user.nil?
  @dead_letter_queue = dead_letter_queue
  Jsii::Type.check_type(@dead_letter_queue, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc3FzLklRdWV1ZSJ9")), "deadLetterQueue") unless @dead_letter_queue.nil?
  @input = input
  Jsii::Type.check_type(@input, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZXZlbnRzLlJ1bGVUYXJnZXRJbnB1dCJ9")), "input") unless @input.nil?
  @role = role
  Jsii::Type.check_type(@role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "role") unless @role.nil?
  @secret = secret
  Jsii::Type.check_type(@secret, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc2VjcmV0c21hbmFnZXIuSVNlY3JldCJ9")), "secret") unless @secret.nil?
  @send_event_bridge_event = send_event_bridge_event
  Jsii::Type.check_type(@send_event_bridge_event, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "sendEventBridgeEvent") unless @send_event_bridge_event.nil?
  @statement_name = statement_name
  Jsii::Type.check_type(@statement_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "statementName") unless @statement_name.nil?
end

Instance Attribute Details

#databaseString (readonly)

The Amazon Redshift database to run the query against.

Returns:

  • (String)


40
41
42
# File 'events_targets/redshift_query_props.rb', line 40

def database
  @database
end

#db_userString? (readonly)

Note:

Default: - No Database user is specified

The Amazon Redshift database user to run the query as.

This is required when authenticating via temporary credentials.

Returns:

  • (String, nil)


57
58
59
# File 'events_targets/redshift_query_props.rb', line 57

def db_user
  @db_user
end

#dead_letter_queueAWSCDK::SQS::IQueue? (readonly)

Note:

Default: - No dead letter queue is specified

The queue to be used as dead letter queue.

Returns:



62
63
64
# File 'events_targets/redshift_query_props.rb', line 62

def dead_letter_queue
  @dead_letter_queue
end

#inputAWSCDK::Events::RuleTargetInput? (readonly)

Note:

Default: - the entire EventBridge event

The input to the state machine execution.



67
68
69
# File 'events_targets/redshift_query_props.rb', line 67

def input
  @input
end

#roleAWSCDK::IAM::IRole? (readonly)

Note:

Default: - a new role will be created.

The IAM role to be used to execute the SQL statement.

Returns:



72
73
74
# File 'events_targets/redshift_query_props.rb', line 72

def role
  @role
end

#secretAWSCDK::SecretsManager::ISecret? (readonly)

Note:

Default: - No secret is specified

The secret containing the password for the database user.

This is required when authenticating via Secrets Manager. If the full secret ARN is not specified, this will instead use the secret name.



80
81
82
# File 'events_targets/redshift_query_props.rb', line 80

def secret
  @secret
end

#send_event_bridge_eventBoolean? (readonly)

Note:

Default: false

Should an event be sent back to Event Bridge when the SQL statement is executed.

Returns:

  • (Boolean, nil)


85
86
87
# File 'events_targets/redshift_query_props.rb', line 85

def send_event_bridge_event
  @send_event_bridge_event
end

#sqlArray<String> (readonly)

Note:

Default: - No SQL query is specified

The SQL queries to be executed.

Each query is run sequentially within a single transaction; the next query in the array will only execute after the previous one has successfully completed.

  • When multiple sql queries are included, this will use the batch_execute_statement API. Therefore, if any statement fails, the entire transaction is rolled back.
  • If a single SQL statement is to be executed, this will use the execute_statement API.

Returns:

  • (Array<String>)


50
51
52
# File 'events_targets/redshift_query_props.rb', line 50

def sql
  @sql
end

#statement_nameString? (readonly)

Note:

Default: - No statement name is specified

The name of the SQL statement.

You can name the SQL statement for identitfication purposes. If you would like Amazon Redshift to identify the Event Bridge rule, and present it in the Amazon Redshift console, append a QS2- prefix to the statement name.

Returns:

  • (String, nil)


92
93
94
# File 'events_targets/redshift_query_props.rb', line 92

def statement_name
  @statement_name
end

Class Method Details

.jsii_propertiesObject



94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'events_targets/redshift_query_props.rb', line 94

def self.jsii_properties
  {
    :database => "database",
    :sql => "sql",
    :db_user => "dbUser",
    :dead_letter_queue => "deadLetterQueue",
    :input => "input",
    :role => "role",
    :secret => "secret",
    :send_event_bridge_event => "sendEventBridgeEvent",
    :statement_name => "statementName",
  }
end

Instance Method Details

#to_jsiiObject



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'events_targets/redshift_query_props.rb', line 108

def to_jsii
  result = {}
  result.merge!({
    "database" => @database,
    "sql" => @sql,
    "dbUser" => @db_user,
    "deadLetterQueue" => @dead_letter_queue,
    "input" => @input,
    "role" => @role,
    "secret" => @secret,
    "sendEventBridgeEvent" => @send_event_bridge_event,
    "statementName" => @statement_name,
  })
  result.compact
end