daytona_api_client 0.195.0 → 0.197.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.
@@ -0,0 +1,249 @@
1
+ =begin
2
+ #Daytona
3
+
4
+ #Daytona AI platform API Docs
5
+
6
+ The version of the OpenAPI document: 1.0
7
+ Contact: support@daytona.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.21.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module DaytonaApiClient
17
+ class AvailableSandboxClass < ApiModelBase
18
+ attr_accessor :region_id
19
+
20
+ attr_accessor :sandbox_class
21
+
22
+ attr_accessor :gpu_available
23
+
24
+ attr_accessor :allowed_gpu_types
25
+
26
+ class EnumAttributeValidator
27
+ attr_reader :datatype
28
+ attr_reader :allowable_values
29
+
30
+ def initialize(datatype, allowable_values)
31
+ @allowable_values = allowable_values.map do |value|
32
+ case datatype.to_s
33
+ when /Integer/i
34
+ value.to_i
35
+ when /Float/i
36
+ value.to_f
37
+ else
38
+ value
39
+ end
40
+ end
41
+ end
42
+
43
+ def valid?(value)
44
+ !value || allowable_values.include?(value)
45
+ end
46
+ end
47
+
48
+ # Attribute mapping from ruby-style variable name to JSON key.
49
+ def self.attribute_map
50
+ {
51
+ :'region_id' => :'regionId',
52
+ :'sandbox_class' => :'sandboxClass',
53
+ :'gpu_available' => :'gpuAvailable',
54
+ :'allowed_gpu_types' => :'allowedGpuTypes'
55
+ }
56
+ end
57
+
58
+ # Returns attribute mapping this model knows about
59
+ def self.acceptable_attribute_map
60
+ attribute_map
61
+ end
62
+
63
+ # Returns all the JSON keys this model knows about
64
+ def self.acceptable_attributes
65
+ acceptable_attribute_map.values
66
+ end
67
+
68
+ # Attribute type mapping.
69
+ def self.openapi_types
70
+ {
71
+ :'region_id' => :'String',
72
+ :'sandbox_class' => :'SandboxClass',
73
+ :'gpu_available' => :'Boolean',
74
+ :'allowed_gpu_types' => :'Array<GpuType>'
75
+ }
76
+ end
77
+
78
+ # List of attributes with nullable: true
79
+ def self.openapi_nullable
80
+ Set.new([
81
+ ])
82
+ end
83
+
84
+ # Initializes the object
85
+ # @param [Hash] attributes Model attributes in the form of hash
86
+ def initialize(attributes = {})
87
+ if (!attributes.is_a?(Hash))
88
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DaytonaApiClient::AvailableSandboxClass` initialize method"
89
+ end
90
+
91
+ # check to see if the attribute exists and convert string to symbol for hash key
92
+ acceptable_attribute_map = self.class.acceptable_attribute_map
93
+ attributes = attributes.each_with_object({}) { |(k, v), h|
94
+ if (!acceptable_attribute_map.key?(k.to_sym))
95
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DaytonaApiClient::AvailableSandboxClass`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
96
+ end
97
+ h[k.to_sym] = v
98
+ }
99
+
100
+ if attributes.key?(:'region_id')
101
+ self.region_id = attributes[:'region_id']
102
+ else
103
+ self.region_id = nil
104
+ end
105
+
106
+ if attributes.key?(:'sandbox_class')
107
+ self.sandbox_class = attributes[:'sandbox_class']
108
+ else
109
+ self.sandbox_class = nil
110
+ end
111
+
112
+ if attributes.key?(:'gpu_available')
113
+ self.gpu_available = attributes[:'gpu_available']
114
+ else
115
+ self.gpu_available = nil
116
+ end
117
+
118
+ if attributes.key?(:'allowed_gpu_types')
119
+ if (value = attributes[:'allowed_gpu_types']).is_a?(Array)
120
+ self.allowed_gpu_types = value
121
+ end
122
+ end
123
+ end
124
+
125
+ # Show invalid properties with the reasons. Usually used together with valid?
126
+ # @return Array for valid properties with the reasons
127
+ def list_invalid_properties
128
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
129
+ invalid_properties = Array.new
130
+ if @region_id.nil?
131
+ invalid_properties.push('invalid value for "region_id", region_id cannot be nil.')
132
+ end
133
+
134
+ if @sandbox_class.nil?
135
+ invalid_properties.push('invalid value for "sandbox_class", sandbox_class cannot be nil.')
136
+ end
137
+
138
+ if @gpu_available.nil?
139
+ invalid_properties.push('invalid value for "gpu_available", gpu_available cannot be nil.')
140
+ end
141
+
142
+ invalid_properties
143
+ end
144
+
145
+ # Check to see if the all the properties in the model are valid
146
+ # @return true if the model is valid
147
+ def valid?
148
+ warn '[DEPRECATED] the `valid?` method is obsolete'
149
+ return false if @region_id.nil?
150
+ return false if @sandbox_class.nil?
151
+ return false if @gpu_available.nil?
152
+ true
153
+ end
154
+
155
+ # Custom attribute writer method with validation
156
+ # @param [Object] region_id Value to be assigned
157
+ def region_id=(region_id)
158
+ if region_id.nil?
159
+ fail ArgumentError, 'region_id cannot be nil'
160
+ end
161
+
162
+ @region_id = region_id
163
+ end
164
+
165
+ # Custom attribute writer method with validation
166
+ # @param [Object] sandbox_class Value to be assigned
167
+ def sandbox_class=(sandbox_class)
168
+ if sandbox_class.nil?
169
+ fail ArgumentError, 'sandbox_class cannot be nil'
170
+ end
171
+
172
+ @sandbox_class = sandbox_class
173
+ end
174
+
175
+ # Custom attribute writer method with validation
176
+ # @param [Object] gpu_available Value to be assigned
177
+ def gpu_available=(gpu_available)
178
+ if gpu_available.nil?
179
+ fail ArgumentError, 'gpu_available cannot be nil'
180
+ end
181
+
182
+ @gpu_available = gpu_available
183
+ end
184
+
185
+ # Checks equality by comparing each attribute.
186
+ # @param [Object] Object to be compared
187
+ def ==(o)
188
+ return true if self.equal?(o)
189
+ self.class == o.class &&
190
+ region_id == o.region_id &&
191
+ sandbox_class == o.sandbox_class &&
192
+ gpu_available == o.gpu_available &&
193
+ allowed_gpu_types == o.allowed_gpu_types
194
+ end
195
+
196
+ # @see the `==` method
197
+ # @param [Object] Object to be compared
198
+ def eql?(o)
199
+ self == o
200
+ end
201
+
202
+ # Calculates hash code according to all attributes.
203
+ # @return [Integer] Hash code
204
+ def hash
205
+ [region_id, sandbox_class, gpu_available, allowed_gpu_types].hash
206
+ end
207
+
208
+ # Builds the object from hash
209
+ # @param [Hash] attributes Model attributes in the form of hash
210
+ # @return [Object] Returns the model itself
211
+ def self.build_from_hash(attributes)
212
+ return nil unless attributes.is_a?(Hash)
213
+ attributes = attributes.transform_keys(&:to_sym)
214
+ transformed_hash = {}
215
+ openapi_types.each_pair do |key, type|
216
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
217
+ transformed_hash["#{key}"] = nil
218
+ elsif type =~ /\AArray<(.*)>/i
219
+ # check to ensure the input is an array given that the attribute
220
+ # is documented as an array but the input is not
221
+ if attributes[attribute_map[key]].is_a?(Array)
222
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
223
+ end
224
+ elsif !attributes[attribute_map[key]].nil?
225
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
226
+ end
227
+ end
228
+ new(transformed_hash)
229
+ end
230
+
231
+ # Returns the object in the form of hash
232
+ # @return [Hash] Returns the object in the form of hash
233
+ def to_hash
234
+ hash = {}
235
+ self.class.attribute_map.each_pair do |attr, param|
236
+ value = self.send(attr)
237
+ if value.nil?
238
+ is_nullable = self.class.openapi_nullable.include?(attr)
239
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
240
+ end
241
+
242
+ hash[param] = _to_hash(value)
243
+ end
244
+ hash
245
+ end
246
+
247
+ end
248
+
249
+ end
@@ -21,6 +21,8 @@ module DaytonaApiClient
21
21
 
