Class: Zilla::IoK8sApiCoreV1ServiceSpec
- Inherits:
-
Object
- Object
- Zilla::IoK8sApiCoreV1ServiceSpec
- Defined in:
- lib/zilla/models/io_k8s_api_core_v1_service_spec.rb
Overview
ServiceSpec describes the attributes that a user creates on a service.
Instance Attribute Summary collapse
-
#allocate_load_balancer_node_ports ⇒ Object
allocateLoadBalancerNodePorts defines if NodePorts will be automatically allocated for services with type LoadBalancer.
-
#cluster_ip ⇒ Object
clusterIP is the IP address of the service and is usually assigned randomly.
-
#cluster_ips ⇒ Object
ClusterIPs is a list of IP addresses assigned to this service, and are usually assigned randomly.
-
#external_ips ⇒ Object
externalIPs is a list of IP addresses for which nodes in the cluster will also accept traffic for this service.
-
#external_name ⇒ Object
externalName is the external reference that discovery mechanisms will return as an alias for this service (e.g. a DNS CNAME record).
-
#external_traffic_policy ⇒ Object
externalTrafficPolicy describes how nodes distribute service traffic they receive on one of the Service’s "externally-facing" addresses (NodePorts, ExternalIPs, and LoadBalancer IPs).
-
#health_check_node_port ⇒ Object
healthCheckNodePort specifies the healthcheck nodePort for the service.
-
#internal_traffic_policy ⇒ Object
InternalTrafficPolicy describes how nodes distribute service traffic they receive on the ClusterIP.
-
#ip_families ⇒ Object
IPFamilies is a list of IP families (e.g. IPv4, IPv6) assigned to this service.
-
#ip_family_policy ⇒ Object
IPFamilyPolicy represents the dual-stack-ness requested or required by this Service.
-
#load_balancer_class ⇒ Object
loadBalancerClass is the class of the load balancer implementation this Service belongs to.
-
#load_balancer_ip ⇒ Object
Only applies to Service Type: LoadBalancer.
-
#load_balancer_source_ranges ⇒ Object
If specified and supported by the platform, this will restrict traffic through the cloud-provider load-balancer will be restricted to the specified client IPs.
-
#ports ⇒ Object
The list of ports that are exposed by this service.
-
#publish_not_ready_addresses ⇒ Object
publishNotReadyAddresses indicates that any agent which deals with endpoints for this Service should disregard any indications of ready/not-ready.
-
#selector ⇒ Object
Route service traffic to pods with label keys and values matching this selector.
-
#session_affinity ⇒ Object
Supports "ClientIP" and "None".
-
#session_affinity_config ⇒ Object
Returns the value of attribute session_affinity_config.
-
#type ⇒ Object
type determines how the Service is exposed.
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 = {}) ⇒ IoK8sApiCoreV1ServiceSpec
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 = {}) ⇒ IoK8sApiCoreV1ServiceSpec
Initializes the object
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 |
# File 'lib/zilla/models/io_k8s_api_core_v1_service_spec.rb', line 137 def initialize(attributes = {}) unless attributes.is_a?(Hash) raise ArgumentError, 'The input argument (attributes) must be a hash in `Zilla::IoK8sApiCoreV1ServiceSpec` 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::IoK8sApiCoreV1ServiceSpec`. 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?(:allocate_load_balancer_node_ports) self.allocate_load_balancer_node_ports = attributes[:allocate_load_balancer_node_ports] end self.cluster_ip = attributes[:cluster_ip] if attributes.key?(:cluster_ip) if attributes.key?(:cluster_ips) && (value = attributes[:cluster_ips]).is_a?(Array) self.cluster_ips = value end if attributes.key?(:external_ips) && (value = attributes[:external_ips]).is_a?(Array) self.external_ips = value end self.external_name = attributes[:external_name] if attributes.key?(:external_name) self.external_traffic_policy = attributes[:external_traffic_policy] if attributes.key?(:external_traffic_policy) self.health_check_node_port = attributes[:health_check_node_port] if attributes.key?(:health_check_node_port) self.internal_traffic_policy = attributes[:internal_traffic_policy] if attributes.key?(:internal_traffic_policy) if attributes.key?(:ip_families) && (value = attributes[:ip_families]).is_a?(Array) self.ip_families = value end self.ip_family_policy = attributes[:ip_family_policy] if attributes.key?(:ip_family_policy) self.load_balancer_class = attributes[:load_balancer_class] if attributes.key?(:load_balancer_class) self.load_balancer_ip = attributes[:load_balancer_ip] if attributes.key?(:load_balancer_ip) if attributes.key?(:load_balancer_source_ranges) && (value = attributes[:load_balancer_source_ranges]).is_a?(Array) self.load_balancer_source_ranges = value end if attributes.key?(:ports) && (value = attributes[:ports]).is_a?(Array) self.ports = value end if attributes.key?(:publish_not_ready_addresses) self.publish_not_ready_addresses = attributes[:publish_not_ready_addresses] end if attributes.key?(:selector) && (value = attributes[:selector]).is_a?(Hash) self.selector = value end self.session_affinity = attributes[:session_affinity] if attributes.key?(:session_affinity) self.session_affinity_config = attributes[:session_affinity_config] if attributes.key?(:session_affinity_config) return unless attributes.key?(:type) self.type = attributes[:type] end |
Instance Attribute Details
#allocate_load_balancer_node_ports ⇒ Object
allocateLoadBalancerNodePorts defines if NodePorts will be automatically allocated for services with type LoadBalancer. Default is "true". It may be set to "false" if the cluster load-balancer does not rely on NodePorts. If the caller requests specific NodePorts (by specifying a value), those requests will be respected, regardless of this field. This field may only be set for services with type LoadBalancer and will be cleared if the type is changed to any other type.
20 21 22 |
# File 'lib/zilla/models/io_k8s_api_core_v1_service_spec.rb', line 20 def allocate_load_balancer_node_ports @allocate_load_balancer_node_ports end |
#cluster_ip ⇒ Object
clusterIP is the IP address of the service and is usually assigned randomly. If an address is specified manually, is in-range (as per system configuration), and is not in use, it will be allocated to the service; otherwise creation of the service will fail. This field may not be changed through updates unless the type field is also being changed to ExternalName (which requires this field to be blank) or the type field is being changed from ExternalName (in which case this field may optionally be specified, as describe above). Valid values are "None", empty string (""), or a valid IP address. Setting this to "None" makes a "headless service" (no virtual IP), which is useful when direct endpoint connections are preferred and proxying is not required. Only applies to types ClusterIP, NodePort, and LoadBalancer. If this field is specified when creating a Service of type ExternalName, creation will fail. This field will be wiped when updating a Service to type ExternalName. More info: kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies
23 24 25 |
# File 'lib/zilla/models/io_k8s_api_core_v1_service_spec.rb', line 23 def cluster_ip @cluster_ip end |
#cluster_ips ⇒ Object
ClusterIPs is a list of IP addresses assigned to this service, and are usually assigned randomly. If an address is specified manually, is in-range (as per system configuration), and is not in use, it will be allocated to the service; otherwise creation of the service will fail. This field may not be changed through updates unless the type field is also being changed to ExternalName (which requires this field to be empty) or the type field is being changed from ExternalName (in which case this field may optionally be specified, as describe above). Valid values are "None", empty string (""), or a valid IP address. Setting this to "None" makes a "headless service" (no virtual IP), which is useful when direct endpoint connections are preferred and proxying is not required. Only applies to types ClusterIP, NodePort, and LoadBalancer. If this field is specified when creating a Service of type ExternalName, creation will fail. This field will be wiped when updating a Service to type ExternalName. If this field is not specified, it will be initialized from the clusterIP field. If this field is specified, clients must ensure that clusterIPs and clusterIP have the same value. This field may hold a maximum of two entries (dual-stack IPs, in either order). These IPs must correspond to the values of the ipFamilies field. Both clusterIPs and ipFamilies are governed by the ipFamilyPolicy field. More info: kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies
26 27 28 |
# File 'lib/zilla/models/io_k8s_api_core_v1_service_spec.rb', line 26 def cluster_ips @cluster_ips end |
#external_ips ⇒ Object
externalIPs is a list of IP addresses for which nodes in the cluster will also accept traffic for this service. These IPs are not managed by Kubernetes. The user is responsible for ensuring that traffic arrives at a node with this IP. A common example is external load-balancers that are not part of the Kubernetes system.
29 30 31 |
# File 'lib/zilla/models/io_k8s_api_core_v1_service_spec.rb', line 29 def external_ips @external_ips end |
#external_name ⇒ Object
externalName is the external reference that discovery mechanisms will return as an alias for this service (e.g. a DNS CNAME record). No proxying will be involved. Must be a lowercase RFC-1123 hostname (tools.ietf.org/html/rfc1123) and requires ‘type` to be "ExternalName".
32 33 34 |
# File 'lib/zilla/models/io_k8s_api_core_v1_service_spec.rb', line 32 def external_name @external_name end |
#external_traffic_policy ⇒ Object
externalTrafficPolicy describes how nodes distribute service traffic they receive on one of the Service’s "externally-facing" addresses (NodePorts, ExternalIPs, and LoadBalancer IPs). If set to "Local", the proxy will configure the service in a way that assumes that external load balancers will take care of balancing the service traffic between nodes, and so each node will deliver traffic only to the node-local endpoints of the service, without masquerading the client source IP. (Traffic mistakenly sent to a node with no endpoints will be dropped.) The default value, "Cluster", uses the standard behavior of routing to all endpoints evenly (possibly modified by topology and other features). Note that traffic sent to an External IP or LoadBalancer IP from within the cluster will always get "Cluster" semantics, but clients sending to a NodePort from within the cluster may need to take traffic policy into account when picking a node.
35 36 37 |
# File 'lib/zilla/models/io_k8s_api_core_v1_service_spec.rb', line 35 def external_traffic_policy @external_traffic_policy end |
#health_check_node_port ⇒ Object
healthCheckNodePort specifies the healthcheck nodePort for the service. This only applies when type is set to LoadBalancer and externalTrafficPolicy is set to Local. If a value is specified, is in-range, and is not in use, it will be used. If not specified, a value will be automatically allocated. External systems (e.g. load-balancers) can use this port to determine if a given node holds endpoints for this service or not. If this field is specified when creating a Service which does not need it, creation will fail. This field will be wiped when updating a Service to no longer need it (e.g. changing type). This field cannot be updated once set.
38 39 40 |
# File 'lib/zilla/models/io_k8s_api_core_v1_service_spec.rb', line 38 def health_check_node_port @health_check_node_port end |
#internal_traffic_policy ⇒ Object
InternalTrafficPolicy describes how nodes distribute service traffic they receive on the ClusterIP. If set to "Local", the proxy will assume that pods only want to talk to endpoints of the service on the same node as the pod, dropping the traffic if there are no local endpoints. The default value, "Cluster", uses the standard behavior of routing to all endpoints evenly (possibly modified by topology and other features).
41 42 43 |
# File 'lib/zilla/models/io_k8s_api_core_v1_service_spec.rb', line 41 def internal_traffic_policy @internal_traffic_policy end |
#ip_families ⇒ Object
IPFamilies is a list of IP families (e.g. IPv4, IPv6) assigned to this service. This field is usually assigned automatically based on cluster configuration and the ipFamilyPolicy field. If this field is specified manually, the requested family is available in the cluster, and ipFamilyPolicy allows it, it will be used; otherwise creation of the service will fail. This field is conditionally mutable: it allows for adding or removing a secondary IP family, but it does not allow changing the primary IP family of the Service. Valid values are "IPv4" and "IPv6". This field only applies to Services of types ClusterIP, NodePort, and LoadBalancer, and does apply to "headless" services. This field will be wiped when updating a Service to type ExternalName. This field may hold a maximum of two entries (dual-stack families, in either order). These families must correspond to the values of the clusterIPs field, if specified. Both clusterIPs and ipFamilies are governed by the ipFamilyPolicy field.
44 45 46 |
# File 'lib/zilla/models/io_k8s_api_core_v1_service_spec.rb', line 44 def ip_families @ip_families end |
#ip_family_policy ⇒ Object
IPFamilyPolicy represents the dual-stack-ness requested or required by this Service. If there is no value provided, then this field will be set to SingleStack. Services can be "SingleStack" (a single IP family), "PreferDualStack" (two IP families on dual-stack configured clusters or a single IP family on single-stack clusters), or "RequireDualStack" (two IP families on dual-stack configured clusters, otherwise fail). The ipFamilies and clusterIPs fields depend on the value of this field. This field will be wiped when updating a service to type ExternalName.
47 48 49 |
# File 'lib/zilla/models/io_k8s_api_core_v1_service_spec.rb', line 47 def ip_family_policy @ip_family_policy end |
#load_balancer_class ⇒ Object
loadBalancerClass is the class of the load balancer implementation this Service belongs to. If specified, the value of this field must be a label-style identifier, with an optional prefix, e.g. "internal-vip" or "example.com/internal-vip". Unprefixed names are reserved for end-users. This field can only be set when the Service type is ‘LoadBalancer’. If not set, the default load balancer implementation is used, today this is typically done through the cloud provider integration, but should apply for any default implementation. If set, it is assumed that a load balancer implementation is watching for Services with a matching class. Any default load balancer implementation (e.g. cloud providers) should ignore Services that set this field. This field can only be set when creating or updating a Service to type ‘LoadBalancer’. Once set, it can not be changed. This field will be wiped when a service is updated to a non ‘LoadBalancer’ type.
50 51 52 |
# File 'lib/zilla/models/io_k8s_api_core_v1_service_spec.rb', line 50 def load_balancer_class @load_balancer_class end |
#load_balancer_ip ⇒ Object
Only applies to Service Type: LoadBalancer. This feature depends on whether the underlying cloud-provider supports specifying the loadBalancerIP when a load balancer is created. This field will be ignored if the cloud-provider does not support the feature. Deprecated: This field was under-specified and its meaning varies across implementations, and it cannot support dual-stack. As of Kubernetes v1.24, users are encouraged to use implementation-specific annotations when available. This field may be removed in a future API version.
53 54 55 |
# File 'lib/zilla/models/io_k8s_api_core_v1_service_spec.rb', line 53 def load_balancer_ip @load_balancer_ip end |
#load_balancer_source_ranges ⇒ Object
If specified and supported by the platform, this will restrict traffic through the cloud-provider load-balancer will be restricted to the specified client IPs. This field will be ignored if the cloud-provider does not support the feature." More info: kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/
56 57 58 |
# File 'lib/zilla/models/io_k8s_api_core_v1_service_spec.rb', line 56 def load_balancer_source_ranges @load_balancer_source_ranges end |
#ports ⇒ Object
The list of ports that are exposed by this service. More info: kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies
59 60 61 |
# File 'lib/zilla/models/io_k8s_api_core_v1_service_spec.rb', line 59 def ports @ports end |
#publish_not_ready_addresses ⇒ Object
publishNotReadyAddresses indicates that any agent which deals with endpoints for this Service should disregard any indications of ready/not-ready. The primary use case for setting this field is for a StatefulSet’s Headless Service to propagate SRV DNS records for its Pods for the purpose of peer discovery. The Kubernetes controllers that generate Endpoints and EndpointSlice resources for Services interpret this to mean that all endpoints are considered "ready" even if the Pods themselves are not. Agents which consume only Kubernetes generated endpoints through the Endpoints or EndpointSlice resources can safely assume this behavior.
62 63 64 |
# File 'lib/zilla/models/io_k8s_api_core_v1_service_spec.rb', line 62 def publish_not_ready_addresses @publish_not_ready_addresses end |
#selector ⇒ Object
Route service traffic to pods with label keys and values matching this selector. If empty or not present, the service is assumed to have an external process managing its endpoints, which Kubernetes will not modify. Only applies to types ClusterIP, NodePort, and LoadBalancer. Ignored if type is ExternalName. More info: kubernetes.io/docs/concepts/services-networking/service/
65 66 67 |
# File 'lib/zilla/models/io_k8s_api_core_v1_service_spec.rb', line 65 def selector @selector end |
#session_affinity ⇒ Object
Supports "ClientIP" and "None". Used to maintain session affinity. Enable client IP based session affinity. Must be ClientIP or None. Defaults to None. More info: kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies
68 69 70 |
# File 'lib/zilla/models/io_k8s_api_core_v1_service_spec.rb', line 68 def session_affinity @session_affinity end |
#session_affinity_config ⇒ Object
Returns the value of attribute session_affinity_config.
70 71 72 |
# File 'lib/zilla/models/io_k8s_api_core_v1_service_spec.rb', line 70 def session_affinity_config @session_affinity_config end |
#type ⇒ Object
type determines how the Service is exposed. Defaults to ClusterIP. Valid options are ExternalName, ClusterIP, NodePort, and LoadBalancer. "ClusterIP" allocates a cluster-internal IP address for load-balancing to endpoints. Endpoints are determined by the selector or if that is not specified, by manual construction of an Endpoints object or EndpointSlice objects. If clusterIP is "None", no virtual IP is allocated and the endpoints are published as a set of endpoints rather than a virtual IP. "NodePort" builds on ClusterIP and allocates a port on every node which routes to the same endpoints as the clusterIP. "LoadBalancer" builds on NodePort and creates an external load-balancer (if supported in the current cloud) which routes to the same endpoints as the clusterIP. "ExternalName" aliases this service to the specified externalName. Several other fields do not apply to ExternalName services. More info: kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types
73 74 75 |
# File 'lib/zilla/models/io_k8s_api_core_v1_service_spec.rb', line 73 def type @type end |
Class Method Details
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
101 102 103 |
# File 'lib/zilla/models/io_k8s_api_core_v1_service_spec.rb', line 101 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/zilla/models/io_k8s_api_core_v1_service_spec.rb', line 76 def self.attribute_map { allocate_load_balancer_node_ports: :allocateLoadBalancerNodePorts, cluster_ip: :clusterIP, cluster_ips: :clusterIPs, external_ips: :externalIPs, external_name: :externalName, external_traffic_policy: :externalTrafficPolicy, health_check_node_port: :healthCheckNodePort, internal_traffic_policy: :internalTrafficPolicy, ip_families: :ipFamilies, ip_family_policy: :ipFamilyPolicy, load_balancer_class: :loadBalancerClass, load_balancer_ip: :loadBalancerIP, load_balancer_source_ranges: :loadBalancerSourceRanges, ports: :ports, publish_not_ready_addresses: :publishNotReadyAddresses, selector: :selector, session_affinity: :sessionAffinity, session_affinity_config: :sessionAffinityConfig, type: :type } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
265 266 267 |
# File 'lib/zilla/models/io_k8s_api_core_v1_service_spec.rb', line 265 def self.build_from_hash(attributes) new.build_from_hash(attributes) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
131 132 133 |
# File 'lib/zilla/models/io_k8s_api_core_v1_service_spec.rb', line 131 def self.openapi_nullable Set.new([]) end |
.openapi_types ⇒ Object
Attribute type mapping.
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/zilla/models/io_k8s_api_core_v1_service_spec.rb', line 106 def self.openapi_types { allocate_load_balancer_node_ports: :Boolean, cluster_ip: :String, cluster_ips: :'Array<String>', external_ips: :'Array<String>', external_name: :String, external_traffic_policy: :String, health_check_node_port: :Integer, internal_traffic_policy: :String, ip_families: :'Array<String>', ip_family_policy: :String, load_balancer_class: :String, load_balancer_ip: :String, load_balancer_source_ranges: :'Array<String>', ports: :'Array<IoK8sApiCoreV1ServicePort>', publish_not_ready_addresses: :Boolean, selector: :'Hash<String, String>', session_affinity: :String, session_affinity_config: :IoK8sApiCoreV1SessionAffinityConfig, type: :String } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 |
# File 'lib/zilla/models/io_k8s_api_core_v1_service_spec.rb', line 224 def ==(other) return true if equal?(other) self.class == other.class && allocate_load_balancer_node_ports == other.allocate_load_balancer_node_ports && cluster_ip == other.cluster_ip && cluster_ips == other.cluster_ips && external_ips == other.external_ips && external_name == other.external_name && external_traffic_policy == other.external_traffic_policy && health_check_node_port == other.health_check_node_port && internal_traffic_policy == other.internal_traffic_policy && ip_families == other.ip_families && ip_family_policy == other.ip_family_policy && load_balancer_class == other.load_balancer_class && load_balancer_ip == other.load_balancer_ip && load_balancer_source_ranges == other.load_balancer_source_ranges && ports == other.ports && publish_not_ready_addresses == other.publish_not_ready_addresses && selector == other.selector && session_affinity == other.session_affinity && session_affinity_config == other.session_affinity_config && type == other.type end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 |
# File 'lib/zilla/models/io_k8s_api_core_v1_service_spec.rb', line 299 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
370 371 372 373 374 375 376 377 378 379 380 381 382 |
# File 'lib/zilla/models/io_k8s_api_core_v1_service_spec.rb', line 370 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
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 |
# File 'lib/zilla/models/io_k8s_api_core_v1_service_spec.rb', line 272 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
251 252 253 |
# File 'lib/zilla/models/io_k8s_api_core_v1_service_spec.rb', line 251 def eql?(other) self == other end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
257 258 259 260 |
# File 'lib/zilla/models/io_k8s_api_core_v1_service_spec.rb', line 257 def hash [allocate_load_balancer_node_ports, cluster_ip, cluster_ips, external_ips, external_name, external_traffic_policy, health_check_node_port, internal_traffic_policy, ip_families, ip_family_policy, load_balancer_class, load_balancer_ip, load_balancer_source_ranges, ports, publish_not_ready_addresses, selector, session_affinity, session_affinity_config, type].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
212 213 214 |
# File 'lib/zilla/models/io_k8s_api_core_v1_service_spec.rb', line 212 def list_invalid_properties [] end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
346 347 348 |
# File 'lib/zilla/models/io_k8s_api_core_v1_service_spec.rb', line 346 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
352 353 354 355 356 357 358 359 360 361 362 363 364 |
# File 'lib/zilla/models/io_k8s_api_core_v1_service_spec.rb', line 352 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
340 341 342 |
# File 'lib/zilla/models/io_k8s_api_core_v1_service_spec.rb', line 340 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
218 219 220 |
# File 'lib/zilla/models/io_k8s_api_core_v1_service_spec.rb', line 218 def valid? true end |