Class: Svix::SnowflakeConfig

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

Overview

Configuration parameters for defining a Snowflake sink.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ SnowflakeConfig

Returns a new instance of SnowflakeConfig.



32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/svix/models/snowflake_config.rb', line 32

def initialize(attributes = {})
  unless attributes.is_a?(Hash)
    fail(ArgumentError, "The input argument (attributes) must be a hash in `Svix::SnowflakeConfig` new method")
  end

  attributes.each do |k, v|
    unless ALL_FIELD.include?(k.to_s)
      fail(ArgumentError, "The field #{k} is not part of Svix::SnowflakeConfig")
    end

    instance_variable_set("@#{k}", v)
    instance_variable_set("@__#{k}_is_defined", true)
  end
end

Instance Attribute Details

#account_identifierObject

Snowflake account identifier, which includes both the organization and account IDs separated by a hyphen.



9
10
11
# File 'lib/svix/models/snowflake_config.rb', line 9

def 
  @account_identifier
end

#db_nameObject

Database name.

Only required if not using transformations.



13
14
15
# File 'lib/svix/models/snowflake_config.rb', line 13

def db_name
  @db_name
end

#private_keyObject

PEM-encoded private key used for signing token-based requests to the Snowflake API.

Beginning/end delimiters are not required.



17
18
19
# File 'lib/svix/models/snowflake_config.rb', line 17

def private_key
  @private_key
end

#schema_nameObject

Schema name.

Only required if not using transformations.



21
22
23
# File 'lib/svix/models/snowflake_config.rb', line 21

def schema_name
  @schema_name
end

#table_nameObject

Table name.

Only required if not using transformations.



25
26
27
# File 'lib/svix/models/snowflake_config.rb', line 25

def table_name
  @table_name
end

#user_idObject

The Snowflake user id.



27
28
29
# File 'lib/svix/models/snowflake_config.rb', line 27

def user_id
  @user_id
end

Class Method Details

.deserialize(attributes = {}) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
# File 'lib/svix/models/snowflake_config.rb', line 47

def self.deserialize(attributes = {})
  attributes = attributes.transform_keys(&:to_s)
  attrs = Hash.new
  attrs["account_identifier"] = attributes["accountIdentifier"]
  attrs["db_name"] = attributes["dbName"]
  attrs["private_key"] = attributes["privateKey"]
  attrs["schema_name"] = attributes["schemaName"]
  attrs["table_name"] = attributes["tableName"]
  attrs["user_id"] = attributes["userId"]
  new(attrs)
end

Instance Method Details

#serializeObject



59
60
61
62
63
64
65
66
67
68
# File 'lib/svix/models/snowflake_config.rb', line 59

def serialize
  out = Hash.new
  out["accountIdentifier"] = Svix::serialize_primitive(@account_identifier) if @account_identifier
  out["dbName"] = Svix::serialize_primitive(@db_name) if @db_name
  out["privateKey"] = Svix::serialize_primitive(@private_key) if @private_key
  out["schemaName"] = Svix::serialize_primitive(@schema_name) if @schema_name
  out["tableName"] = Svix::serialize_primitive(@table_name) if @table_name
  out["userId"] = Svix::serialize_primitive(@user_id) if @user_id
  out
end

#to_jsonObject

Serializes the object to a json string

Returns:

  • String



72
73
74
# File 'lib/svix/models/snowflake_config.rb', line 72

def to_json
  JSON.dump(serialize)
end