From 647a5091869946531bb96e1e09b0826ac33d974e Mon Sep 17 00:00:00 2001 From: Ronald Ding Date: Fri, 15 Aug 2025 13:45:27 -0700 Subject: [PATCH 01/12] feat: initial addition of shadeform --- .gitignore | 1 + internal/shadeform/Makefile | 15 + internal/shadeform/gen/shadeform/.gitignore | 24 + .../gen/shadeform/.openapi-generator-ignore | 23 + .../gen/shadeform/.openapi-generator/FILES | 97 + .../gen/shadeform/.openapi-generator/VERSION | 1 + internal/shadeform/gen/shadeform/.travis.yml | 8 + internal/shadeform/gen/shadeform/README.md | 198 ++ .../shadeform/gen/shadeform/api/openapi.yaml | 2711 ++++++++++++++++ .../shadeform/gen/shadeform/api_default.go | 2722 +++++++++++++++++ internal/shadeform/gen/shadeform/client.go | 652 ++++ .../shadeform/gen/shadeform/configuration.go | 218 ++ .../gen/shadeform/docs/AddSshKeyRequest.md | 72 + .../gen/shadeform/docs/AddSshKeyResponse.md | 51 + .../shadeform/gen/shadeform/docs/Alert.md | 82 + .../gen/shadeform/docs/AutoDelete.md | 82 + .../gen/shadeform/docs/Availability.md | 93 + .../shadeform/gen/shadeform/docs/Cloud.md | 61 + .../gen/shadeform/docs/CreateRequest.md | 395 +++ .../gen/shadeform/docs/CreateResponse.md | 51 + .../gen/shadeform/docs/CreateVolumeRequest.md | 114 + .../shadeform/docs/CreateVolumeResponse.md | 51 + .../gen/shadeform/docs/DefaultAPI.md | 1567 ++++++++++ .../gen/shadeform/docs/DockerConfiguration.md | 207 ++ internal/shadeform/gen/shadeform/docs/Env.md | 72 + .../gen/shadeform/docs/FeaturedTemplate.md | 275 ++ .../docs/FeaturedTemplatesResponse.md | 51 + .../shadeform/gen/shadeform/docs/Instance.md | 444 +++ .../shadeform/docs/InstanceConfiguration.md | 224 ++ .../shadeform/docs/InstanceInfoResponse.md | 626 ++++ .../shadeform/docs/InstancePortMappings.md | 82 + .../gen/shadeform/docs/InstanceType.md | 385 +++ .../docs/InstanceTypeConfiguration.md | 224 ++ .../shadeform/docs/InstanceTypesResponse.md | 51 + .../gen/shadeform/docs/InstancesResponse.md | 51 + .../gen/shadeform/docs/LaunchConfiguration.md | 103 + .../gen/shadeform/docs/Networking.md | 56 + .../gen/shadeform/docs/PortMappings.md | 72 + .../gen/shadeform/docs/RegistryCredentials.md | 82 + .../gen/shadeform/docs/ScriptConfiguration.md | 51 + .../shadeform/gen/shadeform/docs/SshKey.md | 114 + .../gen/shadeform/docs/SshKeysResponse.md | 51 + .../shadeform/gen/shadeform/docs/Status.md | 19 + .../shadeform/gen/shadeform/docs/Template.md | 358 +++ .../shadeform/docs/TemplateCreateResponse.md | 51 + .../gen/shadeform/docs/TemplateSaveRequest.md | 285 ++ .../gen/shadeform/docs/TemplatesResponse.md | 51 + .../shadeform/gen/shadeform/docs/UfwRule.md | 200 ++ .../gen/shadeform/docs/UpdateRequest.md | 134 + .../shadeform/gen/shadeform/docs/Volume.md | 240 ++ .../gen/shadeform/docs/VolumeMount.md | 56 + .../gen/shadeform/docs/VolumeMounts.md | 72 + .../gen/shadeform/docs/VolumeTypesInner.md | 135 + .../gen/shadeform/docs/VolumesResponse.md | 51 + .../shadeform/docs/VolumesTypesResponse.md | 51 + internal/shadeform/gen/shadeform/git_push.sh | 57 + .../shadeform/model_add_ssh_key_request.go | 198 ++ .../shadeform/model_add_ssh_key_response.go | 168 + .../shadeform/gen/shadeform/model_alert.go | 193 ++ .../gen/shadeform/model_auto_delete.go | 193 ++ .../gen/shadeform/model_availability.go | 228 ++ .../shadeform/gen/shadeform/model_cloud.go | 159 + .../gen/shadeform/model_create_request.go | 663 ++++ .../gen/shadeform/model_create_response.go | 168 + .../shadeform/model_create_volume_request.go | 257 ++ .../shadeform/model_create_volume_response.go | 168 + .../shadeform/model_docker_configuration.go | 395 +++ internal/shadeform/gen/shadeform/model_env.go | 198 ++ .../gen/shadeform/model_featured_template.go | 493 +++ .../model_featured_templates_response.go | 167 + .../shadeform/gen/shadeform/model_instance.go | 729 +++++ .../shadeform/model_instance_configuration.go | 416 +++ .../shadeform/model_instance_info_response.go | 992 ++++++ .../shadeform/model_instance_port_mappings.go | 191 ++ .../gen/shadeform/model_instance_type.go | 648 ++++ .../model_instance_type_configuration.go | 416 +++ .../model_instance_types_response.go | 167 + .../gen/shadeform/model_instances_response.go | 167 + .../shadeform/model_launch_configuration.go | 242 ++ .../gen/shadeform/model_networking.go | 155 + .../gen/shadeform/model_port_mappings.go | 198 ++ .../shadeform/model_registry_credentials.go | 193 ++ .../shadeform/model_script_configuration.go | 168 + .../shadeform/gen/shadeform/model_ssh_key.go | 258 ++ .../gen/shadeform/model_ssh_keys_response.go | 167 + .../shadeform/gen/shadeform/model_status.go | 117 + .../shadeform/gen/shadeform/model_template.go | 611 ++++ .../model_template_create_response.go | 168 + .../shadeform/model_template_save_request.go | 505 +++ .../gen/shadeform/model_templates_response.go | 167 + .../shadeform/gen/shadeform/model_ufw_rule.go | 351 +++ .../gen/shadeform/model_update_request.go | 267 ++ .../shadeform/gen/shadeform/model_volume.go | 437 +++ .../gen/shadeform/model_volume_mount.go | 155 + .../gen/shadeform/model_volume_mounts.go | 198 ++ .../gen/shadeform/model_volume_types_inner.go | 287 ++ .../gen/shadeform/model_volumes_response.go | 167 + .../shadeform/model_volumes_types_response.go | 167 + internal/shadeform/gen/shadeform/response.go | 48 + .../gen/shadeform/test/api_default_test.go | 317 ++ internal/shadeform/gen/shadeform/utils.go | 362 +++ internal/shadeform/v1/capabilities.go | 18 + internal/shadeform/v1/client.go | 119 + internal/shadeform/v1/configuration.go | 18 + internal/shadeform/v1/instance.go | 204 ++ internal/shadeform/v1/instancetype.go | 164 + internal/shadeform/v1/validation_test.go | 45 + main/main.go | 8 + 108 files changed, 27925 insertions(+) create mode 100644 internal/shadeform/Makefile create mode 100644 internal/shadeform/gen/shadeform/.gitignore create mode 100644 internal/shadeform/gen/shadeform/.openapi-generator-ignore create mode 100644 internal/shadeform/gen/shadeform/.openapi-generator/FILES create mode 100644 internal/shadeform/gen/shadeform/.openapi-generator/VERSION create mode 100644 internal/shadeform/gen/shadeform/.travis.yml create mode 100644 internal/shadeform/gen/shadeform/README.md create mode 100644 internal/shadeform/gen/shadeform/api/openapi.yaml create mode 100644 internal/shadeform/gen/shadeform/api_default.go create mode 100644 internal/shadeform/gen/shadeform/client.go create mode 100644 internal/shadeform/gen/shadeform/configuration.go create mode 100644 internal/shadeform/gen/shadeform/docs/AddSshKeyRequest.md create mode 100644 internal/shadeform/gen/shadeform/docs/AddSshKeyResponse.md create mode 100644 internal/shadeform/gen/shadeform/docs/Alert.md create mode 100644 internal/shadeform/gen/shadeform/docs/AutoDelete.md create mode 100644 internal/shadeform/gen/shadeform/docs/Availability.md create mode 100644 internal/shadeform/gen/shadeform/docs/Cloud.md create mode 100644 internal/shadeform/gen/shadeform/docs/CreateRequest.md create mode 100644 internal/shadeform/gen/shadeform/docs/CreateResponse.md create mode 100644 internal/shadeform/gen/shadeform/docs/CreateVolumeRequest.md create mode 100644 internal/shadeform/gen/shadeform/docs/CreateVolumeResponse.md create mode 100644 internal/shadeform/gen/shadeform/docs/DefaultAPI.md create mode 100644 internal/shadeform/gen/shadeform/docs/DockerConfiguration.md create mode 100644 internal/shadeform/gen/shadeform/docs/Env.md create mode 100644 internal/shadeform/gen/shadeform/docs/FeaturedTemplate.md create mode 100644 internal/shadeform/gen/shadeform/docs/FeaturedTemplatesResponse.md create mode 100644 internal/shadeform/gen/shadeform/docs/Instance.md create mode 100644 internal/shadeform/gen/shadeform/docs/InstanceConfiguration.md create mode 100644 internal/shadeform/gen/shadeform/docs/InstanceInfoResponse.md create mode 100644 internal/shadeform/gen/shadeform/docs/InstancePortMappings.md create mode 100644 internal/shadeform/gen/shadeform/docs/InstanceType.md create mode 100644 internal/shadeform/gen/shadeform/docs/InstanceTypeConfiguration.md create mode 100644 internal/shadeform/gen/shadeform/docs/InstanceTypesResponse.md create mode 100644 internal/shadeform/gen/shadeform/docs/InstancesResponse.md create mode 100644 internal/shadeform/gen/shadeform/docs/LaunchConfiguration.md create mode 100644 internal/shadeform/gen/shadeform/docs/Networking.md create mode 100644 internal/shadeform/gen/shadeform/docs/PortMappings.md create mode 100644 internal/shadeform/gen/shadeform/docs/RegistryCredentials.md create mode 100644 internal/shadeform/gen/shadeform/docs/ScriptConfiguration.md create mode 100644 internal/shadeform/gen/shadeform/docs/SshKey.md create mode 100644 internal/shadeform/gen/shadeform/docs/SshKeysResponse.md create mode 100644 internal/shadeform/gen/shadeform/docs/Status.md create mode 100644 internal/shadeform/gen/shadeform/docs/Template.md create mode 100644 internal/shadeform/gen/shadeform/docs/TemplateCreateResponse.md create mode 100644 internal/shadeform/gen/shadeform/docs/TemplateSaveRequest.md create mode 100644 internal/shadeform/gen/shadeform/docs/TemplatesResponse.md create mode 100644 internal/shadeform/gen/shadeform/docs/UfwRule.md create mode 100644 internal/shadeform/gen/shadeform/docs/UpdateRequest.md create mode 100644 internal/shadeform/gen/shadeform/docs/Volume.md create mode 100644 internal/shadeform/gen/shadeform/docs/VolumeMount.md create mode 100644 internal/shadeform/gen/shadeform/docs/VolumeMounts.md create mode 100644 internal/shadeform/gen/shadeform/docs/VolumeTypesInner.md create mode 100644 internal/shadeform/gen/shadeform/docs/VolumesResponse.md create mode 100644 internal/shadeform/gen/shadeform/docs/VolumesTypesResponse.md create mode 100644 internal/shadeform/gen/shadeform/git_push.sh create mode 100644 internal/shadeform/gen/shadeform/model_add_ssh_key_request.go create mode 100644 internal/shadeform/gen/shadeform/model_add_ssh_key_response.go create mode 100644 internal/shadeform/gen/shadeform/model_alert.go create mode 100644 internal/shadeform/gen/shadeform/model_auto_delete.go create mode 100644 internal/shadeform/gen/shadeform/model_availability.go create mode 100644 internal/shadeform/gen/shadeform/model_cloud.go create mode 100644 internal/shadeform/gen/shadeform/model_create_request.go create mode 100644 internal/shadeform/gen/shadeform/model_create_response.go create mode 100644 internal/shadeform/gen/shadeform/model_create_volume_request.go create mode 100644 internal/shadeform/gen/shadeform/model_create_volume_response.go create mode 100644 internal/shadeform/gen/shadeform/model_docker_configuration.go create mode 100644 internal/shadeform/gen/shadeform/model_env.go create mode 100644 internal/shadeform/gen/shadeform/model_featured_template.go create mode 100644 internal/shadeform/gen/shadeform/model_featured_templates_response.go create mode 100644 internal/shadeform/gen/shadeform/model_instance.go create mode 100644 internal/shadeform/gen/shadeform/model_instance_configuration.go create mode 100644 internal/shadeform/gen/shadeform/model_instance_info_response.go create mode 100644 internal/shadeform/gen/shadeform/model_instance_port_mappings.go create mode 100644 internal/shadeform/gen/shadeform/model_instance_type.go create mode 100644 internal/shadeform/gen/shadeform/model_instance_type_configuration.go create mode 100644 internal/shadeform/gen/shadeform/model_instance_types_response.go create mode 100644 internal/shadeform/gen/shadeform/model_instances_response.go create mode 100644 internal/shadeform/gen/shadeform/model_launch_configuration.go create mode 100644 internal/shadeform/gen/shadeform/model_networking.go create mode 100644 internal/shadeform/gen/shadeform/model_port_mappings.go create mode 100644 internal/shadeform/gen/shadeform/model_registry_credentials.go create mode 100644 internal/shadeform/gen/shadeform/model_script_configuration.go create mode 100644 internal/shadeform/gen/shadeform/model_ssh_key.go create mode 100644 internal/shadeform/gen/shadeform/model_ssh_keys_response.go create mode 100644 internal/shadeform/gen/shadeform/model_status.go create mode 100644 internal/shadeform/gen/shadeform/model_template.go create mode 100644 internal/shadeform/gen/shadeform/model_template_create_response.go create mode 100644 internal/shadeform/gen/shadeform/model_template_save_request.go create mode 100644 internal/shadeform/gen/shadeform/model_templates_response.go create mode 100644 internal/shadeform/gen/shadeform/model_ufw_rule.go create mode 100644 internal/shadeform/gen/shadeform/model_update_request.go create mode 100644 internal/shadeform/gen/shadeform/model_volume.go create mode 100644 internal/shadeform/gen/shadeform/model_volume_mount.go create mode 100644 internal/shadeform/gen/shadeform/model_volume_mounts.go create mode 100644 internal/shadeform/gen/shadeform/model_volume_types_inner.go create mode 100644 internal/shadeform/gen/shadeform/model_volumes_response.go create mode 100644 internal/shadeform/gen/shadeform/model_volumes_types_response.go create mode 100644 internal/shadeform/gen/shadeform/response.go create mode 100644 internal/shadeform/gen/shadeform/test/api_default_test.go create mode 100644 internal/shadeform/gen/shadeform/utils.go create mode 100644 internal/shadeform/v1/capabilities.go create mode 100644 internal/shadeform/v1/client.go create mode 100644 internal/shadeform/v1/configuration.go create mode 100644 internal/shadeform/v1/instance.go create mode 100644 internal/shadeform/v1/instancetype.go create mode 100644 internal/shadeform/v1/validation_test.go create mode 100644 main/main.go diff --git a/.gitignore b/.gitignore index 024618b8..d4eeaaca 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .env __debug_bin* +.idea/* diff --git a/internal/shadeform/Makefile b/internal/shadeform/Makefile new file mode 100644 index 00000000..6544745a --- /dev/null +++ b/internal/shadeform/Makefile @@ -0,0 +1,15 @@ +generate-shadeform-client: + docker run --rm -v "${PWD}:/local" -v "/Users/ronald/shade/docs:/docs" openapitools/openapi-generator-cli:v7.8.0 generate \ + --additional-properties disallowAdditionalPropertiesIfNotPresent=false \ + -i /docs/openapi.yaml \ + -g go \ + --git-user-id shadeform \ + --git-repo-id cloud-shadeform \ + -o /local/gen/shadeform + sudo chown -R $(shell id -u):$(shell id -g) gen/shadeform + gofmt -s -w gen/shadeform + rm -rf gen/shadeform/go.mod gen/shadeform/go.sum + + +validate-shadeform-openapi: + docker run --rm -v ${PWD}:/local -v "/Users/ronald/shade/docs:/docs" openapitools/openapi-generator-cli:v7.8.0 validate -i /docs/openapi.yaml diff --git a/internal/shadeform/gen/shadeform/.gitignore b/internal/shadeform/gen/shadeform/.gitignore new file mode 100644 index 00000000..daf913b1 --- /dev/null +++ b/internal/shadeform/gen/shadeform/.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/shadeform/gen/shadeform/.openapi-generator-ignore b/internal/shadeform/gen/shadeform/.openapi-generator-ignore new file mode 100644 index 00000000..7484ee59 --- /dev/null +++ b/internal/shadeform/gen/shadeform/.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/shadeform/gen/shadeform/.openapi-generator/FILES b/internal/shadeform/gen/shadeform/.openapi-generator/FILES new file mode 100644 index 00000000..0c2bd54a --- /dev/null +++ b/internal/shadeform/gen/shadeform/.openapi-generator/FILES @@ -0,0 +1,97 @@ +.gitignore +.travis.yml +README.md +api/openapi.yaml +api_default.go +client.go +configuration.go +docs/AddSshKeyRequest.md +docs/AddSshKeyResponse.md +docs/Alert.md +docs/AutoDelete.md +docs/Availability.md +docs/Cloud.md +docs/CreateRequest.md +docs/CreateResponse.md +docs/CreateVolumeRequest.md +docs/CreateVolumeResponse.md +docs/DefaultAPI.md +docs/DockerConfiguration.md +docs/Env.md +docs/FeaturedTemplate.md +docs/FeaturedTemplatesResponse.md +docs/Instance.md +docs/InstanceConfiguration.md +docs/InstanceInfoResponse.md +docs/InstancePortMappings.md +docs/InstanceType.md +docs/InstanceTypeConfiguration.md +docs/InstanceTypesResponse.md +docs/InstancesResponse.md +docs/LaunchConfiguration.md +docs/Networking.md +docs/PortMappings.md +docs/RegistryCredentials.md +docs/ScriptConfiguration.md +docs/SshKey.md +docs/SshKeysResponse.md +docs/Status.md +docs/Template.md +docs/TemplateCreateResponse.md +docs/TemplateSaveRequest.md +docs/TemplatesResponse.md +docs/UfwRule.md +docs/UpdateRequest.md +docs/Volume.md +docs/VolumeMount.md +docs/VolumeMounts.md +docs/VolumeTypesInner.md +docs/VolumesResponse.md +docs/VolumesTypesResponse.md +git_push.sh +go.mod +go.sum +model_add_ssh_key_request.go +model_add_ssh_key_response.go +model_alert.go +model_auto_delete.go +model_availability.go +model_cloud.go +model_create_request.go +model_create_response.go +model_create_volume_request.go +model_create_volume_response.go +model_docker_configuration.go +model_env.go +model_featured_template.go +model_featured_templates_response.go +model_instance.go +model_instance_configuration.go +model_instance_info_response.go +model_instance_port_mappings.go +model_instance_type.go +model_instance_type_configuration.go +model_instance_types_response.go +model_instances_response.go +model_launch_configuration.go +model_networking.go +model_port_mappings.go +model_registry_credentials.go +model_script_configuration.go +model_ssh_key.go +model_ssh_keys_response.go +model_status.go +model_template.go +model_template_create_response.go +model_template_save_request.go +model_templates_response.go +model_ufw_rule.go +model_update_request.go +model_volume.go +model_volume_mount.go +model_volume_mounts.go +model_volume_types_inner.go +model_volumes_response.go +model_volumes_types_response.go +response.go +utils.go diff --git a/internal/shadeform/gen/shadeform/.openapi-generator/VERSION b/internal/shadeform/gen/shadeform/.openapi-generator/VERSION new file mode 100644 index 00000000..09a6d308 --- /dev/null +++ b/internal/shadeform/gen/shadeform/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.8.0 diff --git a/internal/shadeform/gen/shadeform/.travis.yml b/internal/shadeform/gen/shadeform/.travis.yml new file mode 100644 index 00000000..f5cb2ce9 --- /dev/null +++ b/internal/shadeform/gen/shadeform/.travis.yml @@ -0,0 +1,8 @@ +language: go + +install: + - go get -d -v . + +script: + - go build -v ./ + diff --git a/internal/shadeform/gen/shadeform/README.md b/internal/shadeform/gen/shadeform/README.md new file mode 100644 index 00000000..a66d5ce4 --- /dev/null +++ b/internal/shadeform/gen/shadeform/README.md @@ -0,0 +1,198 @@ +# Go API client for openapi + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +## 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: 1.0.0 +- Package version: 1.0.0 +- Generator version: 7.8.0 +- Build package: org.openapitools.codegen.languages.GoClientCodegen +For more information, please visit [https://www.shadeform.ai](https://www.shadeform.ai) + +## 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/shadeform/cloud-shadeform" +``` + +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://api.shadeform.ai/v1* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*DefaultAPI* | [**Instances**](docs/DefaultAPI.md#instances) | **Get** /instances | /instances +*DefaultAPI* | [**InstancesCreate**](docs/DefaultAPI.md#instancescreate) | **Post** /instances/create | /instances/create +*DefaultAPI* | [**InstancesDelete**](docs/DefaultAPI.md#instancesdelete) | **Post** /instances/{id}/delete | /instances/{id}/delete +*DefaultAPI* | [**InstancesInfo**](docs/DefaultAPI.md#instancesinfo) | **Get** /instances/{id}/info | /instances/{id}/info +*DefaultAPI* | [**InstancesRestart**](docs/DefaultAPI.md#instancesrestart) | **Post** /instances/{id}/restart | /instances/{id}/restart +*DefaultAPI* | [**InstancesTypes**](docs/DefaultAPI.md#instancestypes) | **Get** /instances/types | /instances/types +*DefaultAPI* | [**InstancesUpdate**](docs/DefaultAPI.md#instancesupdate) | **Post** /instances/{id}/update | /instances/{id}/update +*DefaultAPI* | [**SshKeys**](docs/DefaultAPI.md#sshkeys) | **Get** /sshkeys | /sshkeys +*DefaultAPI* | [**SshKeysAdd**](docs/DefaultAPI.md#sshkeysadd) | **Post** /sshkeys/add | /sshkeys/add +*DefaultAPI* | [**SshKeysDelete**](docs/DefaultAPI.md#sshkeysdelete) | **Post** /sshkeys/{id}/delete | /sshkeys/{id}/delete +*DefaultAPI* | [**SshKeysInfo**](docs/DefaultAPI.md#sshkeysinfo) | **Get** /sshkeys/{id}/info | /sshkeys/{id}/info +*DefaultAPI* | [**SshKeysSetDefault**](docs/DefaultAPI.md#sshkeyssetdefault) | **Post** /sshkeys/{id}/setdefault | /sshkeys/{id}/setdefault +*DefaultAPI* | [**Templates**](docs/DefaultAPI.md#templates) | **Get** /templates | /templates +*DefaultAPI* | [**TemplatesDelete**](docs/DefaultAPI.md#templatesdelete) | **Post** /templates/{template_id}/delete | /templates/{template_id}/delete +*DefaultAPI* | [**TemplatesFeatured**](docs/DefaultAPI.md#templatesfeatured) | **Get** /templates/featured | /templates/featured +*DefaultAPI* | [**TemplatesInfo**](docs/DefaultAPI.md#templatesinfo) | **Get** /templates/{template_id}/info | /templates/{template_id}/info +*DefaultAPI* | [**TemplatesSave**](docs/DefaultAPI.md#templatessave) | **Post** /templates/save | /templates/save +*DefaultAPI* | [**TemplatesUpdate**](docs/DefaultAPI.md#templatesupdate) | **Post** /templates/{template_id}/update | /templates/{template_id}/update +*DefaultAPI* | [**Volumes**](docs/DefaultAPI.md#volumes) | **Get** /volumes | /volumes +*DefaultAPI* | [**VolumesCreate**](docs/DefaultAPI.md#volumescreate) | **Post** /volumes/create | /volumes/create +*DefaultAPI* | [**VolumesDelete**](docs/DefaultAPI.md#volumesdelete) | **Post** /volumes/{id}/delete | /volumes/{id}/delete +*DefaultAPI* | [**VolumesInfo**](docs/DefaultAPI.md#volumesinfo) | **Get** /volumes/{id}/info | /volumes/{id}/info +*DefaultAPI* | [**VolumesTypes**](docs/DefaultAPI.md#volumestypes) | **Get** /volumes/types | /volumes/types + + +## Documentation For Models + + - [AddSshKeyRequest](docs/AddSshKeyRequest.md) + - [AddSshKeyResponse](docs/AddSshKeyResponse.md) + - [Alert](docs/Alert.md) + - [AutoDelete](docs/AutoDelete.md) + - [Availability](docs/Availability.md) + - [Cloud](docs/Cloud.md) + - [CreateRequest](docs/CreateRequest.md) + - [CreateResponse](docs/CreateResponse.md) + - [CreateVolumeRequest](docs/CreateVolumeRequest.md) + - [CreateVolumeResponse](docs/CreateVolumeResponse.md) + - [DockerConfiguration](docs/DockerConfiguration.md) + - [Env](docs/Env.md) + - [FeaturedTemplate](docs/FeaturedTemplate.md) + - [FeaturedTemplatesResponse](docs/FeaturedTemplatesResponse.md) + - [Instance](docs/Instance.md) + - [InstanceConfiguration](docs/InstanceConfiguration.md) + - [InstanceInfoResponse](docs/InstanceInfoResponse.md) + - [InstancePortMappings](docs/InstancePortMappings.md) + - [InstanceType](docs/InstanceType.md) + - [InstanceTypeConfiguration](docs/InstanceTypeConfiguration.md) + - [InstanceTypesResponse](docs/InstanceTypesResponse.md) + - [InstancesResponse](docs/InstancesResponse.md) + - [LaunchConfiguration](docs/LaunchConfiguration.md) + - [Networking](docs/Networking.md) + - [PortMappings](docs/PortMappings.md) + - [RegistryCredentials](docs/RegistryCredentials.md) + - [ScriptConfiguration](docs/ScriptConfiguration.md) + - [SshKey](docs/SshKey.md) + - [SshKeysResponse](docs/SshKeysResponse.md) + - [Status](docs/Status.md) + - [Template](docs/Template.md) + - [TemplateCreateResponse](docs/TemplateCreateResponse.md) + - [TemplateSaveRequest](docs/TemplateSaveRequest.md) + - [TemplatesResponse](docs/TemplatesResponse.md) + - [UfwRule](docs/UfwRule.md) + - [UpdateRequest](docs/UpdateRequest.md) + - [Volume](docs/Volume.md) + - [VolumeMount](docs/VolumeMount.md) + - [VolumeMounts](docs/VolumeMounts.md) + - [VolumeTypesInner](docs/VolumeTypesInner.md) + - [VolumesResponse](docs/VolumesResponse.md) + - [VolumesTypesResponse](docs/VolumesTypesResponse.md) + + +## Documentation For Authorization + + +Authentication schemes defined for the API: +### ApiKeyAuth + +- **Type**: API key +- **API key parameter name**: X-API-KEY +- **Location**: HTTP header + +Note, each API key must be added to a map of `map[string]APIKey` where the key is: X-API-KEY and passed in as the auth context for each request. + +Example + +```go +auth := context.WithValue( + context.Background(), + openapi.ContextAPIKeys, + map[string]openapi.APIKey{ + "X-API-KEY": {Key: "API_KEY_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 + +support@shadeform.ai + diff --git a/internal/shadeform/gen/shadeform/api/openapi.yaml b/internal/shadeform/gen/shadeform/api/openapi.yaml new file mode 100644 index 00000000..3c592586 --- /dev/null +++ b/internal/shadeform/gen/shadeform/api/openapi.yaml @@ -0,0 +1,2711 @@ +openapi: 3.0.0 +info: + contact: + email: support@shadeform.ai + name: Shadeform + url: https://www.shadeform.ai + description: Shadeform is a single API and platform for deploying and managing cloud + GPUs. + title: Shadeform API + version: 1.0.0 +servers: +- description: Shadeform Production + url: https://api.shadeform.ai/v1 +security: +- ApiKeyAuth: [] +paths: + /instances: + get: + description: Get active and pending instances. + operationId: Instances + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/InstancesResponse' + description: Returns an InstancesResponse object. + summary: /instances + /instances/types: + get: + description: Return all the GPU instance types with their corresponding availability + and specs. + operationId: InstancesTypes + parameters: + - description: Filter the instance type results by cloud. + example: aws + explode: true + in: query + name: cloud + required: false + schema: + type: string + style: form + - description: Filter the instance type results by region. + example: us-east-1a + explode: true + in: query + name: region + required: false + schema: + type: string + style: form + - description: Filter the instance type results by the number of gpus. + example: 1 + explode: true + in: query + name: num_gpus + required: false + schema: + type: string + style: form + - description: Filter the instance type results by gpu type. + example: A100_80G + explode: true + in: query + name: gpu_type + required: false + schema: + type: string + style: form + - description: Filter the instance type results by the shade instance type. + example: A100_80G + explode: true + in: query + name: shade_instance_type + required: false + schema: + type: string + style: form + - description: Filter the instance type results by availability. + example: true + explode: true + in: query + name: available + required: false + schema: + type: boolean + style: form + - description: Sort the order of the instance type results. + example: price + explode: true + in: query + name: sort + required: false + schema: + enum: + - price + type: string + style: form + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/InstanceTypesResponse' + description: Returns an InstanceTypesResponse object + summary: /instances/types + /instances/create: + post: + description: "Create a new GPU instance. Our create API is designed to be asynchronous,\ + \ so the response will be a CreateResponse object with a status of \"creating\"\ + . We then have a process that will pick it up and create it. You can poll\ + \ the /instances/{id}/info endpoint to check the status of the instance." + operationId: InstancesCreate + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateRequest' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/CreateResponse' + description: Returns a CreateResponse object + summary: /instances/create + /instances/{id}/info: + get: + description: Get details for the specified instance in the url. + operationId: InstancesInfo + parameters: + - description: The instance id + example: d290f1ee-6c54-4b01-90e6-d701748f0851 + explode: false + in: path + name: id + required: true + schema: + minimum: 1 + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/InstanceInfoResponse' + description: Return an instance object. + summary: "/instances/{id}/info" + /instances/{id}/update: + post: + description: Update mutable details about the instance. Set a value to null + to delete it. Omit a value or leave undefined to keep unchanged. + operationId: InstancesUpdate + parameters: + - description: The instance id + example: d290f1ee-6c54-4b01-90e6-d701748f0851 + explode: false + in: path + name: id + required: true + schema: + minimum: 1 + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateRequest' + responses: + "200": + description: Confirms the update of an instance. + summary: "/instances/{id}/update" + /instances/{id}/delete: + post: + description: Delete an instance. Some cloud providers may only allow deletion + of an instance after it has moved to the 'active' status. + operationId: InstancesDelete + parameters: + - description: The instance id + example: d290f1ee-6c54-4b01-90e6-d701748f0851 + explode: false + in: path + name: id + required: true + schema: + minimum: 1 + type: string + style: simple + responses: + "200": + description: Confirms the deletion of an instance. + summary: "/instances/{id}/delete" + /instances/{id}/restart: + post: + description: "Restart an instance. The status of the instance will stay as 'active'\ + \ throughout, but you may have to wait a few minutes for the instance to be\ + \ ready to use again." + operationId: InstancesRestart + parameters: + - description: The instance id + example: d290f1ee-6c54-4b01-90e6-d701748f0851 + explode: false + in: path + name: id + required: true + schema: + minimum: 1 + type: string + style: simple + responses: + "200": + description: Confirms the restart of an instance has been initiated. This + does not confirm that the instance restarted successfully. + summary: "/instances/{id}/restart" + /sshkeys: + get: + description: Get all SSH Keys for the account. + operationId: SshKeys + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/SshKeysResponse' + description: Returns an SSHKeysResponse object + summary: /sshkeys + /sshkeys/add: + post: + description: Add a new SSH Key + operationId: SshKeysAdd + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AddSshKeyRequest' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/AddSshKeyResponse' + description: Returns a AddSshKeyResponse object + summary: /sshkeys/add + /sshkeys/{id}/delete: + post: + description: "Delete an ssh key. The Shadeform managed SSH Key, current default\ + \ ssh key, and in use SSH Keys cannot be deleted." + operationId: SshKeysDelete + parameters: + - description: The ssh key id + example: d290f1ee-6c54-4b01-90e6-d701748f0851 + explode: false + in: path + name: id + required: true + schema: + minimum: 1 + type: string + style: simple + responses: + "200": + description: Confirms the deletion of an ssh key. + summary: "/sshkeys/{id}/delete" + /sshkeys/{id}/info: + get: + description: Get details for the specified SSH Key in the url. + operationId: SshKeysInfo + parameters: + - description: The ssh key id + example: d290f1ee-6c54-4b01-90e6-d701748f0851 + explode: false + in: path + name: id + required: true + schema: + minimum: 1 + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/SshKey' + description: Return an SshKey object. + summary: "/sshkeys/{id}/info" + /sshkeys/{id}/setdefault: + post: + description: Set the specified SSH Key as the default SSH Key used by Shadeform. + operationId: SshKeysSetDefault + parameters: + - description: The ssh key id + example: d290f1ee-6c54-4b01-90e6-d701748f0851 + explode: false + in: path + name: id + required: true + schema: + minimum: 1 + type: string + style: simple + responses: + "200": + description: Confirms that the specified SSH Key was as set as the default + key. + summary: "/sshkeys/{id}/setdefault" + /volumes: + get: + description: Get all storage volumes for the account. + operationId: Volumes + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/VolumesResponse' + description: Returns an VolumesResponse object + summary: /volumes + /volumes/create: + post: + description: Create a new storage volume + operationId: VolumesCreate + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateVolumeRequest' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/CreateVolumeResponse' + description: Returns a CreateVolumeResponse object + summary: /volumes/create + /volumes/{id}/delete: + post: + description: Delete a storage volume. + operationId: VolumesDelete + parameters: + - description: The volume id. + example: d290f1ee-6c54-4b01-90e6-d701748f0851 + explode: false + in: path + name: id + required: true + schema: + minimum: 1 + type: string + style: simple + responses: + "200": + description: Confirms the deletion of the specified storage volume. + summary: "/volumes/{id}/delete" + /volumes/{id}/info: + get: + description: Get details for the specified storage volume. + operationId: VolumesInfo + parameters: + - description: The volume id. + example: d290f1ee-6c54-4b01-90e6-d701748f0851 + explode: false + in: path + name: id + required: true + schema: + minimum: 1 + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Volume' + description: Return a volume object. + summary: "/volumes/{id}/info" + /volumes/types: + get: + description: Get list of supported storage volumes. + operationId: VolumesTypes + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/VolumesTypesResponse' + description: Returns an VolumesTypesResponse object. + summary: /volumes/types + /templates: + get: + description: List all templates created by the user + operationId: Templates + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/TemplatesResponse' + description: Returns a list of templates + summary: /templates + /templates/featured: + get: + description: List featured templates + operationId: TemplatesFeatured + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/TemplatesResponse' + description: Returns a list of featured templates + summary: /templates/featured + /templates/{template_id}/info: + get: + description: Get information about a specific template + operationId: TemplatesInfo + parameters: + - description: The template ID + explode: false + in: path + name: template_id + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Template' + description: Returns template information + summary: "/templates/{template_id}/info" + /templates/save: + post: + description: Create a new template + operationId: TemplatesSave + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TemplateSaveRequest' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/TemplateCreateResponse' + description: Returns a TemplateCreateResponse object + summary: /templates/save + /templates/{template_id}/update: + post: + description: Update an existing template + operationId: TemplatesUpdate + parameters: + - description: The template ID + explode: false + in: path + name: template_id + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TemplateSaveRequest' + required: true + responses: + "200": + description: Template updated successfully + summary: "/templates/{template_id}/update" + /templates/{template_id}/delete: + post: + description: Delete a template + operationId: TemplatesDelete + parameters: + - description: The template ID + explode: false + in: path + name: template_id + required: true + schema: + type: string + style: simple + responses: + "200": + description: Template deleted successfully + summary: "/templates/{template_id}/delete" +components: + schemas: + InstanceTypesResponse: + description: Response of /instances/types + example: + instance_types: + - nvlink: true + configuration: + nvlink: true + num_gpus: 1 + gpu_type: A100 + memory_in_gb: 12 + vram_per_gpu_in_gb: 48 + vcpus: 6 + storage_in_gb: 256 + interconnect: pcie + os_options: + - ubuntu22.04_cuda12.2_shade_os + - ubuntu20.04_cuda12.0_shade_os + num_gpus: 1 + gpu_type: A100 + cloud_instance_type: gpu_1x_a6000 + memory_in_gb: 12 + availability: + - region: us-central-1 + available: true + display_name: "US, Wichita, KS" + - region: us-central-2 + available: false + display_name: "US, Wichita, KS" + vcpus: 6 + interconnect: pcie + shade_instance_type: A6000 + cloud: hyperstack + hourly_price: 210 + deployment_type: vm + boot_time: + min_boot_in_sec: 180 + max_boot_in_sec: 300 + storage_in_gb: 256 + - nvlink: true + configuration: + nvlink: true + num_gpus: 1 + gpu_type: A100 + memory_in_gb: 12 + vram_per_gpu_in_gb: 48 + vcpus: 6 + storage_in_gb: 256 + interconnect: pcie + os_options: + - ubuntu22.04_cuda12.2_shade_os + - ubuntu20.04_cuda12.0_shade_os + num_gpus: 1 + gpu_type: A100 + cloud_instance_type: gpu_1x_a6000 + memory_in_gb: 12 + availability: + - region: us-central-1 + available: true + display_name: "US, Wichita, KS" + - region: us-central-2 + available: false + display_name: "US, Wichita, KS" + vcpus: 6 + interconnect: pcie + shade_instance_type: A6000 + cloud: hyperstack + hourly_price: 210 + deployment_type: vm + boot_time: + min_boot_in_sec: 180 + max_boot_in_sec: 300 + storage_in_gb: 256 + properties: + instance_types: + items: + $ref: '#/components/schemas/InstanceType' + type: array + required: + - instance_types + type: object + InstanceType: + description: Information about a specific instance type + example: + nvlink: true + configuration: + nvlink: true + num_gpus: 1 + gpu_type: A100 + memory_in_gb: 12 + vram_per_gpu_in_gb: 48 + vcpus: 6 + storage_in_gb: 256 + interconnect: pcie + os_options: + - ubuntu22.04_cuda12.2_shade_os + - ubuntu20.04_cuda12.0_shade_os + num_gpus: 1 + gpu_type: A100 + cloud_instance_type: gpu_1x_a6000 + memory_in_gb: 12 + availability: + - region: us-central-1 + available: true + display_name: "US, Wichita, KS" + - region: us-central-2 + available: false + display_name: "US, Wichita, KS" + vcpus: 6 + interconnect: pcie + shade_instance_type: A6000 + cloud: hyperstack + hourly_price: 210 + deployment_type: vm + boot_time: + min_boot_in_sec: 180 + max_boot_in_sec: 300 + storage_in_gb: 256 + properties: + cloud: + $ref: '#/components/schemas/Cloud' + shade_instance_type: + description: "The Shadeform standardized instance type. See this [explanation](/getting-started/concepts#shade-instance-type-and-cloud-instance-type)\ + \ for more details." + example: A6000 + type: string + cloud_instance_type: + description: "The instance type for the underlying cloud provider. See this\ + \ [explanation](/getting-started/concepts#shade-instance-type-and-cloud-instance-type)\ + \ for more details." + example: gpu_1x_a6000 + type: string + configuration: + $ref: '#/components/schemas/InstanceTypeConfiguration' + hourly_price: + description: The hourly price of the instance in cents. + example: 210 + type: integer + deployment_type: + description: "Whether the instance is a \"vm\" (virtual machine), a \"container\"\ + \ (docker container), or \"baremetal\" (bare metal server)." + example: vm + type: string + availability: + example: + - region: us-central-1 + available: true + display_name: "US, Wichita, KS" + - region: us-central-2 + available: false + display_name: "US, Wichita, KS" + items: + $ref: '#/components/schemas/Availability' + type: array + boot_time: + example: + min_boot_in_sec: 180 + max_boot_in_sec: 300 + type: object + memory_in_gb: + description: The amount of memory for the instance in gigabytes. Note that + this is not VRAM which is determined by GPU type and the number of GPUs. + example: 12 + type: integer + storage_in_gb: + description: "The amount of storage for the instance. If this storage is\ + \ too low for the instance type, please email support@shadeform.ai as\ + \ the storage may be adjustable." + example: 256 + type: integer + vcpus: + description: The number of vCPUs for the instance. + example: 6 + type: integer + num_gpus: + description: The number of GPUs for the instance. + example: 1 + type: integer + gpu_type: + description: The type of GPU for the instance. + example: A100 + type: string + interconnect: + description: The type of GPU interconnect. + example: pcie + type: string + nvlink: + description: If the instance has NVLink + example: true + type: boolean + required: + - availability + - cloud + - cloud_instance_type + - configuration + - deployment_type + - hourly_price + - shade_instance_type + type: object + InstancesResponse: + example: + instances: + - ssh_port: 22 + configuration: + nvlink: true + os: ubuntu_22_shade_os + num_gpus: 1 + gpu_type: A100 + memory_in_gb: 12 + vram_per_gpu_in_gb: 48 + vcpus: 6 + storage_in_gb: 256 + interconnect: pcie + launch_configuration: + docker_configuration: + args: --model mistralai/Mistral-7B-v0.1 + shared_memory_in_gb: 8 + image: vllm/vllm-openai:latest + port_mappings: + - container_port: 8000 + host_port: 80 + - container_port: 8000 + host_port: 80 + registry_credentials: + password: password + username: username + envs: + - name: HUGGING_FACE_HUB_TOKEN + value: hugging_face_api_token + - name: HUGGING_FACE_HUB_TOKEN + value: hugging_face_api_token + volume_mounts: + - host_path: "~/.cache/huggingface" + container_path: /root/.cache/huggingface + - host_path: "~/.cache/huggingface" + container_path: /root/.cache/huggingface + script_configuration: + base64_script: IyEvYmluL2Jhc2gKCiMgRW5kbGVzcyBsb29wCndoaWxlIHRydWUKZG8KICAgICMgRmV0Y2ggYSBjYXQgZmFjdCB3aXRoIGEgbWF4aW11bSBsZW5ndGggb2YgMTQwIGNoYXJhY3RlcnMKICAgIGN1cmwgLS1uby1wcm9ncmVzcy1tZXRlciBodHRwczovL2NhdGZhY3QubmluamEvZmFjdD9tYXhfbGVuZ3RoPTE0MAoKICAgICMgUHJpbnQgYSBuZXdsaW5lIGZvciByZWFkYWJpbGl0eQogICAgZWNobwoKICAgICMgU2xlZXAgZm9yIDMgc2Vjb25kcyBiZWZvcmUgdGhlIG5leHQgaXRlcmF0aW9uCiAgICBzbGVlcCAzCmRvbmUKCgo= + type: docker + cloud_instance_type: gpu_1x_a6000 + ip: 1.0.0.1 + created_at: 2016-08-29T09:12:33.001Z + cloud_assigned_id: 13b057d7-e266-4869-985f-760fe75a78b3 + deleted_at: 2016-08-29T09:12:33.001Z + shade_cloud: true + shade_instance_type: A6000 + cloud: hyperstack + hourly_price: 210 + cost_estimate: "103.4" + port_mappings: + - external_port: 80 + internal_port: 8000 + - external_port: 80 + internal_port: 8000 + name: cool-gpu-server + id: d290f1ee-6c54-4b01-90e6-d701748f0851 + region: canada-1 + ssh_user: shadeform + status: active + - ssh_port: 22 + configuration: + nvlink: true + os: ubuntu_22_shade_os + num_gpus: 1 + gpu_type: A100 + memory_in_gb: 12 + vram_per_gpu_in_gb: 48 + vcpus: 6 + storage_in_gb: 256 + interconnect: pcie + launch_configuration: + docker_configuration: + args: --model mistralai/Mistral-7B-v0.1 + shared_memory_in_gb: 8 + image: vllm/vllm-openai:latest + port_mappings: + - container_port: 8000 + host_port: 80 + - container_port: 8000 + host_port: 80 + registry_credentials: + password: password + username: username + envs: + - name: HUGGING_FACE_HUB_TOKEN + value: hugging_face_api_token + - name: HUGGING_FACE_HUB_TOKEN + value: hugging_face_api_token + volume_mounts: + - host_path: "~/.cache/huggingface" + container_path: /root/.cache/huggingface + - host_path: "~/.cache/huggingface" + container_path: /root/.cache/huggingface + script_configuration: + base64_script: IyEvYmluL2Jhc2gKCiMgRW5kbGVzcyBsb29wCndoaWxlIHRydWUKZG8KICAgICMgRmV0Y2ggYSBjYXQgZmFjdCB3aXRoIGEgbWF4aW11bSBsZW5ndGggb2YgMTQwIGNoYXJhY3RlcnMKICAgIGN1cmwgLS1uby1wcm9ncmVzcy1tZXRlciBodHRwczovL2NhdGZhY3QubmluamEvZmFjdD9tYXhfbGVuZ3RoPTE0MAoKICAgICMgUHJpbnQgYSBuZXdsaW5lIGZvciByZWFkYWJpbGl0eQogICAgZWNobwoKICAgICMgU2xlZXAgZm9yIDMgc2Vjb25kcyBiZWZvcmUgdGhlIG5leHQgaXRlcmF0aW9uCiAgICBzbGVlcCAzCmRvbmUKCgo= + type: docker + cloud_instance_type: gpu_1x_a6000 + ip: 1.0.0.1 + created_at: 2016-08-29T09:12:33.001Z + cloud_assigned_id: 13b057d7-e266-4869-985f-760fe75a78b3 + deleted_at: 2016-08-29T09:12:33.001Z + shade_cloud: true + shade_instance_type: A6000 + cloud: hyperstack + hourly_price: 210 + cost_estimate: "103.4" + port_mappings: + - external_port: 80 + internal_port: 8000 + - external_port: 80 + internal_port: 8000 + name: cool-gpu-server + id: d290f1ee-6c54-4b01-90e6-d701748f0851 + region: canada-1 + ssh_user: shadeform + status: active + properties: + instances: + items: + $ref: '#/components/schemas/Instance' + type: array + required: + - instances + type: object + Instance: + example: + ssh_port: 22 + configuration: + nvlink: true + os: ubuntu_22_shade_os + num_gpus: 1 + gpu_type: A100 + memory_in_gb: 12 + vram_per_gpu_in_gb: 48 + vcpus: 6 + storage_in_gb: 256 + interconnect: pcie + launch_configuration: + docker_configuration: + args: --model mistralai/Mistral-7B-v0.1 + shared_memory_in_gb: 8 + image: vllm/vllm-openai:latest + port_mappings: + - container_port: 8000 + host_port: 80 + - container_port: 8000 + host_port: 80 + registry_credentials: + password: password + username: username + envs: + - name: HUGGING_FACE_HUB_TOKEN + value: hugging_face_api_token + - name: HUGGING_FACE_HUB_TOKEN + value: hugging_face_api_token + volume_mounts: + - host_path: "~/.cache/huggingface" + container_path: /root/.cache/huggingface + - host_path: "~/.cache/huggingface" + container_path: /root/.cache/huggingface + script_configuration: + base64_script: IyEvYmluL2Jhc2gKCiMgRW5kbGVzcyBsb29wCndoaWxlIHRydWUKZG8KICAgICMgRmV0Y2ggYSBjYXQgZmFjdCB3aXRoIGEgbWF4aW11bSBsZW5ndGggb2YgMTQwIGNoYXJhY3RlcnMKICAgIGN1cmwgLS1uby1wcm9ncmVzcy1tZXRlciBodHRwczovL2NhdGZhY3QubmluamEvZmFjdD9tYXhfbGVuZ3RoPTE0MAoKICAgICMgUHJpbnQgYSBuZXdsaW5lIGZvciByZWFkYWJpbGl0eQogICAgZWNobwoKICAgICMgU2xlZXAgZm9yIDMgc2Vjb25kcyBiZWZvcmUgdGhlIG5leHQgaXRlcmF0aW9uCiAgICBzbGVlcCAzCmRvbmUKCgo= + type: docker + cloud_instance_type: gpu_1x_a6000 + ip: 1.0.0.1 + created_at: 2016-08-29T09:12:33.001Z + cloud_assigned_id: 13b057d7-e266-4869-985f-760fe75a78b3 + deleted_at: 2016-08-29T09:12:33.001Z + shade_cloud: true + shade_instance_type: A6000 + cloud: hyperstack + hourly_price: 210 + cost_estimate: "103.4" + port_mappings: + - external_port: 80 + internal_port: 8000 + - external_port: 80 + internal_port: 8000 + name: cool-gpu-server + id: d290f1ee-6c54-4b01-90e6-d701748f0851 + region: canada-1 + ssh_user: shadeform + status: active + properties: + id: + description: "The unique identifier for the instance. Used in the instances\ + \ for the /instances/{id}/info and /instances/{id}/delete APIs." + example: d290f1ee-6c54-4b01-90e6-d701748f0851 + format: uuid + type: string + cloud: + $ref: '#/components/schemas/Cloud' + region: + description: Specifies the region. + example: canada-1 + type: string + shade_instance_type: + description: "The Shadeform standardized instance type. See this [explanation](/getting-started/concepts#shade-instance-type-and-cloud-instance-type)\ + \ for more details." + example: A6000 + type: string + cloud_instance_type: + description: "The instance type for the underlying cloud provider. See this\ + \ [explanation](/getting-started/concepts#shade-instance-type-and-cloud-instance-type)\ + \ for more details." + example: gpu_1x_a6000 + type: string + cloud_assigned_id: + description: The unique identifier of the instance issued by the underlying + cloud provider. + example: 13b057d7-e266-4869-985f-760fe75a78b3 + type: string + shade_cloud: + description: "Specifies if the instance is launched in [Shade Cloud](/getting-started/concepts#shade-cloud)\ + \ or in a linked cloud account." + example: true + type: boolean + name: + description: The name of the instance + example: cool-gpu-server + type: string + configuration: + $ref: '#/components/schemas/Instance_configuration' + ip: + description: "The public IP address of the instance. In select cases, it\ + \ may also be the DNS." + example: 1.0.0.1 + type: string + ssh_user: + description: The SSH user used to SSH into the instance. + example: shadeform + type: string + ssh_port: + description: "The SSH port of the instance. In most cases, this will be\ + \ port 22 but for some clouds, this may be a different port." + example: 22 + type: integer + status: + $ref: '#/components/schemas/Status' + cost_estimate: + description: "The cost incurred by the instance. This only the cost via\ + \ Shadeform. If the instance is deployed in your own cloud account, then\ + \ all billing is through your cloud provider." + example: "103.4" + type: string + hourly_price: + description: The hourly price of the instance in cents. + example: 210 + type: integer + launch_configuration: + $ref: '#/components/schemas/LaunchConfiguration' + port_mappings: + description: List of port mappings on an instance that a Cloud Provider + might have automatically set up. + items: + $ref: '#/components/schemas/InstancePortMappings' + type: array + created_at: + description: The timestamp of when the instance was created in UTC. + example: 2016-08-29T09:12:33.001Z + format: date-time + type: string + deleted_at: + description: The timestamp of when the instance was deleted in UTC. + example: 2016-08-29T09:12:33.001Z + format: date-time + type: string + required: + - cloud + - cloud_assigned_id + - cloud_instance_type + - configuration + - cost_estimate + - created_at + - deleted_at + - id + - ip + - name + - region + - shade_cloud + - shade_instance_type + - ssh_port + - ssh_user + - status + type: object + InstanceInfoResponse: + example: + configuration: + nvlink: true + os: ubuntu_22_shade_os + num_gpus: 1 + gpu_type: A100 + memory_in_gb: 12 + vram_per_gpu_in_gb: 48 + vcpus: 6 + storage_in_gb: 256 + interconnect: pcie + cloud_instance_type: gpu_1x_a6000 + auto_delete: + spend_threshold: "3.14" + date_threshold: 2006-01-02T15:04:05-07:00 + envs: + - name: HUGGING_FACE_HUB_TOKEN + value: hugging_face_api_token + - name: HUGGING_FACE_HUB_TOKEN + value: hugging_face_api_token + created_at: 2016-08-29T09:12:33.001Z + cloud_assigned_id: 13b057d7-e266-4869-985f-760fe75a78b3 + shade_instance_type: A6000 + cloud: hyperstack + hourly_price: 210 + cost_estimate: "103.4" + alert: + spend_threshold: "3.14" + date_threshold: 2006-01-02T15:04:05-07:00 + ssh_key_id: 78a0dd5a-dbb1-4568-b55c-5e7e0a8b0c40 + port_mappings: + - external_port: 80 + internal_port: 8000 + - external_port: 80 + internal_port: 8000 + id: d290f1ee-6c54-4b01-90e6-d701748f0851 + ssh_user: shadeform + volume_mount: + auto: true + ssh_port: 22 + launch_configuration: + docker_configuration: + args: --model mistralai/Mistral-7B-v0.1 + shared_memory_in_gb: 8 + image: vllm/vllm-openai:latest + port_mappings: + - container_port: 8000 + host_port: 80 + - container_port: 8000 + host_port: 80 + registry_credentials: + password: password + username: username + envs: + - name: HUGGING_FACE_HUB_TOKEN + value: hugging_face_api_token + - name: HUGGING_FACE_HUB_TOKEN + value: hugging_face_api_token + volume_mounts: + - host_path: "~/.cache/huggingface" + container_path: /root/.cache/huggingface + - host_path: "~/.cache/huggingface" + container_path: /root/.cache/huggingface + script_configuration: + base64_script: IyEvYmluL2Jhc2gKCiMgRW5kbGVzcyBsb29wCndoaWxlIHRydWUKZG8KICAgICMgRmV0Y2ggYSBjYXQgZmFjdCB3aXRoIGEgbWF4aW11bSBsZW5ndGggb2YgMTQwIGNoYXJhY3RlcnMKICAgIGN1cmwgLS1uby1wcm9ncmVzcy1tZXRlciBodHRwczovL2NhdGZhY3QubmluamEvZmFjdD9tYXhfbGVuZ3RoPTE0MAoKICAgICMgUHJpbnQgYSBuZXdsaW5lIGZvciByZWFkYWJpbGl0eQogICAgZWNobwoKICAgICMgU2xlZXAgZm9yIDMgc2Vjb25kcyBiZWZvcmUgdGhlIG5leHQgaXRlcmF0aW9uCiAgICBzbGVlcCAzCmRvbmUKCgo= + type: docker + ip: 1.0.0.1 + volume_ids: + - 78a0dd5a-dbb1-4568-b55c-5e7e0a8b0c40 + - 78a0dd5a-dbb1-4568-b55c-5e7e0a8b0c40 + deleted_at: 2016-08-29T09:12:33.001Z + shade_cloud: true + tags: + - tag1 + - tag1 + name: cool-gpu-server + region: canada-1 + status: active + properties: + id: + description: "The unique identifier for the instance. Used in the instances\ + \ for the /instances/{id}/info and /instances/{id}/delete APIs." + example: d290f1ee-6c54-4b01-90e6-d701748f0851 + format: uuid + type: string + cloud: + $ref: '#/components/schemas/Cloud' + region: + description: Specifies the region. + example: canada-1 + type: string + shade_instance_type: + description: "The Shadeform standardized instance type. See this [explanation](/getting-started/concepts#shade-instance-type-and-cloud-instance-type)\ + \ for more details." + example: A6000 + type: string + cloud_instance_type: + description: "The instance type for the underlying cloud provider. See this\ + \ [explanation](/getting-started/concepts#shade-instance-type-and-cloud-instance-type)\ + \ for more details." + example: gpu_1x_a6000 + type: string + cloud_assigned_id: + description: The unique identifier of the instance issued by the underlying + cloud provider. + example: 13b057d7-e266-4869-985f-760fe75a78b3 + type: string + shade_cloud: + description: "Specifies if the instance is launched in [Shade Cloud](/getting-started/concepts#shade-cloud)\ + \ or in a linked cloud account." + example: true + type: boolean + name: + description: The name of the instance + example: cool-gpu-server + type: string + configuration: + $ref: '#/components/schemas/Instance_configuration' + ip: + description: "The public IP address of the instance. In select cases, it\ + \ may also be the DNS." + example: 1.0.0.1 + type: string + ssh_user: + description: The SSH user used to SSH into the instance. + example: shadeform + type: string + ssh_port: + description: "The SSH port of the instance. In most cases, this will be\ + \ port 22 but for some clouds, this may be a different port." + example: 22 + type: integer + status: + $ref: '#/components/schemas/Status' + cost_estimate: + description: "The cost incurred by the instance. This only the cost via\ + \ Shadeform. If the instance is deployed in your own cloud account, then\ + \ all billing is through your cloud provider." + example: "103.4" + type: string + hourly_price: + description: The hourly price of the instance in cents. + example: 210 + type: integer + volume_ids: + description: List of volume IDs to be mounted. Currently only supports 1 + volume at a time. + items: + $ref: '#/components/schemas/VolumeID' + type: array + ssh_key_id: + description: The ID of the SSH Key. + example: 78a0dd5a-dbb1-4568-b55c-5e7e0a8b0c40 + type: string + launch_configuration: + $ref: '#/components/schemas/LaunchConfiguration' + auto_delete: + $ref: '#/components/schemas/AutoDelete' + alert: + $ref: '#/components/schemas/Alert' + volume_mount: + $ref: '#/components/schemas/VolumeMount' + tags: + description: "Add custom, searchable tags to instances." + items: + $ref: '#/components/schemas/Tag' + type: array + envs: + description: List of environment variable name and values to automatically + add to the instance + items: + $ref: '#/components/schemas/Env' + type: array + port_mappings: + description: List of port mappings on an instance that a Cloud Provider + might have automatically set up. + items: + $ref: '#/components/schemas/InstancePortMappings' + type: array + created_at: + description: The timestamp of when the instance was created in UTC. + example: 2016-08-29T09:12:33.001Z + format: date-time + type: string + deleted_at: + description: The timestamp of when the instance was deleted in UTC. + example: 2016-08-29T09:12:33.001Z + format: date-time + type: string + required: + - cloud + - cloud_assigned_id + - cloud_instance_type + - configuration + - cost_estimate + - created_at + - deleted_at + - id + - ip + - name + - region + - shade_cloud + - shade_instance_type + - ssh_port + - ssh_user + - status + type: object + InstanceTypeConfiguration: + example: + nvlink: true + num_gpus: 1 + gpu_type: A100 + memory_in_gb: 12 + vram_per_gpu_in_gb: 48 + vcpus: 6 + storage_in_gb: 256 + interconnect: pcie + os_options: + - ubuntu22.04_cuda12.2_shade_os + - ubuntu20.04_cuda12.0_shade_os + properties: + memory_in_gb: + description: The amount of memory for the instance in gigabytes. Note that + this is not VRAM which is determined by GPU type and the number of GPUs. + example: 12 + type: integer + storage_in_gb: + description: "The amount of storage for the instance. If this storage is\ + \ too low for the instance type, please email support@shadeform.ai as\ + \ the storage may be adjustable." + example: 256 + type: integer + vcpus: + description: The number of vCPUs for the instance. + example: 6 + type: integer + num_gpus: + description: The number of GPUs for the instance. + example: 1 + type: integer + gpu_type: + description: The type of GPU for the instance. + example: A100 + type: string + interconnect: + description: The type of GPU interconnect. + example: pcie + type: string + nvlink: + description: If the instance has NVLink + example: true + type: boolean + vram_per_gpu_in_gb: + description: The video memory per GPU for the instance in gigabytes. + example: 48 + type: integer + os_options: + description: The list of available operating systems for the instance. + example: + - ubuntu22.04_cuda12.2_shade_os + - ubuntu20.04_cuda12.0_shade_os + items: + type: string + type: array + required: + - gpu_type + - interconnect + - memory_in_gb + - num_gpus + - os_options + - storage_in_gb + - vcpus + - vram_per_gpu_in_gb + type: object + InstanceConfiguration: + properties: + memory_in_gb: + description: The amount of memory for the instance in gigabytes. Note that + this is not VRAM which is determined by GPU type and the number of GPUs. + example: 12 + type: integer + storage_in_gb: + description: "The amount of storage for the instance. If this storage is\ + \ too low for the instance type, please email support@shadeform.ai as\ + \ the storage may be adjustable." + example: 256 + type: integer + vcpus: + description: The number of vCPUs for the instance. + example: 6 + type: integer + num_gpus: + description: The number of GPUs for the instance. + example: 1 + type: integer + gpu_type: + description: The type of GPU for the instance. + example: A100 + type: string + interconnect: + description: The type of GPU interconnect. + example: pcie + type: string + nvlink: + description: If the instance has NVLink + example: true + type: boolean + vram_per_gpu_in_gb: + description: The video memory per GPU for the instance in gigabytes. + example: 48 + type: integer + required: + - gpu_type + - interconnect + - memory_in_gb + - num_gpus + - os + - storage_in_gb + - vcpus + - vram_per_gpu_in_gb + type: object + Availability: + properties: + region: + description: Specifies the region. + example: canada-1 + type: string + available: + description: Indicate whether the instance is available in the region. + example: true + type: boolean + display_name: + description: The display name of the region + example: "Toronto, Canana" + type: string + required: + - available + - display_name + - region + type: object + CreateRequest: + example: + volume_mount: + auto: true + os: ubuntu22.04_cuda12.2_shade_os + launch_configuration: + docker_configuration: + args: --model mistralai/Mistral-7B-v0.1 + shared_memory_in_gb: 8 + image: vllm/vllm-openai:latest + port_mappings: + - container_port: 8000 + host_port: 80 + - container_port: 8000 + host_port: 80 + registry_credentials: + password: password + username: username + envs: + - name: HUGGING_FACE_HUB_TOKEN + value: hugging_face_api_token + - name: HUGGING_FACE_HUB_TOKEN + value: hugging_face_api_token + volume_mounts: + - host_path: "~/.cache/huggingface" + container_path: /root/.cache/huggingface + - host_path: "~/.cache/huggingface" + container_path: /root/.cache/huggingface + script_configuration: + base64_script: IyEvYmluL2Jhc2gKCiMgRW5kbGVzcyBsb29wCndoaWxlIHRydWUKZG8KICAgICMgRmV0Y2ggYSBjYXQgZmFjdCB3aXRoIGEgbWF4aW11bSBsZW5ndGggb2YgMTQwIGNoYXJhY3RlcnMKICAgIGN1cmwgLS1uby1wcm9ncmVzcy1tZXRlciBodHRwczovL2NhdGZhY3QubmluamEvZmFjdD9tYXhfbGVuZ3RoPTE0MAoKICAgICMgUHJpbnQgYSBuZXdsaW5lIGZvciByZWFkYWJpbGl0eQogICAgZWNobwoKICAgICMgU2xlZXAgZm9yIDMgc2Vjb25kcyBiZWZvcmUgdGhlIG5leHQgaXRlcmF0aW9uCiAgICBzbGVlcCAzCmRvbmUKCgo= + type: docker + auto_delete: + spend_threshold: "3.14" + date_threshold: 2006-01-02T15:04:05-07:00 + volume_ids: + - 78a0dd5a-dbb1-4568-b55c-5e7e0a8b0c40 + - 78a0dd5a-dbb1-4568-b55c-5e7e0a8b0c40 + envs: + - name: HUGGING_FACE_HUB_TOKEN + value: hugging_face_api_token + - name: HUGGING_FACE_HUB_TOKEN + value: hugging_face_api_token + shade_cloud: true + shade_instance_type: A6000 + tags: + - tag1 + - tag1 + cloud: hyperstack + alert: + spend_threshold: "3.14" + date_threshold: 2006-01-02T15:04:05-07:00 + ssh_key_id: 78a0dd5a-dbb1-4568-b55c-5e7e0a8b0c40 + name: cool-gpu-server + template_id: template-123 + region: canada-1 + properties: + cloud: + $ref: '#/components/schemas/Cloud' + region: + description: Specifies the region. + example: canada-1 + type: string + shade_instance_type: + description: "The Shadeform standardized instance type. See this [explanation](/getting-started/concepts#shade-instance-type-and-cloud-instance-type)\ + \ for more details." + example: A6000 + type: string + shade_cloud: + description: "Specifies if the instance is launched in [Shade Cloud](/getting-started/concepts#shade-cloud)\ + \ or in a linked cloud account." + example: true + type: boolean + name: + description: The name of the instance + example: cool-gpu-server + type: string + os: + description: The operating system of the instance. + example: ubuntu22.04_cuda12.2_shade_os + type: string + template_id: + description: The ID of the template to use for this instance + example: template-123 + type: string + launch_configuration: + $ref: '#/components/schemas/LaunchConfiguration' + volume_ids: + description: List of volume IDs to be mounted. Currently only supports 1 + volume at a time. + items: + $ref: '#/components/schemas/VolumeID' + type: array + ssh_key_id: + description: The ID of the SSH Key. + example: 78a0dd5a-dbb1-4568-b55c-5e7e0a8b0c40 + type: string + auto_delete: + $ref: '#/components/schemas/AutoDelete' + alert: + $ref: '#/components/schemas/Alert' + volume_mount: + $ref: '#/components/schemas/VolumeMount' + tags: + description: "Add custom, searchable tags to instances." + items: + $ref: '#/components/schemas/Tag' + type: array + envs: + description: List of environment variable name and values to automatically + add to the instance + items: + $ref: '#/components/schemas/Env' + type: array + required: + - cloud + - name + - region + - shade_cloud + - shade_instance_type + type: object + UpdateRequest: + example: + alert: + spend_threshold: "3.14" + date_threshold: 2006-01-02T15:04:05-07:00 + name: cool-gpu-server + auto_delete: + spend_threshold: "3.14" + date_threshold: 2006-01-02T15:04:05-07:00 + tags: + - tag1 + - tag1 + properties: + name: + description: The name of the instance + example: cool-gpu-server + type: string + auto_delete: + $ref: '#/components/schemas/AutoDelete' + alert: + $ref: '#/components/schemas/Alert' + tags: + description: "Add custom, searchable tags to instances." + items: + $ref: '#/components/schemas/Tag' + type: array + type: object + LaunchConfiguration: + description: Defines automatic actions after the instance becomes active. + example: + docker_configuration: + args: --model mistralai/Mistral-7B-v0.1 + shared_memory_in_gb: 8 + image: vllm/vllm-openai:latest + port_mappings: + - container_port: 8000 + host_port: 80 + - container_port: 8000 + host_port: 80 + registry_credentials: + password: password + username: username + envs: + - name: HUGGING_FACE_HUB_TOKEN + value: hugging_face_api_token + - name: HUGGING_FACE_HUB_TOKEN + value: hugging_face_api_token + volume_mounts: + - host_path: "~/.cache/huggingface" + container_path: /root/.cache/huggingface + - host_path: "~/.cache/huggingface" + container_path: /root/.cache/huggingface + script_configuration: + base64_script: IyEvYmluL2Jhc2gKCiMgRW5kbGVzcyBsb29wCndoaWxlIHRydWUKZG8KICAgICMgRmV0Y2ggYSBjYXQgZmFjdCB3aXRoIGEgbWF4aW11bSBsZW5ndGggb2YgMTQwIGNoYXJhY3RlcnMKICAgIGN1cmwgLS1uby1wcm9ncmVzcy1tZXRlciBodHRwczovL2NhdGZhY3QubmluamEvZmFjdD9tYXhfbGVuZ3RoPTE0MAoKICAgICMgUHJpbnQgYSBuZXdsaW5lIGZvciByZWFkYWJpbGl0eQogICAgZWNobwoKICAgICMgU2xlZXAgZm9yIDMgc2Vjb25kcyBiZWZvcmUgdGhlIG5leHQgaXRlcmF0aW9uCiAgICBzbGVlcCAzCmRvbmUKCgo= + type: docker + properties: + type: + description: "Specifies the type of launch configuration. See [Launch Configuration](/getting-started/concepts#launch-configuration)\ + \ for more details." + enum: + - docker + - script + example: docker + type: string + docker_configuration: + $ref: '#/components/schemas/DockerConfiguration' + script_configuration: + $ref: '#/components/schemas/ScriptConfiguration' + required: + - type + type: object + DockerConfiguration: + description: "May only be used if launch_configuration.type is 'docker'. Use\ + \ docker_configuration to automatically pull and run a docker image. See this\ + \ [tutorial](/guides/dockercontainers) for examples." + example: + args: --model mistralai/Mistral-7B-v0.1 + shared_memory_in_gb: 8 + image: vllm/vllm-openai:latest + port_mappings: + - container_port: 8000 + host_port: 80 + - container_port: 8000 + host_port: 80 + registry_credentials: + password: password + username: username + envs: + - name: HUGGING_FACE_HUB_TOKEN + value: hugging_face_api_token + - name: HUGGING_FACE_HUB_TOKEN + value: hugging_face_api_token + volume_mounts: + - host_path: "~/.cache/huggingface" + container_path: /root/.cache/huggingface + - host_path: "~/.cache/huggingface" + container_path: /root/.cache/huggingface + properties: + image: + description: Specifies the docker image to be pulled and run on the instance + at startup. + example: vllm/vllm-openai:latest + type: string + args: + description: Specifies the container arguments passed into the image at + runtime. + example: --model mistralai/Mistral-7B-v0.1 + type: string + shared_memory_in_gb: + description: "Describes the amount of shared memory allocated for the container.\ + \ Equivalent to using the --shm-size flag in the docker cli. If shared_memory_in_gb\ + \ is not specified, then the container will use the host namespace which\ + \ is the equivalent of --ipc=host." + example: 8 + type: integer + envs: + description: List of environment variable name-value pairs that will be + passed to the docker container. + items: + $ref: '#/components/schemas/Env' + type: array + port_mappings: + description: List of port mappings between the host instance and the docker + container. Equivalent of -p flag for docker run command. + items: + $ref: '#/components/schemas/PortMappings' + type: array + volume_mounts: + description: List of volume mounts between the host instance and the docker + container. Equivalent of -v flag for docker run command. + items: + $ref: '#/components/schemas/VolumeMounts' + type: array + registry_credentials: + $ref: '#/components/schemas/RegistryCredentials' + required: + - image + type: object + RegistryCredentials: + example: + password: password + username: username + properties: + username: + description: The username for the docker registry. + example: username + type: string + password: + description: The password for the docker registry. + example: password + type: string + type: object + ScriptConfiguration: + description: "May only be used if launch_configuration.type is 'script'. Configures\ + \ a startup script to be run automatically after the instance is active. See\ + \ this [tutorial]/guides/startupscript) for examples." + example: + base64_script: IyEvYmluL2Jhc2gKCiMgRW5kbGVzcyBsb29wCndoaWxlIHRydWUKZG8KICAgICMgRmV0Y2ggYSBjYXQgZmFjdCB3aXRoIGEgbWF4aW11bSBsZW5ndGggb2YgMTQwIGNoYXJhY3RlcnMKICAgIGN1cmwgLS1uby1wcm9ncmVzcy1tZXRlciBodHRwczovL2NhdGZhY3QubmluamEvZmFjdD9tYXhfbGVuZ3RoPTE0MAoKICAgICMgUHJpbnQgYSBuZXdsaW5lIGZvciByZWFkYWJpbGl0eQogICAgZWNobwoKICAgICMgU2xlZXAgZm9yIDMgc2Vjb25kcyBiZWZvcmUgdGhlIG5leHQgaXRlcmF0aW9uCiAgICBzbGVlcCAzCmRvbmUKCgo= + properties: + base64_script: + description: A startup script that is base64 encoded. + example: IyEvYmluL2Jhc2gKCiMgRW5kbGVzcyBsb29wCndoaWxlIHRydWUKZG8KICAgICMgRmV0Y2ggYSBjYXQgZmFjdCB3aXRoIGEgbWF4aW11bSBsZW5ndGggb2YgMTQwIGNoYXJhY3RlcnMKICAgIGN1cmwgLS1uby1wcm9ncmVzcy1tZXRlciBodHRwczovL2NhdGZhY3QubmluamEvZmFjdD9tYXhfbGVuZ3RoPTE0MAoKICAgICMgUHJpbnQgYSBuZXdsaW5lIGZvciByZWFkYWJpbGl0eQogICAgZWNobwoKICAgICMgU2xlZXAgZm9yIDMgc2Vjb25kcyBiZWZvcmUgdGhlIG5leHQgaXRlcmF0aW9uCiAgICBzbGVlcCAzCmRvbmUKCgo= + type: string + required: + - base64_script + type: object + Env: + description: Environment variables for the container image. + example: + name: HUGGING_FACE_HUB_TOKEN + value: hugging_face_api_token + properties: + name: + description: Name of the environment variable + example: HUGGING_FACE_HUB_TOKEN + type: string + value: + description: Value of the environment variable + example: hugging_face_api_token + type: string + required: + - name + - value + type: object + PortMappings: + description: Maps the public instance port to a port on the container. + example: + container_port: 8000 + host_port: 80 + properties: + host_port: + description: Port of the host. + example: 80 + type: integer + container_port: + description: Port of the container. + example: 8000 + type: integer + required: + - container_port + - host_port + type: object + VolumeMounts: + description: Mounts the host volume to a container file path. + example: + host_path: "~/.cache/huggingface" + container_path: /root/.cache/huggingface + properties: + host_path: + description: Filepath of the host. + example: "~/.cache/huggingface" + type: string + container_path: + description: Filepath of the container. + example: /root/.cache/huggingface + type: string + required: + - container_path + - host_path + type: object + CreateResponse: + description: Response of the /instances/create API call + example: + id: d290f1ee-6c54-4b01-90e6-d701748f0851 + properties: + id: + description: "The unique identifier for the instance. Used in the instances\ + \ for the /instances/{id}/info and /instances/{id}/delete APIs." + example: d290f1ee-6c54-4b01-90e6-d701748f0851 + format: uuid + type: string + required: + - id + type: object + Cloud: + description: "Specifies the underlying cloud provider. See this [explanation](/getting-started/concepts#cloud-cloud-provider)\ + \ for more details." + enum: + - lambdalabs + - paperspace + - vultr + - datacrunch + - latitude + - massedcompute + - imwt + - hyperstack + - nebius + - crusoe + - denvr + - digitalocean + - tcm + - hotaisle + - cudo + - scaleway + - evergreen + - excesssupply + - voltagepark + - boostrun + - ionstream + - whitefiber + - horizon + - fpt + - hydra + - amaya + example: hyperstack + type: string + Region: + description: Specifies the region. + example: canada-1 + type: string + Id: + description: "The unique identifier for the instance. Used in the instances\ + \ for the /instances/{id}/info and /instances/{id}/delete APIs." + example: d290f1ee-6c54-4b01-90e6-d701748f0851 + format: uuid + type: string + CloudAssignedId: + description: The unique identifier of the instance issued by the underlying + cloud provider. + example: 13b057d7-e266-4869-985f-760fe75a78b3 + type: string + Name: + description: The name of the instance + example: cool-gpu-server + type: string + ShadeInstanceType: + description: "The Shadeform standardized instance type. See this [explanation](/getting-started/concepts#shade-instance-type-and-cloud-instance-type)\ + \ for more details." + example: A6000 + type: string + ShadeCloud: + description: "Specifies if the instance is launched in [Shade Cloud](/getting-started/concepts#shade-cloud)\ + \ or in a linked cloud account." + example: true + type: boolean + CloudInstanceType: + description: "The instance type for the underlying cloud provider. See this\ + \ [explanation](/getting-started/concepts#shade-instance-type-and-cloud-instance-type)\ + \ for more details." + example: gpu_1x_a6000 + type: string + HourlyPrice: + description: The hourly price of the instance in cents. + example: 210 + type: integer + DeploymentType: + description: "Whether the instance is a \"vm\" (virtual machine), a \"container\"\ + \ (docker container), or \"baremetal\" (bare metal server)." + example: vm + type: string + Ip: + description: "The public IP address of the instance. In select cases, it may\ + \ also be the DNS." + example: 1.0.0.1 + type: string + SshUser: + description: The SSH user used to SSH into the instance. + example: shadeform + type: string + SshPort: + description: "The SSH port of the instance. In most cases, this will be port\ + \ 22 but for some clouds, this may be a different port." + example: 22 + type: integer + Status: + description: The status of the instance. + enum: + - creating + - pending_provider + - pending + - active + - deleted + example: active + type: string + CostEstimate: + description: "The cost incurred by the instance. This only the cost via Shadeform.\ + \ If the instance is deployed in your own cloud account, then all billing\ + \ is through your cloud provider." + example: "103.4" + type: string + CreatedAt: + description: The timestamp of when the instance was created in UTC. + example: 2016-08-29T09:12:33.001Z + format: date-time + type: string + DeletedAt: + description: The timestamp of when the instance was deleted in UTC. + example: 2016-08-29T09:12:33.001Z + format: date-time + type: string + SshKeysResponse: + example: + ssh_keys: + - public_key: ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAklOUpkDHrfHY17SbrmTIpNLTGK9Tjom/BWDSU + GPl+nafzlHDTYW7hdI4yZ5ew18JH4JW9jbhUFrviQzM7xlELEVf4h9lFX5QVkbPppSwg0cda3 + Pbv7kOdJ/MTyBlWXFCR+HAo3FXRitBqxiX1nKhXpHAZsMciLq8V6RjsNAQwdsdMFvSlVK/7XA + t3FaoJoAsncM1Q9x5+3V0Ww68/eIFmb1zuUFljQJKprrX88XypNDvjYNby6vw/Pb0rwert/En + mZ+AW4OZPnTPI89ZPmVMLuayrD2cE86Z/il8b+gw3r3+1nKatmIkjn2so1d01QraTlMqVSsbx + NrRFi9wrf+M7Q== schacon@mylaptop.local + name: My ssh key + id: 78a0dd5a-dbb1-4568-b55c-5e7e0a8b0c40 + is_default: false + - public_key: ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAklOUpkDHrfHY17SbrmTIpNLTGK9Tjom/BWDSU + GPl+nafzlHDTYW7hdI4yZ5ew18JH4JW9jbhUFrviQzM7xlELEVf4h9lFX5QVkbPppSwg0cda3 + Pbv7kOdJ/MTyBlWXFCR+HAo3FXRitBqxiX1nKhXpHAZsMciLq8V6RjsNAQwdsdMFvSlVK/7XA + t3FaoJoAsncM1Q9x5+3V0Ww68/eIFmb1zuUFljQJKprrX88XypNDvjYNby6vw/Pb0rwert/En + mZ+AW4OZPnTPI89ZPmVMLuayrD2cE86Z/il8b+gw3r3+1nKatmIkjn2so1d01QraTlMqVSsbx + NrRFi9wrf+M7Q== schacon@mylaptop.local + name: My ssh key + id: 78a0dd5a-dbb1-4568-b55c-5e7e0a8b0c40 + is_default: false + properties: + ssh_keys: + items: + $ref: '#/components/schemas/SshKey' + type: array + required: + - ssh_keys + type: object + SshKey: + example: + public_key: ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAklOUpkDHrfHY17SbrmTIpNLTGK9Tjom/BWDSU + GPl+nafzlHDTYW7hdI4yZ5ew18JH4JW9jbhUFrviQzM7xlELEVf4h9lFX5QVkbPppSwg0cda3 + Pbv7kOdJ/MTyBlWXFCR+HAo3FXRitBqxiX1nKhXpHAZsMciLq8V6RjsNAQwdsdMFvSlVK/7XA + t3FaoJoAsncM1Q9x5+3V0Ww68/eIFmb1zuUFljQJKprrX88XypNDvjYNby6vw/Pb0rwert/En + mZ+AW4OZPnTPI89ZPmVMLuayrD2cE86Z/il8b+gw3r3+1nKatmIkjn2so1d01QraTlMqVSsbx + NrRFi9wrf+M7Q== schacon@mylaptop.local + name: My ssh key + id: 78a0dd5a-dbb1-4568-b55c-5e7e0a8b0c40 + is_default: false + properties: + id: + description: The ID of the SSH Key. + example: 78a0dd5a-dbb1-4568-b55c-5e7e0a8b0c40 + type: string + name: + description: The name of the SSH Key. + example: My ssh key + type: string + public_key: + description: The public key. + example: ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAklOUpkDHrfHY17SbrmTIpNLTGK9Tjom/BWDSU + GPl+nafzlHDTYW7hdI4yZ5ew18JH4JW9jbhUFrviQzM7xlELEVf4h9lFX5QVkbPppSwg0cda3 + Pbv7kOdJ/MTyBlWXFCR+HAo3FXRitBqxiX1nKhXpHAZsMciLq8V6RjsNAQwdsdMFvSlVK/7XA + t3FaoJoAsncM1Q9x5+3V0Ww68/eIFmb1zuUFljQJKprrX88XypNDvjYNby6vw/Pb0rwert/En + mZ+AW4OZPnTPI89ZPmVMLuayrD2cE86Z/il8b+gw3r3+1nKatmIkjn2so1d01QraTlMqVSsbx + NrRFi9wrf+M7Q== schacon@mylaptop.local + type: string + is_default: + description: Indicates the default key. + example: false + type: boolean + required: + - id + - is_default + - name + - public_key + type: object + AddSshKeyRequest: + example: + public_key: ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAklOUpkDHrfHY17SbrmTIpNLTGK9Tjom/BWDSU + GPl+nafzlHDTYW7hdI4yZ5ew18JH4JW9jbhUFrviQzM7xlELEVf4h9lFX5QVkbPppSwg0cda3 + Pbv7kOdJ/MTyBlWXFCR+HAo3FXRitBqxiX1nKhXpHAZsMciLq8V6RjsNAQwdsdMFvSlVK/7XA + t3FaoJoAsncM1Q9x5+3V0Ww68/eIFmb1zuUFljQJKprrX88XypNDvjYNby6vw/Pb0rwert/En + mZ+AW4OZPnTPI89ZPmVMLuayrD2cE86Z/il8b+gw3r3+1nKatmIkjn2so1d01QraTlMqVSsbx + NrRFi9wrf+M7Q== schacon@mylaptop.local + name: My ssh key + properties: + name: + description: The name of the SSH Key. + example: My ssh key + type: string + public_key: + description: The public key. + example: ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAklOUpkDHrfHY17SbrmTIpNLTGK9Tjom/BWDSU + GPl+nafzlHDTYW7hdI4yZ5ew18JH4JW9jbhUFrviQzM7xlELEVf4h9lFX5QVkbPppSwg0cda3 + Pbv7kOdJ/MTyBlWXFCR+HAo3FXRitBqxiX1nKhXpHAZsMciLq8V6RjsNAQwdsdMFvSlVK/7XA + t3FaoJoAsncM1Q9x5+3V0Ww68/eIFmb1zuUFljQJKprrX88XypNDvjYNby6vw/Pb0rwert/En + mZ+AW4OZPnTPI89ZPmVMLuayrD2cE86Z/il8b+gw3r3+1nKatmIkjn2so1d01QraTlMqVSsbx + NrRFi9wrf+M7Q== schacon@mylaptop.local + type: string + required: + - name + - public_key + type: object + AddSshKeyResponse: + example: + id: 78a0dd5a-dbb1-4568-b55c-5e7e0a8b0c40 + properties: + id: + description: The ID of the SSH Key. + example: 78a0dd5a-dbb1-4568-b55c-5e7e0a8b0c40 + type: string + required: + - id + type: object + SshKeyID: + description: The ID of the SSH Key. + example: 78a0dd5a-dbb1-4568-b55c-5e7e0a8b0c40 + type: string + AutoDelete: + description: Set a date or spend threshold to automatically delete the instance + example: + spend_threshold: "3.14" + date_threshold: 2006-01-02T15:04:05-07:00 + properties: + date_threshold: + description: RFC3339 date string + example: 2006-01-02T15:04:05-07:00 + type: string + spend_threshold: + description: Valid decimal representation of a dollar amount + example: "3.14" + type: string + type: object + InstancePortMappings: + description: List of port mappings on an instance that a Cloud Provider might + have automatically set up. + example: + external_port: 80 + internal_port: 8000 + properties: + internal_port: + example: 8000 + type: integer + external_port: + example: 80 + type: integer + type: object + Alert: + description: Set a date or spend threshold to receive an email alert + example: + spend_threshold: "3.14" + date_threshold: 2006-01-02T15:04:05-07:00 + properties: + date_threshold: + description: RFC3339 date string + example: 2006-01-02T15:04:05-07:00 + type: string + spend_threshold: + description: Valid decimal representation of a dollar amount + example: "3.14" + type: string + type: object + DateThreshold: + description: RFC3339 date string + example: 2006-01-02T15:04:05-07:00 + type: string + SpendThreshold: + description: Valid decimal representation of a dollar amount + example: "3.14" + type: string + VolumeMount: + description: Settings for mounting volumes onto file systems + example: + auto: true + properties: + auto: + description: Set to true to automatically mount unmounted disks to a default + filesystem. + type: boolean + type: object + SshKeyName: + description: The name of the SSH Key. + example: My ssh key + type: string + PublicKey: + description: The public key. + example: ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAklOUpkDHrfHY17SbrmTIpNLTGK9Tjom/BWDSU + GPl+nafzlHDTYW7hdI4yZ5ew18JH4JW9jbhUFrviQzM7xlELEVf4h9lFX5QVkbPppSwg0cda3 + Pbv7kOdJ/MTyBlWXFCR+HAo3FXRitBqxiX1nKhXpHAZsMciLq8V6RjsNAQwdsdMFvSlVK/7XA + t3FaoJoAsncM1Q9x5+3V0Ww68/eIFmb1zuUFljQJKprrX88XypNDvjYNby6vw/Pb0rwert/En + mZ+AW4OZPnTPI89ZPmVMLuayrD2cE86Z/il8b+gw3r3+1nKatmIkjn2so1d01QraTlMqVSsbx + NrRFi9wrf+M7Q== schacon@mylaptop.local + type: string + IsDefault: + description: Indicates the default key. + example: false + type: boolean + Tag: + description: Tag for searching and grouping + example: tag1 + type: string + VolumesResponse: + example: + volumes: + - cloud: hyperstack + fixed_size: true + cost_estimate: "103.4" + supports_multi_mount: true + mounted_by: 13b057d7-e266-4869-985f-760fe75a78b3 + name: My storage volume + id: 78a0dd5a-dbb1-4568-b55c-5e7e0a8b0c40 + cloud_assigned_id: 13b057d7-e266-4869-985f-760fe75a78b3 + region: canada-1 + size_in_gb: 100 + - cloud: hyperstack + fixed_size: true + cost_estimate: "103.4" + supports_multi_mount: true + mounted_by: 13b057d7-e266-4869-985f-760fe75a78b3 + name: My storage volume + id: 78a0dd5a-dbb1-4568-b55c-5e7e0a8b0c40 + cloud_assigned_id: 13b057d7-e266-4869-985f-760fe75a78b3 + region: canada-1 + size_in_gb: 100 + properties: + volumes: + items: + $ref: '#/components/schemas/Volume' + type: array + required: + - volumes + type: object + CreateVolumeRequest: + example: + cloud: hyperstack + name: My storage volume + region: canada-1 + size_in_gb: 100 + properties: + cloud: + $ref: '#/components/schemas/Cloud' + region: + description: Specifies the region. + example: canada-1 + type: string + size_in_gb: + description: Storage volume size in GB + example: 100 + type: integer + name: + description: The name of the storage volume. + example: My storage volume + type: string + required: + - cloud + - name + - region + - size_in_gb + type: object + CreateVolumeResponse: + example: + id: 78a0dd5a-dbb1-4568-b55c-5e7e0a8b0c40 + properties: + id: + description: The ID of the storage volume. + example: 78a0dd5a-dbb1-4568-b55c-5e7e0a8b0c40 + type: string + required: + - id + type: object + VolumesTypesResponse: + example: + volume_types: + - cloud: hyperstack + fixed_size: true + supports_multi_mount: true + price_per_gb_per_hour: "0.0001" + region: canada-1 + - cloud: hyperstack + fixed_size: true + supports_multi_mount: true + price_per_gb_per_hour: "0.0001" + region: canada-1 + properties: + volume_types: + items: + $ref: '#/components/schemas/VolumeTypes_inner' + type: array + required: + - volume_types + type: object + Volume: + example: + cloud: hyperstack + fixed_size: true + cost_estimate: "103.4" + supports_multi_mount: true + mounted_by: 13b057d7-e266-4869-985f-760fe75a78b3 + name: My storage volume + id: 78a0dd5a-dbb1-4568-b55c-5e7e0a8b0c40 + cloud_assigned_id: 13b057d7-e266-4869-985f-760fe75a78b3 + region: canada-1 + size_in_gb: 100 + properties: + id: + description: The ID of the storage volume. + example: 78a0dd5a-dbb1-4568-b55c-5e7e0a8b0c40 + type: string + cloud: + $ref: '#/components/schemas/Cloud' + cloud_assigned_id: + description: The unique identifier of the storage volume issued by the underlying + cloud provider. + example: 13b057d7-e266-4869-985f-760fe75a78b3 + type: string + region: + description: Specifies the region. + example: canada-1 + type: string + name: + description: The name of the storage volume. + example: My storage volume + type: string + fixed_size: + description: Denotes whether the volume is fixed in size or elastically + scaling. + example: true + type: boolean + size_in_gb: + description: Storage volume size in GB + example: 100 + type: integer + cost_estimate: + description: "The cost incurred by the instance. This only the cost via\ + \ Shadeform. If the instance is deployed in your own cloud account, then\ + \ all billing is through your cloud provider." + example: "103.4" + type: string + supports_multi_mount: + description: Denotes whether the volume supports multiple instances mounting + to it at the same time. + example: true + type: boolean + mounted_by: + description: The ID of the instance that is currently mounting the volume. + example: 13b057d7-e266-4869-985f-760fe75a78b3 + type: string + required: + - cloud + - cloud_assigned_id + - cost_estimate + - fixed_size + - id + - mounted_by + - name + - region + - size_in_gb + - supports_multi_mount + type: object + VolumeID: + description: The ID of the storage volume. + example: 78a0dd5a-dbb1-4568-b55c-5e7e0a8b0c40 + type: string + VolumeName: + description: The name of the storage volume. + example: My storage volume + type: string + VolumeCloudAssignedId: + description: The unique identifier of the storage volume issued by the underlying + cloud provider. + example: 13b057d7-e266-4869-985f-760fe75a78b3 + type: string + VolumeFixedSize: + description: Denotes whether the volume is fixed in size or elastically scaling. + example: true + type: boolean + VolumeSizeInGB: + description: Storage volume size in GB + example: 100 + type: integer + VolumeCostEstimate: + description: Cost incurred by the storage volume + example: "12.01" + type: string + VolumeSupportsMultiMount: + description: Denotes whether the volume supports multiple instances mounting + to it at the same time. + example: true + type: boolean + VolumeMountedBy: + description: The ID of the instance that is currently mounting the volume. + example: 13b057d7-e266-4869-985f-760fe75a78b3 + type: string + VolumePricePerGBPerHour: + description: Price of the specified volume type per GB per hour + example: "0.0001" + type: string + VolumeTypes: + items: + $ref: '#/components/schemas/VolumeTypes_inner' + type: array + Template: + example: + volume_mount: + auto: true + author: John Doe + launch_configuration: + docker_configuration: + args: --model mistralai/Mistral-7B-v0.1 + shared_memory_in_gb: 8 + image: vllm/vllm-openai:latest + port_mappings: + - container_port: 8000 + host_port: 80 + - container_port: 8000 + host_port: 80 + registry_credentials: + password: password + username: username + envs: + - name: HUGGING_FACE_HUB_TOKEN + value: hugging_face_api_token + - name: HUGGING_FACE_HUB_TOKEN + value: hugging_face_api_token + volume_mounts: + - host_path: "~/.cache/huggingface" + container_path: /root/.cache/huggingface + - host_path: "~/.cache/huggingface" + container_path: /root/.cache/huggingface + script_configuration: + base64_script: IyEvYmluL2Jhc2gKCiMgRW5kbGVzcyBsb29wCndoaWxlIHRydWUKZG8KICAgICMgRmV0Y2ggYSBjYXQgZmFjdCB3aXRoIGEgbWF4aW11bSBsZW5ndGggb2YgMTQwIGNoYXJhY3RlcnMKICAgIGN1cmwgLS1uby1wcm9ncmVzcy1tZXRlciBodHRwczovL2NhdGZhY3QubmluamEvZmFjdD9tYXhfbGVuZ3RoPTE0MAoKICAgICMgUHJpbnQgYSBuZXdsaW5lIGZvciByZWFkYWJpbGl0eQogICAgZWNobwoKICAgICMgU2xlZXAgZm9yIDMgc2Vjb25kcyBiZWZvcmUgdGhlIG5leHQgaXRlcmF0aW9uCiAgICBzbGVlcCAzCmRvbmUKCgo= + type: docker + auto_delete: + spend_threshold: "3.14" + date_threshold: 2006-01-02T15:04:05-07:00 + description: A template for running vLLM + envs: + - name: HUGGING_FACE_HUB_TOKEN + value: hugging_face_api_token + - name: HUGGING_FACE_HUB_TOKEN + value: hugging_face_api_token + networking: + ufw_rules: + - port: "80" + proto: tcp + rule: allow + to_ip: 10.0.0.0/8 + from_ip: 192.168.1.0/24 + - port: "80" + proto: tcp + rule: allow + to_ip: 10.0.0.0/8 + from_ip: 192.168.1.0/24 + tags: + - tag1 + - tag1 + public: true + alert: + spend_threshold: "3.14" + date_threshold: 2006-01-02T15:04:05-07:00 + name: My AwesomeTemplate + logo: https://example.com/logo.png + id: d290f1ee-6c54-4b01-90e6-d701748f0851 + properties: + id: + description: "Unique identifier for the template, generated by Shadeform" + example: d290f1ee-6c54-4b01-90e6-d701748f0851 + type: string + name: + description: Name of the template + example: My AwesomeTemplate + type: string + description: + description: Description of the template + example: A template for running vLLM + type: string + author: + description: Author of the template + example: John Doe + type: string + logo: + description: URL to the template's logo + example: https://example.com/logo.png + type: string + public: + description: Whether the template is publicly available + example: true + type: boolean + launch_configuration: + $ref: '#/components/schemas/LaunchConfiguration' + auto_delete: + $ref: '#/components/schemas/AutoDelete' + alert: + $ref: '#/components/schemas/Alert' + volume_mount: + $ref: '#/components/schemas/VolumeMount' + tags: + description: "Add custom, searchable tags to instances." + items: + $ref: '#/components/schemas/Tag' + type: array + envs: + description: List of environment variable name and values to automatically + add to the instance + items: + $ref: '#/components/schemas/Env' + type: array + networking: + $ref: '#/components/schemas/Networking' + required: + - id + - name + type: object + TemplatesResponse: + example: + templates: + - volume_mount: + auto: true + author: John Doe + launch_configuration: + docker_configuration: + args: --model mistralai/Mistral-7B-v0.1 + shared_memory_in_gb: 8 + image: vllm/vllm-openai:latest + port_mappings: + - container_port: 8000 + host_port: 80 + - container_port: 8000 + host_port: 80 + registry_credentials: + password: password + username: username + envs: + - name: HUGGING_FACE_HUB_TOKEN + value: hugging_face_api_token + - name: HUGGING_FACE_HUB_TOKEN + value: hugging_face_api_token + volume_mounts: + - host_path: "~/.cache/huggingface" + container_path: /root/.cache/huggingface + - host_path: "~/.cache/huggingface" + container_path: /root/.cache/huggingface + script_configuration: + base64_script: IyEvYmluL2Jhc2gKCiMgRW5kbGVzcyBsb29wCndoaWxlIHRydWUKZG8KICAgICMgRmV0Y2ggYSBjYXQgZmFjdCB3aXRoIGEgbWF4aW11bSBsZW5ndGggb2YgMTQwIGNoYXJhY3RlcnMKICAgIGN1cmwgLS1uby1wcm9ncmVzcy1tZXRlciBodHRwczovL2NhdGZhY3QubmluamEvZmFjdD9tYXhfbGVuZ3RoPTE0MAoKICAgICMgUHJpbnQgYSBuZXdsaW5lIGZvciByZWFkYWJpbGl0eQogICAgZWNobwoKICAgICMgU2xlZXAgZm9yIDMgc2Vjb25kcyBiZWZvcmUgdGhlIG5leHQgaXRlcmF0aW9uCiAgICBzbGVlcCAzCmRvbmUKCgo= + type: docker + auto_delete: + spend_threshold: "3.14" + date_threshold: 2006-01-02T15:04:05-07:00 + description: A template for running vLLM + envs: + - name: HUGGING_FACE_HUB_TOKEN + value: hugging_face_api_token + - name: HUGGING_FACE_HUB_TOKEN + value: hugging_face_api_token + networking: + ufw_rules: + - port: "80" + proto: tcp + rule: allow + to_ip: 10.0.0.0/8 + from_ip: 192.168.1.0/24 + - port: "80" + proto: tcp + rule: allow + to_ip: 10.0.0.0/8 + from_ip: 192.168.1.0/24 + tags: + - tag1 + - tag1 + public: true + alert: + spend_threshold: "3.14" + date_threshold: 2006-01-02T15:04:05-07:00 + name: My AwesomeTemplate + logo: https://example.com/logo.png + id: d290f1ee-6c54-4b01-90e6-d701748f0851 + - volume_mount: + auto: true + author: John Doe + launch_configuration: + docker_configuration: + args: --model mistralai/Mistral-7B-v0.1 + shared_memory_in_gb: 8 + image: vllm/vllm-openai:latest + port_mappings: + - container_port: 8000 + host_port: 80 + - container_port: 8000 + host_port: 80 + registry_credentials: + password: password + username: username + envs: + - name: HUGGING_FACE_HUB_TOKEN + value: hugging_face_api_token + - name: HUGGING_FACE_HUB_TOKEN + value: hugging_face_api_token + volume_mounts: + - host_path: "~/.cache/huggingface" + container_path: /root/.cache/huggingface + - host_path: "~/.cache/huggingface" + container_path: /root/.cache/huggingface + script_configuration: + base64_script: IyEvYmluL2Jhc2gKCiMgRW5kbGVzcyBsb29wCndoaWxlIHRydWUKZG8KICAgICMgRmV0Y2ggYSBjYXQgZmFjdCB3aXRoIGEgbWF4aW11bSBsZW5ndGggb2YgMTQwIGNoYXJhY3RlcnMKICAgIGN1cmwgLS1uby1wcm9ncmVzcy1tZXRlciBodHRwczovL2NhdGZhY3QubmluamEvZmFjdD9tYXhfbGVuZ3RoPTE0MAoKICAgICMgUHJpbnQgYSBuZXdsaW5lIGZvciByZWFkYWJpbGl0eQogICAgZWNobwoKICAgICMgU2xlZXAgZm9yIDMgc2Vjb25kcyBiZWZvcmUgdGhlIG5leHQgaXRlcmF0aW9uCiAgICBzbGVlcCAzCmRvbmUKCgo= + type: docker + auto_delete: + spend_threshold: "3.14" + date_threshold: 2006-01-02T15:04:05-07:00 + description: A template for running vLLM + envs: + - name: HUGGING_FACE_HUB_TOKEN + value: hugging_face_api_token + - name: HUGGING_FACE_HUB_TOKEN + value: hugging_face_api_token + networking: + ufw_rules: + - port: "80" + proto: tcp + rule: allow + to_ip: 10.0.0.0/8 + from_ip: 192.168.1.0/24 + - port: "80" + proto: tcp + rule: allow + to_ip: 10.0.0.0/8 + from_ip: 192.168.1.0/24 + tags: + - tag1 + - tag1 + public: true + alert: + spend_threshold: "3.14" + date_threshold: 2006-01-02T15:04:05-07:00 + name: My AwesomeTemplate + logo: https://example.com/logo.png + id: d290f1ee-6c54-4b01-90e6-d701748f0851 + properties: + templates: + items: + $ref: '#/components/schemas/Template' + type: array + required: + - templates + type: object + FeaturedTemplate: + properties: + name: + description: Name of the featured template + example: Featured Template + type: string + description: + description: Description of the featured template + example: A featured template for ML workloads + type: string + public: + description: Whether the template is publicly available + example: true + type: boolean + launch_configuration: + description: Configuration for launching the instance + type: object + auto_delete: + description: Auto-deletion configuration + type: object + alert: + description: Alert configuration + type: object + volume_mount: + description: Volume mount configuration + type: object + tags: + description: Tags associated with the template + example: + - ml + - pytorch + items: + type: string + type: array + envs: + description: Environment variables for the template + items: + $ref: '#/components/schemas/Env' + type: array + networking: + $ref: '#/components/schemas/Networking' + required: + - description + - name + - public + type: object + FeaturedTemplatesResponse: + properties: + templates: + items: + $ref: '#/components/schemas/FeaturedTemplate' + type: array + required: + - templates + type: object + TemplateSaveRequest: + example: + volume_mount: + auto: true + public: true + alert: + spend_threshold: "3.14" + date_threshold: 2006-01-02T15:04:05-07:00 + launch_configuration: + docker_configuration: + args: --model mistralai/Mistral-7B-v0.1 + shared_memory_in_gb: 8 + image: vllm/vllm-openai:latest + port_mappings: + - container_port: 8000 + host_port: 80 + - container_port: 8000 + host_port: 80 + registry_credentials: + password: password + username: username + envs: + - name: HUGGING_FACE_HUB_TOKEN + value: hugging_face_api_token + - name: HUGGING_FACE_HUB_TOKEN + value: hugging_face_api_token + volume_mounts: + - host_path: "~/.cache/huggingface" + container_path: /root/.cache/huggingface + - host_path: "~/.cache/huggingface" + container_path: /root/.cache/huggingface + script_configuration: + base64_script: IyEvYmluL2Jhc2gKCiMgRW5kbGVzcyBsb29wCndoaWxlIHRydWUKZG8KICAgICMgRmV0Y2ggYSBjYXQgZmFjdCB3aXRoIGEgbWF4aW11bSBsZW5ndGggb2YgMTQwIGNoYXJhY3RlcnMKICAgIGN1cmwgLS1uby1wcm9ncmVzcy1tZXRlciBodHRwczovL2NhdGZhY3QubmluamEvZmFjdD9tYXhfbGVuZ3RoPTE0MAoKICAgICMgUHJpbnQgYSBuZXdsaW5lIGZvciByZWFkYWJpbGl0eQogICAgZWNobwoKICAgICMgU2xlZXAgZm9yIDMgc2Vjb25kcyBiZWZvcmUgdGhlIG5leHQgaXRlcmF0aW9uCiAgICBzbGVlcCAzCmRvbmUKCgo= + type: docker + name: My Template + auto_delete: + spend_threshold: "3.14" + date_threshold: 2006-01-02T15:04:05-07:00 + description: A template for ML workloads + envs: + - name: HUGGING_FACE_HUB_TOKEN + value: hugging_face_api_token + - name: HUGGING_FACE_HUB_TOKEN + value: hugging_face_api_token + networking: + ufw_rules: + - port: "80" + proto: tcp + rule: allow + to_ip: 10.0.0.0/8 + from_ip: 192.168.1.0/24 + - port: "80" + proto: tcp + rule: allow + to_ip: 10.0.0.0/8 + from_ip: 192.168.1.0/24 + tags: + - ml + - pytorch + properties: + name: + description: Name of the template + example: My Template + type: string + description: + description: Description of the template + example: A template for ML workloads + type: string + public: + description: Whether the template is publicly available + example: true + type: boolean + launch_configuration: + $ref: '#/components/schemas/LaunchConfiguration' + auto_delete: + $ref: '#/components/schemas/AutoDelete' + alert: + $ref: '#/components/schemas/Alert' + volume_mount: + $ref: '#/components/schemas/VolumeMount' + tags: + description: Tags associated with the template + example: + - ml + - pytorch + items: + type: string + type: array + envs: + description: Environment variables for the template + items: + $ref: '#/components/schemas/Env' + type: array + networking: + $ref: '#/components/schemas/Networking' + required: + - name + type: object + Networking: + description: Network configuration including firewall rules + example: + ufw_rules: + - port: "80" + proto: tcp + rule: allow + to_ip: 10.0.0.0/8 + from_ip: 192.168.1.0/24 + - port: "80" + proto: tcp + rule: allow + to_ip: 10.0.0.0/8 + from_ip: 192.168.1.0/24 + properties: + ufw_rules: + description: List of UFW (Uncomplicated Firewall) rules + items: + $ref: '#/components/schemas/UfwRule' + type: array + type: object + UfwRule: + description: Uncomplicated Firewall rule configuration + example: + port: "80" + proto: tcp + rule: allow + to_ip: 10.0.0.0/8 + from_ip: 192.168.1.0/24 + properties: + rule: + description: The UFW rule action + example: allow + type: string + from_ip: + description: Source IP address or CIDR range + example: 192.168.1.0/24 + nullable: true + type: string + to_ip: + description: Destination IP address or CIDR range + example: 10.0.0.0/8 + nullable: true + type: string + port: + description: Port number or range (e.g. '80' or '8000:8999') + example: "80" + nullable: true + type: string + proto: + description: "Protocol (e.g. tcp, udp)" + example: tcp + nullable: true + type: string + type: object + TemplateCreateResponse: + description: Response of the /templates/save API call + example: + id: d290f1ee-6c54-4b01-90e6-d701748f0851 + properties: + id: + description: "The unique identifier for the instance. Used in the instances\ + \ for the /instances/{id}/info and /instances/{id}/delete APIs." + example: d290f1ee-6c54-4b01-90e6-d701748f0851 + format: uuid + type: string + required: + - id + type: object + Instance_configuration: + allOf: + - $ref: '#/components/schemas/InstanceConfiguration' + - properties: + os: + description: The operating system of the instance. + example: ubuntu_22_shade_os + type: string + required: + - os + type: object + example: + nvlink: true + os: ubuntu_22_shade_os + num_gpus: 1 + gpu_type: A100 + memory_in_gb: 12 + vram_per_gpu_in_gb: 48 + vcpus: 6 + storage_in_gb: 256 + interconnect: pcie + VolumeTypes_inner: + example: + cloud: hyperstack + fixed_size: true + supports_multi_mount: true + price_per_gb_per_hour: "0.0001" + region: canada-1 + properties: + cloud: + $ref: '#/components/schemas/Cloud' + region: + description: Specifies the region. + example: canada-1 + type: string + supports_multi_mount: + description: Denotes whether the volume supports multiple instances mounting + to it at the same time. + example: true + type: boolean + fixed_size: + description: Denotes whether the volume is fixed in size or elastically + scaling. + example: true + type: boolean + price_per_gb_per_hour: + description: Price of the specified volume type per GB per hour + example: "0.0001" + type: string + required: + - cloud + - fixed_size + - price_per_gb_per_hour + - region + - supports_multi_mount + type: object + securitySchemes: + ApiKeyAuth: + in: header + name: X-API-KEY + type: apiKey diff --git a/internal/shadeform/gen/shadeform/api_default.go b/internal/shadeform/gen/shadeform/api_default.go new file mode 100644 index 00000000..3b361f64 --- /dev/null +++ b/internal/shadeform/gen/shadeform/api_default.go @@ -0,0 +1,2722 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// DefaultAPIService DefaultAPI service +type DefaultAPIService service + +type ApiInstancesRequest struct { + ctx context.Context + ApiService *DefaultAPIService +} + +func (r ApiInstancesRequest) Execute() (*InstancesResponse, *http.Response, error) { + return r.ApiService.InstancesExecute(r) +} + +/* +Instances /instances + +Get active and pending instances. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiInstancesRequest +*/ +func (a *DefaultAPIService) Instances(ctx context.Context) ApiInstancesRequest { + return ApiInstancesRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return InstancesResponse +func (a *DefaultAPIService) InstancesExecute(r ApiInstancesRequest) (*InstancesResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *InstancesResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.Instances") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/instances" + + 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 + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-KEY"] = key + } + } + } + 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, + } + 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 ApiInstancesCreateRequest struct { + ctx context.Context + ApiService *DefaultAPIService + createRequest *CreateRequest +} + +func (r ApiInstancesCreateRequest) CreateRequest(createRequest CreateRequest) ApiInstancesCreateRequest { + r.createRequest = &createRequest + return r +} + +func (r ApiInstancesCreateRequest) Execute() (*CreateResponse, *http.Response, error) { + return r.ApiService.InstancesCreateExecute(r) +} + +/* +InstancesCreate /instances/create + +Create a new GPU instance. Our create API is designed to be asynchronous, so the response will be a CreateResponse object with a status of "creating". We then have a process that will pick it up and create it. You can poll the /instances/{id}/info endpoint to check the status of the instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiInstancesCreateRequest +*/ +func (a *DefaultAPIService) InstancesCreate(ctx context.Context) ApiInstancesCreateRequest { + return ApiInstancesCreateRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return CreateResponse +func (a *DefaultAPIService) InstancesCreateExecute(r ApiInstancesCreateRequest) (*CreateResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CreateResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.InstancesCreate") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/instances/create" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // 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.createRequest + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-KEY"] = key + } + } + } + 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, + } + 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 ApiInstancesDeleteRequest struct { + ctx context.Context + ApiService *DefaultAPIService + id string +} + +func (r ApiInstancesDeleteRequest) Execute() (*http.Response, error) { + return r.ApiService.InstancesDeleteExecute(r) +} + +/* +InstancesDelete /instances/{id}/delete + +Delete an instance. Some cloud providers may only allow deletion of an instance after it has moved to the 'active' status. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id The instance id + @return ApiInstancesDeleteRequest +*/ +func (a *DefaultAPIService) InstancesDelete(ctx context.Context, id string) ApiInstancesDeleteRequest { + return ApiInstancesDeleteRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +func (a *DefaultAPIService) InstancesDeleteExecute(r ApiInstancesDeleteRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.InstancesDelete") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/instances/{id}/delete" + 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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-KEY"] = key + } + } + } + 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, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiInstancesInfoRequest struct { + ctx context.Context + ApiService *DefaultAPIService + id string +} + +func (r ApiInstancesInfoRequest) Execute() (*InstanceInfoResponse, *http.Response, error) { + return r.ApiService.InstancesInfoExecute(r) +} + +/* +InstancesInfo /instances/{id}/info + +Get details for the specified instance in the url. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id The instance id + @return ApiInstancesInfoRequest +*/ +func (a *DefaultAPIService) InstancesInfo(ctx context.Context, id string) ApiInstancesInfoRequest { + return ApiInstancesInfoRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return InstanceInfoResponse +func (a *DefaultAPIService) InstancesInfoExecute(r ApiInstancesInfoRequest) (*InstanceInfoResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *InstanceInfoResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.InstancesInfo") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/instances/{id}/info" + 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 + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-KEY"] = key + } + } + } + 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, + } + 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 ApiInstancesRestartRequest struct { + ctx context.Context + ApiService *DefaultAPIService + id string +} + +func (r ApiInstancesRestartRequest) Execute() (*http.Response, error) { + return r.ApiService.InstancesRestartExecute(r) +} + +/* +InstancesRestart /instances/{id}/restart + +Restart an instance. The status of the instance will stay as 'active' throughout, but you may have to wait a few minutes for the instance to be ready to use again. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id The instance id + @return ApiInstancesRestartRequest +*/ +func (a *DefaultAPIService) InstancesRestart(ctx context.Context, id string) ApiInstancesRestartRequest { + return ApiInstancesRestartRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +func (a *DefaultAPIService) InstancesRestartExecute(r ApiInstancesRestartRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.InstancesRestart") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/instances/{id}/restart" + 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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-KEY"] = key + } + } + } + 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, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiInstancesTypesRequest struct { + ctx context.Context + ApiService *DefaultAPIService + cloud *string + region *string + numGpus *string + gpuType *string + shadeInstanceType *string + available *bool + sort *string +} + +// Filter the instance type results by cloud. +func (r ApiInstancesTypesRequest) Cloud(cloud string) ApiInstancesTypesRequest { + r.cloud = &cloud + return r +} + +// Filter the instance type results by region. +func (r ApiInstancesTypesRequest) Region(region string) ApiInstancesTypesRequest { + r.region = ®ion + return r +} + +// Filter the instance type results by the number of gpus. +func (r ApiInstancesTypesRequest) NumGpus(numGpus string) ApiInstancesTypesRequest { + r.numGpus = &numGpus + return r +} + +// Filter the instance type results by gpu type. +func (r ApiInstancesTypesRequest) GpuType(gpuType string) ApiInstancesTypesRequest { + r.gpuType = &gpuType + return r +} + +// Filter the instance type results by the shade instance type. +func (r ApiInstancesTypesRequest) ShadeInstanceType(shadeInstanceType string) ApiInstancesTypesRequest { + r.shadeInstanceType = &shadeInstanceType + return r +} + +// Filter the instance type results by availability. +func (r ApiInstancesTypesRequest) Available(available bool) ApiInstancesTypesRequest { + r.available = &available + return r +} + +// Sort the order of the instance type results. +func (r ApiInstancesTypesRequest) Sort(sort string) ApiInstancesTypesRequest { + r.sort = &sort + return r +} + +func (r ApiInstancesTypesRequest) Execute() (*InstanceTypesResponse, *http.Response, error) { + return r.ApiService.InstancesTypesExecute(r) +} + +/* +InstancesTypes /instances/types + +Return all the GPU instance types with their corresponding availability and specs. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiInstancesTypesRequest +*/ +func (a *DefaultAPIService) InstancesTypes(ctx context.Context) ApiInstancesTypesRequest { + return ApiInstancesTypesRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return InstanceTypesResponse +func (a *DefaultAPIService) InstancesTypesExecute(r ApiInstancesTypesRequest) (*InstanceTypesResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *InstanceTypesResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.InstancesTypes") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/instances/types" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.cloud != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "cloud", r.cloud, "form", "") + } + if r.region != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "region", r.region, "form", "") + } + if r.numGpus != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "num_gpus", r.numGpus, "form", "") + } + if r.gpuType != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "gpu_type", r.gpuType, "form", "") + } + if r.shadeInstanceType != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "shade_instance_type", r.shadeInstanceType, "form", "") + } + if r.available != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "available", r.available, "form", "") + } + if r.sort != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "sort", r.sort, "form", "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-KEY"] = key + } + } + } + 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, + } + 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 ApiInstancesUpdateRequest struct { + ctx context.Context + ApiService *DefaultAPIService + id string + updateRequest *UpdateRequest +} + +func (r ApiInstancesUpdateRequest) UpdateRequest(updateRequest UpdateRequest) ApiInstancesUpdateRequest { + r.updateRequest = &updateRequest + return r +} + +func (r ApiInstancesUpdateRequest) Execute() (*http.Response, error) { + return r.ApiService.InstancesUpdateExecute(r) +} + +/* +InstancesUpdate /instances/{id}/update + +Update mutable details about the instance. Set a value to null to delete it. Omit a value or leave undefined to keep unchanged. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id The instance id + @return ApiInstancesUpdateRequest +*/ +func (a *DefaultAPIService) InstancesUpdate(ctx context.Context, id string) ApiInstancesUpdateRequest { + return ApiInstancesUpdateRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +func (a *DefaultAPIService) InstancesUpdateExecute(r ApiInstancesUpdateRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.InstancesUpdate") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/instances/{id}/update" + 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{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateRequest + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-KEY"] = key + } + } + } + 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, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiSshKeysRequest struct { + ctx context.Context + ApiService *DefaultAPIService +} + +func (r ApiSshKeysRequest) Execute() (*SshKeysResponse, *http.Response, error) { + return r.ApiService.SshKeysExecute(r) +} + +/* +SshKeys /sshkeys + +Get all SSH Keys for the account. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiSshKeysRequest +*/ +func (a *DefaultAPIService) SshKeys(ctx context.Context) ApiSshKeysRequest { + return ApiSshKeysRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return SshKeysResponse +func (a *DefaultAPIService) SshKeysExecute(r ApiSshKeysRequest) (*SshKeysResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SshKeysResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.SshKeys") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/sshkeys" + + 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 + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-KEY"] = key + } + } + } + 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, + } + 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 ApiSshKeysAddRequest struct { + ctx context.Context + ApiService *DefaultAPIService + addSshKeyRequest *AddSshKeyRequest +} + +func (r ApiSshKeysAddRequest) AddSshKeyRequest(addSshKeyRequest AddSshKeyRequest) ApiSshKeysAddRequest { + r.addSshKeyRequest = &addSshKeyRequest + return r +} + +func (r ApiSshKeysAddRequest) Execute() (*AddSshKeyResponse, *http.Response, error) { + return r.ApiService.SshKeysAddExecute(r) +} + +/* +SshKeysAdd /sshkeys/add + +Add a new SSH Key + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiSshKeysAddRequest +*/ +func (a *DefaultAPIService) SshKeysAdd(ctx context.Context) ApiSshKeysAddRequest { + return ApiSshKeysAddRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return AddSshKeyResponse +func (a *DefaultAPIService) SshKeysAddExecute(r ApiSshKeysAddRequest) (*AddSshKeyResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AddSshKeyResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.SshKeysAdd") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/sshkeys/add" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // 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.addSshKeyRequest + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-KEY"] = key + } + } + } + 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, + } + 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 ApiSshKeysDeleteRequest struct { + ctx context.Context + ApiService *DefaultAPIService + id string +} + +func (r ApiSshKeysDeleteRequest) Execute() (*http.Response, error) { + return r.ApiService.SshKeysDeleteExecute(r) +} + +/* +SshKeysDelete /sshkeys/{id}/delete + +Delete an ssh key. The Shadeform managed SSH Key, current default ssh key, and in use SSH Keys cannot be deleted. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id The ssh key id + @return ApiSshKeysDeleteRequest +*/ +func (a *DefaultAPIService) SshKeysDelete(ctx context.Context, id string) ApiSshKeysDeleteRequest { + return ApiSshKeysDeleteRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +func (a *DefaultAPIService) SshKeysDeleteExecute(r ApiSshKeysDeleteRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.SshKeysDelete") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/sshkeys/{id}/delete" + 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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-KEY"] = key + } + } + } + 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, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiSshKeysInfoRequest struct { + ctx context.Context + ApiService *DefaultAPIService + id string +} + +func (r ApiSshKeysInfoRequest) Execute() (*SshKey, *http.Response, error) { + return r.ApiService.SshKeysInfoExecute(r) +} + +/* +SshKeysInfo /sshkeys/{id}/info + +Get details for the specified SSH Key in the url. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id The ssh key id + @return ApiSshKeysInfoRequest +*/ +func (a *DefaultAPIService) SshKeysInfo(ctx context.Context, id string) ApiSshKeysInfoRequest { + return ApiSshKeysInfoRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return SshKey +func (a *DefaultAPIService) SshKeysInfoExecute(r ApiSshKeysInfoRequest) (*SshKey, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SshKey + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.SshKeysInfo") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/sshkeys/{id}/info" + 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 + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-KEY"] = key + } + } + } + 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, + } + 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 ApiSshKeysSetDefaultRequest struct { + ctx context.Context + ApiService *DefaultAPIService + id string +} + +func (r ApiSshKeysSetDefaultRequest) Execute() (*http.Response, error) { + return r.ApiService.SshKeysSetDefaultExecute(r) +} + +/* +SshKeysSetDefault /sshkeys/{id}/setdefault + +Set the specified SSH Key as the default SSH Key used by Shadeform. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id The ssh key id + @return ApiSshKeysSetDefaultRequest +*/ +func (a *DefaultAPIService) SshKeysSetDefault(ctx context.Context, id string) ApiSshKeysSetDefaultRequest { + return ApiSshKeysSetDefaultRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +func (a *DefaultAPIService) SshKeysSetDefaultExecute(r ApiSshKeysSetDefaultRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.SshKeysSetDefault") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/sshkeys/{id}/setdefault" + 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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-KEY"] = key + } + } + } + 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, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiTemplatesRequest struct { + ctx context.Context + ApiService *DefaultAPIService +} + +func (r ApiTemplatesRequest) Execute() (*TemplatesResponse, *http.Response, error) { + return r.ApiService.TemplatesExecute(r) +} + +/* +Templates /templates + +List all templates created by the user + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTemplatesRequest +*/ +func (a *DefaultAPIService) Templates(ctx context.Context) ApiTemplatesRequest { + return ApiTemplatesRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return TemplatesResponse +func (a *DefaultAPIService) TemplatesExecute(r ApiTemplatesRequest) (*TemplatesResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *TemplatesResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.Templates") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/templates" + + 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 + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-KEY"] = key + } + } + } + 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, + } + 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 ApiTemplatesDeleteRequest struct { + ctx context.Context + ApiService *DefaultAPIService + templateId string +} + +func (r ApiTemplatesDeleteRequest) Execute() (*http.Response, error) { + return r.ApiService.TemplatesDeleteExecute(r) +} + +/* +TemplatesDelete /templates/{template_id}/delete + +Delete a template + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param templateId The template ID + @return ApiTemplatesDeleteRequest +*/ +func (a *DefaultAPIService) TemplatesDelete(ctx context.Context, templateId string) ApiTemplatesDeleteRequest { + return ApiTemplatesDeleteRequest{ + ApiService: a, + ctx: ctx, + templateId: templateId, + } +} + +// Execute executes the request +func (a *DefaultAPIService) TemplatesDeleteExecute(r ApiTemplatesDeleteRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.TemplatesDelete") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/templates/{template_id}/delete" + localVarPath = strings.Replace(localVarPath, "{"+"template_id"+"}", url.PathEscape(parameterValueToString(r.templateId, "templateId")), -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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-KEY"] = key + } + } + } + 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, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiTemplatesFeaturedRequest struct { + ctx context.Context + ApiService *DefaultAPIService +} + +func (r ApiTemplatesFeaturedRequest) Execute() (*TemplatesResponse, *http.Response, error) { + return r.ApiService.TemplatesFeaturedExecute(r) +} + +/* +TemplatesFeatured /templates/featured + +List featured templates + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTemplatesFeaturedRequest +*/ +func (a *DefaultAPIService) TemplatesFeatured(ctx context.Context) ApiTemplatesFeaturedRequest { + return ApiTemplatesFeaturedRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return TemplatesResponse +func (a *DefaultAPIService) TemplatesFeaturedExecute(r ApiTemplatesFeaturedRequest) (*TemplatesResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *TemplatesResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.TemplatesFeatured") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/templates/featured" + + 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 + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-KEY"] = key + } + } + } + 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, + } + 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 ApiTemplatesInfoRequest struct { + ctx context.Context + ApiService *DefaultAPIService + templateId string +} + +func (r ApiTemplatesInfoRequest) Execute() (*Template, *http.Response, error) { + return r.ApiService.TemplatesInfoExecute(r) +} + +/* +TemplatesInfo /templates/{template_id}/info + +Get information about a specific template + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param templateId The template ID + @return ApiTemplatesInfoRequest +*/ +func (a *DefaultAPIService) TemplatesInfo(ctx context.Context, templateId string) ApiTemplatesInfoRequest { + return ApiTemplatesInfoRequest{ + ApiService: a, + ctx: ctx, + templateId: templateId, + } +} + +// Execute executes the request +// +// @return Template +func (a *DefaultAPIService) TemplatesInfoExecute(r ApiTemplatesInfoRequest) (*Template, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Template + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.TemplatesInfo") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/templates/{template_id}/info" + localVarPath = strings.Replace(localVarPath, "{"+"template_id"+"}", url.PathEscape(parameterValueToString(r.templateId, "templateId")), -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 + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-KEY"] = key + } + } + } + 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, + } + 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 ApiTemplatesSaveRequest struct { + ctx context.Context + ApiService *DefaultAPIService + templateSaveRequest *TemplateSaveRequest +} + +func (r ApiTemplatesSaveRequest) TemplateSaveRequest(templateSaveRequest TemplateSaveRequest) ApiTemplatesSaveRequest { + r.templateSaveRequest = &templateSaveRequest + return r +} + +func (r ApiTemplatesSaveRequest) Execute() (*TemplateCreateResponse, *http.Response, error) { + return r.ApiService.TemplatesSaveExecute(r) +} + +/* +TemplatesSave /templates/save + +Create a new template + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTemplatesSaveRequest +*/ +func (a *DefaultAPIService) TemplatesSave(ctx context.Context) ApiTemplatesSaveRequest { + return ApiTemplatesSaveRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return TemplateCreateResponse +func (a *DefaultAPIService) TemplatesSaveExecute(r ApiTemplatesSaveRequest) (*TemplateCreateResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *TemplateCreateResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.TemplatesSave") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/templates/save" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.templateSaveRequest == nil { + return localVarReturnValue, nil, reportError("templateSaveRequest 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.templateSaveRequest + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-KEY"] = key + } + } + } + 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, + } + 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 ApiTemplatesUpdateRequest struct { + ctx context.Context + ApiService *DefaultAPIService + templateId string + templateSaveRequest *TemplateSaveRequest +} + +func (r ApiTemplatesUpdateRequest) TemplateSaveRequest(templateSaveRequest TemplateSaveRequest) ApiTemplatesUpdateRequest { + r.templateSaveRequest = &templateSaveRequest + return r +} + +func (r ApiTemplatesUpdateRequest) Execute() (*http.Response, error) { + return r.ApiService.TemplatesUpdateExecute(r) +} + +/* +TemplatesUpdate /templates/{template_id}/update + +Update an existing template + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param templateId The template ID + @return ApiTemplatesUpdateRequest +*/ +func (a *DefaultAPIService) TemplatesUpdate(ctx context.Context, templateId string) ApiTemplatesUpdateRequest { + return ApiTemplatesUpdateRequest{ + ApiService: a, + ctx: ctx, + templateId: templateId, + } +} + +// Execute executes the request +func (a *DefaultAPIService) TemplatesUpdateExecute(r ApiTemplatesUpdateRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.TemplatesUpdate") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/templates/{template_id}/update" + localVarPath = strings.Replace(localVarPath, "{"+"template_id"+"}", url.PathEscape(parameterValueToString(r.templateId, "templateId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.templateSaveRequest == nil { + return nil, reportError("templateSaveRequest 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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.templateSaveRequest + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-KEY"] = key + } + } + } + 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, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiVolumesRequest struct { + ctx context.Context + ApiService *DefaultAPIService +} + +func (r ApiVolumesRequest) Execute() (*VolumesResponse, *http.Response, error) { + return r.ApiService.VolumesExecute(r) +} + +/* +Volumes /volumes + +Get all storage volumes for the account. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVolumesRequest +*/ +func (a *DefaultAPIService) Volumes(ctx context.Context) ApiVolumesRequest { + return ApiVolumesRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return VolumesResponse +func (a *DefaultAPIService) VolumesExecute(r ApiVolumesRequest) (*VolumesResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VolumesResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.Volumes") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/volumes" + + 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 + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-KEY"] = key + } + } + } + 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, + } + 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 ApiVolumesCreateRequest struct { + ctx context.Context + ApiService *DefaultAPIService + createVolumeRequest *CreateVolumeRequest +} + +func (r ApiVolumesCreateRequest) CreateVolumeRequest(createVolumeRequest CreateVolumeRequest) ApiVolumesCreateRequest { + r.createVolumeRequest = &createVolumeRequest + return r +} + +func (r ApiVolumesCreateRequest) Execute() (*CreateVolumeResponse, *http.Response, error) { + return r.ApiService.VolumesCreateExecute(r) +} + +/* +VolumesCreate /volumes/create + +Create a new storage volume + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVolumesCreateRequest +*/ +func (a *DefaultAPIService) VolumesCreate(ctx context.Context) ApiVolumesCreateRequest { + return ApiVolumesCreateRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return CreateVolumeResponse +func (a *DefaultAPIService) VolumesCreateExecute(r ApiVolumesCreateRequest) (*CreateVolumeResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CreateVolumeResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.VolumesCreate") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/volumes/create" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // 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.createVolumeRequest + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-KEY"] = key + } + } + } + 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, + } + 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 ApiVolumesDeleteRequest struct { + ctx context.Context + ApiService *DefaultAPIService + id string +} + +func (r ApiVolumesDeleteRequest) Execute() (*http.Response, error) { + return r.ApiService.VolumesDeleteExecute(r) +} + +/* +VolumesDelete /volumes/{id}/delete + +Delete a storage volume. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id The volume id. + @return ApiVolumesDeleteRequest +*/ +func (a *DefaultAPIService) VolumesDelete(ctx context.Context, id string) ApiVolumesDeleteRequest { + return ApiVolumesDeleteRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +func (a *DefaultAPIService) VolumesDeleteExecute(r ApiVolumesDeleteRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.VolumesDelete") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/volumes/{id}/delete" + 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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-KEY"] = key + } + } + } + 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, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiVolumesInfoRequest struct { + ctx context.Context + ApiService *DefaultAPIService + id string +} + +func (r ApiVolumesInfoRequest) Execute() (*Volume, *http.Response, error) { + return r.ApiService.VolumesInfoExecute(r) +} + +/* +VolumesInfo /volumes/{id}/info + +Get details for the specified storage volume. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id The volume id. + @return ApiVolumesInfoRequest +*/ +func (a *DefaultAPIService) VolumesInfo(ctx context.Context, id string) ApiVolumesInfoRequest { + return ApiVolumesInfoRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return Volume +func (a *DefaultAPIService) VolumesInfoExecute(r ApiVolumesInfoRequest) (*Volume, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Volume + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.VolumesInfo") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/volumes/{id}/info" + 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 + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-KEY"] = key + } + } + } + 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, + } + 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 ApiVolumesTypesRequest struct { + ctx context.Context + ApiService *DefaultAPIService +} + +func (r ApiVolumesTypesRequest) Execute() (*VolumesTypesResponse, *http.Response, error) { + return r.ApiService.VolumesTypesExecute(r) +} + +/* +VolumesTypes /volumes/types + +Get list of supported storage volumes. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVolumesTypesRequest +*/ +func (a *DefaultAPIService) VolumesTypes(ctx context.Context) ApiVolumesTypesRequest { + return ApiVolumesTypesRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return VolumesTypesResponse +func (a *DefaultAPIService) VolumesTypesExecute(r ApiVolumesTypesRequest) (*VolumesTypesResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VolumesTypesResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.VolumesTypes") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/volumes/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 + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-KEY"] = key + } + } + } + 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, + } + 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/shadeform/gen/shadeform/client.go b/internal/shadeform/gen/shadeform/client.go new file mode 100644 index 00000000..1dfbb52c --- /dev/null +++ b/internal/shadeform/gen/shadeform/client.go @@ -0,0 +1,652 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// 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 Shadeform API API v1.0.0 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + + // API Services + + DefaultAPI *DefaultAPIService +} + +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.DefaultAPI = (*DefaultAPIService)(&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. + + } + + 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/shadeform/gen/shadeform/configuration.go b/internal/shadeform/gen/shadeform/configuration.go new file mode 100644 index 00000000..7ac71c26 --- /dev/null +++ b/internal/shadeform/gen/shadeform/configuration.go @@ -0,0 +1,218 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// 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 ( + // ContextAPIKeys takes a string apikey as authentication for the request + ContextAPIKeys = contextKey("apiKeys") + + // 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://api.shadeform.ai/v1", + Description: "Shadeform Production", + }, + }, + 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/shadeform/gen/shadeform/docs/AddSshKeyRequest.md b/internal/shadeform/gen/shadeform/docs/AddSshKeyRequest.md new file mode 100644 index 00000000..a5786270 --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/AddSshKeyRequest.md @@ -0,0 +1,72 @@ +# AddSshKeyRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | The name of the SSH Key. | +**PublicKey** | **string** | The public key. | + +## Methods + +### NewAddSshKeyRequest + +`func NewAddSshKeyRequest(name string, publicKey string, ) *AddSshKeyRequest` + +NewAddSshKeyRequest instantiates a new AddSshKeyRequest 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 + +### NewAddSshKeyRequestWithDefaults + +`func NewAddSshKeyRequestWithDefaults() *AddSshKeyRequest` + +NewAddSshKeyRequestWithDefaults instantiates a new AddSshKeyRequest 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 *AddSshKeyRequest) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *AddSshKeyRequest) 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 *AddSshKeyRequest) SetName(v string)` + +SetName sets Name field to given value. + + +### GetPublicKey + +`func (o *AddSshKeyRequest) GetPublicKey() string` + +GetPublicKey returns the PublicKey field if non-nil, zero value otherwise. + +### GetPublicKeyOk + +`func (o *AddSshKeyRequest) GetPublicKeyOk() (*string, bool)` + +GetPublicKeyOk returns a tuple with the PublicKey field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPublicKey + +`func (o *AddSshKeyRequest) SetPublicKey(v string)` + +SetPublicKey sets PublicKey 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/shadeform/gen/shadeform/docs/AddSshKeyResponse.md b/internal/shadeform/gen/shadeform/docs/AddSshKeyResponse.md new file mode 100644 index 00000000..a21fcb3f --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/AddSshKeyResponse.md @@ -0,0 +1,51 @@ +# AddSshKeyResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **string** | The ID of the SSH Key. | + +## Methods + +### NewAddSshKeyResponse + +`func NewAddSshKeyResponse(id string, ) *AddSshKeyResponse` + +NewAddSshKeyResponse instantiates a new AddSshKeyResponse 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 + +### NewAddSshKeyResponseWithDefaults + +`func NewAddSshKeyResponseWithDefaults() *AddSshKeyResponse` + +NewAddSshKeyResponseWithDefaults instantiates a new AddSshKeyResponse 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 *AddSshKeyResponse) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *AddSshKeyResponse) 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 *AddSshKeyResponse) SetId(v string)` + +SetId sets Id 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/shadeform/gen/shadeform/docs/Alert.md b/internal/shadeform/gen/shadeform/docs/Alert.md new file mode 100644 index 00000000..b3a2a05d --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/Alert.md @@ -0,0 +1,82 @@ +# Alert + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**DateThreshold** | Pointer to **string** | RFC3339 date string | [optional] +**SpendThreshold** | Pointer to **string** | Valid decimal representation of a dollar amount | [optional] + +## Methods + +### NewAlert + +`func NewAlert() *Alert` + +NewAlert instantiates a new Alert 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 + +### NewAlertWithDefaults + +`func NewAlertWithDefaults() *Alert` + +NewAlertWithDefaults instantiates a new Alert 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 + +### GetDateThreshold + +`func (o *Alert) GetDateThreshold() string` + +GetDateThreshold returns the DateThreshold field if non-nil, zero value otherwise. + +### GetDateThresholdOk + +`func (o *Alert) GetDateThresholdOk() (*string, bool)` + +GetDateThresholdOk returns a tuple with the DateThreshold field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDateThreshold + +`func (o *Alert) SetDateThreshold(v string)` + +SetDateThreshold sets DateThreshold field to given value. + +### HasDateThreshold + +`func (o *Alert) HasDateThreshold() bool` + +HasDateThreshold returns a boolean if a field has been set. + +### GetSpendThreshold + +`func (o *Alert) GetSpendThreshold() string` + +GetSpendThreshold returns the SpendThreshold field if non-nil, zero value otherwise. + +### GetSpendThresholdOk + +`func (o *Alert) GetSpendThresholdOk() (*string, bool)` + +GetSpendThresholdOk returns a tuple with the SpendThreshold field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSpendThreshold + +`func (o *Alert) SetSpendThreshold(v string)` + +SetSpendThreshold sets SpendThreshold field to given value. + +### HasSpendThreshold + +`func (o *Alert) HasSpendThreshold() bool` + +HasSpendThreshold 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/shadeform/gen/shadeform/docs/AutoDelete.md b/internal/shadeform/gen/shadeform/docs/AutoDelete.md new file mode 100644 index 00000000..da9a9b03 --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/AutoDelete.md @@ -0,0 +1,82 @@ +# AutoDelete + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**DateThreshold** | Pointer to **string** | RFC3339 date string | [optional] +**SpendThreshold** | Pointer to **string** | Valid decimal representation of a dollar amount | [optional] + +## Methods + +### NewAutoDelete + +`func NewAutoDelete() *AutoDelete` + +NewAutoDelete instantiates a new AutoDelete 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 + +### NewAutoDeleteWithDefaults + +`func NewAutoDeleteWithDefaults() *AutoDelete` + +NewAutoDeleteWithDefaults instantiates a new AutoDelete 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 + +### GetDateThreshold + +`func (o *AutoDelete) GetDateThreshold() string` + +GetDateThreshold returns the DateThreshold field if non-nil, zero value otherwise. + +### GetDateThresholdOk + +`func (o *AutoDelete) GetDateThresholdOk() (*string, bool)` + +GetDateThresholdOk returns a tuple with the DateThreshold field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDateThreshold + +`func (o *AutoDelete) SetDateThreshold(v string)` + +SetDateThreshold sets DateThreshold field to given value. + +### HasDateThreshold + +`func (o *AutoDelete) HasDateThreshold() bool` + +HasDateThreshold returns a boolean if a field has been set. + +### GetSpendThreshold + +`func (o *AutoDelete) GetSpendThreshold() string` + +GetSpendThreshold returns the SpendThreshold field if non-nil, zero value otherwise. + +### GetSpendThresholdOk + +`func (o *AutoDelete) GetSpendThresholdOk() (*string, bool)` + +GetSpendThresholdOk returns a tuple with the SpendThreshold field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSpendThreshold + +`func (o *AutoDelete) SetSpendThreshold(v string)` + +SetSpendThreshold sets SpendThreshold field to given value. + +### HasSpendThreshold + +`func (o *AutoDelete) HasSpendThreshold() bool` + +HasSpendThreshold 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/shadeform/gen/shadeform/docs/Availability.md b/internal/shadeform/gen/shadeform/docs/Availability.md new file mode 100644 index 00000000..364e30c2 --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/Availability.md @@ -0,0 +1,93 @@ +# Availability + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Region** | **string** | Specifies the region. | +**Available** | **bool** | Indicate whether the instance is available in the region. | +**DisplayName** | **string** | The display name of the region | + +## Methods + +### NewAvailability + +`func NewAvailability(region string, available bool, displayName string, ) *Availability` + +NewAvailability instantiates a new Availability 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 + +### NewAvailabilityWithDefaults + +`func NewAvailabilityWithDefaults() *Availability` + +NewAvailabilityWithDefaults instantiates a new Availability 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 + +### GetRegion + +`func (o *Availability) GetRegion() string` + +GetRegion returns the Region field if non-nil, zero value otherwise. + +### GetRegionOk + +`func (o *Availability) GetRegionOk() (*string, bool)` + +GetRegionOk returns a tuple with the Region field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRegion + +`func (o *Availability) SetRegion(v string)` + +SetRegion sets Region field to given value. + + +### GetAvailable + +`func (o *Availability) GetAvailable() bool` + +GetAvailable returns the Available field if non-nil, zero value otherwise. + +### GetAvailableOk + +`func (o *Availability) GetAvailableOk() (*bool, bool)` + +GetAvailableOk returns a tuple with the Available field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAvailable + +`func (o *Availability) SetAvailable(v bool)` + +SetAvailable sets Available field to given value. + + +### GetDisplayName + +`func (o *Availability) GetDisplayName() string` + +GetDisplayName returns the DisplayName field if non-nil, zero value otherwise. + +### GetDisplayNameOk + +`func (o *Availability) GetDisplayNameOk() (*string, bool)` + +GetDisplayNameOk returns a tuple with the DisplayName field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDisplayName + +`func (o *Availability) SetDisplayName(v string)` + +SetDisplayName sets DisplayName 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/shadeform/gen/shadeform/docs/Cloud.md b/internal/shadeform/gen/shadeform/docs/Cloud.md new file mode 100644 index 00000000..993ac0f8 --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/Cloud.md @@ -0,0 +1,61 @@ +# Cloud + +## Enum + + +* `LAMBDALABS` (value: `"lambdalabs"`) + +* `PAPERSPACE` (value: `"paperspace"`) + +* `VULTR` (value: `"vultr"`) + +* `DATACRUNCH` (value: `"datacrunch"`) + +* `LATITUDE` (value: `"latitude"`) + +* `MASSEDCOMPUTE` (value: `"massedcompute"`) + +* `IMWT` (value: `"imwt"`) + +* `HYPERSTACK` (value: `"hyperstack"`) + +* `NEBIUS` (value: `"nebius"`) + +* `CRUSOE` (value: `"crusoe"`) + +* `DENVR` (value: `"denvr"`) + +* `DIGITALOCEAN` (value: `"digitalocean"`) + +* `TCM` (value: `"tcm"`) + +* `HOTAISLE` (value: `"hotaisle"`) + +* `CUDO` (value: `"cudo"`) + +* `SCALEWAY` (value: `"scaleway"`) + +* `EVERGREEN` (value: `"evergreen"`) + +* `EXCESSSUPPLY` (value: `"excesssupply"`) + +* `VOLTAGEPARK` (value: `"voltagepark"`) + +* `BOOSTRUN` (value: `"boostrun"`) + +* `IONSTREAM` (value: `"ionstream"`) + +* `WHITEFIBER` (value: `"whitefiber"`) + +* `HORIZON` (value: `"horizon"`) + +* `FPT` (value: `"fpt"`) + +* `HYDRA` (value: `"hydra"`) + +* `AMAYA` (value: `"amaya"`) + + +[[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/shadeform/gen/shadeform/docs/CreateRequest.md b/internal/shadeform/gen/shadeform/docs/CreateRequest.md new file mode 100644 index 00000000..ae416863 --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/CreateRequest.md @@ -0,0 +1,395 @@ +# CreateRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Cloud** | [**Cloud**](Cloud.md) | | +**Region** | **string** | Specifies the region. | +**ShadeInstanceType** | **string** | The Shadeform standardized instance type. See this [explanation](/getting-started/concepts#shade-instance-type-and-cloud-instance-type) for more details. | +**ShadeCloud** | **bool** | Specifies if the instance is launched in [Shade Cloud](/getting-started/concepts#shade-cloud) or in a linked cloud account. | +**Name** | **string** | The name of the instance | +**Os** | Pointer to **string** | The operating system of the instance. | [optional] +**TemplateId** | Pointer to **string** | The ID of the template to use for this instance | [optional] +**LaunchConfiguration** | Pointer to [**LaunchConfiguration**](LaunchConfiguration.md) | | [optional] +**VolumeIds** | Pointer to **[]string** | List of volume IDs to be mounted. Currently only supports 1 volume at a time. | [optional] +**SshKeyId** | Pointer to **string** | The ID of the SSH Key. | [optional] +**AutoDelete** | Pointer to [**AutoDelete**](AutoDelete.md) | | [optional] +**Alert** | Pointer to [**Alert**](Alert.md) | | [optional] +**VolumeMount** | Pointer to [**VolumeMount**](VolumeMount.md) | | [optional] +**Tags** | Pointer to **[]string** | Add custom, searchable tags to instances. | [optional] +**Envs** | Pointer to [**[]Env**](Env.md) | List of environment variable name and values to automatically add to the instance | [optional] + +## Methods + +### NewCreateRequest + +`func NewCreateRequest(cloud Cloud, region string, shadeInstanceType string, shadeCloud bool, name string, ) *CreateRequest` + +NewCreateRequest instantiates a new CreateRequest 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 + +### NewCreateRequestWithDefaults + +`func NewCreateRequestWithDefaults() *CreateRequest` + +NewCreateRequestWithDefaults instantiates a new CreateRequest 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 + +### GetCloud + +`func (o *CreateRequest) GetCloud() Cloud` + +GetCloud returns the Cloud field if non-nil, zero value otherwise. + +### GetCloudOk + +`func (o *CreateRequest) GetCloudOk() (*Cloud, bool)` + +GetCloudOk returns a tuple with the Cloud field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCloud + +`func (o *CreateRequest) SetCloud(v Cloud)` + +SetCloud sets Cloud field to given value. + + +### GetRegion + +`func (o *CreateRequest) GetRegion() string` + +GetRegion returns the Region field if non-nil, zero value otherwise. + +### GetRegionOk + +`func (o *CreateRequest) GetRegionOk() (*string, bool)` + +GetRegionOk returns a tuple with the Region field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRegion + +`func (o *CreateRequest) SetRegion(v string)` + +SetRegion sets Region field to given value. + + +### GetShadeInstanceType + +`func (o *CreateRequest) GetShadeInstanceType() string` + +GetShadeInstanceType returns the ShadeInstanceType field if non-nil, zero value otherwise. + +### GetShadeInstanceTypeOk + +`func (o *CreateRequest) GetShadeInstanceTypeOk() (*string, bool)` + +GetShadeInstanceTypeOk returns a tuple with the ShadeInstanceType field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetShadeInstanceType + +`func (o *CreateRequest) SetShadeInstanceType(v string)` + +SetShadeInstanceType sets ShadeInstanceType field to given value. + + +### GetShadeCloud + +`func (o *CreateRequest) GetShadeCloud() bool` + +GetShadeCloud returns the ShadeCloud field if non-nil, zero value otherwise. + +### GetShadeCloudOk + +`func (o *CreateRequest) GetShadeCloudOk() (*bool, bool)` + +GetShadeCloudOk returns a tuple with the ShadeCloud field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetShadeCloud + +`func (o *CreateRequest) SetShadeCloud(v bool)` + +SetShadeCloud sets ShadeCloud field to given value. + + +### GetName + +`func (o *CreateRequest) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *CreateRequest) 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 *CreateRequest) SetName(v string)` + +SetName sets Name field to given value. + + +### GetOs + +`func (o *CreateRequest) GetOs() string` + +GetOs returns the Os field if non-nil, zero value otherwise. + +### GetOsOk + +`func (o *CreateRequest) GetOsOk() (*string, bool)` + +GetOsOk returns a tuple with the Os field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetOs + +`func (o *CreateRequest) SetOs(v string)` + +SetOs sets Os field to given value. + +### HasOs + +`func (o *CreateRequest) HasOs() bool` + +HasOs returns a boolean if a field has been set. + +### GetTemplateId + +`func (o *CreateRequest) GetTemplateId() string` + +GetTemplateId returns the TemplateId field if non-nil, zero value otherwise. + +### GetTemplateIdOk + +`func (o *CreateRequest) GetTemplateIdOk() (*string, bool)` + +GetTemplateIdOk returns a tuple with the TemplateId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTemplateId + +`func (o *CreateRequest) SetTemplateId(v string)` + +SetTemplateId sets TemplateId field to given value. + +### HasTemplateId + +`func (o *CreateRequest) HasTemplateId() bool` + +HasTemplateId returns a boolean if a field has been set. + +### GetLaunchConfiguration + +`func (o *CreateRequest) GetLaunchConfiguration() LaunchConfiguration` + +GetLaunchConfiguration returns the LaunchConfiguration field if non-nil, zero value otherwise. + +### GetLaunchConfigurationOk + +`func (o *CreateRequest) GetLaunchConfigurationOk() (*LaunchConfiguration, bool)` + +GetLaunchConfigurationOk returns a tuple with the LaunchConfiguration field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLaunchConfiguration + +`func (o *CreateRequest) SetLaunchConfiguration(v LaunchConfiguration)` + +SetLaunchConfiguration sets LaunchConfiguration field to given value. + +### HasLaunchConfiguration + +`func (o *CreateRequest) HasLaunchConfiguration() bool` + +HasLaunchConfiguration returns a boolean if a field has been set. + +### GetVolumeIds + +`func (o *CreateRequest) GetVolumeIds() []string` + +GetVolumeIds returns the VolumeIds field if non-nil, zero value otherwise. + +### GetVolumeIdsOk + +`func (o *CreateRequest) GetVolumeIdsOk() (*[]string, bool)` + +GetVolumeIdsOk returns a tuple with the VolumeIds field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetVolumeIds + +`func (o *CreateRequest) SetVolumeIds(v []string)` + +SetVolumeIds sets VolumeIds field to given value. + +### HasVolumeIds + +`func (o *CreateRequest) HasVolumeIds() bool` + +HasVolumeIds returns a boolean if a field has been set. + +### GetSshKeyId + +`func (o *CreateRequest) GetSshKeyId() string` + +GetSshKeyId returns the SshKeyId field if non-nil, zero value otherwise. + +### GetSshKeyIdOk + +`func (o *CreateRequest) GetSshKeyIdOk() (*string, bool)` + +GetSshKeyIdOk returns a tuple with the SshKeyId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSshKeyId + +`func (o *CreateRequest) SetSshKeyId(v string)` + +SetSshKeyId sets SshKeyId field to given value. + +### HasSshKeyId + +`func (o *CreateRequest) HasSshKeyId() bool` + +HasSshKeyId returns a boolean if a field has been set. + +### GetAutoDelete + +`func (o *CreateRequest) GetAutoDelete() AutoDelete` + +GetAutoDelete returns the AutoDelete field if non-nil, zero value otherwise. + +### GetAutoDeleteOk + +`func (o *CreateRequest) GetAutoDeleteOk() (*AutoDelete, bool)` + +GetAutoDeleteOk returns a tuple with the AutoDelete field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAutoDelete + +`func (o *CreateRequest) SetAutoDelete(v AutoDelete)` + +SetAutoDelete sets AutoDelete field to given value. + +### HasAutoDelete + +`func (o *CreateRequest) HasAutoDelete() bool` + +HasAutoDelete returns a boolean if a field has been set. + +### GetAlert + +`func (o *CreateRequest) GetAlert() Alert` + +GetAlert returns the Alert field if non-nil, zero value otherwise. + +### GetAlertOk + +`func (o *CreateRequest) GetAlertOk() (*Alert, bool)` + +GetAlertOk returns a tuple with the Alert field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAlert + +`func (o *CreateRequest) SetAlert(v Alert)` + +SetAlert sets Alert field to given value. + +### HasAlert + +`func (o *CreateRequest) HasAlert() bool` + +HasAlert returns a boolean if a field has been set. + +### GetVolumeMount + +`func (o *CreateRequest) GetVolumeMount() VolumeMount` + +GetVolumeMount returns the VolumeMount field if non-nil, zero value otherwise. + +### GetVolumeMountOk + +`func (o *CreateRequest) GetVolumeMountOk() (*VolumeMount, bool)` + +GetVolumeMountOk returns a tuple with the VolumeMount field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetVolumeMount + +`func (o *CreateRequest) SetVolumeMount(v VolumeMount)` + +SetVolumeMount sets VolumeMount field to given value. + +### HasVolumeMount + +`func (o *CreateRequest) HasVolumeMount() bool` + +HasVolumeMount returns a boolean if a field has been set. + +### GetTags + +`func (o *CreateRequest) GetTags() []string` + +GetTags returns the Tags field if non-nil, zero value otherwise. + +### GetTagsOk + +`func (o *CreateRequest) GetTagsOk() (*[]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 *CreateRequest) SetTags(v []string)` + +SetTags sets Tags field to given value. + +### HasTags + +`func (o *CreateRequest) HasTags() bool` + +HasTags returns a boolean if a field has been set. + +### GetEnvs + +`func (o *CreateRequest) GetEnvs() []Env` + +GetEnvs returns the Envs field if non-nil, zero value otherwise. + +### GetEnvsOk + +`func (o *CreateRequest) GetEnvsOk() (*[]Env, bool)` + +GetEnvsOk returns a tuple with the Envs field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEnvs + +`func (o *CreateRequest) SetEnvs(v []Env)` + +SetEnvs sets Envs field to given value. + +### HasEnvs + +`func (o *CreateRequest) HasEnvs() bool` + +HasEnvs 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/shadeform/gen/shadeform/docs/CreateResponse.md b/internal/shadeform/gen/shadeform/docs/CreateResponse.md new file mode 100644 index 00000000..db268b79 --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/CreateResponse.md @@ -0,0 +1,51 @@ +# CreateResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **string** | The unique identifier for the instance. Used in the instances for the /instances/{id}/info and /instances/{id}/delete APIs. | + +## Methods + +### NewCreateResponse + +`func NewCreateResponse(id string, ) *CreateResponse` + +NewCreateResponse instantiates a new CreateResponse 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 + +### NewCreateResponseWithDefaults + +`func NewCreateResponseWithDefaults() *CreateResponse` + +NewCreateResponseWithDefaults instantiates a new CreateResponse 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 *CreateResponse) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *CreateResponse) 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 *CreateResponse) SetId(v string)` + +SetId sets Id 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/shadeform/gen/shadeform/docs/CreateVolumeRequest.md b/internal/shadeform/gen/shadeform/docs/CreateVolumeRequest.md new file mode 100644 index 00000000..7a4993a3 --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/CreateVolumeRequest.md @@ -0,0 +1,114 @@ +# CreateVolumeRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Cloud** | [**Cloud**](Cloud.md) | | +**Region** | **string** | Specifies the region. | +**SizeInGb** | **int32** | Storage volume size in GB | +**Name** | **string** | The name of the storage volume. | + +## Methods + +### NewCreateVolumeRequest + +`func NewCreateVolumeRequest(cloud Cloud, region string, sizeInGb int32, name string, ) *CreateVolumeRequest` + +NewCreateVolumeRequest instantiates a new CreateVolumeRequest 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 + +### NewCreateVolumeRequestWithDefaults + +`func NewCreateVolumeRequestWithDefaults() *CreateVolumeRequest` + +NewCreateVolumeRequestWithDefaults instantiates a new CreateVolumeRequest 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 + +### GetCloud + +`func (o *CreateVolumeRequest) GetCloud() Cloud` + +GetCloud returns the Cloud field if non-nil, zero value otherwise. + +### GetCloudOk + +`func (o *CreateVolumeRequest) GetCloudOk() (*Cloud, bool)` + +GetCloudOk returns a tuple with the Cloud field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCloud + +`func (o *CreateVolumeRequest) SetCloud(v Cloud)` + +SetCloud sets Cloud field to given value. + + +### GetRegion + +`func (o *CreateVolumeRequest) GetRegion() string` + +GetRegion returns the Region field if non-nil, zero value otherwise. + +### GetRegionOk + +`func (o *CreateVolumeRequest) GetRegionOk() (*string, bool)` + +GetRegionOk returns a tuple with the Region field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRegion + +`func (o *CreateVolumeRequest) SetRegion(v string)` + +SetRegion sets Region field to given value. + + +### GetSizeInGb + +`func (o *CreateVolumeRequest) GetSizeInGb() int32` + +GetSizeInGb returns the SizeInGb field if non-nil, zero value otherwise. + +### GetSizeInGbOk + +`func (o *CreateVolumeRequest) GetSizeInGbOk() (*int32, bool)` + +GetSizeInGbOk returns a tuple with the SizeInGb field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSizeInGb + +`func (o *CreateVolumeRequest) SetSizeInGb(v int32)` + +SetSizeInGb sets SizeInGb field to given value. + + +### GetName + +`func (o *CreateVolumeRequest) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *CreateVolumeRequest) 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 *CreateVolumeRequest) SetName(v string)` + +SetName sets Name 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/shadeform/gen/shadeform/docs/CreateVolumeResponse.md b/internal/shadeform/gen/shadeform/docs/CreateVolumeResponse.md new file mode 100644 index 00000000..39a985df --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/CreateVolumeResponse.md @@ -0,0 +1,51 @@ +# CreateVolumeResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **string** | The ID of the storage volume. | + +## Methods + +### NewCreateVolumeResponse + +`func NewCreateVolumeResponse(id string, ) *CreateVolumeResponse` + +NewCreateVolumeResponse instantiates a new CreateVolumeResponse 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 + +### NewCreateVolumeResponseWithDefaults + +`func NewCreateVolumeResponseWithDefaults() *CreateVolumeResponse` + +NewCreateVolumeResponseWithDefaults instantiates a new CreateVolumeResponse 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 *CreateVolumeResponse) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *CreateVolumeResponse) 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 *CreateVolumeResponse) SetId(v string)` + +SetId sets Id 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/shadeform/gen/shadeform/docs/DefaultAPI.md b/internal/shadeform/gen/shadeform/docs/DefaultAPI.md new file mode 100644 index 00000000..1434cd6e --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/DefaultAPI.md @@ -0,0 +1,1567 @@ +# \DefaultAPI + +All URIs are relative to *https://api.shadeform.ai/v1* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**Instances**](DefaultAPI.md#Instances) | **Get** /instances | /instances +[**InstancesCreate**](DefaultAPI.md#InstancesCreate) | **Post** /instances/create | /instances/create +[**InstancesDelete**](DefaultAPI.md#InstancesDelete) | **Post** /instances/{id}/delete | /instances/{id}/delete +[**InstancesInfo**](DefaultAPI.md#InstancesInfo) | **Get** /instances/{id}/info | /instances/{id}/info +[**InstancesRestart**](DefaultAPI.md#InstancesRestart) | **Post** /instances/{id}/restart | /instances/{id}/restart +[**InstancesTypes**](DefaultAPI.md#InstancesTypes) | **Get** /instances/types | /instances/types +[**InstancesUpdate**](DefaultAPI.md#InstancesUpdate) | **Post** /instances/{id}/update | /instances/{id}/update +[**SshKeys**](DefaultAPI.md#SshKeys) | **Get** /sshkeys | /sshkeys +[**SshKeysAdd**](DefaultAPI.md#SshKeysAdd) | **Post** /sshkeys/add | /sshkeys/add +[**SshKeysDelete**](DefaultAPI.md#SshKeysDelete) | **Post** /sshkeys/{id}/delete | /sshkeys/{id}/delete +[**SshKeysInfo**](DefaultAPI.md#SshKeysInfo) | **Get** /sshkeys/{id}/info | /sshkeys/{id}/info +[**SshKeysSetDefault**](DefaultAPI.md#SshKeysSetDefault) | **Post** /sshkeys/{id}/setdefault | /sshkeys/{id}/setdefault +[**Templates**](DefaultAPI.md#Templates) | **Get** /templates | /templates +[**TemplatesDelete**](DefaultAPI.md#TemplatesDelete) | **Post** /templates/{template_id}/delete | /templates/{template_id}/delete +[**TemplatesFeatured**](DefaultAPI.md#TemplatesFeatured) | **Get** /templates/featured | /templates/featured +[**TemplatesInfo**](DefaultAPI.md#TemplatesInfo) | **Get** /templates/{template_id}/info | /templates/{template_id}/info +[**TemplatesSave**](DefaultAPI.md#TemplatesSave) | **Post** /templates/save | /templates/save +[**TemplatesUpdate**](DefaultAPI.md#TemplatesUpdate) | **Post** /templates/{template_id}/update | /templates/{template_id}/update +[**Volumes**](DefaultAPI.md#Volumes) | **Get** /volumes | /volumes +[**VolumesCreate**](DefaultAPI.md#VolumesCreate) | **Post** /volumes/create | /volumes/create +[**VolumesDelete**](DefaultAPI.md#VolumesDelete) | **Post** /volumes/{id}/delete | /volumes/{id}/delete +[**VolumesInfo**](DefaultAPI.md#VolumesInfo) | **Get** /volumes/{id}/info | /volumes/{id}/info +[**VolumesTypes**](DefaultAPI.md#VolumesTypes) | **Get** /volumes/types | /volumes/types + + + +## Instances + +> InstancesResponse Instances(ctx).Execute() + +/instances + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/shadeform/cloud-shadeform" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefaultAPI.Instances(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.Instances``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `Instances`: InstancesResponse + fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.Instances`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiInstancesRequest struct via the builder pattern + + +### Return type + +[**InstancesResponse**](InstancesResponse.md) + +### Authorization + +[ApiKeyAuth](../README.md#ApiKeyAuth) + +### 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) + + +## InstancesCreate + +> CreateResponse InstancesCreate(ctx).CreateRequest(createRequest).Execute() + +/instances/create + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/shadeform/cloud-shadeform" +) + +func main() { + createRequest := *openapiclient.NewCreateRequest(openapiclient.Cloud("lambdalabs"), "canada-1", "A6000", true, "cool-gpu-server") // CreateRequest | (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefaultAPI.InstancesCreate(context.Background()).CreateRequest(createRequest).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.InstancesCreate``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `InstancesCreate`: CreateResponse + fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.InstancesCreate`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiInstancesCreateRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **createRequest** | [**CreateRequest**](CreateRequest.md) | | + +### Return type + +[**CreateResponse**](CreateResponse.md) + +### Authorization + +[ApiKeyAuth](../README.md#ApiKeyAuth) + +### 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) + + +## InstancesDelete + +> InstancesDelete(ctx, id).Execute() + +/instances/{id}/delete + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/shadeform/cloud-shadeform" +) + +func main() { + id := "d290f1ee-6c54-4b01-90e6-d701748f0851" // string | The instance id + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + r, err := apiClient.DefaultAPI.InstancesDelete(context.Background(), id).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.InstancesDelete``: %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** | The instance id | + +### Other Parameters + +Other parameters are passed through a pointer to a apiInstancesDeleteRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + + (empty response body) + +### Authorization + +[ApiKeyAuth](../README.md#ApiKeyAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[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) + + +## InstancesInfo + +> InstanceInfoResponse InstancesInfo(ctx, id).Execute() + +/instances/{id}/info + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/shadeform/cloud-shadeform" +) + +func main() { + id := "d290f1ee-6c54-4b01-90e6-d701748f0851" // string | The instance id + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefaultAPI.InstancesInfo(context.Background(), id).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.InstancesInfo``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `InstancesInfo`: InstanceInfoResponse + fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.InstancesInfo`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string** | The instance id | + +### Other Parameters + +Other parameters are passed through a pointer to a apiInstancesInfoRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**InstanceInfoResponse**](InstanceInfoResponse.md) + +### Authorization + +[ApiKeyAuth](../README.md#ApiKeyAuth) + +### 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) + + +## InstancesRestart + +> InstancesRestart(ctx, id).Execute() + +/instances/{id}/restart + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/shadeform/cloud-shadeform" +) + +func main() { + id := "d290f1ee-6c54-4b01-90e6-d701748f0851" // string | The instance id + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + r, err := apiClient.DefaultAPI.InstancesRestart(context.Background(), id).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.InstancesRestart``: %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** | The instance id | + +### Other Parameters + +Other parameters are passed through a pointer to a apiInstancesRestartRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + + (empty response body) + +### Authorization + +[ApiKeyAuth](../README.md#ApiKeyAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[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) + + +## InstancesTypes + +> InstanceTypesResponse InstancesTypes(ctx).Cloud(cloud).Region(region).NumGpus(numGpus).GpuType(gpuType).ShadeInstanceType(shadeInstanceType).Available(available).Sort(sort).Execute() + +/instances/types + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/shadeform/cloud-shadeform" +) + +func main() { + cloud := "aws" // string | Filter the instance type results by cloud. (optional) + region := "us-east-1a" // string | Filter the instance type results by region. (optional) + numGpus := "1" // string | Filter the instance type results by the number of gpus. (optional) + gpuType := "A100_80G" // string | Filter the instance type results by gpu type. (optional) + shadeInstanceType := "A100_80G" // string | Filter the instance type results by the shade instance type. (optional) + available := true // bool | Filter the instance type results by availability. (optional) + sort := "price" // string | Sort the order of the instance type results. (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefaultAPI.InstancesTypes(context.Background()).Cloud(cloud).Region(region).NumGpus(numGpus).GpuType(gpuType).ShadeInstanceType(shadeInstanceType).Available(available).Sort(sort).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.InstancesTypes``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `InstancesTypes`: InstanceTypesResponse + fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.InstancesTypes`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiInstancesTypesRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **cloud** | **string** | Filter the instance type results by cloud. | + **region** | **string** | Filter the instance type results by region. | + **numGpus** | **string** | Filter the instance type results by the number of gpus. | + **gpuType** | **string** | Filter the instance type results by gpu type. | + **shadeInstanceType** | **string** | Filter the instance type results by the shade instance type. | + **available** | **bool** | Filter the instance type results by availability. | + **sort** | **string** | Sort the order of the instance type results. | + +### Return type + +[**InstanceTypesResponse**](InstanceTypesResponse.md) + +### Authorization + +[ApiKeyAuth](../README.md#ApiKeyAuth) + +### 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) + + +## InstancesUpdate + +> InstancesUpdate(ctx, id).UpdateRequest(updateRequest).Execute() + +/instances/{id}/update + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/shadeform/cloud-shadeform" +) + +func main() { + id := "d290f1ee-6c54-4b01-90e6-d701748f0851" // string | The instance id + updateRequest := *openapiclient.NewUpdateRequest() // UpdateRequest | (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + r, err := apiClient.DefaultAPI.InstancesUpdate(context.Background(), id).UpdateRequest(updateRequest).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.InstancesUpdate``: %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** | The instance id | + +### Other Parameters + +Other parameters are passed through a pointer to a apiInstancesUpdateRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **updateRequest** | [**UpdateRequest**](UpdateRequest.md) | | + +### Return type + + (empty response body) + +### Authorization + +[ApiKeyAuth](../README.md#ApiKeyAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +[[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) + + +## SshKeys + +> SshKeysResponse SshKeys(ctx).Execute() + +/sshkeys + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/shadeform/cloud-shadeform" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefaultAPI.SshKeys(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.SshKeys``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `SshKeys`: SshKeysResponse + fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.SshKeys`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiSshKeysRequest struct via the builder pattern + + +### Return type + +[**SshKeysResponse**](SshKeysResponse.md) + +### Authorization + +[ApiKeyAuth](../README.md#ApiKeyAuth) + +### 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) + + +## SshKeysAdd + +> AddSshKeyResponse SshKeysAdd(ctx).AddSshKeyRequest(addSshKeyRequest).Execute() + +/sshkeys/add + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/shadeform/cloud-shadeform" +) + +func main() { + addSshKeyRequest := *openapiclient.NewAddSshKeyRequest("My ssh key", "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAklOUpkDHrfHY17SbrmTIpNLTGK9Tjom/BWDSU GPl+nafzlHDTYW7hdI4yZ5ew18JH4JW9jbhUFrviQzM7xlELEVf4h9lFX5QVkbPppSwg0cda3 Pbv7kOdJ/MTyBlWXFCR+HAo3FXRitBqxiX1nKhXpHAZsMciLq8V6RjsNAQwdsdMFvSlVK/7XA t3FaoJoAsncM1Q9x5+3V0Ww68/eIFmb1zuUFljQJKprrX88XypNDvjYNby6vw/Pb0rwert/En mZ+AW4OZPnTPI89ZPmVMLuayrD2cE86Z/il8b+gw3r3+1nKatmIkjn2so1d01QraTlMqVSsbx NrRFi9wrf+M7Q== schacon@mylaptop.local") // AddSshKeyRequest | (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefaultAPI.SshKeysAdd(context.Background()).AddSshKeyRequest(addSshKeyRequest).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.SshKeysAdd``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `SshKeysAdd`: AddSshKeyResponse + fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.SshKeysAdd`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiSshKeysAddRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **addSshKeyRequest** | [**AddSshKeyRequest**](AddSshKeyRequest.md) | | + +### Return type + +[**AddSshKeyResponse**](AddSshKeyResponse.md) + +### Authorization + +[ApiKeyAuth](../README.md#ApiKeyAuth) + +### 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) + + +## SshKeysDelete + +> SshKeysDelete(ctx, id).Execute() + +/sshkeys/{id}/delete + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/shadeform/cloud-shadeform" +) + +func main() { + id := "d290f1ee-6c54-4b01-90e6-d701748f0851" // string | The ssh key id + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + r, err := apiClient.DefaultAPI.SshKeysDelete(context.Background(), id).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.SshKeysDelete``: %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** | The ssh key id | + +### Other Parameters + +Other parameters are passed through a pointer to a apiSshKeysDeleteRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + + (empty response body) + +### Authorization + +[ApiKeyAuth](../README.md#ApiKeyAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[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) + + +## SshKeysInfo + +> SshKey SshKeysInfo(ctx, id).Execute() + +/sshkeys/{id}/info + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/shadeform/cloud-shadeform" +) + +func main() { + id := "d290f1ee-6c54-4b01-90e6-d701748f0851" // string | The ssh key id + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefaultAPI.SshKeysInfo(context.Background(), id).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.SshKeysInfo``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `SshKeysInfo`: SshKey + fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.SshKeysInfo`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string** | The ssh key id | + +### Other Parameters + +Other parameters are passed through a pointer to a apiSshKeysInfoRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**SshKey**](SshKey.md) + +### Authorization + +[ApiKeyAuth](../README.md#ApiKeyAuth) + +### 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) + + +## SshKeysSetDefault + +> SshKeysSetDefault(ctx, id).Execute() + +/sshkeys/{id}/setdefault + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/shadeform/cloud-shadeform" +) + +func main() { + id := "d290f1ee-6c54-4b01-90e6-d701748f0851" // string | The ssh key id + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + r, err := apiClient.DefaultAPI.SshKeysSetDefault(context.Background(), id).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.SshKeysSetDefault``: %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** | The ssh key id | + +### Other Parameters + +Other parameters are passed through a pointer to a apiSshKeysSetDefaultRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + + (empty response body) + +### Authorization + +[ApiKeyAuth](../README.md#ApiKeyAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[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) + + +## Templates + +> TemplatesResponse Templates(ctx).Execute() + +/templates + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/shadeform/cloud-shadeform" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefaultAPI.Templates(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.Templates``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `Templates`: TemplatesResponse + fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.Templates`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiTemplatesRequest struct via the builder pattern + + +### Return type + +[**TemplatesResponse**](TemplatesResponse.md) + +### Authorization + +[ApiKeyAuth](../README.md#ApiKeyAuth) + +### 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) + + +## TemplatesDelete + +> TemplatesDelete(ctx, templateId).Execute() + +/templates/{template_id}/delete + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/shadeform/cloud-shadeform" +) + +func main() { + templateId := "templateId_example" // string | The template ID + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + r, err := apiClient.DefaultAPI.TemplatesDelete(context.Background(), templateId).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.TemplatesDelete``: %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. +**templateId** | **string** | The template ID | + +### Other Parameters + +Other parameters are passed through a pointer to a apiTemplatesDeleteRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + + (empty response body) + +### Authorization + +[ApiKeyAuth](../README.md#ApiKeyAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[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) + + +## TemplatesFeatured + +> TemplatesResponse TemplatesFeatured(ctx).Execute() + +/templates/featured + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/shadeform/cloud-shadeform" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefaultAPI.TemplatesFeatured(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.TemplatesFeatured``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `TemplatesFeatured`: TemplatesResponse + fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.TemplatesFeatured`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiTemplatesFeaturedRequest struct via the builder pattern + + +### Return type + +[**TemplatesResponse**](TemplatesResponse.md) + +### Authorization + +[ApiKeyAuth](../README.md#ApiKeyAuth) + +### 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) + + +## TemplatesInfo + +> Template TemplatesInfo(ctx, templateId).Execute() + +/templates/{template_id}/info + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/shadeform/cloud-shadeform" +) + +func main() { + templateId := "templateId_example" // string | The template ID + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefaultAPI.TemplatesInfo(context.Background(), templateId).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.TemplatesInfo``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `TemplatesInfo`: Template + fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.TemplatesInfo`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**templateId** | **string** | The template ID | + +### Other Parameters + +Other parameters are passed through a pointer to a apiTemplatesInfoRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**Template**](Template.md) + +### Authorization + +[ApiKeyAuth](../README.md#ApiKeyAuth) + +### 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) + + +## TemplatesSave + +> TemplateCreateResponse TemplatesSave(ctx).TemplateSaveRequest(templateSaveRequest).Execute() + +/templates/save + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/shadeform/cloud-shadeform" +) + +func main() { + templateSaveRequest := *openapiclient.NewTemplateSaveRequest("My Template") // TemplateSaveRequest | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefaultAPI.TemplatesSave(context.Background()).TemplateSaveRequest(templateSaveRequest).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.TemplatesSave``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `TemplatesSave`: TemplateCreateResponse + fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.TemplatesSave`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTemplatesSaveRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **templateSaveRequest** | [**TemplateSaveRequest**](TemplateSaveRequest.md) | | + +### Return type + +[**TemplateCreateResponse**](TemplateCreateResponse.md) + +### Authorization + +[ApiKeyAuth](../README.md#ApiKeyAuth) + +### 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) + + +## TemplatesUpdate + +> TemplatesUpdate(ctx, templateId).TemplateSaveRequest(templateSaveRequest).Execute() + +/templates/{template_id}/update + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/shadeform/cloud-shadeform" +) + +func main() { + templateId := "templateId_example" // string | The template ID + templateSaveRequest := *openapiclient.NewTemplateSaveRequest("My Template") // TemplateSaveRequest | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + r, err := apiClient.DefaultAPI.TemplatesUpdate(context.Background(), templateId).TemplateSaveRequest(templateSaveRequest).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.TemplatesUpdate``: %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. +**templateId** | **string** | The template ID | + +### Other Parameters + +Other parameters are passed through a pointer to a apiTemplatesUpdateRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **templateSaveRequest** | [**TemplateSaveRequest**](TemplateSaveRequest.md) | | + +### Return type + + (empty response body) + +### Authorization + +[ApiKeyAuth](../README.md#ApiKeyAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +[[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) + + +## Volumes + +> VolumesResponse Volumes(ctx).Execute() + +/volumes + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/shadeform/cloud-shadeform" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefaultAPI.Volumes(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.Volumes``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `Volumes`: VolumesResponse + fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.Volumes`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiVolumesRequest struct via the builder pattern + + +### Return type + +[**VolumesResponse**](VolumesResponse.md) + +### Authorization + +[ApiKeyAuth](../README.md#ApiKeyAuth) + +### 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) + + +## VolumesCreate + +> CreateVolumeResponse VolumesCreate(ctx).CreateVolumeRequest(createVolumeRequest).Execute() + +/volumes/create + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/shadeform/cloud-shadeform" +) + +func main() { + createVolumeRequest := *openapiclient.NewCreateVolumeRequest(openapiclient.Cloud("lambdalabs"), "canada-1", int32(100), "My storage volume") // CreateVolumeRequest | (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefaultAPI.VolumesCreate(context.Background()).CreateVolumeRequest(createVolumeRequest).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.VolumesCreate``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `VolumesCreate`: CreateVolumeResponse + fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.VolumesCreate`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiVolumesCreateRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **createVolumeRequest** | [**CreateVolumeRequest**](CreateVolumeRequest.md) | | + +### Return type + +[**CreateVolumeResponse**](CreateVolumeResponse.md) + +### Authorization + +[ApiKeyAuth](../README.md#ApiKeyAuth) + +### 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) + + +## VolumesDelete + +> VolumesDelete(ctx, id).Execute() + +/volumes/{id}/delete + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/shadeform/cloud-shadeform" +) + +func main() { + id := "d290f1ee-6c54-4b01-90e6-d701748f0851" // string | The volume id. + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + r, err := apiClient.DefaultAPI.VolumesDelete(context.Background(), id).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.VolumesDelete``: %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** | The volume id. | + +### Other Parameters + +Other parameters are passed through a pointer to a apiVolumesDeleteRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + + (empty response body) + +### Authorization + +[ApiKeyAuth](../README.md#ApiKeyAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[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) + + +## VolumesInfo + +> Volume VolumesInfo(ctx, id).Execute() + +/volumes/{id}/info + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/shadeform/cloud-shadeform" +) + +func main() { + id := "d290f1ee-6c54-4b01-90e6-d701748f0851" // string | The volume id. + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefaultAPI.VolumesInfo(context.Background(), id).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.VolumesInfo``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `VolumesInfo`: Volume + fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.VolumesInfo`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string** | The volume id. | + +### Other Parameters + +Other parameters are passed through a pointer to a apiVolumesInfoRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**Volume**](Volume.md) + +### Authorization + +[ApiKeyAuth](../README.md#ApiKeyAuth) + +### 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) + + +## VolumesTypes + +> VolumesTypesResponse VolumesTypes(ctx).Execute() + +/volumes/types + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/shadeform/cloud-shadeform" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefaultAPI.VolumesTypes(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.VolumesTypes``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `VolumesTypes`: VolumesTypesResponse + fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.VolumesTypes`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiVolumesTypesRequest struct via the builder pattern + + +### Return type + +[**VolumesTypesResponse**](VolumesTypesResponse.md) + +### Authorization + +[ApiKeyAuth](../README.md#ApiKeyAuth) + +### 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/shadeform/gen/shadeform/docs/DockerConfiguration.md b/internal/shadeform/gen/shadeform/docs/DockerConfiguration.md new file mode 100644 index 00000000..eea79080 --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/DockerConfiguration.md @@ -0,0 +1,207 @@ +# DockerConfiguration + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Image** | **string** | Specifies the docker image to be pulled and run on the instance at startup. | +**Args** | Pointer to **string** | Specifies the container arguments passed into the image at runtime. | [optional] +**SharedMemoryInGb** | Pointer to **int32** | Describes the amount of shared memory allocated for the container. Equivalent to using the --shm-size flag in the docker cli. If shared_memory_in_gb is not specified, then the container will use the host namespace which is the equivalent of --ipc=host. | [optional] +**Envs** | Pointer to [**[]Env**](Env.md) | List of environment variable name-value pairs that will be passed to the docker container. | [optional] +**PortMappings** | Pointer to [**[]PortMappings**](PortMappings.md) | List of port mappings between the host instance and the docker container. Equivalent of -p flag for docker run command. | [optional] +**VolumeMounts** | Pointer to [**[]VolumeMounts**](VolumeMounts.md) | List of volume mounts between the host instance and the docker container. Equivalent of -v flag for docker run command. | [optional] +**RegistryCredentials** | Pointer to [**RegistryCredentials**](RegistryCredentials.md) | | [optional] + +## Methods + +### NewDockerConfiguration + +`func NewDockerConfiguration(image string, ) *DockerConfiguration` + +NewDockerConfiguration instantiates a new DockerConfiguration 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 + +### NewDockerConfigurationWithDefaults + +`func NewDockerConfigurationWithDefaults() *DockerConfiguration` + +NewDockerConfigurationWithDefaults instantiates a new DockerConfiguration 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 + +### GetImage + +`func (o *DockerConfiguration) GetImage() string` + +GetImage returns the Image field if non-nil, zero value otherwise. + +### GetImageOk + +`func (o *DockerConfiguration) 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 *DockerConfiguration) SetImage(v string)` + +SetImage sets Image field to given value. + + +### GetArgs + +`func (o *DockerConfiguration) GetArgs() string` + +GetArgs returns the Args field if non-nil, zero value otherwise. + +### GetArgsOk + +`func (o *DockerConfiguration) GetArgsOk() (*string, bool)` + +GetArgsOk returns a tuple with the Args field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetArgs + +`func (o *DockerConfiguration) SetArgs(v string)` + +SetArgs sets Args field to given value. + +### HasArgs + +`func (o *DockerConfiguration) HasArgs() bool` + +HasArgs returns a boolean if a field has been set. + +### GetSharedMemoryInGb + +`func (o *DockerConfiguration) GetSharedMemoryInGb() int32` + +GetSharedMemoryInGb returns the SharedMemoryInGb field if non-nil, zero value otherwise. + +### GetSharedMemoryInGbOk + +`func (o *DockerConfiguration) GetSharedMemoryInGbOk() (*int32, bool)` + +GetSharedMemoryInGbOk returns a tuple with the SharedMemoryInGb field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSharedMemoryInGb + +`func (o *DockerConfiguration) SetSharedMemoryInGb(v int32)` + +SetSharedMemoryInGb sets SharedMemoryInGb field to given value. + +### HasSharedMemoryInGb + +`func (o *DockerConfiguration) HasSharedMemoryInGb() bool` + +HasSharedMemoryInGb returns a boolean if a field has been set. + +### GetEnvs + +`func (o *DockerConfiguration) GetEnvs() []Env` + +GetEnvs returns the Envs field if non-nil, zero value otherwise. + +### GetEnvsOk + +`func (o *DockerConfiguration) GetEnvsOk() (*[]Env, bool)` + +GetEnvsOk returns a tuple with the Envs field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEnvs + +`func (o *DockerConfiguration) SetEnvs(v []Env)` + +SetEnvs sets Envs field to given value. + +### HasEnvs + +`func (o *DockerConfiguration) HasEnvs() bool` + +HasEnvs returns a boolean if a field has been set. + +### GetPortMappings + +`func (o *DockerConfiguration) GetPortMappings() []PortMappings` + +GetPortMappings returns the PortMappings field if non-nil, zero value otherwise. + +### GetPortMappingsOk + +`func (o *DockerConfiguration) GetPortMappingsOk() (*[]PortMappings, bool)` + +GetPortMappingsOk returns a tuple with the PortMappings field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPortMappings + +`func (o *DockerConfiguration) SetPortMappings(v []PortMappings)` + +SetPortMappings sets PortMappings field to given value. + +### HasPortMappings + +`func (o *DockerConfiguration) HasPortMappings() bool` + +HasPortMappings returns a boolean if a field has been set. + +### GetVolumeMounts + +`func (o *DockerConfiguration) GetVolumeMounts() []VolumeMounts` + +GetVolumeMounts returns the VolumeMounts field if non-nil, zero value otherwise. + +### GetVolumeMountsOk + +`func (o *DockerConfiguration) GetVolumeMountsOk() (*[]VolumeMounts, bool)` + +GetVolumeMountsOk returns a tuple with the VolumeMounts field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetVolumeMounts + +`func (o *DockerConfiguration) SetVolumeMounts(v []VolumeMounts)` + +SetVolumeMounts sets VolumeMounts field to given value. + +### HasVolumeMounts + +`func (o *DockerConfiguration) HasVolumeMounts() bool` + +HasVolumeMounts returns a boolean if a field has been set. + +### GetRegistryCredentials + +`func (o *DockerConfiguration) GetRegistryCredentials() RegistryCredentials` + +GetRegistryCredentials returns the RegistryCredentials field if non-nil, zero value otherwise. + +### GetRegistryCredentialsOk + +`func (o *DockerConfiguration) GetRegistryCredentialsOk() (*RegistryCredentials, bool)` + +GetRegistryCredentialsOk returns a tuple with the RegistryCredentials field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRegistryCredentials + +`func (o *DockerConfiguration) SetRegistryCredentials(v RegistryCredentials)` + +SetRegistryCredentials sets RegistryCredentials field to given value. + +### HasRegistryCredentials + +`func (o *DockerConfiguration) HasRegistryCredentials() bool` + +HasRegistryCredentials 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/shadeform/gen/shadeform/docs/Env.md b/internal/shadeform/gen/shadeform/docs/Env.md new file mode 100644 index 00000000..f224fd2a --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/Env.md @@ -0,0 +1,72 @@ +# Env + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | Name of the environment variable | +**Value** | **string** | Value of the environment variable | + +## Methods + +### NewEnv + +`func NewEnv(name string, value string, ) *Env` + +NewEnv instantiates a new Env 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 + +### NewEnvWithDefaults + +`func NewEnvWithDefaults() *Env` + +NewEnvWithDefaults instantiates a new Env 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 *Env) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *Env) 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 *Env) SetName(v string)` + +SetName sets Name field to given value. + + +### GetValue + +`func (o *Env) GetValue() string` + +GetValue returns the Value field if non-nil, zero value otherwise. + +### GetValueOk + +`func (o *Env) 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 *Env) SetValue(v string)` + +SetValue sets Value 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/shadeform/gen/shadeform/docs/FeaturedTemplate.md b/internal/shadeform/gen/shadeform/docs/FeaturedTemplate.md new file mode 100644 index 00000000..9cfc7a84 --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/FeaturedTemplate.md @@ -0,0 +1,275 @@ +# FeaturedTemplate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | Name of the featured template | +**Description** | **string** | Description of the featured template | +**Public** | **bool** | Whether the template is publicly available | +**LaunchConfiguration** | Pointer to **map[string]interface{}** | Configuration for launching the instance | [optional] +**AutoDelete** | Pointer to **map[string]interface{}** | Auto-deletion configuration | [optional] +**Alert** | Pointer to **map[string]interface{}** | Alert configuration | [optional] +**VolumeMount** | Pointer to **map[string]interface{}** | Volume mount configuration | [optional] +**Tags** | Pointer to **[]string** | Tags associated with the template | [optional] +**Envs** | Pointer to [**[]Env**](Env.md) | Environment variables for the template | [optional] +**Networking** | Pointer to [**Networking**](Networking.md) | | [optional] + +## Methods + +### NewFeaturedTemplate + +`func NewFeaturedTemplate(name string, description string, public bool, ) *FeaturedTemplate` + +NewFeaturedTemplate instantiates a new FeaturedTemplate 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 + +### NewFeaturedTemplateWithDefaults + +`func NewFeaturedTemplateWithDefaults() *FeaturedTemplate` + +NewFeaturedTemplateWithDefaults instantiates a new FeaturedTemplate 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 *FeaturedTemplate) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *FeaturedTemplate) 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 *FeaturedTemplate) SetName(v string)` + +SetName sets Name field to given value. + + +### GetDescription + +`func (o *FeaturedTemplate) GetDescription() string` + +GetDescription returns the Description field if non-nil, zero value otherwise. + +### GetDescriptionOk + +`func (o *FeaturedTemplate) GetDescriptionOk() (*string, bool)` + +GetDescriptionOk returns a tuple with the Description field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDescription + +`func (o *FeaturedTemplate) SetDescription(v string)` + +SetDescription sets Description field to given value. + + +### GetPublic + +`func (o *FeaturedTemplate) GetPublic() bool` + +GetPublic returns the Public field if non-nil, zero value otherwise. + +### GetPublicOk + +`func (o *FeaturedTemplate) GetPublicOk() (*bool, bool)` + +GetPublicOk returns a tuple with the Public field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPublic + +`func (o *FeaturedTemplate) SetPublic(v bool)` + +SetPublic sets Public field to given value. + + +### GetLaunchConfiguration + +`func (o *FeaturedTemplate) GetLaunchConfiguration() map[string]interface{}` + +GetLaunchConfiguration returns the LaunchConfiguration field if non-nil, zero value otherwise. + +### GetLaunchConfigurationOk + +`func (o *FeaturedTemplate) GetLaunchConfigurationOk() (*map[string]interface{}, bool)` + +GetLaunchConfigurationOk returns a tuple with the LaunchConfiguration field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLaunchConfiguration + +`func (o *FeaturedTemplate) SetLaunchConfiguration(v map[string]interface{})` + +SetLaunchConfiguration sets LaunchConfiguration field to given value. + +### HasLaunchConfiguration + +`func (o *FeaturedTemplate) HasLaunchConfiguration() bool` + +HasLaunchConfiguration returns a boolean if a field has been set. + +### GetAutoDelete + +`func (o *FeaturedTemplate) GetAutoDelete() map[string]interface{}` + +GetAutoDelete returns the AutoDelete field if non-nil, zero value otherwise. + +### GetAutoDeleteOk + +`func (o *FeaturedTemplate) GetAutoDeleteOk() (*map[string]interface{}, bool)` + +GetAutoDeleteOk returns a tuple with the AutoDelete field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAutoDelete + +`func (o *FeaturedTemplate) SetAutoDelete(v map[string]interface{})` + +SetAutoDelete sets AutoDelete field to given value. + +### HasAutoDelete + +`func (o *FeaturedTemplate) HasAutoDelete() bool` + +HasAutoDelete returns a boolean if a field has been set. + +### GetAlert + +`func (o *FeaturedTemplate) GetAlert() map[string]interface{}` + +GetAlert returns the Alert field if non-nil, zero value otherwise. + +### GetAlertOk + +`func (o *FeaturedTemplate) GetAlertOk() (*map[string]interface{}, bool)` + +GetAlertOk returns a tuple with the Alert field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAlert + +`func (o *FeaturedTemplate) SetAlert(v map[string]interface{})` + +SetAlert sets Alert field to given value. + +### HasAlert + +`func (o *FeaturedTemplate) HasAlert() bool` + +HasAlert returns a boolean if a field has been set. + +### GetVolumeMount + +`func (o *FeaturedTemplate) GetVolumeMount() map[string]interface{}` + +GetVolumeMount returns the VolumeMount field if non-nil, zero value otherwise. + +### GetVolumeMountOk + +`func (o *FeaturedTemplate) GetVolumeMountOk() (*map[string]interface{}, bool)` + +GetVolumeMountOk returns a tuple with the VolumeMount field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetVolumeMount + +`func (o *FeaturedTemplate) SetVolumeMount(v map[string]interface{})` + +SetVolumeMount sets VolumeMount field to given value. + +### HasVolumeMount + +`func (o *FeaturedTemplate) HasVolumeMount() bool` + +HasVolumeMount returns a boolean if a field has been set. + +### GetTags + +`func (o *FeaturedTemplate) GetTags() []string` + +GetTags returns the Tags field if non-nil, zero value otherwise. + +### GetTagsOk + +`func (o *FeaturedTemplate) GetTagsOk() (*[]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 *FeaturedTemplate) SetTags(v []string)` + +SetTags sets Tags field to given value. + +### HasTags + +`func (o *FeaturedTemplate) HasTags() bool` + +HasTags returns a boolean if a field has been set. + +### GetEnvs + +`func (o *FeaturedTemplate) GetEnvs() []Env` + +GetEnvs returns the Envs field if non-nil, zero value otherwise. + +### GetEnvsOk + +`func (o *FeaturedTemplate) GetEnvsOk() (*[]Env, bool)` + +GetEnvsOk returns a tuple with the Envs field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEnvs + +`func (o *FeaturedTemplate) SetEnvs(v []Env)` + +SetEnvs sets Envs field to given value. + +### HasEnvs + +`func (o *FeaturedTemplate) HasEnvs() bool` + +HasEnvs returns a boolean if a field has been set. + +### GetNetworking + +`func (o *FeaturedTemplate) GetNetworking() Networking` + +GetNetworking returns the Networking field if non-nil, zero value otherwise. + +### GetNetworkingOk + +`func (o *FeaturedTemplate) GetNetworkingOk() (*Networking, bool)` + +GetNetworkingOk returns a tuple with the Networking field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNetworking + +`func (o *FeaturedTemplate) SetNetworking(v Networking)` + +SetNetworking sets Networking field to given value. + +### HasNetworking + +`func (o *FeaturedTemplate) HasNetworking() bool` + +HasNetworking 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/shadeform/gen/shadeform/docs/FeaturedTemplatesResponse.md b/internal/shadeform/gen/shadeform/docs/FeaturedTemplatesResponse.md new file mode 100644 index 00000000..4e19c227 --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/FeaturedTemplatesResponse.md @@ -0,0 +1,51 @@ +# FeaturedTemplatesResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Templates** | [**[]FeaturedTemplate**](FeaturedTemplate.md) | | + +## Methods + +### NewFeaturedTemplatesResponse + +`func NewFeaturedTemplatesResponse(templates []FeaturedTemplate, ) *FeaturedTemplatesResponse` + +NewFeaturedTemplatesResponse instantiates a new FeaturedTemplatesResponse 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 + +### NewFeaturedTemplatesResponseWithDefaults + +`func NewFeaturedTemplatesResponseWithDefaults() *FeaturedTemplatesResponse` + +NewFeaturedTemplatesResponseWithDefaults instantiates a new FeaturedTemplatesResponse 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 + +### GetTemplates + +`func (o *FeaturedTemplatesResponse) GetTemplates() []FeaturedTemplate` + +GetTemplates returns the Templates field if non-nil, zero value otherwise. + +### GetTemplatesOk + +`func (o *FeaturedTemplatesResponse) GetTemplatesOk() (*[]FeaturedTemplate, bool)` + +GetTemplatesOk returns a tuple with the Templates field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTemplates + +`func (o *FeaturedTemplatesResponse) SetTemplates(v []FeaturedTemplate)` + +SetTemplates sets Templates 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/shadeform/gen/shadeform/docs/Instance.md b/internal/shadeform/gen/shadeform/docs/Instance.md new file mode 100644 index 00000000..c852fc67 --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/Instance.md @@ -0,0 +1,444 @@ +# Instance + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **string** | The unique identifier for the instance. Used in the instances for the /instances/{id}/info and /instances/{id}/delete APIs. | +**Cloud** | [**Cloud**](Cloud.md) | | +**Region** | **string** | Specifies the region. | +**ShadeInstanceType** | **string** | The Shadeform standardized instance type. See this [explanation](/getting-started/concepts#shade-instance-type-and-cloud-instance-type) for more details. | +**CloudInstanceType** | **string** | The instance type for the underlying cloud provider. See this [explanation](/getting-started/concepts#shade-instance-type-and-cloud-instance-type) for more details. | +**CloudAssignedId** | **string** | The unique identifier of the instance issued by the underlying cloud provider. | +**ShadeCloud** | **bool** | Specifies if the instance is launched in [Shade Cloud](/getting-started/concepts#shade-cloud) or in a linked cloud account. | +**Name** | **string** | The name of the instance | +**Configuration** | [**InstanceConfiguration**](InstanceConfiguration.md) | | +**Ip** | **string** | The public IP address of the instance. In select cases, it may also be the DNS. | +**SshUser** | **string** | The SSH user used to SSH into the instance. | +**SshPort** | **int32** | The SSH port of the instance. In most cases, this will be port 22 but for some clouds, this may be a different port. | +**Status** | [**Status**](Status.md) | | +**CostEstimate** | **string** | The cost incurred by the instance. This only the cost via Shadeform. If the instance is deployed in your own cloud account, then all billing is through your cloud provider. | +**HourlyPrice** | Pointer to **int32** | The hourly price of the instance in cents. | [optional] +**LaunchConfiguration** | Pointer to [**LaunchConfiguration**](LaunchConfiguration.md) | | [optional] +**PortMappings** | Pointer to [**[]InstancePortMappings**](InstancePortMappings.md) | List of port mappings on an instance that a Cloud Provider might have automatically set up. | [optional] +**CreatedAt** | **time.Time** | The timestamp of when the instance was created in UTC. | +**DeletedAt** | **time.Time** | The timestamp of when the instance was deleted in UTC. | + +## Methods + +### NewInstance + +`func NewInstance(id string, cloud Cloud, region string, shadeInstanceType string, cloudInstanceType string, cloudAssignedId string, shadeCloud bool, name string, configuration InstanceConfiguration, ip string, sshUser string, sshPort int32, status Status, costEstimate string, createdAt time.Time, deletedAt time.Time, ) *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. + + +### GetCloud + +`func (o *Instance) GetCloud() Cloud` + +GetCloud returns the Cloud field if non-nil, zero value otherwise. + +### GetCloudOk + +`func (o *Instance) GetCloudOk() (*Cloud, bool)` + +GetCloudOk returns a tuple with the Cloud field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCloud + +`func (o *Instance) SetCloud(v Cloud)` + +SetCloud sets Cloud field to given value. + + +### GetRegion + +`func (o *Instance) GetRegion() string` + +GetRegion returns the Region field if non-nil, zero value otherwise. + +### GetRegionOk + +`func (o *Instance) GetRegionOk() (*string, bool)` + +GetRegionOk returns a tuple with the Region field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRegion + +`func (o *Instance) SetRegion(v string)` + +SetRegion sets Region field to given value. + + +### GetShadeInstanceType + +`func (o *Instance) GetShadeInstanceType() string` + +GetShadeInstanceType returns the ShadeInstanceType field if non-nil, zero value otherwise. + +### GetShadeInstanceTypeOk + +`func (o *Instance) GetShadeInstanceTypeOk() (*string, bool)` + +GetShadeInstanceTypeOk returns a tuple with the ShadeInstanceType field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetShadeInstanceType + +`func (o *Instance) SetShadeInstanceType(v string)` + +SetShadeInstanceType sets ShadeInstanceType field to given value. + + +### GetCloudInstanceType + +`func (o *Instance) GetCloudInstanceType() string` + +GetCloudInstanceType returns the CloudInstanceType field if non-nil, zero value otherwise. + +### GetCloudInstanceTypeOk + +`func (o *Instance) GetCloudInstanceTypeOk() (*string, bool)` + +GetCloudInstanceTypeOk returns a tuple with the CloudInstanceType field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCloudInstanceType + +`func (o *Instance) SetCloudInstanceType(v string)` + +SetCloudInstanceType sets CloudInstanceType field to given value. + + +### GetCloudAssignedId + +`func (o *Instance) GetCloudAssignedId() string` + +GetCloudAssignedId returns the CloudAssignedId field if non-nil, zero value otherwise. + +### GetCloudAssignedIdOk + +`func (o *Instance) GetCloudAssignedIdOk() (*string, bool)` + +GetCloudAssignedIdOk returns a tuple with the CloudAssignedId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCloudAssignedId + +`func (o *Instance) SetCloudAssignedId(v string)` + +SetCloudAssignedId sets CloudAssignedId field to given value. + + +### GetShadeCloud + +`func (o *Instance) GetShadeCloud() bool` + +GetShadeCloud returns the ShadeCloud field if non-nil, zero value otherwise. + +### GetShadeCloudOk + +`func (o *Instance) GetShadeCloudOk() (*bool, bool)` + +GetShadeCloudOk returns a tuple with the ShadeCloud field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetShadeCloud + +`func (o *Instance) SetShadeCloud(v bool)` + +SetShadeCloud sets ShadeCloud 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. + + +### GetConfiguration + +`func (o *Instance) GetConfiguration() InstanceConfiguration` + +GetConfiguration returns the Configuration field if non-nil, zero value otherwise. + +### GetConfigurationOk + +`func (o *Instance) GetConfigurationOk() (*InstanceConfiguration, bool)` + +GetConfigurationOk returns a tuple with the Configuration field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetConfiguration + +`func (o *Instance) SetConfiguration(v InstanceConfiguration)` + +SetConfiguration sets Configuration 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. + + +### GetSshUser + +`func (o *Instance) GetSshUser() string` + +GetSshUser returns the SshUser field if non-nil, zero value otherwise. + +### GetSshUserOk + +`func (o *Instance) GetSshUserOk() (*string, bool)` + +GetSshUserOk returns a tuple with the SshUser field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSshUser + +`func (o *Instance) SetSshUser(v string)` + +SetSshUser sets SshUser field to given value. + + +### GetSshPort + +`func (o *Instance) GetSshPort() int32` + +GetSshPort returns the SshPort field if non-nil, zero value otherwise. + +### GetSshPortOk + +`func (o *Instance) GetSshPortOk() (*int32, bool)` + +GetSshPortOk returns a tuple with the SshPort field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSshPort + +`func (o *Instance) SetSshPort(v int32)` + +SetSshPort sets SshPort field to given value. + + +### GetStatus + +`func (o *Instance) GetStatus() Status` + +GetStatus returns the Status field if non-nil, zero value otherwise. + +### GetStatusOk + +`func (o *Instance) GetStatusOk() (*Status, 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 *Instance) SetStatus(v Status)` + +SetStatus sets Status field to given value. + + +### GetCostEstimate + +`func (o *Instance) GetCostEstimate() string` + +GetCostEstimate returns the CostEstimate field if non-nil, zero value otherwise. + +### GetCostEstimateOk + +`func (o *Instance) GetCostEstimateOk() (*string, bool)` + +GetCostEstimateOk returns a tuple with the CostEstimate field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCostEstimate + +`func (o *Instance) SetCostEstimate(v string)` + +SetCostEstimate sets CostEstimate field to given value. + + +### GetHourlyPrice + +`func (o *Instance) GetHourlyPrice() int32` + +GetHourlyPrice returns the HourlyPrice field if non-nil, zero value otherwise. + +### GetHourlyPriceOk + +`func (o *Instance) GetHourlyPriceOk() (*int32, bool)` + +GetHourlyPriceOk returns a tuple with the HourlyPrice field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetHourlyPrice + +`func (o *Instance) SetHourlyPrice(v int32)` + +SetHourlyPrice sets HourlyPrice field to given value. + +### HasHourlyPrice + +`func (o *Instance) HasHourlyPrice() bool` + +HasHourlyPrice returns a boolean if a field has been set. + +### GetLaunchConfiguration + +`func (o *Instance) GetLaunchConfiguration() LaunchConfiguration` + +GetLaunchConfiguration returns the LaunchConfiguration field if non-nil, zero value otherwise. + +### GetLaunchConfigurationOk + +`func (o *Instance) GetLaunchConfigurationOk() (*LaunchConfiguration, bool)` + +GetLaunchConfigurationOk returns a tuple with the LaunchConfiguration field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLaunchConfiguration + +`func (o *Instance) SetLaunchConfiguration(v LaunchConfiguration)` + +SetLaunchConfiguration sets LaunchConfiguration field to given value. + +### HasLaunchConfiguration + +`func (o *Instance) HasLaunchConfiguration() bool` + +HasLaunchConfiguration returns a boolean if a field has been set. + +### GetPortMappings + +`func (o *Instance) GetPortMappings() []InstancePortMappings` + +GetPortMappings returns the PortMappings field if non-nil, zero value otherwise. + +### GetPortMappingsOk + +`func (o *Instance) GetPortMappingsOk() (*[]InstancePortMappings, bool)` + +GetPortMappingsOk returns a tuple with the PortMappings field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPortMappings + +`func (o *Instance) SetPortMappings(v []InstancePortMappings)` + +SetPortMappings sets PortMappings field to given value. + +### HasPortMappings + +`func (o *Instance) HasPortMappings() bool` + +HasPortMappings returns a boolean if a field has been set. + +### GetCreatedAt + +`func (o *Instance) GetCreatedAt() time.Time` + +GetCreatedAt returns the CreatedAt field if non-nil, zero value otherwise. + +### GetCreatedAtOk + +`func (o *Instance) 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 *Instance) SetCreatedAt(v time.Time)` + +SetCreatedAt sets CreatedAt field to given value. + + +### GetDeletedAt + +`func (o *Instance) GetDeletedAt() time.Time` + +GetDeletedAt returns the DeletedAt field if non-nil, zero value otherwise. + +### GetDeletedAtOk + +`func (o *Instance) GetDeletedAtOk() (*time.Time, bool)` + +GetDeletedAtOk returns a tuple with the DeletedAt field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDeletedAt + +`func (o *Instance) SetDeletedAt(v time.Time)` + +SetDeletedAt sets DeletedAt 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/shadeform/gen/shadeform/docs/InstanceConfiguration.md b/internal/shadeform/gen/shadeform/docs/InstanceConfiguration.md new file mode 100644 index 00000000..6e4d4777 --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/InstanceConfiguration.md @@ -0,0 +1,224 @@ +# InstanceConfiguration + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**MemoryInGb** | **int32** | The amount of memory for the instance in gigabytes. Note that this is not VRAM which is determined by GPU type and the number of GPUs. | +**StorageInGb** | **int32** | The amount of storage for the instance. If this storage is too low for the instance type, please email support@shadeform.ai as the storage may be adjustable. | +**Vcpus** | **int32** | The number of vCPUs for the instance. | +**NumGpus** | **int32** | The number of GPUs for the instance. | +**GpuType** | **string** | The type of GPU for the instance. | +**Interconnect** | **string** | The type of GPU interconnect. | +**Nvlink** | Pointer to **bool** | If the instance has NVLink | [optional] +**VramPerGpuInGb** | **int32** | The video memory per GPU for the instance in gigabytes. | +**Os** | **string** | The operating system of the instance. | + +## Methods + +### NewInstanceConfiguration + +`func NewInstanceConfiguration(memoryInGb int32, storageInGb int32, vcpus int32, numGpus int32, gpuType string, interconnect string, vramPerGpuInGb int32, os string, ) *InstanceConfiguration` + +NewInstanceConfiguration instantiates a new InstanceConfiguration 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 + +### NewInstanceConfigurationWithDefaults + +`func NewInstanceConfigurationWithDefaults() *InstanceConfiguration` + +NewInstanceConfigurationWithDefaults instantiates a new InstanceConfiguration 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 + +### GetMemoryInGb + +`func (o *InstanceConfiguration) GetMemoryInGb() int32` + +GetMemoryInGb returns the MemoryInGb field if non-nil, zero value otherwise. + +### GetMemoryInGbOk + +`func (o *InstanceConfiguration) GetMemoryInGbOk() (*int32, bool)` + +GetMemoryInGbOk returns a tuple with the MemoryInGb field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMemoryInGb + +`func (o *InstanceConfiguration) SetMemoryInGb(v int32)` + +SetMemoryInGb sets MemoryInGb field to given value. + + +### GetStorageInGb + +`func (o *InstanceConfiguration) GetStorageInGb() int32` + +GetStorageInGb returns the StorageInGb field if non-nil, zero value otherwise. + +### GetStorageInGbOk + +`func (o *InstanceConfiguration) GetStorageInGbOk() (*int32, bool)` + +GetStorageInGbOk returns a tuple with the StorageInGb field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetStorageInGb + +`func (o *InstanceConfiguration) SetStorageInGb(v int32)` + +SetStorageInGb sets StorageInGb field to given value. + + +### GetVcpus + +`func (o *InstanceConfiguration) GetVcpus() int32` + +GetVcpus returns the Vcpus field if non-nil, zero value otherwise. + +### GetVcpusOk + +`func (o *InstanceConfiguration) GetVcpusOk() (*int32, bool)` + +GetVcpusOk returns a tuple with the Vcpus field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetVcpus + +`func (o *InstanceConfiguration) SetVcpus(v int32)` + +SetVcpus sets Vcpus field to given value. + + +### GetNumGpus + +`func (o *InstanceConfiguration) GetNumGpus() int32` + +GetNumGpus returns the NumGpus field if non-nil, zero value otherwise. + +### GetNumGpusOk + +`func (o *InstanceConfiguration) GetNumGpusOk() (*int32, bool)` + +GetNumGpusOk returns a tuple with the NumGpus field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNumGpus + +`func (o *InstanceConfiguration) SetNumGpus(v int32)` + +SetNumGpus sets NumGpus field to given value. + + +### GetGpuType + +`func (o *InstanceConfiguration) GetGpuType() string` + +GetGpuType returns the GpuType field if non-nil, zero value otherwise. + +### GetGpuTypeOk + +`func (o *InstanceConfiguration) GetGpuTypeOk() (*string, bool)` + +GetGpuTypeOk returns a tuple with the GpuType field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetGpuType + +`func (o *InstanceConfiguration) SetGpuType(v string)` + +SetGpuType sets GpuType field to given value. + + +### GetInterconnect + +`func (o *InstanceConfiguration) GetInterconnect() string` + +GetInterconnect returns the Interconnect field if non-nil, zero value otherwise. + +### GetInterconnectOk + +`func (o *InstanceConfiguration) GetInterconnectOk() (*string, bool)` + +GetInterconnectOk returns a tuple with the Interconnect field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetInterconnect + +`func (o *InstanceConfiguration) SetInterconnect(v string)` + +SetInterconnect sets Interconnect field to given value. + + +### GetNvlink + +`func (o *InstanceConfiguration) GetNvlink() bool` + +GetNvlink returns the Nvlink field if non-nil, zero value otherwise. + +### GetNvlinkOk + +`func (o *InstanceConfiguration) GetNvlinkOk() (*bool, bool)` + +GetNvlinkOk returns a tuple with the Nvlink field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNvlink + +`func (o *InstanceConfiguration) SetNvlink(v bool)` + +SetNvlink sets Nvlink field to given value. + +### HasNvlink + +`func (o *InstanceConfiguration) HasNvlink() bool` + +HasNvlink returns a boolean if a field has been set. + +### GetVramPerGpuInGb + +`func (o *InstanceConfiguration) GetVramPerGpuInGb() int32` + +GetVramPerGpuInGb returns the VramPerGpuInGb field if non-nil, zero value otherwise. + +### GetVramPerGpuInGbOk + +`func (o *InstanceConfiguration) GetVramPerGpuInGbOk() (*int32, bool)` + +GetVramPerGpuInGbOk returns a tuple with the VramPerGpuInGb field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetVramPerGpuInGb + +`func (o *InstanceConfiguration) SetVramPerGpuInGb(v int32)` + +SetVramPerGpuInGb sets VramPerGpuInGb field to given value. + + +### GetOs + +`func (o *InstanceConfiguration) GetOs() string` + +GetOs returns the Os field if non-nil, zero value otherwise. + +### GetOsOk + +`func (o *InstanceConfiguration) GetOsOk() (*string, bool)` + +GetOsOk returns a tuple with the Os field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetOs + +`func (o *InstanceConfiguration) SetOs(v string)` + +SetOs sets Os 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/shadeform/gen/shadeform/docs/InstanceInfoResponse.md b/internal/shadeform/gen/shadeform/docs/InstanceInfoResponse.md new file mode 100644 index 00000000..ab7d6b75 --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/InstanceInfoResponse.md @@ -0,0 +1,626 @@ +# InstanceInfoResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **string** | The unique identifier for the instance. Used in the instances for the /instances/{id}/info and /instances/{id}/delete APIs. | +**Cloud** | [**Cloud**](Cloud.md) | | +**Region** | **string** | Specifies the region. | +**ShadeInstanceType** | **string** | The Shadeform standardized instance type. See this [explanation](/getting-started/concepts#shade-instance-type-and-cloud-instance-type) for more details. | +**CloudInstanceType** | **string** | The instance type for the underlying cloud provider. See this [explanation](/getting-started/concepts#shade-instance-type-and-cloud-instance-type) for more details. | +**CloudAssignedId** | **string** | The unique identifier of the instance issued by the underlying cloud provider. | +**ShadeCloud** | **bool** | Specifies if the instance is launched in [Shade Cloud](/getting-started/concepts#shade-cloud) or in a linked cloud account. | +**Name** | **string** | The name of the instance | +**Configuration** | [**InstanceConfiguration**](InstanceConfiguration.md) | | +**Ip** | **string** | The public IP address of the instance. In select cases, it may also be the DNS. | +**SshUser** | **string** | The SSH user used to SSH into the instance. | +**SshPort** | **int32** | The SSH port of the instance. In most cases, this will be port 22 but for some clouds, this may be a different port. | +**Status** | [**Status**](Status.md) | | +**CostEstimate** | **string** | The cost incurred by the instance. This only the cost via Shadeform. If the instance is deployed in your own cloud account, then all billing is through your cloud provider. | +**HourlyPrice** | Pointer to **int32** | The hourly price of the instance in cents. | [optional] +**VolumeIds** | Pointer to **[]string** | List of volume IDs to be mounted. Currently only supports 1 volume at a time. | [optional] +**SshKeyId** | Pointer to **string** | The ID of the SSH Key. | [optional] +**LaunchConfiguration** | Pointer to [**LaunchConfiguration**](LaunchConfiguration.md) | | [optional] +**AutoDelete** | Pointer to [**AutoDelete**](AutoDelete.md) | | [optional] +**Alert** | Pointer to [**Alert**](Alert.md) | | [optional] +**VolumeMount** | Pointer to [**VolumeMount**](VolumeMount.md) | | [optional] +**Tags** | Pointer to **[]string** | Add custom, searchable tags to instances. | [optional] +**Envs** | Pointer to [**[]Env**](Env.md) | List of environment variable name and values to automatically add to the instance | [optional] +**PortMappings** | Pointer to [**[]InstancePortMappings**](InstancePortMappings.md) | List of port mappings on an instance that a Cloud Provider might have automatically set up. | [optional] +**CreatedAt** | **time.Time** | The timestamp of when the instance was created in UTC. | +**DeletedAt** | **time.Time** | The timestamp of when the instance was deleted in UTC. | + +## Methods + +### NewInstanceInfoResponse + +`func NewInstanceInfoResponse(id string, cloud Cloud, region string, shadeInstanceType string, cloudInstanceType string, cloudAssignedId string, shadeCloud bool, name string, configuration InstanceConfiguration, ip string, sshUser string, sshPort int32, status Status, costEstimate string, createdAt time.Time, deletedAt time.Time, ) *InstanceInfoResponse` + +NewInstanceInfoResponse instantiates a new InstanceInfoResponse 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 + +### NewInstanceInfoResponseWithDefaults + +`func NewInstanceInfoResponseWithDefaults() *InstanceInfoResponse` + +NewInstanceInfoResponseWithDefaults instantiates a new InstanceInfoResponse 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 *InstanceInfoResponse) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *InstanceInfoResponse) 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 *InstanceInfoResponse) SetId(v string)` + +SetId sets Id field to given value. + + +### GetCloud + +`func (o *InstanceInfoResponse) GetCloud() Cloud` + +GetCloud returns the Cloud field if non-nil, zero value otherwise. + +### GetCloudOk + +`func (o *InstanceInfoResponse) GetCloudOk() (*Cloud, bool)` + +GetCloudOk returns a tuple with the Cloud field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCloud + +`func (o *InstanceInfoResponse) SetCloud(v Cloud)` + +SetCloud sets Cloud field to given value. + + +### GetRegion + +`func (o *InstanceInfoResponse) GetRegion() string` + +GetRegion returns the Region field if non-nil, zero value otherwise. + +### GetRegionOk + +`func (o *InstanceInfoResponse) GetRegionOk() (*string, bool)` + +GetRegionOk returns a tuple with the Region field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRegion + +`func (o *InstanceInfoResponse) SetRegion(v string)` + +SetRegion sets Region field to given value. + + +### GetShadeInstanceType + +`func (o *InstanceInfoResponse) GetShadeInstanceType() string` + +GetShadeInstanceType returns the ShadeInstanceType field if non-nil, zero value otherwise. + +### GetShadeInstanceTypeOk + +`func (o *InstanceInfoResponse) GetShadeInstanceTypeOk() (*string, bool)` + +GetShadeInstanceTypeOk returns a tuple with the ShadeInstanceType field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetShadeInstanceType + +`func (o *InstanceInfoResponse) SetShadeInstanceType(v string)` + +SetShadeInstanceType sets ShadeInstanceType field to given value. + + +### GetCloudInstanceType + +`func (o *InstanceInfoResponse) GetCloudInstanceType() string` + +GetCloudInstanceType returns the CloudInstanceType field if non-nil, zero value otherwise. + +### GetCloudInstanceTypeOk + +`func (o *InstanceInfoResponse) GetCloudInstanceTypeOk() (*string, bool)` + +GetCloudInstanceTypeOk returns a tuple with the CloudInstanceType field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCloudInstanceType + +`func (o *InstanceInfoResponse) SetCloudInstanceType(v string)` + +SetCloudInstanceType sets CloudInstanceType field to given value. + + +### GetCloudAssignedId + +`func (o *InstanceInfoResponse) GetCloudAssignedId() string` + +GetCloudAssignedId returns the CloudAssignedId field if non-nil, zero value otherwise. + +### GetCloudAssignedIdOk + +`func (o *InstanceInfoResponse) GetCloudAssignedIdOk() (*string, bool)` + +GetCloudAssignedIdOk returns a tuple with the CloudAssignedId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCloudAssignedId + +`func (o *InstanceInfoResponse) SetCloudAssignedId(v string)` + +SetCloudAssignedId sets CloudAssignedId field to given value. + + +### GetShadeCloud + +`func (o *InstanceInfoResponse) GetShadeCloud() bool` + +GetShadeCloud returns the ShadeCloud field if non-nil, zero value otherwise. + +### GetShadeCloudOk + +`func (o *InstanceInfoResponse) GetShadeCloudOk() (*bool, bool)` + +GetShadeCloudOk returns a tuple with the ShadeCloud field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetShadeCloud + +`func (o *InstanceInfoResponse) SetShadeCloud(v bool)` + +SetShadeCloud sets ShadeCloud field to given value. + + +### GetName + +`func (o *InstanceInfoResponse) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *InstanceInfoResponse) 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 *InstanceInfoResponse) SetName(v string)` + +SetName sets Name field to given value. + + +### GetConfiguration + +`func (o *InstanceInfoResponse) GetConfiguration() InstanceConfiguration` + +GetConfiguration returns the Configuration field if non-nil, zero value otherwise. + +### GetConfigurationOk + +`func (o *InstanceInfoResponse) GetConfigurationOk() (*InstanceConfiguration, bool)` + +GetConfigurationOk returns a tuple with the Configuration field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetConfiguration + +`func (o *InstanceInfoResponse) SetConfiguration(v InstanceConfiguration)` + +SetConfiguration sets Configuration field to given value. + + +### GetIp + +`func (o *InstanceInfoResponse) GetIp() string` + +GetIp returns the Ip field if non-nil, zero value otherwise. + +### GetIpOk + +`func (o *InstanceInfoResponse) 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 *InstanceInfoResponse) SetIp(v string)` + +SetIp sets Ip field to given value. + + +### GetSshUser + +`func (o *InstanceInfoResponse) GetSshUser() string` + +GetSshUser returns the SshUser field if non-nil, zero value otherwise. + +### GetSshUserOk + +`func (o *InstanceInfoResponse) GetSshUserOk() (*string, bool)` + +GetSshUserOk returns a tuple with the SshUser field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSshUser + +`func (o *InstanceInfoResponse) SetSshUser(v string)` + +SetSshUser sets SshUser field to given value. + + +### GetSshPort + +`func (o *InstanceInfoResponse) GetSshPort() int32` + +GetSshPort returns the SshPort field if non-nil, zero value otherwise. + +### GetSshPortOk + +`func (o *InstanceInfoResponse) GetSshPortOk() (*int32, bool)` + +GetSshPortOk returns a tuple with the SshPort field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSshPort + +`func (o *InstanceInfoResponse) SetSshPort(v int32)` + +SetSshPort sets SshPort field to given value. + + +### GetStatus + +`func (o *InstanceInfoResponse) GetStatus() Status` + +GetStatus returns the Status field if non-nil, zero value otherwise. + +### GetStatusOk + +`func (o *InstanceInfoResponse) GetStatusOk() (*Status, 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 *InstanceInfoResponse) SetStatus(v Status)` + +SetStatus sets Status field to given value. + + +### GetCostEstimate + +`func (o *InstanceInfoResponse) GetCostEstimate() string` + +GetCostEstimate returns the CostEstimate field if non-nil, zero value otherwise. + +### GetCostEstimateOk + +`func (o *InstanceInfoResponse) GetCostEstimateOk() (*string, bool)` + +GetCostEstimateOk returns a tuple with the CostEstimate field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCostEstimate + +`func (o *InstanceInfoResponse) SetCostEstimate(v string)` + +SetCostEstimate sets CostEstimate field to given value. + + +### GetHourlyPrice + +`func (o *InstanceInfoResponse) GetHourlyPrice() int32` + +GetHourlyPrice returns the HourlyPrice field if non-nil, zero value otherwise. + +### GetHourlyPriceOk + +`func (o *InstanceInfoResponse) GetHourlyPriceOk() (*int32, bool)` + +GetHourlyPriceOk returns a tuple with the HourlyPrice field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetHourlyPrice + +`func (o *InstanceInfoResponse) SetHourlyPrice(v int32)` + +SetHourlyPrice sets HourlyPrice field to given value. + +### HasHourlyPrice + +`func (o *InstanceInfoResponse) HasHourlyPrice() bool` + +HasHourlyPrice returns a boolean if a field has been set. + +### GetVolumeIds + +`func (o *InstanceInfoResponse) GetVolumeIds() []string` + +GetVolumeIds returns the VolumeIds field if non-nil, zero value otherwise. + +### GetVolumeIdsOk + +`func (o *InstanceInfoResponse) GetVolumeIdsOk() (*[]string, bool)` + +GetVolumeIdsOk returns a tuple with the VolumeIds field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetVolumeIds + +`func (o *InstanceInfoResponse) SetVolumeIds(v []string)` + +SetVolumeIds sets VolumeIds field to given value. + +### HasVolumeIds + +`func (o *InstanceInfoResponse) HasVolumeIds() bool` + +HasVolumeIds returns a boolean if a field has been set. + +### GetSshKeyId + +`func (o *InstanceInfoResponse) GetSshKeyId() string` + +GetSshKeyId returns the SshKeyId field if non-nil, zero value otherwise. + +### GetSshKeyIdOk + +`func (o *InstanceInfoResponse) GetSshKeyIdOk() (*string, bool)` + +GetSshKeyIdOk returns a tuple with the SshKeyId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSshKeyId + +`func (o *InstanceInfoResponse) SetSshKeyId(v string)` + +SetSshKeyId sets SshKeyId field to given value. + +### HasSshKeyId + +`func (o *InstanceInfoResponse) HasSshKeyId() bool` + +HasSshKeyId returns a boolean if a field has been set. + +### GetLaunchConfiguration + +`func (o *InstanceInfoResponse) GetLaunchConfiguration() LaunchConfiguration` + +GetLaunchConfiguration returns the LaunchConfiguration field if non-nil, zero value otherwise. + +### GetLaunchConfigurationOk + +`func (o *InstanceInfoResponse) GetLaunchConfigurationOk() (*LaunchConfiguration, bool)` + +GetLaunchConfigurationOk returns a tuple with the LaunchConfiguration field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLaunchConfiguration + +`func (o *InstanceInfoResponse) SetLaunchConfiguration(v LaunchConfiguration)` + +SetLaunchConfiguration sets LaunchConfiguration field to given value. + +### HasLaunchConfiguration + +`func (o *InstanceInfoResponse) HasLaunchConfiguration() bool` + +HasLaunchConfiguration returns a boolean if a field has been set. + +### GetAutoDelete + +`func (o *InstanceInfoResponse) GetAutoDelete() AutoDelete` + +GetAutoDelete returns the AutoDelete field if non-nil, zero value otherwise. + +### GetAutoDeleteOk + +`func (o *InstanceInfoResponse) GetAutoDeleteOk() (*AutoDelete, bool)` + +GetAutoDeleteOk returns a tuple with the AutoDelete field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAutoDelete + +`func (o *InstanceInfoResponse) SetAutoDelete(v AutoDelete)` + +SetAutoDelete sets AutoDelete field to given value. + +### HasAutoDelete + +`func (o *InstanceInfoResponse) HasAutoDelete() bool` + +HasAutoDelete returns a boolean if a field has been set. + +### GetAlert + +`func (o *InstanceInfoResponse) GetAlert() Alert` + +GetAlert returns the Alert field if non-nil, zero value otherwise. + +### GetAlertOk + +`func (o *InstanceInfoResponse) GetAlertOk() (*Alert, bool)` + +GetAlertOk returns a tuple with the Alert field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAlert + +`func (o *InstanceInfoResponse) SetAlert(v Alert)` + +SetAlert sets Alert field to given value. + +### HasAlert + +`func (o *InstanceInfoResponse) HasAlert() bool` + +HasAlert returns a boolean if a field has been set. + +### GetVolumeMount + +`func (o *InstanceInfoResponse) GetVolumeMount() VolumeMount` + +GetVolumeMount returns the VolumeMount field if non-nil, zero value otherwise. + +### GetVolumeMountOk + +`func (o *InstanceInfoResponse) GetVolumeMountOk() (*VolumeMount, bool)` + +GetVolumeMountOk returns a tuple with the VolumeMount field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetVolumeMount + +`func (o *InstanceInfoResponse) SetVolumeMount(v VolumeMount)` + +SetVolumeMount sets VolumeMount field to given value. + +### HasVolumeMount + +`func (o *InstanceInfoResponse) HasVolumeMount() bool` + +HasVolumeMount returns a boolean if a field has been set. + +### GetTags + +`func (o *InstanceInfoResponse) GetTags() []string` + +GetTags returns the Tags field if non-nil, zero value otherwise. + +### GetTagsOk + +`func (o *InstanceInfoResponse) GetTagsOk() (*[]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 *InstanceInfoResponse) SetTags(v []string)` + +SetTags sets Tags field to given value. + +### HasTags + +`func (o *InstanceInfoResponse) HasTags() bool` + +HasTags returns a boolean if a field has been set. + +### GetEnvs + +`func (o *InstanceInfoResponse) GetEnvs() []Env` + +GetEnvs returns the Envs field if non-nil, zero value otherwise. + +### GetEnvsOk + +`func (o *InstanceInfoResponse) GetEnvsOk() (*[]Env, bool)` + +GetEnvsOk returns a tuple with the Envs field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEnvs + +`func (o *InstanceInfoResponse) SetEnvs(v []Env)` + +SetEnvs sets Envs field to given value. + +### HasEnvs + +`func (o *InstanceInfoResponse) HasEnvs() bool` + +HasEnvs returns a boolean if a field has been set. + +### GetPortMappings + +`func (o *InstanceInfoResponse) GetPortMappings() []InstancePortMappings` + +GetPortMappings returns the PortMappings field if non-nil, zero value otherwise. + +### GetPortMappingsOk + +`func (o *InstanceInfoResponse) GetPortMappingsOk() (*[]InstancePortMappings, bool)` + +GetPortMappingsOk returns a tuple with the PortMappings field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPortMappings + +`func (o *InstanceInfoResponse) SetPortMappings(v []InstancePortMappings)` + +SetPortMappings sets PortMappings field to given value. + +### HasPortMappings + +`func (o *InstanceInfoResponse) HasPortMappings() bool` + +HasPortMappings returns a boolean if a field has been set. + +### GetCreatedAt + +`func (o *InstanceInfoResponse) GetCreatedAt() time.Time` + +GetCreatedAt returns the CreatedAt field if non-nil, zero value otherwise. + +### GetCreatedAtOk + +`func (o *InstanceInfoResponse) 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 *InstanceInfoResponse) SetCreatedAt(v time.Time)` + +SetCreatedAt sets CreatedAt field to given value. + + +### GetDeletedAt + +`func (o *InstanceInfoResponse) GetDeletedAt() time.Time` + +GetDeletedAt returns the DeletedAt field if non-nil, zero value otherwise. + +### GetDeletedAtOk + +`func (o *InstanceInfoResponse) GetDeletedAtOk() (*time.Time, bool)` + +GetDeletedAtOk returns a tuple with the DeletedAt field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDeletedAt + +`func (o *InstanceInfoResponse) SetDeletedAt(v time.Time)` + +SetDeletedAt sets DeletedAt 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/shadeform/gen/shadeform/docs/InstancePortMappings.md b/internal/shadeform/gen/shadeform/docs/InstancePortMappings.md new file mode 100644 index 00000000..9c4f2899 --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/InstancePortMappings.md @@ -0,0 +1,82 @@ +# InstancePortMappings + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**InternalPort** | Pointer to **int32** | | [optional] +**ExternalPort** | Pointer to **int32** | | [optional] + +## Methods + +### NewInstancePortMappings + +`func NewInstancePortMappings() *InstancePortMappings` + +NewInstancePortMappings instantiates a new InstancePortMappings 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 + +### NewInstancePortMappingsWithDefaults + +`func NewInstancePortMappingsWithDefaults() *InstancePortMappings` + +NewInstancePortMappingsWithDefaults instantiates a new InstancePortMappings 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 + +### GetInternalPort + +`func (o *InstancePortMappings) GetInternalPort() int32` + +GetInternalPort returns the InternalPort field if non-nil, zero value otherwise. + +### GetInternalPortOk + +`func (o *InstancePortMappings) GetInternalPortOk() (*int32, bool)` + +GetInternalPortOk returns a tuple with the InternalPort field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetInternalPort + +`func (o *InstancePortMappings) SetInternalPort(v int32)` + +SetInternalPort sets InternalPort field to given value. + +### HasInternalPort + +`func (o *InstancePortMappings) HasInternalPort() bool` + +HasInternalPort returns a boolean if a field has been set. + +### GetExternalPort + +`func (o *InstancePortMappings) GetExternalPort() int32` + +GetExternalPort returns the ExternalPort field if non-nil, zero value otherwise. + +### GetExternalPortOk + +`func (o *InstancePortMappings) GetExternalPortOk() (*int32, bool)` + +GetExternalPortOk returns a tuple with the ExternalPort field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetExternalPort + +`func (o *InstancePortMappings) SetExternalPort(v int32)` + +SetExternalPort sets ExternalPort field to given value. + +### HasExternalPort + +`func (o *InstancePortMappings) HasExternalPort() bool` + +HasExternalPort 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/shadeform/gen/shadeform/docs/InstanceType.md b/internal/shadeform/gen/shadeform/docs/InstanceType.md new file mode 100644 index 00000000..ecd9a75f --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/InstanceType.md @@ -0,0 +1,385 @@ +# InstanceType + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Cloud** | [**Cloud**](Cloud.md) | | +**ShadeInstanceType** | **string** | The Shadeform standardized instance type. See this [explanation](/getting-started/concepts#shade-instance-type-and-cloud-instance-type) for more details. | +**CloudInstanceType** | **string** | The instance type for the underlying cloud provider. See this [explanation](/getting-started/concepts#shade-instance-type-and-cloud-instance-type) for more details. | +**Configuration** | [**InstanceTypeConfiguration**](InstanceTypeConfiguration.md) | | +**HourlyPrice** | **int32** | The hourly price of the instance in cents. | +**DeploymentType** | **string** | Whether the instance is a \"vm\" (virtual machine), a \"container\" (docker container), or \"baremetal\" (bare metal server). | +**Availability** | [**[]Availability**](Availability.md) | | +**BootTime** | Pointer to **map[string]interface{}** | | [optional] +**MemoryInGb** | Pointer to **int32** | The amount of memory for the instance in gigabytes. Note that this is not VRAM which is determined by GPU type and the number of GPUs. | [optional] +**StorageInGb** | Pointer to **int32** | The amount of storage for the instance. If this storage is too low for the instance type, please email support@shadeform.ai as the storage may be adjustable. | [optional] +**Vcpus** | Pointer to **int32** | The number of vCPUs for the instance. | [optional] +**NumGpus** | Pointer to **int32** | The number of GPUs for the instance. | [optional] +**GpuType** | Pointer to **string** | The type of GPU for the instance. | [optional] +**Interconnect** | Pointer to **string** | The type of GPU interconnect. | [optional] +**Nvlink** | Pointer to **bool** | If the instance has NVLink | [optional] + +## Methods + +### NewInstanceType + +`func NewInstanceType(cloud Cloud, shadeInstanceType string, cloudInstanceType string, configuration InstanceTypeConfiguration, hourlyPrice int32, deploymentType string, availability []Availability, ) *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 + +### GetCloud + +`func (o *InstanceType) GetCloud() Cloud` + +GetCloud returns the Cloud field if non-nil, zero value otherwise. + +### GetCloudOk + +`func (o *InstanceType) GetCloudOk() (*Cloud, bool)` + +GetCloudOk returns a tuple with the Cloud field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCloud + +`func (o *InstanceType) SetCloud(v Cloud)` + +SetCloud sets Cloud field to given value. + + +### GetShadeInstanceType + +`func (o *InstanceType) GetShadeInstanceType() string` + +GetShadeInstanceType returns the ShadeInstanceType field if non-nil, zero value otherwise. + +### GetShadeInstanceTypeOk + +`func (o *InstanceType) GetShadeInstanceTypeOk() (*string, bool)` + +GetShadeInstanceTypeOk returns a tuple with the ShadeInstanceType field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetShadeInstanceType + +`func (o *InstanceType) SetShadeInstanceType(v string)` + +SetShadeInstanceType sets ShadeInstanceType field to given value. + + +### GetCloudInstanceType + +`func (o *InstanceType) GetCloudInstanceType() string` + +GetCloudInstanceType returns the CloudInstanceType field if non-nil, zero value otherwise. + +### GetCloudInstanceTypeOk + +`func (o *InstanceType) GetCloudInstanceTypeOk() (*string, bool)` + +GetCloudInstanceTypeOk returns a tuple with the CloudInstanceType field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCloudInstanceType + +`func (o *InstanceType) SetCloudInstanceType(v string)` + +SetCloudInstanceType sets CloudInstanceType field to given value. + + +### GetConfiguration + +`func (o *InstanceType) GetConfiguration() InstanceTypeConfiguration` + +GetConfiguration returns the Configuration field if non-nil, zero value otherwise. + +### GetConfigurationOk + +`func (o *InstanceType) GetConfigurationOk() (*InstanceTypeConfiguration, bool)` + +GetConfigurationOk returns a tuple with the Configuration field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetConfiguration + +`func (o *InstanceType) SetConfiguration(v InstanceTypeConfiguration)` + +SetConfiguration sets Configuration field to given value. + + +### GetHourlyPrice + +`func (o *InstanceType) GetHourlyPrice() int32` + +GetHourlyPrice returns the HourlyPrice field if non-nil, zero value otherwise. + +### GetHourlyPriceOk + +`func (o *InstanceType) GetHourlyPriceOk() (*int32, bool)` + +GetHourlyPriceOk returns a tuple with the HourlyPrice field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetHourlyPrice + +`func (o *InstanceType) SetHourlyPrice(v int32)` + +SetHourlyPrice sets HourlyPrice field to given value. + + +### GetDeploymentType + +`func (o *InstanceType) GetDeploymentType() string` + +GetDeploymentType returns the DeploymentType field if non-nil, zero value otherwise. + +### GetDeploymentTypeOk + +`func (o *InstanceType) GetDeploymentTypeOk() (*string, bool)` + +GetDeploymentTypeOk returns a tuple with the DeploymentType field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDeploymentType + +`func (o *InstanceType) SetDeploymentType(v string)` + +SetDeploymentType sets DeploymentType field to given value. + + +### GetAvailability + +`func (o *InstanceType) GetAvailability() []Availability` + +GetAvailability returns the Availability field if non-nil, zero value otherwise. + +### GetAvailabilityOk + +`func (o *InstanceType) GetAvailabilityOk() (*[]Availability, bool)` + +GetAvailabilityOk returns a tuple with the Availability field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAvailability + +`func (o *InstanceType) SetAvailability(v []Availability)` + +SetAvailability sets Availability field to given value. + + +### GetBootTime + +`func (o *InstanceType) GetBootTime() map[string]interface{}` + +GetBootTime returns the BootTime field if non-nil, zero value otherwise. + +### GetBootTimeOk + +`func (o *InstanceType) GetBootTimeOk() (*map[string]interface{}, bool)` + +GetBootTimeOk returns a tuple with the BootTime field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBootTime + +`func (o *InstanceType) SetBootTime(v map[string]interface{})` + +SetBootTime sets BootTime field to given value. + +### HasBootTime + +`func (o *InstanceType) HasBootTime() bool` + +HasBootTime returns a boolean if a field has been set. + +### GetMemoryInGb + +`func (o *InstanceType) GetMemoryInGb() int32` + +GetMemoryInGb returns the MemoryInGb field if non-nil, zero value otherwise. + +### GetMemoryInGbOk + +`func (o *InstanceType) GetMemoryInGbOk() (*int32, bool)` + +GetMemoryInGbOk returns a tuple with the MemoryInGb field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMemoryInGb + +`func (o *InstanceType) SetMemoryInGb(v int32)` + +SetMemoryInGb sets MemoryInGb field to given value. + +### HasMemoryInGb + +`func (o *InstanceType) HasMemoryInGb() bool` + +HasMemoryInGb returns a boolean if a field has been set. + +### GetStorageInGb + +`func (o *InstanceType) GetStorageInGb() int32` + +GetStorageInGb returns the StorageInGb field if non-nil, zero value otherwise. + +### GetStorageInGbOk + +`func (o *InstanceType) GetStorageInGbOk() (*int32, bool)` + +GetStorageInGbOk returns a tuple with the StorageInGb field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetStorageInGb + +`func (o *InstanceType) SetStorageInGb(v int32)` + +SetStorageInGb sets StorageInGb field to given value. + +### HasStorageInGb + +`func (o *InstanceType) HasStorageInGb() bool` + +HasStorageInGb returns a boolean if a field has been set. + +### GetVcpus + +`func (o *InstanceType) GetVcpus() int32` + +GetVcpus returns the Vcpus field if non-nil, zero value otherwise. + +### GetVcpusOk + +`func (o *InstanceType) GetVcpusOk() (*int32, bool)` + +GetVcpusOk returns a tuple with the Vcpus field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetVcpus + +`func (o *InstanceType) SetVcpus(v int32)` + +SetVcpus sets Vcpus field to given value. + +### HasVcpus + +`func (o *InstanceType) HasVcpus() bool` + +HasVcpus returns a boolean if a field has been set. + +### GetNumGpus + +`func (o *InstanceType) GetNumGpus() int32` + +GetNumGpus returns the NumGpus field if non-nil, zero value otherwise. + +### GetNumGpusOk + +`func (o *InstanceType) GetNumGpusOk() (*int32, bool)` + +GetNumGpusOk returns a tuple with the NumGpus field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNumGpus + +`func (o *InstanceType) SetNumGpus(v int32)` + +SetNumGpus sets NumGpus field to given value. + +### HasNumGpus + +`func (o *InstanceType) HasNumGpus() bool` + +HasNumGpus returns a boolean if a field has been set. + +### GetGpuType + +`func (o *InstanceType) GetGpuType() string` + +GetGpuType returns the GpuType field if non-nil, zero value otherwise. + +### GetGpuTypeOk + +`func (o *InstanceType) GetGpuTypeOk() (*string, bool)` + +GetGpuTypeOk returns a tuple with the GpuType field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetGpuType + +`func (o *InstanceType) SetGpuType(v string)` + +SetGpuType sets GpuType field to given value. + +### HasGpuType + +`func (o *InstanceType) HasGpuType() bool` + +HasGpuType returns a boolean if a field has been set. + +### GetInterconnect + +`func (o *InstanceType) GetInterconnect() string` + +GetInterconnect returns the Interconnect field if non-nil, zero value otherwise. + +### GetInterconnectOk + +`func (o *InstanceType) GetInterconnectOk() (*string, bool)` + +GetInterconnectOk returns a tuple with the Interconnect field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetInterconnect + +`func (o *InstanceType) SetInterconnect(v string)` + +SetInterconnect sets Interconnect field to given value. + +### HasInterconnect + +`func (o *InstanceType) HasInterconnect() bool` + +HasInterconnect returns a boolean if a field has been set. + +### GetNvlink + +`func (o *InstanceType) GetNvlink() bool` + +GetNvlink returns the Nvlink field if non-nil, zero value otherwise. + +### GetNvlinkOk + +`func (o *InstanceType) GetNvlinkOk() (*bool, bool)` + +GetNvlinkOk returns a tuple with the Nvlink field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNvlink + +`func (o *InstanceType) SetNvlink(v bool)` + +SetNvlink sets Nvlink field to given value. + +### HasNvlink + +`func (o *InstanceType) HasNvlink() bool` + +HasNvlink 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/shadeform/gen/shadeform/docs/InstanceTypeConfiguration.md b/internal/shadeform/gen/shadeform/docs/InstanceTypeConfiguration.md new file mode 100644 index 00000000..d3a3c07b --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/InstanceTypeConfiguration.md @@ -0,0 +1,224 @@ +# InstanceTypeConfiguration + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**MemoryInGb** | **int32** | The amount of memory for the instance in gigabytes. Note that this is not VRAM which is determined by GPU type and the number of GPUs. | +**StorageInGb** | **int32** | The amount of storage for the instance. If this storage is too low for the instance type, please email support@shadeform.ai as the storage may be adjustable. | +**Vcpus** | **int32** | The number of vCPUs for the instance. | +**NumGpus** | **int32** | The number of GPUs for the instance. | +**GpuType** | **string** | The type of GPU for the instance. | +**Interconnect** | **string** | The type of GPU interconnect. | +**Nvlink** | Pointer to **bool** | If the instance has NVLink | [optional] +**VramPerGpuInGb** | **int32** | The video memory per GPU for the instance in gigabytes. | +**OsOptions** | **[]string** | The list of available operating systems for the instance. | + +## Methods + +### NewInstanceTypeConfiguration + +`func NewInstanceTypeConfiguration(memoryInGb int32, storageInGb int32, vcpus int32, numGpus int32, gpuType string, interconnect string, vramPerGpuInGb int32, osOptions []string, ) *InstanceTypeConfiguration` + +NewInstanceTypeConfiguration instantiates a new InstanceTypeConfiguration 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 + +### NewInstanceTypeConfigurationWithDefaults + +`func NewInstanceTypeConfigurationWithDefaults() *InstanceTypeConfiguration` + +NewInstanceTypeConfigurationWithDefaults instantiates a new InstanceTypeConfiguration 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 + +### GetMemoryInGb + +`func (o *InstanceTypeConfiguration) GetMemoryInGb() int32` + +GetMemoryInGb returns the MemoryInGb field if non-nil, zero value otherwise. + +### GetMemoryInGbOk + +`func (o *InstanceTypeConfiguration) GetMemoryInGbOk() (*int32, bool)` + +GetMemoryInGbOk returns a tuple with the MemoryInGb field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMemoryInGb + +`func (o *InstanceTypeConfiguration) SetMemoryInGb(v int32)` + +SetMemoryInGb sets MemoryInGb field to given value. + + +### GetStorageInGb + +`func (o *InstanceTypeConfiguration) GetStorageInGb() int32` + +GetStorageInGb returns the StorageInGb field if non-nil, zero value otherwise. + +### GetStorageInGbOk + +`func (o *InstanceTypeConfiguration) GetStorageInGbOk() (*int32, bool)` + +GetStorageInGbOk returns a tuple with the StorageInGb field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetStorageInGb + +`func (o *InstanceTypeConfiguration) SetStorageInGb(v int32)` + +SetStorageInGb sets StorageInGb field to given value. + + +### GetVcpus + +`func (o *InstanceTypeConfiguration) GetVcpus() int32` + +GetVcpus returns the Vcpus field if non-nil, zero value otherwise. + +### GetVcpusOk + +`func (o *InstanceTypeConfiguration) GetVcpusOk() (*int32, bool)` + +GetVcpusOk returns a tuple with the Vcpus field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetVcpus + +`func (o *InstanceTypeConfiguration) SetVcpus(v int32)` + +SetVcpus sets Vcpus field to given value. + + +### GetNumGpus + +`func (o *InstanceTypeConfiguration) GetNumGpus() int32` + +GetNumGpus returns the NumGpus field if non-nil, zero value otherwise. + +### GetNumGpusOk + +`func (o *InstanceTypeConfiguration) GetNumGpusOk() (*int32, bool)` + +GetNumGpusOk returns a tuple with the NumGpus field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNumGpus + +`func (o *InstanceTypeConfiguration) SetNumGpus(v int32)` + +SetNumGpus sets NumGpus field to given value. + + +### GetGpuType + +`func (o *InstanceTypeConfiguration) GetGpuType() string` + +GetGpuType returns the GpuType field if non-nil, zero value otherwise. + +### GetGpuTypeOk + +`func (o *InstanceTypeConfiguration) GetGpuTypeOk() (*string, bool)` + +GetGpuTypeOk returns a tuple with the GpuType field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetGpuType + +`func (o *InstanceTypeConfiguration) SetGpuType(v string)` + +SetGpuType sets GpuType field to given value. + + +### GetInterconnect + +`func (o *InstanceTypeConfiguration) GetInterconnect() string` + +GetInterconnect returns the Interconnect field if non-nil, zero value otherwise. + +### GetInterconnectOk + +`func (o *InstanceTypeConfiguration) GetInterconnectOk() (*string, bool)` + +GetInterconnectOk returns a tuple with the Interconnect field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetInterconnect + +`func (o *InstanceTypeConfiguration) SetInterconnect(v string)` + +SetInterconnect sets Interconnect field to given value. + + +### GetNvlink + +`func (o *InstanceTypeConfiguration) GetNvlink() bool` + +GetNvlink returns the Nvlink field if non-nil, zero value otherwise. + +### GetNvlinkOk + +`func (o *InstanceTypeConfiguration) GetNvlinkOk() (*bool, bool)` + +GetNvlinkOk returns a tuple with the Nvlink field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNvlink + +`func (o *InstanceTypeConfiguration) SetNvlink(v bool)` + +SetNvlink sets Nvlink field to given value. + +### HasNvlink + +`func (o *InstanceTypeConfiguration) HasNvlink() bool` + +HasNvlink returns a boolean if a field has been set. + +### GetVramPerGpuInGb + +`func (o *InstanceTypeConfiguration) GetVramPerGpuInGb() int32` + +GetVramPerGpuInGb returns the VramPerGpuInGb field if non-nil, zero value otherwise. + +### GetVramPerGpuInGbOk + +`func (o *InstanceTypeConfiguration) GetVramPerGpuInGbOk() (*int32, bool)` + +GetVramPerGpuInGbOk returns a tuple with the VramPerGpuInGb field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetVramPerGpuInGb + +`func (o *InstanceTypeConfiguration) SetVramPerGpuInGb(v int32)` + +SetVramPerGpuInGb sets VramPerGpuInGb field to given value. + + +### GetOsOptions + +`func (o *InstanceTypeConfiguration) GetOsOptions() []string` + +GetOsOptions returns the OsOptions field if non-nil, zero value otherwise. + +### GetOsOptionsOk + +`func (o *InstanceTypeConfiguration) GetOsOptionsOk() (*[]string, bool)` + +GetOsOptionsOk returns a tuple with the OsOptions field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetOsOptions + +`func (o *InstanceTypeConfiguration) SetOsOptions(v []string)` + +SetOsOptions sets OsOptions 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/shadeform/gen/shadeform/docs/InstanceTypesResponse.md b/internal/shadeform/gen/shadeform/docs/InstanceTypesResponse.md new file mode 100644 index 00000000..96c69244 --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/InstanceTypesResponse.md @@ -0,0 +1,51 @@ +# InstanceTypesResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**InstanceTypes** | [**[]InstanceType**](InstanceType.md) | | + +## Methods + +### NewInstanceTypesResponse + +`func NewInstanceTypesResponse(instanceTypes []InstanceType, ) *InstanceTypesResponse` + +NewInstanceTypesResponse instantiates a new InstanceTypesResponse 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 + +### NewInstanceTypesResponseWithDefaults + +`func NewInstanceTypesResponseWithDefaults() *InstanceTypesResponse` + +NewInstanceTypesResponseWithDefaults instantiates a new InstanceTypesResponse 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 + +### GetInstanceTypes + +`func (o *InstanceTypesResponse) GetInstanceTypes() []InstanceType` + +GetInstanceTypes returns the InstanceTypes field if non-nil, zero value otherwise. + +### GetInstanceTypesOk + +`func (o *InstanceTypesResponse) GetInstanceTypesOk() (*[]InstanceType, bool)` + +GetInstanceTypesOk returns a tuple with the InstanceTypes field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetInstanceTypes + +`func (o *InstanceTypesResponse) SetInstanceTypes(v []InstanceType)` + +SetInstanceTypes sets InstanceTypes 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/shadeform/gen/shadeform/docs/InstancesResponse.md b/internal/shadeform/gen/shadeform/docs/InstancesResponse.md new file mode 100644 index 00000000..54fefa2f --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/InstancesResponse.md @@ -0,0 +1,51 @@ +# InstancesResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Instances** | [**[]Instance**](Instance.md) | | + +## Methods + +### NewInstancesResponse + +`func NewInstancesResponse(instances []Instance, ) *InstancesResponse` + +NewInstancesResponse instantiates a new InstancesResponse 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 + +### NewInstancesResponseWithDefaults + +`func NewInstancesResponseWithDefaults() *InstancesResponse` + +NewInstancesResponseWithDefaults instantiates a new InstancesResponse 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 + +### GetInstances + +`func (o *InstancesResponse) GetInstances() []Instance` + +GetInstances returns the Instances field if non-nil, zero value otherwise. + +### GetInstancesOk + +`func (o *InstancesResponse) GetInstancesOk() (*[]Instance, bool)` + +GetInstancesOk returns a tuple with the Instances field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetInstances + +`func (o *InstancesResponse) SetInstances(v []Instance)` + +SetInstances sets Instances 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/shadeform/gen/shadeform/docs/LaunchConfiguration.md b/internal/shadeform/gen/shadeform/docs/LaunchConfiguration.md new file mode 100644 index 00000000..5bff8efb --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/LaunchConfiguration.md @@ -0,0 +1,103 @@ +# LaunchConfiguration + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type** | **string** | Specifies the type of launch configuration. See [Launch Configuration](/getting-started/concepts#launch-configuration) for more details. | +**DockerConfiguration** | Pointer to [**DockerConfiguration**](DockerConfiguration.md) | | [optional] +**ScriptConfiguration** | Pointer to [**ScriptConfiguration**](ScriptConfiguration.md) | | [optional] + +## Methods + +### NewLaunchConfiguration + +`func NewLaunchConfiguration(type_ string, ) *LaunchConfiguration` + +NewLaunchConfiguration instantiates a new LaunchConfiguration 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 + +### NewLaunchConfigurationWithDefaults + +`func NewLaunchConfigurationWithDefaults() *LaunchConfiguration` + +NewLaunchConfigurationWithDefaults instantiates a new LaunchConfiguration 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 *LaunchConfiguration) GetType() string` + +GetType returns the Type field if non-nil, zero value otherwise. + +### GetTypeOk + +`func (o *LaunchConfiguration) 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 *LaunchConfiguration) SetType(v string)` + +SetType sets Type field to given value. + + +### GetDockerConfiguration + +`func (o *LaunchConfiguration) GetDockerConfiguration() DockerConfiguration` + +GetDockerConfiguration returns the DockerConfiguration field if non-nil, zero value otherwise. + +### GetDockerConfigurationOk + +`func (o *LaunchConfiguration) GetDockerConfigurationOk() (*DockerConfiguration, bool)` + +GetDockerConfigurationOk returns a tuple with the DockerConfiguration field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDockerConfiguration + +`func (o *LaunchConfiguration) SetDockerConfiguration(v DockerConfiguration)` + +SetDockerConfiguration sets DockerConfiguration field to given value. + +### HasDockerConfiguration + +`func (o *LaunchConfiguration) HasDockerConfiguration() bool` + +HasDockerConfiguration returns a boolean if a field has been set. + +### GetScriptConfiguration + +`func (o *LaunchConfiguration) GetScriptConfiguration() ScriptConfiguration` + +GetScriptConfiguration returns the ScriptConfiguration field if non-nil, zero value otherwise. + +### GetScriptConfigurationOk + +`func (o *LaunchConfiguration) GetScriptConfigurationOk() (*ScriptConfiguration, bool)` + +GetScriptConfigurationOk returns a tuple with the ScriptConfiguration field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetScriptConfiguration + +`func (o *LaunchConfiguration) SetScriptConfiguration(v ScriptConfiguration)` + +SetScriptConfiguration sets ScriptConfiguration field to given value. + +### HasScriptConfiguration + +`func (o *LaunchConfiguration) HasScriptConfiguration() bool` + +HasScriptConfiguration 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/shadeform/gen/shadeform/docs/Networking.md b/internal/shadeform/gen/shadeform/docs/Networking.md new file mode 100644 index 00000000..06934414 --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/Networking.md @@ -0,0 +1,56 @@ +# Networking + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**UfwRules** | Pointer to [**[]UfwRule**](UfwRule.md) | List of UFW (Uncomplicated Firewall) rules | [optional] + +## Methods + +### NewNetworking + +`func NewNetworking() *Networking` + +NewNetworking instantiates a new Networking 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 + +### NewNetworkingWithDefaults + +`func NewNetworkingWithDefaults() *Networking` + +NewNetworkingWithDefaults instantiates a new Networking 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 + +### GetUfwRules + +`func (o *Networking) GetUfwRules() []UfwRule` + +GetUfwRules returns the UfwRules field if non-nil, zero value otherwise. + +### GetUfwRulesOk + +`func (o *Networking) GetUfwRulesOk() (*[]UfwRule, bool)` + +GetUfwRulesOk returns a tuple with the UfwRules field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUfwRules + +`func (o *Networking) SetUfwRules(v []UfwRule)` + +SetUfwRules sets UfwRules field to given value. + +### HasUfwRules + +`func (o *Networking) HasUfwRules() bool` + +HasUfwRules 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/shadeform/gen/shadeform/docs/PortMappings.md b/internal/shadeform/gen/shadeform/docs/PortMappings.md new file mode 100644 index 00000000..07252604 --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/PortMappings.md @@ -0,0 +1,72 @@ +# PortMappings + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**HostPort** | **int32** | Port of the host. | +**ContainerPort** | **int32** | Port of the container. | + +## Methods + +### NewPortMappings + +`func NewPortMappings(hostPort int32, containerPort int32, ) *PortMappings` + +NewPortMappings instantiates a new PortMappings 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 + +### NewPortMappingsWithDefaults + +`func NewPortMappingsWithDefaults() *PortMappings` + +NewPortMappingsWithDefaults instantiates a new PortMappings 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 + +### GetHostPort + +`func (o *PortMappings) GetHostPort() int32` + +GetHostPort returns the HostPort field if non-nil, zero value otherwise. + +### GetHostPortOk + +`func (o *PortMappings) GetHostPortOk() (*int32, bool)` + +GetHostPortOk returns a tuple with the HostPort field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetHostPort + +`func (o *PortMappings) SetHostPort(v int32)` + +SetHostPort sets HostPort field to given value. + + +### GetContainerPort + +`func (o *PortMappings) GetContainerPort() int32` + +GetContainerPort returns the ContainerPort field if non-nil, zero value otherwise. + +### GetContainerPortOk + +`func (o *PortMappings) GetContainerPortOk() (*int32, bool)` + +GetContainerPortOk returns a tuple with the ContainerPort field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetContainerPort + +`func (o *PortMappings) SetContainerPort(v int32)` + +SetContainerPort sets ContainerPort 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/shadeform/gen/shadeform/docs/RegistryCredentials.md b/internal/shadeform/gen/shadeform/docs/RegistryCredentials.md new file mode 100644 index 00000000..d36ec1eb --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/RegistryCredentials.md @@ -0,0 +1,82 @@ +# RegistryCredentials + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Username** | Pointer to **string** | The username for the docker registry. | [optional] +**Password** | Pointer to **string** | The password for the docker registry. | [optional] + +## Methods + +### NewRegistryCredentials + +`func NewRegistryCredentials() *RegistryCredentials` + +NewRegistryCredentials instantiates a new RegistryCredentials 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 + +### NewRegistryCredentialsWithDefaults + +`func NewRegistryCredentialsWithDefaults() *RegistryCredentials` + +NewRegistryCredentialsWithDefaults instantiates a new RegistryCredentials 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 + +### GetUsername + +`func (o *RegistryCredentials) GetUsername() string` + +GetUsername returns the Username field if non-nil, zero value otherwise. + +### GetUsernameOk + +`func (o *RegistryCredentials) GetUsernameOk() (*string, bool)` + +GetUsernameOk returns a tuple with the Username field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUsername + +`func (o *RegistryCredentials) SetUsername(v string)` + +SetUsername sets Username field to given value. + +### HasUsername + +`func (o *RegistryCredentials) HasUsername() bool` + +HasUsername returns a boolean if a field has been set. + +### GetPassword + +`func (o *RegistryCredentials) GetPassword() string` + +GetPassword returns the Password field if non-nil, zero value otherwise. + +### GetPasswordOk + +`func (o *RegistryCredentials) GetPasswordOk() (*string, bool)` + +GetPasswordOk returns a tuple with the Password field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPassword + +`func (o *RegistryCredentials) SetPassword(v string)` + +SetPassword sets Password field to given value. + +### HasPassword + +`func (o *RegistryCredentials) HasPassword() bool` + +HasPassword 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/shadeform/gen/shadeform/docs/ScriptConfiguration.md b/internal/shadeform/gen/shadeform/docs/ScriptConfiguration.md new file mode 100644 index 00000000..2d977d6f --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/ScriptConfiguration.md @@ -0,0 +1,51 @@ +# ScriptConfiguration + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Base64Script** | **string** | A startup script that is base64 encoded. | + +## Methods + +### NewScriptConfiguration + +`func NewScriptConfiguration(base64Script string, ) *ScriptConfiguration` + +NewScriptConfiguration instantiates a new ScriptConfiguration 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 + +### NewScriptConfigurationWithDefaults + +`func NewScriptConfigurationWithDefaults() *ScriptConfiguration` + +NewScriptConfigurationWithDefaults instantiates a new ScriptConfiguration 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 + +### GetBase64Script + +`func (o *ScriptConfiguration) GetBase64Script() string` + +GetBase64Script returns the Base64Script field if non-nil, zero value otherwise. + +### GetBase64ScriptOk + +`func (o *ScriptConfiguration) GetBase64ScriptOk() (*string, bool)` + +GetBase64ScriptOk returns a tuple with the Base64Script field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBase64Script + +`func (o *ScriptConfiguration) SetBase64Script(v string)` + +SetBase64Script sets Base64Script 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/shadeform/gen/shadeform/docs/SshKey.md b/internal/shadeform/gen/shadeform/docs/SshKey.md new file mode 100644 index 00000000..3440cdbf --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/SshKey.md @@ -0,0 +1,114 @@ +# SshKey + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **string** | The ID of the SSH Key. | +**Name** | **string** | The name of the SSH Key. | +**PublicKey** | **string** | The public key. | +**IsDefault** | **bool** | Indicates the default key. | + +## Methods + +### NewSshKey + +`func NewSshKey(id string, name string, publicKey string, isDefault bool, ) *SshKey` + +NewSshKey instantiates a new SshKey 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 + +### NewSshKeyWithDefaults + +`func NewSshKeyWithDefaults() *SshKey` + +NewSshKeyWithDefaults instantiates a new SshKey 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 *SshKey) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *SshKey) 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 *SshKey) SetId(v string)` + +SetId sets Id field to given value. + + +### GetName + +`func (o *SshKey) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *SshKey) 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 *SshKey) SetName(v string)` + +SetName sets Name field to given value. + + +### GetPublicKey + +`func (o *SshKey) GetPublicKey() string` + +GetPublicKey returns the PublicKey field if non-nil, zero value otherwise. + +### GetPublicKeyOk + +`func (o *SshKey) GetPublicKeyOk() (*string, bool)` + +GetPublicKeyOk returns a tuple with the PublicKey field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPublicKey + +`func (o *SshKey) SetPublicKey(v string)` + +SetPublicKey sets PublicKey field to given value. + + +### GetIsDefault + +`func (o *SshKey) GetIsDefault() bool` + +GetIsDefault returns the IsDefault field if non-nil, zero value otherwise. + +### GetIsDefaultOk + +`func (o *SshKey) GetIsDefaultOk() (*bool, bool)` + +GetIsDefaultOk returns a tuple with the IsDefault field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIsDefault + +`func (o *SshKey) SetIsDefault(v bool)` + +SetIsDefault sets IsDefault 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/shadeform/gen/shadeform/docs/SshKeysResponse.md b/internal/shadeform/gen/shadeform/docs/SshKeysResponse.md new file mode 100644 index 00000000..7ec74899 --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/SshKeysResponse.md @@ -0,0 +1,51 @@ +# SshKeysResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**SshKeys** | [**[]SshKey**](SshKey.md) | | + +## Methods + +### NewSshKeysResponse + +`func NewSshKeysResponse(sshKeys []SshKey, ) *SshKeysResponse` + +NewSshKeysResponse instantiates a new SshKeysResponse 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 + +### NewSshKeysResponseWithDefaults + +`func NewSshKeysResponseWithDefaults() *SshKeysResponse` + +NewSshKeysResponseWithDefaults instantiates a new SshKeysResponse 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 + +### GetSshKeys + +`func (o *SshKeysResponse) GetSshKeys() []SshKey` + +GetSshKeys returns the SshKeys field if non-nil, zero value otherwise. + +### GetSshKeysOk + +`func (o *SshKeysResponse) GetSshKeysOk() (*[]SshKey, bool)` + +GetSshKeysOk returns a tuple with the SshKeys field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSshKeys + +`func (o *SshKeysResponse) SetSshKeys(v []SshKey)` + +SetSshKeys sets SshKeys 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/shadeform/gen/shadeform/docs/Status.md b/internal/shadeform/gen/shadeform/docs/Status.md new file mode 100644 index 00000000..0c6cde1d --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/Status.md @@ -0,0 +1,19 @@ +# Status + +## Enum + + +* `CREATING` (value: `"creating"`) + +* `PENDING_PROVIDER` (value: `"pending_provider"`) + +* `PENDING` (value: `"pending"`) + +* `ACTIVE` (value: `"active"`) + +* `DELETED` (value: `"deleted"`) + + +[[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/shadeform/gen/shadeform/docs/Template.md b/internal/shadeform/gen/shadeform/docs/Template.md new file mode 100644 index 00000000..2fdaa047 --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/Template.md @@ -0,0 +1,358 @@ +# Template + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **string** | Unique identifier for the template, generated by Shadeform | +**Name** | **string** | Name of the template | +**Description** | Pointer to **string** | Description of the template | [optional] +**Author** | Pointer to **string** | Author of the template | [optional] +**Logo** | Pointer to **string** | URL to the template's logo | [optional] +**Public** | Pointer to **bool** | Whether the template is publicly available | [optional] +**LaunchConfiguration** | Pointer to [**LaunchConfiguration**](LaunchConfiguration.md) | | [optional] +**AutoDelete** | Pointer to [**AutoDelete**](AutoDelete.md) | | [optional] +**Alert** | Pointer to [**Alert**](Alert.md) | | [optional] +**VolumeMount** | Pointer to [**VolumeMount**](VolumeMount.md) | | [optional] +**Tags** | Pointer to **[]string** | Add custom, searchable tags to instances. | [optional] +**Envs** | Pointer to [**[]Env**](Env.md) | List of environment variable name and values to automatically add to the instance | [optional] +**Networking** | Pointer to [**Networking**](Networking.md) | | [optional] + +## Methods + +### NewTemplate + +`func NewTemplate(id string, name string, ) *Template` + +NewTemplate instantiates a new Template 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 + +### NewTemplateWithDefaults + +`func NewTemplateWithDefaults() *Template` + +NewTemplateWithDefaults instantiates a new Template 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 *Template) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *Template) 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 *Template) SetId(v string)` + +SetId sets Id field to given value. + + +### GetName + +`func (o *Template) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *Template) 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 *Template) SetName(v string)` + +SetName sets Name field to given value. + + +### GetDescription + +`func (o *Template) GetDescription() string` + +GetDescription returns the Description field if non-nil, zero value otherwise. + +### GetDescriptionOk + +`func (o *Template) GetDescriptionOk() (*string, bool)` + +GetDescriptionOk returns a tuple with the Description field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDescription + +`func (o *Template) SetDescription(v string)` + +SetDescription sets Description field to given value. + +### HasDescription + +`func (o *Template) HasDescription() bool` + +HasDescription returns a boolean if a field has been set. + +### GetAuthor + +`func (o *Template) GetAuthor() string` + +GetAuthor returns the Author field if non-nil, zero value otherwise. + +### GetAuthorOk + +`func (o *Template) GetAuthorOk() (*string, bool)` + +GetAuthorOk returns a tuple with the Author field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAuthor + +`func (o *Template) SetAuthor(v string)` + +SetAuthor sets Author field to given value. + +### HasAuthor + +`func (o *Template) HasAuthor() bool` + +HasAuthor returns a boolean if a field has been set. + +### GetLogo + +`func (o *Template) GetLogo() string` + +GetLogo returns the Logo field if non-nil, zero value otherwise. + +### GetLogoOk + +`func (o *Template) GetLogoOk() (*string, bool)` + +GetLogoOk returns a tuple with the Logo field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLogo + +`func (o *Template) SetLogo(v string)` + +SetLogo sets Logo field to given value. + +### HasLogo + +`func (o *Template) HasLogo() bool` + +HasLogo returns a boolean if a field has been set. + +### GetPublic + +`func (o *Template) GetPublic() bool` + +GetPublic returns the Public field if non-nil, zero value otherwise. + +### GetPublicOk + +`func (o *Template) GetPublicOk() (*bool, bool)` + +GetPublicOk returns a tuple with the Public field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPublic + +`func (o *Template) SetPublic(v bool)` + +SetPublic sets Public field to given value. + +### HasPublic + +`func (o *Template) HasPublic() bool` + +HasPublic returns a boolean if a field has been set. + +### GetLaunchConfiguration + +`func (o *Template) GetLaunchConfiguration() LaunchConfiguration` + +GetLaunchConfiguration returns the LaunchConfiguration field if non-nil, zero value otherwise. + +### GetLaunchConfigurationOk + +`func (o *Template) GetLaunchConfigurationOk() (*LaunchConfiguration, bool)` + +GetLaunchConfigurationOk returns a tuple with the LaunchConfiguration field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLaunchConfiguration + +`func (o *Template) SetLaunchConfiguration(v LaunchConfiguration)` + +SetLaunchConfiguration sets LaunchConfiguration field to given value. + +### HasLaunchConfiguration + +`func (o *Template) HasLaunchConfiguration() bool` + +HasLaunchConfiguration returns a boolean if a field has been set. + +### GetAutoDelete + +`func (o *Template) GetAutoDelete() AutoDelete` + +GetAutoDelete returns the AutoDelete field if non-nil, zero value otherwise. + +### GetAutoDeleteOk + +`func (o *Template) GetAutoDeleteOk() (*AutoDelete, bool)` + +GetAutoDeleteOk returns a tuple with the AutoDelete field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAutoDelete + +`func (o *Template) SetAutoDelete(v AutoDelete)` + +SetAutoDelete sets AutoDelete field to given value. + +### HasAutoDelete + +`func (o *Template) HasAutoDelete() bool` + +HasAutoDelete returns a boolean if a field has been set. + +### GetAlert + +`func (o *Template) GetAlert() Alert` + +GetAlert returns the Alert field if non-nil, zero value otherwise. + +### GetAlertOk + +`func (o *Template) GetAlertOk() (*Alert, bool)` + +GetAlertOk returns a tuple with the Alert field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAlert + +`func (o *Template) SetAlert(v Alert)` + +SetAlert sets Alert field to given value. + +### HasAlert + +`func (o *Template) HasAlert() bool` + +HasAlert returns a boolean if a field has been set. + +### GetVolumeMount + +`func (o *Template) GetVolumeMount() VolumeMount` + +GetVolumeMount returns the VolumeMount field if non-nil, zero value otherwise. + +### GetVolumeMountOk + +`func (o *Template) GetVolumeMountOk() (*VolumeMount, bool)` + +GetVolumeMountOk returns a tuple with the VolumeMount field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetVolumeMount + +`func (o *Template) SetVolumeMount(v VolumeMount)` + +SetVolumeMount sets VolumeMount field to given value. + +### HasVolumeMount + +`func (o *Template) HasVolumeMount() bool` + +HasVolumeMount returns a boolean if a field has been set. + +### GetTags + +`func (o *Template) GetTags() []string` + +GetTags returns the Tags field if non-nil, zero value otherwise. + +### GetTagsOk + +`func (o *Template) GetTagsOk() (*[]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 *Template) SetTags(v []string)` + +SetTags sets Tags field to given value. + +### HasTags + +`func (o *Template) HasTags() bool` + +HasTags returns a boolean if a field has been set. + +### GetEnvs + +`func (o *Template) GetEnvs() []Env` + +GetEnvs returns the Envs field if non-nil, zero value otherwise. + +### GetEnvsOk + +`func (o *Template) GetEnvsOk() (*[]Env, bool)` + +GetEnvsOk returns a tuple with the Envs field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEnvs + +`func (o *Template) SetEnvs(v []Env)` + +SetEnvs sets Envs field to given value. + +### HasEnvs + +`func (o *Template) HasEnvs() bool` + +HasEnvs returns a boolean if a field has been set. + +### GetNetworking + +`func (o *Template) GetNetworking() Networking` + +GetNetworking returns the Networking field if non-nil, zero value otherwise. + +### GetNetworkingOk + +`func (o *Template) GetNetworkingOk() (*Networking, bool)` + +GetNetworkingOk returns a tuple with the Networking field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNetworking + +`func (o *Template) SetNetworking(v Networking)` + +SetNetworking sets Networking field to given value. + +### HasNetworking + +`func (o *Template) HasNetworking() bool` + +HasNetworking 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/shadeform/gen/shadeform/docs/TemplateCreateResponse.md b/internal/shadeform/gen/shadeform/docs/TemplateCreateResponse.md new file mode 100644 index 00000000..b8eae73e --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/TemplateCreateResponse.md @@ -0,0 +1,51 @@ +# TemplateCreateResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **string** | The unique identifier for the instance. Used in the instances for the /instances/{id}/info and /instances/{id}/delete APIs. | + +## Methods + +### NewTemplateCreateResponse + +`func NewTemplateCreateResponse(id string, ) *TemplateCreateResponse` + +NewTemplateCreateResponse instantiates a new TemplateCreateResponse 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 + +### NewTemplateCreateResponseWithDefaults + +`func NewTemplateCreateResponseWithDefaults() *TemplateCreateResponse` + +NewTemplateCreateResponseWithDefaults instantiates a new TemplateCreateResponse 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 *TemplateCreateResponse) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *TemplateCreateResponse) 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 *TemplateCreateResponse) SetId(v string)` + +SetId sets Id 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/shadeform/gen/shadeform/docs/TemplateSaveRequest.md b/internal/shadeform/gen/shadeform/docs/TemplateSaveRequest.md new file mode 100644 index 00000000..6e263542 --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/TemplateSaveRequest.md @@ -0,0 +1,285 @@ +# TemplateSaveRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | Name of the template | +**Description** | Pointer to **string** | Description of the template | [optional] +**Public** | Pointer to **bool** | Whether the template is publicly available | [optional] +**LaunchConfiguration** | Pointer to [**LaunchConfiguration**](LaunchConfiguration.md) | | [optional] +**AutoDelete** | Pointer to [**AutoDelete**](AutoDelete.md) | | [optional] +**Alert** | Pointer to [**Alert**](Alert.md) | | [optional] +**VolumeMount** | Pointer to [**VolumeMount**](VolumeMount.md) | | [optional] +**Tags** | Pointer to **[]string** | Tags associated with the template | [optional] +**Envs** | Pointer to [**[]Env**](Env.md) | Environment variables for the template | [optional] +**Networking** | Pointer to [**Networking**](Networking.md) | | [optional] + +## Methods + +### NewTemplateSaveRequest + +`func NewTemplateSaveRequest(name string, ) *TemplateSaveRequest` + +NewTemplateSaveRequest instantiates a new TemplateSaveRequest 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 + +### NewTemplateSaveRequestWithDefaults + +`func NewTemplateSaveRequestWithDefaults() *TemplateSaveRequest` + +NewTemplateSaveRequestWithDefaults instantiates a new TemplateSaveRequest 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 *TemplateSaveRequest) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *TemplateSaveRequest) 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 *TemplateSaveRequest) SetName(v string)` + +SetName sets Name field to given value. + + +### GetDescription + +`func (o *TemplateSaveRequest) GetDescription() string` + +GetDescription returns the Description field if non-nil, zero value otherwise. + +### GetDescriptionOk + +`func (o *TemplateSaveRequest) GetDescriptionOk() (*string, bool)` + +GetDescriptionOk returns a tuple with the Description field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDescription + +`func (o *TemplateSaveRequest) SetDescription(v string)` + +SetDescription sets Description field to given value. + +### HasDescription + +`func (o *TemplateSaveRequest) HasDescription() bool` + +HasDescription returns a boolean if a field has been set. + +### GetPublic + +`func (o *TemplateSaveRequest) GetPublic() bool` + +GetPublic returns the Public field if non-nil, zero value otherwise. + +### GetPublicOk + +`func (o *TemplateSaveRequest) GetPublicOk() (*bool, bool)` + +GetPublicOk returns a tuple with the Public field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPublic + +`func (o *TemplateSaveRequest) SetPublic(v bool)` + +SetPublic sets Public field to given value. + +### HasPublic + +`func (o *TemplateSaveRequest) HasPublic() bool` + +HasPublic returns a boolean if a field has been set. + +### GetLaunchConfiguration + +`func (o *TemplateSaveRequest) GetLaunchConfiguration() LaunchConfiguration` + +GetLaunchConfiguration returns the LaunchConfiguration field if non-nil, zero value otherwise. + +### GetLaunchConfigurationOk + +`func (o *TemplateSaveRequest) GetLaunchConfigurationOk() (*LaunchConfiguration, bool)` + +GetLaunchConfigurationOk returns a tuple with the LaunchConfiguration field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLaunchConfiguration + +`func (o *TemplateSaveRequest) SetLaunchConfiguration(v LaunchConfiguration)` + +SetLaunchConfiguration sets LaunchConfiguration field to given value. + +### HasLaunchConfiguration + +`func (o *TemplateSaveRequest) HasLaunchConfiguration() bool` + +HasLaunchConfiguration returns a boolean if a field has been set. + +### GetAutoDelete + +`func (o *TemplateSaveRequest) GetAutoDelete() AutoDelete` + +GetAutoDelete returns the AutoDelete field if non-nil, zero value otherwise. + +### GetAutoDeleteOk + +`func (o *TemplateSaveRequest) GetAutoDeleteOk() (*AutoDelete, bool)` + +GetAutoDeleteOk returns a tuple with the AutoDelete field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAutoDelete + +`func (o *TemplateSaveRequest) SetAutoDelete(v AutoDelete)` + +SetAutoDelete sets AutoDelete field to given value. + +### HasAutoDelete + +`func (o *TemplateSaveRequest) HasAutoDelete() bool` + +HasAutoDelete returns a boolean if a field has been set. + +### GetAlert + +`func (o *TemplateSaveRequest) GetAlert() Alert` + +GetAlert returns the Alert field if non-nil, zero value otherwise. + +### GetAlertOk + +`func (o *TemplateSaveRequest) GetAlertOk() (*Alert, bool)` + +GetAlertOk returns a tuple with the Alert field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAlert + +`func (o *TemplateSaveRequest) SetAlert(v Alert)` + +SetAlert sets Alert field to given value. + +### HasAlert + +`func (o *TemplateSaveRequest) HasAlert() bool` + +HasAlert returns a boolean if a field has been set. + +### GetVolumeMount + +`func (o *TemplateSaveRequest) GetVolumeMount() VolumeMount` + +GetVolumeMount returns the VolumeMount field if non-nil, zero value otherwise. + +### GetVolumeMountOk + +`func (o *TemplateSaveRequest) GetVolumeMountOk() (*VolumeMount, bool)` + +GetVolumeMountOk returns a tuple with the VolumeMount field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetVolumeMount + +`func (o *TemplateSaveRequest) SetVolumeMount(v VolumeMount)` + +SetVolumeMount sets VolumeMount field to given value. + +### HasVolumeMount + +`func (o *TemplateSaveRequest) HasVolumeMount() bool` + +HasVolumeMount returns a boolean if a field has been set. + +### GetTags + +`func (o *TemplateSaveRequest) GetTags() []string` + +GetTags returns the Tags field if non-nil, zero value otherwise. + +### GetTagsOk + +`func (o *TemplateSaveRequest) GetTagsOk() (*[]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 *TemplateSaveRequest) SetTags(v []string)` + +SetTags sets Tags field to given value. + +### HasTags + +`func (o *TemplateSaveRequest) HasTags() bool` + +HasTags returns a boolean if a field has been set. + +### GetEnvs + +`func (o *TemplateSaveRequest) GetEnvs() []Env` + +GetEnvs returns the Envs field if non-nil, zero value otherwise. + +### GetEnvsOk + +`func (o *TemplateSaveRequest) GetEnvsOk() (*[]Env, bool)` + +GetEnvsOk returns a tuple with the Envs field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEnvs + +`func (o *TemplateSaveRequest) SetEnvs(v []Env)` + +SetEnvs sets Envs field to given value. + +### HasEnvs + +`func (o *TemplateSaveRequest) HasEnvs() bool` + +HasEnvs returns a boolean if a field has been set. + +### GetNetworking + +`func (o *TemplateSaveRequest) GetNetworking() Networking` + +GetNetworking returns the Networking field if non-nil, zero value otherwise. + +### GetNetworkingOk + +`func (o *TemplateSaveRequest) GetNetworkingOk() (*Networking, bool)` + +GetNetworkingOk returns a tuple with the Networking field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNetworking + +`func (o *TemplateSaveRequest) SetNetworking(v Networking)` + +SetNetworking sets Networking field to given value. + +### HasNetworking + +`func (o *TemplateSaveRequest) HasNetworking() bool` + +HasNetworking 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/shadeform/gen/shadeform/docs/TemplatesResponse.md b/internal/shadeform/gen/shadeform/docs/TemplatesResponse.md new file mode 100644 index 00000000..fcc64a2d --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/TemplatesResponse.md @@ -0,0 +1,51 @@ +# TemplatesResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Templates** | [**[]Template**](Template.md) | | + +## Methods + +### NewTemplatesResponse + +`func NewTemplatesResponse(templates []Template, ) *TemplatesResponse` + +NewTemplatesResponse instantiates a new TemplatesResponse 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 + +### NewTemplatesResponseWithDefaults + +`func NewTemplatesResponseWithDefaults() *TemplatesResponse` + +NewTemplatesResponseWithDefaults instantiates a new TemplatesResponse 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 + +### GetTemplates + +`func (o *TemplatesResponse) GetTemplates() []Template` + +GetTemplates returns the Templates field if non-nil, zero value otherwise. + +### GetTemplatesOk + +`func (o *TemplatesResponse) GetTemplatesOk() (*[]Template, bool)` + +GetTemplatesOk returns a tuple with the Templates field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTemplates + +`func (o *TemplatesResponse) SetTemplates(v []Template)` + +SetTemplates sets Templates 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/shadeform/gen/shadeform/docs/UfwRule.md b/internal/shadeform/gen/shadeform/docs/UfwRule.md new file mode 100644 index 00000000..09a87645 --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/UfwRule.md @@ -0,0 +1,200 @@ +# UfwRule + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Rule** | Pointer to **string** | The UFW rule action | [optional] +**FromIp** | Pointer to **NullableString** | Source IP address or CIDR range | [optional] +**ToIp** | Pointer to **NullableString** | Destination IP address or CIDR range | [optional] +**Port** | Pointer to **NullableString** | Port number or range (e.g. '80' or '8000:8999') | [optional] +**Proto** | Pointer to **NullableString** | Protocol (e.g. tcp, udp) | [optional] + +## Methods + +### NewUfwRule + +`func NewUfwRule() *UfwRule` + +NewUfwRule instantiates a new UfwRule 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 + +### NewUfwRuleWithDefaults + +`func NewUfwRuleWithDefaults() *UfwRule` + +NewUfwRuleWithDefaults instantiates a new UfwRule 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 + +### GetRule + +`func (o *UfwRule) GetRule() string` + +GetRule returns the Rule field if non-nil, zero value otherwise. + +### GetRuleOk + +`func (o *UfwRule) GetRuleOk() (*string, bool)` + +GetRuleOk returns a tuple with the Rule field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRule + +`func (o *UfwRule) SetRule(v string)` + +SetRule sets Rule field to given value. + +### HasRule + +`func (o *UfwRule) HasRule() bool` + +HasRule returns a boolean if a field has been set. + +### GetFromIp + +`func (o *UfwRule) GetFromIp() string` + +GetFromIp returns the FromIp field if non-nil, zero value otherwise. + +### GetFromIpOk + +`func (o *UfwRule) GetFromIpOk() (*string, bool)` + +GetFromIpOk returns a tuple with the FromIp field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFromIp + +`func (o *UfwRule) SetFromIp(v string)` + +SetFromIp sets FromIp field to given value. + +### HasFromIp + +`func (o *UfwRule) HasFromIp() bool` + +HasFromIp returns a boolean if a field has been set. + +### SetFromIpNil + +`func (o *UfwRule) SetFromIpNil(b bool)` + + SetFromIpNil sets the value for FromIp to be an explicit nil + +### UnsetFromIp +`func (o *UfwRule) UnsetFromIp()` + +UnsetFromIp ensures that no value is present for FromIp, not even an explicit nil +### GetToIp + +`func (o *UfwRule) GetToIp() string` + +GetToIp returns the ToIp field if non-nil, zero value otherwise. + +### GetToIpOk + +`func (o *UfwRule) GetToIpOk() (*string, bool)` + +GetToIpOk returns a tuple with the ToIp field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetToIp + +`func (o *UfwRule) SetToIp(v string)` + +SetToIp sets ToIp field to given value. + +### HasToIp + +`func (o *UfwRule) HasToIp() bool` + +HasToIp returns a boolean if a field has been set. + +### SetToIpNil + +`func (o *UfwRule) SetToIpNil(b bool)` + + SetToIpNil sets the value for ToIp to be an explicit nil + +### UnsetToIp +`func (o *UfwRule) UnsetToIp()` + +UnsetToIp ensures that no value is present for ToIp, not even an explicit nil +### GetPort + +`func (o *UfwRule) GetPort() string` + +GetPort returns the Port field if non-nil, zero value otherwise. + +### GetPortOk + +`func (o *UfwRule) GetPortOk() (*string, bool)` + +GetPortOk returns a tuple with the Port field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPort + +`func (o *UfwRule) SetPort(v string)` + +SetPort sets Port field to given value. + +### HasPort + +`func (o *UfwRule) HasPort() bool` + +HasPort returns a boolean if a field has been set. + +### SetPortNil + +`func (o *UfwRule) SetPortNil(b bool)` + + SetPortNil sets the value for Port to be an explicit nil + +### UnsetPort +`func (o *UfwRule) UnsetPort()` + +UnsetPort ensures that no value is present for Port, not even an explicit nil +### GetProto + +`func (o *UfwRule) GetProto() string` + +GetProto returns the Proto field if non-nil, zero value otherwise. + +### GetProtoOk + +`func (o *UfwRule) GetProtoOk() (*string, bool)` + +GetProtoOk returns a tuple with the Proto field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetProto + +`func (o *UfwRule) SetProto(v string)` + +SetProto sets Proto field to given value. + +### HasProto + +`func (o *UfwRule) HasProto() bool` + +HasProto returns a boolean if a field has been set. + +### SetProtoNil + +`func (o *UfwRule) SetProtoNil(b bool)` + + SetProtoNil sets the value for Proto to be an explicit nil + +### UnsetProto +`func (o *UfwRule) UnsetProto()` + +UnsetProto ensures that no value is present for Proto, not even an explicit nil + +[[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/shadeform/gen/shadeform/docs/UpdateRequest.md b/internal/shadeform/gen/shadeform/docs/UpdateRequest.md new file mode 100644 index 00000000..c0e22496 --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/UpdateRequest.md @@ -0,0 +1,134 @@ +# UpdateRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | Pointer to **string** | The name of the instance | [optional] +**AutoDelete** | Pointer to [**AutoDelete**](AutoDelete.md) | | [optional] +**Alert** | Pointer to [**Alert**](Alert.md) | | [optional] +**Tags** | Pointer to **[]string** | Add custom, searchable tags to instances. | [optional] + +## Methods + +### NewUpdateRequest + +`func NewUpdateRequest() *UpdateRequest` + +NewUpdateRequest instantiates a new UpdateRequest 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 + +### NewUpdateRequestWithDefaults + +`func NewUpdateRequestWithDefaults() *UpdateRequest` + +NewUpdateRequestWithDefaults instantiates a new UpdateRequest 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 *UpdateRequest) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *UpdateRequest) 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 *UpdateRequest) SetName(v string)` + +SetName sets Name field to given value. + +### HasName + +`func (o *UpdateRequest) HasName() bool` + +HasName returns a boolean if a field has been set. + +### GetAutoDelete + +`func (o *UpdateRequest) GetAutoDelete() AutoDelete` + +GetAutoDelete returns the AutoDelete field if non-nil, zero value otherwise. + +### GetAutoDeleteOk + +`func (o *UpdateRequest) GetAutoDeleteOk() (*AutoDelete, bool)` + +GetAutoDeleteOk returns a tuple with the AutoDelete field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAutoDelete + +`func (o *UpdateRequest) SetAutoDelete(v AutoDelete)` + +SetAutoDelete sets AutoDelete field to given value. + +### HasAutoDelete + +`func (o *UpdateRequest) HasAutoDelete() bool` + +HasAutoDelete returns a boolean if a field has been set. + +### GetAlert + +`func (o *UpdateRequest) GetAlert() Alert` + +GetAlert returns the Alert field if non-nil, zero value otherwise. + +### GetAlertOk + +`func (o *UpdateRequest) GetAlertOk() (*Alert, bool)` + +GetAlertOk returns a tuple with the Alert field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAlert + +`func (o *UpdateRequest) SetAlert(v Alert)` + +SetAlert sets Alert field to given value. + +### HasAlert + +`func (o *UpdateRequest) HasAlert() bool` + +HasAlert returns a boolean if a field has been set. + +### GetTags + +`func (o *UpdateRequest) GetTags() []string` + +GetTags returns the Tags field if non-nil, zero value otherwise. + +### GetTagsOk + +`func (o *UpdateRequest) GetTagsOk() (*[]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 *UpdateRequest) SetTags(v []string)` + +SetTags sets Tags field to given value. + +### HasTags + +`func (o *UpdateRequest) 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/shadeform/gen/shadeform/docs/Volume.md b/internal/shadeform/gen/shadeform/docs/Volume.md new file mode 100644 index 00000000..3be73dda --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/Volume.md @@ -0,0 +1,240 @@ +# Volume + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **string** | The ID of the storage volume. | +**Cloud** | [**Cloud**](Cloud.md) | | +**CloudAssignedId** | **string** | The unique identifier of the storage volume issued by the underlying cloud provider. | +**Region** | **string** | Specifies the region. | +**Name** | **string** | The name of the storage volume. | +**FixedSize** | **bool** | Denotes whether the volume is fixed in size or elastically scaling. | +**SizeInGb** | **int32** | Storage volume size in GB | +**CostEstimate** | **string** | The cost incurred by the instance. This only the cost via Shadeform. If the instance is deployed in your own cloud account, then all billing is through your cloud provider. | +**SupportsMultiMount** | **bool** | Denotes whether the volume supports multiple instances mounting to it at the same time. | +**MountedBy** | **string** | The ID of the instance that is currently mounting the volume. | + +## Methods + +### NewVolume + +`func NewVolume(id string, cloud Cloud, cloudAssignedId string, region string, name string, fixedSize bool, sizeInGb int32, costEstimate string, supportsMultiMount bool, mountedBy string, ) *Volume` + +NewVolume instantiates a new Volume 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 + +### NewVolumeWithDefaults + +`func NewVolumeWithDefaults() *Volume` + +NewVolumeWithDefaults instantiates a new Volume 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 *Volume) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *Volume) 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 *Volume) SetId(v string)` + +SetId sets Id field to given value. + + +### GetCloud + +`func (o *Volume) GetCloud() Cloud` + +GetCloud returns the Cloud field if non-nil, zero value otherwise. + +### GetCloudOk + +`func (o *Volume) GetCloudOk() (*Cloud, bool)` + +GetCloudOk returns a tuple with the Cloud field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCloud + +`func (o *Volume) SetCloud(v Cloud)` + +SetCloud sets Cloud field to given value. + + +### GetCloudAssignedId + +`func (o *Volume) GetCloudAssignedId() string` + +GetCloudAssignedId returns the CloudAssignedId field if non-nil, zero value otherwise. + +### GetCloudAssignedIdOk + +`func (o *Volume) GetCloudAssignedIdOk() (*string, bool)` + +GetCloudAssignedIdOk returns a tuple with the CloudAssignedId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCloudAssignedId + +`func (o *Volume) SetCloudAssignedId(v string)` + +SetCloudAssignedId sets CloudAssignedId field to given value. + + +### GetRegion + +`func (o *Volume) GetRegion() string` + +GetRegion returns the Region field if non-nil, zero value otherwise. + +### GetRegionOk + +`func (o *Volume) GetRegionOk() (*string, bool)` + +GetRegionOk returns a tuple with the Region field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRegion + +`func (o *Volume) SetRegion(v string)` + +SetRegion sets Region field to given value. + + +### GetName + +`func (o *Volume) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *Volume) 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 *Volume) SetName(v string)` + +SetName sets Name field to given value. + + +### GetFixedSize + +`func (o *Volume) GetFixedSize() bool` + +GetFixedSize returns the FixedSize field if non-nil, zero value otherwise. + +### GetFixedSizeOk + +`func (o *Volume) GetFixedSizeOk() (*bool, bool)` + +GetFixedSizeOk returns a tuple with the FixedSize field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFixedSize + +`func (o *Volume) SetFixedSize(v bool)` + +SetFixedSize sets FixedSize field to given value. + + +### GetSizeInGb + +`func (o *Volume) GetSizeInGb() int32` + +GetSizeInGb returns the SizeInGb field if non-nil, zero value otherwise. + +### GetSizeInGbOk + +`func (o *Volume) GetSizeInGbOk() (*int32, bool)` + +GetSizeInGbOk returns a tuple with the SizeInGb field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSizeInGb + +`func (o *Volume) SetSizeInGb(v int32)` + +SetSizeInGb sets SizeInGb field to given value. + + +### GetCostEstimate + +`func (o *Volume) GetCostEstimate() string` + +GetCostEstimate returns the CostEstimate field if non-nil, zero value otherwise. + +### GetCostEstimateOk + +`func (o *Volume) GetCostEstimateOk() (*string, bool)` + +GetCostEstimateOk returns a tuple with the CostEstimate field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCostEstimate + +`func (o *Volume) SetCostEstimate(v string)` + +SetCostEstimate sets CostEstimate field to given value. + + +### GetSupportsMultiMount + +`func (o *Volume) GetSupportsMultiMount() bool` + +GetSupportsMultiMount returns the SupportsMultiMount field if non-nil, zero value otherwise. + +### GetSupportsMultiMountOk + +`func (o *Volume) GetSupportsMultiMountOk() (*bool, bool)` + +GetSupportsMultiMountOk returns a tuple with the SupportsMultiMount field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSupportsMultiMount + +`func (o *Volume) SetSupportsMultiMount(v bool)` + +SetSupportsMultiMount sets SupportsMultiMount field to given value. + + +### GetMountedBy + +`func (o *Volume) GetMountedBy() string` + +GetMountedBy returns the MountedBy field if non-nil, zero value otherwise. + +### GetMountedByOk + +`func (o *Volume) GetMountedByOk() (*string, bool)` + +GetMountedByOk returns a tuple with the MountedBy field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMountedBy + +`func (o *Volume) SetMountedBy(v string)` + +SetMountedBy sets MountedBy 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/shadeform/gen/shadeform/docs/VolumeMount.md b/internal/shadeform/gen/shadeform/docs/VolumeMount.md new file mode 100644 index 00000000..bfc54bd9 --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/VolumeMount.md @@ -0,0 +1,56 @@ +# VolumeMount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Auto** | Pointer to **bool** | Set to true to automatically mount unmounted disks to a default filesystem. | [optional] + +## Methods + +### NewVolumeMount + +`func NewVolumeMount() *VolumeMount` + +NewVolumeMount instantiates a new VolumeMount 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 + +### NewVolumeMountWithDefaults + +`func NewVolumeMountWithDefaults() *VolumeMount` + +NewVolumeMountWithDefaults instantiates a new VolumeMount 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 + +### GetAuto + +`func (o *VolumeMount) GetAuto() bool` + +GetAuto returns the Auto field if non-nil, zero value otherwise. + +### GetAutoOk + +`func (o *VolumeMount) GetAutoOk() (*bool, bool)` + +GetAutoOk returns a tuple with the Auto field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAuto + +`func (o *VolumeMount) SetAuto(v bool)` + +SetAuto sets Auto field to given value. + +### HasAuto + +`func (o *VolumeMount) HasAuto() bool` + +HasAuto 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/shadeform/gen/shadeform/docs/VolumeMounts.md b/internal/shadeform/gen/shadeform/docs/VolumeMounts.md new file mode 100644 index 00000000..b47500f9 --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/VolumeMounts.md @@ -0,0 +1,72 @@ +# VolumeMounts + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**HostPath** | **string** | Filepath of the host. | +**ContainerPath** | **string** | Filepath of the container. | + +## Methods + +### NewVolumeMounts + +`func NewVolumeMounts(hostPath string, containerPath string, ) *VolumeMounts` + +NewVolumeMounts instantiates a new VolumeMounts 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 + +### NewVolumeMountsWithDefaults + +`func NewVolumeMountsWithDefaults() *VolumeMounts` + +NewVolumeMountsWithDefaults instantiates a new VolumeMounts 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 + +### GetHostPath + +`func (o *VolumeMounts) GetHostPath() string` + +GetHostPath returns the HostPath field if non-nil, zero value otherwise. + +### GetHostPathOk + +`func (o *VolumeMounts) GetHostPathOk() (*string, bool)` + +GetHostPathOk returns a tuple with the HostPath field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetHostPath + +`func (o *VolumeMounts) SetHostPath(v string)` + +SetHostPath sets HostPath field to given value. + + +### GetContainerPath + +`func (o *VolumeMounts) GetContainerPath() string` + +GetContainerPath returns the ContainerPath field if non-nil, zero value otherwise. + +### GetContainerPathOk + +`func (o *VolumeMounts) GetContainerPathOk() (*string, bool)` + +GetContainerPathOk returns a tuple with the ContainerPath field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetContainerPath + +`func (o *VolumeMounts) SetContainerPath(v string)` + +SetContainerPath sets ContainerPath 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/shadeform/gen/shadeform/docs/VolumeTypesInner.md b/internal/shadeform/gen/shadeform/docs/VolumeTypesInner.md new file mode 100644 index 00000000..c96d8aed --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/VolumeTypesInner.md @@ -0,0 +1,135 @@ +# VolumeTypesInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Cloud** | [**Cloud**](Cloud.md) | | +**Region** | **string** | Specifies the region. | +**SupportsMultiMount** | **bool** | Denotes whether the volume supports multiple instances mounting to it at the same time. | +**FixedSize** | **bool** | Denotes whether the volume is fixed in size or elastically scaling. | +**PricePerGbPerHour** | **string** | Price of the specified volume type per GB per hour | + +## Methods + +### NewVolumeTypesInner + +`func NewVolumeTypesInner(cloud Cloud, region string, supportsMultiMount bool, fixedSize bool, pricePerGbPerHour string, ) *VolumeTypesInner` + +NewVolumeTypesInner instantiates a new VolumeTypesInner 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 + +### NewVolumeTypesInnerWithDefaults + +`func NewVolumeTypesInnerWithDefaults() *VolumeTypesInner` + +NewVolumeTypesInnerWithDefaults instantiates a new VolumeTypesInner 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 + +### GetCloud + +`func (o *VolumeTypesInner) GetCloud() Cloud` + +GetCloud returns the Cloud field if non-nil, zero value otherwise. + +### GetCloudOk + +`func (o *VolumeTypesInner) GetCloudOk() (*Cloud, bool)` + +GetCloudOk returns a tuple with the Cloud field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCloud + +`func (o *VolumeTypesInner) SetCloud(v Cloud)` + +SetCloud sets Cloud field to given value. + + +### GetRegion + +`func (o *VolumeTypesInner) GetRegion() string` + +GetRegion returns the Region field if non-nil, zero value otherwise. + +### GetRegionOk + +`func (o *VolumeTypesInner) GetRegionOk() (*string, bool)` + +GetRegionOk returns a tuple with the Region field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRegion + +`func (o *VolumeTypesInner) SetRegion(v string)` + +SetRegion sets Region field to given value. + + +### GetSupportsMultiMount + +`func (o *VolumeTypesInner) GetSupportsMultiMount() bool` + +GetSupportsMultiMount returns the SupportsMultiMount field if non-nil, zero value otherwise. + +### GetSupportsMultiMountOk + +`func (o *VolumeTypesInner) GetSupportsMultiMountOk() (*bool, bool)` + +GetSupportsMultiMountOk returns a tuple with the SupportsMultiMount field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSupportsMultiMount + +`func (o *VolumeTypesInner) SetSupportsMultiMount(v bool)` + +SetSupportsMultiMount sets SupportsMultiMount field to given value. + + +### GetFixedSize + +`func (o *VolumeTypesInner) GetFixedSize() bool` + +GetFixedSize returns the FixedSize field if non-nil, zero value otherwise. + +### GetFixedSizeOk + +`func (o *VolumeTypesInner) GetFixedSizeOk() (*bool, bool)` + +GetFixedSizeOk returns a tuple with the FixedSize field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFixedSize + +`func (o *VolumeTypesInner) SetFixedSize(v bool)` + +SetFixedSize sets FixedSize field to given value. + + +### GetPricePerGbPerHour + +`func (o *VolumeTypesInner) GetPricePerGbPerHour() string` + +GetPricePerGbPerHour returns the PricePerGbPerHour field if non-nil, zero value otherwise. + +### GetPricePerGbPerHourOk + +`func (o *VolumeTypesInner) GetPricePerGbPerHourOk() (*string, bool)` + +GetPricePerGbPerHourOk returns a tuple with the PricePerGbPerHour field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPricePerGbPerHour + +`func (o *VolumeTypesInner) SetPricePerGbPerHour(v string)` + +SetPricePerGbPerHour sets PricePerGbPerHour 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/shadeform/gen/shadeform/docs/VolumesResponse.md b/internal/shadeform/gen/shadeform/docs/VolumesResponse.md new file mode 100644 index 00000000..24fffdce --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/VolumesResponse.md @@ -0,0 +1,51 @@ +# VolumesResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Volumes** | [**[]Volume**](Volume.md) | | + +## Methods + +### NewVolumesResponse + +`func NewVolumesResponse(volumes []Volume, ) *VolumesResponse` + +NewVolumesResponse instantiates a new VolumesResponse 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 + +### NewVolumesResponseWithDefaults + +`func NewVolumesResponseWithDefaults() *VolumesResponse` + +NewVolumesResponseWithDefaults instantiates a new VolumesResponse 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 + +### GetVolumes + +`func (o *VolumesResponse) GetVolumes() []Volume` + +GetVolumes returns the Volumes field if non-nil, zero value otherwise. + +### GetVolumesOk + +`func (o *VolumesResponse) GetVolumesOk() (*[]Volume, bool)` + +GetVolumesOk returns a tuple with the Volumes field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetVolumes + +`func (o *VolumesResponse) SetVolumes(v []Volume)` + +SetVolumes sets Volumes 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/shadeform/gen/shadeform/docs/VolumesTypesResponse.md b/internal/shadeform/gen/shadeform/docs/VolumesTypesResponse.md new file mode 100644 index 00000000..7e94f223 --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/VolumesTypesResponse.md @@ -0,0 +1,51 @@ +# VolumesTypesResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**VolumeTypes** | [**[]VolumeTypesInner**](VolumeTypesInner.md) | | + +## Methods + +### NewVolumesTypesResponse + +`func NewVolumesTypesResponse(volumeTypes []VolumeTypesInner, ) *VolumesTypesResponse` + +NewVolumesTypesResponse instantiates a new VolumesTypesResponse 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 + +### NewVolumesTypesResponseWithDefaults + +`func NewVolumesTypesResponseWithDefaults() *VolumesTypesResponse` + +NewVolumesTypesResponseWithDefaults instantiates a new VolumesTypesResponse 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 + +### GetVolumeTypes + +`func (o *VolumesTypesResponse) GetVolumeTypes() []VolumeTypesInner` + +GetVolumeTypes returns the VolumeTypes field if non-nil, zero value otherwise. + +### GetVolumeTypesOk + +`func (o *VolumesTypesResponse) GetVolumeTypesOk() (*[]VolumeTypesInner, bool)` + +GetVolumeTypesOk returns a tuple with the VolumeTypes field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetVolumeTypes + +`func (o *VolumesTypesResponse) SetVolumeTypes(v []VolumeTypesInner)` + +SetVolumeTypes sets VolumeTypes 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/shadeform/gen/shadeform/git_push.sh b/internal/shadeform/gen/shadeform/git_push.sh new file mode 100644 index 00000000..ca85d089 --- /dev/null +++ b/internal/shadeform/gen/shadeform/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="shadeform" + 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-shadeform" + 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/shadeform/gen/shadeform/model_add_ssh_key_request.go b/internal/shadeform/gen/shadeform/model_add_ssh_key_request.go new file mode 100644 index 00000000..59e1caed --- /dev/null +++ b/internal/shadeform/gen/shadeform/model_add_ssh_key_request.go @@ -0,0 +1,198 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the AddSshKeyRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AddSshKeyRequest{} + +// AddSshKeyRequest struct for AddSshKeyRequest +type AddSshKeyRequest struct { + // The name of the SSH Key. + Name string `json:"name"` + // The public key. + PublicKey string `json:"public_key"` + AdditionalProperties map[string]interface{} +} + +type _AddSshKeyRequest AddSshKeyRequest + +// NewAddSshKeyRequest instantiates a new AddSshKeyRequest 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 NewAddSshKeyRequest(name string, publicKey string) *AddSshKeyRequest { + this := AddSshKeyRequest{} + this.Name = name + this.PublicKey = publicKey + return &this +} + +// NewAddSshKeyRequestWithDefaults instantiates a new AddSshKeyRequest 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 NewAddSshKeyRequestWithDefaults() *AddSshKeyRequest { + this := AddSshKeyRequest{} + return &this +} + +// GetName returns the Name field value +func (o *AddSshKeyRequest) 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 *AddSshKeyRequest) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *AddSshKeyRequest) SetName(v string) { + o.Name = v +} + +// GetPublicKey returns the PublicKey field value +func (o *AddSshKeyRequest) GetPublicKey() string { + if o == nil { + var ret string + return ret + } + + return o.PublicKey +} + +// GetPublicKeyOk returns a tuple with the PublicKey field value +// and a boolean to check if the value has been set. +func (o *AddSshKeyRequest) GetPublicKeyOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.PublicKey, true +} + +// SetPublicKey sets field value +func (o *AddSshKeyRequest) SetPublicKey(v string) { + o.PublicKey = v +} + +func (o AddSshKeyRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AddSshKeyRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + toSerialize["public_key"] = o.PublicKey + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *AddSshKeyRequest) 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", + "public_key", + } + + 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) + } + } + + varAddSshKeyRequest := _AddSshKeyRequest{} + + err = json.Unmarshal(data, &varAddSshKeyRequest) + + if err != nil { + return err + } + + *o = AddSshKeyRequest(varAddSshKeyRequest) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "public_key") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableAddSshKeyRequest struct { + value *AddSshKeyRequest + isSet bool +} + +func (v NullableAddSshKeyRequest) Get() *AddSshKeyRequest { + return v.value +} + +func (v *NullableAddSshKeyRequest) Set(val *AddSshKeyRequest) { + v.value = val + v.isSet = true +} + +func (v NullableAddSshKeyRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableAddSshKeyRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAddSshKeyRequest(val *AddSshKeyRequest) *NullableAddSshKeyRequest { + return &NullableAddSshKeyRequest{value: val, isSet: true} +} + +func (v NullableAddSshKeyRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAddSshKeyRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/shadeform/gen/shadeform/model_add_ssh_key_response.go b/internal/shadeform/gen/shadeform/model_add_ssh_key_response.go new file mode 100644 index 00000000..78cf8a03 --- /dev/null +++ b/internal/shadeform/gen/shadeform/model_add_ssh_key_response.go @@ -0,0 +1,168 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the AddSshKeyResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AddSshKeyResponse{} + +// AddSshKeyResponse struct for AddSshKeyResponse +type AddSshKeyResponse struct { + // The ID of the SSH Key. + Id string `json:"id"` + AdditionalProperties map[string]interface{} +} + +type _AddSshKeyResponse AddSshKeyResponse + +// NewAddSshKeyResponse instantiates a new AddSshKeyResponse 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 NewAddSshKeyResponse(id string) *AddSshKeyResponse { + this := AddSshKeyResponse{} + this.Id = id + return &this +} + +// NewAddSshKeyResponseWithDefaults instantiates a new AddSshKeyResponse 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 NewAddSshKeyResponseWithDefaults() *AddSshKeyResponse { + this := AddSshKeyResponse{} + return &this +} + +// GetId returns the Id field value +func (o *AddSshKeyResponse) 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 *AddSshKeyResponse) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *AddSshKeyResponse) SetId(v string) { + o.Id = v +} + +func (o AddSshKeyResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AddSshKeyResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *AddSshKeyResponse) 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", + } + + 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) + } + } + + varAddSshKeyResponse := _AddSshKeyResponse{} + + err = json.Unmarshal(data, &varAddSshKeyResponse) + + if err != nil { + return err + } + + *o = AddSshKeyResponse(varAddSshKeyResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableAddSshKeyResponse struct { + value *AddSshKeyResponse + isSet bool +} + +func (v NullableAddSshKeyResponse) Get() *AddSshKeyResponse { + return v.value +} + +func (v *NullableAddSshKeyResponse) Set(val *AddSshKeyResponse) { + v.value = val + v.isSet = true +} + +func (v NullableAddSshKeyResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableAddSshKeyResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAddSshKeyResponse(val *AddSshKeyResponse) *NullableAddSshKeyResponse { + return &NullableAddSshKeyResponse{value: val, isSet: true} +} + +func (v NullableAddSshKeyResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAddSshKeyResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/shadeform/gen/shadeform/model_alert.go b/internal/shadeform/gen/shadeform/model_alert.go new file mode 100644 index 00000000..0c42e94d --- /dev/null +++ b/internal/shadeform/gen/shadeform/model_alert.go @@ -0,0 +1,193 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the Alert type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Alert{} + +// Alert Set a date or spend threshold to receive an email alert +type Alert struct { + // RFC3339 date string + DateThreshold *string `json:"date_threshold,omitempty"` + // Valid decimal representation of a dollar amount + SpendThreshold *string `json:"spend_threshold,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Alert Alert + +// NewAlert instantiates a new Alert 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 NewAlert() *Alert { + this := Alert{} + return &this +} + +// NewAlertWithDefaults instantiates a new Alert 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 NewAlertWithDefaults() *Alert { + this := Alert{} + return &this +} + +// GetDateThreshold returns the DateThreshold field value if set, zero value otherwise. +func (o *Alert) GetDateThreshold() string { + if o == nil || IsNil(o.DateThreshold) { + var ret string + return ret + } + return *o.DateThreshold +} + +// GetDateThresholdOk returns a tuple with the DateThreshold field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Alert) GetDateThresholdOk() (*string, bool) { + if o == nil || IsNil(o.DateThreshold) { + return nil, false + } + return o.DateThreshold, true +} + +// HasDateThreshold returns a boolean if a field has been set. +func (o *Alert) HasDateThreshold() bool { + if o != nil && !IsNil(o.DateThreshold) { + return true + } + + return false +} + +// SetDateThreshold gets a reference to the given string and assigns it to the DateThreshold field. +func (o *Alert) SetDateThreshold(v string) { + o.DateThreshold = &v +} + +// GetSpendThreshold returns the SpendThreshold field value if set, zero value otherwise. +func (o *Alert) GetSpendThreshold() string { + if o == nil || IsNil(o.SpendThreshold) { + var ret string + return ret + } + return *o.SpendThreshold +} + +// GetSpendThresholdOk returns a tuple with the SpendThreshold field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Alert) GetSpendThresholdOk() (*string, bool) { + if o == nil || IsNil(o.SpendThreshold) { + return nil, false + } + return o.SpendThreshold, true +} + +// HasSpendThreshold returns a boolean if a field has been set. +func (o *Alert) HasSpendThreshold() bool { + if o != nil && !IsNil(o.SpendThreshold) { + return true + } + + return false +} + +// SetSpendThreshold gets a reference to the given string and assigns it to the SpendThreshold field. +func (o *Alert) SetSpendThreshold(v string) { + o.SpendThreshold = &v +} + +func (o Alert) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Alert) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.DateThreshold) { + toSerialize["date_threshold"] = o.DateThreshold + } + if !IsNil(o.SpendThreshold) { + toSerialize["spend_threshold"] = o.SpendThreshold + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Alert) UnmarshalJSON(data []byte) (err error) { + varAlert := _Alert{} + + err = json.Unmarshal(data, &varAlert) + + if err != nil { + return err + } + + *o = Alert(varAlert) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "date_threshold") + delete(additionalProperties, "spend_threshold") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableAlert struct { + value *Alert + isSet bool +} + +func (v NullableAlert) Get() *Alert { + return v.value +} + +func (v *NullableAlert) Set(val *Alert) { + v.value = val + v.isSet = true +} + +func (v NullableAlert) IsSet() bool { + return v.isSet +} + +func (v *NullableAlert) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAlert(val *Alert) *NullableAlert { + return &NullableAlert{value: val, isSet: true} +} + +func (v NullableAlert) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAlert) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/shadeform/gen/shadeform/model_auto_delete.go b/internal/shadeform/gen/shadeform/model_auto_delete.go new file mode 100644 index 00000000..5ac3f074 --- /dev/null +++ b/internal/shadeform/gen/shadeform/model_auto_delete.go @@ -0,0 +1,193 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the AutoDelete type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AutoDelete{} + +// AutoDelete Set a date or spend threshold to automatically delete the instance +type AutoDelete struct { + // RFC3339 date string + DateThreshold *string `json:"date_threshold,omitempty"` + // Valid decimal representation of a dollar amount + SpendThreshold *string `json:"spend_threshold,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _AutoDelete AutoDelete + +// NewAutoDelete instantiates a new AutoDelete 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 NewAutoDelete() *AutoDelete { + this := AutoDelete{} + return &this +} + +// NewAutoDeleteWithDefaults instantiates a new AutoDelete 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 NewAutoDeleteWithDefaults() *AutoDelete { + this := AutoDelete{} + return &this +} + +// GetDateThreshold returns the DateThreshold field value if set, zero value otherwise. +func (o *AutoDelete) GetDateThreshold() string { + if o == nil || IsNil(o.DateThreshold) { + var ret string + return ret + } + return *o.DateThreshold +} + +// GetDateThresholdOk returns a tuple with the DateThreshold field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AutoDelete) GetDateThresholdOk() (*string, bool) { + if o == nil || IsNil(o.DateThreshold) { + return nil, false + } + return o.DateThreshold, true +} + +// HasDateThreshold returns a boolean if a field has been set. +func (o *AutoDelete) HasDateThreshold() bool { + if o != nil && !IsNil(o.DateThreshold) { + return true + } + + return false +} + +// SetDateThreshold gets a reference to the given string and assigns it to the DateThreshold field. +func (o *AutoDelete) SetDateThreshold(v string) { + o.DateThreshold = &v +} + +// GetSpendThreshold returns the SpendThreshold field value if set, zero value otherwise. +func (o *AutoDelete) GetSpendThreshold() string { + if o == nil || IsNil(o.SpendThreshold) { + var ret string + return ret + } + return *o.SpendThreshold +} + +// GetSpendThresholdOk returns a tuple with the SpendThreshold field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AutoDelete) GetSpendThresholdOk() (*string, bool) { + if o == nil || IsNil(o.SpendThreshold) { + return nil, false + } + return o.SpendThreshold, true +} + +// HasSpendThreshold returns a boolean if a field has been set. +func (o *AutoDelete) HasSpendThreshold() bool { + if o != nil && !IsNil(o.SpendThreshold) { + return true + } + + return false +} + +// SetSpendThreshold gets a reference to the given string and assigns it to the SpendThreshold field. +func (o *AutoDelete) SetSpendThreshold(v string) { + o.SpendThreshold = &v +} + +func (o AutoDelete) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AutoDelete) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.DateThreshold) { + toSerialize["date_threshold"] = o.DateThreshold + } + if !IsNil(o.SpendThreshold) { + toSerialize["spend_threshold"] = o.SpendThreshold + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *AutoDelete) UnmarshalJSON(data []byte) (err error) { + varAutoDelete := _AutoDelete{} + + err = json.Unmarshal(data, &varAutoDelete) + + if err != nil { + return err + } + + *o = AutoDelete(varAutoDelete) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "date_threshold") + delete(additionalProperties, "spend_threshold") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableAutoDelete struct { + value *AutoDelete + isSet bool +} + +func (v NullableAutoDelete) Get() *AutoDelete { + return v.value +} + +func (v *NullableAutoDelete) Set(val *AutoDelete) { + v.value = val + v.isSet = true +} + +func (v NullableAutoDelete) IsSet() bool { + return v.isSet +} + +func (v *NullableAutoDelete) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAutoDelete(val *AutoDelete) *NullableAutoDelete { + return &NullableAutoDelete{value: val, isSet: true} +} + +func (v NullableAutoDelete) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAutoDelete) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/shadeform/gen/shadeform/model_availability.go b/internal/shadeform/gen/shadeform/model_availability.go new file mode 100644 index 00000000..c5b01e97 --- /dev/null +++ b/internal/shadeform/gen/shadeform/model_availability.go @@ -0,0 +1,228 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the Availability type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Availability{} + +// Availability struct for Availability +type Availability struct { + // Specifies the region. + Region string `json:"region"` + // Indicate whether the instance is available in the region. + Available bool `json:"available"` + // The display name of the region + DisplayName string `json:"display_name"` + AdditionalProperties map[string]interface{} +} + +type _Availability Availability + +// NewAvailability instantiates a new Availability 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 NewAvailability(region string, available bool, displayName string) *Availability { + this := Availability{} + this.Region = region + this.Available = available + this.DisplayName = displayName + return &this +} + +// NewAvailabilityWithDefaults instantiates a new Availability 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 NewAvailabilityWithDefaults() *Availability { + this := Availability{} + return &this +} + +// GetRegion returns the Region field value +func (o *Availability) GetRegion() string { + if o == nil { + var ret string + return ret + } + + return o.Region +} + +// GetRegionOk returns a tuple with the Region field value +// and a boolean to check if the value has been set. +func (o *Availability) GetRegionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Region, true +} + +// SetRegion sets field value +func (o *Availability) SetRegion(v string) { + o.Region = v +} + +// GetAvailable returns the Available field value +func (o *Availability) GetAvailable() bool { + if o == nil { + var ret bool + return ret + } + + return o.Available +} + +// GetAvailableOk returns a tuple with the Available field value +// and a boolean to check if the value has been set. +func (o *Availability) GetAvailableOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.Available, true +} + +// SetAvailable sets field value +func (o *Availability) SetAvailable(v bool) { + o.Available = v +} + +// GetDisplayName returns the DisplayName field value +func (o *Availability) GetDisplayName() string { + if o == nil { + var ret string + return ret + } + + return o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *Availability) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *Availability) SetDisplayName(v string) { + o.DisplayName = v +} + +func (o Availability) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Availability) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["region"] = o.Region + toSerialize["available"] = o.Available + toSerialize["display_name"] = o.DisplayName + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Availability) 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{ + "region", + "available", + "display_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) + } + } + + varAvailability := _Availability{} + + err = json.Unmarshal(data, &varAvailability) + + if err != nil { + return err + } + + *o = Availability(varAvailability) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "region") + delete(additionalProperties, "available") + delete(additionalProperties, "display_name") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableAvailability struct { + value *Availability + isSet bool +} + +func (v NullableAvailability) Get() *Availability { + return v.value +} + +func (v *NullableAvailability) Set(val *Availability) { + v.value = val + v.isSet = true +} + +func (v NullableAvailability) IsSet() bool { + return v.isSet +} + +func (v *NullableAvailability) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAvailability(val *Availability) *NullableAvailability { + return &NullableAvailability{value: val, isSet: true} +} + +func (v NullableAvailability) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAvailability) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/shadeform/gen/shadeform/model_cloud.go b/internal/shadeform/gen/shadeform/model_cloud.go new file mode 100644 index 00000000..04da8a25 --- /dev/null +++ b/internal/shadeform/gen/shadeform/model_cloud.go @@ -0,0 +1,159 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// Cloud Specifies the underlying cloud provider. See this [explanation](/getting-started/concepts#cloud-cloud-provider) for more details. +type Cloud string + +// List of Cloud +const ( + LAMBDALABS Cloud = "lambdalabs" + PAPERSPACE Cloud = "paperspace" + VULTR Cloud = "vultr" + DATACRUNCH Cloud = "datacrunch" + LATITUDE Cloud = "latitude" + MASSEDCOMPUTE Cloud = "massedcompute" + IMWT Cloud = "imwt" + HYPERSTACK Cloud = "hyperstack" + NEBIUS Cloud = "nebius" + CRUSOE Cloud = "crusoe" + DENVR Cloud = "denvr" + DIGITALOCEAN Cloud = "digitalocean" + TCM Cloud = "tcm" + HOTAISLE Cloud = "hotaisle" + CUDO Cloud = "cudo" + SCALEWAY Cloud = "scaleway" + EVERGREEN Cloud = "evergreen" + EXCESSSUPPLY Cloud = "excesssupply" + VOLTAGEPARK Cloud = "voltagepark" + BOOSTRUN Cloud = "boostrun" + IONSTREAM Cloud = "ionstream" + WHITEFIBER Cloud = "whitefiber" + HORIZON Cloud = "horizon" + FPT Cloud = "fpt" + HYDRA Cloud = "hydra" + AMAYA Cloud = "amaya" +) + +// All allowed values of Cloud enum +var AllowedCloudEnumValues = []Cloud{ + "lambdalabs", + "paperspace", + "vultr", + "datacrunch", + "latitude", + "massedcompute", + "imwt", + "hyperstack", + "nebius", + "crusoe", + "denvr", + "digitalocean", + "tcm", + "hotaisle", + "cudo", + "scaleway", + "evergreen", + "excesssupply", + "voltagepark", + "boostrun", + "ionstream", + "whitefiber", + "horizon", + "fpt", + "hydra", + "amaya", +} + +func (v *Cloud) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := Cloud(value) + for _, existing := range AllowedCloudEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Cloud", value) +} + +// NewCloudFromValue returns a pointer to a valid Cloud +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewCloudFromValue(v string) (*Cloud, error) { + ev := Cloud(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for Cloud: valid values are %v", v, AllowedCloudEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v Cloud) IsValid() bool { + for _, existing := range AllowedCloudEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to Cloud value +func (v Cloud) Ptr() *Cloud { + return &v +} + +type NullableCloud struct { + value *Cloud + isSet bool +} + +func (v NullableCloud) Get() *Cloud { + return v.value +} + +func (v *NullableCloud) Set(val *Cloud) { + v.value = val + v.isSet = true +} + +func (v NullableCloud) IsSet() bool { + return v.isSet +} + +func (v *NullableCloud) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCloud(val *Cloud) *NullableCloud { + return &NullableCloud{value: val, isSet: true} +} + +func (v NullableCloud) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCloud) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/shadeform/gen/shadeform/model_create_request.go b/internal/shadeform/gen/shadeform/model_create_request.go new file mode 100644 index 00000000..106b0ca3 --- /dev/null +++ b/internal/shadeform/gen/shadeform/model_create_request.go @@ -0,0 +1,663 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the CreateRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateRequest{} + +// CreateRequest struct for CreateRequest +type CreateRequest struct { + Cloud Cloud `json:"cloud"` + // Specifies the region. + Region string `json:"region"` + // The Shadeform standardized instance type. See this [explanation](/getting-started/concepts#shade-instance-type-and-cloud-instance-type) for more details. + ShadeInstanceType string `json:"shade_instance_type"` + // Specifies if the instance is launched in [Shade Cloud](/getting-started/concepts#shade-cloud) or in a linked cloud account. + ShadeCloud bool `json:"shade_cloud"` + // The name of the instance + Name string `json:"name"` + // The operating system of the instance. + Os *string `json:"os,omitempty"` + // The ID of the template to use for this instance + TemplateId *string `json:"template_id,omitempty"` + LaunchConfiguration *LaunchConfiguration `json:"launch_configuration,omitempty"` + // List of volume IDs to be mounted. Currently only supports 1 volume at a time. + VolumeIds []string `json:"volume_ids,omitempty"` + // The ID of the SSH Key. + SshKeyId *string `json:"ssh_key_id,omitempty"` + AutoDelete *AutoDelete `json:"auto_delete,omitempty"` + Alert *Alert `json:"alert,omitempty"` + VolumeMount *VolumeMount `json:"volume_mount,omitempty"` + // Add custom, searchable tags to instances. + Tags []string `json:"tags,omitempty"` + // List of environment variable name and values to automatically add to the instance + Envs []Env `json:"envs,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _CreateRequest CreateRequest + +// NewCreateRequest instantiates a new CreateRequest 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 NewCreateRequest(cloud Cloud, region string, shadeInstanceType string, shadeCloud bool, name string) *CreateRequest { + this := CreateRequest{} + this.Cloud = cloud + this.Region = region + this.ShadeInstanceType = shadeInstanceType + this.ShadeCloud = shadeCloud + this.Name = name + return &this +} + +// NewCreateRequestWithDefaults instantiates a new CreateRequest 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 NewCreateRequestWithDefaults() *CreateRequest { + this := CreateRequest{} + return &this +} + +// GetCloud returns the Cloud field value +func (o *CreateRequest) GetCloud() Cloud { + if o == nil { + var ret Cloud + return ret + } + + return o.Cloud +} + +// GetCloudOk returns a tuple with the Cloud field value +// and a boolean to check if the value has been set. +func (o *CreateRequest) GetCloudOk() (*Cloud, bool) { + if o == nil { + return nil, false + } + return &o.Cloud, true +} + +// SetCloud sets field value +func (o *CreateRequest) SetCloud(v Cloud) { + o.Cloud = v +} + +// GetRegion returns the Region field value +func (o *CreateRequest) GetRegion() string { + if o == nil { + var ret string + return ret + } + + return o.Region +} + +// GetRegionOk returns a tuple with the Region field value +// and a boolean to check if the value has been set. +func (o *CreateRequest) GetRegionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Region, true +} + +// SetRegion sets field value +func (o *CreateRequest) SetRegion(v string) { + o.Region = v +} + +// GetShadeInstanceType returns the ShadeInstanceType field value +func (o *CreateRequest) GetShadeInstanceType() string { + if o == nil { + var ret string + return ret + } + + return o.ShadeInstanceType +} + +// GetShadeInstanceTypeOk returns a tuple with the ShadeInstanceType field value +// and a boolean to check if the value has been set. +func (o *CreateRequest) GetShadeInstanceTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ShadeInstanceType, true +} + +// SetShadeInstanceType sets field value +func (o *CreateRequest) SetShadeInstanceType(v string) { + o.ShadeInstanceType = v +} + +// GetShadeCloud returns the ShadeCloud field value +func (o *CreateRequest) GetShadeCloud() bool { + if o == nil { + var ret bool + return ret + } + + return o.ShadeCloud +} + +// GetShadeCloudOk returns a tuple with the ShadeCloud field value +// and a boolean to check if the value has been set. +func (o *CreateRequest) GetShadeCloudOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.ShadeCloud, true +} + +// SetShadeCloud sets field value +func (o *CreateRequest) SetShadeCloud(v bool) { + o.ShadeCloud = v +} + +// GetName returns the Name field value +func (o *CreateRequest) 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 *CreateRequest) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *CreateRequest) SetName(v string) { + o.Name = v +} + +// GetOs returns the Os field value if set, zero value otherwise. +func (o *CreateRequest) GetOs() string { + if o == nil || IsNil(o.Os) { + var ret string + return ret + } + return *o.Os +} + +// GetOsOk returns a tuple with the Os field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateRequest) GetOsOk() (*string, bool) { + if o == nil || IsNil(o.Os) { + return nil, false + } + return o.Os, true +} + +// HasOs returns a boolean if a field has been set. +func (o *CreateRequest) HasOs() bool { + if o != nil && !IsNil(o.Os) { + return true + } + + return false +} + +// SetOs gets a reference to the given string and assigns it to the Os field. +func (o *CreateRequest) SetOs(v string) { + o.Os = &v +} + +// GetTemplateId returns the TemplateId field value if set, zero value otherwise. +func (o *CreateRequest) GetTemplateId() string { + if o == nil || IsNil(o.TemplateId) { + var ret string + return ret + } + return *o.TemplateId +} + +// GetTemplateIdOk returns a tuple with the TemplateId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateRequest) GetTemplateIdOk() (*string, bool) { + if o == nil || IsNil(o.TemplateId) { + return nil, false + } + return o.TemplateId, true +} + +// HasTemplateId returns a boolean if a field has been set. +func (o *CreateRequest) HasTemplateId() bool { + if o != nil && !IsNil(o.TemplateId) { + return true + } + + return false +} + +// SetTemplateId gets a reference to the given string and assigns it to the TemplateId field. +func (o *CreateRequest) SetTemplateId(v string) { + o.TemplateId = &v +} + +// GetLaunchConfiguration returns the LaunchConfiguration field value if set, zero value otherwise. +func (o *CreateRequest) GetLaunchConfiguration() LaunchConfiguration { + if o == nil || IsNil(o.LaunchConfiguration) { + var ret LaunchConfiguration + return ret + } + return *o.LaunchConfiguration +} + +// GetLaunchConfigurationOk returns a tuple with the LaunchConfiguration field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateRequest) GetLaunchConfigurationOk() (*LaunchConfiguration, bool) { + if o == nil || IsNil(o.LaunchConfiguration) { + return nil, false + } + return o.LaunchConfiguration, true +} + +// HasLaunchConfiguration returns a boolean if a field has been set. +func (o *CreateRequest) HasLaunchConfiguration() bool { + if o != nil && !IsNil(o.LaunchConfiguration) { + return true + } + + return false +} + +// SetLaunchConfiguration gets a reference to the given LaunchConfiguration and assigns it to the LaunchConfiguration field. +func (o *CreateRequest) SetLaunchConfiguration(v LaunchConfiguration) { + o.LaunchConfiguration = &v +} + +// GetVolumeIds returns the VolumeIds field value if set, zero value otherwise. +func (o *CreateRequest) GetVolumeIds() []string { + if o == nil || IsNil(o.VolumeIds) { + var ret []string + return ret + } + return o.VolumeIds +} + +// GetVolumeIdsOk returns a tuple with the VolumeIds field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateRequest) GetVolumeIdsOk() ([]string, bool) { + if o == nil || IsNil(o.VolumeIds) { + return nil, false + } + return o.VolumeIds, true +} + +// HasVolumeIds returns a boolean if a field has been set. +func (o *CreateRequest) HasVolumeIds() bool { + if o != nil && !IsNil(o.VolumeIds) { + return true + } + + return false +} + +// SetVolumeIds gets a reference to the given []string and assigns it to the VolumeIds field. +func (o *CreateRequest) SetVolumeIds(v []string) { + o.VolumeIds = v +} + +// GetSshKeyId returns the SshKeyId field value if set, zero value otherwise. +func (o *CreateRequest) GetSshKeyId() string { + if o == nil || IsNil(o.SshKeyId) { + var ret string + return ret + } + return *o.SshKeyId +} + +// GetSshKeyIdOk returns a tuple with the SshKeyId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateRequest) GetSshKeyIdOk() (*string, bool) { + if o == nil || IsNil(o.SshKeyId) { + return nil, false + } + return o.SshKeyId, true +} + +// HasSshKeyId returns a boolean if a field has been set. +func (o *CreateRequest) HasSshKeyId() bool { + if o != nil && !IsNil(o.SshKeyId) { + return true + } + + return false +} + +// SetSshKeyId gets a reference to the given string and assigns it to the SshKeyId field. +func (o *CreateRequest) SetSshKeyId(v string) { + o.SshKeyId = &v +} + +// GetAutoDelete returns the AutoDelete field value if set, zero value otherwise. +func (o *CreateRequest) GetAutoDelete() AutoDelete { + if o == nil || IsNil(o.AutoDelete) { + var ret AutoDelete + return ret + } + return *o.AutoDelete +} + +// GetAutoDeleteOk returns a tuple with the AutoDelete field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateRequest) GetAutoDeleteOk() (*AutoDelete, bool) { + if o == nil || IsNil(o.AutoDelete) { + return nil, false + } + return o.AutoDelete, true +} + +// HasAutoDelete returns a boolean if a field has been set. +func (o *CreateRequest) HasAutoDelete() bool { + if o != nil && !IsNil(o.AutoDelete) { + return true + } + + return false +} + +// SetAutoDelete gets a reference to the given AutoDelete and assigns it to the AutoDelete field. +func (o *CreateRequest) SetAutoDelete(v AutoDelete) { + o.AutoDelete = &v +} + +// GetAlert returns the Alert field value if set, zero value otherwise. +func (o *CreateRequest) GetAlert() Alert { + if o == nil || IsNil(o.Alert) { + var ret Alert + return ret + } + return *o.Alert +} + +// GetAlertOk returns a tuple with the Alert field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateRequest) GetAlertOk() (*Alert, bool) { + if o == nil || IsNil(o.Alert) { + return nil, false + } + return o.Alert, true +} + +// HasAlert returns a boolean if a field has been set. +func (o *CreateRequest) HasAlert() bool { + if o != nil && !IsNil(o.Alert) { + return true + } + + return false +} + +// SetAlert gets a reference to the given Alert and assigns it to the Alert field. +func (o *CreateRequest) SetAlert(v Alert) { + o.Alert = &v +} + +// GetVolumeMount returns the VolumeMount field value if set, zero value otherwise. +func (o *CreateRequest) GetVolumeMount() VolumeMount { + if o == nil || IsNil(o.VolumeMount) { + var ret VolumeMount + return ret + } + return *o.VolumeMount +} + +// GetVolumeMountOk returns a tuple with the VolumeMount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateRequest) GetVolumeMountOk() (*VolumeMount, bool) { + if o == nil || IsNil(o.VolumeMount) { + return nil, false + } + return o.VolumeMount, true +} + +// HasVolumeMount returns a boolean if a field has been set. +func (o *CreateRequest) HasVolumeMount() bool { + if o != nil && !IsNil(o.VolumeMount) { + return true + } + + return false +} + +// SetVolumeMount gets a reference to the given VolumeMount and assigns it to the VolumeMount field. +func (o *CreateRequest) SetVolumeMount(v VolumeMount) { + o.VolumeMount = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *CreateRequest) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []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 *CreateRequest) GetTagsOk() ([]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 *CreateRequest) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *CreateRequest) SetTags(v []string) { + o.Tags = v +} + +// GetEnvs returns the Envs field value if set, zero value otherwise. +func (o *CreateRequest) GetEnvs() []Env { + if o == nil || IsNil(o.Envs) { + var ret []Env + return ret + } + return o.Envs +} + +// GetEnvsOk returns a tuple with the Envs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateRequest) GetEnvsOk() ([]Env, bool) { + if o == nil || IsNil(o.Envs) { + return nil, false + } + return o.Envs, true +} + +// HasEnvs returns a boolean if a field has been set. +func (o *CreateRequest) HasEnvs() bool { + if o != nil && !IsNil(o.Envs) { + return true + } + + return false +} + +// SetEnvs gets a reference to the given []Env and assigns it to the Envs field. +func (o *CreateRequest) SetEnvs(v []Env) { + o.Envs = v +} + +func (o CreateRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["cloud"] = o.Cloud + toSerialize["region"] = o.Region + toSerialize["shade_instance_type"] = o.ShadeInstanceType + toSerialize["shade_cloud"] = o.ShadeCloud + toSerialize["name"] = o.Name + if !IsNil(o.Os) { + toSerialize["os"] = o.Os + } + if !IsNil(o.TemplateId) { + toSerialize["template_id"] = o.TemplateId + } + if !IsNil(o.LaunchConfiguration) { + toSerialize["launch_configuration"] = o.LaunchConfiguration + } + if !IsNil(o.VolumeIds) { + toSerialize["volume_ids"] = o.VolumeIds + } + if !IsNil(o.SshKeyId) { + toSerialize["ssh_key_id"] = o.SshKeyId + } + if !IsNil(o.AutoDelete) { + toSerialize["auto_delete"] = o.AutoDelete + } + if !IsNil(o.Alert) { + toSerialize["alert"] = o.Alert + } + if !IsNil(o.VolumeMount) { + toSerialize["volume_mount"] = o.VolumeMount + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + if !IsNil(o.Envs) { + toSerialize["envs"] = o.Envs + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CreateRequest) 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{ + "cloud", + "region", + "shade_instance_type", + "shade_cloud", + "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) + } + } + + varCreateRequest := _CreateRequest{} + + err = json.Unmarshal(data, &varCreateRequest) + + if err != nil { + return err + } + + *o = CreateRequest(varCreateRequest) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "cloud") + delete(additionalProperties, "region") + delete(additionalProperties, "shade_instance_type") + delete(additionalProperties, "shade_cloud") + delete(additionalProperties, "name") + delete(additionalProperties, "os") + delete(additionalProperties, "template_id") + delete(additionalProperties, "launch_configuration") + delete(additionalProperties, "volume_ids") + delete(additionalProperties, "ssh_key_id") + delete(additionalProperties, "auto_delete") + delete(additionalProperties, "alert") + delete(additionalProperties, "volume_mount") + delete(additionalProperties, "tags") + delete(additionalProperties, "envs") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCreateRequest struct { + value *CreateRequest + isSet bool +} + +func (v NullableCreateRequest) Get() *CreateRequest { + return v.value +} + +func (v *NullableCreateRequest) Set(val *CreateRequest) { + v.value = val + v.isSet = true +} + +func (v NullableCreateRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateRequest(val *CreateRequest) *NullableCreateRequest { + return &NullableCreateRequest{value: val, isSet: true} +} + +func (v NullableCreateRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/shadeform/gen/shadeform/model_create_response.go b/internal/shadeform/gen/shadeform/model_create_response.go new file mode 100644 index 00000000..3c275990 --- /dev/null +++ b/internal/shadeform/gen/shadeform/model_create_response.go @@ -0,0 +1,168 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the CreateResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateResponse{} + +// CreateResponse Response of the /instances/create API call +type CreateResponse struct { + // The unique identifier for the instance. Used in the instances for the /instances/{id}/info and /instances/{id}/delete APIs. + Id string `json:"id"` + AdditionalProperties map[string]interface{} +} + +type _CreateResponse CreateResponse + +// NewCreateResponse instantiates a new CreateResponse 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 NewCreateResponse(id string) *CreateResponse { + this := CreateResponse{} + this.Id = id + return &this +} + +// NewCreateResponseWithDefaults instantiates a new CreateResponse 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 NewCreateResponseWithDefaults() *CreateResponse { + this := CreateResponse{} + return &this +} + +// GetId returns the Id field value +func (o *CreateResponse) 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 *CreateResponse) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *CreateResponse) SetId(v string) { + o.Id = v +} + +func (o CreateResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CreateResponse) 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", + } + + 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) + } + } + + varCreateResponse := _CreateResponse{} + + err = json.Unmarshal(data, &varCreateResponse) + + if err != nil { + return err + } + + *o = CreateResponse(varCreateResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCreateResponse struct { + value *CreateResponse + isSet bool +} + +func (v NullableCreateResponse) Get() *CreateResponse { + return v.value +} + +func (v *NullableCreateResponse) Set(val *CreateResponse) { + v.value = val + v.isSet = true +} + +func (v NullableCreateResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateResponse(val *CreateResponse) *NullableCreateResponse { + return &NullableCreateResponse{value: val, isSet: true} +} + +func (v NullableCreateResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/shadeform/gen/shadeform/model_create_volume_request.go b/internal/shadeform/gen/shadeform/model_create_volume_request.go new file mode 100644 index 00000000..674d8b2f --- /dev/null +++ b/internal/shadeform/gen/shadeform/model_create_volume_request.go @@ -0,0 +1,257 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the CreateVolumeRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateVolumeRequest{} + +// CreateVolumeRequest struct for CreateVolumeRequest +type CreateVolumeRequest struct { + Cloud Cloud `json:"cloud"` + // Specifies the region. + Region string `json:"region"` + // Storage volume size in GB + SizeInGb int32 `json:"size_in_gb"` + // The name of the storage volume. + Name string `json:"name"` + AdditionalProperties map[string]interface{} +} + +type _CreateVolumeRequest CreateVolumeRequest + +// NewCreateVolumeRequest instantiates a new CreateVolumeRequest 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 NewCreateVolumeRequest(cloud Cloud, region string, sizeInGb int32, name string) *CreateVolumeRequest { + this := CreateVolumeRequest{} + this.Cloud = cloud + this.Region = region + this.SizeInGb = sizeInGb + this.Name = name + return &this +} + +// NewCreateVolumeRequestWithDefaults instantiates a new CreateVolumeRequest 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 NewCreateVolumeRequestWithDefaults() *CreateVolumeRequest { + this := CreateVolumeRequest{} + return &this +} + +// GetCloud returns the Cloud field value +func (o *CreateVolumeRequest) GetCloud() Cloud { + if o == nil { + var ret Cloud + return ret + } + + return o.Cloud +} + +// GetCloudOk returns a tuple with the Cloud field value +// and a boolean to check if the value has been set. +func (o *CreateVolumeRequest) GetCloudOk() (*Cloud, bool) { + if o == nil { + return nil, false + } + return &o.Cloud, true +} + +// SetCloud sets field value +func (o *CreateVolumeRequest) SetCloud(v Cloud) { + o.Cloud = v +} + +// GetRegion returns the Region field value +func (o *CreateVolumeRequest) GetRegion() string { + if o == nil { + var ret string + return ret + } + + return o.Region +} + +// GetRegionOk returns a tuple with the Region field value +// and a boolean to check if the value has been set. +func (o *CreateVolumeRequest) GetRegionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Region, true +} + +// SetRegion sets field value +func (o *CreateVolumeRequest) SetRegion(v string) { + o.Region = v +} + +// GetSizeInGb returns the SizeInGb field value +func (o *CreateVolumeRequest) GetSizeInGb() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.SizeInGb +} + +// GetSizeInGbOk returns a tuple with the SizeInGb field value +// and a boolean to check if the value has been set. +func (o *CreateVolumeRequest) GetSizeInGbOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.SizeInGb, true +} + +// SetSizeInGb sets field value +func (o *CreateVolumeRequest) SetSizeInGb(v int32) { + o.SizeInGb = v +} + +// GetName returns the Name field value +func (o *CreateVolumeRequest) 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 *CreateVolumeRequest) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *CreateVolumeRequest) SetName(v string) { + o.Name = v +} + +func (o CreateVolumeRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateVolumeRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["cloud"] = o.Cloud + toSerialize["region"] = o.Region + toSerialize["size_in_gb"] = o.SizeInGb + toSerialize["name"] = o.Name + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CreateVolumeRequest) 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{ + "cloud", + "region", + "size_in_gb", + "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) + } + } + + varCreateVolumeRequest := _CreateVolumeRequest{} + + err = json.Unmarshal(data, &varCreateVolumeRequest) + + if err != nil { + return err + } + + *o = CreateVolumeRequest(varCreateVolumeRequest) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "cloud") + delete(additionalProperties, "region") + delete(additionalProperties, "size_in_gb") + delete(additionalProperties, "name") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCreateVolumeRequest struct { + value *CreateVolumeRequest + isSet bool +} + +func (v NullableCreateVolumeRequest) Get() *CreateVolumeRequest { + return v.value +} + +func (v *NullableCreateVolumeRequest) Set(val *CreateVolumeRequest) { + v.value = val + v.isSet = true +} + +func (v NullableCreateVolumeRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateVolumeRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateVolumeRequest(val *CreateVolumeRequest) *NullableCreateVolumeRequest { + return &NullableCreateVolumeRequest{value: val, isSet: true} +} + +func (v NullableCreateVolumeRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateVolumeRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/shadeform/gen/shadeform/model_create_volume_response.go b/internal/shadeform/gen/shadeform/model_create_volume_response.go new file mode 100644 index 00000000..894df3e4 --- /dev/null +++ b/internal/shadeform/gen/shadeform/model_create_volume_response.go @@ -0,0 +1,168 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the CreateVolumeResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateVolumeResponse{} + +// CreateVolumeResponse struct for CreateVolumeResponse +type CreateVolumeResponse struct { + // The ID of the storage volume. + Id string `json:"id"` + AdditionalProperties map[string]interface{} +} + +type _CreateVolumeResponse CreateVolumeResponse + +// NewCreateVolumeResponse instantiates a new CreateVolumeResponse 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 NewCreateVolumeResponse(id string) *CreateVolumeResponse { + this := CreateVolumeResponse{} + this.Id = id + return &this +} + +// NewCreateVolumeResponseWithDefaults instantiates a new CreateVolumeResponse 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 NewCreateVolumeResponseWithDefaults() *CreateVolumeResponse { + this := CreateVolumeResponse{} + return &this +} + +// GetId returns the Id field value +func (o *CreateVolumeResponse) 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 *CreateVolumeResponse) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *CreateVolumeResponse) SetId(v string) { + o.Id = v +} + +func (o CreateVolumeResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateVolumeResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CreateVolumeResponse) 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", + } + + 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) + } + } + + varCreateVolumeResponse := _CreateVolumeResponse{} + + err = json.Unmarshal(data, &varCreateVolumeResponse) + + if err != nil { + return err + } + + *o = CreateVolumeResponse(varCreateVolumeResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCreateVolumeResponse struct { + value *CreateVolumeResponse + isSet bool +} + +func (v NullableCreateVolumeResponse) Get() *CreateVolumeResponse { + return v.value +} + +func (v *NullableCreateVolumeResponse) Set(val *CreateVolumeResponse) { + v.value = val + v.isSet = true +} + +func (v NullableCreateVolumeResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateVolumeResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateVolumeResponse(val *CreateVolumeResponse) *NullableCreateVolumeResponse { + return &NullableCreateVolumeResponse{value: val, isSet: true} +} + +func (v NullableCreateVolumeResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateVolumeResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/shadeform/gen/shadeform/model_docker_configuration.go b/internal/shadeform/gen/shadeform/model_docker_configuration.go new file mode 100644 index 00000000..c3b57535 --- /dev/null +++ b/internal/shadeform/gen/shadeform/model_docker_configuration.go @@ -0,0 +1,395 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the DockerConfiguration type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DockerConfiguration{} + +// DockerConfiguration May only be used if launch_configuration.type is 'docker'. Use docker_configuration to automatically pull and run a docker image. See this [tutorial](/guides/dockercontainers) for examples. +type DockerConfiguration struct { + // Specifies the docker image to be pulled and run on the instance at startup. + Image string `json:"image"` + // Specifies the container arguments passed into the image at runtime. + Args *string `json:"args,omitempty"` + // Describes the amount of shared memory allocated for the container. Equivalent to using the --shm-size flag in the docker cli. If shared_memory_in_gb is not specified, then the container will use the host namespace which is the equivalent of --ipc=host. + SharedMemoryInGb *int32 `json:"shared_memory_in_gb,omitempty"` + // List of environment variable name-value pairs that will be passed to the docker container. + Envs []Env `json:"envs,omitempty"` + // List of port mappings between the host instance and the docker container. Equivalent of -p flag for docker run command. + PortMappings []PortMappings `json:"port_mappings,omitempty"` + // List of volume mounts between the host instance and the docker container. Equivalent of -v flag for docker run command. + VolumeMounts []VolumeMounts `json:"volume_mounts,omitempty"` + RegistryCredentials *RegistryCredentials `json:"registry_credentials,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _DockerConfiguration DockerConfiguration + +// NewDockerConfiguration instantiates a new DockerConfiguration 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 NewDockerConfiguration(image string) *DockerConfiguration { + this := DockerConfiguration{} + this.Image = image + return &this +} + +// NewDockerConfigurationWithDefaults instantiates a new DockerConfiguration 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 NewDockerConfigurationWithDefaults() *DockerConfiguration { + this := DockerConfiguration{} + return &this +} + +// GetImage returns the Image field value +func (o *DockerConfiguration) 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 *DockerConfiguration) GetImageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Image, true +} + +// SetImage sets field value +func (o *DockerConfiguration) SetImage(v string) { + o.Image = v +} + +// GetArgs returns the Args field value if set, zero value otherwise. +func (o *DockerConfiguration) GetArgs() string { + if o == nil || IsNil(o.Args) { + var ret string + return ret + } + return *o.Args +} + +// GetArgsOk returns a tuple with the Args field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DockerConfiguration) GetArgsOk() (*string, bool) { + if o == nil || IsNil(o.Args) { + return nil, false + } + return o.Args, true +} + +// HasArgs returns a boolean if a field has been set. +func (o *DockerConfiguration) HasArgs() bool { + if o != nil && !IsNil(o.Args) { + return true + } + + return false +} + +// SetArgs gets a reference to the given string and assigns it to the Args field. +func (o *DockerConfiguration) SetArgs(v string) { + o.Args = &v +} + +// GetSharedMemoryInGb returns the SharedMemoryInGb field value if set, zero value otherwise. +func (o *DockerConfiguration) GetSharedMemoryInGb() int32 { + if o == nil || IsNil(o.SharedMemoryInGb) { + var ret int32 + return ret + } + return *o.SharedMemoryInGb +} + +// GetSharedMemoryInGbOk returns a tuple with the SharedMemoryInGb field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DockerConfiguration) GetSharedMemoryInGbOk() (*int32, bool) { + if o == nil || IsNil(o.SharedMemoryInGb) { + return nil, false + } + return o.SharedMemoryInGb, true +} + +// HasSharedMemoryInGb returns a boolean if a field has been set. +func (o *DockerConfiguration) HasSharedMemoryInGb() bool { + if o != nil && !IsNil(o.SharedMemoryInGb) { + return true + } + + return false +} + +// SetSharedMemoryInGb gets a reference to the given int32 and assigns it to the SharedMemoryInGb field. +func (o *DockerConfiguration) SetSharedMemoryInGb(v int32) { + o.SharedMemoryInGb = &v +} + +// GetEnvs returns the Envs field value if set, zero value otherwise. +func (o *DockerConfiguration) GetEnvs() []Env { + if o == nil || IsNil(o.Envs) { + var ret []Env + return ret + } + return o.Envs +} + +// GetEnvsOk returns a tuple with the Envs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DockerConfiguration) GetEnvsOk() ([]Env, bool) { + if o == nil || IsNil(o.Envs) { + return nil, false + } + return o.Envs, true +} + +// HasEnvs returns a boolean if a field has been set. +func (o *DockerConfiguration) HasEnvs() bool { + if o != nil && !IsNil(o.Envs) { + return true + } + + return false +} + +// SetEnvs gets a reference to the given []Env and assigns it to the Envs field. +func (o *DockerConfiguration) SetEnvs(v []Env) { + o.Envs = v +} + +// GetPortMappings returns the PortMappings field value if set, zero value otherwise. +func (o *DockerConfiguration) GetPortMappings() []PortMappings { + if o == nil || IsNil(o.PortMappings) { + var ret []PortMappings + return ret + } + return o.PortMappings +} + +// GetPortMappingsOk returns a tuple with the PortMappings field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DockerConfiguration) GetPortMappingsOk() ([]PortMappings, bool) { + if o == nil || IsNil(o.PortMappings) { + return nil, false + } + return o.PortMappings, true +} + +// HasPortMappings returns a boolean if a field has been set. +func (o *DockerConfiguration) HasPortMappings() bool { + if o != nil && !IsNil(o.PortMappings) { + return true + } + + return false +} + +// SetPortMappings gets a reference to the given []PortMappings and assigns it to the PortMappings field. +func (o *DockerConfiguration) SetPortMappings(v []PortMappings) { + o.PortMappings = v +} + +// GetVolumeMounts returns the VolumeMounts field value if set, zero value otherwise. +func (o *DockerConfiguration) GetVolumeMounts() []VolumeMounts { + if o == nil || IsNil(o.VolumeMounts) { + var ret []VolumeMounts + return ret + } + return o.VolumeMounts +} + +// GetVolumeMountsOk returns a tuple with the VolumeMounts field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DockerConfiguration) GetVolumeMountsOk() ([]VolumeMounts, bool) { + if o == nil || IsNil(o.VolumeMounts) { + return nil, false + } + return o.VolumeMounts, true +} + +// HasVolumeMounts returns a boolean if a field has been set. +func (o *DockerConfiguration) HasVolumeMounts() bool { + if o != nil && !IsNil(o.VolumeMounts) { + return true + } + + return false +} + +// SetVolumeMounts gets a reference to the given []VolumeMounts and assigns it to the VolumeMounts field. +func (o *DockerConfiguration) SetVolumeMounts(v []VolumeMounts) { + o.VolumeMounts = v +} + +// GetRegistryCredentials returns the RegistryCredentials field value if set, zero value otherwise. +func (o *DockerConfiguration) GetRegistryCredentials() RegistryCredentials { + if o == nil || IsNil(o.RegistryCredentials) { + var ret RegistryCredentials + return ret + } + return *o.RegistryCredentials +} + +// GetRegistryCredentialsOk returns a tuple with the RegistryCredentials field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DockerConfiguration) GetRegistryCredentialsOk() (*RegistryCredentials, bool) { + if o == nil || IsNil(o.RegistryCredentials) { + return nil, false + } + return o.RegistryCredentials, true +} + +// HasRegistryCredentials returns a boolean if a field has been set. +func (o *DockerConfiguration) HasRegistryCredentials() bool { + if o != nil && !IsNil(o.RegistryCredentials) { + return true + } + + return false +} + +// SetRegistryCredentials gets a reference to the given RegistryCredentials and assigns it to the RegistryCredentials field. +func (o *DockerConfiguration) SetRegistryCredentials(v RegistryCredentials) { + o.RegistryCredentials = &v +} + +func (o DockerConfiguration) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DockerConfiguration) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["image"] = o.Image + if !IsNil(o.Args) { + toSerialize["args"] = o.Args + } + if !IsNil(o.SharedMemoryInGb) { + toSerialize["shared_memory_in_gb"] = o.SharedMemoryInGb + } + if !IsNil(o.Envs) { + toSerialize["envs"] = o.Envs + } + if !IsNil(o.PortMappings) { + toSerialize["port_mappings"] = o.PortMappings + } + if !IsNil(o.VolumeMounts) { + toSerialize["volume_mounts"] = o.VolumeMounts + } + if !IsNil(o.RegistryCredentials) { + toSerialize["registry_credentials"] = o.RegistryCredentials + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *DockerConfiguration) 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{ + "image", + } + + 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) + } + } + + varDockerConfiguration := _DockerConfiguration{} + + err = json.Unmarshal(data, &varDockerConfiguration) + + if err != nil { + return err + } + + *o = DockerConfiguration(varDockerConfiguration) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "image") + delete(additionalProperties, "args") + delete(additionalProperties, "shared_memory_in_gb") + delete(additionalProperties, "envs") + delete(additionalProperties, "port_mappings") + delete(additionalProperties, "volume_mounts") + delete(additionalProperties, "registry_credentials") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDockerConfiguration struct { + value *DockerConfiguration + isSet bool +} + +func (v NullableDockerConfiguration) Get() *DockerConfiguration { + return v.value +} + +func (v *NullableDockerConfiguration) Set(val *DockerConfiguration) { + v.value = val + v.isSet = true +} + +func (v NullableDockerConfiguration) IsSet() bool { + return v.isSet +} + +func (v *NullableDockerConfiguration) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDockerConfiguration(val *DockerConfiguration) *NullableDockerConfiguration { + return &NullableDockerConfiguration{value: val, isSet: true} +} + +func (v NullableDockerConfiguration) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDockerConfiguration) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/shadeform/gen/shadeform/model_env.go b/internal/shadeform/gen/shadeform/model_env.go new file mode 100644 index 00000000..b52c3ece --- /dev/null +++ b/internal/shadeform/gen/shadeform/model_env.go @@ -0,0 +1,198 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the Env type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Env{} + +// Env Environment variables for the container image. +type Env struct { + // Name of the environment variable + Name string `json:"name"` + // Value of the environment variable + Value string `json:"value"` + AdditionalProperties map[string]interface{} +} + +type _Env Env + +// NewEnv instantiates a new Env 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 NewEnv(name string, value string) *Env { + this := Env{} + this.Name = name + this.Value = value + return &this +} + +// NewEnvWithDefaults instantiates a new Env 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 NewEnvWithDefaults() *Env { + this := Env{} + return &this +} + +// GetName returns the Name field value +func (o *Env) 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 *Env) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *Env) SetName(v string) { + o.Name = v +} + +// GetValue returns the Value field value +func (o *Env) GetValue() string { + if o == nil { + var ret string + return ret + } + + return o.Value +} + +// GetValueOk returns a tuple with the Value field value +// and a boolean to check if the value has been set. +func (o *Env) GetValueOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Value, true +} + +// SetValue sets field value +func (o *Env) SetValue(v string) { + o.Value = v +} + +func (o Env) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Env) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + toSerialize["value"] = o.Value + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Env) 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", + "value", + } + + 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) + } + } + + varEnv := _Env{} + + err = json.Unmarshal(data, &varEnv) + + if err != nil { + return err + } + + *o = Env(varEnv) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "value") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableEnv struct { + value *Env + isSet bool +} + +func (v NullableEnv) Get() *Env { + return v.value +} + +func (v *NullableEnv) Set(val *Env) { + v.value = val + v.isSet = true +} + +func (v NullableEnv) IsSet() bool { + return v.isSet +} + +func (v *NullableEnv) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEnv(val *Env) *NullableEnv { + return &NullableEnv{value: val, isSet: true} +} + +func (v NullableEnv) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEnv) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/shadeform/gen/shadeform/model_featured_template.go b/internal/shadeform/gen/shadeform/model_featured_template.go new file mode 100644 index 00000000..60b8e4df --- /dev/null +++ b/internal/shadeform/gen/shadeform/model_featured_template.go @@ -0,0 +1,493 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the FeaturedTemplate type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FeaturedTemplate{} + +// FeaturedTemplate struct for FeaturedTemplate +type FeaturedTemplate struct { + // Name of the featured template + Name string `json:"name"` + // Description of the featured template + Description string `json:"description"` + // Whether the template is publicly available + Public bool `json:"public"` + // Configuration for launching the instance + LaunchConfiguration map[string]interface{} `json:"launch_configuration,omitempty"` + // Auto-deletion configuration + AutoDelete map[string]interface{} `json:"auto_delete,omitempty"` + // Alert configuration + Alert map[string]interface{} `json:"alert,omitempty"` + // Volume mount configuration + VolumeMount map[string]interface{} `json:"volume_mount,omitempty"` + // Tags associated with the template + Tags []string `json:"tags,omitempty"` + // Environment variables for the template + Envs []Env `json:"envs,omitempty"` + Networking *Networking `json:"networking,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _FeaturedTemplate FeaturedTemplate + +// NewFeaturedTemplate instantiates a new FeaturedTemplate 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 NewFeaturedTemplate(name string, description string, public bool) *FeaturedTemplate { + this := FeaturedTemplate{} + this.Name = name + this.Description = description + this.Public = public + return &this +} + +// NewFeaturedTemplateWithDefaults instantiates a new FeaturedTemplate 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 NewFeaturedTemplateWithDefaults() *FeaturedTemplate { + this := FeaturedTemplate{} + return &this +} + +// GetName returns the Name field value +func (o *FeaturedTemplate) 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 *FeaturedTemplate) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *FeaturedTemplate) SetName(v string) { + o.Name = v +} + +// GetDescription returns the Description field value +func (o *FeaturedTemplate) GetDescription() string { + if o == nil { + var ret string + return ret + } + + return o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value +// and a boolean to check if the value has been set. +func (o *FeaturedTemplate) GetDescriptionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Description, true +} + +// SetDescription sets field value +func (o *FeaturedTemplate) SetDescription(v string) { + o.Description = v +} + +// GetPublic returns the Public field value +func (o *FeaturedTemplate) GetPublic() bool { + if o == nil { + var ret bool + return ret + } + + return o.Public +} + +// GetPublicOk returns a tuple with the Public field value +// and a boolean to check if the value has been set. +func (o *FeaturedTemplate) GetPublicOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.Public, true +} + +// SetPublic sets field value +func (o *FeaturedTemplate) SetPublic(v bool) { + o.Public = v +} + +// GetLaunchConfiguration returns the LaunchConfiguration field value if set, zero value otherwise. +func (o *FeaturedTemplate) GetLaunchConfiguration() map[string]interface{} { + if o == nil || IsNil(o.LaunchConfiguration) { + var ret map[string]interface{} + return ret + } + return o.LaunchConfiguration +} + +// GetLaunchConfigurationOk returns a tuple with the LaunchConfiguration field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FeaturedTemplate) GetLaunchConfigurationOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.LaunchConfiguration) { + return map[string]interface{}{}, false + } + return o.LaunchConfiguration, true +} + +// HasLaunchConfiguration returns a boolean if a field has been set. +func (o *FeaturedTemplate) HasLaunchConfiguration() bool { + if o != nil && !IsNil(o.LaunchConfiguration) { + return true + } + + return false +} + +// SetLaunchConfiguration gets a reference to the given map[string]interface{} and assigns it to the LaunchConfiguration field. +func (o *FeaturedTemplate) SetLaunchConfiguration(v map[string]interface{}) { + o.LaunchConfiguration = v +} + +// GetAutoDelete returns the AutoDelete field value if set, zero value otherwise. +func (o *FeaturedTemplate) GetAutoDelete() map[string]interface{} { + if o == nil || IsNil(o.AutoDelete) { + var ret map[string]interface{} + return ret + } + return o.AutoDelete +} + +// GetAutoDeleteOk returns a tuple with the AutoDelete field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FeaturedTemplate) GetAutoDeleteOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.AutoDelete) { + return map[string]interface{}{}, false + } + return o.AutoDelete, true +} + +// HasAutoDelete returns a boolean if a field has been set. +func (o *FeaturedTemplate) HasAutoDelete() bool { + if o != nil && !IsNil(o.AutoDelete) { + return true + } + + return false +} + +// SetAutoDelete gets a reference to the given map[string]interface{} and assigns it to the AutoDelete field. +func (o *FeaturedTemplate) SetAutoDelete(v map[string]interface{}) { + o.AutoDelete = v +} + +// GetAlert returns the Alert field value if set, zero value otherwise. +func (o *FeaturedTemplate) GetAlert() map[string]interface{} { + if o == nil || IsNil(o.Alert) { + var ret map[string]interface{} + return ret + } + return o.Alert +} + +// GetAlertOk returns a tuple with the Alert field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FeaturedTemplate) GetAlertOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Alert) { + return map[string]interface{}{}, false + } + return o.Alert, true +} + +// HasAlert returns a boolean if a field has been set. +func (o *FeaturedTemplate) HasAlert() bool { + if o != nil && !IsNil(o.Alert) { + return true + } + + return false +} + +// SetAlert gets a reference to the given map[string]interface{} and assigns it to the Alert field. +func (o *FeaturedTemplate) SetAlert(v map[string]interface{}) { + o.Alert = v +} + +// GetVolumeMount returns the VolumeMount field value if set, zero value otherwise. +func (o *FeaturedTemplate) GetVolumeMount() map[string]interface{} { + if o == nil || IsNil(o.VolumeMount) { + var ret map[string]interface{} + return ret + } + return o.VolumeMount +} + +// GetVolumeMountOk returns a tuple with the VolumeMount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FeaturedTemplate) GetVolumeMountOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.VolumeMount) { + return map[string]interface{}{}, false + } + return o.VolumeMount, true +} + +// HasVolumeMount returns a boolean if a field has been set. +func (o *FeaturedTemplate) HasVolumeMount() bool { + if o != nil && !IsNil(o.VolumeMount) { + return true + } + + return false +} + +// SetVolumeMount gets a reference to the given map[string]interface{} and assigns it to the VolumeMount field. +func (o *FeaturedTemplate) SetVolumeMount(v map[string]interface{}) { + o.VolumeMount = v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *FeaturedTemplate) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []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 *FeaturedTemplate) GetTagsOk() ([]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 *FeaturedTemplate) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *FeaturedTemplate) SetTags(v []string) { + o.Tags = v +} + +// GetEnvs returns the Envs field value if set, zero value otherwise. +func (o *FeaturedTemplate) GetEnvs() []Env { + if o == nil || IsNil(o.Envs) { + var ret []Env + return ret + } + return o.Envs +} + +// GetEnvsOk returns a tuple with the Envs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FeaturedTemplate) GetEnvsOk() ([]Env, bool) { + if o == nil || IsNil(o.Envs) { + return nil, false + } + return o.Envs, true +} + +// HasEnvs returns a boolean if a field has been set. +func (o *FeaturedTemplate) HasEnvs() bool { + if o != nil && !IsNil(o.Envs) { + return true + } + + return false +} + +// SetEnvs gets a reference to the given []Env and assigns it to the Envs field. +func (o *FeaturedTemplate) SetEnvs(v []Env) { + o.Envs = v +} + +// GetNetworking returns the Networking field value if set, zero value otherwise. +func (o *FeaturedTemplate) GetNetworking() Networking { + if o == nil || IsNil(o.Networking) { + var ret Networking + return ret + } + return *o.Networking +} + +// GetNetworkingOk returns a tuple with the Networking field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FeaturedTemplate) GetNetworkingOk() (*Networking, bool) { + if o == nil || IsNil(o.Networking) { + return nil, false + } + return o.Networking, true +} + +// HasNetworking returns a boolean if a field has been set. +func (o *FeaturedTemplate) HasNetworking() bool { + if o != nil && !IsNil(o.Networking) { + return true + } + + return false +} + +// SetNetworking gets a reference to the given Networking and assigns it to the Networking field. +func (o *FeaturedTemplate) SetNetworking(v Networking) { + o.Networking = &v +} + +func (o FeaturedTemplate) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o FeaturedTemplate) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + toSerialize["description"] = o.Description + toSerialize["public"] = o.Public + if !IsNil(o.LaunchConfiguration) { + toSerialize["launch_configuration"] = o.LaunchConfiguration + } + if !IsNil(o.AutoDelete) { + toSerialize["auto_delete"] = o.AutoDelete + } + if !IsNil(o.Alert) { + toSerialize["alert"] = o.Alert + } + if !IsNil(o.VolumeMount) { + toSerialize["volume_mount"] = o.VolumeMount + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + if !IsNil(o.Envs) { + toSerialize["envs"] = o.Envs + } + if !IsNil(o.Networking) { + toSerialize["networking"] = o.Networking + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *FeaturedTemplate) 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", + "description", + "public", + } + + 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) + } + } + + varFeaturedTemplate := _FeaturedTemplate{} + + err = json.Unmarshal(data, &varFeaturedTemplate) + + if err != nil { + return err + } + + *o = FeaturedTemplate(varFeaturedTemplate) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "description") + delete(additionalProperties, "public") + delete(additionalProperties, "launch_configuration") + delete(additionalProperties, "auto_delete") + delete(additionalProperties, "alert") + delete(additionalProperties, "volume_mount") + delete(additionalProperties, "tags") + delete(additionalProperties, "envs") + delete(additionalProperties, "networking") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableFeaturedTemplate struct { + value *FeaturedTemplate + isSet bool +} + +func (v NullableFeaturedTemplate) Get() *FeaturedTemplate { + return v.value +} + +func (v *NullableFeaturedTemplate) Set(val *FeaturedTemplate) { + v.value = val + v.isSet = true +} + +func (v NullableFeaturedTemplate) IsSet() bool { + return v.isSet +} + +func (v *NullableFeaturedTemplate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFeaturedTemplate(val *FeaturedTemplate) *NullableFeaturedTemplate { + return &NullableFeaturedTemplate{value: val, isSet: true} +} + +func (v NullableFeaturedTemplate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFeaturedTemplate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/shadeform/gen/shadeform/model_featured_templates_response.go b/internal/shadeform/gen/shadeform/model_featured_templates_response.go new file mode 100644 index 00000000..01bccc45 --- /dev/null +++ b/internal/shadeform/gen/shadeform/model_featured_templates_response.go @@ -0,0 +1,167 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the FeaturedTemplatesResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FeaturedTemplatesResponse{} + +// FeaturedTemplatesResponse struct for FeaturedTemplatesResponse +type FeaturedTemplatesResponse struct { + Templates []FeaturedTemplate `json:"templates"` + AdditionalProperties map[string]interface{} +} + +type _FeaturedTemplatesResponse FeaturedTemplatesResponse + +// NewFeaturedTemplatesResponse instantiates a new FeaturedTemplatesResponse 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 NewFeaturedTemplatesResponse(templates []FeaturedTemplate) *FeaturedTemplatesResponse { + this := FeaturedTemplatesResponse{} + this.Templates = templates + return &this +} + +// NewFeaturedTemplatesResponseWithDefaults instantiates a new FeaturedTemplatesResponse 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 NewFeaturedTemplatesResponseWithDefaults() *FeaturedTemplatesResponse { + this := FeaturedTemplatesResponse{} + return &this +} + +// GetTemplates returns the Templates field value +func (o *FeaturedTemplatesResponse) GetTemplates() []FeaturedTemplate { + if o == nil { + var ret []FeaturedTemplate + return ret + } + + return o.Templates +} + +// GetTemplatesOk returns a tuple with the Templates field value +// and a boolean to check if the value has been set. +func (o *FeaturedTemplatesResponse) GetTemplatesOk() ([]FeaturedTemplate, bool) { + if o == nil { + return nil, false + } + return o.Templates, true +} + +// SetTemplates sets field value +func (o *FeaturedTemplatesResponse) SetTemplates(v []FeaturedTemplate) { + o.Templates = v +} + +func (o FeaturedTemplatesResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o FeaturedTemplatesResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["templates"] = o.Templates + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *FeaturedTemplatesResponse) 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{ + "templates", + } + + 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) + } + } + + varFeaturedTemplatesResponse := _FeaturedTemplatesResponse{} + + err = json.Unmarshal(data, &varFeaturedTemplatesResponse) + + if err != nil { + return err + } + + *o = FeaturedTemplatesResponse(varFeaturedTemplatesResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "templates") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableFeaturedTemplatesResponse struct { + value *FeaturedTemplatesResponse + isSet bool +} + +func (v NullableFeaturedTemplatesResponse) Get() *FeaturedTemplatesResponse { + return v.value +} + +func (v *NullableFeaturedTemplatesResponse) Set(val *FeaturedTemplatesResponse) { + v.value = val + v.isSet = true +} + +func (v NullableFeaturedTemplatesResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableFeaturedTemplatesResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFeaturedTemplatesResponse(val *FeaturedTemplatesResponse) *NullableFeaturedTemplatesResponse { + return &NullableFeaturedTemplatesResponse{value: val, isSet: true} +} + +func (v NullableFeaturedTemplatesResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFeaturedTemplatesResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/shadeform/gen/shadeform/model_instance.go b/internal/shadeform/gen/shadeform/model_instance.go new file mode 100644 index 00000000..91951348 --- /dev/null +++ b/internal/shadeform/gen/shadeform/model_instance.go @@ -0,0 +1,729 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the Instance type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Instance{} + +// Instance struct for Instance +type Instance struct { + // The unique identifier for the instance. Used in the instances for the /instances/{id}/info and /instances/{id}/delete APIs. + Id string `json:"id"` + Cloud Cloud `json:"cloud"` + // Specifies the region. + Region string `json:"region"` + // The Shadeform standardized instance type. See this [explanation](/getting-started/concepts#shade-instance-type-and-cloud-instance-type) for more details. + ShadeInstanceType string `json:"shade_instance_type"` + // The instance type for the underlying cloud provider. See this [explanation](/getting-started/concepts#shade-instance-type-and-cloud-instance-type) for more details. + CloudInstanceType string `json:"cloud_instance_type"` + // The unique identifier of the instance issued by the underlying cloud provider. + CloudAssignedId string `json:"cloud_assigned_id"` + // Specifies if the instance is launched in [Shade Cloud](/getting-started/concepts#shade-cloud) or in a linked cloud account. + ShadeCloud bool `json:"shade_cloud"` + // The name of the instance + Name string `json:"name"` + Configuration InstanceConfiguration `json:"configuration"` + // The public IP address of the instance. In select cases, it may also be the DNS. + Ip string `json:"ip"` + // The SSH user used to SSH into the instance. + SshUser string `json:"ssh_user"` + // The SSH port of the instance. In most cases, this will be port 22 but for some clouds, this may be a different port. + SshPort int32 `json:"ssh_port"` + Status Status `json:"status"` + // The cost incurred by the instance. This only the cost via Shadeform. If the instance is deployed in your own cloud account, then all billing is through your cloud provider. + CostEstimate string `json:"cost_estimate"` + // The hourly price of the instance in cents. + HourlyPrice *int32 `json:"hourly_price,omitempty"` + LaunchConfiguration *LaunchConfiguration `json:"launch_configuration,omitempty"` + // List of port mappings on an instance that a Cloud Provider might have automatically set up. + PortMappings []InstancePortMappings `json:"port_mappings,omitempty"` + // The timestamp of when the instance was created in UTC. + CreatedAt time.Time `json:"created_at"` + // The timestamp of when the instance was deleted in UTC. + DeletedAt time.Time `json:"deleted_at"` + 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, cloud Cloud, region string, shadeInstanceType string, cloudInstanceType string, cloudAssignedId string, shadeCloud bool, name string, configuration InstanceConfiguration, ip string, sshUser string, sshPort int32, status Status, costEstimate string, createdAt time.Time, deletedAt time.Time) *Instance { + this := Instance{} + this.Id = id + this.Cloud = cloud + this.Region = region + this.ShadeInstanceType = shadeInstanceType + this.CloudInstanceType = cloudInstanceType + this.CloudAssignedId = cloudAssignedId + this.ShadeCloud = shadeCloud + this.Name = name + this.Configuration = configuration + this.Ip = ip + this.SshUser = sshUser + this.SshPort = sshPort + this.Status = status + this.CostEstimate = costEstimate + this.CreatedAt = createdAt + this.DeletedAt = deletedAt + 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 +} + +// GetCloud returns the Cloud field value +func (o *Instance) GetCloud() Cloud { + if o == nil { + var ret Cloud + return ret + } + + return o.Cloud +} + +// GetCloudOk returns a tuple with the Cloud field value +// and a boolean to check if the value has been set. +func (o *Instance) GetCloudOk() (*Cloud, bool) { + if o == nil { + return nil, false + } + return &o.Cloud, true +} + +// SetCloud sets field value +func (o *Instance) SetCloud(v Cloud) { + o.Cloud = v +} + +// GetRegion returns the Region field value +func (o *Instance) GetRegion() string { + if o == nil { + var ret string + return ret + } + + return o.Region +} + +// GetRegionOk returns a tuple with the Region field value +// and a boolean to check if the value has been set. +func (o *Instance) GetRegionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Region, true +} + +// SetRegion sets field value +func (o *Instance) SetRegion(v string) { + o.Region = v +} + +// GetShadeInstanceType returns the ShadeInstanceType field value +func (o *Instance) GetShadeInstanceType() string { + if o == nil { + var ret string + return ret + } + + return o.ShadeInstanceType +} + +// GetShadeInstanceTypeOk returns a tuple with the ShadeInstanceType field value +// and a boolean to check if the value has been set. +func (o *Instance) GetShadeInstanceTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ShadeInstanceType, true +} + +// SetShadeInstanceType sets field value +func (o *Instance) SetShadeInstanceType(v string) { + o.ShadeInstanceType = v +} + +// GetCloudInstanceType returns the CloudInstanceType field value +func (o *Instance) GetCloudInstanceType() string { + if o == nil { + var ret string + return ret + } + + return o.CloudInstanceType +} + +// GetCloudInstanceTypeOk returns a tuple with the CloudInstanceType field value +// and a boolean to check if the value has been set. +func (o *Instance) GetCloudInstanceTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.CloudInstanceType, true +} + +// SetCloudInstanceType sets field value +func (o *Instance) SetCloudInstanceType(v string) { + o.CloudInstanceType = v +} + +// GetCloudAssignedId returns the CloudAssignedId field value +func (o *Instance) GetCloudAssignedId() string { + if o == nil { + var ret string + return ret + } + + return o.CloudAssignedId +} + +// GetCloudAssignedIdOk returns a tuple with the CloudAssignedId field value +// and a boolean to check if the value has been set. +func (o *Instance) GetCloudAssignedIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.CloudAssignedId, true +} + +// SetCloudAssignedId sets field value +func (o *Instance) SetCloudAssignedId(v string) { + o.CloudAssignedId = v +} + +// GetShadeCloud returns the ShadeCloud field value +func (o *Instance) GetShadeCloud() bool { + if o == nil { + var ret bool + return ret + } + + return o.ShadeCloud +} + +// GetShadeCloudOk returns a tuple with the ShadeCloud field value +// and a boolean to check if the value has been set. +func (o *Instance) GetShadeCloudOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.ShadeCloud, true +} + +// SetShadeCloud sets field value +func (o *Instance) SetShadeCloud(v bool) { + o.ShadeCloud = 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 +} + +// GetConfiguration returns the Configuration field value +func (o *Instance) GetConfiguration() InstanceConfiguration { + if o == nil { + var ret InstanceConfiguration + return ret + } + + return o.Configuration +} + +// GetConfigurationOk returns a tuple with the Configuration field value +// and a boolean to check if the value has been set. +func (o *Instance) GetConfigurationOk() (*InstanceConfiguration, bool) { + if o == nil { + return nil, false + } + return &o.Configuration, true +} + +// SetConfiguration sets field value +func (o *Instance) SetConfiguration(v InstanceConfiguration) { + o.Configuration = v +} + +// GetIp returns the Ip field value +func (o *Instance) GetIp() string { + if o == nil { + var ret string + return ret + } + + return o.Ip +} + +// GetIpOk returns a tuple with the Ip field value +// and a boolean to check if the value has been set. +func (o *Instance) GetIpOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Ip, true +} + +// SetIp sets field value +func (o *Instance) SetIp(v string) { + o.Ip = v +} + +// GetSshUser returns the SshUser field value +func (o *Instance) GetSshUser() string { + if o == nil { + var ret string + return ret + } + + return o.SshUser +} + +// GetSshUserOk returns a tuple with the SshUser field value +// and a boolean to check if the value has been set. +func (o *Instance) GetSshUserOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.SshUser, true +} + +// SetSshUser sets field value +func (o *Instance) SetSshUser(v string) { + o.SshUser = v +} + +// GetSshPort returns the SshPort field value +func (o *Instance) GetSshPort() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.SshPort +} + +// GetSshPortOk returns a tuple with the SshPort field value +// and a boolean to check if the value has been set. +func (o *Instance) GetSshPortOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.SshPort, true +} + +// SetSshPort sets field value +func (o *Instance) SetSshPort(v int32) { + o.SshPort = v +} + +// GetStatus returns the Status field value +func (o *Instance) GetStatus() Status { + if o == nil { + var ret Status + return ret + } + + return o.Status +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *Instance) GetStatusOk() (*Status, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value +func (o *Instance) SetStatus(v Status) { + o.Status = v +} + +// GetCostEstimate returns the CostEstimate field value +func (o *Instance) GetCostEstimate() string { + if o == nil { + var ret string + return ret + } + + return o.CostEstimate +} + +// GetCostEstimateOk returns a tuple with the CostEstimate field value +// and a boolean to check if the value has been set. +func (o *Instance) GetCostEstimateOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.CostEstimate, true +} + +// SetCostEstimate sets field value +func (o *Instance) SetCostEstimate(v string) { + o.CostEstimate = v +} + +// GetHourlyPrice returns the HourlyPrice field value if set, zero value otherwise. +func (o *Instance) GetHourlyPrice() int32 { + if o == nil || IsNil(o.HourlyPrice) { + var ret int32 + return ret + } + return *o.HourlyPrice +} + +// GetHourlyPriceOk returns a tuple with the HourlyPrice field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Instance) GetHourlyPriceOk() (*int32, bool) { + if o == nil || IsNil(o.HourlyPrice) { + return nil, false + } + return o.HourlyPrice, true +} + +// HasHourlyPrice returns a boolean if a field has been set. +func (o *Instance) HasHourlyPrice() bool { + if o != nil && !IsNil(o.HourlyPrice) { + return true + } + + return false +} + +// SetHourlyPrice gets a reference to the given int32 and assigns it to the HourlyPrice field. +func (o *Instance) SetHourlyPrice(v int32) { + o.HourlyPrice = &v +} + +// GetLaunchConfiguration returns the LaunchConfiguration field value if set, zero value otherwise. +func (o *Instance) GetLaunchConfiguration() LaunchConfiguration { + if o == nil || IsNil(o.LaunchConfiguration) { + var ret LaunchConfiguration + return ret + } + return *o.LaunchConfiguration +} + +// GetLaunchConfigurationOk returns a tuple with the LaunchConfiguration field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Instance) GetLaunchConfigurationOk() (*LaunchConfiguration, bool) { + if o == nil || IsNil(o.LaunchConfiguration) { + return nil, false + } + return o.LaunchConfiguration, true +} + +// HasLaunchConfiguration returns a boolean if a field has been set. +func (o *Instance) HasLaunchConfiguration() bool { + if o != nil && !IsNil(o.LaunchConfiguration) { + return true + } + + return false +} + +// SetLaunchConfiguration gets a reference to the given LaunchConfiguration and assigns it to the LaunchConfiguration field. +func (o *Instance) SetLaunchConfiguration(v LaunchConfiguration) { + o.LaunchConfiguration = &v +} + +// GetPortMappings returns the PortMappings field value if set, zero value otherwise. +func (o *Instance) GetPortMappings() []InstancePortMappings { + if o == nil || IsNil(o.PortMappings) { + var ret []InstancePortMappings + return ret + } + return o.PortMappings +} + +// GetPortMappingsOk returns a tuple with the PortMappings field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Instance) GetPortMappingsOk() ([]InstancePortMappings, bool) { + if o == nil || IsNil(o.PortMappings) { + return nil, false + } + return o.PortMappings, true +} + +// HasPortMappings returns a boolean if a field has been set. +func (o *Instance) HasPortMappings() bool { + if o != nil && !IsNil(o.PortMappings) { + return true + } + + return false +} + +// SetPortMappings gets a reference to the given []InstancePortMappings and assigns it to the PortMappings field. +func (o *Instance) SetPortMappings(v []InstancePortMappings) { + o.PortMappings = v +} + +// GetCreatedAt returns the CreatedAt field value +func (o *Instance) 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 *Instance) GetCreatedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.CreatedAt, true +} + +// SetCreatedAt sets field value +func (o *Instance) SetCreatedAt(v time.Time) { + o.CreatedAt = v +} + +// GetDeletedAt returns the DeletedAt field value +func (o *Instance) GetDeletedAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.DeletedAt +} + +// GetDeletedAtOk returns a tuple with the DeletedAt field value +// and a boolean to check if the value has been set. +func (o *Instance) GetDeletedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.DeletedAt, true +} + +// SetDeletedAt sets field value +func (o *Instance) SetDeletedAt(v time.Time) { + o.DeletedAt = 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["cloud"] = o.Cloud + toSerialize["region"] = o.Region + toSerialize["shade_instance_type"] = o.ShadeInstanceType + toSerialize["cloud_instance_type"] = o.CloudInstanceType + toSerialize["cloud_assigned_id"] = o.CloudAssignedId + toSerialize["shade_cloud"] = o.ShadeCloud + toSerialize["name"] = o.Name + toSerialize["configuration"] = o.Configuration + toSerialize["ip"] = o.Ip + toSerialize["ssh_user"] = o.SshUser + toSerialize["ssh_port"] = o.SshPort + toSerialize["status"] = o.Status + toSerialize["cost_estimate"] = o.CostEstimate + if !IsNil(o.HourlyPrice) { + toSerialize["hourly_price"] = o.HourlyPrice + } + if !IsNil(o.LaunchConfiguration) { + toSerialize["launch_configuration"] = o.LaunchConfiguration + } + if !IsNil(o.PortMappings) { + toSerialize["port_mappings"] = o.PortMappings + } + toSerialize["created_at"] = o.CreatedAt + toSerialize["deleted_at"] = o.DeletedAt + + 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", + "cloud", + "region", + "shade_instance_type", + "cloud_instance_type", + "cloud_assigned_id", + "shade_cloud", + "name", + "configuration", + "ip", + "ssh_user", + "ssh_port", + "status", + "cost_estimate", + "created_at", + "deleted_at", + } + + 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, "cloud") + delete(additionalProperties, "region") + delete(additionalProperties, "shade_instance_type") + delete(additionalProperties, "cloud_instance_type") + delete(additionalProperties, "cloud_assigned_id") + delete(additionalProperties, "shade_cloud") + delete(additionalProperties, "name") + delete(additionalProperties, "configuration") + delete(additionalProperties, "ip") + delete(additionalProperties, "ssh_user") + delete(additionalProperties, "ssh_port") + delete(additionalProperties, "status") + delete(additionalProperties, "cost_estimate") + delete(additionalProperties, "hourly_price") + delete(additionalProperties, "launch_configuration") + delete(additionalProperties, "port_mappings") + delete(additionalProperties, "created_at") + delete(additionalProperties, "deleted_at") + 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/shadeform/gen/shadeform/model_instance_configuration.go b/internal/shadeform/gen/shadeform/model_instance_configuration.go new file mode 100644 index 00000000..8485777f --- /dev/null +++ b/internal/shadeform/gen/shadeform/model_instance_configuration.go @@ -0,0 +1,416 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the InstanceConfiguration type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InstanceConfiguration{} + +// InstanceConfiguration struct for InstanceConfiguration +type InstanceConfiguration struct { + // The amount of memory for the instance in gigabytes. Note that this is not VRAM which is determined by GPU type and the number of GPUs. + MemoryInGb int32 `json:"memory_in_gb"` + // The amount of storage for the instance. If this storage is too low for the instance type, please email support@shadeform.ai as the storage may be adjustable. + StorageInGb int32 `json:"storage_in_gb"` + // The number of vCPUs for the instance. + Vcpus int32 `json:"vcpus"` + // The number of GPUs for the instance. + NumGpus int32 `json:"num_gpus"` + // The type of GPU for the instance. + GpuType string `json:"gpu_type"` + // The type of GPU interconnect. + Interconnect string `json:"interconnect"` + // If the instance has NVLink + Nvlink *bool `json:"nvlink,omitempty"` + // The video memory per GPU for the instance in gigabytes. + VramPerGpuInGb int32 `json:"vram_per_gpu_in_gb"` + // The operating system of the instance. + Os string `json:"os"` + AdditionalProperties map[string]interface{} +} + +type _InstanceConfiguration InstanceConfiguration + +// NewInstanceConfiguration instantiates a new InstanceConfiguration 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 NewInstanceConfiguration(memoryInGb int32, storageInGb int32, vcpus int32, numGpus int32, gpuType string, interconnect string, vramPerGpuInGb int32, os string) *InstanceConfiguration { + this := InstanceConfiguration{} + this.MemoryInGb = memoryInGb + this.StorageInGb = storageInGb + this.Vcpus = vcpus + this.NumGpus = numGpus + this.GpuType = gpuType + this.Interconnect = interconnect + this.VramPerGpuInGb = vramPerGpuInGb + this.Os = os + return &this +} + +// NewInstanceConfigurationWithDefaults instantiates a new InstanceConfiguration 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 NewInstanceConfigurationWithDefaults() *InstanceConfiguration { + this := InstanceConfiguration{} + return &this +} + +// GetMemoryInGb returns the MemoryInGb field value +func (o *InstanceConfiguration) GetMemoryInGb() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.MemoryInGb +} + +// GetMemoryInGbOk returns a tuple with the MemoryInGb field value +// and a boolean to check if the value has been set. +func (o *InstanceConfiguration) GetMemoryInGbOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.MemoryInGb, true +} + +// SetMemoryInGb sets field value +func (o *InstanceConfiguration) SetMemoryInGb(v int32) { + o.MemoryInGb = v +} + +// GetStorageInGb returns the StorageInGb field value +func (o *InstanceConfiguration) GetStorageInGb() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.StorageInGb +} + +// GetStorageInGbOk returns a tuple with the StorageInGb field value +// and a boolean to check if the value has been set. +func (o *InstanceConfiguration) GetStorageInGbOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.StorageInGb, true +} + +// SetStorageInGb sets field value +func (o *InstanceConfiguration) SetStorageInGb(v int32) { + o.StorageInGb = v +} + +// GetVcpus returns the Vcpus field value +func (o *InstanceConfiguration) GetVcpus() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Vcpus +} + +// GetVcpusOk returns a tuple with the Vcpus field value +// and a boolean to check if the value has been set. +func (o *InstanceConfiguration) GetVcpusOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Vcpus, true +} + +// SetVcpus sets field value +func (o *InstanceConfiguration) SetVcpus(v int32) { + o.Vcpus = v +} + +// GetNumGpus returns the NumGpus field value +func (o *InstanceConfiguration) GetNumGpus() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.NumGpus +} + +// GetNumGpusOk returns a tuple with the NumGpus field value +// and a boolean to check if the value has been set. +func (o *InstanceConfiguration) GetNumGpusOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.NumGpus, true +} + +// SetNumGpus sets field value +func (o *InstanceConfiguration) SetNumGpus(v int32) { + o.NumGpus = v +} + +// GetGpuType returns the GpuType field value +func (o *InstanceConfiguration) GetGpuType() string { + if o == nil { + var ret string + return ret + } + + return o.GpuType +} + +// GetGpuTypeOk returns a tuple with the GpuType field value +// and a boolean to check if the value has been set. +func (o *InstanceConfiguration) GetGpuTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.GpuType, true +} + +// SetGpuType sets field value +func (o *InstanceConfiguration) SetGpuType(v string) { + o.GpuType = v +} + +// GetInterconnect returns the Interconnect field value +func (o *InstanceConfiguration) GetInterconnect() string { + if o == nil { + var ret string + return ret + } + + return o.Interconnect +} + +// GetInterconnectOk returns a tuple with the Interconnect field value +// and a boolean to check if the value has been set. +func (o *InstanceConfiguration) GetInterconnectOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Interconnect, true +} + +// SetInterconnect sets field value +func (o *InstanceConfiguration) SetInterconnect(v string) { + o.Interconnect = v +} + +// GetNvlink returns the Nvlink field value if set, zero value otherwise. +func (o *InstanceConfiguration) GetNvlink() bool { + if o == nil || IsNil(o.Nvlink) { + var ret bool + return ret + } + return *o.Nvlink +} + +// GetNvlinkOk returns a tuple with the Nvlink field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstanceConfiguration) GetNvlinkOk() (*bool, bool) { + if o == nil || IsNil(o.Nvlink) { + return nil, false + } + return o.Nvlink, true +} + +// HasNvlink returns a boolean if a field has been set. +func (o *InstanceConfiguration) HasNvlink() bool { + if o != nil && !IsNil(o.Nvlink) { + return true + } + + return false +} + +// SetNvlink gets a reference to the given bool and assigns it to the Nvlink field. +func (o *InstanceConfiguration) SetNvlink(v bool) { + o.Nvlink = &v +} + +// GetVramPerGpuInGb returns the VramPerGpuInGb field value +func (o *InstanceConfiguration) GetVramPerGpuInGb() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.VramPerGpuInGb +} + +// GetVramPerGpuInGbOk returns a tuple with the VramPerGpuInGb field value +// and a boolean to check if the value has been set. +func (o *InstanceConfiguration) GetVramPerGpuInGbOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.VramPerGpuInGb, true +} + +// SetVramPerGpuInGb sets field value +func (o *InstanceConfiguration) SetVramPerGpuInGb(v int32) { + o.VramPerGpuInGb = v +} + +// GetOs returns the Os field value +func (o *InstanceConfiguration) GetOs() string { + if o == nil { + var ret string + return ret + } + + return o.Os +} + +// GetOsOk returns a tuple with the Os field value +// and a boolean to check if the value has been set. +func (o *InstanceConfiguration) GetOsOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Os, true +} + +// SetOs sets field value +func (o *InstanceConfiguration) SetOs(v string) { + o.Os = v +} + +func (o InstanceConfiguration) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o InstanceConfiguration) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["memory_in_gb"] = o.MemoryInGb + toSerialize["storage_in_gb"] = o.StorageInGb + toSerialize["vcpus"] = o.Vcpus + toSerialize["num_gpus"] = o.NumGpus + toSerialize["gpu_type"] = o.GpuType + toSerialize["interconnect"] = o.Interconnect + if !IsNil(o.Nvlink) { + toSerialize["nvlink"] = o.Nvlink + } + toSerialize["vram_per_gpu_in_gb"] = o.VramPerGpuInGb + toSerialize["os"] = o.Os + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *InstanceConfiguration) 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{ + "memory_in_gb", + "storage_in_gb", + "vcpus", + "num_gpus", + "gpu_type", + "interconnect", + "vram_per_gpu_in_gb", + "os", + } + + 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) + } + } + + varInstanceConfiguration := _InstanceConfiguration{} + + err = json.Unmarshal(data, &varInstanceConfiguration) + + if err != nil { + return err + } + + *o = InstanceConfiguration(varInstanceConfiguration) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "memory_in_gb") + delete(additionalProperties, "storage_in_gb") + delete(additionalProperties, "vcpus") + delete(additionalProperties, "num_gpus") + delete(additionalProperties, "gpu_type") + delete(additionalProperties, "interconnect") + delete(additionalProperties, "nvlink") + delete(additionalProperties, "vram_per_gpu_in_gb") + delete(additionalProperties, "os") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableInstanceConfiguration struct { + value *InstanceConfiguration + isSet bool +} + +func (v NullableInstanceConfiguration) Get() *InstanceConfiguration { + return v.value +} + +func (v *NullableInstanceConfiguration) Set(val *InstanceConfiguration) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceConfiguration) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceConfiguration) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceConfiguration(val *InstanceConfiguration) *NullableInstanceConfiguration { + return &NullableInstanceConfiguration{value: val, isSet: true} +} + +func (v NullableInstanceConfiguration) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceConfiguration) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/shadeform/gen/shadeform/model_instance_info_response.go b/internal/shadeform/gen/shadeform/model_instance_info_response.go new file mode 100644 index 00000000..c863cfd1 --- /dev/null +++ b/internal/shadeform/gen/shadeform/model_instance_info_response.go @@ -0,0 +1,992 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the InstanceInfoResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InstanceInfoResponse{} + +// InstanceInfoResponse struct for InstanceInfoResponse +type InstanceInfoResponse struct { + // The unique identifier for the instance. Used in the instances for the /instances/{id}/info and /instances/{id}/delete APIs. + Id string `json:"id"` + Cloud Cloud `json:"cloud"` + // Specifies the region. + Region string `json:"region"` + // The Shadeform standardized instance type. See this [explanation](/getting-started/concepts#shade-instance-type-and-cloud-instance-type) for more details. + ShadeInstanceType string `json:"shade_instance_type"` + // The instance type for the underlying cloud provider. See this [explanation](/getting-started/concepts#shade-instance-type-and-cloud-instance-type) for more details. + CloudInstanceType string `json:"cloud_instance_type"` + // The unique identifier of the instance issued by the underlying cloud provider. + CloudAssignedId string `json:"cloud_assigned_id"` + // Specifies if the instance is launched in [Shade Cloud](/getting-started/concepts#shade-cloud) or in a linked cloud account. + ShadeCloud bool `json:"shade_cloud"` + // The name of the instance + Name string `json:"name"` + Configuration InstanceConfiguration `json:"configuration"` + // The public IP address of the instance. In select cases, it may also be the DNS. + Ip string `json:"ip"` + // The SSH user used to SSH into the instance. + SshUser string `json:"ssh_user"` + // The SSH port of the instance. In most cases, this will be port 22 but for some clouds, this may be a different port. + SshPort int32 `json:"ssh_port"` + Status Status `json:"status"` + // The cost incurred by the instance. This only the cost via Shadeform. If the instance is deployed in your own cloud account, then all billing is through your cloud provider. + CostEstimate string `json:"cost_estimate"` + // The hourly price of the instance in cents. + HourlyPrice *int32 `json:"hourly_price,omitempty"` + // List of volume IDs to be mounted. Currently only supports 1 volume at a time. + VolumeIds []string `json:"volume_ids,omitempty"` + // The ID of the SSH Key. + SshKeyId *string `json:"ssh_key_id,omitempty"` + LaunchConfiguration *LaunchConfiguration `json:"launch_configuration,omitempty"` + AutoDelete *AutoDelete `json:"auto_delete,omitempty"` + Alert *Alert `json:"alert,omitempty"` + VolumeMount *VolumeMount `json:"volume_mount,omitempty"` + // Add custom, searchable tags to instances. + Tags []string `json:"tags,omitempty"` + // List of environment variable name and values to automatically add to the instance + Envs []Env `json:"envs,omitempty"` + // List of port mappings on an instance that a Cloud Provider might have automatically set up. + PortMappings []InstancePortMappings `json:"port_mappings,omitempty"` + // The timestamp of when the instance was created in UTC. + CreatedAt time.Time `json:"created_at"` + // The timestamp of when the instance was deleted in UTC. + DeletedAt time.Time `json:"deleted_at"` + AdditionalProperties map[string]interface{} +} + +type _InstanceInfoResponse InstanceInfoResponse + +// NewInstanceInfoResponse instantiates a new InstanceInfoResponse 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 NewInstanceInfoResponse(id string, cloud Cloud, region string, shadeInstanceType string, cloudInstanceType string, cloudAssignedId string, shadeCloud bool, name string, configuration InstanceConfiguration, ip string, sshUser string, sshPort int32, status Status, costEstimate string, createdAt time.Time, deletedAt time.Time) *InstanceInfoResponse { + this := InstanceInfoResponse{} + this.Id = id + this.Cloud = cloud + this.Region = region + this.ShadeInstanceType = shadeInstanceType + this.CloudInstanceType = cloudInstanceType + this.CloudAssignedId = cloudAssignedId + this.ShadeCloud = shadeCloud + this.Name = name + this.Configuration = configuration + this.Ip = ip + this.SshUser = sshUser + this.SshPort = sshPort + this.Status = status + this.CostEstimate = costEstimate + this.CreatedAt = createdAt + this.DeletedAt = deletedAt + return &this +} + +// NewInstanceInfoResponseWithDefaults instantiates a new InstanceInfoResponse 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 NewInstanceInfoResponseWithDefaults() *InstanceInfoResponse { + this := InstanceInfoResponse{} + return &this +} + +// GetId returns the Id field value +func (o *InstanceInfoResponse) 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 *InstanceInfoResponse) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *InstanceInfoResponse) SetId(v string) { + o.Id = v +} + +// GetCloud returns the Cloud field value +func (o *InstanceInfoResponse) GetCloud() Cloud { + if o == nil { + var ret Cloud + return ret + } + + return o.Cloud +} + +// GetCloudOk returns a tuple with the Cloud field value +// and a boolean to check if the value has been set. +func (o *InstanceInfoResponse) GetCloudOk() (*Cloud, bool) { + if o == nil { + return nil, false + } + return &o.Cloud, true +} + +// SetCloud sets field value +func (o *InstanceInfoResponse) SetCloud(v Cloud) { + o.Cloud = v +} + +// GetRegion returns the Region field value +func (o *InstanceInfoResponse) GetRegion() string { + if o == nil { + var ret string + return ret + } + + return o.Region +} + +// GetRegionOk returns a tuple with the Region field value +// and a boolean to check if the value has been set. +func (o *InstanceInfoResponse) GetRegionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Region, true +} + +// SetRegion sets field value +func (o *InstanceInfoResponse) SetRegion(v string) { + o.Region = v +} + +// GetShadeInstanceType returns the ShadeInstanceType field value +func (o *InstanceInfoResponse) GetShadeInstanceType() string { + if o == nil { + var ret string + return ret + } + + return o.ShadeInstanceType +} + +// GetShadeInstanceTypeOk returns a tuple with the ShadeInstanceType field value +// and a boolean to check if the value has been set. +func (o *InstanceInfoResponse) GetShadeInstanceTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ShadeInstanceType, true +} + +// SetShadeInstanceType sets field value +func (o *InstanceInfoResponse) SetShadeInstanceType(v string) { + o.ShadeInstanceType = v +} + +// GetCloudInstanceType returns the CloudInstanceType field value +func (o *InstanceInfoResponse) GetCloudInstanceType() string { + if o == nil { + var ret string + return ret + } + + return o.CloudInstanceType +} + +// GetCloudInstanceTypeOk returns a tuple with the CloudInstanceType field value +// and a boolean to check if the value has been set. +func (o *InstanceInfoResponse) GetCloudInstanceTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.CloudInstanceType, true +} + +// SetCloudInstanceType sets field value +func (o *InstanceInfoResponse) SetCloudInstanceType(v string) { + o.CloudInstanceType = v +} + +// GetCloudAssignedId returns the CloudAssignedId field value +func (o *InstanceInfoResponse) GetCloudAssignedId() string { + if o == nil { + var ret string + return ret + } + + return o.CloudAssignedId +} + +// GetCloudAssignedIdOk returns a tuple with the CloudAssignedId field value +// and a boolean to check if the value has been set. +func (o *InstanceInfoResponse) GetCloudAssignedIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.CloudAssignedId, true +} + +// SetCloudAssignedId sets field value +func (o *InstanceInfoResponse) SetCloudAssignedId(v string) { + o.CloudAssignedId = v +} + +// GetShadeCloud returns the ShadeCloud field value +func (o *InstanceInfoResponse) GetShadeCloud() bool { + if o == nil { + var ret bool + return ret + } + + return o.ShadeCloud +} + +// GetShadeCloudOk returns a tuple with the ShadeCloud field value +// and a boolean to check if the value has been set. +func (o *InstanceInfoResponse) GetShadeCloudOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.ShadeCloud, true +} + +// SetShadeCloud sets field value +func (o *InstanceInfoResponse) SetShadeCloud(v bool) { + o.ShadeCloud = v +} + +// GetName returns the Name field value +func (o *InstanceInfoResponse) 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 *InstanceInfoResponse) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *InstanceInfoResponse) SetName(v string) { + o.Name = v +} + +// GetConfiguration returns the Configuration field value +func (o *InstanceInfoResponse) GetConfiguration() InstanceConfiguration { + if o == nil { + var ret InstanceConfiguration + return ret + } + + return o.Configuration +} + +// GetConfigurationOk returns a tuple with the Configuration field value +// and a boolean to check if the value has been set. +func (o *InstanceInfoResponse) GetConfigurationOk() (*InstanceConfiguration, bool) { + if o == nil { + return nil, false + } + return &o.Configuration, true +} + +// SetConfiguration sets field value +func (o *InstanceInfoResponse) SetConfiguration(v InstanceConfiguration) { + o.Configuration = v +} + +// GetIp returns the Ip field value +func (o *InstanceInfoResponse) GetIp() string { + if o == nil { + var ret string + return ret + } + + return o.Ip +} + +// GetIpOk returns a tuple with the Ip field value +// and a boolean to check if the value has been set. +func (o *InstanceInfoResponse) GetIpOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Ip, true +} + +// SetIp sets field value +func (o *InstanceInfoResponse) SetIp(v string) { + o.Ip = v +} + +// GetSshUser returns the SshUser field value +func (o *InstanceInfoResponse) GetSshUser() string { + if o == nil { + var ret string + return ret + } + + return o.SshUser +} + +// GetSshUserOk returns a tuple with the SshUser field value +// and a boolean to check if the value has been set. +func (o *InstanceInfoResponse) GetSshUserOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.SshUser, true +} + +// SetSshUser sets field value +func (o *InstanceInfoResponse) SetSshUser(v string) { + o.SshUser = v +} + +// GetSshPort returns the SshPort field value +func (o *InstanceInfoResponse) GetSshPort() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.SshPort +} + +// GetSshPortOk returns a tuple with the SshPort field value +// and a boolean to check if the value has been set. +func (o *InstanceInfoResponse) GetSshPortOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.SshPort, true +} + +// SetSshPort sets field value +func (o *InstanceInfoResponse) SetSshPort(v int32) { + o.SshPort = v +} + +// GetStatus returns the Status field value +func (o *InstanceInfoResponse) GetStatus() Status { + if o == nil { + var ret Status + return ret + } + + return o.Status +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *InstanceInfoResponse) GetStatusOk() (*Status, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value +func (o *InstanceInfoResponse) SetStatus(v Status) { + o.Status = v +} + +// GetCostEstimate returns the CostEstimate field value +func (o *InstanceInfoResponse) GetCostEstimate() string { + if o == nil { + var ret string + return ret + } + + return o.CostEstimate +} + +// GetCostEstimateOk returns a tuple with the CostEstimate field value +// and a boolean to check if the value has been set. +func (o *InstanceInfoResponse) GetCostEstimateOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.CostEstimate, true +} + +// SetCostEstimate sets field value +func (o *InstanceInfoResponse) SetCostEstimate(v string) { + o.CostEstimate = v +} + +// GetHourlyPrice returns the HourlyPrice field value if set, zero value otherwise. +func (o *InstanceInfoResponse) GetHourlyPrice() int32 { + if o == nil || IsNil(o.HourlyPrice) { + var ret int32 + return ret + } + return *o.HourlyPrice +} + +// GetHourlyPriceOk returns a tuple with the HourlyPrice field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstanceInfoResponse) GetHourlyPriceOk() (*int32, bool) { + if o == nil || IsNil(o.HourlyPrice) { + return nil, false + } + return o.HourlyPrice, true +} + +// HasHourlyPrice returns a boolean if a field has been set. +func (o *InstanceInfoResponse) HasHourlyPrice() bool { + if o != nil && !IsNil(o.HourlyPrice) { + return true + } + + return false +} + +// SetHourlyPrice gets a reference to the given int32 and assigns it to the HourlyPrice field. +func (o *InstanceInfoResponse) SetHourlyPrice(v int32) { + o.HourlyPrice = &v +} + +// GetVolumeIds returns the VolumeIds field value if set, zero value otherwise. +func (o *InstanceInfoResponse) GetVolumeIds() []string { + if o == nil || IsNil(o.VolumeIds) { + var ret []string + return ret + } + return o.VolumeIds +} + +// GetVolumeIdsOk returns a tuple with the VolumeIds field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstanceInfoResponse) GetVolumeIdsOk() ([]string, bool) { + if o == nil || IsNil(o.VolumeIds) { + return nil, false + } + return o.VolumeIds, true +} + +// HasVolumeIds returns a boolean if a field has been set. +func (o *InstanceInfoResponse) HasVolumeIds() bool { + if o != nil && !IsNil(o.VolumeIds) { + return true + } + + return false +} + +// SetVolumeIds gets a reference to the given []string and assigns it to the VolumeIds field. +func (o *InstanceInfoResponse) SetVolumeIds(v []string) { + o.VolumeIds = v +} + +// GetSshKeyId returns the SshKeyId field value if set, zero value otherwise. +func (o *InstanceInfoResponse) GetSshKeyId() string { + if o == nil || IsNil(o.SshKeyId) { + var ret string + return ret + } + return *o.SshKeyId +} + +// GetSshKeyIdOk returns a tuple with the SshKeyId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstanceInfoResponse) GetSshKeyIdOk() (*string, bool) { + if o == nil || IsNil(o.SshKeyId) { + return nil, false + } + return o.SshKeyId, true +} + +// HasSshKeyId returns a boolean if a field has been set. +func (o *InstanceInfoResponse) HasSshKeyId() bool { + if o != nil && !IsNil(o.SshKeyId) { + return true + } + + return false +} + +// SetSshKeyId gets a reference to the given string and assigns it to the SshKeyId field. +func (o *InstanceInfoResponse) SetSshKeyId(v string) { + o.SshKeyId = &v +} + +// GetLaunchConfiguration returns the LaunchConfiguration field value if set, zero value otherwise. +func (o *InstanceInfoResponse) GetLaunchConfiguration() LaunchConfiguration { + if o == nil || IsNil(o.LaunchConfiguration) { + var ret LaunchConfiguration + return ret + } + return *o.LaunchConfiguration +} + +// GetLaunchConfigurationOk returns a tuple with the LaunchConfiguration field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstanceInfoResponse) GetLaunchConfigurationOk() (*LaunchConfiguration, bool) { + if o == nil || IsNil(o.LaunchConfiguration) { + return nil, false + } + return o.LaunchConfiguration, true +} + +// HasLaunchConfiguration returns a boolean if a field has been set. +func (o *InstanceInfoResponse) HasLaunchConfiguration() bool { + if o != nil && !IsNil(o.LaunchConfiguration) { + return true + } + + return false +} + +// SetLaunchConfiguration gets a reference to the given LaunchConfiguration and assigns it to the LaunchConfiguration field. +func (o *InstanceInfoResponse) SetLaunchConfiguration(v LaunchConfiguration) { + o.LaunchConfiguration = &v +} + +// GetAutoDelete returns the AutoDelete field value if set, zero value otherwise. +func (o *InstanceInfoResponse) GetAutoDelete() AutoDelete { + if o == nil || IsNil(o.AutoDelete) { + var ret AutoDelete + return ret + } + return *o.AutoDelete +} + +// GetAutoDeleteOk returns a tuple with the AutoDelete field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstanceInfoResponse) GetAutoDeleteOk() (*AutoDelete, bool) { + if o == nil || IsNil(o.AutoDelete) { + return nil, false + } + return o.AutoDelete, true +} + +// HasAutoDelete returns a boolean if a field has been set. +func (o *InstanceInfoResponse) HasAutoDelete() bool { + if o != nil && !IsNil(o.AutoDelete) { + return true + } + + return false +} + +// SetAutoDelete gets a reference to the given AutoDelete and assigns it to the AutoDelete field. +func (o *InstanceInfoResponse) SetAutoDelete(v AutoDelete) { + o.AutoDelete = &v +} + +// GetAlert returns the Alert field value if set, zero value otherwise. +func (o *InstanceInfoResponse) GetAlert() Alert { + if o == nil || IsNil(o.Alert) { + var ret Alert + return ret + } + return *o.Alert +} + +// GetAlertOk returns a tuple with the Alert field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstanceInfoResponse) GetAlertOk() (*Alert, bool) { + if o == nil || IsNil(o.Alert) { + return nil, false + } + return o.Alert, true +} + +// HasAlert returns a boolean if a field has been set. +func (o *InstanceInfoResponse) HasAlert() bool { + if o != nil && !IsNil(o.Alert) { + return true + } + + return false +} + +// SetAlert gets a reference to the given Alert and assigns it to the Alert field. +func (o *InstanceInfoResponse) SetAlert(v Alert) { + o.Alert = &v +} + +// GetVolumeMount returns the VolumeMount field value if set, zero value otherwise. +func (o *InstanceInfoResponse) GetVolumeMount() VolumeMount { + if o == nil || IsNil(o.VolumeMount) { + var ret VolumeMount + return ret + } + return *o.VolumeMount +} + +// GetVolumeMountOk returns a tuple with the VolumeMount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstanceInfoResponse) GetVolumeMountOk() (*VolumeMount, bool) { + if o == nil || IsNil(o.VolumeMount) { + return nil, false + } + return o.VolumeMount, true +} + +// HasVolumeMount returns a boolean if a field has been set. +func (o *InstanceInfoResponse) HasVolumeMount() bool { + if o != nil && !IsNil(o.VolumeMount) { + return true + } + + return false +} + +// SetVolumeMount gets a reference to the given VolumeMount and assigns it to the VolumeMount field. +func (o *InstanceInfoResponse) SetVolumeMount(v VolumeMount) { + o.VolumeMount = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *InstanceInfoResponse) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []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 *InstanceInfoResponse) GetTagsOk() ([]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 *InstanceInfoResponse) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *InstanceInfoResponse) SetTags(v []string) { + o.Tags = v +} + +// GetEnvs returns the Envs field value if set, zero value otherwise. +func (o *InstanceInfoResponse) GetEnvs() []Env { + if o == nil || IsNil(o.Envs) { + var ret []Env + return ret + } + return o.Envs +} + +// GetEnvsOk returns a tuple with the Envs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstanceInfoResponse) GetEnvsOk() ([]Env, bool) { + if o == nil || IsNil(o.Envs) { + return nil, false + } + return o.Envs, true +} + +// HasEnvs returns a boolean if a field has been set. +func (o *InstanceInfoResponse) HasEnvs() bool { + if o != nil && !IsNil(o.Envs) { + return true + } + + return false +} + +// SetEnvs gets a reference to the given []Env and assigns it to the Envs field. +func (o *InstanceInfoResponse) SetEnvs(v []Env) { + o.Envs = v +} + +// GetPortMappings returns the PortMappings field value if set, zero value otherwise. +func (o *InstanceInfoResponse) GetPortMappings() []InstancePortMappings { + if o == nil || IsNil(o.PortMappings) { + var ret []InstancePortMappings + return ret + } + return o.PortMappings +} + +// GetPortMappingsOk returns a tuple with the PortMappings field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstanceInfoResponse) GetPortMappingsOk() ([]InstancePortMappings, bool) { + if o == nil || IsNil(o.PortMappings) { + return nil, false + } + return o.PortMappings, true +} + +// HasPortMappings returns a boolean if a field has been set. +func (o *InstanceInfoResponse) HasPortMappings() bool { + if o != nil && !IsNil(o.PortMappings) { + return true + } + + return false +} + +// SetPortMappings gets a reference to the given []InstancePortMappings and assigns it to the PortMappings field. +func (o *InstanceInfoResponse) SetPortMappings(v []InstancePortMappings) { + o.PortMappings = v +} + +// GetCreatedAt returns the CreatedAt field value +func (o *InstanceInfoResponse) 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 *InstanceInfoResponse) GetCreatedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.CreatedAt, true +} + +// SetCreatedAt sets field value +func (o *InstanceInfoResponse) SetCreatedAt(v time.Time) { + o.CreatedAt = v +} + +// GetDeletedAt returns the DeletedAt field value +func (o *InstanceInfoResponse) GetDeletedAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.DeletedAt +} + +// GetDeletedAtOk returns a tuple with the DeletedAt field value +// and a boolean to check if the value has been set. +func (o *InstanceInfoResponse) GetDeletedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.DeletedAt, true +} + +// SetDeletedAt sets field value +func (o *InstanceInfoResponse) SetDeletedAt(v time.Time) { + o.DeletedAt = v +} + +func (o InstanceInfoResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o InstanceInfoResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["cloud"] = o.Cloud + toSerialize["region"] = o.Region + toSerialize["shade_instance_type"] = o.ShadeInstanceType + toSerialize["cloud_instance_type"] = o.CloudInstanceType + toSerialize["cloud_assigned_id"] = o.CloudAssignedId + toSerialize["shade_cloud"] = o.ShadeCloud + toSerialize["name"] = o.Name + toSerialize["configuration"] = o.Configuration + toSerialize["ip"] = o.Ip + toSerialize["ssh_user"] = o.SshUser + toSerialize["ssh_port"] = o.SshPort + toSerialize["status"] = o.Status + toSerialize["cost_estimate"] = o.CostEstimate + if !IsNil(o.HourlyPrice) { + toSerialize["hourly_price"] = o.HourlyPrice + } + if !IsNil(o.VolumeIds) { + toSerialize["volume_ids"] = o.VolumeIds + } + if !IsNil(o.SshKeyId) { + toSerialize["ssh_key_id"] = o.SshKeyId + } + if !IsNil(o.LaunchConfiguration) { + toSerialize["launch_configuration"] = o.LaunchConfiguration + } + if !IsNil(o.AutoDelete) { + toSerialize["auto_delete"] = o.AutoDelete + } + if !IsNil(o.Alert) { + toSerialize["alert"] = o.Alert + } + if !IsNil(o.VolumeMount) { + toSerialize["volume_mount"] = o.VolumeMount + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + if !IsNil(o.Envs) { + toSerialize["envs"] = o.Envs + } + if !IsNil(o.PortMappings) { + toSerialize["port_mappings"] = o.PortMappings + } + toSerialize["created_at"] = o.CreatedAt + toSerialize["deleted_at"] = o.DeletedAt + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *InstanceInfoResponse) 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", + "cloud", + "region", + "shade_instance_type", + "cloud_instance_type", + "cloud_assigned_id", + "shade_cloud", + "name", + "configuration", + "ip", + "ssh_user", + "ssh_port", + "status", + "cost_estimate", + "created_at", + "deleted_at", + } + + 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) + } + } + + varInstanceInfoResponse := _InstanceInfoResponse{} + + err = json.Unmarshal(data, &varInstanceInfoResponse) + + if err != nil { + return err + } + + *o = InstanceInfoResponse(varInstanceInfoResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "cloud") + delete(additionalProperties, "region") + delete(additionalProperties, "shade_instance_type") + delete(additionalProperties, "cloud_instance_type") + delete(additionalProperties, "cloud_assigned_id") + delete(additionalProperties, "shade_cloud") + delete(additionalProperties, "name") + delete(additionalProperties, "configuration") + delete(additionalProperties, "ip") + delete(additionalProperties, "ssh_user") + delete(additionalProperties, "ssh_port") + delete(additionalProperties, "status") + delete(additionalProperties, "cost_estimate") + delete(additionalProperties, "hourly_price") + delete(additionalProperties, "volume_ids") + delete(additionalProperties, "ssh_key_id") + delete(additionalProperties, "launch_configuration") + delete(additionalProperties, "auto_delete") + delete(additionalProperties, "alert") + delete(additionalProperties, "volume_mount") + delete(additionalProperties, "tags") + delete(additionalProperties, "envs") + delete(additionalProperties, "port_mappings") + delete(additionalProperties, "created_at") + delete(additionalProperties, "deleted_at") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableInstanceInfoResponse struct { + value *InstanceInfoResponse + isSet bool +} + +func (v NullableInstanceInfoResponse) Get() *InstanceInfoResponse { + return v.value +} + +func (v *NullableInstanceInfoResponse) Set(val *InstanceInfoResponse) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceInfoResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceInfoResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceInfoResponse(val *InstanceInfoResponse) *NullableInstanceInfoResponse { + return &NullableInstanceInfoResponse{value: val, isSet: true} +} + +func (v NullableInstanceInfoResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceInfoResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/shadeform/gen/shadeform/model_instance_port_mappings.go b/internal/shadeform/gen/shadeform/model_instance_port_mappings.go new file mode 100644 index 00000000..49108e2d --- /dev/null +++ b/internal/shadeform/gen/shadeform/model_instance_port_mappings.go @@ -0,0 +1,191 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the InstancePortMappings type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InstancePortMappings{} + +// InstancePortMappings List of port mappings on an instance that a Cloud Provider might have automatically set up. +type InstancePortMappings struct { + InternalPort *int32 `json:"internal_port,omitempty"` + ExternalPort *int32 `json:"external_port,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _InstancePortMappings InstancePortMappings + +// NewInstancePortMappings instantiates a new InstancePortMappings 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 NewInstancePortMappings() *InstancePortMappings { + this := InstancePortMappings{} + return &this +} + +// NewInstancePortMappingsWithDefaults instantiates a new InstancePortMappings 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 NewInstancePortMappingsWithDefaults() *InstancePortMappings { + this := InstancePortMappings{} + return &this +} + +// GetInternalPort returns the InternalPort field value if set, zero value otherwise. +func (o *InstancePortMappings) GetInternalPort() int32 { + if o == nil || IsNil(o.InternalPort) { + var ret int32 + return ret + } + return *o.InternalPort +} + +// GetInternalPortOk returns a tuple with the InternalPort field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstancePortMappings) GetInternalPortOk() (*int32, bool) { + if o == nil || IsNil(o.InternalPort) { + return nil, false + } + return o.InternalPort, true +} + +// HasInternalPort returns a boolean if a field has been set. +func (o *InstancePortMappings) HasInternalPort() bool { + if o != nil && !IsNil(o.InternalPort) { + return true + } + + return false +} + +// SetInternalPort gets a reference to the given int32 and assigns it to the InternalPort field. +func (o *InstancePortMappings) SetInternalPort(v int32) { + o.InternalPort = &v +} + +// GetExternalPort returns the ExternalPort field value if set, zero value otherwise. +func (o *InstancePortMappings) GetExternalPort() int32 { + if o == nil || IsNil(o.ExternalPort) { + var ret int32 + return ret + } + return *o.ExternalPort +} + +// GetExternalPortOk returns a tuple with the ExternalPort field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstancePortMappings) GetExternalPortOk() (*int32, bool) { + if o == nil || IsNil(o.ExternalPort) { + return nil, false + } + return o.ExternalPort, true +} + +// HasExternalPort returns a boolean if a field has been set. +func (o *InstancePortMappings) HasExternalPort() bool { + if o != nil && !IsNil(o.ExternalPort) { + return true + } + + return false +} + +// SetExternalPort gets a reference to the given int32 and assigns it to the ExternalPort field. +func (o *InstancePortMappings) SetExternalPort(v int32) { + o.ExternalPort = &v +} + +func (o InstancePortMappings) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o InstancePortMappings) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.InternalPort) { + toSerialize["internal_port"] = o.InternalPort + } + if !IsNil(o.ExternalPort) { + toSerialize["external_port"] = o.ExternalPort + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *InstancePortMappings) UnmarshalJSON(data []byte) (err error) { + varInstancePortMappings := _InstancePortMappings{} + + err = json.Unmarshal(data, &varInstancePortMappings) + + if err != nil { + return err + } + + *o = InstancePortMappings(varInstancePortMappings) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "internal_port") + delete(additionalProperties, "external_port") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableInstancePortMappings struct { + value *InstancePortMappings + isSet bool +} + +func (v NullableInstancePortMappings) Get() *InstancePortMappings { + return v.value +} + +func (v *NullableInstancePortMappings) Set(val *InstancePortMappings) { + v.value = val + v.isSet = true +} + +func (v NullableInstancePortMappings) IsSet() bool { + return v.isSet +} + +func (v *NullableInstancePortMappings) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstancePortMappings(val *InstancePortMappings) *NullableInstancePortMappings { + return &NullableInstancePortMappings{value: val, isSet: true} +} + +func (v NullableInstancePortMappings) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstancePortMappings) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/shadeform/gen/shadeform/model_instance_type.go b/internal/shadeform/gen/shadeform/model_instance_type.go new file mode 100644 index 00000000..0e1ed4d4 --- /dev/null +++ b/internal/shadeform/gen/shadeform/model_instance_type.go @@ -0,0 +1,648 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// 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 Information about a specific instance type +type InstanceType struct { + Cloud Cloud `json:"cloud"` + // The Shadeform standardized instance type. See this [explanation](/getting-started/concepts#shade-instance-type-and-cloud-instance-type) for more details. + ShadeInstanceType string `json:"shade_instance_type"` + // The instance type for the underlying cloud provider. See this [explanation](/getting-started/concepts#shade-instance-type-and-cloud-instance-type) for more details. + CloudInstanceType string `json:"cloud_instance_type"` + Configuration InstanceTypeConfiguration `json:"configuration"` + // The hourly price of the instance in cents. + HourlyPrice int32 `json:"hourly_price"` + // Whether the instance is a \"vm\" (virtual machine), a \"container\" (docker container), or \"baremetal\" (bare metal server). + DeploymentType string `json:"deployment_type"` + Availability []Availability `json:"availability"` + BootTime map[string]interface{} `json:"boot_time,omitempty"` + // The amount of memory for the instance in gigabytes. Note that this is not VRAM which is determined by GPU type and the number of GPUs. + MemoryInGb *int32 `json:"memory_in_gb,omitempty"` + // The amount of storage for the instance. If this storage is too low for the instance type, please email support@shadeform.ai as the storage may be adjustable. + StorageInGb *int32 `json:"storage_in_gb,omitempty"` + // The number of vCPUs for the instance. + Vcpus *int32 `json:"vcpus,omitempty"` + // The number of GPUs for the instance. + NumGpus *int32 `json:"num_gpus,omitempty"` + // The type of GPU for the instance. + GpuType *string `json:"gpu_type,omitempty"` + // The type of GPU interconnect. + Interconnect *string `json:"interconnect,omitempty"` + // If the instance has NVLink + Nvlink *bool `json:"nvlink,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(cloud Cloud, shadeInstanceType string, cloudInstanceType string, configuration InstanceTypeConfiguration, hourlyPrice int32, deploymentType string, availability []Availability) *InstanceType { + this := InstanceType{} + this.Cloud = cloud + this.ShadeInstanceType = shadeInstanceType + this.CloudInstanceType = cloudInstanceType + this.Configuration = configuration + this.HourlyPrice = hourlyPrice + this.DeploymentType = deploymentType + this.Availability = availability + 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 +} + +// GetCloud returns the Cloud field value +func (o *InstanceType) GetCloud() Cloud { + if o == nil { + var ret Cloud + return ret + } + + return o.Cloud +} + +// GetCloudOk returns a tuple with the Cloud field value +// and a boolean to check if the value has been set. +func (o *InstanceType) GetCloudOk() (*Cloud, bool) { + if o == nil { + return nil, false + } + return &o.Cloud, true +} + +// SetCloud sets field value +func (o *InstanceType) SetCloud(v Cloud) { + o.Cloud = v +} + +// GetShadeInstanceType returns the ShadeInstanceType field value +func (o *InstanceType) GetShadeInstanceType() string { + if o == nil { + var ret string + return ret + } + + return o.ShadeInstanceType +} + +// GetShadeInstanceTypeOk returns a tuple with the ShadeInstanceType field value +// and a boolean to check if the value has been set. +func (o *InstanceType) GetShadeInstanceTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ShadeInstanceType, true +} + +// SetShadeInstanceType sets field value +func (o *InstanceType) SetShadeInstanceType(v string) { + o.ShadeInstanceType = v +} + +// GetCloudInstanceType returns the CloudInstanceType field value +func (o *InstanceType) GetCloudInstanceType() string { + if o == nil { + var ret string + return ret + } + + return o.CloudInstanceType +} + +// GetCloudInstanceTypeOk returns a tuple with the CloudInstanceType field value +// and a boolean to check if the value has been set. +func (o *InstanceType) GetCloudInstanceTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.CloudInstanceType, true +} + +// SetCloudInstanceType sets field value +func (o *InstanceType) SetCloudInstanceType(v string) { + o.CloudInstanceType = v +} + +// GetConfiguration returns the Configuration field value +func (o *InstanceType) GetConfiguration() InstanceTypeConfiguration { + if o == nil { + var ret InstanceTypeConfiguration + return ret + } + + return o.Configuration +} + +// GetConfigurationOk returns a tuple with the Configuration field value +// and a boolean to check if the value has been set. +func (o *InstanceType) GetConfigurationOk() (*InstanceTypeConfiguration, bool) { + if o == nil { + return nil, false + } + return &o.Configuration, true +} + +// SetConfiguration sets field value +func (o *InstanceType) SetConfiguration(v InstanceTypeConfiguration) { + o.Configuration = v +} + +// GetHourlyPrice returns the HourlyPrice field value +func (o *InstanceType) GetHourlyPrice() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.HourlyPrice +} + +// GetHourlyPriceOk returns a tuple with the HourlyPrice field value +// and a boolean to check if the value has been set. +func (o *InstanceType) GetHourlyPriceOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.HourlyPrice, true +} + +// SetHourlyPrice sets field value +func (o *InstanceType) SetHourlyPrice(v int32) { + o.HourlyPrice = v +} + +// GetDeploymentType returns the DeploymentType field value +func (o *InstanceType) GetDeploymentType() string { + if o == nil { + var ret string + return ret + } + + return o.DeploymentType +} + +// GetDeploymentTypeOk returns a tuple with the DeploymentType field value +// and a boolean to check if the value has been set. +func (o *InstanceType) GetDeploymentTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DeploymentType, true +} + +// SetDeploymentType sets field value +func (o *InstanceType) SetDeploymentType(v string) { + o.DeploymentType = v +} + +// GetAvailability returns the Availability field value +func (o *InstanceType) GetAvailability() []Availability { + if o == nil { + var ret []Availability + return ret + } + + return o.Availability +} + +// GetAvailabilityOk returns a tuple with the Availability field value +// and a boolean to check if the value has been set. +func (o *InstanceType) GetAvailabilityOk() ([]Availability, bool) { + if o == nil { + return nil, false + } + return o.Availability, true +} + +// SetAvailability sets field value +func (o *InstanceType) SetAvailability(v []Availability) { + o.Availability = v +} + +// GetBootTime returns the BootTime field value if set, zero value otherwise. +func (o *InstanceType) GetBootTime() map[string]interface{} { + if o == nil || IsNil(o.BootTime) { + var ret map[string]interface{} + return ret + } + return o.BootTime +} + +// GetBootTimeOk returns a tuple with the BootTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstanceType) GetBootTimeOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.BootTime) { + return map[string]interface{}{}, false + } + return o.BootTime, true +} + +// HasBootTime returns a boolean if a field has been set. +func (o *InstanceType) HasBootTime() bool { + if o != nil && !IsNil(o.BootTime) { + return true + } + + return false +} + +// SetBootTime gets a reference to the given map[string]interface{} and assigns it to the BootTime field. +func (o *InstanceType) SetBootTime(v map[string]interface{}) { + o.BootTime = v +} + +// GetMemoryInGb returns the MemoryInGb field value if set, zero value otherwise. +func (o *InstanceType) GetMemoryInGb() int32 { + if o == nil || IsNil(o.MemoryInGb) { + var ret int32 + return ret + } + return *o.MemoryInGb +} + +// GetMemoryInGbOk returns a tuple with the MemoryInGb field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstanceType) GetMemoryInGbOk() (*int32, bool) { + if o == nil || IsNil(o.MemoryInGb) { + return nil, false + } + return o.MemoryInGb, true +} + +// HasMemoryInGb returns a boolean if a field has been set. +func (o *InstanceType) HasMemoryInGb() bool { + if o != nil && !IsNil(o.MemoryInGb) { + return true + } + + return false +} + +// SetMemoryInGb gets a reference to the given int32 and assigns it to the MemoryInGb field. +func (o *InstanceType) SetMemoryInGb(v int32) { + o.MemoryInGb = &v +} + +// GetStorageInGb returns the StorageInGb field value if set, zero value otherwise. +func (o *InstanceType) GetStorageInGb() int32 { + if o == nil || IsNil(o.StorageInGb) { + var ret int32 + return ret + } + return *o.StorageInGb +} + +// GetStorageInGbOk returns a tuple with the StorageInGb field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstanceType) GetStorageInGbOk() (*int32, bool) { + if o == nil || IsNil(o.StorageInGb) { + return nil, false + } + return o.StorageInGb, true +} + +// HasStorageInGb returns a boolean if a field has been set. +func (o *InstanceType) HasStorageInGb() bool { + if o != nil && !IsNil(o.StorageInGb) { + return true + } + + return false +} + +// SetStorageInGb gets a reference to the given int32 and assigns it to the StorageInGb field. +func (o *InstanceType) SetStorageInGb(v int32) { + o.StorageInGb = &v +} + +// GetVcpus returns the Vcpus field value if set, zero value otherwise. +func (o *InstanceType) GetVcpus() int32 { + if o == nil || IsNil(o.Vcpus) { + var ret int32 + return ret + } + return *o.Vcpus +} + +// GetVcpusOk returns a tuple with the Vcpus field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstanceType) GetVcpusOk() (*int32, bool) { + if o == nil || IsNil(o.Vcpus) { + return nil, false + } + return o.Vcpus, true +} + +// HasVcpus returns a boolean if a field has been set. +func (o *InstanceType) HasVcpus() bool { + if o != nil && !IsNil(o.Vcpus) { + return true + } + + return false +} + +// SetVcpus gets a reference to the given int32 and assigns it to the Vcpus field. +func (o *InstanceType) SetVcpus(v int32) { + o.Vcpus = &v +} + +// GetNumGpus returns the NumGpus field value if set, zero value otherwise. +func (o *InstanceType) GetNumGpus() int32 { + if o == nil || IsNil(o.NumGpus) { + var ret int32 + return ret + } + return *o.NumGpus +} + +// GetNumGpusOk returns a tuple with the NumGpus field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstanceType) GetNumGpusOk() (*int32, bool) { + if o == nil || IsNil(o.NumGpus) { + return nil, false + } + return o.NumGpus, true +} + +// HasNumGpus returns a boolean if a field has been set. +func (o *InstanceType) HasNumGpus() bool { + if o != nil && !IsNil(o.NumGpus) { + return true + } + + return false +} + +// SetNumGpus gets a reference to the given int32 and assigns it to the NumGpus field. +func (o *InstanceType) SetNumGpus(v int32) { + o.NumGpus = &v +} + +// GetGpuType returns the GpuType field value if set, zero value otherwise. +func (o *InstanceType) GetGpuType() string { + if o == nil || IsNil(o.GpuType) { + var ret string + return ret + } + return *o.GpuType +} + +// GetGpuTypeOk returns a tuple with the GpuType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstanceType) GetGpuTypeOk() (*string, bool) { + if o == nil || IsNil(o.GpuType) { + return nil, false + } + return o.GpuType, true +} + +// HasGpuType returns a boolean if a field has been set. +func (o *InstanceType) HasGpuType() bool { + if o != nil && !IsNil(o.GpuType) { + return true + } + + return false +} + +// SetGpuType gets a reference to the given string and assigns it to the GpuType field. +func (o *InstanceType) SetGpuType(v string) { + o.GpuType = &v +} + +// GetInterconnect returns the Interconnect field value if set, zero value otherwise. +func (o *InstanceType) GetInterconnect() string { + if o == nil || IsNil(o.Interconnect) { + var ret string + return ret + } + return *o.Interconnect +} + +// GetInterconnectOk returns a tuple with the Interconnect field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstanceType) GetInterconnectOk() (*string, bool) { + if o == nil || IsNil(o.Interconnect) { + return nil, false + } + return o.Interconnect, true +} + +// HasInterconnect returns a boolean if a field has been set. +func (o *InstanceType) HasInterconnect() bool { + if o != nil && !IsNil(o.Interconnect) { + return true + } + + return false +} + +// SetInterconnect gets a reference to the given string and assigns it to the Interconnect field. +func (o *InstanceType) SetInterconnect(v string) { + o.Interconnect = &v +} + +// GetNvlink returns the Nvlink field value if set, zero value otherwise. +func (o *InstanceType) GetNvlink() bool { + if o == nil || IsNil(o.Nvlink) { + var ret bool + return ret + } + return *o.Nvlink +} + +// GetNvlinkOk returns a tuple with the Nvlink field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstanceType) GetNvlinkOk() (*bool, bool) { + if o == nil || IsNil(o.Nvlink) { + return nil, false + } + return o.Nvlink, true +} + +// HasNvlink returns a boolean if a field has been set. +func (o *InstanceType) HasNvlink() bool { + if o != nil && !IsNil(o.Nvlink) { + return true + } + + return false +} + +// SetNvlink gets a reference to the given bool and assigns it to the Nvlink field. +func (o *InstanceType) SetNvlink(v bool) { + o.Nvlink = &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["cloud"] = o.Cloud + toSerialize["shade_instance_type"] = o.ShadeInstanceType + toSerialize["cloud_instance_type"] = o.CloudInstanceType + toSerialize["configuration"] = o.Configuration + toSerialize["hourly_price"] = o.HourlyPrice + toSerialize["deployment_type"] = o.DeploymentType + toSerialize["availability"] = o.Availability + if !IsNil(o.BootTime) { + toSerialize["boot_time"] = o.BootTime + } + if !IsNil(o.MemoryInGb) { + toSerialize["memory_in_gb"] = o.MemoryInGb + } + if !IsNil(o.StorageInGb) { + toSerialize["storage_in_gb"] = o.StorageInGb + } + if !IsNil(o.Vcpus) { + toSerialize["vcpus"] = o.Vcpus + } + if !IsNil(o.NumGpus) { + toSerialize["num_gpus"] = o.NumGpus + } + if !IsNil(o.GpuType) { + toSerialize["gpu_type"] = o.GpuType + } + if !IsNil(o.Interconnect) { + toSerialize["interconnect"] = o.Interconnect + } + if !IsNil(o.Nvlink) { + toSerialize["nvlink"] = o.Nvlink + } + + 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{ + "cloud", + "shade_instance_type", + "cloud_instance_type", + "configuration", + "hourly_price", + "deployment_type", + "availability", + } + + 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, "cloud") + delete(additionalProperties, "shade_instance_type") + delete(additionalProperties, "cloud_instance_type") + delete(additionalProperties, "configuration") + delete(additionalProperties, "hourly_price") + delete(additionalProperties, "deployment_type") + delete(additionalProperties, "availability") + delete(additionalProperties, "boot_time") + delete(additionalProperties, "memory_in_gb") + delete(additionalProperties, "storage_in_gb") + delete(additionalProperties, "vcpus") + delete(additionalProperties, "num_gpus") + delete(additionalProperties, "gpu_type") + delete(additionalProperties, "interconnect") + delete(additionalProperties, "nvlink") + 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/shadeform/gen/shadeform/model_instance_type_configuration.go b/internal/shadeform/gen/shadeform/model_instance_type_configuration.go new file mode 100644 index 00000000..46d50c8a --- /dev/null +++ b/internal/shadeform/gen/shadeform/model_instance_type_configuration.go @@ -0,0 +1,416 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the InstanceTypeConfiguration type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InstanceTypeConfiguration{} + +// InstanceTypeConfiguration struct for InstanceTypeConfiguration +type InstanceTypeConfiguration struct { + // The amount of memory for the instance in gigabytes. Note that this is not VRAM which is determined by GPU type and the number of GPUs. + MemoryInGb int32 `json:"memory_in_gb"` + // The amount of storage for the instance. If this storage is too low for the instance type, please email support@shadeform.ai as the storage may be adjustable. + StorageInGb int32 `json:"storage_in_gb"` + // The number of vCPUs for the instance. + Vcpus int32 `json:"vcpus"` + // The number of GPUs for the instance. + NumGpus int32 `json:"num_gpus"` + // The type of GPU for the instance. + GpuType string `json:"gpu_type"` + // The type of GPU interconnect. + Interconnect string `json:"interconnect"` + // If the instance has NVLink + Nvlink *bool `json:"nvlink,omitempty"` + // The video memory per GPU for the instance in gigabytes. + VramPerGpuInGb int32 `json:"vram_per_gpu_in_gb"` + // The list of available operating systems for the instance. + OsOptions []string `json:"os_options"` + AdditionalProperties map[string]interface{} +} + +type _InstanceTypeConfiguration InstanceTypeConfiguration + +// NewInstanceTypeConfiguration instantiates a new InstanceTypeConfiguration 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 NewInstanceTypeConfiguration(memoryInGb int32, storageInGb int32, vcpus int32, numGpus int32, gpuType string, interconnect string, vramPerGpuInGb int32, osOptions []string) *InstanceTypeConfiguration { + this := InstanceTypeConfiguration{} + this.MemoryInGb = memoryInGb + this.StorageInGb = storageInGb + this.Vcpus = vcpus + this.NumGpus = numGpus + this.GpuType = gpuType + this.Interconnect = interconnect + this.VramPerGpuInGb = vramPerGpuInGb + this.OsOptions = osOptions + return &this +} + +// NewInstanceTypeConfigurationWithDefaults instantiates a new InstanceTypeConfiguration 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 NewInstanceTypeConfigurationWithDefaults() *InstanceTypeConfiguration { + this := InstanceTypeConfiguration{} + return &this +} + +// GetMemoryInGb returns the MemoryInGb field value +func (o *InstanceTypeConfiguration) GetMemoryInGb() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.MemoryInGb +} + +// GetMemoryInGbOk returns a tuple with the MemoryInGb field value +// and a boolean to check if the value has been set. +func (o *InstanceTypeConfiguration) GetMemoryInGbOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.MemoryInGb, true +} + +// SetMemoryInGb sets field value +func (o *InstanceTypeConfiguration) SetMemoryInGb(v int32) { + o.MemoryInGb = v +} + +// GetStorageInGb returns the StorageInGb field value +func (o *InstanceTypeConfiguration) GetStorageInGb() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.StorageInGb +} + +// GetStorageInGbOk returns a tuple with the StorageInGb field value +// and a boolean to check if the value has been set. +func (o *InstanceTypeConfiguration) GetStorageInGbOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.StorageInGb, true +} + +// SetStorageInGb sets field value +func (o *InstanceTypeConfiguration) SetStorageInGb(v int32) { + o.StorageInGb = v +} + +// GetVcpus returns the Vcpus field value +func (o *InstanceTypeConfiguration) GetVcpus() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Vcpus +} + +// GetVcpusOk returns a tuple with the Vcpus field value +// and a boolean to check if the value has been set. +func (o *InstanceTypeConfiguration) GetVcpusOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Vcpus, true +} + +// SetVcpus sets field value +func (o *InstanceTypeConfiguration) SetVcpus(v int32) { + o.Vcpus = v +} + +// GetNumGpus returns the NumGpus field value +func (o *InstanceTypeConfiguration) GetNumGpus() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.NumGpus +} + +// GetNumGpusOk returns a tuple with the NumGpus field value +// and a boolean to check if the value has been set. +func (o *InstanceTypeConfiguration) GetNumGpusOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.NumGpus, true +} + +// SetNumGpus sets field value +func (o *InstanceTypeConfiguration) SetNumGpus(v int32) { + o.NumGpus = v +} + +// GetGpuType returns the GpuType field value +func (o *InstanceTypeConfiguration) GetGpuType() string { + if o == nil { + var ret string + return ret + } + + return o.GpuType +} + +// GetGpuTypeOk returns a tuple with the GpuType field value +// and a boolean to check if the value has been set. +func (o *InstanceTypeConfiguration) GetGpuTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.GpuType, true +} + +// SetGpuType sets field value +func (o *InstanceTypeConfiguration) SetGpuType(v string) { + o.GpuType = v +} + +// GetInterconnect returns the Interconnect field value +func (o *InstanceTypeConfiguration) GetInterconnect() string { + if o == nil { + var ret string + return ret + } + + return o.Interconnect +} + +// GetInterconnectOk returns a tuple with the Interconnect field value +// and a boolean to check if the value has been set. +func (o *InstanceTypeConfiguration) GetInterconnectOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Interconnect, true +} + +// SetInterconnect sets field value +func (o *InstanceTypeConfiguration) SetInterconnect(v string) { + o.Interconnect = v +} + +// GetNvlink returns the Nvlink field value if set, zero value otherwise. +func (o *InstanceTypeConfiguration) GetNvlink() bool { + if o == nil || IsNil(o.Nvlink) { + var ret bool + return ret + } + return *o.Nvlink +} + +// GetNvlinkOk returns a tuple with the Nvlink field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstanceTypeConfiguration) GetNvlinkOk() (*bool, bool) { + if o == nil || IsNil(o.Nvlink) { + return nil, false + } + return o.Nvlink, true +} + +// HasNvlink returns a boolean if a field has been set. +func (o *InstanceTypeConfiguration) HasNvlink() bool { + if o != nil && !IsNil(o.Nvlink) { + return true + } + + return false +} + +// SetNvlink gets a reference to the given bool and assigns it to the Nvlink field. +func (o *InstanceTypeConfiguration) SetNvlink(v bool) { + o.Nvlink = &v +} + +// GetVramPerGpuInGb returns the VramPerGpuInGb field value +func (o *InstanceTypeConfiguration) GetVramPerGpuInGb() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.VramPerGpuInGb +} + +// GetVramPerGpuInGbOk returns a tuple with the VramPerGpuInGb field value +// and a boolean to check if the value has been set. +func (o *InstanceTypeConfiguration) GetVramPerGpuInGbOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.VramPerGpuInGb, true +} + +// SetVramPerGpuInGb sets field value +func (o *InstanceTypeConfiguration) SetVramPerGpuInGb(v int32) { + o.VramPerGpuInGb = v +} + +// GetOsOptions returns the OsOptions field value +func (o *InstanceTypeConfiguration) GetOsOptions() []string { + if o == nil { + var ret []string + return ret + } + + return o.OsOptions +} + +// GetOsOptionsOk returns a tuple with the OsOptions field value +// and a boolean to check if the value has been set. +func (o *InstanceTypeConfiguration) GetOsOptionsOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.OsOptions, true +} + +// SetOsOptions sets field value +func (o *InstanceTypeConfiguration) SetOsOptions(v []string) { + o.OsOptions = v +} + +func (o InstanceTypeConfiguration) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o InstanceTypeConfiguration) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["memory_in_gb"] = o.MemoryInGb + toSerialize["storage_in_gb"] = o.StorageInGb + toSerialize["vcpus"] = o.Vcpus + toSerialize["num_gpus"] = o.NumGpus + toSerialize["gpu_type"] = o.GpuType + toSerialize["interconnect"] = o.Interconnect + if !IsNil(o.Nvlink) { + toSerialize["nvlink"] = o.Nvlink + } + toSerialize["vram_per_gpu_in_gb"] = o.VramPerGpuInGb + toSerialize["os_options"] = o.OsOptions + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *InstanceTypeConfiguration) 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{ + "memory_in_gb", + "storage_in_gb", + "vcpus", + "num_gpus", + "gpu_type", + "interconnect", + "vram_per_gpu_in_gb", + "os_options", + } + + 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) + } + } + + varInstanceTypeConfiguration := _InstanceTypeConfiguration{} + + err = json.Unmarshal(data, &varInstanceTypeConfiguration) + + if err != nil { + return err + } + + *o = InstanceTypeConfiguration(varInstanceTypeConfiguration) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "memory_in_gb") + delete(additionalProperties, "storage_in_gb") + delete(additionalProperties, "vcpus") + delete(additionalProperties, "num_gpus") + delete(additionalProperties, "gpu_type") + delete(additionalProperties, "interconnect") + delete(additionalProperties, "nvlink") + delete(additionalProperties, "vram_per_gpu_in_gb") + delete(additionalProperties, "os_options") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableInstanceTypeConfiguration struct { + value *InstanceTypeConfiguration + isSet bool +} + +func (v NullableInstanceTypeConfiguration) Get() *InstanceTypeConfiguration { + return v.value +} + +func (v *NullableInstanceTypeConfiguration) Set(val *InstanceTypeConfiguration) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceTypeConfiguration) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceTypeConfiguration) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceTypeConfiguration(val *InstanceTypeConfiguration) *NullableInstanceTypeConfiguration { + return &NullableInstanceTypeConfiguration{value: val, isSet: true} +} + +func (v NullableInstanceTypeConfiguration) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceTypeConfiguration) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/shadeform/gen/shadeform/model_instance_types_response.go b/internal/shadeform/gen/shadeform/model_instance_types_response.go new file mode 100644 index 00000000..412c9f87 --- /dev/null +++ b/internal/shadeform/gen/shadeform/model_instance_types_response.go @@ -0,0 +1,167 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the InstanceTypesResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InstanceTypesResponse{} + +// InstanceTypesResponse Response of /instances/types +type InstanceTypesResponse struct { + InstanceTypes []InstanceType `json:"instance_types"` + AdditionalProperties map[string]interface{} +} + +type _InstanceTypesResponse InstanceTypesResponse + +// NewInstanceTypesResponse instantiates a new InstanceTypesResponse 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 NewInstanceTypesResponse(instanceTypes []InstanceType) *InstanceTypesResponse { + this := InstanceTypesResponse{} + this.InstanceTypes = instanceTypes + return &this +} + +// NewInstanceTypesResponseWithDefaults instantiates a new InstanceTypesResponse 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 NewInstanceTypesResponseWithDefaults() *InstanceTypesResponse { + this := InstanceTypesResponse{} + return &this +} + +// GetInstanceTypes returns the InstanceTypes field value +func (o *InstanceTypesResponse) GetInstanceTypes() []InstanceType { + if o == nil { + var ret []InstanceType + return ret + } + + return o.InstanceTypes +} + +// GetInstanceTypesOk returns a tuple with the InstanceTypes field value +// and a boolean to check if the value has been set. +func (o *InstanceTypesResponse) GetInstanceTypesOk() ([]InstanceType, bool) { + if o == nil { + return nil, false + } + return o.InstanceTypes, true +} + +// SetInstanceTypes sets field value +func (o *InstanceTypesResponse) SetInstanceTypes(v []InstanceType) { + o.InstanceTypes = v +} + +func (o InstanceTypesResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o InstanceTypesResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["instance_types"] = o.InstanceTypes + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *InstanceTypesResponse) 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{ + "instance_types", + } + + 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) + } + } + + varInstanceTypesResponse := _InstanceTypesResponse{} + + err = json.Unmarshal(data, &varInstanceTypesResponse) + + if err != nil { + return err + } + + *o = InstanceTypesResponse(varInstanceTypesResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "instance_types") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableInstanceTypesResponse struct { + value *InstanceTypesResponse + isSet bool +} + +func (v NullableInstanceTypesResponse) Get() *InstanceTypesResponse { + return v.value +} + +func (v *NullableInstanceTypesResponse) Set(val *InstanceTypesResponse) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceTypesResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceTypesResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceTypesResponse(val *InstanceTypesResponse) *NullableInstanceTypesResponse { + return &NullableInstanceTypesResponse{value: val, isSet: true} +} + +func (v NullableInstanceTypesResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceTypesResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/shadeform/gen/shadeform/model_instances_response.go b/internal/shadeform/gen/shadeform/model_instances_response.go new file mode 100644 index 00000000..94fe671d --- /dev/null +++ b/internal/shadeform/gen/shadeform/model_instances_response.go @@ -0,0 +1,167 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the InstancesResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InstancesResponse{} + +// InstancesResponse struct for InstancesResponse +type InstancesResponse struct { + Instances []Instance `json:"instances"` + AdditionalProperties map[string]interface{} +} + +type _InstancesResponse InstancesResponse + +// NewInstancesResponse instantiates a new InstancesResponse 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 NewInstancesResponse(instances []Instance) *InstancesResponse { + this := InstancesResponse{} + this.Instances = instances + return &this +} + +// NewInstancesResponseWithDefaults instantiates a new InstancesResponse 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 NewInstancesResponseWithDefaults() *InstancesResponse { + this := InstancesResponse{} + return &this +} + +// GetInstances returns the Instances field value +func (o *InstancesResponse) GetInstances() []Instance { + if o == nil { + var ret []Instance + return ret + } + + return o.Instances +} + +// GetInstancesOk returns a tuple with the Instances field value +// and a boolean to check if the value has been set. +func (o *InstancesResponse) GetInstancesOk() ([]Instance, bool) { + if o == nil { + return nil, false + } + return o.Instances, true +} + +// SetInstances sets field value +func (o *InstancesResponse) SetInstances(v []Instance) { + o.Instances = v +} + +func (o InstancesResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o InstancesResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["instances"] = o.Instances + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *InstancesResponse) 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{ + "instances", + } + + 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) + } + } + + varInstancesResponse := _InstancesResponse{} + + err = json.Unmarshal(data, &varInstancesResponse) + + if err != nil { + return err + } + + *o = InstancesResponse(varInstancesResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "instances") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableInstancesResponse struct { + value *InstancesResponse + isSet bool +} + +func (v NullableInstancesResponse) Get() *InstancesResponse { + return v.value +} + +func (v *NullableInstancesResponse) Set(val *InstancesResponse) { + v.value = val + v.isSet = true +} + +func (v NullableInstancesResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableInstancesResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstancesResponse(val *InstancesResponse) *NullableInstancesResponse { + return &NullableInstancesResponse{value: val, isSet: true} +} + +func (v NullableInstancesResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstancesResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/shadeform/gen/shadeform/model_launch_configuration.go b/internal/shadeform/gen/shadeform/model_launch_configuration.go new file mode 100644 index 00000000..0ef49a5c --- /dev/null +++ b/internal/shadeform/gen/shadeform/model_launch_configuration.go @@ -0,0 +1,242 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the LaunchConfiguration type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LaunchConfiguration{} + +// LaunchConfiguration Defines automatic actions after the instance becomes active. +type LaunchConfiguration struct { + // Specifies the type of launch configuration. See [Launch Configuration](/getting-started/concepts#launch-configuration) for more details. + Type string `json:"type"` + DockerConfiguration *DockerConfiguration `json:"docker_configuration,omitempty"` + ScriptConfiguration *ScriptConfiguration `json:"script_configuration,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _LaunchConfiguration LaunchConfiguration + +// NewLaunchConfiguration instantiates a new LaunchConfiguration 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 NewLaunchConfiguration(type_ string) *LaunchConfiguration { + this := LaunchConfiguration{} + this.Type = type_ + return &this +} + +// NewLaunchConfigurationWithDefaults instantiates a new LaunchConfiguration 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 NewLaunchConfigurationWithDefaults() *LaunchConfiguration { + this := LaunchConfiguration{} + return &this +} + +// GetType returns the Type field value +func (o *LaunchConfiguration) 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 *LaunchConfiguration) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *LaunchConfiguration) SetType(v string) { + o.Type = v +} + +// GetDockerConfiguration returns the DockerConfiguration field value if set, zero value otherwise. +func (o *LaunchConfiguration) GetDockerConfiguration() DockerConfiguration { + if o == nil || IsNil(o.DockerConfiguration) { + var ret DockerConfiguration + return ret + } + return *o.DockerConfiguration +} + +// GetDockerConfigurationOk returns a tuple with the DockerConfiguration field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LaunchConfiguration) GetDockerConfigurationOk() (*DockerConfiguration, bool) { + if o == nil || IsNil(o.DockerConfiguration) { + return nil, false + } + return o.DockerConfiguration, true +} + +// HasDockerConfiguration returns a boolean if a field has been set. +func (o *LaunchConfiguration) HasDockerConfiguration() bool { + if o != nil && !IsNil(o.DockerConfiguration) { + return true + } + + return false +} + +// SetDockerConfiguration gets a reference to the given DockerConfiguration and assigns it to the DockerConfiguration field. +func (o *LaunchConfiguration) SetDockerConfiguration(v DockerConfiguration) { + o.DockerConfiguration = &v +} + +// GetScriptConfiguration returns the ScriptConfiguration field value if set, zero value otherwise. +func (o *LaunchConfiguration) GetScriptConfiguration() ScriptConfiguration { + if o == nil || IsNil(o.ScriptConfiguration) { + var ret ScriptConfiguration + return ret + } + return *o.ScriptConfiguration +} + +// GetScriptConfigurationOk returns a tuple with the ScriptConfiguration field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LaunchConfiguration) GetScriptConfigurationOk() (*ScriptConfiguration, bool) { + if o == nil || IsNil(o.ScriptConfiguration) { + return nil, false + } + return o.ScriptConfiguration, true +} + +// HasScriptConfiguration returns a boolean if a field has been set. +func (o *LaunchConfiguration) HasScriptConfiguration() bool { + if o != nil && !IsNil(o.ScriptConfiguration) { + return true + } + + return false +} + +// SetScriptConfiguration gets a reference to the given ScriptConfiguration and assigns it to the ScriptConfiguration field. +func (o *LaunchConfiguration) SetScriptConfiguration(v ScriptConfiguration) { + o.ScriptConfiguration = &v +} + +func (o LaunchConfiguration) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o LaunchConfiguration) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["type"] = o.Type + if !IsNil(o.DockerConfiguration) { + toSerialize["docker_configuration"] = o.DockerConfiguration + } + if !IsNil(o.ScriptConfiguration) { + toSerialize["script_configuration"] = o.ScriptConfiguration + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *LaunchConfiguration) 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", + } + + 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) + } + } + + varLaunchConfiguration := _LaunchConfiguration{} + + err = json.Unmarshal(data, &varLaunchConfiguration) + + if err != nil { + return err + } + + *o = LaunchConfiguration(varLaunchConfiguration) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "type") + delete(additionalProperties, "docker_configuration") + delete(additionalProperties, "script_configuration") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableLaunchConfiguration struct { + value *LaunchConfiguration + isSet bool +} + +func (v NullableLaunchConfiguration) Get() *LaunchConfiguration { + return v.value +} + +func (v *NullableLaunchConfiguration) Set(val *LaunchConfiguration) { + v.value = val + v.isSet = true +} + +func (v NullableLaunchConfiguration) IsSet() bool { + return v.isSet +} + +func (v *NullableLaunchConfiguration) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLaunchConfiguration(val *LaunchConfiguration) *NullableLaunchConfiguration { + return &NullableLaunchConfiguration{value: val, isSet: true} +} + +func (v NullableLaunchConfiguration) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLaunchConfiguration) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/shadeform/gen/shadeform/model_networking.go b/internal/shadeform/gen/shadeform/model_networking.go new file mode 100644 index 00000000..cd60c8e9 --- /dev/null +++ b/internal/shadeform/gen/shadeform/model_networking.go @@ -0,0 +1,155 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the Networking type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Networking{} + +// Networking Network configuration including firewall rules +type Networking struct { + // List of UFW (Uncomplicated Firewall) rules + UfwRules []UfwRule `json:"ufw_rules,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Networking Networking + +// NewNetworking instantiates a new Networking 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 NewNetworking() *Networking { + this := Networking{} + return &this +} + +// NewNetworkingWithDefaults instantiates a new Networking 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 NewNetworkingWithDefaults() *Networking { + this := Networking{} + return &this +} + +// GetUfwRules returns the UfwRules field value if set, zero value otherwise. +func (o *Networking) GetUfwRules() []UfwRule { + if o == nil || IsNil(o.UfwRules) { + var ret []UfwRule + return ret + } + return o.UfwRules +} + +// GetUfwRulesOk returns a tuple with the UfwRules field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Networking) GetUfwRulesOk() ([]UfwRule, bool) { + if o == nil || IsNil(o.UfwRules) { + return nil, false + } + return o.UfwRules, true +} + +// HasUfwRules returns a boolean if a field has been set. +func (o *Networking) HasUfwRules() bool { + if o != nil && !IsNil(o.UfwRules) { + return true + } + + return false +} + +// SetUfwRules gets a reference to the given []UfwRule and assigns it to the UfwRules field. +func (o *Networking) SetUfwRules(v []UfwRule) { + o.UfwRules = v +} + +func (o Networking) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Networking) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.UfwRules) { + toSerialize["ufw_rules"] = o.UfwRules + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Networking) UnmarshalJSON(data []byte) (err error) { + varNetworking := _Networking{} + + err = json.Unmarshal(data, &varNetworking) + + if err != nil { + return err + } + + *o = Networking(varNetworking) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "ufw_rules") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableNetworking struct { + value *Networking + isSet bool +} + +func (v NullableNetworking) Get() *Networking { + return v.value +} + +func (v *NullableNetworking) Set(val *Networking) { + v.value = val + v.isSet = true +} + +func (v NullableNetworking) IsSet() bool { + return v.isSet +} + +func (v *NullableNetworking) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNetworking(val *Networking) *NullableNetworking { + return &NullableNetworking{value: val, isSet: true} +} + +func (v NullableNetworking) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNetworking) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/shadeform/gen/shadeform/model_port_mappings.go b/internal/shadeform/gen/shadeform/model_port_mappings.go new file mode 100644 index 00000000..a0469b36 --- /dev/null +++ b/internal/shadeform/gen/shadeform/model_port_mappings.go @@ -0,0 +1,198 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the PortMappings type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PortMappings{} + +// PortMappings Maps the public instance port to a port on the container. +type PortMappings struct { + // Port of the host. + HostPort int32 `json:"host_port"` + // Port of the container. + ContainerPort int32 `json:"container_port"` + AdditionalProperties map[string]interface{} +} + +type _PortMappings PortMappings + +// NewPortMappings instantiates a new PortMappings 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 NewPortMappings(hostPort int32, containerPort int32) *PortMappings { + this := PortMappings{} + this.HostPort = hostPort + this.ContainerPort = containerPort + return &this +} + +// NewPortMappingsWithDefaults instantiates a new PortMappings 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 NewPortMappingsWithDefaults() *PortMappings { + this := PortMappings{} + return &this +} + +// GetHostPort returns the HostPort field value +func (o *PortMappings) GetHostPort() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.HostPort +} + +// GetHostPortOk returns a tuple with the HostPort field value +// and a boolean to check if the value has been set. +func (o *PortMappings) GetHostPortOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.HostPort, true +} + +// SetHostPort sets field value +func (o *PortMappings) SetHostPort(v int32) { + o.HostPort = v +} + +// GetContainerPort returns the ContainerPort field value +func (o *PortMappings) GetContainerPort() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.ContainerPort +} + +// GetContainerPortOk returns a tuple with the ContainerPort field value +// and a boolean to check if the value has been set. +func (o *PortMappings) GetContainerPortOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.ContainerPort, true +} + +// SetContainerPort sets field value +func (o *PortMappings) SetContainerPort(v int32) { + o.ContainerPort = v +} + +func (o PortMappings) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PortMappings) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["host_port"] = o.HostPort + toSerialize["container_port"] = o.ContainerPort + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *PortMappings) 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{ + "host_port", + "container_port", + } + + 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) + } + } + + varPortMappings := _PortMappings{} + + err = json.Unmarshal(data, &varPortMappings) + + if err != nil { + return err + } + + *o = PortMappings(varPortMappings) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "host_port") + delete(additionalProperties, "container_port") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePortMappings struct { + value *PortMappings + isSet bool +} + +func (v NullablePortMappings) Get() *PortMappings { + return v.value +} + +func (v *NullablePortMappings) Set(val *PortMappings) { + v.value = val + v.isSet = true +} + +func (v NullablePortMappings) IsSet() bool { + return v.isSet +} + +func (v *NullablePortMappings) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePortMappings(val *PortMappings) *NullablePortMappings { + return &NullablePortMappings{value: val, isSet: true} +} + +func (v NullablePortMappings) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePortMappings) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/shadeform/gen/shadeform/model_registry_credentials.go b/internal/shadeform/gen/shadeform/model_registry_credentials.go new file mode 100644 index 00000000..d39a6b3e --- /dev/null +++ b/internal/shadeform/gen/shadeform/model_registry_credentials.go @@ -0,0 +1,193 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the RegistryCredentials type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RegistryCredentials{} + +// RegistryCredentials struct for RegistryCredentials +type RegistryCredentials struct { + // The username for the docker registry. + Username *string `json:"username,omitempty"` + // The password for the docker registry. + Password *string `json:"password,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _RegistryCredentials RegistryCredentials + +// NewRegistryCredentials instantiates a new RegistryCredentials 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 NewRegistryCredentials() *RegistryCredentials { + this := RegistryCredentials{} + return &this +} + +// NewRegistryCredentialsWithDefaults instantiates a new RegistryCredentials 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 NewRegistryCredentialsWithDefaults() *RegistryCredentials { + this := RegistryCredentials{} + return &this +} + +// GetUsername returns the Username field value if set, zero value otherwise. +func (o *RegistryCredentials) GetUsername() string { + if o == nil || IsNil(o.Username) { + var ret string + return ret + } + return *o.Username +} + +// GetUsernameOk returns a tuple with the Username field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RegistryCredentials) GetUsernameOk() (*string, bool) { + if o == nil || IsNil(o.Username) { + return nil, false + } + return o.Username, true +} + +// HasUsername returns a boolean if a field has been set. +func (o *RegistryCredentials) HasUsername() bool { + if o != nil && !IsNil(o.Username) { + return true + } + + return false +} + +// SetUsername gets a reference to the given string and assigns it to the Username field. +func (o *RegistryCredentials) SetUsername(v string) { + o.Username = &v +} + +// GetPassword returns the Password field value if set, zero value otherwise. +func (o *RegistryCredentials) GetPassword() string { + if o == nil || IsNil(o.Password) { + var ret string + return ret + } + return *o.Password +} + +// GetPasswordOk returns a tuple with the Password field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RegistryCredentials) GetPasswordOk() (*string, bool) { + if o == nil || IsNil(o.Password) { + return nil, false + } + return o.Password, true +} + +// HasPassword returns a boolean if a field has been set. +func (o *RegistryCredentials) HasPassword() bool { + if o != nil && !IsNil(o.Password) { + return true + } + + return false +} + +// SetPassword gets a reference to the given string and assigns it to the Password field. +func (o *RegistryCredentials) SetPassword(v string) { + o.Password = &v +} + +func (o RegistryCredentials) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RegistryCredentials) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Username) { + toSerialize["username"] = o.Username + } + if !IsNil(o.Password) { + toSerialize["password"] = o.Password + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *RegistryCredentials) UnmarshalJSON(data []byte) (err error) { + varRegistryCredentials := _RegistryCredentials{} + + err = json.Unmarshal(data, &varRegistryCredentials) + + if err != nil { + return err + } + + *o = RegistryCredentials(varRegistryCredentials) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "username") + delete(additionalProperties, "password") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableRegistryCredentials struct { + value *RegistryCredentials + isSet bool +} + +func (v NullableRegistryCredentials) Get() *RegistryCredentials { + return v.value +} + +func (v *NullableRegistryCredentials) Set(val *RegistryCredentials) { + v.value = val + v.isSet = true +} + +func (v NullableRegistryCredentials) IsSet() bool { + return v.isSet +} + +func (v *NullableRegistryCredentials) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRegistryCredentials(val *RegistryCredentials) *NullableRegistryCredentials { + return &NullableRegistryCredentials{value: val, isSet: true} +} + +func (v NullableRegistryCredentials) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRegistryCredentials) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/shadeform/gen/shadeform/model_script_configuration.go b/internal/shadeform/gen/shadeform/model_script_configuration.go new file mode 100644 index 00000000..eda0042c --- /dev/null +++ b/internal/shadeform/gen/shadeform/model_script_configuration.go @@ -0,0 +1,168 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the ScriptConfiguration type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ScriptConfiguration{} + +// ScriptConfiguration May only be used if launch_configuration.type is 'script'. Configures a startup script to be run automatically after the instance is active. See this [tutorial]/guides/startupscript) for examples. +type ScriptConfiguration struct { + // A startup script that is base64 encoded. + Base64Script string `json:"base64_script"` + AdditionalProperties map[string]interface{} +} + +type _ScriptConfiguration ScriptConfiguration + +// NewScriptConfiguration instantiates a new ScriptConfiguration 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 NewScriptConfiguration(base64Script string) *ScriptConfiguration { + this := ScriptConfiguration{} + this.Base64Script = base64Script + return &this +} + +// NewScriptConfigurationWithDefaults instantiates a new ScriptConfiguration 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 NewScriptConfigurationWithDefaults() *ScriptConfiguration { + this := ScriptConfiguration{} + return &this +} + +// GetBase64Script returns the Base64Script field value +func (o *ScriptConfiguration) GetBase64Script() string { + if o == nil { + var ret string + return ret + } + + return o.Base64Script +} + +// GetBase64ScriptOk returns a tuple with the Base64Script field value +// and a boolean to check if the value has been set. +func (o *ScriptConfiguration) GetBase64ScriptOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Base64Script, true +} + +// SetBase64Script sets field value +func (o *ScriptConfiguration) SetBase64Script(v string) { + o.Base64Script = v +} + +func (o ScriptConfiguration) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ScriptConfiguration) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["base64_script"] = o.Base64Script + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ScriptConfiguration) 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{ + "base64_script", + } + + 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) + } + } + + varScriptConfiguration := _ScriptConfiguration{} + + err = json.Unmarshal(data, &varScriptConfiguration) + + if err != nil { + return err + } + + *o = ScriptConfiguration(varScriptConfiguration) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "base64_script") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableScriptConfiguration struct { + value *ScriptConfiguration + isSet bool +} + +func (v NullableScriptConfiguration) Get() *ScriptConfiguration { + return v.value +} + +func (v *NullableScriptConfiguration) Set(val *ScriptConfiguration) { + v.value = val + v.isSet = true +} + +func (v NullableScriptConfiguration) IsSet() bool { + return v.isSet +} + +func (v *NullableScriptConfiguration) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableScriptConfiguration(val *ScriptConfiguration) *NullableScriptConfiguration { + return &NullableScriptConfiguration{value: val, isSet: true} +} + +func (v NullableScriptConfiguration) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableScriptConfiguration) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/shadeform/gen/shadeform/model_ssh_key.go b/internal/shadeform/gen/shadeform/model_ssh_key.go new file mode 100644 index 00000000..db25fedd --- /dev/null +++ b/internal/shadeform/gen/shadeform/model_ssh_key.go @@ -0,0 +1,258 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the SshKey type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SshKey{} + +// SshKey struct for SshKey +type SshKey struct { + // The ID of the SSH Key. + Id string `json:"id"` + // The name of the SSH Key. + Name string `json:"name"` + // The public key. + PublicKey string `json:"public_key"` + // Indicates the default key. + IsDefault bool `json:"is_default"` + AdditionalProperties map[string]interface{} +} + +type _SshKey SshKey + +// NewSshKey instantiates a new SshKey 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 NewSshKey(id string, name string, publicKey string, isDefault bool) *SshKey { + this := SshKey{} + this.Id = id + this.Name = name + this.PublicKey = publicKey + this.IsDefault = isDefault + return &this +} + +// NewSshKeyWithDefaults instantiates a new SshKey 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 NewSshKeyWithDefaults() *SshKey { + this := SshKey{} + return &this +} + +// GetId returns the Id field value +func (o *SshKey) 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 *SshKey) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *SshKey) SetId(v string) { + o.Id = v +} + +// GetName returns the Name field value +func (o *SshKey) 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 *SshKey) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *SshKey) SetName(v string) { + o.Name = v +} + +// GetPublicKey returns the PublicKey field value +func (o *SshKey) GetPublicKey() string { + if o == nil { + var ret string + return ret + } + + return o.PublicKey +} + +// GetPublicKeyOk returns a tuple with the PublicKey field value +// and a boolean to check if the value has been set. +func (o *SshKey) GetPublicKeyOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.PublicKey, true +} + +// SetPublicKey sets field value +func (o *SshKey) SetPublicKey(v string) { + o.PublicKey = v +} + +// GetIsDefault returns the IsDefault field value +func (o *SshKey) GetIsDefault() bool { + if o == nil { + var ret bool + return ret + } + + return o.IsDefault +} + +// GetIsDefaultOk returns a tuple with the IsDefault field value +// and a boolean to check if the value has been set. +func (o *SshKey) GetIsDefaultOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.IsDefault, true +} + +// SetIsDefault sets field value +func (o *SshKey) SetIsDefault(v bool) { + o.IsDefault = v +} + +func (o SshKey) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SshKey) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["name"] = o.Name + toSerialize["public_key"] = o.PublicKey + toSerialize["is_default"] = o.IsDefault + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *SshKey) 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", + "public_key", + "is_default", + } + + 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) + } + } + + varSshKey := _SshKey{} + + err = json.Unmarshal(data, &varSshKey) + + if err != nil { + return err + } + + *o = SshKey(varSshKey) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "name") + delete(additionalProperties, "public_key") + delete(additionalProperties, "is_default") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableSshKey struct { + value *SshKey + isSet bool +} + +func (v NullableSshKey) Get() *SshKey { + return v.value +} + +func (v *NullableSshKey) Set(val *SshKey) { + v.value = val + v.isSet = true +} + +func (v NullableSshKey) IsSet() bool { + return v.isSet +} + +func (v *NullableSshKey) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSshKey(val *SshKey) *NullableSshKey { + return &NullableSshKey{value: val, isSet: true} +} + +func (v NullableSshKey) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSshKey) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/shadeform/gen/shadeform/model_ssh_keys_response.go b/internal/shadeform/gen/shadeform/model_ssh_keys_response.go new file mode 100644 index 00000000..f608a765 --- /dev/null +++ b/internal/shadeform/gen/shadeform/model_ssh_keys_response.go @@ -0,0 +1,167 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the SshKeysResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SshKeysResponse{} + +// SshKeysResponse struct for SshKeysResponse +type SshKeysResponse struct { + SshKeys []SshKey `json:"ssh_keys"` + AdditionalProperties map[string]interface{} +} + +type _SshKeysResponse SshKeysResponse + +// NewSshKeysResponse instantiates a new SshKeysResponse 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 NewSshKeysResponse(sshKeys []SshKey) *SshKeysResponse { + this := SshKeysResponse{} + this.SshKeys = sshKeys + return &this +} + +// NewSshKeysResponseWithDefaults instantiates a new SshKeysResponse 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 NewSshKeysResponseWithDefaults() *SshKeysResponse { + this := SshKeysResponse{} + return &this +} + +// GetSshKeys returns the SshKeys field value +func (o *SshKeysResponse) GetSshKeys() []SshKey { + if o == nil { + var ret []SshKey + return ret + } + + return o.SshKeys +} + +// GetSshKeysOk returns a tuple with the SshKeys field value +// and a boolean to check if the value has been set. +func (o *SshKeysResponse) GetSshKeysOk() ([]SshKey, bool) { + if o == nil { + return nil, false + } + return o.SshKeys, true +} + +// SetSshKeys sets field value +func (o *SshKeysResponse) SetSshKeys(v []SshKey) { + o.SshKeys = v +} + +func (o SshKeysResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SshKeysResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["ssh_keys"] = o.SshKeys + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *SshKeysResponse) 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{ + "ssh_keys", + } + + 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) + } + } + + varSshKeysResponse := _SshKeysResponse{} + + err = json.Unmarshal(data, &varSshKeysResponse) + + if err != nil { + return err + } + + *o = SshKeysResponse(varSshKeysResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "ssh_keys") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableSshKeysResponse struct { + value *SshKeysResponse + isSet bool +} + +func (v NullableSshKeysResponse) Get() *SshKeysResponse { + return v.value +} + +func (v *NullableSshKeysResponse) Set(val *SshKeysResponse) { + v.value = val + v.isSet = true +} + +func (v NullableSshKeysResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableSshKeysResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSshKeysResponse(val *SshKeysResponse) *NullableSshKeysResponse { + return &NullableSshKeysResponse{value: val, isSet: true} +} + +func (v NullableSshKeysResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSshKeysResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/shadeform/gen/shadeform/model_status.go b/internal/shadeform/gen/shadeform/model_status.go new file mode 100644 index 00000000..a39c8452 --- /dev/null +++ b/internal/shadeform/gen/shadeform/model_status.go @@ -0,0 +1,117 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// Status The status of the instance. +type Status string + +// List of Status +const ( + CREATING Status = "creating" + PENDING_PROVIDER Status = "pending_provider" + PENDING Status = "pending" + ACTIVE Status = "active" + DELETED Status = "deleted" +) + +// All allowed values of Status enum +var AllowedStatusEnumValues = []Status{ + "creating", + "pending_provider", + "pending", + "active", + "deleted", +} + +func (v *Status) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := Status(value) + for _, existing := range AllowedStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Status", value) +} + +// NewStatusFromValue returns a pointer to a valid Status +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewStatusFromValue(v string) (*Status, error) { + ev := Status(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for Status: valid values are %v", v, AllowedStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v Status) IsValid() bool { + for _, existing := range AllowedStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to Status value +func (v Status) Ptr() *Status { + return &v +} + +type NullableStatus struct { + value *Status + isSet bool +} + +func (v NullableStatus) Get() *Status { + return v.value +} + +func (v *NullableStatus) Set(val *Status) { + v.value = val + v.isSet = true +} + +func (v NullableStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableStatus(val *Status) *NullableStatus { + return &NullableStatus{value: val, isSet: true} +} + +func (v NullableStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/shadeform/gen/shadeform/model_template.go b/internal/shadeform/gen/shadeform/model_template.go new file mode 100644 index 00000000..b9c27aa8 --- /dev/null +++ b/internal/shadeform/gen/shadeform/model_template.go @@ -0,0 +1,611 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the Template type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Template{} + +// Template struct for Template +type Template struct { + // Unique identifier for the template, generated by Shadeform + Id string `json:"id"` + // Name of the template + Name string `json:"name"` + // Description of the template + Description *string `json:"description,omitempty"` + // Author of the template + Author *string `json:"author,omitempty"` + // URL to the template's logo + Logo *string `json:"logo,omitempty"` + // Whether the template is publicly available + Public *bool `json:"public,omitempty"` + LaunchConfiguration *LaunchConfiguration `json:"launch_configuration,omitempty"` + AutoDelete *AutoDelete `json:"auto_delete,omitempty"` + Alert *Alert `json:"alert,omitempty"` + VolumeMount *VolumeMount `json:"volume_mount,omitempty"` + // Add custom, searchable tags to instances. + Tags []string `json:"tags,omitempty"` + // List of environment variable name and values to automatically add to the instance + Envs []Env `json:"envs,omitempty"` + Networking *Networking `json:"networking,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Template Template + +// NewTemplate instantiates a new Template 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 NewTemplate(id string, name string) *Template { + this := Template{} + this.Id = id + this.Name = name + return &this +} + +// NewTemplateWithDefaults instantiates a new Template 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 NewTemplateWithDefaults() *Template { + this := Template{} + return &this +} + +// GetId returns the Id field value +func (o *Template) 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 *Template) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *Template) SetId(v string) { + o.Id = v +} + +// GetName returns the Name field value +func (o *Template) 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 *Template) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *Template) SetName(v string) { + o.Name = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *Template) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Template) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *Template) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *Template) SetDescription(v string) { + o.Description = &v +} + +// GetAuthor returns the Author field value if set, zero value otherwise. +func (o *Template) GetAuthor() string { + if o == nil || IsNil(o.Author) { + var ret string + return ret + } + return *o.Author +} + +// GetAuthorOk returns a tuple with the Author field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Template) GetAuthorOk() (*string, bool) { + if o == nil || IsNil(o.Author) { + return nil, false + } + return o.Author, true +} + +// HasAuthor returns a boolean if a field has been set. +func (o *Template) HasAuthor() bool { + if o != nil && !IsNil(o.Author) { + return true + } + + return false +} + +// SetAuthor gets a reference to the given string and assigns it to the Author field. +func (o *Template) SetAuthor(v string) { + o.Author = &v +} + +// GetLogo returns the Logo field value if set, zero value otherwise. +func (o *Template) GetLogo() string { + if o == nil || IsNil(o.Logo) { + var ret string + return ret + } + return *o.Logo +} + +// GetLogoOk returns a tuple with the Logo field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Template) GetLogoOk() (*string, bool) { + if o == nil || IsNil(o.Logo) { + return nil, false + } + return o.Logo, true +} + +// HasLogo returns a boolean if a field has been set. +func (o *Template) HasLogo() bool { + if o != nil && !IsNil(o.Logo) { + return true + } + + return false +} + +// SetLogo gets a reference to the given string and assigns it to the Logo field. +func (o *Template) SetLogo(v string) { + o.Logo = &v +} + +// GetPublic returns the Public field value if set, zero value otherwise. +func (o *Template) GetPublic() bool { + if o == nil || IsNil(o.Public) { + var ret bool + return ret + } + return *o.Public +} + +// GetPublicOk returns a tuple with the Public field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Template) GetPublicOk() (*bool, bool) { + if o == nil || IsNil(o.Public) { + return nil, false + } + return o.Public, true +} + +// HasPublic returns a boolean if a field has been set. +func (o *Template) HasPublic() bool { + if o != nil && !IsNil(o.Public) { + return true + } + + return false +} + +// SetPublic gets a reference to the given bool and assigns it to the Public field. +func (o *Template) SetPublic(v bool) { + o.Public = &v +} + +// GetLaunchConfiguration returns the LaunchConfiguration field value if set, zero value otherwise. +func (o *Template) GetLaunchConfiguration() LaunchConfiguration { + if o == nil || IsNil(o.LaunchConfiguration) { + var ret LaunchConfiguration + return ret + } + return *o.LaunchConfiguration +} + +// GetLaunchConfigurationOk returns a tuple with the LaunchConfiguration field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Template) GetLaunchConfigurationOk() (*LaunchConfiguration, bool) { + if o == nil || IsNil(o.LaunchConfiguration) { + return nil, false + } + return o.LaunchConfiguration, true +} + +// HasLaunchConfiguration returns a boolean if a field has been set. +func (o *Template) HasLaunchConfiguration() bool { + if o != nil && !IsNil(o.LaunchConfiguration) { + return true + } + + return false +} + +// SetLaunchConfiguration gets a reference to the given LaunchConfiguration and assigns it to the LaunchConfiguration field. +func (o *Template) SetLaunchConfiguration(v LaunchConfiguration) { + o.LaunchConfiguration = &v +} + +// GetAutoDelete returns the AutoDelete field value if set, zero value otherwise. +func (o *Template) GetAutoDelete() AutoDelete { + if o == nil || IsNil(o.AutoDelete) { + var ret AutoDelete + return ret + } + return *o.AutoDelete +} + +// GetAutoDeleteOk returns a tuple with the AutoDelete field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Template) GetAutoDeleteOk() (*AutoDelete, bool) { + if o == nil || IsNil(o.AutoDelete) { + return nil, false + } + return o.AutoDelete, true +} + +// HasAutoDelete returns a boolean if a field has been set. +func (o *Template) HasAutoDelete() bool { + if o != nil && !IsNil(o.AutoDelete) { + return true + } + + return false +} + +// SetAutoDelete gets a reference to the given AutoDelete and assigns it to the AutoDelete field. +func (o *Template) SetAutoDelete(v AutoDelete) { + o.AutoDelete = &v +} + +// GetAlert returns the Alert field value if set, zero value otherwise. +func (o *Template) GetAlert() Alert { + if o == nil || IsNil(o.Alert) { + var ret Alert + return ret + } + return *o.Alert +} + +// GetAlertOk returns a tuple with the Alert field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Template) GetAlertOk() (*Alert, bool) { + if o == nil || IsNil(o.Alert) { + return nil, false + } + return o.Alert, true +} + +// HasAlert returns a boolean if a field has been set. +func (o *Template) HasAlert() bool { + if o != nil && !IsNil(o.Alert) { + return true + } + + return false +} + +// SetAlert gets a reference to the given Alert and assigns it to the Alert field. +func (o *Template) SetAlert(v Alert) { + o.Alert = &v +} + +// GetVolumeMount returns the VolumeMount field value if set, zero value otherwise. +func (o *Template) GetVolumeMount() VolumeMount { + if o == nil || IsNil(o.VolumeMount) { + var ret VolumeMount + return ret + } + return *o.VolumeMount +} + +// GetVolumeMountOk returns a tuple with the VolumeMount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Template) GetVolumeMountOk() (*VolumeMount, bool) { + if o == nil || IsNil(o.VolumeMount) { + return nil, false + } + return o.VolumeMount, true +} + +// HasVolumeMount returns a boolean if a field has been set. +func (o *Template) HasVolumeMount() bool { + if o != nil && !IsNil(o.VolumeMount) { + return true + } + + return false +} + +// SetVolumeMount gets a reference to the given VolumeMount and assigns it to the VolumeMount field. +func (o *Template) SetVolumeMount(v VolumeMount) { + o.VolumeMount = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *Template) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []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 *Template) GetTagsOk() ([]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 *Template) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *Template) SetTags(v []string) { + o.Tags = v +} + +// GetEnvs returns the Envs field value if set, zero value otherwise. +func (o *Template) GetEnvs() []Env { + if o == nil || IsNil(o.Envs) { + var ret []Env + return ret + } + return o.Envs +} + +// GetEnvsOk returns a tuple with the Envs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Template) GetEnvsOk() ([]Env, bool) { + if o == nil || IsNil(o.Envs) { + return nil, false + } + return o.Envs, true +} + +// HasEnvs returns a boolean if a field has been set. +func (o *Template) HasEnvs() bool { + if o != nil && !IsNil(o.Envs) { + return true + } + + return false +} + +// SetEnvs gets a reference to the given []Env and assigns it to the Envs field. +func (o *Template) SetEnvs(v []Env) { + o.Envs = v +} + +// GetNetworking returns the Networking field value if set, zero value otherwise. +func (o *Template) GetNetworking() Networking { + if o == nil || IsNil(o.Networking) { + var ret Networking + return ret + } + return *o.Networking +} + +// GetNetworkingOk returns a tuple with the Networking field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Template) GetNetworkingOk() (*Networking, bool) { + if o == nil || IsNil(o.Networking) { + return nil, false + } + return o.Networking, true +} + +// HasNetworking returns a boolean if a field has been set. +func (o *Template) HasNetworking() bool { + if o != nil && !IsNil(o.Networking) { + return true + } + + return false +} + +// SetNetworking gets a reference to the given Networking and assigns it to the Networking field. +func (o *Template) SetNetworking(v Networking) { + o.Networking = &v +} + +func (o Template) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Template) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["name"] = o.Name + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Author) { + toSerialize["author"] = o.Author + } + if !IsNil(o.Logo) { + toSerialize["logo"] = o.Logo + } + if !IsNil(o.Public) { + toSerialize["public"] = o.Public + } + if !IsNil(o.LaunchConfiguration) { + toSerialize["launch_configuration"] = o.LaunchConfiguration + } + if !IsNil(o.AutoDelete) { + toSerialize["auto_delete"] = o.AutoDelete + } + if !IsNil(o.Alert) { + toSerialize["alert"] = o.Alert + } + if !IsNil(o.VolumeMount) { + toSerialize["volume_mount"] = o.VolumeMount + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + if !IsNil(o.Envs) { + toSerialize["envs"] = o.Envs + } + if !IsNil(o.Networking) { + toSerialize["networking"] = o.Networking + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Template) 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", + } + + 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) + } + } + + varTemplate := _Template{} + + err = json.Unmarshal(data, &varTemplate) + + if err != nil { + return err + } + + *o = Template(varTemplate) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "name") + delete(additionalProperties, "description") + delete(additionalProperties, "author") + delete(additionalProperties, "logo") + delete(additionalProperties, "public") + delete(additionalProperties, "launch_configuration") + delete(additionalProperties, "auto_delete") + delete(additionalProperties, "alert") + delete(additionalProperties, "volume_mount") + delete(additionalProperties, "tags") + delete(additionalProperties, "envs") + delete(additionalProperties, "networking") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableTemplate struct { + value *Template + isSet bool +} + +func (v NullableTemplate) Get() *Template { + return v.value +} + +func (v *NullableTemplate) Set(val *Template) { + v.value = val + v.isSet = true +} + +func (v NullableTemplate) IsSet() bool { + return v.isSet +} + +func (v *NullableTemplate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTemplate(val *Template) *NullableTemplate { + return &NullableTemplate{value: val, isSet: true} +} + +func (v NullableTemplate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTemplate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/shadeform/gen/shadeform/model_template_create_response.go b/internal/shadeform/gen/shadeform/model_template_create_response.go new file mode 100644 index 00000000..fed61d34 --- /dev/null +++ b/internal/shadeform/gen/shadeform/model_template_create_response.go @@ -0,0 +1,168 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the TemplateCreateResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TemplateCreateResponse{} + +// TemplateCreateResponse Response of the /templates/save API call +type TemplateCreateResponse struct { + // The unique identifier for the instance. Used in the instances for the /instances/{id}/info and /instances/{id}/delete APIs. + Id string `json:"id"` + AdditionalProperties map[string]interface{} +} + +type _TemplateCreateResponse TemplateCreateResponse + +// NewTemplateCreateResponse instantiates a new TemplateCreateResponse 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 NewTemplateCreateResponse(id string) *TemplateCreateResponse { + this := TemplateCreateResponse{} + this.Id = id + return &this +} + +// NewTemplateCreateResponseWithDefaults instantiates a new TemplateCreateResponse 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 NewTemplateCreateResponseWithDefaults() *TemplateCreateResponse { + this := TemplateCreateResponse{} + return &this +} + +// GetId returns the Id field value +func (o *TemplateCreateResponse) 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 *TemplateCreateResponse) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *TemplateCreateResponse) SetId(v string) { + o.Id = v +} + +func (o TemplateCreateResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TemplateCreateResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *TemplateCreateResponse) 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", + } + + 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) + } + } + + varTemplateCreateResponse := _TemplateCreateResponse{} + + err = json.Unmarshal(data, &varTemplateCreateResponse) + + if err != nil { + return err + } + + *o = TemplateCreateResponse(varTemplateCreateResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableTemplateCreateResponse struct { + value *TemplateCreateResponse + isSet bool +} + +func (v NullableTemplateCreateResponse) Get() *TemplateCreateResponse { + return v.value +} + +func (v *NullableTemplateCreateResponse) Set(val *TemplateCreateResponse) { + v.value = val + v.isSet = true +} + +func (v NullableTemplateCreateResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableTemplateCreateResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTemplateCreateResponse(val *TemplateCreateResponse) *NullableTemplateCreateResponse { + return &NullableTemplateCreateResponse{value: val, isSet: true} +} + +func (v NullableTemplateCreateResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTemplateCreateResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/shadeform/gen/shadeform/model_template_save_request.go b/internal/shadeform/gen/shadeform/model_template_save_request.go new file mode 100644 index 00000000..a4f548d1 --- /dev/null +++ b/internal/shadeform/gen/shadeform/model_template_save_request.go @@ -0,0 +1,505 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the TemplateSaveRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TemplateSaveRequest{} + +// TemplateSaveRequest struct for TemplateSaveRequest +type TemplateSaveRequest struct { + // Name of the template + Name string `json:"name"` + // Description of the template + Description *string `json:"description,omitempty"` + // Whether the template is publicly available + Public *bool `json:"public,omitempty"` + LaunchConfiguration *LaunchConfiguration `json:"launch_configuration,omitempty"` + AutoDelete *AutoDelete `json:"auto_delete,omitempty"` + Alert *Alert `json:"alert,omitempty"` + VolumeMount *VolumeMount `json:"volume_mount,omitempty"` + // Tags associated with the template + Tags []string `json:"tags,omitempty"` + // Environment variables for the template + Envs []Env `json:"envs,omitempty"` + Networking *Networking `json:"networking,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _TemplateSaveRequest TemplateSaveRequest + +// NewTemplateSaveRequest instantiates a new TemplateSaveRequest 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 NewTemplateSaveRequest(name string) *TemplateSaveRequest { + this := TemplateSaveRequest{} + this.Name = name + return &this +} + +// NewTemplateSaveRequestWithDefaults instantiates a new TemplateSaveRequest 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 NewTemplateSaveRequestWithDefaults() *TemplateSaveRequest { + this := TemplateSaveRequest{} + return &this +} + +// GetName returns the Name field value +func (o *TemplateSaveRequest) 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 *TemplateSaveRequest) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *TemplateSaveRequest) SetName(v string) { + o.Name = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *TemplateSaveRequest) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TemplateSaveRequest) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *TemplateSaveRequest) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *TemplateSaveRequest) SetDescription(v string) { + o.Description = &v +} + +// GetPublic returns the Public field value if set, zero value otherwise. +func (o *TemplateSaveRequest) GetPublic() bool { + if o == nil || IsNil(o.Public) { + var ret bool + return ret + } + return *o.Public +} + +// GetPublicOk returns a tuple with the Public field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TemplateSaveRequest) GetPublicOk() (*bool, bool) { + if o == nil || IsNil(o.Public) { + return nil, false + } + return o.Public, true +} + +// HasPublic returns a boolean if a field has been set. +func (o *TemplateSaveRequest) HasPublic() bool { + if o != nil && !IsNil(o.Public) { + return true + } + + return false +} + +// SetPublic gets a reference to the given bool and assigns it to the Public field. +func (o *TemplateSaveRequest) SetPublic(v bool) { + o.Public = &v +} + +// GetLaunchConfiguration returns the LaunchConfiguration field value if set, zero value otherwise. +func (o *TemplateSaveRequest) GetLaunchConfiguration() LaunchConfiguration { + if o == nil || IsNil(o.LaunchConfiguration) { + var ret LaunchConfiguration + return ret + } + return *o.LaunchConfiguration +} + +// GetLaunchConfigurationOk returns a tuple with the LaunchConfiguration field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TemplateSaveRequest) GetLaunchConfigurationOk() (*LaunchConfiguration, bool) { + if o == nil || IsNil(o.LaunchConfiguration) { + return nil, false + } + return o.LaunchConfiguration, true +} + +// HasLaunchConfiguration returns a boolean if a field has been set. +func (o *TemplateSaveRequest) HasLaunchConfiguration() bool { + if o != nil && !IsNil(o.LaunchConfiguration) { + return true + } + + return false +} + +// SetLaunchConfiguration gets a reference to the given LaunchConfiguration and assigns it to the LaunchConfiguration field. +func (o *TemplateSaveRequest) SetLaunchConfiguration(v LaunchConfiguration) { + o.LaunchConfiguration = &v +} + +// GetAutoDelete returns the AutoDelete field value if set, zero value otherwise. +func (o *TemplateSaveRequest) GetAutoDelete() AutoDelete { + if o == nil || IsNil(o.AutoDelete) { + var ret AutoDelete + return ret + } + return *o.AutoDelete +} + +// GetAutoDeleteOk returns a tuple with the AutoDelete field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TemplateSaveRequest) GetAutoDeleteOk() (*AutoDelete, bool) { + if o == nil || IsNil(o.AutoDelete) { + return nil, false + } + return o.AutoDelete, true +} + +// HasAutoDelete returns a boolean if a field has been set. +func (o *TemplateSaveRequest) HasAutoDelete() bool { + if o != nil && !IsNil(o.AutoDelete) { + return true + } + + return false +} + +// SetAutoDelete gets a reference to the given AutoDelete and assigns it to the AutoDelete field. +func (o *TemplateSaveRequest) SetAutoDelete(v AutoDelete) { + o.AutoDelete = &v +} + +// GetAlert returns the Alert field value if set, zero value otherwise. +func (o *TemplateSaveRequest) GetAlert() Alert { + if o == nil || IsNil(o.Alert) { + var ret Alert + return ret + } + return *o.Alert +} + +// GetAlertOk returns a tuple with the Alert field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TemplateSaveRequest) GetAlertOk() (*Alert, bool) { + if o == nil || IsNil(o.Alert) { + return nil, false + } + return o.Alert, true +} + +// HasAlert returns a boolean if a field has been set. +func (o *TemplateSaveRequest) HasAlert() bool { + if o != nil && !IsNil(o.Alert) { + return true + } + + return false +} + +// SetAlert gets a reference to the given Alert and assigns it to the Alert field. +func (o *TemplateSaveRequest) SetAlert(v Alert) { + o.Alert = &v +} + +// GetVolumeMount returns the VolumeMount field value if set, zero value otherwise. +func (o *TemplateSaveRequest) GetVolumeMount() VolumeMount { + if o == nil || IsNil(o.VolumeMount) { + var ret VolumeMount + return ret + } + return *o.VolumeMount +} + +// GetVolumeMountOk returns a tuple with the VolumeMount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TemplateSaveRequest) GetVolumeMountOk() (*VolumeMount, bool) { + if o == nil || IsNil(o.VolumeMount) { + return nil, false + } + return o.VolumeMount, true +} + +// HasVolumeMount returns a boolean if a field has been set. +func (o *TemplateSaveRequest) HasVolumeMount() bool { + if o != nil && !IsNil(o.VolumeMount) { + return true + } + + return false +} + +// SetVolumeMount gets a reference to the given VolumeMount and assigns it to the VolumeMount field. +func (o *TemplateSaveRequest) SetVolumeMount(v VolumeMount) { + o.VolumeMount = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *TemplateSaveRequest) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []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 *TemplateSaveRequest) GetTagsOk() ([]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 *TemplateSaveRequest) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *TemplateSaveRequest) SetTags(v []string) { + o.Tags = v +} + +// GetEnvs returns the Envs field value if set, zero value otherwise. +func (o *TemplateSaveRequest) GetEnvs() []Env { + if o == nil || IsNil(o.Envs) { + var ret []Env + return ret + } + return o.Envs +} + +// GetEnvsOk returns a tuple with the Envs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TemplateSaveRequest) GetEnvsOk() ([]Env, bool) { + if o == nil || IsNil(o.Envs) { + return nil, false + } + return o.Envs, true +} + +// HasEnvs returns a boolean if a field has been set. +func (o *TemplateSaveRequest) HasEnvs() bool { + if o != nil && !IsNil(o.Envs) { + return true + } + + return false +} + +// SetEnvs gets a reference to the given []Env and assigns it to the Envs field. +func (o *TemplateSaveRequest) SetEnvs(v []Env) { + o.Envs = v +} + +// GetNetworking returns the Networking field value if set, zero value otherwise. +func (o *TemplateSaveRequest) GetNetworking() Networking { + if o == nil || IsNil(o.Networking) { + var ret Networking + return ret + } + return *o.Networking +} + +// GetNetworkingOk returns a tuple with the Networking field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TemplateSaveRequest) GetNetworkingOk() (*Networking, bool) { + if o == nil || IsNil(o.Networking) { + return nil, false + } + return o.Networking, true +} + +// HasNetworking returns a boolean if a field has been set. +func (o *TemplateSaveRequest) HasNetworking() bool { + if o != nil && !IsNil(o.Networking) { + return true + } + + return false +} + +// SetNetworking gets a reference to the given Networking and assigns it to the Networking field. +func (o *TemplateSaveRequest) SetNetworking(v Networking) { + o.Networking = &v +} + +func (o TemplateSaveRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TemplateSaveRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Public) { + toSerialize["public"] = o.Public + } + if !IsNil(o.LaunchConfiguration) { + toSerialize["launch_configuration"] = o.LaunchConfiguration + } + if !IsNil(o.AutoDelete) { + toSerialize["auto_delete"] = o.AutoDelete + } + if !IsNil(o.Alert) { + toSerialize["alert"] = o.Alert + } + if !IsNil(o.VolumeMount) { + toSerialize["volume_mount"] = o.VolumeMount + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + if !IsNil(o.Envs) { + toSerialize["envs"] = o.Envs + } + if !IsNil(o.Networking) { + toSerialize["networking"] = o.Networking + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *TemplateSaveRequest) 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) + } + } + + varTemplateSaveRequest := _TemplateSaveRequest{} + + err = json.Unmarshal(data, &varTemplateSaveRequest) + + if err != nil { + return err + } + + *o = TemplateSaveRequest(varTemplateSaveRequest) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "description") + delete(additionalProperties, "public") + delete(additionalProperties, "launch_configuration") + delete(additionalProperties, "auto_delete") + delete(additionalProperties, "alert") + delete(additionalProperties, "volume_mount") + delete(additionalProperties, "tags") + delete(additionalProperties, "envs") + delete(additionalProperties, "networking") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableTemplateSaveRequest struct { + value *TemplateSaveRequest + isSet bool +} + +func (v NullableTemplateSaveRequest) Get() *TemplateSaveRequest { + return v.value +} + +func (v *NullableTemplateSaveRequest) Set(val *TemplateSaveRequest) { + v.value = val + v.isSet = true +} + +func (v NullableTemplateSaveRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableTemplateSaveRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTemplateSaveRequest(val *TemplateSaveRequest) *NullableTemplateSaveRequest { + return &NullableTemplateSaveRequest{value: val, isSet: true} +} + +func (v NullableTemplateSaveRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTemplateSaveRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/shadeform/gen/shadeform/model_templates_response.go b/internal/shadeform/gen/shadeform/model_templates_response.go new file mode 100644 index 00000000..ff1aaead --- /dev/null +++ b/internal/shadeform/gen/shadeform/model_templates_response.go @@ -0,0 +1,167 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the TemplatesResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TemplatesResponse{} + +// TemplatesResponse struct for TemplatesResponse +type TemplatesResponse struct { + Templates []Template `json:"templates"` + AdditionalProperties map[string]interface{} +} + +type _TemplatesResponse TemplatesResponse + +// NewTemplatesResponse instantiates a new TemplatesResponse 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 NewTemplatesResponse(templates []Template) *TemplatesResponse { + this := TemplatesResponse{} + this.Templates = templates + return &this +} + +// NewTemplatesResponseWithDefaults instantiates a new TemplatesResponse 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 NewTemplatesResponseWithDefaults() *TemplatesResponse { + this := TemplatesResponse{} + return &this +} + +// GetTemplates returns the Templates field value +func (o *TemplatesResponse) GetTemplates() []Template { + if o == nil { + var ret []Template + return ret + } + + return o.Templates +} + +// GetTemplatesOk returns a tuple with the Templates field value +// and a boolean to check if the value has been set. +func (o *TemplatesResponse) GetTemplatesOk() ([]Template, bool) { + if o == nil { + return nil, false + } + return o.Templates, true +} + +// SetTemplates sets field value +func (o *TemplatesResponse) SetTemplates(v []Template) { + o.Templates = v +} + +func (o TemplatesResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TemplatesResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["templates"] = o.Templates + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *TemplatesResponse) 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{ + "templates", + } + + 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) + } + } + + varTemplatesResponse := _TemplatesResponse{} + + err = json.Unmarshal(data, &varTemplatesResponse) + + if err != nil { + return err + } + + *o = TemplatesResponse(varTemplatesResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "templates") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableTemplatesResponse struct { + value *TemplatesResponse + isSet bool +} + +func (v NullableTemplatesResponse) Get() *TemplatesResponse { + return v.value +} + +func (v *NullableTemplatesResponse) Set(val *TemplatesResponse) { + v.value = val + v.isSet = true +} + +func (v NullableTemplatesResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableTemplatesResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTemplatesResponse(val *TemplatesResponse) *NullableTemplatesResponse { + return &NullableTemplatesResponse{value: val, isSet: true} +} + +func (v NullableTemplatesResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTemplatesResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/shadeform/gen/shadeform/model_ufw_rule.go b/internal/shadeform/gen/shadeform/model_ufw_rule.go new file mode 100644 index 00000000..3db76844 --- /dev/null +++ b/internal/shadeform/gen/shadeform/model_ufw_rule.go @@ -0,0 +1,351 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the UfwRule type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UfwRule{} + +// UfwRule Uncomplicated Firewall rule configuration +type UfwRule struct { + // The UFW rule action + Rule *string `json:"rule,omitempty"` + // Source IP address or CIDR range + FromIp NullableString `json:"from_ip,omitempty"` + // Destination IP address or CIDR range + ToIp NullableString `json:"to_ip,omitempty"` + // Port number or range (e.g. '80' or '8000:8999') + Port NullableString `json:"port,omitempty"` + // Protocol (e.g. tcp, udp) + Proto NullableString `json:"proto,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _UfwRule UfwRule + +// NewUfwRule instantiates a new UfwRule 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 NewUfwRule() *UfwRule { + this := UfwRule{} + return &this +} + +// NewUfwRuleWithDefaults instantiates a new UfwRule 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 NewUfwRuleWithDefaults() *UfwRule { + this := UfwRule{} + return &this +} + +// GetRule returns the Rule field value if set, zero value otherwise. +func (o *UfwRule) GetRule() string { + if o == nil || IsNil(o.Rule) { + var ret string + return ret + } + return *o.Rule +} + +// GetRuleOk returns a tuple with the Rule field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UfwRule) GetRuleOk() (*string, bool) { + if o == nil || IsNil(o.Rule) { + return nil, false + } + return o.Rule, true +} + +// HasRule returns a boolean if a field has been set. +func (o *UfwRule) HasRule() bool { + if o != nil && !IsNil(o.Rule) { + return true + } + + return false +} + +// SetRule gets a reference to the given string and assigns it to the Rule field. +func (o *UfwRule) SetRule(v string) { + o.Rule = &v +} + +// GetFromIp returns the FromIp field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UfwRule) GetFromIp() string { + if o == nil || IsNil(o.FromIp.Get()) { + var ret string + return ret + } + return *o.FromIp.Get() +} + +// GetFromIpOk returns a tuple with the FromIp 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 *UfwRule) GetFromIpOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.FromIp.Get(), o.FromIp.IsSet() +} + +// HasFromIp returns a boolean if a field has been set. +func (o *UfwRule) HasFromIp() bool { + if o != nil && o.FromIp.IsSet() { + return true + } + + return false +} + +// SetFromIp gets a reference to the given NullableString and assigns it to the FromIp field. +func (o *UfwRule) SetFromIp(v string) { + o.FromIp.Set(&v) +} + +// SetFromIpNil sets the value for FromIp to be an explicit nil +func (o *UfwRule) SetFromIpNil() { + o.FromIp.Set(nil) +} + +// UnsetFromIp ensures that no value is present for FromIp, not even an explicit nil +func (o *UfwRule) UnsetFromIp() { + o.FromIp.Unset() +} + +// GetToIp returns the ToIp field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UfwRule) GetToIp() string { + if o == nil || IsNil(o.ToIp.Get()) { + var ret string + return ret + } + return *o.ToIp.Get() +} + +// GetToIpOk returns a tuple with the ToIp 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 *UfwRule) GetToIpOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.ToIp.Get(), o.ToIp.IsSet() +} + +// HasToIp returns a boolean if a field has been set. +func (o *UfwRule) HasToIp() bool { + if o != nil && o.ToIp.IsSet() { + return true + } + + return false +} + +// SetToIp gets a reference to the given NullableString and assigns it to the ToIp field. +func (o *UfwRule) SetToIp(v string) { + o.ToIp.Set(&v) +} + +// SetToIpNil sets the value for ToIp to be an explicit nil +func (o *UfwRule) SetToIpNil() { + o.ToIp.Set(nil) +} + +// UnsetToIp ensures that no value is present for ToIp, not even an explicit nil +func (o *UfwRule) UnsetToIp() { + o.ToIp.Unset() +} + +// GetPort returns the Port field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UfwRule) GetPort() string { + if o == nil || IsNil(o.Port.Get()) { + var ret string + return ret + } + return *o.Port.Get() +} + +// GetPortOk returns a tuple with the Port 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 *UfwRule) GetPortOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Port.Get(), o.Port.IsSet() +} + +// HasPort returns a boolean if a field has been set. +func (o *UfwRule) HasPort() bool { + if o != nil && o.Port.IsSet() { + return true + } + + return false +} + +// SetPort gets a reference to the given NullableString and assigns it to the Port field. +func (o *UfwRule) SetPort(v string) { + o.Port.Set(&v) +} + +// SetPortNil sets the value for Port to be an explicit nil +func (o *UfwRule) SetPortNil() { + o.Port.Set(nil) +} + +// UnsetPort ensures that no value is present for Port, not even an explicit nil +func (o *UfwRule) UnsetPort() { + o.Port.Unset() +} + +// GetProto returns the Proto field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UfwRule) GetProto() string { + if o == nil || IsNil(o.Proto.Get()) { + var ret string + return ret + } + return *o.Proto.Get() +} + +// GetProtoOk returns a tuple with the Proto 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 *UfwRule) GetProtoOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Proto.Get(), o.Proto.IsSet() +} + +// HasProto returns a boolean if a field has been set. +func (o *UfwRule) HasProto() bool { + if o != nil && o.Proto.IsSet() { + return true + } + + return false +} + +// SetProto gets a reference to the given NullableString and assigns it to the Proto field. +func (o *UfwRule) SetProto(v string) { + o.Proto.Set(&v) +} + +// SetProtoNil sets the value for Proto to be an explicit nil +func (o *UfwRule) SetProtoNil() { + o.Proto.Set(nil) +} + +// UnsetProto ensures that no value is present for Proto, not even an explicit nil +func (o *UfwRule) UnsetProto() { + o.Proto.Unset() +} + +func (o UfwRule) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UfwRule) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Rule) { + toSerialize["rule"] = o.Rule + } + if o.FromIp.IsSet() { + toSerialize["from_ip"] = o.FromIp.Get() + } + if o.ToIp.IsSet() { + toSerialize["to_ip"] = o.ToIp.Get() + } + if o.Port.IsSet() { + toSerialize["port"] = o.Port.Get() + } + if o.Proto.IsSet() { + toSerialize["proto"] = o.Proto.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UfwRule) UnmarshalJSON(data []byte) (err error) { + varUfwRule := _UfwRule{} + + err = json.Unmarshal(data, &varUfwRule) + + if err != nil { + return err + } + + *o = UfwRule(varUfwRule) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "rule") + delete(additionalProperties, "from_ip") + delete(additionalProperties, "to_ip") + delete(additionalProperties, "port") + delete(additionalProperties, "proto") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUfwRule struct { + value *UfwRule + isSet bool +} + +func (v NullableUfwRule) Get() *UfwRule { + return v.value +} + +func (v *NullableUfwRule) Set(val *UfwRule) { + v.value = val + v.isSet = true +} + +func (v NullableUfwRule) IsSet() bool { + return v.isSet +} + +func (v *NullableUfwRule) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUfwRule(val *UfwRule) *NullableUfwRule { + return &NullableUfwRule{value: val, isSet: true} +} + +func (v NullableUfwRule) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUfwRule) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/shadeform/gen/shadeform/model_update_request.go b/internal/shadeform/gen/shadeform/model_update_request.go new file mode 100644 index 00000000..bfbe24b8 --- /dev/null +++ b/internal/shadeform/gen/shadeform/model_update_request.go @@ -0,0 +1,267 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the UpdateRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateRequest{} + +// UpdateRequest struct for UpdateRequest +type UpdateRequest struct { + // The name of the instance + Name *string `json:"name,omitempty"` + AutoDelete *AutoDelete `json:"auto_delete,omitempty"` + Alert *Alert `json:"alert,omitempty"` + // Add custom, searchable tags to instances. + Tags []string `json:"tags,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _UpdateRequest UpdateRequest + +// NewUpdateRequest instantiates a new UpdateRequest 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 NewUpdateRequest() *UpdateRequest { + this := UpdateRequest{} + return &this +} + +// NewUpdateRequestWithDefaults instantiates a new UpdateRequest 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 NewUpdateRequestWithDefaults() *UpdateRequest { + this := UpdateRequest{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UpdateRequest) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRequest) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *UpdateRequest) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *UpdateRequest) SetName(v string) { + o.Name = &v +} + +// GetAutoDelete returns the AutoDelete field value if set, zero value otherwise. +func (o *UpdateRequest) GetAutoDelete() AutoDelete { + if o == nil || IsNil(o.AutoDelete) { + var ret AutoDelete + return ret + } + return *o.AutoDelete +} + +// GetAutoDeleteOk returns a tuple with the AutoDelete field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRequest) GetAutoDeleteOk() (*AutoDelete, bool) { + if o == nil || IsNil(o.AutoDelete) { + return nil, false + } + return o.AutoDelete, true +} + +// HasAutoDelete returns a boolean if a field has been set. +func (o *UpdateRequest) HasAutoDelete() bool { + if o != nil && !IsNil(o.AutoDelete) { + return true + } + + return false +} + +// SetAutoDelete gets a reference to the given AutoDelete and assigns it to the AutoDelete field. +func (o *UpdateRequest) SetAutoDelete(v AutoDelete) { + o.AutoDelete = &v +} + +// GetAlert returns the Alert field value if set, zero value otherwise. +func (o *UpdateRequest) GetAlert() Alert { + if o == nil || IsNil(o.Alert) { + var ret Alert + return ret + } + return *o.Alert +} + +// GetAlertOk returns a tuple with the Alert field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRequest) GetAlertOk() (*Alert, bool) { + if o == nil || IsNil(o.Alert) { + return nil, false + } + return o.Alert, true +} + +// HasAlert returns a boolean if a field has been set. +func (o *UpdateRequest) HasAlert() bool { + if o != nil && !IsNil(o.Alert) { + return true + } + + return false +} + +// SetAlert gets a reference to the given Alert and assigns it to the Alert field. +func (o *UpdateRequest) SetAlert(v Alert) { + o.Alert = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *UpdateRequest) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []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 *UpdateRequest) GetTagsOk() ([]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 *UpdateRequest) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *UpdateRequest) SetTags(v []string) { + o.Tags = v +} + +func (o UpdateRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.AutoDelete) { + toSerialize["auto_delete"] = o.AutoDelete + } + if !IsNil(o.Alert) { + toSerialize["alert"] = o.Alert + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UpdateRequest) UnmarshalJSON(data []byte) (err error) { + varUpdateRequest := _UpdateRequest{} + + err = json.Unmarshal(data, &varUpdateRequest) + + if err != nil { + return err + } + + *o = UpdateRequest(varUpdateRequest) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "auto_delete") + delete(additionalProperties, "alert") + delete(additionalProperties, "tags") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUpdateRequest struct { + value *UpdateRequest + isSet bool +} + +func (v NullableUpdateRequest) Get() *UpdateRequest { + return v.value +} + +func (v *NullableUpdateRequest) Set(val *UpdateRequest) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateRequest(val *UpdateRequest) *NullableUpdateRequest { + return &NullableUpdateRequest{value: val, isSet: true} +} + +func (v NullableUpdateRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/shadeform/gen/shadeform/model_volume.go b/internal/shadeform/gen/shadeform/model_volume.go new file mode 100644 index 00000000..a76ac09d --- /dev/null +++ b/internal/shadeform/gen/shadeform/model_volume.go @@ -0,0 +1,437 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the Volume type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Volume{} + +// Volume struct for Volume +type Volume struct { + // The ID of the storage volume. + Id string `json:"id"` + Cloud Cloud `json:"cloud"` + // The unique identifier of the storage volume issued by the underlying cloud provider. + CloudAssignedId string `json:"cloud_assigned_id"` + // Specifies the region. + Region string `json:"region"` + // The name of the storage volume. + Name string `json:"name"` + // Denotes whether the volume is fixed in size or elastically scaling. + FixedSize bool `json:"fixed_size"` + // Storage volume size in GB + SizeInGb int32 `json:"size_in_gb"` + // The cost incurred by the instance. This only the cost via Shadeform. If the instance is deployed in your own cloud account, then all billing is through your cloud provider. + CostEstimate string `json:"cost_estimate"` + // Denotes whether the volume supports multiple instances mounting to it at the same time. + SupportsMultiMount bool `json:"supports_multi_mount"` + // The ID of the instance that is currently mounting the volume. + MountedBy string `json:"mounted_by"` + AdditionalProperties map[string]interface{} +} + +type _Volume Volume + +// NewVolume instantiates a new Volume 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 NewVolume(id string, cloud Cloud, cloudAssignedId string, region string, name string, fixedSize bool, sizeInGb int32, costEstimate string, supportsMultiMount bool, mountedBy string) *Volume { + this := Volume{} + this.Id = id + this.Cloud = cloud + this.CloudAssignedId = cloudAssignedId + this.Region = region + this.Name = name + this.FixedSize = fixedSize + this.SizeInGb = sizeInGb + this.CostEstimate = costEstimate + this.SupportsMultiMount = supportsMultiMount + this.MountedBy = mountedBy + return &this +} + +// NewVolumeWithDefaults instantiates a new Volume 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 NewVolumeWithDefaults() *Volume { + this := Volume{} + return &this +} + +// GetId returns the Id field value +func (o *Volume) 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 *Volume) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *Volume) SetId(v string) { + o.Id = v +} + +// GetCloud returns the Cloud field value +func (o *Volume) GetCloud() Cloud { + if o == nil { + var ret Cloud + return ret + } + + return o.Cloud +} + +// GetCloudOk returns a tuple with the Cloud field value +// and a boolean to check if the value has been set. +func (o *Volume) GetCloudOk() (*Cloud, bool) { + if o == nil { + return nil, false + } + return &o.Cloud, true +} + +// SetCloud sets field value +func (o *Volume) SetCloud(v Cloud) { + o.Cloud = v +} + +// GetCloudAssignedId returns the CloudAssignedId field value +func (o *Volume) GetCloudAssignedId() string { + if o == nil { + var ret string + return ret + } + + return o.CloudAssignedId +} + +// GetCloudAssignedIdOk returns a tuple with the CloudAssignedId field value +// and a boolean to check if the value has been set. +func (o *Volume) GetCloudAssignedIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.CloudAssignedId, true +} + +// SetCloudAssignedId sets field value +func (o *Volume) SetCloudAssignedId(v string) { + o.CloudAssignedId = v +} + +// GetRegion returns the Region field value +func (o *Volume) GetRegion() string { + if o == nil { + var ret string + return ret + } + + return o.Region +} + +// GetRegionOk returns a tuple with the Region field value +// and a boolean to check if the value has been set. +func (o *Volume) GetRegionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Region, true +} + +// SetRegion sets field value +func (o *Volume) SetRegion(v string) { + o.Region = v +} + +// GetName returns the Name field value +func (o *Volume) 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 *Volume) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *Volume) SetName(v string) { + o.Name = v +} + +// GetFixedSize returns the FixedSize field value +func (o *Volume) GetFixedSize() bool { + if o == nil { + var ret bool + return ret + } + + return o.FixedSize +} + +// GetFixedSizeOk returns a tuple with the FixedSize field value +// and a boolean to check if the value has been set. +func (o *Volume) GetFixedSizeOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.FixedSize, true +} + +// SetFixedSize sets field value +func (o *Volume) SetFixedSize(v bool) { + o.FixedSize = v +} + +// GetSizeInGb returns the SizeInGb field value +func (o *Volume) GetSizeInGb() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.SizeInGb +} + +// GetSizeInGbOk returns a tuple with the SizeInGb field value +// and a boolean to check if the value has been set. +func (o *Volume) GetSizeInGbOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.SizeInGb, true +} + +// SetSizeInGb sets field value +func (o *Volume) SetSizeInGb(v int32) { + o.SizeInGb = v +} + +// GetCostEstimate returns the CostEstimate field value +func (o *Volume) GetCostEstimate() string { + if o == nil { + var ret string + return ret + } + + return o.CostEstimate +} + +// GetCostEstimateOk returns a tuple with the CostEstimate field value +// and a boolean to check if the value has been set. +func (o *Volume) GetCostEstimateOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.CostEstimate, true +} + +// SetCostEstimate sets field value +func (o *Volume) SetCostEstimate(v string) { + o.CostEstimate = v +} + +// GetSupportsMultiMount returns the SupportsMultiMount field value +func (o *Volume) GetSupportsMultiMount() bool { + if o == nil { + var ret bool + return ret + } + + return o.SupportsMultiMount +} + +// GetSupportsMultiMountOk returns a tuple with the SupportsMultiMount field value +// and a boolean to check if the value has been set. +func (o *Volume) GetSupportsMultiMountOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.SupportsMultiMount, true +} + +// SetSupportsMultiMount sets field value +func (o *Volume) SetSupportsMultiMount(v bool) { + o.SupportsMultiMount = v +} + +// GetMountedBy returns the MountedBy field value +func (o *Volume) GetMountedBy() string { + if o == nil { + var ret string + return ret + } + + return o.MountedBy +} + +// GetMountedByOk returns a tuple with the MountedBy field value +// and a boolean to check if the value has been set. +func (o *Volume) GetMountedByOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.MountedBy, true +} + +// SetMountedBy sets field value +func (o *Volume) SetMountedBy(v string) { + o.MountedBy = v +} + +func (o Volume) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Volume) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["cloud"] = o.Cloud + toSerialize["cloud_assigned_id"] = o.CloudAssignedId + toSerialize["region"] = o.Region + toSerialize["name"] = o.Name + toSerialize["fixed_size"] = o.FixedSize + toSerialize["size_in_gb"] = o.SizeInGb + toSerialize["cost_estimate"] = o.CostEstimate + toSerialize["supports_multi_mount"] = o.SupportsMultiMount + toSerialize["mounted_by"] = o.MountedBy + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Volume) 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", + "cloud", + "cloud_assigned_id", + "region", + "name", + "fixed_size", + "size_in_gb", + "cost_estimate", + "supports_multi_mount", + "mounted_by", + } + + 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) + } + } + + varVolume := _Volume{} + + err = json.Unmarshal(data, &varVolume) + + if err != nil { + return err + } + + *o = Volume(varVolume) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "cloud") + delete(additionalProperties, "cloud_assigned_id") + delete(additionalProperties, "region") + delete(additionalProperties, "name") + delete(additionalProperties, "fixed_size") + delete(additionalProperties, "size_in_gb") + delete(additionalProperties, "cost_estimate") + delete(additionalProperties, "supports_multi_mount") + delete(additionalProperties, "mounted_by") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVolume struct { + value *Volume + isSet bool +} + +func (v NullableVolume) Get() *Volume { + return v.value +} + +func (v *NullableVolume) Set(val *Volume) { + v.value = val + v.isSet = true +} + +func (v NullableVolume) IsSet() bool { + return v.isSet +} + +func (v *NullableVolume) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolume(val *Volume) *NullableVolume { + return &NullableVolume{value: val, isSet: true} +} + +func (v NullableVolume) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolume) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/shadeform/gen/shadeform/model_volume_mount.go b/internal/shadeform/gen/shadeform/model_volume_mount.go new file mode 100644 index 00000000..cadba101 --- /dev/null +++ b/internal/shadeform/gen/shadeform/model_volume_mount.go @@ -0,0 +1,155 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the VolumeMount type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VolumeMount{} + +// VolumeMount Settings for mounting volumes onto file systems +type VolumeMount struct { + // Set to true to automatically mount unmounted disks to a default filesystem. + Auto *bool `json:"auto,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _VolumeMount VolumeMount + +// NewVolumeMount instantiates a new VolumeMount 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 NewVolumeMount() *VolumeMount { + this := VolumeMount{} + return &this +} + +// NewVolumeMountWithDefaults instantiates a new VolumeMount 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 NewVolumeMountWithDefaults() *VolumeMount { + this := VolumeMount{} + return &this +} + +// GetAuto returns the Auto field value if set, zero value otherwise. +func (o *VolumeMount) GetAuto() bool { + if o == nil || IsNil(o.Auto) { + var ret bool + return ret + } + return *o.Auto +} + +// GetAutoOk returns a tuple with the Auto field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VolumeMount) GetAutoOk() (*bool, bool) { + if o == nil || IsNil(o.Auto) { + return nil, false + } + return o.Auto, true +} + +// HasAuto returns a boolean if a field has been set. +func (o *VolumeMount) HasAuto() bool { + if o != nil && !IsNil(o.Auto) { + return true + } + + return false +} + +// SetAuto gets a reference to the given bool and assigns it to the Auto field. +func (o *VolumeMount) SetAuto(v bool) { + o.Auto = &v +} + +func (o VolumeMount) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VolumeMount) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Auto) { + toSerialize["auto"] = o.Auto + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *VolumeMount) UnmarshalJSON(data []byte) (err error) { + varVolumeMount := _VolumeMount{} + + err = json.Unmarshal(data, &varVolumeMount) + + if err != nil { + return err + } + + *o = VolumeMount(varVolumeMount) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "auto") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVolumeMount struct { + value *VolumeMount + isSet bool +} + +func (v NullableVolumeMount) Get() *VolumeMount { + return v.value +} + +func (v *NullableVolumeMount) Set(val *VolumeMount) { + v.value = val + v.isSet = true +} + +func (v NullableVolumeMount) IsSet() bool { + return v.isSet +} + +func (v *NullableVolumeMount) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolumeMount(val *VolumeMount) *NullableVolumeMount { + return &NullableVolumeMount{value: val, isSet: true} +} + +func (v NullableVolumeMount) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolumeMount) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/shadeform/gen/shadeform/model_volume_mounts.go b/internal/shadeform/gen/shadeform/model_volume_mounts.go new file mode 100644 index 00000000..82fe6d8b --- /dev/null +++ b/internal/shadeform/gen/shadeform/model_volume_mounts.go @@ -0,0 +1,198 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the VolumeMounts type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VolumeMounts{} + +// VolumeMounts Mounts the host volume to a container file path. +type VolumeMounts struct { + // Filepath of the host. + HostPath string `json:"host_path"` + // Filepath of the container. + ContainerPath string `json:"container_path"` + AdditionalProperties map[string]interface{} +} + +type _VolumeMounts VolumeMounts + +// NewVolumeMounts instantiates a new VolumeMounts 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 NewVolumeMounts(hostPath string, containerPath string) *VolumeMounts { + this := VolumeMounts{} + this.HostPath = hostPath + this.ContainerPath = containerPath + return &this +} + +// NewVolumeMountsWithDefaults instantiates a new VolumeMounts 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 NewVolumeMountsWithDefaults() *VolumeMounts { + this := VolumeMounts{} + return &this +} + +// GetHostPath returns the HostPath field value +func (o *VolumeMounts) GetHostPath() string { + if o == nil { + var ret string + return ret + } + + return o.HostPath +} + +// GetHostPathOk returns a tuple with the HostPath field value +// and a boolean to check if the value has been set. +func (o *VolumeMounts) GetHostPathOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.HostPath, true +} + +// SetHostPath sets field value +func (o *VolumeMounts) SetHostPath(v string) { + o.HostPath = v +} + +// GetContainerPath returns the ContainerPath field value +func (o *VolumeMounts) GetContainerPath() string { + if o == nil { + var ret string + return ret + } + + return o.ContainerPath +} + +// GetContainerPathOk returns a tuple with the ContainerPath field value +// and a boolean to check if the value has been set. +func (o *VolumeMounts) GetContainerPathOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ContainerPath, true +} + +// SetContainerPath sets field value +func (o *VolumeMounts) SetContainerPath(v string) { + o.ContainerPath = v +} + +func (o VolumeMounts) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VolumeMounts) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["host_path"] = o.HostPath + toSerialize["container_path"] = o.ContainerPath + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *VolumeMounts) 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{ + "host_path", + "container_path", + } + + 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) + } + } + + varVolumeMounts := _VolumeMounts{} + + err = json.Unmarshal(data, &varVolumeMounts) + + if err != nil { + return err + } + + *o = VolumeMounts(varVolumeMounts) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "host_path") + delete(additionalProperties, "container_path") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVolumeMounts struct { + value *VolumeMounts + isSet bool +} + +func (v NullableVolumeMounts) Get() *VolumeMounts { + return v.value +} + +func (v *NullableVolumeMounts) Set(val *VolumeMounts) { + v.value = val + v.isSet = true +} + +func (v NullableVolumeMounts) IsSet() bool { + return v.isSet +} + +func (v *NullableVolumeMounts) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolumeMounts(val *VolumeMounts) *NullableVolumeMounts { + return &NullableVolumeMounts{value: val, isSet: true} +} + +func (v NullableVolumeMounts) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolumeMounts) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/shadeform/gen/shadeform/model_volume_types_inner.go b/internal/shadeform/gen/shadeform/model_volume_types_inner.go new file mode 100644 index 00000000..20ee1625 --- /dev/null +++ b/internal/shadeform/gen/shadeform/model_volume_types_inner.go @@ -0,0 +1,287 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the VolumeTypesInner type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VolumeTypesInner{} + +// VolumeTypesInner struct for VolumeTypesInner +type VolumeTypesInner struct { + Cloud Cloud `json:"cloud"` + // Specifies the region. + Region string `json:"region"` + // Denotes whether the volume supports multiple instances mounting to it at the same time. + SupportsMultiMount bool `json:"supports_multi_mount"` + // Denotes whether the volume is fixed in size or elastically scaling. + FixedSize bool `json:"fixed_size"` + // Price of the specified volume type per GB per hour + PricePerGbPerHour string `json:"price_per_gb_per_hour"` + AdditionalProperties map[string]interface{} +} + +type _VolumeTypesInner VolumeTypesInner + +// NewVolumeTypesInner instantiates a new VolumeTypesInner 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 NewVolumeTypesInner(cloud Cloud, region string, supportsMultiMount bool, fixedSize bool, pricePerGbPerHour string) *VolumeTypesInner { + this := VolumeTypesInner{} + this.Cloud = cloud + this.Region = region + this.SupportsMultiMount = supportsMultiMount + this.FixedSize = fixedSize + this.PricePerGbPerHour = pricePerGbPerHour + return &this +} + +// NewVolumeTypesInnerWithDefaults instantiates a new VolumeTypesInner 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 NewVolumeTypesInnerWithDefaults() *VolumeTypesInner { + this := VolumeTypesInner{} + return &this +} + +// GetCloud returns the Cloud field value +func (o *VolumeTypesInner) GetCloud() Cloud { + if o == nil { + var ret Cloud + return ret + } + + return o.Cloud +} + +// GetCloudOk returns a tuple with the Cloud field value +// and a boolean to check if the value has been set. +func (o *VolumeTypesInner) GetCloudOk() (*Cloud, bool) { + if o == nil { + return nil, false + } + return &o.Cloud, true +} + +// SetCloud sets field value +func (o *VolumeTypesInner) SetCloud(v Cloud) { + o.Cloud = v +} + +// GetRegion returns the Region field value +func (o *VolumeTypesInner) GetRegion() string { + if o == nil { + var ret string + return ret + } + + return o.Region +} + +// GetRegionOk returns a tuple with the Region field value +// and a boolean to check if the value has been set. +func (o *VolumeTypesInner) GetRegionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Region, true +} + +// SetRegion sets field value +func (o *VolumeTypesInner) SetRegion(v string) { + o.Region = v +} + +// GetSupportsMultiMount returns the SupportsMultiMount field value +func (o *VolumeTypesInner) GetSupportsMultiMount() bool { + if o == nil { + var ret bool + return ret + } + + return o.SupportsMultiMount +} + +// GetSupportsMultiMountOk returns a tuple with the SupportsMultiMount field value +// and a boolean to check if the value has been set. +func (o *VolumeTypesInner) GetSupportsMultiMountOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.SupportsMultiMount, true +} + +// SetSupportsMultiMount sets field value +func (o *VolumeTypesInner) SetSupportsMultiMount(v bool) { + o.SupportsMultiMount = v +} + +// GetFixedSize returns the FixedSize field value +func (o *VolumeTypesInner) GetFixedSize() bool { + if o == nil { + var ret bool + return ret + } + + return o.FixedSize +} + +// GetFixedSizeOk returns a tuple with the FixedSize field value +// and a boolean to check if the value has been set. +func (o *VolumeTypesInner) GetFixedSizeOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.FixedSize, true +} + +// SetFixedSize sets field value +func (o *VolumeTypesInner) SetFixedSize(v bool) { + o.FixedSize = v +} + +// GetPricePerGbPerHour returns the PricePerGbPerHour field value +func (o *VolumeTypesInner) GetPricePerGbPerHour() string { + if o == nil { + var ret string + return ret + } + + return o.PricePerGbPerHour +} + +// GetPricePerGbPerHourOk returns a tuple with the PricePerGbPerHour field value +// and a boolean to check if the value has been set. +func (o *VolumeTypesInner) GetPricePerGbPerHourOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.PricePerGbPerHour, true +} + +// SetPricePerGbPerHour sets field value +func (o *VolumeTypesInner) SetPricePerGbPerHour(v string) { + o.PricePerGbPerHour = v +} + +func (o VolumeTypesInner) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VolumeTypesInner) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["cloud"] = o.Cloud + toSerialize["region"] = o.Region + toSerialize["supports_multi_mount"] = o.SupportsMultiMount + toSerialize["fixed_size"] = o.FixedSize + toSerialize["price_per_gb_per_hour"] = o.PricePerGbPerHour + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *VolumeTypesInner) 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{ + "cloud", + "region", + "supports_multi_mount", + "fixed_size", + "price_per_gb_per_hour", + } + + 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) + } + } + + varVolumeTypesInner := _VolumeTypesInner{} + + err = json.Unmarshal(data, &varVolumeTypesInner) + + if err != nil { + return err + } + + *o = VolumeTypesInner(varVolumeTypesInner) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "cloud") + delete(additionalProperties, "region") + delete(additionalProperties, "supports_multi_mount") + delete(additionalProperties, "fixed_size") + delete(additionalProperties, "price_per_gb_per_hour") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVolumeTypesInner struct { + value *VolumeTypesInner + isSet bool +} + +func (v NullableVolumeTypesInner) Get() *VolumeTypesInner { + return v.value +} + +func (v *NullableVolumeTypesInner) Set(val *VolumeTypesInner) { + v.value = val + v.isSet = true +} + +func (v NullableVolumeTypesInner) IsSet() bool { + return v.isSet +} + +func (v *NullableVolumeTypesInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolumeTypesInner(val *VolumeTypesInner) *NullableVolumeTypesInner { + return &NullableVolumeTypesInner{value: val, isSet: true} +} + +func (v NullableVolumeTypesInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolumeTypesInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/shadeform/gen/shadeform/model_volumes_response.go b/internal/shadeform/gen/shadeform/model_volumes_response.go new file mode 100644 index 00000000..210c4975 --- /dev/null +++ b/internal/shadeform/gen/shadeform/model_volumes_response.go @@ -0,0 +1,167 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the VolumesResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VolumesResponse{} + +// VolumesResponse struct for VolumesResponse +type VolumesResponse struct { + Volumes []Volume `json:"volumes"` + AdditionalProperties map[string]interface{} +} + +type _VolumesResponse VolumesResponse + +// NewVolumesResponse instantiates a new VolumesResponse 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 NewVolumesResponse(volumes []Volume) *VolumesResponse { + this := VolumesResponse{} + this.Volumes = volumes + return &this +} + +// NewVolumesResponseWithDefaults instantiates a new VolumesResponse 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 NewVolumesResponseWithDefaults() *VolumesResponse { + this := VolumesResponse{} + return &this +} + +// GetVolumes returns the Volumes field value +func (o *VolumesResponse) GetVolumes() []Volume { + if o == nil { + var ret []Volume + return ret + } + + return o.Volumes +} + +// GetVolumesOk returns a tuple with the Volumes field value +// and a boolean to check if the value has been set. +func (o *VolumesResponse) GetVolumesOk() ([]Volume, bool) { + if o == nil { + return nil, false + } + return o.Volumes, true +} + +// SetVolumes sets field value +func (o *VolumesResponse) SetVolumes(v []Volume) { + o.Volumes = v +} + +func (o VolumesResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VolumesResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["volumes"] = o.Volumes + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *VolumesResponse) 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{ + "volumes", + } + + 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) + } + } + + varVolumesResponse := _VolumesResponse{} + + err = json.Unmarshal(data, &varVolumesResponse) + + if err != nil { + return err + } + + *o = VolumesResponse(varVolumesResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "volumes") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVolumesResponse struct { + value *VolumesResponse + isSet bool +} + +func (v NullableVolumesResponse) Get() *VolumesResponse { + return v.value +} + +func (v *NullableVolumesResponse) Set(val *VolumesResponse) { + v.value = val + v.isSet = true +} + +func (v NullableVolumesResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableVolumesResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolumesResponse(val *VolumesResponse) *NullableVolumesResponse { + return &NullableVolumesResponse{value: val, isSet: true} +} + +func (v NullableVolumesResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolumesResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/shadeform/gen/shadeform/model_volumes_types_response.go b/internal/shadeform/gen/shadeform/model_volumes_types_response.go new file mode 100644 index 00000000..6960f60d --- /dev/null +++ b/internal/shadeform/gen/shadeform/model_volumes_types_response.go @@ -0,0 +1,167 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the VolumesTypesResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VolumesTypesResponse{} + +// VolumesTypesResponse struct for VolumesTypesResponse +type VolumesTypesResponse struct { + VolumeTypes []VolumeTypesInner `json:"volume_types"` + AdditionalProperties map[string]interface{} +} + +type _VolumesTypesResponse VolumesTypesResponse + +// NewVolumesTypesResponse instantiates a new VolumesTypesResponse 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 NewVolumesTypesResponse(volumeTypes []VolumeTypesInner) *VolumesTypesResponse { + this := VolumesTypesResponse{} + this.VolumeTypes = volumeTypes + return &this +} + +// NewVolumesTypesResponseWithDefaults instantiates a new VolumesTypesResponse 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 NewVolumesTypesResponseWithDefaults() *VolumesTypesResponse { + this := VolumesTypesResponse{} + return &this +} + +// GetVolumeTypes returns the VolumeTypes field value +func (o *VolumesTypesResponse) GetVolumeTypes() []VolumeTypesInner { + if o == nil { + var ret []VolumeTypesInner + return ret + } + + return o.VolumeTypes +} + +// GetVolumeTypesOk returns a tuple with the VolumeTypes field value +// and a boolean to check if the value has been set. +func (o *VolumesTypesResponse) GetVolumeTypesOk() ([]VolumeTypesInner, bool) { + if o == nil { + return nil, false + } + return o.VolumeTypes, true +} + +// SetVolumeTypes sets field value +func (o *VolumesTypesResponse) SetVolumeTypes(v []VolumeTypesInner) { + o.VolumeTypes = v +} + +func (o VolumesTypesResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VolumesTypesResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["volume_types"] = o.VolumeTypes + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *VolumesTypesResponse) 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{ + "volume_types", + } + + 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) + } + } + + varVolumesTypesResponse := _VolumesTypesResponse{} + + err = json.Unmarshal(data, &varVolumesTypesResponse) + + if err != nil { + return err + } + + *o = VolumesTypesResponse(varVolumesTypesResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "volume_types") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVolumesTypesResponse struct { + value *VolumesTypesResponse + isSet bool +} + +func (v NullableVolumesTypesResponse) Get() *VolumesTypesResponse { + return v.value +} + +func (v *NullableVolumesTypesResponse) Set(val *VolumesTypesResponse) { + v.value = val + v.isSet = true +} + +func (v NullableVolumesTypesResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableVolumesTypesResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolumesTypesResponse(val *VolumesTypesResponse) *NullableVolumesTypesResponse { + return &NullableVolumesTypesResponse{value: val, isSet: true} +} + +func (v NullableVolumesTypesResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolumesTypesResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/shadeform/gen/shadeform/response.go b/internal/shadeform/gen/shadeform/response.go new file mode 100644 index 00000000..6fb35823 --- /dev/null +++ b/internal/shadeform/gen/shadeform/response.go @@ -0,0 +1,48 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// 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/shadeform/gen/shadeform/test/api_default_test.go b/internal/shadeform/gen/shadeform/test/api_default_test.go new file mode 100644 index 00000000..da4e9a04 --- /dev/null +++ b/internal/shadeform/gen/shadeform/test/api_default_test.go @@ -0,0 +1,317 @@ +/* +Shadeform API + +Testing DefaultAPIService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package openapi + +import ( + "context" + openapiclient "github.com/shadeform/cloud-shadeform" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "testing" +) + +func Test_openapi_DefaultAPIService(t *testing.T) { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + + t.Run("Test DefaultAPIService Instances", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.DefaultAPI.Instances(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test DefaultAPIService InstancesCreate", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.DefaultAPI.InstancesCreate(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test DefaultAPIService InstancesDelete", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var id string + + httpRes, err := apiClient.DefaultAPI.InstancesDelete(context.Background(), id).Execute() + + require.Nil(t, err) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test DefaultAPIService InstancesInfo", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var id string + + resp, httpRes, err := apiClient.DefaultAPI.InstancesInfo(context.Background(), id).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test DefaultAPIService InstancesRestart", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var id string + + httpRes, err := apiClient.DefaultAPI.InstancesRestart(context.Background(), id).Execute() + + require.Nil(t, err) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test DefaultAPIService InstancesTypes", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.DefaultAPI.InstancesTypes(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test DefaultAPIService InstancesUpdate", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var id string + + httpRes, err := apiClient.DefaultAPI.InstancesUpdate(context.Background(), id).Execute() + + require.Nil(t, err) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test DefaultAPIService Sshkeys", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.DefaultAPI.Sshkeys(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test DefaultAPIService SshkeysAdd", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.DefaultAPI.SshkeysAdd(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test DefaultAPIService SshkeysDelete", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var id string + + httpRes, err := apiClient.DefaultAPI.SshkeysDelete(context.Background(), id).Execute() + + require.Nil(t, err) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test DefaultAPIService SshkeysInfo", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var id string + + resp, httpRes, err := apiClient.DefaultAPI.SshkeysInfo(context.Background(), id).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test DefaultAPIService SshkeysSetdefault", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var id string + + httpRes, err := apiClient.DefaultAPI.SshkeysSetdefault(context.Background(), id).Execute() + + require.Nil(t, err) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test DefaultAPIService Templates", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.DefaultAPI.Templates(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test DefaultAPIService TemplatesDelete", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var templateId string + + httpRes, err := apiClient.DefaultAPI.TemplatesDelete(context.Background(), templateId).Execute() + + require.Nil(t, err) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test DefaultAPIService TemplatesFeatured", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.DefaultAPI.TemplatesFeatured(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test DefaultAPIService TemplatesInfo", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var templateId string + + resp, httpRes, err := apiClient.DefaultAPI.TemplatesInfo(context.Background(), templateId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test DefaultAPIService TemplatesSave", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.DefaultAPI.TemplatesSave(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test DefaultAPIService TemplatesUpdate", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var templateId string + + httpRes, err := apiClient.DefaultAPI.TemplatesUpdate(context.Background(), templateId).Execute() + + require.Nil(t, err) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test DefaultAPIService Volumes", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.DefaultAPI.Volumes(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test DefaultAPIService VolumesCreate", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.DefaultAPI.VolumesCreate(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test DefaultAPIService VolumesDelete", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var id string + + httpRes, err := apiClient.DefaultAPI.VolumesDelete(context.Background(), id).Execute() + + require.Nil(t, err) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test DefaultAPIService VolumesInfo", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var id string + + resp, httpRes, err := apiClient.DefaultAPI.VolumesInfo(context.Background(), id).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test DefaultAPIService VolumesTypes", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.DefaultAPI.VolumesTypes(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + +} diff --git a/internal/shadeform/gen/shadeform/utils.go b/internal/shadeform/gen/shadeform/utils.go new file mode 100644 index 00000000..f41a5f2e --- /dev/null +++ b/internal/shadeform/gen/shadeform/utils.go @@ -0,0 +1,362 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// 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/shadeform/v1/capabilities.go b/internal/shadeform/v1/capabilities.go new file mode 100644 index 00000000..3f0b8330 --- /dev/null +++ b/internal/shadeform/v1/capabilities.go @@ -0,0 +1,18 @@ +package v1 + +import ( + "context" + v1 "github.com/brevdev/cloud/pkg/v1" +) + +func (c *ShadeformClient) GetCapabilities(_ context.Context) (v1.Capabilities, error) { + capabilities := v1.Capabilities{ + v1.CapabilityCreateInstance, + v1.CapabilityTerminateInstance, + v1.CapabilityTags, + v1.CapabilityRebootInstance, + v1.CapabilityMachineImage, + } + + return capabilities, nil +} diff --git a/internal/shadeform/v1/client.go b/internal/shadeform/v1/client.go new file mode 100644 index 00000000..d5d05d0d --- /dev/null +++ b/internal/shadeform/v1/client.go @@ -0,0 +1,119 @@ +package v1 + +import ( + "context" + "crypto/sha256" + "fmt" + "net/http" + + openapi "github.com/brevdev/cloud/internal/shadeform/gen/shadeform" + "github.com/brevdev/cloud/pkg/v1" +) + +const CloudProviderID = "shadeform" + +// ShadeformCredential implements the CloudCredential interface for Shadeform +type ShadeformCredential struct { + RefID string + APIKey string +} + +var _ v1.CloudCredential = &ShadeformCredential{} + +func NewShadeformCredential(refID, apiKey string) *ShadeformCredential { + return &ShadeformCredential{ + RefID: refID, + APIKey: apiKey, + } +} + +// GetReferenceID returns the reference ID for this credential +func (c *ShadeformCredential) GetReferenceID() string { + return c.RefID +} + +// GetAPIType returns the API type for Shadeform +func (c *ShadeformCredential) GetAPIType() v1.APIType { + return v1.APITypeGlobal +} + +// GetCloudProviderID returns the cloud provider ID for Shadeform +func (c *ShadeformCredential) GetCloudProviderID() v1.CloudProviderID { + return CloudProviderID +} + +// GetTenantID returns the account ID for Shadeform +func (c *ShadeformCredential) GetTenantID() (string, error) { + // TODO: Return the account ID for the API key + return fmt.Sprintf("%s-%x", CloudProviderID, sha256.Sum256([]byte(c.APIKey))), nil +} + +// GetCapabilities returns the capabilities for Shadeform +func (c *ShadeformCredential) GetCapabilities(ctx context.Context) (v1.Capabilities, error) { + client, err := c.MakeClient(ctx, "") + if err != nil { + return nil, err + } + return client.GetCapabilities(ctx) +} + +// MakeClient creates a new Shadeform client from this credential +func (c *ShadeformCredential) MakeClient(_ context.Context, _ string) (v1.CloudClient, error) { + return NewShadeformClient(c.RefID, c.APIKey), nil +} + +// Shadeform implements the CloudClient interface for Shadeform +// It embeds NotImplCloudClient to handle unsupported features +type ShadeformClient struct { + v1.NotImplCloudClient + refID string + apiKey string + baseURL string + projectID string + client *openapi.APIClient + config *Configuration +} + +var _ v1.CloudClient = &ShadeformClient{} + +func NewShadeformClient(refID, apiKey string) *ShadeformClient { + config := openapi.NewConfiguration() + config.HTTPClient = http.DefaultClient + client := openapi.NewAPIClient(config) + + return &ShadeformClient{ + refID: refID, + apiKey: apiKey, + baseURL: "https://api.shadeform.ai/v1", + client: client, + } +} + +func (c *ShadeformClient) WithConfiguration(config Configuration) *ShadeformClient { + c.config = &config + return c +} + +// GetAPIType returns the API type for Shadeform +func (c *ShadeformClient) GetAPIType() v1.APIType { + return v1.APITypeGlobal +} + +// GetCloudProviderID returns the cloud provider ID for Shadeform +func (c *ShadeformClient) GetCloudProviderID() v1.CloudProviderID { + return CloudProviderID +} + +// MakeClient creates a new client instance +func (c *ShadeformClient) MakeClient(_ context.Context, _ string) (v1.CloudClient, error) { + return c, nil +} + +// GetReferenceID returns the reference ID for this client +func (c *ShadeformClient) GetReferenceID() string { + return c.refID +} + +func (c *ShadeformClient) makeAuthContext(ctx context.Context) context.Context { + return context.WithValue(ctx, openapi.ContextAPIKeys, c.apiKey) +} diff --git a/internal/shadeform/v1/configuration.go b/internal/shadeform/v1/configuration.go new file mode 100644 index 00000000..8bf30505 --- /dev/null +++ b/internal/shadeform/v1/configuration.go @@ -0,0 +1,18 @@ +package v1 + +type Configuration struct { + AllowedInstanceTypes map[string][]string +} + +func (c *Configuration) isAllowed(cloud string, shadeInstanceType string) bool { + allowedInstanceTypes, found := c.AllowedInstanceTypes[cloud] + if !found { + return false + } + for _, allowedInstanceType := range allowedInstanceTypes { + if shadeInstanceType == allowedInstanceType { + return true + } + } + return false +} diff --git a/internal/shadeform/v1/instance.go b/internal/shadeform/v1/instance.go new file mode 100644 index 00000000..ddf5f3a6 --- /dev/null +++ b/internal/shadeform/v1/instance.go @@ -0,0 +1,204 @@ +package v1 + +import ( + "context" + "fmt" + "github.com/alecthomas/units" + openapi "github.com/brevdev/cloud/internal/shadeform/gen/shadeform" + "github.com/brevdev/cloud/pkg/v1" +) + +const ( + hostname = "shadecloud" +) + +func (c *ShadeformClient) CreateInstance(ctx context.Context, attrs v1.CreateInstanceAttrs) (*v1.Instance, error) { + authCtx := c.makeAuthContext(ctx) + + region := attrs.Location + cloud, shadeInstanceType, err := c.getShadeformCloudAndInstanceType(attrs.InstanceType) + if err != nil { + return nil, err + } + + cloudEnum, err := openapi.NewCloudFromValue(cloud) + if err != nil { + return nil, err + } + + req := openapi.CreateRequest{ + Cloud: *cloudEnum, + Region: region, + ShadeInstanceType: shadeInstanceType, + Name: attrs.Name, + } + + resp, httpResp, err := c.client.DefaultAPI.InstancesCreate(authCtx).CreateRequest(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") + } + + // Since Shadeform doesn't return the full instance that's created, we need to make a second API call to get + // the created instance after we call create + createdInstance, err := c.GetInstance(authCtx, v1.CloudProviderInstanceID(resp.Id)) + if err != nil { + return nil, err + } + + return createdInstance, nil +} + +func (c *ShadeformClient) GetInstance(ctx context.Context, instanceID v1.CloudProviderInstanceID) (*v1.Instance, error) { + authCtx := c.makeAuthContext(ctx) + + resp, httpResp, err := c.client.DefaultAPI.InstancesInfo(authCtx, string(instanceID)).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 c.convertInstanceInfoResponseToV1Instance(*resp), nil +} + +func (c *ShadeformClient) TerminateInstance(ctx context.Context, instanceID v1.CloudProviderInstanceID) error { + authCtx := c.makeAuthContext(ctx) + + httpResp, err := c.client.DefaultAPI.InstancesDelete(authCtx, string(instanceID)).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 *ShadeformClient) ListInstances(ctx context.Context, _ v1.ListInstancesArgs) ([]v1.Instance, error) { + authCtx := c.makeAuthContext(ctx) + + resp, httpResp, err := c.client.DefaultAPI.Instances(authCtx).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 _, instance := range resp.Instances { + instances = append(instances, *c.convertShadeformInstanceToV1Instance(instance)) + } + + return instances, nil +} + +func (c *ShadeformClient) RebootInstance(_ context.Context, _ v1.CloudProviderInstanceID) error { + return v1.ErrNotImplemented +} + +func (c *ShadeformClient) MergeInstanceForUpdate(currInst v1.Instance, _ v1.Instance) v1.Instance { + return currInst +} + +func (c *ShadeformClient) MergeInstanceTypeForUpdate(currIt v1.InstanceType, _ v1.InstanceType) v1.InstanceType { + return currIt +} + +func (c *ShadeformClient) convertInstanceInfoResponseToV1Instance(instanceInfo openapi.InstanceInfoResponse) *v1.Instance { + var lifecycleStatus v1.LifecycleStatus + switch instanceInfo.Status { + case "creating": + lifecycleStatus = v1.LifecycleStatusPending + case "pending_provider": + lifecycleStatus = v1.LifecycleStatusPending + case "pending": + lifecycleStatus = v1.LifecycleStatusPending + case "active": + lifecycleStatus = v1.LifecycleStatusRunning + case "error": + lifecycleStatus = v1.LifecycleStatusFailed + default: + lifecycleStatus = v1.LifecycleStatusPending + } + + instanceType := c.getInstanceType(string(instanceInfo.Cloud), instanceInfo.ShadeInstanceType) + + instance := &v1.Instance{ + Name: instanceInfo.Name, + CreatedAt: instanceInfo.CreatedAt, + CloudID: v1.CloudProviderInstanceID(instanceInfo.Id), + PublicIP: instanceInfo.Ip, + Hostname: hostname, + ImageID: instanceInfo.Configuration.Os, + InstanceType: instanceType, + DiskSize: units.Base2Bytes(instanceInfo.Configuration.StorageInGb) * units.GiB, + SSHUser: instanceInfo.SshUser, + SSHPort: int(instanceInfo.SshPort), + Status: v1.Status{ + LifecycleStatus: lifecycleStatus, + }, + Spot: false, + Location: instanceInfo.Region, + Stoppable: false, + Rebootable: true, + } + + return instance +} + +func (c *ShadeformClient) convertShadeformInstanceToV1Instance(shadeformInstance openapi.Instance) *v1.Instance { + + var lifecycleStatus v1.LifecycleStatus + switch shadeformInstance.Status { + case "creating": + lifecycleStatus = v1.LifecycleStatusPending + case "pending_provider": + lifecycleStatus = v1.LifecycleStatusPending + case "pending": + lifecycleStatus = v1.LifecycleStatusPending + case "active": + lifecycleStatus = v1.LifecycleStatusRunning + case "error": + lifecycleStatus = v1.LifecycleStatusFailed + default: + lifecycleStatus = v1.LifecycleStatusPending + } + + instanceType := c.getInstanceType(string(shadeformInstance.Cloud), shadeformInstance.ShadeInstanceType) + + instance := &v1.Instance{ + Name: shadeformInstance.Name, + CreatedAt: shadeformInstance.CreatedAt, + CloudID: v1.CloudProviderInstanceID(shadeformInstance.Id), + PublicIP: shadeformInstance.Ip, + Hostname: hostname, + ImageID: shadeformInstance.Configuration.Os, + InstanceType: instanceType, + DiskSize: units.Base2Bytes(shadeformInstance.Configuration.StorageInGb) * units.GiB, + SSHUser: shadeformInstance.SshUser, + SSHPort: int(shadeformInstance.SshPort), + Status: v1.Status{ + LifecycleStatus: lifecycleStatus, + }, + Spot: false, + Location: shadeformInstance.Region, + Stoppable: false, + Rebootable: true, + } + + return instance +} diff --git a/internal/shadeform/v1/instancetype.go b/internal/shadeform/v1/instancetype.go new file mode 100644 index 00000000..aeb22276 --- /dev/null +++ b/internal/shadeform/v1/instancetype.go @@ -0,0 +1,164 @@ +package v1 + +import ( + "context" + "errors" + "fmt" + "github.com/alecthomas/units" + "github.com/bojanz/currency" + "strings" + "time" + + openapi "github.com/brevdev/cloud/internal/shadeform/gen/shadeform" + + "github.com/brevdev/cloud/pkg/v1" +) + +const ( + UsdCurrentCode = "USD" + AllRegions = "all" +) + +// TODO: We need to apply a filter to specifically limit the integration and api to selected clouds and shade instance types + +func (c *ShadeformClient) GetInstanceTypes(ctx context.Context, args v1.GetInstanceTypeArgs) ([]v1.InstanceType, error) { + authCtx := c.makeAuthContext(ctx) + + request := c.client.DefaultAPI.InstancesTypes(authCtx) + if len(args.Locations) > 0 && args.Locations[0] != AllRegions { + regionFilter := args.Locations[0] + request = request.Region(regionFilter) + } + + resp, httpResp, err := request.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 _, sfInstanceType := range resp.InstanceTypes { + instanceTypesFromShadeformInstanceType, err := c.convertShadeformInstanceTypeToV1InstanceType(sfInstanceType) + if err != nil { + return nil, err + } + instanceTypes = append(instanceTypes, instanceTypesFromShadeformInstanceType...) + } + + return instanceTypes, nil +} + +func (c *ShadeformClient) GetInstanceTypePollTime() time.Duration { + return 5 * time.Minute +} + +func (c *ShadeformClient) GetLocations(ctx context.Context, _ v1.GetLocationsArgs) ([]v1.Location, error) { + authCtx := c.makeAuthContext(ctx) + + resp, httpResp, err := c.client.DefaultAPI.InstancesTypes(authCtx).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) + } + + // Shadeform doesn't have a dedicated locations API but we can get the same result from using the + // instance types API and formatting the output + + dedupedLocations := map[string]v1.Location{} + + if resp != nil { + for _, instanceType := range resp.InstanceTypes { + for _, availability := range instanceType.Availability { + _, ok := dedupedLocations[availability.Region] + if !ok { + dedupedLocations[availability.Region] = v1.Location{ + Name: availability.Region, + Description: availability.DisplayName, + Available: availability.Available, + } + } + } + } + } + + locations := []v1.Location{} + + for _, location := range dedupedLocations { + locations = append(locations, location) + } + + return locations, nil +} + +// getInstanceType - gets the Brev instance type from the shadeform cloud and shade instance type +// TODO: determine if it would be better to include the shadeform cloud inside the region / location instead +func (c *ShadeformClient) getInstanceType(shadeformCloud string, shadeformInstanceType string) string { + return fmt.Sprintf("%v_%v", shadeformCloud, shadeformInstanceType) +} + +// getInstanceTypeID - unique identifier for the SKU +func (c *ShadeformClient) getInstanceTypeID(instanceType string, region string) string { + return fmt.Sprintf("%v_%v", instanceType, region) +} + +func (c *ShadeformClient) getShadeformCloudAndInstanceType(instanceType string) (string, string, error) { + shadeformCloud, shadeformInstanceType, found := strings.Cut(instanceType, "_") + if !found { + return "", "", errors.New("Could not determine shadeform cloud and instance type from instance type") + } + return shadeformCloud, shadeformInstanceType, nil +} + +// convertShadeformInstanceTypeToV1InstanceTypes - converts a shadeform returned instance type to a specific instance type and region of availability +func (c *ShadeformClient) convertShadeformInstanceTypeToV1InstanceType(shadeformInstanceType openapi.InstanceType) ([]v1.InstanceType, error) { + instanceType := c.getInstanceType(string(shadeformInstanceType.Cloud), shadeformInstanceType.ShadeInstanceType) + + instanceTypes := []v1.InstanceType{} + + basePrice, err := convertHourlyPriceToAmount(shadeformInstanceType.HourlyPrice) + if err != nil { + return nil, err + } + + for _, region := range shadeformInstanceType.Availability { + instanceTypes = append(instanceTypes, v1.InstanceType{ + ID: v1.InstanceTypeID(c.getInstanceTypeID(instanceType, region.Region)), + Type: instanceType, + VCPU: shadeformInstanceType.Configuration.Vcpus, + Memory: units.Base2Bytes(shadeformInstanceType.Configuration.MemoryInGb) * units.GiB, + SupportedGPUs: []v1.GPU{ + { + Count: shadeformInstanceType.Configuration.NumGpus, + Memory: units.Base2Bytes(shadeformInstanceType.Configuration.VramPerGpuInGb) * units.GiB, + MemoryDetails: "", + NetworkDetails: "", + Manufacturer: "", + // TODO: Need to double check if there is a standard for name and type + Name: shadeformInstanceType.Configuration.GpuType, + Type: shadeformInstanceType.Configuration.GpuType, + }, + }, + BasePrice: basePrice, + IsAvailable: region.Available, + Location: region.Region, + Provider: CloudProviderID, + }) + } + + return instanceTypes, nil +} + +func convertHourlyPriceToAmount(hourlyPrice int32) (*currency.Amount, error) { + number := fmt.Sprintf("%.2f", float64(hourlyPrice)/100) + + amount, err := currency.NewAmount(number, UsdCurrentCode) + if err != nil { + return nil, err + } + return &amount, nil +} diff --git a/internal/shadeform/v1/validation_test.go b/internal/shadeform/v1/validation_test.go new file mode 100644 index 00000000..dd61c5f3 --- /dev/null +++ b/internal/shadeform/v1/validation_test.go @@ -0,0 +1,45 @@ +package v1 + +import ( + "github.com/brevdev/cloud/internal/validation" + v1 "github.com/brevdev/cloud/pkg/v1" + "os" + "testing" +) + +func TestValidationFunctions(t *testing.T) { + checkSkip(t) + apiKey := getAPIKey() + + config := validation.ProviderConfig{ + Credential: NewShadeformCredential("validation-test", apiKey), + StableIDs: []v1.InstanceTypeID{"datacrunch_B200_helsinki-finland-5", "massedcompute_L40_desmoines-usa-1"}, + } + + validation.RunValidationSuite(t, config) +} + +func TestInstanceLifecycleValidation(t *testing.T) { + checkSkip(t) + apiKey := getAPIKey() + + config := validation.ProviderConfig{ + Credential: NewShadeformCredential("validation-test", apiKey), + } + + validation.RunInstanceLifecycleValidation(t, config) +} + +func checkSkip(t *testing.T) { + apiKey := getAPIKey() + isValidationTest := os.Getenv("VALIDATION_TEST") + if apiKey == "" && isValidationTest != "" { + t.Fatal("SHADEFORM_API_KEY not set, but VALIDATION_TEST is set") + } else if apiKey == "" && isValidationTest == "" { + t.Skip("SHADEFORM_API_KEY not set, skipping shadeform validation tests") + } +} + +func getAPIKey() string { + return os.Getenv("SHADEFORM_API_KEY") +} diff --git a/main/main.go b/main/main.go new file mode 100644 index 00000000..942b1a10 --- /dev/null +++ b/main/main.go @@ -0,0 +1,8 @@ +package main + +import "fmt" + +func main() { + fmt.Println("Things are working!") + +} From 574c43e7f8d93f6a7358fcba0cae55ee5f7af933 Mon Sep 17 00:00:00 2001 From: Ronald Ding Date: Fri, 15 Aug 2025 15:52:23 -0700 Subject: [PATCH 02/12] feat: update validation test and pass all others --- .../gen/shadeform/.openapi-generator/FILES | 2 + internal/shadeform/gen/shadeform/README.md | 1 + .../shadeform/gen/shadeform/api/openapi.yaml | 90 +++++++- .../shadeform/gen/shadeform/docs/BootTime.md | 82 ++++++++ .../shadeform/gen/shadeform/docs/Instance.md | 104 ++++++++++ .../shadeform/docs/InstanceInfoResponse.md | 78 +++++++ .../gen/shadeform/docs/InstanceType.md | 8 +- .../gen/shadeform/model_boot_time.go | 193 ++++++++++++++++++ .../shadeform/gen/shadeform/model_instance.go | 151 ++++++++++++++ .../shadeform/model_instance_info_response.go | 113 ++++++++++ .../gen/shadeform/model_instance_type.go | 22 +- internal/shadeform/v1/client.go | 7 +- internal/shadeform/v1/instance.go | 17 ++ pkg/v1/image.go | 2 +- 14 files changed, 846 insertions(+), 24 deletions(-) create mode 100644 internal/shadeform/gen/shadeform/docs/BootTime.md create mode 100644 internal/shadeform/gen/shadeform/model_boot_time.go diff --git a/internal/shadeform/gen/shadeform/.openapi-generator/FILES b/internal/shadeform/gen/shadeform/.openapi-generator/FILES index 0c2bd54a..59edec64 100644 --- a/internal/shadeform/gen/shadeform/.openapi-generator/FILES +++ b/internal/shadeform/gen/shadeform/.openapi-generator/FILES @@ -10,6 +10,7 @@ docs/AddSshKeyResponse.md docs/Alert.md docs/AutoDelete.md docs/Availability.md +docs/BootTime.md docs/Cloud.md docs/CreateRequest.md docs/CreateResponse.md @@ -56,6 +57,7 @@ model_add_ssh_key_response.go model_alert.go model_auto_delete.go model_availability.go +model_boot_time.go model_cloud.go model_create_request.go model_create_response.go diff --git a/internal/shadeform/gen/shadeform/README.md b/internal/shadeform/gen/shadeform/README.md index a66d5ce4..fb3512ce 100644 --- a/internal/shadeform/gen/shadeform/README.md +++ b/internal/shadeform/gen/shadeform/README.md @@ -111,6 +111,7 @@ Class | Method | HTTP request | Description - [Alert](docs/Alert.md) - [AutoDelete](docs/AutoDelete.md) - [Availability](docs/Availability.md) + - [BootTime](docs/BootTime.md) - [Cloud](docs/Cloud.md) - [CreateRequest](docs/CreateRequest.md) - [CreateResponse](docs/CreateResponse.md) diff --git a/internal/shadeform/gen/shadeform/api/openapi.yaml b/internal/shadeform/gen/shadeform/api/openapi.yaml index 3c592586..50f862ad 100644 --- a/internal/shadeform/gen/shadeform/api/openapi.yaml +++ b/internal/shadeform/gen/shadeform/api/openapi.yaml @@ -530,8 +530,8 @@ components: hourly_price: 210 deployment_type: vm boot_time: - min_boot_in_sec: 180 max_boot_in_sec: 300 + min_boot_in_sec: 180 storage_in_gb: 256 - nvlink: true configuration: @@ -564,8 +564,8 @@ components: hourly_price: 210 deployment_type: vm boot_time: - min_boot_in_sec: 180 max_boot_in_sec: 300 + min_boot_in_sec: 180 storage_in_gb: 256 properties: instance_types: @@ -609,8 +609,8 @@ components: hourly_price: 210 deployment_type: vm boot_time: - min_boot_in_sec: 180 max_boot_in_sec: 300 + min_boot_in_sec: 180 storage_in_gb: 256 properties: cloud: @@ -649,10 +649,7 @@ components: $ref: '#/components/schemas/Availability' type: array boot_time: - example: - min_boot_in_sec: 180 - max_boot_in_sec: 300 - type: object + $ref: '#/components/schemas/BootTime' memory_in_gb: description: The amount of memory for the instance in gigabytes. Note that this is not VRAM which is determined by GPU type and the number of GPUs. @@ -740,9 +737,15 @@ components: deleted_at: 2016-08-29T09:12:33.001Z shade_cloud: true shade_instance_type: A6000 + tags: + - tag1 + - tag1 cloud: hyperstack hourly_price: 210 cost_estimate: "103.4" + boot_time: + max_boot_in_sec: 300 + min_boot_in_sec: 180 port_mappings: - external_port: 80 internal_port: 8000 @@ -751,6 +754,8 @@ components: name: cool-gpu-server id: d290f1ee-6c54-4b01-90e6-d701748f0851 region: canada-1 + active_at: 2016-08-29T09:12:33.001Z + status_details: downloading ssh_user: shadeform status: active - ssh_port: 22 @@ -797,9 +802,15 @@ components: deleted_at: 2016-08-29T09:12:33.001Z shade_cloud: true shade_instance_type: A6000 + tags: + - tag1 + - tag1 cloud: hyperstack hourly_price: 210 cost_estimate: "103.4" + boot_time: + max_boot_in_sec: 300 + min_boot_in_sec: 180 port_mappings: - external_port: 80 internal_port: 8000 @@ -808,6 +819,8 @@ components: name: cool-gpu-server id: d290f1ee-6c54-4b01-90e6-d701748f0851 region: canada-1 + active_at: 2016-08-29T09:12:33.001Z + status_details: downloading ssh_user: shadeform status: active properties: @@ -864,9 +877,15 @@ components: deleted_at: 2016-08-29T09:12:33.001Z shade_cloud: true shade_instance_type: A6000 + tags: + - tag1 + - tag1 cloud: hyperstack hourly_price: 210 cost_estimate: "103.4" + boot_time: + max_boot_in_sec: 300 + min_boot_in_sec: 180 port_mappings: - external_port: 80 internal_port: 8000 @@ -875,6 +894,8 @@ components: name: cool-gpu-server id: d290f1ee-6c54-4b01-90e6-d701748f0851 region: canada-1 + active_at: 2016-08-29T09:12:33.001Z + status_details: downloading ssh_user: shadeform status: active properties: @@ -933,6 +954,10 @@ components: type: integer status: $ref: '#/components/schemas/Status' + status_details: + description: Additional context for the status + example: downloading + type: string cost_estimate: description: "The cost incurred by the instance. This only the cost via\ \ Shadeform. If the instance is deployed in your own cloud account, then\ @@ -945,12 +970,22 @@ components: type: integer launch_configuration: $ref: '#/components/schemas/LaunchConfiguration' + tags: + description: "Add custom, searchable tags to instances." + items: + $ref: '#/components/schemas/Tag' + type: array port_mappings: description: List of port mappings on an instance that a Cloud Provider might have automatically set up. items: $ref: '#/components/schemas/InstancePortMappings' type: array + active_at: + description: The timestamp of when the instance was active in UTC. + example: 2016-08-29T09:12:33.001Z + format: date-time + type: string created_at: description: The timestamp of when the instance was created in UTC. example: 2016-08-29T09:12:33.001Z @@ -961,6 +996,8 @@ components: example: 2016-08-29T09:12:33.001Z format: date-time type: string + boot_time: + $ref: '#/components/schemas/BootTime' required: - cloud - cloud_assigned_id @@ -1016,6 +1053,7 @@ components: - external_port: 80 internal_port: 8000 id: d290f1ee-6c54-4b01-90e6-d701748f0851 + status_details: downloading ssh_user: shadeform volume_mount: auto: true @@ -1055,8 +1093,12 @@ components: tags: - tag1 - tag1 + boot_time: + max_boot_in_sec: 300 + min_boot_in_sec: 180 name: cool-gpu-server region: canada-1 + active_at: 2016-08-29T09:12:33.001Z status: active properties: id: @@ -1114,6 +1156,10 @@ components: type: integer status: $ref: '#/components/schemas/Status' + status_details: + description: Additional context for the status + example: downloading + type: string cost_estimate: description: "The cost incurred by the instance. This only the cost via\ \ Shadeform. If the instance is deployed in your own cloud account, then\ @@ -1159,6 +1205,11 @@ components: items: $ref: '#/components/schemas/InstancePortMappings' type: array + active_at: + description: The timestamp of when the instance was active in UTC. + example: 2016-08-29T09:12:33.001Z + format: date-time + type: string created_at: description: The timestamp of when the instance was created in UTC. example: 2016-08-29T09:12:33.001Z @@ -1169,6 +1220,8 @@ components: example: 2016-08-29T09:12:33.001Z format: date-time type: string + boot_time: + $ref: '#/components/schemas/BootTime' required: - cloud - cloud_assigned_id @@ -1320,6 +1373,20 @@ components: - display_name - region type: object + BootTime: + example: + max_boot_in_sec: 300 + min_boot_in_sec: 180 + properties: + min_boot_in_sec: + description: boot time minimum estimate + example: 180 + type: integer + max_boot_in_sec: + description: boot time maximum estimate + example: 300 + type: integer + type: object CreateRequest: example: volume_mount: @@ -1774,12 +1841,21 @@ components: - deleted example: active type: string + StatusDetails: + description: Additional context for the status + example: downloading + type: string CostEstimate: description: "The cost incurred by the instance. This only the cost via Shadeform.\ \ If the instance is deployed in your own cloud account, then all billing\ \ is through your cloud provider." example: "103.4" type: string + ActiveAt: + description: The timestamp of when the instance was active in UTC. + example: 2016-08-29T09:12:33.001Z + format: date-time + type: string CreatedAt: description: The timestamp of when the instance was created in UTC. example: 2016-08-29T09:12:33.001Z diff --git a/internal/shadeform/gen/shadeform/docs/BootTime.md b/internal/shadeform/gen/shadeform/docs/BootTime.md new file mode 100644 index 00000000..93d77f32 --- /dev/null +++ b/internal/shadeform/gen/shadeform/docs/BootTime.md @@ -0,0 +1,82 @@ +# BootTime + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**MinBootInSec** | Pointer to **int32** | boot time minimum estimate | [optional] +**MaxBootInSec** | Pointer to **int32** | boot time maximum estimate | [optional] + +## Methods + +### NewBootTime + +`func NewBootTime() *BootTime` + +NewBootTime instantiates a new BootTime 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 + +### NewBootTimeWithDefaults + +`func NewBootTimeWithDefaults() *BootTime` + +NewBootTimeWithDefaults instantiates a new BootTime 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 + +### GetMinBootInSec + +`func (o *BootTime) GetMinBootInSec() int32` + +GetMinBootInSec returns the MinBootInSec field if non-nil, zero value otherwise. + +### GetMinBootInSecOk + +`func (o *BootTime) GetMinBootInSecOk() (*int32, bool)` + +GetMinBootInSecOk returns a tuple with the MinBootInSec field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMinBootInSec + +`func (o *BootTime) SetMinBootInSec(v int32)` + +SetMinBootInSec sets MinBootInSec field to given value. + +### HasMinBootInSec + +`func (o *BootTime) HasMinBootInSec() bool` + +HasMinBootInSec returns a boolean if a field has been set. + +### GetMaxBootInSec + +`func (o *BootTime) GetMaxBootInSec() int32` + +GetMaxBootInSec returns the MaxBootInSec field if non-nil, zero value otherwise. + +### GetMaxBootInSecOk + +`func (o *BootTime) GetMaxBootInSecOk() (*int32, bool)` + +GetMaxBootInSecOk returns a tuple with the MaxBootInSec field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMaxBootInSec + +`func (o *BootTime) SetMaxBootInSec(v int32)` + +SetMaxBootInSec sets MaxBootInSec field to given value. + +### HasMaxBootInSec + +`func (o *BootTime) HasMaxBootInSec() bool` + +HasMaxBootInSec 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/shadeform/gen/shadeform/docs/Instance.md b/internal/shadeform/gen/shadeform/docs/Instance.md index c852fc67..ec90feda 100644 --- a/internal/shadeform/gen/shadeform/docs/Instance.md +++ b/internal/shadeform/gen/shadeform/docs/Instance.md @@ -17,12 +17,16 @@ Name | Type | Description | Notes **SshUser** | **string** | The SSH user used to SSH into the instance. | **SshPort** | **int32** | The SSH port of the instance. In most cases, this will be port 22 but for some clouds, this may be a different port. | **Status** | [**Status**](Status.md) | | +**StatusDetails** | Pointer to **string** | Additional context for the status | [optional] **CostEstimate** | **string** | The cost incurred by the instance. This only the cost via Shadeform. If the instance is deployed in your own cloud account, then all billing is through your cloud provider. | **HourlyPrice** | Pointer to **int32** | The hourly price of the instance in cents. | [optional] **LaunchConfiguration** | Pointer to [**LaunchConfiguration**](LaunchConfiguration.md) | | [optional] +**Tags** | Pointer to **[]string** | Add custom, searchable tags to instances. | [optional] **PortMappings** | Pointer to [**[]InstancePortMappings**](InstancePortMappings.md) | List of port mappings on an instance that a Cloud Provider might have automatically set up. | [optional] +**ActiveAt** | Pointer to **time.Time** | The timestamp of when the instance was active in UTC. | [optional] **CreatedAt** | **time.Time** | The timestamp of when the instance was created in UTC. | **DeletedAt** | **time.Time** | The timestamp of when the instance was deleted in UTC. | +**BootTime** | Pointer to [**BootTime**](BootTime.md) | | [optional] ## Methods @@ -303,6 +307,31 @@ and a boolean to check if the value has been set. SetStatus sets Status field to given value. +### GetStatusDetails + +`func (o *Instance) GetStatusDetails() string` + +GetStatusDetails returns the StatusDetails field if non-nil, zero value otherwise. + +### GetStatusDetailsOk + +`func (o *Instance) GetStatusDetailsOk() (*string, bool)` + +GetStatusDetailsOk returns a tuple with the StatusDetails field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetStatusDetails + +`func (o *Instance) SetStatusDetails(v string)` + +SetStatusDetails sets StatusDetails field to given value. + +### HasStatusDetails + +`func (o *Instance) HasStatusDetails() bool` + +HasStatusDetails returns a boolean if a field has been set. + ### GetCostEstimate `func (o *Instance) GetCostEstimate() string` @@ -373,6 +402,31 @@ SetLaunchConfiguration sets LaunchConfiguration field to given value. HasLaunchConfiguration returns a boolean if a field has been set. +### GetTags + +`func (o *Instance) GetTags() []string` + +GetTags returns the Tags field if non-nil, zero value otherwise. + +### GetTagsOk + +`func (o *Instance) GetTagsOk() (*[]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 []string)` + +SetTags sets Tags field to given value. + +### HasTags + +`func (o *Instance) HasTags() bool` + +HasTags returns a boolean if a field has been set. + ### GetPortMappings `func (o *Instance) GetPortMappings() []InstancePortMappings` @@ -398,6 +452,31 @@ SetPortMappings sets PortMappings field to given value. HasPortMappings returns a boolean if a field has been set. +### GetActiveAt + +`func (o *Instance) GetActiveAt() time.Time` + +GetActiveAt returns the ActiveAt field if non-nil, zero value otherwise. + +### GetActiveAtOk + +`func (o *Instance) GetActiveAtOk() (*time.Time, bool)` + +GetActiveAtOk returns a tuple with the ActiveAt field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetActiveAt + +`func (o *Instance) SetActiveAt(v time.Time)` + +SetActiveAt sets ActiveAt field to given value. + +### HasActiveAt + +`func (o *Instance) HasActiveAt() bool` + +HasActiveAt returns a boolean if a field has been set. + ### GetCreatedAt `func (o *Instance) GetCreatedAt() time.Time` @@ -438,6 +517,31 @@ and a boolean to check if the value has been set. SetDeletedAt sets DeletedAt field to given value. +### GetBootTime + +`func (o *Instance) GetBootTime() BootTime` + +GetBootTime returns the BootTime field if non-nil, zero value otherwise. + +### GetBootTimeOk + +`func (o *Instance) GetBootTimeOk() (*BootTime, bool)` + +GetBootTimeOk returns a tuple with the BootTime field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBootTime + +`func (o *Instance) SetBootTime(v BootTime)` + +SetBootTime sets BootTime field to given value. + +### HasBootTime + +`func (o *Instance) HasBootTime() bool` + +HasBootTime 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/shadeform/gen/shadeform/docs/InstanceInfoResponse.md b/internal/shadeform/gen/shadeform/docs/InstanceInfoResponse.md index ab7d6b75..d18d9931 100644 --- a/internal/shadeform/gen/shadeform/docs/InstanceInfoResponse.md +++ b/internal/shadeform/gen/shadeform/docs/InstanceInfoResponse.md @@ -17,6 +17,7 @@ Name | Type | Description | Notes **SshUser** | **string** | The SSH user used to SSH into the instance. | **SshPort** | **int32** | The SSH port of the instance. In most cases, this will be port 22 but for some clouds, this may be a different port. | **Status** | [**Status**](Status.md) | | +**StatusDetails** | Pointer to **string** | Additional context for the status | [optional] **CostEstimate** | **string** | The cost incurred by the instance. This only the cost via Shadeform. If the instance is deployed in your own cloud account, then all billing is through your cloud provider. | **HourlyPrice** | Pointer to **int32** | The hourly price of the instance in cents. | [optional] **VolumeIds** | Pointer to **[]string** | List of volume IDs to be mounted. Currently only supports 1 volume at a time. | [optional] @@ -28,8 +29,10 @@ Name | Type | Description | Notes **Tags** | Pointer to **[]string** | Add custom, searchable tags to instances. | [optional] **Envs** | Pointer to [**[]Env**](Env.md) | List of environment variable name and values to automatically add to the instance | [optional] **PortMappings** | Pointer to [**[]InstancePortMappings**](InstancePortMappings.md) | List of port mappings on an instance that a Cloud Provider might have automatically set up. | [optional] +**ActiveAt** | Pointer to **time.Time** | The timestamp of when the instance was active in UTC. | [optional] **CreatedAt** | **time.Time** | The timestamp of when the instance was created in UTC. | **DeletedAt** | **time.Time** | The timestamp of when the instance was deleted in UTC. | +**BootTime** | Pointer to [**BootTime**](BootTime.md) | | [optional] ## Methods @@ -310,6 +313,31 @@ and a boolean to check if the value has been set. SetStatus sets Status field to given value. +### GetStatusDetails + +`func (o *InstanceInfoResponse) GetStatusDetails() string` + +GetStatusDetails returns the StatusDetails field if non-nil, zero value otherwise. + +### GetStatusDetailsOk + +`func (o *InstanceInfoResponse) GetStatusDetailsOk() (*string, bool)` + +GetStatusDetailsOk returns a tuple with the StatusDetails field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetStatusDetails + +`func (o *InstanceInfoResponse) SetStatusDetails(v string)` + +SetStatusDetails sets StatusDetails field to given value. + +### HasStatusDetails + +`func (o *InstanceInfoResponse) HasStatusDetails() bool` + +HasStatusDetails returns a boolean if a field has been set. + ### GetCostEstimate `func (o *InstanceInfoResponse) GetCostEstimate() string` @@ -580,6 +608,31 @@ SetPortMappings sets PortMappings field to given value. HasPortMappings returns a boolean if a field has been set. +### GetActiveAt + +`func (o *InstanceInfoResponse) GetActiveAt() time.Time` + +GetActiveAt returns the ActiveAt field if non-nil, zero value otherwise. + +### GetActiveAtOk + +`func (o *InstanceInfoResponse) GetActiveAtOk() (*time.Time, bool)` + +GetActiveAtOk returns a tuple with the ActiveAt field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetActiveAt + +`func (o *InstanceInfoResponse) SetActiveAt(v time.Time)` + +SetActiveAt sets ActiveAt field to given value. + +### HasActiveAt + +`func (o *InstanceInfoResponse) HasActiveAt() bool` + +HasActiveAt returns a boolean if a field has been set. + ### GetCreatedAt `func (o *InstanceInfoResponse) GetCreatedAt() time.Time` @@ -620,6 +673,31 @@ and a boolean to check if the value has been set. SetDeletedAt sets DeletedAt field to given value. +### GetBootTime + +`func (o *InstanceInfoResponse) GetBootTime() BootTime` + +GetBootTime returns the BootTime field if non-nil, zero value otherwise. + +### GetBootTimeOk + +`func (o *InstanceInfoResponse) GetBootTimeOk() (*BootTime, bool)` + +GetBootTimeOk returns a tuple with the BootTime field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBootTime + +`func (o *InstanceInfoResponse) SetBootTime(v BootTime)` + +SetBootTime sets BootTime field to given value. + +### HasBootTime + +`func (o *InstanceInfoResponse) HasBootTime() bool` + +HasBootTime 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/shadeform/gen/shadeform/docs/InstanceType.md b/internal/shadeform/gen/shadeform/docs/InstanceType.md index ecd9a75f..d68a2c4f 100644 --- a/internal/shadeform/gen/shadeform/docs/InstanceType.md +++ b/internal/shadeform/gen/shadeform/docs/InstanceType.md @@ -11,7 +11,7 @@ Name | Type | Description | Notes **HourlyPrice** | **int32** | The hourly price of the instance in cents. | **DeploymentType** | **string** | Whether the instance is a \"vm\" (virtual machine), a \"container\" (docker container), or \"baremetal\" (bare metal server). | **Availability** | [**[]Availability**](Availability.md) | | -**BootTime** | Pointer to **map[string]interface{}** | | [optional] +**BootTime** | Pointer to [**BootTime**](BootTime.md) | | [optional] **MemoryInGb** | Pointer to **int32** | The amount of memory for the instance in gigabytes. Note that this is not VRAM which is determined by GPU type and the number of GPUs. | [optional] **StorageInGb** | Pointer to **int32** | The amount of storage for the instance. If this storage is too low for the instance type, please email support@shadeform.ai as the storage may be adjustable. | [optional] **Vcpus** | Pointer to **int32** | The number of vCPUs for the instance. | [optional] @@ -181,20 +181,20 @@ SetAvailability sets Availability field to given value. ### GetBootTime -`func (o *InstanceType) GetBootTime() map[string]interface{}` +`func (o *InstanceType) GetBootTime() BootTime` GetBootTime returns the BootTime field if non-nil, zero value otherwise. ### GetBootTimeOk -`func (o *InstanceType) GetBootTimeOk() (*map[string]interface{}, bool)` +`func (o *InstanceType) GetBootTimeOk() (*BootTime, bool)` GetBootTimeOk returns a tuple with the BootTime field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetBootTime -`func (o *InstanceType) SetBootTime(v map[string]interface{})` +`func (o *InstanceType) SetBootTime(v BootTime)` SetBootTime sets BootTime field to given value. diff --git a/internal/shadeform/gen/shadeform/model_boot_time.go b/internal/shadeform/gen/shadeform/model_boot_time.go new file mode 100644 index 00000000..e6441435 --- /dev/null +++ b/internal/shadeform/gen/shadeform/model_boot_time.go @@ -0,0 +1,193 @@ +/* +Shadeform API + +Shadeform is a single API and platform for deploying and managing cloud GPUs. + +API version: 1.0.0 +Contact: support@shadeform.ai +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the BootTime type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BootTime{} + +// BootTime struct for BootTime +type BootTime struct { + // boot time minimum estimate + MinBootInSec *int32 `json:"min_boot_in_sec,omitempty"` + // boot time maximum estimate + MaxBootInSec *int32 `json:"max_boot_in_sec,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _BootTime BootTime + +// NewBootTime instantiates a new BootTime 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 NewBootTime() *BootTime { + this := BootTime{} + return &this +} + +// NewBootTimeWithDefaults instantiates a new BootTime 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 NewBootTimeWithDefaults() *BootTime { + this := BootTime{} + return &this +} + +// GetMinBootInSec returns the MinBootInSec field value if set, zero value otherwise. +func (o *BootTime) GetMinBootInSec() int32 { + if o == nil || IsNil(o.MinBootInSec) { + var ret int32 + return ret + } + return *o.MinBootInSec +} + +// GetMinBootInSecOk returns a tuple with the MinBootInSec field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BootTime) GetMinBootInSecOk() (*int32, bool) { + if o == nil || IsNil(o.MinBootInSec) { + return nil, false + } + return o.MinBootInSec, true +} + +// HasMinBootInSec returns a boolean if a field has been set. +func (o *BootTime) HasMinBootInSec() bool { + if o != nil && !IsNil(o.MinBootInSec) { + return true + } + + return false +} + +// SetMinBootInSec gets a reference to the given int32 and assigns it to the MinBootInSec field. +func (o *BootTime) SetMinBootInSec(v int32) { + o.MinBootInSec = &v +} + +// GetMaxBootInSec returns the MaxBootInSec field value if set, zero value otherwise. +func (o *BootTime) GetMaxBootInSec() int32 { + if o == nil || IsNil(o.MaxBootInSec) { + var ret int32 + return ret + } + return *o.MaxBootInSec +} + +// GetMaxBootInSecOk returns a tuple with the MaxBootInSec field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BootTime) GetMaxBootInSecOk() (*int32, bool) { + if o == nil || IsNil(o.MaxBootInSec) { + return nil, false + } + return o.MaxBootInSec, true +} + +// HasMaxBootInSec returns a boolean if a field has been set. +func (o *BootTime) HasMaxBootInSec() bool { + if o != nil && !IsNil(o.MaxBootInSec) { + return true + } + + return false +} + +// SetMaxBootInSec gets a reference to the given int32 and assigns it to the MaxBootInSec field. +func (o *BootTime) SetMaxBootInSec(v int32) { + o.MaxBootInSec = &v +} + +func (o BootTime) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BootTime) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.MinBootInSec) { + toSerialize["min_boot_in_sec"] = o.MinBootInSec + } + if !IsNil(o.MaxBootInSec) { + toSerialize["max_boot_in_sec"] = o.MaxBootInSec + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *BootTime) UnmarshalJSON(data []byte) (err error) { + varBootTime := _BootTime{} + + err = json.Unmarshal(data, &varBootTime) + + if err != nil { + return err + } + + *o = BootTime(varBootTime) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "min_boot_in_sec") + delete(additionalProperties, "max_boot_in_sec") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableBootTime struct { + value *BootTime + isSet bool +} + +func (v NullableBootTime) Get() *BootTime { + return v.value +} + +func (v *NullableBootTime) Set(val *BootTime) { + v.value = val + v.isSet = true +} + +func (v NullableBootTime) IsSet() bool { + return v.isSet +} + +func (v *NullableBootTime) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBootTime(val *BootTime) *NullableBootTime { + return &NullableBootTime{value: val, isSet: true} +} + +func (v NullableBootTime) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBootTime) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/shadeform/gen/shadeform/model_instance.go b/internal/shadeform/gen/shadeform/model_instance.go index 91951348..69284c8c 100644 --- a/internal/shadeform/gen/shadeform/model_instance.go +++ b/internal/shadeform/gen/shadeform/model_instance.go @@ -45,17 +45,24 @@ type Instance struct { // The SSH port of the instance. In most cases, this will be port 22 but for some clouds, this may be a different port. SshPort int32 `json:"ssh_port"` Status Status `json:"status"` + // Additional context for the status + StatusDetails *string `json:"status_details,omitempty"` // The cost incurred by the instance. This only the cost via Shadeform. If the instance is deployed in your own cloud account, then all billing is through your cloud provider. CostEstimate string `json:"cost_estimate"` // The hourly price of the instance in cents. HourlyPrice *int32 `json:"hourly_price,omitempty"` LaunchConfiguration *LaunchConfiguration `json:"launch_configuration,omitempty"` + // Add custom, searchable tags to instances. + Tags []string `json:"tags,omitempty"` // List of port mappings on an instance that a Cloud Provider might have automatically set up. PortMappings []InstancePortMappings `json:"port_mappings,omitempty"` + // The timestamp of when the instance was active in UTC. + ActiveAt *time.Time `json:"active_at,omitempty"` // The timestamp of when the instance was created in UTC. CreatedAt time.Time `json:"created_at"` // The timestamp of when the instance was deleted in UTC. DeletedAt time.Time `json:"deleted_at"` + BootTime *BootTime `json:"boot_time,omitempty"` AdditionalProperties map[string]interface{} } @@ -406,6 +413,38 @@ func (o *Instance) SetStatus(v Status) { o.Status = v } +// GetStatusDetails returns the StatusDetails field value if set, zero value otherwise. +func (o *Instance) GetStatusDetails() string { + if o == nil || IsNil(o.StatusDetails) { + var ret string + return ret + } + return *o.StatusDetails +} + +// GetStatusDetailsOk returns a tuple with the StatusDetails field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Instance) GetStatusDetailsOk() (*string, bool) { + if o == nil || IsNil(o.StatusDetails) { + return nil, false + } + return o.StatusDetails, true +} + +// HasStatusDetails returns a boolean if a field has been set. +func (o *Instance) HasStatusDetails() bool { + if o != nil && !IsNil(o.StatusDetails) { + return true + } + + return false +} + +// SetStatusDetails gets a reference to the given string and assigns it to the StatusDetails field. +func (o *Instance) SetStatusDetails(v string) { + o.StatusDetails = &v +} + // GetCostEstimate returns the CostEstimate field value func (o *Instance) GetCostEstimate() string { if o == nil { @@ -494,6 +533,38 @@ func (o *Instance) SetLaunchConfiguration(v LaunchConfiguration) { o.LaunchConfiguration = &v } +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *Instance) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []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 *Instance) GetTagsOk() ([]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 *Instance) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *Instance) SetTags(v []string) { + o.Tags = v +} + // GetPortMappings returns the PortMappings field value if set, zero value otherwise. func (o *Instance) GetPortMappings() []InstancePortMappings { if o == nil || IsNil(o.PortMappings) { @@ -526,6 +597,38 @@ func (o *Instance) SetPortMappings(v []InstancePortMappings) { o.PortMappings = v } +// GetActiveAt returns the ActiveAt field value if set, zero value otherwise. +func (o *Instance) GetActiveAt() time.Time { + if o == nil || IsNil(o.ActiveAt) { + var ret time.Time + return ret + } + return *o.ActiveAt +} + +// GetActiveAtOk returns a tuple with the ActiveAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Instance) GetActiveAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.ActiveAt) { + return nil, false + } + return o.ActiveAt, true +} + +// HasActiveAt returns a boolean if a field has been set. +func (o *Instance) HasActiveAt() bool { + if o != nil && !IsNil(o.ActiveAt) { + return true + } + + return false +} + +// SetActiveAt gets a reference to the given time.Time and assigns it to the ActiveAt field. +func (o *Instance) SetActiveAt(v time.Time) { + o.ActiveAt = &v +} + // GetCreatedAt returns the CreatedAt field value func (o *Instance) GetCreatedAt() time.Time { if o == nil { @@ -574,6 +677,38 @@ func (o *Instance) SetDeletedAt(v time.Time) { o.DeletedAt = v } +// GetBootTime returns the BootTime field value if set, zero value otherwise. +func (o *Instance) GetBootTime() BootTime { + if o == nil || IsNil(o.BootTime) { + var ret BootTime + return ret + } + return *o.BootTime +} + +// GetBootTimeOk returns a tuple with the BootTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Instance) GetBootTimeOk() (*BootTime, bool) { + if o == nil || IsNil(o.BootTime) { + return nil, false + } + return o.BootTime, true +} + +// HasBootTime returns a boolean if a field has been set. +func (o *Instance) HasBootTime() bool { + if o != nil && !IsNil(o.BootTime) { + return true + } + + return false +} + +// SetBootTime gets a reference to the given BootTime and assigns it to the BootTime field. +func (o *Instance) SetBootTime(v BootTime) { + o.BootTime = &v +} + func (o Instance) MarshalJSON() ([]byte, error) { toSerialize, err := o.ToMap() if err != nil { @@ -597,6 +732,9 @@ func (o Instance) ToMap() (map[string]interface{}, error) { toSerialize["ssh_user"] = o.SshUser toSerialize["ssh_port"] = o.SshPort toSerialize["status"] = o.Status + if !IsNil(o.StatusDetails) { + toSerialize["status_details"] = o.StatusDetails + } toSerialize["cost_estimate"] = o.CostEstimate if !IsNil(o.HourlyPrice) { toSerialize["hourly_price"] = o.HourlyPrice @@ -604,11 +742,20 @@ func (o Instance) ToMap() (map[string]interface{}, error) { if !IsNil(o.LaunchConfiguration) { toSerialize["launch_configuration"] = o.LaunchConfiguration } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } if !IsNil(o.PortMappings) { toSerialize["port_mappings"] = o.PortMappings } + if !IsNil(o.ActiveAt) { + toSerialize["active_at"] = o.ActiveAt + } toSerialize["created_at"] = o.CreatedAt toSerialize["deleted_at"] = o.DeletedAt + if !IsNil(o.BootTime) { + toSerialize["boot_time"] = o.BootTime + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -680,12 +827,16 @@ func (o *Instance) UnmarshalJSON(data []byte) (err error) { delete(additionalProperties, "ssh_user") delete(additionalProperties, "ssh_port") delete(additionalProperties, "status") + delete(additionalProperties, "status_details") delete(additionalProperties, "cost_estimate") delete(additionalProperties, "hourly_price") delete(additionalProperties, "launch_configuration") + delete(additionalProperties, "tags") delete(additionalProperties, "port_mappings") + delete(additionalProperties, "active_at") delete(additionalProperties, "created_at") delete(additionalProperties, "deleted_at") + delete(additionalProperties, "boot_time") o.AdditionalProperties = additionalProperties } diff --git a/internal/shadeform/gen/shadeform/model_instance_info_response.go b/internal/shadeform/gen/shadeform/model_instance_info_response.go index c863cfd1..de86f98e 100644 --- a/internal/shadeform/gen/shadeform/model_instance_info_response.go +++ b/internal/shadeform/gen/shadeform/model_instance_info_response.go @@ -45,6 +45,8 @@ type InstanceInfoResponse struct { // The SSH port of the instance. In most cases, this will be port 22 but for some clouds, this may be a different port. SshPort int32 `json:"ssh_port"` Status Status `json:"status"` + // Additional context for the status + StatusDetails *string `json:"status_details,omitempty"` // The cost incurred by the instance. This only the cost via Shadeform. If the instance is deployed in your own cloud account, then all billing is through your cloud provider. CostEstimate string `json:"cost_estimate"` // The hourly price of the instance in cents. @@ -63,10 +65,13 @@ type InstanceInfoResponse struct { Envs []Env `json:"envs,omitempty"` // List of port mappings on an instance that a Cloud Provider might have automatically set up. PortMappings []InstancePortMappings `json:"port_mappings,omitempty"` + // The timestamp of when the instance was active in UTC. + ActiveAt *time.Time `json:"active_at,omitempty"` // The timestamp of when the instance was created in UTC. CreatedAt time.Time `json:"created_at"` // The timestamp of when the instance was deleted in UTC. DeletedAt time.Time `json:"deleted_at"` + BootTime *BootTime `json:"boot_time,omitempty"` AdditionalProperties map[string]interface{} } @@ -417,6 +422,38 @@ func (o *InstanceInfoResponse) SetStatus(v Status) { o.Status = v } +// GetStatusDetails returns the StatusDetails field value if set, zero value otherwise. +func (o *InstanceInfoResponse) GetStatusDetails() string { + if o == nil || IsNil(o.StatusDetails) { + var ret string + return ret + } + return *o.StatusDetails +} + +// GetStatusDetailsOk returns a tuple with the StatusDetails field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstanceInfoResponse) GetStatusDetailsOk() (*string, bool) { + if o == nil || IsNil(o.StatusDetails) { + return nil, false + } + return o.StatusDetails, true +} + +// HasStatusDetails returns a boolean if a field has been set. +func (o *InstanceInfoResponse) HasStatusDetails() bool { + if o != nil && !IsNil(o.StatusDetails) { + return true + } + + return false +} + +// SetStatusDetails gets a reference to the given string and assigns it to the StatusDetails field. +func (o *InstanceInfoResponse) SetStatusDetails(v string) { + o.StatusDetails = &v +} + // GetCostEstimate returns the CostEstimate field value func (o *InstanceInfoResponse) GetCostEstimate() string { if o == nil { @@ -761,6 +798,38 @@ func (o *InstanceInfoResponse) SetPortMappings(v []InstancePortMappings) { o.PortMappings = v } +// GetActiveAt returns the ActiveAt field value if set, zero value otherwise. +func (o *InstanceInfoResponse) GetActiveAt() time.Time { + if o == nil || IsNil(o.ActiveAt) { + var ret time.Time + return ret + } + return *o.ActiveAt +} + +// GetActiveAtOk returns a tuple with the ActiveAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstanceInfoResponse) GetActiveAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.ActiveAt) { + return nil, false + } + return o.ActiveAt, true +} + +// HasActiveAt returns a boolean if a field has been set. +func (o *InstanceInfoResponse) HasActiveAt() bool { + if o != nil && !IsNil(o.ActiveAt) { + return true + } + + return false +} + +// SetActiveAt gets a reference to the given time.Time and assigns it to the ActiveAt field. +func (o *InstanceInfoResponse) SetActiveAt(v time.Time) { + o.ActiveAt = &v +} + // GetCreatedAt returns the CreatedAt field value func (o *InstanceInfoResponse) GetCreatedAt() time.Time { if o == nil { @@ -809,6 +878,38 @@ func (o *InstanceInfoResponse) SetDeletedAt(v time.Time) { o.DeletedAt = v } +// GetBootTime returns the BootTime field value if set, zero value otherwise. +func (o *InstanceInfoResponse) GetBootTime() BootTime { + if o == nil || IsNil(o.BootTime) { + var ret BootTime + return ret + } + return *o.BootTime +} + +// GetBootTimeOk returns a tuple with the BootTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstanceInfoResponse) GetBootTimeOk() (*BootTime, bool) { + if o == nil || IsNil(o.BootTime) { + return nil, false + } + return o.BootTime, true +} + +// HasBootTime returns a boolean if a field has been set. +func (o *InstanceInfoResponse) HasBootTime() bool { + if o != nil && !IsNil(o.BootTime) { + return true + } + + return false +} + +// SetBootTime gets a reference to the given BootTime and assigns it to the BootTime field. +func (o *InstanceInfoResponse) SetBootTime(v BootTime) { + o.BootTime = &v +} + func (o InstanceInfoResponse) MarshalJSON() ([]byte, error) { toSerialize, err := o.ToMap() if err != nil { @@ -832,6 +933,9 @@ func (o InstanceInfoResponse) ToMap() (map[string]interface{}, error) { toSerialize["ssh_user"] = o.SshUser toSerialize["ssh_port"] = o.SshPort toSerialize["status"] = o.Status + if !IsNil(o.StatusDetails) { + toSerialize["status_details"] = o.StatusDetails + } toSerialize["cost_estimate"] = o.CostEstimate if !IsNil(o.HourlyPrice) { toSerialize["hourly_price"] = o.HourlyPrice @@ -863,8 +967,14 @@ func (o InstanceInfoResponse) ToMap() (map[string]interface{}, error) { if !IsNil(o.PortMappings) { toSerialize["port_mappings"] = o.PortMappings } + if !IsNil(o.ActiveAt) { + toSerialize["active_at"] = o.ActiveAt + } toSerialize["created_at"] = o.CreatedAt toSerialize["deleted_at"] = o.DeletedAt + if !IsNil(o.BootTime) { + toSerialize["boot_time"] = o.BootTime + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -936,6 +1046,7 @@ func (o *InstanceInfoResponse) UnmarshalJSON(data []byte) (err error) { delete(additionalProperties, "ssh_user") delete(additionalProperties, "ssh_port") delete(additionalProperties, "status") + delete(additionalProperties, "status_details") delete(additionalProperties, "cost_estimate") delete(additionalProperties, "hourly_price") delete(additionalProperties, "volume_ids") @@ -947,8 +1058,10 @@ func (o *InstanceInfoResponse) UnmarshalJSON(data []byte) (err error) { delete(additionalProperties, "tags") delete(additionalProperties, "envs") delete(additionalProperties, "port_mappings") + delete(additionalProperties, "active_at") delete(additionalProperties, "created_at") delete(additionalProperties, "deleted_at") + delete(additionalProperties, "boot_time") o.AdditionalProperties = additionalProperties } diff --git a/internal/shadeform/gen/shadeform/model_instance_type.go b/internal/shadeform/gen/shadeform/model_instance_type.go index 0e1ed4d4..b0fc7ba8 100644 --- a/internal/shadeform/gen/shadeform/model_instance_type.go +++ b/internal/shadeform/gen/shadeform/model_instance_type.go @@ -30,9 +30,9 @@ type InstanceType struct { // The hourly price of the instance in cents. HourlyPrice int32 `json:"hourly_price"` // Whether the instance is a \"vm\" (virtual machine), a \"container\" (docker container), or \"baremetal\" (bare metal server). - DeploymentType string `json:"deployment_type"` - Availability []Availability `json:"availability"` - BootTime map[string]interface{} `json:"boot_time,omitempty"` + DeploymentType string `json:"deployment_type"` + Availability []Availability `json:"availability"` + BootTime *BootTime `json:"boot_time,omitempty"` // The amount of memory for the instance in gigabytes. Note that this is not VRAM which is determined by GPU type and the number of GPUs. MemoryInGb *int32 `json:"memory_in_gb,omitempty"` // The amount of storage for the instance. If this storage is too low for the instance type, please email support@shadeform.ai as the storage may be adjustable. @@ -245,19 +245,19 @@ func (o *InstanceType) SetAvailability(v []Availability) { } // GetBootTime returns the BootTime field value if set, zero value otherwise. -func (o *InstanceType) GetBootTime() map[string]interface{} { +func (o *InstanceType) GetBootTime() BootTime { if o == nil || IsNil(o.BootTime) { - var ret map[string]interface{} + var ret BootTime return ret } - return o.BootTime + return *o.BootTime } // GetBootTimeOk returns a tuple with the BootTime field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *InstanceType) GetBootTimeOk() (map[string]interface{}, bool) { +func (o *InstanceType) GetBootTimeOk() (*BootTime, bool) { if o == nil || IsNil(o.BootTime) { - return map[string]interface{}{}, false + return nil, false } return o.BootTime, true } @@ -271,9 +271,9 @@ func (o *InstanceType) HasBootTime() bool { return false } -// SetBootTime gets a reference to the given map[string]interface{} and assigns it to the BootTime field. -func (o *InstanceType) SetBootTime(v map[string]interface{}) { - o.BootTime = v +// SetBootTime gets a reference to the given BootTime and assigns it to the BootTime field. +func (o *InstanceType) SetBootTime(v BootTime) { + o.BootTime = &v } // GetMemoryInGb returns the MemoryInGb field value if set, zero value otherwise. diff --git a/internal/shadeform/v1/client.go b/internal/shadeform/v1/client.go index d5d05d0d..aa695651 100644 --- a/internal/shadeform/v1/client.go +++ b/internal/shadeform/v1/client.go @@ -115,5 +115,10 @@ func (c *ShadeformClient) GetReferenceID() string { } func (c *ShadeformClient) makeAuthContext(ctx context.Context) context.Context { - return context.WithValue(ctx, openapi.ContextAPIKeys, c.apiKey) + return context.WithValue(ctx, openapi.ContextAPIKeys, map[string]openapi.APIKey{ + "ApiKeyAuth": { + Key: c.apiKey, + Prefix: "", // or "" if no prefix is needed + }, + }) } diff --git a/internal/shadeform/v1/instance.go b/internal/shadeform/v1/instance.go index ddf5f3a6..1b3a8d79 100644 --- a/internal/shadeform/v1/instance.go +++ b/internal/shadeform/v1/instance.go @@ -31,6 +31,8 @@ func (c *ShadeformClient) CreateInstance(ctx context.Context, attrs v1.CreateIns Region: region, ShadeInstanceType: shadeInstanceType, Name: attrs.Name, + ShadeCloud: true, + Tags: []string{attrs.RefID}, } resp, httpResp, err := c.client.DefaultAPI.InstancesCreate(authCtx).CreateRequest(req).Execute() @@ -118,6 +120,7 @@ func (c *ShadeformClient) MergeInstanceTypeForUpdate(currIt v1.InstanceType, _ v return currIt } +// convertInstanceInfoResponseToV1Instance - converts Instance Info to v1 instance func (c *ShadeformClient) convertInstanceInfoResponseToV1Instance(instanceInfo openapi.InstanceInfoResponse) *v1.Instance { var lifecycleStatus v1.LifecycleStatus switch instanceInfo.Status { @@ -137,6 +140,11 @@ func (c *ShadeformClient) convertInstanceInfoResponseToV1Instance(instanceInfo o instanceType := c.getInstanceType(string(instanceInfo.Cloud), instanceInfo.ShadeInstanceType) + refID := "" + if instanceInfo.Tags != nil && len(instanceInfo.Tags) > 0 { + refID = instanceInfo.Tags[0] + } + instance := &v1.Instance{ Name: instanceInfo.Name, CreatedAt: instanceInfo.CreatedAt, @@ -155,11 +163,14 @@ func (c *ShadeformClient) convertInstanceInfoResponseToV1Instance(instanceInfo o Location: instanceInfo.Region, Stoppable: false, Rebootable: true, + RefID: refID, } return instance } +// convertInstanceInfoResponseToV1Instance - converts /instances response to v1 instance; the api struct is slightly +// different from instance info so keeping it as a separate function for now func (c *ShadeformClient) convertShadeformInstanceToV1Instance(shadeformInstance openapi.Instance) *v1.Instance { var lifecycleStatus v1.LifecycleStatus @@ -180,6 +191,11 @@ func (c *ShadeformClient) convertShadeformInstanceToV1Instance(shadeformInstance instanceType := c.getInstanceType(string(shadeformInstance.Cloud), shadeformInstance.ShadeInstanceType) + refID := "" + if shadeformInstance.Tags != nil && len(shadeformInstance.Tags) > 0 { + refID = shadeformInstance.Tags[0] + } + instance := &v1.Instance{ Name: shadeformInstance.Name, CreatedAt: shadeformInstance.CreatedAt, @@ -198,6 +214,7 @@ func (c *ShadeformClient) convertShadeformInstanceToV1Instance(shadeformInstance Location: shadeformInstance.Region, Stoppable: false, Rebootable: true, + RefID: refID, } return instance diff --git a/pkg/v1/image.go b/pkg/v1/image.go index 60778e18..4298ac71 100644 --- a/pkg/v1/image.go +++ b/pkg/v1/image.go @@ -131,7 +131,7 @@ func validateHomeDirectory(ctx context.Context, sshClient *ssh.Client, sshUser s return "", fmt.Errorf("expected ubuntu user home directory to contain /home/ubuntu, got: %s", homeDir) } } else { - if !strings.Contains(homeDir, "/root") { + if !strings.Contains(homeDir, "/root") && !strings.Contains(homeDir, fmt.Sprintf("/home/%v", sshUser)) { return "", fmt.Errorf("expected non-ubuntu user home directory to contain /root, got: %s", homeDir) } } From 56fe375a931604813c50fd1b5e4c6b3fd8e63bb2 Mon Sep 17 00:00:00 2001 From: Ronald Ding Date: Mon, 18 Aug 2025 17:00:03 -0700 Subject: [PATCH 03/12] feat: add ssh support and instance type filter --- internal/shadeform/v1/configuration.go | 22 ++++++---- internal/shadeform/v1/instance.go | 50 +++++++++++++++++++++ internal/shadeform/v1/instancetype.go | 37 +++++++++++++--- internal/shadeform/v1/validation_test.go | 56 ++++++++++++++++++++++++ 4 files changed, 152 insertions(+), 13 deletions(-) diff --git a/internal/shadeform/v1/configuration.go b/internal/shadeform/v1/configuration.go index 8bf30505..36c82b7a 100644 --- a/internal/shadeform/v1/configuration.go +++ b/internal/shadeform/v1/configuration.go @@ -1,18 +1,24 @@ package v1 +import ( + openapi "github.com/brevdev/cloud/internal/shadeform/gen/shadeform" +) + type Configuration struct { - AllowedInstanceTypes map[string][]string + AllowedInstanceTypes map[openapi.Cloud]map[string]bool } -func (c *Configuration) isAllowed(cloud string, shadeInstanceType string) bool { - allowedInstanceTypes, found := c.AllowedInstanceTypes[cloud] +func (c *Configuration) isAllowed(cloud openapi.Cloud, shadeInstanceType string) bool { + + allowedClouds, found := c.AllowedInstanceTypes[cloud] if !found { return false } - for _, allowedInstanceType := range allowedInstanceTypes { - if shadeInstanceType == allowedInstanceType { - return true - } + + _, found = allowedClouds[shadeInstanceType] + if !found { + return false } - return false + + return found } diff --git a/internal/shadeform/v1/instance.go b/internal/shadeform/v1/instance.go index 1b3a8d79..b35dc8d0 100644 --- a/internal/shadeform/v1/instance.go +++ b/internal/shadeform/v1/instance.go @@ -6,6 +6,8 @@ import ( "github.com/alecthomas/units" openapi "github.com/brevdev/cloud/internal/shadeform/gen/shadeform" "github.com/brevdev/cloud/pkg/v1" + "github.com/google/uuid" + "strings" ) const ( @@ -15,6 +17,30 @@ const ( func (c *ShadeformClient) CreateInstance(ctx context.Context, attrs v1.CreateInstanceAttrs) (*v1.Instance, error) { authCtx := c.makeAuthContext(ctx) + // Check if the instance type is allowed by configuration + if !c.isInstanceTypeAllowed(attrs.InstanceType) { + return nil, fmt.Errorf("instance type: %v is not deployable", attrs.InstanceType) + } + + sshKeyID := "" + + keyPairName := attrs.RefID + if attrs.KeyPairName != nil { + keyPairName = *attrs.KeyPairName + } + + if keyPairName == "" { + keyPairName = uuid.New().String() + } + + if attrs.PublicKey != "" { + var err error + sshKeyID, err = c.addSshKey(ctx, keyPairName, attrs.PublicKey) + if err != nil && !strings.Contains(err.Error(), "name must be unique") { + return nil, fmt.Errorf("failed to add SSH key: %w", err) + } + } + region := attrs.Location cloud, shadeInstanceType, err := c.getShadeformCloudAndInstanceType(attrs.InstanceType) if err != nil { @@ -33,6 +59,7 @@ func (c *ShadeformClient) CreateInstance(ctx context.Context, attrs v1.CreateIns Name: attrs.Name, ShadeCloud: true, Tags: []string{attrs.RefID}, + SshKeyId: &sshKeyID, } resp, httpResp, err := c.client.DefaultAPI.InstancesCreate(authCtx).CreateRequest(req).Execute() @@ -57,6 +84,29 @@ func (c *ShadeformClient) CreateInstance(ctx context.Context, attrs v1.CreateIns return createdInstance, nil } +func (c *ShadeformClient) addSshKey(ctx context.Context, keyPairName string, publicKey string) (string, error) { + authCtx := c.makeAuthContext(ctx) + + request := openapi.AddSshKeyRequest{ + Name: keyPairName, + PublicKey: publicKey, + } + + resp, httpResp, err := c.client.DefaultAPI.SshKeysAdd(authCtx).AddSshKeyRequest(request).Execute() + if httpResp != nil && httpResp.Body != nil { + defer func() { _ = httpResp.Body.Close() }() + } + if err != nil { + return "", fmt.Errorf("failed to add SSH Key: %w", err) + } + + if resp == nil { + return "", fmt.Errorf("no instance returned from post request") + } + + return resp.Id, nil +} + func (c *ShadeformClient) GetInstance(ctx context.Context, instanceID v1.CloudProviderInstanceID) (*v1.Instance, error) { authCtx := c.makeAuthContext(ctx) diff --git a/internal/shadeform/v1/instancetype.go b/internal/shadeform/v1/instancetype.go index aeb22276..2e852eb7 100644 --- a/internal/shadeform/v1/instancetype.go +++ b/internal/shadeform/v1/instancetype.go @@ -44,7 +44,12 @@ func (c *ShadeformClient) GetInstanceTypes(ctx context.Context, args v1.GetInsta if err != nil { return nil, err } - instanceTypes = append(instanceTypes, instanceTypesFromShadeformInstanceType...) + // Filter the list down to the instance types that are allowed by the configuration filter + for _, singleInstanceType := range instanceTypesFromShadeformInstanceType { + if c.isInstanceTypeAllowed(singleInstanceType.Type) { + instanceTypes = append(instanceTypes, singleInstanceType) + } + } } return instanceTypes, nil @@ -95,6 +100,29 @@ func (c *ShadeformClient) GetLocations(ctx context.Context, _ v1.GetLocationsArg return locations, nil } +// isInstanceTypeAllowed - determines if an instance type is allowed based on configuration +func (c *ShadeformClient) isInstanceTypeAllowed(instanceType string) bool { + + // By default, everything is allowed + if c.config == nil || c.config.AllowedInstanceTypes == nil { + return true + } + + // Convert to Cloud and Instance Type + cloud, shadeInstanceType, err := c.getShadeformCloudAndInstanceType(instanceType) + if err != nil { + return false + } + + // Convert to API Cloud Enum + cloudEnum, err := openapi.NewCloudFromValue(cloud) + if err != nil { + return false + } + + return c.config.isAllowed(*cloudEnum, shadeInstanceType) +} + // getInstanceType - gets the Brev instance type from the shadeform cloud and shade instance type // TODO: determine if it would be better to include the shadeform cloud inside the region / location instead func (c *ShadeformClient) getInstanceType(shadeformCloud string, shadeformInstanceType string) string { @@ -109,7 +137,7 @@ func (c *ShadeformClient) getInstanceTypeID(instanceType string, region string) func (c *ShadeformClient) getShadeformCloudAndInstanceType(instanceType string) (string, string, error) { shadeformCloud, shadeformInstanceType, found := strings.Cut(instanceType, "_") if !found { - return "", "", errors.New("Could not determine shadeform cloud and instance type from instance type") + return "", "", errors.New("could not determine shadeform cloud and instance type from instance type") } return shadeformCloud, shadeformInstanceType, nil } @@ -138,9 +166,8 @@ func (c *ShadeformClient) convertShadeformInstanceTypeToV1InstanceType(shadeform MemoryDetails: "", NetworkDetails: "", Manufacturer: "", - // TODO: Need to double check if there is a standard for name and type - Name: shadeformInstanceType.Configuration.GpuType, - Type: shadeformInstanceType.Configuration.GpuType, + Name: shadeformInstanceType.Configuration.GpuType, + Type: shadeformInstanceType.Configuration.GpuType, }, }, BasePrice: basePrice, diff --git a/internal/shadeform/v1/validation_test.go b/internal/shadeform/v1/validation_test.go index dd61c5f3..5db59610 100644 --- a/internal/shadeform/v1/validation_test.go +++ b/internal/shadeform/v1/validation_test.go @@ -1,10 +1,16 @@ package v1 import ( + "context" + openapi "github.com/brevdev/cloud/internal/shadeform/gen/shadeform" "github.com/brevdev/cloud/internal/validation" + "github.com/brevdev/cloud/pkg/ssh" v1 "github.com/brevdev/cloud/pkg/v1" + "github.com/google/uuid" + "github.com/stretchr/testify/require" "os" "testing" + "time" ) func TestValidationFunctions(t *testing.T) { @@ -30,6 +36,56 @@ func TestInstanceLifecycleValidation(t *testing.T) { validation.RunInstanceLifecycleValidation(t, config) } +func TestInstanceTypeFilter(t *testing.T) { + checkSkip(t) + apiKey := getAPIKey() + + ctx, cancel := context.WithTimeout(context.Background(), 15*time.Minute) + defer cancel() + + client := NewShadeformClient("validation-test", apiKey) + client.WithConfiguration(Configuration{ + AllowedInstanceTypes: map[openapi.Cloud]map[string]bool{ + openapi.DATACRUNCH: { + "B200": true, + }, + }, + }) + + types, err := client.GetInstanceTypes(ctx, v1.GetInstanceTypeArgs{}) + require.NoError(t, err) + require.NotEmpty(t, types, "Should have instance types") + require.True(t, len(types) == 1, "Instance types should return only one entry") + require.True(t, types[0].Type == "datacrunch_B200", "returned instance type does not match expectations") + + if !types[0].IsAvailable { + return + } + + instance, err := client.CreateInstance(ctx, v1.CreateInstanceAttrs{ + RefID: uuid.New().String(), + InstanceType: types[0].Type, + Location: types[0].Location, + PublicKey: ssh.GetTestPublicKey(), + Name: "test_name", + }) + + if err != nil { + t.Fatalf("ValidateCreateInstance failed: %v", err) + } + require.NotNil(t, instance) + + t.Run("ValidateSSHAccessible", func(t *testing.T) { + err := v1.ValidateInstanceSSHAccessible(ctx, client, instance, ssh.GetTestPrivateKey()) + require.NoError(t, err, "ValidateSSHAccessible should pass") + }) + + t.Run("ValidateTerminateInstance", func(t *testing.T) { + err := v1.ValidateTerminateInstance(ctx, client, instance) + require.NoError(t, err, "ValidateTerminateInstance should pass") + }) +} + func checkSkip(t *testing.T) { apiKey := getAPIKey() isValidationTest := os.Getenv("VALIDATION_TEST") From 3ffa2dab399789d4934583863992eb52a44a0671 Mon Sep 17 00:00:00 2001 From: Ronald Ding Date: Mon, 18 Aug 2025 17:27:51 -0700 Subject: [PATCH 04/12] fix: update validation tests and make file --- internal/shadeform/Makefile | 4 +- .../shadeform/gen/shadeform/api/openapi.yaml | 78 +---- .../gen/shadeform/docs/InstanceType.md | 182 ------------ .../gen/shadeform/model_instance_type.go | 272 +----------------- internal/shadeform/v1/validation_test.go | 24 +- 5 files changed, 32 insertions(+), 528 deletions(-) diff --git a/internal/shadeform/Makefile b/internal/shadeform/Makefile index 6544745a..2902e3ef 100644 --- a/internal/shadeform/Makefile +++ b/internal/shadeform/Makefile @@ -1,7 +1,7 @@ generate-shadeform-client: - docker run --rm -v "${PWD}:/local" -v "/Users/ronald/shade/docs:/docs" openapitools/openapi-generator-cli:v7.8.0 generate \ + docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli:v7.8.0 generate \ --additional-properties disallowAdditionalPropertiesIfNotPresent=false \ - -i /docs/openapi.yaml \ + -i https://raw.githubusercontent.com/shadeform/docs/refs/heads/main/openapi.yaml \ -g go \ --git-user-id shadeform \ --git-repo-id cloud-shadeform \ diff --git a/internal/shadeform/gen/shadeform/api/openapi.yaml b/internal/shadeform/gen/shadeform/api/openapi.yaml index 50f862ad..ea04682f 100644 --- a/internal/shadeform/gen/shadeform/api/openapi.yaml +++ b/internal/shadeform/gen/shadeform/api/openapi.yaml @@ -499,7 +499,12 @@ components: description: Response of /instances/types example: instance_types: - - nvlink: true + - cloud: hyperstack + hourly_price: 210 + deployment_type: vm + boot_time: + max_boot_in_sec: 300 + min_boot_in_sec: 180 configuration: nvlink: true num_gpus: 1 @@ -512,10 +517,7 @@ components: os_options: - ubuntu22.04_cuda12.2_shade_os - ubuntu20.04_cuda12.0_shade_os - num_gpus: 1 - gpu_type: A100 cloud_instance_type: gpu_1x_a6000 - memory_in_gb: 12 availability: - region: us-central-1 available: true @@ -523,17 +525,13 @@ components: - region: us-central-2 available: false display_name: "US, Wichita, KS" - vcpus: 6 - interconnect: pcie shade_instance_type: A6000 - cloud: hyperstack + - cloud: hyperstack hourly_price: 210 deployment_type: vm boot_time: max_boot_in_sec: 300 min_boot_in_sec: 180 - storage_in_gb: 256 - - nvlink: true configuration: nvlink: true num_gpus: 1 @@ -546,10 +544,7 @@ components: os_options: - ubuntu22.04_cuda12.2_shade_os - ubuntu20.04_cuda12.0_shade_os - num_gpus: 1 - gpu_type: A100 cloud_instance_type: gpu_1x_a6000 - memory_in_gb: 12 availability: - region: us-central-1 available: true @@ -557,16 +552,7 @@ components: - region: us-central-2 available: false display_name: "US, Wichita, KS" - vcpus: 6 - interconnect: pcie shade_instance_type: A6000 - cloud: hyperstack - hourly_price: 210 - deployment_type: vm - boot_time: - max_boot_in_sec: 300 - min_boot_in_sec: 180 - storage_in_gb: 256 properties: instance_types: items: @@ -578,7 +564,12 @@ components: InstanceType: description: Information about a specific instance type example: - nvlink: true + cloud: hyperstack + hourly_price: 210 + deployment_type: vm + boot_time: + max_boot_in_sec: 300 + min_boot_in_sec: 180 configuration: nvlink: true num_gpus: 1 @@ -591,10 +582,7 @@ components: os_options: - ubuntu22.04_cuda12.2_shade_os - ubuntu20.04_cuda12.0_shade_os - num_gpus: 1 - gpu_type: A100 cloud_instance_type: gpu_1x_a6000 - memory_in_gb: 12 availability: - region: us-central-1 available: true @@ -602,16 +590,7 @@ components: - region: us-central-2 available: false display_name: "US, Wichita, KS" - vcpus: 6 - interconnect: pcie shade_instance_type: A6000 - cloud: hyperstack - hourly_price: 210 - deployment_type: vm - boot_time: - max_boot_in_sec: 300 - min_boot_in_sec: 180 - storage_in_gb: 256 properties: cloud: $ref: '#/components/schemas/Cloud' @@ -650,37 +629,6 @@ components: type: array boot_time: $ref: '#/components/schemas/BootTime' - memory_in_gb: - description: The amount of memory for the instance in gigabytes. Note that - this is not VRAM which is determined by GPU type and the number of GPUs. - example: 12 - type: integer - storage_in_gb: - description: "The amount of storage for the instance. If this storage is\ - \ too low for the instance type, please email support@shadeform.ai as\ - \ the storage may be adjustable." - example: 256 - type: integer - vcpus: - description: The number of vCPUs for the instance. - example: 6 - type: integer - num_gpus: - description: The number of GPUs for the instance. - example: 1 - type: integer - gpu_type: - description: The type of GPU for the instance. - example: A100 - type: string - interconnect: - description: The type of GPU interconnect. - example: pcie - type: string - nvlink: - description: If the instance has NVLink - example: true - type: boolean required: - availability - cloud diff --git a/internal/shadeform/gen/shadeform/docs/InstanceType.md b/internal/shadeform/gen/shadeform/docs/InstanceType.md index d68a2c4f..8ff28d3f 100644 --- a/internal/shadeform/gen/shadeform/docs/InstanceType.md +++ b/internal/shadeform/gen/shadeform/docs/InstanceType.md @@ -12,13 +12,6 @@ Name | Type | Description | Notes **DeploymentType** | **string** | Whether the instance is a \"vm\" (virtual machine), a \"container\" (docker container), or \"baremetal\" (bare metal server). | **Availability** | [**[]Availability**](Availability.md) | | **BootTime** | Pointer to [**BootTime**](BootTime.md) | | [optional] -**MemoryInGb** | Pointer to **int32** | The amount of memory for the instance in gigabytes. Note that this is not VRAM which is determined by GPU type and the number of GPUs. | [optional] -**StorageInGb** | Pointer to **int32** | The amount of storage for the instance. If this storage is too low for the instance type, please email support@shadeform.ai as the storage may be adjustable. | [optional] -**Vcpus** | Pointer to **int32** | The number of vCPUs for the instance. | [optional] -**NumGpus** | Pointer to **int32** | The number of GPUs for the instance. | [optional] -**GpuType** | Pointer to **string** | The type of GPU for the instance. | [optional] -**Interconnect** | Pointer to **string** | The type of GPU interconnect. | [optional] -**Nvlink** | Pointer to **bool** | If the instance has NVLink | [optional] ## Methods @@ -204,181 +197,6 @@ SetBootTime sets BootTime field to given value. HasBootTime returns a boolean if a field has been set. -### GetMemoryInGb - -`func (o *InstanceType) GetMemoryInGb() int32` - -GetMemoryInGb returns the MemoryInGb field if non-nil, zero value otherwise. - -### GetMemoryInGbOk - -`func (o *InstanceType) GetMemoryInGbOk() (*int32, bool)` - -GetMemoryInGbOk returns a tuple with the MemoryInGb field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetMemoryInGb - -`func (o *InstanceType) SetMemoryInGb(v int32)` - -SetMemoryInGb sets MemoryInGb field to given value. - -### HasMemoryInGb - -`func (o *InstanceType) HasMemoryInGb() bool` - -HasMemoryInGb returns a boolean if a field has been set. - -### GetStorageInGb - -`func (o *InstanceType) GetStorageInGb() int32` - -GetStorageInGb returns the StorageInGb field if non-nil, zero value otherwise. - -### GetStorageInGbOk - -`func (o *InstanceType) GetStorageInGbOk() (*int32, bool)` - -GetStorageInGbOk returns a tuple with the StorageInGb field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetStorageInGb - -`func (o *InstanceType) SetStorageInGb(v int32)` - -SetStorageInGb sets StorageInGb field to given value. - -### HasStorageInGb - -`func (o *InstanceType) HasStorageInGb() bool` - -HasStorageInGb returns a boolean if a field has been set. - -### GetVcpus - -`func (o *InstanceType) GetVcpus() int32` - -GetVcpus returns the Vcpus field if non-nil, zero value otherwise. - -### GetVcpusOk - -`func (o *InstanceType) GetVcpusOk() (*int32, bool)` - -GetVcpusOk returns a tuple with the Vcpus field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetVcpus - -`func (o *InstanceType) SetVcpus(v int32)` - -SetVcpus sets Vcpus field to given value. - -### HasVcpus - -`func (o *InstanceType) HasVcpus() bool` - -HasVcpus returns a boolean if a field has been set. - -### GetNumGpus - -`func (o *InstanceType) GetNumGpus() int32` - -GetNumGpus returns the NumGpus field if non-nil, zero value otherwise. - -### GetNumGpusOk - -`func (o *InstanceType) GetNumGpusOk() (*int32, bool)` - -GetNumGpusOk returns a tuple with the NumGpus field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetNumGpus - -`func (o *InstanceType) SetNumGpus(v int32)` - -SetNumGpus sets NumGpus field to given value. - -### HasNumGpus - -`func (o *InstanceType) HasNumGpus() bool` - -HasNumGpus returns a boolean if a field has been set. - -### GetGpuType - -`func (o *InstanceType) GetGpuType() string` - -GetGpuType returns the GpuType field if non-nil, zero value otherwise. - -### GetGpuTypeOk - -`func (o *InstanceType) GetGpuTypeOk() (*string, bool)` - -GetGpuTypeOk returns a tuple with the GpuType field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetGpuType - -`func (o *InstanceType) SetGpuType(v string)` - -SetGpuType sets GpuType field to given value. - -### HasGpuType - -`func (o *InstanceType) HasGpuType() bool` - -HasGpuType returns a boolean if a field has been set. - -### GetInterconnect - -`func (o *InstanceType) GetInterconnect() string` - -GetInterconnect returns the Interconnect field if non-nil, zero value otherwise. - -### GetInterconnectOk - -`func (o *InstanceType) GetInterconnectOk() (*string, bool)` - -GetInterconnectOk returns a tuple with the Interconnect field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetInterconnect - -`func (o *InstanceType) SetInterconnect(v string)` - -SetInterconnect sets Interconnect field to given value. - -### HasInterconnect - -`func (o *InstanceType) HasInterconnect() bool` - -HasInterconnect returns a boolean if a field has been set. - -### GetNvlink - -`func (o *InstanceType) GetNvlink() bool` - -GetNvlink returns the Nvlink field if non-nil, zero value otherwise. - -### GetNvlinkOk - -`func (o *InstanceType) GetNvlinkOk() (*bool, bool)` - -GetNvlinkOk returns a tuple with the Nvlink field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetNvlink - -`func (o *InstanceType) SetNvlink(v bool)` - -SetNvlink sets Nvlink field to given value. - -### HasNvlink - -`func (o *InstanceType) HasNvlink() bool` - -HasNvlink 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/shadeform/gen/shadeform/model_instance_type.go b/internal/shadeform/gen/shadeform/model_instance_type.go index b0fc7ba8..7705d3ec 100644 --- a/internal/shadeform/gen/shadeform/model_instance_type.go +++ b/internal/shadeform/gen/shadeform/model_instance_type.go @@ -30,23 +30,9 @@ type InstanceType struct { // The hourly price of the instance in cents. HourlyPrice int32 `json:"hourly_price"` // Whether the instance is a \"vm\" (virtual machine), a \"container\" (docker container), or \"baremetal\" (bare metal server). - DeploymentType string `json:"deployment_type"` - Availability []Availability `json:"availability"` - BootTime *BootTime `json:"boot_time,omitempty"` - // The amount of memory for the instance in gigabytes. Note that this is not VRAM which is determined by GPU type and the number of GPUs. - MemoryInGb *int32 `json:"memory_in_gb,omitempty"` - // The amount of storage for the instance. If this storage is too low for the instance type, please email support@shadeform.ai as the storage may be adjustable. - StorageInGb *int32 `json:"storage_in_gb,omitempty"` - // The number of vCPUs for the instance. - Vcpus *int32 `json:"vcpus,omitempty"` - // The number of GPUs for the instance. - NumGpus *int32 `json:"num_gpus,omitempty"` - // The type of GPU for the instance. - GpuType *string `json:"gpu_type,omitempty"` - // The type of GPU interconnect. - Interconnect *string `json:"interconnect,omitempty"` - // If the instance has NVLink - Nvlink *bool `json:"nvlink,omitempty"` + DeploymentType string `json:"deployment_type"` + Availability []Availability `json:"availability"` + BootTime *BootTime `json:"boot_time,omitempty"` AdditionalProperties map[string]interface{} } @@ -276,230 +262,6 @@ func (o *InstanceType) SetBootTime(v BootTime) { o.BootTime = &v } -// GetMemoryInGb returns the MemoryInGb field value if set, zero value otherwise. -func (o *InstanceType) GetMemoryInGb() int32 { - if o == nil || IsNil(o.MemoryInGb) { - var ret int32 - return ret - } - return *o.MemoryInGb -} - -// GetMemoryInGbOk returns a tuple with the MemoryInGb field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *InstanceType) GetMemoryInGbOk() (*int32, bool) { - if o == nil || IsNil(o.MemoryInGb) { - return nil, false - } - return o.MemoryInGb, true -} - -// HasMemoryInGb returns a boolean if a field has been set. -func (o *InstanceType) HasMemoryInGb() bool { - if o != nil && !IsNil(o.MemoryInGb) { - return true - } - - return false -} - -// SetMemoryInGb gets a reference to the given int32 and assigns it to the MemoryInGb field. -func (o *InstanceType) SetMemoryInGb(v int32) { - o.MemoryInGb = &v -} - -// GetStorageInGb returns the StorageInGb field value if set, zero value otherwise. -func (o *InstanceType) GetStorageInGb() int32 { - if o == nil || IsNil(o.StorageInGb) { - var ret int32 - return ret - } - return *o.StorageInGb -} - -// GetStorageInGbOk returns a tuple with the StorageInGb field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *InstanceType) GetStorageInGbOk() (*int32, bool) { - if o == nil || IsNil(o.StorageInGb) { - return nil, false - } - return o.StorageInGb, true -} - -// HasStorageInGb returns a boolean if a field has been set. -func (o *InstanceType) HasStorageInGb() bool { - if o != nil && !IsNil(o.StorageInGb) { - return true - } - - return false -} - -// SetStorageInGb gets a reference to the given int32 and assigns it to the StorageInGb field. -func (o *InstanceType) SetStorageInGb(v int32) { - o.StorageInGb = &v -} - -// GetVcpus returns the Vcpus field value if set, zero value otherwise. -func (o *InstanceType) GetVcpus() int32 { - if o == nil || IsNil(o.Vcpus) { - var ret int32 - return ret - } - return *o.Vcpus -} - -// GetVcpusOk returns a tuple with the Vcpus field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *InstanceType) GetVcpusOk() (*int32, bool) { - if o == nil || IsNil(o.Vcpus) { - return nil, false - } - return o.Vcpus, true -} - -// HasVcpus returns a boolean if a field has been set. -func (o *InstanceType) HasVcpus() bool { - if o != nil && !IsNil(o.Vcpus) { - return true - } - - return false -} - -// SetVcpus gets a reference to the given int32 and assigns it to the Vcpus field. -func (o *InstanceType) SetVcpus(v int32) { - o.Vcpus = &v -} - -// GetNumGpus returns the NumGpus field value if set, zero value otherwise. -func (o *InstanceType) GetNumGpus() int32 { - if o == nil || IsNil(o.NumGpus) { - var ret int32 - return ret - } - return *o.NumGpus -} - -// GetNumGpusOk returns a tuple with the NumGpus field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *InstanceType) GetNumGpusOk() (*int32, bool) { - if o == nil || IsNil(o.NumGpus) { - return nil, false - } - return o.NumGpus, true -} - -// HasNumGpus returns a boolean if a field has been set. -func (o *InstanceType) HasNumGpus() bool { - if o != nil && !IsNil(o.NumGpus) { - return true - } - - return false -} - -// SetNumGpus gets a reference to the given int32 and assigns it to the NumGpus field. -func (o *InstanceType) SetNumGpus(v int32) { - o.NumGpus = &v -} - -// GetGpuType returns the GpuType field value if set, zero value otherwise. -func (o *InstanceType) GetGpuType() string { - if o == nil || IsNil(o.GpuType) { - var ret string - return ret - } - return *o.GpuType -} - -// GetGpuTypeOk returns a tuple with the GpuType field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *InstanceType) GetGpuTypeOk() (*string, bool) { - if o == nil || IsNil(o.GpuType) { - return nil, false - } - return o.GpuType, true -} - -// HasGpuType returns a boolean if a field has been set. -func (o *InstanceType) HasGpuType() bool { - if o != nil && !IsNil(o.GpuType) { - return true - } - - return false -} - -// SetGpuType gets a reference to the given string and assigns it to the GpuType field. -func (o *InstanceType) SetGpuType(v string) { - o.GpuType = &v -} - -// GetInterconnect returns the Interconnect field value if set, zero value otherwise. -func (o *InstanceType) GetInterconnect() string { - if o == nil || IsNil(o.Interconnect) { - var ret string - return ret - } - return *o.Interconnect -} - -// GetInterconnectOk returns a tuple with the Interconnect field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *InstanceType) GetInterconnectOk() (*string, bool) { - if o == nil || IsNil(o.Interconnect) { - return nil, false - } - return o.Interconnect, true -} - -// HasInterconnect returns a boolean if a field has been set. -func (o *InstanceType) HasInterconnect() bool { - if o != nil && !IsNil(o.Interconnect) { - return true - } - - return false -} - -// SetInterconnect gets a reference to the given string and assigns it to the Interconnect field. -func (o *InstanceType) SetInterconnect(v string) { - o.Interconnect = &v -} - -// GetNvlink returns the Nvlink field value if set, zero value otherwise. -func (o *InstanceType) GetNvlink() bool { - if o == nil || IsNil(o.Nvlink) { - var ret bool - return ret - } - return *o.Nvlink -} - -// GetNvlinkOk returns a tuple with the Nvlink field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *InstanceType) GetNvlinkOk() (*bool, bool) { - if o == nil || IsNil(o.Nvlink) { - return nil, false - } - return o.Nvlink, true -} - -// HasNvlink returns a boolean if a field has been set. -func (o *InstanceType) HasNvlink() bool { - if o != nil && !IsNil(o.Nvlink) { - return true - } - - return false -} - -// SetNvlink gets a reference to the given bool and assigns it to the Nvlink field. -func (o *InstanceType) SetNvlink(v bool) { - o.Nvlink = &v -} - func (o InstanceType) MarshalJSON() ([]byte, error) { toSerialize, err := o.ToMap() if err != nil { @@ -520,27 +282,6 @@ func (o InstanceType) ToMap() (map[string]interface{}, error) { if !IsNil(o.BootTime) { toSerialize["boot_time"] = o.BootTime } - if !IsNil(o.MemoryInGb) { - toSerialize["memory_in_gb"] = o.MemoryInGb - } - if !IsNil(o.StorageInGb) { - toSerialize["storage_in_gb"] = o.StorageInGb - } - if !IsNil(o.Vcpus) { - toSerialize["vcpus"] = o.Vcpus - } - if !IsNil(o.NumGpus) { - toSerialize["num_gpus"] = o.NumGpus - } - if !IsNil(o.GpuType) { - toSerialize["gpu_type"] = o.GpuType - } - if !IsNil(o.Interconnect) { - toSerialize["interconnect"] = o.Interconnect - } - if !IsNil(o.Nvlink) { - toSerialize["nvlink"] = o.Nvlink - } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -598,13 +339,6 @@ func (o *InstanceType) UnmarshalJSON(data []byte) (err error) { delete(additionalProperties, "deployment_type") delete(additionalProperties, "availability") delete(additionalProperties, "boot_time") - delete(additionalProperties, "memory_in_gb") - delete(additionalProperties, "storage_in_gb") - delete(additionalProperties, "vcpus") - delete(additionalProperties, "num_gpus") - delete(additionalProperties, "gpu_type") - delete(additionalProperties, "interconnect") - delete(additionalProperties, "nvlink") o.AdditionalProperties = additionalProperties } diff --git a/internal/shadeform/v1/validation_test.go b/internal/shadeform/v1/validation_test.go index 5db59610..fd66902f 100644 --- a/internal/shadeform/v1/validation_test.go +++ b/internal/shadeform/v1/validation_test.go @@ -14,6 +14,7 @@ import ( ) func TestValidationFunctions(t *testing.T) { + t.Parallel() checkSkip(t) apiKey := getAPIKey() @@ -25,18 +26,21 @@ func TestValidationFunctions(t *testing.T) { validation.RunValidationSuite(t, config) } -func TestInstanceLifecycleValidation(t *testing.T) { - checkSkip(t) - apiKey := getAPIKey() - - config := validation.ProviderConfig{ - Credential: NewShadeformCredential("validation-test", apiKey), - } - - validation.RunInstanceLifecycleValidation(t, config) -} +// +//func TestInstanceLifecycleValidation(t *testing.T) { +// t.Parallel() +// checkSkip(t) +// apiKey := getAPIKey() +// +// config := validation.ProviderConfig{ +// Credential: NewShadeformCredential("validation-test", apiKey), +// } +// +// validation.RunInstanceLifecycleValidation(t, config) +//} func TestInstanceTypeFilter(t *testing.T) { + t.Parallel() checkSkip(t) apiKey := getAPIKey() From c8687ecc232288656dd15cd307053013574124c8 Mon Sep 17 00:00:00 2001 From: Ronald Ding Date: Mon, 18 Aug 2025 17:29:35 -0700 Subject: [PATCH 05/12] fix: remove extra makefile command --- internal/shadeform/Makefile | 4 ---- 1 file changed, 4 deletions(-) diff --git a/internal/shadeform/Makefile b/internal/shadeform/Makefile index 2902e3ef..0c6c3784 100644 --- a/internal/shadeform/Makefile +++ b/internal/shadeform/Makefile @@ -9,7 +9,3 @@ generate-shadeform-client: sudo chown -R $(shell id -u):$(shell id -g) gen/shadeform gofmt -s -w gen/shadeform rm -rf gen/shadeform/go.mod gen/shadeform/go.sum - - -validate-shadeform-openapi: - docker run --rm -v ${PWD}:/local -v "/Users/ronald/shade/docs:/docs" openapitools/openapi-generator-cli:v7.8.0 validate -i /docs/openapi.yaml From 1d196b020f989816e42a4b68dad3f5bba3f84cfd Mon Sep 17 00:00:00 2001 From: Ronald Ding Date: Tue, 19 Aug 2025 11:16:57 -0700 Subject: [PATCH 06/12] fix: add lifecycle test --- internal/shadeform/v1/validation_test.go | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/internal/shadeform/v1/validation_test.go b/internal/shadeform/v1/validation_test.go index fd66902f..b00cc376 100644 --- a/internal/shadeform/v1/validation_test.go +++ b/internal/shadeform/v1/validation_test.go @@ -26,18 +26,17 @@ func TestValidationFunctions(t *testing.T) { validation.RunValidationSuite(t, config) } -// -//func TestInstanceLifecycleValidation(t *testing.T) { -// t.Parallel() -// checkSkip(t) -// apiKey := getAPIKey() -// -// config := validation.ProviderConfig{ -// Credential: NewShadeformCredential("validation-test", apiKey), -// } -// -// validation.RunInstanceLifecycleValidation(t, config) -//} +func TestInstanceLifecycleValidation(t *testing.T) { + t.Parallel() + checkSkip(t) + apiKey := getAPIKey() + + config := validation.ProviderConfig{ + Credential: NewShadeformCredential("validation-test", apiKey), + } + + validation.RunInstanceLifecycleValidation(t, config) +} func TestInstanceTypeFilter(t *testing.T) { t.Parallel() From f2114fb0fa848f7f1a7a47431a1d9766800ac663 Mon Sep 17 00:00:00 2001 From: Ronald Ding Date: Tue, 19 Aug 2025 15:13:38 -0700 Subject: [PATCH 07/12] feat: add refID and cloudCredRefID tags; enhance tagging --- internal/shadeform/v1/instance.go | 165 ++++++++++++++++++++++-------- 1 file changed, 121 insertions(+), 44 deletions(-) diff --git a/internal/shadeform/v1/instance.go b/internal/shadeform/v1/instance.go index b35dc8d0..0b62800b 100644 --- a/internal/shadeform/v1/instance.go +++ b/internal/shadeform/v1/instance.go @@ -2,6 +2,7 @@ package v1 import ( "context" + "errors" "fmt" "github.com/alecthomas/units" openapi "github.com/brevdev/cloud/internal/shadeform/gen/shadeform" @@ -11,7 +12,9 @@ import ( ) const ( - hostname = "shadecloud" + hostname = "shadecloud" + refIDTagName = "refID" + cloudCredRefIDTagName = "cloudCredRefID" ) func (c *ShadeformClient) CreateInstance(ctx context.Context, attrs v1.CreateInstanceAttrs) (*v1.Instance, error) { @@ -52,13 +55,35 @@ func (c *ShadeformClient) CreateInstance(ctx context.Context, attrs v1.CreateIns return nil, err } + // Add refID tag + refIDTag, err := c.createTag(refIDTagName, attrs.RefID) + if err != nil { + return nil, err + } + + // Add cloudRefID tag + cloudCredRefIDTag, err := c.createTag(cloudCredRefIDTagName, c.GetReferenceID()) + if err != nil { + return nil, err + } + + tags := []string{refIDTag, cloudCredRefIDTag} + // Add all other tags + for key, value := range attrs.Tags { + createdTag, err := c.createTag(key, value) + if err != nil { + return nil, err + } + tags = append(tags, createdTag) + } + req := openapi.CreateRequest{ Cloud: *cloudEnum, Region: region, ShadeInstanceType: shadeInstanceType, Name: attrs.Name, ShadeCloud: true, - Tags: []string{attrs.RefID}, + Tags: tags, SshKeyId: &sshKeyID, } @@ -122,7 +147,12 @@ func (c *ShadeformClient) GetInstance(ctx context.Context, instanceID v1.CloudPr return nil, fmt.Errorf("no instance returned from get request") } - return c.convertInstanceInfoResponseToV1Instance(*resp), nil + instance, err := c.convertInstanceInfoResponseToV1Instance(*resp) + if err != nil { + return nil, err + } + + return instance, nil } func (c *ShadeformClient) TerminateInstance(ctx context.Context, instanceID v1.CloudProviderInstanceID) error { @@ -152,7 +182,11 @@ func (c *ShadeformClient) ListInstances(ctx context.Context, _ v1.ListInstancesA var instances []v1.Instance for _, instance := range resp.Instances { - instances = append(instances, *c.convertShadeformInstanceToV1Instance(instance)) + singleInstance, err := c.convertShadeformInstanceToV1Instance(instance) + if err != nil { + return nil, err + } + instances = append(instances, *singleInstance) } return instances, nil @@ -170,10 +204,9 @@ func (c *ShadeformClient) MergeInstanceTypeForUpdate(currIt v1.InstanceType, _ v return currIt } -// convertInstanceInfoResponseToV1Instance - converts Instance Info to v1 instance -func (c *ShadeformClient) convertInstanceInfoResponseToV1Instance(instanceInfo openapi.InstanceInfoResponse) *v1.Instance { +func (c *ShadeformClient) getLifecycleStatus(status string) v1.LifecycleStatus { var lifecycleStatus v1.LifecycleStatus - switch instanceInfo.Status { + switch status { case "creating": lifecycleStatus = v1.LifecycleStatusPending case "pending_provider": @@ -187,13 +220,30 @@ func (c *ShadeformClient) convertInstanceInfoResponseToV1Instance(instanceInfo o default: lifecycleStatus = v1.LifecycleStatusPending } + return lifecycleStatus +} +// convertInstanceInfoResponseToV1Instance - converts Instance Info to v1 instance +func (c *ShadeformClient) convertInstanceInfoResponseToV1Instance(instanceInfo openapi.InstanceInfoResponse) (*v1.Instance, error) { instanceType := c.getInstanceType(string(instanceInfo.Cloud), instanceInfo.ShadeInstanceType) + lifeCycleStatus := c.getLifecycleStatus(string(instanceInfo.Status)) + + tags, err := c.convertShadeformTagToV1Tag(instanceInfo.Tags) + if err != nil { + return nil, err + } - refID := "" - if instanceInfo.Tags != nil && len(instanceInfo.Tags) > 0 { - refID = instanceInfo.Tags[0] + refID, found := tags[refIDTagName] + if !found { + return nil, errors.New("could not find refID tag") } + delete(tags, refIDTagName) + + cloudCredRefID := tags[cloudCredRefIDTagName] + if err != nil { + return nil, errors.New("could not find cloudCredRefID tag") + } + delete(tags, cloudCredRefIDTagName) instance := &v1.Instance{ Name: instanceInfo.Name, @@ -207,44 +257,41 @@ func (c *ShadeformClient) convertInstanceInfoResponseToV1Instance(instanceInfo o SSHUser: instanceInfo.SshUser, SSHPort: int(instanceInfo.SshPort), Status: v1.Status{ - LifecycleStatus: lifecycleStatus, + LifecycleStatus: lifeCycleStatus, }, - Spot: false, - Location: instanceInfo.Region, - Stoppable: false, - Rebootable: true, - RefID: refID, + Spot: false, + Location: instanceInfo.Region, + Stoppable: false, + Rebootable: true, + RefID: refID, + CloudCredRefID: cloudCredRefID, } - return instance + return instance, nil } // convertInstanceInfoResponseToV1Instance - converts /instances response to v1 instance; the api struct is slightly -// different from instance info so keeping it as a separate function for now -func (c *ShadeformClient) convertShadeformInstanceToV1Instance(shadeformInstance openapi.Instance) *v1.Instance { +// different from instance info response and expected to diverge so keeping it as a separate function for now +func (c *ShadeformClient) convertShadeformInstanceToV1Instance(shadeformInstance openapi.Instance) (*v1.Instance, error) { + instanceType := c.getInstanceType(string(shadeformInstance.Cloud), shadeformInstance.ShadeInstanceType) + lifeCycleStatus := c.getLifecycleStatus(string(shadeformInstance.Status)) - var lifecycleStatus v1.LifecycleStatus - switch shadeformInstance.Status { - case "creating": - lifecycleStatus = v1.LifecycleStatusPending - case "pending_provider": - lifecycleStatus = v1.LifecycleStatusPending - case "pending": - lifecycleStatus = v1.LifecycleStatusPending - case "active": - lifecycleStatus = v1.LifecycleStatusRunning - case "error": - lifecycleStatus = v1.LifecycleStatusFailed - default: - lifecycleStatus = v1.LifecycleStatusPending + tags, err := c.convertShadeformTagToV1Tag(shadeformInstance.Tags) + if err != nil { + return nil, err } - instanceType := c.getInstanceType(string(shadeformInstance.Cloud), shadeformInstance.ShadeInstanceType) + refID, found := tags[refIDTagName] + if !found { + return nil, errors.New("could not find refID tag") + } + delete(tags, refIDTagName) - refID := "" - if shadeformInstance.Tags != nil && len(shadeformInstance.Tags) > 0 { - refID = shadeformInstance.Tags[0] + cloudCredRefID := tags[cloudCredRefIDTagName] + if err != nil { + return nil, errors.New("could not find cloudCredRefID tag") } + delete(tags, cloudCredRefIDTagName) instance := &v1.Instance{ Name: shadeformInstance.Name, @@ -258,14 +305,44 @@ func (c *ShadeformClient) convertShadeformInstanceToV1Instance(shadeformInstance SSHUser: shadeformInstance.SshUser, SSHPort: int(shadeformInstance.SshPort), Status: v1.Status{ - LifecycleStatus: lifecycleStatus, + LifecycleStatus: lifeCycleStatus, }, - Spot: false, - Location: shadeformInstance.Region, - Stoppable: false, - Rebootable: true, - RefID: refID, + Spot: false, + Location: shadeformInstance.Region, + Stoppable: false, + Rebootable: true, + RefID: refID, + Tags: tags, + CloudCredRefID: cloudCredRefID, + } + + return instance, nil +} + +func (c *ShadeformClient) convertShadeformTagToV1Tag(shadeformTags []string) (v1.Tags, error) { + tags := v1.Tags{} + for _, tag := range shadeformTags { + key, value, err := c.getTag(tag) + if err != nil { + return nil, err + } + tags[key] = value + } + return tags, nil +} + +func (c *ShadeformClient) createTag(key string, value string) (string, error) { + if strings.Contains(key, "=") { + return "", errors.New("tags cannot contain the '=' character") } - return instance + return fmt.Sprintf("%v=%v", key, value), nil +} + +func (c *ShadeformClient) getTag(shadeformTag string) (string, string, error) { + key, value, found := strings.Cut(shadeformTag, "=") + if !found { + return "", "", errors.New(fmt.Sprintf("tag %v does not conform to the key value tag format", shadeformTag)) + } + return key, value, nil } From 8bf7b4bf54acd75d55e03b8cbe50ffe3e568e362 Mon Sep 17 00:00:00 2001 From: Ronald Ding Date: Tue, 19 Aug 2025 15:33:07 -0700 Subject: [PATCH 08/12] feat: add validation github action for shadeform --- .github/workflows/validation-shadeform.yml | 59 ++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/workflows/validation-shadeform.yml diff --git a/.github/workflows/validation-shadeform.yml b/.github/workflows/validation-shadeform.yml new file mode 100644 index 00000000..3cd067f2 --- /dev/null +++ b/.github/workflows/validation-shadeform.yml @@ -0,0 +1,59 @@ +name: Shadeform Validation Tests + +on: + schedule: + # Run daily at 2 AM UTC + - cron: '0 2 * * *' + workflow_dispatch: + # Allow manual triggering + pull_request: + paths: + - 'internal/shadeform/**' + - 'internal/validation/**' + - 'pkg/v1/**' + branches: [ main ] + +jobs: + shadeform-validation: + name: Shadeform Provider Validation + runs-on: ubuntu-latest + if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' + + steps: + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.23.0' + + - name: Cache Go modules + uses: actions/cache@v4 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + + - name: Install dependencies + run: make deps + + - name: Run Shadeform validation tests + env: + SHADEFORM_API_KEY: ${{ secrets.SHADEFORM_API_KEY }} + TEST_PRIVATE_KEY_BASE64: ${{ secrets.TEST_PRIVATE_KEY_BASE64 }} + TEST_PUBLIC_KEY_BASE64: ${{ secrets.TEST_PUBLIC_KEY_BASE64 }} + VALIDATION_TEST: true + run: | + cd internal/shadeform + go test -v -short=false -timeout=30m ./... + + - name: Upload test results + uses: actions/upload-artifact@v4 + if: always() + with: + name: shadeform-validation-results + path: | + internal/shadeform/coverage.out From 39d79e837c64ff2649434972d5ede641cc4c0493 Mon Sep 17 00:00:00 2001 From: Ronald Ding Date: Wed, 20 Aug 2025 12:51:01 -0700 Subject: [PATCH 09/12] feat: add firewall rules via ufw --- internal/shadeform/Makefile | 4 +- internal/shadeform/gen/shadeform/README.md | 2 +- .../gen/shadeform/docs/DefaultAPI.md | 46 +++++------ internal/shadeform/gen/shadeform/git_push.sh | 4 +- internal/shadeform/v1/instance.go | 11 +++ internal/shadeform/v1/ufw.go | 77 +++++++++++++++++++ internal/shadeform/v1/validation_test.go | 26 ++++++- main/main.go | 8 -- 8 files changed, 138 insertions(+), 40 deletions(-) create mode 100644 internal/shadeform/v1/ufw.go delete mode 100644 main/main.go diff --git a/internal/shadeform/Makefile b/internal/shadeform/Makefile index 0c6c3784..b1b7e13b 100644 --- a/internal/shadeform/Makefile +++ b/internal/shadeform/Makefile @@ -3,8 +3,8 @@ generate-shadeform-client: --additional-properties disallowAdditionalPropertiesIfNotPresent=false \ -i https://raw.githubusercontent.com/shadeform/docs/refs/heads/main/openapi.yaml \ -g go \ - --git-user-id shadeform \ - --git-repo-id cloud-shadeform \ + --git-user-id brevdev \ + --git-repo-id cloud \ -o /local/gen/shadeform sudo chown -R $(shell id -u):$(shell id -g) gen/shadeform gofmt -s -w gen/shadeform diff --git a/internal/shadeform/gen/shadeform/README.md b/internal/shadeform/gen/shadeform/README.md index fb3512ce..e0b22510 100644 --- a/internal/shadeform/gen/shadeform/README.md +++ b/internal/shadeform/gen/shadeform/README.md @@ -23,7 +23,7 @@ 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/shadeform/cloud-shadeform" +import openapi "github.com/brevdev/cloud" ``` To use a proxy, set the environment variable `HTTP_PROXY`: diff --git a/internal/shadeform/gen/shadeform/docs/DefaultAPI.md b/internal/shadeform/gen/shadeform/docs/DefaultAPI.md index 1434cd6e..6c7dd40d 100644 --- a/internal/shadeform/gen/shadeform/docs/DefaultAPI.md +++ b/internal/shadeform/gen/shadeform/docs/DefaultAPI.md @@ -47,7 +47,7 @@ import ( "context" "fmt" "os" - openapiclient "github.com/shadeform/cloud-shadeform" + openapiclient "github.com/brevdev/cloud" ) func main() { @@ -108,7 +108,7 @@ import ( "context" "fmt" "os" - openapiclient "github.com/shadeform/cloud-shadeform" + openapiclient "github.com/brevdev/cloud" ) func main() { @@ -174,7 +174,7 @@ import ( "context" "fmt" "os" - openapiclient "github.com/shadeform/cloud-shadeform" + openapiclient "github.com/brevdev/cloud" ) func main() { @@ -242,7 +242,7 @@ import ( "context" "fmt" "os" - openapiclient "github.com/shadeform/cloud-shadeform" + openapiclient "github.com/brevdev/cloud" ) func main() { @@ -312,7 +312,7 @@ import ( "context" "fmt" "os" - openapiclient "github.com/shadeform/cloud-shadeform" + openapiclient "github.com/brevdev/cloud" ) func main() { @@ -380,7 +380,7 @@ import ( "context" "fmt" "os" - openapiclient "github.com/shadeform/cloud-shadeform" + openapiclient "github.com/brevdev/cloud" ) func main() { @@ -458,7 +458,7 @@ import ( "context" "fmt" "os" - openapiclient "github.com/shadeform/cloud-shadeform" + openapiclient "github.com/brevdev/cloud" ) func main() { @@ -528,7 +528,7 @@ import ( "context" "fmt" "os" - openapiclient "github.com/shadeform/cloud-shadeform" + openapiclient "github.com/brevdev/cloud" ) func main() { @@ -589,7 +589,7 @@ import ( "context" "fmt" "os" - openapiclient "github.com/shadeform/cloud-shadeform" + openapiclient "github.com/brevdev/cloud" ) func main() { @@ -655,7 +655,7 @@ import ( "context" "fmt" "os" - openapiclient "github.com/shadeform/cloud-shadeform" + openapiclient "github.com/brevdev/cloud" ) func main() { @@ -723,7 +723,7 @@ import ( "context" "fmt" "os" - openapiclient "github.com/shadeform/cloud-shadeform" + openapiclient "github.com/brevdev/cloud" ) func main() { @@ -793,7 +793,7 @@ import ( "context" "fmt" "os" - openapiclient "github.com/shadeform/cloud-shadeform" + openapiclient "github.com/brevdev/cloud" ) func main() { @@ -861,7 +861,7 @@ import ( "context" "fmt" "os" - openapiclient "github.com/shadeform/cloud-shadeform" + openapiclient "github.com/brevdev/cloud" ) func main() { @@ -922,7 +922,7 @@ import ( "context" "fmt" "os" - openapiclient "github.com/shadeform/cloud-shadeform" + openapiclient "github.com/brevdev/cloud" ) func main() { @@ -990,7 +990,7 @@ import ( "context" "fmt" "os" - openapiclient "github.com/shadeform/cloud-shadeform" + openapiclient "github.com/brevdev/cloud" ) func main() { @@ -1051,7 +1051,7 @@ import ( "context" "fmt" "os" - openapiclient "github.com/shadeform/cloud-shadeform" + openapiclient "github.com/brevdev/cloud" ) func main() { @@ -1121,7 +1121,7 @@ import ( "context" "fmt" "os" - openapiclient "github.com/shadeform/cloud-shadeform" + openapiclient "github.com/brevdev/cloud" ) func main() { @@ -1187,7 +1187,7 @@ import ( "context" "fmt" "os" - openapiclient "github.com/shadeform/cloud-shadeform" + openapiclient "github.com/brevdev/cloud" ) func main() { @@ -1257,7 +1257,7 @@ import ( "context" "fmt" "os" - openapiclient "github.com/shadeform/cloud-shadeform" + openapiclient "github.com/brevdev/cloud" ) func main() { @@ -1318,7 +1318,7 @@ import ( "context" "fmt" "os" - openapiclient "github.com/shadeform/cloud-shadeform" + openapiclient "github.com/brevdev/cloud" ) func main() { @@ -1384,7 +1384,7 @@ import ( "context" "fmt" "os" - openapiclient "github.com/shadeform/cloud-shadeform" + openapiclient "github.com/brevdev/cloud" ) func main() { @@ -1452,7 +1452,7 @@ import ( "context" "fmt" "os" - openapiclient "github.com/shadeform/cloud-shadeform" + openapiclient "github.com/brevdev/cloud" ) func main() { @@ -1522,7 +1522,7 @@ import ( "context" "fmt" "os" - openapiclient "github.com/shadeform/cloud-shadeform" + openapiclient "github.com/brevdev/cloud" ) func main() { diff --git a/internal/shadeform/gen/shadeform/git_push.sh b/internal/shadeform/gen/shadeform/git_push.sh index ca85d089..ccffd509 100644 --- a/internal/shadeform/gen/shadeform/git_push.sh +++ b/internal/shadeform/gen/shadeform/git_push.sh @@ -14,12 +14,12 @@ if [ "$git_host" = "" ]; then fi if [ "$git_user_id" = "" ]; then - git_user_id="shadeform" + 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-shadeform" + git_repo_id="cloud" echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" fi diff --git a/internal/shadeform/v1/instance.go b/internal/shadeform/v1/instance.go index 0b62800b..49d987ee 100644 --- a/internal/shadeform/v1/instance.go +++ b/internal/shadeform/v1/instance.go @@ -77,6 +77,11 @@ func (c *ShadeformClient) CreateInstance(ctx context.Context, attrs v1.CreateIns tags = append(tags, createdTag) } + base64Script, err := c.generateFirewallScript(attrs.FirewallRules) + if err != nil { + return nil, err + } + req := openapi.CreateRequest{ Cloud: *cloudEnum, Region: region, @@ -85,6 +90,12 @@ func (c *ShadeformClient) CreateInstance(ctx context.Context, attrs v1.CreateIns ShadeCloud: true, Tags: tags, SshKeyId: &sshKeyID, + LaunchConfiguration: &openapi.LaunchConfiguration{ + Type: "script", + ScriptConfiguration: &openapi.ScriptConfiguration{ + Base64Script: base64Script, + }, + }, } resp, httpResp, err := c.client.DefaultAPI.InstancesCreate(authCtx).CreateRequest(req).Execute() diff --git a/internal/shadeform/v1/ufw.go b/internal/shadeform/v1/ufw.go new file mode 100644 index 00000000..bc3ec9f0 --- /dev/null +++ b/internal/shadeform/v1/ufw.go @@ -0,0 +1,77 @@ +package v1 + +import ( + "encoding/base64" + "fmt" + v1 "github.com/brevdev/cloud/pkg/v1" +) + +const ( + ufwForceReset = "ufw --force reset" + ufwDefaultDropIncoming = "ufw default deny incoming" + ufwDefaultAllowOutgoing = "ufw default allow outgoing" + ufwDefaultAllowPort22 = "ufw allow 22/tcp" + ufwDefaultAllowPort2222 = "ufw allow 2222/tcp" + ufwForceEnable = "ufw --force enable" +) + +func (c *ShadeformClient) generateFirewallScript(firewallRules v1.FirewallRules) (string, error) { + commands := []string{ufwForceReset, ufwDefaultDropIncoming, ufwDefaultAllowOutgoing, ufwDefaultAllowPort22, ufwDefaultAllowPort2222} + + for _, firewallRule := range firewallRules.IngressRules { + commands = append(commands, c.convertIngressFirewallRuleToUfwCommand(firewallRule)...) + } + + for _, firewallRule := range firewallRules.EgressRules { + commands = append(commands, c.convertEgressFirewallRuleToUfwCommand(firewallRule)...) + } + + // Add the enable command + commands = append(commands, ufwForceEnable) + + script := "" + for _, command := range commands { + script = script + fmt.Sprintf("%v\n", command) + } + + encoded := base64.StdEncoding.EncodeToString([]byte(script)) + return encoded, nil +} + +func (c *ShadeformClient) convertIngressFirewallRuleToUfwCommand(firewallRule v1.FirewallRule) []string { + cmds := []string{} + portSpec := "" + if firewallRule.FromPort == firewallRule.ToPort { + portSpec = fmt.Sprintf("port %d", firewallRule.FromPort) + } else { + portSpec = fmt.Sprintf("port %d:%d", firewallRule.FromPort, firewallRule.ToPort) + } + + if len(firewallRule.IPRanges) == 0 { + cmds = append(cmds, fmt.Sprintf("ufw allow in from any to any port %s", portSpec)) + } + + for _, ipRange := range firewallRule.IPRanges { + cmds = append(cmds, fmt.Sprintf("ufw allow in from %s to any port %s", ipRange, portSpec)) + } + return cmds +} + +func (c *ShadeformClient) convertEgressFirewallRuleToUfwCommand(firewallRule v1.FirewallRule) []string { + cmds := []string{} + portSpec := "" + if firewallRule.FromPort == firewallRule.ToPort { + portSpec = fmt.Sprintf("port %d", firewallRule.FromPort) + } else { + portSpec = fmt.Sprintf("port %d:%d", firewallRule.FromPort, firewallRule.ToPort) + } + + if len(firewallRule.IPRanges) == 0 { + cmds = append(cmds, fmt.Sprintf("ufw allow out to any port %s", portSpec)) + } + + for _, ipRange := range firewallRule.IPRanges { + cmds = append(cmds, fmt.Sprintf("ufw allow out to %s port %s", ipRange, portSpec)) + } + return cmds +} diff --git a/internal/shadeform/v1/validation_test.go b/internal/shadeform/v1/validation_test.go index b00cc376..9f703725 100644 --- a/internal/shadeform/v1/validation_test.go +++ b/internal/shadeform/v1/validation_test.go @@ -71,6 +71,24 @@ func TestInstanceTypeFilter(t *testing.T) { Location: types[0].Location, PublicKey: ssh.GetTestPublicKey(), Name: "test_name", + FirewallRules: v1.FirewallRules{ + EgressRules: []v1.FirewallRule{ + { + ID: "test-rule", + FromPort: 80, + ToPort: 8080, + IPRanges: []string{"127.0.0.1", "10.0.0.0/32"}, + }, + }, + IngressRules: []v1.FirewallRule{ + { + ID: "test-rule", + FromPort: 5432, + ToPort: 5432, + IPRanges: []string{"127.0.0.1", "10.0.0.0/32"}, + }, + }, + }, }) if err != nil { @@ -83,10 +101,10 @@ func TestInstanceTypeFilter(t *testing.T) { require.NoError(t, err, "ValidateSSHAccessible should pass") }) - t.Run("ValidateTerminateInstance", func(t *testing.T) { - err := v1.ValidateTerminateInstance(ctx, client, instance) - require.NoError(t, err, "ValidateTerminateInstance should pass") - }) + //t.Run("ValidateTerminateInstance", func(t *testing.T) { + // err := v1.ValidateTerminateInstance(ctx, client, instance) + // require.NoError(t, err, "ValidateTerminateInstance should pass") + //}) } func checkSkip(t *testing.T) { diff --git a/main/main.go b/main/main.go deleted file mode 100644 index 942b1a10..00000000 --- a/main/main.go +++ /dev/null @@ -1,8 +0,0 @@ -package main - -import "fmt" - -func main() { - fmt.Println("Things are working!") - -} From 03d9382263fddde3ff46ab5a3b346253c6a1ab0d Mon Sep 17 00:00:00 2001 From: Ronald Ding Date: Wed, 20 Aug 2025 12:54:42 -0700 Subject: [PATCH 10/12] fix: generated package names --- .../gen/shadeform/.openapi-generator/FILES | 2 ++ .../gen/shadeform/test/api_default_test.go | 22 +++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/internal/shadeform/gen/shadeform/.openapi-generator/FILES b/internal/shadeform/gen/shadeform/.openapi-generator/FILES index 59edec64..d6c9d505 100644 --- a/internal/shadeform/gen/shadeform/.openapi-generator/FILES +++ b/internal/shadeform/gen/shadeform/.openapi-generator/FILES @@ -1,4 +1,5 @@ .gitignore +.openapi-generator-ignore .travis.yml README.md api/openapi.yaml @@ -96,4 +97,5 @@ model_volume_types_inner.go model_volumes_response.go model_volumes_types_response.go response.go +test/api_default_test.go utils.go diff --git a/internal/shadeform/gen/shadeform/test/api_default_test.go b/internal/shadeform/gen/shadeform/test/api_default_test.go index da4e9a04..2ba43906 100644 --- a/internal/shadeform/gen/shadeform/test/api_default_test.go +++ b/internal/shadeform/gen/shadeform/test/api_default_test.go @@ -11,7 +11,7 @@ package openapi import ( "context" - openapiclient "github.com/shadeform/cloud-shadeform" + openapiclient "github.com/brevdev/cloud" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "testing" @@ -111,11 +111,11 @@ func Test_openapi_DefaultAPIService(t *testing.T) { }) - t.Run("Test DefaultAPIService Sshkeys", func(t *testing.T) { + t.Run("Test DefaultAPIService SshKeys", func(t *testing.T) { t.Skip("skip test") // remove to run test - resp, httpRes, err := apiClient.DefaultAPI.Sshkeys(context.Background()).Execute() + resp, httpRes, err := apiClient.DefaultAPI.SshKeys(context.Background()).Execute() require.Nil(t, err) require.NotNil(t, resp) @@ -123,11 +123,11 @@ func Test_openapi_DefaultAPIService(t *testing.T) { }) - t.Run("Test DefaultAPIService SshkeysAdd", func(t *testing.T) { + t.Run("Test DefaultAPIService SshKeysAdd", func(t *testing.T) { t.Skip("skip test") // remove to run test - resp, httpRes, err := apiClient.DefaultAPI.SshkeysAdd(context.Background()).Execute() + resp, httpRes, err := apiClient.DefaultAPI.SshKeysAdd(context.Background()).Execute() require.Nil(t, err) require.NotNil(t, resp) @@ -135,26 +135,26 @@ func Test_openapi_DefaultAPIService(t *testing.T) { }) - t.Run("Test DefaultAPIService SshkeysDelete", func(t *testing.T) { + t.Run("Test DefaultAPIService SshKeysDelete", func(t *testing.T) { t.Skip("skip test") // remove to run test var id string - httpRes, err := apiClient.DefaultAPI.SshkeysDelete(context.Background(), id).Execute() + httpRes, err := apiClient.DefaultAPI.SshKeysDelete(context.Background(), id).Execute() require.Nil(t, err) assert.Equal(t, 200, httpRes.StatusCode) }) - t.Run("Test DefaultAPIService SshkeysInfo", func(t *testing.T) { + t.Run("Test DefaultAPIService SshKeysInfo", func(t *testing.T) { t.Skip("skip test") // remove to run test var id string - resp, httpRes, err := apiClient.DefaultAPI.SshkeysInfo(context.Background(), id).Execute() + resp, httpRes, err := apiClient.DefaultAPI.SshKeysInfo(context.Background(), id).Execute() require.Nil(t, err) require.NotNil(t, resp) @@ -162,13 +162,13 @@ func Test_openapi_DefaultAPIService(t *testing.T) { }) - t.Run("Test DefaultAPIService SshkeysSetdefault", func(t *testing.T) { + t.Run("Test DefaultAPIService SshKeysSetDefault", func(t *testing.T) { t.Skip("skip test") // remove to run test var id string - httpRes, err := apiClient.DefaultAPI.SshkeysSetdefault(context.Background(), id).Execute() + httpRes, err := apiClient.DefaultAPI.SshKeysSetDefault(context.Background(), id).Execute() require.Nil(t, err) assert.Equal(t, 200, httpRes.StatusCode) From 07ca2dd1486ce909bafc28b1b04ec4708f3984d7 Mon Sep 17 00:00:00 2001 From: Ronald Ding Date: Wed, 20 Aug 2025 12:55:35 -0700 Subject: [PATCH 11/12] fix: add termination back --- internal/shadeform/v1/validation_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/shadeform/v1/validation_test.go b/internal/shadeform/v1/validation_test.go index 9f703725..155da190 100644 --- a/internal/shadeform/v1/validation_test.go +++ b/internal/shadeform/v1/validation_test.go @@ -101,10 +101,10 @@ func TestInstanceTypeFilter(t *testing.T) { require.NoError(t, err, "ValidateSSHAccessible should pass") }) - //t.Run("ValidateTerminateInstance", func(t *testing.T) { - // err := v1.ValidateTerminateInstance(ctx, client, instance) - // require.NoError(t, err, "ValidateTerminateInstance should pass") - //}) + t.Run("ValidateTerminateInstance", func(t *testing.T) { + err := v1.ValidateTerminateInstance(ctx, client, instance) + require.NoError(t, err, "ValidateTerminateInstance should pass") + }) } func checkSkip(t *testing.T) { From 931901ca1ec0d042bd7a11ad787e504d7e02bc89 Mon Sep 17 00:00:00 2001 From: Ronald Ding Date: Wed, 20 Aug 2025 14:19:35 -0700 Subject: [PATCH 12/12] fix: generate firewall script --- internal/shadeform/v1/instance.go | 2 +- internal/shadeform/v1/ufw.go | 34 ++++++++++++++++-------- internal/shadeform/v1/validation_test.go | 20 +++++++++++--- 3 files changed, 40 insertions(+), 16 deletions(-) diff --git a/internal/shadeform/v1/instance.go b/internal/shadeform/v1/instance.go index 49d987ee..53104a4b 100644 --- a/internal/shadeform/v1/instance.go +++ b/internal/shadeform/v1/instance.go @@ -77,7 +77,7 @@ func (c *ShadeformClient) CreateInstance(ctx context.Context, attrs v1.CreateIns tags = append(tags, createdTag) } - base64Script, err := c.generateFirewallScript(attrs.FirewallRules) + base64Script, err := c.GenerateFirewallScript(attrs.FirewallRules) if err != nil { return nil, err } diff --git a/internal/shadeform/v1/ufw.go b/internal/shadeform/v1/ufw.go index bc3ec9f0..17db526d 100644 --- a/internal/shadeform/v1/ufw.go +++ b/internal/shadeform/v1/ufw.go @@ -15,7 +15,7 @@ const ( ufwForceEnable = "ufw --force enable" ) -func (c *ShadeformClient) generateFirewallScript(firewallRules v1.FirewallRules) (string, error) { +func (c *ShadeformClient) GenerateFirewallScript(firewallRules v1.FirewallRules) (string, error) { commands := []string{ufwForceReset, ufwDefaultDropIncoming, ufwDefaultAllowOutgoing, ufwDefaultAllowPort22, ufwDefaultAllowPort2222} for _, firewallRule := range firewallRules.IngressRules { @@ -40,38 +40,50 @@ func (c *ShadeformClient) generateFirewallScript(firewallRules v1.FirewallRules) func (c *ShadeformClient) convertIngressFirewallRuleToUfwCommand(firewallRule v1.FirewallRule) []string { cmds := []string{} - portSpec := "" + portSpecs := []string{} if firewallRule.FromPort == firewallRule.ToPort { - portSpec = fmt.Sprintf("port %d", firewallRule.FromPort) + portSpecs = append(portSpecs, fmt.Sprintf("port %d", firewallRule.FromPort)) } else { - portSpec = fmt.Sprintf("port %d:%d", firewallRule.FromPort, firewallRule.ToPort) + // port ranges require two separate rules for tcp and udp + portSpecs = append(portSpecs, fmt.Sprintf("port %d:%d proto tcp", firewallRule.FromPort, firewallRule.ToPort)) + portSpecs = append(portSpecs, fmt.Sprintf("port %d:%d proto udp", firewallRule.FromPort, firewallRule.ToPort)) } if len(firewallRule.IPRanges) == 0 { - cmds = append(cmds, fmt.Sprintf("ufw allow in from any to any port %s", portSpec)) + for _, portSpec := range portSpecs { + cmds = append(cmds, fmt.Sprintf("ufw allow in from any to any %s", portSpec)) + } } for _, ipRange := range firewallRule.IPRanges { - cmds = append(cmds, fmt.Sprintf("ufw allow in from %s to any port %s", ipRange, portSpec)) + for _, portSpec := range portSpecs { + cmds = append(cmds, fmt.Sprintf("ufw allow in from %s to any %s", ipRange, portSpec)) + } } return cmds } func (c *ShadeformClient) convertEgressFirewallRuleToUfwCommand(firewallRule v1.FirewallRule) []string { cmds := []string{} - portSpec := "" + portSpecs := []string{} if firewallRule.FromPort == firewallRule.ToPort { - portSpec = fmt.Sprintf("port %d", firewallRule.FromPort) + portSpecs = append(portSpecs, fmt.Sprintf("port %d", firewallRule.FromPort)) } else { - portSpec = fmt.Sprintf("port %d:%d", firewallRule.FromPort, firewallRule.ToPort) + // port ranges require two separate rules for tcp and udp + portSpecs = append(portSpecs, fmt.Sprintf("port %d:%d proto tcp", firewallRule.FromPort, firewallRule.ToPort)) + portSpecs = append(portSpecs, fmt.Sprintf("port %d:%d proto udp", firewallRule.FromPort, firewallRule.ToPort)) } if len(firewallRule.IPRanges) == 0 { - cmds = append(cmds, fmt.Sprintf("ufw allow out to any port %s", portSpec)) + for _, portSpec := range portSpecs { + cmds = append(cmds, fmt.Sprintf("ufw allow out to any %s", portSpec)) + } } for _, ipRange := range firewallRule.IPRanges { - cmds = append(cmds, fmt.Sprintf("ufw allow out to %s port %s", ipRange, portSpec)) + for _, portSpec := range portSpecs { + cmds = append(cmds, fmt.Sprintf("ufw allow out to %s %s", ipRange, portSpec)) + } } return cmds } diff --git a/internal/shadeform/v1/validation_test.go b/internal/shadeform/v1/validation_test.go index 155da190..211b2317 100644 --- a/internal/shadeform/v1/validation_test.go +++ b/internal/shadeform/v1/validation_test.go @@ -74,18 +74,30 @@ func TestInstanceTypeFilter(t *testing.T) { FirewallRules: v1.FirewallRules{ EgressRules: []v1.FirewallRule{ { - ID: "test-rule", + ID: "test-rule1", FromPort: 80, ToPort: 8080, - IPRanges: []string{"127.0.0.1", "10.0.0.0/32"}, + IPRanges: []string{"127.0.0.1", "10.0.0.0/24"}, + }, + { + ID: "test-rule2", + FromPort: 5432, + ToPort: 5432, + IPRanges: []string{"127.0.0.1", "10.0.0.0/24"}, }, }, IngressRules: []v1.FirewallRule{ { - ID: "test-rule", + ID: "test-rule3", + FromPort: 80, + ToPort: 8080, + IPRanges: []string{"127.0.0.1", "10.0.0.0/24"}, + }, + { + ID: "test-rule4", FromPort: 5432, ToPort: 5432, - IPRanges: []string{"127.0.0.1", "10.0.0.0/32"}, + IPRanges: []string{"127.0.0.1", "10.0.0.0/24"}, }, }, },