Class: Kubernetes::V1ObjectMeta
- Inherits:
-
Object
- Object
- Kubernetes::V1ObjectMeta
- Defined in:
- lib/kubernetes/models/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
-
#annotations ⇒ Object
Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata.
-
#creation_timestamp ⇒ Object
CreationTimestamp is a timestamp representing the server time when this object was created.
-
#deletion_grace_period_seconds ⇒ Object
Number of seconds allowed for this object to gracefully terminate before it will be removed from the system.
-
#deletion_timestamp ⇒ Object
DeletionTimestamp is RFC 3339 date and time at which this resource will be deleted.
-
#finalizers ⇒ Object
Must be empty before the object is deleted from the registry.
-
#generate_name ⇒ Object
GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided.
-
#generation ⇒ Object
A sequence number representing a specific generation of the desired state.
-
#labels ⇒ Object
Map of string keys and values that can be used to organize and categorize (scope and select) objects.
-
#managed_fields ⇒ Object
ManagedFields maps workflow-id and version to the set of fields that are managed by that workflow.
-
#name ⇒ Object
Name must be unique within a namespace.
-
#namespace ⇒ Object
Namespace defines the space within which each name must be unique.
-
#owner_references ⇒ Object
List of objects depended by this object.
-
#resource_version ⇒ Object
An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed.
-
#self_link ⇒ Object
Deprecated: selfLink is a legacy read-only field that is no longer populated by the system.
-
#uid ⇒ Object
UID is the unique in time and space value for this object.
Class Method Summary collapse
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ V1ObjectMeta
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ V1ObjectMeta
Initializes the object
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 199 200 201 |
# File 'lib/kubernetes/models/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 `Kubernetes::V1ObjectMeta` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `Kubernetes::V1ObjectMeta`. Please check the name to make sure it's valid. List of attributes: " + self.class.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?(:'creation_timestamp') self. = attributes[:'creation_timestamp'] 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. = 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
#annotations ⇒ Object
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/kubernetes/models/v1_object_meta.rb', line 20 def annotations @annotations end |
#creation_timestamp ⇒ Object
CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC. Populated by the system. Read-only. Null for lists. More info: git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
23 24 25 |
# File 'lib/kubernetes/models/v1_object_meta.rb', line 23 def @creation_timestamp end |
#deletion_grace_period_seconds ⇒ Object
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.
26 27 28 |
# File 'lib/kubernetes/models/v1_object_meta.rb', line 26 def deletion_grace_period_seconds @deletion_grace_period_seconds end |
#deletion_timestamp ⇒ Object
DeletionTimestamp is RFC 3339 date and time at which this resource will be deleted. This field is set by the server when a graceful deletion is requested by the user, and is not directly settable by a client. The resource is expected to be deleted (no longer visible from resource lists, and not reachable by name) after the time in this field, once the finalizers list is empty. As long as the finalizers list contains items, deletion is blocked. Once the deletionTimestamp is set, this value may not be unset or be set further into the future, although it may be shortened or the resource may be deleted prior to this time. For example, a user may request that a pod is deleted in 30 seconds. The Kubelet will react by sending a graceful termination signal to the containers in the pod. After that 30 seconds, the Kubelet will send a hard termination signal (SIGKILL) to the container and after cleanup, remove the pod from the API. In the presence of network partitions, this object may still exist after this timestamp, until an administrator or automated process can determine the resource is fully terminated. If not set, graceful deletion of the object has not been requested. Populated by the system when a graceful deletion is requested. Read-only. More info: git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
29 30 31 |
# File 'lib/kubernetes/models/v1_object_meta.rb', line 29 def @deletion_timestamp end |
#finalizers ⇒ Object
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.
32 33 34 |
# File 'lib/kubernetes/models/v1_object_meta.rb', line 32 def finalizers @finalizers end |
#generate_name ⇒ Object
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
35 36 37 |
# File 'lib/kubernetes/models/v1_object_meta.rb', line 35 def generate_name @generate_name end |
#generation ⇒ Object
A sequence number representing a specific generation of the desired state. Populated by the system. Read-only.
38 39 40 |
# File 'lib/kubernetes/models/v1_object_meta.rb', line 38 def generation @generation end |
#labels ⇒ Object
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
41 42 43 |
# File 'lib/kubernetes/models/v1_object_meta.rb', line 41 def labels @labels end |
#managed_fields ⇒ Object
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.
44 45 46 |
# File 'lib/kubernetes/models/v1_object_meta.rb', line 44 def managed_fields @managed_fields end |
#name ⇒ Object
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
47 48 49 |
# File 'lib/kubernetes/models/v1_object_meta.rb', line 47 def name @name end |
#namespace ⇒ Object
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
50 51 52 |
# File 'lib/kubernetes/models/v1_object_meta.rb', line 50 def namespace @namespace end |
#owner_references ⇒ Object
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.
53 54 55 |
# File 'lib/kubernetes/models/v1_object_meta.rb', line 53 def owner_references @owner_references end |
#resource_version ⇒ Object
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
56 57 58 |
# File 'lib/kubernetes/models/v1_object_meta.rb', line 56 def resource_version @resource_version end |
#self_link ⇒ Object
Deprecated: selfLink is a legacy read-only field that is no longer populated by the system.
59 60 61 |
# File 'lib/kubernetes/models/v1_object_meta.rb', line 59 def self_link @self_link end |
#uid ⇒ Object
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
62 63 64 |
# File 'lib/kubernetes/models/v1_object_meta.rb', line 62 def uid @uid end |
Class Method Details
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
86 87 88 |
# File 'lib/kubernetes/models/v1_object_meta.rb', line 86 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/kubernetes/models/v1_object_meta.rb', line 65 def self.attribute_map { :'annotations' => :'annotations', :'creation_timestamp' => :'creationTimestamp', :'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
253 254 255 |
# File 'lib/kubernetes/models/v1_object_meta.rb', line 253 def self.build_from_hash(attributes) new.build_from_hash(attributes) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
112 113 114 115 |
# File 'lib/kubernetes/models/v1_object_meta.rb', line 112 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/kubernetes/models/v1_object_meta.rb', line 91 def self.openapi_types { :'annotations' => :'Hash<String, String>', :'creation_timestamp' => :'Time', :'deletion_grace_period_seconds' => :'Integer', :'deletion_timestamp' => :'Time', :'finalizers' => :'Array<String>', :'generate_name' => :'String', :'generation' => :'Integer', :'labels' => :'Hash<String, String>', :'managed_fields' => :'Array<V1ManagedFieldsEntry>', :'name' => :'String', :'namespace' => :'String', :'owner_references' => :'Array<V1OwnerReference>', :'resource_version' => :'String', :'self_link' => :'String', :'uid' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 |
# File 'lib/kubernetes/models/v1_object_meta.rb', line 218 def ==(o) return true if self.equal?(o) self.class == o.class && annotations == o.annotations && == o. && deletion_grace_period_seconds == o.deletion_grace_period_seconds && == o. && 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 |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 |
# File 'lib/kubernetes/models/v1_object_meta.rb', line 283 def _deserialize(type, value) case type.to_sym when :Time Time.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 # models (e.g. Pet) or oneOf klass = Kubernetes.const_get(type) klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.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
354 355 356 357 358 359 360 361 362 363 364 365 366 |
# File 'lib/kubernetes/models/v1_object_meta.rb', line 354 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
260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 |
# File 'lib/kubernetes/models/v1_object_meta.rb', line 260 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.openapi_types.each_pair do |key, type| if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) self.send("#{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[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end end self end |
#eql?(o) ⇒ Boolean
240 241 242 |
# File 'lib/kubernetes/models/v1_object_meta.rb', line 240 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
246 247 248 |
# File 'lib/kubernetes/models/v1_object_meta.rb', line 246 def hash [annotations, , deletion_grace_period_seconds, , finalizers, generate_name, generation, labels, managed_fields, name, namespace, owner_references, resource_version, self_link, uid].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
205 206 207 208 |
# File 'lib/kubernetes/models/v1_object_meta.rb', line 205 def list_invalid_properties invalid_properties = Array.new invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
330 331 332 |
# File 'lib/kubernetes/models/v1_object_meta.rb', line 330 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
336 337 338 339 340 341 342 343 344 345 346 347 348 |
# File 'lib/kubernetes/models/v1_object_meta.rb', line 336 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 |
#to_s ⇒ String
Returns the string representation of the object
324 325 326 |
# File 'lib/kubernetes/models/v1_object_meta.rb', line 324 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
212 213 214 |
# File 'lib/kubernetes/models/v1_object_meta.rb', line 212 def valid? true end |