Class: Kubevirt::V1KubeVirtSpec

Inherits:
ApiModelBase show all
Defined in:
lib/kubevirt/models/v1_kube_virt_spec.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ V1KubeVirtSpec

Initializes the object



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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# File 'lib/kubevirt/models/v1_kube_virt_spec.rb', line 154

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Kubevirt::V1KubeVirtSpec` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Kubevirt::V1KubeVirtSpec`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'certificate_rotate_strategy')
    self.certificate_rotate_strategy = attributes[:'certificate_rotate_strategy']
  end

  if attributes.key?(:'configuration')
    self.configuration = attributes[:'configuration']
  end

  if attributes.key?(:'customize_components')
    self.customize_components = attributes[:'customize_components']
  end

  if attributes.key?(:'image_pull_policy')
    self.image_pull_policy = attributes[:'image_pull_policy']
  end

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

  if attributes.key?(:'image_registry')
    self.image_registry = attributes[:'image_registry']
  end

  if attributes.key?(:'image_tag')
    self.image_tag = attributes[:'image_tag']
  end

  if attributes.key?(:'infra')
    self.infra = attributes[:'infra']
  end

  if attributes.key?(:'monitor_account')
    self. = attributes[:'monitor_account']
  end

  if attributes.key?(:'monitor_namespace')
    self.monitor_namespace = attributes[:'monitor_namespace']
  end

  if attributes.key?(:'product_component')
    self.product_component = attributes[:'product_component']
  end

  if attributes.key?(:'product_name')
    self.product_name = attributes[:'product_name']
  end

  if attributes.key?(:'product_version')
    self.product_version = attributes[:'product_version']
  end

  if attributes.key?(:'service_monitor_namespace')
    self.service_monitor_namespace = attributes[:'service_monitor_namespace']
  end

  if attributes.key?(:'synchronization_port')
    self.synchronization_port = attributes[:'synchronization_port']
  end

  if attributes.key?(:'uninstall_strategy')
    self.uninstall_strategy = attributes[:'uninstall_strategy']
  end

  if attributes.key?(:'workload_update_strategy')
    self.workload_update_strategy = attributes[:'workload_update_strategy']
  end

  if attributes.key?(:'workloads')
    self.workloads = attributes[:'workloads']
  end
end

Instance Attribute Details

#certificate_rotate_strategyObject

Returns the value of attribute certificate_rotate_strategy.



18
19
20
# File 'lib/kubevirt/models/v1_kube_virt_spec.rb', line 18

def certificate_rotate_strategy
  @certificate_rotate_strategy
end

#configurationObject

Returns the value of attribute configuration.



20
21
22
# File 'lib/kubevirt/models/v1_kube_virt_spec.rb', line 20

def configuration
  @configuration
end

#customize_componentsObject

Returns the value of attribute customize_components.



22
23
24
# File 'lib/kubevirt/models/v1_kube_virt_spec.rb', line 22

def customize_components
  @customize_components
end

#image_pull_policyObject

The ImagePullPolicy to use. Possible enum values: - ‘"Always"` means that kubelet always attempts to pull the latest image. Container will fail If the pull fails. - `"IfNotPresent"` means that kubelet pulls if the image isn’t present on disk. Container will fail if the image isn’t present and the pull fails. - ‘"Never"` means that kubelet never pulls an image, but only uses a local image. Container will fail if the image isn’t present



25
26
27
# File 'lib/kubevirt/models/v1_kube_virt_spec.rb', line 25

def image_pull_policy
  @image_pull_policy
end

#image_pull_secretsObject

The imagePullSecrets to pull the container images from Defaults to none



28
29
30
# File 'lib/kubevirt/models/v1_kube_virt_spec.rb', line 28

def image_pull_secrets
  @image_pull_secrets
end

#image_registryObject

The image registry to pull the container images from Defaults to the same registry the operator’s container image is pulled from.



31
32
33
# File 'lib/kubevirt/models/v1_kube_virt_spec.rb', line 31