22
22
  attr_accessor :total_disk_quota
23
23
 
24
+ attr_accessor :total_gpu_quota
25
+
24
26
  attr_accessor :max_cpu_per_sandbox
25
27
 
26
28
  attr_accessor :max_memory_per_sandbox
@@ -42,6 +44,7 @@ module DaytonaApiClient
42
44
  :'total_cpu_quota' => :'totalCpuQuota',
43
45
  :'total_memory_quota' => :'totalMemoryQuota',
44
46
  :'total_disk_quota' => :'totalDiskQuota',
47
+ :'total_gpu_quota' => :'totalGpuQuota',
45
48
  :'max_cpu_per_sandbox' => :'maxCpuPerSandbox',
46
49
  :'max_memory_per_sandbox' => :'maxMemoryPerSandbox',
47
50
  :'max_disk_per_sandbox' => :'maxDiskPerSandbox',
@@ -68,6 +71,7 @@ module DaytonaApiClient
68
71
  :'total_cpu_quota' => :'Float',
69
72
  :'total_memory_quota' => :'Float',
70
73
  :'total_disk_quota' => :'Float',
74
+ :'total_gpu_quota' => :'Float',
71
75
  :'max_cpu_per_sandbox' => :'Float',
72
76
  :'max_memory_per_sandbox' => :'Float',
73
77
  :'max_disk_per_sandbox' => :'Float',
@@ -112,6 +116,10 @@ module DaytonaApiClient
112
116
  self.total_disk_quota = attributes[:'total_disk_quota']
113
117
  end
114
118
 
119
+ if attributes.key?(:'total_gpu_quota')
120
+ self.total_gpu_quota = attributes[:'total_gpu_quota']
121
+ end
122
+
115
123
  if attributes.key?(:'max_cpu_per_sandbox')
116
124
  self.max_cpu_per_sandbox = attributes[:'max_cpu_per_sandbox']
117
125
  end
@@ -164,6 +172,7 @@ module DaytonaApiClient
164
172
  total_cpu_quota == o.total_cpu_quota &&
165
173
  total_memory_quota == o.total_memory_quota &&
166
174
  total_disk_quota == o.total_disk_quota &&
175
+ total_gpu_quota == o.total_gpu_quota &&
167
176
  max_cpu_per_sandbox == o.max_cpu_per_sandbox &&
168
177
  max_memory_per_sandbox == o.max_memory_per_sandbox &&
169
178
  max_disk_per_sandbox == o.max_disk_per_sandbox &&
@@ -182,7 +191,7 @@ module DaytonaApiClient
182
191
  # Calculates hash code according to all attributes.
183
192
  # @return [Integer] Hash code
184
193
  def hash
185
- [total_cpu_quota, total_memory_quota, total_disk_quota, max_cpu_per_sandbox, max_memory_per_sandbox, max_disk_per_sandbox, snapshot_quota, max_snapshot_size, volume_quota, max_concurrent_snapshot_processing].hash
194
+ [total_cpu_quota, total_memory_quota, total_disk_quota, total_gpu_quota, max_cpu_per_sandbox, max_memory_per_sandbox, max_disk_per_sandbox, snapshot_quota, max_snapshot_size, volume_quota, max_concurrent_snapshot_processing].hash
186
195
  end
187
196
 
188
197
  # Builds the object from hash
@@ -63,6 +63,9 @@ module DaytonaApiClient
63
63
  # Auto-stop interval in minutes (0 means disabled)
64
64
  attr_accessor :auto_stop_interval
65
65
 
66
+ # Auto-pause interval in minutes (0 means disabled). Only supported for sandbox classes that support pausing. Not allowed for ephemeral sandboxes. At most one of autoStopInterval and autoPauseInterval may be non-zero. For non-ephemeral sandbox classes that support pausing, defaults to 60 minutes (with auto-stop disabled) when neither interval is provided.
67
+ attr_accessor :auto_pause_interval
68
+
66
69
  # Auto-archive interval in minutes (0 means the maximum interval will be used)
