GithubHelp home page GithubHelp logo

virty-go's Introduction

Go API client for openapi

No description provided (generated by Openapi Generator https://github.com/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: 4.1.0
  • Package version: 1.0.0
  • 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 openapi "github.com/hibiki31/virty-go"

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

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.

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.

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://virty-pr.hinagiku.me/api

Class Method HTTP request Description
AuthAPI Login Post /api/auth Login For Access Token
AuthAPI Setup Post /api/auth/setup Api Auth Setup
AuthAPI ValidateToken Get /api/auth/validate Read Auth Validate
FlavorsAPI CreateFlavor Post /api/flavors Post Api Flavors
FlavorsAPI DeleteFlavor Delete /api/flavors/{flavor_id} Delete Flavors
FlavorsAPI GetFlavors Get /api/flavors Get Api Flavors
ImagesAPI GetImages Get /api/images Get Api Images
ImagesAPI ScpImage Put /api/images/scp Put Api Images Scp
ImagesAPI UpdateImageFlavor Patch /api/images Patch Api Images
ImagesTaskAPI DownloadImage Post /api/tasks/images/download Post Image Download
ImagesTaskAPI RefreshImages Put /api/tasks/images Put Api Images
MetricsAPI GetMetrics Get /api/metrics Exporter Get
MixinAPI GetVersion Get /api/version Get Version
NetworksAPI CreateNetworkPool Post /api/networks/pools Post Api Networks Pools
NetworksAPI DeleteNetworkPool Delete /api/networks/pools/{id} Delete Pools Uuid
NetworksAPI GetNetwork Get /api/networks/{uuid} Get Api Networks Uuid
NetworksAPI GetNetworkPools Get /api/networks/pools Get Api Networks Pools
NetworksAPI GetNetworks Get /api/networks Get Api Networks
NetworksAPI UpdateNetworkPool Patch /api/networks/pools Patch Api Networks Pools
NetworksTaskAPI CreateNetwork Post /api/tasks/networks Post Api Storage
NetworksTaskAPI CreateNetworkOvs Post /api/tasks/networks/{uuid}/ovs Post Uuid Ovs
NetworksTaskAPI DeleteNetwork Delete /api/tasks/networks/{uuid} Delete Api Storage
NetworksTaskAPI DeleteNetworkOvs Delete /api/tasks/networks/{uuid}/ovs/{name} Post Api Networks Uuid Ovs
NetworksTaskAPI PostUuidOvsApiTasksNetworksProvidersPost Post /api/tasks/networks/providers Post Uuid Ovs
NetworksTaskAPI RefreshNetworks Put /api/tasks/networks Put Api Networks
NodesAPI GetNode Get /api/nodes/{name} Get Api Node
NodesAPI GetNodeFacts Get /api/nodes/{name}/facts Get Node Name Facts
NodesAPI GetNodeNameFactsApiNodesNameNetworkGet Get /api/nodes/{name}/network Get Node Name Facts
NodesAPI GetNodes Get /api/nodes Get Api Nodes
NodesAPI GetSshKeyPair Get /api/nodes/key Get Ssh Key Pair
NodesAPI UpdateSshKeyPair Post /api/nodes/key Post Ssh Key Pair
NodesTaskAPI CreateNode Post /api/tasks/nodes Post Tasks Nodes
NodesTaskAPI DeleteNode Delete /api/tasks/nodes/{name} Delete Tasks Nodes Name
NodesTaskAPI UpdateNodeRole Patch /api/tasks/nodes/roles Patch Api Node Role
ProjectsAPI CreateProject Post /api/tasks/projects Post Api Projects
ProjectsAPI DeleteProject Delete /api/tasks/projects/{project_id} Delete Api Projects
ProjectsAPI GetProjects Get /api/projects Get Api Projects
ProjectsAPI UpdateProject Put /api/projects Put Api Projects
StoragesAPI CreateStoragePool Post /api/storages/pools Post Api Storages Pools
StoragesAPI GetStorage Get /api/storages/{uuid} Get Api Storages Uuid
StoragesAPI GetStoragePools Get /api/storages/pools Get Api Storages Pools
StoragesAPI GetStorages Get /api/storages Get Api Storages
StoragesAPI UpdateStorageMetadata Patch /api/storages Post Api Storage
StoragesAPI UpdateStoragePool Patch /api/storages/pools Post Api Storages Pools
StoragesTaskAPI CreateStorage Post /api/tasks/storages Post Api Storage
StoragesTaskAPI DeleteStorage Delete /api/tasks/storages/{uuid} Delete Api Storages
TasksAPI DeleteTasks Delete /api/tasks/ Delete Tasks
TasksAPI GetIncompleteTasks Get /api/tasks/incomplete Get Tasks Incomplete
TasksAPI GetTask Get /api/tasks/{uuid} Get Tasks
TasksAPI GetTasks Get /api/tasks Get Tasks
UsersAPI CreateUser Post /api/users Post Api Users
UsersAPI DeleteUser Delete /api/users/{username} Delete User
UsersAPI GetCurrentUser Get /api/users/me Read Users Me
UsersAPI GetUsers Get /api/users Get Api Users
VmsAPI GetVm Get /api/vms/{uuid} Get Api Domain Uuid
VmsAPI GetVms Get /api/vms Get Api Domain
VmsAPI GetVncAddress Get /api/vms/vnc/{token} Get Api Domain
VmsTaskAPI ControlVmCdrom Patch /api/tasks/vms/{uuid}/cdrom Patch Api Tasks Vms Uuid Cdrom
VmsTaskAPI CreateVm Post /api/tasks/vms Post Api Vms
VmsTaskAPI DeleteVm Delete /api/tasks/vms/{uuid} Delete Api Domains
VmsTaskAPI PathVmsProjectApiTasksVmsProjectPatch Patch /api/tasks/vms/project Path Vms Project
VmsTaskAPI RefreshVms Put /api/tasks/vms Publish Task To Update Vm List
VmsTaskAPI UpdateVmNetwork Patch /api/tasks/vms/{uuid}/network Patch Api Vm Network
VmsTaskAPI UpdateVmPowerStatus Patch /api/tasks/vms/{uuid}/power Patch Api Tasks Vms Uuid Power

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

OAuth2PasswordBearer

  • Type: OAuth
  • Flow: password
  • Authorization URL:
  • Scopes:
  • admin: Have all authority
  • user: User authority

Example

auth := context.WithValue(context.Background(), openapi.ContextAccessToken, "ACCESSTOKENSTRING")
r, err := client.Service.Operation(auth, args)

Or via OAuth2 module to automatically refresh tokens and perform user authentication.

import "golang.org/x/oauth2"

/* Perform OAuth2 round trip request and obtain a token */

tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
auth := context.WithValue(oauth2.NoContext, openapi.ContextOAuth2, tokenSource)
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

virty-go's People

Contributors

hibiki31 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.