Class: SDM::Query

Inherits:
Object
  • Object
show all
Defined in:
lib/models/porcelain.rb

Overview

A Query is a record of a single client request to a resource, such as a SQL query. Longer-running queries including long-running SSH commands and SSH, RDP, or Kubernetes interactive sessions will return two Query records with the same identifier, one record at the start of the query and a second record upon the completion of the query with additional detail.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(account_email: nil, account_first_name: nil, account_id: nil, account_last_name: nil, account_tags: nil, capture: nil, client_ip: nil, completed_at: nil, duration: nil, egress_node_id: nil, encrypted: nil, id: nil, query_body: nil, query_category: nil, query_hash: nil, query_key: nil, record_count: nil, remote_identity_username: nil, replayable: nil, resource_id: nil, resource_name: nil, resource_tags: nil, resource_type: nil, source_ip: nil, timestamp: nil) ⇒ Query

Returns a new instance of Query.



8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
# File 'lib/models/porcelain.rb', line 8163

def initialize(
  account_email: nil,
  account_first_name: nil,
  account_id: nil,
  account_last_name: nil,
  account_tags: nil,
  capture: nil,
  client_ip: nil,
  completed_at: nil,
  duration: nil,
  egress_node_id: nil,
  encrypted: nil,
  id: nil,
  query_body: nil,
  query_category: nil,
  query_hash: nil,
  query_key: nil,
  record_count: nil,
  remote_identity_username: nil,
  replayable: nil,
  resource_id: nil,
  resource_name: nil,
  resource_tags: nil,
  resource_type: nil,
  source_ip: nil,
  timestamp: nil
)
  @account_email =  == nil ? "" : 
  @account_first_name =  == nil ? "" : 
  @account_id =  == nil ? "" : 
  @account_last_name =  == nil ? "" : 
  @account_tags =  == nil ? SDM::_porcelain_zero_value_tags() : 
  @capture = capture == nil ? nil : capture
  @client_ip = client_ip == nil ? "" : client_ip
  @completed_at = completed_at == nil ? nil : completed_at
  @duration = duration == nil ? nil : duration
  @egress_node_id = egress_node_id == nil ? "" : egress_node_id
  @encrypted = encrypted == nil ? false : encrypted
  @id = id == nil ? "" : id
  @query_body = query_body == nil ? "" : query_body
  @query_category = query_category == nil ? "" : query_category
  @query_hash = query_hash == nil ? "" : query_hash
  @query_key = query_key == nil ? "" : query_key
  @record_count = record_count == nil ? 0 : record_count
  @remote_identity_username = remote_identity_username == nil ? "" : remote_identity_username
  @replayable = replayable == nil ? false : replayable
  @resource_id = resource_id == nil ? "" : resource_id
  @resource_name = resource_name == nil ? "" : resource_name
  @resource_tags = resource_tags == nil ? SDM::_porcelain_zero_value_tags() : resource_tags
  @resource_type = resource_type == nil ? "" : resource_type
  @source_ip = source_ip == nil ? "" : source_ip
  @timestamp = timestamp == nil ? nil : timestamp
end

Instance Attribute Details

#account_emailObject

The email of the account performing this query, at the time the query was executed. If the account email is later changed, that change will not be reflected via this field.



8102
8103
8104
# File 'lib/models/porcelain.rb', line 8102

def 
  @account_email
end

#account_first_nameObject

The given name of the account performing this query, at the time the query was executed. If the account is later renamed, that change will not be reflected via this field.



8105
8106
8107
# File 'lib/models/porcelain.rb', line 8105

def 
  @account_first_name
end

#account_idObject

Unique identifier of the Account that performed the Query.



8107
8108
8109
# File 'lib/models/porcelain.rb', line 8107

def 
  @account_id
end

#account_last_nameObject

The family name of the account performing this query, at the time the query was executed. If the account is later renamed, that change will not be reflected via this field.



8110
8111
8112
# File 'lib/models/porcelain.rb', line 8110

def 
  @account_last_name
end

#account_tagsObject

The tags of the account accessed, at the time the query was executed. If the account tags are later changed, that change will not be reflected via this field.



8113
8114
8115
# File 'lib/models/porcelain.rb', line 8113

def 
  @account_tags
end

#captureObject

For queries against SSH, Kubernetes, and RDP resources, this contains additional information about the captured query.



8116
8117
8118
# File 'lib/models/porcelain.rb', line 8116