def image_registry
  @image_registry
end

#image_tagObject

The image tag to use for the continer images installed. Defaults to the same tag as the operator’s container image.



34
35
36
# File 'lib/kubevirt/models/v1_kube_virt_spec.rb', line 34

def image_tag
  @image_tag
end

#infraObject

Returns the value of attribute infra.



36
37
38
# File 'lib/kubevirt/models/v1_kube_virt_spec.rb', line 36

def infra
  @infra
end

#monitor_accountObject

The name of the Prometheus service account that needs read-access to KubeVirt endpoints Defaults to prometheus-k8s



39
40
41
# File 'lib/kubevirt/models/v1_kube_virt_spec.rb', line 39

def 
  
end

#monitor_namespaceObject

The namespace Prometheus is deployed in Defaults to openshift-monitor



42
43
44
# File 'lib/kubevirt/models/v1_kube_virt_spec.rb', line 42

def monitor_namespace
  @monitor_namespace
end

#product_componentObject

Designate the apps.kubevirt.io/component label for KubeVirt components. Useful if KubeVirt is included as part of a product. If ProductComponent is not specified, the component label default value is kubevirt.



45
46
47
# File 'lib/kubevirt/models/v1_kube_virt_spec.rb', line 45

def product_component
  @product_component
end

#product_nameObject

Designate the apps.kubevirt.io/part-of label for KubeVirt components. Useful if KubeVirt is included as part of a product. If ProductName is not specified, the part-of label will be omitted.



48
49
50
# File 'lib/kubevirt/models/v1_kube_virt_spec.rb', line 48

def product_name
  @product_name
end

#product_versionObject

Designate the apps.kubevirt.io/version label for KubeVirt components. Useful if KubeVirt is included as part of a product. If ProductVersion is not specified, KubeVirt’s version will be used.



51
52
53
# File 'lib/kubevirt/models/v1_kube_virt_spec.rb', line 51

def product_version
  @product_version
end

#service_monitor_namespaceObject

The namespace the service monitor will be deployed When ServiceMonitorNamespace is set, then we’ll install the service monitor object in that namespace otherwise we will use the monitoring namespace.



54
55
56
# File 'lib/kubevirt/models/v1_kube_virt_spec.rb', line 54

def service_monitor_namespace
  @service_monitor_namespace
end

#synchronization_portObject

Specify the port to listen on for VMI status synchronization traffic. Default is 9185



57
58
59
# File 'lib/kubevirt/models/v1_kube_virt_spec.rb', line 57

def synchronization_port
  @synchronization_port
end

#uninstall_strategyObject

Specifies if kubevirt can be deleted if workloads are still present. This is mainly a precaution to avoid accidental data loss



60
61
62
# File 'lib/kubevirt/models/v1_kube_virt_spec.rb', line 60

def uninstall_strategy
  @uninstall_strategy
end

#workload_update_strategyObject

Returns the value of attribute workload_update_strategy.



62
63
64
# File 'lib/kubevirt/models/v1_kube_virt_spec.rb', line 62

def workload_update_strategy
  @workload_update_strategy
end

#workloadsObject

Returns the value of attribute workloads.



64
65
66
# File 'lib/kubevirt/models/v1_kube_virt_spec.rb', line 64

def workloads
  @workloads
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



113
114
115
# File 'lib/kubevirt/models/v1_kube_virt_spec.rb', line 113

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



118
119
120
# File 'lib/kubevirt/models/v1_kube_virt_spec.rb', line 118

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/kubevirt/models/v1_kube_virt_spec.rb', line 89

