Files
sdk/model_compute_cluster_view.go

573 lines
17 KiB
Go

/*
Hanzo Cloud API
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
API version: v1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package hanzoai
import (
"encoding/json"
)
// checks if the ComputeClusterView type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &ComputeClusterView{}
// ComputeClusterView struct for ComputeClusterView
type ComputeClusterView struct {
// AmdGPU is the same count for `amd.com/gpu`: AMD accelerators across the BYO cluster's nodes, as of the attach.
AmdGpu *int64 `json:"amdGpu,omitempty"`
// CreatedAt is when the cluster started existing: the earliest creation time among its pools for a managed cluster, and for a BYO one the RFC 3339 moment it was attached. Empty when the source states none.
CreatedAt *string `json:"createdAt,omitempty"`
// DoClusterID carries the SAME id as DoksClusterID. Both names exist because the console's Cluster type reads either one; neither is a second identifier.
DoClusterId *string `json:"doClusterId,omitempty"`
// DoksClusterID is the provider's own id for the cluster, and the value the /v1/compute/k8s/clusters/:id routes take. Empty for a BYO cluster: an attached kubeconfig was never provisioned, so there is no provider id to state.
DoksClusterId *string `json:"doksClusterId,omitempty"`
// Kind says which of the two kinds of cluster this row is, and there are only two: \"managed\" — Visor provisioned it and Hanzo's account pays the provider — or \"byo\", an existing cluster the org attached by kubeconfig.
Kind *string `json:"kind,omitempty"`
// Name is the cluster's name: the provider's for a managed cluster, and for a BYO one the lower-cased fleet name it was attached under — which is also how the detach route addresses it.
Name *string `json:"name,omitempty"`
// NodeCount is how many worker nodes the cluster has — the sum over its pools for a managed cluster, and for a BYO one the node count read off the cluster when it was attached.
NodeCount *int64 `json:"nodeCount,omitempty"`
// NodePools is the authoritative node inventory — every pool, each with its own size and count. It is empty in two cases that are not \"no pools\": a row from the /v1/compute/k8s/clusters LIST, which is deliberately lightweight and whose :id detail carries them, and a BYO cluster, whose pools were never read.
NodePools []ComputeNodePoolView `json:"nodePools,omitempty"`
// NodeSize is a display convenience: the size slug of the FIRST pool. A cluster mixing sizes has more than one, and NodePools is where they all are.
NodeSize *string `json:"nodeSize,omitempty"`
// NvidiaGPU is how many NVIDIA accelerators the cluster's nodes advertise, the sum of `nvidia.com/gpu` allocatable across them. BYO only, and counted ONCE when the cluster was attached — it is an inventory, not live capacity.
NvidiaGpu *int64 `json:"nvidiaGpu,omitempty"`
// Region is the provider region slug for a managed cluster. A BYO cluster has no region we can read, so it carries the free-form `provider` label the attach named it with (\"gke\", \"on-prem\") instead.
Region *string `json:"region,omitempty"`
// Status is the cluster's state: the provider's own word for a managed cluster (\"running\", \"provisioning\"), \"unknown\" when the provider stated none, and always \"attached\" for a BYO cluster — that one says the kubeconfig is on file, not that the cluster is reachable this second.
Status *string `json:"status,omitempty"`
AdditionalProperties map[string]interface{}
}
type _ComputeClusterView ComputeClusterView
// NewComputeClusterView instantiates a new ComputeClusterView object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
func NewComputeClusterView() *ComputeClusterView {
this := ComputeClusterView{}
return &this
}
// NewComputeClusterViewWithDefaults instantiates a new ComputeClusterView object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewComputeClusterViewWithDefaults() *ComputeClusterView {
this := ComputeClusterView{}
return &this
}
// GetAmdGpu returns the AmdGpu field value if set, zero value otherwise.
func (o *ComputeClusterView) GetAmdGpu() int64 {
if o == nil || IsNil(o.AmdGpu) {
var ret int64
return ret
}
return *o.AmdGpu
}
// GetAmdGpuOk returns a tuple with the AmdGpu field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ComputeClusterView) GetAmdGpuOk() (*int64, bool) {
if o == nil || IsNil(o.AmdGpu) {
return nil, false
}
return o.AmdGpu, true
}
// HasAmdGpu returns a boolean if a field has been set.
func (o *ComputeClusterView) HasAmdGpu() bool {
if o != nil && !IsNil(o.AmdGpu) {
return true
}
return false
}
// SetAmdGpu gets a reference to the given int64 and assigns it to the AmdGpu field.
func (o *ComputeClusterView) SetAmdGpu(v int64) {
o.AmdGpu = &v
}
// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise.
func (o *ComputeClusterView) GetCreatedAt() string {
if o == nil || IsNil(o.CreatedAt) {
var ret string
return ret
}
return *o.CreatedAt
}
// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ComputeClusterView) GetCreatedAtOk() (*string, bool) {
if o == nil || IsNil(o.CreatedAt) {
return nil, false
}
return o.CreatedAt, true
}
// HasCreatedAt returns a boolean if a field has been set.
func (o *ComputeClusterView) HasCreatedAt() bool {
if o != nil && !IsNil(o.CreatedAt) {
return true
}
return false
}
// SetCreatedAt gets a reference to the given string and assigns it to the CreatedAt field.
func (o *ComputeClusterView) SetCreatedAt(v string) {
o.CreatedAt = &v
}
// GetDoClusterId returns the DoClusterId field value if set, zero value otherwise.
func (o *ComputeClusterView) GetDoClusterId() string {
if o == nil || IsNil(o.DoClusterId) {
var ret string
return ret
}
return *o.DoClusterId
}
// GetDoClusterIdOk returns a tuple with the DoClusterId field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ComputeClusterView) GetDoClusterIdOk() (*string, bool) {
if o == nil || IsNil(o.DoClusterId) {
return nil, false
}
return o.DoClusterId, true
}
// HasDoClusterId returns a boolean if a field has been set.
func (o *ComputeClusterView) HasDoClusterId() bool {
if o != nil && !IsNil(o.DoClusterId) {
return true
}
return false
}
// SetDoClusterId gets a reference to the given string and assigns it to the DoClusterId field.
func (o *ComputeClusterView) SetDoClusterId(v string) {
o.DoClusterId = &v
}
// GetDoksClusterId returns the DoksClusterId field value if set, zero value otherwise.
func (o *ComputeClusterView) GetDoksClusterId() string {
if o == nil || IsNil(o.DoksClusterId) {
var ret string
return ret
}
return *o.DoksClusterId
}
// GetDoksClusterIdOk returns a tuple with the DoksClusterId field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ComputeClusterView) GetDoksClusterIdOk() (*string, bool) {
if o == nil || IsNil(o.DoksClusterId) {
return nil, false
}
return o.DoksClusterId, true
}
// HasDoksClusterId returns a boolean if a field has been set.
func (o *ComputeClusterView) HasDoksClusterId() bool {
if o != nil && !IsNil(o.DoksClusterId) {
return true
}
return false
}
// SetDoksClusterId gets a reference to the given string and assigns it to the DoksClusterId field.
func (o *ComputeClusterView) SetDoksClusterId(v string) {
o.DoksClusterId = &v
}
// GetKind returns the Kind field value if set, zero value otherwise.
func (o *ComputeClusterView) GetKind() string {
if o == nil || IsNil(o.Kind) {
var ret string
return ret
}
return *o.Kind
}
// GetKindOk returns a tuple with the Kind field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ComputeClusterView) GetKindOk() (*string, bool) {
if o == nil || IsNil(o.Kind) {
return nil, false
}
return o.Kind, true
}
// HasKind returns a boolean if a field has been set.
func (o *ComputeClusterView) HasKind() bool {
if o != nil && !IsNil(o.Kind) {
return true
}
return false
}
// SetKind gets a reference to the given string and assigns it to the Kind field.
func (o *ComputeClusterView) SetKind(v string) {
o.Kind = &v
}
// GetName returns the Name field value if set, zero value otherwise.
func (o *ComputeClusterView) GetName() string {
if o == nil || IsNil(o.Name) {
var ret string
return ret
}
return *o.Name
}
// GetNameOk returns a tuple with the Name field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ComputeClusterView) GetNameOk() (*string, bool) {
if o == nil || IsNil(o.Name) {
return nil, false
}
return o.Name, true
}
// HasName returns a boolean if a field has been set.
func (o *ComputeClusterView) HasName() bool {
if o != nil && !IsNil(o.Name) {
return true
}
return false
}
// SetName gets a reference to the given string and assigns it to the Name field.
func (o *ComputeClusterView) SetName(v string) {
o.Name = &v
}
// GetNodeCount returns the NodeCount field value if set, zero value otherwise.
func (o *ComputeClusterView) GetNodeCount() int64 {
if o == nil || IsNil(o.NodeCount) {
var ret int64
return ret
}
return *o.NodeCount
}
// GetNodeCountOk returns a tuple with the NodeCount field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ComputeClusterView) GetNodeCountOk() (*int64, bool) {
if o == nil || IsNil(o.NodeCount) {
return nil, false
}
return o.NodeCount, true
}
// HasNodeCount returns a boolean if a field has been set.
func (o *ComputeClusterView) HasNodeCount() bool {
if o != nil && !IsNil(o.NodeCount) {
return true
}
return false
}
// SetNodeCount gets a reference to the given int64 and assigns it to the NodeCount field.
func (o *ComputeClusterView) SetNodeCount(v int64) {
o.NodeCount = &v
}
// GetNodePools returns the NodePools field value if set, zero value otherwise.
func (o *ComputeClusterView) GetNodePools() []ComputeNodePoolView {
if o == nil || IsNil(o.NodePools) {
var ret []ComputeNodePoolView
return ret
}
return o.NodePools
}
// GetNodePoolsOk returns a tuple with the NodePools field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ComputeClusterView) GetNodePoolsOk() ([]ComputeNodePoolView, bool) {
if o == nil || IsNil(o.NodePools) {
return nil, false
}
return o.NodePools, true
}
// HasNodePools returns a boolean if a field has been set.
func (o *ComputeClusterView) HasNodePools() bool {
if o != nil && !IsNil(o.NodePools) {
return true
}
return false
}
// SetNodePools gets a reference to the given []ComputeNodePoolView and assigns it to the NodePools field.
func (o *ComputeClusterView) SetNodePools(v []ComputeNodePoolView) {
o.NodePools = v
}
// GetNodeSize returns the NodeSize field value if set, zero value otherwise.
func (o *ComputeClusterView) GetNodeSize() string {
if o == nil || IsNil(o.NodeSize) {
var ret string
return ret
}
return *o.NodeSize
}
// GetNodeSizeOk returns a tuple with the NodeSize field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ComputeClusterView) GetNodeSizeOk() (*string, bool) {
if o == nil || IsNil(o.NodeSize) {
return nil, false
}
return o.NodeSize, true
}
// HasNodeSize returns a boolean if a field has been set.
func (o *ComputeClusterView) HasNodeSize() bool {
if o != nil && !IsNil(o.NodeSize) {
return true
}
return false
}
// SetNodeSize gets a reference to the given string and assigns it to the NodeSize field.
func (o *ComputeClusterView) SetNodeSize(v string) {
o.NodeSize = &v
}
// GetNvidiaGpu returns the NvidiaGpu field value if set, zero value otherwise.
func (o *ComputeClusterView) GetNvidiaGpu() int64 {
if o == nil || IsNil(o.NvidiaGpu) {
var ret int64
return ret
}
return *o.NvidiaGpu
}
// GetNvidiaGpuOk returns a tuple with the NvidiaGpu field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ComputeClusterView) GetNvidiaGpuOk() (*int64, bool) {
if o == nil || IsNil(o.NvidiaGpu) {
return nil, false
}
return o.NvidiaGpu, true
}
// HasNvidiaGpu returns a boolean if a field has been set.
func (o *ComputeClusterView) HasNvidiaGpu() bool {
if o != nil && !IsNil(o.NvidiaGpu) {
return true
}
return false
}
// SetNvidiaGpu gets a reference to the given int64 and assigns it to the NvidiaGpu field.
func (o *ComputeClusterView) SetNvidiaGpu(v int64) {
o.NvidiaGpu = &v
}
// GetRegion returns the Region field value if set, zero value otherwise.
func (o *ComputeClusterView) GetRegion() string {
if o == nil || IsNil(o.Region) {
var ret string
return ret
}
return *o.Region
}
// GetRegionOk returns a tuple with the Region field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ComputeClusterView) GetRegionOk() (*string, bool) {
if o == nil || IsNil(o.Region) {
return nil, false
}
return o.Region, true
}
// HasRegion returns a boolean if a field has been set.
func (o *ComputeClusterView) HasRegion() bool {
if o != nil && !IsNil(o.Region) {
return true
}
return false
}
// SetRegion gets a reference to the given string and assigns it to the Region field.
func (o *ComputeClusterView) SetRegion(v string) {
o.Region = &v
}
// GetStatus returns the Status field value if set, zero value otherwise.
func (o *ComputeClusterView) GetStatus() string {
if o == nil || IsNil(o.Status) {
var ret string
return ret
}
return *o.Status
}
// GetStatusOk returns a tuple with the Status field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ComputeClusterView) GetStatusOk() (*string, bool) {
if o == nil || IsNil(o.Status) {
return nil, false
}
return o.Status, true
}
// HasStatus returns a boolean if a field has been set.
func (o *ComputeClusterView) HasStatus() bool {
if o != nil && !IsNil(o.Status) {
return true
}
return false
}
// SetStatus gets a reference to the given string and assigns it to the Status field.
func (o *ComputeClusterView) SetStatus(v string) {
o.Status = &v
}
func (o ComputeClusterView) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o ComputeClusterView) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.AmdGpu) {
toSerialize["amdGpu"] = o.AmdGpu
}
if !IsNil(o.CreatedAt) {
toSerialize["createdAt"] = o.CreatedAt
}
if !IsNil(o.DoClusterId) {
toSerialize["doClusterId"] = o.DoClusterId
}
if !IsNil(o.DoksClusterId) {
toSerialize["doksClusterId"] = o.DoksClusterId
}
if !IsNil(o.Kind) {
toSerialize["kind"] = o.Kind
}
if !IsNil(o.Name) {
toSerialize["name"] = o.Name
}
if !IsNil(o.NodeCount) {
toSerialize["nodeCount"] = o.NodeCount
}
if !IsNil(o.NodePools) {
toSerialize["nodePools"] = o.NodePools
}
if !IsNil(o.NodeSize) {
toSerialize["nodeSize"] = o.NodeSize
}
if !IsNil(o.NvidiaGpu) {
toSerialize["nvidiaGpu"] = o.NvidiaGpu
}
if !IsNil(o.Region) {
toSerialize["region"] = o.Region
}
if !IsNil(o.Status) {
toSerialize["status"] = o.Status
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *ComputeClusterView) UnmarshalJSON(data []byte) (err error) {
varComputeClusterView := _ComputeClusterView{}
err = json.Unmarshal(data, &varComputeClusterView)
if err != nil {
return err
}
*o = ComputeClusterView(varComputeClusterView)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "amdGpu")
delete(additionalProperties, "createdAt")
delete(additionalProperties, "doClusterId")
delete(additionalProperties, "doksClusterId")
delete(additionalProperties, "kind")
delete(additionalProperties, "name")
delete(additionalProperties, "nodeCount")
delete(additionalProperties, "nodePools")
delete(additionalProperties, "nodeSize")
delete(additionalProperties, "nvidiaGpu")
delete(additionalProperties, "region")
delete(additionalProperties, "status")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableComputeClusterView struct {
value *ComputeClusterView
isSet bool
}
func (v NullableComputeClusterView) Get() *ComputeClusterView {
return v.value
}
func (v *NullableComputeClusterView) Set(val *ComputeClusterView) {
v.value = val
v.isSet = true
}
func (v NullableComputeClusterView) IsSet() bool {
return v.isSet
}
func (v *NullableComputeClusterView) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableComputeClusterView(val *ComputeClusterView) *NullableComputeClusterView {
return &NullableComputeClusterView{value: val, isSet: true}
}
func (v NullableComputeClusterView) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableComputeClusterView) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}