Class: Kubevirt::K8sIoApimachineryPkgApisMetaV1ObjectMeta

Inherits:
ApiModelBase
  • Object
show all
Defined in:
lib/kubevirt/models/k8s_io_apimachinery_pkg_apis_meta_v1_object_meta.rb

Overview

ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create.

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 = {}) ⇒ K8sIoApimachineryPkgApisMetaV1ObjectMeta

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



119
120
121
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
# File 'lib/kubevirt/models/k8s_io_apimachinery_pkg_apis_meta_v1_object_meta.rb', line 119

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Kubevirt::K8sIoApimachineryPkgApisMetaV1ObjectMeta` 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::K8sIoApimachineryPkgApisMetaV1ObjectMeta`. 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?(:'annotations')
    if (value = attributes[:'annotations']).is_a?(Hash)
      self.annotations = value
    end
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#annotationsObject

Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: kubernetes.io/docs/concepts/overview/working-with-objects/annotations



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

def annotations
  @annotations
end

#deletion_grace_period_secondsObject

Number of seconds allowed for this object to gracefully terminate before it will be removed from the system. Only set when deletionTimestamp is also set. May only be shortened. Read-only.



23
24
25
# File 'lib/kubevirt/models/k8s_io_apimachinery_pkg_apis_meta_v1_object_meta.rb', line 23

def deletion_grace_period_seconds
  @deletion_grace_period_seconds
end

#deletion_timestampObject

Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.



26
27
28
# File 'lib/kubevirt/models/k8s_io_apimachinery_pkg_apis_meta_v1_object_meta.rb', line 26

def deletion_timestamp
  @deletion_timestamp
end

#finalizersObject

Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed. Finalizers may be processed and removed in any order. Order is NOT enforced because it introduces significant risk of stuck finalizers. finalizers is a shared field, any actor with permission can reorder it. If the finalizer list is processed in order, then this can lead to a situation in which the component responsible for the first finalizer in the list is waiting for a signal (field value, external system, or other) produced by a component responsible for a finalizer later in the list, resulting in a deadlock. Without enforced ordering finalizers are free to order amongst themselves and are not vulnerable to ordering changes in the list.



29
30
31
# File 'lib/kubevirt/models/k8s_io_apimachinery_pkg_apis_meta_v1_object_meta.rb', line 29

def finalizers
  @finalizers
end

#generate_nameObject

GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server. If this field is specified and the generated name exists, the server will return a 409. Applied only if Name is not specified. More info: git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#idempotency



32
33
34
# File 'lib/kubevirt/models/k8s_io_apimachinery_pkg_apis_meta_v1_object_meta.rb', line 32

def generate_name
  @generate_name
end

#generationObject

A sequence number representing a specific generation of the desired state. Populated by the system. Read-only.



35
36
37
# File 'lib/kubevirt/models/k8s_io_apimachinery_pkg_apis_meta_v1_object_meta.rb', line 35

def generation
  @generation
end

#labelsObject

Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: kubernetes.io/docs/concepts/overview/working-with-objects/labels



38
39
40
# File 'lib/kubevirt/models/k8s_io_apimachinery_pkg_apis_meta_v1_object_meta.rb', line 38

def labels
  @labels
end

#managed_fieldsObject

ManagedFields maps workflow-id and version to the set of fields that are managed by that workflow. This is mostly for internal housekeeping, and users typically shouldn’t need to set or understand this field. A workflow can be the user’s name, a controller’s name, or the name of a specific apply path like "ci-cd". The set of fields is always in the version that the workflow used when modifying the object.



41
42
43
# File 'lib/kubevirt/models/k8s_io_apimachinery_pkg_apis_meta_v1_object_meta.rb', line 41

def managed_fields
  @managed_fields
end

#nameObject

Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: kubernetes.io/docs/concepts/overview/working-with-objects/names#names



44
45
46
# File 'lib/kubevirt/models/k8s_io_apimachinery_pkg_apis_meta_v1_object_meta.rb', line 44

def name
  @name
end

#namespaceObject

Namespace defines the space within which each name must be unique. An empty namespace is equivalent to the "default" namespace, but "default" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty. Must be a DNS_LABEL. Cannot be updated. More info: kubernetes.io/docs/concepts/overview/working-with-objects/namespaces



47
48
49
# File 'lib/kubevirt/models/k8s_io_apimachinery_pkg_apis_meta_v1_object_meta.rb', line 47

def namespace
  @namespace
end

#owner_referencesObject

List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller.



50
51
52
# File 'lib/kubevirt/models/k8s_io_apimachinery_pkg_apis_meta_v1_object_meta.rb', line 50

def owner_references
  @owner_references
end

#resource_versionObject