67
70
  attr_accessor :auto_archive_interval
68
71
 
@@ -100,6 +103,7 @@ module DaytonaApiClient
100
103
  :'memory' => :'memory',
101
104
  :'disk' => :'disk',
102
105
  :'auto_stop_interval' => :'autoStopInterval',
106
+ :'auto_pause_interval' => :'autoPauseInterval',
103
107
  :'auto_archive_interval' => :'autoArchiveInterval',
104
108
  :'auto_delete_interval' => :'autoDeleteInterval',
105
109
  :'volumes' => :'volumes',
@@ -138,6 +142,7 @@ module DaytonaApiClient
138
142
  :'memory' => :'Integer',
139
143
  :'disk' => :'Integer',
140
144
  :'auto_stop_interval' => :'Integer',
145
+ :'auto_pause_interval' => :'Integer',
141
146
  :'auto_archive_interval' => :'Integer',
142
147
  :'auto_delete_interval' => :'Integer',
143
148
  :'volumes' => :'Array<SandboxVolume>',
@@ -239,6 +244,10 @@ module DaytonaApiClient
239
244
  self.auto_stop_interval = attributes[:'auto_stop_interval']
240
245
  end
241
246
 
247
+ if attributes.key?(:'auto_pause_interval')
248
+ self.auto_pause_interval = attributes[:'auto_pause_interval']
249
+ end
250
+
242
251
  if attributes.key?(:'auto_archive_interval')
243
252
  self.auto_archive_interval = attributes[:'auto_archive_interval']
244
253
  end
@@ -304,6 +313,7 @@ module DaytonaApiClient
304
313
  memory == o.memory &&
305
314
  disk == o.disk &&
306
315
  auto_stop_interval == o.auto_stop_interval &&
316
+ auto_pause_interval == o.auto_pause_interval &&
307
317
  auto_archive_interval == o.auto_archive_interval &&
308
318
  auto_delete_interval == o.auto_delete_interval &&
309
319
  volumes == o.volumes &&
@@ -321,7 +331,7 @@ module DaytonaApiClient
321
331
  # Calculates hash code according to all attributes.
322
332
  # @return [Integer] Hash code
323
333
  def hash
324
- [name, snapshot, user, env, labels, public, network_block_all, network_allow_list, domain_allow_list, target, cpu, gpu, gpu_type, memory, disk, auto_stop_interval, auto_archive_interval, auto_delete_interval, volumes, build_info, linked_sandbox, secrets].hash
334
+ [name, snapshot, user, env, labels, public, network_block_all, network_allow_list, domain_allow_list, target, cpu, gpu, gpu_type, memory, disk, auto_stop_interval, auto_pause_interval, auto_archive_interval, auto_delete_interval, volumes, build_info, linked_sandbox, secrets].hash
325
335
  end
326
336
 
327
337
  # Builds the object from hash
@@ -27,13 +27,14 @@ module DaytonaApiClient
27
27
  INSPECT_SNAPSHOT_IN_REGISTRY = "INSPECT_SNAPSHOT_IN_REGISTRY".freeze
28
28
  REMOVE_SNAPSHOT = "REMOVE_SNAPSHOT".freeze
29
29
  UPDATE_SANDBOX_NETWORK_SETTINGS = "UPDATE_SANDBOX_NETWORK_SETTINGS".freeze
30
+ UPDATE_SANDBOX_SECRETS = "UPDATE_SANDBOX_SECRETS".freeze
30
31
  SNAPSHOT_SANDBOX = "SNAPSHOT_SANDBOX".freeze
31
32
  FORK_SANDBOX = "FORK_SANDBOX".freeze
32
33
  PAUSE_SANDBOX = "PAUSE_SANDBOX".freeze
33
34
  UNKNOWN_DEFAULT_OPEN_API = "unknown_default_open_api".freeze
