diff --git a/internal/fluidstack/Makefile b/internal/fluidstack/Makefile new file mode 100644 index 0000000..bc79b41 --- /dev/null +++ b/internal/fluidstack/Makefile @@ -0,0 +1,11 @@ +generate-fluidstack-client: + docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli:v7.8.0 generate \ + --additional-properties disallowAdditionalPropertiesIfNotPresent=false \ + -i https://docs.atlas.fluidstack.io/redocusaurus/infrastructure-api.yaml \ + -g go \ + --git-user-id brevdev \ + --git-repo-id cloud \ + -o /local/gen/fluidstack + sudo chown -R $(shell id -u):$(shell id -g) gen/fluidstack + gofmt -s -w gen/fluidstack + rm -rf gen/fluidstack/go.mod gen/fluidstack/go.sum diff --git a/internal/fluidstack/gen/fluidstack/.gitignore b/internal/fluidstack/gen/fluidstack/.gitignore new file mode 100644 index 0000000..daf913b --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/.gitignore @@ -0,0 +1,24 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof diff --git a/internal/fluidstack/gen/fluidstack/.openapi-generator-ignore b/internal/fluidstack/gen/fluidstack/.openapi-generator-ignore new file mode 100644 index 0000000..7484ee5 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/internal/fluidstack/gen/fluidstack/.openapi-generator/FILES b/internal/fluidstack/gen/fluidstack/.openapi-generator/FILES new file mode 100644 index 0000000..8707028 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/.openapi-generator/FILES @@ -0,0 +1,88 @@ +.gitignore +.openapi-generator-ignore +.travis.yml +README.md +api/openapi.yaml +api_capabilities.go +api_capacity.go +api_filesystems.go +api_instance_types.go +api_instances.go +api_kubernetes.go +api_projects.go +api_slurm.go +client.go +configuration.go +docs/Accelerator.md +docs/CapabilitiesAPI.md +docs/Capability.md +docs/CapacityAPI.md +docs/Error.md +docs/Filesystem.md +docs/FilesystemsAPI.md +docs/FilesystemsPostRequest.md +docs/Instance.md +docs/InstanceState.md +docs/InstanceType.md +docs/InstanceTypesAPI.md +docs/InstancesAPI.md +docs/InstancesPostRequest.md +docs/KubernetesAPI.md +docs/KubernetesCluster.md +docs/KubernetesClustersPostRequest.md +docs/KubernetesNode.md +docs/KubernetesNodeConditionsInner.md +docs/KubernetesNodePool.md +docs/KubernetesNodePoolPostRequest.md +docs/KubernetesNodeTaintsInner.md +docs/ListCapacity200ResponseInner.md +docs/Project.md +docs/ProjectState.md +docs/ProjectsAPI.md +docs/ProjectsPostRequest.md +docs/SlurmAPI.md +docs/SlurmCluster.md +docs/SlurmClustersPostRequest.md +docs/SlurmLoginNode.md +docs/SlurmNode.md +docs/SlurmNodePool.md +docs/SlurmNodePoolPostRequest.md +git_push.sh +go.mod +go.sum +model_accelerator.go +model_capability.go +model_error.go +model_filesystem.go +model_filesystems_post_request.go +model_instance.go +model_instance_state.go +model_instance_type.go +model_instances_post_request.go +model_kubernetes_cluster.go +model_kubernetes_clusters_post_request.go +model_kubernetes_node.go +model_kubernetes_node_conditions_inner.go +model_kubernetes_node_pool.go +model_kubernetes_node_pool_post_request.go +model_kubernetes_node_taints_inner.go +model_list_capacity_200_response_inner.go +model_project.go +model_project_state.go +model_projects_post_request.go +model_slurm_cluster.go +model_slurm_clusters_post_request.go +model_slurm_login_node.go +model_slurm_node.go +model_slurm_node_pool.go +model_slurm_node_pool_post_request.go +response.go +test/api_capabilities_test.go +test/api_capacity_test.go +test/api_filesystems_test.go +test/api_instance_types_test.go +test/api_instances_test.go +test/api_kubernetes_test.go +test/api_projects_test.go +test/api_slurm_test.go +utils.go diff --git a/internal/fluidstack/gen/fluidstack/.openapi-generator/VERSION b/internal/fluidstack/gen/fluidstack/.openapi-generator/VERSION new file mode 100644 index 0000000..09a6d30 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.8.0 diff --git a/internal/fluidstack/gen/fluidstack/.travis.yml b/internal/fluidstack/gen/fluidstack/.travis.yml new file mode 100644 index 0000000..f5cb2ce --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/.travis.yml @@ -0,0 +1,8 @@ +language: go + +install: + - go get -d -v . + +script: + - go build -v ./ + diff --git a/internal/fluidstack/gen/fluidstack/README.md b/internal/fluidstack/gen/fluidstack/README.md new file mode 100644 index 0000000..faa26a4 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/README.md @@ -0,0 +1,182 @@ +# Go API client for openapi + +Fluidstack Infrastructure API + +## Overview +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. + +- API version: v1alpha1 +- Package version: 1.0.0 +- Generator version: 7.8.0 +- Build package: org.openapitools.codegen.languages.GoClientCodegen + +## Installation + +Install the following dependencies: + +```sh +go get github.com/stretchr/testify/assert +go get golang.org/x/net/context +``` + +Put the package under your project folder and add the following in import: + +```go +import openapi "github.com/brevdev/cloud" +``` + +To use a proxy, set the environment variable `HTTP_PROXY`: + +```go +os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port") +``` + +## Configuration of Server URL + +Default configuration comes with `Servers` field that contains server objects as defined in the OpenAPI specification. + +### Select Server Configuration + +For using other server than the one defined on index 0 set context value `openapi.ContextServerIndex` of type `int`. + +```go +ctx := context.WithValue(context.Background(), openapi.ContextServerIndex, 1) +``` + +### Templated Server URL + +Templated server URL is formatted using default variables from configuration or from context value `openapi.ContextServerVariables` of type `map[string]string`. + +```go +ctx := context.WithValue(context.Background(), openapi.ContextServerVariables, map[string]string{ + "basePath": "v2", +}) +``` + +Note, enum values are always validated and all unused variables are silently ignored. + +### URLs Configuration per Operation + +Each operation can use different server URL defined using `OperationServers` map in the `Configuration`. +An operation is uniquely identified by `"{classname}Service.{nickname}"` string. +Similar rules for overriding default operation server index and variables applies by using `openapi.ContextOperationServerIndices` and `openapi.ContextOperationServerVariables` context maps. + +```go +ctx := context.WithValue(context.Background(), openapi.ContextOperationServerIndices, map[string]int{ + "{classname}Service.{nickname}": 2, +}) +ctx = context.WithValue(context.Background(), openapi.ContextOperationServerVariables, map[string]map[string]string{ + "{classname}Service.{nickname}": { + "port": "8443", + }, +}) +``` + +## Documentation for API Endpoints + +All URIs are relative to *https://<region>.atlas.fluidstack.io/api/v1alpha1* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*CapabilitiesAPI* | [**ListCapabilities**](docs/CapabilitiesAPI.md#listcapabilities) | **Get** /capabilities | List available capabilities +*CapacityAPI* | [**ListCapacity**](docs/CapacityAPI.md#listcapacity) | **Get** /capacity | List available capacity +*FilesystemsAPI* | [**CreateFilesystem**](docs/FilesystemsAPI.md#createfilesystem) | **Post** /filesystems | Create a filesystem +*FilesystemsAPI* | [**DeleteFilesystem**](docs/FilesystemsAPI.md#deletefilesystem) | **Delete** /filesystems/{id} | Delete a filesystem +*FilesystemsAPI* | [**GetFilesystem**](docs/FilesystemsAPI.md#getfilesystem) | **Get** /filesystems/{id} | Get a filesystem +*FilesystemsAPI* | [**ListFilesystems**](docs/FilesystemsAPI.md#listfilesystems) | **Get** /filesystems | List all filesystems +*InstanceTypesAPI* | [**ListInstanceTypes**](docs/InstanceTypesAPI.md#listinstancetypes) | **Get** /instance-types | List all available instance types +*InstancesAPI* | [**CreateInstance**](docs/InstancesAPI.md#createinstance) | **Post** /instances | Create a machine instance +*InstancesAPI* | [**DeleteInstance**](docs/InstancesAPI.md#deleteinstance) | **Delete** /instances/{id} | Delete a machine instance +*InstancesAPI* | [**GetInstance**](docs/InstancesAPI.md#getinstance) | **Get** /instances/{id} | Get a machine instance +*InstancesAPI* | [**ListInstances**](docs/InstancesAPI.md#listinstances) | **Get** /instances | List all machine instances +*InstancesAPI* | [**StartInstance**](docs/InstancesAPI.md#startinstance) | **Post** /instances/{id}/actions/start | Start a machine instance +*InstancesAPI* | [**StopInstance**](docs/InstancesAPI.md#stopinstance) | **Post** /instances/{id}/actions/stop | Stop a machine instance +*KubernetesAPI* | [**CreateKubernetesCluster**](docs/KubernetesAPI.md#createkubernetescluster) | **Post** /kubernetes/clusters | Create a cluster +*KubernetesAPI* | [**CreateKubernetesNodePool**](docs/KubernetesAPI.md#createkubernetesnodepool) | **Post** /kubernetes/clusters/{cluster_id}/node-pools | Create a node pool +*KubernetesAPI* | [**DeleteKubernetesCluster**](docs/KubernetesAPI.md#deletekubernetescluster) | **Delete** /kubernetes/clusters/{id} | Delete a cluster +*KubernetesAPI* | [**DeleteKubernetesNodePool**](docs/KubernetesAPI.md#deletekubernetesnodepool) | **Delete** /kubernetes/clusters/{cluster_id}/node-pools/{node_pool_id} | Delete a node pool +*KubernetesAPI* | [**GetKubernetesCluster**](docs/KubernetesAPI.md#getkubernetescluster) | **Get** /kubernetes/clusters/{id} | Get a cluster +*KubernetesAPI* | [**GetKubernetesClusterCredentials**](docs/KubernetesAPI.md#getkubernetesclustercredentials) | **Get** /kubernetes/clusters/{cluster_id}/credentials | Get kubeconfig credentials for a cluster +*KubernetesAPI* | [**GetKubernetesNodePool**](docs/KubernetesAPI.md#getkubernetesnodepool) | **Get** /kubernetes/clusters/{cluster_id}/node-pools/{node_pool_id} | Get a node pool +*KubernetesAPI* | [**ListKubernetesClusters**](docs/KubernetesAPI.md#listkubernetesclusters) | **Get** /kubernetes/clusters | List all clusters +*KubernetesAPI* | [**ListKubernetesNodePools**](docs/KubernetesAPI.md#listkubernetesnodepools) | **Get** /kubernetes/clusters/{cluster_id}/node-pools | List all node pools for a cluster +*ProjectsAPI* | [**CreateProject**](docs/ProjectsAPI.md#createproject) | **Post** /projects | Create a project +*ProjectsAPI* | [**DeleteProject**](docs/ProjectsAPI.md#deleteproject) | **Delete** /projects/{id} | Delete a project +*ProjectsAPI* | [**GetProject**](docs/ProjectsAPI.md#getproject) | **Get** /projects/{id} | Get a project +*ProjectsAPI* | [**ListProjects**](docs/ProjectsAPI.md#listprojects) | **Get** /projects | List all projects +*SlurmAPI* | [**CreateSlurmCluster**](docs/SlurmAPI.md#createslurmcluster) | **Post** /slurm/clusters | Create a cluster +*SlurmAPI* | [**CreateSlurmNodePool**](docs/SlurmAPI.md#createslurmnodepool) | **Post** /slurm/clusters/{cluster_id}/node-pools | Create a node pool +*SlurmAPI* | [**DeleteSlurmCluster**](docs/SlurmAPI.md#deleteslurmcluster) | **Delete** /slurm/clusters/{id} | Delete a cluster +*SlurmAPI* | [**DeleteSlurmNodePool**](docs/SlurmAPI.md#deleteslurmnodepool) | **Delete** /slurm/clusters/{cluster_id}/node-pools/{node_pool_id} | Delete a node pool +*SlurmAPI* | [**GetSlurmCluster**](docs/SlurmAPI.md#getslurmcluster) | **Get** /slurm/clusters/{id} | Get a cluster +*SlurmAPI* | [**GetSlurmNodePool**](docs/SlurmAPI.md#getslurmnodepool) | **Get** /slurm/clusters/{cluster_id}/node-pools/{node_pool_id} | Get a node pool +*SlurmAPI* | [**ListSlurmClusters**](docs/SlurmAPI.md#listslurmclusters) | **Get** /slurm/clusters | List all clusters +*SlurmAPI* | [**ListSlurmNodePools**](docs/SlurmAPI.md#listslurmnodepools) | **Get** /slurm/clusters/{cluster_id}/node-pools | List all node pools for a cluster + + +## Documentation For Models + + - [Accelerator](docs/Accelerator.md) + - [Capability](docs/Capability.md) + - [Error](docs/Error.md) + - [Filesystem](docs/Filesystem.md) + - [FilesystemsPostRequest](docs/FilesystemsPostRequest.md) + - [Instance](docs/Instance.md) + - [InstanceState](docs/InstanceState.md) + - [InstanceType](docs/InstanceType.md) + - [InstancesPostRequest](docs/InstancesPostRequest.md) + - [KubernetesCluster](docs/KubernetesCluster.md) + - [KubernetesClustersPostRequest](docs/KubernetesClustersPostRequest.md) + - [KubernetesNode](docs/KubernetesNode.md) + - [KubernetesNodeConditionsInner](docs/KubernetesNodeConditionsInner.md) + - [KubernetesNodePool](docs/KubernetesNodePool.md) + - [KubernetesNodePoolPostRequest](docs/KubernetesNodePoolPostRequest.md) + - [KubernetesNodeTaintsInner](docs/KubernetesNodeTaintsInner.md) + - [ListCapacity200ResponseInner](docs/ListCapacity200ResponseInner.md) + - [Project](docs/Project.md) + - [ProjectState](docs/ProjectState.md) + - [ProjectsPostRequest](docs/ProjectsPostRequest.md) + - [SlurmCluster](docs/SlurmCluster.md) + - [SlurmClustersPostRequest](docs/SlurmClustersPostRequest.md) + - [SlurmLoginNode](docs/SlurmLoginNode.md) + - [SlurmNode](docs/SlurmNode.md) + - [SlurmNodePool](docs/SlurmNodePool.md) + - [SlurmNodePoolPostRequest](docs/SlurmNodePoolPostRequest.md) + + +## Documentation For Authorization + + +Authentication schemes defined for the API: +### bearerAuth + +- **Type**: HTTP Bearer token authentication + +Example + +```go +auth := context.WithValue(context.Background(), openapi.ContextAccessToken, "BEARER_TOKEN_STRING") +r, err := client.Service.Operation(auth, args) +``` + + +## Documentation for Utility Methods + +Due to the fact that model structure members are all pointers, this package contains +a number of utility functions to easily obtain pointers to values of basic types. +Each of these functions takes a value of the given basic type and returns a pointer to it: + +* `PtrBool` +* `PtrInt` +* `PtrInt32` +* `PtrInt64` +* `PtrFloat` +* `PtrFloat32` +* `PtrFloat64` +* `PtrString` +* `PtrTime` + +## Author + + + diff --git a/internal/fluidstack/gen/fluidstack/api/openapi.yaml b/internal/fluidstack/gen/fluidstack/api/openapi.yaml new file mode 100644 index 0000000..147c0dd --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/api/openapi.yaml @@ -0,0 +1,3005 @@ +openapi: 3.0.0 +info: + description: Fluidstack Infrastructure API + title: Infrastructure API + version: v1alpha1 +servers: +- url: https://.atlas.fluidstack.io/api/v1alpha1 +security: +- bearerAuth: [] +paths: + /projects: + get: + operationId: ListProjects + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Project' + type: array + description: A list of projects + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + "501": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Not implemented + summary: List all projects + tags: + - Projects + post: + operationId: CreateProject + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ProjectsPostRequest' + description: Details of the project to create + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/Project' + description: Project created successfully + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Invalid input + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + "501": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Not implemented + summary: Create a project + tags: + - Projects + /projects/{id}: + delete: + operationId: DeleteProject + parameters: + - description: Unique identifier of the project to delete + explode: false + in: path + name: id + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ID + responses: + "204": + description: Project deleted successfully + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Project not found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + "501": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Not implemented + summary: Delete a project + tags: + - Projects + get: + operationId: GetProject + parameters: + - description: Unique identifier of the project + explode: false + in: path + name: id + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ID + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Project' + description: Project details retrieved successfully + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Project not found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + "501": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Not implemented + summary: Get a project + tags: + - Projects + /instances: + get: + operationId: ListInstances + parameters: + - description: Project identifier passed as a header + explode: false + in: header + name: X-PROJECT-ID + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ProjectID + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Instance' + type: array + description: A list of machine instances + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Not found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + "501": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Not implemented + summary: List all machine instances + tags: + - Instances + post: + operationId: CreateInstance + parameters: + - description: Project identifier passed as a header + explode: false + in: header + name: X-PROJECT-ID + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ProjectID + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/InstancesPostRequest' + description: Details of the instance to create + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/Instance' + description: Instance created successfully + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Invalid input + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Not found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + "501": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Not implemented + summary: Create a machine instance + tags: + - Instances + /instances/{id}: + delete: + operationId: DeleteInstance + parameters: + - description: Project identifier passed as a header + explode: false + in: header + name: X-PROJECT-ID + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ProjectID + - description: Unique identifier of the instance + explode: false + in: path + name: id + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ID + responses: + "204": + description: Instance deleted successfully + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Instance not found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + "501": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Not implemented + summary: Delete a machine instance + tags: + - Instances + get: + operationId: GetInstance + parameters: + - description: Project identifier passed as a header + explode: false + in: header + name: X-PROJECT-ID + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ProjectID + - description: Unique identifier of the instance + explode: false + in: path + name: id + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ID + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Instance' + description: Instance details retrieved successfully + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Instance not found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + "501": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Not implemented + summary: Get a machine instance + tags: + - Instances + /instances/{id}/actions/start: + post: + operationId: StartInstance + parameters: + - description: Project identifier passed as a header + explode: false + in: header + name: X-PROJECT-ID + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ProjectID + - description: Unique identifier of the instance + explode: false + in: path + name: id + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ID + responses: + "202": + description: Instance start initiated successfully + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Invalid input + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Instance not found + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Instance state conflict + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + "501": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Not implemented + summary: Start a machine instance + tags: + - Instances + /instances/{id}/actions/stop: + post: + operationId: StopInstance + parameters: + - description: Project identifier passed as a header + explode: false + in: header + name: X-PROJECT-ID + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ProjectID + - description: Unique identifier of the instance + explode: false + in: path + name: id + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ID + responses: + "202": + description: Instance stop initiated successfully + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Invalid input + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Instance not found + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Instance state conflict + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + "501": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Not implemented + summary: Stop a machine instance + tags: + - Instances + /instance-types: + get: + operationId: ListInstanceTypes + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/InstanceType' + type: array + description: A list of available instance types + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + "501": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Not implemented + summary: List all available instance types + tags: + - Instance Types + /filesystems: + get: + operationId: ListFilesystems + parameters: + - description: Project identifier passed as a header + explode: false + in: header + name: X-PROJECT-ID + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ProjectID + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Filesystem' + type: array + description: A list of filesystems + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + "501": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Not implemented + summary: List all filesystems + tags: + - Filesystems + post: + operationId: CreateFilesystem + parameters: + - description: Project identifier passed as a header + explode: false + in: header + name: X-PROJECT-ID + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ProjectID + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FilesystemsPostRequest' + description: Details of the filesystem to create + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/Filesystem' + description: Filesystem created successfully + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Invalid input + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + "501": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Not implemented + summary: Create a filesystem + tags: + - Filesystems + /filesystems/{id}: + delete: + operationId: DeleteFilesystem + parameters: + - description: Project identifier passed as a header + explode: false + in: header + name: X-PROJECT-ID + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ProjectID + - description: Unique identifier of the filesystem + explode: false + in: path + name: id + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ID + responses: + "204": + description: Filesystem deleted successfully + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Filesystem not found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + "501": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Not implemented + summary: Delete a filesystem + tags: + - Filesystems + get: + operationId: GetFilesystem + parameters: + - description: Project identifier passed as a header + explode: false + in: header + name: X-PROJECT-ID + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ProjectID + - description: Unique identifier of the filesystem + explode: false + in: path + name: id + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ID + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Filesystem' + description: Filesystem details retrieved successfully + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Filesystem not found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + "501": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Not implemented + summary: Get a filesystem + tags: + - Filesystems + /kubernetes/clusters: + get: + operationId: ListKubernetesClusters + parameters: + - description: Project identifier passed as a header + explode: false + in: header + name: X-PROJECT-ID + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ProjectID + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/KubernetesCluster' + type: array + description: Cluster details retrieved successfully + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + "501": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Not implemented + summary: List all clusters + tags: + - Kubernetes + post: + operationId: CreateKubernetesCluster + parameters: + - description: Project identifier passed as a header + explode: false + in: header + name: X-PROJECT-ID + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ProjectID + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/KubernetesClustersPostRequest' + description: Details of the cluster to create + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/KubernetesCluster' + description: Cluster created successfully + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Invalid input + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Forbidden + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Cluster already exists + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + "501": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Not implemented + summary: Create a cluster + tags: + - Kubernetes + /kubernetes/clusters/{id}: + delete: + operationId: DeleteKubernetesCluster + parameters: + - description: Project identifier passed as a header + explode: false + in: header + name: X-PROJECT-ID + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ProjectID + - description: Unique identifier of the kubernetes cluster to delete + explode: false + in: path + name: id + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ID + responses: + "204": + description: Kubernetes cluster deleted successfully + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Kubernetes cluster not found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + "501": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Not implemented + summary: Delete a cluster + tags: + - Kubernetes + get: + operationId: GetKubernetesCluster + parameters: + - description: Project identifier passed as a header + explode: false + in: header + name: X-PROJECT-ID + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ProjectID + - description: Unique identifier of the kubernetes cluster + explode: false + in: path + name: id + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/KubernetesCluster' + description: Kubernetes cluster details retrieved successfully + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Kubernetes cluster not found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + "501": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Not implemented + summary: Get a cluster + tags: + - Kubernetes + /kubernetes/clusters/{cluster_id}/node-pools: + get: + operationId: ListKubernetesNodePools + parameters: + - description: Project identifier passed as a header + explode: false + in: header + name: X-PROJECT-ID + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ProjectID + - description: Unique identifier of the cluster + explode: false + in: path + name: cluster_id + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ClusterID + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/KubernetesNodePool' + type: array + description: Node pools retrieved successfully + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Cluster not found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + "501": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Not implemented + summary: List all node pools for a cluster + tags: + - Kubernetes + post: + operationId: CreateKubernetesNodePool + parameters: + - description: Project identifier passed as a header + explode: false + in: header + name: X-PROJECT-ID + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ProjectID + - description: Unique identifier of the cluster + explode: false + in: path + name: cluster_id + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ClusterID + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/KubernetesNodePoolPostRequest' + description: Details of the node pool to create + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/KubernetesNodePool' + description: Node pool created successfully + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Invalid input + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Forbidden + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Node pool already exists + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + "501": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Not implemented + summary: Create a node pool + tags: + - Kubernetes + /kubernetes/clusters/{cluster_id}/node-pools/{node_pool_id}: + delete: + operationId: DeleteKubernetesNodePool + parameters: + - description: Project identifier passed as a header + explode: false + in: header + name: X-PROJECT-ID + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ProjectID + - description: Unique identifier of the cluster + explode: false + in: path + name: cluster_id + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ClusterID + - description: Unique identifier of the node pool to delete + explode: false + in: path + name: node_pool_id + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: NodePoolID + responses: + "204": + description: Node pool deleted successfully + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Node pool not found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + "501": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Not implemented + summary: Delete a node pool + tags: + - Kubernetes + get: + operationId: GetKubernetesNodePool + parameters: + - description: Project identifier passed as a header + explode: false + in: header + name: X-PROJECT-ID + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ProjectID + - description: Unique identifier of the cluster + explode: false + in: path + name: cluster_id + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ClusterID + - description: Unique identifier of the node pool + explode: false + in: path + name: node_pool_id + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: NodePoolID + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/KubernetesNodePool' + description: Node pool details retrieved successfully + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Node pool not found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + "501": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Not implemented + summary: Get a node pool + tags: + - Kubernetes + /kubernetes/clusters/{cluster_id}/credentials: + get: + operationId: GetKubernetesClusterCredentials + parameters: + - description: Project identifier passed as a header + explode: false + in: header + name: X-PROJECT-ID + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ProjectID + - description: Unique identifier of the kubernetes cluster + explode: false + in: path + name: cluster_id + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ClusterID + responses: + "200": + content: + application/yaml: + schema: + description: Base64-encoded kubeconfig file + format: byte + type: string + description: Kubeconfig credentials retrieved successfully + headers: + Cache-Control: + description: Prevents credential caching + explode: false + schema: + example: "no-store, no-cache, must-revalidate" + type: string + style: simple + Content-Disposition: + description: Forces download as file + explode: false + schema: + example: attachment; filename=kubeconfig + type: string + style: simple + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Kubernetes cluster not found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Internal Server Error + "501": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Not implemented + summary: Get kubeconfig credentials for a cluster + tags: + - Kubernetes + /slurm/clusters: + get: + operationId: ListSlurmClusters + parameters: + - description: Project identifier passed as a header + explode: false + in: header + name: X-PROJECT-ID + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ProjectID + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/SlurmCluster' + type: array + description: Slurm Cluster details retrieved successfully + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + "501": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Not implemented + summary: List all clusters + tags: + - Slurm + post: + operationId: CreateSlurmCluster + parameters: + - description: Project identifier passed as a header + explode: false + in: header + name: X-PROJECT-ID + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ProjectID + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SlurmClustersPostRequest' + description: Details of the cluster to create + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/SlurmCluster' + description: Cluster created successfully + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Invalid input + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + "501": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Not implemented + summary: Create a cluster + tags: + - Slurm + /slurm/clusters/{id}: + delete: + operationId: DeleteSlurmCluster + parameters: + - description: Project identifier passed as a header + explode: false + in: header + name: X-PROJECT-ID + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ProjectID + - description: Unique identifier of the cluster to delete + explode: false + in: path + name: id + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ID + responses: + "204": + description: Cluster deleted successfully + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Cluster not found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + "501": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Not implemented + summary: Delete a cluster + tags: + - Slurm + get: + operationId: GetSlurmCluster + parameters: + - description: Project identifier passed as a header + explode: false + in: header + name: X-PROJECT-ID + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ProjectID + - description: Unique identifier of the cluster + explode: false + in: path + name: id + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/SlurmCluster' + description: Cluster details retrieved successfully + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Cluster not found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + "501": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Not implemented + summary: Get a cluster + tags: + - Slurm + /slurm/clusters/{cluster_id}/node-pools: + get: + operationId: ListSlurmNodePools + parameters: + - description: Project identifier passed as a header + explode: false + in: header + name: X-PROJECT-ID + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ProjectID + - description: Unique identifier of the cluster + explode: false + in: path + name: cluster_id + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ClusterID + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/SlurmNodePool' + type: array + description: Node pools retrieved successfully + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Slurm cluster not found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + "501": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Not implemented + summary: List all node pools for a cluster + tags: + - Slurm + post: + operationId: CreateSlurmNodePool + parameters: + - description: Project identifier passed as a header + explode: false + in: header + name: X-PROJECT-ID + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ProjectID + - description: Unique identifier of the cluster + explode: false + in: path + name: cluster_id + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ClusterID + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SlurmNodePoolPostRequest' + description: Details of the node pool to create + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/SlurmNodePool' + description: Node pool created successfully + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Invalid input + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Forbidden + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Node pool already exists + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + "501": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Not implemented + summary: Create a node pool + tags: + - Slurm + /capacity: + get: + operationId: ListCapacity + parameters: + - description: Project identifier passed as a header + explode: false + in: header + name: X-PROJECT-ID + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ProjectID + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/ListCapacity_200_response_inner' + type: array + description: A list of available capacity by instance type. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + "501": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Not implemented + summary: List available capacity + tags: + - Capacity + /capabilities: + get: + operationId: ListCapabilities + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Capabilities' + description: A list of available capabilities + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + "501": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Not implemented + summary: List available capabilities + tags: + - Capabilities + /slurm/clusters/{cluster_id}/node-pools/{node_pool_id}: + delete: + operationId: DeleteSlurmNodePool + parameters: + - description: Project identifier passed as a header + explode: false + in: header + name: X-PROJECT-ID + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ProjectID + - description: Unique identifier of the cluster + explode: false + in: path + name: cluster_id + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ClusterID + - description: Unique identifier of the node pool to delete + explode: false + in: path + name: node_pool_id + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: NodePoolID + responses: + "204": + description: Node pool deleted successfully + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Node pool not found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + "501": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Not implemented + summary: Delete a node pool + tags: + - Slurm + get: + operationId: GetSlurmNodePool + parameters: + - description: Project identifier passed as a header + explode: false + in: header + name: X-PROJECT-ID + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ProjectID + - description: Unique identifier of the cluster + explode: false + in: path + name: cluster_id + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ClusterID + - description: Unique identifier of the node pool + explode: false + in: path + name: node_pool_id + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: NodePoolID + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/SlurmNodePool' + description: Node pool details retrieved successfully + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Node pool not found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + "501": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Not implemented + summary: Get a node pool + tags: + - Slurm +components: + parameters: + X-PROJECT-ID: + description: Project identifier passed as a header + explode: false + in: header + name: X-PROJECT-ID + required: true + schema: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + style: simple + x-go-name: ProjectID + schemas: + Error: + description: Error response + example: + message: message + properties: + message: + description: Human-readable error message + type: string + required: + - message + type: object + InstancesPostRequest: + description: POST request for a machine instance + example: + image: image://ubuntu22.04 + preemptible: false + userData: !!binary |- + STJOc2IzVmtMV052Ym1acFp3cHdZV05yWVdkbGN6b0tJQ0F0SUc1bmFXNTQK + name: instance-1 + ephemeral: false + type: h100-hgx-80gb.8x + filesystems: + - 123e4567-e89b-12d3-a456-426614174000 + - 123e4567-e89b-12d3-a456-426614174001 + tags: + environment: production + properties: + name: + description: Name of the instance + example: instance-1 + type: string + type: + description: Instance type + example: h100-hgx-80gb.8x + type: string + image: + default: image://ubuntu22.04 + description: Operating system image for the instance + example: image://ubuntu22.04 + type: string + preemptible: + default: false + description: Whether the instance is preemptible + example: false + type: boolean + ephemeral: + default: false + description: Whether the instance is ephemeral + example: false + type: boolean + userData: + description: Base64-encoded cloud-init user data for instance initialization + example: !!binary |- + STJOc2IzVmtMV052Ym1acFp3cHdZV05yWVdkbGN6b0tJQ0F0SUc1bmFXNTQK + format: byte + nullable: true + type: string + filesystems: + description: List of filesystem UUIDs attached to the instance + example: + - 123e4567-e89b-12d3-a456-426614174000 + - 123e4567-e89b-12d3-a456-426614174001 + items: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + type: array + tags: + additionalProperties: + type: string + description: | + Tags for the instance. Tag keys must be 1–63 characters, start and end with alphanumerics, and may include `-`, `_`, and `.`. + example: + environment: production + type: object + required: + - name + - type + type: object + Instance: + description: machine instance + example: + image: ubuntu22.04 + preemptible: false + userData: !!binary |- + STJOc2IzVmtMV052Ym1acFp3cHdZV05yWVdkbGN6b0tJQ0F0SUc1bmFXNTQK + ip: 10.0.0.2 + name: instance-1 + ephemeral: false + id: 550e8400-e29b-41d4-a716-446655440000 + state: running + type: h100-hgx-80gb.8x + filesystems: + - 123e4567-e89b-12d3-a456-426614174000 + - 123e4567-e89b-12d3-a456-426614174001 + tags: + environment: production + properties: + id: + description: Unique identifier of the instance + example: 550e8400-e29b-41d4-a716-446655440000 + format: uuid + type: string + x-go-name: ID + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + name: + description: Name of the instance + example: instance-1 + type: string + type: + description: Instance type + example: h100-hgx-80gb.8x + type: string + ip: + description: Private IP address of the instance + example: 10.0.0.2 + format: ipv4 + nullable: true + type: string + x-go-name: IP + state: + $ref: '#/components/schemas/InstanceState' + image: + description: Operating system image for the instance + example: ubuntu22.04 + type: string + preemptible: + description: Whether the instance is preemptible + example: false + type: boolean + ephemeral: + description: Whether the instance is ephemeral + example: false + type: boolean + userData: + description: Base64-encoded cloud-init user data for instance initialization + example: !!binary |- + STJOc2IzVmtMV052Ym1acFp3cHdZV05yWVdkbGN6b0tJQ0F0SUc1bmFXNTQK + format: byte + nullable: true + type: string + filesystems: + description: List of filesystem UUIDs attached to the instance + example: + - 123e4567-e89b-12d3-a456-426614174000 + - 123e4567-e89b-12d3-a456-426614174001 + items: + format: uuid + type: string + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + type: array + tags: + additionalProperties: + type: string + description: Tags for the instance + example: + environment: production + type: object + required: + - ephemeral + - filesystems + - id + - image + - ip + - name + - preemptible + - state + - tags + - type + - userData + type: object + InstanceType: + description: Machine instance type + example: + memory: 960Gi + gpuModel: GH100_H100_SXM5_80GB + name: h100-hgx-80gb.8x + cpu: 96 + gpuCount: 8 + properties: + name: + description: Name of the instance type + example: h100-hgx-80gb.8x + type: string + cpu: + description: Number of CPUs the instance type has + example: 96 + type: integer + memory: + description: Amount of memory the instance type has + example: 960Gi + type: string + gpuModel: + description: GPU model the instance type has + example: GH100_H100_SXM5_80GB + type: string + gpuCount: + description: Number of GPUs the instance type has + example: 8 + type: integer + required: + - cpu + - memory + - name + type: object + InstanceState: + description: Possible states of a machine instance + enum: + - creating + - starting + - running + - stopping + - stopped + - deleting + - out-of-stock + - error + example: running + type: string + FilesystemsPostRequest: + description: POST request for a filesystem + example: + size: 512Gi + name: fs-1 + properties: + name: + description: Name of the filesystem + example: fs-1 + type: string + size: + description: Size of the filesystem in GB + example: 512Gi + type: string + required: + - name + - size + type: object + Filesystem: + description: Filesystem (virtio-fs) + example: + size: 512Gi + name: fs-1 + id: 123e4567-e89b-12d3-a456-426614174002 + properties: + id: + description: Unique identifier of the filesystem + example: 123e4567-e89b-12d3-a456-426614174002 + format: uuid + type: string + x-go-name: ID + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + name: + description: Name of the filesystem + example: fs-1 + type: string + size: + description: Size of the filesystem in GB + example: 512Gi + type: string + required: + - id + - name + - size + type: object + ProjectsPostRequest: + description: POST request for a project + example: + name: project-1 + tags: + team: ml-ops + properties: + name: + description: Name of the project + example: project-1 + type: string + tags: + additionalProperties: + type: string + description: | + Tags for the project. Tag keys must be 1–63 characters, start and end with alphanumerics, and may include `-`, `_`, and `.`. + example: + team: ml-ops + type: object + required: + - name + type: object + Project: + description: Project information + example: + name: project-1 + id: 123e4567-e89b-12d3-a456-426614174003 + state: active + tags: + team: ml-ops + properties: + id: + description: Unique identifier of the project + example: 123e4567-e89b-12d3-a456-426614174003 + format: uuid + type: string + x-go-name: ID + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + name: + description: Name of the project + example: project-1 + type: string + state: + $ref: '#/components/schemas/ProjectState' + tags: + additionalProperties: + type: string + description: Tags for the project + example: + team: ml-ops + type: object + required: + - id + - name + - state + - tags + type: object + ProjectState: + description: Possible states of a project + enum: + - active + - deleting + example: active + type: string + KubernetesClustersPostRequest: + description: POST request for a kubernetes cluster + example: + name: cluster-01 + version: 1.32.1 + properties: + name: + description: The cluster name. + example: cluster-01 + type: string + version: + description: The cluster version. + example: 1.32.1 + type: string + required: + - name + type: object + KubernetesCluster: + description: Kubernetes Cluster + example: + endpoint: https://api.cluster-01.example.com + name: cluster-01 + id: 123e4567-e89b-12d3-a456-426614174003 + version: 1.32.1 + properties: + id: + description: The unique identifier of the cluster + example: 123e4567-e89b-12d3-a456-426614174003 + format: uuid + type: string + x-go-name: ID + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + name: + description: The cluster name. + example: cluster-01 + type: string + version: + description: The cluster version. + example: 1.32.1 + type: string + endpoint: + description: The API server endpoint of the kubernetes cluster + example: https://api.cluster-01.example.com + format: uri + type: string + required: + - id + - name + - version + type: object + KubernetesNodePoolPostRequest: + description: POST request for a kubernetes node pool + example: + name: pool-01 + count: 3 + type: h100-hgx-80gb.8x + version: 1.32.1 + properties: + name: + description: Name of the kubernetes node pool + example: pool-01 + type: string + type: + description: Instance type of the kubernetes node pool + example: h100-hgx-80gb.8x + type: string + count: + description: Number of nodes in the kubernetes node pool + example: 3 + type: integer + version: + description: Version of the kubernetes node pool + example: 1.32.1 + type: string + required: + - count + - name + - type + type: object + KubernetesNodePool: + description: Kubernetes Node Pool + example: + cluster: cluster-01 + nodes: + - createdAt: 2023-10-01T12:00:00Z + accelerator: + product: NVIDIA-H100-80GB-HBM3 + driverVersion: 550.127.08 + type: nvidia/gpu + instanceID: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 + name: node-01 + kubeletVersion: v1.32.1 + state: ready + taints: + - effect: NoSchedule + value: present + key: nvidia.com/gpu + - effect: NoSchedule + value: present + key: nvidia.com/gpu + conditions: + - reason: KubeletReady + lastHeartbeatTime: 2023-10-01T12:00:00Z + type: Ready + lastTransitionTime: 2023-10-01T12:00:00Z + message: Kubelet is ready + status: "True" + - reason: KubeletReady + lastHeartbeatTime: 2023-10-01T12:00:00Z + type: Ready + lastTransitionTime: 2023-10-01T12:00:00Z + message: Kubelet is ready + status: "True" + labels: + kubernetes.io/hostname: node-01 + node-role.kubernetes.io/worker: "" + - createdAt: 2023-10-01T12:00:00Z + accelerator: + product: NVIDIA-H100-80GB-HBM3 + driverVersion: 550.127.08 + type: nvidia/gpu + instanceID: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 + name: node-01 + kubeletVersion: v1.32.1 + state: ready + taints: + - effect: NoSchedule + value: present + key: nvidia.com/gpu + - effect: NoSchedule + value: present + key: nvidia.com/gpu + conditions: + - reason: KubeletReady + lastHeartbeatTime: 2023-10-01T12:00:00Z + type: Ready + lastTransitionTime: 2023-10-01T12:00:00Z + message: Kubelet is ready + status: "True" + - reason: KubeletReady + lastHeartbeatTime: 2023-10-01T12:00:00Z + type: Ready + lastTransitionTime: 2023-10-01T12:00:00Z + message: Kubelet is ready + status: "True" + labels: + kubernetes.io/hostname: node-01 + node-role.kubernetes.io/worker: "" + name: pool-01 + count: 3 + id: 123e4567-e89b-12d3-a456-426614174003 + type: h100-hgx-80gb.8x + version: 1.32.1 + properties: + id: + description: Unique identifier of the kubernetes node pool + example: 123e4567-e89b-12d3-a456-426614174003 + format: uuid + type: string + x-go-name: ID + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + name: + description: Name of the kubernetes node pool + example: pool-01 + type: string + cluster: + description: Name of the kubernetes cluster + example: cluster-01 + type: string + type: + description: Instance type of the kubernetes node pool + example: h100-hgx-80gb.8x + type: string + count: + description: Number of nodes in the kubernetes node pool + example: 3 + type: integer + version: + description: Version of the kubernetes node pool + example: 1.32.1 + type: string + nodes: + description: List of nodes in the kubernetes node pool + items: + $ref: '#/components/schemas/KubernetesNode' + type: array + required: + - cluster + - count + - id + - name + - type + - version + type: object + KubernetesNode: + description: Kubernetes Node + example: + createdAt: 2023-10-01T12:00:00Z + accelerator: + product: NVIDIA-H100-80GB-HBM3 + driverVersion: 550.127.08 + type: nvidia/gpu + instanceID: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 + name: node-01 + kubeletVersion: v1.32.1 + state: ready + taints: + - effect: NoSchedule + value: present + key: nvidia.com/gpu + - effect: NoSchedule + value: present + key: nvidia.com/gpu + conditions: + - reason: KubeletReady + lastHeartbeatTime: 2023-10-01T12:00:00Z + type: Ready + lastTransitionTime: 2023-10-01T12:00:00Z + message: Kubelet is ready + status: "True" + - reason: KubeletReady + lastHeartbeatTime: 2023-10-01T12:00:00Z + type: Ready + lastTransitionTime: 2023-10-01T12:00:00Z + message: Kubelet is ready + status: "True" + labels: + kubernetes.io/hostname: node-01 + node-role.kubernetes.io/worker: "" + properties: + name: + description: Name of the kubernetes node + example: node-01 + type: string + instanceID: + description: Unique identifier of the instance backing the kubernetes node + format: uuid + type: string + x-go-name: InstanceID + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + state: + description: State of the kubernetes node + enum: + - ready + - not_ready + - unknown + example: ready + type: string + kubeletVersion: + description: Version of the kubelet running on the kubernetes node + example: v1.32.1 + type: string + createdAt: + description: Creation time of the kubernetes node + example: 2023-10-01T12:00:00Z + format: date-time + type: string + conditions: + description: Conditions of the kubernetes node + items: + $ref: '#/components/schemas/KubernetesNode_conditions_inner' + type: array + accelerator: + $ref: '#/components/schemas/Accelerator' + labels: + additionalProperties: + type: string + description: Labels assigned to the kubernetes node + example: + kubernetes.io/hostname: node-01 + node-role.kubernetes.io/worker: "" + type: object + taints: + description: Taints applied to the kubernetes node + items: + $ref: '#/components/schemas/KubernetesNode_taints_inner' + type: array + required: + - conditions + - createdAt + - instanceID + - kubeletVersion + - name + - state + type: object + SlurmClustersPostRequest: + description: POST request for a Slurm cluster + example: + name: cluster-01 + version: v0.40.0 + properties: + name: + description: The cluster name. + example: cluster-01 + type: string + version: + description: The cluster version. + example: v0.40.0 + type: string + required: + - name + type: object + SlurmCluster: + description: Slurm Cluster + example: + name: cluster-01 + id: 123e4567-e89b-12d3-a456-426614174003 + loginNodes: + - name: login-01 + publicIP: 203.0.113.0 + - name: login-01 + publicIP: 203.0.113.0 + version: 24.05.6 + properties: + id: + description: Unique identifier of the slurm cluster + example: 123e4567-e89b-12d3-a456-426614174003 + format: uuid + type: string + x-go-name: ID + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + name: + description: Name of the slurm cluster + example: cluster-01 + type: string + version: + description: The cluster version. + example: 24.05.6 + type: string + loginNodes: + description: Login nodes for the cluster + items: + $ref: '#/components/schemas/SlurmLoginNode' + type: array + required: + - id + - name + - version + type: object + SlurmNodePoolPostRequest: + description: POST request for a Slurm node pool + example: + name: pool-01 + count: 3 + type: h100-hgx-80gb.8x + properties: + name: + description: Name of the node pool + example: pool-01 + type: string + type: + description: Instance type of the node pool + example: h100-hgx-80gb.8x + type: string + count: + description: Number of nodes in the node pool + example: 3 + type: integer + required: + - count + - name + - type + type: object + SlurmNodePool: + description: Slurm Node Pool + example: + nodes: + - instanceID: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 + slurmdVersion: 24.05.7 + name: node-01 + states: + - states + - states + - instanceID: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 + slurmdVersion: 24.05.7 + name: node-01 + states: + - states + - states + name: pool-01 + count: 3 + id: 123e4567-e89b-12d3-a456-426614174003 + type: h100-hgx-80gb.8x + properties: + id: + description: Unique identifier of the slurm node pool + example: 123e4567-e89b-12d3-a456-426614174003 + format: uuid + type: string + x-go-name: ID + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + name: + description: Name of the node pool + example: pool-01 + type: string + type: + description: Instance type of the node pool + example: h100-hgx-80gb.8x + type: string + count: + description: Number of nodes in the node pool + example: 3 + type: integer + nodes: + description: List of nodes in the node pool + items: + $ref: '#/components/schemas/SlurmNode' + type: array + required: + - count + - id + - name + - nodes + - type + type: object + SlurmNode: + description: Slurm Node + example: + instanceID: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 + slurmdVersion: 24.05.7 + name: node-01 + states: + - states + - states + properties: + name: + description: Name of the node + example: node-01 + type: string + instanceID: + description: Unique identifier of the instance backing the node + format: uuid + type: string + x-go-name: InstanceID + x-go-type: uuid.UUID + x-go-type-import: + path: github.com/google/uuid + states: + description: States of the node + items: + type: string + type: array + slurmdVersion: + description: Version of slurmd running on the node + example: 24.05.7 + type: string + required: + - instanceID + - name + - slurmdVersion + - states + type: object + SlurmLoginNode: + description: Slurm Login nNode + example: + name: login-01 + publicIP: 203.0.113.0 + properties: + name: + description: Name of the node + example: login-01 + type: string + publicIP: + description: Public IP address of the node + example: 203.0.113.0 + format: ipv4 + type: string + x-go-name: PublicIP + x-go-type: net.IP + required: + - name + type: object + Accelerator: + description: Hardware details of the kubernetes node + example: + product: NVIDIA-H100-80GB-HBM3 + driverVersion: 550.127.08 + type: nvidia/gpu + properties: + type: + description: Type of the hardware accelerator + enum: + - nvidia/gpu + example: nvidia/gpu + type: string + x-enum-varnames: + - NvidiaGPU + product: + description: Product name of the accelerator + example: NVIDIA-H100-80GB-HBM3 + type: string + driverVersion: + description: Version of the driver for the accelerator + example: 550.127.08 + type: string + required: + - driverVersion + - product + - type + type: object + Capabilities: + description: List of avaialable capabilities + example: + - instances:list + - slurm:clusters:list + items: + $ref: '#/components/schemas/Capability' + type: array + Capability: + enum: + - instances:list + - instances:create + - instances:delete + - instances:read + - instances:update + - instances:start + - instances:stop + - filesystems:list + - filesystems:create + - filesystems:delete + - filesystems:read + - filesystems:update + - projects:list + - projects:create + - projects:delete + - projects:read + - projects:update + - kubernetes:clusters:list + - kubernetes:clusters:create + - kubernetes:clusters:delete + - kubernetes:clusters:read + - kubernetes:node-pools:list + - kubernetes:node-pools:create + - kubernetes:node-pools:delete + - kubernetes:node-pools:read + - kubernetes:credentials:read + - slurm:clusters:list + - slurm:clusters:read + - slurm:clusters:proxy + - slurm:node-pools:list + - slurm:node-pools:read + type: string + ListCapacity_200_response_inner: + example: + name: h100-hgx-80gb.8x + capacity: 1 + properties: + name: + description: Available instance type + example: h100-hgx-80gb.8x + type: string + capacity: + description: Available instance count + example: 1 + type: integer + required: + - capacity + - name + type: object + KubernetesNode_conditions_inner: + example: + reason: KubeletReady + lastHeartbeatTime: 2023-10-01T12:00:00Z + type: Ready + lastTransitionTime: 2023-10-01T12:00:00Z + message: Kubelet is ready + status: "True" + properties: + type: + description: Type of the condition + example: Ready + type: string + status: + description: Status of the condition + enum: + - "True" + - "False" + - Unknown + type: string + lastHeartbeatTime: + description: Last time the condition was updated + example: 2023-10-01T12:00:00Z + format: date-time + type: string + lastTransitionTime: + description: Last time the condition transitioned from one status to another + example: 2023-10-01T12:00:00Z + format: date-time + type: string + reason: + description: Reason for the condition's last transition + example: KubeletReady + type: string + message: + description: Human-readable message indicating details about the condition + example: Kubelet is ready + type: string + type: object + x-go-type: corev1.NodeCondition + x-go-type-import: + path: k8s.io/api/core/v1 + name: corev1 + KubernetesNode_taints_inner: + example: + effect: NoSchedule + value: present + key: nvidia.com/gpu + properties: + key: + description: Key of the taint + example: nvidia.com/gpu + type: string + value: + description: Value of the taint + example: present + type: string + effect: + description: Effect of the taint + enum: + - NoSchedule + - PreferNoSchedule + - NoExecute + example: NoSchedule + type: string + type: object + x-go-type: corev1.Taint + x-go-type-import: + path: k8s.io/api/core/v1 + name: corev1 + securitySchemes: + bearerAuth: + bearerFormat: JWT + scheme: bearer + type: http diff --git a/internal/fluidstack/gen/fluidstack/api_capabilities.go b/internal/fluidstack/gen/fluidstack/api_capabilities.go new file mode 100644 index 0000000..e8107e8 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/api_capabilities.go @@ -0,0 +1,141 @@ +/* +Infrastructure API + +Fluidstack Infrastructure API + +API version: v1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" +) + +// CapabilitiesAPIService CapabilitiesAPI service +type CapabilitiesAPIService service + +type ApiListCapabilitiesRequest struct { + ctx context.Context + ApiService *CapabilitiesAPIService +} + +func (r ApiListCapabilitiesRequest) Execute() ([]Capability, *http.Response, error) { + return r.ApiService.ListCapabilitiesExecute(r) +} + +/* +ListCapabilities List available capabilities + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiListCapabilitiesRequest +*/ +func (a *CapabilitiesAPIService) ListCapabilities(ctx context.Context) ApiListCapabilitiesRequest { + return ApiListCapabilitiesRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return []Capability +func (a *CapabilitiesAPIService) ListCapabilitiesExecute(r ApiListCapabilitiesRequest) ([]Capability, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []Capability + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CapabilitiesAPIService.ListCapabilities") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/capabilities" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.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 + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 501 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/internal/fluidstack/gen/fluidstack/api_capacity.go b/internal/fluidstack/gen/fluidstack/api_capacity.go new file mode 100644 index 0000000..6556c52 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/api_capacity.go @@ -0,0 +1,152 @@ +/* +Infrastructure API + +Fluidstack Infrastructure API + +API version: v1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" +) + +// CapacityAPIService CapacityAPI service +type CapacityAPIService service + +type ApiListCapacityRequest struct { + ctx context.Context + ApiService *CapacityAPIService + xPROJECTID *string +} + +// Project identifier passed as a header +func (r ApiListCapacityRequest) XPROJECTID(xPROJECTID string) ApiListCapacityRequest { + r.xPROJECTID = &xPROJECTID + return r +} + +func (r ApiListCapacityRequest) Execute() ([]ListCapacity200ResponseInner, *http.Response, error) { + return r.ApiService.ListCapacityExecute(r) +} + +/* +ListCapacity List available capacity + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiListCapacityRequest +*/ +func (a *CapacityAPIService) ListCapacity(ctx context.Context) ApiListCapacityRequest { + return ApiListCapacityRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return []ListCapacity200ResponseInner +func (a *CapacityAPIService) ListCapacityExecute(r ApiListCapacityRequest) ([]ListCapacity200ResponseInner, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []ListCapacity200ResponseInner + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CapacityAPIService.ListCapacity") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/capacity" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.xPROJECTID == nil { + return localVarReturnValue, nil, reportError("xPROJECTID is required and must be specified") + } + + // 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 + } + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-PROJECT-ID", r.xPROJECTID, "simple", "") + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 501 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/internal/fluidstack/gen/fluidstack/api_filesystems.go b/internal/fluidstack/gen/fluidstack/api_filesystems.go new file mode 100644 index 0000000..f874b23 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/api_filesystems.go @@ -0,0 +1,628 @@ +/* +Infrastructure API + +Fluidstack Infrastructure API + +API version: v1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// FilesystemsAPIService FilesystemsAPI service +type FilesystemsAPIService service + +type ApiCreateFilesystemRequest struct { + ctx context.Context + ApiService *FilesystemsAPIService + xPROJECTID *string + filesystemsPostRequest *FilesystemsPostRequest +} + +// Project identifier passed as a header +func (r ApiCreateFilesystemRequest) XPROJECTID(xPROJECTID string) ApiCreateFilesystemRequest { + r.xPROJECTID = &xPROJECTID + return r +} + +// Details of the filesystem to create +func (r ApiCreateFilesystemRequest) FilesystemsPostRequest(filesystemsPostRequest FilesystemsPostRequest) ApiCreateFilesystemRequest { + r.filesystemsPostRequest = &filesystemsPostRequest + return r +} + +func (r ApiCreateFilesystemRequest) Execute() (*Filesystem, *http.Response, error) { + return r.ApiService.CreateFilesystemExecute(r) +} + +/* +CreateFilesystem Create a filesystem + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiCreateFilesystemRequest +*/ +func (a *FilesystemsAPIService) CreateFilesystem(ctx context.Context) ApiCreateFilesystemRequest { + return ApiCreateFilesystemRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return Filesystem +func (a *FilesystemsAPIService) CreateFilesystemExecute(r ApiCreateFilesystemRequest) (*Filesystem, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Filesystem + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FilesystemsAPIService.CreateFilesystem") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/filesystems" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.xPROJECTID == nil { + return localVarReturnValue, nil, reportError("xPROJECTID is required and must be specified") + } + if r.filesystemsPostRequest == nil { + return localVarReturnValue, nil, reportError("filesystemsPostRequest is required and must be specified") + } + + // 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 + } + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-PROJECT-ID", r.xPROJECTID, "simple", "") + // body params + localVarPostBody = r.filesystemsPostRequest + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 501 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiDeleteFilesystemRequest struct { + ctx context.Context + ApiService *FilesystemsAPIService + xPROJECTID *string + id string +} + +// Project identifier passed as a header +func (r ApiDeleteFilesystemRequest) XPROJECTID(xPROJECTID string) ApiDeleteFilesystemRequest { + r.xPROJECTID = &xPROJECTID + return r +} + +func (r ApiDeleteFilesystemRequest) Execute() (*http.Response, error) { + return r.ApiService.DeleteFilesystemExecute(r) +} + +/* +DeleteFilesystem Delete a filesystem + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Unique identifier of the filesystem + @return ApiDeleteFilesystemRequest +*/ +func (a *FilesystemsAPIService) DeleteFilesystem(ctx context.Context, id string) ApiDeleteFilesystemRequest { + return ApiDeleteFilesystemRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +func (a *FilesystemsAPIService) DeleteFilesystemExecute(r ApiDeleteFilesystemRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FilesystemsAPIService.DeleteFilesystem") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/filesystems/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.xPROJECTID == nil { + return nil, reportError("xPROJECTID is required and must be specified") + } + + // 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 + } + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-PROJECT-ID", r.xPROJECTID, "simple", "") + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 501 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiGetFilesystemRequest struct { + ctx context.Context + ApiService *FilesystemsAPIService + xPROJECTID *string + id string +} + +// Project identifier passed as a header +func (r ApiGetFilesystemRequest) XPROJECTID(xPROJECTID string) ApiGetFilesystemRequest { + r.xPROJECTID = &xPROJECTID + return r +} + +func (r ApiGetFilesystemRequest) Execute() (*Filesystem, *http.Response, error) { + return r.ApiService.GetFilesystemExecute(r) +} + +/* +GetFilesystem Get a filesystem + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Unique identifier of the filesystem + @return ApiGetFilesystemRequest +*/ +func (a *FilesystemsAPIService) GetFilesystem(ctx context.Context, id string) ApiGetFilesystemRequest { + return ApiGetFilesystemRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return Filesystem +func (a *FilesystemsAPIService) GetFilesystemExecute(r ApiGetFilesystemRequest) (*Filesystem, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Filesystem + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FilesystemsAPIService.GetFilesystem") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/filesystems/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.xPROJECTID == nil { + return localVarReturnValue, nil, reportError("xPROJECTID is required and must be specified") + } + + // 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 + } + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-PROJECT-ID", r.xPROJECTID, "simple", "") + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 501 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiListFilesystemsRequest struct { + ctx context.Context + ApiService *FilesystemsAPIService + xPROJECTID *string +} + +// Project identifier passed as a header +func (r ApiListFilesystemsRequest) XPROJECTID(xPROJECTID string) ApiListFilesystemsRequest { + r.xPROJECTID = &xPROJECTID + return r +} + +func (r ApiListFilesystemsRequest) Execute() ([]Filesystem, *http.Response, error) { + return r.ApiService.ListFilesystemsExecute(r) +} + +/* +ListFilesystems List all filesystems + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiListFilesystemsRequest +*/ +func (a *FilesystemsAPIService) ListFilesystems(ctx context.Context) ApiListFilesystemsRequest { + return ApiListFilesystemsRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return []Filesystem +func (a *FilesystemsAPIService) ListFilesystemsExecute(r ApiListFilesystemsRequest) ([]Filesystem, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []Filesystem + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FilesystemsAPIService.ListFilesystems") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/filesystems" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.xPROJECTID == nil { + return localVarReturnValue, nil, reportError("xPROJECTID is required and must be specified") + } + + // 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 + } + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-PROJECT-ID", r.xPROJECTID, "simple", "") + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 501 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/internal/fluidstack/gen/fluidstack/api_instance_types.go b/internal/fluidstack/gen/fluidstack/api_instance_types.go new file mode 100644 index 0000000..2f34ce7 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/api_instance_types.go @@ -0,0 +1,141 @@ +/* +Infrastructure API + +Fluidstack Infrastructure API + +API version: v1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" +) + +// InstanceTypesAPIService InstanceTypesAPI service +type InstanceTypesAPIService service + +type ApiListInstanceTypesRequest struct { + ctx context.Context + ApiService *InstanceTypesAPIService +} + +func (r ApiListInstanceTypesRequest) Execute() ([]InstanceType, *http.Response, error) { + return r.ApiService.ListInstanceTypesExecute(r) +} + +/* +ListInstanceTypes List all available instance types + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiListInstanceTypesRequest +*/ +func (a *InstanceTypesAPIService) ListInstanceTypes(ctx context.Context) ApiListInstanceTypesRequest { + return ApiListInstanceTypesRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return []InstanceType +func (a *InstanceTypesAPIService) ListInstanceTypesExecute(r ApiListInstanceTypesRequest) ([]InstanceType, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []InstanceType + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "InstanceTypesAPIService.ListInstanceTypes") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/instance-types" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.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 + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 501 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/internal/fluidstack/gen/fluidstack/api_instances.go b/internal/fluidstack/gen/fluidstack/api_instances.go new file mode 100644 index 0000000..b506d85 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/api_instances.go @@ -0,0 +1,982 @@ +/* +Infrastructure API + +Fluidstack Infrastructure API + +API version: v1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// InstancesAPIService InstancesAPI service +type InstancesAPIService service + +type ApiCreateInstanceRequest struct { + ctx context.Context + ApiService *InstancesAPIService + xPROJECTID *string + instancesPostRequest *InstancesPostRequest +} + +// Project identifier passed as a header +func (r ApiCreateInstanceRequest) XPROJECTID(xPROJECTID string) ApiCreateInstanceRequest { + r.xPROJECTID = &xPROJECTID + return r +} + +// Details of the instance to create +func (r ApiCreateInstanceRequest) InstancesPostRequest(instancesPostRequest InstancesPostRequest) ApiCreateInstanceRequest { + r.instancesPostRequest = &instancesPostRequest + return r +} + +func (r ApiCreateInstanceRequest) Execute() (*Instance, *http.Response, error) { + return r.ApiService.CreateInstanceExecute(r) +} + +/* +CreateInstance Create a machine instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiCreateInstanceRequest +*/ +func (a *InstancesAPIService) CreateInstance(ctx context.Context) ApiCreateInstanceRequest { + return ApiCreateInstanceRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return Instance +func (a *InstancesAPIService) CreateInstanceExecute(r ApiCreateInstanceRequest) (*Instance, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Instance + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "InstancesAPIService.CreateInstance") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/instances" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.xPROJECTID == nil { + return localVarReturnValue, nil, reportError("xPROJECTID is required and must be specified") + } + if r.instancesPostRequest == nil { + return localVarReturnValue, nil, reportError("instancesPostRequest is required and must be specified") + } + + // 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 + } + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-PROJECT-ID", r.xPROJECTID, "simple", "") + // body params + localVarPostBody = r.instancesPostRequest + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 501 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiDeleteInstanceRequest struct { + ctx context.Context + ApiService *InstancesAPIService + xPROJECTID *string + id string +} + +// Project identifier passed as a header +func (r ApiDeleteInstanceRequest) XPROJECTID(xPROJECTID string) ApiDeleteInstanceRequest { + r.xPROJECTID = &xPROJECTID + return r +} + +func (r ApiDeleteInstanceRequest) Execute() (*http.Response, error) { + return r.ApiService.DeleteInstanceExecute(r) +} + +/* +DeleteInstance Delete a machine instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Unique identifier of the instance + @return ApiDeleteInstanceRequest +*/ +func (a *InstancesAPIService) DeleteInstance(ctx context.Context, id string) ApiDeleteInstanceRequest { + return ApiDeleteInstanceRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +func (a *InstancesAPIService) DeleteInstanceExecute(r ApiDeleteInstanceRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "InstancesAPIService.DeleteInstance") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/instances/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.xPROJECTID == nil { + return nil, reportError("xPROJECTID is required and must be specified") + } + + // 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 + } + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-PROJECT-ID", r.xPROJECTID, "simple", "") + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 501 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiGetInstanceRequest struct { + ctx context.Context + ApiService *InstancesAPIService + xPROJECTID *string + id string +} + +// Project identifier passed as a header +func (r ApiGetInstanceRequest) XPROJECTID(xPROJECTID string) ApiGetInstanceRequest { + r.xPROJECTID = &xPROJECTID + return r +} + +func (r ApiGetInstanceRequest) Execute() (*Instance, *http.Response, error) { + return r.ApiService.GetInstanceExecute(r) +} + +/* +GetInstance Get a machine instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Unique identifier of the instance + @return ApiGetInstanceRequest +*/ +func (a *InstancesAPIService) GetInstance(ctx context.Context, id string) ApiGetInstanceRequest { + return ApiGetInstanceRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return Instance +func (a *InstancesAPIService) GetInstanceExecute(r ApiGetInstanceRequest) (*Instance, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Instance + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "InstancesAPIService.GetInstance") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/instances/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.xPROJECTID == nil { + return localVarReturnValue, nil, reportError("xPROJECTID is required and must be specified") + } + + // 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 + } + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-PROJECT-ID", r.xPROJECTID, "simple", "") + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 501 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiListInstancesRequest struct { + ctx context.Context + ApiService *InstancesAPIService + xPROJECTID *string +} + +// Project identifier passed as a header +func (r ApiListInstancesRequest) XPROJECTID(xPROJECTID string) ApiListInstancesRequest { + r.xPROJECTID = &xPROJECTID + return r +} + +func (r ApiListInstancesRequest) Execute() ([]Instance, *http.Response, error) { + return r.ApiService.ListInstancesExecute(r) +} + +/* +ListInstances List all machine instances + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiListInstancesRequest +*/ +func (a *InstancesAPIService) ListInstances(ctx context.Context) ApiListInstancesRequest { + return ApiListInstancesRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return []Instance +func (a *InstancesAPIService) ListInstancesExecute(r ApiListInstancesRequest) ([]Instance, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []Instance + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "InstancesAPIService.ListInstances") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/instances" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.xPROJECTID == nil { + return localVarReturnValue, nil, reportError("xPROJECTID is required and must be specified") + } + + // 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 + } + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-PROJECT-ID", r.xPROJECTID, "simple", "") + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 501 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiStartInstanceRequest struct { + ctx context.Context + ApiService *InstancesAPIService + xPROJECTID *string + id string +} + +// Project identifier passed as a header +func (r ApiStartInstanceRequest) XPROJECTID(xPROJECTID string) ApiStartInstanceRequest { + r.xPROJECTID = &xPROJECTID + return r +} + +func (r ApiStartInstanceRequest) Execute() (*http.Response, error) { + return r.ApiService.StartInstanceExecute(r) +} + +/* +StartInstance Start a machine instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Unique identifier of the instance + @return ApiStartInstanceRequest +*/ +func (a *InstancesAPIService) StartInstance(ctx context.Context, id string) ApiStartInstanceRequest { + return ApiStartInstanceRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +func (a *InstancesAPIService) StartInstanceExecute(r ApiStartInstanceRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "InstancesAPIService.StartInstance") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/instances/{id}/actions/start" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.xPROJECTID == nil { + return nil, reportError("xPROJECTID is required and must be specified") + } + + // 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 + } + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-PROJECT-ID", r.xPROJECTID, "simple", "") + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 501 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiStopInstanceRequest struct { + ctx context.Context + ApiService *InstancesAPIService + xPROJECTID *string + id string +} + +// Project identifier passed as a header +func (r ApiStopInstanceRequest) XPROJECTID(xPROJECTID string) ApiStopInstanceRequest { + r.xPROJECTID = &xPROJECTID + return r +} + +func (r ApiStopInstanceRequest) Execute() (*http.Response, error) { + return r.ApiService.StopInstanceExecute(r) +} + +/* +StopInstance Stop a machine instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Unique identifier of the instance + @return ApiStopInstanceRequest +*/ +func (a *InstancesAPIService) StopInstance(ctx context.Context, id string) ApiStopInstanceRequest { + return ApiStopInstanceRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +func (a *InstancesAPIService) StopInstanceExecute(r ApiStopInstanceRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "InstancesAPIService.StopInstance") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/instances/{id}/actions/stop" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.xPROJECTID == nil { + return nil, reportError("xPROJECTID is required and must be specified") + } + + // 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 + } + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-PROJECT-ID", r.xPROJECTID, "simple", "") + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 501 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} diff --git a/internal/fluidstack/gen/fluidstack/api_kubernetes.go b/internal/fluidstack/gen/fluidstack/api_kubernetes.go new file mode 100644 index 0000000..1762d70 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/api_kubernetes.go @@ -0,0 +1,1438 @@ +/* +Infrastructure API + +Fluidstack Infrastructure API + +API version: v1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// KubernetesAPIService KubernetesAPI service +type KubernetesAPIService service + +type ApiCreateKubernetesClusterRequest struct { + ctx context.Context + ApiService *KubernetesAPIService + xPROJECTID *string + kubernetesClustersPostRequest *KubernetesClustersPostRequest +} + +// Project identifier passed as a header +func (r ApiCreateKubernetesClusterRequest) XPROJECTID(xPROJECTID string) ApiCreateKubernetesClusterRequest { + r.xPROJECTID = &xPROJECTID + return r +} + +// Details of the cluster to create +func (r ApiCreateKubernetesClusterRequest) KubernetesClustersPostRequest(kubernetesClustersPostRequest KubernetesClustersPostRequest) ApiCreateKubernetesClusterRequest { + r.kubernetesClustersPostRequest = &kubernetesClustersPostRequest + return r +} + +func (r ApiCreateKubernetesClusterRequest) Execute() (*KubernetesCluster, *http.Response, error) { + return r.ApiService.CreateKubernetesClusterExecute(r) +} + +/* +CreateKubernetesCluster Create a cluster + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiCreateKubernetesClusterRequest +*/ +func (a *KubernetesAPIService) CreateKubernetesCluster(ctx context.Context) ApiCreateKubernetesClusterRequest { + return ApiCreateKubernetesClusterRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return KubernetesCluster +func (a *KubernetesAPIService) CreateKubernetesClusterExecute(r ApiCreateKubernetesClusterRequest) (*KubernetesCluster, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *KubernetesCluster + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesAPIService.CreateKubernetesCluster") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/kubernetes/clusters" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.xPROJECTID == nil { + return localVarReturnValue, nil, reportError("xPROJECTID is required and must be specified") + } + if r.kubernetesClustersPostRequest == nil { + return localVarReturnValue, nil, reportError("kubernetesClustersPostRequest is required and must be specified") + } + + // 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 + } + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-PROJECT-ID", r.xPROJECTID, "simple", "") + // body params + localVarPostBody = r.kubernetesClustersPostRequest + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 501 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiCreateKubernetesNodePoolRequest struct { + ctx context.Context + ApiService *KubernetesAPIService + xPROJECTID *string + clusterId string + kubernetesNodePoolPostRequest *KubernetesNodePoolPostRequest +} + +// Project identifier passed as a header +func (r ApiCreateKubernetesNodePoolRequest) XPROJECTID(xPROJECTID string) ApiCreateKubernetesNodePoolRequest { + r.xPROJECTID = &xPROJECTID + return r +} + +// Details of the node pool to create +func (r ApiCreateKubernetesNodePoolRequest) KubernetesNodePoolPostRequest(kubernetesNodePoolPostRequest KubernetesNodePoolPostRequest) ApiCreateKubernetesNodePoolRequest { + r.kubernetesNodePoolPostRequest = &kubernetesNodePoolPostRequest + return r +} + +func (r ApiCreateKubernetesNodePoolRequest) Execute() (*KubernetesNodePool, *http.Response, error) { + return r.ApiService.CreateKubernetesNodePoolExecute(r) +} + +/* +CreateKubernetesNodePool Create a node pool + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param clusterId Unique identifier of the cluster + @return ApiCreateKubernetesNodePoolRequest +*/ +func (a *KubernetesAPIService) CreateKubernetesNodePool(ctx context.Context, clusterId string) ApiCreateKubernetesNodePoolRequest { + return ApiCreateKubernetesNodePoolRequest{ + ApiService: a, + ctx: ctx, + clusterId: clusterId, + } +} + +// Execute executes the request +// +// @return KubernetesNodePool +func (a *KubernetesAPIService) CreateKubernetesNodePoolExecute(r ApiCreateKubernetesNodePoolRequest) (*KubernetesNodePool, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *KubernetesNodePool + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesAPIService.CreateKubernetesNodePool") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/kubernetes/clusters/{cluster_id}/node-pools" + localVarPath = strings.Replace(localVarPath, "{"+"cluster_id"+"}", url.PathEscape(parameterValueToString(r.clusterId, "clusterId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.xPROJECTID == nil { + return localVarReturnValue, nil, reportError("xPROJECTID is required and must be specified") + } + if r.kubernetesNodePoolPostRequest == nil { + return localVarReturnValue, nil, reportError("kubernetesNodePoolPostRequest is required and must be specified") + } + + // 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 + } + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-PROJECT-ID", r.xPROJECTID, "simple", "") + // body params + localVarPostBody = r.kubernetesNodePoolPostRequest + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 501 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiDeleteKubernetesClusterRequest struct { + ctx context.Context + ApiService *KubernetesAPIService + xPROJECTID *string + id string +} + +// Project identifier passed as a header +func (r ApiDeleteKubernetesClusterRequest) XPROJECTID(xPROJECTID string) ApiDeleteKubernetesClusterRequest { + r.xPROJECTID = &xPROJECTID + return r +} + +func (r ApiDeleteKubernetesClusterRequest) Execute() (*http.Response, error) { + return r.ApiService.DeleteKubernetesClusterExecute(r) +} + +/* +DeleteKubernetesCluster Delete a cluster + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Unique identifier of the kubernetes cluster to delete + @return ApiDeleteKubernetesClusterRequest +*/ +func (a *KubernetesAPIService) DeleteKubernetesCluster(ctx context.Context, id string) ApiDeleteKubernetesClusterRequest { + return ApiDeleteKubernetesClusterRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +func (a *KubernetesAPIService) DeleteKubernetesClusterExecute(r ApiDeleteKubernetesClusterRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesAPIService.DeleteKubernetesCluster") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/kubernetes/clusters/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.xPROJECTID == nil { + return nil, reportError("xPROJECTID is required and must be specified") + } + + // 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 + } + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-PROJECT-ID", r.xPROJECTID, "simple", "") + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 501 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiDeleteKubernetesNodePoolRequest struct { + ctx context.Context + ApiService *KubernetesAPIService + xPROJECTID *string + clusterId string + nodePoolId string +} + +// Project identifier passed as a header +func (r ApiDeleteKubernetesNodePoolRequest) XPROJECTID(xPROJECTID string) ApiDeleteKubernetesNodePoolRequest { + r.xPROJECTID = &xPROJECTID + return r +} + +func (r ApiDeleteKubernetesNodePoolRequest) Execute() (*http.Response, error) { + return r.ApiService.DeleteKubernetesNodePoolExecute(r) +} + +/* +DeleteKubernetesNodePool Delete a node pool + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param clusterId Unique identifier of the cluster + @param nodePoolId Unique identifier of the node pool to delete + @return ApiDeleteKubernetesNodePoolRequest +*/ +func (a *KubernetesAPIService) DeleteKubernetesNodePool(ctx context.Context, clusterId string, nodePoolId string) ApiDeleteKubernetesNodePoolRequest { + return ApiDeleteKubernetesNodePoolRequest{ + ApiService: a, + ctx: ctx, + clusterId: clusterId, + nodePoolId: nodePoolId, + } +} + +// Execute executes the request +func (a *KubernetesAPIService) DeleteKubernetesNodePoolExecute(r ApiDeleteKubernetesNodePoolRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesAPIService.DeleteKubernetesNodePool") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/kubernetes/clusters/{cluster_id}/node-pools/{node_pool_id}" + localVarPath = strings.Replace(localVarPath, "{"+"cluster_id"+"}", url.PathEscape(parameterValueToString(r.clusterId, "clusterId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"node_pool_id"+"}", url.PathEscape(parameterValueToString(r.nodePoolId, "nodePoolId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.xPROJECTID == nil { + return nil, reportError("xPROJECTID is required and must be specified") + } + + // 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 + } + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-PROJECT-ID", r.xPROJECTID, "simple", "") + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 501 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiGetKubernetesClusterRequest struct { + ctx context.Context + ApiService *KubernetesAPIService + xPROJECTID *string + id string +} + +// Project identifier passed as a header +func (r ApiGetKubernetesClusterRequest) XPROJECTID(xPROJECTID string) ApiGetKubernetesClusterRequest { + r.xPROJECTID = &xPROJECTID + return r +} + +func (r ApiGetKubernetesClusterRequest) Execute() (*KubernetesCluster, *http.Response, error) { + return r.ApiService.GetKubernetesClusterExecute(r) +} + +/* +GetKubernetesCluster Get a cluster + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Unique identifier of the kubernetes cluster + @return ApiGetKubernetesClusterRequest +*/ +func (a *KubernetesAPIService) GetKubernetesCluster(ctx context.Context, id string) ApiGetKubernetesClusterRequest { + return ApiGetKubernetesClusterRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return KubernetesCluster +func (a *KubernetesAPIService) GetKubernetesClusterExecute(r ApiGetKubernetesClusterRequest) (*KubernetesCluster, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *KubernetesCluster + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesAPIService.GetKubernetesCluster") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/kubernetes/clusters/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.xPROJECTID == nil { + return localVarReturnValue, nil, reportError("xPROJECTID is required and must be specified") + } + + // 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 + } + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-PROJECT-ID", r.xPROJECTID, "simple", "") + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 501 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetKubernetesClusterCredentialsRequest struct { + ctx context.Context + ApiService *KubernetesAPIService + xPROJECTID *string + clusterId string +} + +// Project identifier passed as a header +func (r ApiGetKubernetesClusterCredentialsRequest) XPROJECTID(xPROJECTID string) ApiGetKubernetesClusterCredentialsRequest { + r.xPROJECTID = &xPROJECTID + return r +} + +func (r ApiGetKubernetesClusterCredentialsRequest) Execute() (string, *http.Response, error) { + return r.ApiService.GetKubernetesClusterCredentialsExecute(r) +} + +/* +GetKubernetesClusterCredentials Get kubeconfig credentials for a cluster + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param clusterId Unique identifier of the kubernetes cluster + @return ApiGetKubernetesClusterCredentialsRequest +*/ +func (a *KubernetesAPIService) GetKubernetesClusterCredentials(ctx context.Context, clusterId string) ApiGetKubernetesClusterCredentialsRequest { + return ApiGetKubernetesClusterCredentialsRequest{ + ApiService: a, + ctx: ctx, + clusterId: clusterId, + } +} + +// Execute executes the request +// +// @return string +func (a *KubernetesAPIService) GetKubernetesClusterCredentialsExecute(r ApiGetKubernetesClusterCredentialsRequest) (string, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue string + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesAPIService.GetKubernetesClusterCredentials") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/kubernetes/clusters/{cluster_id}/credentials" + localVarPath = strings.Replace(localVarPath, "{"+"cluster_id"+"}", url.PathEscape(parameterValueToString(r.clusterId, "clusterId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.xPROJECTID == nil { + return localVarReturnValue, nil, reportError("xPROJECTID is required and must be specified") + } + + // 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/yaml", "application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-PROJECT-ID", r.xPROJECTID, "simple", "") + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 501 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetKubernetesNodePoolRequest struct { + ctx context.Context + ApiService *KubernetesAPIService + xPROJECTID *string + clusterId string + nodePoolId string +} + +// Project identifier passed as a header +func (r ApiGetKubernetesNodePoolRequest) XPROJECTID(xPROJECTID string) ApiGetKubernetesNodePoolRequest { + r.xPROJECTID = &xPROJECTID + return r +} + +func (r ApiGetKubernetesNodePoolRequest) Execute() (*KubernetesNodePool, *http.Response, error) { + return r.ApiService.GetKubernetesNodePoolExecute(r) +} + +/* +GetKubernetesNodePool Get a node pool + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param clusterId Unique identifier of the cluster + @param nodePoolId Unique identifier of the node pool + @return ApiGetKubernetesNodePoolRequest +*/ +func (a *KubernetesAPIService) GetKubernetesNodePool(ctx context.Context, clusterId string, nodePoolId string) ApiGetKubernetesNodePoolRequest { + return ApiGetKubernetesNodePoolRequest{ + ApiService: a, + ctx: ctx, + clusterId: clusterId, + nodePoolId: nodePoolId, + } +} + +// Execute executes the request +// +// @return KubernetesNodePool +func (a *KubernetesAPIService) GetKubernetesNodePoolExecute(r ApiGetKubernetesNodePoolRequest) (*KubernetesNodePool, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *KubernetesNodePool + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesAPIService.GetKubernetesNodePool") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/kubernetes/clusters/{cluster_id}/node-pools/{node_pool_id}" + localVarPath = strings.Replace(localVarPath, "{"+"cluster_id"+"}", url.PathEscape(parameterValueToString(r.clusterId, "clusterId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"node_pool_id"+"}", url.PathEscape(parameterValueToString(r.nodePoolId, "nodePoolId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.xPROJECTID == nil { + return localVarReturnValue, nil, reportError("xPROJECTID is required and must be specified") + } + + // 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 + } + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-PROJECT-ID", r.xPROJECTID, "simple", "") + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 501 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiListKubernetesClustersRequest struct { + ctx context.Context + ApiService *KubernetesAPIService + xPROJECTID *string +} + +// Project identifier passed as a header +func (r ApiListKubernetesClustersRequest) XPROJECTID(xPROJECTID string) ApiListKubernetesClustersRequest { + r.xPROJECTID = &xPROJECTID + return r +} + +func (r ApiListKubernetesClustersRequest) Execute() ([]KubernetesCluster, *http.Response, error) { + return r.ApiService.ListKubernetesClustersExecute(r) +} + +/* +ListKubernetesClusters List all clusters + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiListKubernetesClustersRequest +*/ +func (a *KubernetesAPIService) ListKubernetesClusters(ctx context.Context) ApiListKubernetesClustersRequest { + return ApiListKubernetesClustersRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return []KubernetesCluster +func (a *KubernetesAPIService) ListKubernetesClustersExecute(r ApiListKubernetesClustersRequest) ([]KubernetesCluster, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []KubernetesCluster + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesAPIService.ListKubernetesClusters") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/kubernetes/clusters" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.xPROJECTID == nil { + return localVarReturnValue, nil, reportError("xPROJECTID is required and must be specified") + } + + // 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 + } + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-PROJECT-ID", r.xPROJECTID, "simple", "") + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 501 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiListKubernetesNodePoolsRequest struct { + ctx context.Context + ApiService *KubernetesAPIService + xPROJECTID *string + clusterId string +} + +// Project identifier passed as a header +func (r ApiListKubernetesNodePoolsRequest) XPROJECTID(xPROJECTID string) ApiListKubernetesNodePoolsRequest { + r.xPROJECTID = &xPROJECTID + return r +} + +func (r ApiListKubernetesNodePoolsRequest) Execute() ([]KubernetesNodePool, *http.Response, error) { + return r.ApiService.ListKubernetesNodePoolsExecute(r) +} + +/* +ListKubernetesNodePools List all node pools for a cluster + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param clusterId Unique identifier of the cluster + @return ApiListKubernetesNodePoolsRequest +*/ +func (a *KubernetesAPIService) ListKubernetesNodePools(ctx context.Context, clusterId string) ApiListKubernetesNodePoolsRequest { + return ApiListKubernetesNodePoolsRequest{ + ApiService: a, + ctx: ctx, + clusterId: clusterId, + } +} + +// Execute executes the request +// +// @return []KubernetesNodePool +func (a *KubernetesAPIService) ListKubernetesNodePoolsExecute(r ApiListKubernetesNodePoolsRequest) ([]KubernetesNodePool, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []KubernetesNodePool + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesAPIService.ListKubernetesNodePools") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/kubernetes/clusters/{cluster_id}/node-pools" + localVarPath = strings.Replace(localVarPath, "{"+"cluster_id"+"}", url.PathEscape(parameterValueToString(r.clusterId, "clusterId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.xPROJECTID == nil { + return localVarReturnValue, nil, reportError("xPROJECTID is required and must be specified") + } + + // 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 + } + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-PROJECT-ID", r.xPROJECTID, "simple", "") + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 501 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/internal/fluidstack/gen/fluidstack/api_projects.go b/internal/fluidstack/gen/fluidstack/api_projects.go new file mode 100644 index 0000000..7b1d1d2 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/api_projects.go @@ -0,0 +1,584 @@ +/* +Infrastructure API + +Fluidstack Infrastructure API + +API version: v1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// ProjectsAPIService ProjectsAPI service +type ProjectsAPIService service + +type ApiCreateProjectRequest struct { + ctx context.Context + ApiService *ProjectsAPIService + projectsPostRequest *ProjectsPostRequest +} + +// Details of the project to create +func (r ApiCreateProjectRequest) ProjectsPostRequest(projectsPostRequest ProjectsPostRequest) ApiCreateProjectRequest { + r.projectsPostRequest = &projectsPostRequest + return r +} + +func (r ApiCreateProjectRequest) Execute() (*Project, *http.Response, error) { + return r.ApiService.CreateProjectExecute(r) +} + +/* +CreateProject Create a project + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiCreateProjectRequest +*/ +func (a *ProjectsAPIService) CreateProject(ctx context.Context) ApiCreateProjectRequest { + return ApiCreateProjectRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return Project +func (a *ProjectsAPIService) CreateProjectExecute(r ApiCreateProjectRequest) (*Project, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Project + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectsAPIService.CreateProject") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.projectsPostRequest == nil { + return localVarReturnValue, nil, reportError("projectsPostRequest is required and must be specified") + } + + // 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 + } + // body params + localVarPostBody = r.projectsPostRequest + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 501 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiDeleteProjectRequest struct { + ctx context.Context + ApiService *ProjectsAPIService + id string +} + +func (r ApiDeleteProjectRequest) Execute() (*http.Response, error) { + return r.ApiService.DeleteProjectExecute(r) +} + +/* +DeleteProject Delete a project + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Unique identifier of the project to delete + @return ApiDeleteProjectRequest +*/ +func (a *ProjectsAPIService) DeleteProject(ctx context.Context, id string) ApiDeleteProjectRequest { + return ApiDeleteProjectRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +func (a *ProjectsAPIService) DeleteProjectExecute(r ApiDeleteProjectRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectsAPIService.DeleteProject") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.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 + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 501 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiGetProjectRequest struct { + ctx context.Context + ApiService *ProjectsAPIService + id string +} + +func (r ApiGetProjectRequest) Execute() (*Project, *http.Response, error) { + return r.ApiService.GetProjectExecute(r) +} + +/* +GetProject Get a project + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Unique identifier of the project + @return ApiGetProjectRequest +*/ +func (a *ProjectsAPIService) GetProject(ctx context.Context, id string) ApiGetProjectRequest { + return ApiGetProjectRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return Project +func (a *ProjectsAPIService) GetProjectExecute(r ApiGetProjectRequest) (*Project, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Project + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectsAPIService.GetProject") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.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 + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 501 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiListProjectsRequest struct { + ctx context.Context + ApiService *ProjectsAPIService +} + +func (r ApiListProjectsRequest) Execute() ([]Project, *http.Response, error) { + return r.ApiService.ListProjectsExecute(r) +} + +/* +ListProjects List all projects + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiListProjectsRequest +*/ +func (a *ProjectsAPIService) ListProjects(ctx context.Context) ApiListProjectsRequest { + return ApiListProjectsRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return []Project +func (a *ProjectsAPIService) ListProjectsExecute(r ApiListProjectsRequest) ([]Project, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []Project + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectsAPIService.ListProjects") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.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 + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 501 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/internal/fluidstack/gen/fluidstack/api_slurm.go b/internal/fluidstack/gen/fluidstack/api_slurm.go new file mode 100644 index 0000000..7a5cc59 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/api_slurm.go @@ -0,0 +1,1271 @@ +/* +Infrastructure API + +Fluidstack Infrastructure API + +API version: v1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// SlurmAPIService SlurmAPI service +type SlurmAPIService service + +type ApiCreateSlurmClusterRequest struct { + ctx context.Context + ApiService *SlurmAPIService + xPROJECTID *string + slurmClustersPostRequest *SlurmClustersPostRequest +} + +// Project identifier passed as a header +func (r ApiCreateSlurmClusterRequest) XPROJECTID(xPROJECTID string) ApiCreateSlurmClusterRequest { + r.xPROJECTID = &xPROJECTID + return r +} + +// Details of the cluster to create +func (r ApiCreateSlurmClusterRequest) SlurmClustersPostRequest(slurmClustersPostRequest SlurmClustersPostRequest) ApiCreateSlurmClusterRequest { + r.slurmClustersPostRequest = &slurmClustersPostRequest + return r +} + +func (r ApiCreateSlurmClusterRequest) Execute() (*SlurmCluster, *http.Response, error) { + return r.ApiService.CreateSlurmClusterExecute(r) +} + +/* +CreateSlurmCluster Create a cluster + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiCreateSlurmClusterRequest +*/ +func (a *SlurmAPIService) CreateSlurmCluster(ctx context.Context) ApiCreateSlurmClusterRequest { + return ApiCreateSlurmClusterRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return SlurmCluster +func (a *SlurmAPIService) CreateSlurmClusterExecute(r ApiCreateSlurmClusterRequest) (*SlurmCluster, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SlurmCluster + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SlurmAPIService.CreateSlurmCluster") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/slurm/clusters" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.xPROJECTID == nil { + return localVarReturnValue, nil, reportError("xPROJECTID is required and must be specified") + } + if r.slurmClustersPostRequest == nil { + return localVarReturnValue, nil, reportError("slurmClustersPostRequest is required and must be specified") + } + + // 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 + } + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-PROJECT-ID", r.xPROJECTID, "simple", "") + // body params + localVarPostBody = r.slurmClustersPostRequest + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 501 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiCreateSlurmNodePoolRequest struct { + ctx context.Context + ApiService *SlurmAPIService + xPROJECTID *string + clusterId string + slurmNodePoolPostRequest *SlurmNodePoolPostRequest +} + +// Project identifier passed as a header +func (r ApiCreateSlurmNodePoolRequest) XPROJECTID(xPROJECTID string) ApiCreateSlurmNodePoolRequest { + r.xPROJECTID = &xPROJECTID + return r +} + +// Details of the node pool to create +func (r ApiCreateSlurmNodePoolRequest) SlurmNodePoolPostRequest(slurmNodePoolPostRequest SlurmNodePoolPostRequest) ApiCreateSlurmNodePoolRequest { + r.slurmNodePoolPostRequest = &slurmNodePoolPostRequest + return r +} + +func (r ApiCreateSlurmNodePoolRequest) Execute() (*SlurmNodePool, *http.Response, error) { + return r.ApiService.CreateSlurmNodePoolExecute(r) +} + +/* +CreateSlurmNodePool Create a node pool + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param clusterId Unique identifier of the cluster + @return ApiCreateSlurmNodePoolRequest +*/ +func (a *SlurmAPIService) CreateSlurmNodePool(ctx context.Context, clusterId string) ApiCreateSlurmNodePoolRequest { + return ApiCreateSlurmNodePoolRequest{ + ApiService: a, + ctx: ctx, + clusterId: clusterId, + } +} + +// Execute executes the request +// +// @return SlurmNodePool +func (a *SlurmAPIService) CreateSlurmNodePoolExecute(r ApiCreateSlurmNodePoolRequest) (*SlurmNodePool, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SlurmNodePool + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SlurmAPIService.CreateSlurmNodePool") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/slurm/clusters/{cluster_id}/node-pools" + localVarPath = strings.Replace(localVarPath, "{"+"cluster_id"+"}", url.PathEscape(parameterValueToString(r.clusterId, "clusterId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.xPROJECTID == nil { + return localVarReturnValue, nil, reportError("xPROJECTID is required and must be specified") + } + if r.slurmNodePoolPostRequest == nil { + return localVarReturnValue, nil, reportError("slurmNodePoolPostRequest is required and must be specified") + } + + // 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 + } + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-PROJECT-ID", r.xPROJECTID, "simple", "") + // body params + localVarPostBody = r.slurmNodePoolPostRequest + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 501 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiDeleteSlurmClusterRequest struct { + ctx context.Context + ApiService *SlurmAPIService + xPROJECTID *string + id string +} + +// Project identifier passed as a header +func (r ApiDeleteSlurmClusterRequest) XPROJECTID(xPROJECTID string) ApiDeleteSlurmClusterRequest { + r.xPROJECTID = &xPROJECTID + return r +} + +func (r ApiDeleteSlurmClusterRequest) Execute() (*http.Response, error) { + return r.ApiService.DeleteSlurmClusterExecute(r) +} + +/* +DeleteSlurmCluster Delete a cluster + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Unique identifier of the cluster to delete + @return ApiDeleteSlurmClusterRequest +*/ +func (a *SlurmAPIService) DeleteSlurmCluster(ctx context.Context, id string) ApiDeleteSlurmClusterRequest { + return ApiDeleteSlurmClusterRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +func (a *SlurmAPIService) DeleteSlurmClusterExecute(r ApiDeleteSlurmClusterRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SlurmAPIService.DeleteSlurmCluster") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/slurm/clusters/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.xPROJECTID == nil { + return nil, reportError("xPROJECTID is required and must be specified") + } + + // 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 + } + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-PROJECT-ID", r.xPROJECTID, "simple", "") + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 501 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiDeleteSlurmNodePoolRequest struct { + ctx context.Context + ApiService *SlurmAPIService + xPROJECTID *string + clusterId string + nodePoolId string +} + +// Project identifier passed as a header +func (r ApiDeleteSlurmNodePoolRequest) XPROJECTID(xPROJECTID string) ApiDeleteSlurmNodePoolRequest { + r.xPROJECTID = &xPROJECTID + return r +} + +func (r ApiDeleteSlurmNodePoolRequest) Execute() (*http.Response, error) { + return r.ApiService.DeleteSlurmNodePoolExecute(r) +} + +/* +DeleteSlurmNodePool Delete a node pool + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param clusterId Unique identifier of the cluster + @param nodePoolId Unique identifier of the node pool to delete + @return ApiDeleteSlurmNodePoolRequest +*/ +func (a *SlurmAPIService) DeleteSlurmNodePool(ctx context.Context, clusterId string, nodePoolId string) ApiDeleteSlurmNodePoolRequest { + return ApiDeleteSlurmNodePoolRequest{ + ApiService: a, + ctx: ctx, + clusterId: clusterId, + nodePoolId: nodePoolId, + } +} + +// Execute executes the request +func (a *SlurmAPIService) DeleteSlurmNodePoolExecute(r ApiDeleteSlurmNodePoolRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SlurmAPIService.DeleteSlurmNodePool") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/slurm/clusters/{cluster_id}/node-pools/{node_pool_id}" + localVarPath = strings.Replace(localVarPath, "{"+"cluster_id"+"}", url.PathEscape(parameterValueToString(r.clusterId, "clusterId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"node_pool_id"+"}", url.PathEscape(parameterValueToString(r.nodePoolId, "nodePoolId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.xPROJECTID == nil { + return nil, reportError("xPROJECTID is required and must be specified") + } + + // 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 + } + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-PROJECT-ID", r.xPROJECTID, "simple", "") + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 501 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiGetSlurmClusterRequest struct { + ctx context.Context + ApiService *SlurmAPIService + xPROJECTID *string + id string +} + +// Project identifier passed as a header +func (r ApiGetSlurmClusterRequest) XPROJECTID(xPROJECTID string) ApiGetSlurmClusterRequest { + r.xPROJECTID = &xPROJECTID + return r +} + +func (r ApiGetSlurmClusterRequest) Execute() (*SlurmCluster, *http.Response, error) { + return r.ApiService.GetSlurmClusterExecute(r) +} + +/* +GetSlurmCluster Get a cluster + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Unique identifier of the cluster + @return ApiGetSlurmClusterRequest +*/ +func (a *SlurmAPIService) GetSlurmCluster(ctx context.Context, id string) ApiGetSlurmClusterRequest { + return ApiGetSlurmClusterRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return SlurmCluster +func (a *SlurmAPIService) GetSlurmClusterExecute(r ApiGetSlurmClusterRequest) (*SlurmCluster, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SlurmCluster + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SlurmAPIService.GetSlurmCluster") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/slurm/clusters/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.xPROJECTID == nil { + return localVarReturnValue, nil, reportError("xPROJECTID is required and must be specified") + } + + // 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 + } + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-PROJECT-ID", r.xPROJECTID, "simple", "") + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 501 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetSlurmNodePoolRequest struct { + ctx context.Context + ApiService *SlurmAPIService + xPROJECTID *string + clusterId string + nodePoolId string +} + +// Project identifier passed as a header +func (r ApiGetSlurmNodePoolRequest) XPROJECTID(xPROJECTID string) ApiGetSlurmNodePoolRequest { + r.xPROJECTID = &xPROJECTID + return r +} + +func (r ApiGetSlurmNodePoolRequest) Execute() (*SlurmNodePool, *http.Response, error) { + return r.ApiService.GetSlurmNodePoolExecute(r) +} + +/* +GetSlurmNodePool Get a node pool + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param clusterId Unique identifier of the cluster + @param nodePoolId Unique identifier of the node pool + @return ApiGetSlurmNodePoolRequest +*/ +func (a *SlurmAPIService) GetSlurmNodePool(ctx context.Context, clusterId string, nodePoolId string) ApiGetSlurmNodePoolRequest { + return ApiGetSlurmNodePoolRequest{ + ApiService: a, + ctx: ctx, + clusterId: clusterId, + nodePoolId: nodePoolId, + } +} + +// Execute executes the request +// +// @return SlurmNodePool +func (a *SlurmAPIService) GetSlurmNodePoolExecute(r ApiGetSlurmNodePoolRequest) (*SlurmNodePool, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SlurmNodePool + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SlurmAPIService.GetSlurmNodePool") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/slurm/clusters/{cluster_id}/node-pools/{node_pool_id}" + localVarPath = strings.Replace(localVarPath, "{"+"cluster_id"+"}", url.PathEscape(parameterValueToString(r.clusterId, "clusterId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"node_pool_id"+"}", url.PathEscape(parameterValueToString(r.nodePoolId, "nodePoolId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.xPROJECTID == nil { + return localVarReturnValue, nil, reportError("xPROJECTID is required and must be specified") + } + + // 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 + } + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-PROJECT-ID", r.xPROJECTID, "simple", "") + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 501 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiListSlurmClustersRequest struct { + ctx context.Context + ApiService *SlurmAPIService + xPROJECTID *string +} + +// Project identifier passed as a header +func (r ApiListSlurmClustersRequest) XPROJECTID(xPROJECTID string) ApiListSlurmClustersRequest { + r.xPROJECTID = &xPROJECTID + return r +} + +func (r ApiListSlurmClustersRequest) Execute() ([]SlurmCluster, *http.Response, error) { + return r.ApiService.ListSlurmClustersExecute(r) +} + +/* +ListSlurmClusters List all clusters + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiListSlurmClustersRequest +*/ +func (a *SlurmAPIService) ListSlurmClusters(ctx context.Context) ApiListSlurmClustersRequest { + return ApiListSlurmClustersRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return []SlurmCluster +func (a *SlurmAPIService) ListSlurmClustersExecute(r ApiListSlurmClustersRequest) ([]SlurmCluster, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []SlurmCluster + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SlurmAPIService.ListSlurmClusters") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/slurm/clusters" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.xPROJECTID == nil { + return localVarReturnValue, nil, reportError("xPROJECTID is required and must be specified") + } + + // 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 + } + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-PROJECT-ID", r.xPROJECTID, "simple", "") + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 501 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiListSlurmNodePoolsRequest struct { + ctx context.Context + ApiService *SlurmAPIService + xPROJECTID *string + clusterId string +} + +// Project identifier passed as a header +func (r ApiListSlurmNodePoolsRequest) XPROJECTID(xPROJECTID string) ApiListSlurmNodePoolsRequest { + r.xPROJECTID = &xPROJECTID + return r +} + +func (r ApiListSlurmNodePoolsRequest) Execute() ([]SlurmNodePool, *http.Response, error) { + return r.ApiService.ListSlurmNodePoolsExecute(r) +} + +/* +ListSlurmNodePools List all node pools for a cluster + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param clusterId Unique identifier of the cluster + @return ApiListSlurmNodePoolsRequest +*/ +func (a *SlurmAPIService) ListSlurmNodePools(ctx context.Context, clusterId string) ApiListSlurmNodePoolsRequest { + return ApiListSlurmNodePoolsRequest{ + ApiService: a, + ctx: ctx, + clusterId: clusterId, + } +} + +// Execute executes the request +// +// @return []SlurmNodePool +func (a *SlurmAPIService) ListSlurmNodePoolsExecute(r ApiListSlurmNodePoolsRequest) ([]SlurmNodePool, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []SlurmNodePool + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SlurmAPIService.ListSlurmNodePools") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/slurm/clusters/{cluster_id}/node-pools" + localVarPath = strings.Replace(localVarPath, "{"+"cluster_id"+"}", url.PathEscape(parameterValueToString(r.clusterId, "clusterId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.xPROJECTID == nil { + return localVarReturnValue, nil, reportError("xPROJECTID is required and must be specified") + } + + // 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 + } + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-PROJECT-ID", r.xPROJECTID, "simple", "") + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 501 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/internal/fluidstack/gen/fluidstack/client.go b/internal/fluidstack/gen/fluidstack/client.go new file mode 100644 index 0000000..4096efd --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/client.go @@ -0,0 +1,677 @@ +/* +Infrastructure API + +Fluidstack Infrastructure API + +API version: v1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" +) + +var ( + JsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?json)`) + XmlCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") +) + +// APIClient manages communication with the Infrastructure API API vv1alpha1 +// 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 + + CapabilitiesAPI *CapabilitiesAPIService + + CapacityAPI *CapacityAPIService + + FilesystemsAPI *FilesystemsAPIService + + InstanceTypesAPI *InstanceTypesAPIService + + InstancesAPI *InstancesAPIService + + KubernetesAPI *KubernetesAPIService + + ProjectsAPI *ProjectsAPIService + + SlurmAPI *SlurmAPIService +} + +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.CapabilitiesAPI = (*CapabilitiesAPIService)(&c.common) + c.CapacityAPI = (*CapacityAPIService)(&c.common) + c.FilesystemsAPI = (*FilesystemsAPIService)(&c.common) + c.InstanceTypesAPI = (*InstanceTypesAPIService)(&c.common) + c.InstancesAPI = (*InstancesAPIService)(&c.common) + c.KubernetesAPI = (*KubernetesAPIService)(&c.common) + c.ProjectsAPI = (*ProjectsAPIService)(&c.common) + c.SlurmAPI = (*SlurmAPIService)(&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 insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, 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 +} + +func parameterValueToString(obj interface{}, key string) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + return fmt.Sprintf("%v", obj) + } + var param, ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap, err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, style string, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t, ok := obj.(MappedNullable); ok { + dataMap, err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, style, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339Nano), style, collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i := 0; i < lenIndValue; i++ { + var arrayValue = indValue.Index(i) + var keyPrefixForCollectionType = keyPrefix + if style == "deepObject" { + keyPrefixForCollectionType = keyPrefix + "[" + strconv.Itoa(i) + "]" + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefixForCollectionType, arrayValue.Interface(), style, collectionType) + } + return + + case reflect.Map: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + iter := indValue.MapRange() + for iter.Next() { + k, v := iter.Key(), iter.Value() + parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), style, collectionType) + } + return + + case reflect.Interface: + fallthrough + case reflect.Ptr: + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), style, collectionType) + return + + case reflect.Int, reflect.Int8, reflect.Int16, + reflect.Int32, reflect.Int64: + value = strconv.FormatInt(v.Int(), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, + reflect.Uint32, reflect.Uint64, reflect.Uintptr: + value = strconv.FormatUint(v.Uint(), 10) + case reflect.Float32, reflect.Float64: + value = strconv.FormatFloat(v.Float(), 'g', -1, 32) + case reflect.Bool: + value = strconv.FormatBool(v.Bool()) + case reflect.String: + value = v.String() + default: + value = v.Type().String() + " value" + } + } + + switch valuesMap := headerOrQueryParams.(type) { + case url.Values: + if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" { + valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix)+","+value) + } else { + valuesMap.Add(keyPrefix, value) + } + break + case map[string]string: + valuesMap[keyPrefix] = value + break + } +} + +// 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) { + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + 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)) + } + return resp, err +} + +// 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 +} + +type formFile struct { + fileBytes []byte + fileName string + formFileName string +} + +// 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, + formFiles []formFile) (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(formFiles) > 0) { + 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) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.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() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) + + // 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[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + // 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 f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + 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 { + return 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") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + err = file.Close() + if err != nil { + return err + } + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// 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 fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) + } 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) { + var bs []byte + bs, err = xml.Marshal(body) + if err == nil { + bodyBuf.Write(bs) + } + } + + 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 +} + +// format error message using title and detail when model implements rfc7807 +func formatErrorMessage(status string, v interface{}) string { + str := "" + metaValue := reflect.ValueOf(v).Elem() + + if metaValue.Kind() == reflect.Struct { + field := metaValue.FieldByName("Title") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s", field.Interface()) + } + + field = metaValue.FieldByName("Detail") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s (%s)", str, field.Interface()) + } + } + + return strings.TrimSpace(fmt.Sprintf("%s %s", status, str)) +} diff --git a/internal/fluidstack/gen/fluidstack/configuration.go b/internal/fluidstack/gen/fluidstack/configuration.go new file mode 100644 index 0000000..5efa5fc --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/configuration.go @@ -0,0 +1,217 @@ +/* +Infrastructure API + +Fluidstack Infrastructure API + +API version: v1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "context" + "fmt" + "net/http" + "strings" +) + +// 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 ( + // ContextAccessToken takes a string oauth2 access token as authentication for the request. + ContextAccessToken = contextKey("accesstoken") + + // 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"` + UserAgent string `json:"userAgent,omitempty"` + Debug bool `json:"debug,omitempty"` + Servers ServerConfigurations + OperationServers map[string]ServerConfigurations + HTTPClient *http.Client +} + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *Configuration { + cfg := &Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Servers: ServerConfigurations{ + { + URL: "https://.atlas.fluidstack.io/api/v1alpha1", + Description: "No description provided", + }, + }, + OperationServers: map[string]ServerConfigurations{}, + } + return cfg +} + +// 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 +} + +// 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/internal/fluidstack/gen/fluidstack/docs/Accelerator.md b/internal/fluidstack/gen/fluidstack/docs/Accelerator.md new file mode 100644 index 0000000..b308654 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/docs/Accelerator.md @@ -0,0 +1,93 @@ +# Accelerator + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type** | **string** | Type of the hardware accelerator | +**Product** | **string** | Product name of the accelerator | +**DriverVersion** | **string** | Version of the driver for the accelerator | + +## Methods + +### NewAccelerator + +`func NewAccelerator(type_ string, product string, driverVersion string, ) *Accelerator` + +NewAccelerator instantiates a new Accelerator object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewAcceleratorWithDefaults + +`func NewAcceleratorWithDefaults() *Accelerator` + +NewAcceleratorWithDefaults instantiates a new Accelerator object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetType + +`func (o *Accelerator) GetType() string` + +GetType returns the Type field if non-nil, zero value otherwise. + +### GetTypeOk + +`func (o *Accelerator) GetTypeOk() (*string, bool)` + +GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetType + +`func (o *Accelerator) SetType(v string)` + +SetType sets Type field to given value. + + +### GetProduct + +`func (o *Accelerator) GetProduct() string` + +GetProduct returns the Product field if non-nil, zero value otherwise. + +### GetProductOk + +`func (o *Accelerator) GetProductOk() (*string, bool)` + +GetProductOk returns a tuple with the Product field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetProduct + +`func (o *Accelerator) SetProduct(v string)` + +SetProduct sets Product field to given value. + + +### GetDriverVersion + +`func (o *Accelerator) GetDriverVersion() string` + +GetDriverVersion returns the DriverVersion field if non-nil, zero value otherwise. + +### GetDriverVersionOk + +`func (o *Accelerator) GetDriverVersionOk() (*string, bool)` + +GetDriverVersionOk returns a tuple with the DriverVersion field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDriverVersion + +`func (o *Accelerator) SetDriverVersion(v string)` + +SetDriverVersion sets DriverVersion field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/internal/fluidstack/gen/fluidstack/docs/CapabilitiesAPI.md b/internal/fluidstack/gen/fluidstack/docs/CapabilitiesAPI.md new file mode 100644 index 0000000..9151422 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/docs/CapabilitiesAPI.md @@ -0,0 +1,68 @@ +# \CapabilitiesAPI + +All URIs are relative to *https://<region>.atlas.fluidstack.io/api/v1alpha1* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**ListCapabilities**](CapabilitiesAPI.md#ListCapabilities) | **Get** /capabilities | List available capabilities + + + +## ListCapabilities + +> []Capability ListCapabilities(ctx).Execute() + +List available capabilities + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/brevdev/cloud" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.CapabilitiesAPI.ListCapabilities(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CapabilitiesAPI.ListCapabilities``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ListCapabilities`: []Capability + fmt.Fprintf(os.Stdout, "Response from `CapabilitiesAPI.ListCapabilities`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiListCapabilitiesRequest struct via the builder pattern + + +### Return type + +[**[]Capability**](Capability.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/internal/fluidstack/gen/fluidstack/docs/Capability.md b/internal/fluidstack/gen/fluidstack/docs/Capability.md new file mode 100644 index 0000000..0339a64 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/docs/Capability.md @@ -0,0 +1,71 @@ +# Capability + +## Enum + + +* `INSTANCESLIST` (value: `"instances:list"`) + +* `INSTANCESCREATE` (value: `"instances:create"`) + +* `INSTANCESDELETE` (value: `"instances:delete"`) + +* `INSTANCESREAD` (value: `"instances:read"`) + +* `INSTANCESUPDATE` (value: `"instances:update"`) + +* `INSTANCESSTART` (value: `"instances:start"`) + +* `INSTANCESSTOP` (value: `"instances:stop"`) + +* `FILESYSTEMSLIST` (value: `"filesystems:list"`) + +* `FILESYSTEMSCREATE` (value: `"filesystems:create"`) + +* `FILESYSTEMSDELETE` (value: `"filesystems:delete"`) + +* `FILESYSTEMSREAD` (value: `"filesystems:read"`) + +* `FILESYSTEMSUPDATE` (value: `"filesystems:update"`) + +* `PROJECTSLIST` (value: `"projects:list"`) + +* `PROJECTSCREATE` (value: `"projects:create"`) + +* `PROJECTSDELETE` (value: `"projects:delete"`) + +* `PROJECTSREAD` (value: `"projects:read"`) + +* `PROJECTSUPDATE` (value: `"projects:update"`) + +* `KUBERNETESCLUSTERSLIST` (value: `"kubernetes:clusters:list"`) + +* `KUBERNETESCLUSTERSCREATE` (value: `"kubernetes:clusters:create"`) + +* `KUBERNETESCLUSTERSDELETE` (value: `"kubernetes:clusters:delete"`) + +* `KUBERNETESCLUSTERSREAD` (value: `"kubernetes:clusters:read"`) + +* `KUBERNETESNODE_POOLSLIST` (value: `"kubernetes:node-pools:list"`) + +* `KUBERNETESNODE_POOLSCREATE` (value: `"kubernetes:node-pools:create"`) + +* `KUBERNETESNODE_POOLSDELETE` (value: `"kubernetes:node-pools:delete"`) + +* `KUBERNETESNODE_POOLSREAD` (value: `"kubernetes:node-pools:read"`) + +* `KUBERNETESCREDENTIALSREAD` (value: `"kubernetes:credentials:read"`) + +* `SLURMCLUSTERSLIST` (value: `"slurm:clusters:list"`) + +* `SLURMCLUSTERSREAD` (value: `"slurm:clusters:read"`) + +* `SLURMCLUSTERSPROXY` (value: `"slurm:clusters:proxy"`) + +* `SLURMNODE_POOLSLIST` (value: `"slurm:node-pools:list"`) + +* `SLURMNODE_POOLSREAD` (value: `"slurm:node-pools:read"`) + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/internal/fluidstack/gen/fluidstack/docs/CapacityAPI.md b/internal/fluidstack/gen/fluidstack/docs/CapacityAPI.md new file mode 100644 index 0000000..8eae3aa --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/docs/CapacityAPI.md @@ -0,0 +1,73 @@ +# \CapacityAPI + +All URIs are relative to *https://<region>.atlas.fluidstack.io/api/v1alpha1* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**ListCapacity**](CapacityAPI.md#ListCapacity) | **Get** /capacity | List available capacity + + + +## ListCapacity + +> []ListCapacity200ResponseInner ListCapacity(ctx).XPROJECTID(xPROJECTID).Execute() + +List available capacity + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/brevdev/cloud" +) + +func main() { + xPROJECTID := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Project identifier passed as a header + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.CapacityAPI.ListCapacity(context.Background()).XPROJECTID(xPROJECTID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CapacityAPI.ListCapacity``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ListCapacity`: []ListCapacity200ResponseInner + fmt.Fprintf(os.Stdout, "Response from `CapacityAPI.ListCapacity`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiListCapacityRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xPROJECTID** | **string** | Project identifier passed as a header | + +### Return type + +[**[]ListCapacity200ResponseInner**](ListCapacity200ResponseInner.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/internal/fluidstack/gen/fluidstack/docs/Error.md b/internal/fluidstack/gen/fluidstack/docs/Error.md new file mode 100644 index 0000000..700beae --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/docs/Error.md @@ -0,0 +1,51 @@ +# Error + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Message** | **string** | Human-readable error message | + +## Methods + +### NewError + +`func NewError(message string, ) *Error` + +NewError instantiates a new Error object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewErrorWithDefaults + +`func NewErrorWithDefaults() *Error` + +NewErrorWithDefaults instantiates a new Error object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetMessage + +`func (o *Error) GetMessage() string` + +GetMessage returns the Message field if non-nil, zero value otherwise. + +### GetMessageOk + +`func (o *Error) GetMessageOk() (*string, bool)` + +GetMessageOk returns a tuple with the Message field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMessage + +`func (o *Error) SetMessage(v string)` + +SetMessage sets Message field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/internal/fluidstack/gen/fluidstack/docs/Filesystem.md b/internal/fluidstack/gen/fluidstack/docs/Filesystem.md new file mode 100644 index 0000000..be9956a --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/docs/Filesystem.md @@ -0,0 +1,93 @@ +# Filesystem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **string** | Unique identifier of the filesystem | +**Name** | **string** | Name of the filesystem | +**Size** | **string** | Size of the filesystem in GB | + +## Methods + +### NewFilesystem + +`func NewFilesystem(id string, name string, size string, ) *Filesystem` + +NewFilesystem instantiates a new Filesystem object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewFilesystemWithDefaults + +`func NewFilesystemWithDefaults() *Filesystem` + +NewFilesystemWithDefaults instantiates a new Filesystem object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetId + +`func (o *Filesystem) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *Filesystem) GetIdOk() (*string, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *Filesystem) SetId(v string)` + +SetId sets Id field to given value. + + +### GetName + +`func (o *Filesystem) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *Filesystem) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *Filesystem) SetName(v string)` + +SetName sets Name field to given value. + + +### GetSize + +`func (o *Filesystem) GetSize() string` + +GetSize returns the Size field if non-nil, zero value otherwise. + +### GetSizeOk + +`func (o *Filesystem) GetSizeOk() (*string, bool)` + +GetSizeOk returns a tuple with the Size field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSize + +`func (o *Filesystem) SetSize(v string)` + +SetSize sets Size field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/internal/fluidstack/gen/fluidstack/docs/FilesystemsAPI.md b/internal/fluidstack/gen/fluidstack/docs/FilesystemsAPI.md new file mode 100644 index 0000000..5cba294 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/docs/FilesystemsAPI.md @@ -0,0 +1,280 @@ +# \FilesystemsAPI + +All URIs are relative to *https://<region>.atlas.fluidstack.io/api/v1alpha1* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**CreateFilesystem**](FilesystemsAPI.md#CreateFilesystem) | **Post** /filesystems | Create a filesystem +[**DeleteFilesystem**](FilesystemsAPI.md#DeleteFilesystem) | **Delete** /filesystems/{id} | Delete a filesystem +[**GetFilesystem**](FilesystemsAPI.md#GetFilesystem) | **Get** /filesystems/{id} | Get a filesystem +[**ListFilesystems**](FilesystemsAPI.md#ListFilesystems) | **Get** /filesystems | List all filesystems + + + +## CreateFilesystem + +> Filesystem CreateFilesystem(ctx).XPROJECTID(xPROJECTID).FilesystemsPostRequest(filesystemsPostRequest).Execute() + +Create a filesystem + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/brevdev/cloud" +) + +func main() { + xPROJECTID := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Project identifier passed as a header + filesystemsPostRequest := *openapiclient.NewFilesystemsPostRequest("fs-1", "512Gi") // FilesystemsPostRequest | Details of the filesystem to create + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.FilesystemsAPI.CreateFilesystem(context.Background()).XPROJECTID(xPROJECTID).FilesystemsPostRequest(filesystemsPostRequest).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FilesystemsAPI.CreateFilesystem``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `CreateFilesystem`: Filesystem + fmt.Fprintf(os.Stdout, "Response from `FilesystemsAPI.CreateFilesystem`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiCreateFilesystemRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xPROJECTID** | **string** | Project identifier passed as a header | + **filesystemsPostRequest** | [**FilesystemsPostRequest**](FilesystemsPostRequest.md) | Details of the filesystem to create | + +### Return type + +[**Filesystem**](Filesystem.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## DeleteFilesystem + +> DeleteFilesystem(ctx, id).XPROJECTID(xPROJECTID).Execute() + +Delete a filesystem + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/brevdev/cloud" +) + +func main() { + xPROJECTID := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Project identifier passed as a header + id := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Unique identifier of the filesystem + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + r, err := apiClient.FilesystemsAPI.DeleteFilesystem(context.Background(), id).XPROJECTID(xPROJECTID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FilesystemsAPI.DeleteFilesystem``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string** | Unique identifier of the filesystem | + +### Other Parameters + +Other parameters are passed through a pointer to a apiDeleteFilesystemRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xPROJECTID** | **string** | Project identifier passed as a header | + + +### Return type + + (empty response body) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetFilesystem + +> Filesystem GetFilesystem(ctx, id).XPROJECTID(xPROJECTID).Execute() + +Get a filesystem + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/brevdev/cloud" +) + +func main() { + xPROJECTID := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Project identifier passed as a header + id := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Unique identifier of the filesystem + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.FilesystemsAPI.GetFilesystem(context.Background(), id).XPROJECTID(xPROJECTID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FilesystemsAPI.GetFilesystem``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetFilesystem`: Filesystem + fmt.Fprintf(os.Stdout, "Response from `FilesystemsAPI.GetFilesystem`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string** | Unique identifier of the filesystem | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetFilesystemRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xPROJECTID** | **string** | Project identifier passed as a header | + + +### Return type + +[**Filesystem**](Filesystem.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## ListFilesystems + +> []Filesystem ListFilesystems(ctx).XPROJECTID(xPROJECTID).Execute() + +List all filesystems + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/brevdev/cloud" +) + +func main() { + xPROJECTID := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Project identifier passed as a header + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.FilesystemsAPI.ListFilesystems(context.Background()).XPROJECTID(xPROJECTID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FilesystemsAPI.ListFilesystems``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ListFilesystems`: []Filesystem + fmt.Fprintf(os.Stdout, "Response from `FilesystemsAPI.ListFilesystems`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiListFilesystemsRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xPROJECTID** | **string** | Project identifier passed as a header | + +### Return type + +[**[]Filesystem**](Filesystem.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/internal/fluidstack/gen/fluidstack/docs/FilesystemsPostRequest.md b/internal/fluidstack/gen/fluidstack/docs/FilesystemsPostRequest.md new file mode 100644 index 0000000..a5adcfa --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/docs/FilesystemsPostRequest.md @@ -0,0 +1,72 @@ +# FilesystemsPostRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | Name of the filesystem | +**Size** | **string** | Size of the filesystem in GB | + +## Methods + +### NewFilesystemsPostRequest + +`func NewFilesystemsPostRequest(name string, size string, ) *FilesystemsPostRequest` + +NewFilesystemsPostRequest instantiates a new FilesystemsPostRequest object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewFilesystemsPostRequestWithDefaults + +`func NewFilesystemsPostRequestWithDefaults() *FilesystemsPostRequest` + +NewFilesystemsPostRequestWithDefaults instantiates a new FilesystemsPostRequest object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetName + +`func (o *FilesystemsPostRequest) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *FilesystemsPostRequest) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *FilesystemsPostRequest) SetName(v string)` + +SetName sets Name field to given value. + + +### GetSize + +`func (o *FilesystemsPostRequest) GetSize() string` + +GetSize returns the Size field if non-nil, zero value otherwise. + +### GetSizeOk + +`func (o *FilesystemsPostRequest) GetSizeOk() (*string, bool)` + +GetSizeOk returns a tuple with the Size field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSize + +`func (o *FilesystemsPostRequest) SetSize(v string)` + +SetSize sets Size field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/internal/fluidstack/gen/fluidstack/docs/Instance.md b/internal/fluidstack/gen/fluidstack/docs/Instance.md new file mode 100644 index 0000000..7cc7638 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/docs/Instance.md @@ -0,0 +1,281 @@ +# Instance + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **string** | Unique identifier of the instance | +**Name** | **string** | Name of the instance | +**Type** | **string** | Instance type | +**Ip** | **NullableString** | Private IP address of the instance | +**State** | [**InstanceState**](InstanceState.md) | | +**Image** | **string** | Operating system image for the instance | +**Preemptible** | **bool** | Whether the instance is preemptible | +**Ephemeral** | **bool** | Whether the instance is ephemeral | +**UserData** | **NullableString** | Base64-encoded cloud-init user data for instance initialization | +**Filesystems** | **[]string** | List of filesystem UUIDs attached to the instance | +**Tags** | **map[string]string** | Tags for the instance | + +## Methods + +### NewInstance + +`func NewInstance(id string, name string, type_ string, ip NullableString, state InstanceState, image string, preemptible bool, ephemeral bool, userData NullableString, filesystems []string, tags map[string]string, ) *Instance` + +NewInstance instantiates a new Instance object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewInstanceWithDefaults + +`func NewInstanceWithDefaults() *Instance` + +NewInstanceWithDefaults instantiates a new Instance object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetId + +`func (o *Instance) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *Instance) GetIdOk() (*string, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *Instance) SetId(v string)` + +SetId sets Id field to given value. + + +### GetName + +`func (o *Instance) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *Instance) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *Instance) SetName(v string)` + +SetName sets Name field to given value. + + +### GetType + +`func (o *Instance) GetType() string` + +GetType returns the Type field if non-nil, zero value otherwise. + +### GetTypeOk + +`func (o *Instance) GetTypeOk() (*string, bool)` + +GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetType + +`func (o *Instance) SetType(v string)` + +SetType sets Type field to given value. + + +### GetIp + +`func (o *Instance) GetIp() string` + +GetIp returns the Ip field if non-nil, zero value otherwise. + +### GetIpOk + +`func (o *Instance) GetIpOk() (*string, bool)` + +GetIpOk returns a tuple with the Ip field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIp + +`func (o *Instance) SetIp(v string)` + +SetIp sets Ip field to given value. + + +### SetIpNil + +`func (o *Instance) SetIpNil(b bool)` + + SetIpNil sets the value for Ip to be an explicit nil + +### UnsetIp +`func (o *Instance) UnsetIp()` + +UnsetIp ensures that no value is present for Ip, not even an explicit nil +### GetState + +`func (o *Instance) GetState() InstanceState` + +GetState returns the State field if non-nil, zero value otherwise. + +### GetStateOk + +`func (o *Instance) GetStateOk() (*InstanceState, bool)` + +GetStateOk returns a tuple with the State field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetState + +`func (o *Instance) SetState(v InstanceState)` + +SetState sets State field to given value. + + +### GetImage + +`func (o *Instance) GetImage() string` + +GetImage returns the Image field if non-nil, zero value otherwise. + +### GetImageOk + +`func (o *Instance) GetImageOk() (*string, bool)` + +GetImageOk returns a tuple with the Image field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetImage + +`func (o *Instance) SetImage(v string)` + +SetImage sets Image field to given value. + + +### GetPreemptible + +`func (o *Instance) GetPreemptible() bool` + +GetPreemptible returns the Preemptible field if non-nil, zero value otherwise. + +### GetPreemptibleOk + +`func (o *Instance) GetPreemptibleOk() (*bool, bool)` + +GetPreemptibleOk returns a tuple with the Preemptible field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPreemptible + +`func (o *Instance) SetPreemptible(v bool)` + +SetPreemptible sets Preemptible field to given value. + + +### GetEphemeral + +`func (o *Instance) GetEphemeral() bool` + +GetEphemeral returns the Ephemeral field if non-nil, zero value otherwise. + +### GetEphemeralOk + +`func (o *Instance) GetEphemeralOk() (*bool, bool)` + +GetEphemeralOk returns a tuple with the Ephemeral field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEphemeral + +`func (o *Instance) SetEphemeral(v bool)` + +SetEphemeral sets Ephemeral field to given value. + + +### GetUserData + +`func (o *Instance) GetUserData() string` + +GetUserData returns the UserData field if non-nil, zero value otherwise. + +### GetUserDataOk + +`func (o *Instance) GetUserDataOk() (*string, bool)` + +GetUserDataOk returns a tuple with the UserData field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUserData + +`func (o *Instance) SetUserData(v string)` + +SetUserData sets UserData field to given value. + + +### SetUserDataNil + +`func (o *Instance) SetUserDataNil(b bool)` + + SetUserDataNil sets the value for UserData to be an explicit nil + +### UnsetUserData +`func (o *Instance) UnsetUserData()` + +UnsetUserData ensures that no value is present for UserData, not even an explicit nil +### GetFilesystems + +`func (o *Instance) GetFilesystems() []string` + +GetFilesystems returns the Filesystems field if non-nil, zero value otherwise. + +### GetFilesystemsOk + +`func (o *Instance) GetFilesystemsOk() (*[]string, bool)` + +GetFilesystemsOk returns a tuple with the Filesystems field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFilesystems + +`func (o *Instance) SetFilesystems(v []string)` + +SetFilesystems sets Filesystems field to given value. + + +### GetTags + +`func (o *Instance) GetTags() map[string]string` + +GetTags returns the Tags field if non-nil, zero value otherwise. + +### GetTagsOk + +`func (o *Instance) GetTagsOk() (*map[string]string, bool)` + +GetTagsOk returns a tuple with the Tags field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTags + +`func (o *Instance) SetTags(v map[string]string)` + +SetTags sets Tags field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/internal/fluidstack/gen/fluidstack/docs/InstanceState.md b/internal/fluidstack/gen/fluidstack/docs/InstanceState.md new file mode 100644 index 0000000..e170dbe --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/docs/InstanceState.md @@ -0,0 +1,25 @@ +# InstanceState + +## Enum + + +* `CREATING` (value: `"creating"`) + +* `STARTING` (value: `"starting"`) + +* `RUNNING` (value: `"running"`) + +* `STOPPING` (value: `"stopping"`) + +* `STOPPED` (value: `"stopped"`) + +* `DELETING` (value: `"deleting"`) + +* `OUT_OF_STOCK` (value: `"out-of-stock"`) + +* `ERROR` (value: `"error"`) + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/internal/fluidstack/gen/fluidstack/docs/InstanceType.md b/internal/fluidstack/gen/fluidstack/docs/InstanceType.md new file mode 100644 index 0000000..4a88dd1 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/docs/InstanceType.md @@ -0,0 +1,145 @@ +# InstanceType + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | Name of the instance type | +**Cpu** | **int32** | Number of CPUs the instance type has | +**Memory** | **string** | Amount of memory the instance type has | +**GpuModel** | Pointer to **string** | GPU model the instance type has | [optional] +**GpuCount** | Pointer to **int32** | Number of GPUs the instance type has | [optional] + +## Methods + +### NewInstanceType + +`func NewInstanceType(name string, cpu int32, memory string, ) *InstanceType` + +NewInstanceType instantiates a new InstanceType object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewInstanceTypeWithDefaults + +`func NewInstanceTypeWithDefaults() *InstanceType` + +NewInstanceTypeWithDefaults instantiates a new InstanceType object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetName + +`func (o *InstanceType) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *InstanceType) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *InstanceType) SetName(v string)` + +SetName sets Name field to given value. + + +### GetCpu + +`func (o *InstanceType) GetCpu() int32` + +GetCpu returns the Cpu field if non-nil, zero value otherwise. + +### GetCpuOk + +`func (o *InstanceType) GetCpuOk() (*int32, bool)` + +GetCpuOk returns a tuple with the Cpu field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCpu + +`func (o *InstanceType) SetCpu(v int32)` + +SetCpu sets Cpu field to given value. + + +### GetMemory + +`func (o *InstanceType) GetMemory() string` + +GetMemory returns the Memory field if non-nil, zero value otherwise. + +### GetMemoryOk + +`func (o *InstanceType) GetMemoryOk() (*string, bool)` + +GetMemoryOk returns a tuple with the Memory field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMemory + +`func (o *InstanceType) SetMemory(v string)` + +SetMemory sets Memory field to given value. + + +### GetGpuModel + +`func (o *InstanceType) GetGpuModel() string` + +GetGpuModel returns the GpuModel field if non-nil, zero value otherwise. + +### GetGpuModelOk + +`func (o *InstanceType) GetGpuModelOk() (*string, bool)` + +GetGpuModelOk returns a tuple with the GpuModel field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetGpuModel + +`func (o *InstanceType) SetGpuModel(v string)` + +SetGpuModel sets GpuModel field to given value. + +### HasGpuModel + +`func (o *InstanceType) HasGpuModel() bool` + +HasGpuModel returns a boolean if a field has been set. + +### GetGpuCount + +`func (o *InstanceType) GetGpuCount() int32` + +GetGpuCount returns the GpuCount field if non-nil, zero value otherwise. + +### GetGpuCountOk + +`func (o *InstanceType) GetGpuCountOk() (*int32, bool)` + +GetGpuCountOk returns a tuple with the GpuCount field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetGpuCount + +`func (o *InstanceType) SetGpuCount(v int32)` + +SetGpuCount sets GpuCount field to given value. + +### HasGpuCount + +`func (o *InstanceType) HasGpuCount() bool` + +HasGpuCount returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/internal/fluidstack/gen/fluidstack/docs/InstanceTypesAPI.md b/internal/fluidstack/gen/fluidstack/docs/InstanceTypesAPI.md new file mode 100644 index 0000000..3445a32 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/docs/InstanceTypesAPI.md @@ -0,0 +1,68 @@ +# \InstanceTypesAPI + +All URIs are relative to *https://<region>.atlas.fluidstack.io/api/v1alpha1* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**ListInstanceTypes**](InstanceTypesAPI.md#ListInstanceTypes) | **Get** /instance-types | List all available instance types + + + +## ListInstanceTypes + +> []InstanceType ListInstanceTypes(ctx).Execute() + +List all available instance types + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/brevdev/cloud" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.InstanceTypesAPI.ListInstanceTypes(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `InstanceTypesAPI.ListInstanceTypes``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ListInstanceTypes`: []InstanceType + fmt.Fprintf(os.Stdout, "Response from `InstanceTypesAPI.ListInstanceTypes`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiListInstanceTypesRequest struct via the builder pattern + + +### Return type + +[**[]InstanceType**](InstanceType.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/internal/fluidstack/gen/fluidstack/docs/InstancesAPI.md b/internal/fluidstack/gen/fluidstack/docs/InstancesAPI.md new file mode 100644 index 0000000..dff0a8a --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/docs/InstancesAPI.md @@ -0,0 +1,418 @@ +# \InstancesAPI + +All URIs are relative to *https://<region>.atlas.fluidstack.io/api/v1alpha1* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**CreateInstance**](InstancesAPI.md#CreateInstance) | **Post** /instances | Create a machine instance +[**DeleteInstance**](InstancesAPI.md#DeleteInstance) | **Delete** /instances/{id} | Delete a machine instance +[**GetInstance**](InstancesAPI.md#GetInstance) | **Get** /instances/{id} | Get a machine instance +[**ListInstances**](InstancesAPI.md#ListInstances) | **Get** /instances | List all machine instances +[**StartInstance**](InstancesAPI.md#StartInstance) | **Post** /instances/{id}/actions/start | Start a machine instance +[**StopInstance**](InstancesAPI.md#StopInstance) | **Post** /instances/{id}/actions/stop | Stop a machine instance + + + +## CreateInstance + +> Instance CreateInstance(ctx).XPROJECTID(xPROJECTID).InstancesPostRequest(instancesPostRequest).Execute() + +Create a machine instance + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/brevdev/cloud" +) + +func main() { + xPROJECTID := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Project identifier passed as a header + instancesPostRequest := *openapiclient.NewInstancesPostRequest("instance-1", "h100-hgx-80gb.8x") // InstancesPostRequest | Details of the instance to create + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.InstancesAPI.CreateInstance(context.Background()).XPROJECTID(xPROJECTID).InstancesPostRequest(instancesPostRequest).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `InstancesAPI.CreateInstance``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `CreateInstance`: Instance + fmt.Fprintf(os.Stdout, "Response from `InstancesAPI.CreateInstance`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiCreateInstanceRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xPROJECTID** | **string** | Project identifier passed as a header | + **instancesPostRequest** | [**InstancesPostRequest**](InstancesPostRequest.md) | Details of the instance to create | + +### Return type + +[**Instance**](Instance.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## DeleteInstance + +> DeleteInstance(ctx, id).XPROJECTID(xPROJECTID).Execute() + +Delete a machine instance + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/brevdev/cloud" +) + +func main() { + xPROJECTID := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Project identifier passed as a header + id := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Unique identifier of the instance + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + r, err := apiClient.InstancesAPI.DeleteInstance(context.Background(), id).XPROJECTID(xPROJECTID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `InstancesAPI.DeleteInstance``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string** | Unique identifier of the instance | + +### Other Parameters + +Other parameters are passed through a pointer to a apiDeleteInstanceRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xPROJECTID** | **string** | Project identifier passed as a header | + + +### Return type + + (empty response body) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetInstance + +> Instance GetInstance(ctx, id).XPROJECTID(xPROJECTID).Execute() + +Get a machine instance + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/brevdev/cloud" +) + +func main() { + xPROJECTID := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Project identifier passed as a header + id := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Unique identifier of the instance + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.InstancesAPI.GetInstance(context.Background(), id).XPROJECTID(xPROJECTID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `InstancesAPI.GetInstance``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetInstance`: Instance + fmt.Fprintf(os.Stdout, "Response from `InstancesAPI.GetInstance`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string** | Unique identifier of the instance | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetInstanceRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xPROJECTID** | **string** | Project identifier passed as a header | + + +### Return type + +[**Instance**](Instance.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## ListInstances + +> []Instance ListInstances(ctx).XPROJECTID(xPROJECTID).Execute() + +List all machine instances + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/brevdev/cloud" +) + +func main() { + xPROJECTID := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Project identifier passed as a header + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.InstancesAPI.ListInstances(context.Background()).XPROJECTID(xPROJECTID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `InstancesAPI.ListInstances``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ListInstances`: []Instance + fmt.Fprintf(os.Stdout, "Response from `InstancesAPI.ListInstances`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiListInstancesRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xPROJECTID** | **string** | Project identifier passed as a header | + +### Return type + +[**[]Instance**](Instance.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## StartInstance + +> StartInstance(ctx, id).XPROJECTID(xPROJECTID).Execute() + +Start a machine instance + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/brevdev/cloud" +) + +func main() { + xPROJECTID := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Project identifier passed as a header + id := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Unique identifier of the instance + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + r, err := apiClient.InstancesAPI.StartInstance(context.Background(), id).XPROJECTID(xPROJECTID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `InstancesAPI.StartInstance``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string** | Unique identifier of the instance | + +### Other Parameters + +Other parameters are passed through a pointer to a apiStartInstanceRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xPROJECTID** | **string** | Project identifier passed as a header | + + +### Return type + + (empty response body) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## StopInstance + +> StopInstance(ctx, id).XPROJECTID(xPROJECTID).Execute() + +Stop a machine instance + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/brevdev/cloud" +) + +func main() { + xPROJECTID := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Project identifier passed as a header + id := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Unique identifier of the instance + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + r, err := apiClient.InstancesAPI.StopInstance(context.Background(), id).XPROJECTID(xPROJECTID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `InstancesAPI.StopInstance``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string** | Unique identifier of the instance | + +### Other Parameters + +Other parameters are passed through a pointer to a apiStopInstanceRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xPROJECTID** | **string** | Project identifier passed as a header | + + +### Return type + + (empty response body) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/internal/fluidstack/gen/fluidstack/docs/InstancesPostRequest.md b/internal/fluidstack/gen/fluidstack/docs/InstancesPostRequest.md new file mode 100644 index 0000000..c373aa9 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/docs/InstancesPostRequest.md @@ -0,0 +1,238 @@ +# InstancesPostRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | Name of the instance | +**Type** | **string** | Instance type | +**Image** | Pointer to **string** | Operating system image for the instance | [optional] [default to "image://ubuntu22.04"] +**Preemptible** | Pointer to **bool** | Whether the instance is preemptible | [optional] [default to false] +**Ephemeral** | Pointer to **bool** | Whether the instance is ephemeral | [optional] [default to false] +**UserData** | Pointer to **NullableString** | Base64-encoded cloud-init user data for instance initialization | [optional] +**Filesystems** | Pointer to **[]string** | List of filesystem UUIDs attached to the instance | [optional] +**Tags** | Pointer to **map[string]string** | Tags for the instance. Tag keys must be 1–63 characters, start and end with alphanumerics, and may include `-`, `_`, and `.`. | [optional] + +## Methods + +### NewInstancesPostRequest + +`func NewInstancesPostRequest(name string, type_ string, ) *InstancesPostRequest` + +NewInstancesPostRequest instantiates a new InstancesPostRequest object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewInstancesPostRequestWithDefaults + +`func NewInstancesPostRequestWithDefaults() *InstancesPostRequest` + +NewInstancesPostRequestWithDefaults instantiates a new InstancesPostRequest object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetName + +`func (o *InstancesPostRequest) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *InstancesPostRequest) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *InstancesPostRequest) SetName(v string)` + +SetName sets Name field to given value. + + +### GetType + +`func (o *InstancesPostRequest) GetType() string` + +GetType returns the Type field if non-nil, zero value otherwise. + +### GetTypeOk + +`func (o *InstancesPostRequest) GetTypeOk() (*string, bool)` + +GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetType + +`func (o *InstancesPostRequest) SetType(v string)` + +SetType sets Type field to given value. + + +### GetImage + +`func (o *InstancesPostRequest) GetImage() string` + +GetImage returns the Image field if non-nil, zero value otherwise. + +### GetImageOk + +`func (o *InstancesPostRequest) GetImageOk() (*string, bool)` + +GetImageOk returns a tuple with the Image field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetImage + +`func (o *InstancesPostRequest) SetImage(v string)` + +SetImage sets Image field to given value. + +### HasImage + +`func (o *InstancesPostRequest) HasImage() bool` + +HasImage returns a boolean if a field has been set. + +### GetPreemptible + +`func (o *InstancesPostRequest) GetPreemptible() bool` + +GetPreemptible returns the Preemptible field if non-nil, zero value otherwise. + +### GetPreemptibleOk + +`func (o *InstancesPostRequest) GetPreemptibleOk() (*bool, bool)` + +GetPreemptibleOk returns a tuple with the Preemptible field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPreemptible + +`func (o *InstancesPostRequest) SetPreemptible(v bool)` + +SetPreemptible sets Preemptible field to given value. + +### HasPreemptible + +`func (o *InstancesPostRequest) HasPreemptible() bool` + +HasPreemptible returns a boolean if a field has been set. + +### GetEphemeral + +`func (o *InstancesPostRequest) GetEphemeral() bool` + +GetEphemeral returns the Ephemeral field if non-nil, zero value otherwise. + +### GetEphemeralOk + +`func (o *InstancesPostRequest) GetEphemeralOk() (*bool, bool)` + +GetEphemeralOk returns a tuple with the Ephemeral field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEphemeral + +`func (o *InstancesPostRequest) SetEphemeral(v bool)` + +SetEphemeral sets Ephemeral field to given value. + +### HasEphemeral + +`func (o *InstancesPostRequest) HasEphemeral() bool` + +HasEphemeral returns a boolean if a field has been set. + +### GetUserData + +`func (o *InstancesPostRequest) GetUserData() string` + +GetUserData returns the UserData field if non-nil, zero value otherwise. + +### GetUserDataOk + +`func (o *InstancesPostRequest) GetUserDataOk() (*string, bool)` + +GetUserDataOk returns a tuple with the UserData field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUserData + +`func (o *InstancesPostRequest) SetUserData(v string)` + +SetUserData sets UserData field to given value. + +### HasUserData + +`func (o *InstancesPostRequest) HasUserData() bool` + +HasUserData returns a boolean if a field has been set. + +### SetUserDataNil + +`func (o *InstancesPostRequest) SetUserDataNil(b bool)` + + SetUserDataNil sets the value for UserData to be an explicit nil + +### UnsetUserData +`func (o *InstancesPostRequest) UnsetUserData()` + +UnsetUserData ensures that no value is present for UserData, not even an explicit nil +### GetFilesystems + +`func (o *InstancesPostRequest) GetFilesystems() []string` + +GetFilesystems returns the Filesystems field if non-nil, zero value otherwise. + +### GetFilesystemsOk + +`func (o *InstancesPostRequest) GetFilesystemsOk() (*[]string, bool)` + +GetFilesystemsOk returns a tuple with the Filesystems field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFilesystems + +`func (o *InstancesPostRequest) SetFilesystems(v []string)` + +SetFilesystems sets Filesystems field to given value. + +### HasFilesystems + +`func (o *InstancesPostRequest) HasFilesystems() bool` + +HasFilesystems returns a boolean if a field has been set. + +### GetTags + +`func (o *InstancesPostRequest) GetTags() map[string]string` + +GetTags returns the Tags field if non-nil, zero value otherwise. + +### GetTagsOk + +`func (o *InstancesPostRequest) GetTagsOk() (*map[string]string, bool)` + +GetTagsOk returns a tuple with the Tags field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTags + +`func (o *InstancesPostRequest) SetTags(v map[string]string)` + +SetTags sets Tags field to given value. + +### HasTags + +`func (o *InstancesPostRequest) HasTags() bool` + +HasTags returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/internal/fluidstack/gen/fluidstack/docs/KubernetesAPI.md b/internal/fluidstack/gen/fluidstack/docs/KubernetesAPI.md new file mode 100644 index 0000000..a3ce98a --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/docs/KubernetesAPI.md @@ -0,0 +1,641 @@ +# \KubernetesAPI + +All URIs are relative to *https://<region>.atlas.fluidstack.io/api/v1alpha1* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**CreateKubernetesCluster**](KubernetesAPI.md#CreateKubernetesCluster) | **Post** /kubernetes/clusters | Create a cluster +[**CreateKubernetesNodePool**](KubernetesAPI.md#CreateKubernetesNodePool) | **Post** /kubernetes/clusters/{cluster_id}/node-pools | Create a node pool +[**DeleteKubernetesCluster**](KubernetesAPI.md#DeleteKubernetesCluster) | **Delete** /kubernetes/clusters/{id} | Delete a cluster +[**DeleteKubernetesNodePool**](KubernetesAPI.md#DeleteKubernetesNodePool) | **Delete** /kubernetes/clusters/{cluster_id}/node-pools/{node_pool_id} | Delete a node pool +[**GetKubernetesCluster**](KubernetesAPI.md#GetKubernetesCluster) | **Get** /kubernetes/clusters/{id} | Get a cluster +[**GetKubernetesClusterCredentials**](KubernetesAPI.md#GetKubernetesClusterCredentials) | **Get** /kubernetes/clusters/{cluster_id}/credentials | Get kubeconfig credentials for a cluster +[**GetKubernetesNodePool**](KubernetesAPI.md#GetKubernetesNodePool) | **Get** /kubernetes/clusters/{cluster_id}/node-pools/{node_pool_id} | Get a node pool +[**ListKubernetesClusters**](KubernetesAPI.md#ListKubernetesClusters) | **Get** /kubernetes/clusters | List all clusters +[**ListKubernetesNodePools**](KubernetesAPI.md#ListKubernetesNodePools) | **Get** /kubernetes/clusters/{cluster_id}/node-pools | List all node pools for a cluster + + + +## CreateKubernetesCluster + +> KubernetesCluster CreateKubernetesCluster(ctx).XPROJECTID(xPROJECTID).KubernetesClustersPostRequest(kubernetesClustersPostRequest).Execute() + +Create a cluster + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/brevdev/cloud" +) + +func main() { + xPROJECTID := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Project identifier passed as a header + kubernetesClustersPostRequest := *openapiclient.NewKubernetesClustersPostRequest("cluster-01") // KubernetesClustersPostRequest | Details of the cluster to create + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.KubernetesAPI.CreateKubernetesCluster(context.Background()).XPROJECTID(xPROJECTID).KubernetesClustersPostRequest(kubernetesClustersPostRequest).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `KubernetesAPI.CreateKubernetesCluster``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `CreateKubernetesCluster`: KubernetesCluster + fmt.Fprintf(os.Stdout, "Response from `KubernetesAPI.CreateKubernetesCluster`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiCreateKubernetesClusterRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xPROJECTID** | **string** | Project identifier passed as a header | + **kubernetesClustersPostRequest** | [**KubernetesClustersPostRequest**](KubernetesClustersPostRequest.md) | Details of the cluster to create | + +### Return type + +[**KubernetesCluster**](KubernetesCluster.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## CreateKubernetesNodePool + +> KubernetesNodePool CreateKubernetesNodePool(ctx, clusterId).XPROJECTID(xPROJECTID).KubernetesNodePoolPostRequest(kubernetesNodePoolPostRequest).Execute() + +Create a node pool + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/brevdev/cloud" +) + +func main() { + xPROJECTID := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Project identifier passed as a header + clusterId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Unique identifier of the cluster + kubernetesNodePoolPostRequest := *openapiclient.NewKubernetesNodePoolPostRequest("pool-01", "h100-hgx-80gb.8x", int32(3)) // KubernetesNodePoolPostRequest | Details of the node pool to create + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.KubernetesAPI.CreateKubernetesNodePool(context.Background(), clusterId).XPROJECTID(xPROJECTID).KubernetesNodePoolPostRequest(kubernetesNodePoolPostRequest).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `KubernetesAPI.CreateKubernetesNodePool``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `CreateKubernetesNodePool`: KubernetesNodePool + fmt.Fprintf(os.Stdout, "Response from `KubernetesAPI.CreateKubernetesNodePool`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**clusterId** | **string** | Unique identifier of the cluster | + +### Other Parameters + +Other parameters are passed through a pointer to a apiCreateKubernetesNodePoolRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xPROJECTID** | **string** | Project identifier passed as a header | + + **kubernetesNodePoolPostRequest** | [**KubernetesNodePoolPostRequest**](KubernetesNodePoolPostRequest.md) | Details of the node pool to create | + +### Return type + +[**KubernetesNodePool**](KubernetesNodePool.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## DeleteKubernetesCluster + +> DeleteKubernetesCluster(ctx, id).XPROJECTID(xPROJECTID).Execute() + +Delete a cluster + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/brevdev/cloud" +) + +func main() { + xPROJECTID := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Project identifier passed as a header + id := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Unique identifier of the kubernetes cluster to delete + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + r, err := apiClient.KubernetesAPI.DeleteKubernetesCluster(context.Background(), id).XPROJECTID(xPROJECTID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `KubernetesAPI.DeleteKubernetesCluster``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string** | Unique identifier of the kubernetes cluster to delete | + +### Other Parameters + +Other parameters are passed through a pointer to a apiDeleteKubernetesClusterRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xPROJECTID** | **string** | Project identifier passed as a header | + + +### Return type + + (empty response body) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## DeleteKubernetesNodePool + +> DeleteKubernetesNodePool(ctx, clusterId, nodePoolId).XPROJECTID(xPROJECTID).Execute() + +Delete a node pool + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/brevdev/cloud" +) + +func main() { + xPROJECTID := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Project identifier passed as a header + clusterId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Unique identifier of the cluster + nodePoolId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Unique identifier of the node pool to delete + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + r, err := apiClient.KubernetesAPI.DeleteKubernetesNodePool(context.Background(), clusterId, nodePoolId).XPROJECTID(xPROJECTID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `KubernetesAPI.DeleteKubernetesNodePool``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**clusterId** | **string** | Unique identifier of the cluster | +**nodePoolId** | **string** | Unique identifier of the node pool to delete | + +### Other Parameters + +Other parameters are passed through a pointer to a apiDeleteKubernetesNodePoolRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xPROJECTID** | **string** | Project identifier passed as a header | + + + +### Return type + + (empty response body) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetKubernetesCluster + +> KubernetesCluster GetKubernetesCluster(ctx, id).XPROJECTID(xPROJECTID).Execute() + +Get a cluster + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/brevdev/cloud" +) + +func main() { + xPROJECTID := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Project identifier passed as a header + id := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Unique identifier of the kubernetes cluster + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.KubernetesAPI.GetKubernetesCluster(context.Background(), id).XPROJECTID(xPROJECTID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `KubernetesAPI.GetKubernetesCluster``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetKubernetesCluster`: KubernetesCluster + fmt.Fprintf(os.Stdout, "Response from `KubernetesAPI.GetKubernetesCluster`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string** | Unique identifier of the kubernetes cluster | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetKubernetesClusterRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xPROJECTID** | **string** | Project identifier passed as a header | + + +### Return type + +[**KubernetesCluster**](KubernetesCluster.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetKubernetesClusterCredentials + +> string GetKubernetesClusterCredentials(ctx, clusterId).XPROJECTID(xPROJECTID).Execute() + +Get kubeconfig credentials for a cluster + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/brevdev/cloud" +) + +func main() { + xPROJECTID := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Project identifier passed as a header + clusterId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Unique identifier of the kubernetes cluster + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.KubernetesAPI.GetKubernetesClusterCredentials(context.Background(), clusterId).XPROJECTID(xPROJECTID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `KubernetesAPI.GetKubernetesClusterCredentials``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetKubernetesClusterCredentials`: string + fmt.Fprintf(os.Stdout, "Response from `KubernetesAPI.GetKubernetesClusterCredentials`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**clusterId** | **string** | Unique identifier of the kubernetes cluster | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetKubernetesClusterCredentialsRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xPROJECTID** | **string** | Project identifier passed as a header | + + +### Return type + +**string** + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/yaml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetKubernetesNodePool + +> KubernetesNodePool GetKubernetesNodePool(ctx, clusterId, nodePoolId).XPROJECTID(xPROJECTID).Execute() + +Get a node pool + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/brevdev/cloud" +) + +func main() { + xPROJECTID := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Project identifier passed as a header + clusterId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Unique identifier of the cluster + nodePoolId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Unique identifier of the node pool + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.KubernetesAPI.GetKubernetesNodePool(context.Background(), clusterId, nodePoolId).XPROJECTID(xPROJECTID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `KubernetesAPI.GetKubernetesNodePool``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetKubernetesNodePool`: KubernetesNodePool + fmt.Fprintf(os.Stdout, "Response from `KubernetesAPI.GetKubernetesNodePool`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**clusterId** | **string** | Unique identifier of the cluster | +**nodePoolId** | **string** | Unique identifier of the node pool | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetKubernetesNodePoolRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xPROJECTID** | **string** | Project identifier passed as a header | + + + +### Return type + +[**KubernetesNodePool**](KubernetesNodePool.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## ListKubernetesClusters + +> []KubernetesCluster ListKubernetesClusters(ctx).XPROJECTID(xPROJECTID).Execute() + +List all clusters + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/brevdev/cloud" +) + +func main() { + xPROJECTID := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Project identifier passed as a header + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.KubernetesAPI.ListKubernetesClusters(context.Background()).XPROJECTID(xPROJECTID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `KubernetesAPI.ListKubernetesClusters``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ListKubernetesClusters`: []KubernetesCluster + fmt.Fprintf(os.Stdout, "Response from `KubernetesAPI.ListKubernetesClusters`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiListKubernetesClustersRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xPROJECTID** | **string** | Project identifier passed as a header | + +### Return type + +[**[]KubernetesCluster**](KubernetesCluster.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## ListKubernetesNodePools + +> []KubernetesNodePool ListKubernetesNodePools(ctx, clusterId).XPROJECTID(xPROJECTID).Execute() + +List all node pools for a cluster + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/brevdev/cloud" +) + +func main() { + xPROJECTID := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Project identifier passed as a header + clusterId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Unique identifier of the cluster + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.KubernetesAPI.ListKubernetesNodePools(context.Background(), clusterId).XPROJECTID(xPROJECTID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `KubernetesAPI.ListKubernetesNodePools``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ListKubernetesNodePools`: []KubernetesNodePool + fmt.Fprintf(os.Stdout, "Response from `KubernetesAPI.ListKubernetesNodePools`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**clusterId** | **string** | Unique identifier of the cluster | + +### Other Parameters + +Other parameters are passed through a pointer to a apiListKubernetesNodePoolsRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xPROJECTID** | **string** | Project identifier passed as a header | + + +### Return type + +[**[]KubernetesNodePool**](KubernetesNodePool.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/internal/fluidstack/gen/fluidstack/docs/KubernetesCluster.md b/internal/fluidstack/gen/fluidstack/docs/KubernetesCluster.md new file mode 100644 index 0000000..55716bd --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/docs/KubernetesCluster.md @@ -0,0 +1,119 @@ +# KubernetesCluster + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **string** | The unique identifier of the cluster | +**Name** | **string** | The cluster name. | +**Version** | **string** | The cluster version. | +**Endpoint** | Pointer to **string** | The API server endpoint of the kubernetes cluster | [optional] + +## Methods + +### NewKubernetesCluster + +`func NewKubernetesCluster(id string, name string, version string, ) *KubernetesCluster` + +NewKubernetesCluster instantiates a new KubernetesCluster object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewKubernetesClusterWithDefaults + +`func NewKubernetesClusterWithDefaults() *KubernetesCluster` + +NewKubernetesClusterWithDefaults instantiates a new KubernetesCluster object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetId + +`func (o *KubernetesCluster) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *KubernetesCluster) GetIdOk() (*string, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *KubernetesCluster) SetId(v string)` + +SetId sets Id field to given value. + + +### GetName + +`func (o *KubernetesCluster) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *KubernetesCluster) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *KubernetesCluster) SetName(v string)` + +SetName sets Name field to given value. + + +### GetVersion + +`func (o *KubernetesCluster) GetVersion() string` + +GetVersion returns the Version field if non-nil, zero value otherwise. + +### GetVersionOk + +`func (o *KubernetesCluster) GetVersionOk() (*string, bool)` + +GetVersionOk returns a tuple with the Version field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetVersion + +`func (o *KubernetesCluster) SetVersion(v string)` + +SetVersion sets Version field to given value. + + +### GetEndpoint + +`func (o *KubernetesCluster) GetEndpoint() string` + +GetEndpoint returns the Endpoint field if non-nil, zero value otherwise. + +### GetEndpointOk + +`func (o *KubernetesCluster) GetEndpointOk() (*string, bool)` + +GetEndpointOk returns a tuple with the Endpoint field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEndpoint + +`func (o *KubernetesCluster) SetEndpoint(v string)` + +SetEndpoint sets Endpoint field to given value. + +### HasEndpoint + +`func (o *KubernetesCluster) HasEndpoint() bool` + +HasEndpoint returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/internal/fluidstack/gen/fluidstack/docs/KubernetesClustersPostRequest.md b/internal/fluidstack/gen/fluidstack/docs/KubernetesClustersPostRequest.md new file mode 100644 index 0000000..ecb3da3 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/docs/KubernetesClustersPostRequest.md @@ -0,0 +1,77 @@ +# KubernetesClustersPostRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | The cluster name. | +**Version** | Pointer to **string** | The cluster version. | [optional] + +## Methods + +### NewKubernetesClustersPostRequest + +`func NewKubernetesClustersPostRequest(name string, ) *KubernetesClustersPostRequest` + +NewKubernetesClustersPostRequest instantiates a new KubernetesClustersPostRequest object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewKubernetesClustersPostRequestWithDefaults + +`func NewKubernetesClustersPostRequestWithDefaults() *KubernetesClustersPostRequest` + +NewKubernetesClustersPostRequestWithDefaults instantiates a new KubernetesClustersPostRequest object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetName + +`func (o *KubernetesClustersPostRequest) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *KubernetesClustersPostRequest) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *KubernetesClustersPostRequest) SetName(v string)` + +SetName sets Name field to given value. + + +### GetVersion + +`func (o *KubernetesClustersPostRequest) GetVersion() string` + +GetVersion returns the Version field if non-nil, zero value otherwise. + +### GetVersionOk + +`func (o *KubernetesClustersPostRequest) GetVersionOk() (*string, bool)` + +GetVersionOk returns a tuple with the Version field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetVersion + +`func (o *KubernetesClustersPostRequest) SetVersion(v string)` + +SetVersion sets Version field to given value. + +### HasVersion + +`func (o *KubernetesClustersPostRequest) HasVersion() bool` + +HasVersion returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/internal/fluidstack/gen/fluidstack/docs/KubernetesNode.md b/internal/fluidstack/gen/fluidstack/docs/KubernetesNode.md new file mode 100644 index 0000000..e866ecf --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/docs/KubernetesNode.md @@ -0,0 +1,234 @@ +# KubernetesNode + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | Name of the kubernetes node | +**InstanceID** | **string** | Unique identifier of the instance backing the kubernetes node | +**State** | **string** | State of the kubernetes node | +**KubeletVersion** | **string** | Version of the kubelet running on the kubernetes node | +**CreatedAt** | **time.Time** | Creation time of the kubernetes node | +**Conditions** | [**[]KubernetesNodeConditionsInner**](KubernetesNodeConditionsInner.md) | Conditions of the kubernetes node | +**Accelerator** | Pointer to [**Accelerator**](Accelerator.md) | | [optional] +**Labels** | Pointer to **map[string]string** | Labels assigned to the kubernetes node | [optional] +**Taints** | Pointer to [**[]KubernetesNodeTaintsInner**](KubernetesNodeTaintsInner.md) | Taints applied to the kubernetes node | [optional] + +## Methods + +### NewKubernetesNode + +`func NewKubernetesNode(name string, instanceID string, state string, kubeletVersion string, createdAt time.Time, conditions []KubernetesNodeConditionsInner, ) *KubernetesNode` + +NewKubernetesNode instantiates a new KubernetesNode object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewKubernetesNodeWithDefaults + +`func NewKubernetesNodeWithDefaults() *KubernetesNode` + +NewKubernetesNodeWithDefaults instantiates a new KubernetesNode object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetName + +`func (o *KubernetesNode) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *KubernetesNode) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *KubernetesNode) SetName(v string)` + +SetName sets Name field to given value. + + +### GetInstanceID + +`func (o *KubernetesNode) GetInstanceID() string` + +GetInstanceID returns the InstanceID field if non-nil, zero value otherwise. + +### GetInstanceIDOk + +`func (o *KubernetesNode) GetInstanceIDOk() (*string, bool)` + +GetInstanceIDOk returns a tuple with the InstanceID field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetInstanceID + +`func (o *KubernetesNode) SetInstanceID(v string)` + +SetInstanceID sets InstanceID field to given value. + + +### GetState + +`func (o *KubernetesNode) GetState() string` + +GetState returns the State field if non-nil, zero value otherwise. + +### GetStateOk + +`func (o *KubernetesNode) GetStateOk() (*string, bool)` + +GetStateOk returns a tuple with the State field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetState + +`func (o *KubernetesNode) SetState(v string)` + +SetState sets State field to given value. + + +### GetKubeletVersion + +`func (o *KubernetesNode) GetKubeletVersion() string` + +GetKubeletVersion returns the KubeletVersion field if non-nil, zero value otherwise. + +### GetKubeletVersionOk + +`func (o *KubernetesNode) GetKubeletVersionOk() (*string, bool)` + +GetKubeletVersionOk returns a tuple with the KubeletVersion field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetKubeletVersion + +`func (o *KubernetesNode) SetKubeletVersion(v string)` + +SetKubeletVersion sets KubeletVersion field to given value. + + +### GetCreatedAt + +`func (o *KubernetesNode) GetCreatedAt() time.Time` + +GetCreatedAt returns the CreatedAt field if non-nil, zero value otherwise. + +### GetCreatedAtOk + +`func (o *KubernetesNode) GetCreatedAtOk() (*time.Time, bool)` + +GetCreatedAtOk returns a tuple with the CreatedAt field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCreatedAt + +`func (o *KubernetesNode) SetCreatedAt(v time.Time)` + +SetCreatedAt sets CreatedAt field to given value. + + +### GetConditions + +`func (o *KubernetesNode) GetConditions() []KubernetesNodeConditionsInner` + +GetConditions returns the Conditions field if non-nil, zero value otherwise. + +### GetConditionsOk + +`func (o *KubernetesNode) GetConditionsOk() (*[]KubernetesNodeConditionsInner, bool)` + +GetConditionsOk returns a tuple with the Conditions field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetConditions + +`func (o *KubernetesNode) SetConditions(v []KubernetesNodeConditionsInner)` + +SetConditions sets Conditions field to given value. + + +### GetAccelerator + +`func (o *KubernetesNode) GetAccelerator() Accelerator` + +GetAccelerator returns the Accelerator field if non-nil, zero value otherwise. + +### GetAcceleratorOk + +`func (o *KubernetesNode) GetAcceleratorOk() (*Accelerator, bool)` + +GetAcceleratorOk returns a tuple with the Accelerator field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAccelerator + +`func (o *KubernetesNode) SetAccelerator(v Accelerator)` + +SetAccelerator sets Accelerator field to given value. + +### HasAccelerator + +`func (o *KubernetesNode) HasAccelerator() bool` + +HasAccelerator returns a boolean if a field has been set. + +### GetLabels + +`func (o *KubernetesNode) GetLabels() map[string]string` + +GetLabels returns the Labels field if non-nil, zero value otherwise. + +### GetLabelsOk + +`func (o *KubernetesNode) GetLabelsOk() (*map[string]string, bool)` + +GetLabelsOk returns a tuple with the Labels field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLabels + +`func (o *KubernetesNode) SetLabels(v map[string]string)` + +SetLabels sets Labels field to given value. + +### HasLabels + +`func (o *KubernetesNode) HasLabels() bool` + +HasLabels returns a boolean if a field has been set. + +### GetTaints + +`func (o *KubernetesNode) GetTaints() []KubernetesNodeTaintsInner` + +GetTaints returns the Taints field if non-nil, zero value otherwise. + +### GetTaintsOk + +`func (o *KubernetesNode) GetTaintsOk() (*[]KubernetesNodeTaintsInner, bool)` + +GetTaintsOk returns a tuple with the Taints field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTaints + +`func (o *KubernetesNode) SetTaints(v []KubernetesNodeTaintsInner)` + +SetTaints sets Taints field to given value. + +### HasTaints + +`func (o *KubernetesNode) HasTaints() bool` + +HasTaints returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/internal/fluidstack/gen/fluidstack/docs/KubernetesNodeConditionsInner.md b/internal/fluidstack/gen/fluidstack/docs/KubernetesNodeConditionsInner.md new file mode 100644 index 0000000..4640b85 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/docs/KubernetesNodeConditionsInner.md @@ -0,0 +1,186 @@ +# KubernetesNodeConditionsInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type** | Pointer to **string** | Type of the condition | [optional] +**Status** | Pointer to **string** | Status of the condition | [optional] +**LastHeartbeatTime** | Pointer to **time.Time** | Last time the condition was updated | [optional] +**LastTransitionTime** | Pointer to **time.Time** | Last time the condition transitioned from one status to another | [optional] +**Reason** | Pointer to **string** | Reason for the condition's last transition | [optional] +**Message** | Pointer to **string** | Human-readable message indicating details about the condition | [optional] + +## Methods + +### NewKubernetesNodeConditionsInner + +`func NewKubernetesNodeConditionsInner() *KubernetesNodeConditionsInner` + +NewKubernetesNodeConditionsInner instantiates a new KubernetesNodeConditionsInner object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewKubernetesNodeConditionsInnerWithDefaults + +`func NewKubernetesNodeConditionsInnerWithDefaults() *KubernetesNodeConditionsInner` + +NewKubernetesNodeConditionsInnerWithDefaults instantiates a new KubernetesNodeConditionsInner object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetType + +`func (o *KubernetesNodeConditionsInner) GetType() string` + +GetType returns the Type field if non-nil, zero value otherwise. + +### GetTypeOk + +`func (o *KubernetesNodeConditionsInner) GetTypeOk() (*string, bool)` + +GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetType + +`func (o *KubernetesNodeConditionsInner) SetType(v string)` + +SetType sets Type field to given value. + +### HasType + +`func (o *KubernetesNodeConditionsInner) HasType() bool` + +HasType returns a boolean if a field has been set. + +### GetStatus + +`func (o *KubernetesNodeConditionsInner) GetStatus() string` + +GetStatus returns the Status field if non-nil, zero value otherwise. + +### GetStatusOk + +`func (o *KubernetesNodeConditionsInner) GetStatusOk() (*string, bool)` + +GetStatusOk returns a tuple with the Status field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetStatus + +`func (o *KubernetesNodeConditionsInner) SetStatus(v string)` + +SetStatus sets Status field to given value. + +### HasStatus + +`func (o *KubernetesNodeConditionsInner) HasStatus() bool` + +HasStatus returns a boolean if a field has been set. + +### GetLastHeartbeatTime + +`func (o *KubernetesNodeConditionsInner) GetLastHeartbeatTime() time.Time` + +GetLastHeartbeatTime returns the LastHeartbeatTime field if non-nil, zero value otherwise. + +### GetLastHeartbeatTimeOk + +`func (o *KubernetesNodeConditionsInner) GetLastHeartbeatTimeOk() (*time.Time, bool)` + +GetLastHeartbeatTimeOk returns a tuple with the LastHeartbeatTime field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLastHeartbeatTime + +`func (o *KubernetesNodeConditionsInner) SetLastHeartbeatTime(v time.Time)` + +SetLastHeartbeatTime sets LastHeartbeatTime field to given value. + +### HasLastHeartbeatTime + +`func (o *KubernetesNodeConditionsInner) HasLastHeartbeatTime() bool` + +HasLastHeartbeatTime returns a boolean if a field has been set. + +### GetLastTransitionTime + +`func (o *KubernetesNodeConditionsInner) GetLastTransitionTime() time.Time` + +GetLastTransitionTime returns the LastTransitionTime field if non-nil, zero value otherwise. + +### GetLastTransitionTimeOk + +`func (o *KubernetesNodeConditionsInner) GetLastTransitionTimeOk() (*time.Time, bool)` + +GetLastTransitionTimeOk returns a tuple with the LastTransitionTime field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLastTransitionTime + +`func (o *KubernetesNodeConditionsInner) SetLastTransitionTime(v time.Time)` + +SetLastTransitionTime sets LastTransitionTime field to given value. + +### HasLastTransitionTime + +`func (o *KubernetesNodeConditionsInner) HasLastTransitionTime() bool` + +HasLastTransitionTime returns a boolean if a field has been set. + +### GetReason + +`func (o *KubernetesNodeConditionsInner) GetReason() string` + +GetReason returns the Reason field if non-nil, zero value otherwise. + +### GetReasonOk + +`func (o *KubernetesNodeConditionsInner) GetReasonOk() (*string, bool)` + +GetReasonOk returns a tuple with the Reason field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetReason + +`func (o *KubernetesNodeConditionsInner) SetReason(v string)` + +SetReason sets Reason field to given value. + +### HasReason + +`func (o *KubernetesNodeConditionsInner) HasReason() bool` + +HasReason returns a boolean if a field has been set. + +### GetMessage + +`func (o *KubernetesNodeConditionsInner) GetMessage() string` + +GetMessage returns the Message field if non-nil, zero value otherwise. + +### GetMessageOk + +`func (o *KubernetesNodeConditionsInner) GetMessageOk() (*string, bool)` + +GetMessageOk returns a tuple with the Message field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMessage + +`func (o *KubernetesNodeConditionsInner) SetMessage(v string)` + +SetMessage sets Message field to given value. + +### HasMessage + +`func (o *KubernetesNodeConditionsInner) HasMessage() bool` + +HasMessage returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/internal/fluidstack/gen/fluidstack/docs/KubernetesNodePool.md b/internal/fluidstack/gen/fluidstack/docs/KubernetesNodePool.md new file mode 100644 index 0000000..a165ed0 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/docs/KubernetesNodePool.md @@ -0,0 +1,182 @@ +# KubernetesNodePool + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **string** | Unique identifier of the kubernetes node pool | +**Name** | **string** | Name of the kubernetes node pool | +**Cluster** | **string** | Name of the kubernetes cluster | +**Type** | **string** | Instance type of the kubernetes node pool | +**Count** | **int32** | Number of nodes in the kubernetes node pool | +**Version** | **string** | Version of the kubernetes node pool | +**Nodes** | Pointer to [**[]KubernetesNode**](KubernetesNode.md) | List of nodes in the kubernetes node pool | [optional] + +## Methods + +### NewKubernetesNodePool + +`func NewKubernetesNodePool(id string, name string, cluster string, type_ string, count int32, version string, ) *KubernetesNodePool` + +NewKubernetesNodePool instantiates a new KubernetesNodePool object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewKubernetesNodePoolWithDefaults + +`func NewKubernetesNodePoolWithDefaults() *KubernetesNodePool` + +NewKubernetesNodePoolWithDefaults instantiates a new KubernetesNodePool object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetId + +`func (o *KubernetesNodePool) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *KubernetesNodePool) GetIdOk() (*string, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *KubernetesNodePool) SetId(v string)` + +SetId sets Id field to given value. + + +### GetName + +`func (o *KubernetesNodePool) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *KubernetesNodePool) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *KubernetesNodePool) SetName(v string)` + +SetName sets Name field to given value. + + +### GetCluster + +`func (o *KubernetesNodePool) GetCluster() string` + +GetCluster returns the Cluster field if non-nil, zero value otherwise. + +### GetClusterOk + +`func (o *KubernetesNodePool) GetClusterOk() (*string, bool)` + +GetClusterOk returns a tuple with the Cluster field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCluster + +`func (o *KubernetesNodePool) SetCluster(v string)` + +SetCluster sets Cluster field to given value. + + +### GetType + +`func (o *KubernetesNodePool) GetType() string` + +GetType returns the Type field if non-nil, zero value otherwise. + +### GetTypeOk + +`func (o *KubernetesNodePool) GetTypeOk() (*string, bool)` + +GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetType + +`func (o *KubernetesNodePool) SetType(v string)` + +SetType sets Type field to given value. + + +### GetCount + +`func (o *KubernetesNodePool) GetCount() int32` + +GetCount returns the Count field if non-nil, zero value otherwise. + +### GetCountOk + +`func (o *KubernetesNodePool) GetCountOk() (*int32, bool)` + +GetCountOk returns a tuple with the Count field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCount + +`func (o *KubernetesNodePool) SetCount(v int32)` + +SetCount sets Count field to given value. + + +### GetVersion + +`func (o *KubernetesNodePool) GetVersion() string` + +GetVersion returns the Version field if non-nil, zero value otherwise. + +### GetVersionOk + +`func (o *KubernetesNodePool) GetVersionOk() (*string, bool)` + +GetVersionOk returns a tuple with the Version field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetVersion + +`func (o *KubernetesNodePool) SetVersion(v string)` + +SetVersion sets Version field to given value. + + +### GetNodes + +`func (o *KubernetesNodePool) GetNodes() []KubernetesNode` + +GetNodes returns the Nodes field if non-nil, zero value otherwise. + +### GetNodesOk + +`func (o *KubernetesNodePool) GetNodesOk() (*[]KubernetesNode, bool)` + +GetNodesOk returns a tuple with the Nodes field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNodes + +`func (o *KubernetesNodePool) SetNodes(v []KubernetesNode)` + +SetNodes sets Nodes field to given value. + +### HasNodes + +`func (o *KubernetesNodePool) HasNodes() bool` + +HasNodes returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/internal/fluidstack/gen/fluidstack/docs/KubernetesNodePoolPostRequest.md b/internal/fluidstack/gen/fluidstack/docs/KubernetesNodePoolPostRequest.md new file mode 100644 index 0000000..cafee22 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/docs/KubernetesNodePoolPostRequest.md @@ -0,0 +1,119 @@ +# KubernetesNodePoolPostRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | Name of the kubernetes node pool | +**Type** | **string** | Instance type of the kubernetes node pool | +**Count** | **int32** | Number of nodes in the kubernetes node pool | +**Version** | Pointer to **string** | Version of the kubernetes node pool | [optional] + +## Methods + +### NewKubernetesNodePoolPostRequest + +`func NewKubernetesNodePoolPostRequest(name string, type_ string, count int32, ) *KubernetesNodePoolPostRequest` + +NewKubernetesNodePoolPostRequest instantiates a new KubernetesNodePoolPostRequest object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewKubernetesNodePoolPostRequestWithDefaults + +`func NewKubernetesNodePoolPostRequestWithDefaults() *KubernetesNodePoolPostRequest` + +NewKubernetesNodePoolPostRequestWithDefaults instantiates a new KubernetesNodePoolPostRequest object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetName + +`func (o *KubernetesNodePoolPostRequest) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *KubernetesNodePoolPostRequest) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *KubernetesNodePoolPostRequest) SetName(v string)` + +SetName sets Name field to given value. + + +### GetType + +`func (o *KubernetesNodePoolPostRequest) GetType() string` + +GetType returns the Type field if non-nil, zero value otherwise. + +### GetTypeOk + +`func (o *KubernetesNodePoolPostRequest) GetTypeOk() (*string, bool)` + +GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetType + +`func (o *KubernetesNodePoolPostRequest) SetType(v string)` + +SetType sets Type field to given value. + + +### GetCount + +`func (o *KubernetesNodePoolPostRequest) GetCount() int32` + +GetCount returns the Count field if non-nil, zero value otherwise. + +### GetCountOk + +`func (o *KubernetesNodePoolPostRequest) GetCountOk() (*int32, bool)` + +GetCountOk returns a tuple with the Count field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCount + +`func (o *KubernetesNodePoolPostRequest) SetCount(v int32)` + +SetCount sets Count field to given value. + + +### GetVersion + +`func (o *KubernetesNodePoolPostRequest) GetVersion() string` + +GetVersion returns the Version field if non-nil, zero value otherwise. + +### GetVersionOk + +`func (o *KubernetesNodePoolPostRequest) GetVersionOk() (*string, bool)` + +GetVersionOk returns a tuple with the Version field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetVersion + +`func (o *KubernetesNodePoolPostRequest) SetVersion(v string)` + +SetVersion sets Version field to given value. + +### HasVersion + +`func (o *KubernetesNodePoolPostRequest) HasVersion() bool` + +HasVersion returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/internal/fluidstack/gen/fluidstack/docs/KubernetesNodeTaintsInner.md b/internal/fluidstack/gen/fluidstack/docs/KubernetesNodeTaintsInner.md new file mode 100644 index 0000000..4115f42 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/docs/KubernetesNodeTaintsInner.md @@ -0,0 +1,108 @@ +# KubernetesNodeTaintsInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Key** | Pointer to **string** | Key of the taint | [optional] +**Value** | Pointer to **string** | Value of the taint | [optional] +**Effect** | Pointer to **string** | Effect of the taint | [optional] + +## Methods + +### NewKubernetesNodeTaintsInner + +`func NewKubernetesNodeTaintsInner() *KubernetesNodeTaintsInner` + +NewKubernetesNodeTaintsInner instantiates a new KubernetesNodeTaintsInner object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewKubernetesNodeTaintsInnerWithDefaults + +`func NewKubernetesNodeTaintsInnerWithDefaults() *KubernetesNodeTaintsInner` + +NewKubernetesNodeTaintsInnerWithDefaults instantiates a new KubernetesNodeTaintsInner object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetKey + +`func (o *KubernetesNodeTaintsInner) GetKey() string` + +GetKey returns the Key field if non-nil, zero value otherwise. + +### GetKeyOk + +`func (o *KubernetesNodeTaintsInner) GetKeyOk() (*string, bool)` + +GetKeyOk returns a tuple with the Key field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetKey + +`func (o *KubernetesNodeTaintsInner) SetKey(v string)` + +SetKey sets Key field to given value. + +### HasKey + +`func (o *KubernetesNodeTaintsInner) HasKey() bool` + +HasKey returns a boolean if a field has been set. + +### GetValue + +`func (o *KubernetesNodeTaintsInner) GetValue() string` + +GetValue returns the Value field if non-nil, zero value otherwise. + +### GetValueOk + +`func (o *KubernetesNodeTaintsInner) GetValueOk() (*string, bool)` + +GetValueOk returns a tuple with the Value field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetValue + +`func (o *KubernetesNodeTaintsInner) SetValue(v string)` + +SetValue sets Value field to given value. + +### HasValue + +`func (o *KubernetesNodeTaintsInner) HasValue() bool` + +HasValue returns a boolean if a field has been set. + +### GetEffect + +`func (o *KubernetesNodeTaintsInner) GetEffect() string` + +GetEffect returns the Effect field if non-nil, zero value otherwise. + +### GetEffectOk + +`func (o *KubernetesNodeTaintsInner) GetEffectOk() (*string, bool)` + +GetEffectOk returns a tuple with the Effect field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEffect + +`func (o *KubernetesNodeTaintsInner) SetEffect(v string)` + +SetEffect sets Effect field to given value. + +### HasEffect + +`func (o *KubernetesNodeTaintsInner) HasEffect() bool` + +HasEffect returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/internal/fluidstack/gen/fluidstack/docs/ListCapacity200ResponseInner.md b/internal/fluidstack/gen/fluidstack/docs/ListCapacity200ResponseInner.md new file mode 100644 index 0000000..901018a --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/docs/ListCapacity200ResponseInner.md @@ -0,0 +1,72 @@ +# ListCapacity200ResponseInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | Available instance type | +**Capacity** | **int32** | Available instance count | + +## Methods + +### NewListCapacity200ResponseInner + +`func NewListCapacity200ResponseInner(name string, capacity int32, ) *ListCapacity200ResponseInner` + +NewListCapacity200ResponseInner instantiates a new ListCapacity200ResponseInner object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewListCapacity200ResponseInnerWithDefaults + +`func NewListCapacity200ResponseInnerWithDefaults() *ListCapacity200ResponseInner` + +NewListCapacity200ResponseInnerWithDefaults instantiates a new ListCapacity200ResponseInner object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetName + +`func (o *ListCapacity200ResponseInner) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *ListCapacity200ResponseInner) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *ListCapacity200ResponseInner) SetName(v string)` + +SetName sets Name field to given value. + + +### GetCapacity + +`func (o *ListCapacity200ResponseInner) GetCapacity() int32` + +GetCapacity returns the Capacity field if non-nil, zero value otherwise. + +### GetCapacityOk + +`func (o *ListCapacity200ResponseInner) GetCapacityOk() (*int32, bool)` + +GetCapacityOk returns a tuple with the Capacity field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCapacity + +`func (o *ListCapacity200ResponseInner) SetCapacity(v int32)` + +SetCapacity sets Capacity field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/internal/fluidstack/gen/fluidstack/docs/Project.md b/internal/fluidstack/gen/fluidstack/docs/Project.md new file mode 100644 index 0000000..5328843 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/docs/Project.md @@ -0,0 +1,114 @@ +# Project + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **string** | Unique identifier of the project | +**Name** | **string** | Name of the project | +**State** | [**ProjectState**](ProjectState.md) | | +**Tags** | **map[string]string** | Tags for the project | + +## Methods + +### NewProject + +`func NewProject(id string, name string, state ProjectState, tags map[string]string, ) *Project` + +NewProject instantiates a new Project object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewProjectWithDefaults + +`func NewProjectWithDefaults() *Project` + +NewProjectWithDefaults instantiates a new Project object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetId + +`func (o *Project) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *Project) GetIdOk() (*string, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *Project) SetId(v string)` + +SetId sets Id field to given value. + + +### GetName + +`func (o *Project) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *Project) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *Project) SetName(v string)` + +SetName sets Name field to given value. + + +### GetState + +`func (o *Project) GetState() ProjectState` + +GetState returns the State field if non-nil, zero value otherwise. + +### GetStateOk + +`func (o *Project) GetStateOk() (*ProjectState, bool)` + +GetStateOk returns a tuple with the State field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetState + +`func (o *Project) SetState(v ProjectState)` + +SetState sets State field to given value. + + +### GetTags + +`func (o *Project) GetTags() map[string]string` + +GetTags returns the Tags field if non-nil, zero value otherwise. + +### GetTagsOk + +`func (o *Project) GetTagsOk() (*map[string]string, bool)` + +GetTagsOk returns a tuple with the Tags field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTags + +`func (o *Project) SetTags(v map[string]string)` + +SetTags sets Tags field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/internal/fluidstack/gen/fluidstack/docs/ProjectState.md b/internal/fluidstack/gen/fluidstack/docs/ProjectState.md new file mode 100644 index 0000000..ffe58a9 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/docs/ProjectState.md @@ -0,0 +1,13 @@ +# ProjectState + +## Enum + + +* `ACTIVE` (value: `"active"`) + +* `DELETING` (value: `"deleting"`) + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/internal/fluidstack/gen/fluidstack/docs/ProjectsAPI.md b/internal/fluidstack/gen/fluidstack/docs/ProjectsAPI.md new file mode 100644 index 0000000..70e8690 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/docs/ProjectsAPI.md @@ -0,0 +1,269 @@ +# \ProjectsAPI + +All URIs are relative to *https://<region>.atlas.fluidstack.io/api/v1alpha1* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**CreateProject**](ProjectsAPI.md#CreateProject) | **Post** /projects | Create a project +[**DeleteProject**](ProjectsAPI.md#DeleteProject) | **Delete** /projects/{id} | Delete a project +[**GetProject**](ProjectsAPI.md#GetProject) | **Get** /projects/{id} | Get a project +[**ListProjects**](ProjectsAPI.md#ListProjects) | **Get** /projects | List all projects + + + +## CreateProject + +> Project CreateProject(ctx).ProjectsPostRequest(projectsPostRequest).Execute() + +Create a project + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/brevdev/cloud" +) + +func main() { + projectsPostRequest := *openapiclient.NewProjectsPostRequest("project-1") // ProjectsPostRequest | Details of the project to create + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.ProjectsAPI.CreateProject(context.Background()).ProjectsPostRequest(projectsPostRequest).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ProjectsAPI.CreateProject``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `CreateProject`: Project + fmt.Fprintf(os.Stdout, "Response from `ProjectsAPI.CreateProject`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiCreateProjectRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **projectsPostRequest** | [**ProjectsPostRequest**](ProjectsPostRequest.md) | Details of the project to create | + +### Return type + +[**Project**](Project.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## DeleteProject + +> DeleteProject(ctx, id).Execute() + +Delete a project + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/brevdev/cloud" +) + +func main() { + id := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Unique identifier of the project to delete + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + r, err := apiClient.ProjectsAPI.DeleteProject(context.Background(), id).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ProjectsAPI.DeleteProject``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string** | Unique identifier of the project to delete | + +### Other Parameters + +Other parameters are passed through a pointer to a apiDeleteProjectRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + + (empty response body) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetProject + +> Project GetProject(ctx, id).Execute() + +Get a project + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/brevdev/cloud" +) + +func main() { + id := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Unique identifier of the project + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.ProjectsAPI.GetProject(context.Background(), id).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ProjectsAPI.GetProject``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetProject`: Project + fmt.Fprintf(os.Stdout, "Response from `ProjectsAPI.GetProject`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string** | Unique identifier of the project | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetProjectRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**Project**](Project.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## ListProjects + +> []Project ListProjects(ctx).Execute() + +List all projects + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/brevdev/cloud" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.ProjectsAPI.ListProjects(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ProjectsAPI.ListProjects``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ListProjects`: []Project + fmt.Fprintf(os.Stdout, "Response from `ProjectsAPI.ListProjects`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiListProjectsRequest struct via the builder pattern + + +### Return type + +[**[]Project**](Project.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/internal/fluidstack/gen/fluidstack/docs/ProjectsPostRequest.md b/internal/fluidstack/gen/fluidstack/docs/ProjectsPostRequest.md new file mode 100644 index 0000000..9eeb635 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/docs/ProjectsPostRequest.md @@ -0,0 +1,77 @@ +# ProjectsPostRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | Name of the project | +**Tags** | Pointer to **map[string]string** | Tags for the project. Tag keys must be 1–63 characters, start and end with alphanumerics, and may include `-`, `_`, and `.`. | [optional] + +## Methods + +### NewProjectsPostRequest + +`func NewProjectsPostRequest(name string, ) *ProjectsPostRequest` + +NewProjectsPostRequest instantiates a new ProjectsPostRequest object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewProjectsPostRequestWithDefaults + +`func NewProjectsPostRequestWithDefaults() *ProjectsPostRequest` + +NewProjectsPostRequestWithDefaults instantiates a new ProjectsPostRequest object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetName + +`func (o *ProjectsPostRequest) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *ProjectsPostRequest) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *ProjectsPostRequest) SetName(v string)` + +SetName sets Name field to given value. + + +### GetTags + +`func (o *ProjectsPostRequest) GetTags() map[string]string` + +GetTags returns the Tags field if non-nil, zero value otherwise. + +### GetTagsOk + +`func (o *ProjectsPostRequest) GetTagsOk() (*map[string]string, bool)` + +GetTagsOk returns a tuple with the Tags field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTags + +`func (o *ProjectsPostRequest) SetTags(v map[string]string)` + +SetTags sets Tags field to given value. + +### HasTags + +`func (o *ProjectsPostRequest) HasTags() bool` + +HasTags returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/internal/fluidstack/gen/fluidstack/docs/SlurmAPI.md b/internal/fluidstack/gen/fluidstack/docs/SlurmAPI.md new file mode 100644 index 0000000..547379a --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/docs/SlurmAPI.md @@ -0,0 +1,570 @@ +# \SlurmAPI + +All URIs are relative to *https://<region>.atlas.fluidstack.io/api/v1alpha1* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**CreateSlurmCluster**](SlurmAPI.md#CreateSlurmCluster) | **Post** /slurm/clusters | Create a cluster +[**CreateSlurmNodePool**](SlurmAPI.md#CreateSlurmNodePool) | **Post** /slurm/clusters/{cluster_id}/node-pools | Create a node pool +[**DeleteSlurmCluster**](SlurmAPI.md#DeleteSlurmCluster) | **Delete** /slurm/clusters/{id} | Delete a cluster +[**DeleteSlurmNodePool**](SlurmAPI.md#DeleteSlurmNodePool) | **Delete** /slurm/clusters/{cluster_id}/node-pools/{node_pool_id} | Delete a node pool +[**GetSlurmCluster**](SlurmAPI.md#GetSlurmCluster) | **Get** /slurm/clusters/{id} | Get a cluster +[**GetSlurmNodePool**](SlurmAPI.md#GetSlurmNodePool) | **Get** /slurm/clusters/{cluster_id}/node-pools/{node_pool_id} | Get a node pool +[**ListSlurmClusters**](SlurmAPI.md#ListSlurmClusters) | **Get** /slurm/clusters | List all clusters +[**ListSlurmNodePools**](SlurmAPI.md#ListSlurmNodePools) | **Get** /slurm/clusters/{cluster_id}/node-pools | List all node pools for a cluster + + + +## CreateSlurmCluster + +> SlurmCluster CreateSlurmCluster(ctx).XPROJECTID(xPROJECTID).SlurmClustersPostRequest(slurmClustersPostRequest).Execute() + +Create a cluster + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/brevdev/cloud" +) + +func main() { + xPROJECTID := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Project identifier passed as a header + slurmClustersPostRequest := *openapiclient.NewSlurmClustersPostRequest("cluster-01") // SlurmClustersPostRequest | Details of the cluster to create + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.SlurmAPI.CreateSlurmCluster(context.Background()).XPROJECTID(xPROJECTID).SlurmClustersPostRequest(slurmClustersPostRequest).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SlurmAPI.CreateSlurmCluster``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `CreateSlurmCluster`: SlurmCluster + fmt.Fprintf(os.Stdout, "Response from `SlurmAPI.CreateSlurmCluster`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiCreateSlurmClusterRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xPROJECTID** | **string** | Project identifier passed as a header | + **slurmClustersPostRequest** | [**SlurmClustersPostRequest**](SlurmClustersPostRequest.md) | Details of the cluster to create | + +### Return type + +[**SlurmCluster**](SlurmCluster.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## CreateSlurmNodePool + +> SlurmNodePool CreateSlurmNodePool(ctx, clusterId).XPROJECTID(xPROJECTID).SlurmNodePoolPostRequest(slurmNodePoolPostRequest).Execute() + +Create a node pool + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/brevdev/cloud" +) + +func main() { + xPROJECTID := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Project identifier passed as a header + clusterId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Unique identifier of the cluster + slurmNodePoolPostRequest := *openapiclient.NewSlurmNodePoolPostRequest("pool-01", "h100-hgx-80gb.8x", int32(3)) // SlurmNodePoolPostRequest | Details of the node pool to create + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.SlurmAPI.CreateSlurmNodePool(context.Background(), clusterId).XPROJECTID(xPROJECTID).SlurmNodePoolPostRequest(slurmNodePoolPostRequest).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SlurmAPI.CreateSlurmNodePool``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `CreateSlurmNodePool`: SlurmNodePool + fmt.Fprintf(os.Stdout, "Response from `SlurmAPI.CreateSlurmNodePool`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**clusterId** | **string** | Unique identifier of the cluster | + +### Other Parameters + +Other parameters are passed through a pointer to a apiCreateSlurmNodePoolRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xPROJECTID** | **string** | Project identifier passed as a header | + + **slurmNodePoolPostRequest** | [**SlurmNodePoolPostRequest**](SlurmNodePoolPostRequest.md) | Details of the node pool to create | + +### Return type + +[**SlurmNodePool**](SlurmNodePool.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## DeleteSlurmCluster + +> DeleteSlurmCluster(ctx, id).XPROJECTID(xPROJECTID).Execute() + +Delete a cluster + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/brevdev/cloud" +) + +func main() { + xPROJECTID := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Project identifier passed as a header + id := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Unique identifier of the cluster to delete + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + r, err := apiClient.SlurmAPI.DeleteSlurmCluster(context.Background(), id).XPROJECTID(xPROJECTID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SlurmAPI.DeleteSlurmCluster``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string** | Unique identifier of the cluster to delete | + +### Other Parameters + +Other parameters are passed through a pointer to a apiDeleteSlurmClusterRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xPROJECTID** | **string** | Project identifier passed as a header | + + +### Return type + + (empty response body) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## DeleteSlurmNodePool + +> DeleteSlurmNodePool(ctx, clusterId, nodePoolId).XPROJECTID(xPROJECTID).Execute() + +Delete a node pool + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/brevdev/cloud" +) + +func main() { + xPROJECTID := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Project identifier passed as a header + clusterId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Unique identifier of the cluster + nodePoolId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Unique identifier of the node pool to delete + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + r, err := apiClient.SlurmAPI.DeleteSlurmNodePool(context.Background(), clusterId, nodePoolId).XPROJECTID(xPROJECTID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SlurmAPI.DeleteSlurmNodePool``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**clusterId** | **string** | Unique identifier of the cluster | +**nodePoolId** | **string** | Unique identifier of the node pool to delete | + +### Other Parameters + +Other parameters are passed through a pointer to a apiDeleteSlurmNodePoolRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xPROJECTID** | **string** | Project identifier passed as a header | + + + +### Return type + + (empty response body) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetSlurmCluster + +> SlurmCluster GetSlurmCluster(ctx, id).XPROJECTID(xPROJECTID).Execute() + +Get a cluster + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/brevdev/cloud" +) + +func main() { + xPROJECTID := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Project identifier passed as a header + id := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Unique identifier of the cluster + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.SlurmAPI.GetSlurmCluster(context.Background(), id).XPROJECTID(xPROJECTID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SlurmAPI.GetSlurmCluster``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetSlurmCluster`: SlurmCluster + fmt.Fprintf(os.Stdout, "Response from `SlurmAPI.GetSlurmCluster`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string** | Unique identifier of the cluster | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetSlurmClusterRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xPROJECTID** | **string** | Project identifier passed as a header | + + +### Return type + +[**SlurmCluster**](SlurmCluster.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetSlurmNodePool + +> SlurmNodePool GetSlurmNodePool(ctx, clusterId, nodePoolId).XPROJECTID(xPROJECTID).Execute() + +Get a node pool + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/brevdev/cloud" +) + +func main() { + xPROJECTID := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Project identifier passed as a header + clusterId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Unique identifier of the cluster + nodePoolId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Unique identifier of the node pool + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.SlurmAPI.GetSlurmNodePool(context.Background(), clusterId, nodePoolId).XPROJECTID(xPROJECTID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SlurmAPI.GetSlurmNodePool``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetSlurmNodePool`: SlurmNodePool + fmt.Fprintf(os.Stdout, "Response from `SlurmAPI.GetSlurmNodePool`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**clusterId** | **string** | Unique identifier of the cluster | +**nodePoolId** | **string** | Unique identifier of the node pool | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetSlurmNodePoolRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xPROJECTID** | **string** | Project identifier passed as a header | + + + +### Return type + +[**SlurmNodePool**](SlurmNodePool.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## ListSlurmClusters + +> []SlurmCluster ListSlurmClusters(ctx).XPROJECTID(xPROJECTID).Execute() + +List all clusters + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/brevdev/cloud" +) + +func main() { + xPROJECTID := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Project identifier passed as a header + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.SlurmAPI.ListSlurmClusters(context.Background()).XPROJECTID(xPROJECTID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SlurmAPI.ListSlurmClusters``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ListSlurmClusters`: []SlurmCluster + fmt.Fprintf(os.Stdout, "Response from `SlurmAPI.ListSlurmClusters`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiListSlurmClustersRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xPROJECTID** | **string** | Project identifier passed as a header | + +### Return type + +[**[]SlurmCluster**](SlurmCluster.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## ListSlurmNodePools + +> []SlurmNodePool ListSlurmNodePools(ctx, clusterId).XPROJECTID(xPROJECTID).Execute() + +List all node pools for a cluster + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/brevdev/cloud" +) + +func main() { + xPROJECTID := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Project identifier passed as a header + clusterId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | Unique identifier of the cluster + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.SlurmAPI.ListSlurmNodePools(context.Background(), clusterId).XPROJECTID(xPROJECTID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SlurmAPI.ListSlurmNodePools``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ListSlurmNodePools`: []SlurmNodePool + fmt.Fprintf(os.Stdout, "Response from `SlurmAPI.ListSlurmNodePools`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**clusterId** | **string** | Unique identifier of the cluster | + +### Other Parameters + +Other parameters are passed through a pointer to a apiListSlurmNodePoolsRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xPROJECTID** | **string** | Project identifier passed as a header | + + +### Return type + +[**[]SlurmNodePool**](SlurmNodePool.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/internal/fluidstack/gen/fluidstack/docs/SlurmCluster.md b/internal/fluidstack/gen/fluidstack/docs/SlurmCluster.md new file mode 100644 index 0000000..f3711e8 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/docs/SlurmCluster.md @@ -0,0 +1,119 @@ +# SlurmCluster + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **string** | Unique identifier of the slurm cluster | +**Name** | **string** | Name of the slurm cluster | +**Version** | **string** | The cluster version. | +**LoginNodes** | Pointer to [**[]SlurmLoginNode**](SlurmLoginNode.md) | Login nodes for the cluster | [optional] + +## Methods + +### NewSlurmCluster + +`func NewSlurmCluster(id string, name string, version string, ) *SlurmCluster` + +NewSlurmCluster instantiates a new SlurmCluster object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewSlurmClusterWithDefaults + +`func NewSlurmClusterWithDefaults() *SlurmCluster` + +NewSlurmClusterWithDefaults instantiates a new SlurmCluster object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetId + +`func (o *SlurmCluster) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *SlurmCluster) GetIdOk() (*string, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *SlurmCluster) SetId(v string)` + +SetId sets Id field to given value. + + +### GetName + +`func (o *SlurmCluster) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *SlurmCluster) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *SlurmCluster) SetName(v string)` + +SetName sets Name field to given value. + + +### GetVersion + +`func (o *SlurmCluster) GetVersion() string` + +GetVersion returns the Version field if non-nil, zero value otherwise. + +### GetVersionOk + +`func (o *SlurmCluster) GetVersionOk() (*string, bool)` + +GetVersionOk returns a tuple with the Version field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetVersion + +`func (o *SlurmCluster) SetVersion(v string)` + +SetVersion sets Version field to given value. + + +### GetLoginNodes + +`func (o *SlurmCluster) GetLoginNodes() []SlurmLoginNode` + +GetLoginNodes returns the LoginNodes field if non-nil, zero value otherwise. + +### GetLoginNodesOk + +`func (o *SlurmCluster) GetLoginNodesOk() (*[]SlurmLoginNode, bool)` + +GetLoginNodesOk returns a tuple with the LoginNodes field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLoginNodes + +`func (o *SlurmCluster) SetLoginNodes(v []SlurmLoginNode)` + +SetLoginNodes sets LoginNodes field to given value. + +### HasLoginNodes + +`func (o *SlurmCluster) HasLoginNodes() bool` + +HasLoginNodes returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/internal/fluidstack/gen/fluidstack/docs/SlurmClustersPostRequest.md b/internal/fluidstack/gen/fluidstack/docs/SlurmClustersPostRequest.md new file mode 100644 index 0000000..845578a --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/docs/SlurmClustersPostRequest.md @@ -0,0 +1,77 @@ +# SlurmClustersPostRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | The cluster name. | +**Version** | Pointer to **string** | The cluster version. | [optional] + +## Methods + +### NewSlurmClustersPostRequest + +`func NewSlurmClustersPostRequest(name string, ) *SlurmClustersPostRequest` + +NewSlurmClustersPostRequest instantiates a new SlurmClustersPostRequest object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewSlurmClustersPostRequestWithDefaults + +`func NewSlurmClustersPostRequestWithDefaults() *SlurmClustersPostRequest` + +NewSlurmClustersPostRequestWithDefaults instantiates a new SlurmClustersPostRequest object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetName + +`func (o *SlurmClustersPostRequest) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *SlurmClustersPostRequest) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *SlurmClustersPostRequest) SetName(v string)` + +SetName sets Name field to given value. + + +### GetVersion + +`func (o *SlurmClustersPostRequest) GetVersion() string` + +GetVersion returns the Version field if non-nil, zero value otherwise. + +### GetVersionOk + +`func (o *SlurmClustersPostRequest) GetVersionOk() (*string, bool)` + +GetVersionOk returns a tuple with the Version field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetVersion + +`func (o *SlurmClustersPostRequest) SetVersion(v string)` + +SetVersion sets Version field to given value. + +### HasVersion + +`func (o *SlurmClustersPostRequest) HasVersion() bool` + +HasVersion returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/internal/fluidstack/gen/fluidstack/docs/SlurmLoginNode.md b/internal/fluidstack/gen/fluidstack/docs/SlurmLoginNode.md new file mode 100644 index 0000000..0038523 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/docs/SlurmLoginNode.md @@ -0,0 +1,77 @@ +# SlurmLoginNode + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | Name of the node | +**PublicIP** | Pointer to **string** | Public IP address of the node | [optional] + +## Methods + +### NewSlurmLoginNode + +`func NewSlurmLoginNode(name string, ) *SlurmLoginNode` + +NewSlurmLoginNode instantiates a new SlurmLoginNode object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewSlurmLoginNodeWithDefaults + +`func NewSlurmLoginNodeWithDefaults() *SlurmLoginNode` + +NewSlurmLoginNodeWithDefaults instantiates a new SlurmLoginNode object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetName + +`func (o *SlurmLoginNode) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *SlurmLoginNode) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *SlurmLoginNode) SetName(v string)` + +SetName sets Name field to given value. + + +### GetPublicIP + +`func (o *SlurmLoginNode) GetPublicIP() string` + +GetPublicIP returns the PublicIP field if non-nil, zero value otherwise. + +### GetPublicIPOk + +`func (o *SlurmLoginNode) GetPublicIPOk() (*string, bool)` + +GetPublicIPOk returns a tuple with the PublicIP field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPublicIP + +`func (o *SlurmLoginNode) SetPublicIP(v string)` + +SetPublicIP sets PublicIP field to given value. + +### HasPublicIP + +`func (o *SlurmLoginNode) HasPublicIP() bool` + +HasPublicIP returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/internal/fluidstack/gen/fluidstack/docs/SlurmNode.md b/internal/fluidstack/gen/fluidstack/docs/SlurmNode.md new file mode 100644 index 0000000..a0d5662 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/docs/SlurmNode.md @@ -0,0 +1,114 @@ +# SlurmNode + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | Name of the node | +**InstanceID** | **string** | Unique identifier of the instance backing the node | +**States** | **[]string** | States of the node | +**SlurmdVersion** | **string** | Version of slurmd running on the node | + +## Methods + +### NewSlurmNode + +`func NewSlurmNode(name string, instanceID string, states []string, slurmdVersion string, ) *SlurmNode` + +NewSlurmNode instantiates a new SlurmNode object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewSlurmNodeWithDefaults + +`func NewSlurmNodeWithDefaults() *SlurmNode` + +NewSlurmNodeWithDefaults instantiates a new SlurmNode object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetName + +`func (o *SlurmNode) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *SlurmNode) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *SlurmNode) SetName(v string)` + +SetName sets Name field to given value. + + +### GetInstanceID + +`func (o *SlurmNode) GetInstanceID() string` + +GetInstanceID returns the InstanceID field if non-nil, zero value otherwise. + +### GetInstanceIDOk + +`func (o *SlurmNode) GetInstanceIDOk() (*string, bool)` + +GetInstanceIDOk returns a tuple with the InstanceID field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetInstanceID + +`func (o *SlurmNode) SetInstanceID(v string)` + +SetInstanceID sets InstanceID field to given value. + + +### GetStates + +`func (o *SlurmNode) GetStates() []string` + +GetStates returns the States field if non-nil, zero value otherwise. + +### GetStatesOk + +`func (o *SlurmNode) GetStatesOk() (*[]string, bool)` + +GetStatesOk returns a tuple with the States field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetStates + +`func (o *SlurmNode) SetStates(v []string)` + +SetStates sets States field to given value. + + +### GetSlurmdVersion + +`func (o *SlurmNode) GetSlurmdVersion() string` + +GetSlurmdVersion returns the SlurmdVersion field if non-nil, zero value otherwise. + +### GetSlurmdVersionOk + +`func (o *SlurmNode) GetSlurmdVersionOk() (*string, bool)` + +GetSlurmdVersionOk returns a tuple with the SlurmdVersion field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSlurmdVersion + +`func (o *SlurmNode) SetSlurmdVersion(v string)` + +SetSlurmdVersion sets SlurmdVersion field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/internal/fluidstack/gen/fluidstack/docs/SlurmNodePool.md b/internal/fluidstack/gen/fluidstack/docs/SlurmNodePool.md new file mode 100644 index 0000000..6d23e22 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/docs/SlurmNodePool.md @@ -0,0 +1,135 @@ +# SlurmNodePool + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **string** | Unique identifier of the slurm node pool | +**Name** | **string** | Name of the node pool | +**Type** | **string** | Instance type of the node pool | +**Count** | **int32** | Number of nodes in the node pool | +**Nodes** | [**[]SlurmNode**](SlurmNode.md) | List of nodes in the node pool | + +## Methods + +### NewSlurmNodePool + +`func NewSlurmNodePool(id string, name string, type_ string, count int32, nodes []SlurmNode, ) *SlurmNodePool` + +NewSlurmNodePool instantiates a new SlurmNodePool object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewSlurmNodePoolWithDefaults + +`func NewSlurmNodePoolWithDefaults() *SlurmNodePool` + +NewSlurmNodePoolWithDefaults instantiates a new SlurmNodePool object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetId + +`func (o *SlurmNodePool) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *SlurmNodePool) GetIdOk() (*string, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *SlurmNodePool) SetId(v string)` + +SetId sets Id field to given value. + + +### GetName + +`func (o *SlurmNodePool) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *SlurmNodePool) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *SlurmNodePool) SetName(v string)` + +SetName sets Name field to given value. + + +### GetType + +`func (o *SlurmNodePool) GetType() string` + +GetType returns the Type field if non-nil, zero value otherwise. + +### GetTypeOk + +`func (o *SlurmNodePool) GetTypeOk() (*string, bool)` + +GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetType + +`func (o *SlurmNodePool) SetType(v string)` + +SetType sets Type field to given value. + + +### GetCount + +`func (o *SlurmNodePool) GetCount() int32` + +GetCount returns the Count field if non-nil, zero value otherwise. + +### GetCountOk + +`func (o *SlurmNodePool) GetCountOk() (*int32, bool)` + +GetCountOk returns a tuple with the Count field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCount + +`func (o *SlurmNodePool) SetCount(v int32)` + +SetCount sets Count field to given value. + + +### GetNodes + +`func (o *SlurmNodePool) GetNodes() []SlurmNode` + +GetNodes returns the Nodes field if non-nil, zero value otherwise. + +### GetNodesOk + +`func (o *SlurmNodePool) GetNodesOk() (*[]SlurmNode, bool)` + +GetNodesOk returns a tuple with the Nodes field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNodes + +`func (o *SlurmNodePool) SetNodes(v []SlurmNode)` + +SetNodes sets Nodes field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/internal/fluidstack/gen/fluidstack/docs/SlurmNodePoolPostRequest.md b/internal/fluidstack/gen/fluidstack/docs/SlurmNodePoolPostRequest.md new file mode 100644 index 0000000..14a2966 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/docs/SlurmNodePoolPostRequest.md @@ -0,0 +1,93 @@ +# SlurmNodePoolPostRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | Name of the node pool | +**Type** | **string** | Instance type of the node pool | +**Count** | **int32** | Number of nodes in the node pool | + +## Methods + +### NewSlurmNodePoolPostRequest + +`func NewSlurmNodePoolPostRequest(name string, type_ string, count int32, ) *SlurmNodePoolPostRequest` + +NewSlurmNodePoolPostRequest instantiates a new SlurmNodePoolPostRequest object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewSlurmNodePoolPostRequestWithDefaults + +`func NewSlurmNodePoolPostRequestWithDefaults() *SlurmNodePoolPostRequest` + +NewSlurmNodePoolPostRequestWithDefaults instantiates a new SlurmNodePoolPostRequest object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetName + +`func (o *SlurmNodePoolPostRequest) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *SlurmNodePoolPostRequest) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *SlurmNodePoolPostRequest) SetName(v string)` + +SetName sets Name field to given value. + + +### GetType + +`func (o *SlurmNodePoolPostRequest) GetType() string` + +GetType returns the Type field if non-nil, zero value otherwise. + +### GetTypeOk + +`func (o *SlurmNodePoolPostRequest) GetTypeOk() (*string, bool)` + +GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetType + +`func (o *SlurmNodePoolPostRequest) SetType(v string)` + +SetType sets Type field to given value. + + +### GetCount + +`func (o *SlurmNodePoolPostRequest) GetCount() int32` + +GetCount returns the Count field if non-nil, zero value otherwise. + +### GetCountOk + +`func (o *SlurmNodePoolPostRequest) GetCountOk() (*int32, bool)` + +GetCountOk returns a tuple with the Count field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCount + +`func (o *SlurmNodePoolPostRequest) SetCount(v int32)` + +SetCount sets Count field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/internal/fluidstack/gen/fluidstack/git_push.sh b/internal/fluidstack/gen/fluidstack/git_push.sh new file mode 100644 index 0000000..ccffd50 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/git_push.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="brevdev" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="cloud" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/internal/fluidstack/gen/fluidstack/model_accelerator.go b/internal/fluidstack/gen/fluidstack/model_accelerator.go new file mode 100644 index 0000000..8c66c1b --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/model_accelerator.go @@ -0,0 +1,227 @@ +/* +Infrastructure API + +Fluidstack Infrastructure API + +API version: v1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the Accelerator type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Accelerator{} + +// Accelerator Hardware details of the kubernetes node +type Accelerator struct { + // Type of the hardware accelerator + Type string `json:"type"` + // Product name of the accelerator + Product string `json:"product"` + // Version of the driver for the accelerator + DriverVersion string `json:"driverVersion"` + AdditionalProperties map[string]interface{} +} + +type _Accelerator Accelerator + +// NewAccelerator instantiates a new Accelerator object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAccelerator(type_ string, product string, driverVersion string) *Accelerator { + this := Accelerator{} + this.Type = type_ + this.Product = product + this.DriverVersion = driverVersion + return &this +} + +// NewAcceleratorWithDefaults instantiates a new Accelerator object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAcceleratorWithDefaults() *Accelerator { + this := Accelerator{} + return &this +} + +// GetType returns the Type field value +func (o *Accelerator) GetType() string { + if o == nil { + var ret string + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *Accelerator) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *Accelerator) SetType(v string) { + o.Type = v +} + +// GetProduct returns the Product field value +func (o *Accelerator) GetProduct() string { + if o == nil { + var ret string + return ret + } + + return o.Product +} + +// GetProductOk returns a tuple with the Product field value +// and a boolean to check if the value has been set. +func (o *Accelerator) GetProductOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Product, true +} + +// SetProduct sets field value +func (o *Accelerator) SetProduct(v string) { + o.Product = v +} + +// GetDriverVersion returns the DriverVersion field value +func (o *Accelerator) GetDriverVersion() string { + if o == nil { + var ret string + return ret + } + + return o.DriverVersion +} + +// GetDriverVersionOk returns a tuple with the DriverVersion field value +// and a boolean to check if the value has been set. +func (o *Accelerator) GetDriverVersionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DriverVersion, true +} + +// SetDriverVersion sets field value +func (o *Accelerator) SetDriverVersion(v string) { + o.DriverVersion = v +} + +func (o Accelerator) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Accelerator) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["type"] = o.Type + toSerialize["product"] = o.Product + toSerialize["driverVersion"] = o.DriverVersion + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Accelerator) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "type", + "product", + "driverVersion", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varAccelerator := _Accelerator{} + + err = json.Unmarshal(data, &varAccelerator) + + if err != nil { + return err + } + + *o = Accelerator(varAccelerator) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "type") + delete(additionalProperties, "product") + delete(additionalProperties, "driverVersion") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableAccelerator struct { + value *Accelerator + isSet bool +} + +func (v NullableAccelerator) Get() *Accelerator { + return v.value +} + +func (v *NullableAccelerator) Set(val *Accelerator) { + v.value = val + v.isSet = true +} + +func (v NullableAccelerator) IsSet() bool { + return v.isSet +} + +func (v *NullableAccelerator) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAccelerator(val *Accelerator) *NullableAccelerator { + return &NullableAccelerator{value: val, isSet: true} +} + +func (v NullableAccelerator) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAccelerator) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/fluidstack/gen/fluidstack/model_capability.go b/internal/fluidstack/gen/fluidstack/model_capability.go new file mode 100644 index 0000000..979eb04 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/model_capability.go @@ -0,0 +1,168 @@ +/* +Infrastructure API + +Fluidstack Infrastructure API + +API version: v1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// Capability the model 'Capability' +type Capability string + +// List of Capability +const ( + INSTANCESLIST Capability = "instances:list" + INSTANCESCREATE Capability = "instances:create" + INSTANCESDELETE Capability = "instances:delete" + INSTANCESREAD Capability = "instances:read" + INSTANCESUPDATE Capability = "instances:update" + INSTANCESSTART Capability = "instances:start" + INSTANCESSTOP Capability = "instances:stop" + FILESYSTEMSLIST Capability = "filesystems:list" + FILESYSTEMSCREATE Capability = "filesystems:create" + FILESYSTEMSDELETE Capability = "filesystems:delete" + FILESYSTEMSREAD Capability = "filesystems:read" + FILESYSTEMSUPDATE Capability = "filesystems:update" + PROJECTSLIST Capability = "projects:list" + PROJECTSCREATE Capability = "projects:create" + PROJECTSDELETE Capability = "projects:delete" + PROJECTSREAD Capability = "projects:read" + PROJECTSUPDATE Capability = "projects:update" + KUBERNETESCLUSTERSLIST Capability = "kubernetes:clusters:list" + KUBERNETESCLUSTERSCREATE Capability = "kubernetes:clusters:create" + KUBERNETESCLUSTERSDELETE Capability = "kubernetes:clusters:delete" + KUBERNETESCLUSTERSREAD Capability = "kubernetes:clusters:read" + KUBERNETESNODE_POOLSLIST Capability = "kubernetes:node-pools:list" + KUBERNETESNODE_POOLSCREATE Capability = "kubernetes:node-pools:create" + KUBERNETESNODE_POOLSDELETE Capability = "kubernetes:node-pools:delete" + KUBERNETESNODE_POOLSREAD Capability = "kubernetes:node-pools:read" + KUBERNETESCREDENTIALSREAD Capability = "kubernetes:credentials:read" + SLURMCLUSTERSLIST Capability = "slurm:clusters:list" + SLURMCLUSTERSREAD Capability = "slurm:clusters:read" + SLURMCLUSTERSPROXY Capability = "slurm:clusters:proxy" + SLURMNODE_POOLSLIST Capability = "slurm:node-pools:list" + SLURMNODE_POOLSREAD Capability = "slurm:node-pools:read" +) + +// All allowed values of Capability enum +var AllowedCapabilityEnumValues = []Capability{ + "instances:list", + "instances:create", + "instances:delete", + "instances:read", + "instances:update", + "instances:start", + "instances:stop", + "filesystems:list", + "filesystems:create", + "filesystems:delete", + "filesystems:read", + "filesystems:update", + "projects:list", + "projects:create", + "projects:delete", + "projects:read", + "projects:update", + "kubernetes:clusters:list", + "kubernetes:clusters:create", + "kubernetes:clusters:delete", + "kubernetes:clusters:read", + "kubernetes:node-pools:list", + "kubernetes:node-pools:create", + "kubernetes:node-pools:delete", + "kubernetes:node-pools:read", + "kubernetes:credentials:read", + "slurm:clusters:list", + "slurm:clusters:read", + "slurm:clusters:proxy", + "slurm:node-pools:list", + "slurm:node-pools:read", +} + +func (v *Capability) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := Capability(value) + for _, existing := range AllowedCapabilityEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Capability", value) +} + +// NewCapabilityFromValue returns a pointer to a valid Capability +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewCapabilityFromValue(v string) (*Capability, error) { + ev := Capability(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for Capability: valid values are %v", v, AllowedCapabilityEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v Capability) IsValid() bool { + for _, existing := range AllowedCapabilityEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to Capability value +func (v Capability) Ptr() *Capability { + return &v +} + +type NullableCapability struct { + value *Capability + isSet bool +} + +func (v NullableCapability) Get() *Capability { + return v.value +} + +func (v *NullableCapability) Set(val *Capability) { + v.value = val + v.isSet = true +} + +func (v NullableCapability) IsSet() bool { + return v.isSet +} + +func (v *NullableCapability) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCapability(val *Capability) *NullableCapability { + return &NullableCapability{value: val, isSet: true} +} + +func (v NullableCapability) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCapability) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/fluidstack/gen/fluidstack/model_error.go b/internal/fluidstack/gen/fluidstack/model_error.go new file mode 100644 index 0000000..858ac17 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/model_error.go @@ -0,0 +1,167 @@ +/* +Infrastructure API + +Fluidstack Infrastructure API + +API version: v1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the Error type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Error{} + +// Error Error response +type Error struct { + // Human-readable error message + Message string `json:"message"` + AdditionalProperties map[string]interface{} +} + +type _Error Error + +// NewError instantiates a new Error object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewError(message string) *Error { + this := Error{} + this.Message = message + return &this +} + +// NewErrorWithDefaults instantiates a new Error object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewErrorWithDefaults() *Error { + this := Error{} + return &this +} + +// GetMessage returns the Message field value +func (o *Error) GetMessage() string { + if o == nil { + var ret string + return ret + } + + return o.Message +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *Error) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value +func (o *Error) SetMessage(v string) { + o.Message = v +} + +func (o Error) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Error) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["message"] = o.Message + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Error) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "message", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varError := _Error{} + + err = json.Unmarshal(data, &varError) + + if err != nil { + return err + } + + *o = Error(varError) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "message") + o.AdditionalProperties = additionalProperties + } + + return err +} + +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/internal/fluidstack/gen/fluidstack/model_filesystem.go b/internal/fluidstack/gen/fluidstack/model_filesystem.go new file mode 100644 index 0000000..8d22a93 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/model_filesystem.go @@ -0,0 +1,227 @@ +/* +Infrastructure API + +Fluidstack Infrastructure API + +API version: v1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the Filesystem type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Filesystem{} + +// Filesystem Filesystem (virtio-fs) +type Filesystem struct { + // Unique identifier of the filesystem + Id string `json:"id"` + // Name of the filesystem + Name string `json:"name"` + // Size of the filesystem in GB + Size string `json:"size"` + AdditionalProperties map[string]interface{} +} + +type _Filesystem Filesystem + +// NewFilesystem instantiates a new Filesystem object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewFilesystem(id string, name string, size string) *Filesystem { + this := Filesystem{} + this.Id = id + this.Name = name + this.Size = size + return &this +} + +// NewFilesystemWithDefaults instantiates a new Filesystem object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewFilesystemWithDefaults() *Filesystem { + this := Filesystem{} + return &this +} + +// GetId returns the Id field value +func (o *Filesystem) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *Filesystem) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *Filesystem) SetId(v string) { + o.Id = v +} + +// GetName returns the Name field value +func (o *Filesystem) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *Filesystem) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *Filesystem) SetName(v string) { + o.Name = v +} + +// GetSize returns the Size field value +func (o *Filesystem) GetSize() string { + if o == nil { + var ret string + return ret + } + + return o.Size +} + +// GetSizeOk returns a tuple with the Size field value +// and a boolean to check if the value has been set. +func (o *Filesystem) GetSizeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Size, true +} + +// SetSize sets field value +func (o *Filesystem) SetSize(v string) { + o.Size = v +} + +func (o Filesystem) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Filesystem) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["name"] = o.Name + toSerialize["size"] = o.Size + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Filesystem) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "id", + "name", + "size", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varFilesystem := _Filesystem{} + + err = json.Unmarshal(data, &varFilesystem) + + if err != nil { + return err + } + + *o = Filesystem(varFilesystem) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "name") + delete(additionalProperties, "size") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableFilesystem struct { + value *Filesystem + isSet bool +} + +func (v NullableFilesystem) Get() *Filesystem { + return v.value +} + +func (v *NullableFilesystem) Set(val *Filesystem) { + v.value = val + v.isSet = true +} + +func (v NullableFilesystem) IsSet() bool { + return v.isSet +} + +func (v *NullableFilesystem) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFilesystem(val *Filesystem) *NullableFilesystem { + return &NullableFilesystem{value: val, isSet: true} +} + +func (v NullableFilesystem) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFilesystem) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/fluidstack/gen/fluidstack/model_filesystems_post_request.go b/internal/fluidstack/gen/fluidstack/model_filesystems_post_request.go new file mode 100644 index 0000000..ea7cb3d --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/model_filesystems_post_request.go @@ -0,0 +1,197 @@ +/* +Infrastructure API + +Fluidstack Infrastructure API + +API version: v1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the FilesystemsPostRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FilesystemsPostRequest{} + +// FilesystemsPostRequest POST request for a filesystem +type FilesystemsPostRequest struct { + // Name of the filesystem + Name string `json:"name"` + // Size of the filesystem in GB + Size string `json:"size"` + AdditionalProperties map[string]interface{} +} + +type _FilesystemsPostRequest FilesystemsPostRequest + +// NewFilesystemsPostRequest instantiates a new FilesystemsPostRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewFilesystemsPostRequest(name string, size string) *FilesystemsPostRequest { + this := FilesystemsPostRequest{} + this.Name = name + this.Size = size + return &this +} + +// NewFilesystemsPostRequestWithDefaults instantiates a new FilesystemsPostRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewFilesystemsPostRequestWithDefaults() *FilesystemsPostRequest { + this := FilesystemsPostRequest{} + return &this +} + +// GetName returns the Name field value +func (o *FilesystemsPostRequest) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *FilesystemsPostRequest) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *FilesystemsPostRequest) SetName(v string) { + o.Name = v +} + +// GetSize returns the Size field value +func (o *FilesystemsPostRequest) GetSize() string { + if o == nil { + var ret string + return ret + } + + return o.Size +} + +// GetSizeOk returns a tuple with the Size field value +// and a boolean to check if the value has been set. +func (o *FilesystemsPostRequest) GetSizeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Size, true +} + +// SetSize sets field value +func (o *FilesystemsPostRequest) SetSize(v string) { + o.Size = v +} + +func (o FilesystemsPostRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o FilesystemsPostRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + toSerialize["size"] = o.Size + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *FilesystemsPostRequest) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "name", + "size", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varFilesystemsPostRequest := _FilesystemsPostRequest{} + + err = json.Unmarshal(data, &varFilesystemsPostRequest) + + if err != nil { + return err + } + + *o = FilesystemsPostRequest(varFilesystemsPostRequest) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "size") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableFilesystemsPostRequest struct { + value *FilesystemsPostRequest + isSet bool +} + +func (v NullableFilesystemsPostRequest) Get() *FilesystemsPostRequest { + return v.value +} + +func (v *NullableFilesystemsPostRequest) Set(val *FilesystemsPostRequest) { + v.value = val + v.isSet = true +} + +func (v NullableFilesystemsPostRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableFilesystemsPostRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFilesystemsPostRequest(val *FilesystemsPostRequest) *NullableFilesystemsPostRequest { + return &NullableFilesystemsPostRequest{value: val, isSet: true} +} + +func (v NullableFilesystemsPostRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFilesystemsPostRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/fluidstack/gen/fluidstack/model_instance.go b/internal/fluidstack/gen/fluidstack/model_instance.go new file mode 100644 index 0000000..25a1147 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/model_instance.go @@ -0,0 +1,470 @@ +/* +Infrastructure API + +Fluidstack Infrastructure API + +API version: v1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the Instance type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Instance{} + +// Instance machine instance +type Instance struct { + // Unique identifier of the instance + Id string `json:"id"` + // Name of the instance + Name string `json:"name"` + // Instance type + Type string `json:"type"` + // Private IP address of the instance + Ip NullableString `json:"ip"` + State InstanceState `json:"state"` + // Operating system image for the instance + Image string `json:"image"` + // Whether the instance is preemptible + Preemptible bool `json:"preemptible"` + // Whether the instance is ephemeral + Ephemeral bool `json:"ephemeral"` + // Base64-encoded cloud-init user data for instance initialization + UserData NullableString `json:"userData"` + // List of filesystem UUIDs attached to the instance + Filesystems []string `json:"filesystems"` + // Tags for the instance + Tags map[string]string `json:"tags"` + AdditionalProperties map[string]interface{} +} + +type _Instance Instance + +// NewInstance instantiates a new Instance object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewInstance(id string, name string, type_ string, ip NullableString, state InstanceState, image string, preemptible bool, ephemeral bool, userData NullableString, filesystems []string, tags map[string]string) *Instance { + this := Instance{} + this.Id = id + this.Name = name + this.Type = type_ + this.Ip = ip + this.State = state + this.Image = image + this.Preemptible = preemptible + this.Ephemeral = ephemeral + this.UserData = userData + this.Filesystems = filesystems + this.Tags = tags + return &this +} + +// NewInstanceWithDefaults instantiates a new Instance object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewInstanceWithDefaults() *Instance { + this := Instance{} + return &this +} + +// GetId returns the Id field value +func (o *Instance) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *Instance) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *Instance) SetId(v string) { + o.Id = v +} + +// GetName returns the Name field value +func (o *Instance) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *Instance) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *Instance) SetName(v string) { + o.Name = v +} + +// GetType returns the Type field value +func (o *Instance) GetType() string { + if o == nil { + var ret string + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *Instance) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *Instance) SetType(v string) { + o.Type = v +} + +// GetIp returns the Ip field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Instance) GetIp() string { + if o == nil || o.Ip.Get() == nil { + var ret string + return ret + } + + return *o.Ip.Get() +} + +// 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 *Instance) GetIpOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Ip.Get(), o.Ip.IsSet() +} + +// SetIp sets field value +func (o *Instance) SetIp(v string) { + o.Ip.Set(&v) +} + +// GetState returns the State field value +func (o *Instance) GetState() InstanceState { + if o == nil { + var ret InstanceState + return ret + } + + return o.State +} + +// GetStateOk returns a tuple with the State field value +// and a boolean to check if the value has been set. +func (o *Instance) GetStateOk() (*InstanceState, bool) { + if o == nil { + return nil, false + } + return &o.State, true +} + +// SetState sets field value +func (o *Instance) SetState(v InstanceState) { + o.State = v +} + +// GetImage returns the Image field value +func (o *Instance) GetImage() string { + if o == nil { + var ret string + return ret + } + + return o.Image +} + +// GetImageOk returns a tuple with the Image field value +// and a boolean to check if the value has been set. +func (o *Instance) GetImageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Image, true +} + +// SetImage sets field value +func (o *Instance) SetImage(v string) { + o.Image = v +} + +// GetPreemptible returns the Preemptible field value +func (o *Instance) GetPreemptible() bool { + if o == nil { + var ret bool + return ret + } + + return o.Preemptible +} + +// GetPreemptibleOk returns a tuple with the Preemptible field value +// and a boolean to check if the value has been set. +func (o *Instance) GetPreemptibleOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.Preemptible, true +} + +// SetPreemptible sets field value +func (o *Instance) SetPreemptible(v bool) { + o.Preemptible = v +} + +// GetEphemeral returns the Ephemeral field value +func (o *Instance) GetEphemeral() bool { + if o == nil { + var ret bool + return ret + } + + return o.Ephemeral +} + +// GetEphemeralOk returns a tuple with the Ephemeral field value +// and a boolean to check if the value has been set. +func (o *Instance) GetEphemeralOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.Ephemeral, true +} + +// SetEphemeral sets field value +func (o *Instance) SetEphemeral(v bool) { + o.Ephemeral = v +} + +// GetUserData returns the UserData field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Instance) GetUserData() string { + if o == nil || o.UserData.Get() == nil { + var ret string + return ret + } + + return *o.UserData.Get() +} + +// GetUserDataOk returns a tuple with the UserData field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Instance) GetUserDataOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.UserData.Get(), o.UserData.IsSet() +} + +// SetUserData sets field value +func (o *Instance) SetUserData(v string) { + o.UserData.Set(&v) +} + +// GetFilesystems returns the Filesystems field value +func (o *Instance) GetFilesystems() []string { + if o == nil { + var ret []string + return ret + } + + return o.Filesystems +} + +// GetFilesystemsOk returns a tuple with the Filesystems field value +// and a boolean to check if the value has been set. +func (o *Instance) GetFilesystemsOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Filesystems, true +} + +// SetFilesystems sets field value +func (o *Instance) SetFilesystems(v []string) { + o.Filesystems = v +} + +// GetTags returns the Tags field value +func (o *Instance) GetTags() map[string]string { + if o == nil { + var ret map[string]string + return ret + } + + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value +// and a boolean to check if the value has been set. +func (o *Instance) GetTagsOk() (*map[string]string, bool) { + if o == nil { + return nil, false + } + return &o.Tags, true +} + +// SetTags sets field value +func (o *Instance) SetTags(v map[string]string) { + o.Tags = v +} + +func (o Instance) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Instance) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["name"] = o.Name + toSerialize["type"] = o.Type + toSerialize["ip"] = o.Ip.Get() + toSerialize["state"] = o.State + toSerialize["image"] = o.Image + toSerialize["preemptible"] = o.Preemptible + toSerialize["ephemeral"] = o.Ephemeral + toSerialize["userData"] = o.UserData.Get() + toSerialize["filesystems"] = o.Filesystems + toSerialize["tags"] = o.Tags + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Instance) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "id", + "name", + "type", + "ip", + "state", + "image", + "preemptible", + "ephemeral", + "userData", + "filesystems", + "tags", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varInstance := _Instance{} + + err = json.Unmarshal(data, &varInstance) + + if err != nil { + return err + } + + *o = Instance(varInstance) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "name") + delete(additionalProperties, "type") + delete(additionalProperties, "ip") + delete(additionalProperties, "state") + delete(additionalProperties, "image") + delete(additionalProperties, "preemptible") + delete(additionalProperties, "ephemeral") + delete(additionalProperties, "userData") + delete(additionalProperties, "filesystems") + delete(additionalProperties, "tags") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableInstance struct { + value *Instance + isSet bool +} + +func (v NullableInstance) Get() *Instance { + return v.value +} + +func (v *NullableInstance) Set(val *Instance) { + v.value = val + v.isSet = true +} + +func (v NullableInstance) IsSet() bool { + return v.isSet +} + +func (v *NullableInstance) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstance(val *Instance) *NullableInstance { + return &NullableInstance{value: val, isSet: true} +} + +func (v NullableInstance) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstance) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/fluidstack/gen/fluidstack/model_instance_state.go b/internal/fluidstack/gen/fluidstack/model_instance_state.go new file mode 100644 index 0000000..93f6f62 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/model_instance_state.go @@ -0,0 +1,122 @@ +/* +Infrastructure API + +Fluidstack Infrastructure API + +API version: v1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// InstanceState Possible states of a machine instance +type InstanceState string + +// List of InstanceState +const ( + INSTANCE_CREATING InstanceState = "creating" + INSTANCE_STARTING InstanceState = "starting" + INSTANCE_RUNNING InstanceState = "running" + INSTANCE_STOPPING InstanceState = "stopping" + INSTANCE_STOPPED InstanceState = "stopped" + INSTANCE_DELETING InstanceState = "deleting" + INSTANCE_OUT_OF_STOCK InstanceState = "out-of-stock" + INSTANCE_ERROR InstanceState = "error" +) + +// All allowed values of InstanceState enum +var AllowedInstanceStateEnumValues = []InstanceState{ + "creating", + "starting", + "running", + "stopping", + "stopped", + "deleting", + "out-of-stock", + "error", +} + +func (v *InstanceState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := InstanceState(value) + for _, existing := range AllowedInstanceStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid InstanceState", value) +} + +// NewInstanceStateFromValue returns a pointer to a valid InstanceState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewInstanceStateFromValue(v string) (*InstanceState, error) { + ev := InstanceState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for InstanceState: valid values are %v", v, AllowedInstanceStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v InstanceState) IsValid() bool { + for _, existing := range AllowedInstanceStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to InstanceState value +func (v InstanceState) Ptr() *InstanceState { + return &v +} + +type NullableInstanceState struct { + value *InstanceState + isSet bool +} + +func (v NullableInstanceState) Get() *InstanceState { + return v.value +} + +func (v *NullableInstanceState) Set(val *InstanceState) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceState) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceState(val *InstanceState) *NullableInstanceState { + return &NullableInstanceState{value: val, isSet: true} +} + +func (v NullableInstanceState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/fluidstack/gen/fluidstack/model_instance_type.go b/internal/fluidstack/gen/fluidstack/model_instance_type.go new file mode 100644 index 0000000..37c288d --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/model_instance_type.go @@ -0,0 +1,303 @@ +/* +Infrastructure API + +Fluidstack Infrastructure API + +API version: v1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the InstanceType type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InstanceType{} + +// InstanceType Machine instance type +type InstanceType struct { + // Name of the instance type + Name string `json:"name"` + // Number of CPUs the instance type has + Cpu int32 `json:"cpu"` + // Amount of memory the instance type has + Memory string `json:"memory"` + // GPU model the instance type has + GpuModel *string `json:"gpuModel,omitempty"` + // Number of GPUs the instance type has + GpuCount *int32 `json:"gpuCount,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _InstanceType InstanceType + +// NewInstanceType instantiates a new InstanceType object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewInstanceType(name string, cpu int32, memory string) *InstanceType { + this := InstanceType{} + this.Name = name + this.Cpu = cpu + this.Memory = memory + return &this +} + +// NewInstanceTypeWithDefaults instantiates a new InstanceType object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewInstanceTypeWithDefaults() *InstanceType { + this := InstanceType{} + return &this +} + +// GetName returns the Name field value +func (o *InstanceType) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *InstanceType) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *InstanceType) SetName(v string) { + o.Name = v +} + +// GetCpu returns the Cpu field value +func (o *InstanceType) GetCpu() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Cpu +} + +// GetCpuOk returns a tuple with the Cpu field value +// and a boolean to check if the value has been set. +func (o *InstanceType) GetCpuOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Cpu, true +} + +// SetCpu sets field value +func (o *InstanceType) SetCpu(v int32) { + o.Cpu = v +} + +// GetMemory returns the Memory field value +func (o *InstanceType) GetMemory() string { + if o == nil { + var ret string + return ret + } + + return o.Memory +} + +// GetMemoryOk returns a tuple with the Memory field value +// and a boolean to check if the value has been set. +func (o *InstanceType) GetMemoryOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Memory, true +} + +// SetMemory sets field value +func (o *InstanceType) SetMemory(v string) { + o.Memory = v +} + +// GetGpuModel returns the GpuModel field value if set, zero value otherwise. +func (o *InstanceType) GetGpuModel() string { + if o == nil || IsNil(o.GpuModel) { + var ret string + return ret + } + return *o.GpuModel +} + +// GetGpuModelOk returns a tuple with the GpuModel field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstanceType) GetGpuModelOk() (*string, bool) { + if o == nil || IsNil(o.GpuModel) { + return nil, false + } + return o.GpuModel, true +} + +// HasGpuModel returns a boolean if a field has been set. +func (o *InstanceType) HasGpuModel() bool { + if o != nil && !IsNil(o.GpuModel) { + return true + } + + return false +} + +// SetGpuModel gets a reference to the given string and assigns it to the GpuModel field. +func (o *InstanceType) SetGpuModel(v string) { + o.GpuModel = &v +} + +// GetGpuCount returns the GpuCount field value if set, zero value otherwise. +func (o *InstanceType) GetGpuCount() int32 { + if o == nil || IsNil(o.GpuCount) { + var ret int32 + return ret + } + return *o.GpuCount +} + +// GetGpuCountOk returns a tuple with the GpuCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstanceType) GetGpuCountOk() (*int32, bool) { + if o == nil || IsNil(o.GpuCount) { + return nil, false + } + return o.GpuCount, true +} + +// HasGpuCount returns a boolean if a field has been set. +func (o *InstanceType) HasGpuCount() bool { + if o != nil && !IsNil(o.GpuCount) { + return true + } + + return false +} + +// SetGpuCount gets a reference to the given int32 and assigns it to the GpuCount field. +func (o *InstanceType) SetGpuCount(v int32) { + o.GpuCount = &v +} + +func (o InstanceType) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o InstanceType) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + toSerialize["cpu"] = o.Cpu + toSerialize["memory"] = o.Memory + if !IsNil(o.GpuModel) { + toSerialize["gpuModel"] = o.GpuModel + } + if !IsNil(o.GpuCount) { + toSerialize["gpuCount"] = o.GpuCount + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *InstanceType) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "name", + "cpu", + "memory", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varInstanceType := _InstanceType{} + + err = json.Unmarshal(data, &varInstanceType) + + if err != nil { + return err + } + + *o = InstanceType(varInstanceType) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "cpu") + delete(additionalProperties, "memory") + delete(additionalProperties, "gpuModel") + delete(additionalProperties, "gpuCount") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableInstanceType struct { + value *InstanceType + isSet bool +} + +func (v NullableInstanceType) Get() *InstanceType { + return v.value +} + +func (v *NullableInstanceType) Set(val *InstanceType) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceType) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceType(val *InstanceType) *NullableInstanceType { + return &NullableInstanceType{value: val, isSet: true} +} + +func (v NullableInstanceType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/fluidstack/gen/fluidstack/model_instances_post_request.go b/internal/fluidstack/gen/fluidstack/model_instances_post_request.go new file mode 100644 index 0000000..a5fbcee --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/model_instances_post_request.go @@ -0,0 +1,448 @@ +/* +Infrastructure API + +Fluidstack Infrastructure API + +API version: v1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the InstancesPostRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InstancesPostRequest{} + +// InstancesPostRequest POST request for a machine instance +type InstancesPostRequest struct { + // Name of the instance + Name string `json:"name"` + // Instance type + Type string `json:"type"` + // Operating system image for the instance + Image *string `json:"image,omitempty"` + // Whether the instance is preemptible + Preemptible *bool `json:"preemptible,omitempty"` + // Whether the instance is ephemeral + Ephemeral *bool `json:"ephemeral,omitempty"` + // Base64-encoded cloud-init user data for instance initialization + UserData NullableString `json:"userData,omitempty"` + // List of filesystem UUIDs attached to the instance + Filesystems []string `json:"filesystems,omitempty"` + // Tags for the instance. Tag keys must be 1–63 characters, start and end with alphanumerics, and may include `-`, `_`, and `.`. + Tags *map[string]string `json:"tags,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _InstancesPostRequest InstancesPostRequest + +// NewInstancesPostRequest instantiates a new InstancesPostRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewInstancesPostRequest(name string, type_ string) *InstancesPostRequest { + this := InstancesPostRequest{} + this.Name = name + this.Type = type_ + var image string = "image://ubuntu22.04" + this.Image = &image + var preemptible bool = false + this.Preemptible = &preemptible + var ephemeral bool = false + this.Ephemeral = &ephemeral + return &this +} + +// NewInstancesPostRequestWithDefaults instantiates a new InstancesPostRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewInstancesPostRequestWithDefaults() *InstancesPostRequest { + this := InstancesPostRequest{} + var image string = "image://ubuntu22.04" + this.Image = &image + var preemptible bool = false + this.Preemptible = &preemptible + var ephemeral bool = false + this.Ephemeral = &ephemeral + return &this +} + +// GetName returns the Name field value +func (o *InstancesPostRequest) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *InstancesPostRequest) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *InstancesPostRequest) SetName(v string) { + o.Name = v +} + +// GetType returns the Type field value +func (o *InstancesPostRequest) GetType() string { + if o == nil { + var ret string + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *InstancesPostRequest) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *InstancesPostRequest) SetType(v string) { + o.Type = v +} + +// GetImage returns the Image field value if set, zero value otherwise. +func (o *InstancesPostRequest) GetImage() string { + if o == nil || IsNil(o.Image) { + var ret string + return ret + } + return *o.Image +} + +// GetImageOk returns a tuple with the Image field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstancesPostRequest) GetImageOk() (*string, bool) { + if o == nil || IsNil(o.Image) { + return nil, false + } + return o.Image, true +} + +// HasImage returns a boolean if a field has been set. +func (o *InstancesPostRequest) HasImage() bool { + if o != nil && !IsNil(o.Image) { + return true + } + + return false +} + +// SetImage gets a reference to the given string and assigns it to the Image field. +func (o *InstancesPostRequest) SetImage(v string) { + o.Image = &v +} + +// GetPreemptible returns the Preemptible field value if set, zero value otherwise. +func (o *InstancesPostRequest) GetPreemptible() bool { + if o == nil || IsNil(o.Preemptible) { + var ret bool + return ret + } + return *o.Preemptible +} + +// GetPreemptibleOk returns a tuple with the Preemptible field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstancesPostRequest) GetPreemptibleOk() (*bool, bool) { + if o == nil || IsNil(o.Preemptible) { + return nil, false + } + return o.Preemptible, true +} + +// HasPreemptible returns a boolean if a field has been set. +func (o *InstancesPostRequest) HasPreemptible() bool { + if o != nil && !IsNil(o.Preemptible) { + return true + } + + return false +} + +// SetPreemptible gets a reference to the given bool and assigns it to the Preemptible field. +func (o *InstancesPostRequest) SetPreemptible(v bool) { + o.Preemptible = &v +} + +// GetEphemeral returns the Ephemeral field value if set, zero value otherwise. +func (o *InstancesPostRequest) GetEphemeral() bool { + if o == nil || IsNil(o.Ephemeral) { + var ret bool + return ret + } + return *o.Ephemeral +} + +// GetEphemeralOk returns a tuple with the Ephemeral field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstancesPostRequest) GetEphemeralOk() (*bool, bool) { + if o == nil || IsNil(o.Ephemeral) { + return nil, false + } + return o.Ephemeral, true +} + +// HasEphemeral returns a boolean if a field has been set. +func (o *InstancesPostRequest) HasEphemeral() bool { + if o != nil && !IsNil(o.Ephemeral) { + return true + } + + return false +} + +// SetEphemeral gets a reference to the given bool and assigns it to the Ephemeral field. +func (o *InstancesPostRequest) SetEphemeral(v bool) { + o.Ephemeral = &v +} + +// GetUserData returns the UserData field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *InstancesPostRequest) GetUserData() string { + if o == nil || IsNil(o.UserData.Get()) { + var ret string + return ret + } + return *o.UserData.Get() +} + +// GetUserDataOk returns a tuple with the UserData field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *InstancesPostRequest) GetUserDataOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.UserData.Get(), o.UserData.IsSet() +} + +// HasUserData returns a boolean if a field has been set. +func (o *InstancesPostRequest) HasUserData() bool { + if o != nil && o.UserData.IsSet() { + return true + } + + return false +} + +// SetUserData gets a reference to the given NullableString and assigns it to the UserData field. +func (o *InstancesPostRequest) SetUserData(v string) { + o.UserData.Set(&v) +} + +// SetUserDataNil sets the value for UserData to be an explicit nil +func (o *InstancesPostRequest) SetUserDataNil() { + o.UserData.Set(nil) +} + +// UnsetUserData ensures that no value is present for UserData, not even an explicit nil +func (o *InstancesPostRequest) UnsetUserData() { + o.UserData.Unset() +} + +// GetFilesystems returns the Filesystems field value if set, zero value otherwise. +func (o *InstancesPostRequest) GetFilesystems() []string { + if o == nil || IsNil(o.Filesystems) { + var ret []string + return ret + } + return o.Filesystems +} + +// GetFilesystemsOk returns a tuple with the Filesystems field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstancesPostRequest) GetFilesystemsOk() ([]string, bool) { + if o == nil || IsNil(o.Filesystems) { + return nil, false + } + return o.Filesystems, true +} + +// HasFilesystems returns a boolean if a field has been set. +func (o *InstancesPostRequest) HasFilesystems() bool { + if o != nil && !IsNil(o.Filesystems) { + return true + } + + return false +} + +// SetFilesystems gets a reference to the given []string and assigns it to the Filesystems field. +func (o *InstancesPostRequest) SetFilesystems(v []string) { + o.Filesystems = v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *InstancesPostRequest) GetTags() map[string]string { + if o == nil || IsNil(o.Tags) { + var ret map[string]string + return ret + } + return *o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstancesPostRequest) GetTagsOk() (*map[string]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *InstancesPostRequest) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given map[string]string and assigns it to the Tags field. +func (o *InstancesPostRequest) SetTags(v map[string]string) { + o.Tags = &v +} + +func (o InstancesPostRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o InstancesPostRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + toSerialize["type"] = o.Type + if !IsNil(o.Image) { + toSerialize["image"] = o.Image + } + if !IsNil(o.Preemptible) { + toSerialize["preemptible"] = o.Preemptible + } + if !IsNil(o.Ephemeral) { + toSerialize["ephemeral"] = o.Ephemeral + } + if o.UserData.IsSet() { + toSerialize["userData"] = o.UserData.Get() + } + if !IsNil(o.Filesystems) { + toSerialize["filesystems"] = o.Filesystems + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *InstancesPostRequest) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "name", + "type", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varInstancesPostRequest := _InstancesPostRequest{} + + err = json.Unmarshal(data, &varInstancesPostRequest) + + if err != nil { + return err + } + + *o = InstancesPostRequest(varInstancesPostRequest) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "type") + delete(additionalProperties, "image") + delete(additionalProperties, "preemptible") + delete(additionalProperties, "ephemeral") + delete(additionalProperties, "userData") + delete(additionalProperties, "filesystems") + delete(additionalProperties, "tags") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableInstancesPostRequest struct { + value *InstancesPostRequest + isSet bool +} + +func (v NullableInstancesPostRequest) Get() *InstancesPostRequest { + return v.value +} + +func (v *NullableInstancesPostRequest) Set(val *InstancesPostRequest) { + v.value = val + v.isSet = true +} + +func (v NullableInstancesPostRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableInstancesPostRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstancesPostRequest(val *InstancesPostRequest) *NullableInstancesPostRequest { + return &NullableInstancesPostRequest{value: val, isSet: true} +} + +func (v NullableInstancesPostRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstancesPostRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/fluidstack/gen/fluidstack/model_kubernetes_cluster.go b/internal/fluidstack/gen/fluidstack/model_kubernetes_cluster.go new file mode 100644 index 0000000..000a5b3 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/model_kubernetes_cluster.go @@ -0,0 +1,265 @@ +/* +Infrastructure API + +Fluidstack Infrastructure API + +API version: v1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the KubernetesCluster type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &KubernetesCluster{} + +// KubernetesCluster Kubernetes Cluster +type KubernetesCluster struct { + // The unique identifier of the cluster + Id string `json:"id"` + // The cluster name. + Name string `json:"name"` + // The cluster version. + Version string `json:"version"` + // The API server endpoint of the kubernetes cluster + Endpoint *string `json:"endpoint,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _KubernetesCluster KubernetesCluster + +// NewKubernetesCluster instantiates a new KubernetesCluster object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewKubernetesCluster(id string, name string, version string) *KubernetesCluster { + this := KubernetesCluster{} + this.Id = id + this.Name = name + this.Version = version + return &this +} + +// NewKubernetesClusterWithDefaults instantiates a new KubernetesCluster object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewKubernetesClusterWithDefaults() *KubernetesCluster { + this := KubernetesCluster{} + return &this +} + +// GetId returns the Id field value +func (o *KubernetesCluster) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +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 +} + +// GetName returns the Name field value +func (o *KubernetesCluster) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *KubernetesCluster) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *KubernetesCluster) SetName(v string) { + o.Name = v +} + +// GetVersion returns the Version field value +func (o *KubernetesCluster) GetVersion() string { + if o == nil { + var ret string + return ret + } + + return o.Version +} + +// GetVersionOk returns a tuple with the Version field value +// and a boolean to check if the value has been set. +func (o *KubernetesCluster) GetVersionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Version, true +} + +// SetVersion sets field value +func (o *KubernetesCluster) SetVersion(v string) { + o.Version = v +} + +// GetEndpoint returns the Endpoint field value if set, zero value otherwise. +func (o *KubernetesCluster) GetEndpoint() string { + if o == nil || IsNil(o.Endpoint) { + var ret string + return ret + } + return *o.Endpoint +} + +// GetEndpointOk returns a tuple with the Endpoint field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *KubernetesCluster) GetEndpointOk() (*string, bool) { + if o == nil || IsNil(o.Endpoint) { + return nil, false + } + return o.Endpoint, true +} + +// HasEndpoint returns a boolean if a field has been set. +func (o *KubernetesCluster) HasEndpoint() bool { + if o != nil && !IsNil(o.Endpoint) { + return true + } + + return false +} + +// SetEndpoint gets a reference to the given string and assigns it to the Endpoint field. +func (o *KubernetesCluster) SetEndpoint(v string) { + o.Endpoint = &v +} + +func (o KubernetesCluster) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o KubernetesCluster) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["name"] = o.Name + toSerialize["version"] = o.Version + if !IsNil(o.Endpoint) { + toSerialize["endpoint"] = o.Endpoint + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *KubernetesCluster) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "id", + "name", + "version", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varKubernetesCluster := _KubernetesCluster{} + + err = json.Unmarshal(data, &varKubernetesCluster) + + if err != nil { + return err + } + + *o = KubernetesCluster(varKubernetesCluster) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "name") + delete(additionalProperties, "version") + delete(additionalProperties, "endpoint") + o.AdditionalProperties = additionalProperties + } + + return err +} + +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/internal/fluidstack/gen/fluidstack/model_kubernetes_clusters_post_request.go b/internal/fluidstack/gen/fluidstack/model_kubernetes_clusters_post_request.go new file mode 100644 index 0000000..b326fa7 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/model_kubernetes_clusters_post_request.go @@ -0,0 +1,205 @@ +/* +Infrastructure API + +Fluidstack Infrastructure API + +API version: v1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the KubernetesClustersPostRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &KubernetesClustersPostRequest{} + +// KubernetesClustersPostRequest POST request for a kubernetes cluster +type KubernetesClustersPostRequest struct { + // The cluster name. + Name string `json:"name"` + // The cluster version. + Version *string `json:"version,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _KubernetesClustersPostRequest KubernetesClustersPostRequest + +// NewKubernetesClustersPostRequest instantiates a new KubernetesClustersPostRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewKubernetesClustersPostRequest(name string) *KubernetesClustersPostRequest { + this := KubernetesClustersPostRequest{} + this.Name = name + return &this +} + +// NewKubernetesClustersPostRequestWithDefaults instantiates a new KubernetesClustersPostRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewKubernetesClustersPostRequestWithDefaults() *KubernetesClustersPostRequest { + this := KubernetesClustersPostRequest{} + return &this +} + +// GetName returns the Name field value +func (o *KubernetesClustersPostRequest) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *KubernetesClustersPostRequest) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *KubernetesClustersPostRequest) SetName(v string) { + o.Name = v +} + +// GetVersion returns the Version field value if set, zero value otherwise. +func (o *KubernetesClustersPostRequest) GetVersion() string { + if o == nil || IsNil(o.Version) { + var ret string + return ret + } + return *o.Version +} + +// GetVersionOk returns a tuple with the Version field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *KubernetesClustersPostRequest) GetVersionOk() (*string, bool) { + if o == nil || IsNil(o.Version) { + return nil, false + } + return o.Version, true +} + +// HasVersion returns a boolean if a field has been set. +func (o *KubernetesClustersPostRequest) HasVersion() bool { + if o != nil && !IsNil(o.Version) { + return true + } + + return false +} + +// SetVersion gets a reference to the given string and assigns it to the Version field. +func (o *KubernetesClustersPostRequest) SetVersion(v string) { + o.Version = &v +} + +func (o KubernetesClustersPostRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o KubernetesClustersPostRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + if !IsNil(o.Version) { + toSerialize["version"] = o.Version + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *KubernetesClustersPostRequest) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "name", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varKubernetesClustersPostRequest := _KubernetesClustersPostRequest{} + + err = json.Unmarshal(data, &varKubernetesClustersPostRequest) + + if err != nil { + return err + } + + *o = KubernetesClustersPostRequest(varKubernetesClustersPostRequest) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "version") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableKubernetesClustersPostRequest struct { + value *KubernetesClustersPostRequest + isSet bool +} + +func (v NullableKubernetesClustersPostRequest) Get() *KubernetesClustersPostRequest { + return v.value +} + +func (v *NullableKubernetesClustersPostRequest) Set(val *KubernetesClustersPostRequest) { + v.value = val + v.isSet = true +} + +func (v NullableKubernetesClustersPostRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableKubernetesClustersPostRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableKubernetesClustersPostRequest(val *KubernetesClustersPostRequest) *NullableKubernetesClustersPostRequest { + return &NullableKubernetesClustersPostRequest{value: val, isSet: true} +} + +func (v NullableKubernetesClustersPostRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableKubernetesClustersPostRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/fluidstack/gen/fluidstack/model_kubernetes_node.go b/internal/fluidstack/gen/fluidstack/model_kubernetes_node.go new file mode 100644 index 0000000..e2a99a9 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/model_kubernetes_node.go @@ -0,0 +1,431 @@ +/* +Infrastructure API + +Fluidstack Infrastructure API + +API version: v1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the KubernetesNode type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &KubernetesNode{} + +// KubernetesNode Kubernetes Node +type KubernetesNode struct { + // Name of the kubernetes node + Name string `json:"name"` + // Unique identifier of the instance backing the kubernetes node + InstanceID string `json:"instanceID"` + // State of the kubernetes node + State string `json:"state"` + // Version of the kubelet running on the kubernetes node + KubeletVersion string `json:"kubeletVersion"` + // Creation time of the kubernetes node + CreatedAt time.Time `json:"createdAt"` + // Conditions of the kubernetes node + Conditions []KubernetesNodeConditionsInner `json:"conditions"` + Accelerator *Accelerator `json:"accelerator,omitempty"` + // Labels assigned to the kubernetes node + Labels *map[string]string `json:"labels,omitempty"` + // Taints applied to the kubernetes node + Taints []KubernetesNodeTaintsInner `json:"taints,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _KubernetesNode KubernetesNode + +// NewKubernetesNode instantiates a new KubernetesNode object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewKubernetesNode(name string, instanceID string, state string, kubeletVersion string, createdAt time.Time, conditions []KubernetesNodeConditionsInner) *KubernetesNode { + this := KubernetesNode{} + this.Name = name + this.InstanceID = instanceID + this.State = state + this.KubeletVersion = kubeletVersion + this.CreatedAt = createdAt + this.Conditions = conditions + return &this +} + +// NewKubernetesNodeWithDefaults instantiates a new KubernetesNode object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewKubernetesNodeWithDefaults() *KubernetesNode { + this := KubernetesNode{} + return &this +} + +// GetName returns the Name field value +func (o *KubernetesNode) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *KubernetesNode) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *KubernetesNode) SetName(v string) { + o.Name = v +} + +// GetInstanceID returns the InstanceID field value +func (o *KubernetesNode) GetInstanceID() string { + if o == nil { + var ret string + return ret + } + + return o.InstanceID +} + +// GetInstanceIDOk returns a tuple with the InstanceID field value +// and a boolean to check if the value has been set. +func (o *KubernetesNode) GetInstanceIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.InstanceID, true +} + +// SetInstanceID sets field value +func (o *KubernetesNode) SetInstanceID(v string) { + o.InstanceID = v +} + +// GetState returns the State field value +func (o *KubernetesNode) GetState() string { + if o == nil { + var ret string + return ret + } + + return o.State +} + +// GetStateOk returns a tuple with the State field value +// and a boolean to check if the value has been set. +func (o *KubernetesNode) GetStateOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.State, true +} + +// SetState sets field value +func (o *KubernetesNode) SetState(v string) { + o.State = v +} + +// GetKubeletVersion returns the KubeletVersion field value +func (o *KubernetesNode) GetKubeletVersion() string { + if o == nil { + var ret string + return ret + } + + return o.KubeletVersion +} + +// GetKubeletVersionOk returns a tuple with the KubeletVersion field value +// and a boolean to check if the value has been set. +func (o *KubernetesNode) GetKubeletVersionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.KubeletVersion, true +} + +// SetKubeletVersion sets field value +func (o *KubernetesNode) SetKubeletVersion(v string) { + o.KubeletVersion = v +} + +// GetCreatedAt returns the CreatedAt field value +func (o *KubernetesNode) GetCreatedAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value +// and a boolean to check if the value has been set. +func (o *KubernetesNode) GetCreatedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.CreatedAt, true +} + +// SetCreatedAt sets field value +func (o *KubernetesNode) SetCreatedAt(v time.Time) { + o.CreatedAt = v +} + +// GetConditions returns the Conditions field value +func (o *KubernetesNode) GetConditions() []KubernetesNodeConditionsInner { + if o == nil { + var ret []KubernetesNodeConditionsInner + return ret + } + + return o.Conditions +} + +// GetConditionsOk returns a tuple with the Conditions field value +// and a boolean to check if the value has been set. +func (o *KubernetesNode) GetConditionsOk() ([]KubernetesNodeConditionsInner, bool) { + if o == nil { + return nil, false + } + return o.Conditions, true +} + +// SetConditions sets field value +func (o *KubernetesNode) SetConditions(v []KubernetesNodeConditionsInner) { + o.Conditions = v +} + +// GetAccelerator returns the Accelerator field value if set, zero value otherwise. +func (o *KubernetesNode) GetAccelerator() Accelerator { + if o == nil || IsNil(o.Accelerator) { + var ret Accelerator + return ret + } + return *o.Accelerator +} + +// GetAcceleratorOk returns a tuple with the Accelerator field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *KubernetesNode) GetAcceleratorOk() (*Accelerator, bool) { + if o == nil || IsNil(o.Accelerator) { + return nil, false + } + return o.Accelerator, true +} + +// HasAccelerator returns a boolean if a field has been set. +func (o *KubernetesNode) HasAccelerator() bool { + if o != nil && !IsNil(o.Accelerator) { + return true + } + + return false +} + +// SetAccelerator gets a reference to the given Accelerator and assigns it to the Accelerator field. +func (o *KubernetesNode) SetAccelerator(v Accelerator) { + o.Accelerator = &v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *KubernetesNode) GetLabels() map[string]string { + if o == nil || IsNil(o.Labels) { + var ret map[string]string + return ret + } + return *o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *KubernetesNode) GetLabelsOk() (*map[string]string, bool) { + if o == nil || IsNil(o.Labels) { + return nil, false + } + return o.Labels, true +} + +// HasLabels returns a boolean if a field has been set. +func (o *KubernetesNode) HasLabels() bool { + if o != nil && !IsNil(o.Labels) { + return true + } + + return false +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *KubernetesNode) SetLabels(v map[string]string) { + o.Labels = &v +} + +// GetTaints returns the Taints field value if set, zero value otherwise. +func (o *KubernetesNode) GetTaints() []KubernetesNodeTaintsInner { + if o == nil || IsNil(o.Taints) { + var ret []KubernetesNodeTaintsInner + return ret + } + return o.Taints +} + +// GetTaintsOk returns a tuple with the Taints field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *KubernetesNode) GetTaintsOk() ([]KubernetesNodeTaintsInner, bool) { + if o == nil || IsNil(o.Taints) { + return nil, false + } + return o.Taints, true +} + +// HasTaints returns a boolean if a field has been set. +func (o *KubernetesNode) HasTaints() bool { + if o != nil && !IsNil(o.Taints) { + return true + } + + return false +} + +// SetTaints gets a reference to the given []KubernetesNodeTaintsInner and assigns it to the Taints field. +func (o *KubernetesNode) SetTaints(v []KubernetesNodeTaintsInner) { + o.Taints = v +} + +func (o KubernetesNode) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o KubernetesNode) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + toSerialize["instanceID"] = o.InstanceID + toSerialize["state"] = o.State + toSerialize["kubeletVersion"] = o.KubeletVersion + toSerialize["createdAt"] = o.CreatedAt + toSerialize["conditions"] = o.Conditions + if !IsNil(o.Accelerator) { + toSerialize["accelerator"] = o.Accelerator + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + if !IsNil(o.Taints) { + toSerialize["taints"] = o.Taints + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *KubernetesNode) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "name", + "instanceID", + "state", + "kubeletVersion", + "createdAt", + "conditions", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varKubernetesNode := _KubernetesNode{} + + err = json.Unmarshal(data, &varKubernetesNode) + + if err != nil { + return err + } + + *o = KubernetesNode(varKubernetesNode) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "instanceID") + delete(additionalProperties, "state") + delete(additionalProperties, "kubeletVersion") + delete(additionalProperties, "createdAt") + delete(additionalProperties, "conditions") + delete(additionalProperties, "accelerator") + delete(additionalProperties, "labels") + delete(additionalProperties, "taints") + o.AdditionalProperties = additionalProperties + } + + return err +} + +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/internal/fluidstack/gen/fluidstack/model_kubernetes_node_conditions_inner.go b/internal/fluidstack/gen/fluidstack/model_kubernetes_node_conditions_inner.go new file mode 100644 index 0000000..1b831a2 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/model_kubernetes_node_conditions_inner.go @@ -0,0 +1,345 @@ +/* +Infrastructure API + +Fluidstack Infrastructure API + +API version: v1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "time" +) + +// checks if the KubernetesNodeConditionsInner type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &KubernetesNodeConditionsInner{} + +// KubernetesNodeConditionsInner struct for KubernetesNodeConditionsInner +type KubernetesNodeConditionsInner struct { + // Type of the condition + Type *string `json:"type,omitempty"` + // Status of the condition + Status *string `json:"status,omitempty"` + // Last time the condition was updated + LastHeartbeatTime *time.Time `json:"lastHeartbeatTime,omitempty"` + // Last time the condition transitioned from one status to another + LastTransitionTime *time.Time `json:"lastTransitionTime,omitempty"` + // Reason for the condition's last transition + Reason *string `json:"reason,omitempty"` + // Human-readable message indicating details about the condition + Message *string `json:"message,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _KubernetesNodeConditionsInner KubernetesNodeConditionsInner + +// NewKubernetesNodeConditionsInner instantiates a new KubernetesNodeConditionsInner object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewKubernetesNodeConditionsInner() *KubernetesNodeConditionsInner { + this := KubernetesNodeConditionsInner{} + return &this +} + +// NewKubernetesNodeConditionsInnerWithDefaults instantiates a new KubernetesNodeConditionsInner object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewKubernetesNodeConditionsInnerWithDefaults() *KubernetesNodeConditionsInner { + this := KubernetesNodeConditionsInner{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *KubernetesNodeConditionsInner) GetType() string { + if o == nil || IsNil(o.Type) { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *KubernetesNodeConditionsInner) GetTypeOk() (*string, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *KubernetesNodeConditionsInner) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *KubernetesNodeConditionsInner) SetType(v string) { + o.Type = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *KubernetesNodeConditionsInner) GetStatus() string { + if o == nil || IsNil(o.Status) { + var ret string + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *KubernetesNodeConditionsInner) GetStatusOk() (*string, bool) { + if o == nil || IsNil(o.Status) { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *KubernetesNodeConditionsInner) HasStatus() bool { + if o != nil && !IsNil(o.Status) { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *KubernetesNodeConditionsInner) SetStatus(v string) { + o.Status = &v +} + +// GetLastHeartbeatTime returns the LastHeartbeatTime field value if set, zero value otherwise. +func (o *KubernetesNodeConditionsInner) GetLastHeartbeatTime() time.Time { + if o == nil || IsNil(o.LastHeartbeatTime) { + var ret time.Time + return ret + } + return *o.LastHeartbeatTime +} + +// GetLastHeartbeatTimeOk returns a tuple with the LastHeartbeatTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *KubernetesNodeConditionsInner) GetLastHeartbeatTimeOk() (*time.Time, bool) { + if o == nil || IsNil(o.LastHeartbeatTime) { + return nil, false + } + return o.LastHeartbeatTime, true +} + +// HasLastHeartbeatTime returns a boolean if a field has been set. +func (o *KubernetesNodeConditionsInner) HasLastHeartbeatTime() bool { + if o != nil && !IsNil(o.LastHeartbeatTime) { + return true + } + + return false +} + +// SetLastHeartbeatTime gets a reference to the given time.Time and assigns it to the LastHeartbeatTime field. +func (o *KubernetesNodeConditionsInner) SetLastHeartbeatTime(v time.Time) { + o.LastHeartbeatTime = &v +} + +// GetLastTransitionTime returns the LastTransitionTime field value if set, zero value otherwise. +func (o *KubernetesNodeConditionsInner) GetLastTransitionTime() time.Time { + if o == nil || IsNil(o.LastTransitionTime) { + var ret time.Time + return ret + } + return *o.LastTransitionTime +} + +// GetLastTransitionTimeOk returns a tuple with the LastTransitionTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *KubernetesNodeConditionsInner) GetLastTransitionTimeOk() (*time.Time, bool) { + if o == nil || IsNil(o.LastTransitionTime) { + return nil, false + } + return o.LastTransitionTime, true +} + +// HasLastTransitionTime returns a boolean if a field has been set. +func (o *KubernetesNodeConditionsInner) HasLastTransitionTime() bool { + if o != nil && !IsNil(o.LastTransitionTime) { + return true + } + + return false +} + +// SetLastTransitionTime gets a reference to the given time.Time and assigns it to the LastTransitionTime field. +func (o *KubernetesNodeConditionsInner) SetLastTransitionTime(v time.Time) { + o.LastTransitionTime = &v +} + +// GetReason returns the Reason field value if set, zero value otherwise. +func (o *KubernetesNodeConditionsInner) GetReason() string { + if o == nil || IsNil(o.Reason) { + var ret string + return ret + } + return *o.Reason +} + +// GetReasonOk returns a tuple with the Reason field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *KubernetesNodeConditionsInner) GetReasonOk() (*string, bool) { + if o == nil || IsNil(o.Reason) { + return nil, false + } + return o.Reason, true +} + +// HasReason returns a boolean if a field has been set. +func (o *KubernetesNodeConditionsInner) HasReason() bool { + if o != nil && !IsNil(o.Reason) { + return true + } + + return false +} + +// SetReason gets a reference to the given string and assigns it to the Reason field. +func (o *KubernetesNodeConditionsInner) SetReason(v string) { + o.Reason = &v +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *KubernetesNodeConditionsInner) GetMessage() string { + if o == nil || IsNil(o.Message) { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *KubernetesNodeConditionsInner) GetMessageOk() (*string, bool) { + if o == nil || IsNil(o.Message) { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *KubernetesNodeConditionsInner) HasMessage() bool { + if o != nil && !IsNil(o.Message) { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *KubernetesNodeConditionsInner) SetMessage(v string) { + o.Message = &v +} + +func (o KubernetesNodeConditionsInner) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o KubernetesNodeConditionsInner) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + if !IsNil(o.LastHeartbeatTime) { + toSerialize["lastHeartbeatTime"] = o.LastHeartbeatTime + } + if !IsNil(o.LastTransitionTime) { + toSerialize["lastTransitionTime"] = o.LastTransitionTime + } + if !IsNil(o.Reason) { + toSerialize["reason"] = o.Reason + } + if !IsNil(o.Message) { + toSerialize["message"] = o.Message + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *KubernetesNodeConditionsInner) UnmarshalJSON(data []byte) (err error) { + varKubernetesNodeConditionsInner := _KubernetesNodeConditionsInner{} + + err = json.Unmarshal(data, &varKubernetesNodeConditionsInner) + + if err != nil { + return err + } + + *o = KubernetesNodeConditionsInner(varKubernetesNodeConditionsInner) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "type") + delete(additionalProperties, "status") + delete(additionalProperties, "lastHeartbeatTime") + delete(additionalProperties, "lastTransitionTime") + delete(additionalProperties, "reason") + delete(additionalProperties, "message") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableKubernetesNodeConditionsInner struct { + value *KubernetesNodeConditionsInner + isSet bool +} + +func (v NullableKubernetesNodeConditionsInner) Get() *KubernetesNodeConditionsInner { + return v.value +} + +func (v *NullableKubernetesNodeConditionsInner) Set(val *KubernetesNodeConditionsInner) { + v.value = val + v.isSet = true +} + +func (v NullableKubernetesNodeConditionsInner) IsSet() bool { + return v.isSet +} + +func (v *NullableKubernetesNodeConditionsInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableKubernetesNodeConditionsInner(val *KubernetesNodeConditionsInner) *NullableKubernetesNodeConditionsInner { + return &NullableKubernetesNodeConditionsInner{value: val, isSet: true} +} + +func (v NullableKubernetesNodeConditionsInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableKubernetesNodeConditionsInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/fluidstack/gen/fluidstack/model_kubernetes_node_pool.go b/internal/fluidstack/gen/fluidstack/model_kubernetes_node_pool.go new file mode 100644 index 0000000..554a6d7 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/model_kubernetes_node_pool.go @@ -0,0 +1,355 @@ +/* +Infrastructure API + +Fluidstack Infrastructure API + +API version: v1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the KubernetesNodePool type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &KubernetesNodePool{} + +// KubernetesNodePool Kubernetes Node Pool +type KubernetesNodePool struct { + // Unique identifier of the kubernetes node pool + Id string `json:"id"` + // Name of the kubernetes node pool + Name string `json:"name"` + // Name of the kubernetes cluster + Cluster string `json:"cluster"` + // Instance type of the kubernetes node pool + Type string `json:"type"` + // Number of nodes in the kubernetes node pool + Count int32 `json:"count"` + // Version of the kubernetes node pool + Version string `json:"version"` + // List of nodes in the kubernetes node pool + Nodes []KubernetesNode `json:"nodes,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _KubernetesNodePool KubernetesNodePool + +// NewKubernetesNodePool instantiates a new KubernetesNodePool object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewKubernetesNodePool(id string, name string, cluster string, type_ string, count int32, version string) *KubernetesNodePool { + this := KubernetesNodePool{} + this.Id = id + this.Name = name + this.Cluster = cluster + this.Type = type_ + this.Count = count + this.Version = version + return &this +} + +// NewKubernetesNodePoolWithDefaults instantiates a new KubernetesNodePool object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewKubernetesNodePoolWithDefaults() *KubernetesNodePool { + this := KubernetesNodePool{} + return &this +} + +// GetId returns the Id field value +func (o *KubernetesNodePool) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +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 +} + +// GetName returns the Name field value +func (o *KubernetesNodePool) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *KubernetesNodePool) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *KubernetesNodePool) SetName(v string) { + o.Name = v +} + +// GetCluster returns the Cluster field value +func (o *KubernetesNodePool) GetCluster() string { + if o == nil { + var ret string + return ret + } + + return o.Cluster +} + +// GetClusterOk returns a tuple with the Cluster field value +// and a boolean to check if the value has been set. +func (o *KubernetesNodePool) GetClusterOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Cluster, true +} + +// SetCluster sets field value +func (o *KubernetesNodePool) SetCluster(v string) { + o.Cluster = v +} + +// GetType returns the Type field value +func (o *KubernetesNodePool) GetType() string { + if o == nil { + var ret string + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +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 +} + +// GetCount returns the Count field value +func (o *KubernetesNodePool) GetCount() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Count +} + +// GetCountOk returns a tuple with the Count field value +// and a boolean to check if the value has been set. +func (o *KubernetesNodePool) GetCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Count, true +} + +// SetCount sets field value +func (o *KubernetesNodePool) SetCount(v int32) { + o.Count = v +} + +// GetVersion returns the Version field value +func (o *KubernetesNodePool) GetVersion() string { + if o == nil { + var ret string + return ret + } + + return o.Version +} + +// GetVersionOk returns a tuple with the Version field value +// and a boolean to check if the value has been set. +func (o *KubernetesNodePool) GetVersionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Version, true +} + +// SetVersion sets field value +func (o *KubernetesNodePool) SetVersion(v string) { + o.Version = v +} + +// GetNodes returns the Nodes field value if set, zero value otherwise. +func (o *KubernetesNodePool) GetNodes() []KubernetesNode { + if o == nil || IsNil(o.Nodes) { + var ret []KubernetesNode + return ret + } + return o.Nodes +} + +// GetNodesOk returns a tuple with the Nodes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *KubernetesNodePool) GetNodesOk() ([]KubernetesNode, bool) { + if o == nil || IsNil(o.Nodes) { + return nil, false + } + return o.Nodes, true +} + +// HasNodes returns a boolean if a field has been set. +func (o *KubernetesNodePool) HasNodes() bool { + if o != nil && !IsNil(o.Nodes) { + return true + } + + return false +} + +// SetNodes gets a reference to the given []KubernetesNode and assigns it to the Nodes field. +func (o *KubernetesNodePool) SetNodes(v []KubernetesNode) { + o.Nodes = v +} + +func (o KubernetesNodePool) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o KubernetesNodePool) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["name"] = o.Name + toSerialize["cluster"] = o.Cluster + toSerialize["type"] = o.Type + toSerialize["count"] = o.Count + toSerialize["version"] = o.Version + if !IsNil(o.Nodes) { + toSerialize["nodes"] = o.Nodes + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *KubernetesNodePool) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "id", + "name", + "cluster", + "type", + "count", + "version", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varKubernetesNodePool := _KubernetesNodePool{} + + err = json.Unmarshal(data, &varKubernetesNodePool) + + if err != nil { + return err + } + + *o = KubernetesNodePool(varKubernetesNodePool) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "name") + delete(additionalProperties, "cluster") + delete(additionalProperties, "type") + delete(additionalProperties, "count") + delete(additionalProperties, "version") + delete(additionalProperties, "nodes") + o.AdditionalProperties = additionalProperties + } + + return err +} + +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/internal/fluidstack/gen/fluidstack/model_kubernetes_node_pool_post_request.go b/internal/fluidstack/gen/fluidstack/model_kubernetes_node_pool_post_request.go new file mode 100644 index 0000000..3065534 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/model_kubernetes_node_pool_post_request.go @@ -0,0 +1,265 @@ +/* +Infrastructure API + +Fluidstack Infrastructure API + +API version: v1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the KubernetesNodePoolPostRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &KubernetesNodePoolPostRequest{} + +// KubernetesNodePoolPostRequest POST request for a kubernetes node pool +type KubernetesNodePoolPostRequest struct { + // Name of the kubernetes node pool + Name string `json:"name"` + // Instance type of the kubernetes node pool + Type string `json:"type"` + // Number of nodes in the kubernetes node pool + Count int32 `json:"count"` + // Version of the kubernetes node pool + Version *string `json:"version,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _KubernetesNodePoolPostRequest KubernetesNodePoolPostRequest + +// NewKubernetesNodePoolPostRequest instantiates a new KubernetesNodePoolPostRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewKubernetesNodePoolPostRequest(name string, type_ string, count int32) *KubernetesNodePoolPostRequest { + this := KubernetesNodePoolPostRequest{} + this.Name = name + this.Type = type_ + this.Count = count + return &this +} + +// NewKubernetesNodePoolPostRequestWithDefaults instantiates a new KubernetesNodePoolPostRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewKubernetesNodePoolPostRequestWithDefaults() *KubernetesNodePoolPostRequest { + this := KubernetesNodePoolPostRequest{} + return &this +} + +// GetName returns the Name field value +func (o *KubernetesNodePoolPostRequest) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *KubernetesNodePoolPostRequest) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *KubernetesNodePoolPostRequest) SetName(v string) { + o.Name = v +} + +// GetType returns the Type field value +func (o *KubernetesNodePoolPostRequest) GetType() string { + if o == nil { + var ret string + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *KubernetesNodePoolPostRequest) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *KubernetesNodePoolPostRequest) SetType(v string) { + o.Type = v +} + +// GetCount returns the Count field value +func (o *KubernetesNodePoolPostRequest) GetCount() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Count +} + +// GetCountOk returns a tuple with the Count field value +// and a boolean to check if the value has been set. +func (o *KubernetesNodePoolPostRequest) GetCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Count, true +} + +// SetCount sets field value +func (o *KubernetesNodePoolPostRequest) SetCount(v int32) { + o.Count = v +} + +// GetVersion returns the Version field value if set, zero value otherwise. +func (o *KubernetesNodePoolPostRequest) GetVersion() string { + if o == nil || IsNil(o.Version) { + var ret string + return ret + } + return *o.Version +} + +// GetVersionOk returns a tuple with the Version field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *KubernetesNodePoolPostRequest) GetVersionOk() (*string, bool) { + if o == nil || IsNil(o.Version) { + return nil, false + } + return o.Version, true +} + +// HasVersion returns a boolean if a field has been set. +func (o *KubernetesNodePoolPostRequest) HasVersion() bool { + if o != nil && !IsNil(o.Version) { + return true + } + + return false +} + +// SetVersion gets a reference to the given string and assigns it to the Version field. +func (o *KubernetesNodePoolPostRequest) SetVersion(v string) { + o.Version = &v +} + +func (o KubernetesNodePoolPostRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o KubernetesNodePoolPostRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + toSerialize["type"] = o.Type + toSerialize["count"] = o.Count + if !IsNil(o.Version) { + toSerialize["version"] = o.Version + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *KubernetesNodePoolPostRequest) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "name", + "type", + "count", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varKubernetesNodePoolPostRequest := _KubernetesNodePoolPostRequest{} + + err = json.Unmarshal(data, &varKubernetesNodePoolPostRequest) + + if err != nil { + return err + } + + *o = KubernetesNodePoolPostRequest(varKubernetesNodePoolPostRequest) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "type") + delete(additionalProperties, "count") + delete(additionalProperties, "version") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableKubernetesNodePoolPostRequest struct { + value *KubernetesNodePoolPostRequest + isSet bool +} + +func (v NullableKubernetesNodePoolPostRequest) Get() *KubernetesNodePoolPostRequest { + return v.value +} + +func (v *NullableKubernetesNodePoolPostRequest) Set(val *KubernetesNodePoolPostRequest) { + v.value = val + v.isSet = true +} + +func (v NullableKubernetesNodePoolPostRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableKubernetesNodePoolPostRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableKubernetesNodePoolPostRequest(val *KubernetesNodePoolPostRequest) *NullableKubernetesNodePoolPostRequest { + return &NullableKubernetesNodePoolPostRequest{value: val, isSet: true} +} + +func (v NullableKubernetesNodePoolPostRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableKubernetesNodePoolPostRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/fluidstack/gen/fluidstack/model_kubernetes_node_taints_inner.go b/internal/fluidstack/gen/fluidstack/model_kubernetes_node_taints_inner.go new file mode 100644 index 0000000..ff7f755 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/model_kubernetes_node_taints_inner.go @@ -0,0 +1,230 @@ +/* +Infrastructure API + +Fluidstack Infrastructure API + +API version: v1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the KubernetesNodeTaintsInner type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &KubernetesNodeTaintsInner{} + +// KubernetesNodeTaintsInner struct for KubernetesNodeTaintsInner +type KubernetesNodeTaintsInner struct { + // Key of the taint + Key *string `json:"key,omitempty"` + // Value of the taint + Value *string `json:"value,omitempty"` + // Effect of the taint + Effect *string `json:"effect,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _KubernetesNodeTaintsInner KubernetesNodeTaintsInner + +// NewKubernetesNodeTaintsInner instantiates a new KubernetesNodeTaintsInner object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewKubernetesNodeTaintsInner() *KubernetesNodeTaintsInner { + this := KubernetesNodeTaintsInner{} + return &this +} + +// NewKubernetesNodeTaintsInnerWithDefaults instantiates a new KubernetesNodeTaintsInner object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewKubernetesNodeTaintsInnerWithDefaults() *KubernetesNodeTaintsInner { + this := KubernetesNodeTaintsInner{} + return &this +} + +// GetKey returns the Key field value if set, zero value otherwise. +func (o *KubernetesNodeTaintsInner) GetKey() string { + if o == nil || IsNil(o.Key) { + var ret string + return ret + } + return *o.Key +} + +// GetKeyOk returns a tuple with the Key field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *KubernetesNodeTaintsInner) GetKeyOk() (*string, bool) { + if o == nil || IsNil(o.Key) { + return nil, false + } + return o.Key, true +} + +// HasKey returns a boolean if a field has been set. +func (o *KubernetesNodeTaintsInner) HasKey() bool { + if o != nil && !IsNil(o.Key) { + return true + } + + return false +} + +// SetKey gets a reference to the given string and assigns it to the Key field. +func (o *KubernetesNodeTaintsInner) SetKey(v string) { + o.Key = &v +} + +// GetValue returns the Value field value if set, zero value otherwise. +func (o *KubernetesNodeTaintsInner) GetValue() string { + if o == nil || IsNil(o.Value) { + var ret string + return ret + } + return *o.Value +} + +// GetValueOk returns a tuple with the Value field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *KubernetesNodeTaintsInner) GetValueOk() (*string, bool) { + if o == nil || IsNil(o.Value) { + return nil, false + } + return o.Value, true +} + +// HasValue returns a boolean if a field has been set. +func (o *KubernetesNodeTaintsInner) HasValue() bool { + if o != nil && !IsNil(o.Value) { + return true + } + + return false +} + +// SetValue gets a reference to the given string and assigns it to the Value field. +func (o *KubernetesNodeTaintsInner) SetValue(v string) { + o.Value = &v +} + +// GetEffect returns the Effect field value if set, zero value otherwise. +func (o *KubernetesNodeTaintsInner) GetEffect() string { + if o == nil || IsNil(o.Effect) { + var ret string + return ret + } + return *o.Effect +} + +// GetEffectOk returns a tuple with the Effect field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *KubernetesNodeTaintsInner) GetEffectOk() (*string, bool) { + if o == nil || IsNil(o.Effect) { + return nil, false + } + return o.Effect, true +} + +// HasEffect returns a boolean if a field has been set. +func (o *KubernetesNodeTaintsInner) HasEffect() bool { + if o != nil && !IsNil(o.Effect) { + return true + } + + return false +} + +// SetEffect gets a reference to the given string and assigns it to the Effect field. +func (o *KubernetesNodeTaintsInner) SetEffect(v string) { + o.Effect = &v +} + +func (o KubernetesNodeTaintsInner) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o KubernetesNodeTaintsInner) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Key) { + toSerialize["key"] = o.Key + } + if !IsNil(o.Value) { + toSerialize["value"] = o.Value + } + if !IsNil(o.Effect) { + toSerialize["effect"] = o.Effect + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *KubernetesNodeTaintsInner) UnmarshalJSON(data []byte) (err error) { + varKubernetesNodeTaintsInner := _KubernetesNodeTaintsInner{} + + err = json.Unmarshal(data, &varKubernetesNodeTaintsInner) + + if err != nil { + return err + } + + *o = KubernetesNodeTaintsInner(varKubernetesNodeTaintsInner) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "key") + delete(additionalProperties, "value") + delete(additionalProperties, "effect") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableKubernetesNodeTaintsInner struct { + value *KubernetesNodeTaintsInner + isSet bool +} + +func (v NullableKubernetesNodeTaintsInner) Get() *KubernetesNodeTaintsInner { + return v.value +} + +func (v *NullableKubernetesNodeTaintsInner) Set(val *KubernetesNodeTaintsInner) { + v.value = val + v.isSet = true +} + +func (v NullableKubernetesNodeTaintsInner) IsSet() bool { + return v.isSet +} + +func (v *NullableKubernetesNodeTaintsInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableKubernetesNodeTaintsInner(val *KubernetesNodeTaintsInner) *NullableKubernetesNodeTaintsInner { + return &NullableKubernetesNodeTaintsInner{value: val, isSet: true} +} + +func (v NullableKubernetesNodeTaintsInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableKubernetesNodeTaintsInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/fluidstack/gen/fluidstack/model_list_capacity_200_response_inner.go b/internal/fluidstack/gen/fluidstack/model_list_capacity_200_response_inner.go new file mode 100644 index 0000000..2bf600f --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/model_list_capacity_200_response_inner.go @@ -0,0 +1,197 @@ +/* +Infrastructure API + +Fluidstack Infrastructure API + +API version: v1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the ListCapacity200ResponseInner type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListCapacity200ResponseInner{} + +// ListCapacity200ResponseInner struct for ListCapacity200ResponseInner +type ListCapacity200ResponseInner struct { + // Available instance type + Name string `json:"name"` + // Available instance count + Capacity int32 `json:"capacity"` + AdditionalProperties map[string]interface{} +} + +type _ListCapacity200ResponseInner ListCapacity200ResponseInner + +// NewListCapacity200ResponseInner instantiates a new ListCapacity200ResponseInner object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewListCapacity200ResponseInner(name string, capacity int32) *ListCapacity200ResponseInner { + this := ListCapacity200ResponseInner{} + this.Name = name + this.Capacity = capacity + return &this +} + +// NewListCapacity200ResponseInnerWithDefaults instantiates a new ListCapacity200ResponseInner object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewListCapacity200ResponseInnerWithDefaults() *ListCapacity200ResponseInner { + this := ListCapacity200ResponseInner{} + return &this +} + +// GetName returns the Name field value +func (o *ListCapacity200ResponseInner) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *ListCapacity200ResponseInner) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *ListCapacity200ResponseInner) SetName(v string) { + o.Name = v +} + +// GetCapacity returns the Capacity field value +func (o *ListCapacity200ResponseInner) GetCapacity() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Capacity +} + +// GetCapacityOk returns a tuple with the Capacity field value +// and a boolean to check if the value has been set. +func (o *ListCapacity200ResponseInner) GetCapacityOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Capacity, true +} + +// SetCapacity sets field value +func (o *ListCapacity200ResponseInner) SetCapacity(v int32) { + o.Capacity = v +} + +func (o ListCapacity200ResponseInner) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ListCapacity200ResponseInner) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + toSerialize["capacity"] = o.Capacity + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ListCapacity200ResponseInner) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "name", + "capacity", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varListCapacity200ResponseInner := _ListCapacity200ResponseInner{} + + err = json.Unmarshal(data, &varListCapacity200ResponseInner) + + if err != nil { + return err + } + + *o = ListCapacity200ResponseInner(varListCapacity200ResponseInner) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "capacity") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableListCapacity200ResponseInner struct { + value *ListCapacity200ResponseInner + isSet bool +} + +func (v NullableListCapacity200ResponseInner) Get() *ListCapacity200ResponseInner { + return v.value +} + +func (v *NullableListCapacity200ResponseInner) Set(val *ListCapacity200ResponseInner) { + v.value = val + v.isSet = true +} + +func (v NullableListCapacity200ResponseInner) IsSet() bool { + return v.isSet +} + +func (v *NullableListCapacity200ResponseInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListCapacity200ResponseInner(val *ListCapacity200ResponseInner) *NullableListCapacity200ResponseInner { + return &NullableListCapacity200ResponseInner{value: val, isSet: true} +} + +func (v NullableListCapacity200ResponseInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListCapacity200ResponseInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/fluidstack/gen/fluidstack/model_project.go b/internal/fluidstack/gen/fluidstack/model_project.go new file mode 100644 index 0000000..80bed1f --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/model_project.go @@ -0,0 +1,256 @@ +/* +Infrastructure API + +Fluidstack Infrastructure API + +API version: v1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the Project type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Project{} + +// Project Project information +type Project struct { + // Unique identifier of the project + Id string `json:"id"` + // Name of the project + Name string `json:"name"` + State ProjectState `json:"state"` + // Tags for the project + Tags map[string]string `json:"tags"` + AdditionalProperties map[string]interface{} +} + +type _Project Project + +// NewProject instantiates a new Project object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewProject(id string, name string, state ProjectState, tags map[string]string) *Project { + this := Project{} + this.Id = id + this.Name = name + this.State = state + this.Tags = tags + return &this +} + +// NewProjectWithDefaults instantiates a new Project object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewProjectWithDefaults() *Project { + this := Project{} + return &this +} + +// GetId returns the Id field value +func (o *Project) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *Project) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *Project) SetId(v string) { + o.Id = v +} + +// GetName returns the Name field value +func (o *Project) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *Project) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *Project) SetName(v string) { + o.Name = v +} + +// GetState returns the State field value +func (o *Project) GetState() ProjectState { + if o == nil { + var ret ProjectState + return ret + } + + return o.State +} + +// GetStateOk returns a tuple with the State field value +// and a boolean to check if the value has been set. +func (o *Project) GetStateOk() (*ProjectState, bool) { + if o == nil { + return nil, false + } + return &o.State, true +} + +// SetState sets field value +func (o *Project) SetState(v ProjectState) { + o.State = v +} + +// GetTags returns the Tags field value +func (o *Project) GetTags() map[string]string { + if o == nil { + var ret map[string]string + return ret + } + + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value +// and a boolean to check if the value has been set. +func (o *Project) GetTagsOk() (*map[string]string, bool) { + if o == nil { + return nil, false + } + return &o.Tags, true +} + +// SetTags sets field value +func (o *Project) SetTags(v map[string]string) { + o.Tags = v +} + +func (o Project) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Project) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["name"] = o.Name + toSerialize["state"] = o.State + toSerialize["tags"] = o.Tags + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Project) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "id", + "name", + "state", + "tags", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varProject := _Project{} + + err = json.Unmarshal(data, &varProject) + + if err != nil { + return err + } + + *o = Project(varProject) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "name") + delete(additionalProperties, "state") + delete(additionalProperties, "tags") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableProject struct { + value *Project + isSet bool +} + +func (v NullableProject) Get() *Project { + return v.value +} + +func (v *NullableProject) Set(val *Project) { + v.value = val + v.isSet = true +} + +func (v NullableProject) IsSet() bool { + return v.isSet +} + +func (v *NullableProject) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableProject(val *Project) *NullableProject { + return &NullableProject{value: val, isSet: true} +} + +func (v NullableProject) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableProject) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/fluidstack/gen/fluidstack/model_project_state.go b/internal/fluidstack/gen/fluidstack/model_project_state.go new file mode 100644 index 0000000..708a20d --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/model_project_state.go @@ -0,0 +1,110 @@ +/* +Infrastructure API + +Fluidstack Infrastructure API + +API version: v1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// ProjectState Possible states of a project +type ProjectState string + +// List of ProjectState +const ( + PROJECT_ACTIVE ProjectState = "active" + PROJECT_DELETING ProjectState = "deleting" +) + +// All allowed values of ProjectState enum +var AllowedProjectStateEnumValues = []ProjectState{ + "active", + "deleting", +} + +func (v *ProjectState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := ProjectState(value) + for _, existing := range AllowedProjectStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid ProjectState", value) +} + +// NewProjectStateFromValue returns a pointer to a valid ProjectState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewProjectStateFromValue(v string) (*ProjectState, error) { + ev := ProjectState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ProjectState: valid values are %v", v, AllowedProjectStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ProjectState) IsValid() bool { + for _, existing := range AllowedProjectStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ProjectState value +func (v ProjectState) Ptr() *ProjectState { + return &v +} + +type NullableProjectState struct { + value *ProjectState + isSet bool +} + +func (v NullableProjectState) Get() *ProjectState { + return v.value +} + +func (v *NullableProjectState) Set(val *ProjectState) { + v.value = val + v.isSet = true +} + +func (v NullableProjectState) IsSet() bool { + return v.isSet +} + +func (v *NullableProjectState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableProjectState(val *ProjectState) *NullableProjectState { + return &NullableProjectState{value: val, isSet: true} +} + +func (v NullableProjectState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableProjectState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/fluidstack/gen/fluidstack/model_projects_post_request.go b/internal/fluidstack/gen/fluidstack/model_projects_post_request.go new file mode 100644 index 0000000..d0981e1 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/model_projects_post_request.go @@ -0,0 +1,205 @@ +/* +Infrastructure API + +Fluidstack Infrastructure API + +API version: v1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the ProjectsPostRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ProjectsPostRequest{} + +// ProjectsPostRequest POST request for a project +type ProjectsPostRequest struct { + // Name of the project + Name string `json:"name"` + // Tags for the project. Tag keys must be 1–63 characters, start and end with alphanumerics, and may include `-`, `_`, and `.`. + Tags *map[string]string `json:"tags,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ProjectsPostRequest ProjectsPostRequest + +// NewProjectsPostRequest instantiates a new ProjectsPostRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewProjectsPostRequest(name string) *ProjectsPostRequest { + this := ProjectsPostRequest{} + this.Name = name + return &this +} + +// NewProjectsPostRequestWithDefaults instantiates a new ProjectsPostRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewProjectsPostRequestWithDefaults() *ProjectsPostRequest { + this := ProjectsPostRequest{} + return &this +} + +// GetName returns the Name field value +func (o *ProjectsPostRequest) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *ProjectsPostRequest) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *ProjectsPostRequest) SetName(v string) { + o.Name = v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *ProjectsPostRequest) GetTags() map[string]string { + if o == nil || IsNil(o.Tags) { + var ret map[string]string + return ret + } + return *o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectsPostRequest) GetTagsOk() (*map[string]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *ProjectsPostRequest) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given map[string]string and assigns it to the Tags field. +func (o *ProjectsPostRequest) SetTags(v map[string]string) { + o.Tags = &v +} + +func (o ProjectsPostRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ProjectsPostRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ProjectsPostRequest) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "name", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varProjectsPostRequest := _ProjectsPostRequest{} + + err = json.Unmarshal(data, &varProjectsPostRequest) + + if err != nil { + return err + } + + *o = ProjectsPostRequest(varProjectsPostRequest) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "tags") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableProjectsPostRequest struct { + value *ProjectsPostRequest + isSet bool +} + +func (v NullableProjectsPostRequest) Get() *ProjectsPostRequest { + return v.value +} + +func (v *NullableProjectsPostRequest) Set(val *ProjectsPostRequest) { + v.value = val + v.isSet = true +} + +func (v NullableProjectsPostRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableProjectsPostRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableProjectsPostRequest(val *ProjectsPostRequest) *NullableProjectsPostRequest { + return &NullableProjectsPostRequest{value: val, isSet: true} +} + +func (v NullableProjectsPostRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableProjectsPostRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/fluidstack/gen/fluidstack/model_slurm_cluster.go b/internal/fluidstack/gen/fluidstack/model_slurm_cluster.go new file mode 100644 index 0000000..fbf4bfd --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/model_slurm_cluster.go @@ -0,0 +1,265 @@ +/* +Infrastructure API + +Fluidstack Infrastructure API + +API version: v1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the SlurmCluster type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SlurmCluster{} + +// SlurmCluster Slurm Cluster +type SlurmCluster struct { + // Unique identifier of the slurm cluster + Id string `json:"id"` + // Name of the slurm cluster + Name string `json:"name"` + // The cluster version. + Version string `json:"version"` + // Login nodes for the cluster + LoginNodes []SlurmLoginNode `json:"loginNodes,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _SlurmCluster SlurmCluster + +// NewSlurmCluster instantiates a new SlurmCluster object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSlurmCluster(id string, name string, version string) *SlurmCluster { + this := SlurmCluster{} + this.Id = id + this.Name = name + this.Version = version + return &this +} + +// NewSlurmClusterWithDefaults instantiates a new SlurmCluster object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSlurmClusterWithDefaults() *SlurmCluster { + this := SlurmCluster{} + return &this +} + +// GetId returns the Id field value +func (o *SlurmCluster) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *SlurmCluster) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *SlurmCluster) SetId(v string) { + o.Id = v +} + +// GetName returns the Name field value +func (o *SlurmCluster) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *SlurmCluster) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *SlurmCluster) SetName(v string) { + o.Name = v +} + +// GetVersion returns the Version field value +func (o *SlurmCluster) GetVersion() string { + if o == nil { + var ret string + return ret + } + + return o.Version +} + +// GetVersionOk returns a tuple with the Version field value +// and a boolean to check if the value has been set. +func (o *SlurmCluster) GetVersionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Version, true +} + +// SetVersion sets field value +func (o *SlurmCluster) SetVersion(v string) { + o.Version = v +} + +// GetLoginNodes returns the LoginNodes field value if set, zero value otherwise. +func (o *SlurmCluster) GetLoginNodes() []SlurmLoginNode { + if o == nil || IsNil(o.LoginNodes) { + var ret []SlurmLoginNode + return ret + } + return o.LoginNodes +} + +// GetLoginNodesOk returns a tuple with the LoginNodes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SlurmCluster) GetLoginNodesOk() ([]SlurmLoginNode, bool) { + if o == nil || IsNil(o.LoginNodes) { + return nil, false + } + return o.LoginNodes, true +} + +// HasLoginNodes returns a boolean if a field has been set. +func (o *SlurmCluster) HasLoginNodes() bool { + if o != nil && !IsNil(o.LoginNodes) { + return true + } + + return false +} + +// SetLoginNodes gets a reference to the given []SlurmLoginNode and assigns it to the LoginNodes field. +func (o *SlurmCluster) SetLoginNodes(v []SlurmLoginNode) { + o.LoginNodes = v +} + +func (o SlurmCluster) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SlurmCluster) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["name"] = o.Name + toSerialize["version"] = o.Version + if !IsNil(o.LoginNodes) { + toSerialize["loginNodes"] = o.LoginNodes + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *SlurmCluster) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "id", + "name", + "version", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varSlurmCluster := _SlurmCluster{} + + err = json.Unmarshal(data, &varSlurmCluster) + + if err != nil { + return err + } + + *o = SlurmCluster(varSlurmCluster) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "name") + delete(additionalProperties, "version") + delete(additionalProperties, "loginNodes") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableSlurmCluster struct { + value *SlurmCluster + isSet bool +} + +func (v NullableSlurmCluster) Get() *SlurmCluster { + return v.value +} + +func (v *NullableSlurmCluster) Set(val *SlurmCluster) { + v.value = val + v.isSet = true +} + +func (v NullableSlurmCluster) IsSet() bool { + return v.isSet +} + +func (v *NullableSlurmCluster) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSlurmCluster(val *SlurmCluster) *NullableSlurmCluster { + return &NullableSlurmCluster{value: val, isSet: true} +} + +func (v NullableSlurmCluster) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSlurmCluster) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/fluidstack/gen/fluidstack/model_slurm_clusters_post_request.go b/internal/fluidstack/gen/fluidstack/model_slurm_clusters_post_request.go new file mode 100644 index 0000000..afc2095 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/model_slurm_clusters_post_request.go @@ -0,0 +1,205 @@ +/* +Infrastructure API + +Fluidstack Infrastructure API + +API version: v1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the SlurmClustersPostRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SlurmClustersPostRequest{} + +// SlurmClustersPostRequest POST request for a Slurm cluster +type SlurmClustersPostRequest struct { + // The cluster name. + Name string `json:"name"` + // The cluster version. + Version *string `json:"version,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _SlurmClustersPostRequest SlurmClustersPostRequest + +// NewSlurmClustersPostRequest instantiates a new SlurmClustersPostRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSlurmClustersPostRequest(name string) *SlurmClustersPostRequest { + this := SlurmClustersPostRequest{} + this.Name = name + return &this +} + +// NewSlurmClustersPostRequestWithDefaults instantiates a new SlurmClustersPostRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSlurmClustersPostRequestWithDefaults() *SlurmClustersPostRequest { + this := SlurmClustersPostRequest{} + return &this +} + +// GetName returns the Name field value +func (o *SlurmClustersPostRequest) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *SlurmClustersPostRequest) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *SlurmClustersPostRequest) SetName(v string) { + o.Name = v +} + +// GetVersion returns the Version field value if set, zero value otherwise. +func (o *SlurmClustersPostRequest) GetVersion() string { + if o == nil || IsNil(o.Version) { + var ret string + return ret + } + return *o.Version +} + +// GetVersionOk returns a tuple with the Version field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SlurmClustersPostRequest) GetVersionOk() (*string, bool) { + if o == nil || IsNil(o.Version) { + return nil, false + } + return o.Version, true +} + +// HasVersion returns a boolean if a field has been set. +func (o *SlurmClustersPostRequest) HasVersion() bool { + if o != nil && !IsNil(o.Version) { + return true + } + + return false +} + +// SetVersion gets a reference to the given string and assigns it to the Version field. +func (o *SlurmClustersPostRequest) SetVersion(v string) { + o.Version = &v +} + +func (o SlurmClustersPostRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SlurmClustersPostRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + if !IsNil(o.Version) { + toSerialize["version"] = o.Version + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *SlurmClustersPostRequest) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "name", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varSlurmClustersPostRequest := _SlurmClustersPostRequest{} + + err = json.Unmarshal(data, &varSlurmClustersPostRequest) + + if err != nil { + return err + } + + *o = SlurmClustersPostRequest(varSlurmClustersPostRequest) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "version") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableSlurmClustersPostRequest struct { + value *SlurmClustersPostRequest + isSet bool +} + +func (v NullableSlurmClustersPostRequest) Get() *SlurmClustersPostRequest { + return v.value +} + +func (v *NullableSlurmClustersPostRequest) Set(val *SlurmClustersPostRequest) { + v.value = val + v.isSet = true +} + +func (v NullableSlurmClustersPostRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableSlurmClustersPostRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSlurmClustersPostRequest(val *SlurmClustersPostRequest) *NullableSlurmClustersPostRequest { + return &NullableSlurmClustersPostRequest{value: val, isSet: true} +} + +func (v NullableSlurmClustersPostRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSlurmClustersPostRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/fluidstack/gen/fluidstack/model_slurm_login_node.go b/internal/fluidstack/gen/fluidstack/model_slurm_login_node.go new file mode 100644 index 0000000..871d719 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/model_slurm_login_node.go @@ -0,0 +1,205 @@ +/* +Infrastructure API + +Fluidstack Infrastructure API + +API version: v1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the SlurmLoginNode type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SlurmLoginNode{} + +// SlurmLoginNode Slurm Login nNode +type SlurmLoginNode struct { + // Name of the node + Name string `json:"name"` + // Public IP address of the node + PublicIP *string `json:"publicIP,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _SlurmLoginNode SlurmLoginNode + +// NewSlurmLoginNode instantiates a new SlurmLoginNode object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSlurmLoginNode(name string) *SlurmLoginNode { + this := SlurmLoginNode{} + this.Name = name + return &this +} + +// NewSlurmLoginNodeWithDefaults instantiates a new SlurmLoginNode object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSlurmLoginNodeWithDefaults() *SlurmLoginNode { + this := SlurmLoginNode{} + return &this +} + +// GetName returns the Name field value +func (o *SlurmLoginNode) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *SlurmLoginNode) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *SlurmLoginNode) SetName(v string) { + o.Name = v +} + +// GetPublicIP returns the PublicIP field value if set, zero value otherwise. +func (o *SlurmLoginNode) GetPublicIP() string { + if o == nil || IsNil(o.PublicIP) { + var ret string + return ret + } + return *o.PublicIP +} + +// GetPublicIPOk returns a tuple with the PublicIP field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SlurmLoginNode) GetPublicIPOk() (*string, bool) { + if o == nil || IsNil(o.PublicIP) { + return nil, false + } + return o.PublicIP, true +} + +// HasPublicIP returns a boolean if a field has been set. +func (o *SlurmLoginNode) HasPublicIP() bool { + if o != nil && !IsNil(o.PublicIP) { + return true + } + + return false +} + +// SetPublicIP gets a reference to the given string and assigns it to the PublicIP field. +func (o *SlurmLoginNode) SetPublicIP(v string) { + o.PublicIP = &v +} + +func (o SlurmLoginNode) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SlurmLoginNode) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + if !IsNil(o.PublicIP) { + toSerialize["publicIP"] = o.PublicIP + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *SlurmLoginNode) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "name", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varSlurmLoginNode := _SlurmLoginNode{} + + err = json.Unmarshal(data, &varSlurmLoginNode) + + if err != nil { + return err + } + + *o = SlurmLoginNode(varSlurmLoginNode) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "publicIP") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableSlurmLoginNode struct { + value *SlurmLoginNode + isSet bool +} + +func (v NullableSlurmLoginNode) Get() *SlurmLoginNode { + return v.value +} + +func (v *NullableSlurmLoginNode) Set(val *SlurmLoginNode) { + v.value = val + v.isSet = true +} + +func (v NullableSlurmLoginNode) IsSet() bool { + return v.isSet +} + +func (v *NullableSlurmLoginNode) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSlurmLoginNode(val *SlurmLoginNode) *NullableSlurmLoginNode { + return &NullableSlurmLoginNode{value: val, isSet: true} +} + +func (v NullableSlurmLoginNode) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSlurmLoginNode) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/fluidstack/gen/fluidstack/model_slurm_node.go b/internal/fluidstack/gen/fluidstack/model_slurm_node.go new file mode 100644 index 0000000..d90577e --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/model_slurm_node.go @@ -0,0 +1,257 @@ +/* +Infrastructure API + +Fluidstack Infrastructure API + +API version: v1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the SlurmNode type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SlurmNode{} + +// SlurmNode Slurm Node +type SlurmNode struct { + // Name of the node + Name string `json:"name"` + // Unique identifier of the instance backing the node + InstanceID string `json:"instanceID"` + // States of the node + States []string `json:"states"` + // Version of slurmd running on the node + SlurmdVersion string `json:"slurmdVersion"` + AdditionalProperties map[string]interface{} +} + +type _SlurmNode SlurmNode + +// NewSlurmNode instantiates a new SlurmNode object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSlurmNode(name string, instanceID string, states []string, slurmdVersion string) *SlurmNode { + this := SlurmNode{} + this.Name = name + this.InstanceID = instanceID + this.States = states + this.SlurmdVersion = slurmdVersion + return &this +} + +// NewSlurmNodeWithDefaults instantiates a new SlurmNode object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSlurmNodeWithDefaults() *SlurmNode { + this := SlurmNode{} + return &this +} + +// GetName returns the Name field value +func (o *SlurmNode) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *SlurmNode) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *SlurmNode) SetName(v string) { + o.Name = v +} + +// GetInstanceID returns the InstanceID field value +func (o *SlurmNode) GetInstanceID() string { + if o == nil { + var ret string + return ret + } + + return o.InstanceID +} + +// GetInstanceIDOk returns a tuple with the InstanceID field value +// and a boolean to check if the value has been set. +func (o *SlurmNode) GetInstanceIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.InstanceID, true +} + +// SetInstanceID sets field value +func (o *SlurmNode) SetInstanceID(v string) { + o.InstanceID = v +} + +// GetStates returns the States field value +func (o *SlurmNode) GetStates() []string { + if o == nil { + var ret []string + return ret + } + + return o.States +} + +// GetStatesOk returns a tuple with the States field value +// and a boolean to check if the value has been set. +func (o *SlurmNode) GetStatesOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.States, true +} + +// SetStates sets field value +func (o *SlurmNode) SetStates(v []string) { + o.States = v +} + +// GetSlurmdVersion returns the SlurmdVersion field value +func (o *SlurmNode) GetSlurmdVersion() string { + if o == nil { + var ret string + return ret + } + + return o.SlurmdVersion +} + +// GetSlurmdVersionOk returns a tuple with the SlurmdVersion field value +// and a boolean to check if the value has been set. +func (o *SlurmNode) GetSlurmdVersionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.SlurmdVersion, true +} + +// SetSlurmdVersion sets field value +func (o *SlurmNode) SetSlurmdVersion(v string) { + o.SlurmdVersion = v +} + +func (o SlurmNode) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SlurmNode) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + toSerialize["instanceID"] = o.InstanceID + toSerialize["states"] = o.States + toSerialize["slurmdVersion"] = o.SlurmdVersion + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *SlurmNode) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "name", + "instanceID", + "states", + "slurmdVersion", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varSlurmNode := _SlurmNode{} + + err = json.Unmarshal(data, &varSlurmNode) + + if err != nil { + return err + } + + *o = SlurmNode(varSlurmNode) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "instanceID") + delete(additionalProperties, "states") + delete(additionalProperties, "slurmdVersion") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableSlurmNode struct { + value *SlurmNode + isSet bool +} + +func (v NullableSlurmNode) Get() *SlurmNode { + return v.value +} + +func (v *NullableSlurmNode) Set(val *SlurmNode) { + v.value = val + v.isSet = true +} + +func (v NullableSlurmNode) IsSet() bool { + return v.isSet +} + +func (v *NullableSlurmNode) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSlurmNode(val *SlurmNode) *NullableSlurmNode { + return &NullableSlurmNode{value: val, isSet: true} +} + +func (v NullableSlurmNode) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSlurmNode) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/fluidstack/gen/fluidstack/model_slurm_node_pool.go b/internal/fluidstack/gen/fluidstack/model_slurm_node_pool.go new file mode 100644 index 0000000..0ec07d5 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/model_slurm_node_pool.go @@ -0,0 +1,287 @@ +/* +Infrastructure API + +Fluidstack Infrastructure API + +API version: v1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the SlurmNodePool type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SlurmNodePool{} + +// SlurmNodePool Slurm Node Pool +type SlurmNodePool struct { + // Unique identifier of the slurm node pool + Id string `json:"id"` + // Name of the node pool + Name string `json:"name"` + // Instance type of the node pool + Type string `json:"type"` + // Number of nodes in the node pool + Count int32 `json:"count"` + // List of nodes in the node pool + Nodes []SlurmNode `json:"nodes"` + AdditionalProperties map[string]interface{} +} + +type _SlurmNodePool SlurmNodePool + +// NewSlurmNodePool instantiates a new SlurmNodePool object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSlurmNodePool(id string, name string, type_ string, count int32, nodes []SlurmNode) *SlurmNodePool { + this := SlurmNodePool{} + this.Id = id + this.Name = name + this.Type = type_ + this.Count = count + this.Nodes = nodes + return &this +} + +// NewSlurmNodePoolWithDefaults instantiates a new SlurmNodePool object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSlurmNodePoolWithDefaults() *SlurmNodePool { + this := SlurmNodePool{} + return &this +} + +// GetId returns the Id field value +func (o *SlurmNodePool) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *SlurmNodePool) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *SlurmNodePool) SetId(v string) { + o.Id = v +} + +// GetName returns the Name field value +func (o *SlurmNodePool) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *SlurmNodePool) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *SlurmNodePool) SetName(v string) { + o.Name = v +} + +// GetType returns the Type field value +func (o *SlurmNodePool) GetType() string { + if o == nil { + var ret string + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *SlurmNodePool) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *SlurmNodePool) SetType(v string) { + o.Type = v +} + +// GetCount returns the Count field value +func (o *SlurmNodePool) GetCount() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Count +} + +// GetCountOk returns a tuple with the Count field value +// and a boolean to check if the value has been set. +func (o *SlurmNodePool) GetCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Count, true +} + +// SetCount sets field value +func (o *SlurmNodePool) SetCount(v int32) { + o.Count = v +} + +// GetNodes returns the Nodes field value +func (o *SlurmNodePool) GetNodes() []SlurmNode { + if o == nil { + var ret []SlurmNode + return ret + } + + return o.Nodes +} + +// GetNodesOk returns a tuple with the Nodes field value +// and a boolean to check if the value has been set. +func (o *SlurmNodePool) GetNodesOk() ([]SlurmNode, bool) { + if o == nil { + return nil, false + } + return o.Nodes, true +} + +// SetNodes sets field value +func (o *SlurmNodePool) SetNodes(v []SlurmNode) { + o.Nodes = v +} + +func (o SlurmNodePool) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SlurmNodePool) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["name"] = o.Name + toSerialize["type"] = o.Type + toSerialize["count"] = o.Count + toSerialize["nodes"] = o.Nodes + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *SlurmNodePool) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "id", + "name", + "type", + "count", + "nodes", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varSlurmNodePool := _SlurmNodePool{} + + err = json.Unmarshal(data, &varSlurmNodePool) + + if err != nil { + return err + } + + *o = SlurmNodePool(varSlurmNodePool) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "name") + delete(additionalProperties, "type") + delete(additionalProperties, "count") + delete(additionalProperties, "nodes") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableSlurmNodePool struct { + value *SlurmNodePool + isSet bool +} + +func (v NullableSlurmNodePool) Get() *SlurmNodePool { + return v.value +} + +func (v *NullableSlurmNodePool) Set(val *SlurmNodePool) { + v.value = val + v.isSet = true +} + +func (v NullableSlurmNodePool) IsSet() bool { + return v.isSet +} + +func (v *NullableSlurmNodePool) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSlurmNodePool(val *SlurmNodePool) *NullableSlurmNodePool { + return &NullableSlurmNodePool{value: val, isSet: true} +} + +func (v NullableSlurmNodePool) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSlurmNodePool) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/fluidstack/gen/fluidstack/model_slurm_node_pool_post_request.go b/internal/fluidstack/gen/fluidstack/model_slurm_node_pool_post_request.go new file mode 100644 index 0000000..14bbbaa --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/model_slurm_node_pool_post_request.go @@ -0,0 +1,227 @@ +/* +Infrastructure API + +Fluidstack Infrastructure API + +API version: v1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the SlurmNodePoolPostRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SlurmNodePoolPostRequest{} + +// SlurmNodePoolPostRequest POST request for a Slurm node pool +type SlurmNodePoolPostRequest struct { + // Name of the node pool + Name string `json:"name"` + // Instance type of the node pool + Type string `json:"type"` + // Number of nodes in the node pool + Count int32 `json:"count"` + AdditionalProperties map[string]interface{} +} + +type _SlurmNodePoolPostRequest SlurmNodePoolPostRequest + +// NewSlurmNodePoolPostRequest instantiates a new SlurmNodePoolPostRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSlurmNodePoolPostRequest(name string, type_ string, count int32) *SlurmNodePoolPostRequest { + this := SlurmNodePoolPostRequest{} + this.Name = name + this.Type = type_ + this.Count = count + return &this +} + +// NewSlurmNodePoolPostRequestWithDefaults instantiates a new SlurmNodePoolPostRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSlurmNodePoolPostRequestWithDefaults() *SlurmNodePoolPostRequest { + this := SlurmNodePoolPostRequest{} + return &this +} + +// GetName returns the Name field value +func (o *SlurmNodePoolPostRequest) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *SlurmNodePoolPostRequest) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *SlurmNodePoolPostRequest) SetName(v string) { + o.Name = v +} + +// GetType returns the Type field value +func (o *SlurmNodePoolPostRequest) GetType() string { + if o == nil { + var ret string + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *SlurmNodePoolPostRequest) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *SlurmNodePoolPostRequest) SetType(v string) { + o.Type = v +} + +// GetCount returns the Count field value +func (o *SlurmNodePoolPostRequest) GetCount() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Count +} + +// GetCountOk returns a tuple with the Count field value +// and a boolean to check if the value has been set. +func (o *SlurmNodePoolPostRequest) GetCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Count, true +} + +// SetCount sets field value +func (o *SlurmNodePoolPostRequest) SetCount(v int32) { + o.Count = v +} + +func (o SlurmNodePoolPostRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SlurmNodePoolPostRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + toSerialize["type"] = o.Type + toSerialize["count"] = o.Count + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *SlurmNodePoolPostRequest) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "name", + "type", + "count", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varSlurmNodePoolPostRequest := _SlurmNodePoolPostRequest{} + + err = json.Unmarshal(data, &varSlurmNodePoolPostRequest) + + if err != nil { + return err + } + + *o = SlurmNodePoolPostRequest(varSlurmNodePoolPostRequest) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "type") + delete(additionalProperties, "count") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableSlurmNodePoolPostRequest struct { + value *SlurmNodePoolPostRequest + isSet bool +} + +func (v NullableSlurmNodePoolPostRequest) Get() *SlurmNodePoolPostRequest { + return v.value +} + +func (v *NullableSlurmNodePoolPostRequest) Set(val *SlurmNodePoolPostRequest) { + v.value = val + v.isSet = true +} + +func (v NullableSlurmNodePoolPostRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableSlurmNodePoolPostRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSlurmNodePoolPostRequest(val *SlurmNodePoolPostRequest) *NullableSlurmNodePoolPostRequest { + return &NullableSlurmNodePoolPostRequest{value: val, isSet: true} +} + +func (v NullableSlurmNodePoolPostRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSlurmNodePoolPostRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/fluidstack/gen/fluidstack/response.go b/internal/fluidstack/gen/fluidstack/response.go new file mode 100644 index 0000000..2fa6d9a --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/response.go @@ -0,0 +1,47 @@ +/* +Infrastructure API + +Fluidstack Infrastructure API + +API version: v1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +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 APIResponse 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/internal/fluidstack/gen/fluidstack/test/api_capabilities_test.go b/internal/fluidstack/gen/fluidstack/test/api_capabilities_test.go new file mode 100644 index 0000000..9228757 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/test/api_capabilities_test.go @@ -0,0 +1,37 @@ +/* +Infrastructure API + +Testing CapabilitiesAPIService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package openapi + +import ( + "context" + openapiclient "github.com/brevdev/cloud/internal/fluidstack/gen/fluidstack" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "testing" +) + +func Test_openapi_CapabilitiesAPIService(t *testing.T) { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + + t.Run("Test CapabilitiesAPIService ListCapabilities", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.CapabilitiesAPI.ListCapabilities(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + +} diff --git a/internal/fluidstack/gen/fluidstack/test/api_capacity_test.go b/internal/fluidstack/gen/fluidstack/test/api_capacity_test.go new file mode 100644 index 0000000..74100ff --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/test/api_capacity_test.go @@ -0,0 +1,37 @@ +/* +Infrastructure API + +Testing CapacityAPIService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package openapi + +import ( + "context" + openapiclient "github.com/brevdev/cloud/internal/fluidstack/gen/fluidstack" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "testing" +) + +func Test_openapi_CapacityAPIService(t *testing.T) { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + + t.Run("Test CapacityAPIService ListCapacity", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.CapacityAPI.ListCapacity(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + +} diff --git a/internal/fluidstack/gen/fluidstack/test/api_filesystems_test.go b/internal/fluidstack/gen/fluidstack/test/api_filesystems_test.go new file mode 100644 index 0000000..48a2149 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/test/api_filesystems_test.go @@ -0,0 +1,76 @@ +/* +Infrastructure API + +Testing FilesystemsAPIService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package openapi + +import ( + "context" + openapiclient "github.com/brevdev/cloud/internal/fluidstack/gen/fluidstack" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "testing" +) + +func Test_openapi_FilesystemsAPIService(t *testing.T) { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + + t.Run("Test FilesystemsAPIService CreateFilesystem", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.FilesystemsAPI.CreateFilesystem(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test FilesystemsAPIService DeleteFilesystem", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var id string + + httpRes, err := apiClient.FilesystemsAPI.DeleteFilesystem(context.Background(), id).Execute() + + require.Nil(t, err) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test FilesystemsAPIService GetFilesystem", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var id string + + resp, httpRes, err := apiClient.FilesystemsAPI.GetFilesystem(context.Background(), id).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test FilesystemsAPIService ListFilesystems", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.FilesystemsAPI.ListFilesystems(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + +} diff --git a/internal/fluidstack/gen/fluidstack/test/api_instance_types_test.go b/internal/fluidstack/gen/fluidstack/test/api_instance_types_test.go new file mode 100644 index 0000000..279f207 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/test/api_instance_types_test.go @@ -0,0 +1,37 @@ +/* +Infrastructure API + +Testing InstanceTypesAPIService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package openapi + +import ( + "context" + openapiclient "github.com/brevdev/cloud/internal/fluidstack/gen/fluidstack" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "testing" +) + +func Test_openapi_InstanceTypesAPIService(t *testing.T) { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + + t.Run("Test InstanceTypesAPIService ListInstanceTypes", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.InstanceTypesAPI.ListInstanceTypes(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + +} diff --git a/internal/fluidstack/gen/fluidstack/test/api_instances_test.go b/internal/fluidstack/gen/fluidstack/test/api_instances_test.go new file mode 100644 index 0000000..1653ee2 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/test/api_instances_test.go @@ -0,0 +1,102 @@ +/* +Infrastructure API + +Testing InstancesAPIService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package openapi + +import ( + "context" + openapiclient "github.com/brevdev/cloud/internal/fluidstack/gen/fluidstack" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "testing" +) + +func Test_openapi_InstancesAPIService(t *testing.T) { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + + t.Run("Test InstancesAPIService CreateInstance", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.InstancesAPI.CreateInstance(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test InstancesAPIService DeleteInstance", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var id string + + httpRes, err := apiClient.InstancesAPI.DeleteInstance(context.Background(), id).Execute() + + require.Nil(t, err) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test InstancesAPIService GetInstance", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var id string + + resp, httpRes, err := apiClient.InstancesAPI.GetInstance(context.Background(), id).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test InstancesAPIService ListInstances", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.InstancesAPI.ListInstances(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test InstancesAPIService StartInstance", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var id string + + httpRes, err := apiClient.InstancesAPI.StartInstance(context.Background(), id).Execute() + + require.Nil(t, err) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test InstancesAPIService StopInstance", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var id string + + httpRes, err := apiClient.InstancesAPI.StopInstance(context.Background(), id).Execute() + + require.Nil(t, err) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + +} diff --git a/internal/fluidstack/gen/fluidstack/test/api_kubernetes_test.go b/internal/fluidstack/gen/fluidstack/test/api_kubernetes_test.go new file mode 100644 index 0000000..b49480e --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/test/api_kubernetes_test.go @@ -0,0 +1,147 @@ +/* +Infrastructure API + +Testing KubernetesAPIService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package openapi + +import ( + "context" + openapiclient "github.com/brevdev/cloud/internal/fluidstack/gen/fluidstack" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "testing" +) + +func Test_openapi_KubernetesAPIService(t *testing.T) { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + + t.Run("Test KubernetesAPIService CreateKubernetesCluster", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.KubernetesAPI.CreateKubernetesCluster(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test KubernetesAPIService CreateKubernetesNodePool", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var clusterId string + + resp, httpRes, err := apiClient.KubernetesAPI.CreateKubernetesNodePool(context.Background(), clusterId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test KubernetesAPIService DeleteKubernetesCluster", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var id string + + httpRes, err := apiClient.KubernetesAPI.DeleteKubernetesCluster(context.Background(), id).Execute() + + require.Nil(t, err) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test KubernetesAPIService DeleteKubernetesNodePool", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var clusterId string + var nodePoolId string + + httpRes, err := apiClient.KubernetesAPI.DeleteKubernetesNodePool(context.Background(), clusterId, nodePoolId).Execute() + + require.Nil(t, err) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test KubernetesAPIService GetKubernetesCluster", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var id string + + resp, httpRes, err := apiClient.KubernetesAPI.GetKubernetesCluster(context.Background(), id).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test KubernetesAPIService GetKubernetesClusterCredentials", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var clusterId string + + resp, httpRes, err := apiClient.KubernetesAPI.GetKubernetesClusterCredentials(context.Background(), clusterId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test KubernetesAPIService GetKubernetesNodePool", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var clusterId string + var nodePoolId string + + resp, httpRes, err := apiClient.KubernetesAPI.GetKubernetesNodePool(context.Background(), clusterId, nodePoolId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test KubernetesAPIService ListKubernetesClusters", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.KubernetesAPI.ListKubernetesClusters(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test KubernetesAPIService ListKubernetesNodePools", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var clusterId string + + resp, httpRes, err := apiClient.KubernetesAPI.ListKubernetesNodePools(context.Background(), clusterId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + +} diff --git a/internal/fluidstack/gen/fluidstack/test/api_projects_test.go b/internal/fluidstack/gen/fluidstack/test/api_projects_test.go new file mode 100644 index 0000000..fc1a944 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/test/api_projects_test.go @@ -0,0 +1,76 @@ +/* +Infrastructure API + +Testing ProjectsAPIService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package openapi + +import ( + "context" + openapiclient "github.com/brevdev/cloud/internal/fluidstack/gen/fluidstack" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "testing" +) + +func Test_openapi_ProjectsAPIService(t *testing.T) { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + + t.Run("Test ProjectsAPIService CreateProject", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.ProjectsAPI.CreateProject(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test ProjectsAPIService DeleteProject", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var id string + + httpRes, err := apiClient.ProjectsAPI.DeleteProject(context.Background(), id).Execute() + + require.Nil(t, err) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test ProjectsAPIService GetProject", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var id string + + resp, httpRes, err := apiClient.ProjectsAPI.GetProject(context.Background(), id).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test ProjectsAPIService ListProjects", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.ProjectsAPI.ListProjects(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + +} diff --git a/internal/fluidstack/gen/fluidstack/test/api_slurm_test.go b/internal/fluidstack/gen/fluidstack/test/api_slurm_test.go new file mode 100644 index 0000000..ec30af9 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/test/api_slurm_test.go @@ -0,0 +1,133 @@ +/* +Infrastructure API + +Testing SlurmAPIService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package openapi + +import ( + "context" + openapiclient "github.com/brevdev/cloud/internal/fluidstack/gen/fluidstack" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "testing" +) + +func Test_openapi_SlurmAPIService(t *testing.T) { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + + t.Run("Test SlurmAPIService CreateSlurmCluster", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.SlurmAPI.CreateSlurmCluster(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test SlurmAPIService CreateSlurmNodePool", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var clusterId string + + resp, httpRes, err := apiClient.SlurmAPI.CreateSlurmNodePool(context.Background(), clusterId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test SlurmAPIService DeleteSlurmCluster", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var id string + + httpRes, err := apiClient.SlurmAPI.DeleteSlurmCluster(context.Background(), id).Execute() + + require.Nil(t, err) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test SlurmAPIService DeleteSlurmNodePool", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var clusterId string + var nodePoolId string + + httpRes, err := apiClient.SlurmAPI.DeleteSlurmNodePool(context.Background(), clusterId, nodePoolId).Execute() + + require.Nil(t, err) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test SlurmAPIService GetSlurmCluster", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var id string + + resp, httpRes, err := apiClient.SlurmAPI.GetSlurmCluster(context.Background(), id).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test SlurmAPIService GetSlurmNodePool", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var clusterId string + var nodePoolId string + + resp, httpRes, err := apiClient.SlurmAPI.GetSlurmNodePool(context.Background(), clusterId, nodePoolId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test SlurmAPIService ListSlurmClusters", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.SlurmAPI.ListSlurmClusters(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test SlurmAPIService ListSlurmNodePools", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var clusterId string + + resp, httpRes, err := apiClient.SlurmAPI.ListSlurmNodePools(context.Background(), clusterId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + +} diff --git a/internal/fluidstack/gen/fluidstack/utils.go b/internal/fluidstack/gen/fluidstack/utils.go new file mode 100644 index 0000000..593cba2 --- /dev/null +++ b/internal/fluidstack/gen/fluidstack/utils.go @@ -0,0 +1,361 @@ +/* +Infrastructure API + +Fluidstack Infrastructure API + +API version: v1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "bytes" + "encoding/json" + "fmt" + "reflect" + "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 json.Marshal(v.value) +} + +func (v *NullableTime) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// IsNil checks if an input is nil +func IsNil(i interface{}) bool { + if i == nil { + return true + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +} + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// Prevent trying to import "fmt" +func reportError(format string, a ...interface{}) error { + return fmt.Errorf(format, a...) +} diff --git a/internal/fluidstack/v1/capabilities.go b/internal/fluidstack/v1/capabilities.go index d5bd8f5..38c193e 100644 --- a/internal/fluidstack/v1/capabilities.go +++ b/internal/fluidstack/v1/capabilities.go @@ -12,6 +12,7 @@ func (c *FluidStackClient) GetCapabilities(_ context.Context) (v1.Capabilities, v1.CapabilityTerminateInstance, v1.CapabilityStopStartInstance, v1.CapabilityTags, + v1.CapabilityInstanceUserData, } return capabilities, nil diff --git a/internal/fluidstack/v1/client.go b/internal/fluidstack/v1/client.go index 494950d..9b34374 100644 --- a/internal/fluidstack/v1/client.go +++ b/internal/fluidstack/v1/client.go @@ -4,7 +4,9 @@ import ( "context" "crypto/sha256" "fmt" + "net/http" + openapi "github.com/brevdev/cloud/internal/fluidstack/gen/fluidstack" "github.com/brevdev/cloud/pkg/v1" ) @@ -63,18 +65,25 @@ func (c *FluidStackCredential) MakeClient(_ context.Context, _ string) (v1.Cloud // It embeds NotImplCloudClient to handle unsupported features type FluidStackClient struct { v1.NotImplCloudClient - refID string - apiKey string - baseURL string + refID string + apiKey string + baseURL string + projectID string + client *openapi.APIClient } var _ v1.CloudClient = &FluidStackClient{} func NewFluidStackClient(refID, apiKey string) *FluidStackClient { + config := openapi.NewConfiguration() + config.HTTPClient = http.DefaultClient + client := openapi.NewAPIClient(config) + return &FluidStackClient{ refID: refID, apiKey: apiKey, baseURL: "https://api.fluidstack.io/v1alpha1", + client: client, } } @@ -97,3 +106,15 @@ func (c *FluidStackClient) MakeClient(_ context.Context, _ string) (v1.CloudClie func (c *FluidStackClient) GetReferenceID() string { return c.refID } + +func (c *FluidStackClient) makeAuthContext(ctx context.Context) context.Context { + return context.WithValue(ctx, openapi.ContextAccessToken, c.apiKey) +} + +func (c *FluidStackClient) makeProjectContext(ctx context.Context) context.Context { + // FluidStack requires project ID to be passed, but we'll use a default for now + if c.projectID == "" { + c.projectID = "default-project-id" + } + return ctx +} diff --git a/internal/fluidstack/v1/instance.go b/internal/fluidstack/v1/instance.go index 7ce6ee3..cc3c69d 100644 --- a/internal/fluidstack/v1/instance.go +++ b/internal/fluidstack/v1/instance.go @@ -2,24 +2,100 @@ package v1 import ( "context" + "fmt" + openapi "github.com/brevdev/cloud/internal/fluidstack/gen/fluidstack" "github.com/brevdev/cloud/pkg/v1" ) -func (c *FluidStackClient) CreateInstance(_ context.Context, _ v1.CreateInstanceAttrs) (*v1.Instance, error) { - return nil, v1.ErrNotImplemented +func (c *FluidStackClient) CreateInstance(ctx context.Context, attrs v1.CreateInstanceAttrs) (*v1.Instance, error) { + authCtx := c.makeAuthContext(ctx) + projectCtx := c.makeProjectContext(authCtx) + + req := openapi.InstancesPostRequest{ + Name: attrs.Name, + Type: attrs.InstanceType, + } + + if attrs.UserDataBase64 != "" { + req.SetUserData(attrs.UserDataBase64) + } + + if len(attrs.Tags) > 0 { + tags := make(map[string]string) + for k, v := range attrs.Tags { + tags[k] = v + } + req.SetTags(tags) + } + + resp, httpResp, err := c.client.InstancesAPI.CreateInstance(projectCtx).XPROJECTID(c.projectID).InstancesPostRequest(req).Execute() + if httpResp != nil && httpResp.Body != nil { + defer func() { _ = httpResp.Body.Close() }() + } + if err != nil { + return nil, fmt.Errorf("failed to create instance: %w", err) + } + + if resp == nil { + return nil, fmt.Errorf("no instance returned from create request") + } + + return convertFluidStackInstanceToV1Instance(*resp), nil } -func (c *FluidStackClient) GetInstance(_ context.Context, _ v1.CloudProviderInstanceID) (*v1.Instance, error) { - return nil, v1.ErrNotImplemented +func (c *FluidStackClient) GetInstance(ctx context.Context, instanceID v1.CloudProviderInstanceID) (*v1.Instance, error) { + authCtx := c.makeAuthContext(ctx) + projectCtx := c.makeProjectContext(authCtx) + + resp, httpResp, err := c.client.InstancesAPI.GetInstance(projectCtx, string(instanceID)).XPROJECTID(c.projectID).Execute() + if httpResp != nil && httpResp.Body != nil { + defer func() { _ = httpResp.Body.Close() }() + } + if err != nil { + return nil, fmt.Errorf("failed to get instance: %w", err) + } + + if resp == nil { + return nil, fmt.Errorf("no instance returned from get request") + } + + return convertFluidStackInstanceToV1Instance(*resp), nil } -func (c *FluidStackClient) TerminateInstance(_ context.Context, _ v1.CloudProviderInstanceID) error { - return v1.ErrNotImplemented +func (c *FluidStackClient) TerminateInstance(ctx context.Context, instanceID v1.CloudProviderInstanceID) error { + authCtx := c.makeAuthContext(ctx) + projectCtx := c.makeProjectContext(authCtx) + + httpResp, err := c.client.InstancesAPI.DeleteInstance(projectCtx, string(instanceID)).XPROJECTID(c.projectID).Execute() + if httpResp != nil && httpResp.Body != nil { + defer func() { _ = httpResp.Body.Close() }() + } + if err != nil { + return fmt.Errorf("failed to terminate instance: %w", err) + } + + return nil } -func (c *FluidStackClient) ListInstances(_ context.Context, _ v1.ListInstancesArgs) ([]v1.Instance, error) { - return nil, v1.ErrNotImplemented +func (c *FluidStackClient) ListInstances(ctx context.Context, _ v1.ListInstancesArgs) ([]v1.Instance, error) { + authCtx := c.makeAuthContext(ctx) + projectCtx := c.makeProjectContext(authCtx) + + resp, httpResp, err := c.client.InstancesAPI.ListInstances(projectCtx).XPROJECTID(c.projectID).Execute() + if httpResp != nil && httpResp.Body != nil { + defer func() { _ = httpResp.Body.Close() }() + } + if err != nil { + return nil, fmt.Errorf("failed to list instances: %w", err) + } + + var instances []v1.Instance + for _, fsInstance := range resp { + instances = append(instances, *convertFluidStackInstanceToV1Instance(fsInstance)) + } + + return instances, nil } func (c *FluidStackClient) RebootInstance(_ context.Context, _ v1.CloudProviderInstanceID) error { @@ -33,3 +109,46 @@ func (c *FluidStackClient) MergeInstanceForUpdate(currInst v1.Instance, _ v1.Ins func (c *FluidStackClient) MergeInstanceTypeForUpdate(currIt v1.InstanceType, _ v1.InstanceType) v1.InstanceType { return currIt } + +func convertFluidStackInstanceToV1Instance(fsInstance openapi.Instance) *v1.Instance { + var privateIP string + if fsInstance.Ip.IsSet() && fsInstance.Ip.Get() != nil { + privateIP = *fsInstance.Ip.Get() + } + + var lifecycleStatus v1.LifecycleStatus + switch fsInstance.State { + case openapi.INSTANCE_RUNNING: + lifecycleStatus = v1.LifecycleStatusRunning + case openapi.INSTANCE_STOPPED: + lifecycleStatus = v1.LifecycleStatusStopped + case openapi.INSTANCE_STOPPING: + lifecycleStatus = v1.LifecycleStatusStopping + case openapi.INSTANCE_STARTING, openapi.INSTANCE_CREATING: + lifecycleStatus = v1.LifecycleStatusPending + case openapi.INSTANCE_DELETING: + lifecycleStatus = v1.LifecycleStatusTerminating + case openapi.INSTANCE_ERROR: + lifecycleStatus = v1.LifecycleStatusFailed + default: + lifecycleStatus = v1.LifecycleStatusPending + } + + instance := &v1.Instance{ + Name: fsInstance.Name, + CloudID: v1.CloudProviderInstanceID(fsInstance.Id), + InstanceType: fsInstance.Type, + PrivateIP: privateIP, + ImageID: fsInstance.Image, + Status: v1.Status{ + LifecycleStatus: lifecycleStatus, + }, + Tags: make(map[string]string), + } + + for key, value := range fsInstance.Tags { + instance.Tags[key] = value + } + + return instance +} diff --git a/internal/fluidstack/v1/instancetype.go b/internal/fluidstack/v1/instancetype.go index 5c65007..eb2a90f 100644 --- a/internal/fluidstack/v1/instancetype.go +++ b/internal/fluidstack/v1/instancetype.go @@ -2,19 +2,110 @@ package v1 import ( "context" + "fmt" + "strconv" + "strings" "time" + "github.com/alecthomas/units" + "github.com/bojanz/currency" + openapi "github.com/brevdev/cloud/internal/fluidstack/gen/fluidstack" "github.com/brevdev/cloud/pkg/v1" ) -func (c *FluidStackClient) GetInstanceTypes(_ context.Context, _ v1.GetInstanceTypeArgs) ([]v1.InstanceType, error) { - return nil, v1.ErrNotImplemented +func (c *FluidStackClient) GetInstanceTypes(ctx context.Context, _ v1.GetInstanceTypeArgs) ([]v1.InstanceType, error) { + authCtx := c.makeAuthContext(ctx) + projectCtx := c.makeProjectContext(authCtx) + + resp, httpResp, err := c.client.InstanceTypesAPI.ListInstanceTypes(projectCtx).Execute() + if httpResp != nil && httpResp.Body != nil { + defer func() { _ = httpResp.Body.Close() }() + } + if err != nil { + return nil, fmt.Errorf("failed to get instance types: %w", err) + } + + var instanceTypes []v1.InstanceType + for _, fsInstanceType := range resp { + instanceType := convertFluidStackInstanceTypeToV1InstanceType("", fsInstanceType, true) + instanceTypes = append(instanceTypes, instanceType) + } + + return instanceTypes, nil } func (c *FluidStackClient) GetInstanceTypePollTime() time.Duration { return 5 * time.Minute } -func (c *FluidStackClient) GetLocations(_ context.Context, _ v1.GetLocationsArgs) ([]v1.Location, error) { - return nil, v1.ErrNotImplemented +func (c *FluidStackClient) GetLocations(ctx context.Context, _ v1.GetLocationsArgs) ([]v1.Location, error) { + authCtx := c.makeAuthContext(ctx) + projectCtx := c.makeProjectContext(authCtx) + + resp, httpResp, err := c.client.CapacityAPI.ListCapacity(projectCtx).Execute() + if httpResp != nil && httpResp.Body != nil { + defer func() { _ = httpResp.Body.Close() }() + } + if err != nil { + return nil, fmt.Errorf("failed to get locations: %w", err) + } + + var locations []v1.Location + if resp != nil { + for _, capacity := range resp { + location := v1.Location{ + Name: capacity.Name, + Description: capacity.Name, + Available: capacity.Capacity > 0, + } + locations = append(locations, location) + } + } + + return locations, nil +} + +func convertFluidStackInstanceTypeToV1InstanceType(location string, fsInstanceType openapi.InstanceType, isAvailable bool) v1.InstanceType { + var gpus []v1.GPU + + if fsInstanceType.GpuCount != nil && *fsInstanceType.GpuCount > 0 { + count := int(*fsInstanceType.GpuCount) + model := "GPU" + if fsInstanceType.GpuModel != nil { + model = *fsInstanceType.GpuModel + } + + for i := 0; i < count; i++ { + gpus = append(gpus, v1.GPU{ + Name: model, + }) + } + } + + var ram units.Base2Bytes + if fsInstanceType.Memory != "" { + memoryStr := strings.TrimSuffix(fsInstanceType.Memory, "GB") + memoryStr = strings.TrimSpace(memoryStr) + if memoryGB, err := strconv.ParseFloat(memoryStr, 64); err == nil { + ram = units.Base2Bytes(memoryGB) * units.Gibibyte + } + } + + vcpus := fsInstanceType.Cpu + if vcpus < 0 { + vcpus = 0 + } + + price, _ := currency.NewAmount("0", "USD") + + return v1.InstanceType{ + Type: fsInstanceType.Name, + VCPU: vcpus, + Memory: ram, + SupportedGPUs: gpus, + BasePrice: &price, + IsAvailable: isAvailable, + Location: location, + Provider: CloudProviderID, + } }