volcano-sdk 0.9.4 → 0.10.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/README.md +69 -0
- data/lib/volcano/client.rb +2 -1
- data/lib/volcano/durable.rb +136 -0
- data/lib/volcano/durable_models.rb +143 -0
- data/lib/volcano/generated/lib/volcano-generated/api/databases_api.rb +2 -2
- data/lib/volcano/generated/lib/volcano-generated/api/durable_functions_api.rb +1239 -0
- data/lib/volcano/generated/lib/volcano-generated/api/frontends_api.rb +2 -2
- data/lib/volcano/generated/lib/volcano-generated/api/functions_api.rb +18 -6
- data/lib/volcano/generated/lib/volcano-generated/api/o_auth_authentication_api.rb +2 -2
- data/lib/volcano/generated/lib/volcano-generated/api/projects_api.rb +76 -2
- data/lib/volcano/generated/lib/volcano-generated/models/create_database_request.rb +6 -8
- data/lib/volcano/generated/lib/volcano-generated/models/create_variable_request.rb +11 -1
- data/lib/volcano/generated/lib/volcano-generated/models/durable_execution.rb +358 -0
- data/lib/volcano/generated/lib/volcano-generated/models/durable_execution_error.rb +157 -0
- data/lib/volcano/generated/lib/volcano-generated/models/durable_execution_status.rb +45 -0
- data/lib/volcano/generated/lib/volcano-generated/models/durable_function.rb +479 -0
- data/lib/volcano/generated/lib/volcano-generated/models/durable_function_config.rb +193 -0
- data/lib/volcano/generated/lib/volcano-generated/models/function_kind.rb +40 -0
- data/lib/volcano/generated/lib/volcano-generated/models/function_runtime_option.rb +28 -1
- data/lib/volcano/generated/lib/volcano-generated/models/function_scheduler.rb +11 -1
- data/lib/volcano/generated/lib/volcano-generated/models/list_database_regions200_response_inner.rb +1 -1
- data/lib/volcano/generated/lib/volcano-generated/models/metric_usage_data.rb +1 -1
- data/lib/volcano/generated/lib/volcano-generated/models/paginated_durable_executions.rb +274 -0
- data/lib/volcano/generated/lib/volcano-generated/models/paginated_durable_functions.rb +274 -0
- data/lib/volcano/generated/lib/volcano-generated/models/project_config.rb +23 -1
- data/lib/volcano/generated/lib/volcano-generated/models/project_config_function.rb +47 -2
- data/lib/volcano/generated/lib/volcano-generated/models/project_config_variable.rb +11 -1
- data/lib/volcano/generated/lib/volcano-generated/models/project_deployment_resource.rb +14 -4
- data/lib/volcano/generated/lib/volcano-generated/models/project_health_resource.rb +14 -4
- data/lib/volcano/generated/lib/volcano-generated/models/replace_shared_variables_request.rb +237 -0
- data/lib/volcano/generated/lib/volcano-generated/models/update_variable_request.rb +11 -1
- data/lib/volcano/generated/lib/volcano-generated/models/variable.rb +11 -1
- data/lib/volcano/generated/lib/volcano-generated.rb +10 -0
- data/lib/volcano/generated_transport.rb +2 -1
- data/lib/volcano/generated_transport_durable.rb +50 -0
- data/lib/volcano/generated_transport_support.rb +1 -0
- data/lib/volcano/version.rb +1 -1
- data/lib/volcano.rb +2 -0
- metadata +14 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Volcano Hosting API
|
|
3
|
+
|
|
4
|
+
#Public API for Volcano Hosting clients, SDKs, and CLI tooling (Port 8000). This specification intentionally excludes first-party/internal APIs. See api/openapi-internal.yaml for non-public internal and Builder operations.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 3.0.0
|
|
7
|
+
Contact: support@volcano.dev
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.17.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module Volcano::Generated
|
|
17
|
+
class FunctionKind
|
|
18
|
+
STANDARD = "standard".freeze
|
|
19
|
+
DURABLE = "durable".freeze
|
|
20
|
+
|
|
21
|
+
def self.all_vars
|
|
22
|
+
@all_vars ||= [STANDARD, DURABLE].freeze
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Builds the enum from string
|
|
26
|
+
# @param [String] The enum value in the form of the string
|
|
27
|
+
# @return [String] The enum value
|
|
28
|
+
def self.build_from_hash(value)
|
|
29
|
+
new.build_from_hash(value)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Builds the enum from string
|
|
33
|
+
# @param [String] The enum value in the form of the string
|
|
34
|
+
# @return [String] The enum value
|
|
35
|
+
def build_from_hash(value)
|
|
36
|
+
return value if FunctionKind.all_vars.include?(value)
|
|
37
|
+
raise "Invalid ENUM value #{value} for class #FunctionKind"
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -24,6 +24,9 @@ module Volcano::Generated
|
|
|
24
24
|
# Whether this runtime is the CLI default for its language.
|
|
25
25
|
attr_accessor :default
|
|
26
26
|
|
|
27
|
+
# Whether a durable function can be authored on this runtime. Only runtimes with a durable authoring API report true, and a durable deploy naming any other runtime is rejected.
|
|
28
|
+
attr_accessor :durable_capable
|
|
29
|
+
|
|
27
30
|
attr_accessor :deployment
|
|
28
31
|
|
|
29
32
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
@@ -32,6 +35,7 @@ module Volcano::Generated
|
|
|
32
35
|
:'name' => :'name',
|
|
33
36
|
:'language' => :'language',
|
|
34
37
|
:'default' => :'default',
|
|
38
|
+
:'durable_capable' => :'durable_capable',
|
|
35
39
|
:'deployment' => :'deployment'
|
|
36
40
|
}
|
|
37
41
|
end
|
|
@@ -52,6 +56,7 @@ module Volcano::Generated
|
|
|
52
56
|
:'name' => :'String',
|
|
53
57
|
:'language' => :'String',
|
|
54
58
|
:'default' => :'Boolean',
|
|
59
|
+
:'durable_capable' => :'Boolean',
|
|
55
60
|
:'deployment' => :'FunctionRuntimeDeployment'
|
|
56
61
|
}
|
|
57
62
|
end
|
|
@@ -96,6 +101,12 @@ module Volcano::Generated
|
|
|
96
101
|
self.default = nil
|
|
97
102
|
end
|
|
98
103
|
|
|
104
|
+
if attributes.key?(:'durable_capable')
|
|
105
|
+
self.durable_capable = attributes[:'durable_capable']
|
|
106
|
+
else
|
|
107
|
+
self.durable_capable = nil
|
|
108
|
+
end
|
|
109
|
+
|
|
99
110
|
if attributes.key?(:'deployment')
|
|
100
111
|
self.deployment = attributes[:'deployment']
|
|
101
112
|
else
|
|
@@ -120,6 +131,10 @@ module Volcano::Generated
|
|
|
120
131
|
invalid_properties.push('invalid value for "default", default cannot be nil.')
|
|
121
132
|
end
|
|
122
133
|
|
|
134
|
+
if @durable_capable.nil?
|
|
135
|
+
invalid_properties.push('invalid value for "durable_capable", durable_capable cannot be nil.')
|
|
136
|
+
end
|
|
137
|
+
|
|
123
138
|
if @deployment.nil?
|
|
124
139
|
invalid_properties.push('invalid value for "deployment", deployment cannot be nil.')
|
|
125
140
|
end
|
|
@@ -134,6 +149,7 @@ module Volcano::Generated
|
|
|
134
149
|
return false if @name.nil?
|
|
135
150
|
return false if @language.nil?
|
|
136
151
|
return false if @default.nil?
|
|
152
|
+
return false if @durable_capable.nil?
|
|
137
153
|
return false if @deployment.nil?
|
|
138
154
|
true
|
|
139
155
|
end
|
|
@@ -168,6 +184,16 @@ module Volcano::Generated
|
|
|
168
184
|
@default = default
|
|
169
185
|
end
|
|
170
186
|
|
|
187
|
+
# Custom attribute writer method with validation
|
|
188
|
+
# @param [Object] durable_capable Value to be assigned
|
|
189
|
+
def durable_capable=(durable_capable)
|
|
190
|
+
if durable_capable.nil?
|
|
191
|
+
fail ArgumentError, 'durable_capable cannot be nil'
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
@durable_capable = durable_capable
|
|
195
|
+
end
|
|
196
|
+
|
|
171
197
|
# Custom attribute writer method with validation
|
|
172
198
|
# @param [Object] deployment Value to be assigned
|
|
173
199
|
def deployment=(deployment)
|
|
@@ -186,6 +212,7 @@ module Volcano::Generated
|
|
|
186
212
|
name == o.name &&
|
|
187
213
|
language == o.language &&
|
|
188
214
|
default == o.default &&
|
|
215
|
+
durable_capable == o.durable_capable &&
|
|
189
216
|
deployment == o.deployment
|
|
190
217
|
end
|
|
191
218
|
|
|
@@ -198,7 +225,7 @@ module Volcano::Generated
|
|
|
198
225
|
# Calculates hash code according to all attributes.
|
|
199
226
|
# @return [Integer] Hash code
|
|
200
227
|
def hash
|
|
201
|
-
[name, language, default, deployment].hash
|
|
228
|
+
[name, language, default, durable_capable, deployment].hash
|
|
202
229
|
end
|
|
203
230
|
|
|
204
231
|
# Builds the object from hash
|
|
@@ -21,6 +21,9 @@ module Volcano::Generated
|
|
|
21
21
|
|
|
22
22
|
attr_accessor :function_id
|
|
23
23
|
|
|
24
|
+
# Which collection the scheduled function belongs to. A project-wide scheduler list mixes both kinds, and this is what says whether the function is read back from `/projects/{id}/functions` or `/projects/{id}/durable-functions` — and whether a tick invokes it or starts a durable execution.
|
|
25
|
+
attr_accessor :function_kind
|
|
26
|
+
|
|
24
27
|
attr_accessor :name
|
|
25
28
|
|
|
26
29
|
attr_accessor :enabled
|
|
@@ -78,6 +81,7 @@ module Volcano::Generated
|
|
|
78
81
|
:'id' => :'id',
|
|
79
82
|
:'project_id' => :'project_id',
|
|
80
83
|
:'function_id' => :'function_id',
|
|
84
|
+
:'function_kind' => :'function_kind',
|
|
81
85
|
:'name' => :'name',
|
|
82
86
|
:'enabled' => :'enabled',
|
|
83
87
|
:'schedule_kind' => :'schedule_kind',
|
|
@@ -111,6 +115,7 @@ module Volcano::Generated
|
|
|
111
115
|
:'id' => :'String',
|
|
112
116
|
:'project_id' => :'String',
|
|
113
117
|
:'function_id' => :'String',
|
|
118
|
+
:'function_kind' => :'FunctionKind',
|
|
114
119
|
:'name' => :'String',
|
|
115
120
|
:'enabled' => :'Boolean',
|
|
116
121
|
:'schedule_kind' => :'String',
|
|
@@ -162,6 +167,10 @@ module Volcano::Generated
|
|
|
162
167
|
self.function_id = attributes[:'function_id']
|
|
163
168
|
end
|
|
164
169
|
|
|
170
|
+
if attributes.key?(:'function_kind')
|
|
171
|
+
self.function_kind = attributes[:'function_kind']
|
|
172
|
+
end
|
|
173
|
+
|
|
165
174
|
if attributes.key?(:'name')
|
|
166
175
|
self.name = attributes[:'name']
|
|
167
176
|
end
|
|
@@ -258,6 +267,7 @@ module Volcano::Generated
|
|
|
258
267
|
id == o.id &&
|
|
259
268
|
project_id == o.project_id &&
|
|
260
269
|
function_id == o.function_id &&
|
|
270
|
+
function_kind == o.function_kind &&
|
|
261
271
|
name == o.name &&
|
|
262
272
|
enabled == o.enabled &&
|
|
263
273
|
schedule_kind == o.schedule_kind &&
|
|
@@ -283,7 +293,7 @@ module Volcano::Generated
|
|
|
283
293
|
# Calculates hash code according to all attributes.
|
|
284
294
|
# @return [Integer] Hash code
|
|
285
295
|
def hash
|
|
286
|
-
[id, project_id, function_id, name, enabled, schedule_kind, cron_expression, payload, regions, regions_explicit, next_run_at, last_started_at, last_completed_at, last_error, run_count, created_at, updated_at].hash
|
|
296
|
+
[id, project_id, function_id, function_kind, name, enabled, schedule_kind, cron_expression, payload, regions, regions_explicit, next_run_at, last_started_at, last_completed_at, last_error, run_count, created_at, updated_at].hash
|
|
287
297
|
end
|
|
288
298
|
|
|
289
299
|
# Builds the object from hash
|
|
@@ -16,7 +16,7 @@ require 'time'
|
|
|
16
16
|
module Volcano::Generated
|
|
17
17
|
# Usage data for one metric across totals, daily, and hourly windows.
|
|
18
18
|
class MetricUsageData < ApiModelBase
|
|
19
|
-
# Metric name (for example, \"Function & Frontend Invocations\", \"Frontend Requests\", \"CodeBuild Build Seconds\", \"Bandwidth Ingress (Bytes)\", \"Bandwidth Egress (Bytes)\", \"Bandwidth Total (Bytes)\", or \"Database Storage (Bytes)\"). Byte-based metrics are reported in bytes. \"Bandwidth Total (Bytes)\" is derived (ingress + egress) and is not billed separately. \"Database Storage (Bytes)\" is a current observed gauge, not a cumulative counter. It is the sum of the latest samples exposed as `storage_bytes` by the project's database list, so it includes what each database's branches and backups hold, and it inherits that field's lag behind a live measurement.
|
|
19
|
+
# Metric name (for example, \"Function & Frontend Invocations\", \"Frontend Requests\", \"Durable Executions\", \"Durable Operations\", \"Durable Compute (MB-Seconds)\", \"CodeBuild Build Seconds\", \"Bandwidth Ingress (Bytes)\", \"Bandwidth Egress (Bytes)\", \"Bandwidth Total (Bytes)\", or \"Database Storage (Bytes)\"). Byte-based metrics are reported in bytes. \"Bandwidth Total (Bytes)\" is derived (ingress + egress) and is not billed separately. The three durable metrics are counted separately from \"Function & Frontend Invocations\", which covers standard invocations only. Operations and compute are counted when an execution finishes, so they appear in the window the execution completed in rather than the one it started in. \"Durable Compute (MB-Seconds)\" reports the memory the execution ran at times the time it spent running, in megabyte-seconds; the allowance for it is published in gigabyte-seconds, which is 1024 of these. \"Database Storage (Bytes)\" is a current observed gauge, not a cumulative counter. It is the sum of the latest samples exposed as `storage_bytes` by the project's database list, so it includes what each database's branches and backups hold, and it inherits that field's lag behind a live measurement.
|
|
20
20
|
attr_accessor :metric
|
|
21
21
|
|
|
22
22
|
# Total usage for the current usage month
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Volcano Hosting API
|
|
3
|
+
|
|
4
|
+
#Public API for Volcano Hosting clients, SDKs, and CLI tooling (Port 8000). This specification intentionally excludes first-party/internal APIs. See api/openapi-internal.yaml for non-public internal and Builder operations.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 3.0.0
|
|
7
|
+
Contact: support@volcano.dev
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.17.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module Volcano::Generated
|
|
17
|
+
class PaginatedDurableExecutions < ApiModelBase
|
|
18
|
+
attr_accessor :data
|
|
19
|
+
|
|
20
|
+
# Current page number (1-indexed)
|
|
21
|
+
attr_accessor :page
|
|
22
|
+
|
|
23
|
+
# Number of items per page
|
|
24
|
+
attr_accessor :limit
|
|
25
|
+
|
|
26
|
+
# Total number of items across all pages
|
|
27
|
+
attr_accessor :total
|
|
28
|
+
|
|
29
|
+
# Whether there are more pages available
|
|
30
|
+
attr_accessor :has_more
|
|
31
|
+
|
|
32
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
33
|
+
def self.attribute_map
|
|
34
|
+
{
|
|
35
|
+
:'data' => :'data',
|
|
36
|
+
:'page' => :'page',
|
|
37
|
+
:'limit' => :'limit',
|
|
38
|
+
:'total' => :'total',
|
|
39
|
+
:'has_more' => :'has_more'
|
|
40
|
+
}
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Returns attribute mapping this model knows about
|
|
44
|
+
def self.acceptable_attribute_map
|
|
45
|
+
attribute_map
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Returns all the JSON keys this model knows about
|
|
49
|
+
def self.acceptable_attributes
|
|
50
|
+
acceptable_attribute_map.values
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Attribute type mapping.
|
|
54
|
+
def self.openapi_types
|
|
55
|
+
{
|
|
56
|
+
:'data' => :'Array<DurableExecution>',
|
|
57
|
+
:'page' => :'Integer',
|
|
58
|
+
:'limit' => :'Integer',
|
|
59
|
+
:'total' => :'Integer',
|
|
60
|
+
:'has_more' => :'Boolean'
|
|
61
|
+
}
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# List of attributes with nullable: true
|
|
65
|
+
def self.openapi_nullable
|
|
66
|
+
Set.new([
|
|
67
|
+
])
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Initializes the object
|
|
71
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
72
|
+
def initialize(attributes = {})
|
|
73
|
+
if (!attributes.is_a?(Hash))
|
|
74
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Volcano::Generated::PaginatedDurableExecutions` initialize method"
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
78
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
79
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
80
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
81
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Volcano::Generated::PaginatedDurableExecutions`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
82
|
+
end
|
|
83
|
+
h[k.to_sym] = v
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if attributes.key?(:'data')
|
|
87
|
+
if (value = attributes[:'data']).is_a?(Array)
|
|
88
|
+
self.data = value
|
|
89
|
+
end
|
|
90
|
+
else
|
|
91
|
+
self.data = nil
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
if attributes.key?(:'page')
|
|
95
|
+
self.page = attributes[:'page']
|
|
96
|
+
else
|
|
97
|
+
self.page = nil
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
if attributes.key?(:'limit')
|
|
101
|
+
self.limit = attributes[:'limit']
|
|
102
|
+
else
|
|
103
|
+
self.limit = nil
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
if attributes.key?(:'total')
|
|
107
|
+
self.total = attributes[:'total']
|
|
108
|
+
else
|
|
109
|
+
self.total = nil
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
if attributes.key?(:'has_more')
|
|
113
|
+
self.has_more = attributes[:'has_more']
|
|
114
|
+
else
|
|
115
|
+
self.has_more = nil
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
120
|
+
# @return Array for valid properties with the reasons
|
|
121
|
+
def list_invalid_properties
|
|
122
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
123
|
+
invalid_properties = Array.new
|
|
124
|
+
if @data.nil?
|
|
125
|
+
invalid_properties.push('invalid value for "data", data cannot be nil.')
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
if @page.nil?
|
|
129
|
+
invalid_properties.push('invalid value for "page", page cannot be nil.')
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
if @limit.nil?
|
|
133
|
+
invalid_properties.push('invalid value for "limit", limit cannot be nil.')
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
if @total.nil?
|
|
137
|
+
invalid_properties.push('invalid value for "total", total cannot be nil.')
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
if @has_more.nil?
|
|
141
|
+
invalid_properties.push('invalid value for "has_more", has_more cannot be nil.')
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
invalid_properties
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
# Check to see if the all the properties in the model are valid
|
|
148
|
+
# @return true if the model is valid
|
|
149
|
+
def valid?
|
|
150
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
151
|
+
return false if @data.nil?
|
|
152
|
+
return false if @page.nil?
|
|
153
|
+
return false if @limit.nil?
|
|
154
|
+
return false if @total.nil?
|
|
155
|
+
return false if @has_more.nil?
|
|
156
|
+
true
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
# Custom attribute writer method with validation
|
|
160
|
+
# @param [Object] data Value to be assigned
|
|
161
|
+
def data=(data)
|
|
162
|
+
if data.nil?
|
|
163
|
+
fail ArgumentError, 'data cannot be nil'
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
@data = data
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
# Custom attribute writer method with validation
|
|
170
|
+
# @param [Object] page Value to be assigned
|
|
171
|
+
def page=(page)
|
|
172
|
+
if page.nil?
|
|
173
|
+
fail ArgumentError, 'page cannot be nil'
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
@page = page
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
# Custom attribute writer method with validation
|
|
180
|
+
# @param [Object] limit Value to be assigned
|
|
181
|
+
def limit=(limit)
|
|
182
|
+
if limit.nil?
|
|
183
|
+
fail ArgumentError, 'limit cannot be nil'
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
@limit = limit
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
# Custom attribute writer method with validation
|
|
190
|
+
# @param [Object] total Value to be assigned
|
|
191
|
+
def total=(total)
|
|
192
|
+
if total.nil?
|
|
193
|
+
fail ArgumentError, 'total cannot be nil'
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
@total = total
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
# Custom attribute writer method with validation
|
|
200
|
+
# @param [Object] has_more Value to be assigned
|
|
201
|
+
def has_more=(has_more)
|
|
202
|
+
if has_more.nil?
|
|
203
|
+
fail ArgumentError, 'has_more cannot be nil'
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
@has_more = has_more
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
# Checks equality by comparing each attribute.
|
|
210
|
+
# @param [Object] Object to be compared
|
|
211
|
+
def ==(o)
|
|
212
|
+
return true if self.equal?(o)
|
|
213
|
+
self.class == o.class &&
|
|
214
|
+
data == o.data &&
|
|
215
|
+
page == o.page &&
|
|
216
|
+
limit == o.limit &&
|
|
217
|
+
total == o.total &&
|
|
218
|
+
has_more == o.has_more
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
# @see the `==` method
|
|
222
|
+
# @param [Object] Object to be compared
|
|
223
|
+
def eql?(o)
|
|
224
|
+
self == o
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
# Calculates hash code according to all attributes.
|
|
228
|
+
# @return [Integer] Hash code
|
|
229
|
+
def hash
|
|
230
|
+
[data, page, limit, total, has_more].hash
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
# Builds the object from hash
|
|
234
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
235
|
+
# @return [Object] Returns the model itself
|
|
236
|
+
def self.build_from_hash(attributes)
|
|
237
|
+
return nil unless attributes.is_a?(Hash)
|
|
238
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
239
|
+
transformed_hash = {}
|
|
240
|
+
openapi_types.each_pair do |key, type|
|
|
241
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
242
|
+
transformed_hash["#{key}"] = nil
|
|
243
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
244
|
+
# check to ensure the input is an array given that the attribute
|
|
245
|
+
# is documented as an array but the input is not
|
|
246
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
247
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
248
|
+
end
|
|
249
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
250
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
251
|
+
end
|
|
252
|
+
end
|
|
253
|
+
new(transformed_hash)
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
# Returns the object in the form of hash
|
|
257
|
+
# @return [Hash] Returns the object in the form of hash
|
|
258
|
+
def to_hash
|
|
259
|
+
hash = {}
|
|
260
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
261
|
+
value = self.send(attr)
|
|
262
|
+
if value.nil?
|
|
263
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
264
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
hash[param] = _to_hash(value)
|
|
268
|
+
end
|
|
269
|
+
hash
|
|
270
|
+
end
|
|
271
|
+
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
end
|