Skip to content

mistio/mist-sdk-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go API client for mist_sdk

No description provided (generated by Openapi Generator https:/openapitools/openapi-generator)

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: 2.0.0
  • Package version: 0.0.1
  • Build package: org.openapitools.codegen.languages.GoClientCodegen

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import sw "./mist_sdk"

To use a proxy, set the environment variable HTTP_PROXY:

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 sw.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), sw.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value sw.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), sw.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 identifield by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using sw.ContextOperationServerIndices and sw.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), sw.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), sw.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

All URIs are relative to https://mist.io

Class Method HTTP request Description
CloudsApi AddCloud Post /api/v2/clouds Add cloud
CloudsApi DeleteCloud Delete /api/v2/clouds/{cloud} Delete cloud
CloudsApi EditCloud Put /api/v2/clouds/{cloud} Edit cloud
CloudsApi GetCloud Get /api/v2/clouds/{cloud} Get cloud
CloudsApi ListClouds Get /api/v2/clouds List clouds
CloudsCountApi GetOrg Get /api/v2/orgs/{org} Get Org
ImagesApi GetImage Get /api/v2/images/{image} Get image
ImagesApi ListImages Get /api/v2/images List images
JobsApi GetJob Get /api/v2/jobs/{job_id} Get job
KeysApi AddKey Post /api/v2/keys Add key
KeysApi DeleteKey Delete /api/v2/keys/{key} Delete key
KeysApi EditKey Put /api/v2/keys/{key} Edit key
KeysApi GetKey Get /api/v2/keys/{key} Get key
KeysApi ListKeys Get /api/v2/keys List keys
LocationsApi GetLocation Get /api/v2/locations/{location} Get location
LocationsApi ListLocations Get /api/v2/locations List locations
MachinesApi CloneMachine Post /api/v2/machines/{machine}/actions/clone Clone machine
MachinesApi Console Post /api/v2/machines/{machine}/actions/console Open console
MachinesApi CreateMachine Post /api/v2/machines Create machine
MachinesApi DestroyMachine Post /api/v2/machines/{machine}/actions/destroy Destroy machine
MachinesApi EditMachine Put /api/v2/machines/{machine} Edit machine
MachinesApi ExposeMachine Post /api/v2/machines/{machine}/actions/expose Expose machine
MachinesApi GetMachine Get /api/v2/machines/{machine} Get machine
MachinesApi ListMachines Get /api/v2/machines List machines
MachinesApi RebootMachine Post /api/v2/machines/{machine}/actions/reboot Reboot machine
MachinesApi RenameMachine Post /api/v2/machines/{machine}/actions/rename Rename machine
MachinesApi ResizeMachine Post /api/v2/machines/{machine}/actions/resize Resize machine
MachinesApi ResumeMachine Post /api/v2/machines/{machine}/actions/resume Resume machine
MachinesApi Ssh Post /api/v2/machines/{machine}/actions/ssh Open secure shell
MachinesApi StartMachine Post /api/v2/machines/{machine}/actions/start Start machine
MachinesApi StopMachine Post /api/v2/machines/{machine}/actions/stop Stop machine
MachinesApi SuspendMachine Post /api/v2/machines/{machine}/actions/suspend Suspend machine
MachinesApi UndefineMachine Post /api/v2/machines/{machine}/actions/undefine Undefine machine
MembersApi ListOrgMembers Get /api/v2/orgs/{org}/members List org members
NameApi GetOrg Get /api/v2/orgs/{org} Get Org
NetworksApi CreateNetwork Post /api/v2/networks Create network
NetworksApi EditNetwork Put /api/v2/networks/{network} Edit network
NetworksApi GetNetwork Get /api/v2/networks/{network} Get network
NetworksApi ListNetworks Get /api/v2/networks List networks
OrgsApi GetMember Get /api/v2/orgs/{org}/members/{member} Get Org
OrgsApi GetOrg Get /api/v2/orgs/{org} Get Org
OrgsApi ListOrgMembers Get /api/v2/orgs/{org}/members List org members
OrgsApi ListOrgTeams Get /api/v2/orgs/{org}/teams List org teams
OrgsApi ListOrgs Get /api/v2/orgs List orgs
RulesApi AddRule Post /api/v2/rules Add rule
RulesApi DeleteRule Delete /api/v2/rules/{rule} Delete rule
RulesApi GetRule Get /api/v2/rules/{rule} Get rule
RulesApi ListRules Get /api/v2/rules List rules
RulesApi RenameRule Patch /api/v2/rules/{rule} Rename rule
RulesApi ToggleRule Put /api/v2/rules/{rule} Toggle rule
RulesApi UpdateRule Post /api/v2/rules/{rule} Update rule
ScriptsApi DeleteScript Delete /api/v2/scripts/{script} Delete script
ScriptsApi EditScript Put /api/v2/scripts/{script} Edit script
ScriptsApi GetScript Get /api/v2/scripts/{script} Get script
ScriptsApi ListScripts Get /api/v2/scripts List scripts
SizesApi GetSize Get /api/v2/sizes/{size} Get size
SizesApi ListSizes Get /api/v2/sizes List sizes
SnapshotsApi CreateSnapshot Post /api/v2/machines/{machine}/snapshots Create snapshot
SnapshotsApi ListSnapshots Get /api/v2/machines/{machine}/snapshots List machine snapshots
SnapshotsApi RemoveSnapshot Delete /api/v2/machines/{machine}/snapshots/{snapshot} Remove snapshot
SnapshotsApi RevertToSnapshot Post /api/v2/machines/{machine}/snapshots/{snapshot} Revert to snapshot
TeamsApi ListOrgTeams Get /api/v2/orgs/{org}/teams List org teams
TotalMachineCountApi GetOrg Get /api/v2/orgs/{org} Get Org
UsersApi ListUsers Get /api/v2/users List users
VolumesApi CreateVolume Post /api/v2/volumes Create volume
VolumesApi DeleteVolume Delete /api/v2/volumes/{volume} Delete volume
VolumesApi EditVolume Put /api/v2/volumes/{volume} Edit volume
VolumesApi GetVolume Get /api/v2/volumes/{volume} Get volume
VolumesApi ListVolumes Get /api/v2/volumes List volumes
ZonesApi CreateZone Post /api/v2/zones Create zone
ZonesApi EditZone Put /api/v2/zones/{zone} Edit zone
ZonesApi GetZone Get /api/v2/zones/{zone} Get zone
ZonesApi ListZones Get /api/v2/zones List zones

Documentation For Models

Documentation For Authorization

ApiKeyAuth

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header

Note, each API key must be added to a map of map[string]APIKey where the key is: Authorization and passed in as the auth context for each request.

CookieAuth

  • Type: API key
  • API key parameter name: session.id
  • Location:

Note, each API key must be added to a map of map[string]APIKey where the key is: session.id and passed in as the auth context for each request.

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

[email protected]