34
35
 
35
36
  def self.all_vars
36
- @all_vars ||= [CREATE_SANDBOX, START_SANDBOX, STOP_SANDBOX, DESTROY_SANDBOX, RESIZE_SANDBOX, CREATE_BACKUP, BUILD_SNAPSHOT, PULL_SNAPSHOT, RECOVER_SANDBOX, INSPECT_SNAPSHOT_IN_REGISTRY, REMOVE_SNAPSHOT, UPDATE_SANDBOX_NETWORK_SETTINGS, SNAPSHOT_SANDBOX, FORK_SANDBOX, PAUSE_SANDBOX, UNKNOWN_DEFAULT_OPEN_API].freeze
37
+ @all_vars ||= [CREATE_SANDBOX, START_SANDBOX, STOP_SANDBOX, DESTROY_SANDBOX, RESIZE_SANDBOX, CREATE_BACKUP, BUILD_SNAPSHOT, PULL_SNAPSHOT, RECOVER_SANDBOX, INSPECT_SNAPSHOT_IN_REGISTRY, REMOVE_SNAPSHOT, UPDATE_SANDBOX_NETWORK_SETTINGS, UPDATE_SANDBOX_SECRETS, SNAPSHOT_SANDBOX, FORK_SANDBOX, PAUSE_SANDBOX, UNKNOWN_DEFAULT_OPEN_API].freeze
37
38
  end
38
39
 
39
40
  # Builds the enum from string
@@ -69,6 +69,9 @@ module DaytonaApiClient
69
69
  # Sandbox default network block all
70
70
  attr_accessor :sandbox_limited_network_egress
71
71
 
72
+ # Whether the proxy shows the preview URL warning page for this organization
73
+ attr_accessor :preview_warning_enabled
74
+
72
75
  # Default region ID
73
76
  attr_accessor :default_region_id
74
77
 
@@ -117,6 +120,7 @@ module DaytonaApiClient
117
120
  :'max_secrets_per_sandbox' => :'maxSecretsPerSandbox',
118
121
  :'snapshot_deactivation_timeout_minutes' => :'snapshotDeactivationTimeoutMinutes',
119
122
  :'sandbox_limited_network_egress' => :'sandboxLimitedNetworkEgress',
123
+ :'preview_warning_enabled' => :'previewWarningEnabled',
120
124
  :'default_region_id' => :'defaultRegionId',
121
125
  :'authenticated_rate_limit' => :'authenticatedRateLimit',
122
126
  :'sandbox_create_rate_limit' => :'sandboxCreateRateLimit',
@@ -160,6 +164,7 @@ module DaytonaApiClient
160
164
  :'max_secrets_per_sandbox' => :'Float',
161
165
  :'snapshot_deactivation_timeout_minutes' => :'Float',
162
166
  :'sandbox_limited_network_egress' => :'Boolean',
167
+ :'preview_warning_enabled' => :'Boolean',
163
168
  :'default_region_id' => :'String',
164
169
  :'authenticated_rate_limit' => :'Float',
165
170
  :'sandbox_create_rate_limit' => :'Float',
@@ -309,6 +314,12 @@ module DaytonaApiClient
309
314
  self.sandbox_limited_network_egress = nil
310
315
  end
311
316
 
317
+ if attributes.key?(:'preview_warning_enabled')
318
+ self.preview_warning_enabled = attributes[:'preview_warning_enabled']
319
+ else
320
+ self.preview_warning_enabled = nil
321
+ end
322
+
312
323
  if attributes.key?(:'default_region_id')
313
324
  self.default_region_id = attributes[:'default_region_id']
314
325
  end
@@ -439,6 +450,10 @@ module DaytonaApiClient
439
450
  invalid_properties.push('invalid value for "sandbox_limited_network_egress", sandbox_limited_network_egress cannot be nil.')
440
451
  end
441
452
 
453
+ if @preview_warning_enabled.nil?
454
+ invalid_properties.push('invalid value for "preview_warning_enabled", preview_warning_enabled cannot be nil.')
455
+ end
456
+
442
457
  if @experimental_config.nil?