def self.attribute_map
  {
    :'certificate_rotate_strategy' => :'certificateRotateStrategy',
    :'configuration' => :'configuration',
    :'customize_components' => :'customizeComponents',
    :'image_pull_policy' => :'imagePullPolicy',
    :'image_pull_secrets' => :'imagePullSecrets',
    :'image_registry' => :'imageRegistry',
    :'image_tag' => :'imageTag',
    :'infra' => :'infra',
    :'monitor_account' => :'monitorAccount',
    :'monitor_namespace' => :'monitorNamespace',
    :'product_component' => :'productComponent',
    :'product_name' => :'productName',
    :'product_version' => :'productVersion',
    :'service_monitor_namespace' => :'serviceMonitorNamespace',
    :'synchronization_port' => :'synchronizationPort',
    :'uninstall_strategy' => :'uninstallStrategy',
    :'workload_update_strategy' => :'workloadUpdateStrategy',
    :'workloads' => :'workloads'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash



310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
# File 'lib/kubevirt/models/v1_kube_virt_spec.rb', line 310

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



147
148
149
150
# File 'lib/kubevirt/models/v1_kube_virt_spec.rb', line 147

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/kubevirt/models/v1_kube_virt_spec.rb', line 123

def self.openapi_types
  {
    :'certificate_rotate_strategy' => :'V1KubeVirtCertificateRotateStrategy',
    :'configuration' => :'V1KubeVirtConfiguration',
    :'customize_components' => :'V1CustomizeComponents',
    :'image_pull_policy' => :'String',
    :'image_pull_secrets' => :'Array<K8sIoApiCoreV1LocalObjectReference>',
    :'image_registry' => :'String',
    :'image_tag' => :'String',
    :'infra' => :'V1ComponentConfig',
    :'monitor_account' => :'String',
    :'monitor_namespace' => :'String',
    :'product_component' => :'String',
    :'product_name' => :'String',
    :'product_version' => :'String',
    :'service_monitor_namespace' => :'String',
    :'synchronization_port' => :'String',
    :'uninstall_strategy' => :'String',
    :'workload_update_strategy' => :'V1KubeVirtWorkloadUpdateStrategy',
    :'workloads' => :'V1ComponentConfig'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.



272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
# File 'lib/kubevirt/models/v1_kube_virt_spec.rb', line 272

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      certificate_rotate_strategy == o.certificate_rotate_strategy &&
      configuration == o.configuration &&
      customize_components == o.customize_components &&
      image_pull_policy == o.image_pull_policy &&
      image_pull_secrets == o.image_pull_secrets &&
      image_registry == o.image_registry &&
      image_tag == o.image_tag &&
      infra == o.infra &&
       == o. &&
      monitor_namespace == o.monitor_namespace &&
      product_component == o.product_component &&
      product_name == o.product_name &&
      product_version == o.product_version &&
      service_monitor_namespace == o.service_monitor_namespace &&
      synchronization_port == o.synchronization_port &&
      uninstall_strategy == o.uninstall_strategy &&
      workload_update_strategy == o.workload_update_strategy &&
      workloads == o.workloads
end

#eql?(o) ⇒ Boolean

See Also:

  • `==` method


297
298
299
# File 'lib/kubevirt/models/v1_kube_virt_spec.rb', line 297

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.



303
304
305
# File 'lib/kubevirt/models/v1_kube_virt_spec.rb', line 303

def hash
  [certificate_rotate_strategy, configuration, customize_components, image_pull_policy, image_pull_secrets, image_registry, image_tag, infra, , monitor_namespace, product_component, product_name, product_version, service_monitor_namespace, synchronization_port, uninstall_strategy, workload_update_strategy, workloads].hash
end

#list_invalid_propertiesObject

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



245
246
247
248
249
# File 'lib/kubevirt/models/v1_kube_virt_spec.rb', line 245

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  invalid_properties
end

#to_hashHash

Returns the object in the form of hash



332
333
334
335
336
337
338
339
340
341
342
343
344
# File 'lib/kubevirt/models/v1_kube_virt_spec.rb', line 332

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

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

#valid?Boolean

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



253
254
255
256
257
258
# File 'lib/kubevirt/models/v1_kube_virt_spec.rb', line 253

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  image_pull_policy_validator = EnumAttributeValidator.new('String', ["Always", "IfNotPresent", "Never"])
  return false unless image_pull_policy_validator.valid?(@image_pull_policy)
  true
end