An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources. Populated by the system. Read-only. Value must be treated as opaque by clients and . More info: git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency



53
54
55
# File 'lib/kubevirt/models/k8s_io_apimachinery_pkg_apis_meta_v1_object_meta.rb', line 53

def resource_version
  @resource_version
end

Deprecated: selfLink is a legacy read-only field that is no longer populated by the system.



56
57
58
# File 'lib/kubevirt/models/k8s_io_apimachinery_pkg_apis_meta_v1_object_meta.rb', line 56

def self_link
  @self_link
end

#uidObject

UID is the unique in time and space value for this object. It is typically generated by the server on successful creation of a resource and is not allowed to change on PUT operations. Populated by the system. Read-only. More info: kubernetes.io/docs/concepts/overview/working-with-objects/names#uids



59
60
61
# File 'lib/kubevirt/models/k8s_io_apimachinery_pkg_apis_meta_v1_object_meta.rb', line 59

def uid
  @uid
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



82
83
84
# File 'lib/kubevirt/models/k8s_io_apimachinery_pkg_apis_meta_v1_object_meta.rb', line 82

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



87
88
89
# File 'lib/kubevirt/models/k8s_io_apimachinery_pkg_apis_meta_v1_object_meta.rb', line 87

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/kubevirt/models/k8s_io_apimachinery_pkg_apis_meta_v1_object_meta.rb', line 62

def self.attribute_map
  {
    :'annotations' => :'annotations',
    :'deletion_grace_period_seconds' => :'deletionGracePeriodSeconds',
    :'deletion_timestamp' => :'deletionTimestamp',
    :'finalizers' => :'finalizers',
    :'generate_name' => :'generateName',
    :'generation' => :'generation',
    :'labels' => :'labels',
    :'managed_fields' => :'managedFields',
    :'name' => :'name',
    :'namespace' => :'namespace',
    :'owner_references' => :'ownerReferences',
    :'resource_version' => :'resourceVersion',
    :'self_link' => :'selfLink',
    :'uid' => :'uid'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
# File 'lib/kubevirt/models/k8s_io_apimachinery_pkg_apis_meta_v1_object_meta.rb', line 251

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



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

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

.openapi_typesObject

Attribute type mapping.



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

def self.openapi_types
  {
    :'annotations' => :'Hash<String, String>',
    :'deletion_grace_period_seconds' => :'Integer',
    :'deletion_timestamp' => :'Time',
    :'finalizers' => :'Array<String>',
    :'generate_name' => :'String',
    :'generation' => :'Integer',
    :'labels' => :'Hash<String, String>',
    :'managed_fields' => :'Array<K8sIoApimachineryPkgApisMetaV1ManagedFieldsEntry>',
    :'name' => :'String',
    :'namespace' => :'String',
    :'owner_references' => :'Array<K8sIoApimachineryPkgApisMetaV1OwnerReference>',
    :'resource_version' => :'String',
    :'self_link' => :'String',
    :'uid' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# File 'lib/kubevirt/models/k8s_io_apimachinery_pkg_apis_meta_v1_object_meta.rb', line 217

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      annotations == o.annotations &&
      deletion_grace_period_seconds == o.deletion_grace_period_seconds &&
      deletion_timestamp == o.deletion_timestamp &&
      finalizers == o.finalizers &&
      generate_name == o.generate_name &&
      generation == o.generation &&
      labels == o.labels &&
      managed_fields == o.managed_fields &&
      name == o.name &&
      namespace == o.namespace &&
      owner_references == o.owner_references &&
      resource_version == o.resource_version &&
      self_link == o.self_link &&
      uid == o.uid
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


238
239
240
# File 'lib/kubevirt/models/k8s_io_apimachinery_pkg_apis_meta_v1_object_meta.rb', line 238

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



244
245
246
# File 'lib/kubevirt/models/k8s_io_apimachinery_pkg_apis_meta_v1_object_meta.rb', line 244

def hash
  [annotations, deletion_grace_period_seconds, deletion_timestamp, finalizers, generate_name, generation, labels, managed_fields, name, namespace, owner_references, resource_version, self_link, uid].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



202
203
204
205
206
# File 'lib/kubevirt/models/k8s_io_apimachinery_pkg_apis_meta_v1_object_meta.rb', line 202

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

Returns:

  • (Hash)

    Returns the object in the form of hash



273
274
275
276
277
278
279
280
281
282
283
284
285
# File 'lib/kubevirt/models/k8s_io_apimachinery_pkg_apis_meta_v1_object_meta.rb', line 273

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

Returns:

  • (Boolean)

    true if the model is valid



210
211
212
213
# File 'lib/kubevirt/models/k8s_io_apimachinery_pkg_apis_meta_v1_object_meta.rb', line 210

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  true
end