svix 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/svix/api/destination.rb +75 -0
- data/lib/svix/api/destination_transformation.rb +30 -0
- data/lib/svix/api_internal/destination.rb +14 -0
- data/lib/svix/api_internal/destination_autoconfig.rb +22 -0
- data/lib/svix/api_internal/endpoint.rb +4 -2
- data/lib/svix/api_internal/{endpoint_auto_config.rb → endpoint_auto_config_deprecated.rb} +1 -1
- data/lib/svix/api_internal/endpoint_autoconfig.rb +30 -0
- data/lib/svix/autoconfig.rb +51 -18
- data/lib/svix/autoconfig_consumer.rb +70 -9
- data/lib/svix/models/auto_config_sink_type.rb +1 -5
- data/lib/svix/models/auto_config_subscription_out.rb +67 -0
- data/lib/svix/models/destination_in.rb +204 -0
- data/lib/svix/models/destination_out.rb +224 -0
- data/lib/svix/models/destination_patch.rb +190 -0
- data/lib/svix/models/destination_status.rb +31 -0
- data/lib/svix/models/destination_status_in.rb +29 -0
- data/lib/svix/models/destination_transform_in.rb +49 -0
- data/lib/svix/models/destination_transformation_out.rb +52 -0
- data/lib/svix/models/fifo_endpoint_config_in.rb +52 -0
- data/lib/svix/models/ingest_source_in.rb +6 -5
- data/lib/svix/models/ingest_source_out.rb +6 -5
- data/lib/svix/models/list_response_destination_out.rb +58 -0
- data/lib/svix/models/merge_config.rb +46 -0
- data/lib/svix/models/merge_config_out.rb +43 -0
- data/lib/svix/models/s3_config_in.rb +1 -1
- data/lib/svix/models/status.rb +29 -0
- data/lib/svix/models/stream_sink_in.rb +1 -5
- data/lib/svix/models/stream_sink_out.rb +18 -5
- data/lib/svix/models/stream_sink_patch.rb +1 -5
- data/lib/svix/svix.rb +2 -0
- data/lib/svix/version.rb +1 -1
- data/lib/svix.rb +13 -0
- metadata +21 -3
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file is @generated
|
|
3
|
+
require "json"
|
|
4
|
+
|
|
5
|
+
require_relative "./azure_blob_storage_config_in"
|
|
6
|
+
require_relative "./big_query_config_in"
|
|
7
|
+
require_relative "./clickhouse_config_in"
|
|
8
|
+
require_relative "./destination_status_in"
|
|
9
|
+
require_relative "./event_bridge_config_in"
|
|
10
|
+
require_relative "./fifo_endpoint_config_in"
|
|
11
|
+
require_relative "./google_cloud_pub_sub_config_in"
|
|
12
|
+
require_relative "./google_cloud_storage_config_in"
|
|
13
|
+
require_relative "./otel_tracing_config_in"
|
|
14
|
+
require_relative "./postgres_config_in"
|
|
15
|
+
require_relative "./rabbit_mq_config_in"
|
|
16
|
+
require_relative "./redshift_config_in"
|
|
17
|
+
require_relative "./s3_config_in"
|
|
18
|
+
require_relative "./snowflake_config_in"
|
|
19
|
+
require_relative "./sns_config_in"
|
|
20
|
+
require_relative "./sqs_config_in"
|
|
21
|
+
|
|
22
|
+
module Svix
|
|
23
|
+
class DestinationInConfig
|
|
24
|
+
class PollingEndpoint
|
|
25
|
+
|
|
26
|
+
def serialize
|
|
27
|
+
Hash.new
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def self.deserialize(attributes = {})
|
|
31
|
+
new
|
|
32
|
+
end
|
|
33
|
+
# Serializes the object to a json string
|
|
34
|
+
# @return String
|
|
35
|
+
def to_json(*args)
|
|
36
|
+
serialize.to_json(*args)
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
class AzureBlobStorage < AzureBlobStorageConfigIn
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
class OtelTracing < OtelTracingConfigIn
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
class FifoEndpoint < FifoEndpointConfigIn
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
class AmazonS3 < S3ConfigIn
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
class GoogleCloudStorage < GoogleCloudStorageConfigIn
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
class GoogleCloudPubSub < GoogleCloudPubSubConfigIn
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
class Sqs < SqsConfigIn
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
class Sns < SnsConfigIn
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
class BigQuery < BigQueryConfigIn
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
class Clickhouse < ClickhouseConfigIn
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
class EventBridge < EventBridgeConfigIn
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
class Snowflake < SnowflakeConfigIn
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
class RabbitMq < RabbitMqConfigIn
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
class Redshift < RedshiftConfigIn
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
class Postgres < PostgresConfigIn
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# The destination's type and type-specific configuration.
|
|
87
|
+
class DestinationIn
|
|
88
|
+
# An optional unique identifier for the destination.
|
|
89
|
+
attr_accessor :uid
|
|
90
|
+
# Whether the destination will receive events.
|
|
91
|
+
#
|
|
92
|
+
# If the destination is `enabled`, events sent to the application will be dispatched to the destination in order.
|
|
93
|
+
#
|
|
94
|
+
# If the destination is `disabled`, events will not be dispatched until the destination is reenabled.
|
|
95
|
+
attr_accessor :status
|
|
96
|
+
# How many events will be batched in a request to the destination.
|
|
97
|
+
attr_accessor :batch_size
|
|
98
|
+
# How long to wait before a batch of events is sent, if the `batchSize` is not reached.
|
|
99
|
+
#
|
|
100
|
+
# For example, with a `batchSize` of 100 and `maxWaitSecs` of 10, a request is sent after 10 seconds or 100 events, whichever comes first.
|
|
101
|
+
#
|
|
102
|
+
# Note that an empty batch is never sent to the destination.
|
|
103
|
+
attr_accessor :max_wait_secs
|
|
104
|
+
# A list of event types that filter which events are dispatched to the destination. An empty list (or null) will not filter out any events.
|
|
105
|
+
attr_accessor :event_types
|
|
106
|
+
# A list of channels that filter which events are dispatched to the destination. An empty list (or null) will not filter out any events.
|
|
107
|
+
attr_accessor :channels
|
|
108
|
+
attr_accessor :metadata
|
|
109
|
+
attr_accessor :config
|
|
110
|
+
|
|
111
|
+
ALL_FIELD ||= ["uid", "status", "batch_size", "max_wait_secs", "event_types", "channels", "metadata", "config"].freeze
|
|
112
|
+
private_constant :ALL_FIELD
|
|
113
|
+
TYPE_TO_NAME = {
|
|
114
|
+
DestinationInConfig::PollingEndpoint => "pollingEndpoint",
|
|
115
|
+
DestinationInConfig::AzureBlobStorage => "azureBlobStorage",
|
|
116
|
+
DestinationInConfig::OtelTracing => "otelTracing",
|
|
117
|
+
DestinationInConfig::FifoEndpoint => "fifoEndpoint",
|
|
118
|
+
DestinationInConfig::AmazonS3 => "amazonS3",
|
|
119
|
+
DestinationInConfig::GoogleCloudStorage => "googleCloudStorage",
|
|
120
|
+
DestinationInConfig::GoogleCloudPubSub => "googleCloudPubSub",
|
|
121
|
+
DestinationInConfig::Sqs => "sqs",
|
|
122
|
+
DestinationInConfig::Sns => "sns",
|
|
123
|
+
DestinationInConfig::BigQuery => "bigQuery",
|
|
124
|
+
DestinationInConfig::Clickhouse => "clickhouse",
|
|
125
|
+
DestinationInConfig::EventBridge => "eventBridge",
|
|
126
|
+
DestinationInConfig::Snowflake => "snowflake",
|
|
127
|
+
DestinationInConfig::RabbitMq => "rabbitMq",
|
|
128
|
+
DestinationInConfig::Redshift => "redshift",
|
|
129
|
+
DestinationInConfig::Postgres => "postgres"
|
|
130
|
+
}
|
|
131
|
+
private_constant :TYPE_TO_NAME
|
|
132
|
+
NAME_TO_TYPE = TYPE_TO_NAME.invert
|
|
133
|
+
private_constant :NAME_TO_TYPE
|
|
134
|
+
|
|
135
|
+
def initialize(attributes = {})
|
|
136
|
+
unless attributes.is_a?(Hash)
|
|
137
|
+
fail(
|
|
138
|
+
ArgumentError,
|
|
139
|
+
"The input argument (attributes) must be a hash in `Svix::DestinationIn` new method"
|
|
140
|
+
)
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
attributes.each do |k, v|
|
|
144
|
+
unless ALL_FIELD.include?(k.to_s)
|
|
145
|
+
fail(ArgumentError, "The field #{k} is not part of Svix::DestinationIn")
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
if k.to_s == "config"
|
|
149
|
+
unless TYPE_TO_NAME.key?(v.class)
|
|
150
|
+
fail(ArgumentError, "The field #{k} can't be a `#{v.class}` expected one of #{TYPE_TO_NAME.keys}")
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
instance_variable_set("@__enum_discriminator", TYPE_TO_NAME[v.class])
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
instance_variable_set("@#{k}", v)
|
|
157
|
+
instance_variable_set("@__#{k}_is_defined", true)
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
if @__enum_discriminator.nil?
|
|
161
|
+
fail(ArgumentError, "Required config field was not set")
|
|
162
|
+
end
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
def self.deserialize(attributes = {})
|
|
166
|
+
attributes = attributes.transform_keys(&:to_s)
|
|
167
|
+
attrs = Hash.new
|
|
168
|
+
attrs["uid"] = attributes["uid"]
|
|
169
|
+
attrs["status"] = Svix::DestinationStatusIn.deserialize(attributes["status"]) if attributes["status"]
|
|
170
|
+
attrs["batch_size"] = attributes["batchSize"]
|
|
171
|
+
attrs["max_wait_secs"] = attributes["maxWaitSecs"]
|
|
172
|
+
attrs["event_types"] = attributes["eventTypes"]
|
|
173
|
+
attrs["channels"] = attributes["channels"]
|
|
174
|
+
attrs["metadata"] = attributes["metadata"]
|
|
175
|
+
unless NAME_TO_TYPE.key?(attributes["type"])
|
|
176
|
+
fail(ArgumentError, "Invalid type `#{attributes["type"]}` expected on of #{NAME_TO_TYPE.keys}")
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
attrs["config"] = NAME_TO_TYPE[attributes["type"]].deserialize(attributes["config"] || {})
|
|
180
|
+
new(attrs)
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
def serialize
|
|
184
|
+
out = Hash.new
|
|
185
|
+
out["uid"] = Svix::serialize_primitive(@uid) unless @uid.nil?
|
|
186
|
+
out["status"] = Svix::serialize_schema_ref(@status) unless @status.nil?
|
|
187
|
+
out["batchSize"] = Svix::serialize_primitive(@batch_size) unless @batch_size.nil?
|
|
188
|
+
out["maxWaitSecs"] = Svix::serialize_primitive(@max_wait_secs) unless @max_wait_secs.nil?
|
|
189
|
+
out["eventTypes"] = Svix::serialize_primitive(@event_types) unless @event_types.nil?
|
|
190
|
+
out["channels"] = Svix::serialize_primitive(@channels) unless @channels.nil?
|
|
191
|
+
out["metadata"] = Svix::serialize_primitive(@metadata) unless @metadata.nil?
|
|
192
|
+
out["type"] = @__enum_discriminator
|
|
193
|
+
out["config"] = @config.serialize
|
|
194
|
+
out
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
# Serializes the object to a json string
|
|
198
|
+
# @return String
|
|
199
|
+
def to_json(*args)
|
|
200
|
+
serialize.to_json(*args)
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
end
|
|
204
|
+
end
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file is @generated
|
|
3
|
+
require "json"
|
|
4
|
+
|
|
5
|
+
require_relative "./azure_blob_storage_config_out"
|
|
6
|
+
require_relative "./big_query_config_out"
|
|
7
|
+
require_relative "./clickhouse_config_out"
|
|
8
|
+
require_relative "./destination_status"
|
|
9
|
+
require_relative "./event_bridge_config_out"
|
|
10
|
+
require_relative "./google_cloud_pub_sub_config_out"
|
|
11
|
+
require_relative "./google_cloud_storage_config_out"
|
|
12
|
+
require_relative "./otel_tracing_config_out"
|
|
13
|
+
require_relative "./postgres_config_out"
|
|
14
|
+
require_relative "./rabbit_mq_config_out"
|
|
15
|
+
require_relative "./redshift_config_out"
|
|
16
|
+
require_relative "./s3_config_out"
|
|
17
|
+
require_relative "./sink_http_config_out"
|
|
18
|
+
require_relative "./snowflake_config_out"
|
|
19
|
+
require_relative "./sns_config_out"
|
|
20
|
+
require_relative "./sqs_config_out"
|
|
21
|
+
|
|
22
|
+
module Svix
|
|
23
|
+
class DestinationOutConfig
|
|
24
|
+
class PollingEndpoint
|
|
25
|
+
|
|
26
|
+
def serialize
|
|
27
|
+
Hash.new
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def self.deserialize(attributes = {})
|
|
31
|
+
new
|
|
32
|
+
end
|
|
33
|
+
# Serializes the object to a json string
|
|
34
|
+
# @return String
|
|
35
|
+
def to_json(*args)
|
|
36
|
+
serialize.to_json(*args)
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
class AzureBlobStorage < AzureBlobStorageConfigOut
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
class OtelTracing < OtelTracingConfigOut
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
class FifoEndpoint < SinkHttpConfigOut
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
class AmazonS3 < S3ConfigOut
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
class Snowflake < SnowflakeConfigOut
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
class GoogleCloudStorage < GoogleCloudStorageConfigOut
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
class GoogleCloudPubSub < GoogleCloudPubSubConfigOut
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
class Redshift < RedshiftConfigOut
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
class BigQuery < BigQueryConfigOut
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
class Clickhouse < ClickhouseConfigOut
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
class RabbitMq < RabbitMqConfigOut
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
class Sqs < SqsConfigOut
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
class EventBridge < EventBridgeConfigOut
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
class Sns < SnsConfigOut
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
class Postgres < PostgresConfigOut
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
class DestinationOut
|
|
87
|
+
# The Destination's ID.
|
|
88
|
+
attr_accessor :id
|
|
89
|
+
# The Destination's UID.
|
|
90
|
+
attr_accessor :uid
|
|
91
|
+
attr_accessor :status
|
|
92
|
+
attr_accessor :current_iterator
|
|
93
|
+
attr_accessor :failure_reason
|
|
94
|
+
attr_accessor :created_at
|
|
95
|
+
attr_accessor :updated_at
|
|
96
|
+
attr_accessor :batch_size
|
|
97
|
+
attr_accessor :max_wait_secs
|
|
98
|
+
attr_accessor :event_types
|
|
99
|
+
attr_accessor :channels
|
|
100
|
+
attr_accessor :next_retry_at
|
|
101
|
+
attr_accessor :metadata
|
|
102
|
+
attr_accessor :config
|
|
103
|
+
|
|
104
|
+
ALL_FIELD ||= [
|
|
105
|
+
"id",
|
|
106
|
+
"uid",
|
|
107
|
+
"status",
|
|
108
|
+
"current_iterator",
|
|
109
|
+
"failure_reason",
|
|
110
|
+
"created_at",
|
|
111
|
+
"updated_at",
|
|
112
|
+
"batch_size",
|
|
113
|
+
"max_wait_secs",
|
|
114
|
+
"event_types",
|
|
115
|
+
"channels",
|
|
116
|
+
"next_retry_at",
|
|
117
|
+
"metadata",
|
|
118
|
+
"config"
|
|
119
|
+
].freeze
|
|
120
|
+
private_constant :ALL_FIELD
|
|
121
|
+
TYPE_TO_NAME = {
|
|
122
|
+
DestinationOutConfig::PollingEndpoint => "pollingEndpoint",
|
|
123
|
+
DestinationOutConfig::AzureBlobStorage => "azureBlobStorage",
|
|
124
|
+
DestinationOutConfig::OtelTracing => "otelTracing",
|
|
125
|
+
DestinationOutConfig::FifoEndpoint => "fifoEndpoint",
|
|
126
|
+
DestinationOutConfig::AmazonS3 => "amazonS3",
|
|
127
|
+
DestinationOutConfig::Snowflake => "snowflake",
|
|
128
|
+
DestinationOutConfig::GoogleCloudStorage => "googleCloudStorage",
|
|
129
|
+
DestinationOutConfig::GoogleCloudPubSub => "googleCloudPubSub",
|
|
130
|
+
DestinationOutConfig::Redshift => "redshift",
|
|
131
|
+
DestinationOutConfig::BigQuery => "bigQuery",
|
|
132
|
+
DestinationOutConfig::Clickhouse => "clickhouse",
|
|
133
|
+
DestinationOutConfig::RabbitMq => "rabbitMq",
|
|
134
|
+
DestinationOutConfig::Sqs => "sqs",
|
|
135
|
+
DestinationOutConfig::EventBridge => "eventBridge",
|
|
136
|
+
DestinationOutConfig::Sns => "sns",
|
|
137
|
+
DestinationOutConfig::Postgres => "postgres"
|
|
138
|
+
}
|
|
139
|
+
private_constant :TYPE_TO_NAME
|
|
140
|
+
NAME_TO_TYPE = TYPE_TO_NAME.invert
|
|
141
|
+
private_constant :NAME_TO_TYPE
|
|
142
|
+
|
|
143
|
+
def initialize(attributes = {})
|
|
144
|
+
unless attributes.is_a?(Hash)
|
|
145
|
+
fail(
|
|
146
|
+
ArgumentError,
|
|
147
|
+
"The input argument (attributes) must be a hash in `Svix::DestinationOut` new method"
|
|
148
|
+
)
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
attributes.each do |k, v|
|
|
152
|
+
unless ALL_FIELD.include?(k.to_s)
|
|
153
|
+
fail(ArgumentError, "The field #{k} is not part of Svix::DestinationOut")
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
if k.to_s == "config"
|
|
157
|
+
unless TYPE_TO_NAME.key?(v.class)
|
|
158
|
+
fail(ArgumentError, "The field #{k} can't be a `#{v.class}` expected one of #{TYPE_TO_NAME.keys}")
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
instance_variable_set("@__enum_discriminator", TYPE_TO_NAME[v.class])
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
instance_variable_set("@#{k}", v)
|
|
165
|
+
instance_variable_set("@__#{k}_is_defined", true)
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
if @__enum_discriminator.nil?
|
|
169
|
+
fail(ArgumentError, "Required config field was not set")
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
def self.deserialize(attributes = {})
|
|
174
|
+
attributes = attributes.transform_keys(&:to_s)
|
|
175
|
+
attrs = Hash.new
|
|
176
|
+
attrs["id"] = attributes["id"]
|
|
177
|
+
attrs["uid"] = attributes["uid"]
|
|
178
|
+
attrs["status"] = Svix::DestinationStatus.deserialize(attributes["status"])
|
|
179
|
+
attrs["current_iterator"] = attributes["currentIterator"]
|
|
180
|
+
attrs["failure_reason"] = attributes["failureReason"]
|
|
181
|
+
attrs["created_at"] = DateTime.rfc3339(attributes["createdAt"]).to_time
|
|
182
|
+
attrs["updated_at"] = DateTime.rfc3339(attributes["updatedAt"]).to_time
|
|
183
|
+
attrs["batch_size"] = attributes["batchSize"]
|
|
184
|
+
attrs["max_wait_secs"] = attributes["maxWaitSecs"]
|
|
185
|
+
attrs["event_types"] = attributes["eventTypes"]
|
|
186
|
+
attrs["channels"] = attributes["channels"]
|
|
187
|
+
attrs["next_retry_at"] = DateTime.rfc3339(attributes["nextRetryAt"]).to_time if attributes["nextRetryAt"]
|
|
188
|
+
attrs["metadata"] = attributes["metadata"]
|
|
189
|
+
unless NAME_TO_TYPE.key?(attributes["type"])
|
|
190
|
+
fail(ArgumentError, "Invalid type `#{attributes["type"]}` expected on of #{NAME_TO_TYPE.keys}")
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
attrs["config"] = NAME_TO_TYPE[attributes["type"]].deserialize(attributes["config"] || {})
|
|
194
|
+
new(attrs)
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
def serialize
|
|
198
|
+
out = Hash.new
|
|
199
|
+
out["id"] = Svix::serialize_primitive(@id) unless @id.nil?
|
|
200
|
+
out["uid"] = Svix::serialize_primitive(@uid) unless @uid.nil?
|
|
201
|
+
out["status"] = Svix::serialize_schema_ref(@status) unless @status.nil?
|
|
202
|
+
out["currentIterator"] = Svix::serialize_primitive(@current_iterator) unless @current_iterator.nil?
|
|
203
|
+
out["failureReason"] = Svix::serialize_primitive(@failure_reason) unless @failure_reason.nil?
|
|
204
|
+
out["createdAt"] = Svix::serialize_primitive(@created_at) unless @created_at.nil?
|
|
205
|
+
out["updatedAt"] = Svix::serialize_primitive(@updated_at) unless @updated_at.nil?
|
|
206
|
+
out["batchSize"] = Svix::serialize_primitive(@batch_size) unless @batch_size.nil?
|
|
207
|
+
out["maxWaitSecs"] = Svix::serialize_primitive(@max_wait_secs) unless @max_wait_secs.nil?
|
|
208
|
+
out["eventTypes"] = Svix::serialize_primitive(@event_types) unless @event_types.nil?
|
|
209
|
+
out["channels"] = Svix::serialize_primitive(@channels) unless @channels.nil?
|
|
210
|
+
out["nextRetryAt"] = Svix::serialize_primitive(@next_retry_at) unless @next_retry_at.nil?
|
|
211
|
+
out["metadata"] = Svix::serialize_primitive(@metadata) unless @metadata.nil?
|
|
212
|
+
out["type"] = @__enum_discriminator
|
|
213
|
+
out["config"] = @config.serialize
|
|
214
|
+
out
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
# Serializes the object to a json string
|
|
218
|
+
# @return String
|
|
219
|
+
def to_json(*args)
|
|
220
|
+
serialize.to_json(*args)
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
end
|
|
224
|
+
end
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file is @generated
|
|
3
|
+
require "json"
|
|
4
|
+
|
|
5
|
+
require_relative "./azure_blob_storage_config_patch"
|
|
6
|
+
require_relative "./big_query_config_patch"
|
|
7
|
+
require_relative "./clickhouse_config_patch"
|
|
8
|
+
require_relative "./destination_status_in"
|
|
9
|
+
require_relative "./event_bridge_config_patch"
|
|
10
|
+
require_relative "./google_cloud_pub_sub_config_patch"
|
|
11
|
+
require_relative "./google_cloud_storage_config_patch"
|
|
12
|
+
require_relative "./otel_tracing_config_patch"
|
|
13
|
+
require_relative "./postgres_config_patch"
|
|
14
|
+
require_relative "./rabbit_mq_config_patch"
|
|
15
|
+
require_relative "./redshift_config_patch"
|
|
16
|
+
require_relative "./s3_config_patch"
|
|
17
|
+
require_relative "./sink_http_config_patch"
|
|
18
|
+
require_relative "./snowflake_config_patch"
|
|
19
|
+
require_relative "./sns_config_patch"
|
|
20
|
+
require_relative "./sqs_config_patch"
|
|
21
|
+
|
|
22
|
+
module Svix
|
|
23
|
+
class DestinationPatchConfig
|
|
24
|
+
class PollingEndpoint
|
|
25
|
+
|
|
26
|
+
def serialize
|
|
27
|
+
Hash.new
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def self.deserialize(attributes = {})
|
|
31
|
+
new
|
|
32
|
+
end
|
|
33
|
+
# Serializes the object to a json string
|
|
34
|
+
# @return String
|
|
35
|
+
def to_json(*args)
|
|
36
|
+
serialize.to_json(*args)
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
class AzureBlobStorage < AzureBlobStorageConfigPatch
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
class OtelTracing < OtelTracingConfigPatch
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
class FifoEndpoint < SinkHttpConfigPatch
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
class AmazonS3 < S3ConfigPatch
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
class GoogleCloudStorage < GoogleCloudStorageConfigPatch
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
class GoogleCloudPubSub < GoogleCloudPubSubConfigPatch
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
class Sqs < SqsConfigPatch
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
class Sns < SnsConfigPatch
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
class BigQuery < BigQueryConfigPatch
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
class Clickhouse < ClickhouseConfigPatch
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
class EventBridge < EventBridgeConfigPatch
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
class Snowflake < SnowflakeConfigPatch
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
class RabbitMq < RabbitMqConfigPatch
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
class Redshift < RedshiftConfigPatch
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
class Postgres < PostgresConfigPatch
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
class DestinationPatch
|
|
87
|
+
# The Destination's UID.
|
|
88
|
+
attr_accessor :uid
|
|
89
|
+
attr_accessor :status
|
|
90
|
+
attr_accessor :batch_size
|
|
91
|
+
attr_accessor :max_wait_secs
|
|
92
|
+
attr_accessor :event_types
|
|
93
|
+
attr_accessor :channels
|
|
94
|
+
attr_accessor :metadata
|
|
95
|
+
attr_accessor :config
|
|
96
|
+
|
|
97
|
+
ALL_FIELD ||= ["uid", "status", "batch_size", "max_wait_secs", "event_types", "channels", "metadata", "config"].freeze
|
|
98
|
+
private_constant :ALL_FIELD
|
|
99
|
+
TYPE_TO_NAME = {
|
|
100
|
+
DestinationPatchConfig::PollingEndpoint => "pollingEndpoint",
|
|
101
|
+
DestinationPatchConfig::AzureBlobStorage => "azureBlobStorage",
|
|
102
|
+
DestinationPatchConfig::OtelTracing => "otelTracing",
|
|
103
|
+
DestinationPatchConfig::FifoEndpoint => "fifoEndpoint",
|
|
104
|
+
DestinationPatchConfig::AmazonS3 => "amazonS3",
|
|
105
|
+
DestinationPatchConfig::GoogleCloudStorage => "googleCloudStorage",
|
|
106
|
+
DestinationPatchConfig::GoogleCloudPubSub => "googleCloudPubSub",
|
|
107
|
+
DestinationPatchConfig::Sqs => "sqs",
|
|
108
|
+
DestinationPatchConfig::Sns => "sns",
|
|
109
|
+
DestinationPatchConfig::BigQuery => "bigQuery",
|
|
110
|
+
DestinationPatchConfig::Clickhouse => "clickhouse",
|
|
111
|
+
DestinationPatchConfig::EventBridge => "eventBridge",
|
|
112
|
+
DestinationPatchConfig::Snowflake => "snowflake",
|
|
113
|
+
DestinationPatchConfig::RabbitMq => "rabbitMq",
|
|
114
|
+
DestinationPatchConfig::Redshift => "redshift",
|
|
115
|
+
DestinationPatchConfig::Postgres => "postgres"
|
|
116
|
+
}
|
|
117
|
+
private_constant :TYPE_TO_NAME
|
|
118
|
+
NAME_TO_TYPE = TYPE_TO_NAME.invert
|
|
119
|
+
private_constant :NAME_TO_TYPE
|
|
120
|
+
|
|
121
|
+
def initialize(attributes = {})
|
|
122
|
+
unless attributes.is_a?(Hash)
|
|
123
|
+
fail(
|
|
124
|
+
ArgumentError,
|
|
125
|
+
"The input argument (attributes) must be a hash in `Svix::DestinationPatch` new method"
|
|
126
|
+
)
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
attributes.each do |k, v|
|
|
130
|
+
unless ALL_FIELD.include?(k.to_s)
|
|
131
|
+
fail(ArgumentError, "The field #{k} is not part of Svix::DestinationPatch")
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
if k.to_s == "config"
|
|
135
|
+
unless TYPE_TO_NAME.key?(v.class)
|
|
136
|
+
fail(ArgumentError, "The field #{k} can't be a `#{v.class}` expected one of #{TYPE_TO_NAME.keys}")
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
instance_variable_set("@__enum_discriminator", TYPE_TO_NAME[v.class])
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
instance_variable_set("@#{k}", v)
|
|
143
|
+
instance_variable_set("@__#{k}_is_defined", true)
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
if @__enum_discriminator.nil?
|
|
147
|
+
fail(ArgumentError, "Required config field was not set")
|
|
148
|
+
end
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
def self.deserialize(attributes = {})
|
|
152
|
+
attributes = attributes.transform_keys(&:to_s)
|
|
153
|
+
attrs = Hash.new
|
|
154
|
+
attrs["uid"] = attributes["uid"]
|
|
155
|
+
attrs["status"] = Svix::DestinationStatusIn.deserialize(attributes["status"]) if attributes["status"]
|
|
156
|
+
attrs["batch_size"] = attributes["batchSize"]
|
|
157
|
+
attrs["max_wait_secs"] = attributes["maxWaitSecs"]
|
|
158
|
+
attrs["event_types"] = attributes["eventTypes"]
|
|
159
|
+
attrs["channels"] = attributes["channels"]
|
|
160
|
+
attrs["metadata"] = attributes["metadata"]
|
|
161
|
+
unless NAME_TO_TYPE.key?(attributes["type"])
|
|
162
|
+
fail(ArgumentError, "Invalid type `#{attributes["type"]}` expected on of #{NAME_TO_TYPE.keys}")
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
attrs["config"] = NAME_TO_TYPE[attributes["type"]].deserialize(attributes["config"] || {})
|
|
166
|
+
new(attrs)
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
def serialize
|
|
170
|
+
out = Hash.new
|
|
171
|
+
out["uid"] = Svix::serialize_primitive(@uid) if @__uid_is_defined
|
|
172
|
+
out["status"] = Svix::serialize_schema_ref(@status) if @__status_is_defined
|
|
173
|
+
out["batchSize"] = Svix::serialize_primitive(@batch_size) if @__batch_size_is_defined
|
|
174
|
+
out["maxWaitSecs"] = Svix::serialize_primitive(@max_wait_secs) if @__max_wait_secs_is_defined
|
|
175
|
+
out["eventTypes"] = Svix::serialize_primitive(@event_types) unless @event_types.nil?
|
|
176
|
+
out["channels"] = Svix::serialize_primitive(@channels) unless @channels.nil?
|
|
177
|
+
out["metadata"] = Svix::serialize_primitive(@metadata) unless @metadata.nil?
|
|
178
|
+
out["type"] = @__enum_discriminator
|
|
179
|
+
out["config"] = @config.serialize
|
|
180
|
+
out
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
# Serializes the object to a json string
|
|
184
|
+
# @return String
|
|
185
|
+
def to_json(*args)
|
|
186
|
+
serialize.to_json(*args)
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
end
|
|
190
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file is @generated
|
|
3
|
+
module Svix
|
|
4
|
+
class DestinationStatus
|
|
5
|
+
ENABLED = "enabled".freeze
|
|
6
|
+
PAUSED = "paused".freeze
|
|
7
|
+
DISABLED = "disabled".freeze
|
|
8
|
+
RETRYING = "retrying".freeze
|
|
9
|
+
|
|
10
|
+
def self.all_vars
|
|
11
|
+
@all_vars ||= [ENABLED, PAUSED, DISABLED, RETRYING].freeze
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def initialize(value)
|
|
15
|
+
unless DestinationStatus.all_vars.include?(value)
|
|
16
|
+
raise "Invalid ENUM value '#{value}' for class #DestinationStatus"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
@value = value
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def self.deserialize(value)
|
|
23
|
+
return value if DestinationStatus.all_vars.include?(value)
|
|
24
|
+
raise "Invalid ENUM value '#{value}' for class #DestinationStatus"
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def serialize
|
|
28
|
+
@value
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file is @generated
|
|
3
|
+
module Svix
|
|
4
|
+
class DestinationStatusIn
|
|
5
|
+
ENABLED = "enabled".freeze
|
|
6
|
+
DISABLED = "disabled".freeze
|
|
7
|
+
|
|
8
|
+
def self.all_vars
|
|
9
|
+
@all_vars ||= [ENABLED, DISABLED].freeze
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def initialize(value)
|
|
13
|
+
unless DestinationStatusIn.all_vars.include?(value)
|
|
14
|
+
raise "Invalid ENUM value '#{value}' for class #DestinationStatusIn"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
@value = value
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def self.deserialize(value)
|
|
21
|
+
return value if DestinationStatusIn.all_vars.include?(value)
|
|
22
|
+
raise "Invalid ENUM value '#{value}' for class #DestinationStatusIn"
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def serialize
|
|
26
|
+
@value
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|