turnkey_client 0.0.17 → 0.0.19

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 (166) hide show
  1. checksums.yaml +4 -4
  2. data/lib/turnkey_client/api/broadcasting_api.rb +12 -12
  3. data/lib/turnkey_client/api/default_api.rb +46 -0
  4. data/lib/turnkey_client/api/ip_allowlist_api.rb +193 -0
  5. data/lib/turnkey_client/api/organizations_api.rb +290 -0
  6. data/lib/turnkey_client/api/signing_api.rb +232 -0
  7. data/lib/turnkey_client/api/tvc_api.rb +773 -0
  8. data/lib/turnkey_client/api/wallets_api.rb +116 -0
  9. data/lib/turnkey_client/configuration.rb +7 -0
  10. data/lib/turnkey_client/models/activate_billing_tier_intent.rb +14 -4
  11. data/lib/turnkey_client/models/activity_type.rb +21 -0
  12. data/lib/turnkey_client/models/address_format.rb +2 -0
  13. data/lib/turnkey_client/models/app_status.rb +243 -0
  14. data/lib/turnkey_client/models/asset_balance.rb +255 -0
  15. data/lib/turnkey_client/models/asset_balance_display.rb +216 -0
  16. data/lib/turnkey_client/models/asset_metadata.rb +246 -0
  17. data/lib/turnkey_client/models/boot_proof.rb +17 -6
  18. data/lib/turnkey_client/models/create_oauth_providers_intent_v2.rb +228 -0
  19. data/lib/turnkey_client/models/create_oauth_providers_request.rb +2 -2
  20. data/lib/turnkey_client/models/create_oauth_providers_result_v2.rb +213 -0
  21. data/lib/turnkey_client/models/create_read_write_session_intent_v2.rb +1 -1
  22. data/lib/turnkey_client/models/create_sub_organization_intent_v8.rb +316 -0
  23. data/lib/turnkey_client/models/create_sub_organization_request.rb +2 -2
  24. data/lib/turnkey_client/models/create_sub_organization_result_v8.rb +230 -0
  25. data/lib/turnkey_client/models/create_tvc_app_intent.rb +9 -9
  26. data/lib/turnkey_client/models/create_tvc_app_request.rb +288 -0
  27. data/lib/turnkey_client/models/create_tvc_deployment_intent.rb +60 -41
  28. data/lib/turnkey_client/models/create_tvc_deployment_request.rb +288 -0
  29. data/lib/turnkey_client/models/create_tvc_manifest_approvals_request.rb +288 -0
  30. data/lib/turnkey_client/models/create_users_intent_v4.rb +213 -0
  31. data/lib/turnkey_client/models/create_users_request.rb +2 -2
  32. data/lib/turnkey_client/models/create_webhook_endpoint_intent.rb +238 -0
  33. data/lib/turnkey_client/models/create_webhook_endpoint_request.rb +298 -0
  34. data/lib/turnkey_client/models/create_webhook_endpoint_result.rb +225 -0
  35. data/lib/turnkey_client/models/delete_tvc_app_and_deployments_intent.rb +211 -0
  36. data/lib/turnkey_client/models/delete_tvc_app_and_deployments_request.rb +298 -0
  37. data/lib/turnkey_client/models/delete_tvc_app_and_deployments_result.rb +211 -0
  38. data/lib/turnkey_client/models/delete_tvc_deployment_intent.rb +211 -0
  39. data/lib/turnkey_client/models/delete_tvc_deployment_request.rb +298 -0
  40. data/lib/turnkey_client/models/delete_tvc_deployment_result.rb +211 -0
  41. data/lib/turnkey_client/models/delete_webhook_endpoint_intent.rb +211 -0
  42. data/lib/turnkey_client/models/delete_webhook_endpoint_request.rb +298 -0
  43. data/lib/turnkey_client/models/delete_webhook_endpoint_result.rb +211 -0
  44. data/lib/turnkey_client/models/deployment_status.rb +255 -0
  45. data/lib/turnkey_client/models/eth_failure_details.rb +208 -0
  46. data/lib/turnkey_client/models/eth_send_raw_transaction_intent.rb +2 -2
  47. data/lib/turnkey_client/models/eth_send_transaction_intent.rb +12 -1
  48. data/lib/turnkey_client/models/feature_name.rb +1 -0
  49. data/lib/turnkey_client/models/get_app_status_request.rb +226 -0
  50. data/lib/turnkey_client/models/get_app_status_response.rb +210 -0
  51. data/lib/turnkey_client/models/get_ip_allowlist_request.rb +222 -0
  52. data/lib/turnkey_client/models/get_ip_allowlist_response.rb +210 -0
  53. data/lib/turnkey_client/models/get_nonces_request.rb +35 -1
  54. data/lib/turnkey_client/models/get_send_transaction_status_response.rb +10 -1
  55. data/lib/turnkey_client/models/get_tvc_app_deployments_request.rb +226 -0
  56. data/lib/turnkey_client/models/get_tvc_app_deployments_response.rb +213 -0
  57. data/lib/turnkey_client/models/get_tvc_app_request.rb +226 -0
  58. data/lib/turnkey_client/models/get_tvc_app_response.rb +210 -0
  59. data/lib/turnkey_client/models/get_tvc_apps_request.rb +211 -0
  60. data/lib/turnkey_client/models/get_tvc_apps_response.rb +213 -0
  61. data/lib/turnkey_client/models/get_tvc_deployment_request.rb +226 -0
  62. data/lib/turnkey_client/models/get_tvc_deployment_response.rb +210 -0
  63. data/lib/turnkey_client/models/get_wallet_address_balances_request.rb +275 -0
  64. data/lib/turnkey_client/models/get_wallet_address_balances_response.rb +208 -0
  65. data/lib/turnkey_client/models/init_otp_auth_intent.rb +1 -1
  66. data/lib/turnkey_client/models/init_otp_auth_intent_v2.rb +1 -1
  67. data/lib/turnkey_client/models/init_otp_intent_v3.rb +336 -0
  68. data/lib/turnkey_client/models/init_otp_request.rb +2 -2
  69. data/lib/turnkey_client/models/init_otp_result_v2.rb +226 -0
  70. data/lib/turnkey_client/models/intent.rb +193 -4
  71. data/lib/turnkey_client/models/ip_allowlist.rb +261 -0
  72. data/lib/turnkey_client/models/ip_allowlist_intent_rule.rb +222 -0
  73. data/lib/turnkey_client/models/ip_allowlist_rule.rb +232 -0
  74. data/lib/turnkey_client/models/list_supported_assets_request.rb +260 -0
  75. data/lib/turnkey_client/models/list_supported_assets_response.rb +208 -0
  76. data/lib/turnkey_client/models/list_webhook_endpoints_request.rb +211 -0
  77. data/lib/turnkey_client/models/list_webhook_endpoints_response.rb +212 -0
  78. data/lib/turnkey_client/models/login_usage.rb +211 -0
  79. data/lib/turnkey_client/models/noop_codegen_anchor_response.rb +219 -0
  80. data/lib/turnkey_client/models/oauth2_authenticate_intent.rb +6 -2
  81. data/lib/turnkey_client/models/oauth_provider_params_v2.rb +230 -0
  82. data/lib/turnkey_client/models/oidc_claims.rb +241 -0
  83. data/lib/turnkey_client/models/otp_login_intent_v2.rb +262 -0
  84. data/lib/turnkey_client/models/otp_login_request.rb +2 -2
  85. data/lib/turnkey_client/models/post_tvc_quorum_key_share_intent.rb +240 -0
  86. data/lib/turnkey_client/models/post_tvc_quorum_key_share_result.rb +211 -0
  87. data/lib/turnkey_client/models/quorum_key_share_approval_bundle.rb +241 -0
  88. data/lib/turnkey_client/models/remove_ip_allowlist_intent.rb +207 -0
  89. data/lib/turnkey_client/models/remove_ip_allowlist_request.rb +298 -0
  90. data/lib/turnkey_client/models/remove_ip_allowlist_result.rb +196 -0
  91. data/lib/turnkey_client/models/restore_tvc_deployment_intent.rb +211 -0
  92. data/lib/turnkey_client/models/restore_tvc_deployment_request.rb +298 -0
  93. data/lib/turnkey_client/models/restore_tvc_deployment_result.rb +211 -0
  94. data/lib/turnkey_client/models/result.rb +166 -4
  95. data/lib/turnkey_client/models/root_user_params_v5.rb +284 -0
  96. data/lib/turnkey_client/models/set_ip_allowlist_intent.rb +241 -0
  97. data/lib/turnkey_client/models/set_ip_allowlist_request.rb +298 -0
  98. data/lib/turnkey_client/models/set_ip_allowlist_result.rb +196 -0
  99. data/lib/turnkey_client/models/signup_usage.rb +249 -0
  100. data/lib/turnkey_client/models/signup_usage_v2.rb +249 -0
  101. data/lib/turnkey_client/models/sol_send_transaction_intent.rb +3 -3
  102. data/lib/turnkey_client/models/solana_config.rb +207 -0
  103. data/lib/turnkey_client/models/solana_failure_details.rb +273 -0
  104. data/lib/turnkey_client/models/solana_send_transaction_status.rb +207 -0
  105. data/lib/turnkey_client/models/spark_claim_leaf.rb +241 -0
  106. data/lib/turnkey_client/models/spark_claim_package.rb +275 -0
  107. data/lib/turnkey_client/models/spark_claim_transfer_intent.rb +225 -0
  108. data/lib/turnkey_client/models/spark_claim_transfer_request.rb +288 -0
  109. data/lib/turnkey_client/models/spark_claim_transfer_result.rb +230 -0
  110. data/lib/turnkey_client/models/spark_deposit_derivation.rb +196 -0
  111. data/lib/turnkey_client/models/spark_encrypted_operator_package.rb +226 -0
  112. data/lib/turnkey_client/models/spark_frost_commitment.rb +241 -0
  113. data/lib/turnkey_client/models/spark_htlc_preimage_derivation.rb +196 -0
  114. data/lib/turnkey_client/models/spark_identity_derivation.rb +196 -0
  115. data/lib/turnkey_client/models/spark_key_derivation.rb +241 -0
  116. data/lib/turnkey_client/models/spark_leaf_public_key.rb +226 -0
  117. data/lib/turnkey_client/models/spark_lightning_receive_package.rb +228 -0
  118. data/lib/turnkey_client/models/spark_operator_recipient.rb +226 -0
  119. data/lib/turnkey_client/models/spark_partial_signature.rb +241 -0
  120. data/lib/turnkey_client/models/spark_prepare_lightning_receive_intent.rb +225 -0
  121. data/lib/turnkey_client/models/spark_prepare_lightning_receive_request.rb +288 -0
  122. data/lib/turnkey_client/models/spark_prepare_lightning_receive_result.rb +228 -0
  123. data/lib/turnkey_client/models/spark_prepare_transfer_intent.rb +225 -0
  124. data/lib/turnkey_client/models/spark_prepare_transfer_request.rb +288 -0
  125. data/lib/turnkey_client/models/spark_prepare_transfer_result.rb +245 -0
  126. data/lib/turnkey_client/models/spark_sign_frost_intent.rb +228 -0
  127. data/lib/turnkey_client/models/spark_sign_frost_request.rb +288 -0
  128. data/lib/turnkey_client/models/spark_sign_frost_result.rb +213 -0
  129. data/lib/turnkey_client/models/spark_signature_request.rb +268 -0
  130. data/lib/turnkey_client/models/spark_signing_leaf_derivation.rb +211 -0
  131. data/lib/turnkey_client/models/spark_static_deposit_derivation.rb +211 -0
  132. data/lib/turnkey_client/models/spark_transfer_leaf.rb +272 -0
  133. data/lib/turnkey_client/models/spark_transfer_package.rb +275 -0
  134. data/lib/turnkey_client/models/token_usage.rb +252 -0
  135. data/lib/turnkey_client/models/tvc_app.rb +353 -0
  136. data/lib/turnkey_client/models/tvc_container_spec.rb +302 -0
  137. data/lib/turnkey_client/models/tvc_deployment.rb +372 -0
  138. data/lib/turnkey_client/models/tvc_health_check_type.rb +27 -0
  139. data/lib/turnkey_client/models/tvc_manifest.rb +254 -0
  140. data/lib/turnkey_client/models/tvc_operator.rb +269 -0
  141. data/lib/turnkey_client/models/tvc_operator_approval.rb +283 -0
  142. data/lib/turnkey_client/models/tvc_operator_set.rb +301 -0
  143. data/lib/turnkey_client/models/tx_error.rb +22 -4
  144. data/lib/turnkey_client/models/update_auth_proxy_config_intent.rb +17 -5
  145. data/lib/turnkey_client/models/update_organization_name_intent.rb +211 -0
  146. data/lib/turnkey_client/models/update_organization_name_request.rb +298 -0
  147. data/lib/turnkey_client/models/update_organization_name_result.rb +226 -0
  148. data/lib/turnkey_client/models/update_tvc_app_live_deployment_intent.rb +211 -0
  149. data/lib/turnkey_client/models/update_tvc_app_live_deployment_request.rb +298 -0
  150. data/lib/turnkey_client/models/update_tvc_app_live_deployment_result.rb +196 -0
  151. data/lib/turnkey_client/models/update_webhook_endpoint_intent.rb +244 -0
  152. data/lib/turnkey_client/models/update_webhook_endpoint_request.rb +298 -0
  153. data/lib/turnkey_client/models/update_webhook_endpoint_result.rb +225 -0
  154. data/lib/turnkey_client/models/upsert_gas_usage_config_intent.rb +25 -5
  155. data/lib/turnkey_client/models/usage_type.rb +27 -0
  156. data/lib/turnkey_client/models/user_params_v4.rb +301 -0
  157. data/lib/turnkey_client/models/validate_tvc_image_request.rb +237 -0
  158. data/lib/turnkey_client/models/validate_tvc_image_response.rb +205 -0
  159. data/lib/turnkey_client/models/verify_otp_intent_v2.rb +237 -0
  160. data/lib/turnkey_client/models/verify_otp_request.rb +2 -2
  161. data/lib/turnkey_client/models/web_authn_stamp.rb +256 -0
  162. data/lib/turnkey_client/models/webhook_endpoint_data.rb +283 -0
  163. data/lib/turnkey_client/models/webhook_subscription_params.rb +233 -0
  164. data/lib/turnkey_client/version.rb +1 -1
  165. data/lib/turnkey_client.rb +129 -0
  166. metadata +153 -24
