diff --git a/cluster-autoscaler/README.md b/cluster-autoscaler/README.md index 6a246aa2e6..e41b0ba60c 100644 --- a/cluster-autoscaler/README.md +++ b/cluster-autoscaler/README.md @@ -19,6 +19,7 @@ You should also take a look at the notes and "gotchas" for your specific cloud p * [CloudStack](./cloudprovider/cloudstack/README.md) * [HuaweiCloud](./cloudprovider/huaweicloud/README.md) * [Packet](./cloudprovider/packet/README.md#notes) +* [IonosCloud](./cloudprovider/ionoscloud/README.md) # Releases diff --git a/cluster-autoscaler/cloudprovider/builder/builder_all.go b/cluster-autoscaler/cloudprovider/builder/builder_all.go index dd0e9168fc..dd26d2c162 100644 --- a/cluster-autoscaler/cloudprovider/builder/builder_all.go +++ b/cluster-autoscaler/cloudprovider/builder/builder_all.go @@ -1,4 +1,4 @@ -// +build !gce,!aws,!azure,!kubemark,!alicloud,!magnum,!digitalocean,!clusterapi,!huaweicloud +// +build !gce,!aws,!azure,!kubemark,!alicloud,!magnum,!digitalocean,!clusterapi,!huaweicloud,!ionoscloud /* Copyright 2018 The Kubernetes Authors. @@ -30,6 +30,7 @@ import ( "k8s.io/autoscaler/cluster-autoscaler/cloudprovider/exoscale" "k8s.io/autoscaler/cluster-autoscaler/cloudprovider/gce" "k8s.io/autoscaler/cluster-autoscaler/cloudprovider/huaweicloud" + "k8s.io/autoscaler/cluster-autoscaler/cloudprovider/ionoscloud" "k8s.io/autoscaler/cluster-autoscaler/cloudprovider/magnum" "k8s.io/autoscaler/cluster-autoscaler/cloudprovider/packet" "k8s.io/autoscaler/cluster-autoscaler/config" @@ -48,6 +49,7 @@ var AvailableCloudProviders = []string{ cloudprovider.ExoscaleProviderName, cloudprovider.HuaweicloudProviderName, clusterapi.ProviderName, + cloudprovider.IonoscloudProviderName, } // DefaultCloudProvider is GCE. @@ -79,6 +81,8 @@ func buildCloudProvider(opts config.AutoscalingOptions, do cloudprovider.NodeGro return packet.BuildPacket(opts, do, rl) case clusterapi.ProviderName: return clusterapi.BuildClusterAPI(opts, do, rl) + case cloudprovider.IonoscloudProviderName: + return ionoscloud.BuildIonosCloud(opts, do, rl) } return nil } diff --git a/cluster-autoscaler/cloudprovider/builder/builder_ionoscloud.go b/cluster-autoscaler/cloudprovider/builder/builder_ionoscloud.go new file mode 100644 index 0000000000..1f821f465d --- /dev/null +++ b/cluster-autoscaler/cloudprovider/builder/builder_ionoscloud.go @@ -0,0 +1,42 @@ +// +build ionoscloud + +/* +Copyright 2020 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 builder + +import ( + "k8s.io/autoscaler/cluster-autoscaler/cloudprovider" + "k8s.io/autoscaler/cluster-autoscaler/cloudprovider/ionoscloud" + "k8s.io/autoscaler/cluster-autoscaler/config" +) + +// AvailableCloudProviders supported by the cloud provider builder. +var AvailableCloudProviders = []string{ + cloudprovider.IonoscloudProviderName, +} + +// DefaultCloudProvider for IonosCloud-only build is ionoscloud. +const DefaultCloudProvider = cloudprovider.IonoscloudProviderName + +func buildCloudProvider(opts config.AutoscalingOptions, do cloudprovider.NodeGroupDiscoveryOptions, rl *cloudprovider.ResourceLimiter) cloudprovider.CloudProvider { + switch opts.CloudProviderName { + case cloudprovider.IonoscloudProviderName: + return ionoscloud.BuildIonosCloud(opts, do, rl) + } + + return nil +} diff --git a/cluster-autoscaler/cloudprovider/cloud_provider.go b/cluster-autoscaler/cloudprovider/cloud_provider.go index 519603c0e3..401dc77ab1 100644 --- a/cluster-autoscaler/cloudprovider/cloud_provider.go +++ b/cluster-autoscaler/cloudprovider/cloud_provider.go @@ -49,6 +49,8 @@ const ( KubemarkProviderName = "kubemark" // HuaweicloudProviderName gets the provider name of huaweicloud HuaweicloudProviderName = "huaweicloud" + // IonoscloudProviderName gets the provider name of ionoscloud + IonoscloudProviderName = "ionoscloud" ) // CloudProvider contains configuration info and functions for interacting with diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/.gitignore b/cluster-autoscaler/cloudprovider/ionoscloud/.gitignore new file mode 100644 index 0000000000..570159fe6d --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/.gitignore @@ -0,0 +1,2 @@ +*.out +.envrc diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/OWNERS b/cluster-autoscaler/cloudprovider/ionoscloud/OWNERS new file mode 100644 index 0000000000..f698d69e8f --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/OWNERS @@ -0,0 +1,3 @@ +maintainers: +- avorima +- schegi diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/README.md b/cluster-autoscaler/cloudprovider/ionoscloud/README.md new file mode 100644 index 0000000000..0893372159 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/README.md @@ -0,0 +1,34 @@ +# Cluster Autoscaler on Ionos Cloud Managed Kubernetes + +The cluster autoscaler for the Ionos Cloud scales worker nodes within Managed Kubernetes cluster +node pools. It can be deployed as `Deployment` in your cluster. + +## Deployment + +### Managed + +Managed autoscaling can be enabled or disabled via Kubernetes Manager in the [DCD](https://dcd.ionos.com/latest/) +or [API](https://devops.ionos.com/api/cloud/v5/#update-a-nodepool). +In this case a `Deployment` is not needed, since it will be deployed in the managed Kubernetes controlplane. + +### In-cluster + +Build and push a docker image in the `cluster-autoscaler` directory: + +```sh +make build-in-docker BUILD_TAGS=ionoscloud +make make-image BUILD_TAGS=ionoscloud TAG='' REGISTRY='' +make push-image BUILD_TAGS=ionoscloud TAG='' REGISTRY='' +``` + +If you don't have a token, generate one: + +```sh +curl -u '' -p '' https://api.ionos.com/auth/v1/tokens/generate +``` + +Edit [`cluster-autoscaler-standard.yaml`](./examples/cluster-autoscaler-standard.yaml) and deploy it: + +```console +kubectl apply -f examples/cluster-autoscaler-standard.yaml +``` diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/cache.go b/cluster-autoscaler/cloudprovider/ionoscloud/cache.go new file mode 100644 index 0000000000..8ff6769912 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/cache.go @@ -0,0 +1,285 @@ +/* +Copyright 2020 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 ionoscloud + +import ( + "sync" + "time" + + "k8s.io/autoscaler/cluster-autoscaler/cloudprovider" + "k8s.io/klog/v2" +) + +const nodeGroupCacheEntryTimeout = 2 * time.Minute + +type nodeGroupCacheEntry struct { + data cloudprovider.NodeGroup + ts time.Time +} + +var timeNow = time.Now + +// IonosCache caches resources to reduce API calls. +// Cached state includes autoscaling limits, sizes and target sizes, a mapping of instances to node +// groups, and a simple lock mechanism to prevent invalid node group writes. +type IonosCache struct { + mutex sync.Mutex + + nodeGroups map[string]nodeGroupCacheEntry + nodesToNodeGroups map[string]string + instances map[string]cloudprovider.Instance + nodeGroupSizes map[string]int + nodeGroupTargetSizes map[string]int + nodeGroupLockTable map[string]bool +} + +// NewIonosCache initializes a new IonosCache. +func NewIonosCache() *IonosCache { + return &IonosCache{ + nodeGroups: map[string]nodeGroupCacheEntry{}, + nodesToNodeGroups: map[string]string{}, + instances: map[string]cloudprovider.Instance{}, + nodeGroupSizes: map[string]int{}, + nodeGroupTargetSizes: map[string]int{}, + nodeGroupLockTable: map[string]bool{}, + } +} + +// GetInstancesForNodeGroup returns the list of cached instances a node group. +func (cache *IonosCache) GetInstancesForNodeGroup(id string) []cloudprovider.Instance { + cache.mutex.Lock() + defer cache.mutex.Unlock() + + var nodeIds []string + for nodeId, nodeGroupId := range cache.nodesToNodeGroups { + if nodeGroupId == id { + nodeIds = append(nodeIds, nodeId) + } + } + instances := make([]cloudprovider.Instance, len(nodeIds)) + for i, id := range nodeIds { + instances[i] = cache.instances[id] + } + return instances +} + +// AddNodeGroup adds a node group to the cache. +func (cache *IonosCache) AddNodeGroup(newPool cloudprovider.NodeGroup) { + cache.mutex.Lock() + defer cache.mutex.Unlock() + + cache.nodeGroups[newPool.Id()] = nodeGroupCacheEntry{data: newPool} +} + +func (cache *IonosCache) removeNodesForNodeGroupNoLock(id string) { + for nodeId, nodeGroupId := range cache.nodesToNodeGroups { + if nodeGroupId == id { + delete(cache.instances, nodeId) + delete(cache.nodesToNodeGroups, nodeId) + } + } +} + +// RemoveInstanceFromCache deletes an instance and its respective mapping to the node group from +// the cache. +func (cache *IonosCache) RemoveInstanceFromCache(id string) { + cache.mutex.Lock() + defer cache.mutex.Unlock() + + klog.V(5).Infof("Removed instance %s from cache", id) + nodeGroupId := cache.nodesToNodeGroups[id] + delete(cache.nodesToNodeGroups, id) + delete(cache.instances, id) + cache.updateNodeGroupTimestampNoLock(nodeGroupId) +} + +// SetInstancesCache overwrites all cached instances and node group mappings. +func (cache *IonosCache) SetInstancesCache(nodeGroupInstances map[string][]cloudprovider.Instance) { + cache.mutex.Lock() + defer cache.mutex.Unlock() + + cache.nodesToNodeGroups = map[string]string{} + cache.instances = map[string]cloudprovider.Instance{} + + for id, instances := range nodeGroupInstances { + cache.setInstancesCacheForNodeGroupNoLock(id, instances) + } +} + +// SetInstancesCacheForNodeGroup overwrites cached instances and mappings for a node group. +func (cache *IonosCache) SetInstancesCacheForNodeGroup(id string, instances []cloudprovider.Instance) { + cache.mutex.Lock() + defer cache.mutex.Unlock() + + cache.removeNodesForNodeGroupNoLock(id) + cache.setInstancesCacheForNodeGroupNoLock(id, instances) +} + +func (cache *IonosCache) setInstancesCacheForNodeGroupNoLock(id string, instances []cloudprovider.Instance) { + for _, instance := range instances { + nodeId := convertToNodeId(instance.Id) + cache.nodesToNodeGroups[nodeId] = id + cache.instances[nodeId] = instance + } + cache.updateNodeGroupTimestampNoLock(id) +} + +// GetNodeGroupIds returns an unsorted list of cached node group ids. +func (cache *IonosCache) GetNodeGroupIds() []string { + cache.mutex.Lock() + defer cache.mutex.Unlock() + + return cache.getNodeGroupIds() +} + +func (cache *IonosCache) getNodeGroupIds() []string { + ids := make([]string, 0, len(cache.nodeGroups)) + for id := range cache.nodeGroups { + ids = append(ids, id) + } + return ids +} + +// GetNodeGroups returns an unsorted list of cached node groups. +func (cache *IonosCache) GetNodeGroups() []cloudprovider.NodeGroup { + cache.mutex.Lock() + defer cache.mutex.Unlock() + + nodeGroups := make([]cloudprovider.NodeGroup, 0, len(cache.nodeGroups)) + for id := range cache.nodeGroups { + nodeGroups = append(nodeGroups, cache.nodeGroups[id].data) + } + return nodeGroups +} + +// GetInstances returns an unsorted list of all cached instances. +func (cache *IonosCache) GetInstances() []cloudprovider.Instance { + cache.mutex.Lock() + defer cache.mutex.Unlock() + + instances := make([]cloudprovider.Instance, 0, len(cache.nodesToNodeGroups)) + for _, instance := range cache.instances { + instances = append(instances, instance) + } + return instances +} + +// GetNodeGroupForNode returns the node group for the given node. +// Returns nil if either the mapping or the node group is not cached. +func (cache *IonosCache) GetNodeGroupForNode(nodeId string) cloudprovider.NodeGroup { + cache.mutex.Lock() + defer cache.mutex.Unlock() + + id, found := cache.nodesToNodeGroups[nodeId] + if !found { + return nil + } + entry, found := cache.nodeGroups[id] + if !found { + return nil + } + return entry.data +} + +// TryLockNodeGroup tries to write a node group lock entry. +// Returns true if the write was successful. +func (cache *IonosCache) TryLockNodeGroup(nodeGroup cloudprovider.NodeGroup) bool { + cache.mutex.Lock() + defer cache.mutex.Unlock() + + if cache.nodeGroupLockTable[nodeGroup.Id()] { + return false + } + + klog.V(4).Infof("Acquired lock for node group %s", nodeGroup.Id()) + cache.nodeGroupLockTable[nodeGroup.Id()] = true + return true +} + +// UnlockNodeGroup deletes a node group lock entry if it exists. +func (cache *IonosCache) UnlockNodeGroup(nodeGroup cloudprovider.NodeGroup) { + cache.mutex.Lock() + defer cache.mutex.Unlock() + + if _, found := cache.nodeGroupLockTable[nodeGroup.Id()]; found { + klog.V(5).Infof("Released lock for node group %s", nodeGroup.Id()) + delete(cache.nodeGroupLockTable, nodeGroup.Id()) + } +} + +// GetNodeGroupSize gets the node group's size. Return true if the size was in the cache. +func (cache *IonosCache) GetNodeGroupSize(id string) (int, bool) { + cache.mutex.Lock() + defer cache.mutex.Unlock() + + size, found := cache.nodeGroupSizes[id] + return size, found +} + +// SetNodeGroupSize sets the node group's size. +func (cache *IonosCache) SetNodeGroupSize(id string, size int) { + cache.mutex.Lock() + defer cache.mutex.Unlock() + + previousSize := cache.nodeGroupSizes[id] + klog.V(5).Infof("Updated node group size cache: nodeGroup=%s, previousSize=%d, currentSize=%d", id, previousSize, size) + cache.nodeGroupSizes[id] = size +} + +// GetNodeGroupTargetSize gets the node group's target size. Return true if the target size was in the +// cache. +func (cache *IonosCache) GetNodeGroupTargetSize(id string) (int, bool) { + cache.mutex.Lock() + defer cache.mutex.Unlock() + + size, found := cache.nodeGroupTargetSizes[id] + return size, found +} + +// SetNodeGroupTargetSize sets the node group's target size. +func (cache *IonosCache) SetNodeGroupTargetSize(id string, size int) { + cache.mutex.Lock() + defer cache.mutex.Unlock() + + previousSize := cache.nodeGroupSizes[id] + klog.V(5).Infof("Updated node group target size cache: nodeGroup=%s, previousTargetSize=%d, currentTargetSize=%d", id, previousSize, size) + cache.nodeGroupTargetSizes[id] = size +} + +// InvalidateNodeGroupTargetSize deletes a node group's target size entry. +func (cache *IonosCache) InvalidateNodeGroupTargetSize(id string) { + cache.mutex.Lock() + defer cache.mutex.Unlock() + + delete(cache.nodeGroupTargetSizes, id) +} + +// NodeGroupNeedsRefresh returns true when the instances for the given node group have not been +// updated for more than 2 minutes. +func (cache *IonosCache) NodeGroupNeedsRefresh(id string) bool { + cache.mutex.Lock() + defer cache.mutex.Unlock() + + return timeNow().Sub(cache.nodeGroups[id].ts) > nodeGroupCacheEntryTimeout +} + +func (cache *IonosCache) updateNodeGroupTimestampNoLock(id string) { + if entry, ok := cache.nodeGroups[id]; ok { + entry.ts = timeNow() + cache.nodeGroups[id] = entry + } +} diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/cache_test.go b/cluster-autoscaler/cloudprovider/ionoscloud/cache_test.go new file mode 100644 index 0000000000..38a7b6dbfa --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/cache_test.go @@ -0,0 +1,220 @@ +/* +Copyright 2020 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 ionoscloud + +import ( + "testing" + "time" + + "github.com/stretchr/testify/require" + "k8s.io/autoscaler/cluster-autoscaler/cloudprovider" +) + +func newCacheEntry(data cloudprovider.NodeGroup, ts time.Time) nodeGroupCacheEntry { + return nodeGroupCacheEntry{data: data, ts: ts} +} + +func TestCache_GetInstancesForNodeGroup(t *testing.T) { + cache := NewIonosCache() + cache.nodesToNodeGroups = map[string]string{ + "node-1": "nodepool-1", + "node-2": "nodepool-2", + "node-3": "nodepool-1", + } + cache.instances = map[string]cloudprovider.Instance{ + "node-1": {Id: convertToInstanceId("node-1")}, + "node-2": {Id: convertToInstanceId("node-2")}, + "node-3": {Id: convertToInstanceId("node-3")}, + } + + expect := []cloudprovider.Instance{ + {Id: convertToInstanceId("node-1")}, + {Id: convertToInstanceId("node-3")}, + } + instances := cache.GetInstancesForNodeGroup("nodepool-1") + require.ElementsMatch(t, expect, instances) +} + +func TestCache_AddNodeGroup(t *testing.T) { + cache := NewIonosCache() + require.Empty(t, cache.GetNodeGroups()) + cache.AddNodeGroup(&nodePool{id: "123", min: 1, max: 3}) + require.Equal(t, []cloudprovider.NodeGroup{&nodePool{id: "123", min: 1, max: 3}}, cache.GetNodeGroups()) +} + +func TestCache_RemoveInstanceFromCache(t *testing.T) { + firstTime := timeNow().Add(-2*time.Minute - 1*time.Second) + cache := NewIonosCache() + cache.nodeGroups["2"] = newCacheEntry(&nodePool{id: "2"}, firstTime) + cache.nodesToNodeGroups["b2"] = "2" + cache.instances["b2"] = newInstance("b2") + + require.NotNil(t, cache.GetNodeGroupForNode("b2")) + require.NotEmpty(t, cache.GetInstances()) + require.True(t, cache.NodeGroupNeedsRefresh("2")) + + cache.RemoveInstanceFromCache("b2") + require.Nil(t, cache.GetNodeGroupForNode("b2")) + require.Empty(t, cache.GetInstances()) + require.False(t, cache.NodeGroupNeedsRefresh("2")) +} + +func TestCache_SetInstancesCache(t *testing.T) { + cache := NewIonosCache() + cache.nodeGroups["2"] = newCacheEntry(&nodePool{id: "2"}, timeNow()) + cache.nodesToNodeGroups["b2"] = "2" + cache.instances["a3"] = newInstance("b2") + nodePoolInstances := map[string][]cloudprovider.Instance{ + "1": {newInstance("a1"), newInstance("a2")}, + "2": {newInstance("b1")}, + } + + require.NotNil(t, cache.GetNodeGroupForNode("b2")) + cache.SetInstancesCache(nodePoolInstances) + + require.Nil(t, cache.GetNodeGroupForNode("b2")) + require.ElementsMatch(t, []cloudprovider.Instance{ + newInstance("a1"), newInstance("a2"), newInstance("b1"), + }, cache.GetInstances()) +} + +func TestCache_SetInstancesCacheForNodeGroup(t *testing.T) { + cache := NewIonosCache() + cache.AddNodeGroup(&nodePool{id: "1"}) + cache.AddNodeGroup(&nodePool{id: "2"}) + cache.nodesToNodeGroups["a3"] = "1" + cache.nodesToNodeGroups["b1"] = "2" + cache.instances["a3"] = newInstance("b2") + cache.instances["b1"] = newInstance("b1") + instances := []cloudprovider.Instance{newInstance("a1"), newInstance("a2")} + + require.NotNil(t, cache.GetNodeGroupForNode("a3")) + cache.SetInstancesCacheForNodeGroup("1", instances) + + require.Nil(t, cache.GetNodeGroupForNode("a3")) + require.ElementsMatch(t, []cloudprovider.Instance{ + newInstance("a1"), newInstance("a2"), newInstance("b1"), + }, cache.GetInstances()) +} + +func TestCache_GetNodeGroupIDs(t *testing.T) { + cache := NewIonosCache() + require.Empty(t, cache.GetNodeGroupIds()) + cache.AddNodeGroup(&nodePool{id: "1"}) + require.Equal(t, []string{"1"}, cache.GetNodeGroupIds()) + cache.AddNodeGroup(&nodePool{id: "2"}) + require.ElementsMatch(t, []string{"1", "2"}, cache.GetNodeGroupIds()) +} + +func TestCache_GetNodeGroups(t *testing.T) { + cache := NewIonosCache() + require.Empty(t, cache.GetNodeGroups()) + cache.AddNodeGroup(&nodePool{id: "1"}) + require.Equal(t, []cloudprovider.NodeGroup{&nodePool{id: "1"}}, cache.GetNodeGroups()) + cache.AddNodeGroup(&nodePool{id: "2"}) + require.ElementsMatch(t, []*nodePool{{id: "1"}, {id: "2"}}, cache.GetNodeGroups()) +} + +func TestCache_GetInstances(t *testing.T) { + cache := NewIonosCache() + require.Empty(t, cache.GetInstances()) + cache.nodesToNodeGroups["a1"] = "1" + cache.nodesToNodeGroups["a2"] = "1" + cache.instances["a1"] = newInstance("a1") + cache.instances["a2"] = newInstance("a2") + require.ElementsMatch(t, []cloudprovider.Instance{ + newInstance("a1"), newInstance("a2"), + }, cache.GetInstances()) +} + +func TestCache_GetNodeGroupForNode(t *testing.T) { + cache := NewIonosCache() + require.Nil(t, cache.GetNodeGroupForNode("a1")) + cache.AddNodeGroup(&nodePool{id: "1"}) + require.Nil(t, cache.GetNodeGroupForNode("a1")) + cache.nodesToNodeGroups["a1"] = "1" + require.EqualValues(t, &nodePool{id: "1"}, cache.GetNodeGroupForNode("a1")) +} + +func TestCache_LockUnlockNodeGroup(t *testing.T) { + cache := NewIonosCache() + nodePool := &nodePool{id: "1"} + require.True(t, cache.TryLockNodeGroup(nodePool)) + require.False(t, cache.TryLockNodeGroup(nodePool)) + cache.UnlockNodeGroup(nodePool) + require.True(t, cache.TryLockNodeGroup(nodePool)) +} + +func TestCache_GetSetNodeGroupSize(t *testing.T) { + cache := NewIonosCache() + + size, found := cache.GetNodeGroupSize("1") + require.False(t, found) + require.Zero(t, size) + + cache.SetNodeGroupSize("2", 1) + size, found = cache.GetNodeGroupSize("1") + require.False(t, found) + require.Zero(t, size) + + cache.SetNodeGroupSize("1", 2) + size, found = cache.GetNodeGroupSize("1") + require.True(t, found) + require.Equal(t, 2, size) +} + +func TestCache_GetSetNodeGroupTargetSize(t *testing.T) { + cache := NewIonosCache() + + size, found := cache.GetNodeGroupTargetSize("1") + require.False(t, found) + require.Zero(t, size) + + cache.SetNodeGroupTargetSize("2", 1) + size, found = cache.GetNodeGroupTargetSize("1") + require.False(t, found) + require.Zero(t, size) + + cache.SetNodeGroupTargetSize("1", 2) + size, found = cache.GetNodeGroupTargetSize("1") + require.True(t, found) + require.Equal(t, 2, size) + + cache.InvalidateNodeGroupTargetSize("1") + size, found = cache.GetNodeGroupTargetSize("1") + require.False(t, found) + require.Zero(t, size) +} + +func TestCache_NodeGroupNeedsRefresh(t *testing.T) { + fixedTime := time.Now().Round(time.Second) + timeNow = func() time.Time { return fixedTime } + defer func() { timeNow = time.Now }() + + cache := NewIonosCache() + require.True(t, cache.NodeGroupNeedsRefresh("test")) + + cache.AddNodeGroup(&nodePool{id: "test"}) + require.True(t, cache.NodeGroupNeedsRefresh("test")) + cache.SetInstancesCacheForNodeGroup("test", nil) + require.False(t, cache.NodeGroupNeedsRefresh("test")) + + timeNow = func() time.Time { return fixedTime.Add(nodeGroupCacheEntryTimeout) } + require.False(t, cache.NodeGroupNeedsRefresh("test")) + timeNow = func() time.Time { return fixedTime.Add(nodeGroupCacheEntryTimeout + 1*time.Second) } + require.True(t, cache.NodeGroupNeedsRefresh("test")) +} diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/client.go b/cluster-autoscaler/cloudprovider/ionoscloud/client.go new file mode 100644 index 0000000000..570f37e60b --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/client.go @@ -0,0 +1,225 @@ +/* +Copyright 2020 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 ionoscloud + +import ( + "context" + "crypto/tls" + "fmt" + "io/ioutil" + "net/http" + "path/filepath" + "time" + + uuid "github.com/satori/go.uuid" + "k8s.io/apimachinery/pkg/util/wait" + ionos "k8s.io/autoscaler/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go" + "k8s.io/klog/v2" + "k8s.io/utils/pointer" +) + +const ( + // K8sStateActive indicates that the cluster/nodepool resource is active. + K8sStateActive = "ACTIVE" + // K8sStateUpdating indicates that the cluster/nodepool resource is being updated. + K8sStateUpdating = "UPDATING" +) + +const ( + // K8sNodeStateReady indicates that the Kubernetes Node was provisioned and joined the cluster. + K8sNodeStateReady = "READY" + // K8sNodeStateProvisioning indicates that the instance backing the Kubernetes Node is being provisioned. + K8sNodeStateProvisioning = "PROVISIONING" + // K8sNodeStateProvisioned indicates that the instance backing the Kubernetes Node is ready + K8sNodeStateProvisioned = "PROVISIONED" + // K8sNodeStateTerminating indicates that the Kubernetes Node is being deleted. + K8sNodeStateTerminating = "TERMINATING" + // K8sNodeStateRebuilding indicates that the Kubernetes Node is being rebuilt. + K8sNodeStateRebuilding = "REBUILDING" +) + +// APIClient provides a subset of API calls necessary to perform autoscaling. +type APIClient interface { + K8sNodepoolsFindById(ctx context.Context, k8sClusterId string, nodepoolId string) ionos.ApiK8sNodepoolsFindByIdRequest + K8sNodepoolsFindByIdExecute(r ionos.ApiK8sNodepoolsFindByIdRequest) (ionos.KubernetesNodePool, *ionos.APIResponse, error) + K8sNodepoolsNodesGet(ctx context.Context, k8sClusterId string, nodepoolId string) ionos.ApiK8sNodepoolsNodesGetRequest + K8sNodepoolsNodesGetExecute(r ionos.ApiK8sNodepoolsNodesGetRequest) (ionos.KubernetesNodes, *ionos.APIResponse, error) + K8sNodepoolsNodesDelete(ctx context.Context, k8sClusterId string, nodepoolId string, nodeId string) ionos.ApiK8sNodepoolsNodesDeleteRequest + K8sNodepoolsNodesDeleteExecute(r ionos.ApiK8sNodepoolsNodesDeleteRequest) (map[string]interface{}, *ionos.APIResponse, error) + K8sNodepoolsPut(ctx context.Context, k8sClusterId string, nodepoolId string) ionos.ApiK8sNodepoolsPutRequest + K8sNodepoolsPutExecute(r ionos.ApiK8sNodepoolsPutRequest) (ionos.KubernetesNodePoolForPut, *ionos.APIResponse, error) +} + +var apiClientFactory = NewAPIClient + +// NewAPIClient creates a new IonosCloud API client. +func NewAPIClient(token, endpoint string, insecure bool) APIClient { + config := ionos.NewConfiguration("", "", token) + if endpoint != "" { + config.Servers[0].URL = endpoint + } + if insecure { + config.HTTPClient = &http.Client{ + Transport: &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, //nolint: gosec + }, + } + } + config.Debug = klog.V(6).Enabled() + client := ionos.NewAPIClient(config) + return client.KubernetesApi +} + +// AutoscalingClient is a client abstraction used for autoscaling. +type AutoscalingClient struct { + client APIClient + clusterId string + endpoint string + insecure bool + pollTimeout time.Duration + pollInterval time.Duration + tokens map[string]string +} + +// NewAutoscalingClient contructs a new autoscaling client. +func NewAutoscalingClient(config *Config) (*AutoscalingClient, error) { + c := &AutoscalingClient{ + clusterId: config.ClusterId, + endpoint: config.Endpoint, + insecure: config.Insecure, + pollTimeout: config.PollTimeout, + pollInterval: config.PollInterval, + } + if config.Token != "" { + c.client = apiClientFactory(config.Token, config.Endpoint, config.Insecure) + } else if config.TokensPath != "" { + tokens, err := loadTokensFromFilesystem(config.TokensPath) + if err != nil { + return nil, err + } + c.tokens = tokens + } + return c, nil +} + +// loadTokensFromFilesystem loads a mapping of node pool UUIDs to JWT tokens from the given path. +func loadTokensFromFilesystem(path string) (map[string]string, error) { + klog.V(3).Infof("Loading tokens from: %s", path) + filenames, _ := filepath.Glob(filepath.Join(path, "*")) + tokens := make(map[string]string) + for _, filename := range filenames { + name := filepath.Base(filename) + if _, err := uuid.FromString(name); err != nil { + continue + } + data, err := ioutil.ReadFile(filename) + if err != nil { + return nil, err + } + tokens[name] = string(data) + } + if len(tokens) == 0 { + return nil, fmt.Errorf("%s did not contain any valid entries", path) + } + return tokens, nil +} + +// apiClientFor returns an IonosCloud API client for the given node pool. +// If the cache was not initialized with a client a new one will be created using a cached token. +func (c *AutoscalingClient) apiClientFor(id string) (APIClient, error) { + if c.client != nil { + return c.client, nil + } + token, exists := c.tokens[id] + if !exists { + return nil, fmt.Errorf("missing token for node pool %s", id) + } + return apiClientFactory(token, c.endpoint, c.insecure), nil +} + +// GetNodePool gets a node pool. +func (c *AutoscalingClient) GetNodePool(id string) (*ionos.KubernetesNodePool, error) { + client, err := c.apiClientFor(id) + if err != nil { + return nil, err + } + req := client.K8sNodepoolsFindById(context.Background(), c.clusterId, id) + nodepool, _, err := client.K8sNodepoolsFindByIdExecute(req) + if err != nil { + return nil, err + } + return &nodepool, nil +} + +func resizeRequestBody(targetSize int) ionos.KubernetesNodePoolPropertiesForPut { + return ionos.KubernetesNodePoolPropertiesForPut{ + NodeCount: pointer.Int32Ptr(int32(targetSize)), + } +} + +// ResizeNodePool sets the target size of a node pool and starts the resize process. +// The node pool target size cannot be changed until this operation finishes. +func (c *AutoscalingClient) ResizeNodePool(id string, targetSize int) error { + client, err := c.apiClientFor(id) + if err != nil { + return err + } + req := client.K8sNodepoolsPut(context.Background(), c.clusterId, id) + req = req.KubernetesNodePoolProperties(resizeRequestBody(targetSize)) + _, _, err = client.K8sNodepoolsPutExecute(req) + return err +} + +// WaitForNodePoolResize polls the node pool until it is in state ACTIVE. +func (c *AutoscalingClient) WaitForNodePoolResize(id string, size int) error { + klog.V(1).Infof("Waiting for node pool %s to reach target size %d", id, size) + return wait.PollImmediate(c.pollInterval, c.pollTimeout, func() (bool, error) { + nodePool, err := c.GetNodePool(id) + if err != nil { + return false, fmt.Errorf("failed to fetch node pool %s: %w", id, err) + } + state := *nodePool.Metadata.State + klog.V(5).Infof("Polled node pool %s: state=%s", id, state) + return state == K8sStateActive, nil + }) +} + +// ListNodes lists nodes. +func (c *AutoscalingClient) ListNodes(id string) ([]ionos.KubernetesNode, error) { + client, err := c.apiClientFor(id) + if err != nil { + return nil, err + } + req := client.K8sNodepoolsNodesGet(context.Background(), c.clusterId, id) + req = req.Depth(1) + nodes, _, err := client.K8sNodepoolsNodesGetExecute(req) + if err != nil { + return nil, err + } + return *nodes.Items, nil +} + +// DeleteNode starts node deletion. +func (c *AutoscalingClient) DeleteNode(id, nodeId string) error { + client, err := c.apiClientFor(id) + if err != nil { + return err + } + req := client.K8sNodepoolsNodesDelete(context.Background(), c.clusterId, id, nodeId) + _, _, err = client.K8sNodepoolsNodesDeleteExecute(req) + return err +} diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/client_test.go b/cluster-autoscaler/cloudprovider/ionoscloud/client_test.go new file mode 100644 index 0000000000..f21e4981dc --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/client_test.go @@ -0,0 +1,129 @@ +/* +Copyright 2020 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 ionoscloud + +import ( + "fmt" + "io/ioutil" + "os" + "path/filepath" + "testing" + + uuid "github.com/satori/go.uuid" + "github.com/stretchr/testify/require" +) + +func TestAPIClientFor(t *testing.T) { + apiClientFactory = func(_, _ string, _ bool) APIClient { return &MockAPIClient{} } + defer func() { apiClientFactory = NewAPIClient }() + + cases := []struct { + name string + token string + cachedTokens map[string]string + expectClient APIClient + expectError bool + }{ + { + name: "from cached client", + token: "token", + expectClient: &MockAPIClient{}, + }, + { + name: "from token cache", + cachedTokens: map[string]string{"test": "token"}, + expectClient: &MockAPIClient{}, + }, + { + name: "not in token cache", + cachedTokens: map[string]string{"notfound": "token"}, + expectError: true, + }, + } + + for _, c := range cases { + t.Run(c.name, func(t *testing.T) { + apiClientFactory = func(_, _ string, _ bool) APIClient { return &MockAPIClient{} } + defer func() { apiClientFactory = NewAPIClient }() + + client, _ := NewAutoscalingClient(&Config{ + Token: c.token, + Endpoint: "https://api.cloud.ionos.com/v6", + Insecure: true, + }) + client.tokens = c.cachedTokens + apiClient, err := client.apiClientFor("test") + require.Equalf(t, c.expectError, err != nil, "expected error: %t, got: %v", c.expectError, err) + require.EqualValues(t, c.expectClient, apiClient) + }) + } +} + +func TestLoadTokensFromFilesystem_OK(t *testing.T) { + tempDir, err := ioutil.TempDir("", t.Name()) + require.NoError(t, err) + defer func() { _ = os.RemoveAll(tempDir) }() + + uuid1, uuid2, uuid3 := uuid.NewV4().String(), uuid.NewV4().String(), uuid.NewV4().String() + + input := map[string]string{ + uuid1: "token1", + uuid2: "token2", + uuid3: "token3", + } + expect := map[string]string{ + uuid1: "token1", + uuid2: "token2", + uuid3: "token3", + } + + for name, token := range input { + require.NoError(t, ioutil.WriteFile(filepath.Join(tempDir, name), []byte(token), 0600)) + } + require.NoError(t, ioutil.WriteFile(filepath.Join(tempDir, "..somfile"), []byte("foobar"), 0600)) + + client, err := NewAutoscalingClient(&Config{TokensPath: tempDir}) + require.NoError(t, err) + require.Equal(t, expect, client.tokens) +} + +func TestLoadTokensFromFilesystem_ReadError(t *testing.T) { + tempDir, err := ioutil.TempDir("", t.Name()) + require.NoError(t, err) + defer func() { _ = os.RemoveAll(tempDir) }() + + require.NoError(t, os.Mkdir(filepath.Join(tempDir, uuid.NewV4().String()), 0755)) + client, err := NewAutoscalingClient(&Config{TokensPath: tempDir}) + require.Error(t, err) + require.Nil(t, client) +} + +func TestLoadTokensFromFilesystem_NoValidToken(t *testing.T) { + tempDir, err := ioutil.TempDir("", t.Name()) + require.NoError(t, err) + defer func() { _ = os.RemoveAll(tempDir) }() + + for i := 0; i < 10; i++ { + path := filepath.Join(tempDir, fmt.Sprintf("notauuid%d", i)) + require.NoError(t, ioutil.WriteFile(path, []byte("token"), 0600)) + path = filepath.Join(tempDir, fmt.Sprintf("foo.bar.notauuid%d", i)) + require.NoError(t, ioutil.WriteFile(path, []byte("token"), 0600)) + } + client, err := NewAutoscalingClient(&Config{TokensPath: tempDir}) + require.Error(t, err) + require.Nil(t, client) +} diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/examples/cluster-autoscaler-standard.yaml b/cluster-autoscaler/cloudprovider/ionoscloud/examples/cluster-autoscaler-standard.yaml new file mode 100644 index 0000000000..1abad729ec --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/examples/cluster-autoscaler-standard.yaml @@ -0,0 +1,170 @@ +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: + k8s-addon: cluster-autoscaler.addons.k8s.io + k8s-app: cluster-autoscaler + name: cluster-autoscaler + namespace: kube-system +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: cluster-autoscaler + labels: + k8s-addon: cluster-autoscaler.addons.k8s.io + k8s-app: cluster-autoscaler +rules: + - apiGroups: [""] + resources: ["events", "endpoints"] + verbs: ["create", "patch"] + - apiGroups: [""] + resources: ["pods/eviction"] + verbs: ["create"] + - apiGroups: [""] + resources: ["pods/status"] + verbs: ["update"] + - apiGroups: [""] + resources: ["endpoints"] + resourceNames: ["cluster-autoscaler"] + verbs: ["get", "update"] + - apiGroups: [""] + resources: ["nodes"] + verbs: ["watch", "list", "get", "update"] + - apiGroups: [""] + resources: + - "pods" + - "services" + - "replicationcontrollers" + - "persistentvolumeclaims" + - "persistentvolumes" + verbs: ["watch", "list", "get"] + - apiGroups: ["extensions"] + resources: ["replicasets", "daemonsets"] + verbs: ["watch", "list", "get"] + - apiGroups: ["policy"] + resources: ["poddisruptionbudgets"] + verbs: ["watch", "list"] + - apiGroups: ["apps"] + resources: ["statefulsets", "replicasets", "daemonsets"] + verbs: ["watch", "list", "get"] + - apiGroups: ["storage.k8s.io"] + resources: ["storageclasses", "csinodes"] + verbs: ["watch", "list", "get"] + - apiGroups: ["batch", "extensions"] + resources: ["jobs"] + verbs: ["get", "list", "watch", "patch"] + - apiGroups: ["coordination.k8s.io"] + resources: ["leases"] + verbs: ["create"] + - apiGroups: ["coordination.k8s.io"] + resourceNames: ["cluster-autoscaler"] + resources: ["leases"] + verbs: ["get", "update"] +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: cluster-autoscaler + namespace: kube-system + labels: + k8s-addon: cluster-autoscaler.addons.k8s.io + k8s-app: cluster-autoscaler +rules: + - apiGroups: [""] + resources: ["configmaps"] + verbs: ["create", "list", "watch"] + - apiGroups: [""] + resources: ["configmaps"] + resourceNames: ["cluster-autoscaler-status", "cluster-autoscaler-priority-expander"] + verbs: ["delete", "get", "update", "watch"] + +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: cluster-autoscaler + labels: + k8s-addon: cluster-autoscaler.addons.k8s.io + k8s-app: cluster-autoscaler +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: cluster-autoscaler +subjects: + - kind: ServiceAccount + name: cluster-autoscaler + namespace: kube-system + +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: cluster-autoscaler + namespace: kube-system + labels: + k8s-addon: cluster-autoscaler.addons.k8s.io + k8s-app: cluster-autoscaler +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: cluster-autoscaler +subjects: + - kind: ServiceAccount + name: cluster-autoscaler + namespace: kube-system +--- +apiVersion: v1 +kind: Secret +metadata: + name: cluster-autoscaler + namespace: kube-system +type: Opaque +stringData: + IONOS_CLUSTER_ID: + IONOS_TOKEN: +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: cluster-autoscaler + namespace: kube-system + labels: + app: cluster-autoscaler +spec: + replicas: 1 + selector: + matchLabels: + app: cluster-autoscaler + template: + metadata: + labels: + app: cluster-autoscaler + annotations: + prometheus.io/scrape: 'true' + prometheus.io/port: '8085' + spec: + serviceAccountName: cluster-autoscaler + containers: + - image: k8s.gcr.io/autoscaling/cluster-autoscaler:latest # or your custom image + name: cluster-autoscaler + imagePullPolicy: Always + resources: + limits: + cpu: 100m + memory: 300Mi + requests: + cpu: 100m + memory: 300Mi + command: + - ./cluster-autoscaler + - --v=4 + - --logtostderr=true + - --stderrthreshold=info + - --cloud-provider=ionoscloud + - --skip-nodes-with-local-storage=false + - --nodes=:: # repeatable + envFrom: + - secretRef: + name: cluster-autoscaler diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_backup_unit.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_backup_unit.go new file mode 100644 index 0000000000..63098600a9 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_backup_unit.go @@ -0,0 +1,1154 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" +) + +// Linger please +var ( + _ _context.Context +) + +// BackupUnitApiService BackupUnitApi service +type BackupUnitApiService service + +type ApiBackupunitsDeleteRequest struct { + ctx _context.Context + ApiService *BackupUnitApiService + backupunitId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiBackupunitsDeleteRequest) Pretty(pretty bool) ApiBackupunitsDeleteRequest { + r.pretty = &pretty + return r +} +func (r ApiBackupunitsDeleteRequest) Depth(depth int32) ApiBackupunitsDeleteRequest { + r.depth = &depth + return r +} +func (r ApiBackupunitsDeleteRequest) XContractNumber(xContractNumber int32) ApiBackupunitsDeleteRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiBackupunitsDeleteRequest) Execute() (map[string]interface{}, *APIResponse, error) { + return r.ApiService.BackupunitsDeleteExecute(r) +} + +/* + * BackupunitsDelete Delete a Backup Unit + * NOTE: Running through the deletion process will delete: - the backup plans inside the Backup Unit. - all backups associated with the Backup Unit. - the backup user and finally also the unit + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param backupunitId The unique ID of the backup Unit + * @return ApiBackupunitsDeleteRequest + */ +func (a *BackupUnitApiService) BackupunitsDelete(ctx _context.Context, backupunitId string) ApiBackupunitsDeleteRequest { + return ApiBackupunitsDeleteRequest{ + ApiService: a, + ctx: ctx, + backupunitId: backupunitId, + } +} + +/* + * Execute executes the request + * @return map[string]interface{} + */ +func (a *BackupUnitApiService) BackupunitsDeleteExecute(r ApiBackupunitsDeleteRequest) (map[string]interface{}, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BackupUnitApiService.BackupunitsDelete") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/backupunits/{backupunitId}" + localVarPath = strings.Replace(localVarPath, "{"+"backupunitId"+"}", _neturl.PathEscape(parameterToString(r.backupunitId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "BackupunitsDelete", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiBackupunitsFindByIdRequest struct { + ctx _context.Context + ApiService *BackupUnitApiService + backupunitId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiBackupunitsFindByIdRequest) Pretty(pretty bool) ApiBackupunitsFindByIdRequest { + r.pretty = &pretty + return r +} +func (r ApiBackupunitsFindByIdRequest) Depth(depth int32) ApiBackupunitsFindByIdRequest { + r.depth = &depth + return r +} +func (r ApiBackupunitsFindByIdRequest) XContractNumber(xContractNumber int32) ApiBackupunitsFindByIdRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiBackupunitsFindByIdRequest) Execute() (BackupUnit, *APIResponse, error) { + return r.ApiService.BackupunitsFindByIdExecute(r) +} + +/* + * BackupunitsFindById Returns the specified backup Unit + * You can retrieve the details of an specific backup unit. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param backupunitId The unique ID of the backup unit + * @return ApiBackupunitsFindByIdRequest + */ +func (a *BackupUnitApiService) BackupunitsFindById(ctx _context.Context, backupunitId string) ApiBackupunitsFindByIdRequest { + return ApiBackupunitsFindByIdRequest{ + ApiService: a, + ctx: ctx, + backupunitId: backupunitId, + } +} + +/* + * Execute executes the request + * @return BackupUnit + */ +func (a *BackupUnitApiService) BackupunitsFindByIdExecute(r ApiBackupunitsFindByIdRequest) (BackupUnit, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue BackupUnit + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BackupUnitApiService.BackupunitsFindById") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/backupunits/{backupunitId}" + localVarPath = strings.Replace(localVarPath, "{"+"backupunitId"+"}", _neturl.PathEscape(parameterToString(r.backupunitId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "BackupunitsFindById", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiBackupunitsGetRequest struct { + ctx _context.Context + ApiService *BackupUnitApiService + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiBackupunitsGetRequest) Pretty(pretty bool) ApiBackupunitsGetRequest { + r.pretty = &pretty + return r +} +func (r ApiBackupunitsGetRequest) Depth(depth int32) ApiBackupunitsGetRequest { + r.depth = &depth + return r +} +func (r ApiBackupunitsGetRequest) XContractNumber(xContractNumber int32) ApiBackupunitsGetRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiBackupunitsGetRequest) Execute() (BackupUnits, *APIResponse, error) { + return r.ApiService.BackupunitsGetExecute(r) +} + +/* + * BackupunitsGet List Backup Units + * You can retrieve a complete list of backup Units that you have access to. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiBackupunitsGetRequest + */ +func (a *BackupUnitApiService) BackupunitsGet(ctx _context.Context) ApiBackupunitsGetRequest { + return ApiBackupunitsGetRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + * @return BackupUnits + */ +func (a *BackupUnitApiService) BackupunitsGetExecute(r ApiBackupunitsGetRequest) (BackupUnits, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue BackupUnits + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BackupUnitApiService.BackupunitsGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/backupunits" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "BackupunitsGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiBackupunitsPatchRequest struct { + ctx _context.Context + ApiService *BackupUnitApiService + backupunitId string + backupUnitProperties *BackupUnitProperties + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiBackupunitsPatchRequest) BackupUnitProperties(backupUnitProperties BackupUnitProperties) ApiBackupunitsPatchRequest { + r.backupUnitProperties = &backupUnitProperties + return r +} +func (r ApiBackupunitsPatchRequest) Pretty(pretty bool) ApiBackupunitsPatchRequest { + r.pretty = &pretty + return r +} +func (r ApiBackupunitsPatchRequest) Depth(depth int32) ApiBackupunitsPatchRequest { + r.depth = &depth + return r +} +func (r ApiBackupunitsPatchRequest) XContractNumber(xContractNumber int32) ApiBackupunitsPatchRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiBackupunitsPatchRequest) Execute() (BackupUnit, *APIResponse, error) { + return r.ApiService.BackupunitsPatchExecute(r) +} + +/* + * BackupunitsPatch Partially modify a Backup Unit + * You can use update a backup Unit properties + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param backupunitId The unique ID of the backup unit + * @return ApiBackupunitsPatchRequest + */ +func (a *BackupUnitApiService) BackupunitsPatch(ctx _context.Context, backupunitId string) ApiBackupunitsPatchRequest { + return ApiBackupunitsPatchRequest{ + ApiService: a, + ctx: ctx, + backupunitId: backupunitId, + } +} + +/* + * Execute executes the request + * @return BackupUnit + */ +func (a *BackupUnitApiService) BackupunitsPatchExecute(r ApiBackupunitsPatchRequest) (BackupUnit, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue BackupUnit + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BackupUnitApiService.BackupunitsPatch") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/backupunits/{backupunitId}" + localVarPath = strings.Replace(localVarPath, "{"+"backupunitId"+"}", _neturl.PathEscape(parameterToString(r.backupunitId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.backupUnitProperties == nil { + return localVarReturnValue, nil, reportError("backupUnitProperties is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.backupUnitProperties + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "BackupunitsPatch", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiBackupunitsPostRequest struct { + ctx _context.Context + ApiService *BackupUnitApiService + backupUnit *BackupUnit + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiBackupunitsPostRequest) BackupUnit(backupUnit BackupUnit) ApiBackupunitsPostRequest { + r.backupUnit = &backupUnit + return r +} +func (r ApiBackupunitsPostRequest) Pretty(pretty bool) ApiBackupunitsPostRequest { + r.pretty = &pretty + return r +} +func (r ApiBackupunitsPostRequest) Depth(depth int32) ApiBackupunitsPostRequest { + r.depth = &depth + return r +} +func (r ApiBackupunitsPostRequest) XContractNumber(xContractNumber int32) ApiBackupunitsPostRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiBackupunitsPostRequest) Execute() (BackupUnit, *APIResponse, error) { + return r.ApiService.BackupunitsPostExecute(r) +} + +/* + * BackupunitsPost Create a Backup Unit + * Create a Backup Unit. A Backup Unit is considered a resource like a virtual datacenter, IP Block, snapshot, etc. It shall be shareable via groups inside our User Management Feature + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiBackupunitsPostRequest + */ +func (a *BackupUnitApiService) BackupunitsPost(ctx _context.Context) ApiBackupunitsPostRequest { + return ApiBackupunitsPostRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + * @return BackupUnit + */ +func (a *BackupUnitApiService) BackupunitsPostExecute(r ApiBackupunitsPostRequest) (BackupUnit, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue BackupUnit + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BackupUnitApiService.BackupunitsPost") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/backupunits" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.backupUnit == nil { + return localVarReturnValue, nil, reportError("backupUnit is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.backupUnit + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "BackupunitsPost", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiBackupunitsPutRequest struct { + ctx _context.Context + ApiService *BackupUnitApiService + backupunitId string + backupUnit *BackupUnit + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiBackupunitsPutRequest) BackupUnit(backupUnit BackupUnit) ApiBackupunitsPutRequest { + r.backupUnit = &backupUnit + return r +} +func (r ApiBackupunitsPutRequest) Pretty(pretty bool) ApiBackupunitsPutRequest { + r.pretty = &pretty + return r +} +func (r ApiBackupunitsPutRequest) Depth(depth int32) ApiBackupunitsPutRequest { + r.depth = &depth + return r +} +func (r ApiBackupunitsPutRequest) XContractNumber(xContractNumber int32) ApiBackupunitsPutRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiBackupunitsPutRequest) Execute() (BackupUnit, *APIResponse, error) { + return r.ApiService.BackupunitsPutExecute(r) +} + +/* + * BackupunitsPut Modify a Backup Unit + * You can use update a backup Unit properties + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param backupunitId The unique ID of the backup unit + * @return ApiBackupunitsPutRequest + */ +func (a *BackupUnitApiService) BackupunitsPut(ctx _context.Context, backupunitId string) ApiBackupunitsPutRequest { + return ApiBackupunitsPutRequest{ + ApiService: a, + ctx: ctx, + backupunitId: backupunitId, + } +} + +/* + * Execute executes the request + * @return BackupUnit + */ +func (a *BackupUnitApiService) BackupunitsPutExecute(r ApiBackupunitsPutRequest) (BackupUnit, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue BackupUnit + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BackupUnitApiService.BackupunitsPut") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/backupunits/{backupunitId}" + localVarPath = strings.Replace(localVarPath, "{"+"backupunitId"+"}", _neturl.PathEscape(parameterToString(r.backupunitId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.backupUnit == nil { + return localVarReturnValue, nil, reportError("backupUnit is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.backupUnit + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "BackupunitsPut", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiBackupunitsSsourlGetRequest struct { + ctx _context.Context + ApiService *BackupUnitApiService + backupunitId string + pretty *bool + xContractNumber *int32 +} + +func (r ApiBackupunitsSsourlGetRequest) Pretty(pretty bool) ApiBackupunitsSsourlGetRequest { + r.pretty = &pretty + return r +} +func (r ApiBackupunitsSsourlGetRequest) XContractNumber(xContractNumber int32) ApiBackupunitsSsourlGetRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiBackupunitsSsourlGetRequest) Execute() (BackupUnitSSO, *APIResponse, error) { + return r.ApiService.BackupunitsSsourlGetExecute(r) +} + +/* + * BackupunitsSsourlGet Returns a single signon URL for the specified backup Unit. + * Returns a single signon URL for the specified backup Unit. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param backupunitId The unique UUID of the backup unit + * @return ApiBackupunitsSsourlGetRequest + */ +func (a *BackupUnitApiService) BackupunitsSsourlGet(ctx _context.Context, backupunitId string) ApiBackupunitsSsourlGetRequest { + return ApiBackupunitsSsourlGetRequest{ + ApiService: a, + ctx: ctx, + backupunitId: backupunitId, + } +} + +/* + * Execute executes the request + * @return BackupUnitSSO + */ +func (a *BackupUnitApiService) BackupunitsSsourlGetExecute(r ApiBackupunitsSsourlGetRequest) (BackupUnitSSO, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue BackupUnitSSO + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BackupUnitApiService.BackupunitsSsourlGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/backupunits/{backupunitId}/ssourl" + localVarPath = strings.Replace(localVarPath, "{"+"backupunitId"+"}", _neturl.PathEscape(parameterToString(r.backupunitId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "BackupunitsSsourlGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_contract.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_contract.go new file mode 100644 index 0000000000..5d1ad332f4 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_contract.go @@ -0,0 +1,181 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" +) + +// Linger please +var ( + _ _context.Context +) + +// ContractApiService ContractApi service +type ContractApiService service + +type ApiContractsGetRequest struct { + ctx _context.Context + ApiService *ContractApiService + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiContractsGetRequest) Pretty(pretty bool) ApiContractsGetRequest { + r.pretty = &pretty + return r +} +func (r ApiContractsGetRequest) Depth(depth int32) ApiContractsGetRequest { + r.depth = &depth + return r +} +func (r ApiContractsGetRequest) XContractNumber(xContractNumber int32) ApiContractsGetRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiContractsGetRequest) Execute() (Contract, *APIResponse, error) { + return r.ApiService.ContractsGetExecute(r) +} + +/* + * ContractsGet Retrieve a Contract + * Retrieves the attributes of user's contract. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiContractsGetRequest + */ +func (a *ContractApiService) ContractsGet(ctx _context.Context) ApiContractsGetRequest { + return ApiContractsGetRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + * @return Contract + */ +func (a *ContractApiService) ContractsGetExecute(r ApiContractsGetRequest) (Contract, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Contract + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ContractApiService.ContractsGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/contracts" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "ContractsGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_data_center.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_data_center.go new file mode 100644 index 0000000000..67138e907e --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_data_center.go @@ -0,0 +1,1003 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" +) + +// Linger please +var ( + _ _context.Context +) + +// DataCenterApiService DataCenterApi service +type DataCenterApiService service + +type ApiDatacentersDeleteRequest struct { + ctx _context.Context + ApiService *DataCenterApiService + datacenterId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersDeleteRequest) Pretty(pretty bool) ApiDatacentersDeleteRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersDeleteRequest) Depth(depth int32) ApiDatacentersDeleteRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersDeleteRequest) XContractNumber(xContractNumber int32) ApiDatacentersDeleteRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersDeleteRequest) Execute() (map[string]interface{}, *APIResponse, error) { + return r.ApiService.DatacentersDeleteExecute(r) +} + +/* + * DatacentersDelete Delete a Data Center + * Will remove all objects within the datacenter and remove the datacenter object itself, too. This is a highly destructive method which should be used with caution + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @return ApiDatacentersDeleteRequest + */ +func (a *DataCenterApiService) DatacentersDelete(ctx _context.Context, datacenterId string) ApiDatacentersDeleteRequest { + return ApiDatacentersDeleteRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + } +} + +/* + * Execute executes the request + * @return map[string]interface{} + */ +func (a *DataCenterApiService) DatacentersDeleteExecute(r ApiDatacentersDeleteRequest) (map[string]interface{}, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DataCenterApiService.DatacentersDelete") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersDelete", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersFindByIdRequest struct { + ctx _context.Context + ApiService *DataCenterApiService + datacenterId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersFindByIdRequest) Pretty(pretty bool) ApiDatacentersFindByIdRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersFindByIdRequest) Depth(depth int32) ApiDatacentersFindByIdRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersFindByIdRequest) XContractNumber(xContractNumber int32) ApiDatacentersFindByIdRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersFindByIdRequest) Execute() (Datacenter, *APIResponse, error) { + return r.ApiService.DatacentersFindByIdExecute(r) +} + +/* + * DatacentersFindById Retrieve a Data Center + * You can retrieve a data center by using the resource's ID. This value can be found in the response body when a datacenter is created or when you GET a list of datacenters. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @return ApiDatacentersFindByIdRequest + */ +func (a *DataCenterApiService) DatacentersFindById(ctx _context.Context, datacenterId string) ApiDatacentersFindByIdRequest { + return ApiDatacentersFindByIdRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + } +} + +/* + * Execute executes the request + * @return Datacenter + */ +func (a *DataCenterApiService) DatacentersFindByIdExecute(r ApiDatacentersFindByIdRequest) (Datacenter, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Datacenter + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DataCenterApiService.DatacentersFindById") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersFindById", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersGetRequest struct { + ctx _context.Context + ApiService *DataCenterApiService + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersGetRequest) Pretty(pretty bool) ApiDatacentersGetRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersGetRequest) Depth(depth int32) ApiDatacentersGetRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersGetRequest) XContractNumber(xContractNumber int32) ApiDatacentersGetRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersGetRequest) Execute() (Datacenters, *APIResponse, error) { + return r.ApiService.DatacentersGetExecute(r) +} + +/* + * DatacentersGet List Data Centers under your account + * You can retrieve a complete list of data centers provisioned under your account + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiDatacentersGetRequest + */ +func (a *DataCenterApiService) DatacentersGet(ctx _context.Context) ApiDatacentersGetRequest { + return ApiDatacentersGetRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + * @return Datacenters + */ +func (a *DataCenterApiService) DatacentersGetExecute(r ApiDatacentersGetRequest) (Datacenters, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Datacenters + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DataCenterApiService.DatacentersGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersPatchRequest struct { + ctx _context.Context + ApiService *DataCenterApiService + datacenterId string + datacenter *DatacenterProperties + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersPatchRequest) Datacenter(datacenter DatacenterProperties) ApiDatacentersPatchRequest { + r.datacenter = &datacenter + return r +} +func (r ApiDatacentersPatchRequest) Pretty(pretty bool) ApiDatacentersPatchRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersPatchRequest) Depth(depth int32) ApiDatacentersPatchRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersPatchRequest) XContractNumber(xContractNumber int32) ApiDatacentersPatchRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersPatchRequest) Execute() (Datacenter, *APIResponse, error) { + return r.ApiService.DatacentersPatchExecute(r) +} + +/* + * DatacentersPatch Partially modify a Data Center + * You can use update datacenter to re-name the datacenter or update its description + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @return ApiDatacentersPatchRequest + */ +func (a *DataCenterApiService) DatacentersPatch(ctx _context.Context, datacenterId string) ApiDatacentersPatchRequest { + return ApiDatacentersPatchRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + } +} + +/* + * Execute executes the request + * @return Datacenter + */ +func (a *DataCenterApiService) DatacentersPatchExecute(r ApiDatacentersPatchRequest) (Datacenter, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Datacenter + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DataCenterApiService.DatacentersPatch") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.datacenter == nil { + return localVarReturnValue, nil, reportError("datacenter is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.datacenter + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersPatch", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersPostRequest struct { + ctx _context.Context + ApiService *DataCenterApiService + datacenter *Datacenter + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersPostRequest) Datacenter(datacenter Datacenter) ApiDatacentersPostRequest { + r.datacenter = &datacenter + return r +} +func (r ApiDatacentersPostRequest) Pretty(pretty bool) ApiDatacentersPostRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersPostRequest) Depth(depth int32) ApiDatacentersPostRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersPostRequest) XContractNumber(xContractNumber int32) ApiDatacentersPostRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersPostRequest) Execute() (Datacenter, *APIResponse, error) { + return r.ApiService.DatacentersPostExecute(r) +} + +/* + * DatacentersPost Create a Data Center + * Virtual data centers are the foundation of the platform. They act as logical containers for all other objects you will be creating, e.g. servers. You can provision as many data centers as you want. Datacenters have their own private network and are logically segmented from each other to create isolation. You can use this POST method to create a simple datacenter or to create a datacenter with multiple objects under it such as servers and storage volumes. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiDatacentersPostRequest + */ +func (a *DataCenterApiService) DatacentersPost(ctx _context.Context) ApiDatacentersPostRequest { + return ApiDatacentersPostRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + * @return Datacenter + */ +func (a *DataCenterApiService) DatacentersPostExecute(r ApiDatacentersPostRequest) (Datacenter, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Datacenter + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DataCenterApiService.DatacentersPost") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.datacenter == nil { + return localVarReturnValue, nil, reportError("datacenter is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.datacenter + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersPost", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersPutRequest struct { + ctx _context.Context + ApiService *DataCenterApiService + datacenterId string + datacenter *Datacenter + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersPutRequest) Datacenter(datacenter Datacenter) ApiDatacentersPutRequest { + r.datacenter = &datacenter + return r +} +func (r ApiDatacentersPutRequest) Pretty(pretty bool) ApiDatacentersPutRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersPutRequest) Depth(depth int32) ApiDatacentersPutRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersPutRequest) XContractNumber(xContractNumber int32) ApiDatacentersPutRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersPutRequest) Execute() (Datacenter, *APIResponse, error) { + return r.ApiService.DatacentersPutExecute(r) +} + +/* + * DatacentersPut Modify a Data Center + * You can use update datacenter to re-name the datacenter or update its description + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @return ApiDatacentersPutRequest + */ +func (a *DataCenterApiService) DatacentersPut(ctx _context.Context, datacenterId string) ApiDatacentersPutRequest { + return ApiDatacentersPutRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + } +} + +/* + * Execute executes the request + * @return Datacenter + */ +func (a *DataCenterApiService) DatacentersPutExecute(r ApiDatacentersPutRequest) (Datacenter, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Datacenter + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DataCenterApiService.DatacentersPut") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.datacenter == nil { + return localVarReturnValue, nil, reportError("datacenter is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.datacenter + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersPut", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_image.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_image.go new file mode 100644 index 0000000000..48d6def5d0 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_image.go @@ -0,0 +1,838 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" +) + +// Linger please +var ( + _ _context.Context +) + +// ImageApiService ImageApi service +type ImageApiService service + +type ApiImagesDeleteRequest struct { + ctx _context.Context + ApiService *ImageApiService + imageId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiImagesDeleteRequest) Pretty(pretty bool) ApiImagesDeleteRequest { + r.pretty = &pretty + return r +} +func (r ApiImagesDeleteRequest) Depth(depth int32) ApiImagesDeleteRequest { + r.depth = &depth + return r +} +func (r ApiImagesDeleteRequest) XContractNumber(xContractNumber int32) ApiImagesDeleteRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiImagesDeleteRequest) Execute() (map[string]interface{}, *APIResponse, error) { + return r.ApiService.ImagesDeleteExecute(r) +} + +/* + * ImagesDelete Delete an Image + * Deletes the specified image. This operation is permitted on private image only. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param imageId + * @return ApiImagesDeleteRequest + */ +func (a *ImageApiService) ImagesDelete(ctx _context.Context, imageId string) ApiImagesDeleteRequest { + return ApiImagesDeleteRequest{ + ApiService: a, + ctx: ctx, + imageId: imageId, + } +} + +/* + * Execute executes the request + * @return map[string]interface{} + */ +func (a *ImageApiService) ImagesDeleteExecute(r ApiImagesDeleteRequest) (map[string]interface{}, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ImageApiService.ImagesDelete") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/images/{imageId}" + localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", _neturl.PathEscape(parameterToString(r.imageId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "ImagesDelete", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiImagesFindByIdRequest struct { + ctx _context.Context + ApiService *ImageApiService + imageId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiImagesFindByIdRequest) Pretty(pretty bool) ApiImagesFindByIdRequest { + r.pretty = &pretty + return r +} +func (r ApiImagesFindByIdRequest) Depth(depth int32) ApiImagesFindByIdRequest { + r.depth = &depth + return r +} +func (r ApiImagesFindByIdRequest) XContractNumber(xContractNumber int32) ApiImagesFindByIdRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiImagesFindByIdRequest) Execute() (Image, *APIResponse, error) { + return r.ApiService.ImagesFindByIdExecute(r) +} + +/* + * ImagesFindById Retrieve an Image + * Retrieves the attributes of a given image. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param imageId + * @return ApiImagesFindByIdRequest + */ +func (a *ImageApiService) ImagesFindById(ctx _context.Context, imageId string) ApiImagesFindByIdRequest { + return ApiImagesFindByIdRequest{ + ApiService: a, + ctx: ctx, + imageId: imageId, + } +} + +/* + * Execute executes the request + * @return Image + */ +func (a *ImageApiService) ImagesFindByIdExecute(r ApiImagesFindByIdRequest) (Image, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Image + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ImageApiService.ImagesFindById") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/images/{imageId}" + localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", _neturl.PathEscape(parameterToString(r.imageId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "ImagesFindById", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiImagesGetRequest struct { + ctx _context.Context + ApiService *ImageApiService + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiImagesGetRequest) Pretty(pretty bool) ApiImagesGetRequest { + r.pretty = &pretty + return r +} +func (r ApiImagesGetRequest) Depth(depth int32) ApiImagesGetRequest { + r.depth = &depth + return r +} +func (r ApiImagesGetRequest) XContractNumber(xContractNumber int32) ApiImagesGetRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiImagesGetRequest) Execute() (Images, *APIResponse, error) { + return r.ApiService.ImagesGetExecute(r) +} + +/* + * ImagesGet List Images + * Retrieve a list of images within the datacenter + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiImagesGetRequest + */ +func (a *ImageApiService) ImagesGet(ctx _context.Context) ApiImagesGetRequest { + return ApiImagesGetRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + * @return Images + */ +func (a *ImageApiService) ImagesGetExecute(r ApiImagesGetRequest) (Images, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Images + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ImageApiService.ImagesGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/images" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "ImagesGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiImagesPatchRequest struct { + ctx _context.Context + ApiService *ImageApiService + imageId string + image *ImageProperties + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiImagesPatchRequest) Image(image ImageProperties) ApiImagesPatchRequest { + r.image = &image + return r +} +func (r ApiImagesPatchRequest) Pretty(pretty bool) ApiImagesPatchRequest { + r.pretty = &pretty + return r +} +func (r ApiImagesPatchRequest) Depth(depth int32) ApiImagesPatchRequest { + r.depth = &depth + return r +} +func (r ApiImagesPatchRequest) XContractNumber(xContractNumber int32) ApiImagesPatchRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiImagesPatchRequest) Execute() (Image, *APIResponse, error) { + return r.ApiService.ImagesPatchExecute(r) +} + +/* + * ImagesPatch Partially modify an Image + * You can use update attributes of a resource + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param imageId + * @return ApiImagesPatchRequest + */ +func (a *ImageApiService) ImagesPatch(ctx _context.Context, imageId string) ApiImagesPatchRequest { + return ApiImagesPatchRequest{ + ApiService: a, + ctx: ctx, + imageId: imageId, + } +} + +/* + * Execute executes the request + * @return Image + */ +func (a *ImageApiService) ImagesPatchExecute(r ApiImagesPatchRequest) (Image, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Image + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ImageApiService.ImagesPatch") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/images/{imageId}" + localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", _neturl.PathEscape(parameterToString(r.imageId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.image == nil { + return localVarReturnValue, nil, reportError("image is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.image + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "ImagesPatch", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiImagesPutRequest struct { + ctx _context.Context + ApiService *ImageApiService + imageId string + image *Image + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiImagesPutRequest) Image(image Image) ApiImagesPutRequest { + r.image = &image + return r +} +func (r ApiImagesPutRequest) Pretty(pretty bool) ApiImagesPutRequest { + r.pretty = &pretty + return r +} +func (r ApiImagesPutRequest) Depth(depth int32) ApiImagesPutRequest { + r.depth = &depth + return r +} +func (r ApiImagesPutRequest) XContractNumber(xContractNumber int32) ApiImagesPutRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiImagesPutRequest) Execute() (Image, *APIResponse, error) { + return r.ApiService.ImagesPutExecute(r) +} + +/* + * ImagesPut Modify an Image + * You can use update attributes of a resource + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param imageId + * @return ApiImagesPutRequest + */ +func (a *ImageApiService) ImagesPut(ctx _context.Context, imageId string) ApiImagesPutRequest { + return ApiImagesPutRequest{ + ApiService: a, + ctx: ctx, + imageId: imageId, + } +} + +/* + * Execute executes the request + * @return Image + */ +func (a *ImageApiService) ImagesPutExecute(r ApiImagesPutRequest) (Image, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Image + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ImageApiService.ImagesPut") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/images/{imageId}" + localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", _neturl.PathEscape(parameterToString(r.imageId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.image == nil { + return localVarReturnValue, nil, reportError("image is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.image + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "ImagesPut", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_ip_blocks.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_ip_blocks.go new file mode 100644 index 0000000000..74b49c8325 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_ip_blocks.go @@ -0,0 +1,1003 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" +) + +// Linger please +var ( + _ _context.Context +) + +// IPBlocksApiService IPBlocksApi service +type IPBlocksApiService service + +type ApiIpblocksDeleteRequest struct { + ctx _context.Context + ApiService *IPBlocksApiService + ipblockId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiIpblocksDeleteRequest) Pretty(pretty bool) ApiIpblocksDeleteRequest { + r.pretty = &pretty + return r +} +func (r ApiIpblocksDeleteRequest) Depth(depth int32) ApiIpblocksDeleteRequest { + r.depth = &depth + return r +} +func (r ApiIpblocksDeleteRequest) XContractNumber(xContractNumber int32) ApiIpblocksDeleteRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiIpblocksDeleteRequest) Execute() (map[string]interface{}, *APIResponse, error) { + return r.ApiService.IpblocksDeleteExecute(r) +} + +/* + * IpblocksDelete Delete IP Block + * Removes the specific IP Block + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param ipblockId + * @return ApiIpblocksDeleteRequest + */ +func (a *IPBlocksApiService) IpblocksDelete(ctx _context.Context, ipblockId string) ApiIpblocksDeleteRequest { + return ApiIpblocksDeleteRequest{ + ApiService: a, + ctx: ctx, + ipblockId: ipblockId, + } +} + +/* + * Execute executes the request + * @return map[string]interface{} + */ +func (a *IPBlocksApiService) IpblocksDeleteExecute(r ApiIpblocksDeleteRequest) (map[string]interface{}, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IPBlocksApiService.IpblocksDelete") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ipblocks/{ipblockId}" + localVarPath = strings.Replace(localVarPath, "{"+"ipblockId"+"}", _neturl.PathEscape(parameterToString(r.ipblockId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "IpblocksDelete", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiIpblocksFindByIdRequest struct { + ctx _context.Context + ApiService *IPBlocksApiService + ipblockId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiIpblocksFindByIdRequest) Pretty(pretty bool) ApiIpblocksFindByIdRequest { + r.pretty = &pretty + return r +} +func (r ApiIpblocksFindByIdRequest) Depth(depth int32) ApiIpblocksFindByIdRequest { + r.depth = &depth + return r +} +func (r ApiIpblocksFindByIdRequest) XContractNumber(xContractNumber int32) ApiIpblocksFindByIdRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiIpblocksFindByIdRequest) Execute() (IpBlock, *APIResponse, error) { + return r.ApiService.IpblocksFindByIdExecute(r) +} + +/* + * IpblocksFindById Retrieve an IP Block + * Retrieves the attributes of a given IP Block. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param ipblockId + * @return ApiIpblocksFindByIdRequest + */ +func (a *IPBlocksApiService) IpblocksFindById(ctx _context.Context, ipblockId string) ApiIpblocksFindByIdRequest { + return ApiIpblocksFindByIdRequest{ + ApiService: a, + ctx: ctx, + ipblockId: ipblockId, + } +} + +/* + * Execute executes the request + * @return IpBlock + */ +func (a *IPBlocksApiService) IpblocksFindByIdExecute(r ApiIpblocksFindByIdRequest) (IpBlock, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue IpBlock + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IPBlocksApiService.IpblocksFindById") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ipblocks/{ipblockId}" + localVarPath = strings.Replace(localVarPath, "{"+"ipblockId"+"}", _neturl.PathEscape(parameterToString(r.ipblockId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "IpblocksFindById", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiIpblocksGetRequest struct { + ctx _context.Context + ApiService *IPBlocksApiService + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiIpblocksGetRequest) Pretty(pretty bool) ApiIpblocksGetRequest { + r.pretty = &pretty + return r +} +func (r ApiIpblocksGetRequest) Depth(depth int32) ApiIpblocksGetRequest { + r.depth = &depth + return r +} +func (r ApiIpblocksGetRequest) XContractNumber(xContractNumber int32) ApiIpblocksGetRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiIpblocksGetRequest) Execute() (IpBlocks, *APIResponse, error) { + return r.ApiService.IpblocksGetExecute(r) +} + +/* + * IpblocksGet List IP Blocks + * Retrieve a list of all reserved IP Blocks + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiIpblocksGetRequest + */ +func (a *IPBlocksApiService) IpblocksGet(ctx _context.Context) ApiIpblocksGetRequest { + return ApiIpblocksGetRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + * @return IpBlocks + */ +func (a *IPBlocksApiService) IpblocksGetExecute(r ApiIpblocksGetRequest) (IpBlocks, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue IpBlocks + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IPBlocksApiService.IpblocksGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ipblocks" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "IpblocksGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiIpblocksPatchRequest struct { + ctx _context.Context + ApiService *IPBlocksApiService + ipblockId string + ipblock *IpBlockProperties + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiIpblocksPatchRequest) Ipblock(ipblock IpBlockProperties) ApiIpblocksPatchRequest { + r.ipblock = &ipblock + return r +} +func (r ApiIpblocksPatchRequest) Pretty(pretty bool) ApiIpblocksPatchRequest { + r.pretty = &pretty + return r +} +func (r ApiIpblocksPatchRequest) Depth(depth int32) ApiIpblocksPatchRequest { + r.depth = &depth + return r +} +func (r ApiIpblocksPatchRequest) XContractNumber(xContractNumber int32) ApiIpblocksPatchRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiIpblocksPatchRequest) Execute() (IpBlock, *APIResponse, error) { + return r.ApiService.IpblocksPatchExecute(r) +} + +/* + * IpblocksPatch Partially modify IP Block + * You can use update attributes of a resource + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param ipblockId + * @return ApiIpblocksPatchRequest + */ +func (a *IPBlocksApiService) IpblocksPatch(ctx _context.Context, ipblockId string) ApiIpblocksPatchRequest { + return ApiIpblocksPatchRequest{ + ApiService: a, + ctx: ctx, + ipblockId: ipblockId, + } +} + +/* + * Execute executes the request + * @return IpBlock + */ +func (a *IPBlocksApiService) IpblocksPatchExecute(r ApiIpblocksPatchRequest) (IpBlock, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue IpBlock + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IPBlocksApiService.IpblocksPatch") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ipblocks/{ipblockId}" + localVarPath = strings.Replace(localVarPath, "{"+"ipblockId"+"}", _neturl.PathEscape(parameterToString(r.ipblockId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.ipblock == nil { + return localVarReturnValue, nil, reportError("ipblock is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.ipblock + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "IpblocksPatch", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiIpblocksPostRequest struct { + ctx _context.Context + ApiService *IPBlocksApiService + ipblock *IpBlock + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiIpblocksPostRequest) Ipblock(ipblock IpBlock) ApiIpblocksPostRequest { + r.ipblock = &ipblock + return r +} +func (r ApiIpblocksPostRequest) Pretty(pretty bool) ApiIpblocksPostRequest { + r.pretty = &pretty + return r +} +func (r ApiIpblocksPostRequest) Depth(depth int32) ApiIpblocksPostRequest { + r.depth = &depth + return r +} +func (r ApiIpblocksPostRequest) XContractNumber(xContractNumber int32) ApiIpblocksPostRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiIpblocksPostRequest) Execute() (IpBlock, *APIResponse, error) { + return r.ApiService.IpblocksPostExecute(r) +} + +/* + * IpblocksPost Reserve IP Block + * This will reserve a new IP Block + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiIpblocksPostRequest + */ +func (a *IPBlocksApiService) IpblocksPost(ctx _context.Context) ApiIpblocksPostRequest { + return ApiIpblocksPostRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + * @return IpBlock + */ +func (a *IPBlocksApiService) IpblocksPostExecute(r ApiIpblocksPostRequest) (IpBlock, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue IpBlock + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IPBlocksApiService.IpblocksPost") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ipblocks" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.ipblock == nil { + return localVarReturnValue, nil, reportError("ipblock is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.ipblock + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "IpblocksPost", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiIpblocksPutRequest struct { + ctx _context.Context + ApiService *IPBlocksApiService + ipblockId string + ipblock *IpBlock + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiIpblocksPutRequest) Ipblock(ipblock IpBlock) ApiIpblocksPutRequest { + r.ipblock = &ipblock + return r +} +func (r ApiIpblocksPutRequest) Pretty(pretty bool) ApiIpblocksPutRequest { + r.pretty = &pretty + return r +} +func (r ApiIpblocksPutRequest) Depth(depth int32) ApiIpblocksPutRequest { + r.depth = &depth + return r +} +func (r ApiIpblocksPutRequest) XContractNumber(xContractNumber int32) ApiIpblocksPutRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiIpblocksPutRequest) Execute() (IpBlock, *APIResponse, error) { + return r.ApiService.IpblocksPutExecute(r) +} + +/* + * IpblocksPut Modify IP Block + * You can use update attributes of a resource + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param ipblockId + * @return ApiIpblocksPutRequest + */ +func (a *IPBlocksApiService) IpblocksPut(ctx _context.Context, ipblockId string) ApiIpblocksPutRequest { + return ApiIpblocksPutRequest{ + ApiService: a, + ctx: ctx, + ipblockId: ipblockId, + } +} + +/* + * Execute executes the request + * @return IpBlock + */ +func (a *IPBlocksApiService) IpblocksPutExecute(r ApiIpblocksPutRequest) (IpBlock, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue IpBlock + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IPBlocksApiService.IpblocksPut") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ipblocks/{ipblockId}" + localVarPath = strings.Replace(localVarPath, "{"+"ipblockId"+"}", _neturl.PathEscape(parameterToString(r.ipblockId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.ipblock == nil { + return localVarReturnValue, nil, reportError("ipblock is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.ipblock + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "IpblocksPut", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_kubernetes.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_kubernetes.go new file mode 100644 index 0000000000..374ad9dd0d --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_kubernetes.go @@ -0,0 +1,2883 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" +) + +// Linger please +var ( + _ _context.Context +) + +// KubernetesApiService KubernetesApi service +type KubernetesApiService service + +type ApiK8sDeleteRequest struct { + ctx _context.Context + ApiService *KubernetesApiService + k8sClusterId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiK8sDeleteRequest) Pretty(pretty bool) ApiK8sDeleteRequest { + r.pretty = &pretty + return r +} +func (r ApiK8sDeleteRequest) Depth(depth int32) ApiK8sDeleteRequest { + r.depth = &depth + return r +} +func (r ApiK8sDeleteRequest) XContractNumber(xContractNumber int32) ApiK8sDeleteRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiK8sDeleteRequest) Execute() (map[string]interface{}, *APIResponse, error) { + return r.ApiService.K8sDeleteExecute(r) +} + +/* + * K8sDelete Delete Kubernetes Cluster + * This will remove a Kubernetes Cluster. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param k8sClusterId The unique ID of the Kubernetes Cluster + * @return ApiK8sDeleteRequest + */ +func (a *KubernetesApiService) K8sDelete(ctx _context.Context, k8sClusterId string) ApiK8sDeleteRequest { + return ApiK8sDeleteRequest{ + ApiService: a, + ctx: ctx, + k8sClusterId: k8sClusterId, + } +} + +/* + * Execute executes the request + * @return map[string]interface{} + */ +func (a *KubernetesApiService) K8sDeleteExecute(r ApiK8sDeleteRequest) (map[string]interface{}, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesApiService.K8sDelete") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/k8s/{k8sClusterId}" + localVarPath = strings.Replace(localVarPath, "{"+"k8sClusterId"+"}", _neturl.PathEscape(parameterToString(r.k8sClusterId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "K8sDelete", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiK8sFindByClusteridRequest struct { + ctx _context.Context + ApiService *KubernetesApiService + k8sClusterId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiK8sFindByClusteridRequest) Pretty(pretty bool) ApiK8sFindByClusteridRequest { + r.pretty = &pretty + return r +} +func (r ApiK8sFindByClusteridRequest) Depth(depth int32) ApiK8sFindByClusteridRequest { + r.depth = &depth + return r +} +func (r ApiK8sFindByClusteridRequest) XContractNumber(xContractNumber int32) ApiK8sFindByClusteridRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiK8sFindByClusteridRequest) Execute() (KubernetesCluster, *APIResponse, error) { + return r.ApiService.K8sFindByClusteridExecute(r) +} + +/* + * K8sFindByClusterid Retrieve Kubernetes Cluster + * This will retrieve a single Kubernetes Cluster. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param k8sClusterId The unique ID of the Kubernetes Cluster + * @return ApiK8sFindByClusteridRequest + */ +func (a *KubernetesApiService) K8sFindByClusterid(ctx _context.Context, k8sClusterId string) ApiK8sFindByClusteridRequest { + return ApiK8sFindByClusteridRequest{ + ApiService: a, + ctx: ctx, + k8sClusterId: k8sClusterId, + } +} + +/* + * Execute executes the request + * @return KubernetesCluster + */ +func (a *KubernetesApiService) K8sFindByClusteridExecute(r ApiK8sFindByClusteridRequest) (KubernetesCluster, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue KubernetesCluster + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesApiService.K8sFindByClusterid") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/k8s/{k8sClusterId}" + localVarPath = strings.Replace(localVarPath, "{"+"k8sClusterId"+"}", _neturl.PathEscape(parameterToString(r.k8sClusterId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "K8sFindByClusterid", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiK8sGetRequest struct { + ctx _context.Context + ApiService *KubernetesApiService + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiK8sGetRequest) Pretty(pretty bool) ApiK8sGetRequest { + r.pretty = &pretty + return r +} +func (r ApiK8sGetRequest) Depth(depth int32) ApiK8sGetRequest { + r.depth = &depth + return r +} +func (r ApiK8sGetRequest) XContractNumber(xContractNumber int32) ApiK8sGetRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiK8sGetRequest) Execute() (KubernetesClusters, *APIResponse, error) { + return r.ApiService.K8sGetExecute(r) +} + +/* + * K8sGet List Kubernetes Clusters + * You can retrieve a list of all kubernetes clusters associated with a contract + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiK8sGetRequest + */ +func (a *KubernetesApiService) K8sGet(ctx _context.Context) ApiK8sGetRequest { + return ApiK8sGetRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + * @return KubernetesClusters + */ +func (a *KubernetesApiService) K8sGetExecute(r ApiK8sGetRequest) (KubernetesClusters, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue KubernetesClusters + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesApiService.K8sGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/k8s" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "K8sGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiK8sKubeconfigGetRequest struct { + ctx _context.Context + ApiService *KubernetesApiService + k8sClusterId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiK8sKubeconfigGetRequest) Pretty(pretty bool) ApiK8sKubeconfigGetRequest { + r.pretty = &pretty + return r +} +func (r ApiK8sKubeconfigGetRequest) Depth(depth int32) ApiK8sKubeconfigGetRequest { + r.depth = &depth + return r +} +func (r ApiK8sKubeconfigGetRequest) XContractNumber(xContractNumber int32) ApiK8sKubeconfigGetRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiK8sKubeconfigGetRequest) Execute() (KubernetesConfig, *APIResponse, error) { + return r.ApiService.K8sKubeconfigGetExecute(r) +} + +/* + * K8sKubeconfigGet Retrieve Kubernetes Configuration File + * You can retrieve kubernetes configuration file for the kubernetes cluster. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param k8sClusterId The unique ID of the Kubernetes Cluster + * @return ApiK8sKubeconfigGetRequest + */ +func (a *KubernetesApiService) K8sKubeconfigGet(ctx _context.Context, k8sClusterId string) ApiK8sKubeconfigGetRequest { + return ApiK8sKubeconfigGetRequest{ + ApiService: a, + ctx: ctx, + k8sClusterId: k8sClusterId, + } +} + +/* + * Execute executes the request + * @return KubernetesConfig + */ +func (a *KubernetesApiService) K8sKubeconfigGetExecute(r ApiK8sKubeconfigGetRequest) (KubernetesConfig, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue KubernetesConfig + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesApiService.K8sKubeconfigGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/k8s/{k8sClusterId}/kubeconfig" + localVarPath = strings.Replace(localVarPath, "{"+"k8sClusterId"+"}", _neturl.PathEscape(parameterToString(r.k8sClusterId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "K8sKubeconfigGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiK8sNodepoolsDeleteRequest struct { + ctx _context.Context + ApiService *KubernetesApiService + k8sClusterId string + nodepoolId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiK8sNodepoolsDeleteRequest) Pretty(pretty bool) ApiK8sNodepoolsDeleteRequest { + r.pretty = &pretty + return r +} +func (r ApiK8sNodepoolsDeleteRequest) Depth(depth int32) ApiK8sNodepoolsDeleteRequest { + r.depth = &depth + return r +} +func (r ApiK8sNodepoolsDeleteRequest) XContractNumber(xContractNumber int32) ApiK8sNodepoolsDeleteRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiK8sNodepoolsDeleteRequest) Execute() (map[string]interface{}, *APIResponse, error) { + return r.ApiService.K8sNodepoolsDeleteExecute(r) +} + +/* + * K8sNodepoolsDelete Delete Kubernetes Node Pool + * This will remove a Kubernetes Node Pool. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param k8sClusterId The unique ID of the Kubernetes Cluster + * @param nodepoolId The unique ID of the Kubernetes Node Pool + * @return ApiK8sNodepoolsDeleteRequest + */ +func (a *KubernetesApiService) K8sNodepoolsDelete(ctx _context.Context, k8sClusterId string, nodepoolId string) ApiK8sNodepoolsDeleteRequest { + return ApiK8sNodepoolsDeleteRequest{ + ApiService: a, + ctx: ctx, + k8sClusterId: k8sClusterId, + nodepoolId: nodepoolId, + } +} + +/* + * Execute executes the request + * @return map[string]interface{} + */ +func (a *KubernetesApiService) K8sNodepoolsDeleteExecute(r ApiK8sNodepoolsDeleteRequest) (map[string]interface{}, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesApiService.K8sNodepoolsDelete") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/k8s/{k8sClusterId}/nodepools/{nodepoolId}" + localVarPath = strings.Replace(localVarPath, "{"+"k8sClusterId"+"}", _neturl.PathEscape(parameterToString(r.k8sClusterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nodepoolId"+"}", _neturl.PathEscape(parameterToString(r.nodepoolId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "K8sNodepoolsDelete", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiK8sNodepoolsFindByIdRequest struct { + ctx _context.Context + ApiService *KubernetesApiService + k8sClusterId string + nodepoolId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiK8sNodepoolsFindByIdRequest) Pretty(pretty bool) ApiK8sNodepoolsFindByIdRequest { + r.pretty = &pretty + return r +} +func (r ApiK8sNodepoolsFindByIdRequest) Depth(depth int32) ApiK8sNodepoolsFindByIdRequest { + r.depth = &depth + return r +} +func (r ApiK8sNodepoolsFindByIdRequest) XContractNumber(xContractNumber int32) ApiK8sNodepoolsFindByIdRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiK8sNodepoolsFindByIdRequest) Execute() (KubernetesNodePool, *APIResponse, error) { + return r.ApiService.K8sNodepoolsFindByIdExecute(r) +} + +/* + * K8sNodepoolsFindById Retrieve Kubernetes Node Pool + * You can retrieve a single Kubernetes Node Pool. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param k8sClusterId The unique ID of the Kubernetes Cluster + * @param nodepoolId The unique ID of the Kubernetes Node Pool + * @return ApiK8sNodepoolsFindByIdRequest + */ +func (a *KubernetesApiService) K8sNodepoolsFindById(ctx _context.Context, k8sClusterId string, nodepoolId string) ApiK8sNodepoolsFindByIdRequest { + return ApiK8sNodepoolsFindByIdRequest{ + ApiService: a, + ctx: ctx, + k8sClusterId: k8sClusterId, + nodepoolId: nodepoolId, + } +} + +/* + * Execute executes the request + * @return KubernetesNodePool + */ +func (a *KubernetesApiService) K8sNodepoolsFindByIdExecute(r ApiK8sNodepoolsFindByIdRequest) (KubernetesNodePool, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue KubernetesNodePool + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesApiService.K8sNodepoolsFindById") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/k8s/{k8sClusterId}/nodepools/{nodepoolId}" + localVarPath = strings.Replace(localVarPath, "{"+"k8sClusterId"+"}", _neturl.PathEscape(parameterToString(r.k8sClusterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nodepoolId"+"}", _neturl.PathEscape(parameterToString(r.nodepoolId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "K8sNodepoolsFindById", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiK8sNodepoolsGetRequest struct { + ctx _context.Context + ApiService *KubernetesApiService + k8sClusterId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiK8sNodepoolsGetRequest) Pretty(pretty bool) ApiK8sNodepoolsGetRequest { + r.pretty = &pretty + return r +} +func (r ApiK8sNodepoolsGetRequest) Depth(depth int32) ApiK8sNodepoolsGetRequest { + r.depth = &depth + return r +} +func (r ApiK8sNodepoolsGetRequest) XContractNumber(xContractNumber int32) ApiK8sNodepoolsGetRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiK8sNodepoolsGetRequest) Execute() (KubernetesNodePools, *APIResponse, error) { + return r.ApiService.K8sNodepoolsGetExecute(r) +} + +/* + * K8sNodepoolsGet List Kubernetes Node Pools + * You can retrieve a list of all kubernetes node pools part of kubernetes cluster + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param k8sClusterId The unique ID of the Kubernetes Cluster + * @return ApiK8sNodepoolsGetRequest + */ +func (a *KubernetesApiService) K8sNodepoolsGet(ctx _context.Context, k8sClusterId string) ApiK8sNodepoolsGetRequest { + return ApiK8sNodepoolsGetRequest{ + ApiService: a, + ctx: ctx, + k8sClusterId: k8sClusterId, + } +} + +/* + * Execute executes the request + * @return KubernetesNodePools + */ +func (a *KubernetesApiService) K8sNodepoolsGetExecute(r ApiK8sNodepoolsGetRequest) (KubernetesNodePools, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue KubernetesNodePools + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesApiService.K8sNodepoolsGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/k8s/{k8sClusterId}/nodepools" + localVarPath = strings.Replace(localVarPath, "{"+"k8sClusterId"+"}", _neturl.PathEscape(parameterToString(r.k8sClusterId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "K8sNodepoolsGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiK8sNodepoolsNodesDeleteRequest struct { + ctx _context.Context + ApiService *KubernetesApiService + k8sClusterId string + nodepoolId string + nodeId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiK8sNodepoolsNodesDeleteRequest) Pretty(pretty bool) ApiK8sNodepoolsNodesDeleteRequest { + r.pretty = &pretty + return r +} +func (r ApiK8sNodepoolsNodesDeleteRequest) Depth(depth int32) ApiK8sNodepoolsNodesDeleteRequest { + r.depth = &depth + return r +} +func (r ApiK8sNodepoolsNodesDeleteRequest) XContractNumber(xContractNumber int32) ApiK8sNodepoolsNodesDeleteRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiK8sNodepoolsNodesDeleteRequest) Execute() (map[string]interface{}, *APIResponse, error) { + return r.ApiService.K8sNodepoolsNodesDeleteExecute(r) +} + +/* + * K8sNodepoolsNodesDelete Delete Kubernetes node + * This will remove a Kubernetes node. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param k8sClusterId The unique ID of the Kubernetes Cluster + * @param nodepoolId The unique ID of the Kubernetes Node Pool + * @param nodeId The unique ID of the Kubernetes node + * @return ApiK8sNodepoolsNodesDeleteRequest + */ +func (a *KubernetesApiService) K8sNodepoolsNodesDelete(ctx _context.Context, k8sClusterId string, nodepoolId string, nodeId string) ApiK8sNodepoolsNodesDeleteRequest { + return ApiK8sNodepoolsNodesDeleteRequest{ + ApiService: a, + ctx: ctx, + k8sClusterId: k8sClusterId, + nodepoolId: nodepoolId, + nodeId: nodeId, + } +} + +/* + * Execute executes the request + * @return map[string]interface{} + */ +func (a *KubernetesApiService) K8sNodepoolsNodesDeleteExecute(r ApiK8sNodepoolsNodesDeleteRequest) (map[string]interface{}, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesApiService.K8sNodepoolsNodesDelete") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/k8s/{k8sClusterId}/nodepools/{nodepoolId}/nodes/{nodeId}" + localVarPath = strings.Replace(localVarPath, "{"+"k8sClusterId"+"}", _neturl.PathEscape(parameterToString(r.k8sClusterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nodepoolId"+"}", _neturl.PathEscape(parameterToString(r.nodepoolId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nodeId"+"}", _neturl.PathEscape(parameterToString(r.nodeId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "K8sNodepoolsNodesDelete", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiK8sNodepoolsNodesFindByIdRequest struct { + ctx _context.Context + ApiService *KubernetesApiService + k8sClusterId string + nodepoolId string + nodeId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiK8sNodepoolsNodesFindByIdRequest) Pretty(pretty bool) ApiK8sNodepoolsNodesFindByIdRequest { + r.pretty = &pretty + return r +} +func (r ApiK8sNodepoolsNodesFindByIdRequest) Depth(depth int32) ApiK8sNodepoolsNodesFindByIdRequest { + r.depth = &depth + return r +} +func (r ApiK8sNodepoolsNodesFindByIdRequest) XContractNumber(xContractNumber int32) ApiK8sNodepoolsNodesFindByIdRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiK8sNodepoolsNodesFindByIdRequest) Execute() (KubernetesNode, *APIResponse, error) { + return r.ApiService.K8sNodepoolsNodesFindByIdExecute(r) +} + +/* + * K8sNodepoolsNodesFindById Retrieve Kubernetes node + * You can retrieve a single Kubernetes Node. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param k8sClusterId The unique ID of the Kubernetes Cluster + * @param nodepoolId The unique ID of the Kubernetes Node Pool + * @param nodeId The unique ID of the Kubernetes Node. + * @return ApiK8sNodepoolsNodesFindByIdRequest + */ +func (a *KubernetesApiService) K8sNodepoolsNodesFindById(ctx _context.Context, k8sClusterId string, nodepoolId string, nodeId string) ApiK8sNodepoolsNodesFindByIdRequest { + return ApiK8sNodepoolsNodesFindByIdRequest{ + ApiService: a, + ctx: ctx, + k8sClusterId: k8sClusterId, + nodepoolId: nodepoolId, + nodeId: nodeId, + } +} + +/* + * Execute executes the request + * @return KubernetesNode + */ +func (a *KubernetesApiService) K8sNodepoolsNodesFindByIdExecute(r ApiK8sNodepoolsNodesFindByIdRequest) (KubernetesNode, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue KubernetesNode + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesApiService.K8sNodepoolsNodesFindById") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/k8s/{k8sClusterId}/nodepools/{nodepoolId}/nodes/{nodeId}" + localVarPath = strings.Replace(localVarPath, "{"+"k8sClusterId"+"}", _neturl.PathEscape(parameterToString(r.k8sClusterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nodepoolId"+"}", _neturl.PathEscape(parameterToString(r.nodepoolId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nodeId"+"}", _neturl.PathEscape(parameterToString(r.nodeId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "K8sNodepoolsNodesFindById", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiK8sNodepoolsNodesGetRequest struct { + ctx _context.Context + ApiService *KubernetesApiService + k8sClusterId string + nodepoolId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiK8sNodepoolsNodesGetRequest) Pretty(pretty bool) ApiK8sNodepoolsNodesGetRequest { + r.pretty = &pretty + return r +} +func (r ApiK8sNodepoolsNodesGetRequest) Depth(depth int32) ApiK8sNodepoolsNodesGetRequest { + r.depth = &depth + return r +} +func (r ApiK8sNodepoolsNodesGetRequest) XContractNumber(xContractNumber int32) ApiK8sNodepoolsNodesGetRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiK8sNodepoolsNodesGetRequest) Execute() (KubernetesNodes, *APIResponse, error) { + return r.ApiService.K8sNodepoolsNodesGetExecute(r) +} + +/* + * K8sNodepoolsNodesGet Retrieve Kubernetes nodes. + * You can retrieve all nodes of Kubernetes Node Pool. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param k8sClusterId The unique ID of the Kubernetes Cluster + * @param nodepoolId The unique ID of the Kubernetes Node Pool + * @return ApiK8sNodepoolsNodesGetRequest + */ +func (a *KubernetesApiService) K8sNodepoolsNodesGet(ctx _context.Context, k8sClusterId string, nodepoolId string) ApiK8sNodepoolsNodesGetRequest { + return ApiK8sNodepoolsNodesGetRequest{ + ApiService: a, + ctx: ctx, + k8sClusterId: k8sClusterId, + nodepoolId: nodepoolId, + } +} + +/* + * Execute executes the request + * @return KubernetesNodes + */ +func (a *KubernetesApiService) K8sNodepoolsNodesGetExecute(r ApiK8sNodepoolsNodesGetRequest) (KubernetesNodes, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue KubernetesNodes + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesApiService.K8sNodepoolsNodesGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/k8s/{k8sClusterId}/nodepools/{nodepoolId}/nodes" + localVarPath = strings.Replace(localVarPath, "{"+"k8sClusterId"+"}", _neturl.PathEscape(parameterToString(r.k8sClusterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nodepoolId"+"}", _neturl.PathEscape(parameterToString(r.nodepoolId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "K8sNodepoolsNodesGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiK8sNodepoolsNodesReplacePostRequest struct { + ctx _context.Context + ApiService *KubernetesApiService + k8sClusterId string + nodepoolId string + nodeId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiK8sNodepoolsNodesReplacePostRequest) Pretty(pretty bool) ApiK8sNodepoolsNodesReplacePostRequest { + r.pretty = &pretty + return r +} +func (r ApiK8sNodepoolsNodesReplacePostRequest) Depth(depth int32) ApiK8sNodepoolsNodesReplacePostRequest { + r.depth = &depth + return r +} +func (r ApiK8sNodepoolsNodesReplacePostRequest) XContractNumber(xContractNumber int32) ApiK8sNodepoolsNodesReplacePostRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiK8sNodepoolsNodesReplacePostRequest) Execute() (map[string]interface{}, *APIResponse, error) { + return r.ApiService.K8sNodepoolsNodesReplacePostExecute(r) +} + +/* + * K8sNodepoolsNodesReplacePost Recreate the Kubernetes node + * You can recreate a single Kubernetes Node. + +Managed Kubernetes starts a process which based on the nodepool's template creates & configures a new node, waits for status "ACTIVE", and migrates all the pods from the faulty node, deleting it once empty. While this operation occurs, the nodepool will have an extra billable "ACTIVE" node. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param k8sClusterId The unique ID of the Kubernetes Cluster + * @param nodepoolId The unique ID of the Kubernetes Node Pool + * @param nodeId The unique ID of the Kubernetes Node. + * @return ApiK8sNodepoolsNodesReplacePostRequest + */ +func (a *KubernetesApiService) K8sNodepoolsNodesReplacePost(ctx _context.Context, k8sClusterId string, nodepoolId string, nodeId string) ApiK8sNodepoolsNodesReplacePostRequest { + return ApiK8sNodepoolsNodesReplacePostRequest{ + ApiService: a, + ctx: ctx, + k8sClusterId: k8sClusterId, + nodepoolId: nodepoolId, + nodeId: nodeId, + } +} + +/* + * Execute executes the request + * @return map[string]interface{} + */ +func (a *KubernetesApiService) K8sNodepoolsNodesReplacePostExecute(r ApiK8sNodepoolsNodesReplacePostRequest) (map[string]interface{}, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesApiService.K8sNodepoolsNodesReplacePost") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/k8s/{k8sClusterId}/nodepools/{nodepoolId}/nodes/{nodeId}/replace" + localVarPath = strings.Replace(localVarPath, "{"+"k8sClusterId"+"}", _neturl.PathEscape(parameterToString(r.k8sClusterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nodepoolId"+"}", _neturl.PathEscape(parameterToString(r.nodepoolId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nodeId"+"}", _neturl.PathEscape(parameterToString(r.nodeId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "K8sNodepoolsNodesReplacePost", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiK8sNodepoolsPostRequest struct { + ctx _context.Context + ApiService *KubernetesApiService + k8sClusterId string + kubernetesNodePool *KubernetesNodePool + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiK8sNodepoolsPostRequest) KubernetesNodePool(kubernetesNodePool KubernetesNodePool) ApiK8sNodepoolsPostRequest { + r.kubernetesNodePool = &kubernetesNodePool + return r +} +func (r ApiK8sNodepoolsPostRequest) Pretty(pretty bool) ApiK8sNodepoolsPostRequest { + r.pretty = &pretty + return r +} +func (r ApiK8sNodepoolsPostRequest) Depth(depth int32) ApiK8sNodepoolsPostRequest { + r.depth = &depth + return r +} +func (r ApiK8sNodepoolsPostRequest) XContractNumber(xContractNumber int32) ApiK8sNodepoolsPostRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiK8sNodepoolsPostRequest) Execute() (KubernetesNodePool, *APIResponse, error) { + return r.ApiService.K8sNodepoolsPostExecute(r) +} + +/* + * K8sNodepoolsPost Create a Kubernetes Node Pool + * This will create a new Kubernetes Node Pool inside a Kubernetes Cluster. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param k8sClusterId The unique ID of the Kubernetes Cluster + * @return ApiK8sNodepoolsPostRequest + */ +func (a *KubernetesApiService) K8sNodepoolsPost(ctx _context.Context, k8sClusterId string) ApiK8sNodepoolsPostRequest { + return ApiK8sNodepoolsPostRequest{ + ApiService: a, + ctx: ctx, + k8sClusterId: k8sClusterId, + } +} + +/* + * Execute executes the request + * @return KubernetesNodePool + */ +func (a *KubernetesApiService) K8sNodepoolsPostExecute(r ApiK8sNodepoolsPostRequest) (KubernetesNodePool, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue KubernetesNodePool + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesApiService.K8sNodepoolsPost") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/k8s/{k8sClusterId}/nodepools" + localVarPath = strings.Replace(localVarPath, "{"+"k8sClusterId"+"}", _neturl.PathEscape(parameterToString(r.k8sClusterId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.kubernetesNodePool == nil { + return localVarReturnValue, nil, reportError("kubernetesNodePool is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.kubernetesNodePool + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "K8sNodepoolsPost", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiK8sNodepoolsPutRequest struct { + ctx _context.Context + ApiService *KubernetesApiService + k8sClusterId string + nodepoolId string + kubernetesNodePoolProperties *KubernetesNodePoolPropertiesForPut + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiK8sNodepoolsPutRequest) KubernetesNodePoolProperties(kubernetesNodePoolProperties KubernetesNodePoolPropertiesForPut) ApiK8sNodepoolsPutRequest { + r.kubernetesNodePoolProperties = &kubernetesNodePoolProperties + return r +} +func (r ApiK8sNodepoolsPutRequest) Pretty(pretty bool) ApiK8sNodepoolsPutRequest { + r.pretty = &pretty + return r +} +func (r ApiK8sNodepoolsPutRequest) Depth(depth int32) ApiK8sNodepoolsPutRequest { + r.depth = &depth + return r +} +func (r ApiK8sNodepoolsPutRequest) XContractNumber(xContractNumber int32) ApiK8sNodepoolsPutRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiK8sNodepoolsPutRequest) Execute() (KubernetesNodePoolForPut, *APIResponse, error) { + return r.ApiService.K8sNodepoolsPutExecute(r) +} + +/* + * K8sNodepoolsPut Modify Kubernetes Node Pool + * This will modify the Kubernetes Node Pool. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param k8sClusterId The unique ID of the Kubernetes Cluster + * @param nodepoolId The unique ID of the Kubernetes Node Pool + * @return ApiK8sNodepoolsPutRequest + */ +func (a *KubernetesApiService) K8sNodepoolsPut(ctx _context.Context, k8sClusterId string, nodepoolId string) ApiK8sNodepoolsPutRequest { + return ApiK8sNodepoolsPutRequest{ + ApiService: a, + ctx: ctx, + k8sClusterId: k8sClusterId, + nodepoolId: nodepoolId, + } +} + +/* + * Execute executes the request + * @return KubernetesNodePoolForPut + */ +func (a *KubernetesApiService) K8sNodepoolsPutExecute(r ApiK8sNodepoolsPutRequest) (KubernetesNodePoolForPut, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue KubernetesNodePoolForPut + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesApiService.K8sNodepoolsPut") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/k8s/{k8sClusterId}/nodepools/{nodepoolId}" + localVarPath = strings.Replace(localVarPath, "{"+"k8sClusterId"+"}", _neturl.PathEscape(parameterToString(r.k8sClusterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nodepoolId"+"}", _neturl.PathEscape(parameterToString(r.nodepoolId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.kubernetesNodePoolProperties == nil { + return localVarReturnValue, nil, reportError("kubernetesNodePoolProperties is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = map[string]interface{}{"properties": r.kubernetesNodePoolProperties} + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "K8sNodepoolsPut", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiK8sPostRequest struct { + ctx _context.Context + ApiService *KubernetesApiService + kubernetesCluster *KubernetesCluster + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiK8sPostRequest) KubernetesCluster(kubernetesCluster KubernetesCluster) ApiK8sPostRequest { + r.kubernetesCluster = &kubernetesCluster + return r +} +func (r ApiK8sPostRequest) Pretty(pretty bool) ApiK8sPostRequest { + r.pretty = &pretty + return r +} +func (r ApiK8sPostRequest) Depth(depth int32) ApiK8sPostRequest { + r.depth = &depth + return r +} +func (r ApiK8sPostRequest) XContractNumber(xContractNumber int32) ApiK8sPostRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiK8sPostRequest) Execute() (KubernetesCluster, *APIResponse, error) { + return r.ApiService.K8sPostExecute(r) +} + +/* + * K8sPost Create Kubernetes Cluster + * This will create a new Kubernetes Cluster. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiK8sPostRequest + */ +func (a *KubernetesApiService) K8sPost(ctx _context.Context) ApiK8sPostRequest { + return ApiK8sPostRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + * @return KubernetesCluster + */ +func (a *KubernetesApiService) K8sPostExecute(r ApiK8sPostRequest) (KubernetesCluster, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue KubernetesCluster + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesApiService.K8sPost") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/k8s" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.kubernetesCluster == nil { + return localVarReturnValue, nil, reportError("kubernetesCluster is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.kubernetesCluster + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "K8sPost", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiK8sPutRequest struct { + ctx _context.Context + ApiService *KubernetesApiService + k8sClusterId string + kubernetescluster *KubernetesCluster + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiK8sPutRequest) Kubernetescluster(kubernetescluster KubernetesCluster) ApiK8sPutRequest { + r.kubernetescluster = &kubernetescluster + return r +} +func (r ApiK8sPutRequest) Pretty(pretty bool) ApiK8sPutRequest { + r.pretty = &pretty + return r +} +func (r ApiK8sPutRequest) Depth(depth int32) ApiK8sPutRequest { + r.depth = &depth + return r +} +func (r ApiK8sPutRequest) XContractNumber(xContractNumber int32) ApiK8sPutRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiK8sPutRequest) Execute() (KubernetesCluster, *APIResponse, error) { + return r.ApiService.K8sPutExecute(r) +} + +/* + * K8sPut Modify Kubernetes Cluster + * This will modify the Kubernetes Cluster. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param k8sClusterId The unique ID of the Kubernetes Cluster + * @return ApiK8sPutRequest + */ +func (a *KubernetesApiService) K8sPut(ctx _context.Context, k8sClusterId string) ApiK8sPutRequest { + return ApiK8sPutRequest{ + ApiService: a, + ctx: ctx, + k8sClusterId: k8sClusterId, + } +} + +/* + * Execute executes the request + * @return KubernetesCluster + */ +func (a *KubernetesApiService) K8sPutExecute(r ApiK8sPutRequest) (KubernetesCluster, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue KubernetesCluster + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesApiService.K8sPut") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/k8s/{k8sClusterId}" + localVarPath = strings.Replace(localVarPath, "{"+"k8sClusterId"+"}", _neturl.PathEscape(parameterToString(r.k8sClusterId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.kubernetescluster == nil { + return localVarReturnValue, nil, reportError("kubernetescluster is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.kubernetescluster + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "K8sPut", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiK8sVersionsCompatibilitiesGetRequest struct { + ctx _context.Context + ApiService *KubernetesApiService + clusterVersion string +} + + +func (r ApiK8sVersionsCompatibilitiesGetRequest) Execute() ([]string, *APIResponse, error) { + return r.ApiService.K8sVersionsCompatibilitiesGetExecute(r) +} + +/* + * K8sVersionsCompatibilitiesGet Retrieves a list of available kubernetes versions for nodepools depending on the given kubernetes version running in the cluster. + * You can retrieve a list of available kubernetes versions for nodepools depending on the given kubernetes version running in the cluster. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param clusterVersion + * @return ApiK8sVersionsCompatibilitiesGetRequest + */ +func (a *KubernetesApiService) K8sVersionsCompatibilitiesGet(ctx _context.Context, clusterVersion string) ApiK8sVersionsCompatibilitiesGetRequest { + return ApiK8sVersionsCompatibilitiesGetRequest{ + ApiService: a, + ctx: ctx, + clusterVersion: clusterVersion, + } +} + +/* + * Execute executes the request + * @return []string + */ +func (a *KubernetesApiService) K8sVersionsCompatibilitiesGetExecute(r ApiK8sVersionsCompatibilitiesGetRequest) ([]string, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []string + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesApiService.K8sVersionsCompatibilitiesGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/k8s/versions/{clusterVersion}/compatibilities" + localVarPath = strings.Replace(localVarPath, "{"+"clusterVersion"+"}", _neturl.PathEscape(parameterToString(r.clusterVersion, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "K8sVersionsCompatibilitiesGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiK8sVersionsDefaultGetRequest struct { + ctx _context.Context + ApiService *KubernetesApiService +} + + +func (r ApiK8sVersionsDefaultGetRequest) Execute() (string, *APIResponse, error) { + return r.ApiService.K8sVersionsDefaultGetExecute(r) +} + +/* + * K8sVersionsDefaultGet Retrieve the current default kubernetes version for clusters and nodepools. + * You can retrieve the current default kubernetes version for clusters and nodepools. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiK8sVersionsDefaultGetRequest + */ +func (a *KubernetesApiService) K8sVersionsDefaultGet(ctx _context.Context) ApiK8sVersionsDefaultGetRequest { + return ApiK8sVersionsDefaultGetRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + * @return string + */ +func (a *KubernetesApiService) K8sVersionsDefaultGetExecute(r ApiK8sVersionsDefaultGetRequest) (string, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue string + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesApiService.K8sVersionsDefaultGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/k8s/versions/default" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "K8sVersionsDefaultGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiK8sVersionsGetRequest struct { + ctx _context.Context + ApiService *KubernetesApiService +} + + +func (r ApiK8sVersionsGetRequest) Execute() ([]string, *APIResponse, error) { + return r.ApiService.K8sVersionsGetExecute(r) +} + +/* + * K8sVersionsGet Retrieve available Kubernetes versions + * You can retrieve a list of available kubernetes versions + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiK8sVersionsGetRequest + */ +func (a *KubernetesApiService) K8sVersionsGet(ctx _context.Context) ApiK8sVersionsGetRequest { + return ApiK8sVersionsGetRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + * @return []string + */ +func (a *KubernetesApiService) K8sVersionsGetExecute(r ApiK8sVersionsGetRequest) ([]string, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []string + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesApiService.K8sVersionsGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/k8s/versions" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "K8sVersionsGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_label.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_label.go new file mode 100644 index 0000000000..4b60017262 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_label.go @@ -0,0 +1,4516 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" +) + +// Linger please +var ( + _ _context.Context +) + +// LabelApiService LabelApi service +type LabelApiService service + +type ApiDatacentersLabelsDeleteRequest struct { + ctx _context.Context + ApiService *LabelApiService + datacenterId string + key string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersLabelsDeleteRequest) Pretty(pretty bool) ApiDatacentersLabelsDeleteRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersLabelsDeleteRequest) Depth(depth int32) ApiDatacentersLabelsDeleteRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersLabelsDeleteRequest) XContractNumber(xContractNumber int32) ApiDatacentersLabelsDeleteRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersLabelsDeleteRequest) Execute() (map[string]interface{}, *APIResponse, error) { + return r.ApiService.DatacentersLabelsDeleteExecute(r) +} + +/* + * DatacentersLabelsDelete Delete a Label from Data Center + * This will remove a label from the data center. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the Data Center + * @param key The key of the Label + * @return ApiDatacentersLabelsDeleteRequest + */ +func (a *LabelApiService) DatacentersLabelsDelete(ctx _context.Context, datacenterId string, key string) ApiDatacentersLabelsDeleteRequest { + return ApiDatacentersLabelsDeleteRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + key: key, + } +} + +/* + * Execute executes the request + * @return map[string]interface{} + */ +func (a *LabelApiService) DatacentersLabelsDeleteExecute(r ApiDatacentersLabelsDeleteRequest) (map[string]interface{}, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelApiService.DatacentersLabelsDelete") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/labels/{key}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterToString(r.key, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersLabelsDelete", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersLabelsFindByKeyRequest struct { + ctx _context.Context + ApiService *LabelApiService + datacenterId string + key string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersLabelsFindByKeyRequest) Pretty(pretty bool) ApiDatacentersLabelsFindByKeyRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersLabelsFindByKeyRequest) Depth(depth int32) ApiDatacentersLabelsFindByKeyRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersLabelsFindByKeyRequest) XContractNumber(xContractNumber int32) ApiDatacentersLabelsFindByKeyRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersLabelsFindByKeyRequest) Execute() (LabelResource, *APIResponse, error) { + return r.ApiService.DatacentersLabelsFindByKeyExecute(r) +} + +/* + * DatacentersLabelsFindByKey Retrieve a Label of Data Center + * This will retrieve the properties of a associated label to a data center. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the Data Center + * @param key The key of the Label + * @return ApiDatacentersLabelsFindByKeyRequest + */ +func (a *LabelApiService) DatacentersLabelsFindByKey(ctx _context.Context, datacenterId string, key string) ApiDatacentersLabelsFindByKeyRequest { + return ApiDatacentersLabelsFindByKeyRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + key: key, + } +} + +/* + * Execute executes the request + * @return LabelResource + */ +func (a *LabelApiService) DatacentersLabelsFindByKeyExecute(r ApiDatacentersLabelsFindByKeyRequest) (LabelResource, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue LabelResource + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelApiService.DatacentersLabelsFindByKey") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/labels/{key}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterToString(r.key, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersLabelsFindByKey", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersLabelsGetRequest struct { + ctx _context.Context + ApiService *LabelApiService + datacenterId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersLabelsGetRequest) Pretty(pretty bool) ApiDatacentersLabelsGetRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersLabelsGetRequest) Depth(depth int32) ApiDatacentersLabelsGetRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersLabelsGetRequest) XContractNumber(xContractNumber int32) ApiDatacentersLabelsGetRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersLabelsGetRequest) Execute() (LabelResources, *APIResponse, error) { + return r.ApiService.DatacentersLabelsGetExecute(r) +} + +/* + * DatacentersLabelsGet List all Data Center Labels + * You can retrieve a list of all labels associated with a data center + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the Data Center + * @return ApiDatacentersLabelsGetRequest + */ +func (a *LabelApiService) DatacentersLabelsGet(ctx _context.Context, datacenterId string) ApiDatacentersLabelsGetRequest { + return ApiDatacentersLabelsGetRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + } +} + +/* + * Execute executes the request + * @return LabelResources + */ +func (a *LabelApiService) DatacentersLabelsGetExecute(r ApiDatacentersLabelsGetRequest) (LabelResources, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue LabelResources + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelApiService.DatacentersLabelsGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/labels" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersLabelsGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersLabelsPostRequest struct { + ctx _context.Context + ApiService *LabelApiService + datacenterId string + label *LabelResource + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersLabelsPostRequest) Label(label LabelResource) ApiDatacentersLabelsPostRequest { + r.label = &label + return r +} +func (r ApiDatacentersLabelsPostRequest) Pretty(pretty bool) ApiDatacentersLabelsPostRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersLabelsPostRequest) Depth(depth int32) ApiDatacentersLabelsPostRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersLabelsPostRequest) XContractNumber(xContractNumber int32) ApiDatacentersLabelsPostRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersLabelsPostRequest) Execute() (LabelResource, *APIResponse, error) { + return r.ApiService.DatacentersLabelsPostExecute(r) +} + +/* + * DatacentersLabelsPost Add a Label to Data Center + * This will add a label to the data center. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the Data Center + * @return ApiDatacentersLabelsPostRequest + */ +func (a *LabelApiService) DatacentersLabelsPost(ctx _context.Context, datacenterId string) ApiDatacentersLabelsPostRequest { + return ApiDatacentersLabelsPostRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + } +} + +/* + * Execute executes the request + * @return LabelResource + */ +func (a *LabelApiService) DatacentersLabelsPostExecute(r ApiDatacentersLabelsPostRequest) (LabelResource, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue LabelResource + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelApiService.DatacentersLabelsPost") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/labels" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.label == nil { + return localVarReturnValue, nil, reportError("label is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.label + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersLabelsPost", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersLabelsPutRequest struct { + ctx _context.Context + ApiService *LabelApiService + datacenterId string + key string + label *LabelResource + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersLabelsPutRequest) Label(label LabelResource) ApiDatacentersLabelsPutRequest { + r.label = &label + return r +} +func (r ApiDatacentersLabelsPutRequest) Pretty(pretty bool) ApiDatacentersLabelsPutRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersLabelsPutRequest) Depth(depth int32) ApiDatacentersLabelsPutRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersLabelsPutRequest) XContractNumber(xContractNumber int32) ApiDatacentersLabelsPutRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersLabelsPutRequest) Execute() (LabelResource, *APIResponse, error) { + return r.ApiService.DatacentersLabelsPutExecute(r) +} + +/* + * DatacentersLabelsPut Modify a Label of Data Center + * This will modify the value of the label on a data center. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the Data Center + * @param key The key of the Label + * @return ApiDatacentersLabelsPutRequest + */ +func (a *LabelApiService) DatacentersLabelsPut(ctx _context.Context, datacenterId string, key string) ApiDatacentersLabelsPutRequest { + return ApiDatacentersLabelsPutRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + key: key, + } +} + +/* + * Execute executes the request + * @return LabelResource + */ +func (a *LabelApiService) DatacentersLabelsPutExecute(r ApiDatacentersLabelsPutRequest) (LabelResource, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue LabelResource + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelApiService.DatacentersLabelsPut") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/labels/{key}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterToString(r.key, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.label == nil { + return localVarReturnValue, nil, reportError("label is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.label + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersLabelsPut", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersServersLabelsDeleteRequest struct { + ctx _context.Context + ApiService *LabelApiService + datacenterId string + serverId string + key string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersServersLabelsDeleteRequest) Pretty(pretty bool) ApiDatacentersServersLabelsDeleteRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersServersLabelsDeleteRequest) Depth(depth int32) ApiDatacentersServersLabelsDeleteRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersServersLabelsDeleteRequest) XContractNumber(xContractNumber int32) ApiDatacentersServersLabelsDeleteRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersServersLabelsDeleteRequest) Execute() (map[string]interface{}, *APIResponse, error) { + return r.ApiService.DatacentersServersLabelsDeleteExecute(r) +} + +/* + * DatacentersServersLabelsDelete Delete a Label from Server + * This will remove a label from the server. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the Datacenter + * @param serverId The unique ID of the Server + * @param key The key of the Label + * @return ApiDatacentersServersLabelsDeleteRequest + */ +func (a *LabelApiService) DatacentersServersLabelsDelete(ctx _context.Context, datacenterId string, serverId string, key string) ApiDatacentersServersLabelsDeleteRequest { + return ApiDatacentersServersLabelsDeleteRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + serverId: serverId, + key: key, + } +} + +/* + * Execute executes the request + * @return map[string]interface{} + */ +func (a *LabelApiService) DatacentersServersLabelsDeleteExecute(r ApiDatacentersServersLabelsDeleteRequest) (map[string]interface{}, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelApiService.DatacentersServersLabelsDelete") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/labels/{key}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterToString(r.key, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersServersLabelsDelete", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersServersLabelsFindByKeyRequest struct { + ctx _context.Context + ApiService *LabelApiService + datacenterId string + serverId string + key string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersServersLabelsFindByKeyRequest) Pretty(pretty bool) ApiDatacentersServersLabelsFindByKeyRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersServersLabelsFindByKeyRequest) Depth(depth int32) ApiDatacentersServersLabelsFindByKeyRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersServersLabelsFindByKeyRequest) XContractNumber(xContractNumber int32) ApiDatacentersServersLabelsFindByKeyRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersServersLabelsFindByKeyRequest) Execute() (LabelResource, *APIResponse, error) { + return r.ApiService.DatacentersServersLabelsFindByKeyExecute(r) +} + +/* + * DatacentersServersLabelsFindByKey Retrieve a Label of Server + * This will retrieve the properties of a associated label to a server. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the Datacenter + * @param serverId The unique ID of the Server + * @param key The key of the Label + * @return ApiDatacentersServersLabelsFindByKeyRequest + */ +func (a *LabelApiService) DatacentersServersLabelsFindByKey(ctx _context.Context, datacenterId string, serverId string, key string) ApiDatacentersServersLabelsFindByKeyRequest { + return ApiDatacentersServersLabelsFindByKeyRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + serverId: serverId, + key: key, + } +} + +/* + * Execute executes the request + * @return LabelResource + */ +func (a *LabelApiService) DatacentersServersLabelsFindByKeyExecute(r ApiDatacentersServersLabelsFindByKeyRequest) (LabelResource, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue LabelResource + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelApiService.DatacentersServersLabelsFindByKey") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/labels/{key}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterToString(r.key, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersServersLabelsFindByKey", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersServersLabelsGetRequest struct { + ctx _context.Context + ApiService *LabelApiService + datacenterId string + serverId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersServersLabelsGetRequest) Pretty(pretty bool) ApiDatacentersServersLabelsGetRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersServersLabelsGetRequest) Depth(depth int32) ApiDatacentersServersLabelsGetRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersServersLabelsGetRequest) XContractNumber(xContractNumber int32) ApiDatacentersServersLabelsGetRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersServersLabelsGetRequest) Execute() (LabelResources, *APIResponse, error) { + return r.ApiService.DatacentersServersLabelsGetExecute(r) +} + +/* + * DatacentersServersLabelsGet List all Server Labels + * You can retrieve a list of all labels associated with a server + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the Datacenter + * @param serverId The unique ID of the Server + * @return ApiDatacentersServersLabelsGetRequest + */ +func (a *LabelApiService) DatacentersServersLabelsGet(ctx _context.Context, datacenterId string, serverId string) ApiDatacentersServersLabelsGetRequest { + return ApiDatacentersServersLabelsGetRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + serverId: serverId, + } +} + +/* + * Execute executes the request + * @return LabelResources + */ +func (a *LabelApiService) DatacentersServersLabelsGetExecute(r ApiDatacentersServersLabelsGetRequest) (LabelResources, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue LabelResources + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelApiService.DatacentersServersLabelsGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/labels" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersServersLabelsGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersServersLabelsPostRequest struct { + ctx _context.Context + ApiService *LabelApiService + datacenterId string + serverId string + label *LabelResource + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersServersLabelsPostRequest) Label(label LabelResource) ApiDatacentersServersLabelsPostRequest { + r.label = &label + return r +} +func (r ApiDatacentersServersLabelsPostRequest) Pretty(pretty bool) ApiDatacentersServersLabelsPostRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersServersLabelsPostRequest) Depth(depth int32) ApiDatacentersServersLabelsPostRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersServersLabelsPostRequest) XContractNumber(xContractNumber int32) ApiDatacentersServersLabelsPostRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersServersLabelsPostRequest) Execute() (LabelResource, *APIResponse, error) { + return r.ApiService.DatacentersServersLabelsPostExecute(r) +} + +/* + * DatacentersServersLabelsPost Add a Label to Server + * This will add a label to the server. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the Datacenter + * @param serverId The unique ID of the Server + * @return ApiDatacentersServersLabelsPostRequest + */ +func (a *LabelApiService) DatacentersServersLabelsPost(ctx _context.Context, datacenterId string, serverId string) ApiDatacentersServersLabelsPostRequest { + return ApiDatacentersServersLabelsPostRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + serverId: serverId, + } +} + +/* + * Execute executes the request + * @return LabelResource + */ +func (a *LabelApiService) DatacentersServersLabelsPostExecute(r ApiDatacentersServersLabelsPostRequest) (LabelResource, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue LabelResource + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelApiService.DatacentersServersLabelsPost") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/labels" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.label == nil { + return localVarReturnValue, nil, reportError("label is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.label + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersServersLabelsPost", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersServersLabelsPutRequest struct { + ctx _context.Context + ApiService *LabelApiService + datacenterId string + serverId string + key string + label *LabelResource + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersServersLabelsPutRequest) Label(label LabelResource) ApiDatacentersServersLabelsPutRequest { + r.label = &label + return r +} +func (r ApiDatacentersServersLabelsPutRequest) Pretty(pretty bool) ApiDatacentersServersLabelsPutRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersServersLabelsPutRequest) Depth(depth int32) ApiDatacentersServersLabelsPutRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersServersLabelsPutRequest) XContractNumber(xContractNumber int32) ApiDatacentersServersLabelsPutRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersServersLabelsPutRequest) Execute() (LabelResource, *APIResponse, error) { + return r.ApiService.DatacentersServersLabelsPutExecute(r) +} + +/* + * DatacentersServersLabelsPut Modify a Label of Server + * This will modify the value of the label on a server. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the Datacenter + * @param serverId The unique ID of the Server + * @param key The key of the Label + * @return ApiDatacentersServersLabelsPutRequest + */ +func (a *LabelApiService) DatacentersServersLabelsPut(ctx _context.Context, datacenterId string, serverId string, key string) ApiDatacentersServersLabelsPutRequest { + return ApiDatacentersServersLabelsPutRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + serverId: serverId, + key: key, + } +} + +/* + * Execute executes the request + * @return LabelResource + */ +func (a *LabelApiService) DatacentersServersLabelsPutExecute(r ApiDatacentersServersLabelsPutRequest) (LabelResource, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue LabelResource + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelApiService.DatacentersServersLabelsPut") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/labels/{key}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterToString(r.key, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.label == nil { + return localVarReturnValue, nil, reportError("label is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.label + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersServersLabelsPut", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersVolumesLabelsDeleteRequest struct { + ctx _context.Context + ApiService *LabelApiService + datacenterId string + volumeId string + key string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersVolumesLabelsDeleteRequest) Pretty(pretty bool) ApiDatacentersVolumesLabelsDeleteRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersVolumesLabelsDeleteRequest) Depth(depth int32) ApiDatacentersVolumesLabelsDeleteRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersVolumesLabelsDeleteRequest) XContractNumber(xContractNumber int32) ApiDatacentersVolumesLabelsDeleteRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersVolumesLabelsDeleteRequest) Execute() (map[string]interface{}, *APIResponse, error) { + return r.ApiService.DatacentersVolumesLabelsDeleteExecute(r) +} + +/* + * DatacentersVolumesLabelsDelete Delete a Label from Volume + * This will remove a label from the volume. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the Datacenter + * @param volumeId The unique ID of the Volume + * @param key The key of the Label + * @return ApiDatacentersVolumesLabelsDeleteRequest + */ +func (a *LabelApiService) DatacentersVolumesLabelsDelete(ctx _context.Context, datacenterId string, volumeId string, key string) ApiDatacentersVolumesLabelsDeleteRequest { + return ApiDatacentersVolumesLabelsDeleteRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + volumeId: volumeId, + key: key, + } +} + +/* + * Execute executes the request + * @return map[string]interface{} + */ +func (a *LabelApiService) DatacentersVolumesLabelsDeleteExecute(r ApiDatacentersVolumesLabelsDeleteRequest) (map[string]interface{}, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelApiService.DatacentersVolumesLabelsDelete") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/volumes/{volumeId}/labels/{key}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", _neturl.PathEscape(parameterToString(r.volumeId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterToString(r.key, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersVolumesLabelsDelete", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersVolumesLabelsFindByKeyRequest struct { + ctx _context.Context + ApiService *LabelApiService + datacenterId string + volumeId string + key string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersVolumesLabelsFindByKeyRequest) Pretty(pretty bool) ApiDatacentersVolumesLabelsFindByKeyRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersVolumesLabelsFindByKeyRequest) Depth(depth int32) ApiDatacentersVolumesLabelsFindByKeyRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersVolumesLabelsFindByKeyRequest) XContractNumber(xContractNumber int32) ApiDatacentersVolumesLabelsFindByKeyRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersVolumesLabelsFindByKeyRequest) Execute() (LabelResource, *APIResponse, error) { + return r.ApiService.DatacentersVolumesLabelsFindByKeyExecute(r) +} + +/* + * DatacentersVolumesLabelsFindByKey Retrieve a Label of Volume + * This will retrieve the properties of a associated label to a volume. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the Datacenter + * @param volumeId The unique ID of the Volume + * @param key The key of the Label + * @return ApiDatacentersVolumesLabelsFindByKeyRequest + */ +func (a *LabelApiService) DatacentersVolumesLabelsFindByKey(ctx _context.Context, datacenterId string, volumeId string, key string) ApiDatacentersVolumesLabelsFindByKeyRequest { + return ApiDatacentersVolumesLabelsFindByKeyRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + volumeId: volumeId, + key: key, + } +} + +/* + * Execute executes the request + * @return LabelResource + */ +func (a *LabelApiService) DatacentersVolumesLabelsFindByKeyExecute(r ApiDatacentersVolumesLabelsFindByKeyRequest) (LabelResource, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue LabelResource + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelApiService.DatacentersVolumesLabelsFindByKey") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/volumes/{volumeId}/labels/{key}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", _neturl.PathEscape(parameterToString(r.volumeId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterToString(r.key, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersVolumesLabelsFindByKey", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersVolumesLabelsGetRequest struct { + ctx _context.Context + ApiService *LabelApiService + datacenterId string + volumeId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersVolumesLabelsGetRequest) Pretty(pretty bool) ApiDatacentersVolumesLabelsGetRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersVolumesLabelsGetRequest) Depth(depth int32) ApiDatacentersVolumesLabelsGetRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersVolumesLabelsGetRequest) XContractNumber(xContractNumber int32) ApiDatacentersVolumesLabelsGetRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersVolumesLabelsGetRequest) Execute() (LabelResources, *APIResponse, error) { + return r.ApiService.DatacentersVolumesLabelsGetExecute(r) +} + +/* + * DatacentersVolumesLabelsGet List all Volume Labels + * You can retrieve a list of all labels associated with a volume + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the Datacenter + * @param volumeId The unique ID of the Volume + * @return ApiDatacentersVolumesLabelsGetRequest + */ +func (a *LabelApiService) DatacentersVolumesLabelsGet(ctx _context.Context, datacenterId string, volumeId string) ApiDatacentersVolumesLabelsGetRequest { + return ApiDatacentersVolumesLabelsGetRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + volumeId: volumeId, + } +} + +/* + * Execute executes the request + * @return LabelResources + */ +func (a *LabelApiService) DatacentersVolumesLabelsGetExecute(r ApiDatacentersVolumesLabelsGetRequest) (LabelResources, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue LabelResources + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelApiService.DatacentersVolumesLabelsGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/volumes/{volumeId}/labels" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", _neturl.PathEscape(parameterToString(r.volumeId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersVolumesLabelsGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersVolumesLabelsPostRequest struct { + ctx _context.Context + ApiService *LabelApiService + datacenterId string + volumeId string + label *LabelResource + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersVolumesLabelsPostRequest) Label(label LabelResource) ApiDatacentersVolumesLabelsPostRequest { + r.label = &label + return r +} +func (r ApiDatacentersVolumesLabelsPostRequest) Pretty(pretty bool) ApiDatacentersVolumesLabelsPostRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersVolumesLabelsPostRequest) Depth(depth int32) ApiDatacentersVolumesLabelsPostRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersVolumesLabelsPostRequest) XContractNumber(xContractNumber int32) ApiDatacentersVolumesLabelsPostRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersVolumesLabelsPostRequest) Execute() (LabelResource, *APIResponse, error) { + return r.ApiService.DatacentersVolumesLabelsPostExecute(r) +} + +/* + * DatacentersVolumesLabelsPost Add a Label to Volume + * This will add a label to the volume. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the Datacenter + * @param volumeId The unique ID of the Volume + * @return ApiDatacentersVolumesLabelsPostRequest + */ +func (a *LabelApiService) DatacentersVolumesLabelsPost(ctx _context.Context, datacenterId string, volumeId string) ApiDatacentersVolumesLabelsPostRequest { + return ApiDatacentersVolumesLabelsPostRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + volumeId: volumeId, + } +} + +/* + * Execute executes the request + * @return LabelResource + */ +func (a *LabelApiService) DatacentersVolumesLabelsPostExecute(r ApiDatacentersVolumesLabelsPostRequest) (LabelResource, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue LabelResource + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelApiService.DatacentersVolumesLabelsPost") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/volumes/{volumeId}/labels" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", _neturl.PathEscape(parameterToString(r.volumeId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.label == nil { + return localVarReturnValue, nil, reportError("label is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.label + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersVolumesLabelsPost", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersVolumesLabelsPutRequest struct { + ctx _context.Context + ApiService *LabelApiService + datacenterId string + volumeId string + key string + label *LabelResource + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersVolumesLabelsPutRequest) Label(label LabelResource) ApiDatacentersVolumesLabelsPutRequest { + r.label = &label + return r +} +func (r ApiDatacentersVolumesLabelsPutRequest) Pretty(pretty bool) ApiDatacentersVolumesLabelsPutRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersVolumesLabelsPutRequest) Depth(depth int32) ApiDatacentersVolumesLabelsPutRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersVolumesLabelsPutRequest) XContractNumber(xContractNumber int32) ApiDatacentersVolumesLabelsPutRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersVolumesLabelsPutRequest) Execute() (LabelResource, *APIResponse, error) { + return r.ApiService.DatacentersVolumesLabelsPutExecute(r) +} + +/* + * DatacentersVolumesLabelsPut Modify a Label of Volume + * This will modify the value of the label on a volume. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the Datacenter + * @param volumeId The unique ID of the Volume + * @param key The key of the Label + * @return ApiDatacentersVolumesLabelsPutRequest + */ +func (a *LabelApiService) DatacentersVolumesLabelsPut(ctx _context.Context, datacenterId string, volumeId string, key string) ApiDatacentersVolumesLabelsPutRequest { + return ApiDatacentersVolumesLabelsPutRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + volumeId: volumeId, + key: key, + } +} + +/* + * Execute executes the request + * @return LabelResource + */ +func (a *LabelApiService) DatacentersVolumesLabelsPutExecute(r ApiDatacentersVolumesLabelsPutRequest) (LabelResource, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue LabelResource + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelApiService.DatacentersVolumesLabelsPut") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/volumes/{volumeId}/labels/{key}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", _neturl.PathEscape(parameterToString(r.volumeId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterToString(r.key, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.label == nil { + return localVarReturnValue, nil, reportError("label is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.label + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersVolumesLabelsPut", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiIpblocksLabelsDeleteRequest struct { + ctx _context.Context + ApiService *LabelApiService + ipblockId string + key string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiIpblocksLabelsDeleteRequest) Pretty(pretty bool) ApiIpblocksLabelsDeleteRequest { + r.pretty = &pretty + return r +} +func (r ApiIpblocksLabelsDeleteRequest) Depth(depth int32) ApiIpblocksLabelsDeleteRequest { + r.depth = &depth + return r +} +func (r ApiIpblocksLabelsDeleteRequest) XContractNumber(xContractNumber int32) ApiIpblocksLabelsDeleteRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiIpblocksLabelsDeleteRequest) Execute() (map[string]interface{}, *APIResponse, error) { + return r.ApiService.IpblocksLabelsDeleteExecute(r) +} + +/* + * IpblocksLabelsDelete Delete a Label from IP Block + * This will remove a label from the Ip Block. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param ipblockId The unique ID of the Ip Block + * @param key The key of the Label + * @return ApiIpblocksLabelsDeleteRequest + */ +func (a *LabelApiService) IpblocksLabelsDelete(ctx _context.Context, ipblockId string, key string) ApiIpblocksLabelsDeleteRequest { + return ApiIpblocksLabelsDeleteRequest{ + ApiService: a, + ctx: ctx, + ipblockId: ipblockId, + key: key, + } +} + +/* + * Execute executes the request + * @return map[string]interface{} + */ +func (a *LabelApiService) IpblocksLabelsDeleteExecute(r ApiIpblocksLabelsDeleteRequest) (map[string]interface{}, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelApiService.IpblocksLabelsDelete") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ipblocks/{ipblockId}/labels/{key}" + localVarPath = strings.Replace(localVarPath, "{"+"ipblockId"+"}", _neturl.PathEscape(parameterToString(r.ipblockId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterToString(r.key, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "IpblocksLabelsDelete", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiIpblocksLabelsFindByKeyRequest struct { + ctx _context.Context + ApiService *LabelApiService + ipblockId string + key string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiIpblocksLabelsFindByKeyRequest) Pretty(pretty bool) ApiIpblocksLabelsFindByKeyRequest { + r.pretty = &pretty + return r +} +func (r ApiIpblocksLabelsFindByKeyRequest) Depth(depth int32) ApiIpblocksLabelsFindByKeyRequest { + r.depth = &depth + return r +} +func (r ApiIpblocksLabelsFindByKeyRequest) XContractNumber(xContractNumber int32) ApiIpblocksLabelsFindByKeyRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiIpblocksLabelsFindByKeyRequest) Execute() (LabelResource, *APIResponse, error) { + return r.ApiService.IpblocksLabelsFindByKeyExecute(r) +} + +/* + * IpblocksLabelsFindByKey Retrieve a Label of IP Block + * This will retrieve the properties of a associated label to a Ip Block. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param ipblockId The unique ID of the Ip Block + * @param key The key of the Label + * @return ApiIpblocksLabelsFindByKeyRequest + */ +func (a *LabelApiService) IpblocksLabelsFindByKey(ctx _context.Context, ipblockId string, key string) ApiIpblocksLabelsFindByKeyRequest { + return ApiIpblocksLabelsFindByKeyRequest{ + ApiService: a, + ctx: ctx, + ipblockId: ipblockId, + key: key, + } +} + +/* + * Execute executes the request + * @return LabelResource + */ +func (a *LabelApiService) IpblocksLabelsFindByKeyExecute(r ApiIpblocksLabelsFindByKeyRequest) (LabelResource, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue LabelResource + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelApiService.IpblocksLabelsFindByKey") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ipblocks/{ipblockId}/labels/{key}" + localVarPath = strings.Replace(localVarPath, "{"+"ipblockId"+"}", _neturl.PathEscape(parameterToString(r.ipblockId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterToString(r.key, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "IpblocksLabelsFindByKey", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiIpblocksLabelsGetRequest struct { + ctx _context.Context + ApiService *LabelApiService + ipblockId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiIpblocksLabelsGetRequest) Pretty(pretty bool) ApiIpblocksLabelsGetRequest { + r.pretty = &pretty + return r +} +func (r ApiIpblocksLabelsGetRequest) Depth(depth int32) ApiIpblocksLabelsGetRequest { + r.depth = &depth + return r +} +func (r ApiIpblocksLabelsGetRequest) XContractNumber(xContractNumber int32) ApiIpblocksLabelsGetRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiIpblocksLabelsGetRequest) Execute() (LabelResources, *APIResponse, error) { + return r.ApiService.IpblocksLabelsGetExecute(r) +} + +/* + * IpblocksLabelsGet List all Ip Block Labels + * You can retrieve a list of all labels associated with a IP Block + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param ipblockId The unique ID of the Ip Block + * @return ApiIpblocksLabelsGetRequest + */ +func (a *LabelApiService) IpblocksLabelsGet(ctx _context.Context, ipblockId string) ApiIpblocksLabelsGetRequest { + return ApiIpblocksLabelsGetRequest{ + ApiService: a, + ctx: ctx, + ipblockId: ipblockId, + } +} + +/* + * Execute executes the request + * @return LabelResources + */ +func (a *LabelApiService) IpblocksLabelsGetExecute(r ApiIpblocksLabelsGetRequest) (LabelResources, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue LabelResources + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelApiService.IpblocksLabelsGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ipblocks/{ipblockId}/labels" + localVarPath = strings.Replace(localVarPath, "{"+"ipblockId"+"}", _neturl.PathEscape(parameterToString(r.ipblockId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "IpblocksLabelsGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiIpblocksLabelsPostRequest struct { + ctx _context.Context + ApiService *LabelApiService + ipblockId string + label *LabelResource + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiIpblocksLabelsPostRequest) Label(label LabelResource) ApiIpblocksLabelsPostRequest { + r.label = &label + return r +} +func (r ApiIpblocksLabelsPostRequest) Pretty(pretty bool) ApiIpblocksLabelsPostRequest { + r.pretty = &pretty + return r +} +func (r ApiIpblocksLabelsPostRequest) Depth(depth int32) ApiIpblocksLabelsPostRequest { + r.depth = &depth + return r +} +func (r ApiIpblocksLabelsPostRequest) XContractNumber(xContractNumber int32) ApiIpblocksLabelsPostRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiIpblocksLabelsPostRequest) Execute() (LabelResource, *APIResponse, error) { + return r.ApiService.IpblocksLabelsPostExecute(r) +} + +/* + * IpblocksLabelsPost Add a Label to IP Block + * This will add a label to the Ip Block. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param ipblockId The unique ID of the Ip Block + * @return ApiIpblocksLabelsPostRequest + */ +func (a *LabelApiService) IpblocksLabelsPost(ctx _context.Context, ipblockId string) ApiIpblocksLabelsPostRequest { + return ApiIpblocksLabelsPostRequest{ + ApiService: a, + ctx: ctx, + ipblockId: ipblockId, + } +} + +/* + * Execute executes the request + * @return LabelResource + */ +func (a *LabelApiService) IpblocksLabelsPostExecute(r ApiIpblocksLabelsPostRequest) (LabelResource, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue LabelResource + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelApiService.IpblocksLabelsPost") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ipblocks/{ipblockId}/labels" + localVarPath = strings.Replace(localVarPath, "{"+"ipblockId"+"}", _neturl.PathEscape(parameterToString(r.ipblockId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.label == nil { + return localVarReturnValue, nil, reportError("label is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.label + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "IpblocksLabelsPost", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiIpblocksLabelsPutRequest struct { + ctx _context.Context + ApiService *LabelApiService + ipblockId string + key string + label *LabelResource + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiIpblocksLabelsPutRequest) Label(label LabelResource) ApiIpblocksLabelsPutRequest { + r.label = &label + return r +} +func (r ApiIpblocksLabelsPutRequest) Pretty(pretty bool) ApiIpblocksLabelsPutRequest { + r.pretty = &pretty + return r +} +func (r ApiIpblocksLabelsPutRequest) Depth(depth int32) ApiIpblocksLabelsPutRequest { + r.depth = &depth + return r +} +func (r ApiIpblocksLabelsPutRequest) XContractNumber(xContractNumber int32) ApiIpblocksLabelsPutRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiIpblocksLabelsPutRequest) Execute() (LabelResource, *APIResponse, error) { + return r.ApiService.IpblocksLabelsPutExecute(r) +} + +/* + * IpblocksLabelsPut Modify a Label of IP Block + * This will modify the value of the label on a Ip Block. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param ipblockId The unique ID of the Ip Block + * @param key The key of the Label + * @return ApiIpblocksLabelsPutRequest + */ +func (a *LabelApiService) IpblocksLabelsPut(ctx _context.Context, ipblockId string, key string) ApiIpblocksLabelsPutRequest { + return ApiIpblocksLabelsPutRequest{ + ApiService: a, + ctx: ctx, + ipblockId: ipblockId, + key: key, + } +} + +/* + * Execute executes the request + * @return LabelResource + */ +func (a *LabelApiService) IpblocksLabelsPutExecute(r ApiIpblocksLabelsPutRequest) (LabelResource, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue LabelResource + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelApiService.IpblocksLabelsPut") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ipblocks/{ipblockId}/labels/{key}" + localVarPath = strings.Replace(localVarPath, "{"+"ipblockId"+"}", _neturl.PathEscape(parameterToString(r.ipblockId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterToString(r.key, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.label == nil { + return localVarReturnValue, nil, reportError("label is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.label + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "IpblocksLabelsPut", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiLabelsFindByLabelurnRequest struct { + ctx _context.Context + ApiService *LabelApiService + labelurn string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiLabelsFindByLabelurnRequest) Pretty(pretty bool) ApiLabelsFindByLabelurnRequest { + r.pretty = &pretty + return r +} +func (r ApiLabelsFindByLabelurnRequest) Depth(depth int32) ApiLabelsFindByLabelurnRequest { + r.depth = &depth + return r +} +func (r ApiLabelsFindByLabelurnRequest) XContractNumber(xContractNumber int32) ApiLabelsFindByLabelurnRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiLabelsFindByLabelurnRequest) Execute() (Label, *APIResponse, error) { + return r.ApiService.LabelsFindByLabelurnExecute(r) +} + +/* + * LabelsFindByLabelurn Returns the label by its URN. + * You can retrieve the details of a specific label using its URN. A URN is for uniqueness of a Label and composed using urn:label::: + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param labelurn The URN representing the unique ID of the label. A URN is for uniqueness of a Label and composed using urn:label::: + * @return ApiLabelsFindByLabelurnRequest + */ +func (a *LabelApiService) LabelsFindByLabelurn(ctx _context.Context, labelurn string) ApiLabelsFindByLabelurnRequest { + return ApiLabelsFindByLabelurnRequest{ + ApiService: a, + ctx: ctx, + labelurn: labelurn, + } +} + +/* + * Execute executes the request + * @return Label + */ +func (a *LabelApiService) LabelsFindByLabelurnExecute(r ApiLabelsFindByLabelurnRequest) (Label, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Label + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelApiService.LabelsFindByLabelurn") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/labels/{labelurn}" + localVarPath = strings.Replace(localVarPath, "{"+"labelurn"+"}", _neturl.PathEscape(parameterToString(r.labelurn, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "LabelsFindByLabelurn", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiLabelsGetRequest struct { + ctx _context.Context + ApiService *LabelApiService + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiLabelsGetRequest) Pretty(pretty bool) ApiLabelsGetRequest { + r.pretty = &pretty + return r +} +func (r ApiLabelsGetRequest) Depth(depth int32) ApiLabelsGetRequest { + r.depth = &depth + return r +} +func (r ApiLabelsGetRequest) XContractNumber(xContractNumber int32) ApiLabelsGetRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiLabelsGetRequest) Execute() (Labels, *APIResponse, error) { + return r.ApiService.LabelsGetExecute(r) +} + +/* + * LabelsGet List Labels + * You can retrieve a complete list of labels that you have access to. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiLabelsGetRequest + */ +func (a *LabelApiService) LabelsGet(ctx _context.Context) ApiLabelsGetRequest { + return ApiLabelsGetRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + * @return Labels + */ +func (a *LabelApiService) LabelsGetExecute(r ApiLabelsGetRequest) (Labels, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Labels + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelApiService.LabelsGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/labels" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "LabelsGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiSnapshotsLabelsDeleteRequest struct { + ctx _context.Context + ApiService *LabelApiService + snapshotId string + key string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiSnapshotsLabelsDeleteRequest) Pretty(pretty bool) ApiSnapshotsLabelsDeleteRequest { + r.pretty = &pretty + return r +} +func (r ApiSnapshotsLabelsDeleteRequest) Depth(depth int32) ApiSnapshotsLabelsDeleteRequest { + r.depth = &depth + return r +} +func (r ApiSnapshotsLabelsDeleteRequest) XContractNumber(xContractNumber int32) ApiSnapshotsLabelsDeleteRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiSnapshotsLabelsDeleteRequest) Execute() (map[string]interface{}, *APIResponse, error) { + return r.ApiService.SnapshotsLabelsDeleteExecute(r) +} + +/* + * SnapshotsLabelsDelete Delete a Label from Snapshot + * This will remove a label from the snapshot. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param snapshotId The unique ID of the Snapshot + * @param key The key of the Label + * @return ApiSnapshotsLabelsDeleteRequest + */ +func (a *LabelApiService) SnapshotsLabelsDelete(ctx _context.Context, snapshotId string, key string) ApiSnapshotsLabelsDeleteRequest { + return ApiSnapshotsLabelsDeleteRequest{ + ApiService: a, + ctx: ctx, + snapshotId: snapshotId, + key: key, + } +} + +/* + * Execute executes the request + * @return map[string]interface{} + */ +func (a *LabelApiService) SnapshotsLabelsDeleteExecute(r ApiSnapshotsLabelsDeleteRequest) (map[string]interface{}, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelApiService.SnapshotsLabelsDelete") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/snapshots/{snapshotId}/labels/{key}" + localVarPath = strings.Replace(localVarPath, "{"+"snapshotId"+"}", _neturl.PathEscape(parameterToString(r.snapshotId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterToString(r.key, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "SnapshotsLabelsDelete", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiSnapshotsLabelsFindByKeyRequest struct { + ctx _context.Context + ApiService *LabelApiService + snapshotId string + key string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiSnapshotsLabelsFindByKeyRequest) Pretty(pretty bool) ApiSnapshotsLabelsFindByKeyRequest { + r.pretty = &pretty + return r +} +func (r ApiSnapshotsLabelsFindByKeyRequest) Depth(depth int32) ApiSnapshotsLabelsFindByKeyRequest { + r.depth = &depth + return r +} +func (r ApiSnapshotsLabelsFindByKeyRequest) XContractNumber(xContractNumber int32) ApiSnapshotsLabelsFindByKeyRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiSnapshotsLabelsFindByKeyRequest) Execute() (LabelResource, *APIResponse, error) { + return r.ApiService.SnapshotsLabelsFindByKeyExecute(r) +} + +/* + * SnapshotsLabelsFindByKey Retrieve a Label of Snapshot + * This will retrieve the properties of a associated label to a snapshot. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param snapshotId The unique ID of the Snapshot + * @param key The key of the Label + * @return ApiSnapshotsLabelsFindByKeyRequest + */ +func (a *LabelApiService) SnapshotsLabelsFindByKey(ctx _context.Context, snapshotId string, key string) ApiSnapshotsLabelsFindByKeyRequest { + return ApiSnapshotsLabelsFindByKeyRequest{ + ApiService: a, + ctx: ctx, + snapshotId: snapshotId, + key: key, + } +} + +/* + * Execute executes the request + * @return LabelResource + */ +func (a *LabelApiService) SnapshotsLabelsFindByKeyExecute(r ApiSnapshotsLabelsFindByKeyRequest) (LabelResource, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue LabelResource + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelApiService.SnapshotsLabelsFindByKey") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/snapshots/{snapshotId}/labels/{key}" + localVarPath = strings.Replace(localVarPath, "{"+"snapshotId"+"}", _neturl.PathEscape(parameterToString(r.snapshotId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterToString(r.key, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "SnapshotsLabelsFindByKey", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiSnapshotsLabelsGetRequest struct { + ctx _context.Context + ApiService *LabelApiService + snapshotId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiSnapshotsLabelsGetRequest) Pretty(pretty bool) ApiSnapshotsLabelsGetRequest { + r.pretty = &pretty + return r +} +func (r ApiSnapshotsLabelsGetRequest) Depth(depth int32) ApiSnapshotsLabelsGetRequest { + r.depth = &depth + return r +} +func (r ApiSnapshotsLabelsGetRequest) XContractNumber(xContractNumber int32) ApiSnapshotsLabelsGetRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiSnapshotsLabelsGetRequest) Execute() (LabelResources, *APIResponse, error) { + return r.ApiService.SnapshotsLabelsGetExecute(r) +} + +/* + * SnapshotsLabelsGet List all Snapshot Labels + * You can retrieve a list of all labels associated with a snapshot + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param snapshotId The unique ID of the Snapshot + * @return ApiSnapshotsLabelsGetRequest + */ +func (a *LabelApiService) SnapshotsLabelsGet(ctx _context.Context, snapshotId string) ApiSnapshotsLabelsGetRequest { + return ApiSnapshotsLabelsGetRequest{ + ApiService: a, + ctx: ctx, + snapshotId: snapshotId, + } +} + +/* + * Execute executes the request + * @return LabelResources + */ +func (a *LabelApiService) SnapshotsLabelsGetExecute(r ApiSnapshotsLabelsGetRequest) (LabelResources, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue LabelResources + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelApiService.SnapshotsLabelsGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/snapshots/{snapshotId}/labels" + localVarPath = strings.Replace(localVarPath, "{"+"snapshotId"+"}", _neturl.PathEscape(parameterToString(r.snapshotId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "SnapshotsLabelsGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiSnapshotsLabelsPostRequest struct { + ctx _context.Context + ApiService *LabelApiService + snapshotId string + label *LabelResource + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiSnapshotsLabelsPostRequest) Label(label LabelResource) ApiSnapshotsLabelsPostRequest { + r.label = &label + return r +} +func (r ApiSnapshotsLabelsPostRequest) Pretty(pretty bool) ApiSnapshotsLabelsPostRequest { + r.pretty = &pretty + return r +} +func (r ApiSnapshotsLabelsPostRequest) Depth(depth int32) ApiSnapshotsLabelsPostRequest { + r.depth = &depth + return r +} +func (r ApiSnapshotsLabelsPostRequest) XContractNumber(xContractNumber int32) ApiSnapshotsLabelsPostRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiSnapshotsLabelsPostRequest) Execute() (LabelResource, *APIResponse, error) { + return r.ApiService.SnapshotsLabelsPostExecute(r) +} + +/* + * SnapshotsLabelsPost Add a Label to Snapshot + * This will add a label to the snapshot. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param snapshotId The unique ID of the Snapshot + * @return ApiSnapshotsLabelsPostRequest + */ +func (a *LabelApiService) SnapshotsLabelsPost(ctx _context.Context, snapshotId string) ApiSnapshotsLabelsPostRequest { + return ApiSnapshotsLabelsPostRequest{ + ApiService: a, + ctx: ctx, + snapshotId: snapshotId, + } +} + +/* + * Execute executes the request + * @return LabelResource + */ +func (a *LabelApiService) SnapshotsLabelsPostExecute(r ApiSnapshotsLabelsPostRequest) (LabelResource, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue LabelResource + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelApiService.SnapshotsLabelsPost") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/snapshots/{snapshotId}/labels" + localVarPath = strings.Replace(localVarPath, "{"+"snapshotId"+"}", _neturl.PathEscape(parameterToString(r.snapshotId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.label == nil { + return localVarReturnValue, nil, reportError("label is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.label + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "SnapshotsLabelsPost", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiSnapshotsLabelsPutRequest struct { + ctx _context.Context + ApiService *LabelApiService + snapshotId string + key string + label *LabelResource + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiSnapshotsLabelsPutRequest) Label(label LabelResource) ApiSnapshotsLabelsPutRequest { + r.label = &label + return r +} +func (r ApiSnapshotsLabelsPutRequest) Pretty(pretty bool) ApiSnapshotsLabelsPutRequest { + r.pretty = &pretty + return r +} +func (r ApiSnapshotsLabelsPutRequest) Depth(depth int32) ApiSnapshotsLabelsPutRequest { + r.depth = &depth + return r +} +func (r ApiSnapshotsLabelsPutRequest) XContractNumber(xContractNumber int32) ApiSnapshotsLabelsPutRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiSnapshotsLabelsPutRequest) Execute() (LabelResource, *APIResponse, error) { + return r.ApiService.SnapshotsLabelsPutExecute(r) +} + +/* + * SnapshotsLabelsPut Modify a Label of Snapshot + * This will modify the value of the label on a snapshot. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param snapshotId The unique ID of the Snapshot + * @param key The key of the Label + * @return ApiSnapshotsLabelsPutRequest + */ +func (a *LabelApiService) SnapshotsLabelsPut(ctx _context.Context, snapshotId string, key string) ApiSnapshotsLabelsPutRequest { + return ApiSnapshotsLabelsPutRequest{ + ApiService: a, + ctx: ctx, + snapshotId: snapshotId, + key: key, + } +} + +/* + * Execute executes the request + * @return LabelResource + */ +func (a *LabelApiService) SnapshotsLabelsPutExecute(r ApiSnapshotsLabelsPutRequest) (LabelResource, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue LabelResource + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelApiService.SnapshotsLabelsPut") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/snapshots/{snapshotId}/labels/{key}" + localVarPath = strings.Replace(localVarPath, "{"+"snapshotId"+"}", _neturl.PathEscape(parameterToString(r.snapshotId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterToString(r.key, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.label == nil { + return localVarReturnValue, nil, reportError("label is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.label + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "SnapshotsLabelsPut", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_lan.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_lan.go new file mode 100644 index 0000000000..98d93bbf92 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_lan.go @@ -0,0 +1,1530 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" +) + +// Linger please +var ( + _ _context.Context +) + +// LanApiService LanApi service +type LanApiService service + +type ApiDatacentersLansDeleteRequest struct { + ctx _context.Context + ApiService *LanApiService + datacenterId string + lanId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersLansDeleteRequest) Pretty(pretty bool) ApiDatacentersLansDeleteRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersLansDeleteRequest) Depth(depth int32) ApiDatacentersLansDeleteRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersLansDeleteRequest) XContractNumber(xContractNumber int32) ApiDatacentersLansDeleteRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersLansDeleteRequest) Execute() (map[string]interface{}, *APIResponse, error) { + return r.ApiService.DatacentersLansDeleteExecute(r) +} + +/* + * DatacentersLansDelete Delete a Lan. + * Removes the specific Lan + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @param lanId The unique ID of the LAN + * @return ApiDatacentersLansDeleteRequest + */ +func (a *LanApiService) DatacentersLansDelete(ctx _context.Context, datacenterId string, lanId string) ApiDatacentersLansDeleteRequest { + return ApiDatacentersLansDeleteRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + lanId: lanId, + } +} + +/* + * Execute executes the request + * @return map[string]interface{} + */ +func (a *LanApiService) DatacentersLansDeleteExecute(r ApiDatacentersLansDeleteRequest) (map[string]interface{}, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LanApiService.DatacentersLansDelete") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/lans/{lanId}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"lanId"+"}", _neturl.PathEscape(parameterToString(r.lanId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersLansDelete", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersLansFindByIdRequest struct { + ctx _context.Context + ApiService *LanApiService + datacenterId string + lanId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersLansFindByIdRequest) Pretty(pretty bool) ApiDatacentersLansFindByIdRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersLansFindByIdRequest) Depth(depth int32) ApiDatacentersLansFindByIdRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersLansFindByIdRequest) XContractNumber(xContractNumber int32) ApiDatacentersLansFindByIdRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersLansFindByIdRequest) Execute() (Lan, *APIResponse, error) { + return r.ApiService.DatacentersLansFindByIdExecute(r) +} + +/* + * DatacentersLansFindById Retrieve a Lan + * Retrieves the attributes of a given LAN + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @param lanId The unique ID of the LAN + * @return ApiDatacentersLansFindByIdRequest + */ +func (a *LanApiService) DatacentersLansFindById(ctx _context.Context, datacenterId string, lanId string) ApiDatacentersLansFindByIdRequest { + return ApiDatacentersLansFindByIdRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + lanId: lanId, + } +} + +/* + * Execute executes the request + * @return Lan + */ +func (a *LanApiService) DatacentersLansFindByIdExecute(r ApiDatacentersLansFindByIdRequest) (Lan, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Lan + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LanApiService.DatacentersLansFindById") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/lans/{lanId}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"lanId"+"}", _neturl.PathEscape(parameterToString(r.lanId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersLansFindById", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersLansGetRequest struct { + ctx _context.Context + ApiService *LanApiService + datacenterId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersLansGetRequest) Pretty(pretty bool) ApiDatacentersLansGetRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersLansGetRequest) Depth(depth int32) ApiDatacentersLansGetRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersLansGetRequest) XContractNumber(xContractNumber int32) ApiDatacentersLansGetRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersLansGetRequest) Execute() (Lans, *APIResponse, error) { + return r.ApiService.DatacentersLansGetExecute(r) +} + +/* + * DatacentersLansGet List Lans + * Retrieve a list of LANs within the datacenter + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @return ApiDatacentersLansGetRequest + */ +func (a *LanApiService) DatacentersLansGet(ctx _context.Context, datacenterId string) ApiDatacentersLansGetRequest { + return ApiDatacentersLansGetRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + } +} + +/* + * Execute executes the request + * @return Lans + */ +func (a *LanApiService) DatacentersLansGetExecute(r ApiDatacentersLansGetRequest) (Lans, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Lans + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LanApiService.DatacentersLansGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/lans" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersLansGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersLansNicsFindByIdRequest struct { + ctx _context.Context + ApiService *LanApiService + datacenterId string + lanId string + nicId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersLansNicsFindByIdRequest) Pretty(pretty bool) ApiDatacentersLansNicsFindByIdRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersLansNicsFindByIdRequest) Depth(depth int32) ApiDatacentersLansNicsFindByIdRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersLansNicsFindByIdRequest) XContractNumber(xContractNumber int32) ApiDatacentersLansNicsFindByIdRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersLansNicsFindByIdRequest) Execute() (Nic, *APIResponse, error) { + return r.ApiService.DatacentersLansNicsFindByIdExecute(r) +} + +/* + * DatacentersLansNicsFindById Retrieve a nic attached to lan + * This will retrieve the properties of an attached nic. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @param lanId The unique ID of the LAN + * @param nicId The unique ID of the NIC + * @return ApiDatacentersLansNicsFindByIdRequest + */ +func (a *LanApiService) DatacentersLansNicsFindById(ctx _context.Context, datacenterId string, lanId string, nicId string) ApiDatacentersLansNicsFindByIdRequest { + return ApiDatacentersLansNicsFindByIdRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + lanId: lanId, + nicId: nicId, + } +} + +/* + * Execute executes the request + * @return Nic + */ +func (a *LanApiService) DatacentersLansNicsFindByIdExecute(r ApiDatacentersLansNicsFindByIdRequest) (Nic, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Nic + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LanApiService.DatacentersLansNicsFindById") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/lans/{lanId}/nics/{nicId}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"lanId"+"}", _neturl.PathEscape(parameterToString(r.lanId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterToString(r.nicId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersLansNicsFindById", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersLansNicsGetRequest struct { + ctx _context.Context + ApiService *LanApiService + datacenterId string + lanId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersLansNicsGetRequest) Pretty(pretty bool) ApiDatacentersLansNicsGetRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersLansNicsGetRequest) Depth(depth int32) ApiDatacentersLansNicsGetRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersLansNicsGetRequest) XContractNumber(xContractNumber int32) ApiDatacentersLansNicsGetRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersLansNicsGetRequest) Execute() (LanNics, *APIResponse, error) { + return r.ApiService.DatacentersLansNicsGetExecute(r) +} + +/* + * DatacentersLansNicsGet List Lan Members + * You can retrieve a list of nics attached to a lan + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @param lanId The unique ID of the LAN + * @return ApiDatacentersLansNicsGetRequest + */ +func (a *LanApiService) DatacentersLansNicsGet(ctx _context.Context, datacenterId string, lanId string) ApiDatacentersLansNicsGetRequest { + return ApiDatacentersLansNicsGetRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + lanId: lanId, + } +} + +/* + * Execute executes the request + * @return LanNics + */ +func (a *LanApiService) DatacentersLansNicsGetExecute(r ApiDatacentersLansNicsGetRequest) (LanNics, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue LanNics + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LanApiService.DatacentersLansNicsGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/lans/{lanId}/nics" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"lanId"+"}", _neturl.PathEscape(parameterToString(r.lanId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersLansNicsGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersLansNicsPostRequest struct { + ctx _context.Context + ApiService *LanApiService + datacenterId string + lanId string + nic *Nic + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersLansNicsPostRequest) Nic(nic Nic) ApiDatacentersLansNicsPostRequest { + r.nic = &nic + return r +} +func (r ApiDatacentersLansNicsPostRequest) Pretty(pretty bool) ApiDatacentersLansNicsPostRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersLansNicsPostRequest) Depth(depth int32) ApiDatacentersLansNicsPostRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersLansNicsPostRequest) XContractNumber(xContractNumber int32) ApiDatacentersLansNicsPostRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersLansNicsPostRequest) Execute() (Nic, *APIResponse, error) { + return r.ApiService.DatacentersLansNicsPostExecute(r) +} + +/* + * DatacentersLansNicsPost Attach a nic + * This will attach a pre-existing nic to a lan. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @param lanId The unique ID of the LAN + * @return ApiDatacentersLansNicsPostRequest + */ +func (a *LanApiService) DatacentersLansNicsPost(ctx _context.Context, datacenterId string, lanId string) ApiDatacentersLansNicsPostRequest { + return ApiDatacentersLansNicsPostRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + lanId: lanId, + } +} + +/* + * Execute executes the request + * @return Nic + */ +func (a *LanApiService) DatacentersLansNicsPostExecute(r ApiDatacentersLansNicsPostRequest) (Nic, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Nic + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LanApiService.DatacentersLansNicsPost") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/lans/{lanId}/nics" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"lanId"+"}", _neturl.PathEscape(parameterToString(r.lanId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.nic == nil { + return localVarReturnValue, nil, reportError("nic is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.nic + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersLansNicsPost", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersLansPatchRequest struct { + ctx _context.Context + ApiService *LanApiService + datacenterId string + lanId string + lan *LanProperties + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersLansPatchRequest) Lan(lan LanProperties) ApiDatacentersLansPatchRequest { + r.lan = &lan + return r +} +func (r ApiDatacentersLansPatchRequest) Pretty(pretty bool) ApiDatacentersLansPatchRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersLansPatchRequest) Depth(depth int32) ApiDatacentersLansPatchRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersLansPatchRequest) XContractNumber(xContractNumber int32) ApiDatacentersLansPatchRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersLansPatchRequest) Execute() (Lan, *APIResponse, error) { + return r.ApiService.DatacentersLansPatchExecute(r) +} + +/* + * DatacentersLansPatch Partially modify a Lan + * You can use update attributes of a resource + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @param lanId The unique ID of the LAN + * @return ApiDatacentersLansPatchRequest + */ +func (a *LanApiService) DatacentersLansPatch(ctx _context.Context, datacenterId string, lanId string) ApiDatacentersLansPatchRequest { + return ApiDatacentersLansPatchRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + lanId: lanId, + } +} + +/* + * Execute executes the request + * @return Lan + */ +func (a *LanApiService) DatacentersLansPatchExecute(r ApiDatacentersLansPatchRequest) (Lan, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Lan + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LanApiService.DatacentersLansPatch") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/lans/{lanId}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"lanId"+"}", _neturl.PathEscape(parameterToString(r.lanId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.lan == nil { + return localVarReturnValue, nil, reportError("lan is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.lan + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersLansPatch", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersLansPostRequest struct { + ctx _context.Context + ApiService *LanApiService + datacenterId string + lan *LanPost + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersLansPostRequest) Lan(lan LanPost) ApiDatacentersLansPostRequest { + r.lan = &lan + return r +} +func (r ApiDatacentersLansPostRequest) Pretty(pretty bool) ApiDatacentersLansPostRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersLansPostRequest) Depth(depth int32) ApiDatacentersLansPostRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersLansPostRequest) XContractNumber(xContractNumber int32) ApiDatacentersLansPostRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersLansPostRequest) Execute() (LanPost, *APIResponse, error) { + return r.ApiService.DatacentersLansPostExecute(r) +} + +/* + * DatacentersLansPost Create a Lan + * Creates a LAN within the datacenter + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @return ApiDatacentersLansPostRequest + */ +func (a *LanApiService) DatacentersLansPost(ctx _context.Context, datacenterId string) ApiDatacentersLansPostRequest { + return ApiDatacentersLansPostRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + } +} + +/* + * Execute executes the request + * @return LanPost + */ +func (a *LanApiService) DatacentersLansPostExecute(r ApiDatacentersLansPostRequest) (LanPost, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue LanPost + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LanApiService.DatacentersLansPost") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/lans" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.lan == nil { + return localVarReturnValue, nil, reportError("lan is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.lan + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersLansPost", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersLansPutRequest struct { + ctx _context.Context + ApiService *LanApiService + datacenterId string + lanId string + lan *Lan + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersLansPutRequest) Lan(lan Lan) ApiDatacentersLansPutRequest { + r.lan = &lan + return r +} +func (r ApiDatacentersLansPutRequest) Pretty(pretty bool) ApiDatacentersLansPutRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersLansPutRequest) Depth(depth int32) ApiDatacentersLansPutRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersLansPutRequest) XContractNumber(xContractNumber int32) ApiDatacentersLansPutRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersLansPutRequest) Execute() (Lan, *APIResponse, error) { + return r.ApiService.DatacentersLansPutExecute(r) +} + +/* + * DatacentersLansPut Modify a Lan + * You can use update attributes of a resource + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @param lanId The unique ID of the LAN + * @return ApiDatacentersLansPutRequest + */ +func (a *LanApiService) DatacentersLansPut(ctx _context.Context, datacenterId string, lanId string) ApiDatacentersLansPutRequest { + return ApiDatacentersLansPutRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + lanId: lanId, + } +} + +/* + * Execute executes the request + * @return Lan + */ +func (a *LanApiService) DatacentersLansPutExecute(r ApiDatacentersLansPutRequest) (Lan, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Lan + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LanApiService.DatacentersLansPut") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/lans/{lanId}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"lanId"+"}", _neturl.PathEscape(parameterToString(r.lanId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.lan == nil { + return localVarReturnValue, nil, reportError("lan is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.lan + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersLansPut", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_load_balancer.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_load_balancer.go new file mode 100644 index 0000000000..6a8ca7e50a --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_load_balancer.go @@ -0,0 +1,1697 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" +) + +// Linger please +var ( + _ _context.Context +) + +// LoadBalancerApiService LoadBalancerApi service +type LoadBalancerApiService service + +type ApiDatacentersLoadbalancersBalancednicsDeleteRequest struct { + ctx _context.Context + ApiService *LoadBalancerApiService + datacenterId string + loadbalancerId string + nicId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersLoadbalancersBalancednicsDeleteRequest) Pretty(pretty bool) ApiDatacentersLoadbalancersBalancednicsDeleteRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersLoadbalancersBalancednicsDeleteRequest) Depth(depth int32) ApiDatacentersLoadbalancersBalancednicsDeleteRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersLoadbalancersBalancednicsDeleteRequest) XContractNumber(xContractNumber int32) ApiDatacentersLoadbalancersBalancednicsDeleteRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersLoadbalancersBalancednicsDeleteRequest) Execute() (map[string]interface{}, *APIResponse, error) { + return r.ApiService.DatacentersLoadbalancersBalancednicsDeleteExecute(r) +} + +/* + * DatacentersLoadbalancersBalancednicsDelete Detach a nic from loadbalancer + * This will remove a nic from Load Balancer + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @param loadbalancerId The unique ID of the Load Balancer + * @param nicId The unique ID of the NIC + * @return ApiDatacentersLoadbalancersBalancednicsDeleteRequest + */ +func (a *LoadBalancerApiService) DatacentersLoadbalancersBalancednicsDelete(ctx _context.Context, datacenterId string, loadbalancerId string, nicId string) ApiDatacentersLoadbalancersBalancednicsDeleteRequest { + return ApiDatacentersLoadbalancersBalancednicsDeleteRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + loadbalancerId: loadbalancerId, + nicId: nicId, + } +} + +/* + * Execute executes the request + * @return map[string]interface{} + */ +func (a *LoadBalancerApiService) DatacentersLoadbalancersBalancednicsDeleteExecute(r ApiDatacentersLoadbalancersBalancednicsDeleteRequest) (map[string]interface{}, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LoadBalancerApiService.DatacentersLoadbalancersBalancednicsDelete") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/loadbalancers/{loadbalancerId}/balancednics/{nicId}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"loadbalancerId"+"}", _neturl.PathEscape(parameterToString(r.loadbalancerId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterToString(r.nicId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersLoadbalancersBalancednicsDelete", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersLoadbalancersBalancednicsFindByNicRequest struct { + ctx _context.Context + ApiService *LoadBalancerApiService + datacenterId string + loadbalancerId string + nicId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersLoadbalancersBalancednicsFindByNicRequest) Pretty(pretty bool) ApiDatacentersLoadbalancersBalancednicsFindByNicRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersLoadbalancersBalancednicsFindByNicRequest) Depth(depth int32) ApiDatacentersLoadbalancersBalancednicsFindByNicRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersLoadbalancersBalancednicsFindByNicRequest) XContractNumber(xContractNumber int32) ApiDatacentersLoadbalancersBalancednicsFindByNicRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersLoadbalancersBalancednicsFindByNicRequest) Execute() (Nic, *APIResponse, error) { + return r.ApiService.DatacentersLoadbalancersBalancednicsFindByNicExecute(r) +} + +/* + * DatacentersLoadbalancersBalancednicsFindByNic Retrieve a nic attached to Load Balancer + * This will retrieve the properties of an attached nic. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @param loadbalancerId The unique ID of the Load Balancer + * @param nicId The unique ID of the NIC + * @return ApiDatacentersLoadbalancersBalancednicsFindByNicRequest + */ +func (a *LoadBalancerApiService) DatacentersLoadbalancersBalancednicsFindByNic(ctx _context.Context, datacenterId string, loadbalancerId string, nicId string) ApiDatacentersLoadbalancersBalancednicsFindByNicRequest { + return ApiDatacentersLoadbalancersBalancednicsFindByNicRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + loadbalancerId: loadbalancerId, + nicId: nicId, + } +} + +/* + * Execute executes the request + * @return Nic + */ +func (a *LoadBalancerApiService) DatacentersLoadbalancersBalancednicsFindByNicExecute(r ApiDatacentersLoadbalancersBalancednicsFindByNicRequest) (Nic, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Nic + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LoadBalancerApiService.DatacentersLoadbalancersBalancednicsFindByNic") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/loadbalancers/{loadbalancerId}/balancednics/{nicId}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"loadbalancerId"+"}", _neturl.PathEscape(parameterToString(r.loadbalancerId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterToString(r.nicId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersLoadbalancersBalancednicsFindByNic", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersLoadbalancersBalancednicsGetRequest struct { + ctx _context.Context + ApiService *LoadBalancerApiService + datacenterId string + loadbalancerId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersLoadbalancersBalancednicsGetRequest) Pretty(pretty bool) ApiDatacentersLoadbalancersBalancednicsGetRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersLoadbalancersBalancednicsGetRequest) Depth(depth int32) ApiDatacentersLoadbalancersBalancednicsGetRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersLoadbalancersBalancednicsGetRequest) XContractNumber(xContractNumber int32) ApiDatacentersLoadbalancersBalancednicsGetRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersLoadbalancersBalancednicsGetRequest) Execute() (BalancedNics, *APIResponse, error) { + return r.ApiService.DatacentersLoadbalancersBalancednicsGetExecute(r) +} + +/* + * DatacentersLoadbalancersBalancednicsGet List Load Balancer Members + * You can retrieve a list of nics attached to a Load Balancer + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @param loadbalancerId The unique ID of the Load Balancer + * @return ApiDatacentersLoadbalancersBalancednicsGetRequest + */ +func (a *LoadBalancerApiService) DatacentersLoadbalancersBalancednicsGet(ctx _context.Context, datacenterId string, loadbalancerId string) ApiDatacentersLoadbalancersBalancednicsGetRequest { + return ApiDatacentersLoadbalancersBalancednicsGetRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + loadbalancerId: loadbalancerId, + } +} + +/* + * Execute executes the request + * @return BalancedNics + */ +func (a *LoadBalancerApiService) DatacentersLoadbalancersBalancednicsGetExecute(r ApiDatacentersLoadbalancersBalancednicsGetRequest) (BalancedNics, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue BalancedNics + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LoadBalancerApiService.DatacentersLoadbalancersBalancednicsGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/loadbalancers/{loadbalancerId}/balancednics" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"loadbalancerId"+"}", _neturl.PathEscape(parameterToString(r.loadbalancerId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersLoadbalancersBalancednicsGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersLoadbalancersBalancednicsPostRequest struct { + ctx _context.Context + ApiService *LoadBalancerApiService + datacenterId string + loadbalancerId string + nic *Nic + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersLoadbalancersBalancednicsPostRequest) Nic(nic Nic) ApiDatacentersLoadbalancersBalancednicsPostRequest { + r.nic = &nic + return r +} +func (r ApiDatacentersLoadbalancersBalancednicsPostRequest) Pretty(pretty bool) ApiDatacentersLoadbalancersBalancednicsPostRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersLoadbalancersBalancednicsPostRequest) Depth(depth int32) ApiDatacentersLoadbalancersBalancednicsPostRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersLoadbalancersBalancednicsPostRequest) XContractNumber(xContractNumber int32) ApiDatacentersLoadbalancersBalancednicsPostRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersLoadbalancersBalancednicsPostRequest) Execute() (Nic, *APIResponse, error) { + return r.ApiService.DatacentersLoadbalancersBalancednicsPostExecute(r) +} + +/* + * DatacentersLoadbalancersBalancednicsPost Attach a nic to Load Balancer + * This will attach a pre-existing nic to a Load Balancer. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @param loadbalancerId The unique ID of the Load Balancer + * @return ApiDatacentersLoadbalancersBalancednicsPostRequest + */ +func (a *LoadBalancerApiService) DatacentersLoadbalancersBalancednicsPost(ctx _context.Context, datacenterId string, loadbalancerId string) ApiDatacentersLoadbalancersBalancednicsPostRequest { + return ApiDatacentersLoadbalancersBalancednicsPostRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + loadbalancerId: loadbalancerId, + } +} + +/* + * Execute executes the request + * @return Nic + */ +func (a *LoadBalancerApiService) DatacentersLoadbalancersBalancednicsPostExecute(r ApiDatacentersLoadbalancersBalancednicsPostRequest) (Nic, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Nic + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LoadBalancerApiService.DatacentersLoadbalancersBalancednicsPost") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/loadbalancers/{loadbalancerId}/balancednics" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"loadbalancerId"+"}", _neturl.PathEscape(parameterToString(r.loadbalancerId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.nic == nil { + return localVarReturnValue, nil, reportError("nic is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.nic + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersLoadbalancersBalancednicsPost", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersLoadbalancersDeleteRequest struct { + ctx _context.Context + ApiService *LoadBalancerApiService + datacenterId string + loadbalancerId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersLoadbalancersDeleteRequest) Pretty(pretty bool) ApiDatacentersLoadbalancersDeleteRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersLoadbalancersDeleteRequest) Depth(depth int32) ApiDatacentersLoadbalancersDeleteRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersLoadbalancersDeleteRequest) XContractNumber(xContractNumber int32) ApiDatacentersLoadbalancersDeleteRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersLoadbalancersDeleteRequest) Execute() (map[string]interface{}, *APIResponse, error) { + return r.ApiService.DatacentersLoadbalancersDeleteExecute(r) +} + +/* + * DatacentersLoadbalancersDelete Delete a Loadbalancer. + * Removes the specific Loadbalancer + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @param loadbalancerId The unique ID of the Load Balancer + * @return ApiDatacentersLoadbalancersDeleteRequest + */ +func (a *LoadBalancerApiService) DatacentersLoadbalancersDelete(ctx _context.Context, datacenterId string, loadbalancerId string) ApiDatacentersLoadbalancersDeleteRequest { + return ApiDatacentersLoadbalancersDeleteRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + loadbalancerId: loadbalancerId, + } +} + +/* + * Execute executes the request + * @return map[string]interface{} + */ +func (a *LoadBalancerApiService) DatacentersLoadbalancersDeleteExecute(r ApiDatacentersLoadbalancersDeleteRequest) (map[string]interface{}, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LoadBalancerApiService.DatacentersLoadbalancersDelete") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/loadbalancers/{loadbalancerId}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"loadbalancerId"+"}", _neturl.PathEscape(parameterToString(r.loadbalancerId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersLoadbalancersDelete", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersLoadbalancersFindByIdRequest struct { + ctx _context.Context + ApiService *LoadBalancerApiService + datacenterId string + loadbalancerId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersLoadbalancersFindByIdRequest) Pretty(pretty bool) ApiDatacentersLoadbalancersFindByIdRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersLoadbalancersFindByIdRequest) Depth(depth int32) ApiDatacentersLoadbalancersFindByIdRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersLoadbalancersFindByIdRequest) XContractNumber(xContractNumber int32) ApiDatacentersLoadbalancersFindByIdRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersLoadbalancersFindByIdRequest) Execute() (Loadbalancer, *APIResponse, error) { + return r.ApiService.DatacentersLoadbalancersFindByIdExecute(r) +} + +/* + * DatacentersLoadbalancersFindById Retrieve a loadbalancer + * Retrieves the attributes of a given Loadbalancer + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @param loadbalancerId The unique ID of the Load Balancer + * @return ApiDatacentersLoadbalancersFindByIdRequest + */ +func (a *LoadBalancerApiService) DatacentersLoadbalancersFindById(ctx _context.Context, datacenterId string, loadbalancerId string) ApiDatacentersLoadbalancersFindByIdRequest { + return ApiDatacentersLoadbalancersFindByIdRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + loadbalancerId: loadbalancerId, + } +} + +/* + * Execute executes the request + * @return Loadbalancer + */ +func (a *LoadBalancerApiService) DatacentersLoadbalancersFindByIdExecute(r ApiDatacentersLoadbalancersFindByIdRequest) (Loadbalancer, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Loadbalancer + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LoadBalancerApiService.DatacentersLoadbalancersFindById") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/loadbalancers/{loadbalancerId}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"loadbalancerId"+"}", _neturl.PathEscape(parameterToString(r.loadbalancerId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersLoadbalancersFindById", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersLoadbalancersGetRequest struct { + ctx _context.Context + ApiService *LoadBalancerApiService + datacenterId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersLoadbalancersGetRequest) Pretty(pretty bool) ApiDatacentersLoadbalancersGetRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersLoadbalancersGetRequest) Depth(depth int32) ApiDatacentersLoadbalancersGetRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersLoadbalancersGetRequest) XContractNumber(xContractNumber int32) ApiDatacentersLoadbalancersGetRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersLoadbalancersGetRequest) Execute() (Loadbalancers, *APIResponse, error) { + return r.ApiService.DatacentersLoadbalancersGetExecute(r) +} + +/* + * DatacentersLoadbalancersGet List Load Balancers + * Retrieve a list of Load Balancers within the datacenter + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @return ApiDatacentersLoadbalancersGetRequest + */ +func (a *LoadBalancerApiService) DatacentersLoadbalancersGet(ctx _context.Context, datacenterId string) ApiDatacentersLoadbalancersGetRequest { + return ApiDatacentersLoadbalancersGetRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + } +} + +/* + * Execute executes the request + * @return Loadbalancers + */ +func (a *LoadBalancerApiService) DatacentersLoadbalancersGetExecute(r ApiDatacentersLoadbalancersGetRequest) (Loadbalancers, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Loadbalancers + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LoadBalancerApiService.DatacentersLoadbalancersGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/loadbalancers" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersLoadbalancersGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersLoadbalancersPatchRequest struct { + ctx _context.Context + ApiService *LoadBalancerApiService + datacenterId string + loadbalancerId string + loadbalancer *LoadbalancerProperties + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersLoadbalancersPatchRequest) Loadbalancer(loadbalancer LoadbalancerProperties) ApiDatacentersLoadbalancersPatchRequest { + r.loadbalancer = &loadbalancer + return r +} +func (r ApiDatacentersLoadbalancersPatchRequest) Pretty(pretty bool) ApiDatacentersLoadbalancersPatchRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersLoadbalancersPatchRequest) Depth(depth int32) ApiDatacentersLoadbalancersPatchRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersLoadbalancersPatchRequest) XContractNumber(xContractNumber int32) ApiDatacentersLoadbalancersPatchRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersLoadbalancersPatchRequest) Execute() (Loadbalancer, *APIResponse, error) { + return r.ApiService.DatacentersLoadbalancersPatchExecute(r) +} + +/* + * DatacentersLoadbalancersPatch Partially modify a Loadbalancer + * You can use update attributes of a resource + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @param loadbalancerId The unique ID of the Load Balancer + * @return ApiDatacentersLoadbalancersPatchRequest + */ +func (a *LoadBalancerApiService) DatacentersLoadbalancersPatch(ctx _context.Context, datacenterId string, loadbalancerId string) ApiDatacentersLoadbalancersPatchRequest { + return ApiDatacentersLoadbalancersPatchRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + loadbalancerId: loadbalancerId, + } +} + +/* + * Execute executes the request + * @return Loadbalancer + */ +func (a *LoadBalancerApiService) DatacentersLoadbalancersPatchExecute(r ApiDatacentersLoadbalancersPatchRequest) (Loadbalancer, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Loadbalancer + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LoadBalancerApiService.DatacentersLoadbalancersPatch") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/loadbalancers/{loadbalancerId}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"loadbalancerId"+"}", _neturl.PathEscape(parameterToString(r.loadbalancerId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.loadbalancer == nil { + return localVarReturnValue, nil, reportError("loadbalancer is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.loadbalancer + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersLoadbalancersPatch", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersLoadbalancersPostRequest struct { + ctx _context.Context + ApiService *LoadBalancerApiService + datacenterId string + loadbalancer *Loadbalancer + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersLoadbalancersPostRequest) Loadbalancer(loadbalancer Loadbalancer) ApiDatacentersLoadbalancersPostRequest { + r.loadbalancer = &loadbalancer + return r +} +func (r ApiDatacentersLoadbalancersPostRequest) Pretty(pretty bool) ApiDatacentersLoadbalancersPostRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersLoadbalancersPostRequest) Depth(depth int32) ApiDatacentersLoadbalancersPostRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersLoadbalancersPostRequest) XContractNumber(xContractNumber int32) ApiDatacentersLoadbalancersPostRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersLoadbalancersPostRequest) Execute() (Loadbalancer, *APIResponse, error) { + return r.ApiService.DatacentersLoadbalancersPostExecute(r) +} + +/* + * DatacentersLoadbalancersPost Create a Load Balancer + * Creates a Loadbalancer within the datacenter + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @return ApiDatacentersLoadbalancersPostRequest + */ +func (a *LoadBalancerApiService) DatacentersLoadbalancersPost(ctx _context.Context, datacenterId string) ApiDatacentersLoadbalancersPostRequest { + return ApiDatacentersLoadbalancersPostRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + } +} + +/* + * Execute executes the request + * @return Loadbalancer + */ +func (a *LoadBalancerApiService) DatacentersLoadbalancersPostExecute(r ApiDatacentersLoadbalancersPostRequest) (Loadbalancer, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Loadbalancer + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LoadBalancerApiService.DatacentersLoadbalancersPost") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/loadbalancers" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.loadbalancer == nil { + return localVarReturnValue, nil, reportError("loadbalancer is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.loadbalancer + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersLoadbalancersPost", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersLoadbalancersPutRequest struct { + ctx _context.Context + ApiService *LoadBalancerApiService + datacenterId string + loadbalancerId string + loadbalancer *Loadbalancer + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersLoadbalancersPutRequest) Loadbalancer(loadbalancer Loadbalancer) ApiDatacentersLoadbalancersPutRequest { + r.loadbalancer = &loadbalancer + return r +} +func (r ApiDatacentersLoadbalancersPutRequest) Pretty(pretty bool) ApiDatacentersLoadbalancersPutRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersLoadbalancersPutRequest) Depth(depth int32) ApiDatacentersLoadbalancersPutRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersLoadbalancersPutRequest) XContractNumber(xContractNumber int32) ApiDatacentersLoadbalancersPutRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersLoadbalancersPutRequest) Execute() (Loadbalancer, *APIResponse, error) { + return r.ApiService.DatacentersLoadbalancersPutExecute(r) +} + +/* + * DatacentersLoadbalancersPut Modify a Load Balancer + * You can use update attributes of a resource + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @param loadbalancerId The unique ID of the Load Balancer + * @return ApiDatacentersLoadbalancersPutRequest + */ +func (a *LoadBalancerApiService) DatacentersLoadbalancersPut(ctx _context.Context, datacenterId string, loadbalancerId string) ApiDatacentersLoadbalancersPutRequest { + return ApiDatacentersLoadbalancersPutRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + loadbalancerId: loadbalancerId, + } +} + +/* + * Execute executes the request + * @return Loadbalancer + */ +func (a *LoadBalancerApiService) DatacentersLoadbalancersPutExecute(r ApiDatacentersLoadbalancersPutRequest) (Loadbalancer, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Loadbalancer + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LoadBalancerApiService.DatacentersLoadbalancersPut") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/loadbalancers/{loadbalancerId}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"loadbalancerId"+"}", _neturl.PathEscape(parameterToString(r.loadbalancerId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.loadbalancer == nil { + return localVarReturnValue, nil, reportError("loadbalancer is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.loadbalancer + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersLoadbalancersPut", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_location.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_location.go new file mode 100644 index 0000000000..138ac64c4a --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_location.go @@ -0,0 +1,504 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" +) + +// Linger please +var ( + _ _context.Context +) + +// LocationApiService LocationApi service +type LocationApiService service + +type ApiLocationsFindByRegionRequest struct { + ctx _context.Context + ApiService *LocationApiService + regionId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiLocationsFindByRegionRequest) Pretty(pretty bool) ApiLocationsFindByRegionRequest { + r.pretty = &pretty + return r +} +func (r ApiLocationsFindByRegionRequest) Depth(depth int32) ApiLocationsFindByRegionRequest { + r.depth = &depth + return r +} +func (r ApiLocationsFindByRegionRequest) XContractNumber(xContractNumber int32) ApiLocationsFindByRegionRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiLocationsFindByRegionRequest) Execute() (Locations, *APIResponse, error) { + return r.ApiService.LocationsFindByRegionExecute(r) +} + +/* + * LocationsFindByRegion List Locations within a region + * Retrieve a list of Locations within a world's region + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param regionId + * @return ApiLocationsFindByRegionRequest + */ +func (a *LocationApiService) LocationsFindByRegion(ctx _context.Context, regionId string) ApiLocationsFindByRegionRequest { + return ApiLocationsFindByRegionRequest{ + ApiService: a, + ctx: ctx, + regionId: regionId, + } +} + +/* + * Execute executes the request + * @return Locations + */ +func (a *LocationApiService) LocationsFindByRegionExecute(r ApiLocationsFindByRegionRequest) (Locations, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Locations + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LocationApiService.LocationsFindByRegion") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/locations/{regionId}" + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", _neturl.PathEscape(parameterToString(r.regionId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "LocationsFindByRegion", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiLocationsFindByRegionAndIdRequest struct { + ctx _context.Context + ApiService *LocationApiService + regionId string + locationId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiLocationsFindByRegionAndIdRequest) Pretty(pretty bool) ApiLocationsFindByRegionAndIdRequest { + r.pretty = &pretty + return r +} +func (r ApiLocationsFindByRegionAndIdRequest) Depth(depth int32) ApiLocationsFindByRegionAndIdRequest { + r.depth = &depth + return r +} +func (r ApiLocationsFindByRegionAndIdRequest) XContractNumber(xContractNumber int32) ApiLocationsFindByRegionAndIdRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiLocationsFindByRegionAndIdRequest) Execute() (Location, *APIResponse, error) { + return r.ApiService.LocationsFindByRegionAndIdExecute(r) +} + +/* + * LocationsFindByRegionAndId Retrieve a Location + * Retrieves the attributes of a given location + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param regionId + * @param locationId + * @return ApiLocationsFindByRegionAndIdRequest + */ +func (a *LocationApiService) LocationsFindByRegionAndId(ctx _context.Context, regionId string, locationId string) ApiLocationsFindByRegionAndIdRequest { + return ApiLocationsFindByRegionAndIdRequest{ + ApiService: a, + ctx: ctx, + regionId: regionId, + locationId: locationId, + } +} + +/* + * Execute executes the request + * @return Location + */ +func (a *LocationApiService) LocationsFindByRegionAndIdExecute(r ApiLocationsFindByRegionAndIdRequest) (Location, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Location + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LocationApiService.LocationsFindByRegionAndId") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/locations/{regionId}/{locationId}" + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", _neturl.PathEscape(parameterToString(r.regionId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"locationId"+"}", _neturl.PathEscape(parameterToString(r.locationId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "LocationsFindByRegionAndId", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiLocationsGetRequest struct { + ctx _context.Context + ApiService *LocationApiService + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiLocationsGetRequest) Pretty(pretty bool) ApiLocationsGetRequest { + r.pretty = &pretty + return r +} +func (r ApiLocationsGetRequest) Depth(depth int32) ApiLocationsGetRequest { + r.depth = &depth + return r +} +func (r ApiLocationsGetRequest) XContractNumber(xContractNumber int32) ApiLocationsGetRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiLocationsGetRequest) Execute() (Locations, *APIResponse, error) { + return r.ApiService.LocationsGetExecute(r) +} + +/* + * LocationsGet List Locations + * Retrieve a list of Locations. This list represents where you can provision your virtual data centers + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiLocationsGetRequest + */ +func (a *LocationApiService) LocationsGet(ctx _context.Context) ApiLocationsGetRequest { + return ApiLocationsGetRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + * @return Locations + */ +func (a *LocationApiService) LocationsGetExecute(r ApiLocationsGetRequest) (Locations, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Locations + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LocationApiService.LocationsGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/locations" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "LocationsGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_nic.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_nic.go new file mode 100644 index 0000000000..b82c51cada --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_nic.go @@ -0,0 +1,2099 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" +) + +// Linger please +var ( + _ _context.Context +) + +// NicApiService NicApi service +type NicApiService service + +type ApiDatacentersServersNicsDeleteRequest struct { + ctx _context.Context + ApiService *NicApiService + datacenterId string + serverId string + nicId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersServersNicsDeleteRequest) Pretty(pretty bool) ApiDatacentersServersNicsDeleteRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersServersNicsDeleteRequest) Depth(depth int32) ApiDatacentersServersNicsDeleteRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersServersNicsDeleteRequest) XContractNumber(xContractNumber int32) ApiDatacentersServersNicsDeleteRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersServersNicsDeleteRequest) Execute() (map[string]interface{}, *APIResponse, error) { + return r.ApiService.DatacentersServersNicsDeleteExecute(r) +} + +/* + * DatacentersServersNicsDelete Delete a Nic + * Deletes the specified NIC. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @param serverId The unique ID of the Server + * @param nicId The unique ID of the NIC + * @return ApiDatacentersServersNicsDeleteRequest + */ +func (a *NicApiService) DatacentersServersNicsDelete(ctx _context.Context, datacenterId string, serverId string, nicId string) ApiDatacentersServersNicsDeleteRequest { + return ApiDatacentersServersNicsDeleteRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + serverId: serverId, + nicId: nicId, + } +} + +/* + * Execute executes the request + * @return map[string]interface{} + */ +func (a *NicApiService) DatacentersServersNicsDeleteExecute(r ApiDatacentersServersNicsDeleteRequest) (map[string]interface{}, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NicApiService.DatacentersServersNicsDelete") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterToString(r.nicId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersServersNicsDelete", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersServersNicsFindByIdRequest struct { + ctx _context.Context + ApiService *NicApiService + datacenterId string + serverId string + nicId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersServersNicsFindByIdRequest) Pretty(pretty bool) ApiDatacentersServersNicsFindByIdRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersServersNicsFindByIdRequest) Depth(depth int32) ApiDatacentersServersNicsFindByIdRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersServersNicsFindByIdRequest) XContractNumber(xContractNumber int32) ApiDatacentersServersNicsFindByIdRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersServersNicsFindByIdRequest) Execute() (Nic, *APIResponse, error) { + return r.ApiService.DatacentersServersNicsFindByIdExecute(r) +} + +/* + * DatacentersServersNicsFindById Retrieve a Nic + * Retrieves the attributes of a given NIC + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @param serverId The unique ID of the Server + * @param nicId The unique ID of the NIC + * @return ApiDatacentersServersNicsFindByIdRequest + */ +func (a *NicApiService) DatacentersServersNicsFindById(ctx _context.Context, datacenterId string, serverId string, nicId string) ApiDatacentersServersNicsFindByIdRequest { + return ApiDatacentersServersNicsFindByIdRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + serverId: serverId, + nicId: nicId, + } +} + +/* + * Execute executes the request + * @return Nic + */ +func (a *NicApiService) DatacentersServersNicsFindByIdExecute(r ApiDatacentersServersNicsFindByIdRequest) (Nic, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Nic + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NicApiService.DatacentersServersNicsFindById") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterToString(r.nicId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersServersNicsFindById", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersServersNicsFirewallrulesDeleteRequest struct { + ctx _context.Context + ApiService *NicApiService + datacenterId string + serverId string + nicId string + firewallruleId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersServersNicsFirewallrulesDeleteRequest) Pretty(pretty bool) ApiDatacentersServersNicsFirewallrulesDeleteRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersServersNicsFirewallrulesDeleteRequest) Depth(depth int32) ApiDatacentersServersNicsFirewallrulesDeleteRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersServersNicsFirewallrulesDeleteRequest) XContractNumber(xContractNumber int32) ApiDatacentersServersNicsFirewallrulesDeleteRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersServersNicsFirewallrulesDeleteRequest) Execute() (map[string]interface{}, *APIResponse, error) { + return r.ApiService.DatacentersServersNicsFirewallrulesDeleteExecute(r) +} + +/* + * DatacentersServersNicsFirewallrulesDelete Delete a Firewall Rule + * Removes the specific Firewall Rule + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @param serverId The unique ID of the Server + * @param nicId The unique ID of the NIC + * @param firewallruleId The unique ID of the Firewall Rule + * @return ApiDatacentersServersNicsFirewallrulesDeleteRequest + */ +func (a *NicApiService) DatacentersServersNicsFirewallrulesDelete(ctx _context.Context, datacenterId string, serverId string, nicId string, firewallruleId string) ApiDatacentersServersNicsFirewallrulesDeleteRequest { + return ApiDatacentersServersNicsFirewallrulesDeleteRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + serverId: serverId, + nicId: nicId, + firewallruleId: firewallruleId, + } +} + +/* + * Execute executes the request + * @return map[string]interface{} + */ +func (a *NicApiService) DatacentersServersNicsFirewallrulesDeleteExecute(r ApiDatacentersServersNicsFirewallrulesDeleteRequest) (map[string]interface{}, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NicApiService.DatacentersServersNicsFirewallrulesDelete") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}/firewallrules/{firewallruleId}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterToString(r.nicId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"firewallruleId"+"}", _neturl.PathEscape(parameterToString(r.firewallruleId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersServersNicsFirewallrulesDelete", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersServersNicsFirewallrulesFindByIdRequest struct { + ctx _context.Context + ApiService *NicApiService + datacenterId string + serverId string + nicId string + firewallruleId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersServersNicsFirewallrulesFindByIdRequest) Pretty(pretty bool) ApiDatacentersServersNicsFirewallrulesFindByIdRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersServersNicsFirewallrulesFindByIdRequest) Depth(depth int32) ApiDatacentersServersNicsFirewallrulesFindByIdRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersServersNicsFirewallrulesFindByIdRequest) XContractNumber(xContractNumber int32) ApiDatacentersServersNicsFirewallrulesFindByIdRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersServersNicsFirewallrulesFindByIdRequest) Execute() (FirewallRule, *APIResponse, error) { + return r.ApiService.DatacentersServersNicsFirewallrulesFindByIdExecute(r) +} + +/* + * DatacentersServersNicsFirewallrulesFindById Retrieve a Firewall Rule + * Retrieves the attributes of a given Firewall Rule. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @param serverId The unique ID of the Server + * @param nicId The unique ID of the NIC + * @param firewallruleId The unique ID of the Firewall Rule + * @return ApiDatacentersServersNicsFirewallrulesFindByIdRequest + */ +func (a *NicApiService) DatacentersServersNicsFirewallrulesFindById(ctx _context.Context, datacenterId string, serverId string, nicId string, firewallruleId string) ApiDatacentersServersNicsFirewallrulesFindByIdRequest { + return ApiDatacentersServersNicsFirewallrulesFindByIdRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + serverId: serverId, + nicId: nicId, + firewallruleId: firewallruleId, + } +} + +/* + * Execute executes the request + * @return FirewallRule + */ +func (a *NicApiService) DatacentersServersNicsFirewallrulesFindByIdExecute(r ApiDatacentersServersNicsFirewallrulesFindByIdRequest) (FirewallRule, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue FirewallRule + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NicApiService.DatacentersServersNicsFirewallrulesFindById") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}/firewallrules/{firewallruleId}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterToString(r.nicId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"firewallruleId"+"}", _neturl.PathEscape(parameterToString(r.firewallruleId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersServersNicsFirewallrulesFindById", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersServersNicsFirewallrulesGetRequest struct { + ctx _context.Context + ApiService *NicApiService + datacenterId string + serverId string + nicId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersServersNicsFirewallrulesGetRequest) Pretty(pretty bool) ApiDatacentersServersNicsFirewallrulesGetRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersServersNicsFirewallrulesGetRequest) Depth(depth int32) ApiDatacentersServersNicsFirewallrulesGetRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersServersNicsFirewallrulesGetRequest) XContractNumber(xContractNumber int32) ApiDatacentersServersNicsFirewallrulesGetRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersServersNicsFirewallrulesGetRequest) Execute() (FirewallRules, *APIResponse, error) { + return r.ApiService.DatacentersServersNicsFirewallrulesGetExecute(r) +} + +/* + * DatacentersServersNicsFirewallrulesGet List Firewall Rules + * Retrieves a list of firewall rules associated with a particular NIC + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @param serverId The unique ID of the Server + * @param nicId The unique ID of the NIC + * @return ApiDatacentersServersNicsFirewallrulesGetRequest + */ +func (a *NicApiService) DatacentersServersNicsFirewallrulesGet(ctx _context.Context, datacenterId string, serverId string, nicId string) ApiDatacentersServersNicsFirewallrulesGetRequest { + return ApiDatacentersServersNicsFirewallrulesGetRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + serverId: serverId, + nicId: nicId, + } +} + +/* + * Execute executes the request + * @return FirewallRules + */ +func (a *NicApiService) DatacentersServersNicsFirewallrulesGetExecute(r ApiDatacentersServersNicsFirewallrulesGetRequest) (FirewallRules, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue FirewallRules + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NicApiService.DatacentersServersNicsFirewallrulesGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}/firewallrules" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterToString(r.nicId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersServersNicsFirewallrulesGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersServersNicsFirewallrulesPatchRequest struct { + ctx _context.Context + ApiService *NicApiService + datacenterId string + serverId string + nicId string + firewallruleId string + firewallrule *FirewallruleProperties + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersServersNicsFirewallrulesPatchRequest) Firewallrule(firewallrule FirewallruleProperties) ApiDatacentersServersNicsFirewallrulesPatchRequest { + r.firewallrule = &firewallrule + return r +} +func (r ApiDatacentersServersNicsFirewallrulesPatchRequest) Pretty(pretty bool) ApiDatacentersServersNicsFirewallrulesPatchRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersServersNicsFirewallrulesPatchRequest) Depth(depth int32) ApiDatacentersServersNicsFirewallrulesPatchRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersServersNicsFirewallrulesPatchRequest) XContractNumber(xContractNumber int32) ApiDatacentersServersNicsFirewallrulesPatchRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersServersNicsFirewallrulesPatchRequest) Execute() (FirewallRule, *APIResponse, error) { + return r.ApiService.DatacentersServersNicsFirewallrulesPatchExecute(r) +} + +/* + * DatacentersServersNicsFirewallrulesPatch Partially modify a Firewall Rule + * You can use update attributes of a resource + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @param serverId The unique ID of the Server + * @param nicId The unique ID of the NIC + * @param firewallruleId The unique ID of the Firewall Rule + * @return ApiDatacentersServersNicsFirewallrulesPatchRequest + */ +func (a *NicApiService) DatacentersServersNicsFirewallrulesPatch(ctx _context.Context, datacenterId string, serverId string, nicId string, firewallruleId string) ApiDatacentersServersNicsFirewallrulesPatchRequest { + return ApiDatacentersServersNicsFirewallrulesPatchRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + serverId: serverId, + nicId: nicId, + firewallruleId: firewallruleId, + } +} + +/* + * Execute executes the request + * @return FirewallRule + */ +func (a *NicApiService) DatacentersServersNicsFirewallrulesPatchExecute(r ApiDatacentersServersNicsFirewallrulesPatchRequest) (FirewallRule, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue FirewallRule + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NicApiService.DatacentersServersNicsFirewallrulesPatch") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}/firewallrules/{firewallruleId}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterToString(r.nicId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"firewallruleId"+"}", _neturl.PathEscape(parameterToString(r.firewallruleId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.firewallrule == nil { + return localVarReturnValue, nil, reportError("firewallrule is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.firewallrule + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersServersNicsFirewallrulesPatch", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersServersNicsFirewallrulesPostRequest struct { + ctx _context.Context + ApiService *NicApiService + datacenterId string + serverId string + nicId string + firewallrule *FirewallRule + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersServersNicsFirewallrulesPostRequest) Firewallrule(firewallrule FirewallRule) ApiDatacentersServersNicsFirewallrulesPostRequest { + r.firewallrule = &firewallrule + return r +} +func (r ApiDatacentersServersNicsFirewallrulesPostRequest) Pretty(pretty bool) ApiDatacentersServersNicsFirewallrulesPostRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersServersNicsFirewallrulesPostRequest) Depth(depth int32) ApiDatacentersServersNicsFirewallrulesPostRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersServersNicsFirewallrulesPostRequest) XContractNumber(xContractNumber int32) ApiDatacentersServersNicsFirewallrulesPostRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersServersNicsFirewallrulesPostRequest) Execute() (FirewallRule, *APIResponse, error) { + return r.ApiService.DatacentersServersNicsFirewallrulesPostExecute(r) +} + +/* + * DatacentersServersNicsFirewallrulesPost Create a Firewall Rule + * This will add a Firewall Rule to the NIC + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @param serverId The unique ID of the server + * @param nicId The unique ID of the NIC + * @return ApiDatacentersServersNicsFirewallrulesPostRequest + */ +func (a *NicApiService) DatacentersServersNicsFirewallrulesPost(ctx _context.Context, datacenterId string, serverId string, nicId string) ApiDatacentersServersNicsFirewallrulesPostRequest { + return ApiDatacentersServersNicsFirewallrulesPostRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + serverId: serverId, + nicId: nicId, + } +} + +/* + * Execute executes the request + * @return FirewallRule + */ +func (a *NicApiService) DatacentersServersNicsFirewallrulesPostExecute(r ApiDatacentersServersNicsFirewallrulesPostRequest) (FirewallRule, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue FirewallRule + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NicApiService.DatacentersServersNicsFirewallrulesPost") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}/firewallrules" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterToString(r.nicId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.firewallrule == nil { + return localVarReturnValue, nil, reportError("firewallrule is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.firewallrule + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersServersNicsFirewallrulesPost", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersServersNicsFirewallrulesPutRequest struct { + ctx _context.Context + ApiService *NicApiService + datacenterId string + serverId string + nicId string + firewallruleId string + firewallrule *FirewallRule + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersServersNicsFirewallrulesPutRequest) Firewallrule(firewallrule FirewallRule) ApiDatacentersServersNicsFirewallrulesPutRequest { + r.firewallrule = &firewallrule + return r +} +func (r ApiDatacentersServersNicsFirewallrulesPutRequest) Pretty(pretty bool) ApiDatacentersServersNicsFirewallrulesPutRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersServersNicsFirewallrulesPutRequest) Depth(depth int32) ApiDatacentersServersNicsFirewallrulesPutRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersServersNicsFirewallrulesPutRequest) XContractNumber(xContractNumber int32) ApiDatacentersServersNicsFirewallrulesPutRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersServersNicsFirewallrulesPutRequest) Execute() (FirewallRule, *APIResponse, error) { + return r.ApiService.DatacentersServersNicsFirewallrulesPutExecute(r) +} + +/* + * DatacentersServersNicsFirewallrulesPut Modify a Firewall Rule + * You can use update attributes of a resource + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @param serverId The unique ID of the Server + * @param nicId The unique ID of the NIC + * @param firewallruleId The unique ID of the Firewall Rule + * @return ApiDatacentersServersNicsFirewallrulesPutRequest + */ +func (a *NicApiService) DatacentersServersNicsFirewallrulesPut(ctx _context.Context, datacenterId string, serverId string, nicId string, firewallruleId string) ApiDatacentersServersNicsFirewallrulesPutRequest { + return ApiDatacentersServersNicsFirewallrulesPutRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + serverId: serverId, + nicId: nicId, + firewallruleId: firewallruleId, + } +} + +/* + * Execute executes the request + * @return FirewallRule + */ +func (a *NicApiService) DatacentersServersNicsFirewallrulesPutExecute(r ApiDatacentersServersNicsFirewallrulesPutRequest) (FirewallRule, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue FirewallRule + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NicApiService.DatacentersServersNicsFirewallrulesPut") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}/firewallrules/{firewallruleId}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterToString(r.nicId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"firewallruleId"+"}", _neturl.PathEscape(parameterToString(r.firewallruleId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.firewallrule == nil { + return localVarReturnValue, nil, reportError("firewallrule is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.firewallrule + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersServersNicsFirewallrulesPut", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersServersNicsGetRequest struct { + ctx _context.Context + ApiService *NicApiService + datacenterId string + serverId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersServersNicsGetRequest) Pretty(pretty bool) ApiDatacentersServersNicsGetRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersServersNicsGetRequest) Depth(depth int32) ApiDatacentersServersNicsGetRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersServersNicsGetRequest) XContractNumber(xContractNumber int32) ApiDatacentersServersNicsGetRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersServersNicsGetRequest) Execute() (Nics, *APIResponse, error) { + return r.ApiService.DatacentersServersNicsGetExecute(r) +} + +/* + * DatacentersServersNicsGet List Nics + * Retrieves a list of NICs. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @param serverId The unique ID of the Server + * @return ApiDatacentersServersNicsGetRequest + */ +func (a *NicApiService) DatacentersServersNicsGet(ctx _context.Context, datacenterId string, serverId string) ApiDatacentersServersNicsGetRequest { + return ApiDatacentersServersNicsGetRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + serverId: serverId, + } +} + +/* + * Execute executes the request + * @return Nics + */ +func (a *NicApiService) DatacentersServersNicsGetExecute(r ApiDatacentersServersNicsGetRequest) (Nics, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Nics + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NicApiService.DatacentersServersNicsGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/nics" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersServersNicsGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersServersNicsPatchRequest struct { + ctx _context.Context + ApiService *NicApiService + datacenterId string + serverId string + nicId string + nic *NicProperties + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersServersNicsPatchRequest) Nic(nic NicProperties) ApiDatacentersServersNicsPatchRequest { + r.nic = &nic + return r +} +func (r ApiDatacentersServersNicsPatchRequest) Pretty(pretty bool) ApiDatacentersServersNicsPatchRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersServersNicsPatchRequest) Depth(depth int32) ApiDatacentersServersNicsPatchRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersServersNicsPatchRequest) XContractNumber(xContractNumber int32) ApiDatacentersServersNicsPatchRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersServersNicsPatchRequest) Execute() (Nic, *APIResponse, error) { + return r.ApiService.DatacentersServersNicsPatchExecute(r) +} + +/* + * DatacentersServersNicsPatch Partially modify a Nic + * You can use update attributes of a Nic + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @param serverId The unique ID of the Server + * @param nicId The unique ID of the NIC + * @return ApiDatacentersServersNicsPatchRequest + */ +func (a *NicApiService) DatacentersServersNicsPatch(ctx _context.Context, datacenterId string, serverId string, nicId string) ApiDatacentersServersNicsPatchRequest { + return ApiDatacentersServersNicsPatchRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + serverId: serverId, + nicId: nicId, + } +} + +/* + * Execute executes the request + * @return Nic + */ +func (a *NicApiService) DatacentersServersNicsPatchExecute(r ApiDatacentersServersNicsPatchRequest) (Nic, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Nic + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NicApiService.DatacentersServersNicsPatch") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterToString(r.nicId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.nic == nil { + return localVarReturnValue, nil, reportError("nic is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.nic + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersServersNicsPatch", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersServersNicsPostRequest struct { + ctx _context.Context + ApiService *NicApiService + datacenterId string + serverId string + nic *Nic + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersServersNicsPostRequest) Nic(nic Nic) ApiDatacentersServersNicsPostRequest { + r.nic = &nic + return r +} +func (r ApiDatacentersServersNicsPostRequest) Pretty(pretty bool) ApiDatacentersServersNicsPostRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersServersNicsPostRequest) Depth(depth int32) ApiDatacentersServersNicsPostRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersServersNicsPostRequest) XContractNumber(xContractNumber int32) ApiDatacentersServersNicsPostRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersServersNicsPostRequest) Execute() (Nic, *APIResponse, error) { + return r.ApiService.DatacentersServersNicsPostExecute(r) +} + +/* + * DatacentersServersNicsPost Create a Nic + * Adds a NIC to the target server. Combine count of Nics and volumes attached to the server should not exceed size 24. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @param serverId The unique ID of the Server + * @return ApiDatacentersServersNicsPostRequest + */ +func (a *NicApiService) DatacentersServersNicsPost(ctx _context.Context, datacenterId string, serverId string) ApiDatacentersServersNicsPostRequest { + return ApiDatacentersServersNicsPostRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + serverId: serverId, + } +} + +/* + * Execute executes the request + * @return Nic + */ +func (a *NicApiService) DatacentersServersNicsPostExecute(r ApiDatacentersServersNicsPostRequest) (Nic, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Nic + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NicApiService.DatacentersServersNicsPost") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/nics" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.nic == nil { + return localVarReturnValue, nil, reportError("nic is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.nic + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersServersNicsPost", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersServersNicsPutRequest struct { + ctx _context.Context + ApiService *NicApiService + datacenterId string + serverId string + nicId string + nic *Nic + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersServersNicsPutRequest) Nic(nic Nic) ApiDatacentersServersNicsPutRequest { + r.nic = &nic + return r +} +func (r ApiDatacentersServersNicsPutRequest) Pretty(pretty bool) ApiDatacentersServersNicsPutRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersServersNicsPutRequest) Depth(depth int32) ApiDatacentersServersNicsPutRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersServersNicsPutRequest) XContractNumber(xContractNumber int32) ApiDatacentersServersNicsPutRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersServersNicsPutRequest) Execute() (Nic, *APIResponse, error) { + return r.ApiService.DatacentersServersNicsPutExecute(r) +} + +/* + * DatacentersServersNicsPut Modify a Nic + * You can use update attributes of a Nic + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @param serverId The unique ID of the Server + * @param nicId The unique ID of the NIC + * @return ApiDatacentersServersNicsPutRequest + */ +func (a *NicApiService) DatacentersServersNicsPut(ctx _context.Context, datacenterId string, serverId string, nicId string) ApiDatacentersServersNicsPutRequest { + return ApiDatacentersServersNicsPutRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + serverId: serverId, + nicId: nicId, + } +} + +/* + * Execute executes the request + * @return Nic + */ +func (a *NicApiService) DatacentersServersNicsPutExecute(r ApiDatacentersServersNicsPutRequest) (Nic, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Nic + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NicApiService.DatacentersServersNicsPut") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterToString(r.nicId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.nic == nil { + return localVarReturnValue, nil, reportError("nic is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.nic + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersServersNicsPut", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_private_cross_connect.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_private_cross_connect.go new file mode 100644 index 0000000000..bb74acd115 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_private_cross_connect.go @@ -0,0 +1,834 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" +) + +// Linger please +var ( + _ _context.Context +) + +// PrivateCrossConnectApiService PrivateCrossConnectApi service +type PrivateCrossConnectApiService service + +type ApiPccsDeleteRequest struct { + ctx _context.Context + ApiService *PrivateCrossConnectApiService + pccId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiPccsDeleteRequest) Pretty(pretty bool) ApiPccsDeleteRequest { + r.pretty = &pretty + return r +} +func (r ApiPccsDeleteRequest) Depth(depth int32) ApiPccsDeleteRequest { + r.depth = &depth + return r +} +func (r ApiPccsDeleteRequest) XContractNumber(xContractNumber int32) ApiPccsDeleteRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiPccsDeleteRequest) Execute() (map[string]interface{}, *APIResponse, error) { + return r.ApiService.PccsDeleteExecute(r) +} + +/* + * PccsDelete Delete a Private Cross-Connect + * Delete a private cross-connect if no datacenters are joined to the given PCC + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param pccId The unique ID of the private cross-connect + * @return ApiPccsDeleteRequest + */ +func (a *PrivateCrossConnectApiService) PccsDelete(ctx _context.Context, pccId string) ApiPccsDeleteRequest { + return ApiPccsDeleteRequest{ + ApiService: a, + ctx: ctx, + pccId: pccId, + } +} + +/* + * Execute executes the request + * @return map[string]interface{} + */ +func (a *PrivateCrossConnectApiService) PccsDeleteExecute(r ApiPccsDeleteRequest) (map[string]interface{}, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PrivateCrossConnectApiService.PccsDelete") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/pccs/{pccId}" + localVarPath = strings.Replace(localVarPath, "{"+"pccId"+"}", _neturl.PathEscape(parameterToString(r.pccId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "PccsDelete", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiPccsFindByIdRequest struct { + ctx _context.Context + ApiService *PrivateCrossConnectApiService + pccId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiPccsFindByIdRequest) Pretty(pretty bool) ApiPccsFindByIdRequest { + r.pretty = &pretty + return r +} +func (r ApiPccsFindByIdRequest) Depth(depth int32) ApiPccsFindByIdRequest { + r.depth = &depth + return r +} +func (r ApiPccsFindByIdRequest) XContractNumber(xContractNumber int32) ApiPccsFindByIdRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiPccsFindByIdRequest) Execute() (PrivateCrossConnect, *APIResponse, error) { + return r.ApiService.PccsFindByIdExecute(r) +} + +/* + * PccsFindById Retrieve a Private Cross-Connect + * You can retrieve a private cross-connect by using the resource's ID. This value can be found in the response body when a private cross-connect is created or when you GET a list of private cross-connects. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param pccId The unique ID of the private cross-connect + * @return ApiPccsFindByIdRequest + */ +func (a *PrivateCrossConnectApiService) PccsFindById(ctx _context.Context, pccId string) ApiPccsFindByIdRequest { + return ApiPccsFindByIdRequest{ + ApiService: a, + ctx: ctx, + pccId: pccId, + } +} + +/* + * Execute executes the request + * @return PrivateCrossConnect + */ +func (a *PrivateCrossConnectApiService) PccsFindByIdExecute(r ApiPccsFindByIdRequest) (PrivateCrossConnect, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue PrivateCrossConnect + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PrivateCrossConnectApiService.PccsFindById") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/pccs/{pccId}" + localVarPath = strings.Replace(localVarPath, "{"+"pccId"+"}", _neturl.PathEscape(parameterToString(r.pccId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "PccsFindById", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiPccsGetRequest struct { + ctx _context.Context + ApiService *PrivateCrossConnectApiService + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiPccsGetRequest) Pretty(pretty bool) ApiPccsGetRequest { + r.pretty = &pretty + return r +} +func (r ApiPccsGetRequest) Depth(depth int32) ApiPccsGetRequest { + r.depth = &depth + return r +} +func (r ApiPccsGetRequest) XContractNumber(xContractNumber int32) ApiPccsGetRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiPccsGetRequest) Execute() (PrivateCrossConnects, *APIResponse, error) { + return r.ApiService.PccsGetExecute(r) +} + +/* + * PccsGet List Private Cross-Connects + * You can retrieve a complete list of private cross-connects provisioned under your account + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiPccsGetRequest + */ +func (a *PrivateCrossConnectApiService) PccsGet(ctx _context.Context) ApiPccsGetRequest { + return ApiPccsGetRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + * @return PrivateCrossConnects + */ +func (a *PrivateCrossConnectApiService) PccsGetExecute(r ApiPccsGetRequest) (PrivateCrossConnects, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue PrivateCrossConnects + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PrivateCrossConnectApiService.PccsGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/pccs" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "PccsGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiPccsPatchRequest struct { + ctx _context.Context + ApiService *PrivateCrossConnectApiService + pccId string + pcc *PrivateCrossConnectProperties + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiPccsPatchRequest) Pcc(pcc PrivateCrossConnectProperties) ApiPccsPatchRequest { + r.pcc = &pcc + return r +} +func (r ApiPccsPatchRequest) Pretty(pretty bool) ApiPccsPatchRequest { + r.pretty = &pretty + return r +} +func (r ApiPccsPatchRequest) Depth(depth int32) ApiPccsPatchRequest { + r.depth = &depth + return r +} +func (r ApiPccsPatchRequest) XContractNumber(xContractNumber int32) ApiPccsPatchRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiPccsPatchRequest) Execute() (PrivateCrossConnect, *APIResponse, error) { + return r.ApiService.PccsPatchExecute(r) +} + +/* + * PccsPatch Partially modify a private cross-connect + * You can use update private cross-connect to re-name or update its description + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param pccId The unique ID of the private cross-connect + * @return ApiPccsPatchRequest + */ +func (a *PrivateCrossConnectApiService) PccsPatch(ctx _context.Context, pccId string) ApiPccsPatchRequest { + return ApiPccsPatchRequest{ + ApiService: a, + ctx: ctx, + pccId: pccId, + } +} + +/* + * Execute executes the request + * @return PrivateCrossConnect + */ +func (a *PrivateCrossConnectApiService) PccsPatchExecute(r ApiPccsPatchRequest) (PrivateCrossConnect, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue PrivateCrossConnect + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PrivateCrossConnectApiService.PccsPatch") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/pccs/{pccId}" + localVarPath = strings.Replace(localVarPath, "{"+"pccId"+"}", _neturl.PathEscape(parameterToString(r.pccId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.pcc == nil { + return localVarReturnValue, nil, reportError("pcc is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.pcc + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "PccsPatch", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiPccsPostRequest struct { + ctx _context.Context + ApiService *PrivateCrossConnectApiService + pcc *PrivateCrossConnect + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiPccsPostRequest) Pcc(pcc PrivateCrossConnect) ApiPccsPostRequest { + r.pcc = &pcc + return r +} +func (r ApiPccsPostRequest) Pretty(pretty bool) ApiPccsPostRequest { + r.pretty = &pretty + return r +} +func (r ApiPccsPostRequest) Depth(depth int32) ApiPccsPostRequest { + r.depth = &depth + return r +} +func (r ApiPccsPostRequest) XContractNumber(xContractNumber int32) ApiPccsPostRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiPccsPostRequest) Execute() (PrivateCrossConnect, *APIResponse, error) { + return r.ApiService.PccsPostExecute(r) +} + +/* + * PccsPost Create a Private Cross-Connect + * You can use this POST method to create a private cross-connect + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiPccsPostRequest + */ +func (a *PrivateCrossConnectApiService) PccsPost(ctx _context.Context) ApiPccsPostRequest { + return ApiPccsPostRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + * @return PrivateCrossConnect + */ +func (a *PrivateCrossConnectApiService) PccsPostExecute(r ApiPccsPostRequest) (PrivateCrossConnect, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue PrivateCrossConnect + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PrivateCrossConnectApiService.PccsPost") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/pccs" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.pcc == nil { + return localVarReturnValue, nil, reportError("pcc is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.pcc + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "PccsPost", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_request.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_request.go new file mode 100644 index 0000000000..f9cab7010c --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_request.go @@ -0,0 +1,556 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" +) + +// Linger please +var ( + _ _context.Context +) + +// RequestApiService RequestApi service +type RequestApiService service + +type ApiRequestsFindByIdRequest struct { + ctx _context.Context + ApiService *RequestApiService + requestId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiRequestsFindByIdRequest) Pretty(pretty bool) ApiRequestsFindByIdRequest { + r.pretty = &pretty + return r +} +func (r ApiRequestsFindByIdRequest) Depth(depth int32) ApiRequestsFindByIdRequest { + r.depth = &depth + return r +} +func (r ApiRequestsFindByIdRequest) XContractNumber(xContractNumber int32) ApiRequestsFindByIdRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiRequestsFindByIdRequest) Execute() (Request, *APIResponse, error) { + return r.ApiService.RequestsFindByIdExecute(r) +} + +/* + * RequestsFindById Retrieve a Request + * Retrieves the attributes of a given request. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param requestId + * @return ApiRequestsFindByIdRequest + */ +func (a *RequestApiService) RequestsFindById(ctx _context.Context, requestId string) ApiRequestsFindByIdRequest { + return ApiRequestsFindByIdRequest{ + ApiService: a, + ctx: ctx, + requestId: requestId, + } +} + +/* + * Execute executes the request + * @return Request + */ +func (a *RequestApiService) RequestsFindByIdExecute(r ApiRequestsFindByIdRequest) (Request, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Request + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "RequestApiService.RequestsFindById") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/requests/{requestId}" + localVarPath = strings.Replace(localVarPath, "{"+"requestId"+"}", _neturl.PathEscape(parameterToString(r.requestId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "RequestsFindById", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiRequestsGetRequest struct { + ctx _context.Context + ApiService *RequestApiService + pretty *bool + depth *int32 + xContractNumber *int32 + filterStatus *string + filterCreatedAfter *string + filterCreatedBefore *string + filterUrl *string + filterCreatedDate *string + filterMethod *string + filterBody *string +} + +func (r ApiRequestsGetRequest) Pretty(pretty bool) ApiRequestsGetRequest { + r.pretty = &pretty + return r +} +func (r ApiRequestsGetRequest) Depth(depth int32) ApiRequestsGetRequest { + r.depth = &depth + return r +} +func (r ApiRequestsGetRequest) XContractNumber(xContractNumber int32) ApiRequestsGetRequest { + r.xContractNumber = &xContractNumber + return r +} +func (r ApiRequestsGetRequest) FilterStatus(filterStatus string) ApiRequestsGetRequest { + r.filterStatus = &filterStatus + return r +} +func (r ApiRequestsGetRequest) FilterCreatedAfter(filterCreatedAfter string) ApiRequestsGetRequest { + r.filterCreatedAfter = &filterCreatedAfter + return r +} +func (r ApiRequestsGetRequest) FilterCreatedBefore(filterCreatedBefore string) ApiRequestsGetRequest { + r.filterCreatedBefore = &filterCreatedBefore + return r +} +func (r ApiRequestsGetRequest) FilterUrl(filterUrl string) ApiRequestsGetRequest { + r.filterUrl = &filterUrl + return r +} +func (r ApiRequestsGetRequest) FilterCreatedDate(filterCreatedDate string) ApiRequestsGetRequest { + r.filterCreatedDate = &filterCreatedDate + return r +} +func (r ApiRequestsGetRequest) FilterMethod(filterMethod string) ApiRequestsGetRequest { + r.filterMethod = &filterMethod + return r +} +func (r ApiRequestsGetRequest) FilterBody(filterBody string) ApiRequestsGetRequest { + r.filterBody = &filterBody + return r +} + +func (r ApiRequestsGetRequest) Execute() (Requests, *APIResponse, error) { + return r.ApiService.RequestsGetExecute(r) +} + +/* + * RequestsGet List Requests + * Retrieve a list of API requests. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiRequestsGetRequest + */ +func (a *RequestApiService) RequestsGet(ctx _context.Context) ApiRequestsGetRequest { + return ApiRequestsGetRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + * @return Requests + */ +func (a *RequestApiService) RequestsGetExecute(r ApiRequestsGetRequest) (Requests, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Requests + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "RequestApiService.RequestsGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/requests" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + if r.filterStatus != nil { + localVarQueryParams.Add("filter.status", parameterToString(*r.filterStatus, "")) + } + if r.filterCreatedAfter != nil { + localVarQueryParams.Add("filter.createdAfter", parameterToString(*r.filterCreatedAfter, "")) + } + if r.filterCreatedBefore != nil { + localVarQueryParams.Add("filter.createdBefore", parameterToString(*r.filterCreatedBefore, "")) + } + if r.filterUrl != nil { + localVarQueryParams.Add("filter.url", parameterToString(*r.filterUrl, "")) + } + if r.filterCreatedDate != nil { + localVarQueryParams.Add("filter.createdDate", parameterToString(*r.filterCreatedDate, "")) + } + if r.filterMethod != nil { + localVarQueryParams.Add("filter.method", parameterToString(*r.filterMethod, "")) + } + if r.filterBody != nil { + localVarQueryParams.Add("filter.body", parameterToString(*r.filterBody, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "RequestsGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiRequestsStatusGetRequest struct { + ctx _context.Context + ApiService *RequestApiService + requestId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiRequestsStatusGetRequest) Pretty(pretty bool) ApiRequestsStatusGetRequest { + r.pretty = &pretty + return r +} +func (r ApiRequestsStatusGetRequest) Depth(depth int32) ApiRequestsStatusGetRequest { + r.depth = &depth + return r +} +func (r ApiRequestsStatusGetRequest) XContractNumber(xContractNumber int32) ApiRequestsStatusGetRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiRequestsStatusGetRequest) Execute() (RequestStatus, *APIResponse, error) { + return r.ApiService.RequestsStatusGetExecute(r) +} + +/* + * RequestsStatusGet Retrieve Request Status + * Retrieves the status of a given request. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param requestId + * @return ApiRequestsStatusGetRequest + */ +func (a *RequestApiService) RequestsStatusGet(ctx _context.Context, requestId string) ApiRequestsStatusGetRequest { + return ApiRequestsStatusGetRequest{ + ApiService: a, + ctx: ctx, + requestId: requestId, + } +} + +/* + * Execute executes the request + * @return RequestStatus + */ +func (a *RequestApiService) RequestsStatusGetExecute(r ApiRequestsStatusGetRequest) (RequestStatus, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RequestStatus + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "RequestApiService.RequestsStatusGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/requests/{requestId}/status" + localVarPath = strings.Replace(localVarPath, "{"+"requestId"+"}", _neturl.PathEscape(parameterToString(r.requestId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "RequestsStatusGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_server.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_server.go new file mode 100644 index 0000000000..232be26620 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_server.go @@ -0,0 +1,2999 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" +) + +// Linger please +var ( + _ _context.Context +) + +// ServerApiService ServerApi service +type ServerApiService service + +type ApiDatacentersServersCdromsDeleteRequest struct { + ctx _context.Context + ApiService *ServerApiService + datacenterId string + serverId string + cdromId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersServersCdromsDeleteRequest) Pretty(pretty bool) ApiDatacentersServersCdromsDeleteRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersServersCdromsDeleteRequest) Depth(depth int32) ApiDatacentersServersCdromsDeleteRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersServersCdromsDeleteRequest) XContractNumber(xContractNumber int32) ApiDatacentersServersCdromsDeleteRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersServersCdromsDeleteRequest) Execute() (map[string]interface{}, *APIResponse, error) { + return r.ApiService.DatacentersServersCdromsDeleteExecute(r) +} + +/* + * DatacentersServersCdromsDelete Detach a CD-ROM + * This will detach a CD-ROM from the server + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the Datacenter + * @param serverId The unique ID of the Server + * @param cdromId The unique ID of the CD-ROM + * @return ApiDatacentersServersCdromsDeleteRequest + */ +func (a *ServerApiService) DatacentersServersCdromsDelete(ctx _context.Context, datacenterId string, serverId string, cdromId string) ApiDatacentersServersCdromsDeleteRequest { + return ApiDatacentersServersCdromsDeleteRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + serverId: serverId, + cdromId: cdromId, + } +} + +/* + * Execute executes the request + * @return map[string]interface{} + */ +func (a *ServerApiService) DatacentersServersCdromsDeleteExecute(r ApiDatacentersServersCdromsDeleteRequest) (map[string]interface{}, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ServerApiService.DatacentersServersCdromsDelete") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/cdroms/{cdromId}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"cdromId"+"}", _neturl.PathEscape(parameterToString(r.cdromId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersServersCdromsDelete", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersServersCdromsFindByIdRequest struct { + ctx _context.Context + ApiService *ServerApiService + datacenterId string + serverId string + cdromId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersServersCdromsFindByIdRequest) Pretty(pretty bool) ApiDatacentersServersCdromsFindByIdRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersServersCdromsFindByIdRequest) Depth(depth int32) ApiDatacentersServersCdromsFindByIdRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersServersCdromsFindByIdRequest) XContractNumber(xContractNumber int32) ApiDatacentersServersCdromsFindByIdRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersServersCdromsFindByIdRequest) Execute() (Image, *APIResponse, error) { + return r.ApiService.DatacentersServersCdromsFindByIdExecute(r) +} + +/* + * DatacentersServersCdromsFindById Retrieve an attached CD-ROM + * You can retrieve a specific CD-ROM attached to the server + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the Datacenter + * @param serverId The unique ID of the Server + * @param cdromId The unique ID of the CD-ROM + * @return ApiDatacentersServersCdromsFindByIdRequest + */ +func (a *ServerApiService) DatacentersServersCdromsFindById(ctx _context.Context, datacenterId string, serverId string, cdromId string) ApiDatacentersServersCdromsFindByIdRequest { + return ApiDatacentersServersCdromsFindByIdRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + serverId: serverId, + cdromId: cdromId, + } +} + +/* + * Execute executes the request + * @return Image + */ +func (a *ServerApiService) DatacentersServersCdromsFindByIdExecute(r ApiDatacentersServersCdromsFindByIdRequest) (Image, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Image + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ServerApiService.DatacentersServersCdromsFindById") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/cdroms/{cdromId}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"cdromId"+"}", _neturl.PathEscape(parameterToString(r.cdromId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersServersCdromsFindById", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersServersCdromsGetRequest struct { + ctx _context.Context + ApiService *ServerApiService + datacenterId string + serverId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersServersCdromsGetRequest) Pretty(pretty bool) ApiDatacentersServersCdromsGetRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersServersCdromsGetRequest) Depth(depth int32) ApiDatacentersServersCdromsGetRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersServersCdromsGetRequest) XContractNumber(xContractNumber int32) ApiDatacentersServersCdromsGetRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersServersCdromsGetRequest) Execute() (Cdroms, *APIResponse, error) { + return r.ApiService.DatacentersServersCdromsGetExecute(r) +} + +/* + * DatacentersServersCdromsGet List attached CD-ROMs + * You can retrieve a list of CD-ROMs attached to the server. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the Datacenter + * @param serverId The unique ID of the Server + * @return ApiDatacentersServersCdromsGetRequest + */ +func (a *ServerApiService) DatacentersServersCdromsGet(ctx _context.Context, datacenterId string, serverId string) ApiDatacentersServersCdromsGetRequest { + return ApiDatacentersServersCdromsGetRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + serverId: serverId, + } +} + +/* + * Execute executes the request + * @return Cdroms + */ +func (a *ServerApiService) DatacentersServersCdromsGetExecute(r ApiDatacentersServersCdromsGetRequest) (Cdroms, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Cdroms + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ServerApiService.DatacentersServersCdromsGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/cdroms" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersServersCdromsGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersServersCdromsPostRequest struct { + ctx _context.Context + ApiService *ServerApiService + datacenterId string + serverId string + cdrom *Image + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersServersCdromsPostRequest) Cdrom(cdrom Image) ApiDatacentersServersCdromsPostRequest { + r.cdrom = &cdrom + return r +} +func (r ApiDatacentersServersCdromsPostRequest) Pretty(pretty bool) ApiDatacentersServersCdromsPostRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersServersCdromsPostRequest) Depth(depth int32) ApiDatacentersServersCdromsPostRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersServersCdromsPostRequest) XContractNumber(xContractNumber int32) ApiDatacentersServersCdromsPostRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersServersCdromsPostRequest) Execute() (Image, *APIResponse, error) { + return r.ApiService.DatacentersServersCdromsPostExecute(r) +} + +/* + * DatacentersServersCdromsPost Attach a CD-ROM + * You can attach a CD-ROM to an existing server. You can attach up to 2 CD-ROMs to one server. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the Datacenter + * @param serverId The unique ID of the Server + * @return ApiDatacentersServersCdromsPostRequest + */ +func (a *ServerApiService) DatacentersServersCdromsPost(ctx _context.Context, datacenterId string, serverId string) ApiDatacentersServersCdromsPostRequest { + return ApiDatacentersServersCdromsPostRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + serverId: serverId, + } +} + +/* + * Execute executes the request + * @return Image + */ +func (a *ServerApiService) DatacentersServersCdromsPostExecute(r ApiDatacentersServersCdromsPostRequest) (Image, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Image + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ServerApiService.DatacentersServersCdromsPost") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/cdroms" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.cdrom == nil { + return localVarReturnValue, nil, reportError("cdrom is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.cdrom + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersServersCdromsPost", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersServersDeleteRequest struct { + ctx _context.Context + ApiService *ServerApiService + datacenterId string + serverId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersServersDeleteRequest) Pretty(pretty bool) ApiDatacentersServersDeleteRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersServersDeleteRequest) Depth(depth int32) ApiDatacentersServersDeleteRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersServersDeleteRequest) XContractNumber(xContractNumber int32) ApiDatacentersServersDeleteRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersServersDeleteRequest) Execute() (map[string]interface{}, *APIResponse, error) { + return r.ApiService.DatacentersServersDeleteExecute(r) +} + +/* + * DatacentersServersDelete Delete a Server + * This will remove a server from your datacenter; however, it will not remove the storage volumes attached to the server. You will need to make a separate API call to perform that action + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @param serverId The unique ID of the Server + * @return ApiDatacentersServersDeleteRequest + */ +func (a *ServerApiService) DatacentersServersDelete(ctx _context.Context, datacenterId string, serverId string) ApiDatacentersServersDeleteRequest { + return ApiDatacentersServersDeleteRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + serverId: serverId, + } +} + +/* + * Execute executes the request + * @return map[string]interface{} + */ +func (a *ServerApiService) DatacentersServersDeleteExecute(r ApiDatacentersServersDeleteRequest) (map[string]interface{}, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ServerApiService.DatacentersServersDelete") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersServersDelete", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersServersFindByIdRequest struct { + ctx _context.Context + ApiService *ServerApiService + datacenterId string + serverId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersServersFindByIdRequest) Pretty(pretty bool) ApiDatacentersServersFindByIdRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersServersFindByIdRequest) Depth(depth int32) ApiDatacentersServersFindByIdRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersServersFindByIdRequest) XContractNumber(xContractNumber int32) ApiDatacentersServersFindByIdRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersServersFindByIdRequest) Execute() (Server, *APIResponse, error) { + return r.ApiService.DatacentersServersFindByIdExecute(r) +} + +/* + * DatacentersServersFindById Retrieve a Server + * Returns information about a server such as its configuration, provisioning status, etc. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @param serverId The unique ID of the Server + * @return ApiDatacentersServersFindByIdRequest + */ +func (a *ServerApiService) DatacentersServersFindById(ctx _context.Context, datacenterId string, serverId string) ApiDatacentersServersFindByIdRequest { + return ApiDatacentersServersFindByIdRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + serverId: serverId, + } +} + +/* + * Execute executes the request + * @return Server + */ +func (a *ServerApiService) DatacentersServersFindByIdExecute(r ApiDatacentersServersFindByIdRequest) (Server, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Server + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ServerApiService.DatacentersServersFindById") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersServersFindById", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersServersGetRequest struct { + ctx _context.Context + ApiService *ServerApiService + datacenterId string + pretty *bool + depth *int32 + upgradeNeeded *bool + xContractNumber *int32 +} + +func (r ApiDatacentersServersGetRequest) Pretty(pretty bool) ApiDatacentersServersGetRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersServersGetRequest) Depth(depth int32) ApiDatacentersServersGetRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersServersGetRequest) UpgradeNeeded(upgradeNeeded bool) ApiDatacentersServersGetRequest { + r.upgradeNeeded = &upgradeNeeded + return r +} +func (r ApiDatacentersServersGetRequest) XContractNumber(xContractNumber int32) ApiDatacentersServersGetRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersServersGetRequest) Execute() (Servers, *APIResponse, error) { + return r.ApiService.DatacentersServersGetExecute(r) +} + +/* + * DatacentersServersGet List Servers + * You can retrieve a list of servers within a datacenter + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @return ApiDatacentersServersGetRequest + */ +func (a *ServerApiService) DatacentersServersGet(ctx _context.Context, datacenterId string) ApiDatacentersServersGetRequest { + return ApiDatacentersServersGetRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + } +} + +/* + * Execute executes the request + * @return Servers + */ +func (a *ServerApiService) DatacentersServersGetExecute(r ApiDatacentersServersGetRequest) (Servers, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Servers + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ServerApiService.DatacentersServersGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/servers" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + if r.upgradeNeeded != nil { + localVarQueryParams.Add("upgradeNeeded", parameterToString(*r.upgradeNeeded, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersServersGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersServersPatchRequest struct { + ctx _context.Context + ApiService *ServerApiService + datacenterId string + serverId string + server *ServerProperties + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersServersPatchRequest) Server(server ServerProperties) ApiDatacentersServersPatchRequest { + r.server = &server + return r +} +func (r ApiDatacentersServersPatchRequest) Pretty(pretty bool) ApiDatacentersServersPatchRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersServersPatchRequest) Depth(depth int32) ApiDatacentersServersPatchRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersServersPatchRequest) XContractNumber(xContractNumber int32) ApiDatacentersServersPatchRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersServersPatchRequest) Execute() (Server, *APIResponse, error) { + return r.ApiService.DatacentersServersPatchExecute(r) +} + +/* + * DatacentersServersPatch Partially modify a Server + * You can use update attributes of a server + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @param serverId The unique ID of the server + * @return ApiDatacentersServersPatchRequest + */ +func (a *ServerApiService) DatacentersServersPatch(ctx _context.Context, datacenterId string, serverId string) ApiDatacentersServersPatchRequest { + return ApiDatacentersServersPatchRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + serverId: serverId, + } +} + +/* + * Execute executes the request + * @return Server + */ +func (a *ServerApiService) DatacentersServersPatchExecute(r ApiDatacentersServersPatchRequest) (Server, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Server + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ServerApiService.DatacentersServersPatch") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.server == nil { + return localVarReturnValue, nil, reportError("server is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.server + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersServersPatch", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersServersPostRequest struct { + ctx _context.Context + ApiService *ServerApiService + datacenterId string + server *Server + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersServersPostRequest) Server(server Server) ApiDatacentersServersPostRequest { + r.server = &server + return r +} +func (r ApiDatacentersServersPostRequest) Pretty(pretty bool) ApiDatacentersServersPostRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersServersPostRequest) Depth(depth int32) ApiDatacentersServersPostRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersServersPostRequest) XContractNumber(xContractNumber int32) ApiDatacentersServersPostRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersServersPostRequest) Execute() (Server, *APIResponse, error) { + return r.ApiService.DatacentersServersPostExecute(r) +} + +/* + * DatacentersServersPost Create a Server + * Creates a server within an existing datacenter. You can configure the boot volume and connect the server to an existing LAN. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @return ApiDatacentersServersPostRequest + */ +func (a *ServerApiService) DatacentersServersPost(ctx _context.Context, datacenterId string) ApiDatacentersServersPostRequest { + return ApiDatacentersServersPostRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + } +} + +/* + * Execute executes the request + * @return Server + */ +func (a *ServerApiService) DatacentersServersPostExecute(r ApiDatacentersServersPostRequest) (Server, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Server + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ServerApiService.DatacentersServersPost") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/servers" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.server == nil { + return localVarReturnValue, nil, reportError("server is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.server + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersServersPost", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersServersPutRequest struct { + ctx _context.Context + ApiService *ServerApiService + datacenterId string + serverId string + server *Server + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersServersPutRequest) Server(server Server) ApiDatacentersServersPutRequest { + r.server = &server + return r +} +func (r ApiDatacentersServersPutRequest) Pretty(pretty bool) ApiDatacentersServersPutRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersServersPutRequest) Depth(depth int32) ApiDatacentersServersPutRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersServersPutRequest) XContractNumber(xContractNumber int32) ApiDatacentersServersPutRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersServersPutRequest) Execute() (Server, *APIResponse, error) { + return r.ApiService.DatacentersServersPutExecute(r) +} + +/* + * DatacentersServersPut Modify a Server + * Allows to modify the attributes of a Server. From v5 onwards 'allowReboot' attribute will no longer be available. For certain server property change it was earlier forced to be provided. Now this behaviour is implicit and backend will do this automatically e.g. in earlier versions, when CPU family changes, the 'allowReboot' property was required to be set to true which will no longer be the case and the server will be rebooted automatically + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @param serverId The unique ID of the server + * @return ApiDatacentersServersPutRequest + */ +func (a *ServerApiService) DatacentersServersPut(ctx _context.Context, datacenterId string, serverId string) ApiDatacentersServersPutRequest { + return ApiDatacentersServersPutRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + serverId: serverId, + } +} + +/* + * Execute executes the request + * @return Server + */ +func (a *ServerApiService) DatacentersServersPutExecute(r ApiDatacentersServersPutRequest) (Server, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Server + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ServerApiService.DatacentersServersPut") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.server == nil { + return localVarReturnValue, nil, reportError("server is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.server + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersServersPut", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersServersRebootPostRequest struct { + ctx _context.Context + ApiService *ServerApiService + datacenterId string + serverId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersServersRebootPostRequest) Pretty(pretty bool) ApiDatacentersServersRebootPostRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersServersRebootPostRequest) Depth(depth int32) ApiDatacentersServersRebootPostRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersServersRebootPostRequest) XContractNumber(xContractNumber int32) ApiDatacentersServersRebootPostRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersServersRebootPostRequest) Execute() (map[string]interface{}, *APIResponse, error) { + return r.ApiService.DatacentersServersRebootPostExecute(r) +} + +/* + * DatacentersServersRebootPost Reboot a Server + * This will force a hard reboot of the server. Do not use this method if you want to gracefully reboot the machine. This is the equivalent of powering off the machine and turning it back on. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @param serverId The unique ID of the Server + * @return ApiDatacentersServersRebootPostRequest + */ +func (a *ServerApiService) DatacentersServersRebootPost(ctx _context.Context, datacenterId string, serverId string) ApiDatacentersServersRebootPostRequest { + return ApiDatacentersServersRebootPostRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + serverId: serverId, + } +} + +/* + * Execute executes the request + * @return map[string]interface{} + */ +func (a *ServerApiService) DatacentersServersRebootPostExecute(r ApiDatacentersServersRebootPostRequest) (map[string]interface{}, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ServerApiService.DatacentersServersRebootPost") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/reboot" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersServersRebootPost", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersServersStartPostRequest struct { + ctx _context.Context + ApiService *ServerApiService + datacenterId string + serverId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersServersStartPostRequest) Pretty(pretty bool) ApiDatacentersServersStartPostRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersServersStartPostRequest) Depth(depth int32) ApiDatacentersServersStartPostRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersServersStartPostRequest) XContractNumber(xContractNumber int32) ApiDatacentersServersStartPostRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersServersStartPostRequest) Execute() (map[string]interface{}, *APIResponse, error) { + return r.ApiService.DatacentersServersStartPostExecute(r) +} + +/* + * DatacentersServersStartPost Start a Server + * This will start a server. If the server's public IP was deallocated then a new IP will be assigned + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @param serverId The unique ID of the Server + * @return ApiDatacentersServersStartPostRequest + */ +func (a *ServerApiService) DatacentersServersStartPost(ctx _context.Context, datacenterId string, serverId string) ApiDatacentersServersStartPostRequest { + return ApiDatacentersServersStartPostRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + serverId: serverId, + } +} + +/* + * Execute executes the request + * @return map[string]interface{} + */ +func (a *ServerApiService) DatacentersServersStartPostExecute(r ApiDatacentersServersStartPostRequest) (map[string]interface{}, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ServerApiService.DatacentersServersStartPost") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/start" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersServersStartPost", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersServersStopPostRequest struct { + ctx _context.Context + ApiService *ServerApiService + datacenterId string + serverId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersServersStopPostRequest) Pretty(pretty bool) ApiDatacentersServersStopPostRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersServersStopPostRequest) Depth(depth int32) ApiDatacentersServersStopPostRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersServersStopPostRequest) XContractNumber(xContractNumber int32) ApiDatacentersServersStopPostRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersServersStopPostRequest) Execute() (map[string]interface{}, *APIResponse, error) { + return r.ApiService.DatacentersServersStopPostExecute(r) +} + +/* + * DatacentersServersStopPost Stop a Server + * This will stop a server. The machine will be forcefully powered off, billing will cease, and the public IP, if one is allocated, will be deallocated. The operation is not supported for CoreVPS servers. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @param serverId The unique ID of the Server + * @return ApiDatacentersServersStopPostRequest + */ +func (a *ServerApiService) DatacentersServersStopPost(ctx _context.Context, datacenterId string, serverId string) ApiDatacentersServersStopPostRequest { + return ApiDatacentersServersStopPostRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + serverId: serverId, + } +} + +/* + * Execute executes the request + * @return map[string]interface{} + */ +func (a *ServerApiService) DatacentersServersStopPostExecute(r ApiDatacentersServersStopPostRequest) (map[string]interface{}, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ServerApiService.DatacentersServersStopPost") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/stop" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersServersStopPost", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersServersUpgradePostRequest struct { + ctx _context.Context + ApiService *ServerApiService + datacenterId string + serverId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersServersUpgradePostRequest) Pretty(pretty bool) ApiDatacentersServersUpgradePostRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersServersUpgradePostRequest) Depth(depth int32) ApiDatacentersServersUpgradePostRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersServersUpgradePostRequest) XContractNumber(xContractNumber int32) ApiDatacentersServersUpgradePostRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersServersUpgradePostRequest) Execute() (map[string]interface{}, *APIResponse, error) { + return r.ApiService.DatacentersServersUpgradePostExecute(r) +} + +/* + * DatacentersServersUpgradePost Upgrade a Server + * This will upgrade the version of the server, if needed. To verify if there is an upgrade available for a server, call '/datacenters/{datacenterId}/servers?upgradeNeeded=true' + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @param serverId The unique ID of the Server + * @return ApiDatacentersServersUpgradePostRequest + */ +func (a *ServerApiService) DatacentersServersUpgradePost(ctx _context.Context, datacenterId string, serverId string) ApiDatacentersServersUpgradePostRequest { + return ApiDatacentersServersUpgradePostRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + serverId: serverId, + } +} + +/* + * Execute executes the request + * @return map[string]interface{} + */ +func (a *ServerApiService) DatacentersServersUpgradePostExecute(r ApiDatacentersServersUpgradePostRequest) (map[string]interface{}, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ServerApiService.DatacentersServersUpgradePost") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/upgrade" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersServersUpgradePost", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersServersVolumesDeleteRequest struct { + ctx _context.Context + ApiService *ServerApiService + datacenterId string + serverId string + volumeId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersServersVolumesDeleteRequest) Pretty(pretty bool) ApiDatacentersServersVolumesDeleteRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersServersVolumesDeleteRequest) Depth(depth int32) ApiDatacentersServersVolumesDeleteRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersServersVolumesDeleteRequest) XContractNumber(xContractNumber int32) ApiDatacentersServersVolumesDeleteRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersServersVolumesDeleteRequest) Execute() (map[string]interface{}, *APIResponse, error) { + return r.ApiService.DatacentersServersVolumesDeleteExecute(r) +} + +/* + * DatacentersServersVolumesDelete Detach a volume + * This will detach the volume from the server. This will not delete the volume from your datacenter. You will need to make a separate request to perform a deletion + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the Datacenter + * @param serverId The unique ID of the Server + * @param volumeId The unique ID of the Volume + * @return ApiDatacentersServersVolumesDeleteRequest + */ +func (a *ServerApiService) DatacentersServersVolumesDelete(ctx _context.Context, datacenterId string, serverId string, volumeId string) ApiDatacentersServersVolumesDeleteRequest { + return ApiDatacentersServersVolumesDeleteRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + serverId: serverId, + volumeId: volumeId, + } +} + +/* + * Execute executes the request + * @return map[string]interface{} + */ +func (a *ServerApiService) DatacentersServersVolumesDeleteExecute(r ApiDatacentersServersVolumesDeleteRequest) (map[string]interface{}, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ServerApiService.DatacentersServersVolumesDelete") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/volumes/{volumeId}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", _neturl.PathEscape(parameterToString(r.volumeId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersServersVolumesDelete", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersServersVolumesFindByIdRequest struct { + ctx _context.Context + ApiService *ServerApiService + datacenterId string + serverId string + volumeId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersServersVolumesFindByIdRequest) Pretty(pretty bool) ApiDatacentersServersVolumesFindByIdRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersServersVolumesFindByIdRequest) Depth(depth int32) ApiDatacentersServersVolumesFindByIdRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersServersVolumesFindByIdRequest) XContractNumber(xContractNumber int32) ApiDatacentersServersVolumesFindByIdRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersServersVolumesFindByIdRequest) Execute() (Volume, *APIResponse, error) { + return r.ApiService.DatacentersServersVolumesFindByIdExecute(r) +} + +/* + * DatacentersServersVolumesFindById Retrieve an attached volume + * This will retrieve the properties of an attached volume. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the Datacenter + * @param serverId The unique ID of the Server + * @param volumeId The unique ID of the Volume + * @return ApiDatacentersServersVolumesFindByIdRequest + */ +func (a *ServerApiService) DatacentersServersVolumesFindById(ctx _context.Context, datacenterId string, serverId string, volumeId string) ApiDatacentersServersVolumesFindByIdRequest { + return ApiDatacentersServersVolumesFindByIdRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + serverId: serverId, + volumeId: volumeId, + } +} + +/* + * Execute executes the request + * @return Volume + */ +func (a *ServerApiService) DatacentersServersVolumesFindByIdExecute(r ApiDatacentersServersVolumesFindByIdRequest) (Volume, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Volume + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ServerApiService.DatacentersServersVolumesFindById") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/volumes/{volumeId}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", _neturl.PathEscape(parameterToString(r.volumeId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersServersVolumesFindById", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersServersVolumesGetRequest struct { + ctx _context.Context + ApiService *ServerApiService + datacenterId string + serverId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersServersVolumesGetRequest) Pretty(pretty bool) ApiDatacentersServersVolumesGetRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersServersVolumesGetRequest) Depth(depth int32) ApiDatacentersServersVolumesGetRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersServersVolumesGetRequest) XContractNumber(xContractNumber int32) ApiDatacentersServersVolumesGetRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersServersVolumesGetRequest) Execute() (AttachedVolumes, *APIResponse, error) { + return r.ApiService.DatacentersServersVolumesGetExecute(r) +} + +/* + * DatacentersServersVolumesGet List Attached Volumes + * You can retrieve a list of volumes attached to the server + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the Datacenter + * @param serverId The unique ID of the Server + * @return ApiDatacentersServersVolumesGetRequest + */ +func (a *ServerApiService) DatacentersServersVolumesGet(ctx _context.Context, datacenterId string, serverId string) ApiDatacentersServersVolumesGetRequest { + return ApiDatacentersServersVolumesGetRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + serverId: serverId, + } +} + +/* + * Execute executes the request + * @return AttachedVolumes + */ +func (a *ServerApiService) DatacentersServersVolumesGetExecute(r ApiDatacentersServersVolumesGetRequest) (AttachedVolumes, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue AttachedVolumes + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ServerApiService.DatacentersServersVolumesGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/volumes" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersServersVolumesGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersServersVolumesPostRequest struct { + ctx _context.Context + ApiService *ServerApiService + datacenterId string + serverId string + volume *Volume + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersServersVolumesPostRequest) Volume(volume Volume) ApiDatacentersServersVolumesPostRequest { + r.volume = &volume + return r +} +func (r ApiDatacentersServersVolumesPostRequest) Pretty(pretty bool) ApiDatacentersServersVolumesPostRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersServersVolumesPostRequest) Depth(depth int32) ApiDatacentersServersVolumesPostRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersServersVolumesPostRequest) XContractNumber(xContractNumber int32) ApiDatacentersServersVolumesPostRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersServersVolumesPostRequest) Execute() (Volume, *APIResponse, error) { + return r.ApiService.DatacentersServersVolumesPostExecute(r) +} + +/* + * DatacentersServersVolumesPost Attach a volume + * This will attach a pre-existing storage volume to the server. It is also possible to create and attach a volume in one step just by providing a new volume description as payload. Combine count of Nics and volumes attached to the server should not exceed size 24. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the Datacenter + * @param serverId The unique ID of the Server + * @return ApiDatacentersServersVolumesPostRequest + */ +func (a *ServerApiService) DatacentersServersVolumesPost(ctx _context.Context, datacenterId string, serverId string) ApiDatacentersServersVolumesPostRequest { + return ApiDatacentersServersVolumesPostRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + serverId: serverId, + } +} + +/* + * Execute executes the request + * @return Volume + */ +func (a *ServerApiService) DatacentersServersVolumesPostExecute(r ApiDatacentersServersVolumesPostRequest) (Volume, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Volume + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ServerApiService.DatacentersServersVolumesPost") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/volumes" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.volume == nil { + return localVarReturnValue, nil, reportError("volume is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.volume + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersServersVolumesPost", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_snapshot.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_snapshot.go new file mode 100644 index 0000000000..de54e17f14 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_snapshot.go @@ -0,0 +1,838 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" +) + +// Linger please +var ( + _ _context.Context +) + +// SnapshotApiService SnapshotApi service +type SnapshotApiService service + +type ApiSnapshotsDeleteRequest struct { + ctx _context.Context + ApiService *SnapshotApiService + snapshotId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiSnapshotsDeleteRequest) Pretty(pretty bool) ApiSnapshotsDeleteRequest { + r.pretty = &pretty + return r +} +func (r ApiSnapshotsDeleteRequest) Depth(depth int32) ApiSnapshotsDeleteRequest { + r.depth = &depth + return r +} +func (r ApiSnapshotsDeleteRequest) XContractNumber(xContractNumber int32) ApiSnapshotsDeleteRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiSnapshotsDeleteRequest) Execute() (map[string]interface{}, *APIResponse, error) { + return r.ApiService.SnapshotsDeleteExecute(r) +} + +/* + * SnapshotsDelete Delete a Snapshot + * Deletes the specified Snapshot. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param snapshotId The unique ID of the Snapshot + * @return ApiSnapshotsDeleteRequest + */ +func (a *SnapshotApiService) SnapshotsDelete(ctx _context.Context, snapshotId string) ApiSnapshotsDeleteRequest { + return ApiSnapshotsDeleteRequest{ + ApiService: a, + ctx: ctx, + snapshotId: snapshotId, + } +} + +/* + * Execute executes the request + * @return map[string]interface{} + */ +func (a *SnapshotApiService) SnapshotsDeleteExecute(r ApiSnapshotsDeleteRequest) (map[string]interface{}, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SnapshotApiService.SnapshotsDelete") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/snapshots/{snapshotId}" + localVarPath = strings.Replace(localVarPath, "{"+"snapshotId"+"}", _neturl.PathEscape(parameterToString(r.snapshotId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "SnapshotsDelete", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiSnapshotsFindByIdRequest struct { + ctx _context.Context + ApiService *SnapshotApiService + snapshotId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiSnapshotsFindByIdRequest) Pretty(pretty bool) ApiSnapshotsFindByIdRequest { + r.pretty = &pretty + return r +} +func (r ApiSnapshotsFindByIdRequest) Depth(depth int32) ApiSnapshotsFindByIdRequest { + r.depth = &depth + return r +} +func (r ApiSnapshotsFindByIdRequest) XContractNumber(xContractNumber int32) ApiSnapshotsFindByIdRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiSnapshotsFindByIdRequest) Execute() (Snapshot, *APIResponse, error) { + return r.ApiService.SnapshotsFindByIdExecute(r) +} + +/* + * SnapshotsFindById Retrieve a Snapshot by its uuid. + * Retrieves the attributes of a given Snapshot. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param snapshotId The unique ID of the Snapshot + * @return ApiSnapshotsFindByIdRequest + */ +func (a *SnapshotApiService) SnapshotsFindById(ctx _context.Context, snapshotId string) ApiSnapshotsFindByIdRequest { + return ApiSnapshotsFindByIdRequest{ + ApiService: a, + ctx: ctx, + snapshotId: snapshotId, + } +} + +/* + * Execute executes the request + * @return Snapshot + */ +func (a *SnapshotApiService) SnapshotsFindByIdExecute(r ApiSnapshotsFindByIdRequest) (Snapshot, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Snapshot + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SnapshotApiService.SnapshotsFindById") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/snapshots/{snapshotId}" + localVarPath = strings.Replace(localVarPath, "{"+"snapshotId"+"}", _neturl.PathEscape(parameterToString(r.snapshotId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "SnapshotsFindById", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiSnapshotsGetRequest struct { + ctx _context.Context + ApiService *SnapshotApiService + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiSnapshotsGetRequest) Pretty(pretty bool) ApiSnapshotsGetRequest { + r.pretty = &pretty + return r +} +func (r ApiSnapshotsGetRequest) Depth(depth int32) ApiSnapshotsGetRequest { + r.depth = &depth + return r +} +func (r ApiSnapshotsGetRequest) XContractNumber(xContractNumber int32) ApiSnapshotsGetRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiSnapshotsGetRequest) Execute() (Snapshots, *APIResponse, error) { + return r.ApiService.SnapshotsGetExecute(r) +} + +/* + * SnapshotsGet List Snapshots + * Retrieve a list of available snapshots. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiSnapshotsGetRequest + */ +func (a *SnapshotApiService) SnapshotsGet(ctx _context.Context) ApiSnapshotsGetRequest { + return ApiSnapshotsGetRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + * @return Snapshots + */ +func (a *SnapshotApiService) SnapshotsGetExecute(r ApiSnapshotsGetRequest) (Snapshots, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Snapshots + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SnapshotApiService.SnapshotsGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/snapshots" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "SnapshotsGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiSnapshotsPatchRequest struct { + ctx _context.Context + ApiService *SnapshotApiService + snapshotId string + snapshot *SnapshotProperties + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiSnapshotsPatchRequest) Snapshot(snapshot SnapshotProperties) ApiSnapshotsPatchRequest { + r.snapshot = &snapshot + return r +} +func (r ApiSnapshotsPatchRequest) Pretty(pretty bool) ApiSnapshotsPatchRequest { + r.pretty = &pretty + return r +} +func (r ApiSnapshotsPatchRequest) Depth(depth int32) ApiSnapshotsPatchRequest { + r.depth = &depth + return r +} +func (r ApiSnapshotsPatchRequest) XContractNumber(xContractNumber int32) ApiSnapshotsPatchRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiSnapshotsPatchRequest) Execute() (Snapshot, *APIResponse, error) { + return r.ApiService.SnapshotsPatchExecute(r) +} + +/* + * SnapshotsPatch Partially modify a Snapshot + * You can use this method to update attributes of a Snapshot. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param snapshotId The unique ID of the Snapshot + * @return ApiSnapshotsPatchRequest + */ +func (a *SnapshotApiService) SnapshotsPatch(ctx _context.Context, snapshotId string) ApiSnapshotsPatchRequest { + return ApiSnapshotsPatchRequest{ + ApiService: a, + ctx: ctx, + snapshotId: snapshotId, + } +} + +/* + * Execute executes the request + * @return Snapshot + */ +func (a *SnapshotApiService) SnapshotsPatchExecute(r ApiSnapshotsPatchRequest) (Snapshot, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Snapshot + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SnapshotApiService.SnapshotsPatch") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/snapshots/{snapshotId}" + localVarPath = strings.Replace(localVarPath, "{"+"snapshotId"+"}", _neturl.PathEscape(parameterToString(r.snapshotId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.snapshot == nil { + return localVarReturnValue, nil, reportError("snapshot is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.snapshot + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "SnapshotsPatch", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiSnapshotsPutRequest struct { + ctx _context.Context + ApiService *SnapshotApiService + snapshotId string + snapshot *Snapshot + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiSnapshotsPutRequest) Snapshot(snapshot Snapshot) ApiSnapshotsPutRequest { + r.snapshot = &snapshot + return r +} +func (r ApiSnapshotsPutRequest) Pretty(pretty bool) ApiSnapshotsPutRequest { + r.pretty = &pretty + return r +} +func (r ApiSnapshotsPutRequest) Depth(depth int32) ApiSnapshotsPutRequest { + r.depth = &depth + return r +} +func (r ApiSnapshotsPutRequest) XContractNumber(xContractNumber int32) ApiSnapshotsPutRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiSnapshotsPutRequest) Execute() (Snapshot, *APIResponse, error) { + return r.ApiService.SnapshotsPutExecute(r) +} + +/* + * SnapshotsPut Modify a Snapshot + * You can use update attributes of a resource + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param snapshotId The unique ID of the Snapshot + * @return ApiSnapshotsPutRequest + */ +func (a *SnapshotApiService) SnapshotsPut(ctx _context.Context, snapshotId string) ApiSnapshotsPutRequest { + return ApiSnapshotsPutRequest{ + ApiService: a, + ctx: ctx, + snapshotId: snapshotId, + } +} + +/* + * Execute executes the request + * @return Snapshot + */ +func (a *SnapshotApiService) SnapshotsPutExecute(r ApiSnapshotsPutRequest) (Snapshot, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Snapshot + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SnapshotApiService.SnapshotsPut") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/snapshots/{snapshotId}" + localVarPath = strings.Replace(localVarPath, "{"+"snapshotId"+"}", _neturl.PathEscape(parameterToString(r.snapshotId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.snapshot == nil { + return localVarReturnValue, nil, reportError("snapshot is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.snapshot + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "SnapshotsPut", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_user_management.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_user_management.go new file mode 100644 index 0000000000..0d8fd27bfb --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_user_management.go @@ -0,0 +1,4884 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" +) + +// Linger please +var ( + _ _context.Context +) + +// UserManagementApiService UserManagementApi service +type UserManagementApiService service + +type ApiUmGroupsDeleteRequest struct { + ctx _context.Context + ApiService *UserManagementApiService + groupId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiUmGroupsDeleteRequest) Pretty(pretty bool) ApiUmGroupsDeleteRequest { + r.pretty = &pretty + return r +} +func (r ApiUmGroupsDeleteRequest) Depth(depth int32) ApiUmGroupsDeleteRequest { + r.depth = &depth + return r +} +func (r ApiUmGroupsDeleteRequest) XContractNumber(xContractNumber int32) ApiUmGroupsDeleteRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiUmGroupsDeleteRequest) Execute() (map[string]interface{}, *APIResponse, error) { + return r.ApiService.UmGroupsDeleteExecute(r) +} + +/* + * UmGroupsDelete Delete a Group + * Delete a group + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param groupId The unique ID of the group + * @return ApiUmGroupsDeleteRequest + */ +func (a *UserManagementApiService) UmGroupsDelete(ctx _context.Context, groupId string) ApiUmGroupsDeleteRequest { + return ApiUmGroupsDeleteRequest{ + ApiService: a, + ctx: ctx, + groupId: groupId, + } +} + +/* + * Execute executes the request + * @return map[string]interface{} + */ +func (a *UserManagementApiService) UmGroupsDeleteExecute(r ApiUmGroupsDeleteRequest) (map[string]interface{}, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmGroupsDelete") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/um/groups/{groupId}" + localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", _neturl.PathEscape(parameterToString(r.groupId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "UmGroupsDelete", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiUmGroupsFindByIdRequest struct { + ctx _context.Context + ApiService *UserManagementApiService + groupId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiUmGroupsFindByIdRequest) Pretty(pretty bool) ApiUmGroupsFindByIdRequest { + r.pretty = &pretty + return r +} +func (r ApiUmGroupsFindByIdRequest) Depth(depth int32) ApiUmGroupsFindByIdRequest { + r.depth = &depth + return r +} +func (r ApiUmGroupsFindByIdRequest) XContractNumber(xContractNumber int32) ApiUmGroupsFindByIdRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiUmGroupsFindByIdRequest) Execute() (Group, *APIResponse, error) { + return r.ApiService.UmGroupsFindByIdExecute(r) +} + +/* + * UmGroupsFindById Retrieve a Group + * You can retrieve a group by using the group ID. This value can be found in the response body when a group is created or when you GET a list of groups. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param groupId The unique ID of the group + * @return ApiUmGroupsFindByIdRequest + */ +func (a *UserManagementApiService) UmGroupsFindById(ctx _context.Context, groupId string) ApiUmGroupsFindByIdRequest { + return ApiUmGroupsFindByIdRequest{ + ApiService: a, + ctx: ctx, + groupId: groupId, + } +} + +/* + * Execute executes the request + * @return Group + */ +func (a *UserManagementApiService) UmGroupsFindByIdExecute(r ApiUmGroupsFindByIdRequest) (Group, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Group + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmGroupsFindById") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/um/groups/{groupId}" + localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", _neturl.PathEscape(parameterToString(r.groupId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "UmGroupsFindById", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiUmGroupsGetRequest struct { + ctx _context.Context + ApiService *UserManagementApiService + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiUmGroupsGetRequest) Pretty(pretty bool) ApiUmGroupsGetRequest { + r.pretty = &pretty + return r +} +func (r ApiUmGroupsGetRequest) Depth(depth int32) ApiUmGroupsGetRequest { + r.depth = &depth + return r +} +func (r ApiUmGroupsGetRequest) XContractNumber(xContractNumber int32) ApiUmGroupsGetRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiUmGroupsGetRequest) Execute() (Groups, *APIResponse, error) { + return r.ApiService.UmGroupsGetExecute(r) +} + +/* + * UmGroupsGet List All Groups. + * You can retrieve a complete list of all groups that you have access to + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiUmGroupsGetRequest + */ +func (a *UserManagementApiService) UmGroupsGet(ctx _context.Context) ApiUmGroupsGetRequest { + return ApiUmGroupsGetRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + * @return Groups + */ +func (a *UserManagementApiService) UmGroupsGetExecute(r ApiUmGroupsGetRequest) (Groups, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Groups + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmGroupsGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/um/groups" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "UmGroupsGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiUmGroupsPostRequest struct { + ctx _context.Context + ApiService *UserManagementApiService + group *Group + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiUmGroupsPostRequest) Group(group Group) ApiUmGroupsPostRequest { + r.group = &group + return r +} +func (r ApiUmGroupsPostRequest) Pretty(pretty bool) ApiUmGroupsPostRequest { + r.pretty = &pretty + return r +} +func (r ApiUmGroupsPostRequest) Depth(depth int32) ApiUmGroupsPostRequest { + r.depth = &depth + return r +} +func (r ApiUmGroupsPostRequest) XContractNumber(xContractNumber int32) ApiUmGroupsPostRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiUmGroupsPostRequest) Execute() (Group, *APIResponse, error) { + return r.ApiService.UmGroupsPostExecute(r) +} + +/* + * UmGroupsPost Create a Group + * You can use this POST method to create a group + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiUmGroupsPostRequest + */ +func (a *UserManagementApiService) UmGroupsPost(ctx _context.Context) ApiUmGroupsPostRequest { + return ApiUmGroupsPostRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + * @return Group + */ +func (a *UserManagementApiService) UmGroupsPostExecute(r ApiUmGroupsPostRequest) (Group, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Group + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmGroupsPost") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/um/groups" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.group == nil { + return localVarReturnValue, nil, reportError("group is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.group + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "UmGroupsPost", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiUmGroupsPutRequest struct { + ctx _context.Context + ApiService *UserManagementApiService + groupId string + group *Group + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiUmGroupsPutRequest) Group(group Group) ApiUmGroupsPutRequest { + r.group = &group + return r +} +func (r ApiUmGroupsPutRequest) Pretty(pretty bool) ApiUmGroupsPutRequest { + r.pretty = &pretty + return r +} +func (r ApiUmGroupsPutRequest) Depth(depth int32) ApiUmGroupsPutRequest { + r.depth = &depth + return r +} +func (r ApiUmGroupsPutRequest) XContractNumber(xContractNumber int32) ApiUmGroupsPutRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiUmGroupsPutRequest) Execute() (Group, *APIResponse, error) { + return r.ApiService.UmGroupsPutExecute(r) +} + +/* + * UmGroupsPut Modify a group + * You can use this method to update properties of the group. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param groupId The unique ID of the group + * @return ApiUmGroupsPutRequest + */ +func (a *UserManagementApiService) UmGroupsPut(ctx _context.Context, groupId string) ApiUmGroupsPutRequest { + return ApiUmGroupsPutRequest{ + ApiService: a, + ctx: ctx, + groupId: groupId, + } +} + +/* + * Execute executes the request + * @return Group + */ +func (a *UserManagementApiService) UmGroupsPutExecute(r ApiUmGroupsPutRequest) (Group, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Group + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmGroupsPut") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/um/groups/{groupId}" + localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", _neturl.PathEscape(parameterToString(r.groupId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.group == nil { + return localVarReturnValue, nil, reportError("group is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.group + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "UmGroupsPut", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiUmGroupsResourcesGetRequest struct { + ctx _context.Context + ApiService *UserManagementApiService + groupId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiUmGroupsResourcesGetRequest) Pretty(pretty bool) ApiUmGroupsResourcesGetRequest { + r.pretty = &pretty + return r +} +func (r ApiUmGroupsResourcesGetRequest) Depth(depth int32) ApiUmGroupsResourcesGetRequest { + r.depth = &depth + return r +} +func (r ApiUmGroupsResourcesGetRequest) XContractNumber(xContractNumber int32) ApiUmGroupsResourcesGetRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiUmGroupsResourcesGetRequest) Execute() (ResourceGroups, *APIResponse, error) { + return r.ApiService.UmGroupsResourcesGetExecute(r) +} + +/* + * UmGroupsResourcesGet Retrieve resources assigned to a group + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param groupId The unique ID of the group + * @return ApiUmGroupsResourcesGetRequest + */ +func (a *UserManagementApiService) UmGroupsResourcesGet(ctx _context.Context, groupId string) ApiUmGroupsResourcesGetRequest { + return ApiUmGroupsResourcesGetRequest{ + ApiService: a, + ctx: ctx, + groupId: groupId, + } +} + +/* + * Execute executes the request + * @return ResourceGroups + */ +func (a *UserManagementApiService) UmGroupsResourcesGetExecute(r ApiUmGroupsResourcesGetRequest) (ResourceGroups, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ResourceGroups + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmGroupsResourcesGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/um/groups/{groupId}/resources" + localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", _neturl.PathEscape(parameterToString(r.groupId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "UmGroupsResourcesGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiUmGroupsSharesDeleteRequest struct { + ctx _context.Context + ApiService *UserManagementApiService + groupId string + resourceId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiUmGroupsSharesDeleteRequest) Pretty(pretty bool) ApiUmGroupsSharesDeleteRequest { + r.pretty = &pretty + return r +} +func (r ApiUmGroupsSharesDeleteRequest) Depth(depth int32) ApiUmGroupsSharesDeleteRequest { + r.depth = &depth + return r +} +func (r ApiUmGroupsSharesDeleteRequest) XContractNumber(xContractNumber int32) ApiUmGroupsSharesDeleteRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiUmGroupsSharesDeleteRequest) Execute() (map[string]interface{}, *APIResponse, error) { + return r.ApiService.UmGroupsSharesDeleteExecute(r) +} + +/* + * UmGroupsSharesDelete Remove a resource from a group + * This will remove a resource from a group + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param groupId + * @param resourceId + * @return ApiUmGroupsSharesDeleteRequest + */ +func (a *UserManagementApiService) UmGroupsSharesDelete(ctx _context.Context, groupId string, resourceId string) ApiUmGroupsSharesDeleteRequest { + return ApiUmGroupsSharesDeleteRequest{ + ApiService: a, + ctx: ctx, + groupId: groupId, + resourceId: resourceId, + } +} + +/* + * Execute executes the request + * @return map[string]interface{} + */ +func (a *UserManagementApiService) UmGroupsSharesDeleteExecute(r ApiUmGroupsSharesDeleteRequest) (map[string]interface{}, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmGroupsSharesDelete") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/um/groups/{groupId}/shares/{resourceId}" + localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", _neturl.PathEscape(parameterToString(r.groupId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"resourceId"+"}", _neturl.PathEscape(parameterToString(r.resourceId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "UmGroupsSharesDelete", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiUmGroupsSharesFindByResourceRequest struct { + ctx _context.Context + ApiService *UserManagementApiService + groupId string + resourceId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiUmGroupsSharesFindByResourceRequest) Pretty(pretty bool) ApiUmGroupsSharesFindByResourceRequest { + r.pretty = &pretty + return r +} +func (r ApiUmGroupsSharesFindByResourceRequest) Depth(depth int32) ApiUmGroupsSharesFindByResourceRequest { + r.depth = &depth + return r +} +func (r ApiUmGroupsSharesFindByResourceRequest) XContractNumber(xContractNumber int32) ApiUmGroupsSharesFindByResourceRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiUmGroupsSharesFindByResourceRequest) Execute() (GroupShare, *APIResponse, error) { + return r.ApiService.UmGroupsSharesFindByResourceExecute(r) +} + +/* + * UmGroupsSharesFindByResource Retrieve a group share + * This will retrieve the properties of a group share. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param groupId + * @param resourceId + * @return ApiUmGroupsSharesFindByResourceRequest + */ +func (a *UserManagementApiService) UmGroupsSharesFindByResource(ctx _context.Context, groupId string, resourceId string) ApiUmGroupsSharesFindByResourceRequest { + return ApiUmGroupsSharesFindByResourceRequest{ + ApiService: a, + ctx: ctx, + groupId: groupId, + resourceId: resourceId, + } +} + +/* + * Execute executes the request + * @return GroupShare + */ +func (a *UserManagementApiService) UmGroupsSharesFindByResourceExecute(r ApiUmGroupsSharesFindByResourceRequest) (GroupShare, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue GroupShare + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmGroupsSharesFindByResource") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/um/groups/{groupId}/shares/{resourceId}" + localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", _neturl.PathEscape(parameterToString(r.groupId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"resourceId"+"}", _neturl.PathEscape(parameterToString(r.resourceId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "UmGroupsSharesFindByResource", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiUmGroupsSharesGetRequest struct { + ctx _context.Context + ApiService *UserManagementApiService + groupId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiUmGroupsSharesGetRequest) Pretty(pretty bool) ApiUmGroupsSharesGetRequest { + r.pretty = &pretty + return r +} +func (r ApiUmGroupsSharesGetRequest) Depth(depth int32) ApiUmGroupsSharesGetRequest { + r.depth = &depth + return r +} +func (r ApiUmGroupsSharesGetRequest) XContractNumber(xContractNumber int32) ApiUmGroupsSharesGetRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiUmGroupsSharesGetRequest) Execute() (GroupShares, *APIResponse, error) { + return r.ApiService.UmGroupsSharesGetExecute(r) +} + +/* + * UmGroupsSharesGet List Group Shares + * You can retrieve a list of all resources along with their permissions of the group + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param groupId + * @return ApiUmGroupsSharesGetRequest + */ +func (a *UserManagementApiService) UmGroupsSharesGet(ctx _context.Context, groupId string) ApiUmGroupsSharesGetRequest { + return ApiUmGroupsSharesGetRequest{ + ApiService: a, + ctx: ctx, + groupId: groupId, + } +} + +/* + * Execute executes the request + * @return GroupShares + */ +func (a *UserManagementApiService) UmGroupsSharesGetExecute(r ApiUmGroupsSharesGetRequest) (GroupShares, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue GroupShares + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmGroupsSharesGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/um/groups/{groupId}/shares" + localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", _neturl.PathEscape(parameterToString(r.groupId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "UmGroupsSharesGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiUmGroupsSharesPostRequest struct { + ctx _context.Context + ApiService *UserManagementApiService + groupId string + resourceId string + resource *GroupShare + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiUmGroupsSharesPostRequest) Resource(resource GroupShare) ApiUmGroupsSharesPostRequest { + r.resource = &resource + return r +} +func (r ApiUmGroupsSharesPostRequest) Pretty(pretty bool) ApiUmGroupsSharesPostRequest { + r.pretty = &pretty + return r +} +func (r ApiUmGroupsSharesPostRequest) Depth(depth int32) ApiUmGroupsSharesPostRequest { + r.depth = &depth + return r +} +func (r ApiUmGroupsSharesPostRequest) XContractNumber(xContractNumber int32) ApiUmGroupsSharesPostRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiUmGroupsSharesPostRequest) Execute() (GroupShare, *APIResponse, error) { + return r.ApiService.UmGroupsSharesPostExecute(r) +} + +/* + * UmGroupsSharesPost Add a resource to a group + * This will add a resource to the group. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param groupId + * @param resourceId + * @return ApiUmGroupsSharesPostRequest + */ +func (a *UserManagementApiService) UmGroupsSharesPost(ctx _context.Context, groupId string, resourceId string) ApiUmGroupsSharesPostRequest { + return ApiUmGroupsSharesPostRequest{ + ApiService: a, + ctx: ctx, + groupId: groupId, + resourceId: resourceId, + } +} + +/* + * Execute executes the request + * @return GroupShare + */ +func (a *UserManagementApiService) UmGroupsSharesPostExecute(r ApiUmGroupsSharesPostRequest) (GroupShare, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue GroupShare + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmGroupsSharesPost") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/um/groups/{groupId}/shares/{resourceId}" + localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", _neturl.PathEscape(parameterToString(r.groupId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"resourceId"+"}", _neturl.PathEscape(parameterToString(r.resourceId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.resource == nil { + return localVarReturnValue, nil, reportError("resource is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.resource + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "UmGroupsSharesPost", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiUmGroupsSharesPutRequest struct { + ctx _context.Context + ApiService *UserManagementApiService + groupId string + resourceId string + resource *GroupShare + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiUmGroupsSharesPutRequest) Resource(resource GroupShare) ApiUmGroupsSharesPutRequest { + r.resource = &resource + return r +} +func (r ApiUmGroupsSharesPutRequest) Pretty(pretty bool) ApiUmGroupsSharesPutRequest { + r.pretty = &pretty + return r +} +func (r ApiUmGroupsSharesPutRequest) Depth(depth int32) ApiUmGroupsSharesPutRequest { + r.depth = &depth + return r +} +func (r ApiUmGroupsSharesPutRequest) XContractNumber(xContractNumber int32) ApiUmGroupsSharesPutRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiUmGroupsSharesPutRequest) Execute() (GroupShare, *APIResponse, error) { + return r.ApiService.UmGroupsSharesPutExecute(r) +} + +/* + * UmGroupsSharesPut Modify resource permissions of a group + * You can use update resource permissions of a group. If empty body will be provided, no updates will happen, instead you will be returned the current permissions of resource in a group. In this case response code will be 200 + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param groupId + * @param resourceId + * @return ApiUmGroupsSharesPutRequest + */ +func (a *UserManagementApiService) UmGroupsSharesPut(ctx _context.Context, groupId string, resourceId string) ApiUmGroupsSharesPutRequest { + return ApiUmGroupsSharesPutRequest{ + ApiService: a, + ctx: ctx, + groupId: groupId, + resourceId: resourceId, + } +} + +/* + * Execute executes the request + * @return GroupShare + */ +func (a *UserManagementApiService) UmGroupsSharesPutExecute(r ApiUmGroupsSharesPutRequest) (GroupShare, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue GroupShare + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmGroupsSharesPut") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/um/groups/{groupId}/shares/{resourceId}" + localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", _neturl.PathEscape(parameterToString(r.groupId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"resourceId"+"}", _neturl.PathEscape(parameterToString(r.resourceId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.resource == nil { + return localVarReturnValue, nil, reportError("resource is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.resource + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "UmGroupsSharesPut", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiUmGroupsUsersDeleteRequest struct { + ctx _context.Context + ApiService *UserManagementApiService + groupId string + userId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiUmGroupsUsersDeleteRequest) Pretty(pretty bool) ApiUmGroupsUsersDeleteRequest { + r.pretty = &pretty + return r +} +func (r ApiUmGroupsUsersDeleteRequest) Depth(depth int32) ApiUmGroupsUsersDeleteRequest { + r.depth = &depth + return r +} +func (r ApiUmGroupsUsersDeleteRequest) XContractNumber(xContractNumber int32) ApiUmGroupsUsersDeleteRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiUmGroupsUsersDeleteRequest) Execute() (map[string]interface{}, *APIResponse, error) { + return r.ApiService.UmGroupsUsersDeleteExecute(r) +} + +/* + * UmGroupsUsersDelete Remove a user from a group + * This will remove a user from a group + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param groupId + * @param userId + * @return ApiUmGroupsUsersDeleteRequest + */ +func (a *UserManagementApiService) UmGroupsUsersDelete(ctx _context.Context, groupId string, userId string) ApiUmGroupsUsersDeleteRequest { + return ApiUmGroupsUsersDeleteRequest{ + ApiService: a, + ctx: ctx, + groupId: groupId, + userId: userId, + } +} + +/* + * Execute executes the request + * @return map[string]interface{} + */ +func (a *UserManagementApiService) UmGroupsUsersDeleteExecute(r ApiUmGroupsUsersDeleteRequest) (map[string]interface{}, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmGroupsUsersDelete") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/um/groups/{groupId}/users/{userId}" + localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", _neturl.PathEscape(parameterToString(r.groupId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", _neturl.PathEscape(parameterToString(r.userId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "UmGroupsUsersDelete", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiUmGroupsUsersGetRequest struct { + ctx _context.Context + ApiService *UserManagementApiService + groupId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiUmGroupsUsersGetRequest) Pretty(pretty bool) ApiUmGroupsUsersGetRequest { + r.pretty = &pretty + return r +} +func (r ApiUmGroupsUsersGetRequest) Depth(depth int32) ApiUmGroupsUsersGetRequest { + r.depth = &depth + return r +} +func (r ApiUmGroupsUsersGetRequest) XContractNumber(xContractNumber int32) ApiUmGroupsUsersGetRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiUmGroupsUsersGetRequest) Execute() (GroupMembers, *APIResponse, error) { + return r.ApiService.UmGroupsUsersGetExecute(r) +} + +/* + * UmGroupsUsersGet List Group Members + * You can retrieve a list of users who are members of the group + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param groupId + * @return ApiUmGroupsUsersGetRequest + */ +func (a *UserManagementApiService) UmGroupsUsersGet(ctx _context.Context, groupId string) ApiUmGroupsUsersGetRequest { + return ApiUmGroupsUsersGetRequest{ + ApiService: a, + ctx: ctx, + groupId: groupId, + } +} + +/* + * Execute executes the request + * @return GroupMembers + */ +func (a *UserManagementApiService) UmGroupsUsersGetExecute(r ApiUmGroupsUsersGetRequest) (GroupMembers, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue GroupMembers + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmGroupsUsersGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/um/groups/{groupId}/users" + localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", _neturl.PathEscape(parameterToString(r.groupId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "UmGroupsUsersGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiUmGroupsUsersPostRequest struct { + ctx _context.Context + ApiService *UserManagementApiService + groupId string + user *User + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiUmGroupsUsersPostRequest) User(user User) ApiUmGroupsUsersPostRequest { + r.user = &user + return r +} +func (r ApiUmGroupsUsersPostRequest) Pretty(pretty bool) ApiUmGroupsUsersPostRequest { + r.pretty = &pretty + return r +} +func (r ApiUmGroupsUsersPostRequest) Depth(depth int32) ApiUmGroupsUsersPostRequest { + r.depth = &depth + return r +} +func (r ApiUmGroupsUsersPostRequest) XContractNumber(xContractNumber int32) ApiUmGroupsUsersPostRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiUmGroupsUsersPostRequest) Execute() (User, *APIResponse, error) { + return r.ApiService.UmGroupsUsersPostExecute(r) +} + +/* + * UmGroupsUsersPost Add a user to a group + * This will attach a pre-existing user to a group. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param groupId + * @return ApiUmGroupsUsersPostRequest + */ +func (a *UserManagementApiService) UmGroupsUsersPost(ctx _context.Context, groupId string) ApiUmGroupsUsersPostRequest { + return ApiUmGroupsUsersPostRequest{ + ApiService: a, + ctx: ctx, + groupId: groupId, + } +} + +/* + * Execute executes the request + * @return User + */ +func (a *UserManagementApiService) UmGroupsUsersPostExecute(r ApiUmGroupsUsersPostRequest) (User, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue User + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmGroupsUsersPost") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/um/groups/{groupId}/users" + localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", _neturl.PathEscape(parameterToString(r.groupId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.user == nil { + return localVarReturnValue, nil, reportError("user is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.user + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "UmGroupsUsersPost", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiUmResourcesFindByTypeRequest struct { + ctx _context.Context + ApiService *UserManagementApiService + resourceType string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiUmResourcesFindByTypeRequest) Pretty(pretty bool) ApiUmResourcesFindByTypeRequest { + r.pretty = &pretty + return r +} +func (r ApiUmResourcesFindByTypeRequest) Depth(depth int32) ApiUmResourcesFindByTypeRequest { + r.depth = &depth + return r +} +func (r ApiUmResourcesFindByTypeRequest) XContractNumber(xContractNumber int32) ApiUmResourcesFindByTypeRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiUmResourcesFindByTypeRequest) Execute() (Resources, *APIResponse, error) { + return r.ApiService.UmResourcesFindByTypeExecute(r) +} + +/* + * UmResourcesFindByType Retrieve a list of Resources by type. + * You can retrieve a list of resources by using the type. Allowed values are { datacenter, snapshot, image, ipblock, pcc, backupunit, k8s }. This value of resource type also be found in the response body when you GET a list of all resources. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param resourceType The resource Type + * @return ApiUmResourcesFindByTypeRequest + */ +func (a *UserManagementApiService) UmResourcesFindByType(ctx _context.Context, resourceType string) ApiUmResourcesFindByTypeRequest { + return ApiUmResourcesFindByTypeRequest{ + ApiService: a, + ctx: ctx, + resourceType: resourceType, + } +} + +/* + * Execute executes the request + * @return Resources + */ +func (a *UserManagementApiService) UmResourcesFindByTypeExecute(r ApiUmResourcesFindByTypeRequest) (Resources, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Resources + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmResourcesFindByType") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/um/resources/{resourceType}" + localVarPath = strings.Replace(localVarPath, "{"+"resourceType"+"}", _neturl.PathEscape(parameterToString(r.resourceType, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "UmResourcesFindByType", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiUmResourcesFindByTypeAndIdRequest struct { + ctx _context.Context + ApiService *UserManagementApiService + resourceType string + resourceId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiUmResourcesFindByTypeAndIdRequest) Pretty(pretty bool) ApiUmResourcesFindByTypeAndIdRequest { + r.pretty = &pretty + return r +} +func (r ApiUmResourcesFindByTypeAndIdRequest) Depth(depth int32) ApiUmResourcesFindByTypeAndIdRequest { + r.depth = &depth + return r +} +func (r ApiUmResourcesFindByTypeAndIdRequest) XContractNumber(xContractNumber int32) ApiUmResourcesFindByTypeAndIdRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiUmResourcesFindByTypeAndIdRequest) Execute() (Resource, *APIResponse, error) { + return r.ApiService.UmResourcesFindByTypeAndIdExecute(r) +} + +/* + * UmResourcesFindByTypeAndId Retrieve a Resource by type. + * You can retrieve a resource by using the type and its uuid. Allowed values for types are { datacenter, snapshot, image, ipblock, pcc, backupunit, k8s }. The value of resource type can also be found in the response body when you GET a list of all resources. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param resourceType The resource Type + * @param resourceId The resource Uuid + * @return ApiUmResourcesFindByTypeAndIdRequest + */ +func (a *UserManagementApiService) UmResourcesFindByTypeAndId(ctx _context.Context, resourceType string, resourceId string) ApiUmResourcesFindByTypeAndIdRequest { + return ApiUmResourcesFindByTypeAndIdRequest{ + ApiService: a, + ctx: ctx, + resourceType: resourceType, + resourceId: resourceId, + } +} + +/* + * Execute executes the request + * @return Resource + */ +func (a *UserManagementApiService) UmResourcesFindByTypeAndIdExecute(r ApiUmResourcesFindByTypeAndIdRequest) (Resource, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Resource + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmResourcesFindByTypeAndId") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/um/resources/{resourceType}/{resourceId}" + localVarPath = strings.Replace(localVarPath, "{"+"resourceType"+"}", _neturl.PathEscape(parameterToString(r.resourceType, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"resourceId"+"}", _neturl.PathEscape(parameterToString(r.resourceId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "UmResourcesFindByTypeAndId", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiUmResourcesGetRequest struct { + ctx _context.Context + ApiService *UserManagementApiService + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiUmResourcesGetRequest) Pretty(pretty bool) ApiUmResourcesGetRequest { + r.pretty = &pretty + return r +} +func (r ApiUmResourcesGetRequest) Depth(depth int32) ApiUmResourcesGetRequest { + r.depth = &depth + return r +} +func (r ApiUmResourcesGetRequest) XContractNumber(xContractNumber int32) ApiUmResourcesGetRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiUmResourcesGetRequest) Execute() (Resources, *APIResponse, error) { + return r.ApiService.UmResourcesGetExecute(r) +} + +/* + * UmResourcesGet List All Resources. + * You can retrieve a complete list of all resources that you have access to + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiUmResourcesGetRequest + */ +func (a *UserManagementApiService) UmResourcesGet(ctx _context.Context) ApiUmResourcesGetRequest { + return ApiUmResourcesGetRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + * @return Resources + */ +func (a *UserManagementApiService) UmResourcesGetExecute(r ApiUmResourcesGetRequest) (Resources, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Resources + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmResourcesGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/um/resources" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "UmResourcesGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiUmUsersDeleteRequest struct { + ctx _context.Context + ApiService *UserManagementApiService + userId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiUmUsersDeleteRequest) Pretty(pretty bool) ApiUmUsersDeleteRequest { + r.pretty = &pretty + return r +} +func (r ApiUmUsersDeleteRequest) Depth(depth int32) ApiUmUsersDeleteRequest { + r.depth = &depth + return r +} +func (r ApiUmUsersDeleteRequest) XContractNumber(xContractNumber int32) ApiUmUsersDeleteRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiUmUsersDeleteRequest) Execute() (map[string]interface{}, *APIResponse, error) { + return r.ApiService.UmUsersDeleteExecute(r) +} + +/* + * UmUsersDelete Delete a User + * Delete a user + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param userId The unique ID of the user + * @return ApiUmUsersDeleteRequest + */ +func (a *UserManagementApiService) UmUsersDelete(ctx _context.Context, userId string) ApiUmUsersDeleteRequest { + return ApiUmUsersDeleteRequest{ + ApiService: a, + ctx: ctx, + userId: userId, + } +} + +/* + * Execute executes the request + * @return map[string]interface{} + */ +func (a *UserManagementApiService) UmUsersDeleteExecute(r ApiUmUsersDeleteRequest) (map[string]interface{}, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmUsersDelete") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/um/users/{userId}" + localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", _neturl.PathEscape(parameterToString(r.userId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "UmUsersDelete", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiUmUsersFindByIdRequest struct { + ctx _context.Context + ApiService *UserManagementApiService + userId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiUmUsersFindByIdRequest) Pretty(pretty bool) ApiUmUsersFindByIdRequest { + r.pretty = &pretty + return r +} +func (r ApiUmUsersFindByIdRequest) Depth(depth int32) ApiUmUsersFindByIdRequest { + r.depth = &depth + return r +} +func (r ApiUmUsersFindByIdRequest) XContractNumber(xContractNumber int32) ApiUmUsersFindByIdRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiUmUsersFindByIdRequest) Execute() (User, *APIResponse, error) { + return r.ApiService.UmUsersFindByIdExecute(r) +} + +/* + * UmUsersFindById Retrieve a User + * You can retrieve user details by using the users ID. This value can be found in the response body when a user is created or when you GET a list of users. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param userId The unique ID of the user + * @return ApiUmUsersFindByIdRequest + */ +func (a *UserManagementApiService) UmUsersFindById(ctx _context.Context, userId string) ApiUmUsersFindByIdRequest { + return ApiUmUsersFindByIdRequest{ + ApiService: a, + ctx: ctx, + userId: userId, + } +} + +/* + * Execute executes the request + * @return User + */ +func (a *UserManagementApiService) UmUsersFindByIdExecute(r ApiUmUsersFindByIdRequest) (User, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue User + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmUsersFindById") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/um/users/{userId}" + localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", _neturl.PathEscape(parameterToString(r.userId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "UmUsersFindById", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiUmUsersGetRequest struct { + ctx _context.Context + ApiService *UserManagementApiService + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiUmUsersGetRequest) Pretty(pretty bool) ApiUmUsersGetRequest { + r.pretty = &pretty + return r +} +func (r ApiUmUsersGetRequest) Depth(depth int32) ApiUmUsersGetRequest { + r.depth = &depth + return r +} +func (r ApiUmUsersGetRequest) XContractNumber(xContractNumber int32) ApiUmUsersGetRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiUmUsersGetRequest) Execute() (Users, *APIResponse, error) { + return r.ApiService.UmUsersGetExecute(r) +} + +/* + * UmUsersGet List all Users + * You can retrieve a complete list of users under your account + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiUmUsersGetRequest + */ +func (a *UserManagementApiService) UmUsersGet(ctx _context.Context) ApiUmUsersGetRequest { + return ApiUmUsersGetRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + * @return Users + */ +func (a *UserManagementApiService) UmUsersGetExecute(r ApiUmUsersGetRequest) (Users, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Users + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmUsersGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/um/users" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "UmUsersGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiUmUsersGroupsGetRequest struct { + ctx _context.Context + ApiService *UserManagementApiService + userId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiUmUsersGroupsGetRequest) Pretty(pretty bool) ApiUmUsersGroupsGetRequest { + r.pretty = &pretty + return r +} +func (r ApiUmUsersGroupsGetRequest) Depth(depth int32) ApiUmUsersGroupsGetRequest { + r.depth = &depth + return r +} +func (r ApiUmUsersGroupsGetRequest) XContractNumber(xContractNumber int32) ApiUmUsersGroupsGetRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiUmUsersGroupsGetRequest) Execute() (ResourceGroups, *APIResponse, error) { + return r.ApiService.UmUsersGroupsGetExecute(r) +} + +/* + * UmUsersGroupsGet Retrieve a User's group resources + * You can retrieve group resources of user by using the users ID. This value can be found in the response body when a user is created or when you GET a list of users. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param userId The unique ID of the user + * @return ApiUmUsersGroupsGetRequest + */ +func (a *UserManagementApiService) UmUsersGroupsGet(ctx _context.Context, userId string) ApiUmUsersGroupsGetRequest { + return ApiUmUsersGroupsGetRequest{ + ApiService: a, + ctx: ctx, + userId: userId, + } +} + +/* + * Execute executes the request + * @return ResourceGroups + */ +func (a *UserManagementApiService) UmUsersGroupsGetExecute(r ApiUmUsersGroupsGetRequest) (ResourceGroups, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ResourceGroups + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmUsersGroupsGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/um/users/{userId}/groups" + localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", _neturl.PathEscape(parameterToString(r.userId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "UmUsersGroupsGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiUmUsersOwnsGetRequest struct { + ctx _context.Context + ApiService *UserManagementApiService + userId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiUmUsersOwnsGetRequest) Pretty(pretty bool) ApiUmUsersOwnsGetRequest { + r.pretty = &pretty + return r +} +func (r ApiUmUsersOwnsGetRequest) Depth(depth int32) ApiUmUsersOwnsGetRequest { + r.depth = &depth + return r +} +func (r ApiUmUsersOwnsGetRequest) XContractNumber(xContractNumber int32) ApiUmUsersOwnsGetRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiUmUsersOwnsGetRequest) Execute() (ResourcesUsers, *APIResponse, error) { + return r.ApiService.UmUsersOwnsGetExecute(r) +} + +/* + * UmUsersOwnsGet Retrieve a User's own resources + * You can retrieve resources owned by using the users ID. This value can be found in the response body when a user is created or when you GET a list of users. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param userId The unique ID of the user + * @return ApiUmUsersOwnsGetRequest + */ +func (a *UserManagementApiService) UmUsersOwnsGet(ctx _context.Context, userId string) ApiUmUsersOwnsGetRequest { + return ApiUmUsersOwnsGetRequest{ + ApiService: a, + ctx: ctx, + userId: userId, + } +} + +/* + * Execute executes the request + * @return ResourcesUsers + */ +func (a *UserManagementApiService) UmUsersOwnsGetExecute(r ApiUmUsersOwnsGetRequest) (ResourcesUsers, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ResourcesUsers + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmUsersOwnsGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/um/users/{userId}/owns" + localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", _neturl.PathEscape(parameterToString(r.userId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "UmUsersOwnsGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiUmUsersPostRequest struct { + ctx _context.Context + ApiService *UserManagementApiService + user *User + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiUmUsersPostRequest) User(user User) ApiUmUsersPostRequest { + r.user = &user + return r +} +func (r ApiUmUsersPostRequest) Pretty(pretty bool) ApiUmUsersPostRequest { + r.pretty = &pretty + return r +} +func (r ApiUmUsersPostRequest) Depth(depth int32) ApiUmUsersPostRequest { + r.depth = &depth + return r +} +func (r ApiUmUsersPostRequest) XContractNumber(xContractNumber int32) ApiUmUsersPostRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiUmUsersPostRequest) Execute() (User, *APIResponse, error) { + return r.ApiService.UmUsersPostExecute(r) +} + +/* + * UmUsersPost Create a user + * You can use this POST method to create a user + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiUmUsersPostRequest + */ +func (a *UserManagementApiService) UmUsersPost(ctx _context.Context) ApiUmUsersPostRequest { + return ApiUmUsersPostRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + * @return User + */ +func (a *UserManagementApiService) UmUsersPostExecute(r ApiUmUsersPostRequest) (User, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue User + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmUsersPost") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/um/users" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.user == nil { + return localVarReturnValue, nil, reportError("user is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.user + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "UmUsersPost", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiUmUsersPutRequest struct { + ctx _context.Context + ApiService *UserManagementApiService + userId string + user *User + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiUmUsersPutRequest) User(user User) ApiUmUsersPutRequest { + r.user = &user + return r +} +func (r ApiUmUsersPutRequest) Pretty(pretty bool) ApiUmUsersPutRequest { + r.pretty = &pretty + return r +} +func (r ApiUmUsersPutRequest) Depth(depth int32) ApiUmUsersPutRequest { + r.depth = &depth + return r +} +func (r ApiUmUsersPutRequest) XContractNumber(xContractNumber int32) ApiUmUsersPutRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiUmUsersPutRequest) Execute() (User, *APIResponse, error) { + return r.ApiService.UmUsersPutExecute(r) +} + +/* + * UmUsersPut Modify a user + * You can use update attributes of a User + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param userId + * @return ApiUmUsersPutRequest + */ +func (a *UserManagementApiService) UmUsersPut(ctx _context.Context, userId string) ApiUmUsersPutRequest { + return ApiUmUsersPutRequest{ + ApiService: a, + ctx: ctx, + userId: userId, + } +} + +/* + * Execute executes the request + * @return User + */ +func (a *UserManagementApiService) UmUsersPutExecute(r ApiUmUsersPutRequest) (User, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue User + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmUsersPut") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/um/users/{userId}" + localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", _neturl.PathEscape(parameterToString(r.userId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.user == nil { + return localVarReturnValue, nil, reportError("user is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.user + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "UmUsersPut", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiUmUsersS3keysDeleteRequest struct { + ctx _context.Context + ApiService *UserManagementApiService + userId string + keyId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiUmUsersS3keysDeleteRequest) Pretty(pretty bool) ApiUmUsersS3keysDeleteRequest { + r.pretty = &pretty + return r +} +func (r ApiUmUsersS3keysDeleteRequest) Depth(depth int32) ApiUmUsersS3keysDeleteRequest { + r.depth = &depth + return r +} +func (r ApiUmUsersS3keysDeleteRequest) XContractNumber(xContractNumber int32) ApiUmUsersS3keysDeleteRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiUmUsersS3keysDeleteRequest) Execute() (map[string]interface{}, *APIResponse, error) { + return r.ApiService.UmUsersS3keysDeleteExecute(r) +} + +/* + * UmUsersS3keysDelete Delete a S3 key + * Delete a S3 key + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param userId The unique ID of the user + * @param keyId The unique access key ID of the S3 key + * @return ApiUmUsersS3keysDeleteRequest + */ +func (a *UserManagementApiService) UmUsersS3keysDelete(ctx _context.Context, userId string, keyId string) ApiUmUsersS3keysDeleteRequest { + return ApiUmUsersS3keysDeleteRequest{ + ApiService: a, + ctx: ctx, + userId: userId, + keyId: keyId, + } +} + +/* + * Execute executes the request + * @return map[string]interface{} + */ +func (a *UserManagementApiService) UmUsersS3keysDeleteExecute(r ApiUmUsersS3keysDeleteRequest) (map[string]interface{}, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmUsersS3keysDelete") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/um/users/{userId}/s3keys/{keyId}" + localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", _neturl.PathEscape(parameterToString(r.userId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", _neturl.PathEscape(parameterToString(r.keyId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "UmUsersS3keysDelete", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiUmUsersS3keysFindByKeyRequest struct { + ctx _context.Context + ApiService *UserManagementApiService + userId string + keyId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiUmUsersS3keysFindByKeyRequest) Pretty(pretty bool) ApiUmUsersS3keysFindByKeyRequest { + r.pretty = &pretty + return r +} +func (r ApiUmUsersS3keysFindByKeyRequest) Depth(depth int32) ApiUmUsersS3keysFindByKeyRequest { + r.depth = &depth + return r +} +func (r ApiUmUsersS3keysFindByKeyRequest) XContractNumber(xContractNumber int32) ApiUmUsersS3keysFindByKeyRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiUmUsersS3keysFindByKeyRequest) Execute() (S3Key, *APIResponse, error) { + return r.ApiService.UmUsersS3keysFindByKeyExecute(r) +} + +/* + * UmUsersS3keysFindByKey Retrieve given S3 key belonging to the given User + * You can retrieve S3 key belonging to the given User. This user Id can be found in the response body when a user is created or when you GET a list of users. The key Id can be found in the response body when a S3 key is created or when you GET a list of all S3 keys of a user + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param userId The unique ID of the user + * @param keyId The unique access key ID of the S3 key + * @return ApiUmUsersS3keysFindByKeyRequest + */ +func (a *UserManagementApiService) UmUsersS3keysFindByKey(ctx _context.Context, userId string, keyId string) ApiUmUsersS3keysFindByKeyRequest { + return ApiUmUsersS3keysFindByKeyRequest{ + ApiService: a, + ctx: ctx, + userId: userId, + keyId: keyId, + } +} + +/* + * Execute executes the request + * @return S3Key + */ +func (a *UserManagementApiService) UmUsersS3keysFindByKeyExecute(r ApiUmUsersS3keysFindByKeyRequest) (S3Key, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue S3Key + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmUsersS3keysFindByKey") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/um/users/{userId}/s3keys/{keyId}" + localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", _neturl.PathEscape(parameterToString(r.userId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", _neturl.PathEscape(parameterToString(r.keyId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "UmUsersS3keysFindByKey", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiUmUsersS3keysGetRequest struct { + ctx _context.Context + ApiService *UserManagementApiService + userId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiUmUsersS3keysGetRequest) Pretty(pretty bool) ApiUmUsersS3keysGetRequest { + r.pretty = &pretty + return r +} +func (r ApiUmUsersS3keysGetRequest) Depth(depth int32) ApiUmUsersS3keysGetRequest { + r.depth = &depth + return r +} +func (r ApiUmUsersS3keysGetRequest) XContractNumber(xContractNumber int32) ApiUmUsersS3keysGetRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiUmUsersS3keysGetRequest) Execute() (S3Keys, *APIResponse, error) { + return r.ApiService.UmUsersS3keysGetExecute(r) +} + +/* + * UmUsersS3keysGet Retrieve a User's S3 keys + * You can retrieve S3 keys owned by a user by using the users ID. This user Id can be found in the response body when a user is created or when you GET a list of users. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param userId The unique ID of the user + * @return ApiUmUsersS3keysGetRequest + */ +func (a *UserManagementApiService) UmUsersS3keysGet(ctx _context.Context, userId string) ApiUmUsersS3keysGetRequest { + return ApiUmUsersS3keysGetRequest{ + ApiService: a, + ctx: ctx, + userId: userId, + } +} + +/* + * Execute executes the request + * @return S3Keys + */ +func (a *UserManagementApiService) UmUsersS3keysGetExecute(r ApiUmUsersS3keysGetRequest) (S3Keys, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue S3Keys + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmUsersS3keysGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/um/users/{userId}/s3keys" + localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", _neturl.PathEscape(parameterToString(r.userId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "UmUsersS3keysGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiUmUsersS3keysPostRequest struct { + ctx _context.Context + ApiService *UserManagementApiService + userId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiUmUsersS3keysPostRequest) Pretty(pretty bool) ApiUmUsersS3keysPostRequest { + r.pretty = &pretty + return r +} +func (r ApiUmUsersS3keysPostRequest) Depth(depth int32) ApiUmUsersS3keysPostRequest { + r.depth = &depth + return r +} +func (r ApiUmUsersS3keysPostRequest) XContractNumber(xContractNumber int32) ApiUmUsersS3keysPostRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiUmUsersS3keysPostRequest) Execute() (S3Key, *APIResponse, error) { + return r.ApiService.UmUsersS3keysPostExecute(r) +} + +/* + * UmUsersS3keysPost Create a S3 key for the given user + * Creates a S3 key for the given user. This user Id can be found in the response body when a user is created or when you GET a list of users. Maximum of 5 keys can be generated for a given user + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param userId The unique ID of the user + * @return ApiUmUsersS3keysPostRequest + */ +func (a *UserManagementApiService) UmUsersS3keysPost(ctx _context.Context, userId string) ApiUmUsersS3keysPostRequest { + return ApiUmUsersS3keysPostRequest{ + ApiService: a, + ctx: ctx, + userId: userId, + } +} + +/* + * Execute executes the request + * @return S3Key + */ +func (a *UserManagementApiService) UmUsersS3keysPostExecute(r ApiUmUsersS3keysPostRequest) (S3Key, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue S3Key + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmUsersS3keysPost") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/um/users/{userId}/s3keys" + localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", _neturl.PathEscape(parameterToString(r.userId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "UmUsersS3keysPost", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiUmUsersS3keysPutRequest struct { + ctx _context.Context + ApiService *UserManagementApiService + userId string + keyId string + s3Key *S3Key + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiUmUsersS3keysPutRequest) S3Key(s3Key S3Key) ApiUmUsersS3keysPutRequest { + r.s3Key = &s3Key + return r +} +func (r ApiUmUsersS3keysPutRequest) Pretty(pretty bool) ApiUmUsersS3keysPutRequest { + r.pretty = &pretty + return r +} +func (r ApiUmUsersS3keysPutRequest) Depth(depth int32) ApiUmUsersS3keysPutRequest { + r.depth = &depth + return r +} +func (r ApiUmUsersS3keysPutRequest) XContractNumber(xContractNumber int32) ApiUmUsersS3keysPutRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiUmUsersS3keysPutRequest) Execute() (S3Key, *APIResponse, error) { + return r.ApiService.UmUsersS3keysPutExecute(r) +} + +/* + * UmUsersS3keysPut Modify a S3 key having the given key id + * You can enable or disable a given S3 key + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param userId + * @param keyId The unique access key ID of the S3 key + * @return ApiUmUsersS3keysPutRequest + */ +func (a *UserManagementApiService) UmUsersS3keysPut(ctx _context.Context, userId string, keyId string) ApiUmUsersS3keysPutRequest { + return ApiUmUsersS3keysPutRequest{ + ApiService: a, + ctx: ctx, + userId: userId, + keyId: keyId, + } +} + +/* + * Execute executes the request + * @return S3Key + */ +func (a *UserManagementApiService) UmUsersS3keysPutExecute(r ApiUmUsersS3keysPutRequest) (S3Key, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue S3Key + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmUsersS3keysPut") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/um/users/{userId}/s3keys/{keyId}" + localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", _neturl.PathEscape(parameterToString(r.userId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", _neturl.PathEscape(parameterToString(r.keyId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.s3Key == nil { + return localVarReturnValue, nil, reportError("s3Key is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.s3Key + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "UmUsersS3keysPut", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiUmUsersS3ssourlGetRequest struct { + ctx _context.Context + ApiService *UserManagementApiService + userId string + pretty *bool + xContractNumber *int32 +} + +func (r ApiUmUsersS3ssourlGetRequest) Pretty(pretty bool) ApiUmUsersS3ssourlGetRequest { + r.pretty = &pretty + return r +} +func (r ApiUmUsersS3ssourlGetRequest) XContractNumber(xContractNumber int32) ApiUmUsersS3ssourlGetRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiUmUsersS3ssourlGetRequest) Execute() (S3ObjectStorageSSO, *APIResponse, error) { + return r.ApiService.UmUsersS3ssourlGetExecute(r) +} + +/* + * UmUsersS3ssourlGet Retrieve S3 object storage single signon URL for the given user + * You can retrieve S3 object storage single signon URL for the given user. This user Id can be found in the response body when a user is created or when you GET a list of users. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param userId The unique ID of the user + * @return ApiUmUsersS3ssourlGetRequest + */ +func (a *UserManagementApiService) UmUsersS3ssourlGet(ctx _context.Context, userId string) ApiUmUsersS3ssourlGetRequest { + return ApiUmUsersS3ssourlGetRequest{ + ApiService: a, + ctx: ctx, + userId: userId, + } +} + +/* + * Execute executes the request + * @return S3ObjectStorageSSO + */ +func (a *UserManagementApiService) UmUsersS3ssourlGetExecute(r ApiUmUsersS3ssourlGetRequest) (S3ObjectStorageSSO, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue S3ObjectStorageSSO + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmUsersS3ssourlGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/um/users/{userId}/s3ssourl" + localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", _neturl.PathEscape(parameterToString(r.userId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "UmUsersS3ssourlGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_volume.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_volume.go new file mode 100644 index 0000000000..5a243ff583 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/api_volume.go @@ -0,0 +1,1393 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" +) + +// Linger please +var ( + _ _context.Context +) + +// VolumeApiService VolumeApi service +type VolumeApiService service + +type ApiDatacentersVolumesCreateSnapshotPostRequest struct { + ctx _context.Context + ApiService *VolumeApiService + datacenterId string + volumeId string + pretty *bool + depth *int32 + xContractNumber *int32 + name *string + description *string + secAuthProtection *bool + licenceType *string +} + +func (r ApiDatacentersVolumesCreateSnapshotPostRequest) Pretty(pretty bool) ApiDatacentersVolumesCreateSnapshotPostRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersVolumesCreateSnapshotPostRequest) Depth(depth int32) ApiDatacentersVolumesCreateSnapshotPostRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersVolumesCreateSnapshotPostRequest) XContractNumber(xContractNumber int32) ApiDatacentersVolumesCreateSnapshotPostRequest { + r.xContractNumber = &xContractNumber + return r +} +func (r ApiDatacentersVolumesCreateSnapshotPostRequest) Name(name string) ApiDatacentersVolumesCreateSnapshotPostRequest { + r.name = &name + return r +} +func (r ApiDatacentersVolumesCreateSnapshotPostRequest) Description(description string) ApiDatacentersVolumesCreateSnapshotPostRequest { + r.description = &description + return r +} +func (r ApiDatacentersVolumesCreateSnapshotPostRequest) SecAuthProtection(secAuthProtection bool) ApiDatacentersVolumesCreateSnapshotPostRequest { + r.secAuthProtection = &secAuthProtection + return r +} +func (r ApiDatacentersVolumesCreateSnapshotPostRequest) LicenceType(licenceType string) ApiDatacentersVolumesCreateSnapshotPostRequest { + r.licenceType = &licenceType + return r +} + +func (r ApiDatacentersVolumesCreateSnapshotPostRequest) Execute() (Snapshot, *APIResponse, error) { + return r.ApiService.DatacentersVolumesCreateSnapshotPostExecute(r) +} + +/* + * DatacentersVolumesCreateSnapshotPost Create Volume Snapshot + * Creates a snapshot of a volume within the datacenter. You can use a snapshot to create a new storage volume or to restore a storage volume. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @param volumeId The unique ID of the Volume + * @return ApiDatacentersVolumesCreateSnapshotPostRequest + */ +func (a *VolumeApiService) DatacentersVolumesCreateSnapshotPost(ctx _context.Context, datacenterId string, volumeId string) ApiDatacentersVolumesCreateSnapshotPostRequest { + return ApiDatacentersVolumesCreateSnapshotPostRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + volumeId: volumeId, + } +} + +/* + * Execute executes the request + * @return Snapshot + */ +func (a *VolumeApiService) DatacentersVolumesCreateSnapshotPostExecute(r ApiDatacentersVolumesCreateSnapshotPostRequest) (Snapshot, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Snapshot + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "VolumeApiService.DatacentersVolumesCreateSnapshotPost") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/volumes/{volumeId}/create-snapshot" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", _neturl.PathEscape(parameterToString(r.volumeId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/x-www-form-urlencoded"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.name != nil { + localVarFormParams.Add("name", parameterToString(*r.name, "")) + } + if r.description != nil { + localVarFormParams.Add("description", parameterToString(*r.description, "")) + } + if r.secAuthProtection != nil { + localVarFormParams.Add("secAuthProtection", parameterToString(*r.secAuthProtection, "")) + } + if r.licenceType != nil { + localVarFormParams.Add("licenceType", parameterToString(*r.licenceType, "")) + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersVolumesCreateSnapshotPost", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersVolumesDeleteRequest struct { + ctx _context.Context + ApiService *VolumeApiService + datacenterId string + volumeId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersVolumesDeleteRequest) Pretty(pretty bool) ApiDatacentersVolumesDeleteRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersVolumesDeleteRequest) Depth(depth int32) ApiDatacentersVolumesDeleteRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersVolumesDeleteRequest) XContractNumber(xContractNumber int32) ApiDatacentersVolumesDeleteRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersVolumesDeleteRequest) Execute() (map[string]interface{}, *APIResponse, error) { + return r.ApiService.DatacentersVolumesDeleteExecute(r) +} + +/* + * DatacentersVolumesDelete Delete a Volume + * Deletes the specified volume. This will result in the volume being removed from your datacenter. Use this with caution. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @param volumeId The unique ID of the Volume + * @return ApiDatacentersVolumesDeleteRequest + */ +func (a *VolumeApiService) DatacentersVolumesDelete(ctx _context.Context, datacenterId string, volumeId string) ApiDatacentersVolumesDeleteRequest { + return ApiDatacentersVolumesDeleteRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + volumeId: volumeId, + } +} + +/* + * Execute executes the request + * @return map[string]interface{} + */ +func (a *VolumeApiService) DatacentersVolumesDeleteExecute(r ApiDatacentersVolumesDeleteRequest) (map[string]interface{}, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "VolumeApiService.DatacentersVolumesDelete") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/volumes/{volumeId}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", _neturl.PathEscape(parameterToString(r.volumeId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersVolumesDelete", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersVolumesFindByIdRequest struct { + ctx _context.Context + ApiService *VolumeApiService + datacenterId string + volumeId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersVolumesFindByIdRequest) Pretty(pretty bool) ApiDatacentersVolumesFindByIdRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersVolumesFindByIdRequest) Depth(depth int32) ApiDatacentersVolumesFindByIdRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersVolumesFindByIdRequest) XContractNumber(xContractNumber int32) ApiDatacentersVolumesFindByIdRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersVolumesFindByIdRequest) Execute() (Volume, *APIResponse, error) { + return r.ApiService.DatacentersVolumesFindByIdExecute(r) +} + +/* + * DatacentersVolumesFindById Retrieve a Volume + * Retrieves the attributes of a given Volume + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @param volumeId The unique ID of the Volume + * @return ApiDatacentersVolumesFindByIdRequest + */ +func (a *VolumeApiService) DatacentersVolumesFindById(ctx _context.Context, datacenterId string, volumeId string) ApiDatacentersVolumesFindByIdRequest { + return ApiDatacentersVolumesFindByIdRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + volumeId: volumeId, + } +} + +/* + * Execute executes the request + * @return Volume + */ +func (a *VolumeApiService) DatacentersVolumesFindByIdExecute(r ApiDatacentersVolumesFindByIdRequest) (Volume, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Volume + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "VolumeApiService.DatacentersVolumesFindById") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/volumes/{volumeId}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", _neturl.PathEscape(parameterToString(r.volumeId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersVolumesFindById", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersVolumesGetRequest struct { + ctx _context.Context + ApiService *VolumeApiService + datacenterId string + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersVolumesGetRequest) Pretty(pretty bool) ApiDatacentersVolumesGetRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersVolumesGetRequest) Depth(depth int32) ApiDatacentersVolumesGetRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersVolumesGetRequest) XContractNumber(xContractNumber int32) ApiDatacentersVolumesGetRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersVolumesGetRequest) Execute() (Volumes, *APIResponse, error) { + return r.ApiService.DatacentersVolumesGetExecute(r) +} + +/* + * DatacentersVolumesGet List Volumes + * Retrieves a list of Volumes. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @return ApiDatacentersVolumesGetRequest + */ +func (a *VolumeApiService) DatacentersVolumesGet(ctx _context.Context, datacenterId string) ApiDatacentersVolumesGetRequest { + return ApiDatacentersVolumesGetRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + } +} + +/* + * Execute executes the request + * @return Volumes + */ +func (a *VolumeApiService) DatacentersVolumesGetExecute(r ApiDatacentersVolumesGetRequest) (Volumes, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Volumes + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "VolumeApiService.DatacentersVolumesGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/volumes" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersVolumesGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersVolumesPatchRequest struct { + ctx _context.Context + ApiService *VolumeApiService + datacenterId string + volumeId string + volume *VolumeProperties + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersVolumesPatchRequest) Volume(volume VolumeProperties) ApiDatacentersVolumesPatchRequest { + r.volume = &volume + return r +} +func (r ApiDatacentersVolumesPatchRequest) Pretty(pretty bool) ApiDatacentersVolumesPatchRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersVolumesPatchRequest) Depth(depth int32) ApiDatacentersVolumesPatchRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersVolumesPatchRequest) XContractNumber(xContractNumber int32) ApiDatacentersVolumesPatchRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersVolumesPatchRequest) Execute() (Volume, *APIResponse, error) { + return r.ApiService.DatacentersVolumesPatchExecute(r) +} + +/* + * DatacentersVolumesPatch Partially modify a Volume + * You can use update attributes of a Volume + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @param volumeId The unique ID of the Volume + * @return ApiDatacentersVolumesPatchRequest + */ +func (a *VolumeApiService) DatacentersVolumesPatch(ctx _context.Context, datacenterId string, volumeId string) ApiDatacentersVolumesPatchRequest { + return ApiDatacentersVolumesPatchRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + volumeId: volumeId, + } +} + +/* + * Execute executes the request + * @return Volume + */ +func (a *VolumeApiService) DatacentersVolumesPatchExecute(r ApiDatacentersVolumesPatchRequest) (Volume, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Volume + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "VolumeApiService.DatacentersVolumesPatch") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/volumes/{volumeId}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", _neturl.PathEscape(parameterToString(r.volumeId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.volume == nil { + return localVarReturnValue, nil, reportError("volume is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.volume + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersVolumesPatch", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersVolumesPostRequest struct { + ctx _context.Context + ApiService *VolumeApiService + datacenterId string + volume *Volume + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersVolumesPostRequest) Volume(volume Volume) ApiDatacentersVolumesPostRequest { + r.volume = &volume + return r +} +func (r ApiDatacentersVolumesPostRequest) Pretty(pretty bool) ApiDatacentersVolumesPostRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersVolumesPostRequest) Depth(depth int32) ApiDatacentersVolumesPostRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersVolumesPostRequest) XContractNumber(xContractNumber int32) ApiDatacentersVolumesPostRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersVolumesPostRequest) Execute() (Volume, *APIResponse, error) { + return r.ApiService.DatacentersVolumesPostExecute(r) +} + +/* + * DatacentersVolumesPost Create a Volume + * Creates a volume within the datacenter. This will not attach the volume to a server. Please see the Servers section for details on how to attach storage volumes + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @return ApiDatacentersVolumesPostRequest + */ +func (a *VolumeApiService) DatacentersVolumesPost(ctx _context.Context, datacenterId string) ApiDatacentersVolumesPostRequest { + return ApiDatacentersVolumesPostRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + } +} + +/* + * Execute executes the request + * @return Volume + */ +func (a *VolumeApiService) DatacentersVolumesPostExecute(r ApiDatacentersVolumesPostRequest) (Volume, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Volume + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "VolumeApiService.DatacentersVolumesPost") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/volumes" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.volume == nil { + return localVarReturnValue, nil, reportError("volume is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.volume + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersVolumesPost", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersVolumesPutRequest struct { + ctx _context.Context + ApiService *VolumeApiService + datacenterId string + volumeId string + volume *Volume + pretty *bool + depth *int32 + xContractNumber *int32 +} + +func (r ApiDatacentersVolumesPutRequest) Volume(volume Volume) ApiDatacentersVolumesPutRequest { + r.volume = &volume + return r +} +func (r ApiDatacentersVolumesPutRequest) Pretty(pretty bool) ApiDatacentersVolumesPutRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersVolumesPutRequest) Depth(depth int32) ApiDatacentersVolumesPutRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersVolumesPutRequest) XContractNumber(xContractNumber int32) ApiDatacentersVolumesPutRequest { + r.xContractNumber = &xContractNumber + return r +} + +func (r ApiDatacentersVolumesPutRequest) Execute() (Volume, *APIResponse, error) { + return r.ApiService.DatacentersVolumesPutExecute(r) +} + +/* + * DatacentersVolumesPut Modify a Volume + * You can use update attributes of a Volume + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @param volumeId The unique ID of the Volume + * @return ApiDatacentersVolumesPutRequest + */ +func (a *VolumeApiService) DatacentersVolumesPut(ctx _context.Context, datacenterId string, volumeId string) ApiDatacentersVolumesPutRequest { + return ApiDatacentersVolumesPutRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + volumeId: volumeId, + } +} + +/* + * Execute executes the request + * @return Volume + */ +func (a *VolumeApiService) DatacentersVolumesPutExecute(r ApiDatacentersVolumesPutRequest) (Volume, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Volume + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "VolumeApiService.DatacentersVolumesPut") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/volumes/{volumeId}" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", _neturl.PathEscape(parameterToString(r.volumeId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.volume == nil { + return localVarReturnValue, nil, reportError("volume is required and must be specified") + } + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + // body params + localVarPostBody = r.volume + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersVolumesPut", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiDatacentersVolumesRestoreSnapshotPostRequest struct { + ctx _context.Context + ApiService *VolumeApiService + datacenterId string + volumeId string + pretty *bool + depth *int32 + xContractNumber *int32 + snapshotId *string +} + +func (r ApiDatacentersVolumesRestoreSnapshotPostRequest) Pretty(pretty bool) ApiDatacentersVolumesRestoreSnapshotPostRequest { + r.pretty = &pretty + return r +} +func (r ApiDatacentersVolumesRestoreSnapshotPostRequest) Depth(depth int32) ApiDatacentersVolumesRestoreSnapshotPostRequest { + r.depth = &depth + return r +} +func (r ApiDatacentersVolumesRestoreSnapshotPostRequest) XContractNumber(xContractNumber int32) ApiDatacentersVolumesRestoreSnapshotPostRequest { + r.xContractNumber = &xContractNumber + return r +} +func (r ApiDatacentersVolumesRestoreSnapshotPostRequest) SnapshotId(snapshotId string) ApiDatacentersVolumesRestoreSnapshotPostRequest { + r.snapshotId = &snapshotId + return r +} + +func (r ApiDatacentersVolumesRestoreSnapshotPostRequest) Execute() (map[string]interface{}, *APIResponse, error) { + return r.ApiService.DatacentersVolumesRestoreSnapshotPostExecute(r) +} + +/* + * DatacentersVolumesRestoreSnapshotPost Restore Volume Snapshot + * This will restore a snapshot onto a volume. A snapshot is created as just another image that can be used to create subsequent volumes if you want or to restore an existing volume. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param datacenterId The unique ID of the datacenter + * @param volumeId The unique ID of the Volume + * @return ApiDatacentersVolumesRestoreSnapshotPostRequest + */ +func (a *VolumeApiService) DatacentersVolumesRestoreSnapshotPost(ctx _context.Context, datacenterId string, volumeId string) ApiDatacentersVolumesRestoreSnapshotPostRequest { + return ApiDatacentersVolumesRestoreSnapshotPostRequest{ + ApiService: a, + ctx: ctx, + datacenterId: datacenterId, + volumeId: volumeId, + } +} + +/* + * Execute executes the request + * @return map[string]interface{} + */ +func (a *VolumeApiService) DatacentersVolumesRestoreSnapshotPostExecute(r ApiDatacentersVolumesRestoreSnapshotPostRequest) (map[string]interface{}, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "VolumeApiService.DatacentersVolumesRestoreSnapshotPost") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/datacenters/{datacenterId}/volumes/{volumeId}/restore-snapshot" + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", _neturl.PathEscape(parameterToString(r.volumeId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.pretty != nil { + localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) + } + if r.depth != nil { + localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/x-www-form-urlencoded"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xContractNumber != nil { + localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + } + if r.snapshotId != nil { + localVarFormParams.Add("snapshotId", parameterToString(*r.snapshotId, "")) + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Token Authentication"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse { + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestURL: localVarPath, + Operation: "DatacentersVolumesRestoreSnapshotPost", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/client.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/client.go new file mode 100644 index 0000000000..e00f5a227a --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/client.go @@ -0,0 +1,755 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "io" + "io/ioutil" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "golang.org/x/oauth2" +) + +var ( + jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) + xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) +) + +const DepthParam = "depth" +const DefaultDepth = "10" + +const ( + RequestStatusQueued = "QUEUED" + RequestStatusRunning = "RUNNING" + RequestStatusFailed = "FAILED" + RequestStatusDone = "DONE" +) + +// APIClient manages communication with the CLOUD API API v5.0 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + + // API Services + + BackupUnitApi *BackupUnitApiService + + ContractApi *ContractApiService + + DataCenterApi *DataCenterApiService + + IPBlocksApi *IPBlocksApiService + + ImageApi *ImageApiService + + KubernetesApi *KubernetesApiService + + LabelApi *LabelApiService + + LanApi *LanApiService + + LoadBalancerApi *LoadBalancerApiService + + LocationApi *LocationApiService + + NicApi *NicApiService + + PrivateCrossConnectApi *PrivateCrossConnectApiService + + RequestApi *RequestApiService + + ServerApi *ServerApiService + + SnapshotApi *SnapshotApiService + + UserManagementApi *UserManagementApiService + + VolumeApi *VolumeApiService +} + +type service struct { + client *APIClient +} + +// NewAPIClient creates a new API client. Requires a userAgent string describing your application. +// optionally a custom http.Client to allow for advanced features such as caching. +func NewAPIClient(cfg *Configuration) *APIClient { + if cfg.HTTPClient == nil { + cfg.HTTPClient = http.DefaultClient + } + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + + // API Services + c.BackupUnitApi = (*BackupUnitApiService)(&c.common) + c.ContractApi = (*ContractApiService)(&c.common) + c.DataCenterApi = (*DataCenterApiService)(&c.common) + c.IPBlocksApi = (*IPBlocksApiService)(&c.common) + c.ImageApi = (*ImageApiService)(&c.common) + c.KubernetesApi = (*KubernetesApiService)(&c.common) + c.LabelApi = (*LabelApiService)(&c.common) + c.LanApi = (*LanApiService)(&c.common) + c.LoadBalancerApi = (*LoadBalancerApiService)(&c.common) + c.LocationApi = (*LocationApiService)(&c.common) + c.NicApi = (*NicApiService)(&c.common) + c.PrivateCrossConnectApi = (*PrivateCrossConnectApiService)(&c.common) + c.RequestApi = (*RequestApiService)(&c.common) + c.ServerApi = (*ServerApiService)(&c.common) + c.SnapshotApi = (*SnapshotApiService)(&c.common) + c.UserManagementApi = (*UserManagementApiService)(&c.common) + c.VolumeApi = (*VolumeApiService)(&c.common) + + return c +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insenstive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.ToLower(a) == strings.ToLower(needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("Expected %s to be of type %s but received %s.", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +// parameterToString convert interface{} parameters to string, using a delimiter if format is provided. +func parameterToString(obj interface{}, collectionFormat string) string { + var delimiter string + + switch collectionFormat { + case "pipes": + delimiter = "|" + case "ssv": + delimiter = " " + case "tsv": + delimiter = "\t" + case "csv": + delimiter = "," + } + + if reflect.TypeOf(obj).Kind() == reflect.Slice { + return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]") + } else if t, ok := obj.(time.Time); ok { + return t.Format(time.RFC3339) + } + + return fmt.Sprintf("%v", obj) +} + +// helper for converting interface{} parameters to json strings +func parameterToJson(obj interface{}) (string, error) { + jsonBuf, err := json.Marshal(obj) + if err != nil { + return "", err + } + return string(jsonBuf), err +} + + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + retryCount := 0 + + var resp *http.Response + var err error + + for { + + retryCount ++ + + /* we need to clone the request with every retry time because Body closes after the request */ + var clonedRequest *http.Request = request.Clone(request.Context()) + if request.Body != nil { + clonedRequest.Body, err = request.GetBody() + if err != nil { + return nil, err + } + } + + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(clonedRequest, true) + if err != nil { + return nil, err + } + log.Printf("\ntry no: %d\n", retryCount) + log.Printf("%s\n", string(dump)) + } + + resp, err = c.cfg.HTTPClient.Do(clonedRequest) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + + var backoffTime time.Duration + + switch resp.StatusCode { + case http.StatusServiceUnavailable, + http.StatusGatewayTimeout, + http.StatusBadGateway: + backoffTime = c.GetConfig().WaitTime + + case http.StatusTooManyRequests: + if retryAfterSeconds := resp.Header.Get("Retry-After"); retryAfterSeconds != "" { + waitTime, err := time.ParseDuration(retryAfterSeconds + "s") + if err != nil { + return resp, err + } + backoffTime = waitTime + } else { + backoffTime = c.GetConfig().WaitTime + } + default: + return resp, err + + } + + if retryCount >= c.GetConfig().MaxRetries { + if c.cfg.Debug { + fmt.Printf("number of maximum retries exceeded (%d retries)\n", c.cfg.MaxRetries) + } + break + } else { + c.backOff(backoffTime) + } + } + + return resp, err +} + +func (c *APIClient) backOff(t time.Duration) { + if t > c.GetConfig().MaxWaitTime { + t = c.GetConfig().MaxWaitTime + } + if c.cfg.Debug { + fmt.Printf("sleeping %s before retrying request\n", t.String()) + } + time.Sleep(t) +} + +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *Configuration { + return c.cfg +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + formFileName string, + fileName string, + fileBytes []byte) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if postBody != nil { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") { + if body != nil { + return nil, errors.New("Cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + if len(fileBytes) > 0 && fileName != "" { + w.Boundary() + //_, fileNm := filepath.Split(fileName) + part, err := w.CreateFormFile(formFileName, filepath.Base(fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(fileBytes) + if err != nil { + return nil, err + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + /* adding default query params */ + for k, v := range c.cfg.DefaultQueryParams { + if _, ok := queryParams[k]; !ok { + queryParams[k] = v + } + } + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Adding default depth if needed + if query.Get(DepthParam) == "" { + query.Add(DepthParam, DefaultDepth) + } + + + // Encode the parameters. + url.RawQuery = query.Encode() + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers.Set(h, v) + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if c.cfg.Token != "" { + localVarRequest.Header.Add("Authorization", "Bearer " + c.cfg.Token) + } else { + if c.cfg.Username != "" { + localVarRequest.SetBasicAuth(c.cfg.Username, c.cfg.Password) + } + } + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + // OAuth2 authentication + if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok { + // We were able to grab an oauth2 token from the context + var latestToken *oauth2.Token + if latestToken, err = tok.Token(); err != nil { + return nil, err + } + + latestToken.SetAuthHeader(localVarRequest) + } + + // Basic HTTP Authentication + if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok { + localVarRequest.SetBasicAuth(auth.UserName, auth.Password) + } + + // AccessToken Authentication + if auth, ok := ctx.Value(ContextAccessToken).(string); ok { + localVarRequest.Header.Add("Authorization", "Bearer "+auth) + } + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if xmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if jsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{GetActualInstance() interface{}}); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{UnmarshalJSON([]byte) error}); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err!= nil { + return err + } + } else { + errors.New("Unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return errors.New("undefined response type") +} + + +func (c *APIClient) WaitForRequest(ctx context.Context, path string) (*APIResponse, error) { + + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + r, err := c.prepareRequest(ctx, path, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + ticker := time.NewTicker(1 * time.Second) + defer ticker.Stop() + for { + resp, err := c.callAPI(r) + + var localVarBody = make([]byte, 0) + if resp != nil { + var errRead error + localVarBody, errRead = ioutil.ReadAll(resp.Body) + _ = resp.Body.Close() + if errRead != nil { + return nil, errRead + } + + } + + localVarAPIResponse := &APIResponse { + Response: resp, + Method: localVarHTTPMethod, + RequestURL: path, + Operation: "WaitForRequest", + } + + localVarAPIResponse.Payload = localVarBody + + if err != nil { + return localVarAPIResponse, err + } + + status := RequestStatus{} + err = c.decode(&status, localVarBody, resp.Header.Get("Content-Type")) + if status.Metadata != nil && status.Metadata.Status != nil { + switch *status.Metadata.Status { + case RequestStatusDone: + return localVarAPIResponse, nil + case RequestStatusFailed: + var id = "" + var message = "" + if status.Id != nil { + id = *status.Id + } + if status.Metadata.Message != nil { + message = *status.Metadata.Message + } + return localVarAPIResponse, errors.New( + fmt.Sprintf("Request %s failed: %s", id, message), + ) + } + } + select { + case <-ctx.Done(): + return nil, ctx.Err() + case <-ticker.C: + continue + } + } +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(path) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// Prevent trying to import "fmt" +func reportError(format string, a ...interface{}) error { + return fmt.Errorf(format, a...) +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if jsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if xmlCheck.MatchString(contentType) { + err = xml.NewEncoder(bodyBuf).Encode(body) + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("Invalid body type %s\n", contentType) + return nil, err + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go +type cacheControl map[string]string + +func parseCacheControl(headers http.Header) cacheControl { + cc := cacheControl{} + ccHeader := headers.Get("Cache-Control") + for _, part := range strings.Split(ccHeader, ",") { + part = strings.Trim(part, " ") + if part == "" { + continue + } + if strings.ContainsRune(part, '=') { + keyval := strings.Split(part, "=") + cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") + } else { + cc[part] = "" + } + } + return cc +} + +// CacheExpires helper function to determine remaining time before repeating a request. +func CacheExpires(r *http.Response) time.Time { + // Figure out when the cache expires. + var expires time.Time + now, err := time.Parse(time.RFC1123, r.Header.Get("date")) + if err != nil { + return time.Now() + } + respCacheControl := parseCacheControl(r.Header) + + if maxAge, ok := respCacheControl["max-age"]; ok { + lifetime, err := time.ParseDuration(maxAge + "s") + if err != nil { + expires = now + } else { + expires = now.Add(lifetime) + } + } else { + expiresHeader := r.Header.Get("Expires") + if expiresHeader != "" { + expires, err = time.Parse(time.RFC1123, expiresHeader) + if err != nil { + expires = now + } + } + } + return expires +} + +func strlen(s string) int { + return utf8.RuneCountInString(s) +} + +// GenericOpenAPIError Provides access to the body, error and model on returned errors. +type GenericOpenAPIError struct { + body []byte + error string + model interface{} +} + +// Error returns non-empty string if there was an error. +func (e GenericOpenAPIError) Error() string { + return e.error +} + +// Body returns the raw bytes of the response +func (e GenericOpenAPIError) Body() []byte { + return e.body +} + +// Model returns the unpacked model of the error +func (e GenericOpenAPIError) Model() interface{} { + return e.model +} diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/configuration.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/configuration.go new file mode 100644 index 0000000000..0de593f969 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/configuration.go @@ -0,0 +1,268 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "context" + "fmt" + "net/http" + "net/url" + "os" + "strings" + "time" +) + +const ( + IonosUsernameEnvVar = "IONOS_USERNAME" + IonosPasswordEnvVar = "IONOS_PASSWORD" + IonosTokenEnvVar = "IONOS_TOKEN" + defaultMaxRetries = 3 + defaultWaitTime = time.Duration(100) * time.Millisecond + defaultMaxWaitTime = time.Duration(2000) * time.Millisecond +) + +// contextKeys are used to identify the type of value in the context. +// Since these are string, it is possible to get a short description of the +// context key for logging and debugging using key.String(). + +type contextKey string + +func (c contextKey) String() string { + return "auth " + string(c) +} + +var ( + // ContextOAuth2 takes an oauth2.TokenSource as authentication for the request. + ContextOAuth2 = contextKey("token") + + // ContextBasicAuth takes BasicAuth as authentication for the request. + ContextBasicAuth = contextKey("basic") + + // ContextAccessToken takes a string oauth2 access token as authentication for the request. + ContextAccessToken = contextKey("accesstoken") + + // ContextAPIKeys takes a string apikey as authentication for the request + ContextAPIKeys = contextKey("apiKeys") + + // ContextHttpSignatureAuth takes HttpSignatureAuth as authentication for the request. + ContextHttpSignatureAuth = contextKey("httpsignature") + + // ContextServerIndex uses a server configuration from the index. + ContextServerIndex = contextKey("serverIndex") + + // ContextOperationServerIndices uses a server configuration from the index mapping. + ContextOperationServerIndices = contextKey("serverOperationIndices") + + // ContextServerVariables overrides a server configuration variables. + ContextServerVariables = contextKey("serverVariables") + + // ContextOperationServerVariables overrides a server configuration variables using operation specific values. + ContextOperationServerVariables = contextKey("serverOperationVariables") +) + +// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth +type BasicAuth struct { + UserName string `json:"userName,omitempty"` + Password string `json:"password,omitempty"` +} + +// APIKey provides API key based authentication to a request passed via context using ContextAPIKey +type APIKey struct { + Key string + Prefix string +} + +// ServerVariable stores the information about a server variable +type ServerVariable struct { + Description string + DefaultValue string + EnumValues []string +} + +// ServerConfiguration stores the information about a server +type ServerConfiguration struct { + URL string + Description string + Variables map[string]ServerVariable +} + +// ServerConfigurations stores multiple ServerConfiguration items +type ServerConfigurations []ServerConfiguration + +// Configuration stores the configuration of the API client +type Configuration struct { + Host string `json:"host,omitempty"` + Scheme string `json:"scheme,omitempty"` + DefaultHeader map[string]string `json:"defaultHeader,omitempty"` + DefaultQueryParams url.Values `json:"defaultQueryParams,omitempty"` + UserAgent string `json:"userAgent,omitempty"` + Debug bool `json:"debug,omitempty"` + Servers ServerConfigurations + OperationServers map[string]ServerConfigurations + HTTPClient *http.Client + Username string `json:"username,omitempty"` + Password string `json:"password,omitempty"` + Token string `json:"token,omitempty"` + MaxRetries int `json:"maxRetries,omitempty"` + WaitTime time.Duration `json:"waitTime,omitempty"` + MaxWaitTime time.Duration `json:"maxWaitTime,omitempty"` +} + +// NewConfiguration returns a new Configuration object +func NewConfiguration(username string, password string, token string) *Configuration { + cfg := &Configuration{ + DefaultHeader: make(map[string]string), + DefaultQueryParams: url.Values{}, + UserAgent: "ionos-cloud-sdk-go/v5", + Debug: false, + Username: username, + Password: password, + Token: token, + MaxRetries: defaultMaxRetries, + MaxWaitTime: defaultMaxWaitTime, + WaitTime: defaultWaitTime, + Servers: ServerConfigurations{ + { + URL: "https://api.ionos.com/cloudapi/v5", + Description: "No description provided", + }, + }, + OperationServers: map[string]ServerConfigurations{ + }, + } + return cfg +} + +func NewConfigurationFromEnv() *Configuration { + return NewConfiguration(os.Getenv(IonosUsernameEnvVar), os.Getenv(IonosPasswordEnvVar), os.Getenv(IonosTokenEnvVar)) +} + +// AddDefaultHeader adds a new HTTP header to the default header in the request +func (c *Configuration) AddDefaultHeader(key string, value string) { + c.DefaultHeader[key] = value +} + +func (c *Configuration) AddDefaultQueryParam(key string, value string) { + if _, ok := c.DefaultQueryParams[key]; ok { + c.DefaultQueryParams[key] = append(c.DefaultQueryParams[key], value) + } else { + c.DefaultQueryParams[key] = []string{value} + } +} + +// URL formats template on a index using given variables +func (sc ServerConfigurations) URL(index int, variables map[string]string) (string, error) { + if index < 0 || len(sc) <= index { + return "", fmt.Errorf("Index %v out of range %v", index, len(sc)-1) + } + server := sc[index] + url := server.URL + + // go through variables and replace placeholders + for name, variable := range server.Variables { + if value, ok := variables[name]; ok { + found := bool(len(variable.EnumValues) == 0) + for _, enumValue := range variable.EnumValues { + if value == enumValue { + found = true + } + } + if !found { + return "", fmt.Errorf("The variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues) + } + url = strings.Replace(url, "{"+name+"}", value, -1) + } else { + url = strings.Replace(url, "{"+name+"}", variable.DefaultValue, -1) + } + } + return url, nil +} + +// ServerURL returns URL based on server settings +func (c *Configuration) ServerURL(index int, variables map[string]string) (string, error) { + return c.Servers.URL(index, variables) +} + +func getServerIndex(ctx context.Context) (int, error) { + si := ctx.Value(ContextServerIndex) + if si != nil { + if index, ok := si.(int); ok { + return index, nil + } + return 0, reportError("Invalid type %T should be int", si) + } + return 0, nil +} + +func getServerOperationIndex(ctx context.Context, endpoint string) (int, error) { + osi := ctx.Value(ContextOperationServerIndices) + if osi != nil { + if operationIndices, ok := osi.(map[string]int); !ok { + return 0, reportError("Invalid type %T should be map[string]int", osi) + } else { + index, ok := operationIndices[endpoint] + if ok { + return index, nil + } + } + } + return getServerIndex(ctx) +} + +func getServerVariables(ctx context.Context) (map[string]string, error) { + sv := ctx.Value(ContextServerVariables) + if sv != nil { + if variables, ok := sv.(map[string]string); ok { + return variables, nil + } + return nil, reportError("ctx value of ContextServerVariables has invalid type %T should be map[string]string", sv) + } + return nil, nil +} + +func getServerOperationVariables(ctx context.Context, endpoint string) (map[string]string, error) { + osv := ctx.Value(ContextOperationServerVariables) + if osv != nil { + if operationVariables, ok := osv.(map[string]map[string]string); !ok { + return nil, reportError("ctx value of ContextOperationServerVariables has invalid type %T should be map[string]map[string]string", osv) + } else { + variables, ok := operationVariables[endpoint] + if ok { + return variables, nil + } + } + } + return getServerVariables(ctx) +} + +// ServerURLWithContext returns a new server URL given an endpoint +func (c *Configuration) ServerURLWithContext(ctx context.Context, endpoint string) (string, error) { + sc, ok := c.OperationServers[endpoint] + if !ok { + sc = c.Servers + } + + if ctx == nil { + return sc.URL(0, nil) + } + + index, err := getServerOperationIndex(ctx, endpoint) + if err != nil { + return "", err + } + + variables, err := getServerOperationVariables(ctx, endpoint) + if err != nil { + return "", err + } + + return sc.URL(index, variables) +} diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_attached_volumes.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_attached_volumes.go new file mode 100644 index 0000000000..b0ef52a0e0 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_attached_volumes.go @@ -0,0 +1,235 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// AttachedVolumes struct for AttachedVolumes +type AttachedVolumes struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of object that has been created + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + // Array of items in that collection + Items *[]Volume `json:"items,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *AttachedVolumes) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *AttachedVolumes) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *AttachedVolumes) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *AttachedVolumes) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *AttachedVolumes) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *AttachedVolumes) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *AttachedVolumes) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *AttachedVolumes) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *AttachedVolumes) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *AttachedVolumes) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *AttachedVolumes) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *AttachedVolumes) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []Volume will be returned +func (o *AttachedVolumes) GetItems() *[]Volume { + if o == nil { + return nil + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *AttachedVolumes) GetItemsOk() (*[]Volume, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *AttachedVolumes) SetItems(v []Volume) { + o.Items = &v +} + +// HasItems returns a boolean if a field has been set. +func (o *AttachedVolumes) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + + +func (o AttachedVolumes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullableAttachedVolumes struct { + value *AttachedVolumes + isSet bool +} + +func (v NullableAttachedVolumes) Get() *AttachedVolumes { + return v.value +} + +func (v *NullableAttachedVolumes) Set(val *AttachedVolumes) { + v.value = val + v.isSet = true +} + +func (v NullableAttachedVolumes) IsSet() bool { + return v.isSet +} + +func (v *NullableAttachedVolumes) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAttachedVolumes(val *AttachedVolumes) *NullableAttachedVolumes { + return &NullableAttachedVolumes{value: val, isSet: true} +} + +func (v NullableAttachedVolumes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAttachedVolumes) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_backup_unit.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_backup_unit.go new file mode 100644 index 0000000000..550ca9b1e5 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_backup_unit.go @@ -0,0 +1,276 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// BackupUnit struct for BackupUnit +type BackupUnit struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of object that has been created + Type *string `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` + Properties *BackupUnitProperties `json:"properties"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *BackupUnit) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *BackupUnit) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *BackupUnit) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *BackupUnit) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for string will be returned +func (o *BackupUnit) GetType() *string { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *BackupUnit) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *BackupUnit) SetType(v string) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *BackupUnit) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *BackupUnit) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *BackupUnit) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *BackupUnit) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *BackupUnit) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for DatacenterElementMetadata will be returned +func (o *BackupUnit) GetMetadata() *DatacenterElementMetadata { + if o == nil { + return nil + } + + return o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *BackupUnit) GetMetadataOk() (*DatacenterElementMetadata, bool) { + if o == nil { + return nil, false + } + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *BackupUnit) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + +// HasMetadata returns a boolean if a field has been set. +func (o *BackupUnit) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + + + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for BackupUnitProperties will be returned +func (o *BackupUnit) GetProperties() *BackupUnitProperties { + if o == nil { + return nil + } + + return o.Properties +} + +// GetPropertiesOk returns a tuple with the Properties field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *BackupUnit) GetPropertiesOk() (*BackupUnitProperties, bool) { + if o == nil { + return nil, false + } + return o.Properties, true +} + +// SetProperties sets field value +func (o *BackupUnit) SetProperties(v BackupUnitProperties) { + o.Properties = &v +} + +// HasProperties returns a boolean if a field has been set. +func (o *BackupUnit) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + + +func (o BackupUnit) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + return json.Marshal(toSerialize) +} + +type NullableBackupUnit struct { + value *BackupUnit + isSet bool +} + +func (v NullableBackupUnit) Get() *BackupUnit { + return v.value +} + +func (v *NullableBackupUnit) Set(val *BackupUnit) { + v.value = val + v.isSet = true +} + +func (v NullableBackupUnit) IsSet() bool { + return v.isSet +} + +func (v *NullableBackupUnit) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBackupUnit(val *BackupUnit) *NullableBackupUnit { + return &NullableBackupUnit{value: val, isSet: true} +} + +func (v NullableBackupUnit) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBackupUnit) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_backup_unit_properties.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_backup_unit_properties.go new file mode 100644 index 0000000000..4428de8b09 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_backup_unit_properties.go @@ -0,0 +1,192 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// BackupUnitProperties struct for BackupUnitProperties +type BackupUnitProperties struct { + // A name of that resource (only alphanumeric characters are acceptable) + Name *string `json:"name"` + // the password associated to that resource + Password *string `json:"password,omitempty"` + // The email associated with the backup unit. Bear in mind that this email does not be the same email as of the user. + Email *string `json:"email,omitempty"` +} + + + +// GetName returns the Name field value +// If the value is explicit nil, the zero value for string will be returned +func (o *BackupUnitProperties) GetName() *string { + if o == nil { + return nil + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *BackupUnitProperties) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name, true +} + +// SetName sets field value +func (o *BackupUnitProperties) SetName(v string) { + o.Name = &v +} + +// HasName returns a boolean if a field has been set. +func (o *BackupUnitProperties) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + + + +// GetPassword returns the Password field value +// If the value is explicit nil, the zero value for string will be returned +func (o *BackupUnitProperties) GetPassword() *string { + if o == nil { + return nil + } + + return o.Password +} + +// GetPasswordOk returns a tuple with the Password field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *BackupUnitProperties) GetPasswordOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Password, true +} + +// SetPassword sets field value +func (o *BackupUnitProperties) SetPassword(v string) { + o.Password = &v +} + +// HasPassword returns a boolean if a field has been set. +func (o *BackupUnitProperties) HasPassword() bool { + if o != nil && o.Password != nil { + return true + } + + return false +} + + + +// GetEmail returns the Email field value +// If the value is explicit nil, the zero value for string will be returned +func (o *BackupUnitProperties) GetEmail() *string { + if o == nil { + return nil + } + + return o.Email +} + +// GetEmailOk returns a tuple with the Email field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *BackupUnitProperties) GetEmailOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Email, true +} + +// SetEmail sets field value +func (o *BackupUnitProperties) SetEmail(v string) { + o.Email = &v +} + +// HasEmail returns a boolean if a field has been set. +func (o *BackupUnitProperties) HasEmail() bool { + if o != nil && o.Email != nil { + return true + } + + return false +} + + +func (o BackupUnitProperties) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Name != nil { + toSerialize["name"] = o.Name + } + + + if o.Password != nil { + toSerialize["password"] = o.Password + } + + + if o.Email != nil { + toSerialize["email"] = o.Email + } + + return json.Marshal(toSerialize) +} + +type NullableBackupUnitProperties struct { + value *BackupUnitProperties + isSet bool +} + +func (v NullableBackupUnitProperties) Get() *BackupUnitProperties { + return v.value +} + +func (v *NullableBackupUnitProperties) Set(val *BackupUnitProperties) { + v.value = val + v.isSet = true +} + +func (v NullableBackupUnitProperties) IsSet() bool { + return v.isSet +} + +func (v *NullableBackupUnitProperties) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBackupUnitProperties(val *BackupUnitProperties) *NullableBackupUnitProperties { + return &NullableBackupUnitProperties{value: val, isSet: true} +} + +func (v NullableBackupUnitProperties) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBackupUnitProperties) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_backup_unit_sso.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_backup_unit_sso.go new file mode 100644 index 0000000000..ef53556657 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_backup_unit_sso.go @@ -0,0 +1,106 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// BackupUnitSSO struct for BackupUnitSSO +type BackupUnitSSO struct { + // The backup unit single sign on url + SsoUrl *string `json:"ssoUrl,omitempty"` +} + + + +// GetSsoUrl returns the SsoUrl field value +// If the value is explicit nil, the zero value for string will be returned +func (o *BackupUnitSSO) GetSsoUrl() *string { + if o == nil { + return nil + } + + return o.SsoUrl +} + +// GetSsoUrlOk returns a tuple with the SsoUrl field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *BackupUnitSSO) GetSsoUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.SsoUrl, true +} + +// SetSsoUrl sets field value +func (o *BackupUnitSSO) SetSsoUrl(v string) { + o.SsoUrl = &v +} + +// HasSsoUrl returns a boolean if a field has been set. +func (o *BackupUnitSSO) HasSsoUrl() bool { + if o != nil && o.SsoUrl != nil { + return true + } + + return false +} + + +func (o BackupUnitSSO) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.SsoUrl != nil { + toSerialize["ssoUrl"] = o.SsoUrl + } + + return json.Marshal(toSerialize) +} + +type NullableBackupUnitSSO struct { + value *BackupUnitSSO + isSet bool +} + +func (v NullableBackupUnitSSO) Get() *BackupUnitSSO { + return v.value +} + +func (v *NullableBackupUnitSSO) Set(val *BackupUnitSSO) { + v.value = val + v.isSet = true +} + +func (v NullableBackupUnitSSO) IsSet() bool { + return v.isSet +} + +func (v *NullableBackupUnitSSO) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBackupUnitSSO(val *BackupUnitSSO) *NullableBackupUnitSSO { + return &NullableBackupUnitSSO{value: val, isSet: true} +} + +func (v NullableBackupUnitSSO) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBackupUnitSSO) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_backup_units.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_backup_units.go new file mode 100644 index 0000000000..44be5b692d --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_backup_units.go @@ -0,0 +1,235 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// BackupUnits struct for BackupUnits +type BackupUnits struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of object that has been created + Type *string `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + // Array of items in that collection + Items *[]BackupUnit `json:"items,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *BackupUnits) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *BackupUnits) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *BackupUnits) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *BackupUnits) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for string will be returned +func (o *BackupUnits) GetType() *string { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *BackupUnits) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *BackupUnits) SetType(v string) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *BackupUnits) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *BackupUnits) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *BackupUnits) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *BackupUnits) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *BackupUnits) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []BackupUnit will be returned +func (o *BackupUnits) GetItems() *[]BackupUnit { + if o == nil { + return nil + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *BackupUnits) GetItemsOk() (*[]BackupUnit, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *BackupUnits) SetItems(v []BackupUnit) { + o.Items = &v +} + +// HasItems returns a boolean if a field has been set. +func (o *BackupUnits) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + + +func (o BackupUnits) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullableBackupUnits struct { + value *BackupUnits + isSet bool +} + +func (v NullableBackupUnits) Get() *BackupUnits { + return v.value +} + +func (v *NullableBackupUnits) Set(val *BackupUnits) { + v.value = val + v.isSet = true +} + +func (v NullableBackupUnits) IsSet() bool { + return v.isSet +} + +func (v *NullableBackupUnits) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBackupUnits(val *BackupUnits) *NullableBackupUnits { + return &NullableBackupUnits{value: val, isSet: true} +} + +func (v NullableBackupUnits) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBackupUnits) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_balanced_nics.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_balanced_nics.go new file mode 100644 index 0000000000..f3ecbfec7b --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_balanced_nics.go @@ -0,0 +1,235 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// BalancedNics struct for BalancedNics +type BalancedNics struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of object that has been created + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + // Array of items in that collection + Items *[]Nic `json:"items,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *BalancedNics) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *BalancedNics) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *BalancedNics) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *BalancedNics) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *BalancedNics) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *BalancedNics) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *BalancedNics) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *BalancedNics) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *BalancedNics) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *BalancedNics) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *BalancedNics) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *BalancedNics) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []Nic will be returned +func (o *BalancedNics) GetItems() *[]Nic { + if o == nil { + return nil + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *BalancedNics) GetItemsOk() (*[]Nic, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *BalancedNics) SetItems(v []Nic) { + o.Items = &v +} + +// HasItems returns a boolean if a field has been set. +func (o *BalancedNics) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + + +func (o BalancedNics) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullableBalancedNics struct { + value *BalancedNics + isSet bool +} + +func (v NullableBalancedNics) Get() *BalancedNics { + return v.value +} + +func (v *NullableBalancedNics) Set(val *BalancedNics) { + v.value = val + v.isSet = true +} + +func (v NullableBalancedNics) IsSet() bool { + return v.isSet +} + +func (v *NullableBalancedNics) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBalancedNics(val *BalancedNics) *NullableBalancedNics { + return &NullableBalancedNics{value: val, isSet: true} +} + +func (v NullableBalancedNics) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBalancedNics) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_cdroms.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_cdroms.go new file mode 100644 index 0000000000..1cad3fb128 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_cdroms.go @@ -0,0 +1,235 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// Cdroms struct for Cdroms +type Cdroms struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of object that has been created + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + // Array of items in that collection + Items *[]Image `json:"items,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Cdroms) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Cdroms) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *Cdroms) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *Cdroms) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *Cdroms) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Cdroms) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *Cdroms) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *Cdroms) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Cdroms) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Cdroms) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *Cdroms) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *Cdroms) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []Image will be returned +func (o *Cdroms) GetItems() *[]Image { + if o == nil { + return nil + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Cdroms) GetItemsOk() (*[]Image, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *Cdroms) SetItems(v []Image) { + o.Items = &v +} + +// HasItems returns a boolean if a field has been set. +func (o *Cdroms) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + + +func (o Cdroms) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullableCdroms struct { + value *Cdroms + isSet bool +} + +func (v NullableCdroms) Get() *Cdroms { + return v.value +} + +func (v *NullableCdroms) Set(val *Cdroms) { + v.value = val + v.isSet = true +} + +func (v NullableCdroms) IsSet() bool { + return v.isSet +} + +func (v *NullableCdroms) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCdroms(val *Cdroms) *NullableCdroms { + return &NullableCdroms{value: val, isSet: true} +} + +func (v NullableCdroms) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCdroms) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_connectable_datacenter.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_connectable_datacenter.go new file mode 100644 index 0000000000..4a62657d79 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_connectable_datacenter.go @@ -0,0 +1,189 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// ConnectableDatacenter struct for ConnectableDatacenter +type ConnectableDatacenter struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ConnectableDatacenter) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ConnectableDatacenter) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *ConnectableDatacenter) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *ConnectableDatacenter) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetName returns the Name field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ConnectableDatacenter) GetName() *string { + if o == nil { + return nil + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ConnectableDatacenter) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name, true +} + +// SetName sets field value +func (o *ConnectableDatacenter) SetName(v string) { + o.Name = &v +} + +// HasName returns a boolean if a field has been set. +func (o *ConnectableDatacenter) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + + + +// GetLocation returns the Location field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ConnectableDatacenter) GetLocation() *string { + if o == nil { + return nil + } + + return o.Location +} + +// GetLocationOk returns a tuple with the Location field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ConnectableDatacenter) GetLocationOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Location, true +} + +// SetLocation sets field value +func (o *ConnectableDatacenter) SetLocation(v string) { + o.Location = &v +} + +// HasLocation returns a boolean if a field has been set. +func (o *ConnectableDatacenter) HasLocation() bool { + if o != nil && o.Location != nil { + return true + } + + return false +} + + +func (o ConnectableDatacenter) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Name != nil { + toSerialize["name"] = o.Name + } + + + if o.Location != nil { + toSerialize["location"] = o.Location + } + + return json.Marshal(toSerialize) +} + +type NullableConnectableDatacenter struct { + value *ConnectableDatacenter + isSet bool +} + +func (v NullableConnectableDatacenter) Get() *ConnectableDatacenter { + return v.value +} + +func (v *NullableConnectableDatacenter) Set(val *ConnectableDatacenter) { + v.value = val + v.isSet = true +} + +func (v NullableConnectableDatacenter) IsSet() bool { + return v.isSet +} + +func (v *NullableConnectableDatacenter) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableConnectableDatacenter(val *ConnectableDatacenter) *NullableConnectableDatacenter { + return &NullableConnectableDatacenter{value: val, isSet: true} +} + +func (v NullableConnectableDatacenter) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableConnectableDatacenter) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_contract.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_contract.go new file mode 100644 index 0000000000..09f8fc5d97 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_contract.go @@ -0,0 +1,148 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// Contract struct for Contract +type Contract struct { + // The type of the resource + Type *Type `json:"type,omitempty"` + Properties *ContractProperties `json:"properties"` +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *Contract) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Contract) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *Contract) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *Contract) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for ContractProperties will be returned +func (o *Contract) GetProperties() *ContractProperties { + if o == nil { + return nil + } + + return o.Properties +} + +// GetPropertiesOk returns a tuple with the Properties field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Contract) GetPropertiesOk() (*ContractProperties, bool) { + if o == nil { + return nil, false + } + return o.Properties, true +} + +// SetProperties sets field value +func (o *Contract) SetProperties(v ContractProperties) { + o.Properties = &v +} + +// HasProperties returns a boolean if a field has been set. +func (o *Contract) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + + +func (o Contract) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + return json.Marshal(toSerialize) +} + +type NullableContract struct { + value *Contract + isSet bool +} + +func (v NullableContract) Get() *Contract { + return v.value +} + +func (v *NullableContract) Set(val *Contract) { + v.value = val + v.isSet = true +} + +func (v NullableContract) IsSet() bool { + return v.isSet +} + +func (v *NullableContract) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableContract(val *Contract) *NullableContract { + return &NullableContract{value: val, isSet: true} +} + +func (v NullableContract) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableContract) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_contract_properties.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_contract_properties.go new file mode 100644 index 0000000000..9783db40cd --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_contract_properties.go @@ -0,0 +1,277 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// ContractProperties struct for ContractProperties +type ContractProperties struct { + // contract number + ContractNumber *int64 `json:"contractNumber,omitempty"` + // owner of the contract + Owner *string `json:"owner,omitempty"` + // status of the contract + Status *string `json:"status,omitempty"` + // Registration domain of the contract + RegDomain *string `json:"regDomain,omitempty"` + ResourceLimits *ResourceLimits `json:"resourceLimits,omitempty"` +} + + + +// GetContractNumber returns the ContractNumber field value +// If the value is explicit nil, the zero value for int64 will be returned +func (o *ContractProperties) GetContractNumber() *int64 { + if o == nil { + return nil + } + + return o.ContractNumber +} + +// GetContractNumberOk returns a tuple with the ContractNumber field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ContractProperties) GetContractNumberOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.ContractNumber, true +} + +// SetContractNumber sets field value +func (o *ContractProperties) SetContractNumber(v int64) { + o.ContractNumber = &v +} + +// HasContractNumber returns a boolean if a field has been set. +func (o *ContractProperties) HasContractNumber() bool { + if o != nil && o.ContractNumber != nil { + return true + } + + return false +} + + + +// GetOwner returns the Owner field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ContractProperties) GetOwner() *string { + if o == nil { + return nil + } + + return o.Owner +} + +// GetOwnerOk returns a tuple with the Owner field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ContractProperties) GetOwnerOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Owner, true +} + +// SetOwner sets field value +func (o *ContractProperties) SetOwner(v string) { + o.Owner = &v +} + +// HasOwner returns a boolean if a field has been set. +func (o *ContractProperties) HasOwner() bool { + if o != nil && o.Owner != nil { + return true + } + + return false +} + + + +// GetStatus returns the Status field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ContractProperties) GetStatus() *string { + if o == nil { + return nil + } + + return o.Status +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ContractProperties) GetStatusOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Status, true +} + +// SetStatus sets field value +func (o *ContractProperties) SetStatus(v string) { + o.Status = &v +} + +// HasStatus returns a boolean if a field has been set. +func (o *ContractProperties) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + + + +// GetRegDomain returns the RegDomain field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ContractProperties) GetRegDomain() *string { + if o == nil { + return nil + } + + return o.RegDomain +} + +// GetRegDomainOk returns a tuple with the RegDomain field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ContractProperties) GetRegDomainOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.RegDomain, true +} + +// SetRegDomain sets field value +func (o *ContractProperties) SetRegDomain(v string) { + o.RegDomain = &v +} + +// HasRegDomain returns a boolean if a field has been set. +func (o *ContractProperties) HasRegDomain() bool { + if o != nil && o.RegDomain != nil { + return true + } + + return false +} + + + +// GetResourceLimits returns the ResourceLimits field value +// If the value is explicit nil, the zero value for ResourceLimits will be returned +func (o *ContractProperties) GetResourceLimits() *ResourceLimits { + if o == nil { + return nil + } + + return o.ResourceLimits +} + +// GetResourceLimitsOk returns a tuple with the ResourceLimits field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ContractProperties) GetResourceLimitsOk() (*ResourceLimits, bool) { + if o == nil { + return nil, false + } + return o.ResourceLimits, true +} + +// SetResourceLimits sets field value +func (o *ContractProperties) SetResourceLimits(v ResourceLimits) { + o.ResourceLimits = &v +} + +// HasResourceLimits returns a boolean if a field has been set. +func (o *ContractProperties) HasResourceLimits() bool { + if o != nil && o.ResourceLimits != nil { + return true + } + + return false +} + + +func (o ContractProperties) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.ContractNumber != nil { + toSerialize["contractNumber"] = o.ContractNumber + } + + + if o.Owner != nil { + toSerialize["owner"] = o.Owner + } + + + if o.Status != nil { + toSerialize["status"] = o.Status + } + + + if o.RegDomain != nil { + toSerialize["regDomain"] = o.RegDomain + } + + + if o.ResourceLimits != nil { + toSerialize["resourceLimits"] = o.ResourceLimits + } + + return json.Marshal(toSerialize) +} + +type NullableContractProperties struct { + value *ContractProperties + isSet bool +} + +func (v NullableContractProperties) Get() *ContractProperties { + return v.value +} + +func (v *NullableContractProperties) Set(val *ContractProperties) { + v.value = val + v.isSet = true +} + +func (v NullableContractProperties) IsSet() bool { + return v.isSet +} + +func (v *NullableContractProperties) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableContractProperties(val *ContractProperties) *NullableContractProperties { + return &NullableContractProperties{value: val, isSet: true} +} + +func (v NullableContractProperties) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableContractProperties) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_datacenter.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_datacenter.go new file mode 100644 index 0000000000..c9a8784b78 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_datacenter.go @@ -0,0 +1,318 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// Datacenter struct for Datacenter +type Datacenter struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of object that has been created + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` + Properties *DatacenterProperties `json:"properties"` + Entities *DatacenterEntities `json:"entities,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Datacenter) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Datacenter) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *Datacenter) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *Datacenter) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *Datacenter) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Datacenter) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *Datacenter) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *Datacenter) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Datacenter) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Datacenter) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *Datacenter) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *Datacenter) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for DatacenterElementMetadata will be returned +func (o *Datacenter) GetMetadata() *DatacenterElementMetadata { + if o == nil { + return nil + } + + return o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Datacenter) GetMetadataOk() (*DatacenterElementMetadata, bool) { + if o == nil { + return nil, false + } + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *Datacenter) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + +// HasMetadata returns a boolean if a field has been set. +func (o *Datacenter) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + + + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for DatacenterProperties will be returned +func (o *Datacenter) GetProperties() *DatacenterProperties { + if o == nil { + return nil + } + + return o.Properties +} + +// GetPropertiesOk returns a tuple with the Properties field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Datacenter) GetPropertiesOk() (*DatacenterProperties, bool) { + if o == nil { + return nil, false + } + return o.Properties, true +} + +// SetProperties sets field value +func (o *Datacenter) SetProperties(v DatacenterProperties) { + o.Properties = &v +} + +// HasProperties returns a boolean if a field has been set. +func (o *Datacenter) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + + + +// GetEntities returns the Entities field value +// If the value is explicit nil, the zero value for DatacenterEntities will be returned +func (o *Datacenter) GetEntities() *DatacenterEntities { + if o == nil { + return nil + } + + return o.Entities +} + +// GetEntitiesOk returns a tuple with the Entities field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Datacenter) GetEntitiesOk() (*DatacenterEntities, bool) { + if o == nil { + return nil, false + } + return o.Entities, true +} + +// SetEntities sets field value +func (o *Datacenter) SetEntities(v DatacenterEntities) { + o.Entities = &v +} + +// HasEntities returns a boolean if a field has been set. +func (o *Datacenter) HasEntities() bool { + if o != nil && o.Entities != nil { + return true + } + + return false +} + + +func (o Datacenter) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + + if o.Entities != nil { + toSerialize["entities"] = o.Entities + } + + return json.Marshal(toSerialize) +} + +type NullableDatacenter struct { + value *Datacenter + isSet bool +} + +func (v NullableDatacenter) Get() *Datacenter { + return v.value +} + +func (v *NullableDatacenter) Set(val *Datacenter) { + v.value = val + v.isSet = true +} + +func (v NullableDatacenter) IsSet() bool { + return v.isSet +} + +func (v *NullableDatacenter) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDatacenter(val *Datacenter) *NullableDatacenter { + return &NullableDatacenter{value: val, isSet: true} +} + +func (v NullableDatacenter) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDatacenter) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_datacenter_element_metadata.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_datacenter_element_metadata.go new file mode 100644 index 0000000000..a6df0841d7 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_datacenter_element_metadata.go @@ -0,0 +1,408 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" + "time" +) + +// DatacenterElementMetadata struct for DatacenterElementMetadata +type DatacenterElementMetadata struct { + // Resource's Entity Tag as defined in http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.11 . Entity Tag is also added as an 'ETag response header to requests which don't use 'depth' parameter. + Etag *string `json:"etag,omitempty"` + // The last time the resource was created + CreatedDate *time.Time `json:"createdDate,omitempty"` + // The user who created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // The user id of the user who has created the resource. + CreatedByUserId *string `json:"createdByUserId,omitempty"` + // The last time the resource has been modified + LastModifiedDate *time.Time `json:"lastModifiedDate,omitempty"` + // The user who last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // The user id of the user who has last modified the resource. + LastModifiedByUserId *string `json:"lastModifiedByUserId,omitempty"` + // State of the resource. *AVAILABLE* There are no pending modification requests for this item; *BUSY* There is at least one modification request pending and all following requests will be queued; *INACTIVE* Resource has been de-provisioned; *DEPLOYING* Resource state DEPLOYING - relevant for Kubernetes cluster/nodepool; *ACTIVE* Resource state ACTIVE - relevant for Kubernetes cluster/nodepool; *FAILED* Resource state FAILED - relevant for Kubernetes cluster/nodepool; *SUSPENDED* Resource state SUSPENDED - relevant for Kubernetes cluster/nodepool; *FAILED_SUSPENDED* Resource state FAILED_SUSPENDED - relevant for Kubernetes cluster; *UPDATING* Resource state UPDATING - relevant for Kubernetes cluster/nodepool; *FAILED_UPDATING* Resource state FAILED_UPDATING - relevant for Kubernetes cluster/nodepool; *DESTROYING* Resource state DESTROYING - relevant for Kubernetes cluster; *FAILED_DESTROYING* Resource state FAILED_DESTROYING - relevant for Kubernetes cluster/nodepool; *TERMINATED* Resource state TERMINATED - relevant for Kubernetes cluster/nodepool + State *string `json:"state,omitempty"` +} + + + +// GetEtag returns the Etag field value +// If the value is explicit nil, the zero value for string will be returned +func (o *DatacenterElementMetadata) GetEtag() *string { + if o == nil { + return nil + } + + return o.Etag +} + +// GetEtagOk returns a tuple with the Etag field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *DatacenterElementMetadata) GetEtagOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Etag, true +} + +// SetEtag sets field value +func (o *DatacenterElementMetadata) SetEtag(v string) { + o.Etag = &v +} + +// HasEtag returns a boolean if a field has been set. +func (o *DatacenterElementMetadata) HasEtag() bool { + if o != nil && o.Etag != nil { + return true + } + + return false +} + + + +// GetCreatedDate returns the CreatedDate field value +// If the value is explicit nil, the zero value for time.Time will be returned +func (o *DatacenterElementMetadata) GetCreatedDate() *time.Time { + if o == nil { + return nil + } + + return o.CreatedDate +} + +// GetCreatedDateOk returns a tuple with the CreatedDate field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *DatacenterElementMetadata) GetCreatedDateOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.CreatedDate, true +} + +// SetCreatedDate sets field value +func (o *DatacenterElementMetadata) SetCreatedDate(v time.Time) { + o.CreatedDate = &v +} + +// HasCreatedDate returns a boolean if a field has been set. +func (o *DatacenterElementMetadata) HasCreatedDate() bool { + if o != nil && o.CreatedDate != nil { + return true + } + + return false +} + + + +// GetCreatedBy returns the CreatedBy field value +// If the value is explicit nil, the zero value for string will be returned +func (o *DatacenterElementMetadata) GetCreatedBy() *string { + if o == nil { + return nil + } + + return o.CreatedBy +} + +// GetCreatedByOk returns a tuple with the CreatedBy field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *DatacenterElementMetadata) GetCreatedByOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.CreatedBy, true +} + +// SetCreatedBy sets field value +func (o *DatacenterElementMetadata) SetCreatedBy(v string) { + o.CreatedBy = &v +} + +// HasCreatedBy returns a boolean if a field has been set. +func (o *DatacenterElementMetadata) HasCreatedBy() bool { + if o != nil && o.CreatedBy != nil { + return true + } + + return false +} + + + +// GetCreatedByUserId returns the CreatedByUserId field value +// If the value is explicit nil, the zero value for string will be returned +func (o *DatacenterElementMetadata) GetCreatedByUserId() *string { + if o == nil { + return nil + } + + return o.CreatedByUserId +} + +// GetCreatedByUserIdOk returns a tuple with the CreatedByUserId field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *DatacenterElementMetadata) GetCreatedByUserIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.CreatedByUserId, true +} + +// SetCreatedByUserId sets field value +func (o *DatacenterElementMetadata) SetCreatedByUserId(v string) { + o.CreatedByUserId = &v +} + +// HasCreatedByUserId returns a boolean if a field has been set. +func (o *DatacenterElementMetadata) HasCreatedByUserId() bool { + if o != nil && o.CreatedByUserId != nil { + return true + } + + return false +} + + + +// GetLastModifiedDate returns the LastModifiedDate field value +// If the value is explicit nil, the zero value for time.Time will be returned +func (o *DatacenterElementMetadata) GetLastModifiedDate() *time.Time { + if o == nil { + return nil + } + + return o.LastModifiedDate +} + +// GetLastModifiedDateOk returns a tuple with the LastModifiedDate field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *DatacenterElementMetadata) GetLastModifiedDateOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.LastModifiedDate, true +} + +// SetLastModifiedDate sets field value +func (o *DatacenterElementMetadata) SetLastModifiedDate(v time.Time) { + o.LastModifiedDate = &v +} + +// HasLastModifiedDate returns a boolean if a field has been set. +func (o *DatacenterElementMetadata) HasLastModifiedDate() bool { + if o != nil && o.LastModifiedDate != nil { + return true + } + + return false +} + + + +// GetLastModifiedBy returns the LastModifiedBy field value +// If the value is explicit nil, the zero value for string will be returned +func (o *DatacenterElementMetadata) GetLastModifiedBy() *string { + if o == nil { + return nil + } + + return o.LastModifiedBy +} + +// GetLastModifiedByOk returns a tuple with the LastModifiedBy field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *DatacenterElementMetadata) GetLastModifiedByOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.LastModifiedBy, true +} + +// SetLastModifiedBy sets field value +func (o *DatacenterElementMetadata) SetLastModifiedBy(v string) { + o.LastModifiedBy = &v +} + +// HasLastModifiedBy returns a boolean if a field has been set. +func (o *DatacenterElementMetadata) HasLastModifiedBy() bool { + if o != nil && o.LastModifiedBy != nil { + return true + } + + return false +} + + + +// GetLastModifiedByUserId returns the LastModifiedByUserId field value +// If the value is explicit nil, the zero value for string will be returned +func (o *DatacenterElementMetadata) GetLastModifiedByUserId() *string { + if o == nil { + return nil + } + + return o.LastModifiedByUserId +} + +// GetLastModifiedByUserIdOk returns a tuple with the LastModifiedByUserId field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *DatacenterElementMetadata) GetLastModifiedByUserIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.LastModifiedByUserId, true +} + +// SetLastModifiedByUserId sets field value +func (o *DatacenterElementMetadata) SetLastModifiedByUserId(v string) { + o.LastModifiedByUserId = &v +} + +// HasLastModifiedByUserId returns a boolean if a field has been set. +func (o *DatacenterElementMetadata) HasLastModifiedByUserId() bool { + if o != nil && o.LastModifiedByUserId != nil { + return true + } + + return false +} + + + +// GetState returns the State field value +// If the value is explicit nil, the zero value for string will be returned +func (o *DatacenterElementMetadata) GetState() *string { + if o == nil { + return nil + } + + return o.State +} + +// GetStateOk returns a tuple with the State field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *DatacenterElementMetadata) GetStateOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.State, true +} + +// SetState sets field value +func (o *DatacenterElementMetadata) SetState(v string) { + o.State = &v +} + +// HasState returns a boolean if a field has been set. +func (o *DatacenterElementMetadata) HasState() bool { + if o != nil && o.State != nil { + return true + } + + return false +} + + +func (o DatacenterElementMetadata) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Etag != nil { + toSerialize["etag"] = o.Etag + } + + + if o.CreatedDate != nil { + toSerialize["createdDate"] = o.CreatedDate + } + + + if o.CreatedBy != nil { + toSerialize["createdBy"] = o.CreatedBy + } + + + if o.CreatedByUserId != nil { + toSerialize["createdByUserId"] = o.CreatedByUserId + } + + + if o.LastModifiedDate != nil { + toSerialize["lastModifiedDate"] = o.LastModifiedDate + } + + + if o.LastModifiedBy != nil { + toSerialize["lastModifiedBy"] = o.LastModifiedBy + } + + + if o.LastModifiedByUserId != nil { + toSerialize["lastModifiedByUserId"] = o.LastModifiedByUserId + } + + + if o.State != nil { + toSerialize["state"] = o.State + } + + return json.Marshal(toSerialize) +} + +type NullableDatacenterElementMetadata struct { + value *DatacenterElementMetadata + isSet bool +} + +func (v NullableDatacenterElementMetadata) Get() *DatacenterElementMetadata { + return v.value +} + +func (v *NullableDatacenterElementMetadata) Set(val *DatacenterElementMetadata) { + v.value = val + v.isSet = true +} + +func (v NullableDatacenterElementMetadata) IsSet() bool { + return v.isSet +} + +func (v *NullableDatacenterElementMetadata) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDatacenterElementMetadata(val *DatacenterElementMetadata) *NullableDatacenterElementMetadata { + return &NullableDatacenterElementMetadata{value: val, isSet: true} +} + +func (v NullableDatacenterElementMetadata) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDatacenterElementMetadata) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_datacenter_entities.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_datacenter_entities.go new file mode 100644 index 0000000000..7458507ae2 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_datacenter_entities.go @@ -0,0 +1,231 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// DatacenterEntities struct for DatacenterEntities +type DatacenterEntities struct { + Servers *Servers `json:"servers,omitempty"` + Volumes *Volumes `json:"volumes,omitempty"` + Loadbalancers *Loadbalancers `json:"loadbalancers,omitempty"` + Lans *Lans `json:"lans,omitempty"` +} + + + +// GetServers returns the Servers field value +// If the value is explicit nil, the zero value for Servers will be returned +func (o *DatacenterEntities) GetServers() *Servers { + if o == nil { + return nil + } + + return o.Servers +} + +// GetServersOk returns a tuple with the Servers field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *DatacenterEntities) GetServersOk() (*Servers, bool) { + if o == nil { + return nil, false + } + return o.Servers, true +} + +// SetServers sets field value +func (o *DatacenterEntities) SetServers(v Servers) { + o.Servers = &v +} + +// HasServers returns a boolean if a field has been set. +func (o *DatacenterEntities) HasServers() bool { + if o != nil && o.Servers != nil { + return true + } + + return false +} + + + +// GetVolumes returns the Volumes field value +// If the value is explicit nil, the zero value for Volumes will be returned +func (o *DatacenterEntities) GetVolumes() *Volumes { + if o == nil { + return nil + } + + return o.Volumes +} + +// GetVolumesOk returns a tuple with the Volumes field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *DatacenterEntities) GetVolumesOk() (*Volumes, bool) { + if o == nil { + return nil, false + } + return o.Volumes, true +} + +// SetVolumes sets field value +func (o *DatacenterEntities) SetVolumes(v Volumes) { + o.Volumes = &v +} + +// HasVolumes returns a boolean if a field has been set. +func (o *DatacenterEntities) HasVolumes() bool { + if o != nil && o.Volumes != nil { + return true + } + + return false +} + + + +// GetLoadbalancers returns the Loadbalancers field value +// If the value is explicit nil, the zero value for Loadbalancers will be returned +func (o *DatacenterEntities) GetLoadbalancers() *Loadbalancers { + if o == nil { + return nil + } + + return o.Loadbalancers +} + +// GetLoadbalancersOk returns a tuple with the Loadbalancers field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *DatacenterEntities) GetLoadbalancersOk() (*Loadbalancers, bool) { + if o == nil { + return nil, false + } + return o.Loadbalancers, true +} + +// SetLoadbalancers sets field value +func (o *DatacenterEntities) SetLoadbalancers(v Loadbalancers) { + o.Loadbalancers = &v +} + +// HasLoadbalancers returns a boolean if a field has been set. +func (o *DatacenterEntities) HasLoadbalancers() bool { + if o != nil && o.Loadbalancers != nil { + return true + } + + return false +} + + + +// GetLans returns the Lans field value +// If the value is explicit nil, the zero value for Lans will be returned +func (o *DatacenterEntities) GetLans() *Lans { + if o == nil { + return nil + } + + return o.Lans +} + +// GetLansOk returns a tuple with the Lans field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *DatacenterEntities) GetLansOk() (*Lans, bool) { + if o == nil { + return nil, false + } + return o.Lans, true +} + +// SetLans sets field value +func (o *DatacenterEntities) SetLans(v Lans) { + o.Lans = &v +} + +// HasLans returns a boolean if a field has been set. +func (o *DatacenterEntities) HasLans() bool { + if o != nil && o.Lans != nil { + return true + } + + return false +} + + +func (o DatacenterEntities) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Servers != nil { + toSerialize["servers"] = o.Servers + } + + + if o.Volumes != nil { + toSerialize["volumes"] = o.Volumes + } + + + if o.Loadbalancers != nil { + toSerialize["loadbalancers"] = o.Loadbalancers + } + + + if o.Lans != nil { + toSerialize["lans"] = o.Lans + } + + return json.Marshal(toSerialize) +} + +type NullableDatacenterEntities struct { + value *DatacenterEntities + isSet bool +} + +func (v NullableDatacenterEntities) Get() *DatacenterEntities { + return v.value +} + +func (v *NullableDatacenterEntities) Set(val *DatacenterEntities) { + v.value = val + v.isSet = true +} + +func (v NullableDatacenterEntities) IsSet() bool { + return v.isSet +} + +func (v *NullableDatacenterEntities) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDatacenterEntities(val *DatacenterEntities) *NullableDatacenterEntities { + return &NullableDatacenterEntities{value: val, isSet: true} +} + +func (v NullableDatacenterEntities) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDatacenterEntities) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_datacenter_properties.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_datacenter_properties.go new file mode 100644 index 0000000000..f25e20273c --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_datacenter_properties.go @@ -0,0 +1,321 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// DatacenterProperties struct for DatacenterProperties +type DatacenterProperties struct { + // A name of that resource + Name *string `json:"name,omitempty"` + // A description for the datacenter, e.g. staging, production + Description *string `json:"description,omitempty"` + // The physical location where the datacenter will be created. This will be where all of your servers live. Property cannot be modified after datacenter creation (disallowed in update requests) + Location *string `json:"location"` + // The version of that Data Center. Gets incremented with every change + Version *int32 `json:"version,omitempty"` + // List of features supported by the location this data center is part of + Features *[]string `json:"features,omitempty"` + // Boolean value representing if the data center requires extra protection e.g. two factor protection + SecAuthProtection *bool `json:"secAuthProtection,omitempty"` +} + + + +// GetName returns the Name field value +// If the value is explicit nil, the zero value for string will be returned +func (o *DatacenterProperties) GetName() *string { + if o == nil { + return nil + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *DatacenterProperties) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name, true +} + +// SetName sets field value +func (o *DatacenterProperties) SetName(v string) { + o.Name = &v +} + +// HasName returns a boolean if a field has been set. +func (o *DatacenterProperties) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + + + +// GetDescription returns the Description field value +// If the value is explicit nil, the zero value for string will be returned +func (o *DatacenterProperties) GetDescription() *string { + if o == nil { + return nil + } + + return o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *DatacenterProperties) GetDescriptionOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Description, true +} + +// SetDescription sets field value +func (o *DatacenterProperties) SetDescription(v string) { + o.Description = &v +} + +// HasDescription returns a boolean if a field has been set. +func (o *DatacenterProperties) HasDescription() bool { + if o != nil && o.Description != nil { + return true + } + + return false +} + + + +// GetLocation returns the Location field value +// If the value is explicit nil, the zero value for string will be returned +func (o *DatacenterProperties) GetLocation() *string { + if o == nil { + return nil + } + + return o.Location +} + +// GetLocationOk returns a tuple with the Location field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *DatacenterProperties) GetLocationOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Location, true +} + +// SetLocation sets field value +func (o *DatacenterProperties) SetLocation(v string) { + o.Location = &v +} + +// HasLocation returns a boolean if a field has been set. +func (o *DatacenterProperties) HasLocation() bool { + if o != nil && o.Location != nil { + return true + } + + return false +} + + + +// GetVersion returns the Version field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *DatacenterProperties) GetVersion() *int32 { + if o == nil { + return nil + } + + return o.Version +} + +// GetVersionOk returns a tuple with the Version field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *DatacenterProperties) GetVersionOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.Version, true +} + +// SetVersion sets field value +func (o *DatacenterProperties) SetVersion(v int32) { + o.Version = &v +} + +// HasVersion returns a boolean if a field has been set. +func (o *DatacenterProperties) HasVersion() bool { + if o != nil && o.Version != nil { + return true + } + + return false +} + + + +// GetFeatures returns the Features field value +// If the value is explicit nil, the zero value for []string will be returned +func (o *DatacenterProperties) GetFeatures() *[]string { + if o == nil { + return nil + } + + return o.Features +} + +// GetFeaturesOk returns a tuple with the Features field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *DatacenterProperties) GetFeaturesOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return o.Features, true +} + +// SetFeatures sets field value +func (o *DatacenterProperties) SetFeatures(v []string) { + o.Features = &v +} + +// HasFeatures returns a boolean if a field has been set. +func (o *DatacenterProperties) HasFeatures() bool { + if o != nil && o.Features != nil { + return true + } + + return false +} + + + +// GetSecAuthProtection returns the SecAuthProtection field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *DatacenterProperties) GetSecAuthProtection() *bool { + if o == nil { + return nil + } + + return o.SecAuthProtection +} + +// GetSecAuthProtectionOk returns a tuple with the SecAuthProtection field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *DatacenterProperties) GetSecAuthProtectionOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.SecAuthProtection, true +} + +// SetSecAuthProtection sets field value +func (o *DatacenterProperties) SetSecAuthProtection(v bool) { + o.SecAuthProtection = &v +} + +// HasSecAuthProtection returns a boolean if a field has been set. +func (o *DatacenterProperties) HasSecAuthProtection() bool { + if o != nil && o.SecAuthProtection != nil { + return true + } + + return false +} + + +func (o DatacenterProperties) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Name != nil { + toSerialize["name"] = o.Name + } + + + if o.Description != nil { + toSerialize["description"] = o.Description + } + + + if o.Location != nil { + toSerialize["location"] = o.Location + } + + + if o.Version != nil { + toSerialize["version"] = o.Version + } + + + if o.Features != nil { + toSerialize["features"] = o.Features + } + + + if o.SecAuthProtection != nil { + toSerialize["secAuthProtection"] = o.SecAuthProtection + } + + return json.Marshal(toSerialize) +} + +type NullableDatacenterProperties struct { + value *DatacenterProperties + isSet bool +} + +func (v NullableDatacenterProperties) Get() *DatacenterProperties { + return v.value +} + +func (v *NullableDatacenterProperties) Set(val *DatacenterProperties) { + v.value = val + v.isSet = true +} + +func (v NullableDatacenterProperties) IsSet() bool { + return v.isSet +} + +func (v *NullableDatacenterProperties) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDatacenterProperties(val *DatacenterProperties) *NullableDatacenterProperties { + return &NullableDatacenterProperties{value: val, isSet: true} +} + +func (v NullableDatacenterProperties) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDatacenterProperties) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_datacenters.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_datacenters.go new file mode 100644 index 0000000000..5c9e6c48cf --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_datacenters.go @@ -0,0 +1,235 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// Datacenters struct for Datacenters +type Datacenters struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of object that has been created + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + // Array of items in that collection + Items *[]Datacenter `json:"items,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Datacenters) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Datacenters) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *Datacenters) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *Datacenters) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *Datacenters) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Datacenters) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *Datacenters) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *Datacenters) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Datacenters) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Datacenters) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *Datacenters) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *Datacenters) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []Datacenter will be returned +func (o *Datacenters) GetItems() *[]Datacenter { + if o == nil { + return nil + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Datacenters) GetItemsOk() (*[]Datacenter, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *Datacenters) SetItems(v []Datacenter) { + o.Items = &v +} + +// HasItems returns a boolean if a field has been set. +func (o *Datacenters) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + + +func (o Datacenters) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullableDatacenters struct { + value *Datacenters + isSet bool +} + +func (v NullableDatacenters) Get() *Datacenters { + return v.value +} + +func (v *NullableDatacenters) Set(val *Datacenters) { + v.value = val + v.isSet = true +} + +func (v NullableDatacenters) IsSet() bool { + return v.isSet +} + +func (v *NullableDatacenters) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDatacenters(val *Datacenters) *NullableDatacenters { + return &NullableDatacenters{value: val, isSet: true} +} + +func (v NullableDatacenters) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDatacenters) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_error.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_error.go new file mode 100644 index 0000000000..42ef0a4a64 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_error.go @@ -0,0 +1,148 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// Error struct for Error +type Error struct { + // HTTP status code of the operation + HttpStatus *int32 `json:"httpStatus,omitempty"` + Messages *[]ErrorMessage `json:"messages,omitempty"` +} + + + +// GetHttpStatus returns the HttpStatus field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *Error) GetHttpStatus() *int32 { + if o == nil { + return nil + } + + return o.HttpStatus +} + +// GetHttpStatusOk returns a tuple with the HttpStatus field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Error) GetHttpStatusOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.HttpStatus, true +} + +// SetHttpStatus sets field value +func (o *Error) SetHttpStatus(v int32) { + o.HttpStatus = &v +} + +// HasHttpStatus returns a boolean if a field has been set. +func (o *Error) HasHttpStatus() bool { + if o != nil && o.HttpStatus != nil { + return true + } + + return false +} + + + +// GetMessages returns the Messages field value +// If the value is explicit nil, the zero value for []ErrorMessage will be returned +func (o *Error) GetMessages() *[]ErrorMessage { + if o == nil { + return nil + } + + return o.Messages +} + +// GetMessagesOk returns a tuple with the Messages field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Error) GetMessagesOk() (*[]ErrorMessage, bool) { + if o == nil { + return nil, false + } + return o.Messages, true +} + +// SetMessages sets field value +func (o *Error) SetMessages(v []ErrorMessage) { + o.Messages = &v +} + +// HasMessages returns a boolean if a field has been set. +func (o *Error) HasMessages() bool { + if o != nil && o.Messages != nil { + return true + } + + return false +} + + +func (o Error) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.HttpStatus != nil { + toSerialize["httpStatus"] = o.HttpStatus + } + + + if o.Messages != nil { + toSerialize["messages"] = o.Messages + } + + return json.Marshal(toSerialize) +} + +type NullableError struct { + value *Error + isSet bool +} + +func (v NullableError) Get() *Error { + return v.value +} + +func (v *NullableError) Set(val *Error) { + v.value = val + v.isSet = true +} + +func (v NullableError) IsSet() bool { + return v.isSet +} + +func (v *NullableError) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableError(val *Error) *NullableError { + return &NullableError{value: val, isSet: true} +} + +func (v NullableError) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableError) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_error_message.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_error_message.go new file mode 100644 index 0000000000..2c6fff83e6 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_error_message.go @@ -0,0 +1,149 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// ErrorMessage struct for ErrorMessage +type ErrorMessage struct { + // Application internal error code + ErrorCode *string `json:"errorCode,omitempty"` + // Human readable message + Message *string `json:"message,omitempty"` +} + + + +// GetErrorCode returns the ErrorCode field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ErrorMessage) GetErrorCode() *string { + if o == nil { + return nil + } + + return o.ErrorCode +} + +// GetErrorCodeOk returns a tuple with the ErrorCode field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ErrorMessage) GetErrorCodeOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.ErrorCode, true +} + +// SetErrorCode sets field value +func (o *ErrorMessage) SetErrorCode(v string) { + o.ErrorCode = &v +} + +// HasErrorCode returns a boolean if a field has been set. +func (o *ErrorMessage) HasErrorCode() bool { + if o != nil && o.ErrorCode != nil { + return true + } + + return false +} + + + +// GetMessage returns the Message field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ErrorMessage) GetMessage() *string { + if o == nil { + return nil + } + + return o.Message +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ErrorMessage) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Message, true +} + +// SetMessage sets field value +func (o *ErrorMessage) SetMessage(v string) { + o.Message = &v +} + +// HasMessage returns a boolean if a field has been set. +func (o *ErrorMessage) HasMessage() bool { + if o != nil && o.Message != nil { + return true + } + + return false +} + + +func (o ErrorMessage) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.ErrorCode != nil { + toSerialize["errorCode"] = o.ErrorCode + } + + + if o.Message != nil { + toSerialize["message"] = o.Message + } + + return json.Marshal(toSerialize) +} + +type NullableErrorMessage struct { + value *ErrorMessage + isSet bool +} + +func (v NullableErrorMessage) Get() *ErrorMessage { + return v.value +} + +func (v *NullableErrorMessage) Set(val *ErrorMessage) { + v.value = val + v.isSet = true +} + +func (v NullableErrorMessage) IsSet() bool { + return v.isSet +} + +func (v *NullableErrorMessage) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableErrorMessage(val *ErrorMessage) *NullableErrorMessage { + return &NullableErrorMessage{value: val, isSet: true} +} + +func (v NullableErrorMessage) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableErrorMessage) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_firewall_rule.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_firewall_rule.go new file mode 100644 index 0000000000..ae2bd73f66 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_firewall_rule.go @@ -0,0 +1,276 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// FirewallRule struct for FirewallRule +type FirewallRule struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of object that has been created + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` + Properties *FirewallruleProperties `json:"properties"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *FirewallRule) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *FirewallRule) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *FirewallRule) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *FirewallRule) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *FirewallRule) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *FirewallRule) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *FirewallRule) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *FirewallRule) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *FirewallRule) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *FirewallRule) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *FirewallRule) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *FirewallRule) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for DatacenterElementMetadata will be returned +func (o *FirewallRule) GetMetadata() *DatacenterElementMetadata { + if o == nil { + return nil + } + + return o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *FirewallRule) GetMetadataOk() (*DatacenterElementMetadata, bool) { + if o == nil { + return nil, false + } + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *FirewallRule) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + +// HasMetadata returns a boolean if a field has been set. +func (o *FirewallRule) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + + + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for FirewallruleProperties will be returned +func (o *FirewallRule) GetProperties() *FirewallruleProperties { + if o == nil { + return nil + } + + return o.Properties +} + +// GetPropertiesOk returns a tuple with the Properties field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *FirewallRule) GetPropertiesOk() (*FirewallruleProperties, bool) { + if o == nil { + return nil, false + } + return o.Properties, true +} + +// SetProperties sets field value +func (o *FirewallRule) SetProperties(v FirewallruleProperties) { + o.Properties = &v +} + +// HasProperties returns a boolean if a field has been set. +func (o *FirewallRule) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + + +func (o FirewallRule) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + return json.Marshal(toSerialize) +} + +type NullableFirewallRule struct { + value *FirewallRule + isSet bool +} + +func (v NullableFirewallRule) Get() *FirewallRule { + return v.value +} + +func (v *NullableFirewallRule) Set(val *FirewallRule) { + v.value = val + v.isSet = true +} + +func (v NullableFirewallRule) IsSet() bool { + return v.isSet +} + +func (v *NullableFirewallRule) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFirewallRule(val *FirewallRule) *NullableFirewallRule { + return &NullableFirewallRule{value: val, isSet: true} +} + +func (v NullableFirewallRule) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFirewallRule) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_firewall_rules.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_firewall_rules.go new file mode 100644 index 0000000000..bd46fb030b --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_firewall_rules.go @@ -0,0 +1,235 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// FirewallRules struct for FirewallRules +type FirewallRules struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of object that has been created + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + // Array of items in that collection + Items *[]FirewallRule `json:"items,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *FirewallRules) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *FirewallRules) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *FirewallRules) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *FirewallRules) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *FirewallRules) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *FirewallRules) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *FirewallRules) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *FirewallRules) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *FirewallRules) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *FirewallRules) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *FirewallRules) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *FirewallRules) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []FirewallRule will be returned +func (o *FirewallRules) GetItems() *[]FirewallRule { + if o == nil { + return nil + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *FirewallRules) GetItemsOk() (*[]FirewallRule, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *FirewallRules) SetItems(v []FirewallRule) { + o.Items = &v +} + +// HasItems returns a boolean if a field has been set. +func (o *FirewallRules) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + + +func (o FirewallRules) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullableFirewallRules struct { + value *FirewallRules + isSet bool +} + +func (v NullableFirewallRules) Get() *FirewallRules { + return v.value +} + +func (v *NullableFirewallRules) Set(val *FirewallRules) { + v.value = val + v.isSet = true +} + +func (v NullableFirewallRules) IsSet() bool { + return v.isSet +} + +func (v *NullableFirewallRules) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFirewallRules(val *FirewallRules) *NullableFirewallRules { + return &NullableFirewallRules{value: val, isSet: true} +} + +func (v NullableFirewallRules) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFirewallRules) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_firewallrule_properties.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_firewallrule_properties.go new file mode 100644 index 0000000000..501c5c7436 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_firewallrule_properties.go @@ -0,0 +1,450 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// FirewallruleProperties struct for FirewallruleProperties +type FirewallruleProperties struct { + // A name of that resource + Name *string `json:"name,omitempty"` + // The protocol for the rule. Property cannot be modified after creation (disallowed in update requests) + Protocol *string `json:"protocol"` + // Only traffic originating from the respective MAC address is allowed. Valid format: aa:bb:cc:dd:ee:ff. Value null allows all source MAC address + SourceMac *string `json:"sourceMac,omitempty"` + // Only traffic originating from the respective IPv4 address is allowed. Value null allows all source IPs + SourceIp *string `json:"sourceIp,omitempty"` + // In case the target NIC has multiple IP addresses, only traffic directed to the respective IP address of the NIC is allowed. Value null allows all target IPs + TargetIp *string `json:"targetIp,omitempty"` + // Defines the allowed code (from 0 to 254) if protocol ICMP is chosen. Value null allows all codes + IcmpCode *int32 `json:"icmpCode,omitempty"` + // Defines the allowed type (from 0 to 254) if the protocol ICMP is chosen. Value null allows all types + IcmpType *int32 `json:"icmpType,omitempty"` + // Defines the start range of the allowed port (from 1 to 65534) if protocol TCP or UDP is chosen. Leave portRangeStart and portRangeEnd value null to allow all ports + PortRangeStart *int32 `json:"portRangeStart,omitempty"` + // Defines the end range of the allowed port (from 1 to 65534) if the protocol TCP or UDP is chosen. Leave portRangeStart and portRangeEnd null to allow all ports + PortRangeEnd *int32 `json:"portRangeEnd,omitempty"` +} + + + +// GetName returns the Name field value +// If the value is explicit nil, the zero value for string will be returned +func (o *FirewallruleProperties) GetName() *string { + if o == nil { + return nil + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *FirewallruleProperties) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name, true +} + +// SetName sets field value +func (o *FirewallruleProperties) SetName(v string) { + o.Name = &v +} + +// HasName returns a boolean if a field has been set. +func (o *FirewallruleProperties) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + + + +// GetProtocol returns the Protocol field value +// If the value is explicit nil, the zero value for string will be returned +func (o *FirewallruleProperties) GetProtocol() *string { + if o == nil { + return nil + } + + return o.Protocol +} + +// GetProtocolOk returns a tuple with the Protocol field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *FirewallruleProperties) GetProtocolOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Protocol, true +} + +// SetProtocol sets field value +func (o *FirewallruleProperties) SetProtocol(v string) { + o.Protocol = &v +} + +// HasProtocol returns a boolean if a field has been set. +func (o *FirewallruleProperties) HasProtocol() bool { + if o != nil && o.Protocol != nil { + return true + } + + return false +} + + + +// GetSourceMac returns the SourceMac field value +// If the value is explicit nil, the zero value for string will be returned +func (o *FirewallruleProperties) GetSourceMac() *string { + if o == nil { + return nil + } + + return o.SourceMac +} + +// GetSourceMacOk returns a tuple with the SourceMac field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *FirewallruleProperties) GetSourceMacOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.SourceMac, true +} + +// SetSourceMac sets field value +func (o *FirewallruleProperties) SetSourceMac(v string) { + o.SourceMac = &v +} + +// HasSourceMac returns a boolean if a field has been set. +func (o *FirewallruleProperties) HasSourceMac() bool { + if o != nil && o.SourceMac != nil { + return true + } + + return false +} + + + +// GetSourceIp returns the SourceIp field value +// If the value is explicit nil, the zero value for string will be returned +func (o *FirewallruleProperties) GetSourceIp() *string { + if o == nil { + return nil + } + + return o.SourceIp +} + +// GetSourceIpOk returns a tuple with the SourceIp field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *FirewallruleProperties) GetSourceIpOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.SourceIp, true +} + +// SetSourceIp sets field value +func (o *FirewallruleProperties) SetSourceIp(v string) { + o.SourceIp = &v +} + +// HasSourceIp returns a boolean if a field has been set. +func (o *FirewallruleProperties) HasSourceIp() bool { + if o != nil && o.SourceIp != nil { + return true + } + + return false +} + + + +// GetTargetIp returns the TargetIp field value +// If the value is explicit nil, the zero value for string will be returned +func (o *FirewallruleProperties) GetTargetIp() *string { + if o == nil { + return nil + } + + return o.TargetIp +} + +// GetTargetIpOk returns a tuple with the TargetIp field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *FirewallruleProperties) GetTargetIpOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.TargetIp, true +} + +// SetTargetIp sets field value +func (o *FirewallruleProperties) SetTargetIp(v string) { + o.TargetIp = &v +} + +// HasTargetIp returns a boolean if a field has been set. +func (o *FirewallruleProperties) HasTargetIp() bool { + if o != nil && o.TargetIp != nil { + return true + } + + return false +} + + + +// GetIcmpCode returns the IcmpCode field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *FirewallruleProperties) GetIcmpCode() *int32 { + if o == nil { + return nil + } + + return o.IcmpCode +} + +// GetIcmpCodeOk returns a tuple with the IcmpCode field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *FirewallruleProperties) GetIcmpCodeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.IcmpCode, true +} + +// SetIcmpCode sets field value +func (o *FirewallruleProperties) SetIcmpCode(v int32) { + o.IcmpCode = &v +} + +// HasIcmpCode returns a boolean if a field has been set. +func (o *FirewallruleProperties) HasIcmpCode() bool { + if o != nil && o.IcmpCode != nil { + return true + } + + return false +} + + + +// GetIcmpType returns the IcmpType field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *FirewallruleProperties) GetIcmpType() *int32 { + if o == nil { + return nil + } + + return o.IcmpType +} + +// GetIcmpTypeOk returns a tuple with the IcmpType field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *FirewallruleProperties) GetIcmpTypeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.IcmpType, true +} + +// SetIcmpType sets field value +func (o *FirewallruleProperties) SetIcmpType(v int32) { + o.IcmpType = &v +} + +// HasIcmpType returns a boolean if a field has been set. +func (o *FirewallruleProperties) HasIcmpType() bool { + if o != nil && o.IcmpType != nil { + return true + } + + return false +} + + + +// GetPortRangeStart returns the PortRangeStart field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *FirewallruleProperties) GetPortRangeStart() *int32 { + if o == nil { + return nil + } + + return o.PortRangeStart +} + +// GetPortRangeStartOk returns a tuple with the PortRangeStart field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *FirewallruleProperties) GetPortRangeStartOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.PortRangeStart, true +} + +// SetPortRangeStart sets field value +func (o *FirewallruleProperties) SetPortRangeStart(v int32) { + o.PortRangeStart = &v +} + +// HasPortRangeStart returns a boolean if a field has been set. +func (o *FirewallruleProperties) HasPortRangeStart() bool { + if o != nil && o.PortRangeStart != nil { + return true + } + + return false +} + + + +// GetPortRangeEnd returns the PortRangeEnd field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *FirewallruleProperties) GetPortRangeEnd() *int32 { + if o == nil { + return nil + } + + return o.PortRangeEnd +} + +// GetPortRangeEndOk returns a tuple with the PortRangeEnd field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *FirewallruleProperties) GetPortRangeEndOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.PortRangeEnd, true +} + +// SetPortRangeEnd sets field value +func (o *FirewallruleProperties) SetPortRangeEnd(v int32) { + o.PortRangeEnd = &v +} + +// HasPortRangeEnd returns a boolean if a field has been set. +func (o *FirewallruleProperties) HasPortRangeEnd() bool { + if o != nil && o.PortRangeEnd != nil { + return true + } + + return false +} + + +func (o FirewallruleProperties) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Name != nil { + toSerialize["name"] = o.Name + } + + + if o.Protocol != nil { + toSerialize["protocol"] = o.Protocol + } + + + if o.SourceMac != nil { + toSerialize["sourceMac"] = o.SourceMac + } + + + if o.SourceIp != nil { + toSerialize["sourceIp"] = o.SourceIp + } + + + if o.TargetIp != nil { + toSerialize["targetIp"] = o.TargetIp + } + + + if o.IcmpCode != nil { + toSerialize["icmpCode"] = o.IcmpCode + } + + + if o.IcmpType != nil { + toSerialize["icmpType"] = o.IcmpType + } + + + if o.PortRangeStart != nil { + toSerialize["portRangeStart"] = o.PortRangeStart + } + + + if o.PortRangeEnd != nil { + toSerialize["portRangeEnd"] = o.PortRangeEnd + } + + return json.Marshal(toSerialize) +} + +type NullableFirewallruleProperties struct { + value *FirewallruleProperties + isSet bool +} + +func (v NullableFirewallruleProperties) Get() *FirewallruleProperties { + return v.value +} + +func (v *NullableFirewallruleProperties) Set(val *FirewallruleProperties) { + v.value = val + v.isSet = true +} + +func (v NullableFirewallruleProperties) IsSet() bool { + return v.isSet +} + +func (v *NullableFirewallruleProperties) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFirewallruleProperties(val *FirewallruleProperties) *NullableFirewallruleProperties { + return &NullableFirewallruleProperties{value: val, isSet: true} +} + +func (v NullableFirewallruleProperties) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFirewallruleProperties) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_group.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_group.go new file mode 100644 index 0000000000..c8d4c1a54b --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_group.go @@ -0,0 +1,276 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// Group struct for Group +type Group struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of the resource + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + Properties *GroupProperties `json:"properties"` + Entities *GroupEntities `json:"entities,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Group) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Group) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *Group) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *Group) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *Group) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Group) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *Group) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *Group) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Group) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Group) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *Group) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *Group) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for GroupProperties will be returned +func (o *Group) GetProperties() *GroupProperties { + if o == nil { + return nil + } + + return o.Properties +} + +// GetPropertiesOk returns a tuple with the Properties field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Group) GetPropertiesOk() (*GroupProperties, bool) { + if o == nil { + return nil, false + } + return o.Properties, true +} + +// SetProperties sets field value +func (o *Group) SetProperties(v GroupProperties) { + o.Properties = &v +} + +// HasProperties returns a boolean if a field has been set. +func (o *Group) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + + + +// GetEntities returns the Entities field value +// If the value is explicit nil, the zero value for GroupEntities will be returned +func (o *Group) GetEntities() *GroupEntities { + if o == nil { + return nil + } + + return o.Entities +} + +// GetEntitiesOk returns a tuple with the Entities field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Group) GetEntitiesOk() (*GroupEntities, bool) { + if o == nil { + return nil, false + } + return o.Entities, true +} + +// SetEntities sets field value +func (o *Group) SetEntities(v GroupEntities) { + o.Entities = &v +} + +// HasEntities returns a boolean if a field has been set. +func (o *Group) HasEntities() bool { + if o != nil && o.Entities != nil { + return true + } + + return false +} + + +func (o Group) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + + if o.Entities != nil { + toSerialize["entities"] = o.Entities + } + + return json.Marshal(toSerialize) +} + +type NullableGroup struct { + value *Group + isSet bool +} + +func (v NullableGroup) Get() *Group { + return v.value +} + +func (v *NullableGroup) Set(val *Group) { + v.value = val + v.isSet = true +} + +func (v NullableGroup) IsSet() bool { + return v.isSet +} + +func (v *NullableGroup) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGroup(val *Group) *NullableGroup { + return &NullableGroup{value: val, isSet: true} +} + +func (v NullableGroup) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGroup) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_group_entities.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_group_entities.go new file mode 100644 index 0000000000..f1b6f9d1b4 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_group_entities.go @@ -0,0 +1,147 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// GroupEntities struct for GroupEntities +type GroupEntities struct { + Users *GroupMembers `json:"users,omitempty"` + Resources *ResourceGroups `json:"resources,omitempty"` +} + + + +// GetUsers returns the Users field value +// If the value is explicit nil, the zero value for GroupMembers will be returned +func (o *GroupEntities) GetUsers() *GroupMembers { + if o == nil { + return nil + } + + return o.Users +} + +// GetUsersOk returns a tuple with the Users field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *GroupEntities) GetUsersOk() (*GroupMembers, bool) { + if o == nil { + return nil, false + } + return o.Users, true +} + +// SetUsers sets field value +func (o *GroupEntities) SetUsers(v GroupMembers) { + o.Users = &v +} + +// HasUsers returns a boolean if a field has been set. +func (o *GroupEntities) HasUsers() bool { + if o != nil && o.Users != nil { + return true + } + + return false +} + + + +// GetResources returns the Resources field value +// If the value is explicit nil, the zero value for ResourceGroups will be returned +func (o *GroupEntities) GetResources() *ResourceGroups { + if o == nil { + return nil + } + + return o.Resources +} + +// GetResourcesOk returns a tuple with the Resources field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *GroupEntities) GetResourcesOk() (*ResourceGroups, bool) { + if o == nil { + return nil, false + } + return o.Resources, true +} + +// SetResources sets field value +func (o *GroupEntities) SetResources(v ResourceGroups) { + o.Resources = &v +} + +// HasResources returns a boolean if a field has been set. +func (o *GroupEntities) HasResources() bool { + if o != nil && o.Resources != nil { + return true + } + + return false +} + + +func (o GroupEntities) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Users != nil { + toSerialize["users"] = o.Users + } + + + if o.Resources != nil { + toSerialize["resources"] = o.Resources + } + + return json.Marshal(toSerialize) +} + +type NullableGroupEntities struct { + value *GroupEntities + isSet bool +} + +func (v NullableGroupEntities) Get() *GroupEntities { + return v.value +} + +func (v *NullableGroupEntities) Set(val *GroupEntities) { + v.value = val + v.isSet = true +} + +func (v NullableGroupEntities) IsSet() bool { + return v.isSet +} + +func (v *NullableGroupEntities) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGroupEntities(val *GroupEntities) *NullableGroupEntities { + return &NullableGroupEntities{value: val, isSet: true} +} + +func (v NullableGroupEntities) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGroupEntities) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_group_members.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_group_members.go new file mode 100644 index 0000000000..a1df808df3 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_group_members.go @@ -0,0 +1,235 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// GroupMembers struct for GroupMembers +type GroupMembers struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of object that has been created + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + // Array of items in that collection + Items *[]User `json:"items,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *GroupMembers) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *GroupMembers) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *GroupMembers) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *GroupMembers) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *GroupMembers) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *GroupMembers) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *GroupMembers) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *GroupMembers) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *GroupMembers) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *GroupMembers) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *GroupMembers) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *GroupMembers) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []User will be returned +func (o *GroupMembers) GetItems() *[]User { + if o == nil { + return nil + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *GroupMembers) GetItemsOk() (*[]User, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *GroupMembers) SetItems(v []User) { + o.Items = &v +} + +// HasItems returns a boolean if a field has been set. +func (o *GroupMembers) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + + +func (o GroupMembers) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullableGroupMembers struct { + value *GroupMembers + isSet bool +} + +func (v NullableGroupMembers) Get() *GroupMembers { + return v.value +} + +func (v *NullableGroupMembers) Set(val *GroupMembers) { + v.value = val + v.isSet = true +} + +func (v NullableGroupMembers) IsSet() bool { + return v.isSet +} + +func (v *NullableGroupMembers) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGroupMembers(val *GroupMembers) *NullableGroupMembers { + return &NullableGroupMembers{value: val, isSet: true} +} + +func (v NullableGroupMembers) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGroupMembers) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_group_properties.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_group_properties.go new file mode 100644 index 0000000000..bbf75293b6 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_group_properties.go @@ -0,0 +1,493 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// GroupProperties struct for GroupProperties +type GroupProperties struct { + // A name of that resource + Name *string `json:"name,omitempty"` + // create data center privilege + CreateDataCenter *bool `json:"createDataCenter,omitempty"` + // create snapshot privilege + CreateSnapshot *bool `json:"createSnapshot,omitempty"` + // reserve ip block privilege + ReserveIp *bool `json:"reserveIp,omitempty"` + // activity log access privilege + AccessActivityLog *bool `json:"accessActivityLog,omitempty"` + // create pcc privilege + CreatePcc *bool `json:"createPcc,omitempty"` + // S3 privilege + S3Privilege *bool `json:"s3Privilege,omitempty"` + // create backup unit privilege + CreateBackupUnit *bool `json:"createBackupUnit,omitempty"` + // create internet access privilege + CreateInternetAccess *bool `json:"createInternetAccess,omitempty"` + // create kubernetes cluster privilege + CreateK8sCluster *bool `json:"createK8sCluster,omitempty"` +} + + + +// GetName returns the Name field value +// If the value is explicit nil, the zero value for string will be returned +func (o *GroupProperties) GetName() *string { + if o == nil { + return nil + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *GroupProperties) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name, true +} + +// SetName sets field value +func (o *GroupProperties) SetName(v string) { + o.Name = &v +} + +// HasName returns a boolean if a field has been set. +func (o *GroupProperties) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + + + +// GetCreateDataCenter returns the CreateDataCenter field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *GroupProperties) GetCreateDataCenter() *bool { + if o == nil { + return nil + } + + return o.CreateDataCenter +} + +// GetCreateDataCenterOk returns a tuple with the CreateDataCenter field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *GroupProperties) GetCreateDataCenterOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.CreateDataCenter, true +} + +// SetCreateDataCenter sets field value +func (o *GroupProperties) SetCreateDataCenter(v bool) { + o.CreateDataCenter = &v +} + +// HasCreateDataCenter returns a boolean if a field has been set. +func (o *GroupProperties) HasCreateDataCenter() bool { + if o != nil && o.CreateDataCenter != nil { + return true + } + + return false +} + + + +// GetCreateSnapshot returns the CreateSnapshot field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *GroupProperties) GetCreateSnapshot() *bool { + if o == nil { + return nil + } + + return o.CreateSnapshot +} + +// GetCreateSnapshotOk returns a tuple with the CreateSnapshot field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *GroupProperties) GetCreateSnapshotOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.CreateSnapshot, true +} + +// SetCreateSnapshot sets field value +func (o *GroupProperties) SetCreateSnapshot(v bool) { + o.CreateSnapshot = &v +} + +// HasCreateSnapshot returns a boolean if a field has been set. +func (o *GroupProperties) HasCreateSnapshot() bool { + if o != nil && o.CreateSnapshot != nil { + return true + } + + return false +} + + + +// GetReserveIp returns the ReserveIp field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *GroupProperties) GetReserveIp() *bool { + if o == nil { + return nil + } + + return o.ReserveIp +} + +// GetReserveIpOk returns a tuple with the ReserveIp field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *GroupProperties) GetReserveIpOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.ReserveIp, true +} + +// SetReserveIp sets field value +func (o *GroupProperties) SetReserveIp(v bool) { + o.ReserveIp = &v +} + +// HasReserveIp returns a boolean if a field has been set. +func (o *GroupProperties) HasReserveIp() bool { + if o != nil && o.ReserveIp != nil { + return true + } + + return false +} + + + +// GetAccessActivityLog returns the AccessActivityLog field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *GroupProperties) GetAccessActivityLog() *bool { + if o == nil { + return nil + } + + return o.AccessActivityLog +} + +// GetAccessActivityLogOk returns a tuple with the AccessActivityLog field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *GroupProperties) GetAccessActivityLogOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.AccessActivityLog, true +} + +// SetAccessActivityLog sets field value +func (o *GroupProperties) SetAccessActivityLog(v bool) { + o.AccessActivityLog = &v +} + +// HasAccessActivityLog returns a boolean if a field has been set. +func (o *GroupProperties) HasAccessActivityLog() bool { + if o != nil && o.AccessActivityLog != nil { + return true + } + + return false +} + + + +// GetCreatePcc returns the CreatePcc field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *GroupProperties) GetCreatePcc() *bool { + if o == nil { + return nil + } + + return o.CreatePcc +} + +// GetCreatePccOk returns a tuple with the CreatePcc field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *GroupProperties) GetCreatePccOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.CreatePcc, true +} + +// SetCreatePcc sets field value +func (o *GroupProperties) SetCreatePcc(v bool) { + o.CreatePcc = &v +} + +// HasCreatePcc returns a boolean if a field has been set. +func (o *GroupProperties) HasCreatePcc() bool { + if o != nil && o.CreatePcc != nil { + return true + } + + return false +} + + + +// GetS3Privilege returns the S3Privilege field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *GroupProperties) GetS3Privilege() *bool { + if o == nil { + return nil + } + + return o.S3Privilege +} + +// GetS3PrivilegeOk returns a tuple with the S3Privilege field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *GroupProperties) GetS3PrivilegeOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.S3Privilege, true +} + +// SetS3Privilege sets field value +func (o *GroupProperties) SetS3Privilege(v bool) { + o.S3Privilege = &v +} + +// HasS3Privilege returns a boolean if a field has been set. +func (o *GroupProperties) HasS3Privilege() bool { + if o != nil && o.S3Privilege != nil { + return true + } + + return false +} + + + +// GetCreateBackupUnit returns the CreateBackupUnit field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *GroupProperties) GetCreateBackupUnit() *bool { + if o == nil { + return nil + } + + return o.CreateBackupUnit +} + +// GetCreateBackupUnitOk returns a tuple with the CreateBackupUnit field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *GroupProperties) GetCreateBackupUnitOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.CreateBackupUnit, true +} + +// SetCreateBackupUnit sets field value +func (o *GroupProperties) SetCreateBackupUnit(v bool) { + o.CreateBackupUnit = &v +} + +// HasCreateBackupUnit returns a boolean if a field has been set. +func (o *GroupProperties) HasCreateBackupUnit() bool { + if o != nil && o.CreateBackupUnit != nil { + return true + } + + return false +} + + + +// GetCreateInternetAccess returns the CreateInternetAccess field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *GroupProperties) GetCreateInternetAccess() *bool { + if o == nil { + return nil + } + + return o.CreateInternetAccess +} + +// GetCreateInternetAccessOk returns a tuple with the CreateInternetAccess field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *GroupProperties) GetCreateInternetAccessOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.CreateInternetAccess, true +} + +// SetCreateInternetAccess sets field value +func (o *GroupProperties) SetCreateInternetAccess(v bool) { + o.CreateInternetAccess = &v +} + +// HasCreateInternetAccess returns a boolean if a field has been set. +func (o *GroupProperties) HasCreateInternetAccess() bool { + if o != nil && o.CreateInternetAccess != nil { + return true + } + + return false +} + + + +// GetCreateK8sCluster returns the CreateK8sCluster field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *GroupProperties) GetCreateK8sCluster() *bool { + if o == nil { + return nil + } + + return o.CreateK8sCluster +} + +// GetCreateK8sClusterOk returns a tuple with the CreateK8sCluster field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *GroupProperties) GetCreateK8sClusterOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.CreateK8sCluster, true +} + +// SetCreateK8sCluster sets field value +func (o *GroupProperties) SetCreateK8sCluster(v bool) { + o.CreateK8sCluster = &v +} + +// HasCreateK8sCluster returns a boolean if a field has been set. +func (o *GroupProperties) HasCreateK8sCluster() bool { + if o != nil && o.CreateK8sCluster != nil { + return true + } + + return false +} + + +func (o GroupProperties) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Name != nil { + toSerialize["name"] = o.Name + } + + + if o.CreateDataCenter != nil { + toSerialize["createDataCenter"] = o.CreateDataCenter + } + + + if o.CreateSnapshot != nil { + toSerialize["createSnapshot"] = o.CreateSnapshot + } + + + if o.ReserveIp != nil { + toSerialize["reserveIp"] = o.ReserveIp + } + + + if o.AccessActivityLog != nil { + toSerialize["accessActivityLog"] = o.AccessActivityLog + } + + + if o.CreatePcc != nil { + toSerialize["createPcc"] = o.CreatePcc + } + + + if o.S3Privilege != nil { + toSerialize["s3Privilege"] = o.S3Privilege + } + + + if o.CreateBackupUnit != nil { + toSerialize["createBackupUnit"] = o.CreateBackupUnit + } + + + if o.CreateInternetAccess != nil { + toSerialize["createInternetAccess"] = o.CreateInternetAccess + } + + + if o.CreateK8sCluster != nil { + toSerialize["createK8sCluster"] = o.CreateK8sCluster + } + + return json.Marshal(toSerialize) +} + +type NullableGroupProperties struct { + value *GroupProperties + isSet bool +} + +func (v NullableGroupProperties) Get() *GroupProperties { + return v.value +} + +func (v *NullableGroupProperties) Set(val *GroupProperties) { + v.value = val + v.isSet = true +} + +func (v NullableGroupProperties) IsSet() bool { + return v.isSet +} + +func (v *NullableGroupProperties) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGroupProperties(val *GroupProperties) *NullableGroupProperties { + return &NullableGroupProperties{value: val, isSet: true} +} + +func (v NullableGroupProperties) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGroupProperties) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_group_share.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_group_share.go new file mode 100644 index 0000000000..943a582591 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_group_share.go @@ -0,0 +1,234 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// GroupShare struct for GroupShare +type GroupShare struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // resource as generic type + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + Properties *GroupShareProperties `json:"properties"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *GroupShare) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *GroupShare) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *GroupShare) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *GroupShare) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *GroupShare) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *GroupShare) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *GroupShare) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *GroupShare) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *GroupShare) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *GroupShare) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *GroupShare) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *GroupShare) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for GroupShareProperties will be returned +func (o *GroupShare) GetProperties() *GroupShareProperties { + if o == nil { + return nil + } + + return o.Properties +} + +// GetPropertiesOk returns a tuple with the Properties field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *GroupShare) GetPropertiesOk() (*GroupShareProperties, bool) { + if o == nil { + return nil, false + } + return o.Properties, true +} + +// SetProperties sets field value +func (o *GroupShare) SetProperties(v GroupShareProperties) { + o.Properties = &v +} + +// HasProperties returns a boolean if a field has been set. +func (o *GroupShare) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + + +func (o GroupShare) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + return json.Marshal(toSerialize) +} + +type NullableGroupShare struct { + value *GroupShare + isSet bool +} + +func (v NullableGroupShare) Get() *GroupShare { + return v.value +} + +func (v *NullableGroupShare) Set(val *GroupShare) { + v.value = val + v.isSet = true +} + +func (v NullableGroupShare) IsSet() bool { + return v.isSet +} + +func (v *NullableGroupShare) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGroupShare(val *GroupShare) *NullableGroupShare { + return &NullableGroupShare{value: val, isSet: true} +} + +func (v NullableGroupShare) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGroupShare) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_group_share_properties.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_group_share_properties.go new file mode 100644 index 0000000000..d5dfce78ff --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_group_share_properties.go @@ -0,0 +1,149 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// GroupShareProperties struct for GroupShareProperties +type GroupShareProperties struct { + // edit privilege on a resource + EditPrivilege *bool `json:"editPrivilege,omitempty"` + // share privilege on a resource + SharePrivilege *bool `json:"sharePrivilege,omitempty"` +} + + + +// GetEditPrivilege returns the EditPrivilege field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *GroupShareProperties) GetEditPrivilege() *bool { + if o == nil { + return nil + } + + return o.EditPrivilege +} + +// GetEditPrivilegeOk returns a tuple with the EditPrivilege field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *GroupShareProperties) GetEditPrivilegeOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.EditPrivilege, true +} + +// SetEditPrivilege sets field value +func (o *GroupShareProperties) SetEditPrivilege(v bool) { + o.EditPrivilege = &v +} + +// HasEditPrivilege returns a boolean if a field has been set. +func (o *GroupShareProperties) HasEditPrivilege() bool { + if o != nil && o.EditPrivilege != nil { + return true + } + + return false +} + + + +// GetSharePrivilege returns the SharePrivilege field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *GroupShareProperties) GetSharePrivilege() *bool { + if o == nil { + return nil + } + + return o.SharePrivilege +} + +// GetSharePrivilegeOk returns a tuple with the SharePrivilege field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *GroupShareProperties) GetSharePrivilegeOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.SharePrivilege, true +} + +// SetSharePrivilege sets field value +func (o *GroupShareProperties) SetSharePrivilege(v bool) { + o.SharePrivilege = &v +} + +// HasSharePrivilege returns a boolean if a field has been set. +func (o *GroupShareProperties) HasSharePrivilege() bool { + if o != nil && o.SharePrivilege != nil { + return true + } + + return false +} + + +func (o GroupShareProperties) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.EditPrivilege != nil { + toSerialize["editPrivilege"] = o.EditPrivilege + } + + + if o.SharePrivilege != nil { + toSerialize["sharePrivilege"] = o.SharePrivilege + } + + return json.Marshal(toSerialize) +} + +type NullableGroupShareProperties struct { + value *GroupShareProperties + isSet bool +} + +func (v NullableGroupShareProperties) Get() *GroupShareProperties { + return v.value +} + +func (v *NullableGroupShareProperties) Set(val *GroupShareProperties) { + v.value = val + v.isSet = true +} + +func (v NullableGroupShareProperties) IsSet() bool { + return v.isSet +} + +func (v *NullableGroupShareProperties) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGroupShareProperties(val *GroupShareProperties) *NullableGroupShareProperties { + return &NullableGroupShareProperties{value: val, isSet: true} +} + +func (v NullableGroupShareProperties) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGroupShareProperties) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_group_shares.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_group_shares.go new file mode 100644 index 0000000000..1c3a6910af --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_group_shares.go @@ -0,0 +1,235 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// GroupShares struct for GroupShares +type GroupShares struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // Share representing groups and resource relationship + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + // Array of items in that collection + Items *[]GroupShare `json:"items,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *GroupShares) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *GroupShares) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *GroupShares) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *GroupShares) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *GroupShares) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *GroupShares) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *GroupShares) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *GroupShares) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *GroupShares) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *GroupShares) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *GroupShares) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *GroupShares) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []GroupShare will be returned +func (o *GroupShares) GetItems() *[]GroupShare { + if o == nil { + return nil + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *GroupShares) GetItemsOk() (*[]GroupShare, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *GroupShares) SetItems(v []GroupShare) { + o.Items = &v +} + +// HasItems returns a boolean if a field has been set. +func (o *GroupShares) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + + +func (o GroupShares) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullableGroupShares struct { + value *GroupShares + isSet bool +} + +func (v NullableGroupShares) Get() *GroupShares { + return v.value +} + +func (v *NullableGroupShares) Set(val *GroupShares) { + v.value = val + v.isSet = true +} + +func (v NullableGroupShares) IsSet() bool { + return v.isSet +} + +func (v *NullableGroupShares) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGroupShares(val *GroupShares) *NullableGroupShares { + return &NullableGroupShares{value: val, isSet: true} +} + +func (v NullableGroupShares) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGroupShares) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_group_users.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_group_users.go new file mode 100644 index 0000000000..503655e6d9 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_group_users.go @@ -0,0 +1,235 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// GroupUsers collection of groups a user is member of +type GroupUsers struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of the resource + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + // Array of items in that collection + Items *[]Group `json:"items,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *GroupUsers) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *GroupUsers) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *GroupUsers) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *GroupUsers) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *GroupUsers) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *GroupUsers) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *GroupUsers) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *GroupUsers) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *GroupUsers) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *GroupUsers) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *GroupUsers) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *GroupUsers) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []Group will be returned +func (o *GroupUsers) GetItems() *[]Group { + if o == nil { + return nil + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *GroupUsers) GetItemsOk() (*[]Group, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *GroupUsers) SetItems(v []Group) { + o.Items = &v +} + +// HasItems returns a boolean if a field has been set. +func (o *GroupUsers) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + + +func (o GroupUsers) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullableGroupUsers struct { + value *GroupUsers + isSet bool +} + +func (v NullableGroupUsers) Get() *GroupUsers { + return v.value +} + +func (v *NullableGroupUsers) Set(val *GroupUsers) { + v.value = val + v.isSet = true +} + +func (v NullableGroupUsers) IsSet() bool { + return v.isSet +} + +func (v *NullableGroupUsers) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGroupUsers(val *GroupUsers) *NullableGroupUsers { + return &NullableGroupUsers{value: val, isSet: true} +} + +func (v NullableGroupUsers) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGroupUsers) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_groups.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_groups.go new file mode 100644 index 0000000000..8b40fe7dab --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_groups.go @@ -0,0 +1,235 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// Groups struct for Groups +type Groups struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of the resource + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + // Array of items in that collection + Items *[]Group `json:"items,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Groups) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Groups) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *Groups) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *Groups) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *Groups) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Groups) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *Groups) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *Groups) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Groups) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Groups) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *Groups) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *Groups) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []Group will be returned +func (o *Groups) GetItems() *[]Group { + if o == nil { + return nil + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Groups) GetItemsOk() (*[]Group, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *Groups) SetItems(v []Group) { + o.Items = &v +} + +// HasItems returns a boolean if a field has been set. +func (o *Groups) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + + +func (o Groups) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullableGroups struct { + value *Groups + isSet bool +} + +func (v NullableGroups) Get() *Groups { + return v.value +} + +func (v *NullableGroups) Set(val *Groups) { + v.value = val + v.isSet = true +} + +func (v NullableGroups) IsSet() bool { + return v.isSet +} + +func (v *NullableGroups) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGroups(val *Groups) *NullableGroups { + return &NullableGroups{value: val, isSet: true} +} + +func (v NullableGroups) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGroups) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_image.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_image.go new file mode 100644 index 0000000000..1740e3dcbb --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_image.go @@ -0,0 +1,276 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// Image struct for Image +type Image struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of object that has been created + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` + Properties *ImageProperties `json:"properties"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Image) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Image) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *Image) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *Image) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *Image) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Image) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *Image) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *Image) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Image) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Image) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *Image) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *Image) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for DatacenterElementMetadata will be returned +func (o *Image) GetMetadata() *DatacenterElementMetadata { + if o == nil { + return nil + } + + return o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Image) GetMetadataOk() (*DatacenterElementMetadata, bool) { + if o == nil { + return nil, false + } + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *Image) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + +// HasMetadata returns a boolean if a field has been set. +func (o *Image) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + + + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for ImageProperties will be returned +func (o *Image) GetProperties() *ImageProperties { + if o == nil { + return nil + } + + return o.Properties +} + +// GetPropertiesOk returns a tuple with the Properties field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Image) GetPropertiesOk() (*ImageProperties, bool) { + if o == nil { + return nil, false + } + return o.Properties, true +} + +// SetProperties sets field value +func (o *Image) SetProperties(v ImageProperties) { + o.Properties = &v +} + +// HasProperties returns a boolean if a field has been set. +func (o *Image) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + + +func (o Image) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + return json.Marshal(toSerialize) +} + +type NullableImage struct { + value *Image + isSet bool +} + +func (v NullableImage) Get() *Image { + return v.value +} + +func (v *NullableImage) Set(val *Image) { + v.value = val + v.isSet = true +} + +func (v NullableImage) IsSet() bool { + return v.isSet +} + +func (v *NullableImage) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableImage(val *Image) *NullableImage { + return &NullableImage{value: val, isSet: true} +} + +func (v NullableImage) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableImage) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_image_properties.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_image_properties.go new file mode 100644 index 0000000000..7c277d3193 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_image_properties.go @@ -0,0 +1,794 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// ImageProperties struct for ImageProperties +type ImageProperties struct { + // A name of that resource + Name *string `json:"name,omitempty"` + // Human readable description + Description *string `json:"description,omitempty"` + // Location of that image/snapshot. + Location *string `json:"location,omitempty"` + // The size of the image in GB + Size *float32 `json:"size,omitempty"` + // Is capable of CPU hot plug (no reboot required) + CpuHotPlug *bool `json:"cpuHotPlug,omitempty"` + // Is capable of CPU hot unplug (no reboot required) + CpuHotUnplug *bool `json:"cpuHotUnplug,omitempty"` + // Is capable of memory hot plug (no reboot required) + RamHotPlug *bool `json:"ramHotPlug,omitempty"` + // Is capable of memory hot unplug (no reboot required) + RamHotUnplug *bool `json:"ramHotUnplug,omitempty"` + // Is capable of nic hot plug (no reboot required) + NicHotPlug *bool `json:"nicHotPlug,omitempty"` + // Is capable of nic hot unplug (no reboot required) + NicHotUnplug *bool `json:"nicHotUnplug,omitempty"` + // Is capable of Virt-IO drive hot plug (no reboot required) + DiscVirtioHotPlug *bool `json:"discVirtioHotPlug,omitempty"` + // Is capable of Virt-IO drive hot unplug (no reboot required). This works only for non-Windows virtual Machines. + DiscVirtioHotUnplug *bool `json:"discVirtioHotUnplug,omitempty"` + // Is capable of SCSI drive hot plug (no reboot required) + DiscScsiHotPlug *bool `json:"discScsiHotPlug,omitempty"` + // Is capable of SCSI drive hot unplug (no reboot required). This works only for non-Windows virtual Machines. + DiscScsiHotUnplug *bool `json:"discScsiHotUnplug,omitempty"` + // OS type of this Image + LicenceType *string `json:"licenceType"` + // This indicates the type of image + ImageType *string `json:"imageType,omitempty"` + // Indicates if the image is part of the public repository or not + Public *bool `json:"public,omitempty"` +} + + + +// GetName returns the Name field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ImageProperties) GetName() *string { + if o == nil { + return nil + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageProperties) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name, true +} + +// SetName sets field value +func (o *ImageProperties) SetName(v string) { + o.Name = &v +} + +// HasName returns a boolean if a field has been set. +func (o *ImageProperties) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + + + +// GetDescription returns the Description field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ImageProperties) GetDescription() *string { + if o == nil { + return nil + } + + return o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageProperties) GetDescriptionOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Description, true +} + +// SetDescription sets field value +func (o *ImageProperties) SetDescription(v string) { + o.Description = &v +} + +// HasDescription returns a boolean if a field has been set. +func (o *ImageProperties) HasDescription() bool { + if o != nil && o.Description != nil { + return true + } + + return false +} + + + +// GetLocation returns the Location field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ImageProperties) GetLocation() *string { + if o == nil { + return nil + } + + return o.Location +} + +// GetLocationOk returns a tuple with the Location field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageProperties) GetLocationOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Location, true +} + +// SetLocation sets field value +func (o *ImageProperties) SetLocation(v string) { + o.Location = &v +} + +// HasLocation returns a boolean if a field has been set. +func (o *ImageProperties) HasLocation() bool { + if o != nil && o.Location != nil { + return true + } + + return false +} + + + +// GetSize returns the Size field value +// If the value is explicit nil, the zero value for float32 will be returned +func (o *ImageProperties) GetSize() *float32 { + if o == nil { + return nil + } + + return o.Size +} + +// GetSizeOk returns a tuple with the Size field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageProperties) GetSizeOk() (*float32, bool) { + if o == nil { + return nil, false + } + return o.Size, true +} + +// SetSize sets field value +func (o *ImageProperties) SetSize(v float32) { + o.Size = &v +} + +// HasSize returns a boolean if a field has been set. +func (o *ImageProperties) HasSize() bool { + if o != nil && o.Size != nil { + return true + } + + return false +} + + + +// GetCpuHotPlug returns the CpuHotPlug field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *ImageProperties) GetCpuHotPlug() *bool { + if o == nil { + return nil + } + + return o.CpuHotPlug +} + +// GetCpuHotPlugOk returns a tuple with the CpuHotPlug field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageProperties) GetCpuHotPlugOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.CpuHotPlug, true +} + +// SetCpuHotPlug sets field value +func (o *ImageProperties) SetCpuHotPlug(v bool) { + o.CpuHotPlug = &v +} + +// HasCpuHotPlug returns a boolean if a field has been set. +func (o *ImageProperties) HasCpuHotPlug() bool { + if o != nil && o.CpuHotPlug != nil { + return true + } + + return false +} + + + +// GetCpuHotUnplug returns the CpuHotUnplug field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *ImageProperties) GetCpuHotUnplug() *bool { + if o == nil { + return nil + } + + return o.CpuHotUnplug +} + +// GetCpuHotUnplugOk returns a tuple with the CpuHotUnplug field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageProperties) GetCpuHotUnplugOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.CpuHotUnplug, true +} + +// SetCpuHotUnplug sets field value +func (o *ImageProperties) SetCpuHotUnplug(v bool) { + o.CpuHotUnplug = &v +} + +// HasCpuHotUnplug returns a boolean if a field has been set. +func (o *ImageProperties) HasCpuHotUnplug() bool { + if o != nil && o.CpuHotUnplug != nil { + return true + } + + return false +} + + + +// GetRamHotPlug returns the RamHotPlug field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *ImageProperties) GetRamHotPlug() *bool { + if o == nil { + return nil + } + + return o.RamHotPlug +} + +// GetRamHotPlugOk returns a tuple with the RamHotPlug field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageProperties) GetRamHotPlugOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.RamHotPlug, true +} + +// SetRamHotPlug sets field value +func (o *ImageProperties) SetRamHotPlug(v bool) { + o.RamHotPlug = &v +} + +// HasRamHotPlug returns a boolean if a field has been set. +func (o *ImageProperties) HasRamHotPlug() bool { + if o != nil && o.RamHotPlug != nil { + return true + } + + return false +} + + + +// GetRamHotUnplug returns the RamHotUnplug field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *ImageProperties) GetRamHotUnplug() *bool { + if o == nil { + return nil + } + + return o.RamHotUnplug +} + +// GetRamHotUnplugOk returns a tuple with the RamHotUnplug field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageProperties) GetRamHotUnplugOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.RamHotUnplug, true +} + +// SetRamHotUnplug sets field value +func (o *ImageProperties) SetRamHotUnplug(v bool) { + o.RamHotUnplug = &v +} + +// HasRamHotUnplug returns a boolean if a field has been set. +func (o *ImageProperties) HasRamHotUnplug() bool { + if o != nil && o.RamHotUnplug != nil { + return true + } + + return false +} + + + +// GetNicHotPlug returns the NicHotPlug field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *ImageProperties) GetNicHotPlug() *bool { + if o == nil { + return nil + } + + return o.NicHotPlug +} + +// GetNicHotPlugOk returns a tuple with the NicHotPlug field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageProperties) GetNicHotPlugOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.NicHotPlug, true +} + +// SetNicHotPlug sets field value +func (o *ImageProperties) SetNicHotPlug(v bool) { + o.NicHotPlug = &v +} + +// HasNicHotPlug returns a boolean if a field has been set. +func (o *ImageProperties) HasNicHotPlug() bool { + if o != nil && o.NicHotPlug != nil { + return true + } + + return false +} + + + +// GetNicHotUnplug returns the NicHotUnplug field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *ImageProperties) GetNicHotUnplug() *bool { + if o == nil { + return nil + } + + return o.NicHotUnplug +} + +// GetNicHotUnplugOk returns a tuple with the NicHotUnplug field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageProperties) GetNicHotUnplugOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.NicHotUnplug, true +} + +// SetNicHotUnplug sets field value +func (o *ImageProperties) SetNicHotUnplug(v bool) { + o.NicHotUnplug = &v +} + +// HasNicHotUnplug returns a boolean if a field has been set. +func (o *ImageProperties) HasNicHotUnplug() bool { + if o != nil && o.NicHotUnplug != nil { + return true + } + + return false +} + + + +// GetDiscVirtioHotPlug returns the DiscVirtioHotPlug field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *ImageProperties) GetDiscVirtioHotPlug() *bool { + if o == nil { + return nil + } + + return o.DiscVirtioHotPlug +} + +// GetDiscVirtioHotPlugOk returns a tuple with the DiscVirtioHotPlug field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageProperties) GetDiscVirtioHotPlugOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.DiscVirtioHotPlug, true +} + +// SetDiscVirtioHotPlug sets field value +func (o *ImageProperties) SetDiscVirtioHotPlug(v bool) { + o.DiscVirtioHotPlug = &v +} + +// HasDiscVirtioHotPlug returns a boolean if a field has been set. +func (o *ImageProperties) HasDiscVirtioHotPlug() bool { + if o != nil && o.DiscVirtioHotPlug != nil { + return true + } + + return false +} + + + +// GetDiscVirtioHotUnplug returns the DiscVirtioHotUnplug field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *ImageProperties) GetDiscVirtioHotUnplug() *bool { + if o == nil { + return nil + } + + return o.DiscVirtioHotUnplug +} + +// GetDiscVirtioHotUnplugOk returns a tuple with the DiscVirtioHotUnplug field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageProperties) GetDiscVirtioHotUnplugOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.DiscVirtioHotUnplug, true +} + +// SetDiscVirtioHotUnplug sets field value +func (o *ImageProperties) SetDiscVirtioHotUnplug(v bool) { + o.DiscVirtioHotUnplug = &v +} + +// HasDiscVirtioHotUnplug returns a boolean if a field has been set. +func (o *ImageProperties) HasDiscVirtioHotUnplug() bool { + if o != nil && o.DiscVirtioHotUnplug != nil { + return true + } + + return false +} + + + +// GetDiscScsiHotPlug returns the DiscScsiHotPlug field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *ImageProperties) GetDiscScsiHotPlug() *bool { + if o == nil { + return nil + } + + return o.DiscScsiHotPlug +} + +// GetDiscScsiHotPlugOk returns a tuple with the DiscScsiHotPlug field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageProperties) GetDiscScsiHotPlugOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.DiscScsiHotPlug, true +} + +// SetDiscScsiHotPlug sets field value +func (o *ImageProperties) SetDiscScsiHotPlug(v bool) { + o.DiscScsiHotPlug = &v +} + +// HasDiscScsiHotPlug returns a boolean if a field has been set. +func (o *ImageProperties) HasDiscScsiHotPlug() bool { + if o != nil && o.DiscScsiHotPlug != nil { + return true + } + + return false +} + + + +// GetDiscScsiHotUnplug returns the DiscScsiHotUnplug field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *ImageProperties) GetDiscScsiHotUnplug() *bool { + if o == nil { + return nil + } + + return o.DiscScsiHotUnplug +} + +// GetDiscScsiHotUnplugOk returns a tuple with the DiscScsiHotUnplug field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageProperties) GetDiscScsiHotUnplugOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.DiscScsiHotUnplug, true +} + +// SetDiscScsiHotUnplug sets field value +func (o *ImageProperties) SetDiscScsiHotUnplug(v bool) { + o.DiscScsiHotUnplug = &v +} + +// HasDiscScsiHotUnplug returns a boolean if a field has been set. +func (o *ImageProperties) HasDiscScsiHotUnplug() bool { + if o != nil && o.DiscScsiHotUnplug != nil { + return true + } + + return false +} + + + +// GetLicenceType returns the LicenceType field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ImageProperties) GetLicenceType() *string { + if o == nil { + return nil + } + + return o.LicenceType +} + +// GetLicenceTypeOk returns a tuple with the LicenceType field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageProperties) GetLicenceTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.LicenceType, true +} + +// SetLicenceType sets field value +func (o *ImageProperties) SetLicenceType(v string) { + o.LicenceType = &v +} + +// HasLicenceType returns a boolean if a field has been set. +func (o *ImageProperties) HasLicenceType() bool { + if o != nil && o.LicenceType != nil { + return true + } + + return false +} + + + +// GetImageType returns the ImageType field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ImageProperties) GetImageType() *string { + if o == nil { + return nil + } + + return o.ImageType +} + +// GetImageTypeOk returns a tuple with the ImageType field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageProperties) GetImageTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.ImageType, true +} + +// SetImageType sets field value +func (o *ImageProperties) SetImageType(v string) { + o.ImageType = &v +} + +// HasImageType returns a boolean if a field has been set. +func (o *ImageProperties) HasImageType() bool { + if o != nil && o.ImageType != nil { + return true + } + + return false +} + + + +// GetPublic returns the Public field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *ImageProperties) GetPublic() *bool { + if o == nil { + return nil + } + + return o.Public +} + +// GetPublicOk returns a tuple with the Public field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageProperties) GetPublicOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.Public, true +} + +// SetPublic sets field value +func (o *ImageProperties) SetPublic(v bool) { + o.Public = &v +} + +// HasPublic returns a boolean if a field has been set. +func (o *ImageProperties) HasPublic() bool { + if o != nil && o.Public != nil { + return true + } + + return false +} + + +func (o ImageProperties) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Name != nil { + toSerialize["name"] = o.Name + } + + + if o.Description != nil { + toSerialize["description"] = o.Description + } + + + if o.Location != nil { + toSerialize["location"] = o.Location + } + + + if o.Size != nil { + toSerialize["size"] = o.Size + } + + + if o.CpuHotPlug != nil { + toSerialize["cpuHotPlug"] = o.CpuHotPlug + } + + + if o.CpuHotUnplug != nil { + toSerialize["cpuHotUnplug"] = o.CpuHotUnplug + } + + + if o.RamHotPlug != nil { + toSerialize["ramHotPlug"] = o.RamHotPlug + } + + + if o.RamHotUnplug != nil { + toSerialize["ramHotUnplug"] = o.RamHotUnplug + } + + + if o.NicHotPlug != nil { + toSerialize["nicHotPlug"] = o.NicHotPlug + } + + + if o.NicHotUnplug != nil { + toSerialize["nicHotUnplug"] = o.NicHotUnplug + } + + + if o.DiscVirtioHotPlug != nil { + toSerialize["discVirtioHotPlug"] = o.DiscVirtioHotPlug + } + + + if o.DiscVirtioHotUnplug != nil { + toSerialize["discVirtioHotUnplug"] = o.DiscVirtioHotUnplug + } + + + if o.DiscScsiHotPlug != nil { + toSerialize["discScsiHotPlug"] = o.DiscScsiHotPlug + } + + + if o.DiscScsiHotUnplug != nil { + toSerialize["discScsiHotUnplug"] = o.DiscScsiHotUnplug + } + + + if o.LicenceType != nil { + toSerialize["licenceType"] = o.LicenceType + } + + + if o.ImageType != nil { + toSerialize["imageType"] = o.ImageType + } + + + if o.Public != nil { + toSerialize["public"] = o.Public + } + + return json.Marshal(toSerialize) +} + +type NullableImageProperties struct { + value *ImageProperties + isSet bool +} + +func (v NullableImageProperties) Get() *ImageProperties { + return v.value +} + +func (v *NullableImageProperties) Set(val *ImageProperties) { + v.value = val + v.isSet = true +} + +func (v NullableImageProperties) IsSet() bool { + return v.isSet +} + +func (v *NullableImageProperties) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableImageProperties(val *ImageProperties) *NullableImageProperties { + return &NullableImageProperties{value: val, isSet: true} +} + +func (v NullableImageProperties) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableImageProperties) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_images.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_images.go new file mode 100644 index 0000000000..014b165f06 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_images.go @@ -0,0 +1,235 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// Images struct for Images +type Images struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of object that has been created + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + // Array of items in that collection + Items *[]Image `json:"items,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Images) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Images) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *Images) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *Images) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *Images) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Images) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *Images) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *Images) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Images) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Images) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *Images) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *Images) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []Image will be returned +func (o *Images) GetItems() *[]Image { + if o == nil { + return nil + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Images) GetItemsOk() (*[]Image, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *Images) SetItems(v []Image) { + o.Items = &v +} + +// HasItems returns a boolean if a field has been set. +func (o *Images) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + + +func (o Images) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullableImages struct { + value *Images + isSet bool +} + +func (v NullableImages) Get() *Images { + return v.value +} + +func (v *NullableImages) Set(val *Images) { + v.value = val + v.isSet = true +} + +func (v NullableImages) IsSet() bool { + return v.isSet +} + +func (v *NullableImages) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableImages(val *Images) *NullableImages { + return &NullableImages{value: val, isSet: true} +} + +func (v NullableImages) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableImages) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_info.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_info.go new file mode 100644 index 0000000000..e07988ee72 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_info.go @@ -0,0 +1,192 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// Info struct for Info +type Info struct { + // API entry point + Href *string `json:"href,omitempty"` + // Name of the API + Name *string `json:"name,omitempty"` + // Version of the API + Version *string `json:"version,omitempty"` +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Info) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Info) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *Info) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *Info) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetName returns the Name field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Info) GetName() *string { + if o == nil { + return nil + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Info) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name, true +} + +// SetName sets field value +func (o *Info) SetName(v string) { + o.Name = &v +} + +// HasName returns a boolean if a field has been set. +func (o *Info) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + + + +// GetVersion returns the Version field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Info) GetVersion() *string { + if o == nil { + return nil + } + + return o.Version +} + +// GetVersionOk returns a tuple with the Version field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Info) GetVersionOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Version, true +} + +// SetVersion sets field value +func (o *Info) SetVersion(v string) { + o.Version = &v +} + +// HasVersion returns a boolean if a field has been set. +func (o *Info) HasVersion() bool { + if o != nil && o.Version != nil { + return true + } + + return false +} + + +func (o Info) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Name != nil { + toSerialize["name"] = o.Name + } + + + if o.Version != nil { + toSerialize["version"] = o.Version + } + + return json.Marshal(toSerialize) +} + +type NullableInfo struct { + value *Info + isSet bool +} + +func (v NullableInfo) Get() *Info { + return v.value +} + +func (v *NullableInfo) Set(val *Info) { + v.value = val + v.isSet = true +} + +func (v NullableInfo) IsSet() bool { + return v.isSet +} + +func (v *NullableInfo) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInfo(val *Info) *NullableInfo { + return &NullableInfo{value: val, isSet: true} +} + +func (v NullableInfo) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInfo) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_ip_block.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_ip_block.go new file mode 100644 index 0000000000..f9cd95bc29 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_ip_block.go @@ -0,0 +1,276 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// IpBlock struct for IpBlock +type IpBlock struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of object that has been created + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` + Properties *IpBlockProperties `json:"properties"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *IpBlock) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *IpBlock) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *IpBlock) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *IpBlock) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *IpBlock) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *IpBlock) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *IpBlock) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *IpBlock) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *IpBlock) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *IpBlock) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *IpBlock) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *IpBlock) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for DatacenterElementMetadata will be returned +func (o *IpBlock) GetMetadata() *DatacenterElementMetadata { + if o == nil { + return nil + } + + return o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *IpBlock) GetMetadataOk() (*DatacenterElementMetadata, bool) { + if o == nil { + return nil, false + } + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *IpBlock) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + +// HasMetadata returns a boolean if a field has been set. +func (o *IpBlock) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + + + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for IpBlockProperties will be returned +func (o *IpBlock) GetProperties() *IpBlockProperties { + if o == nil { + return nil + } + + return o.Properties +} + +// GetPropertiesOk returns a tuple with the Properties field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *IpBlock) GetPropertiesOk() (*IpBlockProperties, bool) { + if o == nil { + return nil, false + } + return o.Properties, true +} + +// SetProperties sets field value +func (o *IpBlock) SetProperties(v IpBlockProperties) { + o.Properties = &v +} + +// HasProperties returns a boolean if a field has been set. +func (o *IpBlock) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + + +func (o IpBlock) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + return json.Marshal(toSerialize) +} + +type NullableIpBlock struct { + value *IpBlock + isSet bool +} + +func (v NullableIpBlock) Get() *IpBlock { + return v.value +} + +func (v *NullableIpBlock) Set(val *IpBlock) { + v.value = val + v.isSet = true +} + +func (v NullableIpBlock) IsSet() bool { + return v.isSet +} + +func (v *NullableIpBlock) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIpBlock(val *IpBlock) *NullableIpBlock { + return &NullableIpBlock{value: val, isSet: true} +} + +func (v NullableIpBlock) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIpBlock) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_ip_block_properties.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_ip_block_properties.go new file mode 100644 index 0000000000..14fde442d4 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_ip_block_properties.go @@ -0,0 +1,278 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// IpBlockProperties struct for IpBlockProperties +type IpBlockProperties struct { + // A collection of IPs associated with the IP Block + Ips *[]string `json:"ips,omitempty"` + // Location of that IP Block. Property cannot be modified after creation (disallowed in update requests) + Location *string `json:"location"` + // The size of the IP block + Size *int32 `json:"size"` + // A name of that resource + Name *string `json:"name,omitempty"` + // Read-Only attribute. Lists consumption detail of an individual ip + IpConsumers *[]IpConsumer `json:"ipConsumers,omitempty"` +} + + + +// GetIps returns the Ips field value +// If the value is explicit nil, the zero value for []string will be returned +func (o *IpBlockProperties) GetIps() *[]string { + if o == nil { + return nil + } + + return o.Ips +} + +// GetIpsOk returns a tuple with the Ips field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *IpBlockProperties) GetIpsOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return o.Ips, true +} + +// SetIps sets field value +func (o *IpBlockProperties) SetIps(v []string) { + o.Ips = &v +} + +// HasIps returns a boolean if a field has been set. +func (o *IpBlockProperties) HasIps() bool { + if o != nil && o.Ips != nil { + return true + } + + return false +} + + + +// GetLocation returns the Location field value +// If the value is explicit nil, the zero value for string will be returned +func (o *IpBlockProperties) GetLocation() *string { + if o == nil { + return nil + } + + return o.Location +} + +// GetLocationOk returns a tuple with the Location field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *IpBlockProperties) GetLocationOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Location, true +} + +// SetLocation sets field value +func (o *IpBlockProperties) SetLocation(v string) { + o.Location = &v +} + +// HasLocation returns a boolean if a field has been set. +func (o *IpBlockProperties) HasLocation() bool { + if o != nil && o.Location != nil { + return true + } + + return false +} + + + +// GetSize returns the Size field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *IpBlockProperties) GetSize() *int32 { + if o == nil { + return nil + } + + return o.Size +} + +// GetSizeOk returns a tuple with the Size field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *IpBlockProperties) GetSizeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.Size, true +} + +// SetSize sets field value +func (o *IpBlockProperties) SetSize(v int32) { + o.Size = &v +} + +// HasSize returns a boolean if a field has been set. +func (o *IpBlockProperties) HasSize() bool { + if o != nil && o.Size != nil { + return true + } + + return false +} + + + +// GetName returns the Name field value +// If the value is explicit nil, the zero value for string will be returned +func (o *IpBlockProperties) GetName() *string { + if o == nil { + return nil + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *IpBlockProperties) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name, true +} + +// SetName sets field value +func (o *IpBlockProperties) SetName(v string) { + o.Name = &v +} + +// HasName returns a boolean if a field has been set. +func (o *IpBlockProperties) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + + + +// GetIpConsumers returns the IpConsumers field value +// If the value is explicit nil, the zero value for []IpConsumer will be returned +func (o *IpBlockProperties) GetIpConsumers() *[]IpConsumer { + if o == nil { + return nil + } + + return o.IpConsumers +} + +// GetIpConsumersOk returns a tuple with the IpConsumers field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *IpBlockProperties) GetIpConsumersOk() (*[]IpConsumer, bool) { + if o == nil { + return nil, false + } + return o.IpConsumers, true +} + +// SetIpConsumers sets field value +func (o *IpBlockProperties) SetIpConsumers(v []IpConsumer) { + o.IpConsumers = &v +} + +// HasIpConsumers returns a boolean if a field has been set. +func (o *IpBlockProperties) HasIpConsumers() bool { + if o != nil && o.IpConsumers != nil { + return true + } + + return false +} + + +func (o IpBlockProperties) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Ips != nil { + toSerialize["ips"] = o.Ips + } + + + if o.Location != nil { + toSerialize["location"] = o.Location + } + + + if o.Size != nil { + toSerialize["size"] = o.Size + } + + + if o.Name != nil { + toSerialize["name"] = o.Name + } + + + if o.IpConsumers != nil { + toSerialize["ipConsumers"] = o.IpConsumers + } + + return json.Marshal(toSerialize) +} + +type NullableIpBlockProperties struct { + value *IpBlockProperties + isSet bool +} + +func (v NullableIpBlockProperties) Get() *IpBlockProperties { + return v.value +} + +func (v *NullableIpBlockProperties) Set(val *IpBlockProperties) { + v.value = val + v.isSet = true +} + +func (v NullableIpBlockProperties) IsSet() bool { + return v.isSet +} + +func (v *NullableIpBlockProperties) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIpBlockProperties(val *IpBlockProperties) *NullableIpBlockProperties { + return &NullableIpBlockProperties{value: val, isSet: true} +} + +func (v NullableIpBlockProperties) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIpBlockProperties) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_ip_blocks.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_ip_blocks.go new file mode 100644 index 0000000000..a74f915346 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_ip_blocks.go @@ -0,0 +1,235 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// IpBlocks struct for IpBlocks +type IpBlocks struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of object that has been created + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + // Array of items in that collection + Items *[]IpBlock `json:"items,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *IpBlocks) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *IpBlocks) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *IpBlocks) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *IpBlocks) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *IpBlocks) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *IpBlocks) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *IpBlocks) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *IpBlocks) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *IpBlocks) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *IpBlocks) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *IpBlocks) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *IpBlocks) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []IpBlock will be returned +func (o *IpBlocks) GetItems() *[]IpBlock { + if o == nil { + return nil + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *IpBlocks) GetItemsOk() (*[]IpBlock, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *IpBlocks) SetItems(v []IpBlock) { + o.Items = &v +} + +// HasItems returns a boolean if a field has been set. +func (o *IpBlocks) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + + +func (o IpBlocks) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullableIpBlocks struct { + value *IpBlocks + isSet bool +} + +func (v NullableIpBlocks) Get() *IpBlocks { + return v.value +} + +func (v *NullableIpBlocks) Set(val *IpBlocks) { + v.value = val + v.isSet = true +} + +func (v NullableIpBlocks) IsSet() bool { + return v.isSet +} + +func (v *NullableIpBlocks) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIpBlocks(val *IpBlocks) *NullableIpBlocks { + return &NullableIpBlocks{value: val, isSet: true} +} + +func (v NullableIpBlocks) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIpBlocks) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_ip_consumer.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_ip_consumer.go new file mode 100644 index 0000000000..cc70643256 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_ip_consumer.go @@ -0,0 +1,357 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// IpConsumer struct for IpConsumer +type IpConsumer struct { + Ip *string `json:"ip,omitempty"` + Mac *string `json:"mac,omitempty"` + NicId *string `json:"nicId,omitempty"` + ServerId *string `json:"serverId,omitempty"` + ServerName *string `json:"serverName,omitempty"` + DatacenterId *string `json:"datacenterId,omitempty"` + DatacenterName *string `json:"datacenterName,omitempty"` +} + + + +// GetIp returns the Ip field value +// If the value is explicit nil, the zero value for string will be returned +func (o *IpConsumer) GetIp() *string { + if o == nil { + return nil + } + + return o.Ip +} + +// GetIpOk returns a tuple with the Ip field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *IpConsumer) GetIpOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Ip, true +} + +// SetIp sets field value +func (o *IpConsumer) SetIp(v string) { + o.Ip = &v +} + +// HasIp returns a boolean if a field has been set. +func (o *IpConsumer) HasIp() bool { + if o != nil && o.Ip != nil { + return true + } + + return false +} + + + +// GetMac returns the Mac field value +// If the value is explicit nil, the zero value for string will be returned +func (o *IpConsumer) GetMac() *string { + if o == nil { + return nil + } + + return o.Mac +} + +// GetMacOk returns a tuple with the Mac field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *IpConsumer) GetMacOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Mac, true +} + +// SetMac sets field value +func (o *IpConsumer) SetMac(v string) { + o.Mac = &v +} + +// HasMac returns a boolean if a field has been set. +func (o *IpConsumer) HasMac() bool { + if o != nil && o.Mac != nil { + return true + } + + return false +} + + + +// GetNicId returns the NicId field value +// If the value is explicit nil, the zero value for string will be returned +func (o *IpConsumer) GetNicId() *string { + if o == nil { + return nil + } + + return o.NicId +} + +// GetNicIdOk returns a tuple with the NicId field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *IpConsumer) GetNicIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.NicId, true +} + +// SetNicId sets field value +func (o *IpConsumer) SetNicId(v string) { + o.NicId = &v +} + +// HasNicId returns a boolean if a field has been set. +func (o *IpConsumer) HasNicId() bool { + if o != nil && o.NicId != nil { + return true + } + + return false +} + + + +// GetServerId returns the ServerId field value +// If the value is explicit nil, the zero value for string will be returned +func (o *IpConsumer) GetServerId() *string { + if o == nil { + return nil + } + + return o.ServerId +} + +// GetServerIdOk returns a tuple with the ServerId field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *IpConsumer) GetServerIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.ServerId, true +} + +// SetServerId sets field value +func (o *IpConsumer) SetServerId(v string) { + o.ServerId = &v +} + +// HasServerId returns a boolean if a field has been set. +func (o *IpConsumer) HasServerId() bool { + if o != nil && o.ServerId != nil { + return true + } + + return false +} + + + +// GetServerName returns the ServerName field value +// If the value is explicit nil, the zero value for string will be returned +func (o *IpConsumer) GetServerName() *string { + if o == nil { + return nil + } + + return o.ServerName +} + +// GetServerNameOk returns a tuple with the ServerName field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *IpConsumer) GetServerNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.ServerName, true +} + +// SetServerName sets field value +func (o *IpConsumer) SetServerName(v string) { + o.ServerName = &v +} + +// HasServerName returns a boolean if a field has been set. +func (o *IpConsumer) HasServerName() bool { + if o != nil && o.ServerName != nil { + return true + } + + return false +} + + + +// GetDatacenterId returns the DatacenterId field value +// If the value is explicit nil, the zero value for string will be returned +func (o *IpConsumer) GetDatacenterId() *string { + if o == nil { + return nil + } + + return o.DatacenterId +} + +// GetDatacenterIdOk returns a tuple with the DatacenterId field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *IpConsumer) GetDatacenterIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.DatacenterId, true +} + +// SetDatacenterId sets field value +func (o *IpConsumer) SetDatacenterId(v string) { + o.DatacenterId = &v +} + +// HasDatacenterId returns a boolean if a field has been set. +func (o *IpConsumer) HasDatacenterId() bool { + if o != nil && o.DatacenterId != nil { + return true + } + + return false +} + + + +// GetDatacenterName returns the DatacenterName field value +// If the value is explicit nil, the zero value for string will be returned +func (o *IpConsumer) GetDatacenterName() *string { + if o == nil { + return nil + } + + return o.DatacenterName +} + +// GetDatacenterNameOk returns a tuple with the DatacenterName field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *IpConsumer) GetDatacenterNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.DatacenterName, true +} + +// SetDatacenterName sets field value +func (o *IpConsumer) SetDatacenterName(v string) { + o.DatacenterName = &v +} + +// HasDatacenterName returns a boolean if a field has been set. +func (o *IpConsumer) HasDatacenterName() bool { + if o != nil && o.DatacenterName != nil { + return true + } + + return false +} + + +func (o IpConsumer) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Ip != nil { + toSerialize["ip"] = o.Ip + } + + + if o.Mac != nil { + toSerialize["mac"] = o.Mac + } + + + if o.NicId != nil { + toSerialize["nicId"] = o.NicId + } + + + if o.ServerId != nil { + toSerialize["serverId"] = o.ServerId + } + + + if o.ServerName != nil { + toSerialize["serverName"] = o.ServerName + } + + + if o.DatacenterId != nil { + toSerialize["datacenterId"] = o.DatacenterId + } + + + if o.DatacenterName != nil { + toSerialize["datacenterName"] = o.DatacenterName + } + + return json.Marshal(toSerialize) +} + +type NullableIpConsumer struct { + value *IpConsumer + isSet bool +} + +func (v NullableIpConsumer) Get() *IpConsumer { + return v.value +} + +func (v *NullableIpConsumer) Set(val *IpConsumer) { + v.value = val + v.isSet = true +} + +func (v NullableIpConsumer) IsSet() bool { + return v.isSet +} + +func (v *NullableIpConsumer) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIpConsumer(val *IpConsumer) *NullableIpConsumer { + return &NullableIpConsumer{value: val, isSet: true} +} + +func (v NullableIpConsumer) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIpConsumer) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_ip_failover.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_ip_failover.go new file mode 100644 index 0000000000..e2a3064516 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_ip_failover.go @@ -0,0 +1,147 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// IPFailover struct for IPFailover +type IPFailover struct { + Ip *string `json:"ip,omitempty"` + NicUuid *string `json:"nicUuid,omitempty"` +} + + + +// GetIp returns the Ip field value +// If the value is explicit nil, the zero value for string will be returned +func (o *IPFailover) GetIp() *string { + if o == nil { + return nil + } + + return o.Ip +} + +// GetIpOk returns a tuple with the Ip field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *IPFailover) GetIpOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Ip, true +} + +// SetIp sets field value +func (o *IPFailover) SetIp(v string) { + o.Ip = &v +} + +// HasIp returns a boolean if a field has been set. +func (o *IPFailover) HasIp() bool { + if o != nil && o.Ip != nil { + return true + } + + return false +} + + + +// GetNicUuid returns the NicUuid field value +// If the value is explicit nil, the zero value for string will be returned +func (o *IPFailover) GetNicUuid() *string { + if o == nil { + return nil + } + + return o.NicUuid +} + +// GetNicUuidOk returns a tuple with the NicUuid field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *IPFailover) GetNicUuidOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.NicUuid, true +} + +// SetNicUuid sets field value +func (o *IPFailover) SetNicUuid(v string) { + o.NicUuid = &v +} + +// HasNicUuid returns a boolean if a field has been set. +func (o *IPFailover) HasNicUuid() bool { + if o != nil && o.NicUuid != nil { + return true + } + + return false +} + + +func (o IPFailover) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Ip != nil { + toSerialize["ip"] = o.Ip + } + + + if o.NicUuid != nil { + toSerialize["nicUuid"] = o.NicUuid + } + + return json.Marshal(toSerialize) +} + +type NullableIPFailover struct { + value *IPFailover + isSet bool +} + +func (v NullableIPFailover) Get() *IPFailover { + return v.value +} + +func (v *NullableIPFailover) Set(val *IPFailover) { + v.value = val + v.isSet = true +} + +func (v NullableIPFailover) IsSet() bool { + return v.isSet +} + +func (v *NullableIPFailover) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIPFailover(val *IPFailover) *NullableIPFailover { + return &NullableIPFailover{value: val, isSet: true} +} + +func (v NullableIPFailover) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIPFailover) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_auto_scaling.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_auto_scaling.go new file mode 100644 index 0000000000..31084b7807 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_auto_scaling.go @@ -0,0 +1,149 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// KubernetesAutoScaling struct for KubernetesAutoScaling +type KubernetesAutoScaling struct { + // The minimum number of worker nodes that the managed node group can scale in. Should be set together with 'maxNodeCount'. Value for this attribute must be greater than equal to 1 and less than equal to maxNodeCount. + MinNodeCount *int32 `json:"minNodeCount,omitempty"` + // The maximum number of worker nodes that the managed node pool can scale-out. Should be set together with 'minNodeCount'. Value for this attribute must be greater than equal to 1 and minNodeCount. + MaxNodeCount *int32 `json:"maxNodeCount,omitempty"` +} + + + +// GetMinNodeCount returns the MinNodeCount field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *KubernetesAutoScaling) GetMinNodeCount() *int32 { + if o == nil { + return nil + } + + return o.MinNodeCount +} + +// GetMinNodeCountOk returns a tuple with the MinNodeCount field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesAutoScaling) GetMinNodeCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.MinNodeCount, true +} + +// SetMinNodeCount sets field value +func (o *KubernetesAutoScaling) SetMinNodeCount(v int32) { + o.MinNodeCount = &v +} + +// HasMinNodeCount returns a boolean if a field has been set. +func (o *KubernetesAutoScaling) HasMinNodeCount() bool { + if o != nil && o.MinNodeCount != nil { + return true + } + + return false +} + + + +// GetMaxNodeCount returns the MaxNodeCount field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *KubernetesAutoScaling) GetMaxNodeCount() *int32 { + if o == nil { + return nil + } + + return o.MaxNodeCount +} + +// GetMaxNodeCountOk returns a tuple with the MaxNodeCount field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesAutoScaling) GetMaxNodeCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.MaxNodeCount, true +} + +// SetMaxNodeCount sets field value +func (o *KubernetesAutoScaling) SetMaxNodeCount(v int32) { + o.MaxNodeCount = &v +} + +// HasMaxNodeCount returns a boolean if a field has been set. +func (o *KubernetesAutoScaling) HasMaxNodeCount() bool { + if o != nil && o.MaxNodeCount != nil { + return true + } + + return false +} + + +func (o KubernetesAutoScaling) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.MinNodeCount != nil { + toSerialize["minNodeCount"] = o.MinNodeCount + } + + + if o.MaxNodeCount != nil { + toSerialize["maxNodeCount"] = o.MaxNodeCount + } + + return json.Marshal(toSerialize) +} + +type NullableKubernetesAutoScaling struct { + value *KubernetesAutoScaling + isSet bool +} + +func (v NullableKubernetesAutoScaling) Get() *KubernetesAutoScaling { + return v.value +} + +func (v *NullableKubernetesAutoScaling) Set(val *KubernetesAutoScaling) { + v.value = val + v.isSet = true +} + +func (v NullableKubernetesAutoScaling) IsSet() bool { + return v.isSet +} + +func (v *NullableKubernetesAutoScaling) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableKubernetesAutoScaling(val *KubernetesAutoScaling) *NullableKubernetesAutoScaling { + return &NullableKubernetesAutoScaling{value: val, isSet: true} +} + +func (v NullableKubernetesAutoScaling) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableKubernetesAutoScaling) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_cluster.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_cluster.go new file mode 100644 index 0000000000..7e6bedda22 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_cluster.go @@ -0,0 +1,318 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// KubernetesCluster struct for KubernetesCluster +type KubernetesCluster struct { + // The resource's unique identifier. + Id *string `json:"id,omitempty"` + // The type of object + Type *string `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` + Properties *KubernetesClusterProperties `json:"properties"` + Entities *KubernetesClusterEntities `json:"entities,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesCluster) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesCluster) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *KubernetesCluster) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *KubernetesCluster) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesCluster) GetType() *string { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesCluster) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *KubernetesCluster) SetType(v string) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *KubernetesCluster) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesCluster) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesCluster) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *KubernetesCluster) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *KubernetesCluster) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for DatacenterElementMetadata will be returned +func (o *KubernetesCluster) GetMetadata() *DatacenterElementMetadata { + if o == nil { + return nil + } + + return o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesCluster) GetMetadataOk() (*DatacenterElementMetadata, bool) { + if o == nil { + return nil, false + } + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *KubernetesCluster) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + +// HasMetadata returns a boolean if a field has been set. +func (o *KubernetesCluster) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + + + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for KubernetesClusterProperties will be returned +func (o *KubernetesCluster) GetProperties() *KubernetesClusterProperties { + if o == nil { + return nil + } + + return o.Properties +} + +// GetPropertiesOk returns a tuple with the Properties field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesCluster) GetPropertiesOk() (*KubernetesClusterProperties, bool) { + if o == nil { + return nil, false + } + return o.Properties, true +} + +// SetProperties sets field value +func (o *KubernetesCluster) SetProperties(v KubernetesClusterProperties) { + o.Properties = &v +} + +// HasProperties returns a boolean if a field has been set. +func (o *KubernetesCluster) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + + + +// GetEntities returns the Entities field value +// If the value is explicit nil, the zero value for KubernetesClusterEntities will be returned +func (o *KubernetesCluster) GetEntities() *KubernetesClusterEntities { + if o == nil { + return nil + } + + return o.Entities +} + +// GetEntitiesOk returns a tuple with the Entities field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesCluster) GetEntitiesOk() (*KubernetesClusterEntities, bool) { + if o == nil { + return nil, false + } + return o.Entities, true +} + +// SetEntities sets field value +func (o *KubernetesCluster) SetEntities(v KubernetesClusterEntities) { + o.Entities = &v +} + +// HasEntities returns a boolean if a field has been set. +func (o *KubernetesCluster) HasEntities() bool { + if o != nil && o.Entities != nil { + return true + } + + return false +} + + +func (o KubernetesCluster) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + + if o.Entities != nil { + toSerialize["entities"] = o.Entities + } + + return json.Marshal(toSerialize) +} + +type NullableKubernetesCluster struct { + value *KubernetesCluster + isSet bool +} + +func (v NullableKubernetesCluster) Get() *KubernetesCluster { + return v.value +} + +func (v *NullableKubernetesCluster) Set(val *KubernetesCluster) { + v.value = val + v.isSet = true +} + +func (v NullableKubernetesCluster) IsSet() bool { + return v.isSet +} + +func (v *NullableKubernetesCluster) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableKubernetesCluster(val *KubernetesCluster) *NullableKubernetesCluster { + return &NullableKubernetesCluster{value: val, isSet: true} +} + +func (v NullableKubernetesCluster) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableKubernetesCluster) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_cluster_entities.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_cluster_entities.go new file mode 100644 index 0000000000..21f038e034 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_cluster_entities.go @@ -0,0 +1,105 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// KubernetesClusterEntities struct for KubernetesClusterEntities +type KubernetesClusterEntities struct { + Nodepools *KubernetesNodePools `json:"nodepools,omitempty"` +} + + + +// GetNodepools returns the Nodepools field value +// If the value is explicit nil, the zero value for KubernetesNodePools will be returned +func (o *KubernetesClusterEntities) GetNodepools() *KubernetesNodePools { + if o == nil { + return nil + } + + return o.Nodepools +} + +// GetNodepoolsOk returns a tuple with the Nodepools field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesClusterEntities) GetNodepoolsOk() (*KubernetesNodePools, bool) { + if o == nil { + return nil, false + } + return o.Nodepools, true +} + +// SetNodepools sets field value +func (o *KubernetesClusterEntities) SetNodepools(v KubernetesNodePools) { + o.Nodepools = &v +} + +// HasNodepools returns a boolean if a field has been set. +func (o *KubernetesClusterEntities) HasNodepools() bool { + if o != nil && o.Nodepools != nil { + return true + } + + return false +} + + +func (o KubernetesClusterEntities) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Nodepools != nil { + toSerialize["nodepools"] = o.Nodepools + } + + return json.Marshal(toSerialize) +} + +type NullableKubernetesClusterEntities struct { + value *KubernetesClusterEntities + isSet bool +} + +func (v NullableKubernetesClusterEntities) Get() *KubernetesClusterEntities { + return v.value +} + +func (v *NullableKubernetesClusterEntities) Set(val *KubernetesClusterEntities) { + v.value = val + v.isSet = true +} + +func (v NullableKubernetesClusterEntities) IsSet() bool { + return v.isSet +} + +func (v *NullableKubernetesClusterEntities) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableKubernetesClusterEntities(val *KubernetesClusterEntities) *NullableKubernetesClusterEntities { + return &NullableKubernetesClusterEntities{value: val, isSet: true} +} + +func (v NullableKubernetesClusterEntities) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableKubernetesClusterEntities) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_cluster_properties.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_cluster_properties.go new file mode 100644 index 0000000000..0525a484ca --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_cluster_properties.go @@ -0,0 +1,191 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// KubernetesClusterProperties struct for KubernetesClusterProperties +type KubernetesClusterProperties struct { + // A Kubernetes Cluster Name. Valid Kubernetes Cluster name must be 63 characters or less and must be empty or begin and end with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between. + Name *string `json:"name"` + // The kubernetes version in which a cluster is running. This imposes restrictions on what kubernetes versions can be run in a cluster's nodepools. Additionally, not all kubernetes versions are viable upgrade targets for all prior versions. + K8sVersion *string `json:"k8sVersion,omitempty"` + MaintenanceWindow *KubernetesMaintenanceWindow `json:"maintenanceWindow,omitempty"` +} + + + +// GetName returns the Name field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesClusterProperties) GetName() *string { + if o == nil { + return nil + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesClusterProperties) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name, true +} + +// SetName sets field value +func (o *KubernetesClusterProperties) SetName(v string) { + o.Name = &v +} + +// HasName returns a boolean if a field has been set. +func (o *KubernetesClusterProperties) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + + + +// GetK8sVersion returns the K8sVersion field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesClusterProperties) GetK8sVersion() *string { + if o == nil { + return nil + } + + return o.K8sVersion +} + +// GetK8sVersionOk returns a tuple with the K8sVersion field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesClusterProperties) GetK8sVersionOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.K8sVersion, true +} + +// SetK8sVersion sets field value +func (o *KubernetesClusterProperties) SetK8sVersion(v string) { + o.K8sVersion = &v +} + +// HasK8sVersion returns a boolean if a field has been set. +func (o *KubernetesClusterProperties) HasK8sVersion() bool { + if o != nil && o.K8sVersion != nil { + return true + } + + return false +} + + + +// GetMaintenanceWindow returns the MaintenanceWindow field value +// If the value is explicit nil, the zero value for KubernetesMaintenanceWindow will be returned +func (o *KubernetesClusterProperties) GetMaintenanceWindow() *KubernetesMaintenanceWindow { + if o == nil { + return nil + } + + return o.MaintenanceWindow +} + +// GetMaintenanceWindowOk returns a tuple with the MaintenanceWindow field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesClusterProperties) GetMaintenanceWindowOk() (*KubernetesMaintenanceWindow, bool) { + if o == nil { + return nil, false + } + return o.MaintenanceWindow, true +} + +// SetMaintenanceWindow sets field value +func (o *KubernetesClusterProperties) SetMaintenanceWindow(v KubernetesMaintenanceWindow) { + o.MaintenanceWindow = &v +} + +// HasMaintenanceWindow returns a boolean if a field has been set. +func (o *KubernetesClusterProperties) HasMaintenanceWindow() bool { + if o != nil && o.MaintenanceWindow != nil { + return true + } + + return false +} + + +func (o KubernetesClusterProperties) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Name != nil { + toSerialize["name"] = o.Name + } + + + if o.K8sVersion != nil { + toSerialize["k8sVersion"] = o.K8sVersion + } + + + if o.MaintenanceWindow != nil { + toSerialize["maintenanceWindow"] = o.MaintenanceWindow + } + + return json.Marshal(toSerialize) +} + +type NullableKubernetesClusterProperties struct { + value *KubernetesClusterProperties + isSet bool +} + +func (v NullableKubernetesClusterProperties) Get() *KubernetesClusterProperties { + return v.value +} + +func (v *NullableKubernetesClusterProperties) Set(val *KubernetesClusterProperties) { + v.value = val + v.isSet = true +} + +func (v NullableKubernetesClusterProperties) IsSet() bool { + return v.isSet +} + +func (v *NullableKubernetesClusterProperties) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableKubernetesClusterProperties(val *KubernetesClusterProperties) *NullableKubernetesClusterProperties { + return &NullableKubernetesClusterProperties{value: val, isSet: true} +} + +func (v NullableKubernetesClusterProperties) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableKubernetesClusterProperties) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_clusters.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_clusters.go new file mode 100644 index 0000000000..5f5d03ab01 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_clusters.go @@ -0,0 +1,235 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// KubernetesClusters struct for KubernetesClusters +type KubernetesClusters struct { + // Unique representation for Kubernetes Cluster as a collection on a resource. + Id *string `json:"id,omitempty"` + // The type of resource within a collection + Type *string `json:"type,omitempty"` + // URL to the collection representation (absolute path) + Href *string `json:"href,omitempty"` + // Array of items in that collection + Items *[]KubernetesCluster `json:"items,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesClusters) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesClusters) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *KubernetesClusters) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *KubernetesClusters) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesClusters) GetType() *string { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesClusters) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *KubernetesClusters) SetType(v string) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *KubernetesClusters) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesClusters) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesClusters) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *KubernetesClusters) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *KubernetesClusters) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []KubernetesCluster will be returned +func (o *KubernetesClusters) GetItems() *[]KubernetesCluster { + if o == nil { + return nil + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesClusters) GetItemsOk() (*[]KubernetesCluster, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *KubernetesClusters) SetItems(v []KubernetesCluster) { + o.Items = &v +} + +// HasItems returns a boolean if a field has been set. +func (o *KubernetesClusters) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + + +func (o KubernetesClusters) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullableKubernetesClusters struct { + value *KubernetesClusters + isSet bool +} + +func (v NullableKubernetesClusters) Get() *KubernetesClusters { + return v.value +} + +func (v *NullableKubernetesClusters) Set(val *KubernetesClusters) { + v.value = val + v.isSet = true +} + +func (v NullableKubernetesClusters) IsSet() bool { + return v.isSet +} + +func (v *NullableKubernetesClusters) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableKubernetesClusters(val *KubernetesClusters) *NullableKubernetesClusters { + return &NullableKubernetesClusters{value: val, isSet: true} +} + +func (v NullableKubernetesClusters) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableKubernetesClusters) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_config.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_config.go new file mode 100644 index 0000000000..ac6c54ee63 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_config.go @@ -0,0 +1,234 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// KubernetesConfig struct for KubernetesConfig +type KubernetesConfig struct { + // The resource's unique identifier. + Id *string `json:"id,omitempty"` + // The type of object + Type *string `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + Properties *KubernetesConfigProperties `json:"properties"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesConfig) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesConfig) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *KubernetesConfig) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *KubernetesConfig) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesConfig) GetType() *string { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesConfig) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *KubernetesConfig) SetType(v string) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *KubernetesConfig) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesConfig) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesConfig) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *KubernetesConfig) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *KubernetesConfig) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for KubernetesConfigProperties will be returned +func (o *KubernetesConfig) GetProperties() *KubernetesConfigProperties { + if o == nil { + return nil + } + + return o.Properties +} + +// GetPropertiesOk returns a tuple with the Properties field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesConfig) GetPropertiesOk() (*KubernetesConfigProperties, bool) { + if o == nil { + return nil, false + } + return o.Properties, true +} + +// SetProperties sets field value +func (o *KubernetesConfig) SetProperties(v KubernetesConfigProperties) { + o.Properties = &v +} + +// HasProperties returns a boolean if a field has been set. +func (o *KubernetesConfig) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + + +func (o KubernetesConfig) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + return json.Marshal(toSerialize) +} + +type NullableKubernetesConfig struct { + value *KubernetesConfig + isSet bool +} + +func (v NullableKubernetesConfig) Get() *KubernetesConfig { + return v.value +} + +func (v *NullableKubernetesConfig) Set(val *KubernetesConfig) { + v.value = val + v.isSet = true +} + +func (v NullableKubernetesConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableKubernetesConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableKubernetesConfig(val *KubernetesConfig) *NullableKubernetesConfig { + return &NullableKubernetesConfig{value: val, isSet: true} +} + +func (v NullableKubernetesConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableKubernetesConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_config_properties.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_config_properties.go new file mode 100644 index 0000000000..48c423675b --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_config_properties.go @@ -0,0 +1,106 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// KubernetesConfigProperties struct for KubernetesConfigProperties +type KubernetesConfigProperties struct { + // A Kubernetes Config file data + Kubeconfig *string `json:"kubeconfig,omitempty"` +} + + + +// GetKubeconfig returns the Kubeconfig field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesConfigProperties) GetKubeconfig() *string { + if o == nil { + return nil + } + + return o.Kubeconfig +} + +// GetKubeconfigOk returns a tuple with the Kubeconfig field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesConfigProperties) GetKubeconfigOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Kubeconfig, true +} + +// SetKubeconfig sets field value +func (o *KubernetesConfigProperties) SetKubeconfig(v string) { + o.Kubeconfig = &v +} + +// HasKubeconfig returns a boolean if a field has been set. +func (o *KubernetesConfigProperties) HasKubeconfig() bool { + if o != nil && o.Kubeconfig != nil { + return true + } + + return false +} + + +func (o KubernetesConfigProperties) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Kubeconfig != nil { + toSerialize["kubeconfig"] = o.Kubeconfig + } + + return json.Marshal(toSerialize) +} + +type NullableKubernetesConfigProperties struct { + value *KubernetesConfigProperties + isSet bool +} + +func (v NullableKubernetesConfigProperties) Get() *KubernetesConfigProperties { + return v.value +} + +func (v *NullableKubernetesConfigProperties) Set(val *KubernetesConfigProperties) { + v.value = val + v.isSet = true +} + +func (v NullableKubernetesConfigProperties) IsSet() bool { + return v.isSet +} + +func (v *NullableKubernetesConfigProperties) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableKubernetesConfigProperties(val *KubernetesConfigProperties) *NullableKubernetesConfigProperties { + return &NullableKubernetesConfigProperties{value: val, isSet: true} +} + +func (v NullableKubernetesConfigProperties) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableKubernetesConfigProperties) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_maintenance_window.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_maintenance_window.go new file mode 100644 index 0000000000..f7ecc2a952 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_maintenance_window.go @@ -0,0 +1,149 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// KubernetesMaintenanceWindow struct for KubernetesMaintenanceWindow +type KubernetesMaintenanceWindow struct { + // The day of the week for a maintenance window. + DayOfTheWeek *string `json:"dayOfTheWeek,omitempty"` + // The time to use for a maintenance window. Accepted formats are: HH:mm:ss; HH:mm:ss\"Z\"; HH:mm:ssZ. This time may varies by 15 minutes. + Time *string `json:"time,omitempty"` +} + + + +// GetDayOfTheWeek returns the DayOfTheWeek field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesMaintenanceWindow) GetDayOfTheWeek() *string { + if o == nil { + return nil + } + + return o.DayOfTheWeek +} + +// GetDayOfTheWeekOk returns a tuple with the DayOfTheWeek field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesMaintenanceWindow) GetDayOfTheWeekOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.DayOfTheWeek, true +} + +// SetDayOfTheWeek sets field value +func (o *KubernetesMaintenanceWindow) SetDayOfTheWeek(v string) { + o.DayOfTheWeek = &v +} + +// HasDayOfTheWeek returns a boolean if a field has been set. +func (o *KubernetesMaintenanceWindow) HasDayOfTheWeek() bool { + if o != nil && o.DayOfTheWeek != nil { + return true + } + + return false +} + + + +// GetTime returns the Time field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesMaintenanceWindow) GetTime() *string { + if o == nil { + return nil + } + + return o.Time +} + +// GetTimeOk returns a tuple with the Time field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesMaintenanceWindow) GetTimeOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Time, true +} + +// SetTime sets field value +func (o *KubernetesMaintenanceWindow) SetTime(v string) { + o.Time = &v +} + +// HasTime returns a boolean if a field has been set. +func (o *KubernetesMaintenanceWindow) HasTime() bool { + if o != nil && o.Time != nil { + return true + } + + return false +} + + +func (o KubernetesMaintenanceWindow) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.DayOfTheWeek != nil { + toSerialize["dayOfTheWeek"] = o.DayOfTheWeek + } + + + if o.Time != nil { + toSerialize["time"] = o.Time + } + + return json.Marshal(toSerialize) +} + +type NullableKubernetesMaintenanceWindow struct { + value *KubernetesMaintenanceWindow + isSet bool +} + +func (v NullableKubernetesMaintenanceWindow) Get() *KubernetesMaintenanceWindow { + return v.value +} + +func (v *NullableKubernetesMaintenanceWindow) Set(val *KubernetesMaintenanceWindow) { + v.value = val + v.isSet = true +} + +func (v NullableKubernetesMaintenanceWindow) IsSet() bool { + return v.isSet +} + +func (v *NullableKubernetesMaintenanceWindow) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableKubernetesMaintenanceWindow(val *KubernetesMaintenanceWindow) *NullableKubernetesMaintenanceWindow { + return &NullableKubernetesMaintenanceWindow{value: val, isSet: true} +} + +func (v NullableKubernetesMaintenanceWindow) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableKubernetesMaintenanceWindow) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_node.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_node.go new file mode 100644 index 0000000000..b33e440d11 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_node.go @@ -0,0 +1,276 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// KubernetesNode struct for KubernetesNode +type KubernetesNode struct { + // The resource's unique identifier. + Id *string `json:"id,omitempty"` + // The type of object + Type *string `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + Metadata *KubernetesNodeMetadata `json:"metadata,omitempty"` + Properties *KubernetesNodeProperties `json:"properties"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesNode) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNode) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *KubernetesNode) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *KubernetesNode) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesNode) GetType() *string { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNode) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *KubernetesNode) SetType(v string) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *KubernetesNode) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesNode) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNode) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *KubernetesNode) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *KubernetesNode) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for KubernetesNodeMetadata will be returned +func (o *KubernetesNode) GetMetadata() *KubernetesNodeMetadata { + if o == nil { + return nil + } + + return o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNode) GetMetadataOk() (*KubernetesNodeMetadata, bool) { + if o == nil { + return nil, false + } + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *KubernetesNode) SetMetadata(v KubernetesNodeMetadata) { + o.Metadata = &v +} + +// HasMetadata returns a boolean if a field has been set. +func (o *KubernetesNode) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + + + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for KubernetesNodeProperties will be returned +func (o *KubernetesNode) GetProperties() *KubernetesNodeProperties { + if o == nil { + return nil + } + + return o.Properties +} + +// GetPropertiesOk returns a tuple with the Properties field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNode) GetPropertiesOk() (*KubernetesNodeProperties, bool) { + if o == nil { + return nil, false + } + return o.Properties, true +} + +// SetProperties sets field value +func (o *KubernetesNode) SetProperties(v KubernetesNodeProperties) { + o.Properties = &v +} + +// HasProperties returns a boolean if a field has been set. +func (o *KubernetesNode) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + + +func (o KubernetesNode) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + return json.Marshal(toSerialize) +} + +type NullableKubernetesNode struct { + value *KubernetesNode + isSet bool +} + +func (v NullableKubernetesNode) Get() *KubernetesNode { + return v.value +} + +func (v *NullableKubernetesNode) Set(val *KubernetesNode) { + v.value = val + v.isSet = true +} + +func (v NullableKubernetesNode) IsSet() bool { + return v.isSet +} + +func (v *NullableKubernetesNode) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableKubernetesNode(val *KubernetesNode) *NullableKubernetesNode { + return &NullableKubernetesNode{value: val, isSet: true} +} + +func (v NullableKubernetesNode) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableKubernetesNode) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_node_metadata.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_node_metadata.go new file mode 100644 index 0000000000..f0b25cebf8 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_node_metadata.go @@ -0,0 +1,279 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" + "time" +) + +// KubernetesNodeMetadata struct for KubernetesNodeMetadata +type KubernetesNodeMetadata struct { + // Resource's Entity Tag as defined in http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.11 . Entity Tag is also added as an 'ETag response header to requests which don't use 'depth' parameter. + Etag *string `json:"etag,omitempty"` + // The last time the resource was created + CreatedDate *time.Time `json:"createdDate,omitempty"` + // The last time the resource has been modified + LastModifiedDate *time.Time `json:"lastModifiedDate,omitempty"` + // State of the resource. + State *string `json:"state,omitempty"` + // The last time the software updated on node. + LastSoftwareUpdatedDate *time.Time `json:"lastSoftwareUpdatedDate,omitempty"` +} + + + +// GetEtag returns the Etag field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesNodeMetadata) GetEtag() *string { + if o == nil { + return nil + } + + return o.Etag +} + +// GetEtagOk returns a tuple with the Etag field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodeMetadata) GetEtagOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Etag, true +} + +// SetEtag sets field value +func (o *KubernetesNodeMetadata) SetEtag(v string) { + o.Etag = &v +} + +// HasEtag returns a boolean if a field has been set. +func (o *KubernetesNodeMetadata) HasEtag() bool { + if o != nil && o.Etag != nil { + return true + } + + return false +} + + + +// GetCreatedDate returns the CreatedDate field value +// If the value is explicit nil, the zero value for time.Time will be returned +func (o *KubernetesNodeMetadata) GetCreatedDate() *time.Time { + if o == nil { + return nil + } + + return o.CreatedDate +} + +// GetCreatedDateOk returns a tuple with the CreatedDate field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodeMetadata) GetCreatedDateOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.CreatedDate, true +} + +// SetCreatedDate sets field value +func (o *KubernetesNodeMetadata) SetCreatedDate(v time.Time) { + o.CreatedDate = &v +} + +// HasCreatedDate returns a boolean if a field has been set. +func (o *KubernetesNodeMetadata) HasCreatedDate() bool { + if o != nil && o.CreatedDate != nil { + return true + } + + return false +} + + + +// GetLastModifiedDate returns the LastModifiedDate field value +// If the value is explicit nil, the zero value for time.Time will be returned +func (o *KubernetesNodeMetadata) GetLastModifiedDate() *time.Time { + if o == nil { + return nil + } + + return o.LastModifiedDate +} + +// GetLastModifiedDateOk returns a tuple with the LastModifiedDate field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodeMetadata) GetLastModifiedDateOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.LastModifiedDate, true +} + +// SetLastModifiedDate sets field value +func (o *KubernetesNodeMetadata) SetLastModifiedDate(v time.Time) { + o.LastModifiedDate = &v +} + +// HasLastModifiedDate returns a boolean if a field has been set. +func (o *KubernetesNodeMetadata) HasLastModifiedDate() bool { + if o != nil && o.LastModifiedDate != nil { + return true + } + + return false +} + + + +// GetState returns the State field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesNodeMetadata) GetState() *string { + if o == nil { + return nil + } + + return o.State +} + +// GetStateOk returns a tuple with the State field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodeMetadata) GetStateOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.State, true +} + +// SetState sets field value +func (o *KubernetesNodeMetadata) SetState(v string) { + o.State = &v +} + +// HasState returns a boolean if a field has been set. +func (o *KubernetesNodeMetadata) HasState() bool { + if o != nil && o.State != nil { + return true + } + + return false +} + + + +// GetLastSoftwareUpdatedDate returns the LastSoftwareUpdatedDate field value +// If the value is explicit nil, the zero value for time.Time will be returned +func (o *KubernetesNodeMetadata) GetLastSoftwareUpdatedDate() *time.Time { + if o == nil { + return nil + } + + return o.LastSoftwareUpdatedDate +} + +// GetLastSoftwareUpdatedDateOk returns a tuple with the LastSoftwareUpdatedDate field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodeMetadata) GetLastSoftwareUpdatedDateOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.LastSoftwareUpdatedDate, true +} + +// SetLastSoftwareUpdatedDate sets field value +func (o *KubernetesNodeMetadata) SetLastSoftwareUpdatedDate(v time.Time) { + o.LastSoftwareUpdatedDate = &v +} + +// HasLastSoftwareUpdatedDate returns a boolean if a field has been set. +func (o *KubernetesNodeMetadata) HasLastSoftwareUpdatedDate() bool { + if o != nil && o.LastSoftwareUpdatedDate != nil { + return true + } + + return false +} + + +func (o KubernetesNodeMetadata) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Etag != nil { + toSerialize["etag"] = o.Etag + } + + + if o.CreatedDate != nil { + toSerialize["createdDate"] = o.CreatedDate + } + + + if o.LastModifiedDate != nil { + toSerialize["lastModifiedDate"] = o.LastModifiedDate + } + + + if o.State != nil { + toSerialize["state"] = o.State + } + + + if o.LastSoftwareUpdatedDate != nil { + toSerialize["lastSoftwareUpdatedDate"] = o.LastSoftwareUpdatedDate + } + + return json.Marshal(toSerialize) +} + +type NullableKubernetesNodeMetadata struct { + value *KubernetesNodeMetadata + isSet bool +} + +func (v NullableKubernetesNodeMetadata) Get() *KubernetesNodeMetadata { + return v.value +} + +func (v *NullableKubernetesNodeMetadata) Set(val *KubernetesNodeMetadata) { + v.value = val + v.isSet = true +} + +func (v NullableKubernetesNodeMetadata) IsSet() bool { + return v.isSet +} + +func (v *NullableKubernetesNodeMetadata) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableKubernetesNodeMetadata(val *KubernetesNodeMetadata) *NullableKubernetesNodeMetadata { + return &NullableKubernetesNodeMetadata{value: val, isSet: true} +} + +func (v NullableKubernetesNodeMetadata) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableKubernetesNodeMetadata) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_node_pool.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_node_pool.go new file mode 100644 index 0000000000..85378c5ba1 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_node_pool.go @@ -0,0 +1,276 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// KubernetesNodePool struct for KubernetesNodePool +type KubernetesNodePool struct { + // The resource's unique identifier. + Id *string `json:"id,omitempty"` + // The type of object + Type *string `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` + Properties *KubernetesNodePoolProperties `json:"properties"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesNodePool) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePool) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *KubernetesNodePool) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *KubernetesNodePool) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesNodePool) GetType() *string { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePool) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *KubernetesNodePool) SetType(v string) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *KubernetesNodePool) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesNodePool) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePool) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *KubernetesNodePool) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *KubernetesNodePool) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for DatacenterElementMetadata will be returned +func (o *KubernetesNodePool) GetMetadata() *DatacenterElementMetadata { + if o == nil { + return nil + } + + return o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePool) GetMetadataOk() (*DatacenterElementMetadata, bool) { + if o == nil { + return nil, false + } + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *KubernetesNodePool) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + +// HasMetadata returns a boolean if a field has been set. +func (o *KubernetesNodePool) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + + + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for KubernetesNodePoolProperties will be returned +func (o *KubernetesNodePool) GetProperties() *KubernetesNodePoolProperties { + if o == nil { + return nil + } + + return o.Properties +} + +// GetPropertiesOk returns a tuple with the Properties field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePool) GetPropertiesOk() (*KubernetesNodePoolProperties, bool) { + if o == nil { + return nil, false + } + return o.Properties, true +} + +// SetProperties sets field value +func (o *KubernetesNodePool) SetProperties(v KubernetesNodePoolProperties) { + o.Properties = &v +} + +// HasProperties returns a boolean if a field has been set. +func (o *KubernetesNodePool) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + + +func (o KubernetesNodePool) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + return json.Marshal(toSerialize) +} + +type NullableKubernetesNodePool struct { + value *KubernetesNodePool + isSet bool +} + +func (v NullableKubernetesNodePool) Get() *KubernetesNodePool { + return v.value +} + +func (v *NullableKubernetesNodePool) Set(val *KubernetesNodePool) { + v.value = val + v.isSet = true +} + +func (v NullableKubernetesNodePool) IsSet() bool { + return v.isSet +} + +func (v *NullableKubernetesNodePool) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableKubernetesNodePool(val *KubernetesNodePool) *NullableKubernetesNodePool { + return &NullableKubernetesNodePool{value: val, isSet: true} +} + +func (v NullableKubernetesNodePool) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableKubernetesNodePool) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_node_pool_annotation.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_node_pool_annotation.go new file mode 100644 index 0000000000..0192b337ab --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_node_pool_annotation.go @@ -0,0 +1,149 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// KubernetesNodePoolAnnotation map of annotations attached to node pool +type KubernetesNodePoolAnnotation struct { + // Key of the annotation. String part must consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character. + Key *string `json:"key,omitempty"` + // Value of the annotation. + Value *string `json:"value,omitempty"` +} + + + +// GetKey returns the Key field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesNodePoolAnnotation) GetKey() *string { + if o == nil { + return nil + } + + return o.Key +} + +// GetKeyOk returns a tuple with the Key field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePoolAnnotation) GetKeyOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Key, true +} + +// SetKey sets field value +func (o *KubernetesNodePoolAnnotation) SetKey(v string) { + o.Key = &v +} + +// HasKey returns a boolean if a field has been set. +func (o *KubernetesNodePoolAnnotation) HasKey() bool { + if o != nil && o.Key != nil { + return true + } + + return false +} + + + +// GetValue returns the Value field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesNodePoolAnnotation) GetValue() *string { + if o == nil { + return nil + } + + return o.Value +} + +// GetValueOk returns a tuple with the Value field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePoolAnnotation) GetValueOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Value, true +} + +// SetValue sets field value +func (o *KubernetesNodePoolAnnotation) SetValue(v string) { + o.Value = &v +} + +// HasValue returns a boolean if a field has been set. +func (o *KubernetesNodePoolAnnotation) HasValue() bool { + if o != nil && o.Value != nil { + return true + } + + return false +} + + +func (o KubernetesNodePoolAnnotation) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Key != nil { + toSerialize["key"] = o.Key + } + + + if o.Value != nil { + toSerialize["value"] = o.Value + } + + return json.Marshal(toSerialize) +} + +type NullableKubernetesNodePoolAnnotation struct { + value *KubernetesNodePoolAnnotation + isSet bool +} + +func (v NullableKubernetesNodePoolAnnotation) Get() *KubernetesNodePoolAnnotation { + return v.value +} + +func (v *NullableKubernetesNodePoolAnnotation) Set(val *KubernetesNodePoolAnnotation) { + v.value = val + v.isSet = true +} + +func (v NullableKubernetesNodePoolAnnotation) IsSet() bool { + return v.isSet +} + +func (v *NullableKubernetesNodePoolAnnotation) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableKubernetesNodePoolAnnotation(val *KubernetesNodePoolAnnotation) *NullableKubernetesNodePoolAnnotation { + return &NullableKubernetesNodePoolAnnotation{value: val, isSet: true} +} + +func (v NullableKubernetesNodePoolAnnotation) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableKubernetesNodePoolAnnotation) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_node_pool_for_put.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_node_pool_for_put.go new file mode 100644 index 0000000000..d2c7b93de7 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_node_pool_for_put.go @@ -0,0 +1,276 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// KubernetesNodePoolForPut struct for KubernetesNodePoolForPut +type KubernetesNodePoolForPut struct { + // The resource's unique identifier. + Id *string `json:"id,omitempty"` + // The type of object + Type *string `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` + Properties *KubernetesNodePoolPropertiesForPut `json:"properties"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesNodePoolForPut) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePoolForPut) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *KubernetesNodePoolForPut) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *KubernetesNodePoolForPut) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesNodePoolForPut) GetType() *string { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePoolForPut) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *KubernetesNodePoolForPut) SetType(v string) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *KubernetesNodePoolForPut) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesNodePoolForPut) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePoolForPut) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *KubernetesNodePoolForPut) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *KubernetesNodePoolForPut) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for DatacenterElementMetadata will be returned +func (o *KubernetesNodePoolForPut) GetMetadata() *DatacenterElementMetadata { + if o == nil { + return nil + } + + return o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePoolForPut) GetMetadataOk() (*DatacenterElementMetadata, bool) { + if o == nil { + return nil, false + } + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *KubernetesNodePoolForPut) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + +// HasMetadata returns a boolean if a field has been set. +func (o *KubernetesNodePoolForPut) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + + + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for KubernetesNodePoolPropertiesForPut will be returned +func (o *KubernetesNodePoolForPut) GetProperties() *KubernetesNodePoolPropertiesForPut { + if o == nil { + return nil + } + + return o.Properties +} + +// GetPropertiesOk returns a tuple with the Properties field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePoolForPut) GetPropertiesOk() (*KubernetesNodePoolPropertiesForPut, bool) { + if o == nil { + return nil, false + } + return o.Properties, true +} + +// SetProperties sets field value +func (o *KubernetesNodePoolForPut) SetProperties(v KubernetesNodePoolPropertiesForPut) { + o.Properties = &v +} + +// HasProperties returns a boolean if a field has been set. +func (o *KubernetesNodePoolForPut) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + + +func (o KubernetesNodePoolForPut) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + return json.Marshal(toSerialize) +} + +type NullableKubernetesNodePoolForPut struct { + value *KubernetesNodePoolForPut + isSet bool +} + +func (v NullableKubernetesNodePoolForPut) Get() *KubernetesNodePoolForPut { + return v.value +} + +func (v *NullableKubernetesNodePoolForPut) Set(val *KubernetesNodePoolForPut) { + v.value = val + v.isSet = true +} + +func (v NullableKubernetesNodePoolForPut) IsSet() bool { + return v.isSet +} + +func (v *NullableKubernetesNodePoolForPut) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableKubernetesNodePoolForPut(val *KubernetesNodePoolForPut) *NullableKubernetesNodePoolForPut { + return &NullableKubernetesNodePoolForPut{value: val, isSet: true} +} + +func (v NullableKubernetesNodePoolForPut) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableKubernetesNodePoolForPut) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_node_pool_label.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_node_pool_label.go new file mode 100644 index 0000000000..29869a188c --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_node_pool_label.go @@ -0,0 +1,149 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// KubernetesNodePoolLabel map of labels attached to node pool +type KubernetesNodePoolLabel struct { + // Key of the label. String part must consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character. + Key *string `json:"key,omitempty"` + // Value of the label. String part must consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character. + Value *string `json:"value,omitempty"` +} + + + +// GetKey returns the Key field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesNodePoolLabel) GetKey() *string { + if o == nil { + return nil + } + + return o.Key +} + +// GetKeyOk returns a tuple with the Key field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePoolLabel) GetKeyOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Key, true +} + +// SetKey sets field value +func (o *KubernetesNodePoolLabel) SetKey(v string) { + o.Key = &v +} + +// HasKey returns a boolean if a field has been set. +func (o *KubernetesNodePoolLabel) HasKey() bool { + if o != nil && o.Key != nil { + return true + } + + return false +} + + + +// GetValue returns the Value field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesNodePoolLabel) GetValue() *string { + if o == nil { + return nil + } + + return o.Value +} + +// GetValueOk returns a tuple with the Value field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePoolLabel) GetValueOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Value, true +} + +// SetValue sets field value +func (o *KubernetesNodePoolLabel) SetValue(v string) { + o.Value = &v +} + +// HasValue returns a boolean if a field has been set. +func (o *KubernetesNodePoolLabel) HasValue() bool { + if o != nil && o.Value != nil { + return true + } + + return false +} + + +func (o KubernetesNodePoolLabel) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Key != nil { + toSerialize["key"] = o.Key + } + + + if o.Value != nil { + toSerialize["value"] = o.Value + } + + return json.Marshal(toSerialize) +} + +type NullableKubernetesNodePoolLabel struct { + value *KubernetesNodePoolLabel + isSet bool +} + +func (v NullableKubernetesNodePoolLabel) Get() *KubernetesNodePoolLabel { + return v.value +} + +func (v *NullableKubernetesNodePoolLabel) Set(val *KubernetesNodePoolLabel) { + v.value = val + v.isSet = true +} + +func (v NullableKubernetesNodePoolLabel) IsSet() bool { + return v.isSet +} + +func (v *NullableKubernetesNodePoolLabel) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableKubernetesNodePoolLabel(val *KubernetesNodePoolLabel) *NullableKubernetesNodePoolLabel { + return &NullableKubernetesNodePoolLabel{value: val, isSet: true} +} + +func (v NullableKubernetesNodePoolLabel) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableKubernetesNodePoolLabel) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_node_pool_lan.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_node_pool_lan.go new file mode 100644 index 0000000000..88811ba51b --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_node_pool_lan.go @@ -0,0 +1,106 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// KubernetesNodePoolLan struct for KubernetesNodePoolLan +type KubernetesNodePoolLan struct { + // The LAN ID of an existing LAN at the related datacenter + Id *int32 `json:"id,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *KubernetesNodePoolLan) GetId() *int32 { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePoolLan) GetIdOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *KubernetesNodePoolLan) SetId(v int32) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *KubernetesNodePoolLan) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + +func (o KubernetesNodePoolLan) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + return json.Marshal(toSerialize) +} + +type NullableKubernetesNodePoolLan struct { + value *KubernetesNodePoolLan + isSet bool +} + +func (v NullableKubernetesNodePoolLan) Get() *KubernetesNodePoolLan { + return v.value +} + +func (v *NullableKubernetesNodePoolLan) Set(val *KubernetesNodePoolLan) { + v.value = val + v.isSet = true +} + +func (v NullableKubernetesNodePoolLan) IsSet() bool { + return v.isSet +} + +func (v *NullableKubernetesNodePoolLan) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableKubernetesNodePoolLan(val *KubernetesNodePoolLan) *NullableKubernetesNodePoolLan { + return &NullableKubernetesNodePoolLan{value: val, isSet: true} +} + +func (v NullableKubernetesNodePoolLan) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableKubernetesNodePoolLan) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_node_pool_properties.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_node_pool_properties.go new file mode 100644 index 0000000000..3130e8d125 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_node_pool_properties.go @@ -0,0 +1,704 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// KubernetesNodePoolProperties struct for KubernetesNodePoolProperties +type KubernetesNodePoolProperties struct { + // A Kubernetes Node Pool Name. Valid Kubernetes Node Pool name must be 63 characters or less and must be empty or begin and end with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between. + Name *string `json:"name"` + // A valid uuid of the datacenter on which user has access + DatacenterId *string `json:"datacenterId"` + // Number of nodes part of the Node Pool + NodeCount *int32 `json:"nodeCount"` + // A valid cpu family name + CpuFamily *string `json:"cpuFamily"` + // Number of cores for node + CoresCount *int32 `json:"coresCount"` + // RAM size for node, minimum size 2048MB is recommended. Ram size must be set to multiple of 1024MB. + RamSize *int32 `json:"ramSize"` + // The availability zone in which the server should exist + AvailabilityZone *string `json:"availabilityZone"` + // Hardware type of the volume + StorageType *string `json:"storageType"` + // The size of the volume in GB. The size should be greater than 10GB. + StorageSize *int32 `json:"storageSize"` + // The kubernetes version in which a nodepool is running. This imposes restrictions on what kubernetes versions can be run in a cluster's nodepools. Additionally, not all kubernetes versions are viable upgrade targets for all prior versions. + K8sVersion *string `json:"k8sVersion,omitempty"` + MaintenanceWindow *KubernetesMaintenanceWindow `json:"maintenanceWindow,omitempty"` + AutoScaling *KubernetesAutoScaling `json:"autoScaling,omitempty"` + // array of additional LANs attached to worker nodes + Lans *[]KubernetesNodePoolLan `json:"lans,omitempty"` + Labels *KubernetesNodePoolLabel `json:"labels,omitempty"` + Annotations *KubernetesNodePoolAnnotation `json:"annotations,omitempty"` +} + + + +// GetName returns the Name field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesNodePoolProperties) GetName() *string { + if o == nil { + return nil + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePoolProperties) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name, true +} + +// SetName sets field value +func (o *KubernetesNodePoolProperties) SetName(v string) { + o.Name = &v +} + +// HasName returns a boolean if a field has been set. +func (o *KubernetesNodePoolProperties) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + + + +// GetDatacenterId returns the DatacenterId field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesNodePoolProperties) GetDatacenterId() *string { + if o == nil { + return nil + } + + return o.DatacenterId +} + +// GetDatacenterIdOk returns a tuple with the DatacenterId field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePoolProperties) GetDatacenterIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.DatacenterId, true +} + +// SetDatacenterId sets field value +func (o *KubernetesNodePoolProperties) SetDatacenterId(v string) { + o.DatacenterId = &v +} + +// HasDatacenterId returns a boolean if a field has been set. +func (o *KubernetesNodePoolProperties) HasDatacenterId() bool { + if o != nil && o.DatacenterId != nil { + return true + } + + return false +} + + + +// GetNodeCount returns the NodeCount field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *KubernetesNodePoolProperties) GetNodeCount() *int32 { + if o == nil { + return nil + } + + return o.NodeCount +} + +// GetNodeCountOk returns a tuple with the NodeCount field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePoolProperties) GetNodeCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.NodeCount, true +} + +// SetNodeCount sets field value +func (o *KubernetesNodePoolProperties) SetNodeCount(v int32) { + o.NodeCount = &v +} + +// HasNodeCount returns a boolean if a field has been set. +func (o *KubernetesNodePoolProperties) HasNodeCount() bool { + if o != nil && o.NodeCount != nil { + return true + } + + return false +} + + + +// GetCpuFamily returns the CpuFamily field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesNodePoolProperties) GetCpuFamily() *string { + if o == nil { + return nil + } + + return o.CpuFamily +} + +// GetCpuFamilyOk returns a tuple with the CpuFamily field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePoolProperties) GetCpuFamilyOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.CpuFamily, true +} + +// SetCpuFamily sets field value +func (o *KubernetesNodePoolProperties) SetCpuFamily(v string) { + o.CpuFamily = &v +} + +// HasCpuFamily returns a boolean if a field has been set. +func (o *KubernetesNodePoolProperties) HasCpuFamily() bool { + if o != nil && o.CpuFamily != nil { + return true + } + + return false +} + + + +// GetCoresCount returns the CoresCount field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *KubernetesNodePoolProperties) GetCoresCount() *int32 { + if o == nil { + return nil + } + + return o.CoresCount +} + +// GetCoresCountOk returns a tuple with the CoresCount field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePoolProperties) GetCoresCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.CoresCount, true +} + +// SetCoresCount sets field value +func (o *KubernetesNodePoolProperties) SetCoresCount(v int32) { + o.CoresCount = &v +} + +// HasCoresCount returns a boolean if a field has been set. +func (o *KubernetesNodePoolProperties) HasCoresCount() bool { + if o != nil && o.CoresCount != nil { + return true + } + + return false +} + + + +// GetRamSize returns the RamSize field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *KubernetesNodePoolProperties) GetRamSize() *int32 { + if o == nil { + return nil + } + + return o.RamSize +} + +// GetRamSizeOk returns a tuple with the RamSize field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePoolProperties) GetRamSizeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.RamSize, true +} + +// SetRamSize sets field value +func (o *KubernetesNodePoolProperties) SetRamSize(v int32) { + o.RamSize = &v +} + +// HasRamSize returns a boolean if a field has been set. +func (o *KubernetesNodePoolProperties) HasRamSize() bool { + if o != nil && o.RamSize != nil { + return true + } + + return false +} + + + +// GetAvailabilityZone returns the AvailabilityZone field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesNodePoolProperties) GetAvailabilityZone() *string { + if o == nil { + return nil + } + + return o.AvailabilityZone +} + +// GetAvailabilityZoneOk returns a tuple with the AvailabilityZone field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePoolProperties) GetAvailabilityZoneOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.AvailabilityZone, true +} + +// SetAvailabilityZone sets field value +func (o *KubernetesNodePoolProperties) SetAvailabilityZone(v string) { + o.AvailabilityZone = &v +} + +// HasAvailabilityZone returns a boolean if a field has been set. +func (o *KubernetesNodePoolProperties) HasAvailabilityZone() bool { + if o != nil && o.AvailabilityZone != nil { + return true + } + + return false +} + + + +// GetStorageType returns the StorageType field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesNodePoolProperties) GetStorageType() *string { + if o == nil { + return nil + } + + return o.StorageType +} + +// GetStorageTypeOk returns a tuple with the StorageType field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePoolProperties) GetStorageTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.StorageType, true +} + +// SetStorageType sets field value +func (o *KubernetesNodePoolProperties) SetStorageType(v string) { + o.StorageType = &v +} + +// HasStorageType returns a boolean if a field has been set. +func (o *KubernetesNodePoolProperties) HasStorageType() bool { + if o != nil && o.StorageType != nil { + return true + } + + return false +} + + + +// GetStorageSize returns the StorageSize field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *KubernetesNodePoolProperties) GetStorageSize() *int32 { + if o == nil { + return nil + } + + return o.StorageSize +} + +// GetStorageSizeOk returns a tuple with the StorageSize field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePoolProperties) GetStorageSizeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.StorageSize, true +} + +// SetStorageSize sets field value +func (o *KubernetesNodePoolProperties) SetStorageSize(v int32) { + o.StorageSize = &v +} + +// HasStorageSize returns a boolean if a field has been set. +func (o *KubernetesNodePoolProperties) HasStorageSize() bool { + if o != nil && o.StorageSize != nil { + return true + } + + return false +} + + + +// GetK8sVersion returns the K8sVersion field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesNodePoolProperties) GetK8sVersion() *string { + if o == nil { + return nil + } + + return o.K8sVersion +} + +// GetK8sVersionOk returns a tuple with the K8sVersion field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePoolProperties) GetK8sVersionOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.K8sVersion, true +} + +// SetK8sVersion sets field value +func (o *KubernetesNodePoolProperties) SetK8sVersion(v string) { + o.K8sVersion = &v +} + +// HasK8sVersion returns a boolean if a field has been set. +func (o *KubernetesNodePoolProperties) HasK8sVersion() bool { + if o != nil && o.K8sVersion != nil { + return true + } + + return false +} + + + +// GetMaintenanceWindow returns the MaintenanceWindow field value +// If the value is explicit nil, the zero value for KubernetesMaintenanceWindow will be returned +func (o *KubernetesNodePoolProperties) GetMaintenanceWindow() *KubernetesMaintenanceWindow { + if o == nil { + return nil + } + + return o.MaintenanceWindow +} + +// GetMaintenanceWindowOk returns a tuple with the MaintenanceWindow field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePoolProperties) GetMaintenanceWindowOk() (*KubernetesMaintenanceWindow, bool) { + if o == nil { + return nil, false + } + return o.MaintenanceWindow, true +} + +// SetMaintenanceWindow sets field value +func (o *KubernetesNodePoolProperties) SetMaintenanceWindow(v KubernetesMaintenanceWindow) { + o.MaintenanceWindow = &v +} + +// HasMaintenanceWindow returns a boolean if a field has been set. +func (o *KubernetesNodePoolProperties) HasMaintenanceWindow() bool { + if o != nil && o.MaintenanceWindow != nil { + return true + } + + return false +} + + + +// GetAutoScaling returns the AutoScaling field value +// If the value is explicit nil, the zero value for KubernetesAutoScaling will be returned +func (o *KubernetesNodePoolProperties) GetAutoScaling() *KubernetesAutoScaling { + if o == nil { + return nil + } + + return o.AutoScaling +} + +// GetAutoScalingOk returns a tuple with the AutoScaling field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePoolProperties) GetAutoScalingOk() (*KubernetesAutoScaling, bool) { + if o == nil { + return nil, false + } + return o.AutoScaling, true +} + +// SetAutoScaling sets field value +func (o *KubernetesNodePoolProperties) SetAutoScaling(v KubernetesAutoScaling) { + o.AutoScaling = &v +} + +// HasAutoScaling returns a boolean if a field has been set. +func (o *KubernetesNodePoolProperties) HasAutoScaling() bool { + if o != nil && o.AutoScaling != nil { + return true + } + + return false +} + + + +// GetLans returns the Lans field value +// If the value is explicit nil, the zero value for []KubernetesNodePoolLan will be returned +func (o *KubernetesNodePoolProperties) GetLans() *[]KubernetesNodePoolLan { + if o == nil { + return nil + } + + return o.Lans +} + +// GetLansOk returns a tuple with the Lans field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePoolProperties) GetLansOk() (*[]KubernetesNodePoolLan, bool) { + if o == nil { + return nil, false + } + return o.Lans, true +} + +// SetLans sets field value +func (o *KubernetesNodePoolProperties) SetLans(v []KubernetesNodePoolLan) { + o.Lans = &v +} + +// HasLans returns a boolean if a field has been set. +func (o *KubernetesNodePoolProperties) HasLans() bool { + if o != nil && o.Lans != nil { + return true + } + + return false +} + + + +// GetLabels returns the Labels field value +// If the value is explicit nil, the zero value for KubernetesNodePoolLabel will be returned +func (o *KubernetesNodePoolProperties) GetLabels() *KubernetesNodePoolLabel { + if o == nil { + return nil + } + + return o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePoolProperties) GetLabelsOk() (*KubernetesNodePoolLabel, bool) { + if o == nil { + return nil, false + } + return o.Labels, true +} + +// SetLabels sets field value +func (o *KubernetesNodePoolProperties) SetLabels(v KubernetesNodePoolLabel) { + o.Labels = &v +} + +// HasLabels returns a boolean if a field has been set. +func (o *KubernetesNodePoolProperties) HasLabels() bool { + if o != nil && o.Labels != nil { + return true + } + + return false +} + + + +// GetAnnotations returns the Annotations field value +// If the value is explicit nil, the zero value for KubernetesNodePoolAnnotation will be returned +func (o *KubernetesNodePoolProperties) GetAnnotations() *KubernetesNodePoolAnnotation { + if o == nil { + return nil + } + + return o.Annotations +} + +// GetAnnotationsOk returns a tuple with the Annotations field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePoolProperties) GetAnnotationsOk() (*KubernetesNodePoolAnnotation, bool) { + if o == nil { + return nil, false + } + return o.Annotations, true +} + +// SetAnnotations sets field value +func (o *KubernetesNodePoolProperties) SetAnnotations(v KubernetesNodePoolAnnotation) { + o.Annotations = &v +} + +// HasAnnotations returns a boolean if a field has been set. +func (o *KubernetesNodePoolProperties) HasAnnotations() bool { + if o != nil && o.Annotations != nil { + return true + } + + return false +} + + +func (o KubernetesNodePoolProperties) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Name != nil { + toSerialize["name"] = o.Name + } + + + if o.DatacenterId != nil { + toSerialize["datacenterId"] = o.DatacenterId + } + + + if o.NodeCount != nil { + toSerialize["nodeCount"] = o.NodeCount + } + + + if o.CpuFamily != nil { + toSerialize["cpuFamily"] = o.CpuFamily + } + + + if o.CoresCount != nil { + toSerialize["coresCount"] = o.CoresCount + } + + + if o.RamSize != nil { + toSerialize["ramSize"] = o.RamSize + } + + + if o.AvailabilityZone != nil { + toSerialize["availabilityZone"] = o.AvailabilityZone + } + + + if o.StorageType != nil { + toSerialize["storageType"] = o.StorageType + } + + + if o.StorageSize != nil { + toSerialize["storageSize"] = o.StorageSize + } + + + if o.K8sVersion != nil { + toSerialize["k8sVersion"] = o.K8sVersion + } + + + if o.MaintenanceWindow != nil { + toSerialize["maintenanceWindow"] = o.MaintenanceWindow + } + + + if o.AutoScaling != nil { + toSerialize["autoScaling"] = o.AutoScaling + } + + + if o.Lans != nil { + toSerialize["lans"] = o.Lans + } + + + if o.Labels != nil { + toSerialize["labels"] = o.Labels + } + + + if o.Annotations != nil { + toSerialize["annotations"] = o.Annotations + } + + return json.Marshal(toSerialize) +} + +type NullableKubernetesNodePoolProperties struct { + value *KubernetesNodePoolProperties + isSet bool +} + +func (v NullableKubernetesNodePoolProperties) Get() *KubernetesNodePoolProperties { + return v.value +} + +func (v *NullableKubernetesNodePoolProperties) Set(val *KubernetesNodePoolProperties) { + v.value = val + v.isSet = true +} + +func (v NullableKubernetesNodePoolProperties) IsSet() bool { + return v.isSet +} + +func (v *NullableKubernetesNodePoolProperties) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableKubernetesNodePoolProperties(val *KubernetesNodePoolProperties) *NullableKubernetesNodePoolProperties { + return &NullableKubernetesNodePoolProperties{value: val, isSet: true} +} + +func (v NullableKubernetesNodePoolProperties) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableKubernetesNodePoolProperties) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_node_pool_properties_for_put.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_node_pool_properties_for_put.go new file mode 100644 index 0000000000..fc0a091a11 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_node_pool_properties_for_put.go @@ -0,0 +1,620 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// KubernetesNodePoolPropertiesForPut struct for KubernetesNodePoolPropertiesForPut +type KubernetesNodePoolPropertiesForPut struct { + // A Kubernetes Node Pool Name. Valid Kubernetes Node Pool name must be 63 characters or less and must be empty or begin and end with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between. + Name *string `json:"name"` + // A valid uuid of the datacenter on which user has access + DatacenterId *string `json:"datacenterId"` + // Number of nodes part of the Node Pool + NodeCount *int32 `json:"nodeCount"` + // A valid cpu family name + CpuFamily *string `json:"cpuFamily"` + // Number of cores for node + CoresCount *int32 `json:"coresCount"` + // RAM size for node, minimum size 2048MB is recommended. Ram size must be set to multiple of 1024MB. + RamSize *int32 `json:"ramSize"` + // The availability zone in which the server should exist + AvailabilityZone *string `json:"availabilityZone"` + // Hardware type of the volume + StorageType *string `json:"storageType"` + // The size of the volume in GB. The size should be greater than 10GB. + StorageSize *int32 `json:"storageSize"` + // The kubernetes version in which a nodepool is running. This imposes restrictions on what kubernetes versions can be run in a cluster's nodepools. Additionally, not all kubernetes versions are viable upgrade targets for all prior versions. + K8sVersion *string `json:"k8sVersion,omitempty"` + MaintenanceWindow *KubernetesMaintenanceWindow `json:"maintenanceWindow,omitempty"` + AutoScaling *KubernetesAutoScaling `json:"autoScaling,omitempty"` + // array of additional LANs attached to worker nodes + Lans *[]KubernetesNodePoolLan `json:"lans,omitempty"` +} + + + +// GetName returns the Name field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesNodePoolPropertiesForPut) GetName() *string { + if o == nil { + return nil + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePoolPropertiesForPut) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name, true +} + +// SetName sets field value +func (o *KubernetesNodePoolPropertiesForPut) SetName(v string) { + o.Name = &v +} + +// HasName returns a boolean if a field has been set. +func (o *KubernetesNodePoolPropertiesForPut) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + + + +// GetDatacenterId returns the DatacenterId field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesNodePoolPropertiesForPut) GetDatacenterId() *string { + if o == nil { + return nil + } + + return o.DatacenterId +} + +// GetDatacenterIdOk returns a tuple with the DatacenterId field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePoolPropertiesForPut) GetDatacenterIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.DatacenterId, true +} + +// SetDatacenterId sets field value +func (o *KubernetesNodePoolPropertiesForPut) SetDatacenterId(v string) { + o.DatacenterId = &v +} + +// HasDatacenterId returns a boolean if a field has been set. +func (o *KubernetesNodePoolPropertiesForPut) HasDatacenterId() bool { + if o != nil && o.DatacenterId != nil { + return true + } + + return false +} + + + +// GetNodeCount returns the NodeCount field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *KubernetesNodePoolPropertiesForPut) GetNodeCount() *int32 { + if o == nil { + return nil + } + + return o.NodeCount +} + +// GetNodeCountOk returns a tuple with the NodeCount field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePoolPropertiesForPut) GetNodeCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.NodeCount, true +} + +// SetNodeCount sets field value +func (o *KubernetesNodePoolPropertiesForPut) SetNodeCount(v int32) { + o.NodeCount = &v +} + +// HasNodeCount returns a boolean if a field has been set. +func (o *KubernetesNodePoolPropertiesForPut) HasNodeCount() bool { + if o != nil && o.NodeCount != nil { + return true + } + + return false +} + + + +// GetCpuFamily returns the CpuFamily field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesNodePoolPropertiesForPut) GetCpuFamily() *string { + if o == nil { + return nil + } + + return o.CpuFamily +} + +// GetCpuFamilyOk returns a tuple with the CpuFamily field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePoolPropertiesForPut) GetCpuFamilyOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.CpuFamily, true +} + +// SetCpuFamily sets field value +func (o *KubernetesNodePoolPropertiesForPut) SetCpuFamily(v string) { + o.CpuFamily = &v +} + +// HasCpuFamily returns a boolean if a field has been set. +func (o *KubernetesNodePoolPropertiesForPut) HasCpuFamily() bool { + if o != nil && o.CpuFamily != nil { + return true + } + + return false +} + + + +// GetCoresCount returns the CoresCount field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *KubernetesNodePoolPropertiesForPut) GetCoresCount() *int32 { + if o == nil { + return nil + } + + return o.CoresCount +} + +// GetCoresCountOk returns a tuple with the CoresCount field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePoolPropertiesForPut) GetCoresCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.CoresCount, true +} + +// SetCoresCount sets field value +func (o *KubernetesNodePoolPropertiesForPut) SetCoresCount(v int32) { + o.CoresCount = &v +} + +// HasCoresCount returns a boolean if a field has been set. +func (o *KubernetesNodePoolPropertiesForPut) HasCoresCount() bool { + if o != nil && o.CoresCount != nil { + return true + } + + return false +} + + + +// GetRamSize returns the RamSize field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *KubernetesNodePoolPropertiesForPut) GetRamSize() *int32 { + if o == nil { + return nil + } + + return o.RamSize +} + +// GetRamSizeOk returns a tuple with the RamSize field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePoolPropertiesForPut) GetRamSizeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.RamSize, true +} + +// SetRamSize sets field value +func (o *KubernetesNodePoolPropertiesForPut) SetRamSize(v int32) { + o.RamSize = &v +} + +// HasRamSize returns a boolean if a field has been set. +func (o *KubernetesNodePoolPropertiesForPut) HasRamSize() bool { + if o != nil && o.RamSize != nil { + return true + } + + return false +} + + + +// GetAvailabilityZone returns the AvailabilityZone field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesNodePoolPropertiesForPut) GetAvailabilityZone() *string { + if o == nil { + return nil + } + + return o.AvailabilityZone +} + +// GetAvailabilityZoneOk returns a tuple with the AvailabilityZone field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePoolPropertiesForPut) GetAvailabilityZoneOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.AvailabilityZone, true +} + +// SetAvailabilityZone sets field value +func (o *KubernetesNodePoolPropertiesForPut) SetAvailabilityZone(v string) { + o.AvailabilityZone = &v +} + +// HasAvailabilityZone returns a boolean if a field has been set. +func (o *KubernetesNodePoolPropertiesForPut) HasAvailabilityZone() bool { + if o != nil && o.AvailabilityZone != nil { + return true + } + + return false +} + + + +// GetStorageType returns the StorageType field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesNodePoolPropertiesForPut) GetStorageType() *string { + if o == nil { + return nil + } + + return o.StorageType +} + +// GetStorageTypeOk returns a tuple with the StorageType field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePoolPropertiesForPut) GetStorageTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.StorageType, true +} + +// SetStorageType sets field value +func (o *KubernetesNodePoolPropertiesForPut) SetStorageType(v string) { + o.StorageType = &v +} + +// HasStorageType returns a boolean if a field has been set. +func (o *KubernetesNodePoolPropertiesForPut) HasStorageType() bool { + if o != nil && o.StorageType != nil { + return true + } + + return false +} + + + +// GetStorageSize returns the StorageSize field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *KubernetesNodePoolPropertiesForPut) GetStorageSize() *int32 { + if o == nil { + return nil + } + + return o.StorageSize +} + +// GetStorageSizeOk returns a tuple with the StorageSize field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePoolPropertiesForPut) GetStorageSizeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.StorageSize, true +} + +// SetStorageSize sets field value +func (o *KubernetesNodePoolPropertiesForPut) SetStorageSize(v int32) { + o.StorageSize = &v +} + +// HasStorageSize returns a boolean if a field has been set. +func (o *KubernetesNodePoolPropertiesForPut) HasStorageSize() bool { + if o != nil && o.StorageSize != nil { + return true + } + + return false +} + + + +// GetK8sVersion returns the K8sVersion field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesNodePoolPropertiesForPut) GetK8sVersion() *string { + if o == nil { + return nil + } + + return o.K8sVersion +} + +// GetK8sVersionOk returns a tuple with the K8sVersion field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePoolPropertiesForPut) GetK8sVersionOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.K8sVersion, true +} + +// SetK8sVersion sets field value +func (o *KubernetesNodePoolPropertiesForPut) SetK8sVersion(v string) { + o.K8sVersion = &v +} + +// HasK8sVersion returns a boolean if a field has been set. +func (o *KubernetesNodePoolPropertiesForPut) HasK8sVersion() bool { + if o != nil && o.K8sVersion != nil { + return true + } + + return false +} + + + +// GetMaintenanceWindow returns the MaintenanceWindow field value +// If the value is explicit nil, the zero value for KubernetesMaintenanceWindow will be returned +func (o *KubernetesNodePoolPropertiesForPut) GetMaintenanceWindow() *KubernetesMaintenanceWindow { + if o == nil { + return nil + } + + return o.MaintenanceWindow +} + +// GetMaintenanceWindowOk returns a tuple with the MaintenanceWindow field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePoolPropertiesForPut) GetMaintenanceWindowOk() (*KubernetesMaintenanceWindow, bool) { + if o == nil { + return nil, false + } + return o.MaintenanceWindow, true +} + +// SetMaintenanceWindow sets field value +func (o *KubernetesNodePoolPropertiesForPut) SetMaintenanceWindow(v KubernetesMaintenanceWindow) { + o.MaintenanceWindow = &v +} + +// HasMaintenanceWindow returns a boolean if a field has been set. +func (o *KubernetesNodePoolPropertiesForPut) HasMaintenanceWindow() bool { + if o != nil && o.MaintenanceWindow != nil { + return true + } + + return false +} + + + +// GetAutoScaling returns the AutoScaling field value +// If the value is explicit nil, the zero value for KubernetesAutoScaling will be returned +func (o *KubernetesNodePoolPropertiesForPut) GetAutoScaling() *KubernetesAutoScaling { + if o == nil { + return nil + } + + return o.AutoScaling +} + +// GetAutoScalingOk returns a tuple with the AutoScaling field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePoolPropertiesForPut) GetAutoScalingOk() (*KubernetesAutoScaling, bool) { + if o == nil { + return nil, false + } + return o.AutoScaling, true +} + +// SetAutoScaling sets field value +func (o *KubernetesNodePoolPropertiesForPut) SetAutoScaling(v KubernetesAutoScaling) { + o.AutoScaling = &v +} + +// HasAutoScaling returns a boolean if a field has been set. +func (o *KubernetesNodePoolPropertiesForPut) HasAutoScaling() bool { + if o != nil && o.AutoScaling != nil { + return true + } + + return false +} + + + +// GetLans returns the Lans field value +// If the value is explicit nil, the zero value for []KubernetesNodePoolLan will be returned +func (o *KubernetesNodePoolPropertiesForPut) GetLans() *[]KubernetesNodePoolLan { + if o == nil { + return nil + } + + return o.Lans +} + +// GetLansOk returns a tuple with the Lans field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePoolPropertiesForPut) GetLansOk() (*[]KubernetesNodePoolLan, bool) { + if o == nil { + return nil, false + } + return o.Lans, true +} + +// SetLans sets field value +func (o *KubernetesNodePoolPropertiesForPut) SetLans(v []KubernetesNodePoolLan) { + o.Lans = &v +} + +// HasLans returns a boolean if a field has been set. +func (o *KubernetesNodePoolPropertiesForPut) HasLans() bool { + if o != nil && o.Lans != nil { + return true + } + + return false +} + + +func (o KubernetesNodePoolPropertiesForPut) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Name != nil { + toSerialize["name"] = o.Name + } + + + if o.DatacenterId != nil { + toSerialize["datacenterId"] = o.DatacenterId + } + + + if o.NodeCount != nil { + toSerialize["nodeCount"] = o.NodeCount + } + + + if o.CpuFamily != nil { + toSerialize["cpuFamily"] = o.CpuFamily + } + + + if o.CoresCount != nil { + toSerialize["coresCount"] = o.CoresCount + } + + + if o.RamSize != nil { + toSerialize["ramSize"] = o.RamSize + } + + + if o.AvailabilityZone != nil { + toSerialize["availabilityZone"] = o.AvailabilityZone + } + + + if o.StorageType != nil { + toSerialize["storageType"] = o.StorageType + } + + + if o.StorageSize != nil { + toSerialize["storageSize"] = o.StorageSize + } + + + if o.K8sVersion != nil { + toSerialize["k8sVersion"] = o.K8sVersion + } + + + if o.MaintenanceWindow != nil { + toSerialize["maintenanceWindow"] = o.MaintenanceWindow + } + + + if o.AutoScaling != nil { + toSerialize["autoScaling"] = o.AutoScaling + } + + + if o.Lans != nil { + toSerialize["lans"] = o.Lans + } + + return json.Marshal(toSerialize) +} + +type NullableKubernetesNodePoolPropertiesForPut struct { + value *KubernetesNodePoolPropertiesForPut + isSet bool +} + +func (v NullableKubernetesNodePoolPropertiesForPut) Get() *KubernetesNodePoolPropertiesForPut { + return v.value +} + +func (v *NullableKubernetesNodePoolPropertiesForPut) Set(val *KubernetesNodePoolPropertiesForPut) { + v.value = val + v.isSet = true +} + +func (v NullableKubernetesNodePoolPropertiesForPut) IsSet() bool { + return v.isSet +} + +func (v *NullableKubernetesNodePoolPropertiesForPut) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableKubernetesNodePoolPropertiesForPut(val *KubernetesNodePoolPropertiesForPut) *NullableKubernetesNodePoolPropertiesForPut { + return &NullableKubernetesNodePoolPropertiesForPut{value: val, isSet: true} +} + +func (v NullableKubernetesNodePoolPropertiesForPut) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableKubernetesNodePoolPropertiesForPut) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_node_pools.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_node_pools.go new file mode 100644 index 0000000000..7496854f1d --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_node_pools.go @@ -0,0 +1,235 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// KubernetesNodePools struct for KubernetesNodePools +type KubernetesNodePools struct { + // Unique representation for Kubernetes Node Pool as a collection on a resource. + Id *string `json:"id,omitempty"` + // The type of resource within a collection + Type *string `json:"type,omitempty"` + // URL to the collection representation (absolute path) + Href *string `json:"href,omitempty"` + // Array of items in that collection + Items *[]KubernetesNodePool `json:"items,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesNodePools) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePools) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *KubernetesNodePools) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *KubernetesNodePools) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesNodePools) GetType() *string { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePools) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *KubernetesNodePools) SetType(v string) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *KubernetesNodePools) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesNodePools) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePools) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *KubernetesNodePools) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *KubernetesNodePools) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []KubernetesNodePool will be returned +func (o *KubernetesNodePools) GetItems() *[]KubernetesNodePool { + if o == nil { + return nil + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodePools) GetItemsOk() (*[]KubernetesNodePool, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *KubernetesNodePools) SetItems(v []KubernetesNodePool) { + o.Items = &v +} + +// HasItems returns a boolean if a field has been set. +func (o *KubernetesNodePools) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + + +func (o KubernetesNodePools) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullableKubernetesNodePools struct { + value *KubernetesNodePools + isSet bool +} + +func (v NullableKubernetesNodePools) Get() *KubernetesNodePools { + return v.value +} + +func (v *NullableKubernetesNodePools) Set(val *KubernetesNodePools) { + v.value = val + v.isSet = true +} + +func (v NullableKubernetesNodePools) IsSet() bool { + return v.isSet +} + +func (v *NullableKubernetesNodePools) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableKubernetesNodePools(val *KubernetesNodePools) *NullableKubernetesNodePools { + return &NullableKubernetesNodePools{value: val, isSet: true} +} + +func (v NullableKubernetesNodePools) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableKubernetesNodePools) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_node_properties.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_node_properties.go new file mode 100644 index 0000000000..0c3181da4b --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_node_properties.go @@ -0,0 +1,192 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// KubernetesNodeProperties struct for KubernetesNodeProperties +type KubernetesNodeProperties struct { + // A Kubernetes Node Name. + Name *string `json:"name"` + // A valid public IP. + PublicIP *string `json:"publicIP"` + // The kubernetes version in which a nodepool is running. This imposes restrictions on what kubernetes versions can be run in a cluster's nodepools. Additionally, not all kubernetes versions are viable upgrade targets for all prior versions. + K8sVersion *string `json:"k8sVersion"` +} + + + +// GetName returns the Name field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesNodeProperties) GetName() *string { + if o == nil { + return nil + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodeProperties) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name, true +} + +// SetName sets field value +func (o *KubernetesNodeProperties) SetName(v string) { + o.Name = &v +} + +// HasName returns a boolean if a field has been set. +func (o *KubernetesNodeProperties) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + + + +// GetPublicIP returns the PublicIP field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesNodeProperties) GetPublicIP() *string { + if o == nil { + return nil + } + + return o.PublicIP +} + +// GetPublicIPOk returns a tuple with the PublicIP field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodeProperties) GetPublicIPOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.PublicIP, true +} + +// SetPublicIP sets field value +func (o *KubernetesNodeProperties) SetPublicIP(v string) { + o.PublicIP = &v +} + +// HasPublicIP returns a boolean if a field has been set. +func (o *KubernetesNodeProperties) HasPublicIP() bool { + if o != nil && o.PublicIP != nil { + return true + } + + return false +} + + + +// GetK8sVersion returns the K8sVersion field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesNodeProperties) GetK8sVersion() *string { + if o == nil { + return nil + } + + return o.K8sVersion +} + +// GetK8sVersionOk returns a tuple with the K8sVersion field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodeProperties) GetK8sVersionOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.K8sVersion, true +} + +// SetK8sVersion sets field value +func (o *KubernetesNodeProperties) SetK8sVersion(v string) { + o.K8sVersion = &v +} + +// HasK8sVersion returns a boolean if a field has been set. +func (o *KubernetesNodeProperties) HasK8sVersion() bool { + if o != nil && o.K8sVersion != nil { + return true + } + + return false +} + + +func (o KubernetesNodeProperties) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Name != nil { + toSerialize["name"] = o.Name + } + + + if o.PublicIP != nil { + toSerialize["publicIP"] = o.PublicIP + } + + + if o.K8sVersion != nil { + toSerialize["k8sVersion"] = o.K8sVersion + } + + return json.Marshal(toSerialize) +} + +type NullableKubernetesNodeProperties struct { + value *KubernetesNodeProperties + isSet bool +} + +func (v NullableKubernetesNodeProperties) Get() *KubernetesNodeProperties { + return v.value +} + +func (v *NullableKubernetesNodeProperties) Set(val *KubernetesNodeProperties) { + v.value = val + v.isSet = true +} + +func (v NullableKubernetesNodeProperties) IsSet() bool { + return v.isSet +} + +func (v *NullableKubernetesNodeProperties) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableKubernetesNodeProperties(val *KubernetesNodeProperties) *NullableKubernetesNodeProperties { + return &NullableKubernetesNodeProperties{value: val, isSet: true} +} + +func (v NullableKubernetesNodeProperties) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableKubernetesNodeProperties) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_nodes.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_nodes.go new file mode 100644 index 0000000000..0c5cf8a412 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_kubernetes_nodes.go @@ -0,0 +1,235 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// KubernetesNodes struct for KubernetesNodes +type KubernetesNodes struct { + // Unique representation for Kubernetes Node Pool as a collection on a resource. + Id *string `json:"id,omitempty"` + // The type of resource within a collection + Type *string `json:"type,omitempty"` + // URL to the collection representation (absolute path) + Href *string `json:"href,omitempty"` + // Array of items in that collection + Items *[]KubernetesNode `json:"items,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesNodes) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodes) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *KubernetesNodes) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *KubernetesNodes) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesNodes) GetType() *string { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodes) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *KubernetesNodes) SetType(v string) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *KubernetesNodes) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *KubernetesNodes) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodes) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *KubernetesNodes) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *KubernetesNodes) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []KubernetesNode will be returned +func (o *KubernetesNodes) GetItems() *[]KubernetesNode { + if o == nil { + return nil + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *KubernetesNodes) GetItemsOk() (*[]KubernetesNode, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *KubernetesNodes) SetItems(v []KubernetesNode) { + o.Items = &v +} + +// HasItems returns a boolean if a field has been set. +func (o *KubernetesNodes) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + + +func (o KubernetesNodes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullableKubernetesNodes struct { + value *KubernetesNodes + isSet bool +} + +func (v NullableKubernetesNodes) Get() *KubernetesNodes { + return v.value +} + +func (v *NullableKubernetesNodes) Set(val *KubernetesNodes) { + v.value = val + v.isSet = true +} + +func (v NullableKubernetesNodes) IsSet() bool { + return v.isSet +} + +func (v *NullableKubernetesNodes) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableKubernetesNodes(val *KubernetesNodes) *NullableKubernetesNodes { + return &NullableKubernetesNodes{value: val, isSet: true} +} + +func (v NullableKubernetesNodes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableKubernetesNodes) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_label.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_label.go new file mode 100644 index 0000000000..7e1af05092 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_label.go @@ -0,0 +1,276 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// Label struct for Label +type Label struct { + // Label is identified using standard URN. + Id *string `json:"id,omitempty"` + // The type of object that has been created + Type *string `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + Metadata *NoStateMetaData `json:"metadata,omitempty"` + Properties *LabelProperties `json:"properties"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Label) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Label) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *Label) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *Label) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Label) GetType() *string { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Label) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *Label) SetType(v string) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *Label) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Label) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Label) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *Label) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *Label) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for NoStateMetaData will be returned +func (o *Label) GetMetadata() *NoStateMetaData { + if o == nil { + return nil + } + + return o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Label) GetMetadataOk() (*NoStateMetaData, bool) { + if o == nil { + return nil, false + } + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *Label) SetMetadata(v NoStateMetaData) { + o.Metadata = &v +} + +// HasMetadata returns a boolean if a field has been set. +func (o *Label) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + + + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for LabelProperties will be returned +func (o *Label) GetProperties() *LabelProperties { + if o == nil { + return nil + } + + return o.Properties +} + +// GetPropertiesOk returns a tuple with the Properties field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Label) GetPropertiesOk() (*LabelProperties, bool) { + if o == nil { + return nil, false + } + return o.Properties, true +} + +// SetProperties sets field value +func (o *Label) SetProperties(v LabelProperties) { + o.Properties = &v +} + +// HasProperties returns a boolean if a field has been set. +func (o *Label) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + + +func (o Label) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + return json.Marshal(toSerialize) +} + +type NullableLabel struct { + value *Label + isSet bool +} + +func (v NullableLabel) Get() *Label { + return v.value +} + +func (v *NullableLabel) Set(val *Label) { + v.value = val + v.isSet = true +} + +func (v NullableLabel) IsSet() bool { + return v.isSet +} + +func (v *NullableLabel) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLabel(val *Label) *NullableLabel { + return &NullableLabel{value: val, isSet: true} +} + +func (v NullableLabel) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLabel) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_label_properties.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_label_properties.go new file mode 100644 index 0000000000..58c84024f6 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_label_properties.go @@ -0,0 +1,278 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// LabelProperties struct for LabelProperties +type LabelProperties struct { + // A Label Key + Key *string `json:"key,omitempty"` + // A Label Value + Value *string `json:"value,omitempty"` + // The id of the resource + ResourceId *string `json:"resourceId,omitempty"` + // The type of the resource on which the label is applied. + ResourceType *string `json:"resourceType,omitempty"` + // URL to the Resource (absolute path) on which the label is applied. + ResourceHref *string `json:"resourceHref,omitempty"` +} + + + +// GetKey returns the Key field value +// If the value is explicit nil, the zero value for string will be returned +func (o *LabelProperties) GetKey() *string { + if o == nil { + return nil + } + + return o.Key +} + +// GetKeyOk returns a tuple with the Key field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *LabelProperties) GetKeyOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Key, true +} + +// SetKey sets field value +func (o *LabelProperties) SetKey(v string) { + o.Key = &v +} + +// HasKey returns a boolean if a field has been set. +func (o *LabelProperties) HasKey() bool { + if o != nil && o.Key != nil { + return true + } + + return false +} + + + +// GetValue returns the Value field value +// If the value is explicit nil, the zero value for string will be returned +func (o *LabelProperties) GetValue() *string { + if o == nil { + return nil + } + + return o.Value +} + +// GetValueOk returns a tuple with the Value field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *LabelProperties) GetValueOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Value, true +} + +// SetValue sets field value +func (o *LabelProperties) SetValue(v string) { + o.Value = &v +} + +// HasValue returns a boolean if a field has been set. +func (o *LabelProperties) HasValue() bool { + if o != nil && o.Value != nil { + return true + } + + return false +} + + + +// GetResourceId returns the ResourceId field value +// If the value is explicit nil, the zero value for string will be returned +func (o *LabelProperties) GetResourceId() *string { + if o == nil { + return nil + } + + return o.ResourceId +} + +// GetResourceIdOk returns a tuple with the ResourceId field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *LabelProperties) GetResourceIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.ResourceId, true +} + +// SetResourceId sets field value +func (o *LabelProperties) SetResourceId(v string) { + o.ResourceId = &v +} + +// HasResourceId returns a boolean if a field has been set. +func (o *LabelProperties) HasResourceId() bool { + if o != nil && o.ResourceId != nil { + return true + } + + return false +} + + + +// GetResourceType returns the ResourceType field value +// If the value is explicit nil, the zero value for string will be returned +func (o *LabelProperties) GetResourceType() *string { + if o == nil { + return nil + } + + return o.ResourceType +} + +// GetResourceTypeOk returns a tuple with the ResourceType field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *LabelProperties) GetResourceTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.ResourceType, true +} + +// SetResourceType sets field value +func (o *LabelProperties) SetResourceType(v string) { + o.ResourceType = &v +} + +// HasResourceType returns a boolean if a field has been set. +func (o *LabelProperties) HasResourceType() bool { + if o != nil && o.ResourceType != nil { + return true + } + + return false +} + + + +// GetResourceHref returns the ResourceHref field value +// If the value is explicit nil, the zero value for string will be returned +func (o *LabelProperties) GetResourceHref() *string { + if o == nil { + return nil + } + + return o.ResourceHref +} + +// GetResourceHrefOk returns a tuple with the ResourceHref field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *LabelProperties) GetResourceHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.ResourceHref, true +} + +// SetResourceHref sets field value +func (o *LabelProperties) SetResourceHref(v string) { + o.ResourceHref = &v +} + +// HasResourceHref returns a boolean if a field has been set. +func (o *LabelProperties) HasResourceHref() bool { + if o != nil && o.ResourceHref != nil { + return true + } + + return false +} + + +func (o LabelProperties) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Key != nil { + toSerialize["key"] = o.Key + } + + + if o.Value != nil { + toSerialize["value"] = o.Value + } + + + if o.ResourceId != nil { + toSerialize["resourceId"] = o.ResourceId + } + + + if o.ResourceType != nil { + toSerialize["resourceType"] = o.ResourceType + } + + + if o.ResourceHref != nil { + toSerialize["resourceHref"] = o.ResourceHref + } + + return json.Marshal(toSerialize) +} + +type NullableLabelProperties struct { + value *LabelProperties + isSet bool +} + +func (v NullableLabelProperties) Get() *LabelProperties { + return v.value +} + +func (v *NullableLabelProperties) Set(val *LabelProperties) { + v.value = val + v.isSet = true +} + +func (v NullableLabelProperties) IsSet() bool { + return v.isSet +} + +func (v *NullableLabelProperties) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLabelProperties(val *LabelProperties) *NullableLabelProperties { + return &NullableLabelProperties{value: val, isSet: true} +} + +func (v NullableLabelProperties) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLabelProperties) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_label_resource.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_label_resource.go new file mode 100644 index 0000000000..34d7e10160 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_label_resource.go @@ -0,0 +1,276 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// LabelResource struct for LabelResource +type LabelResource struct { + // Label on a resource is identified using label key. + Id *string `json:"id,omitempty"` + // The type of object that has been created + Type *string `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + Metadata *NoStateMetaData `json:"metadata,omitempty"` + Properties *LabelResourceProperties `json:"properties"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *LabelResource) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *LabelResource) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *LabelResource) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *LabelResource) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for string will be returned +func (o *LabelResource) GetType() *string { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *LabelResource) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *LabelResource) SetType(v string) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *LabelResource) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *LabelResource) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *LabelResource) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *LabelResource) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *LabelResource) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for NoStateMetaData will be returned +func (o *LabelResource) GetMetadata() *NoStateMetaData { + if o == nil { + return nil + } + + return o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *LabelResource) GetMetadataOk() (*NoStateMetaData, bool) { + if o == nil { + return nil, false + } + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *LabelResource) SetMetadata(v NoStateMetaData) { + o.Metadata = &v +} + +// HasMetadata returns a boolean if a field has been set. +func (o *LabelResource) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + + + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for LabelResourceProperties will be returned +func (o *LabelResource) GetProperties() *LabelResourceProperties { + if o == nil { + return nil + } + + return o.Properties +} + +// GetPropertiesOk returns a tuple with the Properties field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *LabelResource) GetPropertiesOk() (*LabelResourceProperties, bool) { + if o == nil { + return nil, false + } + return o.Properties, true +} + +// SetProperties sets field value +func (o *LabelResource) SetProperties(v LabelResourceProperties) { + o.Properties = &v +} + +// HasProperties returns a boolean if a field has been set. +func (o *LabelResource) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + + +func (o LabelResource) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + return json.Marshal(toSerialize) +} + +type NullableLabelResource struct { + value *LabelResource + isSet bool +} + +func (v NullableLabelResource) Get() *LabelResource { + return v.value +} + +func (v *NullableLabelResource) Set(val *LabelResource) { + v.value = val + v.isSet = true +} + +func (v NullableLabelResource) IsSet() bool { + return v.isSet +} + +func (v *NullableLabelResource) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLabelResource(val *LabelResource) *NullableLabelResource { + return &NullableLabelResource{value: val, isSet: true} +} + +func (v NullableLabelResource) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLabelResource) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_label_resource_properties.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_label_resource_properties.go new file mode 100644 index 0000000000..27ca1ff773 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_label_resource_properties.go @@ -0,0 +1,149 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// LabelResourceProperties struct for LabelResourceProperties +type LabelResourceProperties struct { + // A Label Key + Key *string `json:"key,omitempty"` + // A Label Value + Value *string `json:"value,omitempty"` +} + + + +// GetKey returns the Key field value +// If the value is explicit nil, the zero value for string will be returned +func (o *LabelResourceProperties) GetKey() *string { + if o == nil { + return nil + } + + return o.Key +} + +// GetKeyOk returns a tuple with the Key field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *LabelResourceProperties) GetKeyOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Key, true +} + +// SetKey sets field value +func (o *LabelResourceProperties) SetKey(v string) { + o.Key = &v +} + +// HasKey returns a boolean if a field has been set. +func (o *LabelResourceProperties) HasKey() bool { + if o != nil && o.Key != nil { + return true + } + + return false +} + + + +// GetValue returns the Value field value +// If the value is explicit nil, the zero value for string will be returned +func (o *LabelResourceProperties) GetValue() *string { + if o == nil { + return nil + } + + return o.Value +} + +// GetValueOk returns a tuple with the Value field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *LabelResourceProperties) GetValueOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Value, true +} + +// SetValue sets field value +func (o *LabelResourceProperties) SetValue(v string) { + o.Value = &v +} + +// HasValue returns a boolean if a field has been set. +func (o *LabelResourceProperties) HasValue() bool { + if o != nil && o.Value != nil { + return true + } + + return false +} + + +func (o LabelResourceProperties) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Key != nil { + toSerialize["key"] = o.Key + } + + + if o.Value != nil { + toSerialize["value"] = o.Value + } + + return json.Marshal(toSerialize) +} + +type NullableLabelResourceProperties struct { + value *LabelResourceProperties + isSet bool +} + +func (v NullableLabelResourceProperties) Get() *LabelResourceProperties { + return v.value +} + +func (v *NullableLabelResourceProperties) Set(val *LabelResourceProperties) { + v.value = val + v.isSet = true +} + +func (v NullableLabelResourceProperties) IsSet() bool { + return v.isSet +} + +func (v *NullableLabelResourceProperties) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLabelResourceProperties(val *LabelResourceProperties) *NullableLabelResourceProperties { + return &NullableLabelResourceProperties{value: val, isSet: true} +} + +func (v NullableLabelResourceProperties) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLabelResourceProperties) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_label_resources.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_label_resources.go new file mode 100644 index 0000000000..43367e1de0 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_label_resources.go @@ -0,0 +1,235 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// LabelResources struct for LabelResources +type LabelResources struct { + // Unique representation for Label as a collection on a resource. + Id *string `json:"id,omitempty"` + // The type of resource within a collection + Type *string `json:"type,omitempty"` + // URL to the collection representation (absolute path) + Href *string `json:"href,omitempty"` + // Array of items in that collection + Items *[]LabelResource `json:"items,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *LabelResources) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *LabelResources) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *LabelResources) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *LabelResources) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for string will be returned +func (o *LabelResources) GetType() *string { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *LabelResources) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *LabelResources) SetType(v string) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *LabelResources) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *LabelResources) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *LabelResources) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *LabelResources) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *LabelResources) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []LabelResource will be returned +func (o *LabelResources) GetItems() *[]LabelResource { + if o == nil { + return nil + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *LabelResources) GetItemsOk() (*[]LabelResource, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *LabelResources) SetItems(v []LabelResource) { + o.Items = &v +} + +// HasItems returns a boolean if a field has been set. +func (o *LabelResources) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + + +func (o LabelResources) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullableLabelResources struct { + value *LabelResources + isSet bool +} + +func (v NullableLabelResources) Get() *LabelResources { + return v.value +} + +func (v *NullableLabelResources) Set(val *LabelResources) { + v.value = val + v.isSet = true +} + +func (v NullableLabelResources) IsSet() bool { + return v.isSet +} + +func (v *NullableLabelResources) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLabelResources(val *LabelResources) *NullableLabelResources { + return &NullableLabelResources{value: val, isSet: true} +} + +func (v NullableLabelResources) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLabelResources) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_labels.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_labels.go new file mode 100644 index 0000000000..72ac151e28 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_labels.go @@ -0,0 +1,235 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// Labels struct for Labels +type Labels struct { + // Unique representation for Label as a collection of resource. + Id *string `json:"id,omitempty"` + // The type of resource within a collection + Type *string `json:"type,omitempty"` + // URL to the collection representation (absolute path) + Href *string `json:"href,omitempty"` + // Array of items in that collection + Items *[]Label `json:"items,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Labels) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Labels) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *Labels) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *Labels) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Labels) GetType() *string { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Labels) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *Labels) SetType(v string) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *Labels) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Labels) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Labels) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *Labels) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *Labels) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []Label will be returned +func (o *Labels) GetItems() *[]Label { + if o == nil { + return nil + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Labels) GetItemsOk() (*[]Label, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *Labels) SetItems(v []Label) { + o.Items = &v +} + +// HasItems returns a boolean if a field has been set. +func (o *Labels) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + + +func (o Labels) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullableLabels struct { + value *Labels + isSet bool +} + +func (v NullableLabels) Get() *Labels { + return v.value +} + +func (v *NullableLabels) Set(val *Labels) { + v.value = val + v.isSet = true +} + +func (v NullableLabels) IsSet() bool { + return v.isSet +} + +func (v *NullableLabels) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLabels(val *Labels) *NullableLabels { + return &NullableLabels{value: val, isSet: true} +} + +func (v NullableLabels) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLabels) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_lan.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_lan.go new file mode 100644 index 0000000000..8edc04fc97 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_lan.go @@ -0,0 +1,318 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// Lan struct for Lan +type Lan struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of object that has been created + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` + Properties *LanProperties `json:"properties"` + Entities *LanEntities `json:"entities,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Lan) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Lan) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *Lan) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *Lan) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *Lan) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Lan) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *Lan) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *Lan) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Lan) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Lan) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *Lan) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *Lan) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for DatacenterElementMetadata will be returned +func (o *Lan) GetMetadata() *DatacenterElementMetadata { + if o == nil { + return nil + } + + return o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Lan) GetMetadataOk() (*DatacenterElementMetadata, bool) { + if o == nil { + return nil, false + } + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *Lan) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + +// HasMetadata returns a boolean if a field has been set. +func (o *Lan) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + + + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for LanProperties will be returned +func (o *Lan) GetProperties() *LanProperties { + if o == nil { + return nil + } + + return o.Properties +} + +// GetPropertiesOk returns a tuple with the Properties field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Lan) GetPropertiesOk() (*LanProperties, bool) { + if o == nil { + return nil, false + } + return o.Properties, true +} + +// SetProperties sets field value +func (o *Lan) SetProperties(v LanProperties) { + o.Properties = &v +} + +// HasProperties returns a boolean if a field has been set. +func (o *Lan) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + + + +// GetEntities returns the Entities field value +// If the value is explicit nil, the zero value for LanEntities will be returned +func (o *Lan) GetEntities() *LanEntities { + if o == nil { + return nil + } + + return o.Entities +} + +// GetEntitiesOk returns a tuple with the Entities field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Lan) GetEntitiesOk() (*LanEntities, bool) { + if o == nil { + return nil, false + } + return o.Entities, true +} + +// SetEntities sets field value +func (o *Lan) SetEntities(v LanEntities) { + o.Entities = &v +} + +// HasEntities returns a boolean if a field has been set. +func (o *Lan) HasEntities() bool { + if o != nil && o.Entities != nil { + return true + } + + return false +} + + +func (o Lan) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + + if o.Entities != nil { + toSerialize["entities"] = o.Entities + } + + return json.Marshal(toSerialize) +} + +type NullableLan struct { + value *Lan + isSet bool +} + +func (v NullableLan) Get() *Lan { + return v.value +} + +func (v *NullableLan) Set(val *Lan) { + v.value = val + v.isSet = true +} + +func (v NullableLan) IsSet() bool { + return v.isSet +} + +func (v *NullableLan) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLan(val *Lan) *NullableLan { + return &NullableLan{value: val, isSet: true} +} + +func (v NullableLan) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLan) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_lan_entities.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_lan_entities.go new file mode 100644 index 0000000000..4fdf1c6643 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_lan_entities.go @@ -0,0 +1,105 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// LanEntities struct for LanEntities +type LanEntities struct { + Nics *LanNics `json:"nics,omitempty"` +} + + + +// GetNics returns the Nics field value +// If the value is explicit nil, the zero value for LanNics will be returned +func (o *LanEntities) GetNics() *LanNics { + if o == nil { + return nil + } + + return o.Nics +} + +// GetNicsOk returns a tuple with the Nics field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *LanEntities) GetNicsOk() (*LanNics, bool) { + if o == nil { + return nil, false + } + return o.Nics, true +} + +// SetNics sets field value +func (o *LanEntities) SetNics(v LanNics) { + o.Nics = &v +} + +// HasNics returns a boolean if a field has been set. +func (o *LanEntities) HasNics() bool { + if o != nil && o.Nics != nil { + return true + } + + return false +} + + +func (o LanEntities) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Nics != nil { + toSerialize["nics"] = o.Nics + } + + return json.Marshal(toSerialize) +} + +type NullableLanEntities struct { + value *LanEntities + isSet bool +} + +func (v NullableLanEntities) Get() *LanEntities { + return v.value +} + +func (v *NullableLanEntities) Set(val *LanEntities) { + v.value = val + v.isSet = true +} + +func (v NullableLanEntities) IsSet() bool { + return v.isSet +} + +func (v *NullableLanEntities) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLanEntities(val *LanEntities) *NullableLanEntities { + return &NullableLanEntities{value: val, isSet: true} +} + +func (v NullableLanEntities) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLanEntities) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_lan_nics.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_lan_nics.go new file mode 100644 index 0000000000..a13c06b9a5 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_lan_nics.go @@ -0,0 +1,235 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// LanNics struct for LanNics +type LanNics struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of object that has been created + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + // Array of items in that collection + Items *[]Nic `json:"items,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *LanNics) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *LanNics) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *LanNics) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *LanNics) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *LanNics) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *LanNics) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *LanNics) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *LanNics) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *LanNics) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *LanNics) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *LanNics) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *LanNics) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []Nic will be returned +func (o *LanNics) GetItems() *[]Nic { + if o == nil { + return nil + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *LanNics) GetItemsOk() (*[]Nic, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *LanNics) SetItems(v []Nic) { + o.Items = &v +} + +// HasItems returns a boolean if a field has been set. +func (o *LanNics) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + + +func (o LanNics) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullableLanNics struct { + value *LanNics + isSet bool +} + +func (v NullableLanNics) Get() *LanNics { + return v.value +} + +func (v *NullableLanNics) Set(val *LanNics) { + v.value = val + v.isSet = true +} + +func (v NullableLanNics) IsSet() bool { + return v.isSet +} + +func (v *NullableLanNics) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLanNics(val *LanNics) *NullableLanNics { + return &NullableLanNics{value: val, isSet: true} +} + +func (v NullableLanNics) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLanNics) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_lan_post.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_lan_post.go new file mode 100644 index 0000000000..122fe87215 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_lan_post.go @@ -0,0 +1,318 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// LanPost struct for LanPost +type LanPost struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of object that has been created + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` + Entities *LanEntities `json:"entities,omitempty"` + Properties *LanPropertiesPost `json:"properties"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *LanPost) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *LanPost) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *LanPost) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *LanPost) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *LanPost) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *LanPost) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *LanPost) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *LanPost) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *LanPost) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *LanPost) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *LanPost) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *LanPost) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for DatacenterElementMetadata will be returned +func (o *LanPost) GetMetadata() *DatacenterElementMetadata { + if o == nil { + return nil + } + + return o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *LanPost) GetMetadataOk() (*DatacenterElementMetadata, bool) { + if o == nil { + return nil, false + } + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *LanPost) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + +// HasMetadata returns a boolean if a field has been set. +func (o *LanPost) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + + + +// GetEntities returns the Entities field value +// If the value is explicit nil, the zero value for LanEntities will be returned +func (o *LanPost) GetEntities() *LanEntities { + if o == nil { + return nil + } + + return o.Entities +} + +// GetEntitiesOk returns a tuple with the Entities field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *LanPost) GetEntitiesOk() (*LanEntities, bool) { + if o == nil { + return nil, false + } + return o.Entities, true +} + +// SetEntities sets field value +func (o *LanPost) SetEntities(v LanEntities) { + o.Entities = &v +} + +// HasEntities returns a boolean if a field has been set. +func (o *LanPost) HasEntities() bool { + if o != nil && o.Entities != nil { + return true + } + + return false +} + + + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for LanPropertiesPost will be returned +func (o *LanPost) GetProperties() *LanPropertiesPost { + if o == nil { + return nil + } + + return o.Properties +} + +// GetPropertiesOk returns a tuple with the Properties field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *LanPost) GetPropertiesOk() (*LanPropertiesPost, bool) { + if o == nil { + return nil, false + } + return o.Properties, true +} + +// SetProperties sets field value +func (o *LanPost) SetProperties(v LanPropertiesPost) { + o.Properties = &v +} + +// HasProperties returns a boolean if a field has been set. +func (o *LanPost) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + + +func (o LanPost) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + + if o.Entities != nil { + toSerialize["entities"] = o.Entities + } + + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + return json.Marshal(toSerialize) +} + +type NullableLanPost struct { + value *LanPost + isSet bool +} + +func (v NullableLanPost) Get() *LanPost { + return v.value +} + +func (v *NullableLanPost) Set(val *LanPost) { + v.value = val + v.isSet = true +} + +func (v NullableLanPost) IsSet() bool { + return v.isSet +} + +func (v *NullableLanPost) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLanPost(val *LanPost) *NullableLanPost { + return &NullableLanPost{value: val, isSet: true} +} + +func (v NullableLanPost) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLanPost) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_lan_properties.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_lan_properties.go new file mode 100644 index 0000000000..0b6e35290d --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_lan_properties.go @@ -0,0 +1,235 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// LanProperties struct for LanProperties +type LanProperties struct { + // A name of that resource + Name *string `json:"name,omitempty"` + // IP failover configurations for lan + IpFailover *[]IPFailover `json:"ipFailover,omitempty"` + // Unique identifier of the private cross connect the given LAN is connected to if any + Pcc *string `json:"pcc,omitempty"` + // Does this LAN faces the public Internet or not + Public *bool `json:"public,omitempty"` +} + + + +// GetName returns the Name field value +// If the value is explicit nil, the zero value for string will be returned +func (o *LanProperties) GetName() *string { + if o == nil { + return nil + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *LanProperties) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name, true +} + +// SetName sets field value +func (o *LanProperties) SetName(v string) { + o.Name = &v +} + +// HasName returns a boolean if a field has been set. +func (o *LanProperties) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + + + +// GetIpFailover returns the IpFailover field value +// If the value is explicit nil, the zero value for []IPFailover will be returned +func (o *LanProperties) GetIpFailover() *[]IPFailover { + if o == nil { + return nil + } + + return o.IpFailover +} + +// GetIpFailoverOk returns a tuple with the IpFailover field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *LanProperties) GetIpFailoverOk() (*[]IPFailover, bool) { + if o == nil { + return nil, false + } + return o.IpFailover, true +} + +// SetIpFailover sets field value +func (o *LanProperties) SetIpFailover(v []IPFailover) { + o.IpFailover = &v +} + +// HasIpFailover returns a boolean if a field has been set. +func (o *LanProperties) HasIpFailover() bool { + if o != nil && o.IpFailover != nil { + return true + } + + return false +} + + + +// GetPcc returns the Pcc field value +// If the value is explicit nil, the zero value for string will be returned +func (o *LanProperties) GetPcc() *string { + if o == nil { + return nil + } + + return o.Pcc +} + +// GetPccOk returns a tuple with the Pcc field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *LanProperties) GetPccOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Pcc, true +} + +// SetPcc sets field value +func (o *LanProperties) SetPcc(v string) { + o.Pcc = &v +} + +// HasPcc returns a boolean if a field has been set. +func (o *LanProperties) HasPcc() bool { + if o != nil && o.Pcc != nil { + return true + } + + return false +} + + + +// GetPublic returns the Public field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *LanProperties) GetPublic() *bool { + if o == nil { + return nil + } + + return o.Public +} + +// GetPublicOk returns a tuple with the Public field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *LanProperties) GetPublicOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.Public, true +} + +// SetPublic sets field value +func (o *LanProperties) SetPublic(v bool) { + o.Public = &v +} + +// HasPublic returns a boolean if a field has been set. +func (o *LanProperties) HasPublic() bool { + if o != nil && o.Public != nil { + return true + } + + return false +} + + +func (o LanProperties) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Name != nil { + toSerialize["name"] = o.Name + } + + + if o.IpFailover != nil { + toSerialize["ipFailover"] = o.IpFailover + } + + + if o.Pcc != nil { + toSerialize["pcc"] = o.Pcc + } + + + if o.Public != nil { + toSerialize["public"] = o.Public + } + + return json.Marshal(toSerialize) +} + +type NullableLanProperties struct { + value *LanProperties + isSet bool +} + +func (v NullableLanProperties) Get() *LanProperties { + return v.value +} + +func (v *NullableLanProperties) Set(val *LanProperties) { + v.value = val + v.isSet = true +} + +func (v NullableLanProperties) IsSet() bool { + return v.isSet +} + +func (v *NullableLanProperties) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLanProperties(val *LanProperties) *NullableLanProperties { + return &NullableLanProperties{value: val, isSet: true} +} + +func (v NullableLanProperties) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLanProperties) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_lan_properties_post.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_lan_properties_post.go new file mode 100644 index 0000000000..6636bfffcc --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_lan_properties_post.go @@ -0,0 +1,149 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// LanPropertiesPost struct for LanPropertiesPost +type LanPropertiesPost struct { + // A name of that resource + Name *string `json:"name,omitempty"` + // Does this LAN faces the public Internet or not + Public *bool `json:"public,omitempty"` +} + + + +// GetName returns the Name field value +// If the value is explicit nil, the zero value for string will be returned +func (o *LanPropertiesPost) GetName() *string { + if o == nil { + return nil + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *LanPropertiesPost) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name, true +} + +// SetName sets field value +func (o *LanPropertiesPost) SetName(v string) { + o.Name = &v +} + +// HasName returns a boolean if a field has been set. +func (o *LanPropertiesPost) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + + + +// GetPublic returns the Public field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *LanPropertiesPost) GetPublic() *bool { + if o == nil { + return nil + } + + return o.Public +} + +// GetPublicOk returns a tuple with the Public field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *LanPropertiesPost) GetPublicOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.Public, true +} + +// SetPublic sets field value +func (o *LanPropertiesPost) SetPublic(v bool) { + o.Public = &v +} + +// HasPublic returns a boolean if a field has been set. +func (o *LanPropertiesPost) HasPublic() bool { + if o != nil && o.Public != nil { + return true + } + + return false +} + + +func (o LanPropertiesPost) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Name != nil { + toSerialize["name"] = o.Name + } + + + if o.Public != nil { + toSerialize["public"] = o.Public + } + + return json.Marshal(toSerialize) +} + +type NullableLanPropertiesPost struct { + value *LanPropertiesPost + isSet bool +} + +func (v NullableLanPropertiesPost) Get() *LanPropertiesPost { + return v.value +} + +func (v *NullableLanPropertiesPost) Set(val *LanPropertiesPost) { + v.value = val + v.isSet = true +} + +func (v NullableLanPropertiesPost) IsSet() bool { + return v.isSet +} + +func (v *NullableLanPropertiesPost) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLanPropertiesPost(val *LanPropertiesPost) *NullableLanPropertiesPost { + return &NullableLanPropertiesPost{value: val, isSet: true} +} + +func (v NullableLanPropertiesPost) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLanPropertiesPost) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_lans.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_lans.go new file mode 100644 index 0000000000..ec2aeb3330 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_lans.go @@ -0,0 +1,235 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// Lans struct for Lans +type Lans struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of object that has been created + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + // Array of items in that collection + Items *[]Lan `json:"items,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Lans) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Lans) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *Lans) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *Lans) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *Lans) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Lans) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *Lans) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *Lans) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Lans) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Lans) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *Lans) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *Lans) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []Lan will be returned +func (o *Lans) GetItems() *[]Lan { + if o == nil { + return nil + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Lans) GetItemsOk() (*[]Lan, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *Lans) SetItems(v []Lan) { + o.Items = &v +} + +// HasItems returns a boolean if a field has been set. +func (o *Lans) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + + +func (o Lans) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullableLans struct { + value *Lans + isSet bool +} + +func (v NullableLans) Get() *Lans { + return v.value +} + +func (v *NullableLans) Set(val *Lans) { + v.value = val + v.isSet = true +} + +func (v NullableLans) IsSet() bool { + return v.isSet +} + +func (v *NullableLans) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLans(val *Lans) *NullableLans { + return &NullableLans{value: val, isSet: true} +} + +func (v NullableLans) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLans) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_loadbalancer.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_loadbalancer.go new file mode 100644 index 0000000000..47a0adf820 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_loadbalancer.go @@ -0,0 +1,318 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// Loadbalancer struct for Loadbalancer +type Loadbalancer struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of object that has been created + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` + Properties *LoadbalancerProperties `json:"properties"` + Entities *LoadbalancerEntities `json:"entities,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Loadbalancer) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Loadbalancer) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *Loadbalancer) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *Loadbalancer) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *Loadbalancer) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Loadbalancer) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *Loadbalancer) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *Loadbalancer) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Loadbalancer) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Loadbalancer) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *Loadbalancer) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *Loadbalancer) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for DatacenterElementMetadata will be returned +func (o *Loadbalancer) GetMetadata() *DatacenterElementMetadata { + if o == nil { + return nil + } + + return o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Loadbalancer) GetMetadataOk() (*DatacenterElementMetadata, bool) { + if o == nil { + return nil, false + } + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *Loadbalancer) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + +// HasMetadata returns a boolean if a field has been set. +func (o *Loadbalancer) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + + + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for LoadbalancerProperties will be returned +func (o *Loadbalancer) GetProperties() *LoadbalancerProperties { + if o == nil { + return nil + } + + return o.Properties +} + +// GetPropertiesOk returns a tuple with the Properties field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Loadbalancer) GetPropertiesOk() (*LoadbalancerProperties, bool) { + if o == nil { + return nil, false + } + return o.Properties, true +} + +// SetProperties sets field value +func (o *Loadbalancer) SetProperties(v LoadbalancerProperties) { + o.Properties = &v +} + +// HasProperties returns a boolean if a field has been set. +func (o *Loadbalancer) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + + + +// GetEntities returns the Entities field value +// If the value is explicit nil, the zero value for LoadbalancerEntities will be returned +func (o *Loadbalancer) GetEntities() *LoadbalancerEntities { + if o == nil { + return nil + } + + return o.Entities +} + +// GetEntitiesOk returns a tuple with the Entities field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Loadbalancer) GetEntitiesOk() (*LoadbalancerEntities, bool) { + if o == nil { + return nil, false + } + return o.Entities, true +} + +// SetEntities sets field value +func (o *Loadbalancer) SetEntities(v LoadbalancerEntities) { + o.Entities = &v +} + +// HasEntities returns a boolean if a field has been set. +func (o *Loadbalancer) HasEntities() bool { + if o != nil && o.Entities != nil { + return true + } + + return false +} + + +func (o Loadbalancer) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + + if o.Entities != nil { + toSerialize["entities"] = o.Entities + } + + return json.Marshal(toSerialize) +} + +type NullableLoadbalancer struct { + value *Loadbalancer + isSet bool +} + +func (v NullableLoadbalancer) Get() *Loadbalancer { + return v.value +} + +func (v *NullableLoadbalancer) Set(val *Loadbalancer) { + v.value = val + v.isSet = true +} + +func (v NullableLoadbalancer) IsSet() bool { + return v.isSet +} + +func (v *NullableLoadbalancer) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLoadbalancer(val *Loadbalancer) *NullableLoadbalancer { + return &NullableLoadbalancer{value: val, isSet: true} +} + +func (v NullableLoadbalancer) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLoadbalancer) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_loadbalancer_entities.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_loadbalancer_entities.go new file mode 100644 index 0000000000..69538781e2 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_loadbalancer_entities.go @@ -0,0 +1,105 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// LoadbalancerEntities struct for LoadbalancerEntities +type LoadbalancerEntities struct { + Balancednics *BalancedNics `json:"balancednics,omitempty"` +} + + + +// GetBalancednics returns the Balancednics field value +// If the value is explicit nil, the zero value for BalancedNics will be returned +func (o *LoadbalancerEntities) GetBalancednics() *BalancedNics { + if o == nil { + return nil + } + + return o.Balancednics +} + +// GetBalancednicsOk returns a tuple with the Balancednics field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *LoadbalancerEntities) GetBalancednicsOk() (*BalancedNics, bool) { + if o == nil { + return nil, false + } + return o.Balancednics, true +} + +// SetBalancednics sets field value +func (o *LoadbalancerEntities) SetBalancednics(v BalancedNics) { + o.Balancednics = &v +} + +// HasBalancednics returns a boolean if a field has been set. +func (o *LoadbalancerEntities) HasBalancednics() bool { + if o != nil && o.Balancednics != nil { + return true + } + + return false +} + + +func (o LoadbalancerEntities) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Balancednics != nil { + toSerialize["balancednics"] = o.Balancednics + } + + return json.Marshal(toSerialize) +} + +type NullableLoadbalancerEntities struct { + value *LoadbalancerEntities + isSet bool +} + +func (v NullableLoadbalancerEntities) Get() *LoadbalancerEntities { + return v.value +} + +func (v *NullableLoadbalancerEntities) Set(val *LoadbalancerEntities) { + v.value = val + v.isSet = true +} + +func (v NullableLoadbalancerEntities) IsSet() bool { + return v.isSet +} + +func (v *NullableLoadbalancerEntities) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLoadbalancerEntities(val *LoadbalancerEntities) *NullableLoadbalancerEntities { + return &NullableLoadbalancerEntities{value: val, isSet: true} +} + +func (v NullableLoadbalancerEntities) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLoadbalancerEntities) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_loadbalancer_properties.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_loadbalancer_properties.go new file mode 100644 index 0000000000..61a6d83d7b --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_loadbalancer_properties.go @@ -0,0 +1,192 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// LoadbalancerProperties struct for LoadbalancerProperties +type LoadbalancerProperties struct { + // A name of that resource + Name *string `json:"name,omitempty"` + // IPv4 address of the loadbalancer. All attached NICs will inherit this IP. Leaving value null will assign IP automatically + Ip *string `json:"ip,omitempty"` + // Indicates if the loadbalancer will reserve an IP using DHCP + Dhcp *bool `json:"dhcp,omitempty"` +} + + + +// GetName returns the Name field value +// If the value is explicit nil, the zero value for string will be returned +func (o *LoadbalancerProperties) GetName() *string { + if o == nil { + return nil + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *LoadbalancerProperties) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name, true +} + +// SetName sets field value +func (o *LoadbalancerProperties) SetName(v string) { + o.Name = &v +} + +// HasName returns a boolean if a field has been set. +func (o *LoadbalancerProperties) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + + + +// GetIp returns the Ip field value +// If the value is explicit nil, the zero value for string will be returned +func (o *LoadbalancerProperties) GetIp() *string { + if o == nil { + return nil + } + + return o.Ip +} + +// GetIpOk returns a tuple with the Ip field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *LoadbalancerProperties) GetIpOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Ip, true +} + +// SetIp sets field value +func (o *LoadbalancerProperties) SetIp(v string) { + o.Ip = &v +} + +// HasIp returns a boolean if a field has been set. +func (o *LoadbalancerProperties) HasIp() bool { + if o != nil && o.Ip != nil { + return true + } + + return false +} + + + +// GetDhcp returns the Dhcp field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *LoadbalancerProperties) GetDhcp() *bool { + if o == nil { + return nil + } + + return o.Dhcp +} + +// GetDhcpOk returns a tuple with the Dhcp field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *LoadbalancerProperties) GetDhcpOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.Dhcp, true +} + +// SetDhcp sets field value +func (o *LoadbalancerProperties) SetDhcp(v bool) { + o.Dhcp = &v +} + +// HasDhcp returns a boolean if a field has been set. +func (o *LoadbalancerProperties) HasDhcp() bool { + if o != nil && o.Dhcp != nil { + return true + } + + return false +} + + +func (o LoadbalancerProperties) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Name != nil { + toSerialize["name"] = o.Name + } + + + if o.Ip != nil { + toSerialize["ip"] = o.Ip + } + + + if o.Dhcp != nil { + toSerialize["dhcp"] = o.Dhcp + } + + return json.Marshal(toSerialize) +} + +type NullableLoadbalancerProperties struct { + value *LoadbalancerProperties + isSet bool +} + +func (v NullableLoadbalancerProperties) Get() *LoadbalancerProperties { + return v.value +} + +func (v *NullableLoadbalancerProperties) Set(val *LoadbalancerProperties) { + v.value = val + v.isSet = true +} + +func (v NullableLoadbalancerProperties) IsSet() bool { + return v.isSet +} + +func (v *NullableLoadbalancerProperties) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLoadbalancerProperties(val *LoadbalancerProperties) *NullableLoadbalancerProperties { + return &NullableLoadbalancerProperties{value: val, isSet: true} +} + +func (v NullableLoadbalancerProperties) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLoadbalancerProperties) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_loadbalancers.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_loadbalancers.go new file mode 100644 index 0000000000..718b6fa639 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_loadbalancers.go @@ -0,0 +1,235 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// Loadbalancers struct for Loadbalancers +type Loadbalancers struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of object that has been created + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + // Array of items in that collection + Items *[]Loadbalancer `json:"items,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Loadbalancers) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Loadbalancers) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *Loadbalancers) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *Loadbalancers) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *Loadbalancers) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Loadbalancers) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *Loadbalancers) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *Loadbalancers) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Loadbalancers) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Loadbalancers) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *Loadbalancers) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *Loadbalancers) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []Loadbalancer will be returned +func (o *Loadbalancers) GetItems() *[]Loadbalancer { + if o == nil { + return nil + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Loadbalancers) GetItemsOk() (*[]Loadbalancer, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *Loadbalancers) SetItems(v []Loadbalancer) { + o.Items = &v +} + +// HasItems returns a boolean if a field has been set. +func (o *Loadbalancers) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + + +func (o Loadbalancers) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullableLoadbalancers struct { + value *Loadbalancers + isSet bool +} + +func (v NullableLoadbalancers) Get() *Loadbalancers { + return v.value +} + +func (v *NullableLoadbalancers) Set(val *Loadbalancers) { + v.value = val + v.isSet = true +} + +func (v NullableLoadbalancers) IsSet() bool { + return v.isSet +} + +func (v *NullableLoadbalancers) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLoadbalancers(val *Loadbalancers) *NullableLoadbalancers { + return &NullableLoadbalancers{value: val, isSet: true} +} + +func (v NullableLoadbalancers) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLoadbalancers) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_location.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_location.go new file mode 100644 index 0000000000..ece6e03b39 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_location.go @@ -0,0 +1,276 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// Location struct for Location +type Location struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of object that has been created + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` + Properties *LocationProperties `json:"properties"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Location) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Location) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *Location) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *Location) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *Location) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Location) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *Location) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *Location) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Location) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Location) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *Location) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *Location) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for DatacenterElementMetadata will be returned +func (o *Location) GetMetadata() *DatacenterElementMetadata { + if o == nil { + return nil + } + + return o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Location) GetMetadataOk() (*DatacenterElementMetadata, bool) { + if o == nil { + return nil, false + } + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *Location) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + +// HasMetadata returns a boolean if a field has been set. +func (o *Location) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + + + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for LocationProperties will be returned +func (o *Location) GetProperties() *LocationProperties { + if o == nil { + return nil + } + + return o.Properties +} + +// GetPropertiesOk returns a tuple with the Properties field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Location) GetPropertiesOk() (*LocationProperties, bool) { + if o == nil { + return nil, false + } + return o.Properties, true +} + +// SetProperties sets field value +func (o *Location) SetProperties(v LocationProperties) { + o.Properties = &v +} + +// HasProperties returns a boolean if a field has been set. +func (o *Location) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + + +func (o Location) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + return json.Marshal(toSerialize) +} + +type NullableLocation struct { + value *Location + isSet bool +} + +func (v NullableLocation) Get() *Location { + return v.value +} + +func (v *NullableLocation) Set(val *Location) { + v.value = val + v.isSet = true +} + +func (v NullableLocation) IsSet() bool { + return v.isSet +} + +func (v *NullableLocation) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLocation(val *Location) *NullableLocation { + return &NullableLocation{value: val, isSet: true} +} + +func (v NullableLocation) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLocation) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_location_properties.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_location_properties.go new file mode 100644 index 0000000000..8401e5d67a --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_location_properties.go @@ -0,0 +1,192 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// LocationProperties struct for LocationProperties +type LocationProperties struct { + // A name of that resource + Name *string `json:"name,omitempty"` + // List of features supported by the location + Features *[]string `json:"features,omitempty"` + // List of image aliases available for the location + ImageAliases *[]string `json:"imageAliases,omitempty"` +} + + + +// GetName returns the Name field value +// If the value is explicit nil, the zero value for string will be returned +func (o *LocationProperties) GetName() *string { + if o == nil { + return nil + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *LocationProperties) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name, true +} + +// SetName sets field value +func (o *LocationProperties) SetName(v string) { + o.Name = &v +} + +// HasName returns a boolean if a field has been set. +func (o *LocationProperties) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + + + +// GetFeatures returns the Features field value +// If the value is explicit nil, the zero value for []string will be returned +func (o *LocationProperties) GetFeatures() *[]string { + if o == nil { + return nil + } + + return o.Features +} + +// GetFeaturesOk returns a tuple with the Features field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *LocationProperties) GetFeaturesOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return o.Features, true +} + +// SetFeatures sets field value +func (o *LocationProperties) SetFeatures(v []string) { + o.Features = &v +} + +// HasFeatures returns a boolean if a field has been set. +func (o *LocationProperties) HasFeatures() bool { + if o != nil && o.Features != nil { + return true + } + + return false +} + + + +// GetImageAliases returns the ImageAliases field value +// If the value is explicit nil, the zero value for []string will be returned +func (o *LocationProperties) GetImageAliases() *[]string { + if o == nil { + return nil + } + + return o.ImageAliases +} + +// GetImageAliasesOk returns a tuple with the ImageAliases field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *LocationProperties) GetImageAliasesOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return o.ImageAliases, true +} + +// SetImageAliases sets field value +func (o *LocationProperties) SetImageAliases(v []string) { + o.ImageAliases = &v +} + +// HasImageAliases returns a boolean if a field has been set. +func (o *LocationProperties) HasImageAliases() bool { + if o != nil && o.ImageAliases != nil { + return true + } + + return false +} + + +func (o LocationProperties) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Name != nil { + toSerialize["name"] = o.Name + } + + + if o.Features != nil { + toSerialize["features"] = o.Features + } + + + if o.ImageAliases != nil { + toSerialize["imageAliases"] = o.ImageAliases + } + + return json.Marshal(toSerialize) +} + +type NullableLocationProperties struct { + value *LocationProperties + isSet bool +} + +func (v NullableLocationProperties) Get() *LocationProperties { + return v.value +} + +func (v *NullableLocationProperties) Set(val *LocationProperties) { + v.value = val + v.isSet = true +} + +func (v NullableLocationProperties) IsSet() bool { + return v.isSet +} + +func (v *NullableLocationProperties) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLocationProperties(val *LocationProperties) *NullableLocationProperties { + return &NullableLocationProperties{value: val, isSet: true} +} + +func (v NullableLocationProperties) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLocationProperties) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_locations.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_locations.go new file mode 100644 index 0000000000..f3e7abaf69 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_locations.go @@ -0,0 +1,235 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// Locations struct for Locations +type Locations struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of object that has been created + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + // Array of items in that collection + Items *[]Location `json:"items,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Locations) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Locations) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *Locations) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *Locations) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *Locations) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Locations) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *Locations) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *Locations) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Locations) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Locations) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *Locations) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *Locations) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []Location will be returned +func (o *Locations) GetItems() *[]Location { + if o == nil { + return nil + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Locations) GetItemsOk() (*[]Location, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *Locations) SetItems(v []Location) { + o.Items = &v +} + +// HasItems returns a boolean if a field has been set. +func (o *Locations) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + + +func (o Locations) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullableLocations struct { + value *Locations + isSet bool +} + +func (v NullableLocations) Get() *Locations { + return v.value +} + +func (v *NullableLocations) Set(val *Locations) { + v.value = val + v.isSet = true +} + +func (v NullableLocations) IsSet() bool { + return v.isSet +} + +func (v *NullableLocations) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLocations(val *Locations) *NullableLocations { + return &NullableLocations{value: val, isSet: true} +} + +func (v NullableLocations) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLocations) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_nic.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_nic.go new file mode 100644 index 0000000000..47f61d043d --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_nic.go @@ -0,0 +1,318 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// Nic struct for Nic +type Nic struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of object that has been created + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` + Properties *NicProperties `json:"properties"` + Entities *NicEntities `json:"entities,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Nic) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Nic) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *Nic) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *Nic) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *Nic) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Nic) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *Nic) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *Nic) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Nic) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Nic) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *Nic) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *Nic) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for DatacenterElementMetadata will be returned +func (o *Nic) GetMetadata() *DatacenterElementMetadata { + if o == nil { + return nil + } + + return o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Nic) GetMetadataOk() (*DatacenterElementMetadata, bool) { + if o == nil { + return nil, false + } + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *Nic) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + +// HasMetadata returns a boolean if a field has been set. +func (o *Nic) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + + + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for NicProperties will be returned +func (o *Nic) GetProperties() *NicProperties { + if o == nil { + return nil + } + + return o.Properties +} + +// GetPropertiesOk returns a tuple with the Properties field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Nic) GetPropertiesOk() (*NicProperties, bool) { + if o == nil { + return nil, false + } + return o.Properties, true +} + +// SetProperties sets field value +func (o *Nic) SetProperties(v NicProperties) { + o.Properties = &v +} + +// HasProperties returns a boolean if a field has been set. +func (o *Nic) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + + + +// GetEntities returns the Entities field value +// If the value is explicit nil, the zero value for NicEntities will be returned +func (o *Nic) GetEntities() *NicEntities { + if o == nil { + return nil + } + + return o.Entities +} + +// GetEntitiesOk returns a tuple with the Entities field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Nic) GetEntitiesOk() (*NicEntities, bool) { + if o == nil { + return nil, false + } + return o.Entities, true +} + +// SetEntities sets field value +func (o *Nic) SetEntities(v NicEntities) { + o.Entities = &v +} + +// HasEntities returns a boolean if a field has been set. +func (o *Nic) HasEntities() bool { + if o != nil && o.Entities != nil { + return true + } + + return false +} + + +func (o Nic) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + + if o.Entities != nil { + toSerialize["entities"] = o.Entities + } + + return json.Marshal(toSerialize) +} + +type NullableNic struct { + value *Nic + isSet bool +} + +func (v NullableNic) Get() *Nic { + return v.value +} + +func (v *NullableNic) Set(val *Nic) { + v.value = val + v.isSet = true +} + +func (v NullableNic) IsSet() bool { + return v.isSet +} + +func (v *NullableNic) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNic(val *Nic) *NullableNic { + return &NullableNic{value: val, isSet: true} +} + +func (v NullableNic) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNic) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_nic_entities.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_nic_entities.go new file mode 100644 index 0000000000..db039d0d8e --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_nic_entities.go @@ -0,0 +1,105 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// NicEntities struct for NicEntities +type NicEntities struct { + Firewallrules *FirewallRules `json:"firewallrules,omitempty"` +} + + + +// GetFirewallrules returns the Firewallrules field value +// If the value is explicit nil, the zero value for FirewallRules will be returned +func (o *NicEntities) GetFirewallrules() *FirewallRules { + if o == nil { + return nil + } + + return o.Firewallrules +} + +// GetFirewallrulesOk returns a tuple with the Firewallrules field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *NicEntities) GetFirewallrulesOk() (*FirewallRules, bool) { + if o == nil { + return nil, false + } + return o.Firewallrules, true +} + +// SetFirewallrules sets field value +func (o *NicEntities) SetFirewallrules(v FirewallRules) { + o.Firewallrules = &v +} + +// HasFirewallrules returns a boolean if a field has been set. +func (o *NicEntities) HasFirewallrules() bool { + if o != nil && o.Firewallrules != nil { + return true + } + + return false +} + + +func (o NicEntities) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Firewallrules != nil { + toSerialize["firewallrules"] = o.Firewallrules + } + + return json.Marshal(toSerialize) +} + +type NullableNicEntities struct { + value *NicEntities + isSet bool +} + +func (v NullableNicEntities) Get() *NicEntities { + return v.value +} + +func (v *NullableNicEntities) Set(val *NicEntities) { + v.value = val + v.isSet = true +} + +func (v NullableNicEntities) IsSet() bool { + return v.isSet +} + +func (v *NullableNicEntities) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNicEntities(val *NicEntities) *NullableNicEntities { + return &NullableNicEntities{value: val, isSet: true} +} + +func (v NullableNicEntities) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNicEntities) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_nic_properties.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_nic_properties.go new file mode 100644 index 0000000000..53b8b6862e --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_nic_properties.go @@ -0,0 +1,364 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// NicProperties struct for NicProperties +type NicProperties struct { + // A name of that resource + Name *string `json:"name,omitempty"` + // The MAC address of the NIC + Mac *string `json:"mac,omitempty"` + // Collection of IP addresses assigned to a nic. Explicitly assigned public IPs need to come from reserved IP blocks, Passing value null or empty array will assign an IP address automatically. + Ips *[]string `json:"ips,omitempty"` + // Indicates if the nic will reserve an IP using DHCP + Dhcp *bool `json:"dhcp,omitempty"` + // The LAN ID the NIC will sit on. If the LAN ID does not exist it will be implicitly created + Lan *int32 `json:"lan"` + // Activate or deactivate the firewall. By default an active firewall without any defined rules will block all incoming network traffic except for the firewall rules that explicitly allows certain protocols, ip addresses and ports. + FirewallActive *bool `json:"firewallActive,omitempty"` + // Indicates if NAT is enabled on this NIC + Nat *bool `json:"nat,omitempty"` +} + + + +// GetName returns the Name field value +// If the value is explicit nil, the zero value for string will be returned +func (o *NicProperties) GetName() *string { + if o == nil { + return nil + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *NicProperties) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name, true +} + +// SetName sets field value +func (o *NicProperties) SetName(v string) { + o.Name = &v +} + +// HasName returns a boolean if a field has been set. +func (o *NicProperties) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + + + +// GetMac returns the Mac field value +// If the value is explicit nil, the zero value for string will be returned +func (o *NicProperties) GetMac() *string { + if o == nil { + return nil + } + + return o.Mac +} + +// GetMacOk returns a tuple with the Mac field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *NicProperties) GetMacOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Mac, true +} + +// SetMac sets field value +func (o *NicProperties) SetMac(v string) { + o.Mac = &v +} + +// HasMac returns a boolean if a field has been set. +func (o *NicProperties) HasMac() bool { + if o != nil && o.Mac != nil { + return true + } + + return false +} + + + +// GetIps returns the Ips field value +// If the value is explicit nil, the zero value for []string will be returned +func (o *NicProperties) GetIps() *[]string { + if o == nil { + return nil + } + + return o.Ips +} + +// GetIpsOk returns a tuple with the Ips field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *NicProperties) GetIpsOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return o.Ips, true +} + +// SetIps sets field value +func (o *NicProperties) SetIps(v []string) { + o.Ips = &v +} + +// HasIps returns a boolean if a field has been set. +func (o *NicProperties) HasIps() bool { + if o != nil && o.Ips != nil { + return true + } + + return false +} + + + +// GetDhcp returns the Dhcp field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *NicProperties) GetDhcp() *bool { + if o == nil { + return nil + } + + return o.Dhcp +} + +// GetDhcpOk returns a tuple with the Dhcp field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *NicProperties) GetDhcpOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.Dhcp, true +} + +// SetDhcp sets field value +func (o *NicProperties) SetDhcp(v bool) { + o.Dhcp = &v +} + +// HasDhcp returns a boolean if a field has been set. +func (o *NicProperties) HasDhcp() bool { + if o != nil && o.Dhcp != nil { + return true + } + + return false +} + + + +// GetLan returns the Lan field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *NicProperties) GetLan() *int32 { + if o == nil { + return nil + } + + return o.Lan +} + +// GetLanOk returns a tuple with the Lan field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *NicProperties) GetLanOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.Lan, true +} + +// SetLan sets field value +func (o *NicProperties) SetLan(v int32) { + o.Lan = &v +} + +// HasLan returns a boolean if a field has been set. +func (o *NicProperties) HasLan() bool { + if o != nil && o.Lan != nil { + return true + } + + return false +} + + + +// GetFirewallActive returns the FirewallActive field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *NicProperties) GetFirewallActive() *bool { + if o == nil { + return nil + } + + return o.FirewallActive +} + +// GetFirewallActiveOk returns a tuple with the FirewallActive field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *NicProperties) GetFirewallActiveOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.FirewallActive, true +} + +// SetFirewallActive sets field value +func (o *NicProperties) SetFirewallActive(v bool) { + o.FirewallActive = &v +} + +// HasFirewallActive returns a boolean if a field has been set. +func (o *NicProperties) HasFirewallActive() bool { + if o != nil && o.FirewallActive != nil { + return true + } + + return false +} + + + +// GetNat returns the Nat field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *NicProperties) GetNat() *bool { + if o == nil { + return nil + } + + return o.Nat +} + +// GetNatOk returns a tuple with the Nat field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *NicProperties) GetNatOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.Nat, true +} + +// SetNat sets field value +func (o *NicProperties) SetNat(v bool) { + o.Nat = &v +} + +// HasNat returns a boolean if a field has been set. +func (o *NicProperties) HasNat() bool { + if o != nil && o.Nat != nil { + return true + } + + return false +} + + +func (o NicProperties) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Name != nil { + toSerialize["name"] = o.Name + } + + + if o.Mac != nil { + toSerialize["mac"] = o.Mac + } + + + if o.Ips != nil { + toSerialize["ips"] = o.Ips + } + + + if o.Dhcp != nil { + toSerialize["dhcp"] = o.Dhcp + } + + + if o.Lan != nil { + toSerialize["lan"] = o.Lan + } + + + if o.FirewallActive != nil { + toSerialize["firewallActive"] = o.FirewallActive + } + + + if o.Nat != nil { + toSerialize["nat"] = o.Nat + } + + return json.Marshal(toSerialize) +} + +type NullableNicProperties struct { + value *NicProperties + isSet bool +} + +func (v NullableNicProperties) Get() *NicProperties { + return v.value +} + +func (v *NullableNicProperties) Set(val *NicProperties) { + v.value = val + v.isSet = true +} + +func (v NullableNicProperties) IsSet() bool { + return v.isSet +} + +func (v *NullableNicProperties) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNicProperties(val *NicProperties) *NullableNicProperties { + return &NullableNicProperties{value: val, isSet: true} +} + +func (v NullableNicProperties) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNicProperties) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_nics.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_nics.go new file mode 100644 index 0000000000..145d1d701c --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_nics.go @@ -0,0 +1,235 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// Nics struct for Nics +type Nics struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of object that has been created + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + // Array of items in that collection + Items *[]Nic `json:"items,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Nics) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Nics) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *Nics) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *Nics) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *Nics) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Nics) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *Nics) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *Nics) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Nics) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Nics) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *Nics) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *Nics) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []Nic will be returned +func (o *Nics) GetItems() *[]Nic { + if o == nil { + return nil + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Nics) GetItemsOk() (*[]Nic, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *Nics) SetItems(v []Nic) { + o.Items = &v +} + +// HasItems returns a boolean if a field has been set. +func (o *Nics) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + + +func (o Nics) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullableNics struct { + value *Nics + isSet bool +} + +func (v NullableNics) Get() *Nics { + return v.value +} + +func (v *NullableNics) Set(val *Nics) { + v.value = val + v.isSet = true +} + +func (v NullableNics) IsSet() bool { + return v.isSet +} + +func (v *NullableNics) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNics(val *Nics) *NullableNics { + return &NullableNics{value: val, isSet: true} +} + +func (v NullableNics) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNics) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_no_state_meta_data.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_no_state_meta_data.go new file mode 100644 index 0000000000..bade291e55 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_no_state_meta_data.go @@ -0,0 +1,365 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" + "time" +) + +// NoStateMetaData struct for NoStateMetaData +type NoStateMetaData struct { + // Resource's Entity Tag as defined in http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.11 . Entity Tag is also added as an 'ETag response header to requests which don't use 'depth' parameter. + Etag *string `json:"etag,omitempty"` + // The time the Resource was created + CreatedDate *time.Time `json:"createdDate,omitempty"` + // The user who has created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // The user id of the user who has created the resource. + CreatedByUserId *string `json:"createdByUserId,omitempty"` + // The last time the resource has been modified + LastModifiedDate *time.Time `json:"lastModifiedDate,omitempty"` + // The user who last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // The user id of the user who has last modified the resource. + LastModifiedByUserId *string `json:"lastModifiedByUserId,omitempty"` +} + + + +// GetEtag returns the Etag field value +// If the value is explicit nil, the zero value for string will be returned +func (o *NoStateMetaData) GetEtag() *string { + if o == nil { + return nil + } + + return o.Etag +} + +// GetEtagOk returns a tuple with the Etag field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *NoStateMetaData) GetEtagOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Etag, true +} + +// SetEtag sets field value +func (o *NoStateMetaData) SetEtag(v string) { + o.Etag = &v +} + +// HasEtag returns a boolean if a field has been set. +func (o *NoStateMetaData) HasEtag() bool { + if o != nil && o.Etag != nil { + return true + } + + return false +} + + + +// GetCreatedDate returns the CreatedDate field value +// If the value is explicit nil, the zero value for time.Time will be returned +func (o *NoStateMetaData) GetCreatedDate() *time.Time { + if o == nil { + return nil + } + + return o.CreatedDate +} + +// GetCreatedDateOk returns a tuple with the CreatedDate field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *NoStateMetaData) GetCreatedDateOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.CreatedDate, true +} + +// SetCreatedDate sets field value +func (o *NoStateMetaData) SetCreatedDate(v time.Time) { + o.CreatedDate = &v +} + +// HasCreatedDate returns a boolean if a field has been set. +func (o *NoStateMetaData) HasCreatedDate() bool { + if o != nil && o.CreatedDate != nil { + return true + } + + return false +} + + + +// GetCreatedBy returns the CreatedBy field value +// If the value is explicit nil, the zero value for string will be returned +func (o *NoStateMetaData) GetCreatedBy() *string { + if o == nil { + return nil + } + + return o.CreatedBy +} + +// GetCreatedByOk returns a tuple with the CreatedBy field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *NoStateMetaData) GetCreatedByOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.CreatedBy, true +} + +// SetCreatedBy sets field value +func (o *NoStateMetaData) SetCreatedBy(v string) { + o.CreatedBy = &v +} + +// HasCreatedBy returns a boolean if a field has been set. +func (o *NoStateMetaData) HasCreatedBy() bool { + if o != nil && o.CreatedBy != nil { + return true + } + + return false +} + + + +// GetCreatedByUserId returns the CreatedByUserId field value +// If the value is explicit nil, the zero value for string will be returned +func (o *NoStateMetaData) GetCreatedByUserId() *string { + if o == nil { + return nil + } + + return o.CreatedByUserId +} + +// GetCreatedByUserIdOk returns a tuple with the CreatedByUserId field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *NoStateMetaData) GetCreatedByUserIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.CreatedByUserId, true +} + +// SetCreatedByUserId sets field value +func (o *NoStateMetaData) SetCreatedByUserId(v string) { + o.CreatedByUserId = &v +} + +// HasCreatedByUserId returns a boolean if a field has been set. +func (o *NoStateMetaData) HasCreatedByUserId() bool { + if o != nil && o.CreatedByUserId != nil { + return true + } + + return false +} + + + +// GetLastModifiedDate returns the LastModifiedDate field value +// If the value is explicit nil, the zero value for time.Time will be returned +func (o *NoStateMetaData) GetLastModifiedDate() *time.Time { + if o == nil { + return nil + } + + return o.LastModifiedDate +} + +// GetLastModifiedDateOk returns a tuple with the LastModifiedDate field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *NoStateMetaData) GetLastModifiedDateOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.LastModifiedDate, true +} + +// SetLastModifiedDate sets field value +func (o *NoStateMetaData) SetLastModifiedDate(v time.Time) { + o.LastModifiedDate = &v +} + +// HasLastModifiedDate returns a boolean if a field has been set. +func (o *NoStateMetaData) HasLastModifiedDate() bool { + if o != nil && o.LastModifiedDate != nil { + return true + } + + return false +} + + + +// GetLastModifiedBy returns the LastModifiedBy field value +// If the value is explicit nil, the zero value for string will be returned +func (o *NoStateMetaData) GetLastModifiedBy() *string { + if o == nil { + return nil + } + + return o.LastModifiedBy +} + +// GetLastModifiedByOk returns a tuple with the LastModifiedBy field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *NoStateMetaData) GetLastModifiedByOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.LastModifiedBy, true +} + +// SetLastModifiedBy sets field value +func (o *NoStateMetaData) SetLastModifiedBy(v string) { + o.LastModifiedBy = &v +} + +// HasLastModifiedBy returns a boolean if a field has been set. +func (o *NoStateMetaData) HasLastModifiedBy() bool { + if o != nil && o.LastModifiedBy != nil { + return true + } + + return false +} + + + +// GetLastModifiedByUserId returns the LastModifiedByUserId field value +// If the value is explicit nil, the zero value for string will be returned +func (o *NoStateMetaData) GetLastModifiedByUserId() *string { + if o == nil { + return nil + } + + return o.LastModifiedByUserId +} + +// GetLastModifiedByUserIdOk returns a tuple with the LastModifiedByUserId field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *NoStateMetaData) GetLastModifiedByUserIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.LastModifiedByUserId, true +} + +// SetLastModifiedByUserId sets field value +func (o *NoStateMetaData) SetLastModifiedByUserId(v string) { + o.LastModifiedByUserId = &v +} + +// HasLastModifiedByUserId returns a boolean if a field has been set. +func (o *NoStateMetaData) HasLastModifiedByUserId() bool { + if o != nil && o.LastModifiedByUserId != nil { + return true + } + + return false +} + + +func (o NoStateMetaData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Etag != nil { + toSerialize["etag"] = o.Etag + } + + + if o.CreatedDate != nil { + toSerialize["createdDate"] = o.CreatedDate + } + + + if o.CreatedBy != nil { + toSerialize["createdBy"] = o.CreatedBy + } + + + if o.CreatedByUserId != nil { + toSerialize["createdByUserId"] = o.CreatedByUserId + } + + + if o.LastModifiedDate != nil { + toSerialize["lastModifiedDate"] = o.LastModifiedDate + } + + + if o.LastModifiedBy != nil { + toSerialize["lastModifiedBy"] = o.LastModifiedBy + } + + + if o.LastModifiedByUserId != nil { + toSerialize["lastModifiedByUserId"] = o.LastModifiedByUserId + } + + return json.Marshal(toSerialize) +} + +type NullableNoStateMetaData struct { + value *NoStateMetaData + isSet bool +} + +func (v NullableNoStateMetaData) Get() *NoStateMetaData { + return v.value +} + +func (v *NullableNoStateMetaData) Set(val *NoStateMetaData) { + v.value = val + v.isSet = true +} + +func (v NullableNoStateMetaData) IsSet() bool { + return v.isSet +} + +func (v *NullableNoStateMetaData) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNoStateMetaData(val *NoStateMetaData) *NullableNoStateMetaData { + return &NullableNoStateMetaData{value: val, isSet: true} +} + +func (v NullableNoStateMetaData) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNoStateMetaData) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_peer.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_peer.go new file mode 100644 index 0000000000..590a2bc73a --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_peer.go @@ -0,0 +1,273 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// Peer struct for Peer +type Peer struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + DatacenterId *string `json:"datacenterId,omitempty"` + DatacenterName *string `json:"datacenterName,omitempty"` + Location *string `json:"location,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Peer) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Peer) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *Peer) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *Peer) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetName returns the Name field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Peer) GetName() *string { + if o == nil { + return nil + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Peer) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name, true +} + +// SetName sets field value +func (o *Peer) SetName(v string) { + o.Name = &v +} + +// HasName returns a boolean if a field has been set. +func (o *Peer) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + + + +// GetDatacenterId returns the DatacenterId field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Peer) GetDatacenterId() *string { + if o == nil { + return nil + } + + return o.DatacenterId +} + +// GetDatacenterIdOk returns a tuple with the DatacenterId field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Peer) GetDatacenterIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.DatacenterId, true +} + +// SetDatacenterId sets field value +func (o *Peer) SetDatacenterId(v string) { + o.DatacenterId = &v +} + +// HasDatacenterId returns a boolean if a field has been set. +func (o *Peer) HasDatacenterId() bool { + if o != nil && o.DatacenterId != nil { + return true + } + + return false +} + + + +// GetDatacenterName returns the DatacenterName field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Peer) GetDatacenterName() *string { + if o == nil { + return nil + } + + return o.DatacenterName +} + +// GetDatacenterNameOk returns a tuple with the DatacenterName field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Peer) GetDatacenterNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.DatacenterName, true +} + +// SetDatacenterName sets field value +func (o *Peer) SetDatacenterName(v string) { + o.DatacenterName = &v +} + +// HasDatacenterName returns a boolean if a field has been set. +func (o *Peer) HasDatacenterName() bool { + if o != nil && o.DatacenterName != nil { + return true + } + + return false +} + + + +// GetLocation returns the Location field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Peer) GetLocation() *string { + if o == nil { + return nil + } + + return o.Location +} + +// GetLocationOk returns a tuple with the Location field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Peer) GetLocationOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Location, true +} + +// SetLocation sets field value +func (o *Peer) SetLocation(v string) { + o.Location = &v +} + +// HasLocation returns a boolean if a field has been set. +func (o *Peer) HasLocation() bool { + if o != nil && o.Location != nil { + return true + } + + return false +} + + +func (o Peer) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Name != nil { + toSerialize["name"] = o.Name + } + + + if o.DatacenterId != nil { + toSerialize["datacenterId"] = o.DatacenterId + } + + + if o.DatacenterName != nil { + toSerialize["datacenterName"] = o.DatacenterName + } + + + if o.Location != nil { + toSerialize["location"] = o.Location + } + + return json.Marshal(toSerialize) +} + +type NullablePeer struct { + value *Peer + isSet bool +} + +func (v NullablePeer) Get() *Peer { + return v.value +} + +func (v *NullablePeer) Set(val *Peer) { + v.value = val + v.isSet = true +} + +func (v NullablePeer) IsSet() bool { + return v.isSet +} + +func (v *NullablePeer) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePeer(val *Peer) *NullablePeer { + return &NullablePeer{value: val, isSet: true} +} + +func (v NullablePeer) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePeer) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_private_cross_connect.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_private_cross_connect.go new file mode 100644 index 0000000000..4db1183a4e --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_private_cross_connect.go @@ -0,0 +1,276 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// PrivateCrossConnect struct for PrivateCrossConnect +type PrivateCrossConnect struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of object that has been created + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` + Properties *PrivateCrossConnectProperties `json:"properties"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *PrivateCrossConnect) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *PrivateCrossConnect) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *PrivateCrossConnect) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *PrivateCrossConnect) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *PrivateCrossConnect) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *PrivateCrossConnect) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *PrivateCrossConnect) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *PrivateCrossConnect) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *PrivateCrossConnect) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *PrivateCrossConnect) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *PrivateCrossConnect) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *PrivateCrossConnect) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for DatacenterElementMetadata will be returned +func (o *PrivateCrossConnect) GetMetadata() *DatacenterElementMetadata { + if o == nil { + return nil + } + + return o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *PrivateCrossConnect) GetMetadataOk() (*DatacenterElementMetadata, bool) { + if o == nil { + return nil, false + } + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *PrivateCrossConnect) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + +// HasMetadata returns a boolean if a field has been set. +func (o *PrivateCrossConnect) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + + + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for PrivateCrossConnectProperties will be returned +func (o *PrivateCrossConnect) GetProperties() *PrivateCrossConnectProperties { + if o == nil { + return nil + } + + return o.Properties +} + +// GetPropertiesOk returns a tuple with the Properties field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *PrivateCrossConnect) GetPropertiesOk() (*PrivateCrossConnectProperties, bool) { + if o == nil { + return nil, false + } + return o.Properties, true +} + +// SetProperties sets field value +func (o *PrivateCrossConnect) SetProperties(v PrivateCrossConnectProperties) { + o.Properties = &v +} + +// HasProperties returns a boolean if a field has been set. +func (o *PrivateCrossConnect) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + + +func (o PrivateCrossConnect) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + return json.Marshal(toSerialize) +} + +type NullablePrivateCrossConnect struct { + value *PrivateCrossConnect + isSet bool +} + +func (v NullablePrivateCrossConnect) Get() *PrivateCrossConnect { + return v.value +} + +func (v *NullablePrivateCrossConnect) Set(val *PrivateCrossConnect) { + v.value = val + v.isSet = true +} + +func (v NullablePrivateCrossConnect) IsSet() bool { + return v.isSet +} + +func (v *NullablePrivateCrossConnect) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePrivateCrossConnect(val *PrivateCrossConnect) *NullablePrivateCrossConnect { + return &NullablePrivateCrossConnect{value: val, isSet: true} +} + +func (v NullablePrivateCrossConnect) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePrivateCrossConnect) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_private_cross_connect_properties.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_private_cross_connect_properties.go new file mode 100644 index 0000000000..b665ee3620 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_private_cross_connect_properties.go @@ -0,0 +1,235 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// PrivateCrossConnectProperties struct for PrivateCrossConnectProperties +type PrivateCrossConnectProperties struct { + // A name of that resource + Name *string `json:"name,omitempty"` + // Human readable description + Description *string `json:"description,omitempty"` + // Read-Only attribute. Lists LAN's joined to this private cross connect + Peers *[]Peer `json:"peers,omitempty"` + // Read-Only attribute. Lists datacenters that can be joined to this private cross connect + ConnectableDatacenters *[]ConnectableDatacenter `json:"connectableDatacenters,omitempty"` +} + + + +// GetName returns the Name field value +// If the value is explicit nil, the zero value for string will be returned +func (o *PrivateCrossConnectProperties) GetName() *string { + if o == nil { + return nil + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *PrivateCrossConnectProperties) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name, true +} + +// SetName sets field value +func (o *PrivateCrossConnectProperties) SetName(v string) { + o.Name = &v +} + +// HasName returns a boolean if a field has been set. +func (o *PrivateCrossConnectProperties) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + + + +// GetDescription returns the Description field value +// If the value is explicit nil, the zero value for string will be returned +func (o *PrivateCrossConnectProperties) GetDescription() *string { + if o == nil { + return nil + } + + return o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *PrivateCrossConnectProperties) GetDescriptionOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Description, true +} + +// SetDescription sets field value +func (o *PrivateCrossConnectProperties) SetDescription(v string) { + o.Description = &v +} + +// HasDescription returns a boolean if a field has been set. +func (o *PrivateCrossConnectProperties) HasDescription() bool { + if o != nil && o.Description != nil { + return true + } + + return false +} + + + +// GetPeers returns the Peers field value +// If the value is explicit nil, the zero value for []Peer will be returned +func (o *PrivateCrossConnectProperties) GetPeers() *[]Peer { + if o == nil { + return nil + } + + return o.Peers +} + +// GetPeersOk returns a tuple with the Peers field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *PrivateCrossConnectProperties) GetPeersOk() (*[]Peer, bool) { + if o == nil { + return nil, false + } + return o.Peers, true +} + +// SetPeers sets field value +func (o *PrivateCrossConnectProperties) SetPeers(v []Peer) { + o.Peers = &v +} + +// HasPeers returns a boolean if a field has been set. +func (o *PrivateCrossConnectProperties) HasPeers() bool { + if o != nil && o.Peers != nil { + return true + } + + return false +} + + + +// GetConnectableDatacenters returns the ConnectableDatacenters field value +// If the value is explicit nil, the zero value for []ConnectableDatacenter will be returned +func (o *PrivateCrossConnectProperties) GetConnectableDatacenters() *[]ConnectableDatacenter { + if o == nil { + return nil + } + + return o.ConnectableDatacenters +} + +// GetConnectableDatacentersOk returns a tuple with the ConnectableDatacenters field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *PrivateCrossConnectProperties) GetConnectableDatacentersOk() (*[]ConnectableDatacenter, bool) { + if o == nil { + return nil, false + } + return o.ConnectableDatacenters, true +} + +// SetConnectableDatacenters sets field value +func (o *PrivateCrossConnectProperties) SetConnectableDatacenters(v []ConnectableDatacenter) { + o.ConnectableDatacenters = &v +} + +// HasConnectableDatacenters returns a boolean if a field has been set. +func (o *PrivateCrossConnectProperties) HasConnectableDatacenters() bool { + if o != nil && o.ConnectableDatacenters != nil { + return true + } + + return false +} + + +func (o PrivateCrossConnectProperties) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Name != nil { + toSerialize["name"] = o.Name + } + + + if o.Description != nil { + toSerialize["description"] = o.Description + } + + + if o.Peers != nil { + toSerialize["peers"] = o.Peers + } + + + if o.ConnectableDatacenters != nil { + toSerialize["connectableDatacenters"] = o.ConnectableDatacenters + } + + return json.Marshal(toSerialize) +} + +type NullablePrivateCrossConnectProperties struct { + value *PrivateCrossConnectProperties + isSet bool +} + +func (v NullablePrivateCrossConnectProperties) Get() *PrivateCrossConnectProperties { + return v.value +} + +func (v *NullablePrivateCrossConnectProperties) Set(val *PrivateCrossConnectProperties) { + v.value = val + v.isSet = true +} + +func (v NullablePrivateCrossConnectProperties) IsSet() bool { + return v.isSet +} + +func (v *NullablePrivateCrossConnectProperties) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePrivateCrossConnectProperties(val *PrivateCrossConnectProperties) *NullablePrivateCrossConnectProperties { + return &NullablePrivateCrossConnectProperties{value: val, isSet: true} +} + +func (v NullablePrivateCrossConnectProperties) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePrivateCrossConnectProperties) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_private_cross_connects.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_private_cross_connects.go new file mode 100644 index 0000000000..0c291323c9 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_private_cross_connects.go @@ -0,0 +1,235 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// PrivateCrossConnects struct for PrivateCrossConnects +type PrivateCrossConnects struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of object that has been created + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + // Array of items in that collection + Items *[]PrivateCrossConnect `json:"items,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *PrivateCrossConnects) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *PrivateCrossConnects) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *PrivateCrossConnects) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *PrivateCrossConnects) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *PrivateCrossConnects) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *PrivateCrossConnects) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *PrivateCrossConnects) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *PrivateCrossConnects) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *PrivateCrossConnects) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *PrivateCrossConnects) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *PrivateCrossConnects) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *PrivateCrossConnects) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []PrivateCrossConnect will be returned +func (o *PrivateCrossConnects) GetItems() *[]PrivateCrossConnect { + if o == nil { + return nil + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *PrivateCrossConnects) GetItemsOk() (*[]PrivateCrossConnect, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *PrivateCrossConnects) SetItems(v []PrivateCrossConnect) { + o.Items = &v +} + +// HasItems returns a boolean if a field has been set. +func (o *PrivateCrossConnects) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + + +func (o PrivateCrossConnects) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullablePrivateCrossConnects struct { + value *PrivateCrossConnects + isSet bool +} + +func (v NullablePrivateCrossConnects) Get() *PrivateCrossConnects { + return v.value +} + +func (v *NullablePrivateCrossConnects) Set(val *PrivateCrossConnects) { + v.value = val + v.isSet = true +} + +func (v NullablePrivateCrossConnects) IsSet() bool { + return v.isSet +} + +func (v *NullablePrivateCrossConnects) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePrivateCrossConnects(val *PrivateCrossConnects) *NullablePrivateCrossConnects { + return &NullablePrivateCrossConnects{value: val, isSet: true} +} + +func (v NullablePrivateCrossConnects) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePrivateCrossConnects) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_request.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_request.go new file mode 100644 index 0000000000..84035b79aa --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_request.go @@ -0,0 +1,276 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// Request struct for Request +type Request struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of object that has been created + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + Metadata *RequestMetadata `json:"metadata,omitempty"` + Properties *RequestProperties `json:"properties"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Request) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Request) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *Request) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *Request) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *Request) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Request) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *Request) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *Request) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Request) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Request) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *Request) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *Request) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for RequestMetadata will be returned +func (o *Request) GetMetadata() *RequestMetadata { + if o == nil { + return nil + } + + return o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Request) GetMetadataOk() (*RequestMetadata, bool) { + if o == nil { + return nil, false + } + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *Request) SetMetadata(v RequestMetadata) { + o.Metadata = &v +} + +// HasMetadata returns a boolean if a field has been set. +func (o *Request) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + + + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for RequestProperties will be returned +func (o *Request) GetProperties() *RequestProperties { + if o == nil { + return nil + } + + return o.Properties +} + +// GetPropertiesOk returns a tuple with the Properties field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Request) GetPropertiesOk() (*RequestProperties, bool) { + if o == nil { + return nil, false + } + return o.Properties, true +} + +// SetProperties sets field value +func (o *Request) SetProperties(v RequestProperties) { + o.Properties = &v +} + +// HasProperties returns a boolean if a field has been set. +func (o *Request) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + + +func (o Request) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + return json.Marshal(toSerialize) +} + +type NullableRequest struct { + value *Request + isSet bool +} + +func (v NullableRequest) Get() *Request { + return v.value +} + +func (v *NullableRequest) Set(val *Request) { + v.value = val + v.isSet = true +} + +func (v NullableRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRequest(val *Request) *NullableRequest { + return &NullableRequest{value: val, isSet: true} +} + +func (v NullableRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_request_metadata.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_request_metadata.go new file mode 100644 index 0000000000..bc4f71ad3c --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_request_metadata.go @@ -0,0 +1,235 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" + "time" +) + +// RequestMetadata struct for RequestMetadata +type RequestMetadata struct { + // The last time the resource was created + CreatedDate *time.Time `json:"createdDate,omitempty"` + // The user who created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // Resource's Entity Tag as defined in http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.11 . Entity Tag is also added as an 'ETag response header to requests which don't use 'depth' parameter. + Etag *string `json:"etag,omitempty"` + RequestStatus *RequestStatus `json:"requestStatus,omitempty"` +} + + + +// GetCreatedDate returns the CreatedDate field value +// If the value is explicit nil, the zero value for time.Time will be returned +func (o *RequestMetadata) GetCreatedDate() *time.Time { + if o == nil { + return nil + } + + return o.CreatedDate +} + +// GetCreatedDateOk returns a tuple with the CreatedDate field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *RequestMetadata) GetCreatedDateOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.CreatedDate, true +} + +// SetCreatedDate sets field value +func (o *RequestMetadata) SetCreatedDate(v time.Time) { + o.CreatedDate = &v +} + +// HasCreatedDate returns a boolean if a field has been set. +func (o *RequestMetadata) HasCreatedDate() bool { + if o != nil && o.CreatedDate != nil { + return true + } + + return false +} + + + +// GetCreatedBy returns the CreatedBy field value +// If the value is explicit nil, the zero value for string will be returned +func (o *RequestMetadata) GetCreatedBy() *string { + if o == nil { + return nil + } + + return o.CreatedBy +} + +// GetCreatedByOk returns a tuple with the CreatedBy field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *RequestMetadata) GetCreatedByOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.CreatedBy, true +} + +// SetCreatedBy sets field value +func (o *RequestMetadata) SetCreatedBy(v string) { + o.CreatedBy = &v +} + +// HasCreatedBy returns a boolean if a field has been set. +func (o *RequestMetadata) HasCreatedBy() bool { + if o != nil && o.CreatedBy != nil { + return true + } + + return false +} + + + +// GetEtag returns the Etag field value +// If the value is explicit nil, the zero value for string will be returned +func (o *RequestMetadata) GetEtag() *string { + if o == nil { + return nil + } + + return o.Etag +} + +// GetEtagOk returns a tuple with the Etag field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *RequestMetadata) GetEtagOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Etag, true +} + +// SetEtag sets field value +func (o *RequestMetadata) SetEtag(v string) { + o.Etag = &v +} + +// HasEtag returns a boolean if a field has been set. +func (o *RequestMetadata) HasEtag() bool { + if o != nil && o.Etag != nil { + return true + } + + return false +} + + + +// GetRequestStatus returns the RequestStatus field value +// If the value is explicit nil, the zero value for RequestStatus will be returned +func (o *RequestMetadata) GetRequestStatus() *RequestStatus { + if o == nil { + return nil + } + + return o.RequestStatus +} + +// GetRequestStatusOk returns a tuple with the RequestStatus field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *RequestMetadata) GetRequestStatusOk() (*RequestStatus, bool) { + if o == nil { + return nil, false + } + return o.RequestStatus, true +} + +// SetRequestStatus sets field value +func (o *RequestMetadata) SetRequestStatus(v RequestStatus) { + o.RequestStatus = &v +} + +// HasRequestStatus returns a boolean if a field has been set. +func (o *RequestMetadata) HasRequestStatus() bool { + if o != nil && o.RequestStatus != nil { + return true + } + + return false +} + + +func (o RequestMetadata) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.CreatedDate != nil { + toSerialize["createdDate"] = o.CreatedDate + } + + + if o.CreatedBy != nil { + toSerialize["createdBy"] = o.CreatedBy + } + + + if o.Etag != nil { + toSerialize["etag"] = o.Etag + } + + + if o.RequestStatus != nil { + toSerialize["requestStatus"] = o.RequestStatus + } + + return json.Marshal(toSerialize) +} + +type NullableRequestMetadata struct { + value *RequestMetadata + isSet bool +} + +func (v NullableRequestMetadata) Get() *RequestMetadata { + return v.value +} + +func (v *NullableRequestMetadata) Set(val *RequestMetadata) { + v.value = val + v.isSet = true +} + +func (v NullableRequestMetadata) IsSet() bool { + return v.isSet +} + +func (v *NullableRequestMetadata) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRequestMetadata(val *RequestMetadata) *NullableRequestMetadata { + return &NullableRequestMetadata{value: val, isSet: true} +} + +func (v NullableRequestMetadata) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRequestMetadata) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_request_properties.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_request_properties.go new file mode 100644 index 0000000000..7850b7375f --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_request_properties.go @@ -0,0 +1,231 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// RequestProperties struct for RequestProperties +type RequestProperties struct { + Method *string `json:"method,omitempty"` + Headers *map[string]string `json:"headers,omitempty"` + Body *string `json:"body,omitempty"` + Url *string `json:"url,omitempty"` +} + + + +// GetMethod returns the Method field value +// If the value is explicit nil, the zero value for string will be returned +func (o *RequestProperties) GetMethod() *string { + if o == nil { + return nil + } + + return o.Method +} + +// GetMethodOk returns a tuple with the Method field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *RequestProperties) GetMethodOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Method, true +} + +// SetMethod sets field value +func (o *RequestProperties) SetMethod(v string) { + o.Method = &v +} + +// HasMethod returns a boolean if a field has been set. +func (o *RequestProperties) HasMethod() bool { + if o != nil && o.Method != nil { + return true + } + + return false +} + + + +// GetHeaders returns the Headers field value +// If the value is explicit nil, the zero value for map[string]string will be returned +func (o *RequestProperties) GetHeaders() *map[string]string { + if o == nil { + return nil + } + + return o.Headers +} + +// GetHeadersOk returns a tuple with the Headers field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *RequestProperties) GetHeadersOk() (*map[string]string, bool) { + if o == nil { + return nil, false + } + return o.Headers, true +} + +// SetHeaders sets field value +func (o *RequestProperties) SetHeaders(v map[string]string) { + o.Headers = &v +} + +// HasHeaders returns a boolean if a field has been set. +func (o *RequestProperties) HasHeaders() bool { + if o != nil && o.Headers != nil { + return true + } + + return false +} + + + +// GetBody returns the Body field value +// If the value is explicit nil, the zero value for string will be returned +func (o *RequestProperties) GetBody() *string { + if o == nil { + return nil + } + + return o.Body +} + +// GetBodyOk returns a tuple with the Body field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *RequestProperties) GetBodyOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Body, true +} + +// SetBody sets field value +func (o *RequestProperties) SetBody(v string) { + o.Body = &v +} + +// HasBody returns a boolean if a field has been set. +func (o *RequestProperties) HasBody() bool { + if o != nil && o.Body != nil { + return true + } + + return false +} + + + +// GetUrl returns the Url field value +// If the value is explicit nil, the zero value for string will be returned +func (o *RequestProperties) GetUrl() *string { + if o == nil { + return nil + } + + return o.Url +} + +// GetUrlOk returns a tuple with the Url field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *RequestProperties) GetUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Url, true +} + +// SetUrl sets field value +func (o *RequestProperties) SetUrl(v string) { + o.Url = &v +} + +// HasUrl returns a boolean if a field has been set. +func (o *RequestProperties) HasUrl() bool { + if o != nil && o.Url != nil { + return true + } + + return false +} + + +func (o RequestProperties) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Method != nil { + toSerialize["method"] = o.Method + } + + + if o.Headers != nil { + toSerialize["headers"] = o.Headers + } + + + if o.Body != nil { + toSerialize["body"] = o.Body + } + + + if o.Url != nil { + toSerialize["url"] = o.Url + } + + return json.Marshal(toSerialize) +} + +type NullableRequestProperties struct { + value *RequestProperties + isSet bool +} + +func (v NullableRequestProperties) Get() *RequestProperties { + return v.value +} + +func (v *NullableRequestProperties) Set(val *RequestProperties) { + v.value = val + v.isSet = true +} + +func (v NullableRequestProperties) IsSet() bool { + return v.isSet +} + +func (v *NullableRequestProperties) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRequestProperties(val *RequestProperties) *NullableRequestProperties { + return &NullableRequestProperties{value: val, isSet: true} +} + +func (v NullableRequestProperties) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRequestProperties) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_request_status.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_request_status.go new file mode 100644 index 0000000000..7b630638ba --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_request_status.go @@ -0,0 +1,234 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// RequestStatus struct for RequestStatus +type RequestStatus struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of object that has been created + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + Metadata *RequestStatusMetadata `json:"metadata,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *RequestStatus) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *RequestStatus) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *RequestStatus) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *RequestStatus) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *RequestStatus) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *RequestStatus) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *RequestStatus) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *RequestStatus) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *RequestStatus) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *RequestStatus) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *RequestStatus) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *RequestStatus) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for RequestStatusMetadata will be returned +func (o *RequestStatus) GetMetadata() *RequestStatusMetadata { + if o == nil { + return nil + } + + return o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *RequestStatus) GetMetadataOk() (*RequestStatusMetadata, bool) { + if o == nil { + return nil, false + } + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *RequestStatus) SetMetadata(v RequestStatusMetadata) { + o.Metadata = &v +} + +// HasMetadata returns a boolean if a field has been set. +func (o *RequestStatus) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + + +func (o RequestStatus) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + return json.Marshal(toSerialize) +} + +type NullableRequestStatus struct { + value *RequestStatus + isSet bool +} + +func (v NullableRequestStatus) Get() *RequestStatus { + return v.value +} + +func (v *NullableRequestStatus) Set(val *RequestStatus) { + v.value = val + v.isSet = true +} + +func (v NullableRequestStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableRequestStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRequestStatus(val *RequestStatus) *NullableRequestStatus { + return &NullableRequestStatus{value: val, isSet: true} +} + +func (v NullableRequestStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRequestStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_request_status_metadata.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_request_status_metadata.go new file mode 100644 index 0000000000..409c0fd776 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_request_status_metadata.go @@ -0,0 +1,232 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// RequestStatusMetadata struct for RequestStatusMetadata +type RequestStatusMetadata struct { + Status *string `json:"status,omitempty"` + Message *string `json:"message,omitempty"` + // Resource's Entity Tag as defined in http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.11 . Entity Tag is also added as an 'ETag response header to requests which don't use 'depth' parameter. + Etag *string `json:"etag,omitempty"` + Targets *[]RequestTarget `json:"targets,omitempty"` +} + + + +// GetStatus returns the Status field value +// If the value is explicit nil, the zero value for string will be returned +func (o *RequestStatusMetadata) GetStatus() *string { + if o == nil { + return nil + } + + return o.Status +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *RequestStatusMetadata) GetStatusOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Status, true +} + +// SetStatus sets field value +func (o *RequestStatusMetadata) SetStatus(v string) { + o.Status = &v +} + +// HasStatus returns a boolean if a field has been set. +func (o *RequestStatusMetadata) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + + + +// GetMessage returns the Message field value +// If the value is explicit nil, the zero value for string will be returned +func (o *RequestStatusMetadata) GetMessage() *string { + if o == nil { + return nil + } + + return o.Message +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *RequestStatusMetadata) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Message, true +} + +// SetMessage sets field value +func (o *RequestStatusMetadata) SetMessage(v string) { + o.Message = &v +} + +// HasMessage returns a boolean if a field has been set. +func (o *RequestStatusMetadata) HasMessage() bool { + if o != nil && o.Message != nil { + return true + } + + return false +} + + + +// GetEtag returns the Etag field value +// If the value is explicit nil, the zero value for string will be returned +func (o *RequestStatusMetadata) GetEtag() *string { + if o == nil { + return nil + } + + return o.Etag +} + +// GetEtagOk returns a tuple with the Etag field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *RequestStatusMetadata) GetEtagOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Etag, true +} + +// SetEtag sets field value +func (o *RequestStatusMetadata) SetEtag(v string) { + o.Etag = &v +} + +// HasEtag returns a boolean if a field has been set. +func (o *RequestStatusMetadata) HasEtag() bool { + if o != nil && o.Etag != nil { + return true + } + + return false +} + + + +// GetTargets returns the Targets field value +// If the value is explicit nil, the zero value for []RequestTarget will be returned +func (o *RequestStatusMetadata) GetTargets() *[]RequestTarget { + if o == nil { + return nil + } + + return o.Targets +} + +// GetTargetsOk returns a tuple with the Targets field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *RequestStatusMetadata) GetTargetsOk() (*[]RequestTarget, bool) { + if o == nil { + return nil, false + } + return o.Targets, true +} + +// SetTargets sets field value +func (o *RequestStatusMetadata) SetTargets(v []RequestTarget) { + o.Targets = &v +} + +// HasTargets returns a boolean if a field has been set. +func (o *RequestStatusMetadata) HasTargets() bool { + if o != nil && o.Targets != nil { + return true + } + + return false +} + + +func (o RequestStatusMetadata) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Status != nil { + toSerialize["status"] = o.Status + } + + + if o.Message != nil { + toSerialize["message"] = o.Message + } + + + if o.Etag != nil { + toSerialize["etag"] = o.Etag + } + + + if o.Targets != nil { + toSerialize["targets"] = o.Targets + } + + return json.Marshal(toSerialize) +} + +type NullableRequestStatusMetadata struct { + value *RequestStatusMetadata + isSet bool +} + +func (v NullableRequestStatusMetadata) Get() *RequestStatusMetadata { + return v.value +} + +func (v *NullableRequestStatusMetadata) Set(val *RequestStatusMetadata) { + v.value = val + v.isSet = true +} + +func (v NullableRequestStatusMetadata) IsSet() bool { + return v.isSet +} + +func (v *NullableRequestStatusMetadata) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRequestStatusMetadata(val *RequestStatusMetadata) *NullableRequestStatusMetadata { + return &NullableRequestStatusMetadata{value: val, isSet: true} +} + +func (v NullableRequestStatusMetadata) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRequestStatusMetadata) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_request_target.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_request_target.go new file mode 100644 index 0000000000..5b5ec5657f --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_request_target.go @@ -0,0 +1,147 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// RequestTarget struct for RequestTarget +type RequestTarget struct { + Target *ResourceReference `json:"target,omitempty"` + Status *string `json:"status,omitempty"` +} + + + +// GetTarget returns the Target field value +// If the value is explicit nil, the zero value for ResourceReference will be returned +func (o *RequestTarget) GetTarget() *ResourceReference { + if o == nil { + return nil + } + + return o.Target +} + +// GetTargetOk returns a tuple with the Target field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *RequestTarget) GetTargetOk() (*ResourceReference, bool) { + if o == nil { + return nil, false + } + return o.Target, true +} + +// SetTarget sets field value +func (o *RequestTarget) SetTarget(v ResourceReference) { + o.Target = &v +} + +// HasTarget returns a boolean if a field has been set. +func (o *RequestTarget) HasTarget() bool { + if o != nil && o.Target != nil { + return true + } + + return false +} + + + +// GetStatus returns the Status field value +// If the value is explicit nil, the zero value for string will be returned +func (o *RequestTarget) GetStatus() *string { + if o == nil { + return nil + } + + return o.Status +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *RequestTarget) GetStatusOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Status, true +} + +// SetStatus sets field value +func (o *RequestTarget) SetStatus(v string) { + o.Status = &v +} + +// HasStatus returns a boolean if a field has been set. +func (o *RequestTarget) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + + +func (o RequestTarget) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Target != nil { + toSerialize["target"] = o.Target + } + + + if o.Status != nil { + toSerialize["status"] = o.Status + } + + return json.Marshal(toSerialize) +} + +type NullableRequestTarget struct { + value *RequestTarget + isSet bool +} + +func (v NullableRequestTarget) Get() *RequestTarget { + return v.value +} + +func (v *NullableRequestTarget) Set(val *RequestTarget) { + v.value = val + v.isSet = true +} + +func (v NullableRequestTarget) IsSet() bool { + return v.isSet +} + +func (v *NullableRequestTarget) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRequestTarget(val *RequestTarget) *NullableRequestTarget { + return &NullableRequestTarget{value: val, isSet: true} +} + +func (v NullableRequestTarget) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRequestTarget) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_requests.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_requests.go new file mode 100644 index 0000000000..9e7391d0fb --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_requests.go @@ -0,0 +1,235 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// Requests struct for Requests +type Requests struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of object that has been created + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + // Array of items in that collection + Items *[]Request `json:"items,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Requests) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Requests) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *Requests) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *Requests) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *Requests) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Requests) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *Requests) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *Requests) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Requests) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Requests) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *Requests) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *Requests) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []Request will be returned +func (o *Requests) GetItems() *[]Request { + if o == nil { + return nil + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Requests) GetItemsOk() (*[]Request, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *Requests) SetItems(v []Request) { + o.Items = &v +} + +// HasItems returns a boolean if a field has been set. +func (o *Requests) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + + +func (o Requests) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullableRequests struct { + value *Requests + isSet bool +} + +func (v NullableRequests) Get() *Requests { + return v.value +} + +func (v *NullableRequests) Set(val *Requests) { + v.value = val + v.isSet = true +} + +func (v NullableRequests) IsSet() bool { + return v.isSet +} + +func (v *NullableRequests) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRequests(val *Requests) *NullableRequests { + return &NullableRequests{value: val, isSet: true} +} + +func (v NullableRequests) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRequests) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_resource.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_resource.go new file mode 100644 index 0000000000..cd343d07c6 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_resource.go @@ -0,0 +1,318 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// Resource datacenter resource representation +type Resource struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of the resource + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` + Properties *ResourceProperties `json:"properties,omitempty"` + Entities *ResourceEntities `json:"entities,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Resource) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Resource) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *Resource) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *Resource) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *Resource) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Resource) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *Resource) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *Resource) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Resource) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Resource) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *Resource) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *Resource) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for DatacenterElementMetadata will be returned +func (o *Resource) GetMetadata() *DatacenterElementMetadata { + if o == nil { + return nil + } + + return o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Resource) GetMetadataOk() (*DatacenterElementMetadata, bool) { + if o == nil { + return nil, false + } + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *Resource) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + +// HasMetadata returns a boolean if a field has been set. +func (o *Resource) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + + + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for ResourceProperties will be returned +func (o *Resource) GetProperties() *ResourceProperties { + if o == nil { + return nil + } + + return o.Properties +} + +// GetPropertiesOk returns a tuple with the Properties field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Resource) GetPropertiesOk() (*ResourceProperties, bool) { + if o == nil { + return nil, false + } + return o.Properties, true +} + +// SetProperties sets field value +func (o *Resource) SetProperties(v ResourceProperties) { + o.Properties = &v +} + +// HasProperties returns a boolean if a field has been set. +func (o *Resource) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + + + +// GetEntities returns the Entities field value +// If the value is explicit nil, the zero value for ResourceEntities will be returned +func (o *Resource) GetEntities() *ResourceEntities { + if o == nil { + return nil + } + + return o.Entities +} + +// GetEntitiesOk returns a tuple with the Entities field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Resource) GetEntitiesOk() (*ResourceEntities, bool) { + if o == nil { + return nil, false + } + return o.Entities, true +} + +// SetEntities sets field value +func (o *Resource) SetEntities(v ResourceEntities) { + o.Entities = &v +} + +// HasEntities returns a boolean if a field has been set. +func (o *Resource) HasEntities() bool { + if o != nil && o.Entities != nil { + return true + } + + return false +} + + +func (o Resource) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + + if o.Entities != nil { + toSerialize["entities"] = o.Entities + } + + return json.Marshal(toSerialize) +} + +type NullableResource struct { + value *Resource + isSet bool +} + +func (v NullableResource) Get() *Resource { + return v.value +} + +func (v *NullableResource) Set(val *Resource) { + v.value = val + v.isSet = true +} + +func (v NullableResource) IsSet() bool { + return v.isSet +} + +func (v *NullableResource) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableResource(val *Resource) *NullableResource { + return &NullableResource{value: val, isSet: true} +} + +func (v NullableResource) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableResource) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_resource_entities.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_resource_entities.go new file mode 100644 index 0000000000..7b24578029 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_resource_entities.go @@ -0,0 +1,105 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// ResourceEntities struct for ResourceEntities +type ResourceEntities struct { + Groups *ResourceGroups `json:"groups,omitempty"` +} + + + +// GetGroups returns the Groups field value +// If the value is explicit nil, the zero value for ResourceGroups will be returned +func (o *ResourceEntities) GetGroups() *ResourceGroups { + if o == nil { + return nil + } + + return o.Groups +} + +// GetGroupsOk returns a tuple with the Groups field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourceEntities) GetGroupsOk() (*ResourceGroups, bool) { + if o == nil { + return nil, false + } + return o.Groups, true +} + +// SetGroups sets field value +func (o *ResourceEntities) SetGroups(v ResourceGroups) { + o.Groups = &v +} + +// HasGroups returns a boolean if a field has been set. +func (o *ResourceEntities) HasGroups() bool { + if o != nil && o.Groups != nil { + return true + } + + return false +} + + +func (o ResourceEntities) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Groups != nil { + toSerialize["groups"] = o.Groups + } + + return json.Marshal(toSerialize) +} + +type NullableResourceEntities struct { + value *ResourceEntities + isSet bool +} + +func (v NullableResourceEntities) Get() *ResourceEntities { + return v.value +} + +func (v *NullableResourceEntities) Set(val *ResourceEntities) { + v.value = val + v.isSet = true +} + +func (v NullableResourceEntities) IsSet() bool { + return v.isSet +} + +func (v *NullableResourceEntities) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableResourceEntities(val *ResourceEntities) *NullableResourceEntities { + return &NullableResourceEntities{value: val, isSet: true} +} + +func (v NullableResourceEntities) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableResourceEntities) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_resource_groups.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_resource_groups.go new file mode 100644 index 0000000000..69332ef3d7 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_resource_groups.go @@ -0,0 +1,235 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// ResourceGroups Resources assigned to this group. +type ResourceGroups struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of the resource + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + // Array of items in that collection + Items *[]Resource `json:"items,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ResourceGroups) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourceGroups) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *ResourceGroups) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *ResourceGroups) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *ResourceGroups) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourceGroups) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *ResourceGroups) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *ResourceGroups) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ResourceGroups) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourceGroups) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *ResourceGroups) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *ResourceGroups) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []Resource will be returned +func (o *ResourceGroups) GetItems() *[]Resource { + if o == nil { + return nil + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourceGroups) GetItemsOk() (*[]Resource, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *ResourceGroups) SetItems(v []Resource) { + o.Items = &v +} + +// HasItems returns a boolean if a field has been set. +func (o *ResourceGroups) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + + +func (o ResourceGroups) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullableResourceGroups struct { + value *ResourceGroups + isSet bool +} + +func (v NullableResourceGroups) Get() *ResourceGroups { + return v.value +} + +func (v *NullableResourceGroups) Set(val *ResourceGroups) { + v.value = val + v.isSet = true +} + +func (v NullableResourceGroups) IsSet() bool { + return v.isSet +} + +func (v *NullableResourceGroups) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableResourceGroups(val *ResourceGroups) *NullableResourceGroups { + return &NullableResourceGroups{value: val, isSet: true} +} + +func (v NullableResourceGroups) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableResourceGroups) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_resource_limits.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_resource_limits.go new file mode 100644 index 0000000000..014c6f67f4 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_resource_limits.go @@ -0,0 +1,794 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// ResourceLimits struct for ResourceLimits +type ResourceLimits struct { + // maximum number of cores per server + CoresPerServer *int32 `json:"coresPerServer"` + // maximum cores per contract + CoresPerContract *int32 `json:"coresPerContract"` + // number of cores provisioned + CoresProvisioned *int32 `json:"coresProvisioned"` + // maximum ram per server + RamPerServer *int32 `json:"ramPerServer"` + // maximum ram per contract + RamPerContract *int32 `json:"ramPerContract"` + // ram provisioned + RamProvisioned *int32 `json:"ramProvisioned"` + // hdd limit per volume + HddLimitPerVolume *int64 `json:"hddLimitPerVolume"` + // hdd limit per contract + HddLimitPerContract *int64 `json:"hddLimitPerContract"` + // hdd volume provisioned + HddVolumeProvisioned *int64 `json:"hddVolumeProvisioned"` + // ssd limit per volume + SsdLimitPerVolume *int64 `json:"ssdLimitPerVolume"` + // ssd limit per contract + SsdLimitPerContract *int64 `json:"ssdLimitPerContract"` + // ssd volume provisioned + SsdVolumeProvisioned *int64 `json:"ssdVolumeProvisioned"` + // total reservable ip limit of the customer + ReservableIps *int32 `json:"reservableIps"` + // reserved ips on a contract + ReservedIpsOnContract *int32 `json:"reservedIpsOnContract"` + // reserved ips in use + ReservedIpsInUse *int32 `json:"reservedIpsInUse"` + // k8s clusters total limit + K8sClusterLimitTotal *int32 `json:"k8sClusterLimitTotal"` + // k8s clusters provisioned + K8sClustersProvisioned *int32 `json:"k8sClustersProvisioned"` +} + + + +// GetCoresPerServer returns the CoresPerServer field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *ResourceLimits) GetCoresPerServer() *int32 { + if o == nil { + return nil + } + + return o.CoresPerServer +} + +// GetCoresPerServerOk returns a tuple with the CoresPerServer field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourceLimits) GetCoresPerServerOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.CoresPerServer, true +} + +// SetCoresPerServer sets field value +func (o *ResourceLimits) SetCoresPerServer(v int32) { + o.CoresPerServer = &v +} + +// HasCoresPerServer returns a boolean if a field has been set. +func (o *ResourceLimits) HasCoresPerServer() bool { + if o != nil && o.CoresPerServer != nil { + return true + } + + return false +} + + + +// GetCoresPerContract returns the CoresPerContract field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *ResourceLimits) GetCoresPerContract() *int32 { + if o == nil { + return nil + } + + return o.CoresPerContract +} + +// GetCoresPerContractOk returns a tuple with the CoresPerContract field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourceLimits) GetCoresPerContractOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.CoresPerContract, true +} + +// SetCoresPerContract sets field value +func (o *ResourceLimits) SetCoresPerContract(v int32) { + o.CoresPerContract = &v +} + +// HasCoresPerContract returns a boolean if a field has been set. +func (o *ResourceLimits) HasCoresPerContract() bool { + if o != nil && o.CoresPerContract != nil { + return true + } + + return false +} + + + +// GetCoresProvisioned returns the CoresProvisioned field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *ResourceLimits) GetCoresProvisioned() *int32 { + if o == nil { + return nil + } + + return o.CoresProvisioned +} + +// GetCoresProvisionedOk returns a tuple with the CoresProvisioned field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourceLimits) GetCoresProvisionedOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.CoresProvisioned, true +} + +// SetCoresProvisioned sets field value +func (o *ResourceLimits) SetCoresProvisioned(v int32) { + o.CoresProvisioned = &v +} + +// HasCoresProvisioned returns a boolean if a field has been set. +func (o *ResourceLimits) HasCoresProvisioned() bool { + if o != nil && o.CoresProvisioned != nil { + return true + } + + return false +} + + + +// GetRamPerServer returns the RamPerServer field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *ResourceLimits) GetRamPerServer() *int32 { + if o == nil { + return nil + } + + return o.RamPerServer +} + +// GetRamPerServerOk returns a tuple with the RamPerServer field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourceLimits) GetRamPerServerOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.RamPerServer, true +} + +// SetRamPerServer sets field value +func (o *ResourceLimits) SetRamPerServer(v int32) { + o.RamPerServer = &v +} + +// HasRamPerServer returns a boolean if a field has been set. +func (o *ResourceLimits) HasRamPerServer() bool { + if o != nil && o.RamPerServer != nil { + return true + } + + return false +} + + + +// GetRamPerContract returns the RamPerContract field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *ResourceLimits) GetRamPerContract() *int32 { + if o == nil { + return nil + } + + return o.RamPerContract +} + +// GetRamPerContractOk returns a tuple with the RamPerContract field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourceLimits) GetRamPerContractOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.RamPerContract, true +} + +// SetRamPerContract sets field value +func (o *ResourceLimits) SetRamPerContract(v int32) { + o.RamPerContract = &v +} + +// HasRamPerContract returns a boolean if a field has been set. +func (o *ResourceLimits) HasRamPerContract() bool { + if o != nil && o.RamPerContract != nil { + return true + } + + return false +} + + + +// GetRamProvisioned returns the RamProvisioned field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *ResourceLimits) GetRamProvisioned() *int32 { + if o == nil { + return nil + } + + return o.RamProvisioned +} + +// GetRamProvisionedOk returns a tuple with the RamProvisioned field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourceLimits) GetRamProvisionedOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.RamProvisioned, true +} + +// SetRamProvisioned sets field value +func (o *ResourceLimits) SetRamProvisioned(v int32) { + o.RamProvisioned = &v +} + +// HasRamProvisioned returns a boolean if a field has been set. +func (o *ResourceLimits) HasRamProvisioned() bool { + if o != nil && o.RamProvisioned != nil { + return true + } + + return false +} + + + +// GetHddLimitPerVolume returns the HddLimitPerVolume field value +// If the value is explicit nil, the zero value for int64 will be returned +func (o *ResourceLimits) GetHddLimitPerVolume() *int64 { + if o == nil { + return nil + } + + return o.HddLimitPerVolume +} + +// GetHddLimitPerVolumeOk returns a tuple with the HddLimitPerVolume field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourceLimits) GetHddLimitPerVolumeOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.HddLimitPerVolume, true +} + +// SetHddLimitPerVolume sets field value +func (o *ResourceLimits) SetHddLimitPerVolume(v int64) { + o.HddLimitPerVolume = &v +} + +// HasHddLimitPerVolume returns a boolean if a field has been set. +func (o *ResourceLimits) HasHddLimitPerVolume() bool { + if o != nil && o.HddLimitPerVolume != nil { + return true + } + + return false +} + + + +// GetHddLimitPerContract returns the HddLimitPerContract field value +// If the value is explicit nil, the zero value for int64 will be returned +func (o *ResourceLimits) GetHddLimitPerContract() *int64 { + if o == nil { + return nil + } + + return o.HddLimitPerContract +} + +// GetHddLimitPerContractOk returns a tuple with the HddLimitPerContract field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourceLimits) GetHddLimitPerContractOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.HddLimitPerContract, true +} + +// SetHddLimitPerContract sets field value +func (o *ResourceLimits) SetHddLimitPerContract(v int64) { + o.HddLimitPerContract = &v +} + +// HasHddLimitPerContract returns a boolean if a field has been set. +func (o *ResourceLimits) HasHddLimitPerContract() bool { + if o != nil && o.HddLimitPerContract != nil { + return true + } + + return false +} + + + +// GetHddVolumeProvisioned returns the HddVolumeProvisioned field value +// If the value is explicit nil, the zero value for int64 will be returned +func (o *ResourceLimits) GetHddVolumeProvisioned() *int64 { + if o == nil { + return nil + } + + return o.HddVolumeProvisioned +} + +// GetHddVolumeProvisionedOk returns a tuple with the HddVolumeProvisioned field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourceLimits) GetHddVolumeProvisionedOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.HddVolumeProvisioned, true +} + +// SetHddVolumeProvisioned sets field value +func (o *ResourceLimits) SetHddVolumeProvisioned(v int64) { + o.HddVolumeProvisioned = &v +} + +// HasHddVolumeProvisioned returns a boolean if a field has been set. +func (o *ResourceLimits) HasHddVolumeProvisioned() bool { + if o != nil && o.HddVolumeProvisioned != nil { + return true + } + + return false +} + + + +// GetSsdLimitPerVolume returns the SsdLimitPerVolume field value +// If the value is explicit nil, the zero value for int64 will be returned +func (o *ResourceLimits) GetSsdLimitPerVolume() *int64 { + if o == nil { + return nil + } + + return o.SsdLimitPerVolume +} + +// GetSsdLimitPerVolumeOk returns a tuple with the SsdLimitPerVolume field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourceLimits) GetSsdLimitPerVolumeOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.SsdLimitPerVolume, true +} + +// SetSsdLimitPerVolume sets field value +func (o *ResourceLimits) SetSsdLimitPerVolume(v int64) { + o.SsdLimitPerVolume = &v +} + +// HasSsdLimitPerVolume returns a boolean if a field has been set. +func (o *ResourceLimits) HasSsdLimitPerVolume() bool { + if o != nil && o.SsdLimitPerVolume != nil { + return true + } + + return false +} + + + +// GetSsdLimitPerContract returns the SsdLimitPerContract field value +// If the value is explicit nil, the zero value for int64 will be returned +func (o *ResourceLimits) GetSsdLimitPerContract() *int64 { + if o == nil { + return nil + } + + return o.SsdLimitPerContract +} + +// GetSsdLimitPerContractOk returns a tuple with the SsdLimitPerContract field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourceLimits) GetSsdLimitPerContractOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.SsdLimitPerContract, true +} + +// SetSsdLimitPerContract sets field value +func (o *ResourceLimits) SetSsdLimitPerContract(v int64) { + o.SsdLimitPerContract = &v +} + +// HasSsdLimitPerContract returns a boolean if a field has been set. +func (o *ResourceLimits) HasSsdLimitPerContract() bool { + if o != nil && o.SsdLimitPerContract != nil { + return true + } + + return false +} + + + +// GetSsdVolumeProvisioned returns the SsdVolumeProvisioned field value +// If the value is explicit nil, the zero value for int64 will be returned +func (o *ResourceLimits) GetSsdVolumeProvisioned() *int64 { + if o == nil { + return nil + } + + return o.SsdVolumeProvisioned +} + +// GetSsdVolumeProvisionedOk returns a tuple with the SsdVolumeProvisioned field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourceLimits) GetSsdVolumeProvisionedOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.SsdVolumeProvisioned, true +} + +// SetSsdVolumeProvisioned sets field value +func (o *ResourceLimits) SetSsdVolumeProvisioned(v int64) { + o.SsdVolumeProvisioned = &v +} + +// HasSsdVolumeProvisioned returns a boolean if a field has been set. +func (o *ResourceLimits) HasSsdVolumeProvisioned() bool { + if o != nil && o.SsdVolumeProvisioned != nil { + return true + } + + return false +} + + + +// GetReservableIps returns the ReservableIps field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *ResourceLimits) GetReservableIps() *int32 { + if o == nil { + return nil + } + + return o.ReservableIps +} + +// GetReservableIpsOk returns a tuple with the ReservableIps field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourceLimits) GetReservableIpsOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.ReservableIps, true +} + +// SetReservableIps sets field value +func (o *ResourceLimits) SetReservableIps(v int32) { + o.ReservableIps = &v +} + +// HasReservableIps returns a boolean if a field has been set. +func (o *ResourceLimits) HasReservableIps() bool { + if o != nil && o.ReservableIps != nil { + return true + } + + return false +} + + + +// GetReservedIpsOnContract returns the ReservedIpsOnContract field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *ResourceLimits) GetReservedIpsOnContract() *int32 { + if o == nil { + return nil + } + + return o.ReservedIpsOnContract +} + +// GetReservedIpsOnContractOk returns a tuple with the ReservedIpsOnContract field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourceLimits) GetReservedIpsOnContractOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.ReservedIpsOnContract, true +} + +// SetReservedIpsOnContract sets field value +func (o *ResourceLimits) SetReservedIpsOnContract(v int32) { + o.ReservedIpsOnContract = &v +} + +// HasReservedIpsOnContract returns a boolean if a field has been set. +func (o *ResourceLimits) HasReservedIpsOnContract() bool { + if o != nil && o.ReservedIpsOnContract != nil { + return true + } + + return false +} + + + +// GetReservedIpsInUse returns the ReservedIpsInUse field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *ResourceLimits) GetReservedIpsInUse() *int32 { + if o == nil { + return nil + } + + return o.ReservedIpsInUse +} + +// GetReservedIpsInUseOk returns a tuple with the ReservedIpsInUse field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourceLimits) GetReservedIpsInUseOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.ReservedIpsInUse, true +} + +// SetReservedIpsInUse sets field value +func (o *ResourceLimits) SetReservedIpsInUse(v int32) { + o.ReservedIpsInUse = &v +} + +// HasReservedIpsInUse returns a boolean if a field has been set. +func (o *ResourceLimits) HasReservedIpsInUse() bool { + if o != nil && o.ReservedIpsInUse != nil { + return true + } + + return false +} + + + +// GetK8sClusterLimitTotal returns the K8sClusterLimitTotal field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *ResourceLimits) GetK8sClusterLimitTotal() *int32 { + if o == nil { + return nil + } + + return o.K8sClusterLimitTotal +} + +// GetK8sClusterLimitTotalOk returns a tuple with the K8sClusterLimitTotal field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourceLimits) GetK8sClusterLimitTotalOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.K8sClusterLimitTotal, true +} + +// SetK8sClusterLimitTotal sets field value +func (o *ResourceLimits) SetK8sClusterLimitTotal(v int32) { + o.K8sClusterLimitTotal = &v +} + +// HasK8sClusterLimitTotal returns a boolean if a field has been set. +func (o *ResourceLimits) HasK8sClusterLimitTotal() bool { + if o != nil && o.K8sClusterLimitTotal != nil { + return true + } + + return false +} + + + +// GetK8sClustersProvisioned returns the K8sClustersProvisioned field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *ResourceLimits) GetK8sClustersProvisioned() *int32 { + if o == nil { + return nil + } + + return o.K8sClustersProvisioned +} + +// GetK8sClustersProvisionedOk returns a tuple with the K8sClustersProvisioned field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourceLimits) GetK8sClustersProvisionedOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.K8sClustersProvisioned, true +} + +// SetK8sClustersProvisioned sets field value +func (o *ResourceLimits) SetK8sClustersProvisioned(v int32) { + o.K8sClustersProvisioned = &v +} + +// HasK8sClustersProvisioned returns a boolean if a field has been set. +func (o *ResourceLimits) HasK8sClustersProvisioned() bool { + if o != nil && o.K8sClustersProvisioned != nil { + return true + } + + return false +} + + +func (o ResourceLimits) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.CoresPerServer != nil { + toSerialize["coresPerServer"] = o.CoresPerServer + } + + + if o.CoresPerContract != nil { + toSerialize["coresPerContract"] = o.CoresPerContract + } + + + if o.CoresProvisioned != nil { + toSerialize["coresProvisioned"] = o.CoresProvisioned + } + + + if o.RamPerServer != nil { + toSerialize["ramPerServer"] = o.RamPerServer + } + + + if o.RamPerContract != nil { + toSerialize["ramPerContract"] = o.RamPerContract + } + + + if o.RamProvisioned != nil { + toSerialize["ramProvisioned"] = o.RamProvisioned + } + + + if o.HddLimitPerVolume != nil { + toSerialize["hddLimitPerVolume"] = o.HddLimitPerVolume + } + + + if o.HddLimitPerContract != nil { + toSerialize["hddLimitPerContract"] = o.HddLimitPerContract + } + + + if o.HddVolumeProvisioned != nil { + toSerialize["hddVolumeProvisioned"] = o.HddVolumeProvisioned + } + + + if o.SsdLimitPerVolume != nil { + toSerialize["ssdLimitPerVolume"] = o.SsdLimitPerVolume + } + + + if o.SsdLimitPerContract != nil { + toSerialize["ssdLimitPerContract"] = o.SsdLimitPerContract + } + + + if o.SsdVolumeProvisioned != nil { + toSerialize["ssdVolumeProvisioned"] = o.SsdVolumeProvisioned + } + + + if o.ReservableIps != nil { + toSerialize["reservableIps"] = o.ReservableIps + } + + + if o.ReservedIpsOnContract != nil { + toSerialize["reservedIpsOnContract"] = o.ReservedIpsOnContract + } + + + if o.ReservedIpsInUse != nil { + toSerialize["reservedIpsInUse"] = o.ReservedIpsInUse + } + + + if o.K8sClusterLimitTotal != nil { + toSerialize["k8sClusterLimitTotal"] = o.K8sClusterLimitTotal + } + + + if o.K8sClustersProvisioned != nil { + toSerialize["k8sClustersProvisioned"] = o.K8sClustersProvisioned + } + + return json.Marshal(toSerialize) +} + +type NullableResourceLimits struct { + value *ResourceLimits + isSet bool +} + +func (v NullableResourceLimits) Get() *ResourceLimits { + return v.value +} + +func (v *NullableResourceLimits) Set(val *ResourceLimits) { + v.value = val + v.isSet = true +} + +func (v NullableResourceLimits) IsSet() bool { + return v.isSet +} + +func (v *NullableResourceLimits) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableResourceLimits(val *ResourceLimits) *NullableResourceLimits { + return &NullableResourceLimits{value: val, isSet: true} +} + +func (v NullableResourceLimits) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableResourceLimits) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_resource_properties.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_resource_properties.go new file mode 100644 index 0000000000..cba2849bce --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_resource_properties.go @@ -0,0 +1,149 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// ResourceProperties struct for ResourceProperties +type ResourceProperties struct { + // name of the resource + Name *string `json:"name,omitempty"` + // Boolean value representing if the resource is multi factor protected or not e.g. using two factor protection. Currently only Data Centers and Snapshots are allowed to be multi factor protected, The value of attribute if null is intentional and it means that the resource doesn't support multi factor protection at all. + SecAuthProtection *bool `json:"secAuthProtection,omitempty"` +} + + + +// GetName returns the Name field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ResourceProperties) GetName() *string { + if o == nil { + return nil + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourceProperties) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name, true +} + +// SetName sets field value +func (o *ResourceProperties) SetName(v string) { + o.Name = &v +} + +// HasName returns a boolean if a field has been set. +func (o *ResourceProperties) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + + + +// GetSecAuthProtection returns the SecAuthProtection field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *ResourceProperties) GetSecAuthProtection() *bool { + if o == nil { + return nil + } + + return o.SecAuthProtection +} + +// GetSecAuthProtectionOk returns a tuple with the SecAuthProtection field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourceProperties) GetSecAuthProtectionOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.SecAuthProtection, true +} + +// SetSecAuthProtection sets field value +func (o *ResourceProperties) SetSecAuthProtection(v bool) { + o.SecAuthProtection = &v +} + +// HasSecAuthProtection returns a boolean if a field has been set. +func (o *ResourceProperties) HasSecAuthProtection() bool { + if o != nil && o.SecAuthProtection != nil { + return true + } + + return false +} + + +func (o ResourceProperties) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Name != nil { + toSerialize["name"] = o.Name + } + + + if o.SecAuthProtection != nil { + toSerialize["secAuthProtection"] = o.SecAuthProtection + } + + return json.Marshal(toSerialize) +} + +type NullableResourceProperties struct { + value *ResourceProperties + isSet bool +} + +func (v NullableResourceProperties) Get() *ResourceProperties { + return v.value +} + +func (v *NullableResourceProperties) Set(val *ResourceProperties) { + v.value = val + v.isSet = true +} + +func (v NullableResourceProperties) IsSet() bool { + return v.isSet +} + +func (v *NullableResourceProperties) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableResourceProperties(val *ResourceProperties) *NullableResourceProperties { + return &NullableResourceProperties{value: val, isSet: true} +} + +func (v NullableResourceProperties) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableResourceProperties) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_resource_reference.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_resource_reference.go new file mode 100644 index 0000000000..4fec97300a --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_resource_reference.go @@ -0,0 +1,192 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// ResourceReference struct for ResourceReference +type ResourceReference struct { + // The resource's unique identifier + Id *string `json:"id"` + // The type of object that has been created + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ResourceReference) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourceReference) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *ResourceReference) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *ResourceReference) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *ResourceReference) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourceReference) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *ResourceReference) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *ResourceReference) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ResourceReference) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourceReference) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *ResourceReference) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *ResourceReference) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + +func (o ResourceReference) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + return json.Marshal(toSerialize) +} + +type NullableResourceReference struct { + value *ResourceReference + isSet bool +} + +func (v NullableResourceReference) Get() *ResourceReference { + return v.value +} + +func (v *NullableResourceReference) Set(val *ResourceReference) { + v.value = val + v.isSet = true +} + +func (v NullableResourceReference) IsSet() bool { + return v.isSet +} + +func (v *NullableResourceReference) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableResourceReference(val *ResourceReference) *NullableResourceReference { + return &NullableResourceReference{value: val, isSet: true} +} + +func (v NullableResourceReference) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableResourceReference) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_resources.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_resources.go new file mode 100644 index 0000000000..acd1023a18 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_resources.go @@ -0,0 +1,235 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// Resources Collection to represent the resource +type Resources struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of the resource + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + // Array of items in that collection + Items *[]Resource `json:"items,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Resources) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Resources) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *Resources) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *Resources) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *Resources) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Resources) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *Resources) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *Resources) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Resources) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Resources) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *Resources) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *Resources) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []Resource will be returned +func (o *Resources) GetItems() *[]Resource { + if o == nil { + return nil + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Resources) GetItemsOk() (*[]Resource, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *Resources) SetItems(v []Resource) { + o.Items = &v +} + +// HasItems returns a boolean if a field has been set. +func (o *Resources) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + + +func (o Resources) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullableResources struct { + value *Resources + isSet bool +} + +func (v NullableResources) Get() *Resources { + return v.value +} + +func (v *NullableResources) Set(val *Resources) { + v.value = val + v.isSet = true +} + +func (v NullableResources) IsSet() bool { + return v.isSet +} + +func (v *NullableResources) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableResources(val *Resources) *NullableResources { + return &NullableResources{value: val, isSet: true} +} + +func (v NullableResources) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableResources) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_resources_users.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_resources_users.go new file mode 100644 index 0000000000..d03b15884e --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_resources_users.go @@ -0,0 +1,235 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// ResourcesUsers Resources owned by a user. +type ResourcesUsers struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of the resource + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + // Array of items in that collection + Items *[]Resource `json:"items,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ResourcesUsers) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourcesUsers) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *ResourcesUsers) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *ResourcesUsers) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *ResourcesUsers) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourcesUsers) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *ResourcesUsers) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *ResourcesUsers) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ResourcesUsers) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourcesUsers) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *ResourcesUsers) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *ResourcesUsers) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []Resource will be returned +func (o *ResourcesUsers) GetItems() *[]Resource { + if o == nil { + return nil + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourcesUsers) GetItemsOk() (*[]Resource, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *ResourcesUsers) SetItems(v []Resource) { + o.Items = &v +} + +// HasItems returns a boolean if a field has been set. +func (o *ResourcesUsers) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + + +func (o ResourcesUsers) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullableResourcesUsers struct { + value *ResourcesUsers + isSet bool +} + +func (v NullableResourcesUsers) Get() *ResourcesUsers { + return v.value +} + +func (v *NullableResourcesUsers) Set(val *ResourcesUsers) { + v.value = val + v.isSet = true +} + +func (v NullableResourcesUsers) IsSet() bool { + return v.isSet +} + +func (v *NullableResourcesUsers) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableResourcesUsers(val *ResourcesUsers) *NullableResourcesUsers { + return &NullableResourcesUsers{value: val, isSet: true} +} + +func (v NullableResourcesUsers) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableResourcesUsers) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_s3_key.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_s3_key.go new file mode 100644 index 0000000000..fa8bfa5bce --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_s3_key.go @@ -0,0 +1,276 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// S3Key struct for S3Key +type S3Key struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of the resource + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + Metadata *S3KeyMetadata `json:"metadata,omitempty"` + Properties *S3KeyProperties `json:"properties"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *S3Key) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *S3Key) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *S3Key) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *S3Key) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *S3Key) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *S3Key) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *S3Key) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *S3Key) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *S3Key) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *S3Key) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *S3Key) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *S3Key) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for S3KeyMetadata will be returned +func (o *S3Key) GetMetadata() *S3KeyMetadata { + if o == nil { + return nil + } + + return o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *S3Key) GetMetadataOk() (*S3KeyMetadata, bool) { + if o == nil { + return nil, false + } + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *S3Key) SetMetadata(v S3KeyMetadata) { + o.Metadata = &v +} + +// HasMetadata returns a boolean if a field has been set. +func (o *S3Key) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + + + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for S3KeyProperties will be returned +func (o *S3Key) GetProperties() *S3KeyProperties { + if o == nil { + return nil + } + + return o.Properties +} + +// GetPropertiesOk returns a tuple with the Properties field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *S3Key) GetPropertiesOk() (*S3KeyProperties, bool) { + if o == nil { + return nil, false + } + return o.Properties, true +} + +// SetProperties sets field value +func (o *S3Key) SetProperties(v S3KeyProperties) { + o.Properties = &v +} + +// HasProperties returns a boolean if a field has been set. +func (o *S3Key) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + + +func (o S3Key) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + return json.Marshal(toSerialize) +} + +type NullableS3Key struct { + value *S3Key + isSet bool +} + +func (v NullableS3Key) Get() *S3Key { + return v.value +} + +func (v *NullableS3Key) Set(val *S3Key) { + v.value = val + v.isSet = true +} + +func (v NullableS3Key) IsSet() bool { + return v.isSet +} + +func (v *NullableS3Key) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableS3Key(val *S3Key) *NullableS3Key { + return &NullableS3Key{value: val, isSet: true} +} + +func (v NullableS3Key) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableS3Key) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_s3_key_metadata.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_s3_key_metadata.go new file mode 100644 index 0000000000..e4bd9409a2 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_s3_key_metadata.go @@ -0,0 +1,150 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" + "time" +) + +// S3KeyMetadata struct for S3KeyMetadata +type S3KeyMetadata struct { + // Resource's Entity Tag as defined in http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.11 . Entity Tag is also added as an 'ETag response header to requests which don't use 'depth' parameter. + Etag *string `json:"etag,omitempty"` + // The time the S3 key was created + CreatedDate *time.Time `json:"createdDate,omitempty"` +} + + + +// GetEtag returns the Etag field value +// If the value is explicit nil, the zero value for string will be returned +func (o *S3KeyMetadata) GetEtag() *string { + if o == nil { + return nil + } + + return o.Etag +} + +// GetEtagOk returns a tuple with the Etag field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *S3KeyMetadata) GetEtagOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Etag, true +} + +// SetEtag sets field value +func (o *S3KeyMetadata) SetEtag(v string) { + o.Etag = &v +} + +// HasEtag returns a boolean if a field has been set. +func (o *S3KeyMetadata) HasEtag() bool { + if o != nil && o.Etag != nil { + return true + } + + return false +} + + + +// GetCreatedDate returns the CreatedDate field value +// If the value is explicit nil, the zero value for time.Time will be returned +func (o *S3KeyMetadata) GetCreatedDate() *time.Time { + if o == nil { + return nil + } + + return o.CreatedDate +} + +// GetCreatedDateOk returns a tuple with the CreatedDate field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *S3KeyMetadata) GetCreatedDateOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.CreatedDate, true +} + +// SetCreatedDate sets field value +func (o *S3KeyMetadata) SetCreatedDate(v time.Time) { + o.CreatedDate = &v +} + +// HasCreatedDate returns a boolean if a field has been set. +func (o *S3KeyMetadata) HasCreatedDate() bool { + if o != nil && o.CreatedDate != nil { + return true + } + + return false +} + + +func (o S3KeyMetadata) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Etag != nil { + toSerialize["etag"] = o.Etag + } + + + if o.CreatedDate != nil { + toSerialize["createdDate"] = o.CreatedDate + } + + return json.Marshal(toSerialize) +} + +type NullableS3KeyMetadata struct { + value *S3KeyMetadata + isSet bool +} + +func (v NullableS3KeyMetadata) Get() *S3KeyMetadata { + return v.value +} + +func (v *NullableS3KeyMetadata) Set(val *S3KeyMetadata) { + v.value = val + v.isSet = true +} + +func (v NullableS3KeyMetadata) IsSet() bool { + return v.isSet +} + +func (v *NullableS3KeyMetadata) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableS3KeyMetadata(val *S3KeyMetadata) *NullableS3KeyMetadata { + return &NullableS3KeyMetadata{value: val, isSet: true} +} + +func (v NullableS3KeyMetadata) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableS3KeyMetadata) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_s3_key_properties.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_s3_key_properties.go new file mode 100644 index 0000000000..3bad61c2ca --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_s3_key_properties.go @@ -0,0 +1,149 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// S3KeyProperties struct for S3KeyProperties +type S3KeyProperties struct { + // secret of the s3 key + SecretKey *string `json:"secretKey,omitempty"` + // denotes if the s3 key is active or not + Active *bool `json:"active,omitempty"` +} + + + +// GetSecretKey returns the SecretKey field value +// If the value is explicit nil, the zero value for string will be returned +func (o *S3KeyProperties) GetSecretKey() *string { + if o == nil { + return nil + } + + return o.SecretKey +} + +// GetSecretKeyOk returns a tuple with the SecretKey field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *S3KeyProperties) GetSecretKeyOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.SecretKey, true +} + +// SetSecretKey sets field value +func (o *S3KeyProperties) SetSecretKey(v string) { + o.SecretKey = &v +} + +// HasSecretKey returns a boolean if a field has been set. +func (o *S3KeyProperties) HasSecretKey() bool { + if o != nil && o.SecretKey != nil { + return true + } + + return false +} + + + +// GetActive returns the Active field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *S3KeyProperties) GetActive() *bool { + if o == nil { + return nil + } + + return o.Active +} + +// GetActiveOk returns a tuple with the Active field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *S3KeyProperties) GetActiveOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.Active, true +} + +// SetActive sets field value +func (o *S3KeyProperties) SetActive(v bool) { + o.Active = &v +} + +// HasActive returns a boolean if a field has been set. +func (o *S3KeyProperties) HasActive() bool { + if o != nil && o.Active != nil { + return true + } + + return false +} + + +func (o S3KeyProperties) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.SecretKey != nil { + toSerialize["secretKey"] = o.SecretKey + } + + + if o.Active != nil { + toSerialize["active"] = o.Active + } + + return json.Marshal(toSerialize) +} + +type NullableS3KeyProperties struct { + value *S3KeyProperties + isSet bool +} + +func (v NullableS3KeyProperties) Get() *S3KeyProperties { + return v.value +} + +func (v *NullableS3KeyProperties) Set(val *S3KeyProperties) { + v.value = val + v.isSet = true +} + +func (v NullableS3KeyProperties) IsSet() bool { + return v.isSet +} + +func (v *NullableS3KeyProperties) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableS3KeyProperties(val *S3KeyProperties) *NullableS3KeyProperties { + return &NullableS3KeyProperties{value: val, isSet: true} +} + +func (v NullableS3KeyProperties) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableS3KeyProperties) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_s3_keys.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_s3_keys.go new file mode 100644 index 0000000000..7de5326596 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_s3_keys.go @@ -0,0 +1,235 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// S3Keys struct for S3Keys +type S3Keys struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of the resource + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + // Array of items in that collection + Items *[]S3Key `json:"items,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *S3Keys) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *S3Keys) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *S3Keys) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *S3Keys) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *S3Keys) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *S3Keys) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *S3Keys) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *S3Keys) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *S3Keys) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *S3Keys) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *S3Keys) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *S3Keys) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []S3Key will be returned +func (o *S3Keys) GetItems() *[]S3Key { + if o == nil { + return nil + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *S3Keys) GetItemsOk() (*[]S3Key, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *S3Keys) SetItems(v []S3Key) { + o.Items = &v +} + +// HasItems returns a boolean if a field has been set. +func (o *S3Keys) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + + +func (o S3Keys) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullableS3Keys struct { + value *S3Keys + isSet bool +} + +func (v NullableS3Keys) Get() *S3Keys { + return v.value +} + +func (v *NullableS3Keys) Set(val *S3Keys) { + v.value = val + v.isSet = true +} + +func (v NullableS3Keys) IsSet() bool { + return v.isSet +} + +func (v *NullableS3Keys) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableS3Keys(val *S3Keys) *NullableS3Keys { + return &NullableS3Keys{value: val, isSet: true} +} + +func (v NullableS3Keys) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableS3Keys) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_s3_object_storage_sso.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_s3_object_storage_sso.go new file mode 100644 index 0000000000..3139ecc7eb --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_s3_object_storage_sso.go @@ -0,0 +1,106 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// S3ObjectStorageSSO struct for S3ObjectStorageSSO +type S3ObjectStorageSSO struct { + // The S3 object storage single sign on url + SsoUrl *string `json:"ssoUrl,omitempty"` +} + + + +// GetSsoUrl returns the SsoUrl field value +// If the value is explicit nil, the zero value for string will be returned +func (o *S3ObjectStorageSSO) GetSsoUrl() *string { + if o == nil { + return nil + } + + return o.SsoUrl +} + +// GetSsoUrlOk returns a tuple with the SsoUrl field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *S3ObjectStorageSSO) GetSsoUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.SsoUrl, true +} + +// SetSsoUrl sets field value +func (o *S3ObjectStorageSSO) SetSsoUrl(v string) { + o.SsoUrl = &v +} + +// HasSsoUrl returns a boolean if a field has been set. +func (o *S3ObjectStorageSSO) HasSsoUrl() bool { + if o != nil && o.SsoUrl != nil { + return true + } + + return false +} + + +func (o S3ObjectStorageSSO) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.SsoUrl != nil { + toSerialize["ssoUrl"] = o.SsoUrl + } + + return json.Marshal(toSerialize) +} + +type NullableS3ObjectStorageSSO struct { + value *S3ObjectStorageSSO + isSet bool +} + +func (v NullableS3ObjectStorageSSO) Get() *S3ObjectStorageSSO { + return v.value +} + +func (v *NullableS3ObjectStorageSSO) Set(val *S3ObjectStorageSSO) { + v.value = val + v.isSet = true +} + +func (v NullableS3ObjectStorageSSO) IsSet() bool { + return v.isSet +} + +func (v *NullableS3ObjectStorageSSO) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableS3ObjectStorageSSO(val *S3ObjectStorageSSO) *NullableS3ObjectStorageSSO { + return &NullableS3ObjectStorageSSO{value: val, isSet: true} +} + +func (v NullableS3ObjectStorageSSO) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableS3ObjectStorageSSO) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_server.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_server.go new file mode 100644 index 0000000000..2373a6219c --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_server.go @@ -0,0 +1,318 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// Server struct for Server +type Server struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of object that has been created + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` + Properties *ServerProperties `json:"properties"` + Entities *ServerEntities `json:"entities,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Server) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Server) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *Server) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *Server) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *Server) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Server) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *Server) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *Server) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Server) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Server) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *Server) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *Server) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for DatacenterElementMetadata will be returned +func (o *Server) GetMetadata() *DatacenterElementMetadata { + if o == nil { + return nil + } + + return o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Server) GetMetadataOk() (*DatacenterElementMetadata, bool) { + if o == nil { + return nil, false + } + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *Server) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + +// HasMetadata returns a boolean if a field has been set. +func (o *Server) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + + + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for ServerProperties will be returned +func (o *Server) GetProperties() *ServerProperties { + if o == nil { + return nil + } + + return o.Properties +} + +// GetPropertiesOk returns a tuple with the Properties field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Server) GetPropertiesOk() (*ServerProperties, bool) { + if o == nil { + return nil, false + } + return o.Properties, true +} + +// SetProperties sets field value +func (o *Server) SetProperties(v ServerProperties) { + o.Properties = &v +} + +// HasProperties returns a boolean if a field has been set. +func (o *Server) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + + + +// GetEntities returns the Entities field value +// If the value is explicit nil, the zero value for ServerEntities will be returned +func (o *Server) GetEntities() *ServerEntities { + if o == nil { + return nil + } + + return o.Entities +} + +// GetEntitiesOk returns a tuple with the Entities field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Server) GetEntitiesOk() (*ServerEntities, bool) { + if o == nil { + return nil, false + } + return o.Entities, true +} + +// SetEntities sets field value +func (o *Server) SetEntities(v ServerEntities) { + o.Entities = &v +} + +// HasEntities returns a boolean if a field has been set. +func (o *Server) HasEntities() bool { + if o != nil && o.Entities != nil { + return true + } + + return false +} + + +func (o Server) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + + if o.Entities != nil { + toSerialize["entities"] = o.Entities + } + + return json.Marshal(toSerialize) +} + +type NullableServer struct { + value *Server + isSet bool +} + +func (v NullableServer) Get() *Server { + return v.value +} + +func (v *NullableServer) Set(val *Server) { + v.value = val + v.isSet = true +} + +func (v NullableServer) IsSet() bool { + return v.isSet +} + +func (v *NullableServer) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServer(val *Server) *NullableServer { + return &NullableServer{value: val, isSet: true} +} + +func (v NullableServer) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServer) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_server_entities.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_server_entities.go new file mode 100644 index 0000000000..7fc54192c3 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_server_entities.go @@ -0,0 +1,189 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// ServerEntities struct for ServerEntities +type ServerEntities struct { + Cdroms *Cdroms `json:"cdroms,omitempty"` + Volumes *AttachedVolumes `json:"volumes,omitempty"` + Nics *Nics `json:"nics,omitempty"` +} + + + +// GetCdroms returns the Cdroms field value +// If the value is explicit nil, the zero value for Cdroms will be returned +func (o *ServerEntities) GetCdroms() *Cdroms { + if o == nil { + return nil + } + + return o.Cdroms +} + +// GetCdromsOk returns a tuple with the Cdroms field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ServerEntities) GetCdromsOk() (*Cdroms, bool) { + if o == nil { + return nil, false + } + return o.Cdroms, true +} + +// SetCdroms sets field value +func (o *ServerEntities) SetCdroms(v Cdroms) { + o.Cdroms = &v +} + +// HasCdroms returns a boolean if a field has been set. +func (o *ServerEntities) HasCdroms() bool { + if o != nil && o.Cdroms != nil { + return true + } + + return false +} + + + +// GetVolumes returns the Volumes field value +// If the value is explicit nil, the zero value for AttachedVolumes will be returned +func (o *ServerEntities) GetVolumes() *AttachedVolumes { + if o == nil { + return nil + } + + return o.Volumes +} + +// GetVolumesOk returns a tuple with the Volumes field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ServerEntities) GetVolumesOk() (*AttachedVolumes, bool) { + if o == nil { + return nil, false + } + return o.Volumes, true +} + +// SetVolumes sets field value +func (o *ServerEntities) SetVolumes(v AttachedVolumes) { + o.Volumes = &v +} + +// HasVolumes returns a boolean if a field has been set. +func (o *ServerEntities) HasVolumes() bool { + if o != nil && o.Volumes != nil { + return true + } + + return false +} + + + +// GetNics returns the Nics field value +// If the value is explicit nil, the zero value for Nics will be returned +func (o *ServerEntities) GetNics() *Nics { + if o == nil { + return nil + } + + return o.Nics +} + +// GetNicsOk returns a tuple with the Nics field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ServerEntities) GetNicsOk() (*Nics, bool) { + if o == nil { + return nil, false + } + return o.Nics, true +} + +// SetNics sets field value +func (o *ServerEntities) SetNics(v Nics) { + o.Nics = &v +} + +// HasNics returns a boolean if a field has been set. +func (o *ServerEntities) HasNics() bool { + if o != nil && o.Nics != nil { + return true + } + + return false +} + + +func (o ServerEntities) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Cdroms != nil { + toSerialize["cdroms"] = o.Cdroms + } + + + if o.Volumes != nil { + toSerialize["volumes"] = o.Volumes + } + + + if o.Nics != nil { + toSerialize["nics"] = o.Nics + } + + return json.Marshal(toSerialize) +} + +type NullableServerEntities struct { + value *ServerEntities + isSet bool +} + +func (v NullableServerEntities) Get() *ServerEntities { + return v.value +} + +func (v *NullableServerEntities) Set(val *ServerEntities) { + v.value = val + v.isSet = true +} + +func (v NullableServerEntities) IsSet() bool { + return v.isSet +} + +func (v *NullableServerEntities) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServerEntities(val *ServerEntities) *NullableServerEntities { + return &NullableServerEntities{value: val, isSet: true} +} + +func (v NullableServerEntities) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServerEntities) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_server_properties.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_server_properties.go new file mode 100644 index 0000000000..e24d6ea68e --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_server_properties.go @@ -0,0 +1,405 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// ServerProperties struct for ServerProperties +type ServerProperties struct { + // A name of that resource + Name *string `json:"name,omitempty"` + // The total number of cores for the server + Cores *int32 `json:"cores"` + // The amount of memory for the server in MB, e.g. 2048. Size must be specified in multiples of 256 MB with a minimum of 256 MB; however, if you set ramHotPlug to TRUE then you must use a minimum of 1024 MB. If you set the RAM size more than 240GB, then ramHotPlug will be set to FALSE and can not be set to TRUE unless RAM size not set to less than 240GB. + Ram *int32 `json:"ram"` + // The availability zone in which the server should exist + AvailabilityZone *string `json:"availabilityZone,omitempty"` + // Status of the virtual Machine + VmState *string `json:"vmState,omitempty"` + BootCdrom *ResourceReference `json:"bootCdrom,omitempty"` + BootVolume *ResourceReference `json:"bootVolume,omitempty"` + // Cpu family of pserver + CpuFamily *string `json:"cpuFamily,omitempty"` +} + + + +// GetName returns the Name field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ServerProperties) GetName() *string { + if o == nil { + return nil + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ServerProperties) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name, true +} + +// SetName sets field value +func (o *ServerProperties) SetName(v string) { + o.Name = &v +} + +// HasName returns a boolean if a field has been set. +func (o *ServerProperties) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + + + +// GetCores returns the Cores field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *ServerProperties) GetCores() *int32 { + if o == nil { + return nil + } + + return o.Cores +} + +// GetCoresOk returns a tuple with the Cores field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ServerProperties) GetCoresOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.Cores, true +} + +// SetCores sets field value +func (o *ServerProperties) SetCores(v int32) { + o.Cores = &v +} + +// HasCores returns a boolean if a field has been set. +func (o *ServerProperties) HasCores() bool { + if o != nil && o.Cores != nil { + return true + } + + return false +} + + + +// GetRam returns the Ram field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *ServerProperties) GetRam() *int32 { + if o == nil { + return nil + } + + return o.Ram +} + +// GetRamOk returns a tuple with the Ram field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ServerProperties) GetRamOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.Ram, true +} + +// SetRam sets field value +func (o *ServerProperties) SetRam(v int32) { + o.Ram = &v +} + +// HasRam returns a boolean if a field has been set. +func (o *ServerProperties) HasRam() bool { + if o != nil && o.Ram != nil { + return true + } + + return false +} + + + +// GetAvailabilityZone returns the AvailabilityZone field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ServerProperties) GetAvailabilityZone() *string { + if o == nil { + return nil + } + + return o.AvailabilityZone +} + +// GetAvailabilityZoneOk returns a tuple with the AvailabilityZone field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ServerProperties) GetAvailabilityZoneOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.AvailabilityZone, true +} + +// SetAvailabilityZone sets field value +func (o *ServerProperties) SetAvailabilityZone(v string) { + o.AvailabilityZone = &v +} + +// HasAvailabilityZone returns a boolean if a field has been set. +func (o *ServerProperties) HasAvailabilityZone() bool { + if o != nil && o.AvailabilityZone != nil { + return true + } + + return false +} + + + +// GetVmState returns the VmState field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ServerProperties) GetVmState() *string { + if o == nil { + return nil + } + + return o.VmState +} + +// GetVmStateOk returns a tuple with the VmState field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ServerProperties) GetVmStateOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.VmState, true +} + +// SetVmState sets field value +func (o *ServerProperties) SetVmState(v string) { + o.VmState = &v +} + +// HasVmState returns a boolean if a field has been set. +func (o *ServerProperties) HasVmState() bool { + if o != nil && o.VmState != nil { + return true + } + + return false +} + + + +// GetBootCdrom returns the BootCdrom field value +// If the value is explicit nil, the zero value for ResourceReference will be returned +func (o *ServerProperties) GetBootCdrom() *ResourceReference { + if o == nil { + return nil + } + + return o.BootCdrom +} + +// GetBootCdromOk returns a tuple with the BootCdrom field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ServerProperties) GetBootCdromOk() (*ResourceReference, bool) { + if o == nil { + return nil, false + } + return o.BootCdrom, true +} + +// SetBootCdrom sets field value +func (o *ServerProperties) SetBootCdrom(v ResourceReference) { + o.BootCdrom = &v +} + +// HasBootCdrom returns a boolean if a field has been set. +func (o *ServerProperties) HasBootCdrom() bool { + if o != nil && o.BootCdrom != nil { + return true + } + + return false +} + + + +// GetBootVolume returns the BootVolume field value +// If the value is explicit nil, the zero value for ResourceReference will be returned +func (o *ServerProperties) GetBootVolume() *ResourceReference { + if o == nil { + return nil + } + + return o.BootVolume +} + +// GetBootVolumeOk returns a tuple with the BootVolume field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ServerProperties) GetBootVolumeOk() (*ResourceReference, bool) { + if o == nil { + return nil, false + } + return o.BootVolume, true +} + +// SetBootVolume sets field value +func (o *ServerProperties) SetBootVolume(v ResourceReference) { + o.BootVolume = &v +} + +// HasBootVolume returns a boolean if a field has been set. +func (o *ServerProperties) HasBootVolume() bool { + if o != nil && o.BootVolume != nil { + return true + } + + return false +} + + + +// GetCpuFamily returns the CpuFamily field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ServerProperties) GetCpuFamily() *string { + if o == nil { + return nil + } + + return o.CpuFamily +} + +// GetCpuFamilyOk returns a tuple with the CpuFamily field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ServerProperties) GetCpuFamilyOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.CpuFamily, true +} + +// SetCpuFamily sets field value +func (o *ServerProperties) SetCpuFamily(v string) { + o.CpuFamily = &v +} + +// HasCpuFamily returns a boolean if a field has been set. +func (o *ServerProperties) HasCpuFamily() bool { + if o != nil && o.CpuFamily != nil { + return true + } + + return false +} + + +func (o ServerProperties) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Name != nil { + toSerialize["name"] = o.Name + } + + + if o.Cores != nil { + toSerialize["cores"] = o.Cores + } + + + if o.Ram != nil { + toSerialize["ram"] = o.Ram + } + + + if o.AvailabilityZone != nil { + toSerialize["availabilityZone"] = o.AvailabilityZone + } + + + if o.VmState != nil { + toSerialize["vmState"] = o.VmState + } + + + if o.BootCdrom != nil { + toSerialize["bootCdrom"] = o.BootCdrom + } + + + if o.BootVolume != nil { + toSerialize["bootVolume"] = o.BootVolume + } + + + if o.CpuFamily != nil { + toSerialize["cpuFamily"] = o.CpuFamily + } + + return json.Marshal(toSerialize) +} + +type NullableServerProperties struct { + value *ServerProperties + isSet bool +} + +func (v NullableServerProperties) Get() *ServerProperties { + return v.value +} + +func (v *NullableServerProperties) Set(val *ServerProperties) { + v.value = val + v.isSet = true +} + +func (v NullableServerProperties) IsSet() bool { + return v.isSet +} + +func (v *NullableServerProperties) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServerProperties(val *ServerProperties) *NullableServerProperties { + return &NullableServerProperties{value: val, isSet: true} +} + +func (v NullableServerProperties) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServerProperties) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_servers.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_servers.go new file mode 100644 index 0000000000..0d0c3d24c6 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_servers.go @@ -0,0 +1,235 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// Servers struct for Servers +type Servers struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of object that has been created + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + // Array of items in that collection + Items *[]Server `json:"items,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Servers) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Servers) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *Servers) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *Servers) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *Servers) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Servers) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *Servers) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *Servers) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Servers) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Servers) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *Servers) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *Servers) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []Server will be returned +func (o *Servers) GetItems() *[]Server { + if o == nil { + return nil + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Servers) GetItemsOk() (*[]Server, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *Servers) SetItems(v []Server) { + o.Items = &v +} + +// HasItems returns a boolean if a field has been set. +func (o *Servers) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + + +func (o Servers) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullableServers struct { + value *Servers + isSet bool +} + +func (v NullableServers) Get() *Servers { + return v.value +} + +func (v *NullableServers) Set(val *Servers) { + v.value = val + v.isSet = true +} + +func (v NullableServers) IsSet() bool { + return v.isSet +} + +func (v *NullableServers) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServers(val *Servers) *NullableServers { + return &NullableServers{value: val, isSet: true} +} + +func (v NullableServers) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServers) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_snapshot.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_snapshot.go new file mode 100644 index 0000000000..15efa7ea08 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_snapshot.go @@ -0,0 +1,276 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// Snapshot struct for Snapshot +type Snapshot struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of object that has been created + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` + Properties *SnapshotProperties `json:"properties"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Snapshot) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Snapshot) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *Snapshot) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *Snapshot) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *Snapshot) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Snapshot) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *Snapshot) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *Snapshot) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Snapshot) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Snapshot) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *Snapshot) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *Snapshot) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for DatacenterElementMetadata will be returned +func (o *Snapshot) GetMetadata() *DatacenterElementMetadata { + if o == nil { + return nil + } + + return o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Snapshot) GetMetadataOk() (*DatacenterElementMetadata, bool) { + if o == nil { + return nil, false + } + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *Snapshot) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + +// HasMetadata returns a boolean if a field has been set. +func (o *Snapshot) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + + + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for SnapshotProperties will be returned +func (o *Snapshot) GetProperties() *SnapshotProperties { + if o == nil { + return nil + } + + return o.Properties +} + +// GetPropertiesOk returns a tuple with the Properties field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Snapshot) GetPropertiesOk() (*SnapshotProperties, bool) { + if o == nil { + return nil, false + } + return o.Properties, true +} + +// SetProperties sets field value +func (o *Snapshot) SetProperties(v SnapshotProperties) { + o.Properties = &v +} + +// HasProperties returns a boolean if a field has been set. +func (o *Snapshot) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + + +func (o Snapshot) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + return json.Marshal(toSerialize) +} + +type NullableSnapshot struct { + value *Snapshot + isSet bool +} + +func (v NullableSnapshot) Get() *Snapshot { + return v.value +} + +func (v *NullableSnapshot) Set(val *Snapshot) { + v.value = val + v.isSet = true +} + +func (v NullableSnapshot) IsSet() bool { + return v.isSet +} + +func (v *NullableSnapshot) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSnapshot(val *Snapshot) *NullableSnapshot { + return &NullableSnapshot{value: val, isSet: true} +} + +func (v NullableSnapshot) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSnapshot) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_snapshot_properties.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_snapshot_properties.go new file mode 100644 index 0000000000..90f729b960 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_snapshot_properties.go @@ -0,0 +1,751 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// SnapshotProperties struct for SnapshotProperties +type SnapshotProperties struct { + // A name of that resource + Name *string `json:"name,omitempty"` + // Human readable description + Description *string `json:"description,omitempty"` + // Location of that image/snapshot. + Location *string `json:"location,omitempty"` + // The size of the image in GB + Size *float32 `json:"size,omitempty"` + // Boolean value representing if the snapshot requires extra protection e.g. two factor protection + SecAuthProtection *bool `json:"secAuthProtection,omitempty"` + // Is capable of CPU hot plug (no reboot required) + CpuHotPlug *bool `json:"cpuHotPlug,omitempty"` + // Is capable of CPU hot unplug (no reboot required) + CpuHotUnplug *bool `json:"cpuHotUnplug,omitempty"` + // Is capable of memory hot plug (no reboot required) + RamHotPlug *bool `json:"ramHotPlug,omitempty"` + // Is capable of memory hot unplug (no reboot required) + RamHotUnplug *bool `json:"ramHotUnplug,omitempty"` + // Is capable of nic hot plug (no reboot required) + NicHotPlug *bool `json:"nicHotPlug,omitempty"` + // Is capable of nic hot unplug (no reboot required) + NicHotUnplug *bool `json:"nicHotUnplug,omitempty"` + // Is capable of Virt-IO drive hot plug (no reboot required) + DiscVirtioHotPlug *bool `json:"discVirtioHotPlug,omitempty"` + // Is capable of Virt-IO drive hot unplug (no reboot required). This works only for non-Windows virtual Machines. + DiscVirtioHotUnplug *bool `json:"discVirtioHotUnplug,omitempty"` + // Is capable of SCSI drive hot plug (no reboot required) + DiscScsiHotPlug *bool `json:"discScsiHotPlug,omitempty"` + // Is capable of SCSI drive hot unplug (no reboot required). This works only for non-Windows virtual Machines. + DiscScsiHotUnplug *bool `json:"discScsiHotUnplug,omitempty"` + // OS type of this Snapshot + LicenceType *string `json:"licenceType,omitempty"` +} + + + +// GetName returns the Name field value +// If the value is explicit nil, the zero value for string will be returned +func (o *SnapshotProperties) GetName() *string { + if o == nil { + return nil + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *SnapshotProperties) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name, true +} + +// SetName sets field value +func (o *SnapshotProperties) SetName(v string) { + o.Name = &v +} + +// HasName returns a boolean if a field has been set. +func (o *SnapshotProperties) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + + + +// GetDescription returns the Description field value +// If the value is explicit nil, the zero value for string will be returned +func (o *SnapshotProperties) GetDescription() *string { + if o == nil { + return nil + } + + return o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *SnapshotProperties) GetDescriptionOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Description, true +} + +// SetDescription sets field value +func (o *SnapshotProperties) SetDescription(v string) { + o.Description = &v +} + +// HasDescription returns a boolean if a field has been set. +func (o *SnapshotProperties) HasDescription() bool { + if o != nil && o.Description != nil { + return true + } + + return false +} + + + +// GetLocation returns the Location field value +// If the value is explicit nil, the zero value for string will be returned +func (o *SnapshotProperties) GetLocation() *string { + if o == nil { + return nil + } + + return o.Location +} + +// GetLocationOk returns a tuple with the Location field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *SnapshotProperties) GetLocationOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Location, true +} + +// SetLocation sets field value +func (o *SnapshotProperties) SetLocation(v string) { + o.Location = &v +} + +// HasLocation returns a boolean if a field has been set. +func (o *SnapshotProperties) HasLocation() bool { + if o != nil && o.Location != nil { + return true + } + + return false +} + + + +// GetSize returns the Size field value +// If the value is explicit nil, the zero value for float32 will be returned +func (o *SnapshotProperties) GetSize() *float32 { + if o == nil { + return nil + } + + return o.Size +} + +// GetSizeOk returns a tuple with the Size field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *SnapshotProperties) GetSizeOk() (*float32, bool) { + if o == nil { + return nil, false + } + return o.Size, true +} + +// SetSize sets field value +func (o *SnapshotProperties) SetSize(v float32) { + o.Size = &v +} + +// HasSize returns a boolean if a field has been set. +func (o *SnapshotProperties) HasSize() bool { + if o != nil && o.Size != nil { + return true + } + + return false +} + + + +// GetSecAuthProtection returns the SecAuthProtection field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *SnapshotProperties) GetSecAuthProtection() *bool { + if o == nil { + return nil + } + + return o.SecAuthProtection +} + +// GetSecAuthProtectionOk returns a tuple with the SecAuthProtection field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *SnapshotProperties) GetSecAuthProtectionOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.SecAuthProtection, true +} + +// SetSecAuthProtection sets field value +func (o *SnapshotProperties) SetSecAuthProtection(v bool) { + o.SecAuthProtection = &v +} + +// HasSecAuthProtection returns a boolean if a field has been set. +func (o *SnapshotProperties) HasSecAuthProtection() bool { + if o != nil && o.SecAuthProtection != nil { + return true + } + + return false +} + + + +// GetCpuHotPlug returns the CpuHotPlug field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *SnapshotProperties) GetCpuHotPlug() *bool { + if o == nil { + return nil + } + + return o.CpuHotPlug +} + +// GetCpuHotPlugOk returns a tuple with the CpuHotPlug field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *SnapshotProperties) GetCpuHotPlugOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.CpuHotPlug, true +} + +// SetCpuHotPlug sets field value +func (o *SnapshotProperties) SetCpuHotPlug(v bool) { + o.CpuHotPlug = &v +} + +// HasCpuHotPlug returns a boolean if a field has been set. +func (o *SnapshotProperties) HasCpuHotPlug() bool { + if o != nil && o.CpuHotPlug != nil { + return true + } + + return false +} + + + +// GetCpuHotUnplug returns the CpuHotUnplug field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *SnapshotProperties) GetCpuHotUnplug() *bool { + if o == nil { + return nil + } + + return o.CpuHotUnplug +} + +// GetCpuHotUnplugOk returns a tuple with the CpuHotUnplug field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *SnapshotProperties) GetCpuHotUnplugOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.CpuHotUnplug, true +} + +// SetCpuHotUnplug sets field value +func (o *SnapshotProperties) SetCpuHotUnplug(v bool) { + o.CpuHotUnplug = &v +} + +// HasCpuHotUnplug returns a boolean if a field has been set. +func (o *SnapshotProperties) HasCpuHotUnplug() bool { + if o != nil && o.CpuHotUnplug != nil { + return true + } + + return false +} + + + +// GetRamHotPlug returns the RamHotPlug field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *SnapshotProperties) GetRamHotPlug() *bool { + if o == nil { + return nil + } + + return o.RamHotPlug +} + +// GetRamHotPlugOk returns a tuple with the RamHotPlug field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *SnapshotProperties) GetRamHotPlugOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.RamHotPlug, true +} + +// SetRamHotPlug sets field value +func (o *SnapshotProperties) SetRamHotPlug(v bool) { + o.RamHotPlug = &v +} + +// HasRamHotPlug returns a boolean if a field has been set. +func (o *SnapshotProperties) HasRamHotPlug() bool { + if o != nil && o.RamHotPlug != nil { + return true + } + + return false +} + + + +// GetRamHotUnplug returns the RamHotUnplug field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *SnapshotProperties) GetRamHotUnplug() *bool { + if o == nil { + return nil + } + + return o.RamHotUnplug +} + +// GetRamHotUnplugOk returns a tuple with the RamHotUnplug field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *SnapshotProperties) GetRamHotUnplugOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.RamHotUnplug, true +} + +// SetRamHotUnplug sets field value +func (o *SnapshotProperties) SetRamHotUnplug(v bool) { + o.RamHotUnplug = &v +} + +// HasRamHotUnplug returns a boolean if a field has been set. +func (o *SnapshotProperties) HasRamHotUnplug() bool { + if o != nil && o.RamHotUnplug != nil { + return true + } + + return false +} + + + +// GetNicHotPlug returns the NicHotPlug field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *SnapshotProperties) GetNicHotPlug() *bool { + if o == nil { + return nil + } + + return o.NicHotPlug +} + +// GetNicHotPlugOk returns a tuple with the NicHotPlug field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *SnapshotProperties) GetNicHotPlugOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.NicHotPlug, true +} + +// SetNicHotPlug sets field value +func (o *SnapshotProperties) SetNicHotPlug(v bool) { + o.NicHotPlug = &v +} + +// HasNicHotPlug returns a boolean if a field has been set. +func (o *SnapshotProperties) HasNicHotPlug() bool { + if o != nil && o.NicHotPlug != nil { + return true + } + + return false +} + + + +// GetNicHotUnplug returns the NicHotUnplug field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *SnapshotProperties) GetNicHotUnplug() *bool { + if o == nil { + return nil + } + + return o.NicHotUnplug +} + +// GetNicHotUnplugOk returns a tuple with the NicHotUnplug field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *SnapshotProperties) GetNicHotUnplugOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.NicHotUnplug, true +} + +// SetNicHotUnplug sets field value +func (o *SnapshotProperties) SetNicHotUnplug(v bool) { + o.NicHotUnplug = &v +} + +// HasNicHotUnplug returns a boolean if a field has been set. +func (o *SnapshotProperties) HasNicHotUnplug() bool { + if o != nil && o.NicHotUnplug != nil { + return true + } + + return false +} + + + +// GetDiscVirtioHotPlug returns the DiscVirtioHotPlug field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *SnapshotProperties) GetDiscVirtioHotPlug() *bool { + if o == nil { + return nil + } + + return o.DiscVirtioHotPlug +} + +// GetDiscVirtioHotPlugOk returns a tuple with the DiscVirtioHotPlug field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *SnapshotProperties) GetDiscVirtioHotPlugOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.DiscVirtioHotPlug, true +} + +// SetDiscVirtioHotPlug sets field value +func (o *SnapshotProperties) SetDiscVirtioHotPlug(v bool) { + o.DiscVirtioHotPlug = &v +} + +// HasDiscVirtioHotPlug returns a boolean if a field has been set. +func (o *SnapshotProperties) HasDiscVirtioHotPlug() bool { + if o != nil && o.DiscVirtioHotPlug != nil { + return true + } + + return false +} + + + +// GetDiscVirtioHotUnplug returns the DiscVirtioHotUnplug field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *SnapshotProperties) GetDiscVirtioHotUnplug() *bool { + if o == nil { + return nil + } + + return o.DiscVirtioHotUnplug +} + +// GetDiscVirtioHotUnplugOk returns a tuple with the DiscVirtioHotUnplug field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *SnapshotProperties) GetDiscVirtioHotUnplugOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.DiscVirtioHotUnplug, true +} + +// SetDiscVirtioHotUnplug sets field value +func (o *SnapshotProperties) SetDiscVirtioHotUnplug(v bool) { + o.DiscVirtioHotUnplug = &v +} + +// HasDiscVirtioHotUnplug returns a boolean if a field has been set. +func (o *SnapshotProperties) HasDiscVirtioHotUnplug() bool { + if o != nil && o.DiscVirtioHotUnplug != nil { + return true + } + + return false +} + + + +// GetDiscScsiHotPlug returns the DiscScsiHotPlug field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *SnapshotProperties) GetDiscScsiHotPlug() *bool { + if o == nil { + return nil + } + + return o.DiscScsiHotPlug +} + +// GetDiscScsiHotPlugOk returns a tuple with the DiscScsiHotPlug field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *SnapshotProperties) GetDiscScsiHotPlugOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.DiscScsiHotPlug, true +} + +// SetDiscScsiHotPlug sets field value +func (o *SnapshotProperties) SetDiscScsiHotPlug(v bool) { + o.DiscScsiHotPlug = &v +} + +// HasDiscScsiHotPlug returns a boolean if a field has been set. +func (o *SnapshotProperties) HasDiscScsiHotPlug() bool { + if o != nil && o.DiscScsiHotPlug != nil { + return true + } + + return false +} + + + +// GetDiscScsiHotUnplug returns the DiscScsiHotUnplug field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *SnapshotProperties) GetDiscScsiHotUnplug() *bool { + if o == nil { + return nil + } + + return o.DiscScsiHotUnplug +} + +// GetDiscScsiHotUnplugOk returns a tuple with the DiscScsiHotUnplug field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *SnapshotProperties) GetDiscScsiHotUnplugOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.DiscScsiHotUnplug, true +} + +// SetDiscScsiHotUnplug sets field value +func (o *SnapshotProperties) SetDiscScsiHotUnplug(v bool) { + o.DiscScsiHotUnplug = &v +} + +// HasDiscScsiHotUnplug returns a boolean if a field has been set. +func (o *SnapshotProperties) HasDiscScsiHotUnplug() bool { + if o != nil && o.DiscScsiHotUnplug != nil { + return true + } + + return false +} + + + +// GetLicenceType returns the LicenceType field value +// If the value is explicit nil, the zero value for string will be returned +func (o *SnapshotProperties) GetLicenceType() *string { + if o == nil { + return nil + } + + return o.LicenceType +} + +// GetLicenceTypeOk returns a tuple with the LicenceType field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *SnapshotProperties) GetLicenceTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.LicenceType, true +} + +// SetLicenceType sets field value +func (o *SnapshotProperties) SetLicenceType(v string) { + o.LicenceType = &v +} + +// HasLicenceType returns a boolean if a field has been set. +func (o *SnapshotProperties) HasLicenceType() bool { + if o != nil && o.LicenceType != nil { + return true + } + + return false +} + + +func (o SnapshotProperties) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Name != nil { + toSerialize["name"] = o.Name + } + + + if o.Description != nil { + toSerialize["description"] = o.Description + } + + + if o.Location != nil { + toSerialize["location"] = o.Location + } + + + if o.Size != nil { + toSerialize["size"] = o.Size + } + + + if o.SecAuthProtection != nil { + toSerialize["secAuthProtection"] = o.SecAuthProtection + } + + + if o.CpuHotPlug != nil { + toSerialize["cpuHotPlug"] = o.CpuHotPlug + } + + + if o.CpuHotUnplug != nil { + toSerialize["cpuHotUnplug"] = o.CpuHotUnplug + } + + + if o.RamHotPlug != nil { + toSerialize["ramHotPlug"] = o.RamHotPlug + } + + + if o.RamHotUnplug != nil { + toSerialize["ramHotUnplug"] = o.RamHotUnplug + } + + + if o.NicHotPlug != nil { + toSerialize["nicHotPlug"] = o.NicHotPlug + } + + + if o.NicHotUnplug != nil { + toSerialize["nicHotUnplug"] = o.NicHotUnplug + } + + + if o.DiscVirtioHotPlug != nil { + toSerialize["discVirtioHotPlug"] = o.DiscVirtioHotPlug + } + + + if o.DiscVirtioHotUnplug != nil { + toSerialize["discVirtioHotUnplug"] = o.DiscVirtioHotUnplug + } + + + if o.DiscScsiHotPlug != nil { + toSerialize["discScsiHotPlug"] = o.DiscScsiHotPlug + } + + + if o.DiscScsiHotUnplug != nil { + toSerialize["discScsiHotUnplug"] = o.DiscScsiHotUnplug + } + + + if o.LicenceType != nil { + toSerialize["licenceType"] = o.LicenceType + } + + return json.Marshal(toSerialize) +} + +type NullableSnapshotProperties struct { + value *SnapshotProperties + isSet bool +} + +func (v NullableSnapshotProperties) Get() *SnapshotProperties { + return v.value +} + +func (v *NullableSnapshotProperties) Set(val *SnapshotProperties) { + v.value = val + v.isSet = true +} + +func (v NullableSnapshotProperties) IsSet() bool { + return v.isSet +} + +func (v *NullableSnapshotProperties) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSnapshotProperties(val *SnapshotProperties) *NullableSnapshotProperties { + return &NullableSnapshotProperties{value: val, isSet: true} +} + +func (v NullableSnapshotProperties) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSnapshotProperties) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_snapshots.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_snapshots.go new file mode 100644 index 0000000000..e40e5784b1 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_snapshots.go @@ -0,0 +1,235 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// Snapshots struct for Snapshots +type Snapshots struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of object that has been created + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + // Array of items in that collection + Items *[]Snapshot `json:"items,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Snapshots) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Snapshots) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *Snapshots) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *Snapshots) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *Snapshots) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Snapshots) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *Snapshots) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *Snapshots) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Snapshots) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Snapshots) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *Snapshots) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *Snapshots) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []Snapshot will be returned +func (o *Snapshots) GetItems() *[]Snapshot { + if o == nil { + return nil + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Snapshots) GetItemsOk() (*[]Snapshot, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *Snapshots) SetItems(v []Snapshot) { + o.Items = &v +} + +// HasItems returns a boolean if a field has been set. +func (o *Snapshots) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + + +func (o Snapshots) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullableSnapshots struct { + value *Snapshots + isSet bool +} + +func (v NullableSnapshots) Get() *Snapshots { + return v.value +} + +func (v *NullableSnapshots) Set(val *Snapshots) { + v.value = val + v.isSet = true +} + +func (v NullableSnapshots) IsSet() bool { + return v.isSet +} + +func (v *NullableSnapshots) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSnapshots(val *Snapshots) *NullableSnapshots { + return &NullableSnapshots{value: val, isSet: true} +} + +func (v NullableSnapshots) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSnapshots) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_type.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_type.go new file mode 100644 index 0000000000..d67ee7995c --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_type.go @@ -0,0 +1,106 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" + "fmt" +) + +// Type the model 'Type' +type Type string + +// List of Type +const ( + DATACENTER Type = "datacenter" + SERVER Type = "server" + VOLUME Type = "volume" + NIC Type = "nic" + LOADBALANCER Type = "loadbalancer" + LOCATION Type = "location" + FIREWALL_RULE Type = "firewall-rule" + IMAGE Type = "image" + SNAPSHOT Type = "snapshot" + LAN Type = "lan" + IPBLOCK Type = "ipblock" + PCC Type = "pcc" + CONTRACT Type = "contract" + USER Type = "user" + GROUP Type = "group" + COLLECTION Type = "collection" + RESOURCE Type = "resource" + REQUEST Type = "request" + REQUEST_STATUS Type = "request-status" + S3KEY Type = "s3key" + BACKUPUNIT Type = "backupunit" + LABEL Type = "label" + K8S Type = "k8s" + NODEPOOL Type = "nodepool" +) + +func (v *Type) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := Type(value) + for _, existing := range []Type{ "datacenter", "server", "volume", "nic", "loadbalancer", "location", "firewall-rule", "image", "snapshot", "lan", "ipblock", "pcc", "contract", "user", "group", "collection", "resource", "request", "request-status", "s3key", "backupunit", "label", "k8s", "nodepool", } { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Type", value) +} + +// Ptr returns reference to Type value +func (v Type) Ptr() *Type { + return &v +} + +type NullableType struct { + value *Type + isSet bool +} + +func (v NullableType) Get() *Type { + return v.value +} + +func (v *NullableType) Set(val *Type) { + v.value = val + v.isSet = true +} + +func (v NullableType) IsSet() bool { + return v.isSet +} + +func (v *NullableType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableType(val *Type) *NullableType { + return &NullableType{value: val, isSet: true} +} + +func (v NullableType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_user.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_user.go new file mode 100644 index 0000000000..b4b195472d --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_user.go @@ -0,0 +1,318 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// User struct for User +type User struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of object that has been created + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + Metadata *UserMetadata `json:"metadata,omitempty"` + Properties *UserProperties `json:"properties"` + Entities *UsersEntities `json:"entities,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *User) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *User) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *User) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *User) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *User) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *User) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *User) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *User) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *User) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *User) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *User) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *User) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for UserMetadata will be returned +func (o *User) GetMetadata() *UserMetadata { + if o == nil { + return nil + } + + return o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *User) GetMetadataOk() (*UserMetadata, bool) { + if o == nil { + return nil, false + } + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *User) SetMetadata(v UserMetadata) { + o.Metadata = &v +} + +// HasMetadata returns a boolean if a field has been set. +func (o *User) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + + + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for UserProperties will be returned +func (o *User) GetProperties() *UserProperties { + if o == nil { + return nil + } + + return o.Properties +} + +// GetPropertiesOk returns a tuple with the Properties field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *User) GetPropertiesOk() (*UserProperties, bool) { + if o == nil { + return nil, false + } + return o.Properties, true +} + +// SetProperties sets field value +func (o *User) SetProperties(v UserProperties) { + o.Properties = &v +} + +// HasProperties returns a boolean if a field has been set. +func (o *User) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + + + +// GetEntities returns the Entities field value +// If the value is explicit nil, the zero value for UsersEntities will be returned +func (o *User) GetEntities() *UsersEntities { + if o == nil { + return nil + } + + return o.Entities +} + +// GetEntitiesOk returns a tuple with the Entities field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *User) GetEntitiesOk() (*UsersEntities, bool) { + if o == nil { + return nil, false + } + return o.Entities, true +} + +// SetEntities sets field value +func (o *User) SetEntities(v UsersEntities) { + o.Entities = &v +} + +// HasEntities returns a boolean if a field has been set. +func (o *User) HasEntities() bool { + if o != nil && o.Entities != nil { + return true + } + + return false +} + + +func (o User) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + + if o.Entities != nil { + toSerialize["entities"] = o.Entities + } + + return json.Marshal(toSerialize) +} + +type NullableUser struct { + value *User + isSet bool +} + +func (v NullableUser) Get() *User { + return v.value +} + +func (v *NullableUser) Set(val *User) { + v.value = val + v.isSet = true +} + +func (v NullableUser) IsSet() bool { + return v.isSet +} + +func (v *NullableUser) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUser(val *User) *NullableUser { + return &NullableUser{value: val, isSet: true} +} + +func (v NullableUser) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUser) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_user_metadata.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_user_metadata.go new file mode 100644 index 0000000000..1cbb8e5907 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_user_metadata.go @@ -0,0 +1,193 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" + "time" +) + +// UserMetadata struct for UserMetadata +type UserMetadata struct { + // Resource's Entity Tag as defined in http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.11 . Entity Tag is also added as an 'ETag response header to requests which don't use 'depth' parameter. + Etag *string `json:"etag,omitempty"` + // time of creation of the user + CreatedDate *time.Time `json:"createdDate,omitempty"` + // time of last login by the user + LastLogin *time.Time `json:"lastLogin,omitempty"` +} + + + +// GetEtag returns the Etag field value +// If the value is explicit nil, the zero value for string will be returned +func (o *UserMetadata) GetEtag() *string { + if o == nil { + return nil + } + + return o.Etag +} + +// GetEtagOk returns a tuple with the Etag field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserMetadata) GetEtagOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Etag, true +} + +// SetEtag sets field value +func (o *UserMetadata) SetEtag(v string) { + o.Etag = &v +} + +// HasEtag returns a boolean if a field has been set. +func (o *UserMetadata) HasEtag() bool { + if o != nil && o.Etag != nil { + return true + } + + return false +} + + + +// GetCreatedDate returns the CreatedDate field value +// If the value is explicit nil, the zero value for time.Time will be returned +func (o *UserMetadata) GetCreatedDate() *time.Time { + if o == nil { + return nil + } + + return o.CreatedDate +} + +// GetCreatedDateOk returns a tuple with the CreatedDate field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserMetadata) GetCreatedDateOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.CreatedDate, true +} + +// SetCreatedDate sets field value +func (o *UserMetadata) SetCreatedDate(v time.Time) { + o.CreatedDate = &v +} + +// HasCreatedDate returns a boolean if a field has been set. +func (o *UserMetadata) HasCreatedDate() bool { + if o != nil && o.CreatedDate != nil { + return true + } + + return false +} + + + +// GetLastLogin returns the LastLogin field value +// If the value is explicit nil, the zero value for time.Time will be returned +func (o *UserMetadata) GetLastLogin() *time.Time { + if o == nil { + return nil + } + + return o.LastLogin +} + +// GetLastLoginOk returns a tuple with the LastLogin field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserMetadata) GetLastLoginOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.LastLogin, true +} + +// SetLastLogin sets field value +func (o *UserMetadata) SetLastLogin(v time.Time) { + o.LastLogin = &v +} + +// HasLastLogin returns a boolean if a field has been set. +func (o *UserMetadata) HasLastLogin() bool { + if o != nil && o.LastLogin != nil { + return true + } + + return false +} + + +func (o UserMetadata) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Etag != nil { + toSerialize["etag"] = o.Etag + } + + + if o.CreatedDate != nil { + toSerialize["createdDate"] = o.CreatedDate + } + + + if o.LastLogin != nil { + toSerialize["lastLogin"] = o.LastLogin + } + + return json.Marshal(toSerialize) +} + +type NullableUserMetadata struct { + value *UserMetadata + isSet bool +} + +func (v NullableUserMetadata) Get() *UserMetadata { + return v.value +} + +func (v *NullableUserMetadata) Set(val *UserMetadata) { + v.value = val + v.isSet = true +} + +func (v NullableUserMetadata) IsSet() bool { + return v.isSet +} + +func (v *NullableUserMetadata) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUserMetadata(val *UserMetadata) *NullableUserMetadata { + return &NullableUserMetadata{value: val, isSet: true} +} + +func (v NullableUserMetadata) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUserMetadata) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_user_properties.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_user_properties.go new file mode 100644 index 0000000000..5bd1624408 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_user_properties.go @@ -0,0 +1,407 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// UserProperties struct for UserProperties +type UserProperties struct { + // first name of the user + Firstname *string `json:"firstname,omitempty"` + // last name of the user + Lastname *string `json:"lastname,omitempty"` + // email address of the user + Email *string `json:"email,omitempty"` + // indicates if the user has admin rights or not + Administrator *bool `json:"administrator,omitempty"` + // indicates if secure authentication should be forced on the user or not + ForceSecAuth *bool `json:"forceSecAuth,omitempty"` + // indicates if secure authentication is active for the user or not + SecAuthActive *bool `json:"secAuthActive,omitempty"` + // Canonical (S3) id of the user for a given identity + S3CanonicalUserId *string `json:"s3CanonicalUserId,omitempty"` + // User password + Password *string `json:"password,omitempty"` +} + + + +// GetFirstname returns the Firstname field value +// If the value is explicit nil, the zero value for string will be returned +func (o *UserProperties) GetFirstname() *string { + if o == nil { + return nil + } + + return o.Firstname +} + +// GetFirstnameOk returns a tuple with the Firstname field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserProperties) GetFirstnameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Firstname, true +} + +// SetFirstname sets field value +func (o *UserProperties) SetFirstname(v string) { + o.Firstname = &v +} + +// HasFirstname returns a boolean if a field has been set. +func (o *UserProperties) HasFirstname() bool { + if o != nil && o.Firstname != nil { + return true + } + + return false +} + + + +// GetLastname returns the Lastname field value +// If the value is explicit nil, the zero value for string will be returned +func (o *UserProperties) GetLastname() *string { + if o == nil { + return nil + } + + return o.Lastname +} + +// GetLastnameOk returns a tuple with the Lastname field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserProperties) GetLastnameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Lastname, true +} + +// SetLastname sets field value +func (o *UserProperties) SetLastname(v string) { + o.Lastname = &v +} + +// HasLastname returns a boolean if a field has been set. +func (o *UserProperties) HasLastname() bool { + if o != nil && o.Lastname != nil { + return true + } + + return false +} + + + +// GetEmail returns the Email field value +// If the value is explicit nil, the zero value for string will be returned +func (o *UserProperties) GetEmail() *string { + if o == nil { + return nil + } + + return o.Email +} + +// GetEmailOk returns a tuple with the Email field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserProperties) GetEmailOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Email, true +} + +// SetEmail sets field value +func (o *UserProperties) SetEmail(v string) { + o.Email = &v +} + +// HasEmail returns a boolean if a field has been set. +func (o *UserProperties) HasEmail() bool { + if o != nil && o.Email != nil { + return true + } + + return false +} + + + +// GetAdministrator returns the Administrator field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *UserProperties) GetAdministrator() *bool { + if o == nil { + return nil + } + + return o.Administrator +} + +// GetAdministratorOk returns a tuple with the Administrator field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserProperties) GetAdministratorOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.Administrator, true +} + +// SetAdministrator sets field value +func (o *UserProperties) SetAdministrator(v bool) { + o.Administrator = &v +} + +// HasAdministrator returns a boolean if a field has been set. +func (o *UserProperties) HasAdministrator() bool { + if o != nil && o.Administrator != nil { + return true + } + + return false +} + + + +// GetForceSecAuth returns the ForceSecAuth field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *UserProperties) GetForceSecAuth() *bool { + if o == nil { + return nil + } + + return o.ForceSecAuth +} + +// GetForceSecAuthOk returns a tuple with the ForceSecAuth field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserProperties) GetForceSecAuthOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.ForceSecAuth, true +} + +// SetForceSecAuth sets field value +func (o *UserProperties) SetForceSecAuth(v bool) { + o.ForceSecAuth = &v +} + +// HasForceSecAuth returns a boolean if a field has been set. +func (o *UserProperties) HasForceSecAuth() bool { + if o != nil && o.ForceSecAuth != nil { + return true + } + + return false +} + + + +// GetSecAuthActive returns the SecAuthActive field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *UserProperties) GetSecAuthActive() *bool { + if o == nil { + return nil + } + + return o.SecAuthActive +} + +// GetSecAuthActiveOk returns a tuple with the SecAuthActive field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserProperties) GetSecAuthActiveOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.SecAuthActive, true +} + +// SetSecAuthActive sets field value +func (o *UserProperties) SetSecAuthActive(v bool) { + o.SecAuthActive = &v +} + +// HasSecAuthActive returns a boolean if a field has been set. +func (o *UserProperties) HasSecAuthActive() bool { + if o != nil && o.SecAuthActive != nil { + return true + } + + return false +} + + + +// GetS3CanonicalUserId returns the S3CanonicalUserId field value +// If the value is explicit nil, the zero value for string will be returned +func (o *UserProperties) GetS3CanonicalUserId() *string { + if o == nil { + return nil + } + + return o.S3CanonicalUserId +} + +// GetS3CanonicalUserIdOk returns a tuple with the S3CanonicalUserId field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserProperties) GetS3CanonicalUserIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.S3CanonicalUserId, true +} + +// SetS3CanonicalUserId sets field value +func (o *UserProperties) SetS3CanonicalUserId(v string) { + o.S3CanonicalUserId = &v +} + +// HasS3CanonicalUserId returns a boolean if a field has been set. +func (o *UserProperties) HasS3CanonicalUserId() bool { + if o != nil && o.S3CanonicalUserId != nil { + return true + } + + return false +} + + + +// GetPassword returns the Password field value +// If the value is explicit nil, the zero value for string will be returned +func (o *UserProperties) GetPassword() *string { + if o == nil { + return nil + } + + return o.Password +} + +// GetPasswordOk returns a tuple with the Password field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UserProperties) GetPasswordOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Password, true +} + +// SetPassword sets field value +func (o *UserProperties) SetPassword(v string) { + o.Password = &v +} + +// HasPassword returns a boolean if a field has been set. +func (o *UserProperties) HasPassword() bool { + if o != nil && o.Password != nil { + return true + } + + return false +} + + +func (o UserProperties) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Firstname != nil { + toSerialize["firstname"] = o.Firstname + } + + + if o.Lastname != nil { + toSerialize["lastname"] = o.Lastname + } + + + if o.Email != nil { + toSerialize["email"] = o.Email + } + + + if o.Administrator != nil { + toSerialize["administrator"] = o.Administrator + } + + + if o.ForceSecAuth != nil { + toSerialize["forceSecAuth"] = o.ForceSecAuth + } + + + if o.SecAuthActive != nil { + toSerialize["secAuthActive"] = o.SecAuthActive + } + + + if o.S3CanonicalUserId != nil { + toSerialize["s3CanonicalUserId"] = o.S3CanonicalUserId + } + + + if o.Password != nil { + toSerialize["password"] = o.Password + } + + return json.Marshal(toSerialize) +} + +type NullableUserProperties struct { + value *UserProperties + isSet bool +} + +func (v NullableUserProperties) Get() *UserProperties { + return v.value +} + +func (v *NullableUserProperties) Set(val *UserProperties) { + v.value = val + v.isSet = true +} + +func (v NullableUserProperties) IsSet() bool { + return v.isSet +} + +func (v *NullableUserProperties) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUserProperties(val *UserProperties) *NullableUserProperties { + return &NullableUserProperties{value: val, isSet: true} +} + +func (v NullableUserProperties) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUserProperties) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_users.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_users.go new file mode 100644 index 0000000000..9068d95b32 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_users.go @@ -0,0 +1,235 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// Users struct for Users +type Users struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of object that has been created + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + // Array of items in that collection + Items *[]User `json:"items,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Users) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Users) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *Users) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *Users) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *Users) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Users) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *Users) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *Users) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Users) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Users) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *Users) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *Users) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []User will be returned +func (o *Users) GetItems() *[]User { + if o == nil { + return nil + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Users) GetItemsOk() (*[]User, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *Users) SetItems(v []User) { + o.Items = &v +} + +// HasItems returns a boolean if a field has been set. +func (o *Users) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + + +func (o Users) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullableUsers struct { + value *Users + isSet bool +} + +func (v NullableUsers) Get() *Users { + return v.value +} + +func (v *NullableUsers) Set(val *Users) { + v.value = val + v.isSet = true +} + +func (v NullableUsers) IsSet() bool { + return v.isSet +} + +func (v *NullableUsers) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUsers(val *Users) *NullableUsers { + return &NullableUsers{value: val, isSet: true} +} + +func (v NullableUsers) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUsers) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_users_entities.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_users_entities.go new file mode 100644 index 0000000000..41d547aa10 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_users_entities.go @@ -0,0 +1,147 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// UsersEntities struct for UsersEntities +type UsersEntities struct { + Owns *ResourcesUsers `json:"owns,omitempty"` + Groups *GroupUsers `json:"groups,omitempty"` +} + + + +// GetOwns returns the Owns field value +// If the value is explicit nil, the zero value for ResourcesUsers will be returned +func (o *UsersEntities) GetOwns() *ResourcesUsers { + if o == nil { + return nil + } + + return o.Owns +} + +// GetOwnsOk returns a tuple with the Owns field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UsersEntities) GetOwnsOk() (*ResourcesUsers, bool) { + if o == nil { + return nil, false + } + return o.Owns, true +} + +// SetOwns sets field value +func (o *UsersEntities) SetOwns(v ResourcesUsers) { + o.Owns = &v +} + +// HasOwns returns a boolean if a field has been set. +func (o *UsersEntities) HasOwns() bool { + if o != nil && o.Owns != nil { + return true + } + + return false +} + + + +// GetGroups returns the Groups field value +// If the value is explicit nil, the zero value for GroupUsers will be returned +func (o *UsersEntities) GetGroups() *GroupUsers { + if o == nil { + return nil + } + + return o.Groups +} + +// GetGroupsOk returns a tuple with the Groups field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UsersEntities) GetGroupsOk() (*GroupUsers, bool) { + if o == nil { + return nil, false + } + return o.Groups, true +} + +// SetGroups sets field value +func (o *UsersEntities) SetGroups(v GroupUsers) { + o.Groups = &v +} + +// HasGroups returns a boolean if a field has been set. +func (o *UsersEntities) HasGroups() bool { + if o != nil && o.Groups != nil { + return true + } + + return false +} + + +func (o UsersEntities) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Owns != nil { + toSerialize["owns"] = o.Owns + } + + + if o.Groups != nil { + toSerialize["groups"] = o.Groups + } + + return json.Marshal(toSerialize) +} + +type NullableUsersEntities struct { + value *UsersEntities + isSet bool +} + +func (v NullableUsersEntities) Get() *UsersEntities { + return v.value +} + +func (v *NullableUsersEntities) Set(val *UsersEntities) { + v.value = val + v.isSet = true +} + +func (v NullableUsersEntities) IsSet() bool { + return v.isSet +} + +func (v *NullableUsersEntities) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUsersEntities(val *UsersEntities) *NullableUsersEntities { + return &NullableUsersEntities{value: val, isSet: true} +} + +func (v NullableUsersEntities) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUsersEntities) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_volume.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_volume.go new file mode 100644 index 0000000000..15741a600b --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_volume.go @@ -0,0 +1,276 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// Volume struct for Volume +type Volume struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of object that has been created + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` + Properties *VolumeProperties `json:"properties"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Volume) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Volume) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *Volume) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *Volume) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *Volume) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Volume) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *Volume) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *Volume) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Volume) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Volume) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *Volume) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *Volume) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for DatacenterElementMetadata will be returned +func (o *Volume) GetMetadata() *DatacenterElementMetadata { + if o == nil { + return nil + } + + return o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Volume) GetMetadataOk() (*DatacenterElementMetadata, bool) { + if o == nil { + return nil, false + } + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *Volume) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + +// HasMetadata returns a boolean if a field has been set. +func (o *Volume) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + + + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for VolumeProperties will be returned +func (o *Volume) GetProperties() *VolumeProperties { + if o == nil { + return nil + } + + return o.Properties +} + +// GetPropertiesOk returns a tuple with the Properties field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Volume) GetPropertiesOk() (*VolumeProperties, bool) { + if o == nil { + return nil, false + } + return o.Properties, true +} + +// SetProperties sets field value +func (o *Volume) SetProperties(v VolumeProperties) { + o.Properties = &v +} + +// HasProperties returns a boolean if a field has been set. +func (o *Volume) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + + +func (o Volume) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + return json.Marshal(toSerialize) +} + +type NullableVolume struct { + value *Volume + isSet bool +} + +func (v NullableVolume) Get() *Volume { + return v.value +} + +func (v *NullableVolume) Set(val *Volume) { + v.value = val + v.isSet = true +} + +func (v NullableVolume) IsSet() bool { + return v.isSet +} + +func (v *NullableVolume) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolume(val *Volume) *NullableVolume { + return &NullableVolume{value: val, isSet: true} +} + +func (v NullableVolume) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolume) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_volume_properties.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_volume_properties.go new file mode 100644 index 0000000000..0539bb3ff4 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_volume_properties.go @@ -0,0 +1,836 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// VolumeProperties struct for VolumeProperties +type VolumeProperties struct { + // A name of that resource + Name *string `json:"name,omitempty"` + // Hardware type of the volume. + Type *string `json:"type,omitempty"` + // The size of the volume in GB + Size *float32 `json:"size"` + // The availability zone in which the volume should exist. The storage volume will be provisioned on as less physical storages as possible but cannot guarantee upfront + AvailabilityZone *string `json:"availabilityZone,omitempty"` + // Image or snapshot ID to be used as template for this volume + Image *string `json:"image,omitempty"` + ImageAlias *string `json:"imageAlias,omitempty"` + // Initial password to be set for installed OS. Works with public images only. Not modifiable, forbidden in update requests. Password rules allows all characters from a-z, A-Z, 0-9 + ImagePassword *string `json:"imagePassword,omitempty"` + // Public SSH keys are set on the image as authorized keys for appropriate SSH login to the instance using the corresponding private key. This field may only be set in creation requests. When reading, it always returns null. SSH keys are only supported if a public Linux image is used for the volume creation. + SshKeys *[]string `json:"sshKeys,omitempty"` + // The bus type of the volume. Default is VIRTIO + Bus *string `json:"bus,omitempty"` + // OS type of this volume + LicenceType *string `json:"licenceType,omitempty"` + // Is capable of CPU hot plug (no reboot required) + CpuHotPlug *bool `json:"cpuHotPlug,omitempty"` + // Is capable of memory hot plug (no reboot required) + RamHotPlug *bool `json:"ramHotPlug,omitempty"` + // Is capable of nic hot plug (no reboot required) + NicHotPlug *bool `json:"nicHotPlug,omitempty"` + // Is capable of nic hot unplug (no reboot required) + NicHotUnplug *bool `json:"nicHotUnplug,omitempty"` + // Is capable of Virt-IO drive hot plug (no reboot required) + DiscVirtioHotPlug *bool `json:"discVirtioHotPlug,omitempty"` + // Is capable of Virt-IO drive hot unplug (no reboot required). This works only for non-Windows virtual Machines. + DiscVirtioHotUnplug *bool `json:"discVirtioHotUnplug,omitempty"` + // The LUN ID of the storage volume. Null for volumes not mounted to any VM + DeviceNumber *int64 `json:"deviceNumber,omitempty"` + // The uuid of the Backup Unit that user has access to. The property is immutable and is only allowed to be set on a new volume creation. It is mandatory to provied either public image or imageAlias in conjunction with this property. + BackupunitId *string `json:"backupunitId,omitempty"` +} + + + +// GetName returns the Name field value +// If the value is explicit nil, the zero value for string will be returned +func (o *VolumeProperties) GetName() *string { + if o == nil { + return nil + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *VolumeProperties) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name, true +} + +// SetName sets field value +func (o *VolumeProperties) SetName(v string) { + o.Name = &v +} + +// HasName returns a boolean if a field has been set. +func (o *VolumeProperties) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for string will be returned +func (o *VolumeProperties) GetType() *string { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *VolumeProperties) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *VolumeProperties) SetType(v string) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *VolumeProperties) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetSize returns the Size field value +// If the value is explicit nil, the zero value for float32 will be returned +func (o *VolumeProperties) GetSize() *float32 { + if o == nil { + return nil + } + + return o.Size +} + +// GetSizeOk returns a tuple with the Size field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *VolumeProperties) GetSizeOk() (*float32, bool) { + if o == nil { + return nil, false + } + return o.Size, true +} + +// SetSize sets field value +func (o *VolumeProperties) SetSize(v float32) { + o.Size = &v +} + +// HasSize returns a boolean if a field has been set. +func (o *VolumeProperties) HasSize() bool { + if o != nil && o.Size != nil { + return true + } + + return false +} + + + +// GetAvailabilityZone returns the AvailabilityZone field value +// If the value is explicit nil, the zero value for string will be returned +func (o *VolumeProperties) GetAvailabilityZone() *string { + if o == nil { + return nil + } + + return o.AvailabilityZone +} + +// GetAvailabilityZoneOk returns a tuple with the AvailabilityZone field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *VolumeProperties) GetAvailabilityZoneOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.AvailabilityZone, true +} + +// SetAvailabilityZone sets field value +func (o *VolumeProperties) SetAvailabilityZone(v string) { + o.AvailabilityZone = &v +} + +// HasAvailabilityZone returns a boolean if a field has been set. +func (o *VolumeProperties) HasAvailabilityZone() bool { + if o != nil && o.AvailabilityZone != nil { + return true + } + + return false +} + + + +// GetImage returns the Image field value +// If the value is explicit nil, the zero value for string will be returned +func (o *VolumeProperties) GetImage() *string { + if o == nil { + return nil + } + + return o.Image +} + +// GetImageOk returns a tuple with the Image field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *VolumeProperties) GetImageOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Image, true +} + +// SetImage sets field value +func (o *VolumeProperties) SetImage(v string) { + o.Image = &v +} + +// HasImage returns a boolean if a field has been set. +func (o *VolumeProperties) HasImage() bool { + if o != nil && o.Image != nil { + return true + } + + return false +} + + + +// GetImageAlias returns the ImageAlias field value +// If the value is explicit nil, the zero value for string will be returned +func (o *VolumeProperties) GetImageAlias() *string { + if o == nil { + return nil + } + + return o.ImageAlias +} + +// GetImageAliasOk returns a tuple with the ImageAlias field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *VolumeProperties) GetImageAliasOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.ImageAlias, true +} + +// SetImageAlias sets field value +func (o *VolumeProperties) SetImageAlias(v string) { + o.ImageAlias = &v +} + +// HasImageAlias returns a boolean if a field has been set. +func (o *VolumeProperties) HasImageAlias() bool { + if o != nil && o.ImageAlias != nil { + return true + } + + return false +} + + + +// GetImagePassword returns the ImagePassword field value +// If the value is explicit nil, the zero value for string will be returned +func (o *VolumeProperties) GetImagePassword() *string { + if o == nil { + return nil + } + + return o.ImagePassword +} + +// GetImagePasswordOk returns a tuple with the ImagePassword field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *VolumeProperties) GetImagePasswordOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.ImagePassword, true +} + +// SetImagePassword sets field value +func (o *VolumeProperties) SetImagePassword(v string) { + o.ImagePassword = &v +} + +// HasImagePassword returns a boolean if a field has been set. +func (o *VolumeProperties) HasImagePassword() bool { + if o != nil && o.ImagePassword != nil { + return true + } + + return false +} + + + +// GetSshKeys returns the SshKeys field value +// If the value is explicit nil, the zero value for []string will be returned +func (o *VolumeProperties) GetSshKeys() *[]string { + if o == nil { + return nil + } + + return o.SshKeys +} + +// GetSshKeysOk returns a tuple with the SshKeys field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *VolumeProperties) GetSshKeysOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return o.SshKeys, true +} + +// SetSshKeys sets field value +func (o *VolumeProperties) SetSshKeys(v []string) { + o.SshKeys = &v +} + +// HasSshKeys returns a boolean if a field has been set. +func (o *VolumeProperties) HasSshKeys() bool { + if o != nil && o.SshKeys != nil { + return true + } + + return false +} + + + +// GetBus returns the Bus field value +// If the value is explicit nil, the zero value for string will be returned +func (o *VolumeProperties) GetBus() *string { + if o == nil { + return nil + } + + return o.Bus +} + +// GetBusOk returns a tuple with the Bus field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *VolumeProperties) GetBusOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Bus, true +} + +// SetBus sets field value +func (o *VolumeProperties) SetBus(v string) { + o.Bus = &v +} + +// HasBus returns a boolean if a field has been set. +func (o *VolumeProperties) HasBus() bool { + if o != nil && o.Bus != nil { + return true + } + + return false +} + + + +// GetLicenceType returns the LicenceType field value +// If the value is explicit nil, the zero value for string will be returned +func (o *VolumeProperties) GetLicenceType() *string { + if o == nil { + return nil + } + + return o.LicenceType +} + +// GetLicenceTypeOk returns a tuple with the LicenceType field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *VolumeProperties) GetLicenceTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.LicenceType, true +} + +// SetLicenceType sets field value +func (o *VolumeProperties) SetLicenceType(v string) { + o.LicenceType = &v +} + +// HasLicenceType returns a boolean if a field has been set. +func (o *VolumeProperties) HasLicenceType() bool { + if o != nil && o.LicenceType != nil { + return true + } + + return false +} + + + +// GetCpuHotPlug returns the CpuHotPlug field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *VolumeProperties) GetCpuHotPlug() *bool { + if o == nil { + return nil + } + + return o.CpuHotPlug +} + +// GetCpuHotPlugOk returns a tuple with the CpuHotPlug field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *VolumeProperties) GetCpuHotPlugOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.CpuHotPlug, true +} + +// SetCpuHotPlug sets field value +func (o *VolumeProperties) SetCpuHotPlug(v bool) { + o.CpuHotPlug = &v +} + +// HasCpuHotPlug returns a boolean if a field has been set. +func (o *VolumeProperties) HasCpuHotPlug() bool { + if o != nil && o.CpuHotPlug != nil { + return true + } + + return false +} + + + +// GetRamHotPlug returns the RamHotPlug field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *VolumeProperties) GetRamHotPlug() *bool { + if o == nil { + return nil + } + + return o.RamHotPlug +} + +// GetRamHotPlugOk returns a tuple with the RamHotPlug field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *VolumeProperties) GetRamHotPlugOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.RamHotPlug, true +} + +// SetRamHotPlug sets field value +func (o *VolumeProperties) SetRamHotPlug(v bool) { + o.RamHotPlug = &v +} + +// HasRamHotPlug returns a boolean if a field has been set. +func (o *VolumeProperties) HasRamHotPlug() bool { + if o != nil && o.RamHotPlug != nil { + return true + } + + return false +} + + + +// GetNicHotPlug returns the NicHotPlug field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *VolumeProperties) GetNicHotPlug() *bool { + if o == nil { + return nil + } + + return o.NicHotPlug +} + +// GetNicHotPlugOk returns a tuple with the NicHotPlug field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *VolumeProperties) GetNicHotPlugOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.NicHotPlug, true +} + +// SetNicHotPlug sets field value +func (o *VolumeProperties) SetNicHotPlug(v bool) { + o.NicHotPlug = &v +} + +// HasNicHotPlug returns a boolean if a field has been set. +func (o *VolumeProperties) HasNicHotPlug() bool { + if o != nil && o.NicHotPlug != nil { + return true + } + + return false +} + + + +// GetNicHotUnplug returns the NicHotUnplug field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *VolumeProperties) GetNicHotUnplug() *bool { + if o == nil { + return nil + } + + return o.NicHotUnplug +} + +// GetNicHotUnplugOk returns a tuple with the NicHotUnplug field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *VolumeProperties) GetNicHotUnplugOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.NicHotUnplug, true +} + +// SetNicHotUnplug sets field value +func (o *VolumeProperties) SetNicHotUnplug(v bool) { + o.NicHotUnplug = &v +} + +// HasNicHotUnplug returns a boolean if a field has been set. +func (o *VolumeProperties) HasNicHotUnplug() bool { + if o != nil && o.NicHotUnplug != nil { + return true + } + + return false +} + + + +// GetDiscVirtioHotPlug returns the DiscVirtioHotPlug field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *VolumeProperties) GetDiscVirtioHotPlug() *bool { + if o == nil { + return nil + } + + return o.DiscVirtioHotPlug +} + +// GetDiscVirtioHotPlugOk returns a tuple with the DiscVirtioHotPlug field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *VolumeProperties) GetDiscVirtioHotPlugOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.DiscVirtioHotPlug, true +} + +// SetDiscVirtioHotPlug sets field value +func (o *VolumeProperties) SetDiscVirtioHotPlug(v bool) { + o.DiscVirtioHotPlug = &v +} + +// HasDiscVirtioHotPlug returns a boolean if a field has been set. +func (o *VolumeProperties) HasDiscVirtioHotPlug() bool { + if o != nil && o.DiscVirtioHotPlug != nil { + return true + } + + return false +} + + + +// GetDiscVirtioHotUnplug returns the DiscVirtioHotUnplug field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *VolumeProperties) GetDiscVirtioHotUnplug() *bool { + if o == nil { + return nil + } + + return o.DiscVirtioHotUnplug +} + +// GetDiscVirtioHotUnplugOk returns a tuple with the DiscVirtioHotUnplug field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *VolumeProperties) GetDiscVirtioHotUnplugOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.DiscVirtioHotUnplug, true +} + +// SetDiscVirtioHotUnplug sets field value +func (o *VolumeProperties) SetDiscVirtioHotUnplug(v bool) { + o.DiscVirtioHotUnplug = &v +} + +// HasDiscVirtioHotUnplug returns a boolean if a field has been set. +func (o *VolumeProperties) HasDiscVirtioHotUnplug() bool { + if o != nil && o.DiscVirtioHotUnplug != nil { + return true + } + + return false +} + + + +// GetDeviceNumber returns the DeviceNumber field value +// If the value is explicit nil, the zero value for int64 will be returned +func (o *VolumeProperties) GetDeviceNumber() *int64 { + if o == nil { + return nil + } + + return o.DeviceNumber +} + +// GetDeviceNumberOk returns a tuple with the DeviceNumber field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *VolumeProperties) GetDeviceNumberOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.DeviceNumber, true +} + +// SetDeviceNumber sets field value +func (o *VolumeProperties) SetDeviceNumber(v int64) { + o.DeviceNumber = &v +} + +// HasDeviceNumber returns a boolean if a field has been set. +func (o *VolumeProperties) HasDeviceNumber() bool { + if o != nil && o.DeviceNumber != nil { + return true + } + + return false +} + + + +// GetBackupunitId returns the BackupunitId field value +// If the value is explicit nil, the zero value for string will be returned +func (o *VolumeProperties) GetBackupunitId() *string { + if o == nil { + return nil + } + + return o.BackupunitId +} + +// GetBackupunitIdOk returns a tuple with the BackupunitId field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *VolumeProperties) GetBackupunitIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.BackupunitId, true +} + +// SetBackupunitId sets field value +func (o *VolumeProperties) SetBackupunitId(v string) { + o.BackupunitId = &v +} + +// HasBackupunitId returns a boolean if a field has been set. +func (o *VolumeProperties) HasBackupunitId() bool { + if o != nil && o.BackupunitId != nil { + return true + } + + return false +} + + +func (o VolumeProperties) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Name != nil { + toSerialize["name"] = o.Name + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Size != nil { + toSerialize["size"] = o.Size + } + + + if o.AvailabilityZone != nil { + toSerialize["availabilityZone"] = o.AvailabilityZone + } + + + if o.Image != nil { + toSerialize["image"] = o.Image + } + + + if o.ImageAlias != nil { + toSerialize["imageAlias"] = o.ImageAlias + } + + + if o.ImagePassword != nil { + toSerialize["imagePassword"] = o.ImagePassword + } + + + if o.SshKeys != nil { + toSerialize["sshKeys"] = o.SshKeys + } + + + if o.Bus != nil { + toSerialize["bus"] = o.Bus + } + + + if o.LicenceType != nil { + toSerialize["licenceType"] = o.LicenceType + } + + + if o.CpuHotPlug != nil { + toSerialize["cpuHotPlug"] = o.CpuHotPlug + } + + + if o.RamHotPlug != nil { + toSerialize["ramHotPlug"] = o.RamHotPlug + } + + + if o.NicHotPlug != nil { + toSerialize["nicHotPlug"] = o.NicHotPlug + } + + + if o.NicHotUnplug != nil { + toSerialize["nicHotUnplug"] = o.NicHotUnplug + } + + + if o.DiscVirtioHotPlug != nil { + toSerialize["discVirtioHotPlug"] = o.DiscVirtioHotPlug + } + + + if o.DiscVirtioHotUnplug != nil { + toSerialize["discVirtioHotUnplug"] = o.DiscVirtioHotUnplug + } + + + if o.DeviceNumber != nil { + toSerialize["deviceNumber"] = o.DeviceNumber + } + + + if o.BackupunitId != nil { + toSerialize["backupunitId"] = o.BackupunitId + } + + return json.Marshal(toSerialize) +} + +type NullableVolumeProperties struct { + value *VolumeProperties + isSet bool +} + +func (v NullableVolumeProperties) Get() *VolumeProperties { + return v.value +} + +func (v *NullableVolumeProperties) Set(val *VolumeProperties) { + v.value = val + v.isSet = true +} + +func (v NullableVolumeProperties) IsSet() bool { + return v.isSet +} + +func (v *NullableVolumeProperties) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolumeProperties(val *VolumeProperties) *NullableVolumeProperties { + return &NullableVolumeProperties{value: val, isSet: true} +} + +func (v NullableVolumeProperties) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolumeProperties) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_volumes.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_volumes.go new file mode 100644 index 0000000000..6bfa6fc94b --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/model_volumes.go @@ -0,0 +1,235 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" +) + +// Volumes struct for Volumes +type Volumes struct { + // The resource's unique identifier + Id *string `json:"id,omitempty"` + // The type of object that has been created + Type *Type `json:"type,omitempty"` + // URL to the object representation (absolute path) + Href *string `json:"href,omitempty"` + // Array of items in that collection + Items *[]Volume `json:"items,omitempty"` +} + + + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Volumes) GetId() *string { + if o == nil { + return nil + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Volumes) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *Volumes) SetId(v string) { + o.Id = &v +} + +// HasId returns a boolean if a field has been set. +func (o *Volumes) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + + + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for Type will be returned +func (o *Volumes) GetType() *Type { + if o == nil { + return nil + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Volumes) GetTypeOk() (*Type, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *Volumes) SetType(v Type) { + o.Type = &v +} + +// HasType returns a boolean if a field has been set. +func (o *Volumes) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + + + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Volumes) GetHref() *string { + if o == nil { + return nil + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Volumes) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Href, true +} + +// SetHref sets field value +func (o *Volumes) SetHref(v string) { + o.Href = &v +} + +// HasHref returns a boolean if a field has been set. +func (o *Volumes) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + + + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []Volume will be returned +func (o *Volumes) GetItems() *[]Volume { + if o == nil { + return nil + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Volumes) GetItemsOk() (*[]Volume, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *Volumes) SetItems(v []Volume) { + o.Items = &v +} + +// HasItems returns a boolean if a field has been set. +func (o *Volumes) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + + +func (o Volumes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullableVolumes struct { + value *Volumes + isSet bool +} + +func (v NullableVolumes) Get() *Volumes { + return v.value +} + +func (v *NullableVolumes) Set(val *Volumes) { + v.value = val + v.isSet = true +} + +func (v NullableVolumes) IsSet() bool { + return v.isSet +} + +func (v *NullableVolumes) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolumes(val *Volumes) *NullableVolumes { + return &NullableVolumes{value: val, isSet: true} +} + +func (v NullableVolumes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolumes) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/response.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/response.go new file mode 100644 index 0000000000..c1ff44681e --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/response.go @@ -0,0 +1,47 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "net/http" +) + +// APIResponse stores the API response returned by the server. +type APIResponse struct { + *http.Response `json:"-"` + Message string `json:"message,omitempty"` + // Operation is the name of the OpenAPI operation. + Operation string `json:"operation,omitempty"` + // RequestURL is the request URL. This value is always available, even if the + // embedded *http.Response is nil. + RequestURL string `json:"url,omitempty"` + // Method is the HTTP method used for the request. This value is always + // available, even if the embedded *http.Response is nil. + Method string `json:"method,omitempty"` + // Payload holds the contents of the response body (which may be nil or empty). + // This is provided here as the raw response.Body() reader will have already + // been drained. + Payload []byte `json:"-"` +} + +// NewAPIResponse returns a new APIResonse object. +func NewAPIResponse(r *http.Response) *APIResponse { + + response := &APIResponse{Response: r} + return response +} + +// NewAPIResponseWithError returns a new APIResponse object with the provided error message. +func NewAPIResponseWithError(errorMessage string) *APIResponse { + + response := &APIResponse{Message: errorMessage} + return response +} diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/utils.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/utils.go new file mode 100644 index 0000000000..50679f5865 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/utils.go @@ -0,0 +1,335 @@ +/* + * CLOUD API + * + * An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volumes, adjusting networking, and so forth. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive. + * + * API version: 5.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionossdk + +import ( + "encoding/json" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableBool struct { + value *bool + isSet bool +} + +func (v NullableBool) Get() *bool { + return v.value +} + +func (v *NullableBool) Set(val *bool) { + v.value = val + v.isSet = true +} + +func (v NullableBool) IsSet() bool { + return v.isSet +} + +func (v *NullableBool) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBool(val *bool) *NullableBool { + return &NullableBool{value: val, isSet: true} +} + +func (v NullableBool) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBool) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + +type NullableInt struct { + value *int + isSet bool +} + +func (v NullableInt) Get() *int { + return v.value +} + +func (v *NullableInt) Set(val *int) { + v.value = val + v.isSet = true +} + +func (v NullableInt) IsSet() bool { + return v.isSet +} + +func (v *NullableInt) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt(val *int) *NullableInt { + return &NullableInt{value: val, isSet: true} +} + +func (v NullableInt) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + +type NullableInt32 struct { + value *int32 + isSet bool +} + +func (v NullableInt32) Get() *int32 { + return v.value +} + +func (v *NullableInt32) Set(val *int32) { + v.value = val + v.isSet = true +} + +func (v NullableInt32) IsSet() bool { + return v.isSet +} + +func (v *NullableInt32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt32(val *int32) *NullableInt32 { + return &NullableInt32{value: val, isSet: true} +} + +func (v NullableInt32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + +type NullableInt64 struct { + value *int64 + isSet bool +} + +func (v NullableInt64) Get() *int64 { + return v.value +} + +func (v *NullableInt64) Set(val *int64) { + v.value = val + v.isSet = true +} + +func (v NullableInt64) IsSet() bool { + return v.isSet +} + +func (v *NullableInt64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt64(val *int64) *NullableInt64 { + return &NullableInt64{value: val, isSet: true} +} + +func (v NullableInt64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + +type NullableFloat32 struct { + value *float32 + isSet bool +} + +func (v NullableFloat32) Get() *float32 { + return v.value +} + +func (v *NullableFloat32) Set(val *float32) { + v.value = val + v.isSet = true +} + +func (v NullableFloat32) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat32(val *float32) *NullableFloat32 { + return &NullableFloat32{value: val, isSet: true} +} + +func (v NullableFloat32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + +type NullableFloat64 struct { + value *float64 + isSet bool +} + +func (v NullableFloat64) Get() *float64 { + return v.value +} + +func (v *NullableFloat64) Set(val *float64) { + v.value = val + v.isSet = true +} + +func (v NullableFloat64) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat64(val *float64) *NullableFloat64 { + return &NullableFloat64{value: val, isSet: true} +} + +func (v NullableFloat64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + +type NullableString struct { + value *string + isSet bool +} + +func (v NullableString) Get() *string { + return v.value +} + +func (v *NullableString) Set(val *string) { + v.value = val + v.isSet = true +} + +func (v NullableString) IsSet() bool { + return v.isSet +} + +func (v *NullableString) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableString(val *string) *NullableString { + return &NullableString{value: val, isSet: true} +} + +func (v NullableString) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableString) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + +type NullableTime struct { + value *time.Time + isSet bool +} + +func (v NullableTime) Get() *time.Time { + return v.value +} + +func (v *NullableTime) Set(val *time.Time) { + v.value = val + v.isSet = true +} + +func (v NullableTime) IsSet() bool { + return v.isSet +} + +func (v *NullableTime) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTime(val *time.Time) *NullableTime { + return &NullableTime{value: val, isSet: true} +} + +func (v NullableTime) MarshalJSON() ([]byte, error) { + return v.value.MarshalJSON() +} + +func (v *NullableTime) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionoscloud_cloud_provider.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionoscloud_cloud_provider.go new file mode 100644 index 0000000000..b58d43d7eb --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionoscloud_cloud_provider.go @@ -0,0 +1,298 @@ +/* +Copyright 2020 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 ionoscloud + +import ( + "fmt" + + apiv1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/resource" + "k8s.io/autoscaler/cluster-autoscaler/cloudprovider" + "k8s.io/autoscaler/cluster-autoscaler/config" + "k8s.io/autoscaler/cluster-autoscaler/utils/errors" + "k8s.io/klog/v2" + schedulerframework "k8s.io/kubernetes/pkg/scheduler/framework/v1alpha1" +) + +const ( + // GPULabel is the label added to nodes with GPU resource. + GPULabel = "" +) + +type nodePool struct { + id string + min int + max int + + manager IonosCloudManager +} + +var _ cloudprovider.NodeGroup = &nodePool{} + +// MaxSize returns maximum size of the node group. +func (n *nodePool) MaxSize() int { + return n.max +} + +// MinSize returns minimum size of the node group. +func (n *nodePool) MinSize() int { + return n.min +} + +// TargetSize returns the current target size of the node group. It is possible that the +// number of nodes in Kubernetes is different at the moment but should be equal +// to Size() once everything stabilizes (new nodes finish startup and registration or +// removed nodes are deleted completely). Implementation required. +func (n *nodePool) TargetSize() (int, error) { + size, err := n.manager.GetNodeGroupTargetSize(n) + return size, err +} + +// IncreaseSize increases the size of the node group. To delete a node you need +// to explicitly name it and use DeleteNode. This function should wait until +// node group size is updated. Implementation required. +func (n *nodePool) IncreaseSize(delta int) error { + if delta <= 0 { + return fmt.Errorf("size increase must be positive") + } + size, err := n.manager.GetNodeGroupSize(n) + if err != nil { + return err + } + targetSize := size + delta + if targetSize > n.max { + return fmt.Errorf("size increase exceeds upper bound of %d", n.max) + } + return n.manager.SetNodeGroupSize(n, targetSize) +} + +// DeleteNodes deletes nodes from this node group (and also decreasing the size +// of the node group with that). Error is returned either on failure or if the +// given node doesn't belong to this node group. This function should wait +// until node group size is updated. Implementation required. +func (n *nodePool) DeleteNodes(nodes []*apiv1.Node) error { + if acquired := n.manager.TryLockNodeGroup(n); !acquired { + return fmt.Errorf("node deletion already in progress") + } + defer n.manager.UnlockNodeGroup(n) + + for _, node := range nodes { + nodeId := convertToNodeId(node.Spec.ProviderID) + if err := n.manager.DeleteNode(n, nodeId); err != nil { + return err + } + } + return nil +} + +// DecreaseTargetSize decreases the target size of the node group. This function +// doesn't permit to delete any existing node and can be used only to reduce the +// request for new nodes that have not been yet fulfilled. Delta should be negative. +// It is assumed that cloud provider will not delete the existing nodes when there +// is an option to just decrease the target size. Implementation required. +func (n *nodePool) DecreaseTargetSize(delta int) error { + if delta >= 0 { + return fmt.Errorf("size decrease must be negative") + } + size, err := n.manager.GetNodeGroupTargetSize(n) + if err != nil { + return err + } + if size+delta < n.min { + return fmt.Errorf("size decrease exceeds lower bound of %d", n.min) + } + // IonosCloud does not allow modification of the target size while nodes are being provisioned. + return fmt.Errorf("currently not supported behavior") +} + +// Id returns an unique identifier of the node group. +func (n *nodePool) Id() string { + return n.id +} + +// Debug returns a string containing all information regarding this node group. +func (n *nodePool) Debug() string { + return fmt.Sprintf("Id=%s, Min=%d, Max=%d", n.id, n.min, n.max) +} + +// Nodes returns a list of all nodes that belong to this node group. +// It is required that Instance objects returned by this method have Id field set. +// Other fields are optional. +// This list should include also instances that might have not become a kubernetes node yet. +func (n *nodePool) Nodes() ([]cloudprovider.Instance, error) { + return n.manager.GetInstancesForNodeGroup(n) +} + +// TemplateNodeInfo returns a schedulerframework.NodeInfo structure of an empty +// (as if just started) node. This will be used in scale-up simulations to +// predict what would a new node look like if a node group was expanded. The +// returned NodeInfo is expected to have a fully populated Node object, with +// all of the labels, capacity and allocatable information as well as all pods +// that are started on the node by default, using manifest (most likely only +// kube-proxy). Implementation optional. +func (n *nodePool) TemplateNodeInfo() (*schedulerframework.NodeInfo, error) { + return nil, cloudprovider.ErrNotImplemented +} + +// Exist checks if the node group really exists on the cloud provider side. Allows to tell the +// theoretical node group from the real one. Implementation required. +func (n *nodePool) Exist() bool { + return true +} + +// Create creates the node group on the cloud provider side. Implementation optional. +func (n *nodePool) Create() (cloudprovider.NodeGroup, error) { + return nil, cloudprovider.ErrNotImplemented +} + +// Delete deletes the node group on the cloud provider side. +// This will be executed only for autoprovisioned node groups, once their size drops to 0. +// Implementation optional. +func (n *nodePool) Delete() error { + return cloudprovider.ErrNotImplemented +} + +// Autoprovisioned returns true if the node group is autoprovisioned. An autoprovisioned group +// was created by CA and can be deleted when scaled to 0. +func (n *nodePool) Autoprovisioned() bool { + return false +} + +// IonosCloudCloudProvider implements cloudprovider.CloudProvider. +type IonosCloudCloudProvider struct { + manager IonosCloudManager + resourceLimiter *cloudprovider.ResourceLimiter +} + +var _ cloudprovider.CloudProvider = &IonosCloudCloudProvider{} + +// BuildIonosCloudCloudProvider builds CloudProvider implementation for Ionos Cloud. +func BuildIonosCloudCloudProvider(manager IonosCloudManager, rl *cloudprovider.ResourceLimiter) *IonosCloudCloudProvider { + return &IonosCloudCloudProvider{manager: manager, resourceLimiter: rl} +} + +// Name returns name of the cloud provider. +func (ic *IonosCloudCloudProvider) Name() string { + return cloudprovider.IonoscloudProviderName +} + +// NodeGroups returns all node groups configured for this cloud provider. +func (ic *IonosCloudCloudProvider) NodeGroups() []cloudprovider.NodeGroup { + return ic.manager.GetNodeGroups() +} + +// NodeGroupForNode returns the node group for the given node, nil if the node +// should not be processed by cluster autoscaler, or non-nil error if such +// occurred. Must be implemented. +func (ic *IonosCloudCloudProvider) NodeGroupForNode(node *apiv1.Node) (cloudprovider.NodeGroup, error) { + providerID := node.Spec.ProviderID + if nodeGroup := ic.manager.GetNodeGroupForNode(node); nodeGroup != nil { + klog.V(4).Infof("Node %s found in cache", providerID) + return nodeGroup, nil + } + klog.V(4).Infof("Node %s not found in cache", providerID) + + for _, nodeGroup := range ic.manager.GetNodeGroups() { + klog.V(5).Infof("Checking node group %s", nodeGroup.Id()) + nodes, err := nodeGroup.Nodes() + if err != nil { + return nil, err + } + + for _, node := range nodes { + if node.Id != providerID { + continue + } + klog.V(4).Infof("Node %s found after refresh in node group %s", providerID, nodeGroup.Id()) + return nodeGroup, nil + } + } + + // there is no "ErrNotExist" error, so we have to return a nil error + return nil, nil +} + +// Pricing returns pricing model for this cloud provider or error if not +// available. Implementation optional. +func (ic *IonosCloudCloudProvider) Pricing() (cloudprovider.PricingModel, errors.AutoscalerError) { + return nil, cloudprovider.ErrNotImplemented +} + +// GetAvailableMachineTypes get all machine types that can be requested from +// the cloud provider. Implementation optional. +func (ic *IonosCloudCloudProvider) GetAvailableMachineTypes() ([]string, error) { + return nil, cloudprovider.ErrNotImplemented +} + +// NewNodeGroup builds a theoretical node group based on the node definition +// provided. The node group is not automatically created on the cloud provider +// side. The node group is not returned by NodeGroups() until it is created. +// Implementation optional. +func (ic *IonosCloudCloudProvider) NewNodeGroup( + machineType string, + labels map[string]string, + systemLabels map[string]string, + taints []apiv1.Taint, + extraResources map[string]resource.Quantity, +) (cloudprovider.NodeGroup, error) { + return nil, cloudprovider.ErrNotImplemented +} + +// GetResourceLimiter returns struct containing limits (max, min) for +// resources (cores, memory etc.). +func (ic *IonosCloudCloudProvider) GetResourceLimiter() (*cloudprovider.ResourceLimiter, error) { + return ic.resourceLimiter, nil +} + +// GPULabel returns the label added to nodes with GPU resource. +func (ic *IonosCloudCloudProvider) GPULabel() string { + return GPULabel +} + +// GetAvailableGPUTypes return all available GPU types cloud provider supports. +func (ic *IonosCloudCloudProvider) GetAvailableGPUTypes() map[string]struct{} { + return nil +} + +// Cleanup cleans up read resources before the cloud provider is destroyed, +// i.e. go routines etc. +func (ic *IonosCloudCloudProvider) Cleanup() error { + return nil +} + +// Refresh is called before every main loop and can be used to dynamically +// update cloud provider state. In particular the list of node groups returned +// by NodeGroups() can change as a result of CloudProvider.Refresh(). +func (ic *IonosCloudCloudProvider) Refresh() error { + // Currently only static node groups are supported. + return nil +} + +// BuildIonosCloud builds the IonosCloud cloud provider. +func BuildIonosCloud( + opts config.AutoscalingOptions, + do cloudprovider.NodeGroupDiscoveryOptions, + rl *cloudprovider.ResourceLimiter, +) cloudprovider.CloudProvider { + manager, err := CreateIonosCloudManager(opts.NodeGroups) + if err != nil { + klog.Fatalf("Failed to create IonosCloud cloud provider: %v", err) + } + + provider := BuildIonosCloudCloudProvider(manager, rl) + return provider +} diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionoscloud_cloud_provider_test.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionoscloud_cloud_provider_test.go new file mode 100644 index 0000000000..fb2b118919 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionoscloud_cloud_provider_test.go @@ -0,0 +1,297 @@ +/* +Copyright 2020 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 ionoscloud + +import ( + "fmt" + "testing" + + "github.com/stretchr/testify/suite" + apiv1 "k8s.io/api/core/v1" + "k8s.io/autoscaler/cluster-autoscaler/cloudprovider" +) + +type NodeGroupTestSuite struct { + suite.Suite + manager *MockIonosCloudManager + nodePool *nodePool + deleteNode []*apiv1.Node +} + +func (s *NodeGroupTestSuite) SetupTest() { + s.manager = &MockIonosCloudManager{} + s.nodePool = &nodePool{ + id: "test", + min: 1, + max: 3, + manager: s.manager, + } + s.deleteNode = []*apiv1.Node{ + {Spec: apiv1.NodeSpec{ProviderID: convertToInstanceId("testnode")}}, + } +} + +func (s *NodeGroupTestSuite) TearDownTest() { + s.manager.AssertExpectations(s.T()) +} + +func TestNodeGroup(t *testing.T) { + suite.Run(t, new(NodeGroupTestSuite)) +} + +func (s *NodeGroupTestSuite) TestId() { + s.Equal("test", s.nodePool.Id()) +} + +func (s *NodeGroupTestSuite) TestDebug() { + s.Equal("Id=test, Min=1, Max=3", s.nodePool.Debug()) +} + +func (s *NodeGroupTestSuite) TestMaxSize() { + s.Equal(3, s.nodePool.MaxSize()) +} + +func (s *NodeGroupTestSuite) TestMinSize() { + s.Equal(1, s.nodePool.MinSize()) +} + +func (s *NodeGroupTestSuite) TestTemplateNodeInfo() { + nodeInfo, err := s.nodePool.TemplateNodeInfo() + s.Nil(nodeInfo) + s.Equal(cloudprovider.ErrNotImplemented, err) +} + +func (s *NodeGroupTestSuite) TestExist() { + var nodePool *nodePool + s.True((nodePool).Exist()) +} + +func (s *NodeGroupTestSuite) TestCreate() { + nodeGroup, err := s.nodePool.Create() + s.Nil(nodeGroup) + s.Equal(cloudprovider.ErrNotImplemented, err) +} + +func (s *NodeGroupTestSuite) TestDelete() { + err := s.nodePool.Delete() + s.Equal(cloudprovider.ErrNotImplemented, err) +} + +func (s *NodeGroupTestSuite) TestAutoprovisioned() { + var nodePool *nodePool + s.False(nodePool.Autoprovisioned()) +} + +func (s *NodeGroupTestSuite) TestTargetSize_Error() { + s.manager.On("GetNodeGroupTargetSize", s.nodePool).Return(0, fmt.Errorf("error")).Once() + _, err := s.nodePool.TargetSize() + s.Error(err) +} + +func (s *NodeGroupTestSuite) TestTargetSize_OK() { + s.manager.On("GetNodeGroupTargetSize", s.nodePool).Return(3, nil).Once() + size, err := s.nodePool.TargetSize() + s.NoError(err) + s.Equal(3, size) +} + +func (s *NodeGroupTestSuite) TestIncreaseSize_InvalidDelta() { + s.Error(s.nodePool.IncreaseSize(0)) +} + +func (s *NodeGroupTestSuite) TestIncreaseSize_GetSizeError() { + s.manager.On("GetNodeGroupSize", s.nodePool).Return(0, fmt.Errorf("error")).Once() + s.Error(s.nodePool.IncreaseSize(2)) +} + +func (s *NodeGroupTestSuite) TestIncreaseSize_ExceedMax() { + s.manager.On("GetNodeGroupSize", s.nodePool).Return(2, nil).Once() + s.Error(s.nodePool.IncreaseSize(2)) +} + +func (s *NodeGroupTestSuite) TestIncreaseSize_SetSizeError() { + s.manager.On("GetNodeGroupSize", s.nodePool).Return(2, nil).Once() + s.manager.On("SetNodeGroupSize", s.nodePool, 3).Return(fmt.Errorf("error")).Once() + s.Error(s.nodePool.IncreaseSize(1)) +} + +func (s *NodeGroupTestSuite) TestIncreaseSize_OK() { + s.manager.On("GetNodeGroupSize", s.nodePool).Return(2, nil).Once() + s.manager.On("SetNodeGroupSize", s.nodePool, 3).Return(nil).Once() + s.NoError(s.nodePool.IncreaseSize(1)) +} + +func (s *NodeGroupTestSuite) TestDeleteNodes_Locked() { + s.manager.On("TryLockNodeGroup", s.nodePool).Return(false).Once() + s.Error(s.nodePool.DeleteNodes(s.deleteNode)) +} + +func (s *NodeGroupTestSuite) TestDeleteNodes_DeleteError() { + s.manager.On("TryLockNodeGroup", s.nodePool).Return(true).Once() + s.manager.On("UnlockNodeGroup", s.nodePool).Return().Once() + s.manager.On("DeleteNode", s.nodePool, "testnode").Return(fmt.Errorf("error")).Once() + s.Error(s.nodePool.DeleteNodes(s.deleteNode)) +} + +func (s *NodeGroupTestSuite) TestDeleteNodes_OK() { + s.manager.On("TryLockNodeGroup", s.nodePool).Return(true).Once() + s.manager.On("UnlockNodeGroup", s.nodePool).Return().Once() + s.manager.On("DeleteNode", s.nodePool, "testnode").Return(nil).Once() + s.NoError(s.nodePool.DeleteNodes(s.deleteNode)) +} + +func (s *NodeGroupTestSuite) TestDecreaseTargetSize_InvalidDelta() { + s.Error(s.nodePool.DecreaseTargetSize(0)) +} + +func (s *NodeGroupTestSuite) TestDecreaseTargetSize_GetTargetSizeError() { + s.manager.On("GetNodeGroupTargetSize", s.nodePool).Return(0, fmt.Errorf("error")).Once() + s.Error(s.nodePool.DecreaseTargetSize(-1)) +} + +func (s *NodeGroupTestSuite) TestDecreaseTargetSize_ExceedMin() { + s.manager.On("GetNodeGroupTargetSize", s.nodePool).Return(1, nil).Once() + s.Error(s.nodePool.DecreaseTargetSize(-2)) +} + +func (s *NodeGroupTestSuite) TestDecreaseTargetSize_NotImplemented() { + s.manager.On("GetNodeGroupTargetSize", s.nodePool).Return(1, nil).Once() + s.Error(s.nodePool.DecreaseTargetSize(-1)) +} + +type CloudProviderTestSuite struct { + suite.Suite + manager *MockIonosCloudManager + provider *IonosCloudCloudProvider +} + +func (s *CloudProviderTestSuite) SetupTest() { + s.manager = &MockIonosCloudManager{} + s.provider = BuildIonosCloudCloudProvider(s.manager, &cloudprovider.ResourceLimiter{}) +} + +func (s *CloudProviderTestSuite) TearDownTest() { + s.manager.AssertExpectations(s.T()) +} + +func TestIonosCloudCloudProvider(t *testing.T) { + suite.Run(t, new(CloudProviderTestSuite)) +} + +func (s *CloudProviderTestSuite) TestName() { + var ionoscloud *IonosCloudCloudProvider + s.Equal(cloudprovider.IonoscloudProviderName, ionoscloud.Name()) +} + +func (s *CloudProviderTestSuite) TestNodeGroups() { + s.manager.On("GetNodeGroups").Return([]cloudprovider.NodeGroup{&nodePool{id: "test"}}).Once() + s.Equal([]cloudprovider.NodeGroup{&nodePool{id: "test"}}, s.provider.NodeGroups()) +} + +func (s *CloudProviderTestSuite) TestNodeGroupForNode_CacheHit() { + node := newAPINode("test") + s.manager.On("GetNodeGroupForNode", node).Return(&nodePool{id: "test"}).Once() + + nodeGroup, err := s.provider.NodeGroupForNode(node) + s.NoError(err) + s.Equal(&nodePool{id: "test"}, nodeGroup) +} + +func (s *CloudProviderTestSuite) TestNodeGroupForNode_Error() { + node := newAPINode("test") + nodePool := &nodePool{id: "test", manager: s.manager} + s.manager.On("GetNodeGroupForNode", node).Return(nil).Once() + s.manager.On("GetNodeGroups").Return([]cloudprovider.NodeGroup{nodePool}).Once() + s.manager.On("GetInstancesForNodeGroup", nodePool).Return(nil, fmt.Errorf("error")).Once() + + nodeGroup, err := s.provider.NodeGroupForNode(node) + s.Nil(nodeGroup) + s.Error(err) +} + +func (s *CloudProviderTestSuite) TestNodeGroupForNode_Found() { + node := newAPINode("test") + nodePool := &nodePool{id: "test", manager: s.manager} + s.manager.On("GetNodeGroupForNode", node).Return(nil).Once() + s.manager.On("GetNodeGroups").Return([]cloudprovider.NodeGroup{nodePool}).Once() + s.manager.On("GetInstancesForNodeGroup", nodePool).Return([]cloudprovider.Instance{ + newInstance("foo"), newInstance("test"), + }, nil).Once() + + nodeGroup, err := s.provider.NodeGroupForNode(node) + s.Equal(nodePool, nodeGroup) + s.NoError(err) +} + +func (s *CloudProviderTestSuite) TestNodeGroupForNode_NotFound() { + node := newAPINode("test") + nodePool := &nodePool{id: "test", manager: s.manager} + s.manager.On("GetNodeGroupForNode", node).Return(nil).Once() + s.manager.On("GetNodeGroups").Return([]cloudprovider.NodeGroup{nodePool}).Once() + s.manager.On("GetInstancesForNodeGroup", nodePool).Return([]cloudprovider.Instance{ + newInstance("foo"), newInstance("bar"), + }, nil).Once() + + nodeGroup, err := s.provider.NodeGroupForNode(node) + s.Nil(nodeGroup) + s.NoError(err) +} + +func (s *CloudProviderTestSuite) TestPricing_NotImplemented() { + var ionoscloud *IonosCloudCloudProvider + pricingModel, err := ionoscloud.Pricing() + s.Nil(pricingModel) + s.Equal(cloudprovider.ErrNotImplemented, err) +} + +func (s *CloudProviderTestSuite) TestGetAvailableMachineTypes_NotImplemented() { + var ionoscloud *IonosCloudCloudProvider + machineTypes, err := ionoscloud.GetAvailableMachineTypes() + s.Nil(machineTypes) + s.Equal(cloudprovider.ErrNotImplemented, err) +} + +func (s *CloudProviderTestSuite) TestNewNodeGroup_NotImplemented() { + var ionoscloud *IonosCloudCloudProvider + nodeGroup, err := ionoscloud.NewNodeGroup("test", nil, nil, nil, nil) + s.Nil(nodeGroup) + s.Equal(cloudprovider.ErrNotImplemented, err) +} + +func (s *CloudProviderTestSuite) TestGetResourceLimiter() { + rl, err := s.provider.GetResourceLimiter() + s.NotNil(rl) + s.NoError(err) +} + +func (s *CloudProviderTestSuite) TestGPULabel() { + var ionoscloud *IonosCloudCloudProvider + s.Equal(GPULabel, ionoscloud.GPULabel()) +} + +func (s *CloudProviderTestSuite) TestGetAvailableGPUTypes() { + var ionoscloud *IonosCloudCloudProvider + s.Nil(ionoscloud.GetAvailableGPUTypes()) +} + +func (s *CloudProviderTestSuite) TestCleanup() { + s.NoError(s.provider.Cleanup()) +} + +func (s *CloudProviderTestSuite) TestRefresh() { + s.NoError(s.provider.Refresh()) +} diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionoscloud_manager.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionoscloud_manager.go new file mode 100644 index 0000000000..462e7ba0d0 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionoscloud_manager.go @@ -0,0 +1,338 @@ +/* +Copyright 2020 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 ionoscloud + +import ( + "fmt" + "os" + "strconv" + "strings" + "time" + + uuid "github.com/satori/go.uuid" + apiv1 "k8s.io/api/core/v1" + "k8s.io/autoscaler/cluster-autoscaler/cloudprovider" + "k8s.io/klog/v2" +) + +const ( + envKeyClusterId = "IONOS_CLUSTER_ID" + envKeyToken = "IONOS_TOKEN" + envKeyInsecure = "IONOS_INSECURE" + envKeyEndpoint = "IONOS_ENDPOINT" + envKeyPollTimeout = "IONOS_POLL_TIMEOUT" + envKeyPollInterval = "IONOS_POLL_INTERVAL" + envKeyTokensPath = "IONOS_TOKENS_PATH" + defaultTimeout = 15 * time.Minute + defaultInterval = 30 * time.Second +) + +// IonosCloudManager handles IonosCloud communication and data caching of node groups. +type IonosCloudManager interface { + // GetNodeGroupTargetSize gets node group target size. + GetNodeGroupTargetSize(nodeGroup cloudprovider.NodeGroup) (int, error) + // GetNodeGroupSize gets node group size. + GetNodeGroupSize(nodeGroup cloudprovider.NodeGroup) (int, error) + // SetNodeGroupSize sets the node group size. + SetNodeGroupSize(nodeGroup cloudprovider.NodeGroup, size int) error + // DeleteNode deletes a single node. + DeleteNode(nodeGroup cloudprovider.NodeGroup, nodeId string) error + // GetInstancesForNodeGroup returns the instances for the given node group. + GetInstancesForNodeGroup(nodeGroup cloudprovider.NodeGroup) ([]cloudprovider.Instance, error) + // GetNodeGroupForNode returns the node group that the node belongs to. + GetNodeGroupForNode(node *apiv1.Node) cloudprovider.NodeGroup + // TryLockNodeGroup tries to acquire a lock for a node group. + TryLockNodeGroup(nodeGroup cloudprovider.NodeGroup) bool + // UnlockNodeGroup releases a node group lock. + UnlockNodeGroup(nodeGroup cloudprovider.NodeGroup) + // GetNodeGroups returns the list of managed node groups. + GetNodeGroups() []cloudprovider.NodeGroup +} + +// Config holds information necessary to construct IonosCloud API clients. +type Config struct { + // ClusterId is the ID of the cluster to autoscale. + ClusterId string + // Token is an IonosCloud API access token. + // This token takes precedence over tokens contained in TokensPath. + Token string + // Endpoint overrides the default API URL. + Endpoint string + // Insecure configures the IonosCloud API client to use insecure connection. + Insecure bool + // PollTimeout is the timeout for polling a node pool after an update. + PollTimeout time.Duration + // PollInterval is the interval in which a node pool is polled after an update. + PollInterval time.Duration + // TokensPath points to a directory that contains file mappings of node pools to tokens. + TokensPath string +} + +// LoadConfigFromEnv loads the IonosCloud client config from env. +func LoadConfigFromEnv() (*Config, error) { + config := &Config{ + Token: os.Getenv(envKeyToken), + Endpoint: os.Getenv(envKeyEndpoint), + TokensPath: os.Getenv(envKeyTokensPath), + PollInterval: defaultInterval, + PollTimeout: defaultTimeout, + } + + if config.ClusterId = os.Getenv(envKeyClusterId); config.ClusterId == "" { + return nil, fmt.Errorf("missing value for %s", envKeyClusterId) + } + + if config.Token == "" && config.TokensPath == "" { + return nil, fmt.Errorf("missing value for either %s or %s", envKeyToken, envKeyTokensPath) + } + + var err error + if insecure := os.Getenv(envKeyInsecure); insecure != "" { + config.Insecure, err = strconv.ParseBool(insecure) + if err != nil { + return nil, fmt.Errorf("invalid value for %s: %s", envKeyInsecure, insecure) + } + } + if interval := os.Getenv(envKeyPollInterval); interval != "" { + config.PollInterval, err = time.ParseDuration(interval) + if err != nil { + return nil, fmt.Errorf("invalid value for %s: %s", envKeyPollInterval, interval) + } + } + if timeout := os.Getenv(envKeyPollTimeout); timeout != "" { + config.PollTimeout, err = time.ParseDuration(timeout) + if err != nil { + return nil, fmt.Errorf("invalid value for %s: %s", envKeyPollTimeout, timeout) + } + } + + return config, nil +} + +type ionosCloudManagerImpl struct { + cache *IonosCache + client *AutoscalingClient +} + +// CreateIonosCloudManager initializes a new IonosCloudManager. +func CreateIonosCloudManager(nodeGroupsConfig []string) (IonosCloudManager, error) { + klog.V(4).Info("Creating IonosCloud manager") + config, err := LoadConfigFromEnv() + if err != nil { + return nil, fmt.Errorf("failed to load config: %w", err) + } + + client, err := NewAutoscalingClient(config) + if err != nil { + return nil, fmt.Errorf("failed to initialize client: %w", err) + } + manager := newManager(client) + + if err := manager.initExplicitNodeGroups(nodeGroupsConfig); err != nil { + return nil, fmt.Errorf("failed to load pre-configured node groups: %w", err) + } + + return manager, nil +} + +func newManager(client *AutoscalingClient) *ionosCloudManagerImpl { + return &ionosCloudManagerImpl{ + cache: NewIonosCache(), + client: client, + } +} + +// initExplicitNodeGroups adds a list of pre-configured node groups to the cache. +// The node groups are parsed from a list of strings in the format of ::. +func (manager *ionosCloudManagerImpl) initExplicitNodeGroups(nodeGroupsConfig []string) error { + if len(nodeGroupsConfig) == 0 { + return fmt.Errorf("missing value for --nodes flag") + } + + for _, config := range nodeGroupsConfig { + parts := strings.Split(config, ":") + if len(parts) != 3 { + return fmt.Errorf("invalid autoscaling group config: %s", config) + } + min, err := strconv.ParseUint(parts[0], 10, 32) + if err != nil { + return fmt.Errorf("invalid value for min: %s", parts[0]) + } + max, err := strconv.ParseUint(parts[1], 10, 32) + if err != nil || max == 0 { + return fmt.Errorf("invalid value for max: %s", parts[1]) + } + if _, err := uuid.FromString(parts[2]); err != nil { + return fmt.Errorf("invalid value for id: %s", parts[2]) + } + + np := &nodePool{ + id: parts[2], + min: int(min), + max: int(max), + manager: manager, + } + fetchedNodePool, err := manager.client.GetNodePool(np.Id()) + if err != nil { + return fmt.Errorf("failed to fetch configured node pool %s: %w", np.Id(), err) + } + instances, err := manager.fetchInstancesForNodeGroup(np.Id()) + if err != nil { + return err + } + manager.cache.AddNodeGroup(np) + manager.cache.SetNodeGroupSize(np.Id(), len(instances)) + manager.cache.SetNodeGroupTargetSize(np.Id(), int(*fetchedNodePool.Properties.NodeCount)) + manager.cache.SetInstancesCacheForNodeGroup(np.Id(), instances) + } + return nil +} + +// GetNodeGroupSize gets node group size. +func (manager *ionosCloudManagerImpl) GetNodeGroupSize(nodeGroup cloudprovider.NodeGroup) (int, error) { + size, found := manager.cache.GetNodeGroupSize(nodeGroup.Id()) + if !found { + nodes, err := manager.client.ListNodes(nodeGroup.Id()) + if err != nil { + return 0, err + } + size = len(nodes) + manager.cache.SetNodeGroupSize(nodeGroup.Id(), size) + } + return size, nil +} + +// GetNodeGroupSize gets node group target size. +func (manager *ionosCloudManagerImpl) GetNodeGroupTargetSize(nodeGroup cloudprovider.NodeGroup) (int, error) { + size, found := manager.cache.GetNodeGroupTargetSize(nodeGroup.Id()) + if !found { + fetchedNodePool, err := manager.client.GetNodePool(nodeGroup.Id()) + if err != nil { + return 0, err + } + size = int(*fetchedNodePool.Properties.NodeCount) + manager.cache.SetNodeGroupTargetSize(nodeGroup.Id(), size) + } + return size, nil +} + +// SetNodeGroupSize sets the node group size. +func (manager *ionosCloudManagerImpl) SetNodeGroupSize(nodeGroup cloudprovider.NodeGroup, size int) error { + klog.V(1).Infof("Setting node group size of %s to %d", nodeGroup.Id(), size) + if err := manager.client.ResizeNodePool(nodeGroup.Id(), size); err != nil { + return fmt.Errorf("node group resize failed: %w", err) + } + manager.cache.InvalidateNodeGroupTargetSize(nodeGroup.Id()) + if err := manager.client.WaitForNodePoolResize(nodeGroup.Id(), size); err != nil { + return fmt.Errorf("wait for node group resize failed: %w", err) + } + if err := manager.refreshInstancesForNodeGroup(nodeGroup.Id()); err != nil { + return fmt.Errorf("cache refresh after resize failed: %w", err) + } + klog.V(1).Infof("Successfully increased node group size") + return nil +} + +// DeleteNode deletes a single node. +func (manager *ionosCloudManagerImpl) DeleteNode(nodeGroup cloudprovider.NodeGroup, nodeId string) error { + klog.V(1).Infof("Deleting node %s from node group %s", nodeId, nodeGroup.Id()) + size, err := manager.GetNodeGroupSize(nodeGroup) + if err != nil { + return err + } + manager.cache.InvalidateNodeGroupTargetSize(nodeGroup.Id()) + if err := manager.client.DeleteNode(nodeGroup.Id(), nodeId); err != nil { + return fmt.Errorf("delete node %s failed: %w", nodeId, err) + } + targetSize := size - 1 + if err := manager.client.WaitForNodePoolResize(nodeGroup.Id(), targetSize); err != nil { + return err + } + manager.cache.SetNodeGroupSize(nodeGroup.Id(), targetSize) + manager.cache.RemoveInstanceFromCache(nodeId) + klog.V(1).Infof("Successfully deleted node %s from node group %s", nodeId, nodeGroup.Id()) + return nil +} + +// GetInstancesForNodeGroup returns the instances for the given node group. +func (manager *ionosCloudManagerImpl) GetInstancesForNodeGroup(nodeGroup cloudprovider.NodeGroup) ([]cloudprovider.Instance, error) { + if manager.cache.NodeGroupNeedsRefresh(nodeGroup.Id()) { + if err := manager.refreshInstancesForNodeGroup(nodeGroup.Id()); err != nil { + return nil, err + } + } + return manager.cache.GetInstancesForNodeGroup(nodeGroup.Id()), nil +} + +func (manager *ionosCloudManagerImpl) GetNodeGroupForNode(node *apiv1.Node) cloudprovider.NodeGroup { + nodeId := convertToNodeId(node.Spec.ProviderID) + return manager.cache.GetNodeGroupForNode(nodeId) +} + +// Refreshes the cache holding the instances for the configured node groups. +func (manager *ionosCloudManagerImpl) Refresh() error { + nodeGroupInstances := map[string][]cloudprovider.Instance{} + for _, id := range manager.cache.GetNodeGroupIds() { + instances, err := manager.fetchInstancesForNodeGroup(id) + if err != nil { + return err + } + nodeGroupInstances[id] = instances + } + + manager.cache.SetInstancesCache(nodeGroupInstances) + return nil +} + +func (manager *ionosCloudManagerImpl) refreshInstancesForNodeGroup(id string) error { + instances, err := manager.fetchInstancesForNodeGroup(id) + if err != nil { + return err + } + manager.cache.SetInstancesCacheForNodeGroup(id, instances) + manager.cache.SetNodeGroupSize(id, len(instances)) + return nil +} + +func (manager *ionosCloudManagerImpl) fetchInstancesForNodeGroup(id string) ([]cloudprovider.Instance, error) { + klog.V(4).Infof("Refreshing instances for node group: %s", id) + kubernetesNodes, err := manager.client.ListNodes(id) + if err != nil { + return nil, fmt.Errorf("failed to list nodes for node group %s: %w", id, err) + } + + instances := make([]cloudprovider.Instance, len(kubernetesNodes)) + for i, kubernetesNode := range kubernetesNodes { + instances[i] = convertToInstance(kubernetesNode) + } + + return instances, nil +} + +func (manager *ionosCloudManagerImpl) GetNodeGroups() []cloudprovider.NodeGroup { + return manager.cache.GetNodeGroups() +} + +// TryLockNodeGroup tries to acquire a lock for a node group. +func (manager *ionosCloudManagerImpl) TryLockNodeGroup(nodeGroup cloudprovider.NodeGroup) bool { + return manager.cache.TryLockNodeGroup(nodeGroup) +} + +// UnlockNodeGroup releases a node group lock. +func (manager *ionosCloudManagerImpl) UnlockNodeGroup(nodeGroup cloudprovider.NodeGroup) { + manager.cache.UnlockNodeGroup(nodeGroup) +} diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/ionoscloud_manager_test.go b/cluster-autoscaler/cloudprovider/ionoscloud/ionoscloud_manager_test.go new file mode 100644 index 0000000000..3fe9ec99e8 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/ionoscloud_manager_test.go @@ -0,0 +1,580 @@ +/* +Copyright 2020 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 ionoscloud + +import ( + "errors" + "fmt" + "os" + "testing" + "time" + + uuid "github.com/satori/go.uuid" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + apiv1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/autoscaler/cluster-autoscaler/cloudprovider" + ionos "k8s.io/autoscaler/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go" + "k8s.io/utils/pointer" +) + +var ( + pollInterval = 10 * time.Millisecond + pollTimeout = 50 * time.Millisecond +) + +func TestLoadConfigFromEnv(t *testing.T) { + cases := []struct { + name string + env map[string]string + expectErr bool + expectCfg *Config + }{ + { + name: "missing cluster ID", + expectErr: true, + }, + { + name: "missing both token and tokens path", + env: map[string]string{envKeyClusterId: "1"}, + expectErr: true, + }, + { + name: "invalid value for insecure", + env: map[string]string{envKeyClusterId: "1", envKeyToken: "token", envKeyInsecure: "fasle"}, + expectErr: true, + }, + { + name: "invalid value for interval", + env: map[string]string{envKeyClusterId: "1", envKeyToken: "token", envKeyPollInterval: "10Ghz"}, + expectErr: true, + }, + { + name: "invalid value for timeout", + env: map[string]string{envKeyClusterId: "1", envKeyToken: "token", envKeyPollTimeout: "1ly"}, + expectErr: true, + }, + { + name: "use defaults", + env: map[string]string{ + envKeyClusterId: "test", + envKeyToken: "token", + }, + expectCfg: &Config{ + ClusterId: "test", + PollInterval: defaultInterval, + PollTimeout: defaultTimeout, + Token: "token", + }, + }, + { + name: "all fields set", + env: map[string]string{ + envKeyClusterId: "test", + envKeyEndpoint: "/dev/null", + envKeyInsecure: "1", + envKeyPollInterval: "42ms", + envKeyPollTimeout: "1337s", + envKeyToken: "token", + envKeyTokensPath: "/etc/passwd", + }, + expectCfg: &Config{ + ClusterId: "test", + Endpoint: "/dev/null", + Insecure: true, + PollInterval: 42 * time.Millisecond, + PollTimeout: 1337 * time.Second, + Token: "token", + TokensPath: "/etc/passwd", + }, + }, + } + + for _, c := range cases { + t.Run(c.name, func(t *testing.T) { + for key, value := range c.env { + os.Setenv(key, value) + defer os.Unsetenv(key) + } + + cfg, err := LoadConfigFromEnv() + require.Equalf(t, c.expectErr, err != nil, "expected error: %t, got: %v", c.expectErr, err) + require.Equal(t, c.expectCfg, cfg) + }) + } +} + +func TestCreateIonosCloudManager(t *testing.T) { + os.Setenv(envKeyClusterId, "test") + os.Setenv(envKeyToken, "token") + defer func() { + os.Unsetenv(envKeyClusterId) + os.Unsetenv(envKeyToken) + }() + + manager, err := CreateIonosCloudManager(nil) + require.Nil(t, manager) + require.Error(t, err) +} + +func newKubernetesNodePool(state string, size int) *ionos.KubernetesNodePool { + return &ionos.KubernetesNodePool{ + Id: pointer.StringPtr("test"), + Metadata: &ionos.DatacenterElementMetadata{State: pointer.StringPtr(state)}, + Properties: &ionos.KubernetesNodePoolProperties{NodeCount: pointer.Int32Ptr(int32(size))}, + } +} + +func newKubernetesNode(id, state string) ionos.KubernetesNode { + return ionos.KubernetesNode{ + Id: pointer.StringPtr(id), + Metadata: &ionos.KubernetesNodeMetadata{State: pointer.StringPtr(state)}, + } +} + +func newInstance(id string) cloudprovider.Instance { + return cloudprovider.Instance{Id: convertToInstanceId(id)} +} + +func newInstanceWithState(id string, state cloudprovider.InstanceState) cloudprovider.Instance { + instance := newInstance(id) + instance.Status = &cloudprovider.InstanceStatus{ + State: state, + } + return instance +} + +func newAPINode(id string) *apiv1.Node { + return &apiv1.Node{ + Spec: apiv1.NodeSpec{ + ProviderID: convertToInstanceId(id), + }, + } +} + +type ManagerTestSuite struct { + suite.Suite + client *MockAPIClient + manager *ionosCloudManagerImpl + nodePool *nodePool +} + +func (s *ManagerTestSuite) SetupTest() { + s.client = &MockAPIClient{} + apiClientFactory = func(_, _ string, _ bool) APIClient { return s.client } + client, err := NewAutoscalingClient(&Config{ + ClusterId: "cluster", + Token: "token", + PollInterval: pollInterval, + PollTimeout: pollTimeout, + }) + s.Require().NoError(err) + + s.manager = newManager(client) + s.nodePool = &nodePool{ + id: "test", + min: 1, + max: 3, + manager: s.manager, + } +} + +func (s *ManagerTestSuite) TearDownTest() { + apiClientFactory = NewAPIClient + s.client.AssertExpectations(s.T()) +} + +func (s *ManagerTestSuite) OnGetKubernetesNodePool(retval *ionos.KubernetesNodePool, reterr error) *mock.Call { + req := ionos.ApiK8sNodepoolsFindByIdRequest{} + nodepool := ionos.KubernetesNodePool{} + if retval != nil { + nodepool = *retval + } + return s.client. + On("K8sNodepoolsFindById", mock.Anything, s.manager.client.clusterId, s.nodePool.id).Return(req). + On("K8sNodepoolsFindByIdExecute", req).Return(nodepool, nil, reterr) +} + +func (s *ManagerTestSuite) OnUpdateKubernetesNodePool(size int, reterr error) *mock.Call { + origReq := ionos.ApiK8sNodepoolsPutRequest{} + req := ionos.ApiK8sNodepoolsPutRequest{}.KubernetesNodePoolProperties(resizeRequestBody(size)) + return s.client. + On("K8sNodepoolsPut", mock.Anything, s.manager.client.clusterId, s.nodePool.id).Return(origReq). + On("K8sNodepoolsPutExecute", req).Return(ionos.KubernetesNodePoolForPut{}, nil, reterr) +} + +func (s *ManagerTestSuite) OnListKubernetesNodes(retval *ionos.KubernetesNodes, reterr error) *mock.Call { + origReq := ionos.ApiK8sNodepoolsNodesGetRequest{} + req := ionos.ApiK8sNodepoolsNodesGetRequest{}.Depth(1) + nodes := ionos.KubernetesNodes{} + if retval != nil { + nodes = *retval + } + return s.client. + On("K8sNodepoolsNodesGet", mock.Anything, s.manager.client.clusterId, s.nodePool.id).Return(origReq). + On("K8sNodepoolsNodesGetExecute", req).Return(nodes, nil, reterr) +} + +func (s *ManagerTestSuite) OnDeleteKubernetesNode(id string, reterr error) *mock.Call { + req := ionos.ApiK8sNodepoolsNodesDeleteRequest{} + return s.client. + On("K8sNodepoolsNodesDelete", mock.Anything, s.manager.client.clusterId, s.nodePool.id, id).Return(req). + On("K8sNodepoolsNodesDeleteExecute", req).Return(nil, nil, reterr) +} + +func TestIonosCloudManager(t *testing.T) { + suite.Run(t, new(ManagerTestSuite)) +} + +func (s *ManagerTestSuite) TestGetNodeGroupSize_Error() { + s.OnListKubernetesNodes(nil, fmt.Errorf("error")).Once() + + size, err := s.manager.GetNodeGroupSize(s.nodePool) + s.Error(err) + s.Zero(size) +} + +func (s *ManagerTestSuite) TestGetNodeGroupSize_OK() { + s.OnListKubernetesNodes(&ionos.KubernetesNodes{ + Items: &[]ionos.KubernetesNode{ + newKubernetesNode("node-1", K8sNodeStateReady), + newKubernetesNode("node-1", K8sNodeStateReady), + }, + }, nil).Once() + + size, err := s.manager.GetNodeGroupSize(s.nodePool) + s.NoError(err) + s.Equal(2, size) +} + +func (s *ManagerTestSuite) TestGetNodeGroupTargetSize_Error() { + s.OnGetKubernetesNodePool(nil, fmt.Errorf("error")).Once() + + size, err := s.manager.GetNodeGroupTargetSize(s.nodePool) + s.Error(err) + s.Zero(size) +} + +func (s *ManagerTestSuite) TestGetNodeGroupTargetSize_OK() { + s.OnGetKubernetesNodePool(newKubernetesNodePool(K8sStateActive, 2), nil).Once() + + size, err := s.manager.GetNodeGroupTargetSize(s.nodePool) + s.NoError(err) + s.Equal(2, size) +} + +func (s *ManagerTestSuite) TestSetNodeGroupSize_ResizeError() { + s.manager.cache.SetNodeGroupSize(s.nodePool.Id(), 1) + s.OnUpdateKubernetesNodePool(2, fmt.Errorf("error")).Once() + + s.Error(s.manager.SetNodeGroupSize(s.nodePool, 2)) + s.Empty(s.manager.cache.GetNodeGroups()) + size, found := s.manager.cache.GetNodeGroupSize(s.nodePool.Id()) + s.True(found) + s.Equal(1, size) +} + +func (s *ManagerTestSuite) TestSetNodeGroupSize_WaitGetError() { + s.OnUpdateKubernetesNodePool(2, nil).Once() + s.OnGetKubernetesNodePool(newKubernetesNodePool(K8sStateUpdating, 1), nil).Times(3) + s.OnGetKubernetesNodePool(nil, fmt.Errorf("error")).Once() + + err := s.manager.SetNodeGroupSize(s.nodePool, 2) + s.Error(err) + s.False(errors.Is(err, wait.ErrWaitTimeout)) + s.Empty(s.manager.cache.GetNodeGroups()) + s.Empty(s.manager.cache.GetInstancesForNodeGroup(s.nodePool.Id())) +} + +func (s *ManagerTestSuite) TestSetNodeGroupSize_WaitTimeout() { + s.OnUpdateKubernetesNodePool(2, nil).Once() + pollCount := 0 + s.OnGetKubernetesNodePool(newKubernetesNodePool(K8sStateUpdating, 1), nil). + Run(func(_ mock.Arguments) { + pollCount++ + }) + + err := s.manager.SetNodeGroupSize(s.nodePool, 2) + s.Error(err) + s.True(errors.Is(err, wait.ErrWaitTimeout)) + // The poll count may vary, so just do this to prevent flakes. + s.True(pollCount > int(pollTimeout/pollInterval)) + s.Empty(s.manager.cache.GetNodeGroups()) + s.Empty(s.manager.cache.GetInstancesForNodeGroup(s.nodePool.Id())) +} + +func (s *ManagerTestSuite) TestSetNodeGroupSize_RefreshNodesError() { + s.OnUpdateKubernetesNodePool(2, nil).Once() + s.OnGetKubernetesNodePool(newKubernetesNodePool(K8sStateUpdating, 1), nil).Times(3) + s.OnGetKubernetesNodePool(newKubernetesNodePool(K8sStateActive, 2), nil).Once() + s.OnListKubernetesNodes(nil, fmt.Errorf("error")).Once() + + s.Error(s.manager.SetNodeGroupSize(s.nodePool, 2)) + s.Empty(s.manager.cache.GetNodeGroups()) + s.Empty(s.manager.cache.GetInstancesForNodeGroup(s.nodePool.Id())) +} + +func (s *ManagerTestSuite) TestSetNodeGroupSize_OK() { + s.OnUpdateKubernetesNodePool(2, nil).Once() + s.OnGetKubernetesNodePool(newKubernetesNodePool(K8sStateUpdating, 1), nil).Times(3) + s.OnGetKubernetesNodePool(newKubernetesNodePool(K8sStateActive, 2), nil).Once() + s.OnListKubernetesNodes(&ionos.KubernetesNodes{ + Items: &[]ionos.KubernetesNode{ + newKubernetesNode("node-1", K8sNodeStateReady), + newKubernetesNode("node-2", K8sNodeStateReady), + }, + }, nil).Once() + + _, found := s.manager.cache.GetNodeGroupSize(s.nodePool.Id()) + s.False(found) + s.NoError(s.manager.SetNodeGroupSize(s.nodePool, 2)) + size, found := s.manager.cache.GetNodeGroupSize(s.nodePool.Id()) + s.True(found) + s.Equal(2, size) + expectInstances := []cloudprovider.Instance{ + convertToInstance(newKubernetesNode("node-1", K8sNodeStateReady)), + convertToInstance(newKubernetesNode("node-2", K8sNodeStateReady)), + } + s.ElementsMatch(expectInstances, s.manager.cache.GetInstancesForNodeGroup(s.nodePool.Id())) +} + +func (s *ManagerTestSuite) TestGetInstancesForNodeGroup_Error() { + s.OnListKubernetesNodes(nil, fmt.Errorf("error")).Once() + + instances, err := s.manager.GetInstancesForNodeGroup(s.nodePool) + s.Error(err) + s.Empty(instances) +} + +func (s *ManagerTestSuite) TestGetInstancesForNodeGroup_RefreshOK() { + s.manager.cache.AddNodeGroup(s.nodePool) + s.OnListKubernetesNodes(&ionos.KubernetesNodes{ + Items: &[]ionos.KubernetesNode{ + newKubernetesNode("node-1", K8sNodeStateReady), + newKubernetesNode("node-2", K8sNodeStateReady), + newKubernetesNode("node-3", K8sNodeStateProvisioning), + }, + }, nil).Once() + + expectInstances := []cloudprovider.Instance{ + newInstanceWithState("node-1", cloudprovider.InstanceRunning), + newInstanceWithState("node-2", cloudprovider.InstanceRunning), + newInstanceWithState("node-3", cloudprovider.InstanceCreating), + } + instances, err := s.manager.GetInstancesForNodeGroup(s.nodePool) + s.NoError(err) + s.ElementsMatch(expectInstances, instances) +} + +func (s *ManagerTestSuite) TestGetInstancesForNodeGroup_CachedOK() { + s.manager.cache.AddNodeGroup(s.nodePool) + s.manager.cache.SetInstancesCacheForNodeGroup(s.nodePool.Id(), []cloudprovider.Instance{ + newInstanceWithState("node-1", cloudprovider.InstanceRunning), + newInstanceWithState("node-2", cloudprovider.InstanceRunning), + newInstanceWithState("node-3", cloudprovider.InstanceCreating), + }) + + expectInstances := []cloudprovider.Instance{ + newInstanceWithState("node-1", cloudprovider.InstanceRunning), + newInstanceWithState("node-2", cloudprovider.InstanceRunning), + newInstanceWithState("node-3", cloudprovider.InstanceCreating), + } + instances, err := s.manager.GetInstancesForNodeGroup(s.nodePool) + s.NoError(err) + s.ElementsMatch(expectInstances, instances) +} + +func (s *ManagerTestSuite) TestGetNodeGroupForNode_NoMatchingNodes() { + s.Nil(s.manager.GetNodeGroupForNode(newAPINode("node-1"))) +} + +func (s *ManagerTestSuite) TestGetNodeGroupForNode_NoMatchingNodePools() { + s.manager.cache.nodesToNodeGroups["node-1"] = "foo" + + s.Nil(s.manager.GetNodeGroupForNode(newAPINode("node-1"))) +} + +func (s *ManagerTestSuite) TestGetNodeGroupForNode_OK() { + s.manager.cache.nodesToNodeGroups["node-1"] = s.nodePool.Id() + s.manager.cache.nodeGroups[s.nodePool.Id()] = newCacheEntry(s.nodePool, time.Now()) + + nodePool := s.manager.GetNodeGroupForNode(newAPINode("node-1")) + s.Equal(s.nodePool, nodePool) +} + +func (s *ManagerTestSuite) TestGetNodeGroups_OK() { + nodePools := []*nodePool{ + {id: "1", min: 1, max: 3, manager: s.manager}, + {id: "2", min: 1, max: 5, manager: s.manager}, + {id: "3", min: 1, max: 10, manager: s.manager}, + } + for _, nodePool := range nodePools { + s.manager.cache.AddNodeGroup(nodePool) + } + + s.ElementsMatch(nodePools, s.manager.GetNodeGroups()) +} + +func (s *ManagerTestSuite) TestTryLockNodeGroup_LockUnlock() { + s.True(s.manager.TryLockNodeGroup(s.nodePool)) + s.False(s.manager.TryLockNodeGroup(s.nodePool)) + s.manager.UnlockNodeGroup(&nodePool{id: "some other node pool"}) + s.False(s.manager.TryLockNodeGroup(s.nodePool)) + s.manager.UnlockNodeGroup(s.nodePool) + s.True(s.manager.TryLockNodeGroup(s.nodePool)) +} + +func (s *ManagerTestSuite) TestDeleteNode_GetSizeError() { + s.OnListKubernetesNodes(nil, fmt.Errorf("error")).Once() + s.Error(s.manager.DeleteNode(s.nodePool, "deleteme")) +} + +func (s *ManagerTestSuite) TestDeleteNode_DeleteError() { + s.manager.cache.SetNodeGroupSize(s.nodePool.Id(), 2) + s.manager.cache.SetNodeGroupTargetSize(s.nodePool.Id(), 2) + s.OnDeleteKubernetesNode("notfound", fmt.Errorf("error")).Once() + + s.Error(s.manager.DeleteNode(s.nodePool, "notfound")) + size, found := s.manager.cache.GetNodeGroupSize(s.nodePool.Id()) + s.True(found) + s.Equal(2, size) +} + +func (s *ManagerTestSuite) TestDeleteNode_WaitError() { + s.manager.cache.SetNodeGroupSize(s.nodePool.Id(), 2) + s.manager.cache.SetNodeGroupTargetSize(s.nodePool.Id(), 2) + s.OnDeleteKubernetesNode("testnode", nil).Once() + s.OnGetKubernetesNodePool(newKubernetesNodePool(K8sStateUpdating, 1), nil).Twice() + s.OnGetKubernetesNodePool(nil, fmt.Errorf("error")).Once() + + s.Error(s.manager.DeleteNode(s.nodePool, "testnode")) + size, found := s.manager.cache.GetNodeGroupSize(s.nodePool.Id()) + s.True(found) + s.Equal(2, size) + _, found = s.manager.cache.GetNodeGroupTargetSize(s.nodePool.Id()) + s.False(found) +} + +func (s *ManagerTestSuite) TestDeleteNode_OK() { + s.manager.cache.SetNodeGroupSize(s.nodePool.Id(), 2) + s.manager.cache.SetNodeGroupTargetSize(s.nodePool.Id(), 2) + s.manager.cache.SetInstancesCacheForNodeGroup(s.nodePool.Id(), []cloudprovider.Instance{ + newInstance("testnode"), newInstance("othernode"), + }) + s.OnDeleteKubernetesNode("testnode", nil).Once() + s.OnGetKubernetesNodePool(newKubernetesNodePool(K8sStateUpdating, 1), nil).Times(3) + s.OnGetKubernetesNodePool(newKubernetesNodePool(K8sStateActive, 1), nil).Once() + + s.NoError(s.manager.DeleteNode(s.nodePool, "testnode")) + size, found := s.manager.cache.GetNodeGroupSize(s.nodePool.Id()) + s.True(found) + s.Equal(1, size) + _, found = s.manager.cache.GetNodeGroupTargetSize(s.nodePool.Id()) + s.False(found) + s.Nil(s.manager.cache.GetNodeGroupForNode("testnode")) +} + +func (s *ManagerTestSuite) TestInitExplicitNodeGroups_InvalidFormat() { + s.Error(s.manager.initExplicitNodeGroups([]string{"in:valid"})) +} + +func (s *ManagerTestSuite) TestInitExplicitNodeGroups_InvalidMinValue() { + s.Error(s.manager.initExplicitNodeGroups([]string{"invalid:3:test"})) +} + +func (s *ManagerTestSuite) TestInitExplicitNodeGroups_InvalidMaxValue() { + s.Error(s.manager.initExplicitNodeGroups([]string{"1:invalid:test"})) +} + +func (s *ManagerTestSuite) TestInitExplicitNodeGroups_InvalidIDValue() { + s.Error(s.manager.initExplicitNodeGroups([]string{"1:3:invalid"})) +} + +func (s *ManagerTestSuite) TestInitExplicitNodeGroups_GetNodePoolError() { + id := uuid.NewV4().String() + s.nodePool.id = id + s.OnGetKubernetesNodePool(nil, fmt.Errorf("error")).Once() + + s.Error(s.manager.initExplicitNodeGroups([]string{"1:3:" + id})) +} + +func (s *ManagerTestSuite) TestInitExplicitNodeGroups_ListNodesError() { + id := uuid.NewV4().String() + s.nodePool.id = id + kNodePool := newKubernetesNodePool(K8sStateActive, 2) + s.OnGetKubernetesNodePool(kNodePool, nil).Once() + s.OnListKubernetesNodes(nil, fmt.Errorf("error")).Once() + + s.Error(s.manager.initExplicitNodeGroups([]string{"1:3:" + id})) +} + +func (s *ManagerTestSuite) TestInitExplicitNodeGroups_OK() { + id := uuid.NewV4().String() + s.nodePool.id = id + kNodePool := newKubernetesNodePool(K8sStateActive, 2) + s.OnGetKubernetesNodePool(kNodePool, nil).Once() + s.OnListKubernetesNodes(&ionos.KubernetesNodes{ + Items: &[]ionos.KubernetesNode{ + newKubernetesNode("node-1", K8sNodeStateReady), + newKubernetesNode("node-2", K8sNodeStateReady), + }, + }, nil).Once() + + s.NoError(s.manager.initExplicitNodeGroups([]string{"1:3:" + id})) + s.Equal([]cloudprovider.NodeGroup{&nodePool{ + id: id, + min: 1, + max: 3, + manager: s.manager, + }}, s.manager.cache.GetNodeGroups()) + size, found := s.manager.cache.GetNodeGroupTargetSize(id) + s.True(found) + s.Equal(2, size) + size, found = s.manager.cache.GetNodeGroupSize(id) + s.True(found) + s.Equal(2, size) + s.ElementsMatch([]cloudprovider.Instance{ + newInstanceWithState("node-1", cloudprovider.InstanceRunning), + newInstanceWithState("node-2", cloudprovider.InstanceRunning), + }, s.manager.cache.GetInstances()) +} + +func (s *ManagerTestSuite) TestRefresh_Error() { + s.OnListKubernetesNodes(nil, fmt.Errorf("error")).Once() + + s.manager.cache.AddNodeGroup(&nodePool{id: "test", min: 1, max: 3}) + s.Error(s.manager.Refresh()) +} + +func (s *ManagerTestSuite) TestRefresh_OK() { + s.OnListKubernetesNodes(&ionos.KubernetesNodes{ + Items: &[]ionos.KubernetesNode{ + newKubernetesNode("1", K8sNodeStateReady), + newKubernetesNode("2", K8sNodeStateProvisioning), + }, + }, nil).Once() + + s.manager.cache.AddNodeGroup(&nodePool{id: "test", min: 1, max: 3}) + s.Empty(s.manager.cache.GetInstances()) + s.NoError(s.manager.Refresh()) + s.ElementsMatch([]cloudprovider.Instance{ + newInstanceWithState("1", cloudprovider.InstanceRunning), + newInstanceWithState("2", cloudprovider.InstanceCreating), + }, s.manager.cache.GetInstances()) +} diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/mock_api_client_test.go b/cluster-autoscaler/cloudprovider/ionoscloud/mock_api_client_test.go new file mode 100644 index 0000000000..b92841cadd --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/mock_api_client_test.go @@ -0,0 +1,209 @@ +/* +Copyright 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. +*/ + +// Code generated by mockery v2.3.0. DO NOT EDIT. + +package ionoscloud + +import ( + context "context" + + mock "github.com/stretchr/testify/mock" + ionossdk "k8s.io/autoscaler/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go" +) + +// MockAPIClient is an autogenerated mock type for the APIClient type +type MockAPIClient struct { + mock.Mock +} + +// K8sNodepoolsFindById provides a mock function with given fields: ctx, k8sClusterId, nodepoolId +func (_m *MockAPIClient) K8sNodepoolsFindById(ctx context.Context, k8sClusterId string, nodepoolId string) ionossdk.ApiK8sNodepoolsFindByIdRequest { + ret := _m.Called(ctx, k8sClusterId, nodepoolId) + + var r0 ionossdk.ApiK8sNodepoolsFindByIdRequest + if rf, ok := ret.Get(0).(func(context.Context, string, string) ionossdk.ApiK8sNodepoolsFindByIdRequest); ok { + r0 = rf(ctx, k8sClusterId, nodepoolId) + } else { + r0 = ret.Get(0).(ionossdk.ApiK8sNodepoolsFindByIdRequest) + } + + return r0 +} + +// K8sNodepoolsFindByIdExecute provides a mock function with given fields: r +func (_m *MockAPIClient) K8sNodepoolsFindByIdExecute(r ionossdk.ApiK8sNodepoolsFindByIdRequest) (ionossdk.KubernetesNodePool, *ionossdk.APIResponse, error) { + ret := _m.Called(r) + + var r0 ionossdk.KubernetesNodePool + if rf, ok := ret.Get(0).(func(ionossdk.ApiK8sNodepoolsFindByIdRequest) ionossdk.KubernetesNodePool); ok { + r0 = rf(r) + } else { + r0 = ret.Get(0).(ionossdk.KubernetesNodePool) + } + + var r1 *ionossdk.APIResponse + if rf, ok := ret.Get(1).(func(ionossdk.ApiK8sNodepoolsFindByIdRequest) *ionossdk.APIResponse); ok { + r1 = rf(r) + } else { + if ret.Get(1) != nil { + r1 = ret.Get(1).(*ionossdk.APIResponse) + } + } + + var r2 error + if rf, ok := ret.Get(2).(func(ionossdk.ApiK8sNodepoolsFindByIdRequest) error); ok { + r2 = rf(r) + } else { + r2 = ret.Error(2) + } + + return r0, r1, r2 +} + +// K8sNodepoolsNodesDelete provides a mock function with given fields: ctx, k8sClusterId, nodepoolId, nodeId +func (_m *MockAPIClient) K8sNodepoolsNodesDelete(ctx context.Context, k8sClusterId string, nodepoolId string, nodeId string) ionossdk.ApiK8sNodepoolsNodesDeleteRequest { + ret := _m.Called(ctx, k8sClusterId, nodepoolId, nodeId) + + var r0 ionossdk.ApiK8sNodepoolsNodesDeleteRequest + if rf, ok := ret.Get(0).(func(context.Context, string, string, string) ionossdk.ApiK8sNodepoolsNodesDeleteRequest); ok { + r0 = rf(ctx, k8sClusterId, nodepoolId, nodeId) + } else { + r0 = ret.Get(0).(ionossdk.ApiK8sNodepoolsNodesDeleteRequest) + } + + return r0 +} + +// K8sNodepoolsNodesDeleteExecute provides a mock function with given fields: r +func (_m *MockAPIClient) K8sNodepoolsNodesDeleteExecute(r ionossdk.ApiK8sNodepoolsNodesDeleteRequest) (map[string]interface{}, *ionossdk.APIResponse, error) { + ret := _m.Called(r) + + var r0 map[string]interface{} + if rf, ok := ret.Get(0).(func(ionossdk.ApiK8sNodepoolsNodesDeleteRequest) map[string]interface{}); ok { + r0 = rf(r) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(map[string]interface{}) + } + } + + var r1 *ionossdk.APIResponse + if rf, ok := ret.Get(1).(func(ionossdk.ApiK8sNodepoolsNodesDeleteRequest) *ionossdk.APIResponse); ok { + r1 = rf(r) + } else { + if ret.Get(1) != nil { + r1 = ret.Get(1).(*ionossdk.APIResponse) + } + } + + var r2 error + if rf, ok := ret.Get(2).(func(ionossdk.ApiK8sNodepoolsNodesDeleteRequest) error); ok { + r2 = rf(r) + } else { + r2 = ret.Error(2) + } + + return r0, r1, r2 +} + +// K8sNodepoolsNodesGet provides a mock function with given fields: ctx, k8sClusterId, nodepoolId +func (_m *MockAPIClient) K8sNodepoolsNodesGet(ctx context.Context, k8sClusterId string, nodepoolId string) ionossdk.ApiK8sNodepoolsNodesGetRequest { + ret := _m.Called(ctx, k8sClusterId, nodepoolId) + + var r0 ionossdk.ApiK8sNodepoolsNodesGetRequest + if rf, ok := ret.Get(0).(func(context.Context, string, string) ionossdk.ApiK8sNodepoolsNodesGetRequest); ok { + r0 = rf(ctx, k8sClusterId, nodepoolId) + } else { + r0 = ret.Get(0).(ionossdk.ApiK8sNodepoolsNodesGetRequest) + } + + return r0 +} + +// K8sNodepoolsNodesGetExecute provides a mock function with given fields: r +func (_m *MockAPIClient) K8sNodepoolsNodesGetExecute(r ionossdk.ApiK8sNodepoolsNodesGetRequest) (ionossdk.KubernetesNodes, *ionossdk.APIResponse, error) { + ret := _m.Called(r) + + var r0 ionossdk.KubernetesNodes + if rf, ok := ret.Get(0).(func(ionossdk.ApiK8sNodepoolsNodesGetRequest) ionossdk.KubernetesNodes); ok { + r0 = rf(r) + } else { + r0 = ret.Get(0).(ionossdk.KubernetesNodes) + } + + var r1 *ionossdk.APIResponse + if rf, ok := ret.Get(1).(func(ionossdk.ApiK8sNodepoolsNodesGetRequest) *ionossdk.APIResponse); ok { + r1 = rf(r) + } else { + if ret.Get(1) != nil { + r1 = ret.Get(1).(*ionossdk.APIResponse) + } + } + + var r2 error + if rf, ok := ret.Get(2).(func(ionossdk.ApiK8sNodepoolsNodesGetRequest) error); ok { + r2 = rf(r) + } else { + r2 = ret.Error(2) + } + + return r0, r1, r2 +} + +// K8sNodepoolsPut provides a mock function with given fields: ctx, k8sClusterId, nodepoolId +func (_m *MockAPIClient) K8sNodepoolsPut(ctx context.Context, k8sClusterId string, nodepoolId string) ionossdk.ApiK8sNodepoolsPutRequest { + ret := _m.Called(ctx, k8sClusterId, nodepoolId) + + var r0 ionossdk.ApiK8sNodepoolsPutRequest + if rf, ok := ret.Get(0).(func(context.Context, string, string) ionossdk.ApiK8sNodepoolsPutRequest); ok { + r0 = rf(ctx, k8sClusterId, nodepoolId) + } else { + r0 = ret.Get(0).(ionossdk.ApiK8sNodepoolsPutRequest) + } + + return r0 +} + +// K8sNodepoolsPutExecute provides a mock function with given fields: r +func (_m *MockAPIClient) K8sNodepoolsPutExecute(r ionossdk.ApiK8sNodepoolsPutRequest) (ionossdk.KubernetesNodePoolForPut, *ionossdk.APIResponse, error) { + ret := _m.Called(r) + + var r0 ionossdk.KubernetesNodePoolForPut + if rf, ok := ret.Get(0).(func(ionossdk.ApiK8sNodepoolsPutRequest) ionossdk.KubernetesNodePoolForPut); ok { + r0 = rf(r) + } else { + r0 = ret.Get(0).(ionossdk.KubernetesNodePoolForPut) + } + + var r1 *ionossdk.APIResponse + if rf, ok := ret.Get(1).(func(ionossdk.ApiK8sNodepoolsPutRequest) *ionossdk.APIResponse); ok { + r1 = rf(r) + } else { + if ret.Get(1) != nil { + r1 = ret.Get(1).(*ionossdk.APIResponse) + } + } + + var r2 error + if rf, ok := ret.Get(2).(func(ionossdk.ApiK8sNodepoolsPutRequest) error); ok { + r2 = rf(r) + } else { + r2 = ret.Error(2) + } + + return r0, r1, r2 +} diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/mock_ionos_cloud_manager_test.go b/cluster-autoscaler/cloudprovider/ionoscloud/mock_ionos_cloud_manager_test.go new file mode 100644 index 0000000000..63d1a45e3d --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/mock_ionos_cloud_manager_test.go @@ -0,0 +1,175 @@ +/* +Copyright 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. +*/ + +// Code generated by mockery v2.3.0. DO NOT EDIT. + +package ionoscloud + +import ( + mock "github.com/stretchr/testify/mock" + cloudprovider "k8s.io/autoscaler/cluster-autoscaler/cloudprovider" + + v1 "k8s.io/api/core/v1" +) + +// MockIonosCloudManager is an autogenerated mock type for the IonosCloudManager type +type MockIonosCloudManager struct { + mock.Mock +} + +// DeleteNode provides a mock function with given fields: nodeGroup, nodeId +func (_m *MockIonosCloudManager) DeleteNode(nodeGroup cloudprovider.NodeGroup, nodeId string) error { + ret := _m.Called(nodeGroup, nodeId) + + var r0 error + if rf, ok := ret.Get(0).(func(cloudprovider.NodeGroup, string) error); ok { + r0 = rf(nodeGroup, nodeId) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// GetInstancesForNodeGroup provides a mock function with given fields: nodeGroup +func (_m *MockIonosCloudManager) GetInstancesForNodeGroup(nodeGroup cloudprovider.NodeGroup) ([]cloudprovider.Instance, error) { + ret := _m.Called(nodeGroup) + + var r0 []cloudprovider.Instance + if rf, ok := ret.Get(0).(func(cloudprovider.NodeGroup) []cloudprovider.Instance); ok { + r0 = rf(nodeGroup) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]cloudprovider.Instance) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(cloudprovider.NodeGroup) error); ok { + r1 = rf(nodeGroup) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetNodeGroupForNode provides a mock function with given fields: node +func (_m *MockIonosCloudManager) GetNodeGroupForNode(node *v1.Node) cloudprovider.NodeGroup { + ret := _m.Called(node) + + var r0 cloudprovider.NodeGroup + if rf, ok := ret.Get(0).(func(*v1.Node) cloudprovider.NodeGroup); ok { + r0 = rf(node) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(cloudprovider.NodeGroup) + } + } + + return r0 +} + +// GetNodeGroupSize provides a mock function with given fields: nodeGroup +func (_m *MockIonosCloudManager) GetNodeGroupSize(nodeGroup cloudprovider.NodeGroup) (int, error) { + ret := _m.Called(nodeGroup) + + var r0 int + if rf, ok := ret.Get(0).(func(cloudprovider.NodeGroup) int); ok { + r0 = rf(nodeGroup) + } else { + r0 = ret.Get(0).(int) + } + + var r1 error + if rf, ok := ret.Get(1).(func(cloudprovider.NodeGroup) error); ok { + r1 = rf(nodeGroup) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetNodeGroupTargetSize provides a mock function with given fields: nodeGroup +func (_m *MockIonosCloudManager) GetNodeGroupTargetSize(nodeGroup cloudprovider.NodeGroup) (int, error) { + ret := _m.Called(nodeGroup) + + var r0 int + if rf, ok := ret.Get(0).(func(cloudprovider.NodeGroup) int); ok { + r0 = rf(nodeGroup) + } else { + r0 = ret.Get(0).(int) + } + + var r1 error + if rf, ok := ret.Get(1).(func(cloudprovider.NodeGroup) error); ok { + r1 = rf(nodeGroup) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetNodeGroups provides a mock function with given fields: +func (_m *MockIonosCloudManager) GetNodeGroups() []cloudprovider.NodeGroup { + ret := _m.Called() + + var r0 []cloudprovider.NodeGroup + if rf, ok := ret.Get(0).(func() []cloudprovider.NodeGroup); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]cloudprovider.NodeGroup) + } + } + + return r0 +} + +// SetNodeGroupSize provides a mock function with given fields: nodeGroup, size +func (_m *MockIonosCloudManager) SetNodeGroupSize(nodeGroup cloudprovider.NodeGroup, size int) error { + ret := _m.Called(nodeGroup, size) + + var r0 error + if rf, ok := ret.Get(0).(func(cloudprovider.NodeGroup, int) error); ok { + r0 = rf(nodeGroup, size) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// TryLockNodeGroup provides a mock function with given fields: nodeGroup +func (_m *MockIonosCloudManager) TryLockNodeGroup(nodeGroup cloudprovider.NodeGroup) bool { + ret := _m.Called(nodeGroup) + + var r0 bool + if rf, ok := ret.Get(0).(func(cloudprovider.NodeGroup) bool); ok { + r0 = rf(nodeGroup) + } else { + r0 = ret.Get(0).(bool) + } + + return r0 +} + +// UnlockNodeGroup provides a mock function with given fields: nodeGroup +func (_m *MockIonosCloudManager) UnlockNodeGroup(nodeGroup cloudprovider.NodeGroup) { + _m.Called(nodeGroup) +} diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/utils.go b/cluster-autoscaler/cloudprovider/ionoscloud/utils.go new file mode 100644 index 0000000000..db45c91fd0 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/utils.go @@ -0,0 +1,79 @@ +/* +Copyright 2020 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 ionoscloud + +import ( + "fmt" + "strings" + + "k8s.io/autoscaler/cluster-autoscaler/cloudprovider" + ionos "k8s.io/autoscaler/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go" +) + +const ( + // ProviderIdPrefix is the prefix of the provider id of a Kubernetes node object. + ProviderIdPrefix = "ionos://" + // ErrorCodeUnknownState is set if the IonosCloud Kubernetes instace has an unknown state. + ErrorCodeUnknownState = "UNKNOWN_STATE" +) + +// convertToInstanceId converts an IonosCloud kubernetes node Id to a cloudprovider.Instance Id. +func convertToInstanceId(nodeId string) string { + return fmt.Sprintf("%s%s", ProviderIdPrefix, nodeId) +} + +// convertToNodeId converts a cloudprovider.Instance Id to an IonosCloud kubernetes node Id. +func convertToNodeId(providerId string) string { + return strings.TrimPrefix(providerId, ProviderIdPrefix) +} + +// convertToInstances converts a list IonosCloud kubernetes nodes to a list of cloudprovider.Instances. +func convertToInstances(nodes *ionos.KubernetesNodes) []cloudprovider.Instance { + instances := make([]cloudprovider.Instance, 0, len(*nodes.Items)) + for _, node := range *nodes.Items { + instances = append(instances, convertToInstance(node)) + } + return instances +} + +// to Instance converts an IonosCloud kubernetes node to a cloudprovider.Instance. +func convertToInstance(node ionos.KubernetesNode) cloudprovider.Instance { + return cloudprovider.Instance{ + Id: convertToInstanceId(*node.Id), + Status: convertToInstanceStatus(*node.Metadata.State), + } +} + +// convertToInstanceStatus converts an IonosCloud kubernetes node state to a *cloudprovider.InstanceStatus. +func convertToInstanceStatus(nodeState string) *cloudprovider.InstanceStatus { + st := &cloudprovider.InstanceStatus{} + switch nodeState { + case K8sNodeStateProvisioning, K8sNodeStateProvisioned, K8sNodeStateRebuilding: + st.State = cloudprovider.InstanceCreating + case K8sNodeStateTerminating: + st.State = cloudprovider.InstanceDeleting + case K8sNodeStateReady: + st.State = cloudprovider.InstanceRunning + default: + st.ErrorInfo = &cloudprovider.InstanceErrorInfo{ + ErrorClass: cloudprovider.OtherErrorClass, + ErrorCode: ErrorCodeUnknownState, + ErrorMessage: fmt.Sprintf("Unknown node state: %s", nodeState), + } + } + return st +} diff --git a/cluster-autoscaler/cloudprovider/ionoscloud/utils_test.go b/cluster-autoscaler/cloudprovider/ionoscloud/utils_test.go new file mode 100644 index 0000000000..17abdc6229 --- /dev/null +++ b/cluster-autoscaler/cloudprovider/ionoscloud/utils_test.go @@ -0,0 +1,211 @@ +/* +Copyright 2020 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 ionoscloud + +import ( + "testing" + + "github.com/stretchr/testify/require" + "k8s.io/autoscaler/cluster-autoscaler/cloudprovider" + ionos "k8s.io/autoscaler/cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go" + "k8s.io/utils/pointer" +) + +var ( + kubernetesNodes = []ionos.KubernetesNode{ + { + Id: pointer.StringPtr("1"), + Metadata: &ionos.KubernetesNodeMetadata{ + State: pointer.StringPtr(K8sNodeStateProvisioning), + }, + Properties: &ionos.KubernetesNodeProperties{ + Name: pointer.StringPtr("node1"), + }, + }, + { + Id: pointer.StringPtr("2"), + Metadata: &ionos.KubernetesNodeMetadata{ + State: pointer.StringPtr(K8sNodeStateProvisioned), + }, + Properties: &ionos.KubernetesNodeProperties{ + Name: pointer.StringPtr("node2"), + }, + }, + { + Id: pointer.StringPtr("3"), + Metadata: &ionos.KubernetesNodeMetadata{ + State: pointer.StringPtr(K8sNodeStateRebuilding), + }, + Properties: &ionos.KubernetesNodeProperties{ + Name: pointer.StringPtr("node3"), + }, + }, + { + Id: pointer.StringPtr("4"), + Metadata: &ionos.KubernetesNodeMetadata{ + State: pointer.StringPtr(K8sNodeStateTerminating), + }, + Properties: &ionos.KubernetesNodeProperties{ + Name: pointer.StringPtr("node4"), + }, + }, + { + Id: pointer.StringPtr("5"), + Metadata: &ionos.KubernetesNodeMetadata{ + State: pointer.StringPtr(K8sNodeStateReady), + }, + Properties: &ionos.KubernetesNodeProperties{ + Name: pointer.StringPtr("node5"), + }, + }, + } + cloudproviderInstances = []cloudprovider.Instance{ + { + Id: "ionos://1", + Status: &cloudprovider.InstanceStatus{ + State: cloudprovider.InstanceCreating, + }, + }, { + Id: "ionos://2", + Status: &cloudprovider.InstanceStatus{ + State: cloudprovider.InstanceCreating, + }, + }, { + Id: "ionos://3", + Status: &cloudprovider.InstanceStatus{ + State: cloudprovider.InstanceCreating, + }, + }, { + Id: "ionos://4", + Status: &cloudprovider.InstanceStatus{ + State: cloudprovider.InstanceDeleting, + }, + }, { + Id: "ionos://5", + Status: &cloudprovider.InstanceStatus{ + State: cloudprovider.InstanceRunning, + }, + }, + } +) + +func TestUtils_ConvertToInstanceId(t *testing.T) { + t.Run("Success", func(t *testing.T) { + in := "1-2-3-4" + want := "ionos://1-2-3-4" + got := convertToInstanceId(in) + require.Equal(t, want, got) + }) +} + +func TestUtils_ConvertToNodeId(t *testing.T) { + t.Run("Success", func(t *testing.T) { + in := "ionos://1-2-3-4" + want := "1-2-3-4" + got := convertToNodeId(in) + require.Equal(t, want, got) + }) +} + +func TestUtils_ConvertToInstances(t *testing.T) { + t.Run("Success", func(t *testing.T) { + in := ionos.KubernetesNodes{ + Items: &kubernetesNodes, + } + want := cloudproviderInstances + got := convertToInstances(&in) + require.Equal(t, want, got) + }) +} + +func TestUtils_ConvertToInstance(t *testing.T) { + t.Run("Success", func(t *testing.T) { + in := ionos.KubernetesNode{ + Id: pointer.StringPtr("1"), + Metadata: &ionos.KubernetesNodeMetadata{ + State: pointer.StringPtr(K8sNodeStateReady), + }, + } + want := cloudprovider.Instance{ + Id: "ionos://1", + Status: &cloudprovider.InstanceStatus{ + State: cloudprovider.InstanceRunning, + }, + } + got := convertToInstance(in) + require.Equal(t, want, got) + }) +} + +func TestUtils_ConvertToInstanceStatus(t *testing.T) { + tests := []struct { + in, name string + want *cloudprovider.InstanceStatus + }{ + { + name: "success, ionos server provisioning", + in: K8sNodeStateProvisioning, + want: &cloudprovider.InstanceStatus{ + State: cloudprovider.InstanceCreating, + }, + }, { + name: "success, ionos server provisioned", + in: K8sNodeStateProvisioned, + want: &cloudprovider.InstanceStatus{ + State: cloudprovider.InstanceCreating, + }, + }, { + name: "success, ionos server rebuiling", + in: K8sNodeStateRebuilding, + want: &cloudprovider.InstanceStatus{ + State: cloudprovider.InstanceCreating, + }, + }, { + name: "success, ionos server terminating", + in: K8sNodeStateTerminating, + want: &cloudprovider.InstanceStatus{ + State: cloudprovider.InstanceDeleting, + }, + }, { + name: "success, ionos server ready", + in: K8sNodeStateReady, + want: &cloudprovider.InstanceStatus{ + State: cloudprovider.InstanceRunning, + }, + }, + } + + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + got := convertToInstanceStatus(tc.in) + require.Equal(t, tc.want, got) + }) + } + + t.Run("Fail, unknown node state", func(t *testing.T) { + want := &cloudprovider.InstanceStatus{ + State: 0, + ErrorInfo: &cloudprovider.InstanceErrorInfo{ + ErrorClass: cloudprovider.OtherErrorClass, + ErrorCode: ErrorCodeUnknownState, + ErrorMessage: "Unknown node state: wrong_state", + }, + } + got := convertToInstanceStatus("wrong_state") + require.Equal(t, want, got) + }) +} diff --git a/hack/boilerplate/boilerplate.py b/hack/boilerplate/boilerplate.py index 162d5ccfde..5dd5864a04 100755 --- a/hack/boilerplate/boilerplate.py +++ b/hack/boilerplate/boilerplate.py @@ -150,7 +150,8 @@ skipped_dirs = ['Godeps', 'third_party', '_gopath', '_output', '.git', 'cluster/ "pkg/generated/bindata.go", "cluster-autoscaler/cloudprovider/huaweicloud/huaweicloud-sdk-go-v3", "cluster-autoscaler/cloudprovider/digitalocean/godo", - "cluster-autoscaler/cloudprovider/magnum/gophercloud"] + "cluster-autoscaler/cloudprovider/magnum/gophercloud", + "cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go"] # list all the files contain 'DO NOT EDIT', but are not generated skipped_ungenerated_files = ['hack/build-ui.sh', 'hack/lib/swagger.sh', diff --git a/hack/verify-gofmt.sh b/hack/verify-gofmt.sh index 36a842c82e..6b99e30f79 100755 --- a/hack/verify-gofmt.sh +++ b/hack/verify-gofmt.sh @@ -37,6 +37,7 @@ find_files() { -o -wholename './cluster-autoscaler/cloudprovider/magnum/gophercloud/*' \ -o -wholename './cluster-autoscaler/cloudprovider/digitalocean/godo/*' \ -o -wholename './cluster-autoscaler/cloudprovider/huaweicloud/huaweicloud-sdk-go-v3/*' \ + -o -wholename './cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go/*' \ \) -prune \ \) -name '*.go' } diff --git a/hack/verify-golint.sh b/hack/verify-golint.sh index b70d86276d..8b5d50304d 100755 --- a/hack/verify-golint.sh +++ b/hack/verify-golint.sh @@ -29,6 +29,7 @@ excluded_packages=( 'cluster-autoscaler/cloudprovider/digitalocean/godo' 'cluster-autoscaler/cloudprovider/exoscale/internal' 'cluster-autoscaler/cloudprovider/huaweicloud/huaweicloud-sdk-go-v3' + 'cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go' ) FIND_PACKAGES='go list ./... '