def capture
  @capture
end

#client_ipObject

The IP address the Query was performed from, as detected at the StrongDM control plane.



8118
8119
8120
# File 'lib/models/porcelain.rb', line 8118

def client_ip
  @client_ip
end

#completed_atObject

The time at which the Query was completed. Empty if this record indicates the start of a long-running query.



8121
8122
8123
# File 'lib/models/porcelain.rb', line 8121

def completed_at
  @completed_at
end

#durationObject

The duration of the Query.



8123
8124
8125
# File 'lib/models/porcelain.rb', line 8123

def duration
  @duration
end

#egress_node_idObject

The unique ID of the node through which the Resource was accessed.



8125
8126
8127
# File 'lib/models/porcelain.rb', line 8125

def egress_node_id
  @egress_node_id
end

#encryptedObject

Indicates that the body of the Query is encrypted.



8127
8128
8129
# File 'lib/models/porcelain.rb', line 8127

def encrypted
  @encrypted
end

#idObject

Unique identifier of the Query.



8129
8130
8131
# File 'lib/models/porcelain.rb', line 8129

def id
  @id
end

#query_bodyObject

The captured content of the Query. For queries against SSH, Kubernetes, and RDP resources, this contains a JSON representation of the QueryCapture.



8132
8133
8134
# File 'lib/models/porcelain.rb', line 8132

def query_body
  @query_body
end

#query_categoryObject

The general category of Resource against which Query was performed, e.g. "web" or "cloud".



8134
8135
8136
# File 'lib/models/porcelain.rb', line 8134

def query_category
  @query_category
end

#query_hashObject

The hash of the body of the Query.



8136
8137
8138
# File 'lib/models/porcelain.rb', line 8136

def query_hash
  @query_hash
end

#query_keyObject

The symmetric key used to encrypt the body of this Query and its replay if replayable. If the Query is encrypted, this field contains an encrypted symmetric key in base64 encoding. This key must be decrypted with the organization's private key to obtain the symmetric key needed to decrypt the body. If the Query is not encrypted, this field is empty.



8141
8142
8143
# File 'lib/models/porcelain.rb', line 8141

def query_key
  @query_key
end

#record_countObject

The number of records returned by the Query, for a database Resource.



8143
8144
8145
# File 'lib/models/porcelain.rb', line 8143

def record_count
  @record_count
end

#remote_identity_usernameObject

The username of the RemoteIdentity used to access the Resource.



8145
8146
8147
# File 'lib/models/porcelain.rb', line 8145

def remote_identity_username
  @remote_identity_username
end

#replayableObject

Indicates that the Query is replayable, e.g. for some SSH or K8s sessions.



8147
8148
8149
# File 'lib/models/porcelain.rb', line 8147

def replayable
  @replayable
end

#resource_idObject

Unique identifier of the Resource against which the Query was performed.



8149
8150
8151
# File 'lib/models/porcelain.rb', line 8149

def resource_id
  @resource_id
end

#resource_nameObject

The name of the resource accessed, at the time the query was executed. If the resource is later renamed, that change will not be reflected via this field.



8152
8153
8154
# File 'lib/models/porcelain.rb', line 8152

def resource_name
  @resource_name
end

#resource_tagsObject

The tags of the resource accessed, at the time the query was executed. If the resource tags are later changed, that change will not be reflected via this field.



8155
8156
8157
# File 'lib/models/porcelain.rb', line 8155

def resource_tags
  @resource_tags
end

#resource_typeObject

The specific type of Resource against which the Query was performed, e.g. "ssh" or "postgres".



8157
8158
8159
# File 'lib/models/porcelain.rb', line 8157

def resource_type
  @resource_type
end

#source_ipObject

The IP address the Query was performed from, as detected at the ingress gateway.



8159
8160
8161
# File 'lib/models/porcelain.rb', line 8159

def source_ip
  @source_ip
end

#timestampObject

The time at which the Query was started.



8161
8162
8163
# File 'lib/models/porcelain.rb', line 8161

def timestamp
  @timestamp
end

Instance Method Details

#to_json(options = {}) ⇒ Object



8217
8218
8219
8220
8221
8222
8223
# File 'lib/models/porcelain.rb', line 8217

def to_json(options = {})
  hash = {}
  self.instance_variables.each do |var|
    hash[var.id2name.delete_prefix("@")] = self.instance_variable_get var
  end
  hash.to_json
end