1537 lines
53 KiB
Go
1537 lines
53 KiB
Go
|
/*
|
||
|
* 3DS OUTSCALE API
|
||
|
*
|
||
|
* Welcome to the 3DS OUTSCALE's API documentation.<br /><br /> The 3DS OUTSCALE API enables you to manage your resources in the 3DS OUTSCALE Cloud. This documentation describes the different actions available along with code examples.<br /><br /> Note that the 3DS OUTSCALE Cloud is compatible with Amazon Web Services (AWS) APIs, but some resources have different names in AWS than in the 3DS OUTSCALE API. You can find a list of the differences [here](https://wiki.outscale.net/display/EN/3DS+OUTSCALE+APIs+Reference).<br /><br /> You can also manage your resources using the [Cockpit](https://wiki.outscale.net/display/EN/About+Cockpit) web interface.
|
||
|
*
|
||
|
* API version: 1.2
|
||
|
* Contact: support@outscale.com
|
||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||
|
*/
|
||
|
|
||
|
package osc
|
||
|
|
||
|
import (
|
||
|
_context "context"
|
||
|
_ioutil "io/ioutil"
|
||
|
_nethttp "net/http"
|
||
|
_neturl "net/url"
|
||
|
"github.com/antihax/optional"
|
||
|
)
|
||
|
|
||
|
// Linger please
|
||
|
var (
|
||
|
_ _context.Context
|
||
|
)
|
||
|
|
||
|
// VmApiService VmApi service
|
||
|
type VmApiService service
|
||
|
|
||
|
// CreateVmsOpts Optional parameters for the method 'CreateVms'
|
||
|
type CreateVmsOpts struct {
|
||
|
CreateVmsRequest optional.Interface
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
CreateVms Method for CreateVms
|
||
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||
|
* @param optional nil or *CreateVmsOpts - Optional Parameters:
|
||
|
* @param "CreateVmsRequest" (optional.Interface of CreateVmsRequest) -
|
||
|
@return CreateVmsResponse
|
||
|
*/
|
||
|
func (a *VmApiService) CreateVms(ctx _context.Context, localVarOptionals *CreateVmsOpts) (CreateVmsResponse, *_nethttp.Response, error) {
|
||
|
var (
|
||
|
localVarHTTPMethod = _nethttp.MethodPost
|
||
|
localVarPostBody interface{}
|
||
|
localVarFormFileName string
|
||
|
localVarFileName string
|
||
|
localVarFileBytes []byte
|
||
|
localVarReturnValue CreateVmsResponse
|
||
|
)
|
||
|
|
||
|
// create path and map variables
|
||
|
localVarPath := a.client.cfg.BasePath + "/CreateVms"
|
||
|
localVarHeaderParams := make(map[string]string)
|
||
|
localVarQueryParams := _neturl.Values{}
|
||
|
localVarFormParams := _neturl.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
|
||
|
if localVarOptionals != nil && localVarOptionals.CreateVmsRequest.IsSet() {
|
||
|
localVarOptionalCreateVmsRequest, localVarOptionalCreateVmsRequestok := localVarOptionals.CreateVmsRequest.Value().(CreateVmsRequest)
|
||
|
if !localVarOptionalCreateVmsRequestok {
|
||
|
return localVarReturnValue, nil, reportError("createVmsRequest should be CreateVmsRequest")
|
||
|
}
|
||
|
localVarPostBody = &localVarOptionalCreateVmsRequest
|
||
|
}
|
||
|
|
||
|
if ctx != nil {
|
||
|
// API Key Authentication
|
||
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
||
|
var key string
|
||
|
if auth.Prefix != "" {
|
||
|
key = auth.Prefix + " " + auth.Key
|
||
|
} else {
|
||
|
key = auth.Key
|
||
|
}
|
||
|
localVarHeaderParams["Authorization"] = key
|
||
|
}
|
||
|
}
|
||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, nil, err
|
||
|
}
|
||
|
|
||
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
||
|
if err != nil || localVarHTTPResponse == nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
||
|
localVarHTTPResponse.Body.Close()
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
if localVarHTTPResponse.StatusCode >= 300 {
|
||
|
newErr := GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: localVarHTTPResponse.Status,
|
||
|
}
|
||
|
if localVarHTTPResponse.StatusCode == 200 {
|
||
|
var v CreateVmsResponse
|
||
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr.error = err.Error()
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
newErr.model = v
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
if localVarHTTPResponse.StatusCode == 400 {
|
||
|
var v ErrorResponse
|
||
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr.error = err.Error()
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
newErr.model = v
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
if localVarHTTPResponse.StatusCode == 401 {
|
||
|
var v ErrorResponse
|
||
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr.error = err.Error()
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
newErr.model = v
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
if localVarHTTPResponse.StatusCode == 500 {
|
||
|
var v ErrorResponse
|
||
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr.error = err.Error()
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
newErr.model = v
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr := GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: err.Error(),
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
return localVarReturnValue, localVarHTTPResponse, nil
|
||
|
}
|
||
|
|
||
|
// DeleteVmsOpts Optional parameters for the method 'DeleteVms'
|
||
|
type DeleteVmsOpts struct {
|
||
|
DeleteVmsRequest optional.Interface
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
DeleteVms Method for DeleteVms
|
||
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||
|
* @param optional nil or *DeleteVmsOpts - Optional Parameters:
|
||
|
* @param "DeleteVmsRequest" (optional.Interface of DeleteVmsRequest) -
|
||
|
@return DeleteVmsResponse
|
||
|
*/
|
||
|
func (a *VmApiService) DeleteVms(ctx _context.Context, localVarOptionals *DeleteVmsOpts) (DeleteVmsResponse, *_nethttp.Response, error) {
|
||
|
var (
|
||
|
localVarHTTPMethod = _nethttp.MethodPost
|
||
|
localVarPostBody interface{}
|
||
|
localVarFormFileName string
|
||
|
localVarFileName string
|
||
|
localVarFileBytes []byte
|
||
|
localVarReturnValue DeleteVmsResponse
|
||
|
)
|
||
|
|
||
|
// create path and map variables
|
||
|
localVarPath := a.client.cfg.BasePath + "/DeleteVms"
|
||
|
localVarHeaderParams := make(map[string]string)
|
||
|
localVarQueryParams := _neturl.Values{}
|
||
|
localVarFormParams := _neturl.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
|
||
|
if localVarOptionals != nil && localVarOptionals.DeleteVmsRequest.IsSet() {
|
||
|
localVarOptionalDeleteVmsRequest, localVarOptionalDeleteVmsRequestok := localVarOptionals.DeleteVmsRequest.Value().(DeleteVmsRequest)
|
||
|
if !localVarOptionalDeleteVmsRequestok {
|
||
|
return localVarReturnValue, nil, reportError("deleteVmsRequest should be DeleteVmsRequest")
|
||
|
}
|
||
|
localVarPostBody = &localVarOptionalDeleteVmsRequest
|
||
|
}
|
||
|
|
||
|
if ctx != nil {
|
||
|
// API Key Authentication
|
||
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
||
|
var key string
|
||
|
if auth.Prefix != "" {
|
||
|
key = auth.Prefix + " " + auth.Key
|
||
|
} else {
|
||
|
key = auth.Key
|
||
|
}
|
||
|
localVarHeaderParams["Authorization"] = key
|
||
|
}
|
||
|
}
|
||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, nil, err
|
||
|
}
|
||
|
|
||
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
||
|
if err != nil || localVarHTTPResponse == nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
||
|
localVarHTTPResponse.Body.Close()
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
if localVarHTTPResponse.StatusCode >= 300 {
|
||
|
newErr := GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: localVarHTTPResponse.Status,
|
||
|
}
|
||
|
if localVarHTTPResponse.StatusCode == 200 {
|
||
|
var v DeleteVmsResponse
|
||
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr.error = err.Error()
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
newErr.model = v
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
if localVarHTTPResponse.StatusCode == 400 {
|
||
|
var v ErrorResponse
|
||
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr.error = err.Error()
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
newErr.model = v
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
if localVarHTTPResponse.StatusCode == 401 {
|
||
|
var v ErrorResponse
|
||
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr.error = err.Error()
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
newErr.model = v
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
if localVarHTTPResponse.StatusCode == 500 {
|
||
|
var v ErrorResponse
|
||
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr.error = err.Error()
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
newErr.model = v
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr := GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: err.Error(),
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
return localVarReturnValue, localVarHTTPResponse, nil
|
||
|
}
|
||
|
|
||
|
// ReadAdminPasswordOpts Optional parameters for the method 'ReadAdminPassword'
|
||
|
type ReadAdminPasswordOpts struct {
|
||
|
ReadAdminPasswordRequest optional.Interface
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
ReadAdminPassword Method for ReadAdminPassword
|
||
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||
|
* @param optional nil or *ReadAdminPasswordOpts - Optional Parameters:
|
||
|
* @param "ReadAdminPasswordRequest" (optional.Interface of ReadAdminPasswordRequest) -
|
||
|
@return ReadAdminPasswordResponse
|
||
|
*/
|
||
|
func (a *VmApiService) ReadAdminPassword(ctx _context.Context, localVarOptionals *ReadAdminPasswordOpts) (ReadAdminPasswordResponse, *_nethttp.Response, error) {
|
||
|
var (
|
||
|
localVarHTTPMethod = _nethttp.MethodPost
|
||
|
localVarPostBody interface{}
|
||
|
localVarFormFileName string
|
||
|
localVarFileName string
|
||
|
localVarFileBytes []byte
|
||
|
localVarReturnValue ReadAdminPasswordResponse
|
||
|
)
|
||
|
|
||
|
// create path and map variables
|
||
|
localVarPath := a.client.cfg.BasePath + "/ReadAdminPassword"
|
||
|
localVarHeaderParams := make(map[string]string)
|
||
|
localVarQueryParams := _neturl.Values{}
|
||
|
localVarFormParams := _neturl.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
|
||
|
if localVarOptionals != nil && localVarOptionals.ReadAdminPasswordRequest.IsSet() {
|
||
|
localVarOptionalReadAdminPasswordRequest, localVarOptionalReadAdminPasswordRequestok := localVarOptionals.ReadAdminPasswordRequest.Value().(ReadAdminPasswordRequest)
|
||
|
if !localVarOptionalReadAdminPasswordRequestok {
|
||
|
return localVarReturnValue, nil, reportError("readAdminPasswordRequest should be ReadAdminPasswordRequest")
|
||
|
}
|
||
|
localVarPostBody = &localVarOptionalReadAdminPasswordRequest
|
||
|
}
|
||
|
|
||
|
if ctx != nil {
|
||
|
// API Key Authentication
|
||
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
||
|
var key string
|
||
|
if auth.Prefix != "" {
|
||
|
key = auth.Prefix + " " + auth.Key
|
||
|
} else {
|
||
|
key = auth.Key
|
||
|
}
|
||
|
localVarHeaderParams["Authorization"] = key
|
||
|
}
|
||
|
}
|
||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, nil, err
|
||
|
}
|
||
|
|
||
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
||
|
if err != nil || localVarHTTPResponse == nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
||
|
localVarHTTPResponse.Body.Close()
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
if localVarHTTPResponse.StatusCode >= 300 {
|
||
|
newErr := GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: localVarHTTPResponse.Status,
|
||
|
}
|
||
|
if localVarHTTPResponse.StatusCode == 200 {
|
||
|
var v ReadAdminPasswordResponse
|
||
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr.error = err.Error()
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
newErr.model = v
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
if localVarHTTPResponse.StatusCode == 400 {
|
||
|
var v ErrorResponse
|
||
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr.error = err.Error()
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
newErr.model = v
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
if localVarHTTPResponse.StatusCode == 401 {
|
||
|
var v ErrorResponse
|
||
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr.error = err.Error()
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
newErr.model = v
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
if localVarHTTPResponse.StatusCode == 500 {
|
||
|
var v ErrorResponse
|
||
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr.error = err.Error()
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
newErr.model = v
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr := GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: err.Error(),
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
return localVarReturnValue, localVarHTTPResponse, nil
|
||
|
}
|
||
|
|
||
|
// ReadConsoleOutputOpts Optional parameters for the method 'ReadConsoleOutput'
|
||
|
type ReadConsoleOutputOpts struct {
|
||
|
ReadConsoleOutputRequest optional.Interface
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
ReadConsoleOutput Method for ReadConsoleOutput
|
||
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||
|
* @param optional nil or *ReadConsoleOutputOpts - Optional Parameters:
|
||
|
* @param "ReadConsoleOutputRequest" (optional.Interface of ReadConsoleOutputRequest) -
|
||
|
@return ReadConsoleOutputResponse
|
||
|
*/
|
||
|
func (a *VmApiService) ReadConsoleOutput(ctx _context.Context, localVarOptionals *ReadConsoleOutputOpts) (ReadConsoleOutputResponse, *_nethttp.Response, error) {
|
||
|
var (
|
||
|
localVarHTTPMethod = _nethttp.MethodPost
|
||
|
localVarPostBody interface{}
|
||
|
localVarFormFileName string
|
||
|
localVarFileName string
|
||
|
localVarFileBytes []byte
|
||
|
localVarReturnValue ReadConsoleOutputResponse
|
||
|
)
|
||
|
|
||
|
// create path and map variables
|
||
|
localVarPath := a.client.cfg.BasePath + "/ReadConsoleOutput"
|
||
|
localVarHeaderParams := make(map[string]string)
|
||
|
localVarQueryParams := _neturl.Values{}
|
||
|
localVarFormParams := _neturl.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
|
||
|
if localVarOptionals != nil && localVarOptionals.ReadConsoleOutputRequest.IsSet() {
|
||
|
localVarOptionalReadConsoleOutputRequest, localVarOptionalReadConsoleOutputRequestok := localVarOptionals.ReadConsoleOutputRequest.Value().(ReadConsoleOutputRequest)
|
||
|
if !localVarOptionalReadConsoleOutputRequestok {
|
||
|
return localVarReturnValue, nil, reportError("readConsoleOutputRequest should be ReadConsoleOutputRequest")
|
||
|
}
|
||
|
localVarPostBody = &localVarOptionalReadConsoleOutputRequest
|
||
|
}
|
||
|
|
||
|
if ctx != nil {
|
||
|
// API Key Authentication
|
||
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
||
|
var key string
|
||
|
if auth.Prefix != "" {
|
||
|
key = auth.Prefix + " " + auth.Key
|
||
|
} else {
|
||
|
key = auth.Key
|
||
|
}
|
||
|
localVarHeaderParams["Authorization"] = key
|
||
|
}
|
||
|
}
|
||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, nil, err
|
||
|
}
|
||
|
|
||
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
||
|
if err != nil || localVarHTTPResponse == nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
||
|
localVarHTTPResponse.Body.Close()
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
if localVarHTTPResponse.StatusCode >= 300 {
|
||
|
newErr := GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: localVarHTTPResponse.Status,
|
||
|
}
|
||
|
if localVarHTTPResponse.StatusCode == 200 {
|
||
|
var v ReadConsoleOutputResponse
|
||
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr.error = err.Error()
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
newErr.model = v
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
if localVarHTTPResponse.StatusCode == 400 {
|
||
|
var v ErrorResponse
|
||
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr.error = err.Error()
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
newErr.model = v
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
if localVarHTTPResponse.StatusCode == 401 {
|
||
|
var v ErrorResponse
|
||
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr.error = err.Error()
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
newErr.model = v
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
if localVarHTTPResponse.StatusCode == 500 {
|
||
|
var v ErrorResponse
|
||
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr.error = err.Error()
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
newErr.model = v
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr := GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: err.Error(),
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
return localVarReturnValue, localVarHTTPResponse, nil
|
||
|
}
|
||
|
|
||
|
// ReadVmTypesOpts Optional parameters for the method 'ReadVmTypes'
|
||
|
type ReadVmTypesOpts struct {
|
||
|
ReadVmTypesRequest optional.Interface
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
ReadVmTypes Method for ReadVmTypes
|
||
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||
|
* @param optional nil or *ReadVmTypesOpts - Optional Parameters:
|
||
|
* @param "ReadVmTypesRequest" (optional.Interface of ReadVmTypesRequest) -
|
||
|
@return ReadVmTypesResponse
|
||
|
*/
|
||
|
func (a *VmApiService) ReadVmTypes(ctx _context.Context, localVarOptionals *ReadVmTypesOpts) (ReadVmTypesResponse, *_nethttp.Response, error) {
|
||
|
var (
|
||
|
localVarHTTPMethod = _nethttp.MethodPost
|
||
|
localVarPostBody interface{}
|
||
|
localVarFormFileName string
|
||
|
localVarFileName string
|
||
|
localVarFileBytes []byte
|
||
|
localVarReturnValue ReadVmTypesResponse
|
||
|
)
|
||
|
|
||
|
// create path and map variables
|
||
|
localVarPath := a.client.cfg.BasePath + "/ReadVmTypes"
|
||
|
localVarHeaderParams := make(map[string]string)
|
||
|
localVarQueryParams := _neturl.Values{}
|
||
|
localVarFormParams := _neturl.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
|
||
|
if localVarOptionals != nil && localVarOptionals.ReadVmTypesRequest.IsSet() {
|
||
|
localVarOptionalReadVmTypesRequest, localVarOptionalReadVmTypesRequestok := localVarOptionals.ReadVmTypesRequest.Value().(ReadVmTypesRequest)
|
||
|
if !localVarOptionalReadVmTypesRequestok {
|
||
|
return localVarReturnValue, nil, reportError("readVmTypesRequest should be ReadVmTypesRequest")
|
||
|
}
|
||
|
localVarPostBody = &localVarOptionalReadVmTypesRequest
|
||
|
}
|
||
|
|
||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, nil, err
|
||
|
}
|
||
|
|
||
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
||
|
if err != nil || localVarHTTPResponse == nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
||
|
localVarHTTPResponse.Body.Close()
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
if localVarHTTPResponse.StatusCode >= 300 {
|
||
|
newErr := GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: localVarHTTPResponse.Status,
|
||
|
}
|
||
|
if localVarHTTPResponse.StatusCode == 200 {
|
||
|
var v ReadVmTypesResponse
|
||
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr.error = err.Error()
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
newErr.model = v
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr := GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: err.Error(),
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
return localVarReturnValue, localVarHTTPResponse, nil
|
||
|
}
|
||
|
|
||
|
// ReadVmsOpts Optional parameters for the method 'ReadVms'
|
||
|
type ReadVmsOpts struct {
|
||
|
ReadVmsRequest optional.Interface
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
ReadVms Method for ReadVms
|
||
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||
|
* @param optional nil or *ReadVmsOpts - Optional Parameters:
|
||
|
* @param "ReadVmsRequest" (optional.Interface of ReadVmsRequest) -
|
||
|
@return ReadVmsResponse
|
||
|
*/
|
||
|
func (a *VmApiService) ReadVms(ctx _context.Context, localVarOptionals *ReadVmsOpts) (ReadVmsResponse, *_nethttp.Response, error) {
|
||
|
var (
|
||
|
localVarHTTPMethod = _nethttp.MethodPost
|
||
|
localVarPostBody interface{}
|
||
|
localVarFormFileName string
|
||
|
localVarFileName string
|
||
|
localVarFileBytes []byte
|
||
|
localVarReturnValue ReadVmsResponse
|
||
|
)
|
||
|
|
||
|
// create path and map variables
|
||
|
localVarPath := a.client.cfg.BasePath + "/ReadVms"
|
||
|
localVarHeaderParams := make(map[string]string)
|
||
|
localVarQueryParams := _neturl.Values{}
|
||
|
localVarFormParams := _neturl.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
|
||
|
if localVarOptionals != nil && localVarOptionals.ReadVmsRequest.IsSet() {
|
||
|
localVarOptionalReadVmsRequest, localVarOptionalReadVmsRequestok := localVarOptionals.ReadVmsRequest.Value().(ReadVmsRequest)
|
||
|
if !localVarOptionalReadVmsRequestok {
|
||
|
return localVarReturnValue, nil, reportError("readVmsRequest should be ReadVmsRequest")
|
||
|
}
|
||
|
localVarPostBody = &localVarOptionalReadVmsRequest
|
||
|
}
|
||
|
|
||
|
if ctx != nil {
|
||
|
// API Key Authentication
|
||
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
||
|
var key string
|
||
|
if auth.Prefix != "" {
|
||
|
key = auth.Prefix + " " + auth.Key
|
||
|
} else {
|
||
|
key = auth.Key
|
||
|
}
|
||
|
localVarHeaderParams["Authorization"] = key
|
||
|
}
|
||
|
}
|
||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, nil, err
|
||
|
}
|
||
|
|
||
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
||
|
if err != nil || localVarHTTPResponse == nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
||
|
localVarHTTPResponse.Body.Close()
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
if localVarHTTPResponse.StatusCode >= 300 {
|
||
|
newErr := GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: localVarHTTPResponse.Status,
|
||
|
}
|
||
|
if localVarHTTPResponse.StatusCode == 200 {
|
||
|
var v ReadVmsResponse
|
||
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr.error = err.Error()
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
newErr.model = v
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
if localVarHTTPResponse.StatusCode == 400 {
|
||
|
var v ErrorResponse
|
||
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr.error = err.Error()
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
newErr.model = v
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
if localVarHTTPResponse.StatusCode == 401 {
|
||
|
var v ErrorResponse
|
||
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr.error = err.Error()
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
newErr.model = v
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
if localVarHTTPResponse.StatusCode == 500 {
|
||
|
var v ErrorResponse
|
||
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr.error = err.Error()
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
newErr.model = v
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr := GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: err.Error(),
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
return localVarReturnValue, localVarHTTPResponse, nil
|
||
|
}
|
||
|
|
||
|
// ReadVmsStateOpts Optional parameters for the method 'ReadVmsState'
|
||
|
type ReadVmsStateOpts struct {
|
||
|
ReadVmsStateRequest optional.Interface
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
ReadVmsState Method for ReadVmsState
|
||
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||
|
* @param optional nil or *ReadVmsStateOpts - Optional Parameters:
|
||
|
* @param "ReadVmsStateRequest" (optional.Interface of ReadVmsStateRequest) -
|
||
|
@return ReadVmsStateResponse
|
||
|
*/
|
||
|
func (a *VmApiService) ReadVmsState(ctx _context.Context, localVarOptionals *ReadVmsStateOpts) (ReadVmsStateResponse, *_nethttp.Response, error) {
|
||
|
var (
|
||
|
localVarHTTPMethod = _nethttp.MethodPost
|
||
|
localVarPostBody interface{}
|
||
|
localVarFormFileName string
|
||
|
localVarFileName string
|
||
|
localVarFileBytes []byte
|
||
|
localVarReturnValue ReadVmsStateResponse
|
||
|
)
|
||
|
|
||
|
// create path and map variables
|
||
|
localVarPath := a.client.cfg.BasePath + "/ReadVmsState"
|
||
|
localVarHeaderParams := make(map[string]string)
|
||
|
localVarQueryParams := _neturl.Values{}
|
||
|
localVarFormParams := _neturl.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
|
||
|
if localVarOptionals != nil && localVarOptionals.ReadVmsStateRequest.IsSet() {
|
||
|
localVarOptionalReadVmsStateRequest, localVarOptionalReadVmsStateRequestok := localVarOptionals.ReadVmsStateRequest.Value().(ReadVmsStateRequest)
|
||
|
if !localVarOptionalReadVmsStateRequestok {
|
||
|
return localVarReturnValue, nil, reportError("readVmsStateRequest should be ReadVmsStateRequest")
|
||
|
}
|
||
|
localVarPostBody = &localVarOptionalReadVmsStateRequest
|
||
|
}
|
||
|
|
||
|
if ctx != nil {
|
||
|
// API Key Authentication
|
||
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
||
|
var key string
|
||
|
if auth.Prefix != "" {
|
||
|
key = auth.Prefix + " " + auth.Key
|
||
|
} else {
|
||
|
key = auth.Key
|
||
|
}
|
||
|
localVarHeaderParams["Authorization"] = key
|
||
|
}
|
||
|
}
|
||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, nil, err
|
||
|
}
|
||
|
|
||
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
||
|
if err != nil || localVarHTTPResponse == nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
||
|
localVarHTTPResponse.Body.Close()
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
if localVarHTTPResponse.StatusCode >= 300 {
|
||
|
newErr := GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: localVarHTTPResponse.Status,
|
||
|
}
|
||
|
if localVarHTTPResponse.StatusCode == 200 {
|
||
|
var v ReadVmsStateResponse
|
||
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr.error = err.Error()
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
newErr.model = v
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
if localVarHTTPResponse.StatusCode == 400 {
|
||
|
var v ErrorResponse
|
||
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr.error = err.Error()
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
newErr.model = v
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
if localVarHTTPResponse.StatusCode == 401 {
|
||
|
var v ErrorResponse
|
||
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr.error = err.Error()
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
newErr.model = v
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
if localVarHTTPResponse.StatusCode == 500 {
|
||
|
var v ErrorResponse
|
||
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr.error = err.Error()
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
newErr.model = v
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr := GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: err.Error(),
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
return localVarReturnValue, localVarHTTPResponse, nil
|
||
|
}
|
||
|
|
||
|
// RebootVmsOpts Optional parameters for the method 'RebootVms'
|
||
|
type RebootVmsOpts struct {
|
||
|
RebootVmsRequest optional.Interface
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
RebootVms Method for RebootVms
|
||
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||
|
* @param optional nil or *RebootVmsOpts - Optional Parameters:
|
||
|
* @param "RebootVmsRequest" (optional.Interface of RebootVmsRequest) -
|
||
|
@return RebootVmsResponse
|
||
|
*/
|
||
|
func (a *VmApiService) RebootVms(ctx _context.Context, localVarOptionals *RebootVmsOpts) (RebootVmsResponse, *_nethttp.Response, error) {
|
||
|
var (
|
||
|
localVarHTTPMethod = _nethttp.MethodPost
|
||
|
localVarPostBody interface{}
|
||
|
localVarFormFileName string
|
||
|
localVarFileName string
|
||
|
localVarFileBytes []byte
|
||
|
localVarReturnValue RebootVmsResponse
|
||
|
)
|
||
|
|
||
|
// create path and map variables
|
||
|
localVarPath := a.client.cfg.BasePath + "/RebootVms"
|
||
|
localVarHeaderParams := make(map[string]string)
|
||
|
localVarQueryParams := _neturl.Values{}
|
||
|
localVarFormParams := _neturl.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
|
||
|
if localVarOptionals != nil && localVarOptionals.RebootVmsRequest.IsSet() {
|
||
|
localVarOptionalRebootVmsRequest, localVarOptionalRebootVmsRequestok := localVarOptionals.RebootVmsRequest.Value().(RebootVmsRequest)
|
||
|
if !localVarOptionalRebootVmsRequestok {
|
||
|
return localVarReturnValue, nil, reportError("rebootVmsRequest should be RebootVmsRequest")
|
||
|
}
|
||
|
localVarPostBody = &localVarOptionalRebootVmsRequest
|
||
|
}
|
||
|
|
||
|
if ctx != nil {
|
||
|
// API Key Authentication
|
||
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
||
|
var key string
|
||
|
if auth.Prefix != "" {
|
||
|
key = auth.Prefix + " " + auth.Key
|
||
|
} else {
|
||
|
key = auth.Key
|
||
|
}
|
||
|
localVarHeaderParams["Authorization"] = key
|
||
|
}
|
||
|
}
|
||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, nil, err
|
||
|
}
|
||
|
|
||
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
||
|
if err != nil || localVarHTTPResponse == nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
||
|
localVarHTTPResponse.Body.Close()
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
if localVarHTTPResponse.StatusCode >= 300 {
|
||
|
newErr := GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: localVarHTTPResponse.Status,
|
||
|
}
|
||
|
if localVarHTTPResponse.StatusCode == 200 {
|
||
|
var v RebootVmsResponse
|
||
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr.error = err.Error()
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
newErr.model = v
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
if localVarHTTPResponse.StatusCode == 400 {
|
||
|
var v ErrorResponse
|
||
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr.error = err.Error()
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
newErr.model = v
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
if localVarHTTPResponse.StatusCode == 401 {
|
||
|
var v ErrorResponse
|
||
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr.error = err.Error()
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
newErr.model = v
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
if localVarHTTPResponse.StatusCode == 500 {
|
||
|
var v ErrorResponse
|
||
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr.error = err.Error()
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
newErr.model = v
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr := GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: err.Error(),
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
return localVarReturnValue, localVarHTTPResponse, nil
|
||
|
}
|
||
|
|
||
|
// StartVmsOpts Optional parameters for the method 'StartVms'
|
||
|
type StartVmsOpts struct {
|
||
|
StartVmsRequest optional.Interface
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
StartVms Method for StartVms
|
||
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||
|
* @param optional nil or *StartVmsOpts - Optional Parameters:
|
||
|
* @param "StartVmsRequest" (optional.Interface of StartVmsRequest) -
|
||
|
@return StartVmsResponse
|
||
|
*/
|
||
|
func (a *VmApiService) StartVms(ctx _context.Context, localVarOptionals *StartVmsOpts) (StartVmsResponse, *_nethttp.Response, error) {
|
||
|
var (
|
||
|
localVarHTTPMethod = _nethttp.MethodPost
|
||
|
localVarPostBody interface{}
|
||
|
localVarFormFileName string
|
||
|
localVarFileName string
|
||
|
localVarFileBytes []byte
|
||
|
localVarReturnValue StartVmsResponse
|
||
|
)
|
||
|
|
||
|
// create path and map variables
|
||
|
localVarPath := a.client.cfg.BasePath + "/StartVms"
|
||
|
localVarHeaderParams := make(map[string]string)
|
||
|
localVarQueryParams := _neturl.Values{}
|
||
|
localVarFormParams := _neturl.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
|
||
|
if localVarOptionals != nil && localVarOptionals.StartVmsRequest.IsSet() {
|
||
|
localVarOptionalStartVmsRequest, localVarOptionalStartVmsRequestok := localVarOptionals.StartVmsRequest.Value().(StartVmsRequest)
|
||
|
if !localVarOptionalStartVmsRequestok {
|
||
|
return localVarReturnValue, nil, reportError("startVmsRequest should be StartVmsRequest")
|
||
|
}
|
||
|
localVarPostBody = &localVarOptionalStartVmsRequest
|
||
|
}
|
||
|
|
||
|
if ctx != nil {
|
||
|
// API Key Authentication
|
||
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
||
|
var key string
|
||
|
if auth.Prefix != "" {
|
||
|
key = auth.Prefix + " " + auth.Key
|
||
|
} else {
|
||
|
key = auth.Key
|
||
|
}
|
||
|
localVarHeaderParams["Authorization"] = key
|
||
|
}
|
||
|
}
|
||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, nil, err
|
||
|
}
|
||
|
|
||
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
||
|
if err != nil || localVarHTTPResponse == nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
||
|
localVarHTTPResponse.Body.Close()
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
if localVarHTTPResponse.StatusCode >= 300 {
|
||
|
newErr := GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: localVarHTTPResponse.Status,
|
||
|
}
|
||
|
if localVarHTTPResponse.StatusCode == 200 {
|
||
|
var v StartVmsResponse
|
||
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr.error = err.Error()
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
newErr.model = v
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
if localVarHTTPResponse.StatusCode == 400 {
|
||
|
var v ErrorResponse
|
||
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr.error = err.Error()
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
newErr.model = v
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
if localVarHTTPResponse.StatusCode == 401 {
|
||
|
var v ErrorResponse
|
||
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr.error = err.Error()
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
newErr.model = v
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
if localVarHTTPResponse.StatusCode == 500 {
|
||
|
var v ErrorResponse
|
||
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr.error = err.Error()
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
newErr.model = v
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr := GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: err.Error(),
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
return localVarReturnValue, localVarHTTPResponse, nil
|
||
|
}
|
||
|
|
||
|
// StopVmsOpts Optional parameters for the method 'StopVms'
|
||
|
type StopVmsOpts struct {
|
||
|
StopVmsRequest optional.Interface
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
StopVms Method for StopVms
|
||
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||
|
* @param optional nil or *StopVmsOpts - Optional Parameters:
|
||
|
* @param "StopVmsRequest" (optional.Interface of StopVmsRequest) -
|
||
|
@return StopVmsResponse
|
||
|
*/
|
||
|
func (a *VmApiService) StopVms(ctx _context.Context, localVarOptionals *StopVmsOpts) (StopVmsResponse, *_nethttp.Response, error) {
|
||
|
var (
|
||
|
localVarHTTPMethod = _nethttp.MethodPost
|
||
|
localVarPostBody interface{}
|
||
|
localVarFormFileName string
|
||
|
localVarFileName string
|
||
|
localVarFileBytes []byte
|
||
|
localVarReturnValue StopVmsResponse
|
||
|
)
|
||
|
|
||
|
// create path and map variables
|
||
|
localVarPath := a.client.cfg.BasePath + "/StopVms"
|
||
|
localVarHeaderParams := make(map[string]string)
|
||
|
localVarQueryParams := _neturl.Values{}
|
||
|
localVarFormParams := _neturl.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
|
||
|
if localVarOptionals != nil && localVarOptionals.StopVmsRequest.IsSet() {
|
||
|
localVarOptionalStopVmsRequest, localVarOptionalStopVmsRequestok := localVarOptionals.StopVmsRequest.Value().(StopVmsRequest)
|
||
|
if !localVarOptionalStopVmsRequestok {
|
||
|
return localVarReturnValue, nil, reportError("stopVmsRequest should be StopVmsRequest")
|
||
|
}
|
||
|
localVarPostBody = &localVarOptionalStopVmsRequest
|
||
|
}
|
||
|
|
||
|
if ctx != nil {
|
||
|
// API Key Authentication
|
||
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
||
|
var key string
|
||
|
if auth.Prefix != "" {
|
||
|
key = auth.Prefix + " " + auth.Key
|
||
|
} else {
|
||
|
key = auth.Key
|
||
|
}
|
||
|
localVarHeaderParams["Authorization"] = key
|
||
|
}
|
||
|
}
|
||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, nil, err
|
||
|
}
|
||
|
|
||
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
||
|
if err != nil || localVarHTTPResponse == nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
||
|
localVarHTTPResponse.Body.Close()
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
if localVarHTTPResponse.StatusCode >= 300 {
|
||
|
newErr := GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: localVarHTTPResponse.Status,
|
||
|
}
|
||
|
if localVarHTTPResponse.StatusCode == 200 {
|
||
|
var v StopVmsResponse
|
||
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr.error = err.Error()
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
newErr.model = v
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
if localVarHTTPResponse.StatusCode == 400 {
|
||
|
var v ErrorResponse
|
||
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr.error = err.Error()
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
newErr.model = v
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
if localVarHTTPResponse.StatusCode == 401 {
|
||
|
var v ErrorResponse
|
||
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr.error = err.Error()
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
newErr.model = v
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
if localVarHTTPResponse.StatusCode == 500 {
|
||
|
var v ErrorResponse
|
||
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr.error = err.Error()
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
newErr.model = v
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr := GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: err.Error(),
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
return localVarReturnValue, localVarHTTPResponse, nil
|
||
|
}
|
||
|
|
||
|
// UpdateVmOpts Optional parameters for the method 'UpdateVm'
|
||
|
type UpdateVmOpts struct {
|
||
|
UpdateVmRequest optional.Interface
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
UpdateVm Method for UpdateVm
|
||
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||
|
* @param optional nil or *UpdateVmOpts - Optional Parameters:
|
||
|
* @param "UpdateVmRequest" (optional.Interface of UpdateVmRequest) -
|
||
|
@return UpdateVmResponse
|
||
|
*/
|
||
|
func (a *VmApiService) UpdateVm(ctx _context.Context, localVarOptionals *UpdateVmOpts) (UpdateVmResponse, *_nethttp.Response, error) {
|
||
|
var (
|
||
|
localVarHTTPMethod = _nethttp.MethodPost
|
||
|
localVarPostBody interface{}
|
||
|
localVarFormFileName string
|
||
|
localVarFileName string
|
||
|
localVarFileBytes []byte
|
||
|
localVarReturnValue UpdateVmResponse
|
||
|
)
|
||
|
|
||
|
// create path and map variables
|
||
|
localVarPath := a.client.cfg.BasePath + "/UpdateVm"
|
||
|
localVarHeaderParams := make(map[string]string)
|
||
|
localVarQueryParams := _neturl.Values{}
|
||
|
localVarFormParams := _neturl.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
|
||
|
if localVarOptionals != nil && localVarOptionals.UpdateVmRequest.IsSet() {
|
||
|
localVarOptionalUpdateVmRequest, localVarOptionalUpdateVmRequestok := localVarOptionals.UpdateVmRequest.Value().(UpdateVmRequest)
|
||
|
if !localVarOptionalUpdateVmRequestok {
|
||
|
return localVarReturnValue, nil, reportError("updateVmRequest should be UpdateVmRequest")
|
||
|
}
|
||
|
localVarPostBody = &localVarOptionalUpdateVmRequest
|
||
|
}
|
||
|
|
||
|
if ctx != nil {
|
||
|
// API Key Authentication
|
||
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
||
|
var key string
|
||
|
if auth.Prefix != "" {
|
||
|
key = auth.Prefix + " " + auth.Key
|
||
|
} else {
|
||
|
key = auth.Key
|
||
|
}
|
||
|
localVarHeaderParams["Authorization"] = key
|
||
|
}
|
||
|
}
|
||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, nil, err
|
||
|
}
|
||
|
|
||
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
||
|
if err != nil || localVarHTTPResponse == nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
||
|
localVarHTTPResponse.Body.Close()
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
if localVarHTTPResponse.StatusCode >= 300 {
|
||
|
newErr := GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: localVarHTTPResponse.Status,
|
||
|
}
|
||
|
if localVarHTTPResponse.StatusCode == 200 {
|
||
|
var v UpdateVmResponse
|
||
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr.error = err.Error()
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
newErr.model = v
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
if localVarHTTPResponse.StatusCode == 400 {
|
||
|
var v ErrorResponse
|
||
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr.error = err.Error()
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
newErr.model = v
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
if localVarHTTPResponse.StatusCode == 401 {
|
||
|
var v ErrorResponse
|
||
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr.error = err.Error()
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
newErr.model = v
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
if localVarHTTPResponse.StatusCode == 500 {
|
||
|
var v ErrorResponse
|
||
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr.error = err.Error()
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
newErr.model = v
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr := GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: err.Error(),
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
return localVarReturnValue, localVarHTTPResponse, nil
|
||
|
}
|