Class: Kubernetes::V1beta1JSONSchemaProps

Inherits:
Object
  • Object
show all
Defined in:
lib/kubernetes/models/v1beta1_json_schema_props.rb

Overview

JSONSchemaProps is a JSON-Schema following Specification Draft 4 (json-schema.org/).

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ V1beta1JSONSchemaProps

Initializes the object



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 122

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.transform_keys(&:to_sym)

  self.ref = attributes[:$ref] if attributes.key?(:$ref)

  self.schema = attributes[:$schema] if attributes.key?(:$schema)

  self.additional_items = attributes[:additionalItems] if attributes.key?(:additionalItems)

  if attributes.key?(:additionalProperties)
    self.additional_properties = attributes[:additionalProperties]
  end

  if attributes.key?(:allOf) && (value = attributes[:allOf]).is_a?(Array)
    self.all_of = value
  end

  if attributes.key?(:anyOf) && (value = attributes[:anyOf]).is_a?(Array)
    self.any_of = value
  end

  self.default = attributes[:default] if attributes.key?(:default)

  if attributes.key?(:definitions) && (value = attributes[:definitions]).is_a?(Array)
    self.definitions = value
  end

  if attributes.key?(:dependencies) && (value = attributes[:dependencies]).is_a?(Array)
    self.dependencies = value
  end

  self.description = attributes[:description] if attributes.key?(:description)

  if attributes.key?(:enum) && (value = attributes[:enum]).is_a?(Array)
    self.enum = value
  end

  self.example = attributes[:example] if attributes.key?(:example)

  self.exclusive_maximum = attributes[:exclusiveMaximum] if attributes.key?(:exclusiveMaximum)

  self.exclusive_minimum = attributes[:exclusiveMinimum] if attributes.key?(:exclusiveMinimum)

  self.external_docs = attributes[:externalDocs] if attributes.key?(:externalDocs)

  self.format = attributes[:format] if attributes.key?(:format)

  self.id = attributes[:id] if attributes.key?(:id)

  self.items = attributes[:items] if attributes.key?(:items)

  self.max_items = attributes[:maxItems] if attributes.key?(:maxItems)

  self.max_length = attributes[:maxLength] if attributes.key?(:maxLength)

  self.max_properties = attributes[:maxProperties] if attributes.key?(:maxProperties)

  self.maximum = attributes[:maximum] if attributes.key?(:maximum)

  self.min_items = attributes[:minItems] if attributes.key?(:minItems)

  self.min_length = attributes[:minLength] if attributes.key?(:minLength)

  self.min_properties = attributes[:minProperties] if attributes.key?(:minProperties)

  self.minimum = attributes[:minimum] if attributes.key?(:minimum)

  self.multiple_of = attributes[:multipleOf] if attributes.key?(:multipleOf)

  self._not = attributes[:not] if attributes.key?(:not)

  if attributes.key?(:oneOf) && (value = attributes[:oneOf]).is_a?(Array)
    self.one_of = value
  end

  self.pattern = attributes[:pattern] if attributes.key?(:pattern)

  if attributes.key?(:patternProperties) && (value = attributes[:patternProperties]).is_a?(Array)
    self.pattern_properties = value
  end

  if attributes.key?(:properties) && (value = attributes[:properties]).is_a?(Array)
    self.properties = value
  end

  if attributes.key?(:required) && (value = attributes[:required]).is_a?(Array)
    self.required = value
  end

  self.title = attributes[:title] if attributes.key?(:title)

  self.type = attributes[:type] if attributes.key?(:type)

  return unless attributes.key?(:uniqueItems)

  self.unique_items = attributes[:uniqueItems]
end

Instance Attribute Details

#_notObject

Returns the value of attribute _not.



18
19
20
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 18

def _not
  @_not
end

#additional_itemsObject

JSONSchemaPropsOrBool represents JSONSchemaProps or a boolean value. Defaults to true for the boolean property.



22
23
24
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 22

def additional_items
  @additional_items
end

#additional_propertiesObject

JSONSchemaPropsOrBool represents JSONSchemaProps or a boolean value. Defaults to true for the boolean property.



25
26
27
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 25

def additional_properties
  @additional_properties
end

#all_ofObject

Returns the value of attribute all_of.



18
19
20
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 18

def all_of
  @all_of
end

#any_ofObject

Returns the value of attribute any_of.



18
19
20
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 18

def any_of
  @any_of