@@ -0,0 +1,261 @@
1
+ =begin
2
+ #API Reference
3
+
4
+ #Review our [API Introduction](../api-introduction) to get started.
5
+
6
+ OpenAPI spec version: 1.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ =end
10
+
11
+ require 'date'
12
+
13
+ module TurnkeyClient
14
+ class IpAllowlist
15
+ # Unique identifier for the organization this allowlist belongs to.
16
+ attr_accessor :organization_id
17
+
18
+ # List of IP allowlist rules with their metadata.
19
+ attr_accessor :rules
20
+
21
+ # Public key of the API key this allowlist applies to. Null means the allowlist applies to the entire organization.
22
+ attr_accessor :public_key
23
+
24
+ # Whether the IP allowlist is enabled. Only present for organization-level allowlists. Null for API key-level allowlists (presence of the allowlist implies enablement).
25
+ attr_accessor :enabled
26
+
27
+ # Behavior when an error occurs during IP allowlist evaluation. Valid values: ALLOW, DENY. Defaults to DENY.
28
+ attr_accessor :on_evaluation_error
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'organization_id' => :'organizationId',
34
+ :'rules' => :'rules',
35
+ :'public_key' => :'publicKey',
36
+ :'enabled' => :'enabled',
37
+ :'on_evaluation_error' => :'onEvaluationError'
38
+ }
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'organization_id' => :'Object',
45
+ :'rules' => :'Object',
46
+ :'public_key' => :'Object',
47
+ :'enabled' => :'Object',
48
+ :'on_evaluation_error' => :'Object'
49
+ }
50
+ end
51
+
52
+ # List of attributes with nullable: true
53
+ def self.openapi_nullable
54
+ Set.new([
55
+ :'public_key',
56
+ :'enabled',
57
+ :'on_evaluation_error'
58
+ ])
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TurnkeyClient::IpAllowlist` initialize method"
66
+ end
67
+
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ attributes = attributes.each_with_object({}) { |(k, v), h|
70
+ if (!self.class.attribute_map.key?(k.to_sym))
71
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TurnkeyClient::IpAllowlist`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
72
+ end
73
+ h[k.to_sym] = v
74
+ }
75
+
76
+ if attributes.key?(:'organization_id')
77
+ self.organization_id = attributes[:'organization_id']
78
+ end
79
+
80
+ if attributes.key?(:'rules')
81
+ if (value = attributes[:'rules']).is_a?(Array)
82
+ self.rules = value
83
+ end
84
+ end
85
+
86
+ if attributes.key?(:'public_key')
87
+ self.public_key = attributes[:'public_key']
88
+ end
89
+
90
+ if attributes.key?(:'enabled')
91
+ self.enabled = attributes[:'enabled']
92
+ end
93
+
94
+ if attributes.key?(:'on_evaluation_error')
95
+ self.on_evaluation_error = attributes[:'on_evaluation_error']
96
+ end
97
+ end
98
+
99
+ # Show invalid properties with the reasons. Usually used together with valid?
100
+ # @return Array for valid properties with the reasons
101
+ def list_invalid_properties
102
+ invalid_properties = Array.new
103
+ if @organization_id.nil?
104
+ invalid_properties.push('invalid value for "organization_id", organization_id cannot be nil.')
105
+ end
106
+
107
+ if @rules.nil?
108
+ invalid_properties.push('invalid value for "rules", rules cannot be nil.')
109
+ end
110
+
111
+ invalid_properties
112
+ end
113
+
114
+ # Check to see if the all the properties in the model are valid
115
+ # @return true if the model is valid
116
+ def valid?
117
+ return false if @organization_id.nil?
118
+ return false if @rules.nil?
119
+ true
120
+ end
121
+
122
+ # Checks equality by comparing each attribute.
123
+ # @param [Object] Object to be compared
124
+ def ==(o)
125
+ return true if self.equal?(o)
126
+ self.class == o.class &&
127
+ organization_id == o.organization_id &&
128
+ rules == o.rules &&
129
+ public_key == o.public_key &&
130
+ enabled == o.enabled &&
131
+ on_evaluation_error == o.on_evaluation_error
132
+ end
133
+
134
+ # @see the `==` method
135
+ # @param [Object] Object to be compared
136
+ def eql?(o)
137
+ self == o
138
+ end
139
+
140
+ # Calculates hash code according to all attributes.
141
+ # @return [Integer] Hash code
142
+ def hash
143
+ [organization_id, rules, public_key, enabled, on_evaluation_error].hash
144
+ end
145
+
146
+ # Builds the object from hash
147
+ # @param [Hash] attributes Model attributes in the form of hash
148
+ # @return [Object] Returns the model itself
149
+ def self.build_from_hash(attributes)
150
+ new.build_from_hash(attributes)
151
+ end
152
+
153
+ # Builds the object from hash
154
+ # @param [Hash] attributes Model attributes in the form of hash
155
+ # @return [Object] Returns the model itself
156
+ def build_from_hash(attributes)
157
+ return nil unless attributes.is_a?(Hash)
158
+ self.class.openapi_types.each_pair do |key, type|
159
+ if type =~ /\AArray<(.*)>/i
160
+ # check to ensure the input is an array given that the attribute
161
+ # is documented as an array but the input is not
162
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
163
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
164
+ end
165
+ elsif !attributes[self.class.attribute_map[key]].nil?
166
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
167
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
168
+ self.send("#{key}=", nil)
169
+ end
170
+ end
171
+
172
+ self
173
+ end
174
+
175
+ # Deserializes the data based on type
176
+ # @param string type Data type
177
+ # @param string value Value to be deserialized
178
+ # @return [Object] Deserialized data
179
+ def _deserialize(type, value)
180
+ case type.to_sym
181
+ when :DateTime
182
+ DateTime.parse(value)
183
+ when :Date
184
+ Date.parse(value)
185
+ when :String
186
+ value.to_s
187
+ when :Integer
188
+ value.to_i
189
+ when :Float
190
+ value.to_f
191
+ when :Boolean
192
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
193
+ true
194
+ else
195
+ false
196
+ end
197
+ when :Object
198
+ # generic object (usually a Hash), return directly
199
+ value
200
+ when /\AArray<(?<inner_type>.+)>\z/
201
+ inner_type = Regexp.last_match[:inner_type]
202
+ value.map { |v| _deserialize(inner_type, v) }
203
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
204
+ k_type = Regexp.last_match[:k_type]
205
+ v_type = Regexp.last_match[:v_type]
206
+ {}.tap do |hash|
207
+ value.each do |k, v|
208
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
209
+ end
210
+ end
211
+ else # model
212
+ TurnkeyClient.const_get(type).build_from_hash(value)
213
+ end
214
+ end
215
+
216
+ # Returns the string representation of the object
217
+ # @return [String] String presentation of the object
218
+ def to_s
219
+ to_hash.to_s
220
+ end
221
+
222
+ # to_body is an alias to to_hash (backward compatibility)
223
+ # @return [Hash] Returns the object in the form of hash
224
+ def to_body
225
+ to_hash
226
+ end
227
+
228
+ # Returns the object in the form of hash
229
+ # @return [Hash] Returns the object in the form of hash
230
+ def to_hash
231
+ hash = {}
232
+ self.class.attribute_map.each_pair do |attr, param|
233
+ value = self.send(attr)
234
+ if value.nil?
235
+ is_nullable = self.class.openapi_nullable.include?(attr)
236
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
237
+ end
238
+
239
+ hash[param] = _to_hash(value)
240
+ end
241
+ hash
242
+ end
243
+
244
+ # Outputs non-array value in the form of hash
245
+ # For object, use to_hash. Otherwise, just return the value
246
+ # @param [Object] value Any valid value
247
+ # @return [Hash] Returns the value in the form of hash
248
+ def _to_hash(value)
249
+ if value.is_a?(Array)
250
+ value.compact.map { |v| _to_hash(v) }
251
+ elsif value.is_a?(Hash)
252
+ {}.tap do |hash|
253
+ value.each { |k, v| hash[k] = _to_hash(v) }
254
+ end
255
+ elsif value.respond_to? :to_hash
256
+ value.to_hash
257
+ else
258
+ value
259
+ end
260
+ end end
261
+ end
@@ -0,0 +1,222 @@
1
+ =begin
2
+ #API Reference
3
+
4
+ #Review our [API Introduction](../api-introduction) to get started.
5
+
6
+ OpenAPI spec version: 1.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ =end
10
+
11
+ require 'date'
12
+
13
+ module TurnkeyClient
14
+ class IpAllowlistIntentRule
15
+ # CIDR block (e.g., '192.168.1.0/24', '2001:db8::/32').
16
+ attr_accessor :cidr
17
+
18
+ # Optional human-readable label for this rule (e.g., 'Office VPN').
19
+ attr_accessor :label
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'cidr' => :'cidr',
25
+ :'label' => :'label'
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.openapi_types
31
+ {
32
+ :'cidr' => :'Object',
33
+ :'label' => :'Object'
34
+ }
35
+ end
36
+
37
+ # List of attributes with nullable: true
38
+ def self.openapi_nullable
39
+ Set.new([
40
+ :'label'
41
+ ])
42
+ end
43
+
44
+ # Initializes the object
45
+ # @param [Hash] attributes Model attributes in the form of hash
46
+ def initialize(attributes = {})
47
+ if (!attributes.is_a?(Hash))
48
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TurnkeyClient::IpAllowlistIntentRule` initialize method"
49
+ end
50
+
51
+ # check to see if the attribute exists and convert string to symbol for hash key
52
+ attributes = attributes.each_with_object({}) { |(k, v), h|
53
+ if (!self.class.attribute_map.key?(k.to_sym))
54
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TurnkeyClient::IpAllowlistIntentRule`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
55
+ end
56
+ h[k.to_sym] = v
57
+ }
58
+
59
+ if attributes.key?(:'cidr')
60
+ self.cidr = attributes[:'cidr']
61
+ end
62
+
63
+ if attributes.key?(:'label')
64
+ self.label = attributes[:'label']
65
+ end
66
+ end
67
+
68
+ # Show invalid properties with the reasons. Usually used together with valid?
69
+ # @return Array for valid properties with the reasons
70
+ def list_invalid_properties
71
+ invalid_properties = Array.new
72
+ if @cidr.nil?
73
+ invalid_properties.push('invalid value for "cidr", cidr cannot be nil.')
74
+ end
75
+
76
+ invalid_properties
77
+ end
78
+
79
+ # Check to see if the all the properties in the model are valid
80
+ # @return true if the model is valid
81
+ def valid?
82
+ return false if @cidr.nil?
83
+ true
84
+ end
85
+
86
+ # Checks equality by comparing each attribute.
87
+ # @param [Object] Object to be compared
88
+ def ==(o)
89
+ return true if self.equal?(o)
90
+ self.class == o.class &&
91
+ cidr == o.cidr &&
92
+ label == o.label
93
+ end
94
+
95
+ # @see the `==` method
96
+ # @param [Object] Object to be compared
97
+ def eql?(o)
98
+ self == o
99
+ end
100
+
101
+ # Calculates hash code according to all attributes.
102
+ # @return [Integer] Hash code
103
+ def hash
104
+ [cidr, label].hash
105
+ end
106
+
107
+ # Builds the object from hash
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ # @return [Object] Returns the model itself
110
+ def self.build_from_hash(attributes)
111
+ new.build_from_hash(attributes)
112
+ end
113
+
114
+ # Builds the object from hash
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ # @return [Object] Returns the model itself
117
+ def build_from_hash(attributes)
118
+ return nil unless attributes.is_a?(Hash)
119
+ self.class.openapi_types.each_pair do |key, type|
120
+ if type =~ /\AArray<(.*)>/i
121
+ # check to ensure the input is an array given that the attribute
122
+ # is documented as an array but the input is not
123
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
124
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
125
+ end
126
+ elsif !attributes[self.class.attribute_map[key]].nil?
127
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
128
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
129
+ self.send("#{key}=", nil)
130
+ end
131
+ end
132
+
133
+ self
134
+ end
135
+
136
+ # Deserializes the data based on type
137
+ # @param string type Data type
138
+ # @param string value Value to be deserialized
139
+ # @return [Object] Deserialized data
140
+ def _deserialize(type, value)
141
+ case type.to_sym
142
+ when :DateTime
143
+ DateTime.parse(value)
144
+ when :Date
145
+ Date.parse(value)
146
+ when :String
147
+ value.to_s
148
+ when :Integer
149
+ value.to_i
150
+ when :Float
151
+ value.to_f
152
+ when :Boolean
153
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
154
+ true
155
+ else
156
+ false
157
+ end
158
+ when :Object
159
+ # generic object (usually a Hash), return directly
160
+ value
161
+ when /\AArray<(?<inner_type>.+)>\z/
162
+ inner_type = Regexp.last_match[:inner_type]
163
+ value.map { |v| _deserialize(inner_type, v) }
164
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
165
+ k_type = Regexp.last_match[:k_type]
166
+ v_type = Regexp.last_match[:v_type]
167
+ {}.tap do |hash|
168
+ value.each do |k, v|
169
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
170
+ end
171
+ end
172
+ else # model
173
+ TurnkeyClient.const_get(type).build_from_hash(value)
174
+ end
175
+ end
176
+
177
+ # Returns the string representation of the object
178
+ # @return [String] String presentation of the object
179
+ def to_s
180
+ to_hash.to_s
181
+ end
182
+
183
+ # to_body is an alias to to_hash (backward compatibility)
184
+ # @return [Hash] Returns the object in the form of hash
185
+ def to_body
186
+ to_hash
187
+ end
188
+
189
+ # Returns the object in the form of hash
190
+ # @return [Hash] Returns the object in the form of hash
191
+ def to_hash
192
+ hash = {}
193
+ self.class.attribute_map.each_pair do |attr, param|
194
+ value = self.send(attr)
195
+ if value.nil?
196
+ is_nullable = self.class.openapi_nullable.include?(attr)
197
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
198
+ end
199
+
200
+ hash[param] = _to_hash(value)
201
+ end
202
+ hash
203
+ end
204
+
205
+ # Outputs non-array value in the form of hash
206
+ # For object, use to_hash. Otherwise, just return the value
207
+ # @param [Object] value Any valid value
208
+ # @return [Hash] Returns the value in the form of hash
209
+ def _to_hash(value)
210
+ if value.is_a?(Array)
211
+ value.compact.map { |v| _to_hash(v) }
212
+ elsif value.is_a?(Hash)
213
+ {}.tap do |hash|
214
+ value.each { |k, v| hash[k] = _to_hash(v) }
215
+ end
216
+ elsif value.respond_to? :to_hash
217
+ value.to_hash
218
+ else
219
+ value
220
+ end
221
+ end end
222
+ end
@@ -0,0 +1,232 @@
1
+ =begin
2
+ #API Reference
3
+
4
+ #Review our [API Introduction](../api-introduction) to get started.
5
+
6
+ OpenAPI spec version: 1.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ =end
10
+
11
+ require 'date'
12
+
13
+ module TurnkeyClient
14
+ class IpAllowlistRule
15
+ # CIDR block (e.g., '192.168.1.0/24').
16
+ attr_accessor :cidr
17
+
18
+ # Optional human-readable label for this rule.
19
+ attr_accessor :label
20
+
21
+ # Creation timestamp as millisecond epoch string.
22
+ attr_accessor :created_at
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'cidr' => :'cidr',
28
+ :'label' => :'label',
29
+ :'created_at' => :'createdAt'
30
+ }
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.openapi_types
35
+ {
36
+ :'cidr' => :'Object',
37
+ :'label' => :'Object',
38
+ :'created_at' => :'Object'
39
+ }
40
+ end
41
+
42
+ # List of attributes with nullable: true
43
+ def self.openapi_nullable
44
+ Set.new([
45
+ :'label',
46
+ ])
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ if (!attributes.is_a?(Hash))
53
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TurnkeyClient::IpAllowlistRule` initialize method"
54
+ end
55
+
56
+ # check to see if the attribute exists and convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h|
58
+ if (!self.class.attribute_map.key?(k.to_sym))
59
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TurnkeyClient::IpAllowlistRule`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
60
+ end
61
+ h[k.to_sym] = v
62
+ }
63
+
64
+ if attributes.key?(:'cidr')
65
+ self.cidr = attributes[:'cidr']
66
+ end
67
+
68
+ if attributes.key?(:'label')
69
+ self.label = attributes[:'label']
70
+ end
71
+
72
+ if attributes.key?(:'created_at')
73
+ self.created_at = attributes[:'created_at']
74
+ end
75
+ end
76
+
77
+ # Show invalid properties with the reasons. Usually used together with valid?
78
+ # @return Array for valid properties with the reasons
79
+ def list_invalid_properties
80
+ invalid_properties = Array.new
81
+ if @cidr.nil?
82
+ invalid_properties.push('invalid value for "cidr", cidr cannot be nil.')
83
+ end
84
+
85
+ invalid_properties
86
+ end
87
+
88
+ # Check to see if the all the properties in the model are valid
89
+ # @return true if the model is valid
90
+ def valid?
91
+ return false if @cidr.nil?
92
+ true
93
+ end
94
+
95
+ # Checks equality by comparing each attribute.
96
+ # @param [Object] Object to be compared
97
+ def ==(o)
98
+ return true if self.equal?(o)
99
+ self.class == o.class &&
100
+ cidr == o.cidr &&
101
+ label == o.label &&
102
+ created_at == o.created_at
103
+ end
104
+
105
+ # @see the `==` method
106
+ # @param [Object] Object to be compared
107
+ def eql?(o)
108
+ self == o
109
+ end
110
+
111
+ # Calculates hash code according to all attributes.
112
+ # @return [Integer] Hash code
113
+ def hash
114
+ [cidr, label, created_at].hash
115
+ end
116
+
117
+ # Builds the object from hash
118
+ # @param [Hash] attributes Model attributes in the form of hash
119
+ # @return [Object] Returns the model itself
120
+ def self.build_from_hash(attributes)
121
+ new.build_from_hash(attributes)
122
+ end
123
+
124
+ # Builds the object from hash
125
+ # @param [Hash] attributes Model attributes in the form of hash
126
+ # @return [Object] Returns the model itself
127
+ def build_from_hash(attributes)
128
+ return nil unless attributes.is_a?(Hash)
129
+ self.class.openapi_types.each_pair do |key, type|
130
+ if type =~ /\AArray<(.*)>/i
131
+ # check to ensure the input is an array given that the attribute
132
+ # is documented as an array but the input is not
133
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
134
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
135
+ end
136
+ elsif !attributes[self.class.attribute_map[key]].nil?
137
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
138
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
139
+ self.send("#{key}=", nil)
140
+ end
141
+ end
142
+
143
+ self
144
+ end
145
+
146
+ # Deserializes the data based on type
147
+ # @param string type Data type
148
+ # @param string value Value to be deserialized
149
+ # @return [Object] Deserialized data
150
+ def _deserialize(type, value)
151
+ case type.to_sym
152
+ when :DateTime
153
+ DateTime.parse(value)
154
+ when :Date
155
+ Date.parse(value)
156
+ when :String
157
+ value.to_s
158
+ when :Integer
159
+ value.to_i
160
+ when :Float
161
+ value.to_f
162
+ when :Boolean
163
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
164
+ true
165
+ else
166
+ false
167
+ end
168
+ when :Object
169
+ # generic object (usually a Hash), return directly
170
+ value
171
+ when /\AArray<(?<inner_type>.+)>\z/
172
+ inner_type = Regexp.last_match[:inner_type]
173
+ value.map { |v| _deserialize(inner_type, v) }
174
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
175
+ k_type = Regexp.last_match[:k_type]
176
+ v_type = Regexp.last_match[:v_type]
177
+ {}.tap do |hash|
178
+ value.each do |k, v|
179
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
180
+ end
181
+ end
182
+ else # model
183
+ TurnkeyClient.const_get(type).build_from_hash(value)
184
+ end
185
+ end
186
+
187
+ # Returns the string representation of the object
188
+ # @return [String] String presentation of the object
189
+ def to_s
190
+ to_hash.to_s
191
+ end
192
+
193
+ # to_body is an alias to to_hash (backward compatibility)
194
+ # @return [Hash] Returns the object in the form of hash
195
+ def to_body
196
+ to_hash
197
+ end
198
+
199
+ # Returns the object in the form of hash
200
+ # @return [Hash] Returns the object in the form of hash
201
+ def to_hash
202
+ hash = {}
203
+ self.class.attribute_map.each_pair do |attr, param|
204
+ value = self.send(attr)
205
+ if value.nil?
206
+ is_nullable = self.class.openapi_nullable.include?(attr)
207
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
208
+ end
209
+
210
+ hash[param] = _to_hash(value)
211
+ end
212
+ hash
213
+ end
214
+
215
+ # Outputs non-array value in the form of hash
216
+ # For object, use to_hash. Otherwise, just return the value
217
+ # @param [Object] value Any valid value
218
+ # @return [Hash] Returns the value in the form of hash
219
+ def _to_hash(value)
220
+ if value.is_a?(Array)
221
+ value.compact.map { |v| _to_hash(v) }
222
+ elsif value.is_a?(Hash)
223
+ {}.tap do |hash|
224
+ value.each { |k, v| hash[k] = _to_hash(v) }
225
+ end
226
+ elsif value.respond_to? :to_hash
227
+ value.to_hash
228
+ else
229
+ value
230
+ end
231
+ end end
232
+ end