svix 1.76.0 → 1.77.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.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/lib/svix/api/authentication.rb +34 -0
  4. data/lib/svix/api/streaming.rb +46 -0
  5. data/lib/svix/api/streaming_event_type.rb +78 -0
  6. data/lib/svix/api/streaming_events.rb +40 -0
  7. data/lib/svix/api/streaming_sink.rb +103 -0
  8. data/lib/svix/api/streaming_stream.rb +73 -0
  9. data/lib/svix/models/amazon_s3_patch_config.rb +55 -0
  10. data/lib/svix/models/api_token_out.rb +62 -0
  11. data/lib/svix/models/azure_blob_storage_config.rb +55 -0
  12. data/lib/svix/models/azure_blob_storage_patch_config.rb +55 -0
  13. data/lib/svix/models/connector_in.rb +0 -9
  14. data/lib/svix/models/connector_kind.rb +2 -0
  15. data/lib/svix/models/connector_out.rb +0 -8
  16. data/lib/svix/models/create_stream_events_in.rb +52 -0
  17. data/lib/svix/models/create_stream_events_out.rb +46 -0
  18. data/lib/svix/models/empty_response.rb +43 -0
  19. data/lib/svix/models/endpoint_message_out.rb +4 -0
  20. data/lib/svix/models/event_in.rb +50 -0
  21. data/lib/svix/models/event_out.rb +53 -0
  22. data/lib/svix/models/event_stream_out.rb +52 -0
  23. data/lib/svix/models/google_cloud_storage_config.rb +56 -0
  24. data/lib/svix/models/google_cloud_storage_patch_config.rb +52 -0
  25. data/lib/svix/models/http_patch_config.rb +46 -0
  26. data/lib/svix/models/http_sink_headers_patch_in.rb +49 -0
  27. data/lib/svix/models/ingest_endpoint_disabled_event.rb +53 -0
  28. data/lib/svix/models/ingest_endpoint_disabled_event_data.rb +65 -0
  29. data/lib/svix/models/ingest_message_attempt_exhausted_event.rb +53 -0
  30. data/lib/svix/models/ingest_message_attempt_exhausted_event_data.rb +66 -0
  31. data/lib/svix/models/ingest_message_attempt_failing_event.rb +54 -0
  32. data/lib/svix/models/ingest_message_attempt_failing_event_data.rb +66 -0
  33. data/lib/svix/models/ingest_message_attempt_recovered_event.rb +53 -0
  34. data/lib/svix/models/ingest_message_attempt_recovered_event_data.rb +66 -0
  35. data/lib/svix/models/list_response_stream_event_type_out.rb +58 -0
  36. data/lib/svix/models/list_response_stream_out.rb +58 -0
  37. data/lib/svix/models/list_response_stream_sink_out.rb +58 -0
  38. data/lib/svix/models/message_in.rb +7 -0
  39. data/lib/svix/models/message_out.rb +4 -1
  40. data/lib/svix/models/otel_tracing_patch_config.rb +49 -0
  41. data/lib/svix/models/polling_endpoint_message_out.rb +4 -1
  42. data/lib/svix/models/rotate_poller_token_in.rb +55 -0
  43. data/lib/svix/models/s3_config.rb +55 -0
  44. data/lib/svix/models/sink_http_config.rb +52 -0
  45. data/lib/svix/models/sink_otel_v1_config.rb +49 -0
  46. data/lib/svix/models/sink_secret_out.rb +50 -0
  47. data/lib/svix/models/sink_status.rb +31 -0
  48. data/lib/svix/models/sink_status_in.rb +29 -0
  49. data/lib/svix/models/sink_transform_in.rb +46 -0
  50. data/lib/svix/models/sink_transformation_out.rb +52 -0
  51. data/lib/svix/models/stream_event_type_in.rb +59 -0
  52. data/lib/svix/models/stream_event_type_out.rb +65 -0
  53. data/lib/svix/models/stream_event_type_patch.rb +59 -0
  54. data/lib/svix/models/stream_in.rb +54 -0
  55. data/lib/svix/models/stream_out.rb +64 -0
  56. data/lib/svix/models/stream_patch.rb +54 -0
  57. data/lib/svix/models/stream_portal_access_in.rb +59 -0
  58. data/lib/svix/models/stream_sink_in.rb +153 -0
  59. data/lib/svix/models/stream_sink_out.rb +174 -0
  60. data/lib/svix/models/stream_sink_patch.rb +141 -0
  61. data/lib/svix/version.rb +1 -1
  62. data/lib/svix.rb +50 -0
  63. metadata +52 -2
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module Svix
6
+ class StreamIn
7
+ attr_accessor :metadata
8
+ # The stream's name.
9
+ attr_accessor :name
10
+ # An optional unique identifier for the stream.
11
+ attr_accessor :uid
12
+
13
+ ALL_FIELD ||= ["metadata", "name", "uid"].freeze
14
+ private_constant :ALL_FIELD
15
+
16
+ def initialize(attributes = {})
17
+ unless attributes.is_a?(Hash)
18
+ fail(ArgumentError, "The input argument (attributes) must be a hash in `Svix::StreamIn` new method")
19
+ end
20
+
21
+ attributes.each do |k, v|
22
+ unless ALL_FIELD.include?(k.to_s)
23
+ fail(ArgumentError, "The field #{k} is not part of Svix::StreamIn")
24
+ end
25
+
26
+ instance_variable_set("@#{k}", v)
27
+ instance_variable_set("@__#{k}_is_defined", true)
28
+ end
29
+ end
30
+
31
+ def self.deserialize(attributes = {})
32
+ attributes = attributes.transform_keys(&:to_s)
33
+ attrs = Hash.new
34
+ attrs["metadata"] = attributes["metadata"]
35
+ attrs["name"] = attributes["name"]
36
+ attrs["uid"] = attributes["uid"]
37
+ new(attrs)
38
+ end
39
+
40
+ def serialize
41
+ out = Hash.new
42
+ out["metadata"] = Svix::serialize_primitive(@metadata) if @metadata
43
+ out["name"] = Svix::serialize_primitive(@name) if @name
44
+ out["uid"] = Svix::serialize_primitive(@uid) if @uid
45
+ out
46
+ end
47
+
48
+ # Serializes the object to a json string
49
+ # @return String
50
+ def to_json
51
+ JSON.dump(serialize)
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module Svix
6
+ class StreamOut
7
+ attr_accessor :created_at
8
+ # The stream's ID.
9
+ attr_accessor :id
10
+ attr_accessor :metadata
11
+ # The stream's name.
12
+ attr_accessor :name
13
+ # The stream's UID.
14
+ attr_accessor :uid
15
+ attr_accessor :updated_at
16
+
17
+ ALL_FIELD ||= ["created_at", "id", "metadata", "name", "uid", "updated_at"].freeze
18
+ private_constant :ALL_FIELD
19
+
20
+ def initialize(attributes = {})
21
+ unless attributes.is_a?(Hash)
22
+ fail(ArgumentError, "The input argument (attributes) must be a hash in `Svix::StreamOut` new method")
23
+ end
24
+
25
+ attributes.each do |k, v|
26
+ unless ALL_FIELD.include?(k.to_s)
27
+ fail(ArgumentError, "The field #{k} is not part of Svix::StreamOut")
28
+ end
29
+
30
+ instance_variable_set("@#{k}", v)
31
+ instance_variable_set("@__#{k}_is_defined", true)
32
+ end
33
+ end
34
+
35
+ def self.deserialize(attributes = {})
36
+ attributes = attributes.transform_keys(&:to_s)
37
+ attrs = Hash.new
38
+ attrs["created_at"] = DateTime.rfc3339(attributes["createdAt"]).to_time
39
+ attrs["id"] = attributes["id"]
40
+ attrs["metadata"] = attributes["metadata"]
41
+ attrs["name"] = attributes["name"]
42
+ attrs["uid"] = attributes["uid"]
43
+ attrs["updated_at"] = DateTime.rfc3339(attributes["updatedAt"]).to_time
44
+ new(attrs)
45
+ end
46
+
47
+ def serialize
48
+ out = Hash.new
49
+ out["createdAt"] = Svix::serialize_primitive(@created_at) if @created_at
50
+ out["id"] = Svix::serialize_primitive(@id) if @id
51
+ out["metadata"] = Svix::serialize_primitive(@metadata) if @metadata
52
+ out["name"] = Svix::serialize_primitive(@name) if @name
53
+ out["uid"] = Svix::serialize_primitive(@uid) if @uid
54
+ out["updatedAt"] = Svix::serialize_primitive(@updated_at) if @updated_at
55
+ out
56
+ end
57
+
58
+ # Serializes the object to a json string
59
+ # @return String
60
+ def to_json
61
+ JSON.dump(serialize)
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module Svix
6
+ class StreamPatch
7
+ # The Stream's description.
8
+ attr_accessor :description
9
+ attr_accessor :metadata
10
+ # An optional unique identifier for the stream.
11
+ attr_accessor :uid
12
+
13
+ ALL_FIELD ||= ["description", "metadata", "uid"].freeze
14
+ private_constant :ALL_FIELD
15
+
16
+ def initialize(attributes = {})
17
+ unless attributes.is_a?(Hash)
18
+ fail(ArgumentError, "The input argument (attributes) must be a hash in `Svix::StreamPatch` new method")
19
+ end
20
+
21
+ attributes.each do |k, v|
22
+ unless ALL_FIELD.include?(k.to_s)
23
+ fail(ArgumentError, "The field #{k} is not part of Svix::StreamPatch")
24
+ end
25
+
26
+ instance_variable_set("@#{k}", v)
27
+ instance_variable_set("@__#{k}_is_defined", true)
28
+ end
29
+ end
30
+
31
+ def self.deserialize(attributes = {})
32
+ attributes = attributes.transform_keys(&:to_s)
33
+ attrs = Hash.new
34
+ attrs["description"] = attributes["description"]
35
+ attrs["metadata"] = attributes["metadata"]
36
+ attrs["uid"] = attributes["uid"]
37
+ new(attrs)
38
+ end
39
+
40
+ def serialize
41
+ out = Hash.new
42
+ out["description"] = Svix::serialize_primitive(@description) if @description
43
+ out["metadata"] = Svix::serialize_primitive(@metadata) if @metadata
44
+ out["uid"] = Svix::serialize_primitive(@uid) if @__uid_is_defined
45
+ out
46
+ end
47
+
48
+ # Serializes the object to a json string
49
+ # @return String
50
+ def to_json
51
+ JSON.dump(serialize)
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module Svix
6
+ class StreamPortalAccessIn
7
+ # How long the token will be valid for, in seconds.
8
+ #
9
+ # Valid values are between 1 hour and 7 days. The default is 7 days.
10
+ attr_accessor :expiry
11
+ # The set of feature flags the created token will have access to.
12
+ attr_accessor :feature_flags
13
+ # An optional session ID to attach to the token.
14
+ #
15
+ # When expiring tokens with "Expire All", you can include the session ID to only expire tokens that were created with that session ID.
16
+ attr_accessor :session_id
17
+
18
+ ALL_FIELD ||= ["expiry", "feature_flags", "session_id"].freeze
19
+ private_constant :ALL_FIELD
20
+
21
+ def initialize(attributes = {})
22
+ unless attributes.is_a?(Hash)
23
+ fail(ArgumentError, "The input argument (attributes) must be a hash in `Svix::StreamPortalAccessIn` new method")
24
+ end
25
+
26
+ attributes.each do |k, v|
27
+ unless ALL_FIELD.include?(k.to_s)
28
+ fail(ArgumentError, "The field #{k} is not part of Svix::StreamPortalAccessIn")
29
+ end
30
+
31
+ instance_variable_set("@#{k}", v)
32
+ instance_variable_set("@__#{k}_is_defined", true)
33
+ end
34
+ end
35
+
36
+ def self.deserialize(attributes = {})
37
+ attributes = attributes.transform_keys(&:to_s)
38
+ attrs = Hash.new
39
+ attrs["expiry"] = attributes["expiry"]
40
+ attrs["feature_flags"] = attributes["featureFlags"]
41
+ attrs["session_id"] = attributes["sessionId"]
42
+ new(attrs)
43
+ end
44
+
45
+ def serialize
46
+ out = Hash.new
47
+ out["expiry"] = Svix::serialize_primitive(@expiry) if @expiry
48
+ out["featureFlags"] = Svix::serialize_primitive(@feature_flags) if @feature_flags
49
+ out["sessionId"] = Svix::serialize_primitive(@session_id) if @session_id
50
+ out
51
+ end
52
+
53
+ # Serializes the object to a json string
54
+ # @return String
55
+ def to_json
56
+ JSON.dump(serialize)
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,153 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ require_relative "./azure_blob_storage_config"
6
+ require_relative "./google_cloud_storage_config"
7
+ require_relative "./s3_config"
8
+ require_relative "./sink_http_config"
9
+ require_relative "./sink_otel_v1_config"
10
+ require_relative "./sink_status_in"
11
+
12
+ module Svix
13
+ class StreamSinkInConfig
14
+ class Poller
15
+
16
+ def serialize
17
+ Hash.new
18
+ end
19
+
20
+ def self.deserialize(attributes = {})
21
+ new
22
+ end
23
+ # Serializes the object to a json string
24
+ # @return String
25
+ def to_json
26
+ JSON.dump(serialize)
27
+ end
28
+ end
29
+
30
+ class AzureBlobStorage < AzureBlobStorageConfig
31
+ end
32
+
33
+ class OtelTracing < SinkOtelV1Config
34
+ end
35
+
36
+ class Http < SinkHttpConfig
37
+ end
38
+
39
+ class AmazonS3 < S3Config
40
+ end
41
+
42
+ class GoogleCloudStorage < GoogleCloudStorageConfig
43
+ end
44
+ end
45
+
46
+ class StreamSinkIn
47
+ # How many events will be batched in a request to the Sink.
48
+ attr_accessor :batch_size
49
+ # A list of event types that filter which events are dispatched to the Sink. An empty list (or null) will not filter out any events.
50
+ attr_accessor :event_types
51
+ # How long to wait before a batch of events is sent, if the `batchSize` is not reached.
52
+ #
53
+ # For example, with a `batchSize` of 100 and `maxWaitSecs` of 10, we will send a request after 10 seconds or 100 events, whichever comes first.
54
+ #
55
+ # Note that we will never send an empty batch of events to the Sink.
56
+ attr_accessor :max_wait_secs
57
+ attr_accessor :metadata
58
+ # Whether the sink will receive events.
59
+ #
60
+ # If the sink is `enabled`, any events posted to the stream will be dispatched to the Sink in the same order that events were posted to the stream.
61
+ #
62
+ # If the sink is `disabled`, events will not be dispatched to the sink until the sink is reenabled.
63
+ attr_accessor :status
64
+ # An optional unique identifier for the sink.
65
+ attr_accessor :uid
66
+ attr_accessor :config
67
+
68
+ ALL_FIELD ||= ["batch_size", "event_types", "max_wait_secs", "metadata", "status", "uid", "config"].freeze
69
+ private_constant :ALL_FIELD
70
+ TYPE_TO_NAME = {
71
+ StreamSinkInConfig::Poller => "poller",
72
+ StreamSinkInConfig::AzureBlobStorage => "azureBlobStorage",
73
+ StreamSinkInConfig::OtelTracing => "otelTracing",
74
+ StreamSinkInConfig::Http => "http",
75
+ StreamSinkInConfig::AmazonS3 => "amazonS3",
76
+ StreamSinkInConfig::GoogleCloudStorage => "googleCloudStorage"
77
+ }
78
+ private_constant :TYPE_TO_NAME
79
+ NAME_TO_TYPE = TYPE_TO_NAME.invert
80
+ private_constant :NAME_TO_TYPE
81
+
82
+ def initialize(attributes = {})
83
+ unless attributes.is_a?(Hash)
84
+ fail(
85
+ ArgumentError,
86
+ "The input argument (attributes) must be a hash in `Svix::StreamSinkIn` new method"
87
+ )
88
+ end
89
+
90
+ attributes.each do |k, v|
91
+ unless ALL_FIELD.include?(k.to_s)
92
+ fail(ArgumentError, "The field #{k} is not part of Svix::StreamSinkIn")
93
+ end
94
+
95
+ if k == "config"
96
+ unless TYPE_TO_NAME.key?(v.class)
97
+ fail(ArgumentError, "The field #{k} can't be a `#{v.class}` expected one of #{TYPE_TO_NAME.keys}")
98
+ end
99
+
100
+ instance_variable_set("@__enum_discriminator", TYPE_TO_NAME[v.class])
101
+ end
102
+
103
+ instance_variable_set("@#{k}", v)
104
+ instance_variable_set("@__#{k}_is_defined", true)
105
+ end
106
+
107
+ if @__enum_discriminator.nil?
108
+ fail(ArgumentError, "Required config field was not set")
109
+ end
110
+ end
111
+
112
+ def self.deserialize(attributes = {})
113
+ attributes = attributes.transform_keys(&:to_s)
114
+ attrs = Hash.new
115
+ attrs["batch_size"] = attributes["batchSize"]
116
+ attrs["event_types"] = attributes["eventTypes"]
117
+ attrs["max_wait_secs"] = attributes["maxWaitSecs"]
118
+ attrs["metadata"] = attributes["metadata"]
119
+ attrs["status"] = Svix::SinkStatusIn.deserialize(attributes["status"]) if attributes["status"]
120
+ attrs["uid"] = attributes["uid"]
121
+ unless NAME_TO_TYPE.key?(attributes["type"])
122
+ fail(ArgumentError, "Invalid type `#{attributes["type"]}` expected on of #{NAME_TO_TYPE.keys}")
123
+ end
124
+
125
+ unless attributes.key?("config")
126
+ fail(ArgumentError, "Missing required field config")
127
+ end
128
+
129
+ attrs["config"] = NAME_TO_TYPE[attributes["type"]].deserialize(attributes["config"])
130
+ new(attrs)
131
+ end
132
+
133
+ def serialize
134
+ out = Hash.new
135
+ out["batchSize"] = Svix::serialize_primitive(@batch_size) if @batch_size
136
+ out["eventTypes"] = Svix::serialize_primitive(@event_types) if @event_types
137
+ out["maxWaitSecs"] = Svix::serialize_primitive(@max_wait_secs) if @max_wait_secs
138
+ out["metadata"] = Svix::serialize_primitive(@metadata) if @metadata
139
+ out["status"] = Svix::serialize_schema_ref(@status) if @status
140
+ out["uid"] = Svix::serialize_primitive(@uid) if @uid
141
+ out["type"] = @__enum_discriminator
142
+ out["config"] = @config.serialize
143
+ out
144
+ end
145
+
146
+ # Serializes the object to a json string
147
+ # @return String
148
+ def to_json
149
+ JSON.dump(serialize)
150
+ end
151
+
152
+ end
153
+ end
@@ -0,0 +1,174 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ require_relative "./azure_blob_storage_config"
6
+ require_relative "./google_cloud_storage_config"
7
+ require_relative "./s3_config"
8
+ require_relative "./sink_http_config"
9
+ require_relative "./sink_otel_v1_config"
10
+ require_relative "./sink_status"
11
+
12
+ module Svix
13
+ class StreamSinkOutConfig
14
+ class Poller
15
+
16
+ def serialize
17
+ Hash.new
18
+ end
19
+
20
+ def self.deserialize(attributes = {})
21
+ new
22
+ end
23
+ # Serializes the object to a json string
24
+ # @return String
25
+ def to_json
26
+ JSON.dump(serialize)
27
+ end
28
+ end
29
+
30
+ class AzureBlobStorage < AzureBlobStorageConfig
31
+ end
32
+
33
+ class OtelTracing < SinkOtelV1Config
34
+ end
35
+
36
+ class Http < SinkHttpConfig
37
+ end
38
+
39
+ class AmazonS3 < S3Config
40
+ end
41
+
42
+ class GoogleCloudStorage < GoogleCloudStorageConfig
43
+ end
44
+ end
45
+
46
+ class StreamSinkOut
47
+ attr_accessor :batch_size
48
+ attr_accessor :created_at
49
+ attr_accessor :current_iterator
50
+ attr_accessor :event_types
51
+ attr_accessor :failure_reason
52
+ # The sink's ID.
53
+ attr_accessor :id
54
+ attr_accessor :max_wait_secs
55
+ attr_accessor :metadata
56
+ attr_accessor :next_retry_at
57
+ attr_accessor :status
58
+ # The sink's UID.
59
+ attr_accessor :uid
60
+ attr_accessor :updated_at
61
+ attr_accessor :config
62
+
63
+ ALL_FIELD ||= [
64
+ "batch_size",
65
+ "created_at",
66
+ "current_iterator",
67
+ "event_types",
68
+ "failure_reason",
69
+ "id",
70
+ "max_wait_secs",
71
+ "metadata",
72
+ "next_retry_at",
73
+ "status",
74
+ "uid",
75
+ "updated_at",
76
+ "config"
77
+ ].freeze
78
+ private_constant :ALL_FIELD
79
+ TYPE_TO_NAME = {
80
+ StreamSinkOutConfig::Poller => "poller",
81
+ StreamSinkOutConfig::AzureBlobStorage => "azureBlobStorage",
82
+ StreamSinkOutConfig::OtelTracing => "otelTracing",
83
+ StreamSinkOutConfig::Http => "http",
84
+ StreamSinkOutConfig::AmazonS3 => "amazonS3",
85
+ StreamSinkOutConfig::GoogleCloudStorage => "googleCloudStorage"
86
+ }
87
+ private_constant :TYPE_TO_NAME
88
+ NAME_TO_TYPE = TYPE_TO_NAME.invert
89
+ private_constant :NAME_TO_TYPE
90
+
91
+ def initialize(attributes = {})
92
+ unless attributes.is_a?(Hash)
93
+ fail(
94
+ ArgumentError,
95
+ "The input argument (attributes) must be a hash in `Svix::StreamSinkOut` new method"
96
+ )
97
+ end
98
+
99
+ attributes.each do |k, v|
100
+ unless ALL_FIELD.include?(k.to_s)
101
+ fail(ArgumentError, "The field #{k} is not part of Svix::StreamSinkOut")
102
+ end
103
+
104
+ if k == "config"
105
+ unless TYPE_TO_NAME.key?(v.class)
106
+ fail(ArgumentError, "The field #{k} can't be a `#{v.class}` expected one of #{TYPE_TO_NAME.keys}")
107
+ end
108
+
109
+ instance_variable_set("@__enum_discriminator", TYPE_TO_NAME[v.class])
110
+ end
111
+
112
+ instance_variable_set("@#{k}", v)
113
+ instance_variable_set("@__#{k}_is_defined", true)
114
+ end
115
+
116
+ if @__enum_discriminator.nil?
117
+ fail(ArgumentError, "Required config field was not set")
118
+ end
119
+ end
120
+
121
+ def self.deserialize(attributes = {})
122
+ attributes = attributes.transform_keys(&:to_s)
123
+ attrs = Hash.new
124
+ attrs["batch_size"] = attributes["batchSize"]
125
+ attrs["created_at"] = DateTime.rfc3339(attributes["createdAt"]).to_time
126
+ attrs["current_iterator"] = attributes["currentIterator"]
127
+ attrs["event_types"] = attributes["eventTypes"]
128
+ attrs["failure_reason"] = attributes["failureReason"]
129
+ attrs["id"] = attributes["id"]
130
+ attrs["max_wait_secs"] = attributes["maxWaitSecs"]
131
+ attrs["metadata"] = attributes["metadata"]
132
+ attrs["next_retry_at"] = DateTime.rfc3339(attributes["nextRetryAt"]).to_time if attributes["nextRetryAt"]
133
+ attrs["status"] = Svix::SinkStatus.deserialize(attributes["status"])
134
+ attrs["uid"] = attributes["uid"]
135
+ attrs["updated_at"] = DateTime.rfc3339(attributes["updatedAt"]).to_time
136
+ unless NAME_TO_TYPE.key?(attributes["type"])
137
+ fail(ArgumentError, "Invalid type `#{attributes["type"]}` expected on of #{NAME_TO_TYPE.keys}")
138
+ end
139
+
140
+ unless attributes.key?("config")
141
+ fail(ArgumentError, "Missing required field config")
142
+ end
143
+
144
+ attrs["config"] = NAME_TO_TYPE[attributes["type"]].deserialize(attributes["config"])
145
+ new(attrs)
146
+ end
147
+
148
+ def serialize
149
+ out = Hash.new
150
+ out["batchSize"] = Svix::serialize_primitive(@batch_size) if @batch_size
151
+ out["createdAt"] = Svix::serialize_primitive(@created_at) if @created_at
152
+ out["currentIterator"] = Svix::serialize_primitive(@current_iterator) if @current_iterator
153
+ out["eventTypes"] = Svix::serialize_primitive(@event_types) if @event_types
154
+ out["failureReason"] = Svix::serialize_primitive(@failure_reason) if @failure_reason
155
+ out["id"] = Svix::serialize_primitive(@id) if @id
156
+ out["maxWaitSecs"] = Svix::serialize_primitive(@max_wait_secs) if @max_wait_secs
157
+ out["metadata"] = Svix::serialize_primitive(@metadata) if @metadata
158
+ out["nextRetryAt"] = Svix::serialize_primitive(@next_retry_at) if @next_retry_at
159
+ out["status"] = Svix::serialize_schema_ref(@status) if @status
160
+ out["uid"] = Svix::serialize_primitive(@uid) if @uid
161
+ out["updatedAt"] = Svix::serialize_primitive(@updated_at) if @updated_at
162
+ out["type"] = @__enum_discriminator
163
+ out["config"] = @config.serialize
164
+ out
165
+ end
166
+
167
+ # Serializes the object to a json string
168
+ # @return String
169
+ def to_json
170
+ JSON.dump(serialize)
171
+ end
172
+
173
+ end
174
+ end
@@ -0,0 +1,141 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ require_relative "./amazon_s3_patch_config"
6
+ require_relative "./azure_blob_storage_patch_config"
7
+ require_relative "./google_cloud_storage_patch_config"
8
+ require_relative "./http_patch_config"
9
+ require_relative "./otel_tracing_patch_config"
10
+ require_relative "./sink_status_in"
11
+
12
+ module Svix
13
+ class StreamSinkPatchConfig
14
+ class Poller
15
+
16
+ def serialize
17
+ Hash.new
18
+ end
19
+
20
+ def self.deserialize(attributes = {})
21
+ new
22
+ end
23
+ # Serializes the object to a json string
24
+ # @return String
25
+ def to_json
26
+ JSON.dump(serialize)
27
+ end
28
+ end
29
+
30
+ class AzureBlobStorage < AzureBlobStoragePatchConfig
31
+ end
32
+
33
+ class OtelTracing < OtelTracingPatchConfig
34
+ end
35
+
36
+ class Http < HttpPatchConfig
37
+ end
38
+
39
+ class AmazonS3 < AmazonS3PatchConfig
40
+ end
41
+
42
+ class GoogleCloudStorage < GoogleCloudStoragePatchConfig
43
+ end
44
+ end
45
+
46
+ class StreamSinkPatch
47
+ attr_accessor :batch_size
48
+ attr_accessor :event_types
49
+ attr_accessor :max_wait_secs
50
+ attr_accessor :metadata
51
+ attr_accessor :status
52
+ # The StreamSink's UID.
53
+ attr_accessor :uid
54
+ attr_accessor :config
55
+
56
+ ALL_FIELD ||= ["batch_size", "event_types", "max_wait_secs", "metadata", "status", "uid", "config"].freeze
57
+ private_constant :ALL_FIELD
58
+ TYPE_TO_NAME = {
59
+ StreamSinkPatchConfig::Poller => "poller",
60
+ StreamSinkPatchConfig::AzureBlobStorage => "azureBlobStorage",
61
+ StreamSinkPatchConfig::OtelTracing => "otelTracing",
62
+ StreamSinkPatchConfig::Http => "http",
63
+ StreamSinkPatchConfig::AmazonS3 => "amazonS3",
64
+ StreamSinkPatchConfig::GoogleCloudStorage => "googleCloudStorage"
65
+ }
66
+ private_constant :TYPE_TO_NAME
67
+ NAME_TO_TYPE = TYPE_TO_NAME.invert
68
+ private_constant :NAME_TO_TYPE
69
+
70
+ def initialize(attributes = {})
71
+ unless attributes.is_a?(Hash)
72
+ fail(
73
+ ArgumentError,
74
+ "The input argument (attributes) must be a hash in `Svix::StreamSinkPatch` new method"
75
+ )
76
+ end
77
+
78
+ attributes.each do |k, v|
79
+ unless ALL_FIELD.include?(k.to_s)
80
+ fail(ArgumentError, "The field #{k} is not part of Svix::StreamSinkPatch")
81
+ end
82
+
83
+ if k == "config"
84
+ unless TYPE_TO_NAME.key?(v.class)
85
+ fail(ArgumentError, "The field #{k} can't be a `#{v.class}` expected one of #{TYPE_TO_NAME.keys}")
86
+ end
87
+
88
+ instance_variable_set("@__enum_discriminator", TYPE_TO_NAME[v.class])
89
+ end
90
+
91
+ instance_variable_set("@#{k}", v)
92
+ instance_variable_set("@__#{k}_is_defined", true)
93
+ end
94
+
95
+ if @__enum_discriminator.nil?
96
+ fail(ArgumentError, "Required config field was not set")
97
+ end
98
+ end
99
+
100
+ def self.deserialize(attributes = {})
101
+ attributes = attributes.transform_keys(&:to_s)
102
+ attrs = Hash.new
103
+ attrs["batch_size"] = attributes["batchSize"]
104
+ attrs["event_types"] = attributes["eventTypes"]
105
+ attrs["max_wait_secs"] = attributes["maxWaitSecs"]
106
+ attrs["metadata"] = attributes["metadata"]
107
+ attrs["status"] = Svix::SinkStatusIn.deserialize(attributes["status"]) if attributes["status"]
108
+ attrs["uid"] = attributes["uid"]
109
+ unless NAME_TO_TYPE.key?(attributes["type"])
110
+ fail(ArgumentError, "Invalid type `#{attributes["type"]}` expected on of #{NAME_TO_TYPE.keys}")
111
+ end
112
+
113
+ unless attributes.key?("config")
114
+ fail(ArgumentError, "Missing required field config")
115
+ end
116
+
117
+ attrs["config"] = NAME_TO_TYPE[attributes["type"]].deserialize(attributes["config"])
118
+ new(attrs)
119
+ end
120
+
121
+ def serialize
122
+ out = Hash.new
123
+ out["batchSize"] = Svix::serialize_primitive(@batch_size) if @__batch_size_is_defined
124
+ out["eventTypes"] = Svix::serialize_primitive(@event_types) if @event_types
125
+ out["maxWaitSecs"] = Svix::serialize_primitive(@max_wait_secs) if @__max_wait_secs_is_defined
126
+ out["metadata"] = Svix::serialize_primitive(@metadata) if @metadata
127
+ out["status"] = Svix::serialize_schema_ref(@status) if @__status_is_defined
128
+ out["uid"] = Svix::serialize_primitive(@uid) if @__uid_is_defined
129
+ out["type"] = @__enum_discriminator
130
+ out["config"] = @config.serialize
131
+ out
132
+ end
133
+
134
+ # Serializes the object to a json string
135
+ # @return String
136
+ def to_json
137
+ JSON.dump(serialize)
138
+ end
139
+
140
+ end
141
+ end