443
458
  invalid_properties.push('invalid value for "experimental_config", experimental_config cannot be nil.')
444
459
  end
@@ -468,6 +483,7 @@ module DaytonaApiClient
468
483
  return false if @max_secrets_per_sandbox.nil?
469
484
  return false if @snapshot_deactivation_timeout_minutes.nil?
470
485
  return false if @sandbox_limited_network_egress.nil?
486
+ return false if @preview_warning_enabled.nil?
471
487
  return false if @experimental_config.nil?
472
488
  true
473
489
  end
@@ -652,6 +668,16 @@ module DaytonaApiClient
652
668
  @sandbox_limited_network_egress = sandbox_limited_network_egress
653
669
  end
654
670
 
671
+ # Custom attribute writer method with validation
672
+ # @param [Object] preview_warning_enabled Value to be assigned
673
+ def preview_warning_enabled=(preview_warning_enabled)
674
+ if preview_warning_enabled.nil?
675
+ fail ArgumentError, 'preview_warning_enabled cannot be nil'
676
+ end
677
+
678
+ @preview_warning_enabled = preview_warning_enabled
679
+ end
680
+
655
681
  # Custom attribute writer method with validation
656
682
  # @param [Object] experimental_config Value to be assigned
657
683
  def experimental_config=(experimental_config)
@@ -685,6 +711,7 @@ module DaytonaApiClient
685
711
  max_secrets_per_sandbox == o.max_secrets_per_sandbox &&
686
712
  snapshot_deactivation_timeout_minutes == o.snapshot_deactivation_timeout_minutes &&
687
713
  sandbox_limited_network_egress == o.sandbox_limited_network_egress &&
714
+ preview_warning_enabled == o.preview_warning_enabled &&
688
715
  default_region_id == o.default_region_id &&
689
716
  authenticated_rate_limit == o.authenticated_rate_limit &&
690
717
  sandbox_create_rate_limit == o.sandbox_create_rate_limit &&
@@ -705,7 +732,7 @@ module DaytonaApiClient
705
732
  # Calculates hash code according to all attributes.
706
733
  # @return [Integer] Hash code
707
734
  def hash
708
- [id, name, created_by, personal, created_at, updated_at, suspended, suspended_at, suspension_reason, suspended_until, suspension_cleanup_grace_period_hours, max_cpu_per_sandbox, max_memory_per_sandbox, max_disk_per_sandbox, secret_quota, max_secrets_per_sandbox, snapshot_deactivation_timeout_minutes, sandbox_limited_network_egress, default_region_id, authenticated_rate_limit, sandbox_create_rate_limit, sandbox_lifecycle_rate_limit, experimental_config, otel_config, authenticated_rate_limit_ttl_seconds, sandbox_create_rate_limit_ttl_seconds, sandbox_lifecycle_rate_limit_ttl_seconds].hash
735
+ [id, name, created_by, personal, created_at, updated_at, suspended, suspended_at, suspension_reason, suspended_until, suspension_cleanup_grace_period_hours, max_cpu_per_sandbox, max_memory_per_sandbox, max_disk_per_sandbox, secret_quota, max_secrets_per_sandbox, snapshot_deactivation_timeout_minutes, sandbox_limited_network_egress, preview_warning_enabled, default_region_id, authenticated_rate_limit, sandbox_create_rate_limit, sandbox_lifecycle_rate_limit, experimental_config, otel_config, authenticated_rate_limit_ttl_seconds, sandbox_create_rate_limit_ttl_seconds, sandbox_lifecycle_rate_limit_ttl_seconds].hash
709
736
  end
710
737
 
711
738
  # Builds the object from hash
