Class: Zilla::IoK8sApimachineryPkgApisMetaV1ObjectMeta
- Inherits:
-
Object
- Object
- Zilla::IoK8sApimachineryPkgApisMetaV1ObjectMeta
- Defined in:
- lib/zilla/models/io_k8s_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
-
#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
Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON.
-
#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
Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON.
-
#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
-
#==(other) ⇒ 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?(other) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ IoK8sApimachineryPkgApisMetaV1ObjectMeta
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 = {}) ⇒ IoK8sApimachineryPkgApisMetaV1ObjectMeta
Initializes the object
118 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 |
# File 'lib/zilla/models/io_k8s_apimachinery_pkg_apis_meta_v1_object_meta.rb', line 118 def initialize(attributes = {}) unless attributes.is_a?(Hash) raise ArgumentError, 'The input argument (attributes) must be a hash in `Zilla::IoK8sApimachineryPkgApisMetaV1ObjectMeta` initialize method' end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) do |(k, v), h| unless self.class.attribute_map.key?(k.to_sym) raise ArgumentError, "`#{k}` is not a valid attribute in `Zilla::IoK8sApimachineryPkgApisMetaV1ObjectMeta`. 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 end if attributes.key?(:annotations) && (value = attributes[:annotations]).is_a?(Hash) self.annotations = value end self. = attributes[:creation_timestamp] if attributes.key?(:creation_timestamp) if attributes.key?(:deletion_grace_period_seconds) self.deletion_grace_period_seconds = attributes[:deletion_grace_period_seconds] end self. = attributes[:deletion_timestamp] if attributes.key?(:deletion_timestamp) if attributes.key?(:finalizers) && (value = attributes[:finalizers]).is_a?(Array) self.finalizers = value end self.generate_name = attributes[:generate_name] if attributes.key?(:generate_name) self.generation = attributes[:generation] if attributes.key?(:generation) if attributes.key?(:labels) && (value = attributes[:labels]).is_a?(Hash) self.labels = value end if attributes.key?(:managed_fields) && (value = attributes[:managed_fields]).is_a?(Array) self.managed_fields = value end self.name = attributes[:name] if attributes.key?(:name) self.namespace = attributes[:namespace] if attributes.key?(:namespace) if attributes.key?(:owner_references) && (value = attributes[:owner_references]).is_a?(Array) self.owner_references = value end self.resource_version = attributes[:resource_version] if attributes.key?(:resource_version) self.self_link = attributes[:self_link] if attributes.key?(:self_link) return unless attributes.key?(:uid) self.uid = attributes[:uid] 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/user-guide/annotations
20 21 22 |
# File 'lib/zilla/models/io_k8s_apimachinery_pkg_apis_meta_v1_object_meta.rb', line 20 def annotations @annotations end |
#creation_timestamp ⇒ Object
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.
23 24 25 |
# File 'lib/zilla/models/io_k8s_apimachinery_pkg_apis_meta_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/zilla/models/io_k8s_apimachinery_pkg_apis_meta_v1_object_meta.rb', line 26 def deletion_grace_period_seconds @deletion_grace_period_seconds end |
#deletion_timestamp ⇒ Object
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.
29 30 31 |
# File 'lib/zilla/models/io_k8s_apimachinery_pkg_apis_meta_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/zilla/models/io_k8s_apimachinery_pkg_apis_meta_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/zilla/models/io_k8s_apimachinery_pkg_apis_meta_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/zilla/models/io_k8s_apimachinery_pkg_apis_meta_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/user-guide/labels
41 42 43 |
# File 'lib/zilla/models/io_k8s_apimachinery_pkg_apis_meta_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/zilla/models/io_k8s_apimachinery_pkg_apis_meta_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/user-guide/identifiers#names
47 48 49 |
# File 'lib/zilla/models/io_k8s_apimachinery_pkg_apis_meta_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/user-guide/namespaces
50 51 52 |
# File 'lib/zilla/models/io_k8s_apimachinery_pkg_apis_meta_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/zilla/models/io_k8s_apimachinery_pkg_apis_meta_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/zilla/models/io_k8s_apimachinery_pkg_apis_meta_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/zilla/models/io_k8s_apimachinery_pkg_apis_meta_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/user-guide/identifiers#uids
62 63 64 |
# File 'lib/zilla/models/io_k8s_apimachinery_pkg_apis_meta_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/zilla/models/io_k8s_apimachinery_pkg_apis_meta_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/zilla/models/io_k8s_apimachinery_pkg_apis_meta_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
230 231 232 |
# File 'lib/zilla/models/io_k8s_apimachinery_pkg_apis_meta_v1_object_meta.rb', line 230 def self.build_from_hash(attributes) new.build_from_hash(attributes) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
112 113 114 |
# File 'lib/zilla/models/io_k8s_apimachinery_pkg_apis_meta_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/zilla/models/io_k8s_apimachinery_pkg_apis_meta_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<IoK8sApimachineryPkgApisMetaV1ManagedFieldsEntry>', name: :String, namespace: :String, owner_references: :'Array<IoK8sApimachineryPkgApisMetaV1OwnerReference>', resource_version: :String, self_link: :String, uid: :String } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
# File 'lib/zilla/models/io_k8s_apimachinery_pkg_apis_meta_v1_object_meta.rb', line 193 def ==(other) return true if equal?(other) self.class == other.class && annotations == other.annotations && == other. && deletion_grace_period_seconds == other.deletion_grace_period_seconds && == other. && finalizers == other.finalizers && generate_name == other.generate_name && generation == other.generation && labels == other.labels && managed_fields == other.managed_fields && name == other.name && namespace == other.namespace && owner_references == other.owner_references && resource_version == other.resource_version && self_link == other.self_link && uid == other.uid end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 |
# File 'lib/zilla/models/io_k8s_apimachinery_pkg_apis_meta_v1_object_meta.rb', line 264 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 = Zilla.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
335 336 337 338 339 340 341 342 343 344 345 346 347 |
# File 'lib/zilla/models/io_k8s_apimachinery_pkg_apis_meta_v1_object_meta.rb', line 335 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
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
# File 'lib/zilla/models/io_k8s_apimachinery_pkg_apis_meta_v1_object_meta.rb', line 237 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) self.class.openapi_types.each_pair do |key, type| if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) 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) 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
216 217 218 |
# File 'lib/zilla/models/io_k8s_apimachinery_pkg_apis_meta_v1_object_meta.rb', line 216 def eql?(other) self == other end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
222 223 224 225 |
# File 'lib/zilla/models/io_k8s_apimachinery_pkg_apis_meta_v1_object_meta.rb', line 222 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?
181 182 183 |
# File 'lib/zilla/models/io_k8s_apimachinery_pkg_apis_meta_v1_object_meta.rb', line 181 def list_invalid_properties [] end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
311 312 313 |
# File 'lib/zilla/models/io_k8s_apimachinery_pkg_apis_meta_v1_object_meta.rb', line 311 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
317 318 319 320 321 322 323 324 325 326 327 328 329 |
# File 'lib/zilla/models/io_k8s_apimachinery_pkg_apis_meta_v1_object_meta.rb', line 317 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = 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
305 306 307 |
# File 'lib/zilla/models/io_k8s_apimachinery_pkg_apis_meta_v1_object_meta.rb', line 305 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
187 188 189 |
# File 'lib/zilla/models/io_k8s_apimachinery_pkg_apis_meta_v1_object_meta.rb', line 187 def valid? true end |