end

#defaultObject

JSON represents any valid JSON value. These types are supported: bool, int64, float64, string, []interface{}, mapinterface{} and nil.



28
29
30
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 28

def default
  @default
end

#definitionsObject

Returns the value of attribute definitions.



18
19
20
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 18

def definitions
  @definitions
end

#dependenciesObject

Returns the value of attribute dependencies.



18
19
20
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 18

def dependencies
  @dependencies
end

#descriptionObject

Returns the value of attribute description.



18
19
20
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 18

def description
  @description
end

#enumObject

Returns the value of attribute enum.



18
19
20
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 18

def enum
  @enum
end

#exampleObject

JSON represents any valid JSON value. These types are supported: bool, int64, float64, string, []interface{}, mapinterface{} and nil.



31
32
33
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 31

def example
  @example
end

#exclusive_maximumObject

Returns the value of attribute exclusive_maximum.



18
19
20
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 18

def exclusive_maximum
  @exclusive_maximum
end

#exclusive_minimumObject

Returns the value of attribute exclusive_minimum.



18
19
20
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 18

def exclusive_minimum
  @exclusive_minimum
end

#external_docsObject

Returns the value of attribute external_docs.



18
19
20
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 18

def external_docs
  @external_docs
end

#formatObject

Returns the value of attribute format.



18
19
20
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 18

def format
  @format
end

#idObject

Returns the value of attribute id.



18
19
20
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 18

def id
  @id
end

#itemsObject

JSONSchemaPropsOrArray represents a value that can either be a JSONSchemaProps or an array of JSONSchemaProps. Mainly here for serialization purposes.



34
35
36
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 34

def items
  @items
end

#max_itemsObject

Returns the value of attribute max_items.



18
19
20
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 18

def max_items
  @max_items
end

#max_lengthObject

Returns the value of attribute max_length.



18
19
20
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 18

def max_length
  @max_length
end

#max_propertiesObject

Returns the value of attribute max_properties.



18
19
20
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 18

def max_properties
  @max_properties
end

#maximumObject

Returns the value of attribute maximum.



18
19
20
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 18

def maximum
  @maximum
end

#min_itemsObject

Returns the value of attribute min_items.



18
19
20
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 18

def min_items
  @min_items
end

#min_lengthObject

Returns the value of attribute min_length.



18
19
20
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 18

def min_length
  @min_length
end

#min_propertiesObject

Returns the value of attribute min_properties.



18
19
20
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 18

def min_properties
  @min_properties
end

#minimumObject

Returns the value of attribute minimum.



18
19
20
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 18

def minimum
  @minimum
end

#multiple_ofObject

Returns the value of attribute multiple_of.



18
19
20
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 18

def multiple_of
  @multiple_of
end

#one_ofObject

Returns the value of attribute one_of.



18
19
20
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 18

def one_of
  @one_of
end

#patternObject

Returns the value of attribute pattern.



18
19
20
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 18

def pattern
  @pattern
end

#pattern_propertiesObject

Returns the value of attribute pattern_properties.



18
19
20
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 18

def pattern_properties
  @pattern_properties
end

#propertiesObject

Returns the value of attribute properties.



18
19
20
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 18

def properties
  @properties
end

#refObject

Returns the value of attribute ref.



18
19
20
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 18

def ref
  @ref
end

#requiredObject

Returns the value of attribute required.



18
19
20
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 18

def required
  @required
end

#schemaObject

Returns the value of attribute schema.



18
19
20
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 18

def schema
  @schema
end

#titleObject

Returns the value of attribute title.



18
19
20
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 18

def title
  @title
end

#typeObject

Returns the value of attribute type.



18
19
20
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 18

def type
  @type
end

#unique_itemsObject

Returns the value of attribute unique_items.



18
19
20
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 18

def unique_items
  @unique_items
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 37

def self.attribute_map
  {
    ref: :$ref,
    schema: :$schema,
    additional_items: :additionalItems,
    additional_properties: :additionalProperties,
    all_of: :allOf,
    any_of: :anyOf,
    default: :default,
    definitions: :definitions,
    dependencies: :dependencies,
    description: :description,
    enum: :enum,
    example: :example,
    exclusive_maximum: :exclusiveMaximum,
    exclusive_minimum: :exclusiveMinimum,
    external_docs: :externalDocs,
    format: :format,
    id: :id,
    items: :items,
    max_items: :maxItems,
    max_length: :maxLength,
    max_properties: :maxProperties,
    maximum: :maximum,
    min_items: :minItems,
    min_length: :minLength,
    min_properties: :minProperties,
    minimum: :minimum,
    multiple_of: :multipleOf,
    _not: :not,
    one_of: :oneOf,
    pattern: :pattern,
    pattern_properties: :patternProperties,
    properties: :properties,
    required: :required,
    title: :title,
    type: :type,
    unique_items: :uniqueItems
  }
end

.swagger_typesObject

Attribute type mapping.



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 79

def self.swagger_types
  {
    ref: :String,
    schema: :String,
    additional_items: :Object,
    additional_properties: :Object,
    all_of: :'Array<V1beta1JSONSchemaProps>',
    any_of: :'Array<V1beta1JSONSchemaProps>',
    default: :Object,
    definitions: :'Hash<String, V1beta1JSONSchemaProps>',
    dependencies: :'Hash<String, Object>',
    description: :String,
    enum: :'Array<Object>',
    example: :Object,
    exclusive_maximum: :BOOLEAN,
    exclusive_minimum: :BOOLEAN,
    external_docs: :V1beta1ExternalDocumentation,
    format: :String,
    id: :String,
    items: :Object,
    max_items: :Integer,
    max_length: :Integer,
    max_properties: :Integer,
    maximum: :Float,
    min_items: :Integer,
    min_length: :Integer,
    min_properties: :Integer,
    minimum: :Float,
    multiple_of: :Float,
    _not: :V1beta1JSONSchemaProps,
    one_of: :'Array<V1beta1JSONSchemaProps>',
    pattern: :String,
    pattern_properties: :'Hash<String, V1beta1JSONSchemaProps>',
    properties: :'Hash<String, V1beta1JSONSchemaProps>',
    required: :'Array<String>',
    title: :String,
    type: :String,
    unique_items: :BOOLEAN
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 237

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    ref == other.ref &&
    schema == other.schema &&
    additional_items == other.additional_items &&
    additional_properties == other.additional_properties &&
    all_of == other.all_of &&
    any_of == other.any_of &&
    default == other.default &&
    definitions == other.definitions &&
    dependencies == other.dependencies &&
    description == other.description &&
    enum == other.enum &&
    example == other.example &&
    exclusive_maximum == other.exclusive_maximum &&
    exclusive_minimum == other.exclusive_minimum &&
    external_docs == other.external_docs &&
    format == other.format &&
    id == other.id &&
    items == other.items &&
    max_items == other.max_items &&
    max_length == other.max_length &&
    max_properties == other.max_properties &&
    maximum == other.maximum &&
    min_items == other.min_items &&
    min_length == other.min_length &&
    min_properties == other.min_properties &&
    minimum == other.minimum &&
    multiple_of == other.multiple_of &&
    _not == other._not &&
    one_of == other.one_of &&
    pattern == other.pattern &&
    pattern_properties == other.pattern_properties &&
    properties == other.properties &&
    required == other.required &&
    title == other.title &&
    type == other.type &&
    unique_items == other.unique_items
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type



319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 319

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :BOOLEAN
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    temp_model = Kubernetes.const_get(type).new
    temp_model.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value



386
387
388
389
390
391
392
393
394
395
396
397
398
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 386

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash



295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 295

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        send("#{key}=", attributes[self.class.attribute_map[key]].map do |v|
                          _deserialize(Regexp.last_match(1), v)
                        end)
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end
  end

  self
end

#eql?(other) ⇒ Boolean

See Also:

  • `==` method


281
282
283
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 281

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.



287
288
289
290
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 287

def hash
  [ref, schema, additional_items, additional_properties, all_of, any_of, default, definitions,
   dependencies, description, enum, example, exclusive_maximum, exclusive_minimum, external_docs, format, id, items, max_items, max_length, max_properties, maximum, min_items, min_length, min_properties, minimum, multiple_of, _not, one_of, pattern, pattern_properties, properties, required, title, type, unique_items].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?



225
226
227
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 225

def list_invalid_properties
  []
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)



365
366
367
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 365

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash



371
372
373
374
375
376
377
378
379
380
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 371

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = send(attr)
    next if value.nil?

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object



359
360
361
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 359

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid



231
232
233
# File 'lib/kubernetes/models/v1beta1_json_schema_props.rb', line 231

def valid?
  true
end