@@ -0,0 +1,165 @@
1
+ =begin
2
+ #Daytona
3
+
4
+ #Daytona AI platform API Docs
5
+
6
+ The version of the OpenAPI document: 1.0
7
+ Contact: support@daytona.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.21.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module DaytonaApiClient
17
+ class OrganizationPreviewWarning < ApiModelBase
18
+ # Whether the proxy shows the preview URL warning page for this organization
19
+ attr_accessor :preview_warning_enabled
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'preview_warning_enabled' => :'previewWarningEnabled'
25
+ }
26
+ end
27
+
28
+ # Returns attribute mapping this model knows about
29
+ def self.acceptable_attribute_map
30
+ attribute_map
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ acceptable_attribute_map.values
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'preview_warning_enabled' => :'Boolean'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DaytonaApiClient::OrganizationPreviewWarning` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ acceptable_attribute_map = self.class.acceptable_attribute_map
60
+ attributes = attributes.each_with_object({}) { |(k, v), h|
61
+ if (!acceptable_attribute_map.key?(k.to_sym))
62
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DaytonaApiClient::OrganizationPreviewWarning`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
63
+ end
64
+ h[k.to_sym] = v
65
+ }
66
+
67
+ if attributes.key?(:'preview_warning_enabled')
68
+ self.preview_warning_enabled = attributes[:'preview_warning_enabled']
69
+ else
70
+ self.preview_warning_enabled = nil
71
+ end
72
+ end
73
+
74
+ # Show invalid properties with the reasons. Usually used together with valid?
75
+ # @return Array for valid properties with the reasons
76
+ def list_invalid_properties
77
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
78
+ invalid_properties = Array.new
79
+ if @preview_warning_enabled.nil?
80
+ invalid_properties.push('invalid value for "preview_warning_enabled", preview_warning_enabled cannot be nil.')
81
+ end
82
+
83
+ invalid_properties
84
+ end
85
+
86
+ # Check to see if the all the properties in the model are valid
87
+ # @return true if the model is valid
88
+ def valid?
89
+ warn '[DEPRECATED] the `valid?` method is obsolete'
90
+ return false if @preview_warning_enabled.nil?
91
+ true
92
+ end
93
+
94
+ # Custom attribute writer method with validation
95
+ # @param [Object] preview_warning_enabled Value to be assigned
96
+ def preview_warning_enabled=(preview_warning_enabled)
97
+ if preview_warning_enabled.nil?
98
+ fail ArgumentError, 'preview_warning_enabled cannot be nil'
99
+ end
100
+
101
+ @preview_warning_enabled = preview_warning_enabled
102
+ end
103
+
104
+ # Checks equality by comparing each attribute.
105
+ # @param [Object] Object to be compared
106
+ def ==(o)
107
+ return true if self.equal?(o)
108
+ self.class == o.class &&
109
+ preview_warning_enabled == o.preview_warning_enabled
110
+ end
111
+
112
+ # @see the `==` method
113
+ # @param [Object] Object to be compared
114
+ def eql?(o)
115
+ self == o
116
+ end
117
+
118
+ # Calculates hash code according to all attributes.
119
+ # @return [Integer] Hash code
120
+ def hash
121
+ [preview_warning_enabled].hash
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 self.build_from_hash(attributes)
128
+ return nil unless attributes.is_a?(Hash)
129
+ attributes = attributes.transform_keys(&:to_sym)
130
+ transformed_hash = {}
131
+ openapi_types.each_pair do |key, type|
132
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
133
+ transformed_hash["#{key}"] = nil
134
+ elsif type =~ /\AArray<(.*)>/i
135
+ # check to ensure the input is an array given that the attribute
136
+ # is documented as an array but the input is not
137
+ if attributes[attribute_map[key]].is_a?(Array)
138
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
139
+ end
140
+ elsif !attributes[attribute_map[key]].nil?
141
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
142
+ end
143
+ end
144
+ new(transformed_hash)
145
+ end
146
+
147
+ # Returns the object in the form of hash
148
+ # @return [Hash] Returns the object in the form of hash
149
+ def to_hash
150
+ hash = {}
151
+ self.class.attribute_map.each_pair do |attr, param|
152
+ value = self.send(attr)
153
+ if value.nil?
154
+ is_nullable = self.class.openapi_nullable.include?(attr)
155
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
156
+ end
157
+
158
+ hash[param] = _to_hash(value)
159
+ end
160
+ hash
161
+ end
162
+
163
+ end
164
+
165
+ end