io.kubernetes.client.openapi.models.V1beta2Device Maven / Gradle / Ivy
/*
Copyright 2025 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package io.kubernetes.client.openapi.models;
import java.util.Objects;
import java.util.Arrays;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.kubernetes.client.openapi.models.V1NodeSelector;
import io.kubernetes.client.openapi.models.V1beta2DeviceAttribute;
import io.kubernetes.client.openapi.models.V1beta2DeviceCapacity;
import io.kubernetes.client.openapi.models.V1beta2DeviceCounterConsumption;
import io.kubernetes.client.openapi.models.V1beta2DeviceTaint;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Device represents one individual hardware instance that can be selected based on its attributes. Besides the name, exactly one field must be set.
*/
@ApiModel(description = "Device represents one individual hardware instance that can be selected based on its attributes. Besides the name, exactly one field must be set.")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-22T21:20:49.874193Z[Etc/UTC]")
public class V1beta2Device {
public static final String SERIALIZED_NAME_ALL_NODES = "allNodes";
@SerializedName(SERIALIZED_NAME_ALL_NODES)
private Boolean allNodes;
public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes";
@SerializedName(SERIALIZED_NAME_ATTRIBUTES)
private Map attributes = null;
public static final String SERIALIZED_NAME_CAPACITY = "capacity";
@SerializedName(SERIALIZED_NAME_CAPACITY)
private Map capacity = null;
public static final String SERIALIZED_NAME_CONSUMES_COUNTERS = "consumesCounters";
@SerializedName(SERIALIZED_NAME_CONSUMES_COUNTERS)
private List consumesCounters = null;
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)
private String name;
public static final String SERIALIZED_NAME_NODE_NAME = "nodeName";
@SerializedName(SERIALIZED_NAME_NODE_NAME)
private String nodeName;
public static final String SERIALIZED_NAME_NODE_SELECTOR = "nodeSelector";
@SerializedName(SERIALIZED_NAME_NODE_SELECTOR)
private V1NodeSelector nodeSelector;
public static final String SERIALIZED_NAME_TAINTS = "taints";
@SerializedName(SERIALIZED_NAME_TAINTS)
private List taints = null;
public V1beta2Device allNodes(Boolean allNodes) {
this.allNodes = allNodes;
return this;
}
/**
* AllNodes indicates that all nodes have access to the device. Must only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.
* @return allNodes
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "AllNodes indicates that all nodes have access to the device. Must only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.")
public Boolean getAllNodes() {
return allNodes;
}
public void setAllNodes(Boolean allNodes) {
this.allNodes = allNodes;
}
public V1beta2Device attributes(Map attributes) {
this.attributes = attributes;
return this;
}
public V1beta2Device putAttributesItem(String key, V1beta2DeviceAttribute attributesItem) {
if (this.attributes == null) {
this.attributes = new HashMap<>();
}
this.attributes.put(key, attributesItem);
return this;
}
/**
* Attributes defines the set of attributes for this device. The name of each attribute must be unique in that set. The maximum number of attributes and capacities combined is 32.
* @return attributes
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "Attributes defines the set of attributes for this device. The name of each attribute must be unique in that set. The maximum number of attributes and capacities combined is 32.")
public Map getAttributes() {
return attributes;
}
public void setAttributes(Map attributes) {
this.attributes = attributes;
}
public V1beta2Device capacity(Map capacity) {
this.capacity = capacity;
return this;
}
public V1beta2Device putCapacityItem(String key, V1beta2DeviceCapacity capacityItem) {
if (this.capacity == null) {
this.capacity = new HashMap<>();
}
this.capacity.put(key, capacityItem);
return this;
}
/**
* Capacity defines the set of capacities for this device. The name of each capacity must be unique in that set. The maximum number of attributes and capacities combined is 32.
* @return capacity
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "Capacity defines the set of capacities for this device. The name of each capacity must be unique in that set. The maximum number of attributes and capacities combined is 32.")
public Map getCapacity() {
return capacity;
}
public void setCapacity(Map capacity) {
this.capacity = capacity;
}
public V1beta2Device consumesCounters(List consumesCounters) {
this.consumesCounters = consumesCounters;
return this;
}
public V1beta2Device addConsumesCountersItem(V1beta2DeviceCounterConsumption consumesCountersItem) {
if (this.consumesCounters == null) {
this.consumesCounters = new ArrayList<>();
}
this.consumesCounters.add(consumesCountersItem);
return this;
}
/**
* ConsumesCounters defines a list of references to sharedCounters and the set of counters that the device will consume from those counter sets. There can only be a single entry per counterSet. The total number of device counter consumption entries must be <= 32. In addition, the total number in the entire ResourceSlice must be <= 1024 (for example, 64 devices with 16 counters each).
* @return consumesCounters
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "ConsumesCounters defines a list of references to sharedCounters and the set of counters that the device will consume from those counter sets. There can only be a single entry per counterSet. The total number of device counter consumption entries must be <= 32. In addition, the total number in the entire ResourceSlice must be <= 1024 (for example, 64 devices with 16 counters each).")
public List getConsumesCounters() {
return consumesCounters;
}
public void setConsumesCounters(List consumesCounters) {
this.consumesCounters = consumesCounters;
}
public V1beta2Device name(String name) {
this.name = name;
return this;
}
/**
* Name is unique identifier among all devices managed by the driver in the pool. It must be a DNS label.
* @return name
**/
@ApiModelProperty(required = true, value = "Name is unique identifier among all devices managed by the driver in the pool. It must be a DNS label.")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public V1beta2Device nodeName(String nodeName) {
this.nodeName = nodeName;
return this;
}
/**
* NodeName identifies the node where the device is available. Must only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.
* @return nodeName
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "NodeName identifies the node where the device is available. Must only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.")
public String getNodeName() {
return nodeName;
}
public void setNodeName(String nodeName) {
this.nodeName = nodeName;
}
public V1beta2Device nodeSelector(V1NodeSelector nodeSelector) {
this.nodeSelector = nodeSelector;
return this;
}
/**
* Get nodeSelector
* @return nodeSelector
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public V1NodeSelector getNodeSelector() {
return nodeSelector;
}
public void setNodeSelector(V1NodeSelector nodeSelector) {
this.nodeSelector = nodeSelector;
}
public V1beta2Device taints(List taints) {
this.taints = taints;
return this;
}
public V1beta2Device addTaintsItem(V1beta2DeviceTaint taintsItem) {
if (this.taints == null) {
this.taints = new ArrayList<>();
}
this.taints.add(taintsItem);
return this;
}
/**
* If specified, these are the driver-defined taints. The maximum number of taints is 4. This is an alpha field and requires enabling the DRADeviceTaints feature gate.
* @return taints
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "If specified, these are the driver-defined taints. The maximum number of taints is 4. This is an alpha field and requires enabling the DRADeviceTaints feature gate.")
public List getTaints() {
return taints;
}
public void setTaints(List taints) {
this.taints = taints;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
V1beta2Device v1beta2Device = (V1beta2Device) o;
return Objects.equals(this.allNodes, v1beta2Device.allNodes) &&
Objects.equals(this.attributes, v1beta2Device.attributes) &&
Objects.equals(this.capacity, v1beta2Device.capacity) &&
Objects.equals(this.consumesCounters, v1beta2Device.consumesCounters) &&
Objects.equals(this.name, v1beta2Device.name) &&
Objects.equals(this.nodeName, v1beta2Device.nodeName) &&
Objects.equals(this.nodeSelector, v1beta2Device.nodeSelector) &&
Objects.equals(this.taints, v1beta2Device.taints);
}
@Override
public int hashCode() {
return Objects.hash(allNodes, attributes, capacity, consumesCounters, name, nodeName, nodeSelector, taints);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class V1beta2Device {\n");
sb.append(" allNodes: ").append(toIndentedString(allNodes)).append("\n");
sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n");
sb.append(" capacity: ").append(toIndentedString(capacity)).append("\n");
sb.append(" consumesCounters: ").append(toIndentedString(consumesCounters)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" nodeName: ").append(toIndentedString(nodeName)).append("\n");
sb.append(" nodeSelector: ").append(toIndentedString(nodeSelector)).append("\n");
sb.append(" taints: ").append(toIndentedString(taints)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy