2019-02-08 05:15:45 -05:00
|
|
|
/*
|
|
|
|
* HyperOne API
|
|
|
|
*
|
|
|
|
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
|
|
*
|
|
|
|
* API version: 0.0.2
|
|
|
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
|
|
|
*/
|
|
|
|
|
|
|
|
package openapi
|
|
|
|
|
|
|
|
import (
|
2019-12-03 08:18:49 -05:00
|
|
|
_context "context"
|
2019-02-08 05:15:45 -05:00
|
|
|
"fmt"
|
|
|
|
"github.com/antihax/optional"
|
2019-12-03 08:18:49 -05:00
|
|
|
_ioutil "io/ioutil"
|
|
|
|
_nethttp "net/http"
|
|
|
|
_neturl "net/url"
|
|
|
|
"strings"
|
2019-02-08 05:15:45 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
// Linger please
|
|
|
|
var (
|
2019-12-03 08:18:49 -05:00
|
|
|
_ _context.Context
|
2019-02-08 05:15:45 -05:00
|
|
|
)
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
// VmApiService VmApi service
|
2019-02-08 05:15:45 -05:00
|
|
|
type VmApiService service
|
|
|
|
|
|
|
|
/*
|
2019-12-03 08:18:49 -05:00
|
|
|
VmActionFlavour /actions/flavour
|
2019-02-08 05:15:45 -05:00
|
|
|
Action flavour
|
2019-12-03 08:18:49 -05:00
|
|
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
2019-02-08 05:15:45 -05:00
|
|
|
* @param vmId ID of vm
|
|
|
|
* @param vmActionFlavour
|
|
|
|
@return Vm
|
|
|
|
*/
|
2019-12-03 08:18:49 -05:00
|
|
|
func (a *VmApiService) VmActionFlavour(ctx _context.Context, vmId string, vmActionFlavour VmActionFlavour) (Vm, *_nethttp.Response, error) {
|
2019-02-08 05:15:45 -05:00
|
|
|
var (
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPMethod = _nethttp.MethodPost
|
2019-02-08 05:15:45 -05:00
|
|
|
localVarPostBody interface{}
|
|
|
|
localVarFormFileName string
|
|
|
|
localVarFileName string
|
|
|
|
localVarFileBytes []byte
|
|
|
|
localVarReturnValue Vm
|
|
|
|
)
|
|
|
|
|
|
|
|
// create path and map variables
|
|
|
|
localVarPath := a.client.cfg.BasePath + "/vm/{vmId}/actions/flavour"
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarPath = strings.Replace(localVarPath, "{"+"vmId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", vmId)), -1)
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarQueryParams := _neturl.Values{}
|
|
|
|
localVarFormParams := _neturl.Values{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// to determine the Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentTypes := []string{"application/json"}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
|
|
if localVarHTTPContentType != "" {
|
|
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// to determine the Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccepts := []string{"application/json"}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
|
|
if localVarHTTPHeaderAccept != "" {
|
|
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
// body params
|
|
|
|
localVarPostBody = &vmActionFlavour
|
|
|
|
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["x-project"] = key
|
|
|
|
}
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
return localVarReturnValue, nil, err
|
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
|
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
|
|
|
localVarHTTPResponse.Body.Close()
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
2019-02-08 05:15:45 -05:00
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
2019-12-03 08:18:49 -05:00
|
|
|
error: localVarHTTPResponse.Status,
|
|
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode == 200 {
|
|
|
|
var v Vm
|
|
|
|
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
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode == 202 {
|
2019-02-08 05:15:45 -05:00
|
|
|
var v Vm
|
2019-12-03 08:18:49 -05:00
|
|
|
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 InlineResponse400
|
|
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr.error = err.Error()
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
newErr.model = v
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
|
|
|
error: err.Error(),
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2019-12-03 08:18:49 -05:00
|
|
|
VmActionImage /actions/image
|
2019-02-08 05:15:45 -05:00
|
|
|
Action image
|
2019-12-03 08:18:49 -05:00
|
|
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
2019-02-08 05:15:45 -05:00
|
|
|
* @param vmId ID of vm
|
|
|
|
* @param vmActionImage
|
|
|
|
@return Vm
|
|
|
|
*/
|
2019-12-03 08:18:49 -05:00
|
|
|
func (a *VmApiService) VmActionImage(ctx _context.Context, vmId string, vmActionImage VmActionImage) (Vm, *_nethttp.Response, error) {
|
2019-02-08 05:15:45 -05:00
|
|
|
var (
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPMethod = _nethttp.MethodPost
|
2019-02-08 05:15:45 -05:00
|
|
|
localVarPostBody interface{}
|
|
|
|
localVarFormFileName string
|
|
|
|
localVarFileName string
|
|
|
|
localVarFileBytes []byte
|
|
|
|
localVarReturnValue Vm
|
|
|
|
)
|
|
|
|
|
|
|
|
// create path and map variables
|
|
|
|
localVarPath := a.client.cfg.BasePath + "/vm/{vmId}/actions/image"
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarPath = strings.Replace(localVarPath, "{"+"vmId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", vmId)), -1)
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarQueryParams := _neturl.Values{}
|
|
|
|
localVarFormParams := _neturl.Values{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// to determine the Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentTypes := []string{"application/json"}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
|
|
if localVarHTTPContentType != "" {
|
|
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// to determine the Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccepts := []string{"application/json"}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
|
|
if localVarHTTPHeaderAccept != "" {
|
|
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
// body params
|
|
|
|
localVarPostBody = &vmActionImage
|
|
|
|
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["x-project"] = key
|
|
|
|
}
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
return localVarReturnValue, nil, err
|
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
|
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
|
|
|
localVarHTTPResponse.Body.Close()
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
2019-02-08 05:15:45 -05:00
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
2019-12-03 08:18:49 -05:00
|
|
|
error: localVarHTTPResponse.Status,
|
|
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode == 200 {
|
|
|
|
var v Vm
|
|
|
|
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
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode == 202 {
|
2019-02-08 05:15:45 -05:00
|
|
|
var v Vm
|
2019-12-03 08:18:49 -05:00
|
|
|
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 InlineResponse400
|
|
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr.error = err.Error()
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
newErr.model = v
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
|
|
|
error: err.Error(),
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2019-12-03 08:18:49 -05:00
|
|
|
VmActionPasswordReset /actions/password_reset
|
2019-02-08 05:15:45 -05:00
|
|
|
Action password_reset
|
2019-12-03 08:18:49 -05:00
|
|
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
2019-02-08 05:15:45 -05:00
|
|
|
* @param vmId ID of vm
|
|
|
|
* @param vmActionPasswordReset
|
|
|
|
@return Vm
|
|
|
|
*/
|
2019-12-03 08:18:49 -05:00
|
|
|
func (a *VmApiService) VmActionPasswordReset(ctx _context.Context, vmId string, vmActionPasswordReset VmActionPasswordReset) (Vm, *_nethttp.Response, error) {
|
2019-02-08 05:15:45 -05:00
|
|
|
var (
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPMethod = _nethttp.MethodPost
|
2019-02-08 05:15:45 -05:00
|
|
|
localVarPostBody interface{}
|
|
|
|
localVarFormFileName string
|
|
|
|
localVarFileName string
|
|
|
|
localVarFileBytes []byte
|
|
|
|
localVarReturnValue Vm
|
|
|
|
)
|
|
|
|
|
|
|
|
// create path and map variables
|
|
|
|
localVarPath := a.client.cfg.BasePath + "/vm/{vmId}/actions/password_reset"
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarPath = strings.Replace(localVarPath, "{"+"vmId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", vmId)), -1)
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarQueryParams := _neturl.Values{}
|
|
|
|
localVarFormParams := _neturl.Values{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// to determine the Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentTypes := []string{"application/json"}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
|
|
if localVarHTTPContentType != "" {
|
|
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// to determine the Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccepts := []string{"application/json"}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
|
|
if localVarHTTPHeaderAccept != "" {
|
|
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
// body params
|
|
|
|
localVarPostBody = &vmActionPasswordReset
|
|
|
|
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["x-project"] = key
|
|
|
|
}
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
return localVarReturnValue, nil, err
|
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
|
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
|
|
|
localVarHTTPResponse.Body.Close()
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
2019-02-08 05:15:45 -05:00
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
2019-12-03 08:18:49 -05:00
|
|
|
error: localVarHTTPResponse.Status,
|
|
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode == 200 {
|
|
|
|
var v Vm
|
|
|
|
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
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode == 202 {
|
2019-02-08 05:15:45 -05:00
|
|
|
var v Vm
|
2019-12-03 08:18:49 -05:00
|
|
|
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 InlineResponse400
|
|
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr.error = err.Error()
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
newErr.model = v
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
|
|
|
error: err.Error(),
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2019-12-03 08:18:49 -05:00
|
|
|
VmActionRename /actions/rename
|
2019-02-08 05:15:45 -05:00
|
|
|
Action rename
|
2019-12-03 08:18:49 -05:00
|
|
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
2019-02-08 05:15:45 -05:00
|
|
|
* @param vmId ID of vm
|
|
|
|
* @param vmActionRename
|
|
|
|
@return Vm
|
|
|
|
*/
|
2019-12-03 08:18:49 -05:00
|
|
|
func (a *VmApiService) VmActionRename(ctx _context.Context, vmId string, vmActionRename VmActionRename) (Vm, *_nethttp.Response, error) {
|
2019-02-08 05:15:45 -05:00
|
|
|
var (
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPMethod = _nethttp.MethodPost
|
2019-02-08 05:15:45 -05:00
|
|
|
localVarPostBody interface{}
|
|
|
|
localVarFormFileName string
|
|
|
|
localVarFileName string
|
|
|
|
localVarFileBytes []byte
|
|
|
|
localVarReturnValue Vm
|
|
|
|
)
|
|
|
|
|
|
|
|
// create path and map variables
|
|
|
|
localVarPath := a.client.cfg.BasePath + "/vm/{vmId}/actions/rename"
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarPath = strings.Replace(localVarPath, "{"+"vmId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", vmId)), -1)
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarQueryParams := _neturl.Values{}
|
|
|
|
localVarFormParams := _neturl.Values{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// to determine the Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentTypes := []string{"application/json"}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
|
|
if localVarHTTPContentType != "" {
|
|
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// to determine the Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccepts := []string{"application/json"}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
|
|
if localVarHTTPHeaderAccept != "" {
|
|
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
// body params
|
|
|
|
localVarPostBody = &vmActionRename
|
|
|
|
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["x-project"] = key
|
|
|
|
}
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
return localVarReturnValue, nil, err
|
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
|
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
|
|
|
localVarHTTPResponse.Body.Close()
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
2019-02-08 05:15:45 -05:00
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
2019-12-03 08:18:49 -05:00
|
|
|
error: localVarHTTPResponse.Status,
|
|
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode == 200 {
|
|
|
|
var v Vm
|
|
|
|
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
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode == 202 {
|
2019-02-08 05:15:45 -05:00
|
|
|
var v Vm
|
2019-12-03 08:18:49 -05:00
|
|
|
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 InlineResponse400
|
|
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr.error = err.Error()
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
newErr.model = v
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
|
|
|
error: err.Error(),
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2019-12-03 08:18:49 -05:00
|
|
|
VmActionRestart /actions/restart
|
2019-02-08 05:15:45 -05:00
|
|
|
Action restart
|
2019-12-03 08:18:49 -05:00
|
|
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
2019-02-08 05:15:45 -05:00
|
|
|
* @param vmId ID of vm
|
|
|
|
@return Vm
|
|
|
|
*/
|
2019-12-03 08:18:49 -05:00
|
|
|
func (a *VmApiService) VmActionRestart(ctx _context.Context, vmId string) (Vm, *_nethttp.Response, error) {
|
2019-02-08 05:15:45 -05:00
|
|
|
var (
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPMethod = _nethttp.MethodPost
|
2019-02-08 05:15:45 -05:00
|
|
|
localVarPostBody interface{}
|
|
|
|
localVarFormFileName string
|
|
|
|
localVarFileName string
|
|
|
|
localVarFileBytes []byte
|
|
|
|
localVarReturnValue Vm
|
|
|
|
)
|
|
|
|
|
|
|
|
// create path and map variables
|
|
|
|
localVarPath := a.client.cfg.BasePath + "/vm/{vmId}/actions/restart"
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarPath = strings.Replace(localVarPath, "{"+"vmId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", vmId)), -1)
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarQueryParams := _neturl.Values{}
|
|
|
|
localVarFormParams := _neturl.Values{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// to determine the Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentTypes := []string{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
|
|
if localVarHTTPContentType != "" {
|
|
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// to determine the Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccepts := []string{"application/json"}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
|
|
if localVarHTTPHeaderAccept != "" {
|
|
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
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["x-project"] = key
|
|
|
|
}
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
return localVarReturnValue, nil, err
|
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
|
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
|
|
|
localVarHTTPResponse.Body.Close()
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
2019-02-08 05:15:45 -05:00
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
2019-12-03 08:18:49 -05:00
|
|
|
error: localVarHTTPResponse.Status,
|
|
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode == 200 {
|
|
|
|
var v Vm
|
|
|
|
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
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode == 202 {
|
2019-02-08 05:15:45 -05:00
|
|
|
var v Vm
|
2019-12-03 08:18:49 -05:00
|
|
|
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 InlineResponse400
|
|
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr.error = err.Error()
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
newErr.model = v
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
|
|
|
error: err.Error(),
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2019-12-03 08:18:49 -05:00
|
|
|
VmActionStart /actions/start
|
2019-02-08 05:15:45 -05:00
|
|
|
Action start
|
2019-12-03 08:18:49 -05:00
|
|
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
2019-02-08 05:15:45 -05:00
|
|
|
* @param vmId ID of vm
|
|
|
|
@return Vm
|
|
|
|
*/
|
2019-12-03 08:18:49 -05:00
|
|
|
func (a *VmApiService) VmActionStart(ctx _context.Context, vmId string) (Vm, *_nethttp.Response, error) {
|
2019-02-08 05:15:45 -05:00
|
|
|
var (
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPMethod = _nethttp.MethodPost
|
2019-02-08 05:15:45 -05:00
|
|
|
localVarPostBody interface{}
|
|
|
|
localVarFormFileName string
|
|
|
|
localVarFileName string
|
|
|
|
localVarFileBytes []byte
|
|
|
|
localVarReturnValue Vm
|
|
|
|
)
|
|
|
|
|
|
|
|
// create path and map variables
|
|
|
|
localVarPath := a.client.cfg.BasePath + "/vm/{vmId}/actions/start"
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarPath = strings.Replace(localVarPath, "{"+"vmId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", vmId)), -1)
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarQueryParams := _neturl.Values{}
|
|
|
|
localVarFormParams := _neturl.Values{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// to determine the Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentTypes := []string{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
|
|
if localVarHTTPContentType != "" {
|
|
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// to determine the Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccepts := []string{"application/json"}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
|
|
if localVarHTTPHeaderAccept != "" {
|
|
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
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["x-project"] = key
|
|
|
|
}
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
return localVarReturnValue, nil, err
|
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
|
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
|
|
|
localVarHTTPResponse.Body.Close()
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
2019-02-08 05:15:45 -05:00
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
2019-12-03 08:18:49 -05:00
|
|
|
error: localVarHTTPResponse.Status,
|
|
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode == 200 {
|
|
|
|
var v Vm
|
|
|
|
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
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode == 202 {
|
2019-02-08 05:15:45 -05:00
|
|
|
var v Vm
|
2019-12-03 08:18:49 -05:00
|
|
|
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 InlineResponse400
|
|
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr.error = err.Error()
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
newErr.model = v
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
|
|
|
error: err.Error(),
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2019-12-03 08:18:49 -05:00
|
|
|
VmActionStop /actions/stop
|
2019-02-08 05:15:45 -05:00
|
|
|
Action stop
|
2019-12-03 08:18:49 -05:00
|
|
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
2019-02-08 05:15:45 -05:00
|
|
|
* @param vmId ID of vm
|
|
|
|
@return Vm
|
|
|
|
*/
|
2019-12-03 08:18:49 -05:00
|
|
|
func (a *VmApiService) VmActionStop(ctx _context.Context, vmId string) (Vm, *_nethttp.Response, error) {
|
2019-02-08 05:15:45 -05:00
|
|
|
var (
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPMethod = _nethttp.MethodPost
|
2019-02-08 05:15:45 -05:00
|
|
|
localVarPostBody interface{}
|
|
|
|
localVarFormFileName string
|
|
|
|
localVarFileName string
|
|
|
|
localVarFileBytes []byte
|
|
|
|
localVarReturnValue Vm
|
|
|
|
)
|
|
|
|
|
|
|
|
// create path and map variables
|
|
|
|
localVarPath := a.client.cfg.BasePath + "/vm/{vmId}/actions/stop"
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarPath = strings.Replace(localVarPath, "{"+"vmId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", vmId)), -1)
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarQueryParams := _neturl.Values{}
|
|
|
|
localVarFormParams := _neturl.Values{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// to determine the Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentTypes := []string{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
|
|
if localVarHTTPContentType != "" {
|
|
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// to determine the Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccepts := []string{"application/json"}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
|
|
if localVarHTTPHeaderAccept != "" {
|
|
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
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["x-project"] = key
|
|
|
|
}
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
return localVarReturnValue, nil, err
|
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
|
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
|
|
|
localVarHTTPResponse.Body.Close()
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
2019-02-08 05:15:45 -05:00
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
2019-12-03 08:18:49 -05:00
|
|
|
error: localVarHTTPResponse.Status,
|
|
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode == 200 {
|
|
|
|
var v Vm
|
|
|
|
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
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode == 202 {
|
2019-02-08 05:15:45 -05:00
|
|
|
var v Vm
|
2019-12-03 08:18:49 -05:00
|
|
|
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 InlineResponse400
|
|
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr.error = err.Error()
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
newErr.model = v
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
|
|
|
error: err.Error(),
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2019-12-03 08:18:49 -05:00
|
|
|
VmActionTurnoff /actions/turnoff
|
2019-02-08 05:15:45 -05:00
|
|
|
Action turnoff
|
2019-12-03 08:18:49 -05:00
|
|
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
2019-02-08 05:15:45 -05:00
|
|
|
* @param vmId ID of vm
|
|
|
|
@return Vm
|
|
|
|
*/
|
2019-12-03 08:18:49 -05:00
|
|
|
func (a *VmApiService) VmActionTurnoff(ctx _context.Context, vmId string) (Vm, *_nethttp.Response, error) {
|
2019-02-08 05:15:45 -05:00
|
|
|
var (
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPMethod = _nethttp.MethodPost
|
2019-02-08 05:15:45 -05:00
|
|
|
localVarPostBody interface{}
|
|
|
|
localVarFormFileName string
|
|
|
|
localVarFileName string
|
|
|
|
localVarFileBytes []byte
|
|
|
|
localVarReturnValue Vm
|
|
|
|
)
|
|
|
|
|
|
|
|
// create path and map variables
|
|
|
|
localVarPath := a.client.cfg.BasePath + "/vm/{vmId}/actions/turnoff"
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarPath = strings.Replace(localVarPath, "{"+"vmId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", vmId)), -1)
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarQueryParams := _neturl.Values{}
|
|
|
|
localVarFormParams := _neturl.Values{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// to determine the Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentTypes := []string{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
|
|
if localVarHTTPContentType != "" {
|
|
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// to determine the Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccepts := []string{"application/json"}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
|
|
if localVarHTTPHeaderAccept != "" {
|
|
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
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["x-project"] = key
|
|
|
|
}
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
return localVarReturnValue, nil, err
|
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
|
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
|
|
|
localVarHTTPResponse.Body.Close()
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
2019-02-08 05:15:45 -05:00
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
2019-12-03 08:18:49 -05:00
|
|
|
error: localVarHTTPResponse.Status,
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode == 200 {
|
2019-02-08 05:15:45 -05:00
|
|
|
var v Vm
|
2019-12-03 08:18:49 -05:00
|
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr.error = err.Error()
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
newErr.model = v
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode == 202 {
|
|
|
|
var v Vm
|
|
|
|
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 InlineResponse400
|
|
|
|
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
|
|
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
|
|
|
error: err.Error(),
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2019-12-03 08:18:49 -05:00
|
|
|
VmCreate Create
|
2019-02-08 05:15:45 -05:00
|
|
|
Create vm
|
2019-12-03 08:18:49 -05:00
|
|
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
2019-02-08 05:15:45 -05:00
|
|
|
* @param vmCreate
|
|
|
|
@return Vm
|
|
|
|
*/
|
2019-12-03 08:18:49 -05:00
|
|
|
func (a *VmApiService) VmCreate(ctx _context.Context, vmCreate VmCreate) (Vm, *_nethttp.Response, error) {
|
2019-02-08 05:15:45 -05:00
|
|
|
var (
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPMethod = _nethttp.MethodPost
|
2019-02-08 05:15:45 -05:00
|
|
|
localVarPostBody interface{}
|
|
|
|
localVarFormFileName string
|
|
|
|
localVarFileName string
|
|
|
|
localVarFileBytes []byte
|
|
|
|
localVarReturnValue Vm
|
|
|
|
)
|
|
|
|
|
|
|
|
// create path and map variables
|
|
|
|
localVarPath := a.client.cfg.BasePath + "/vm"
|
|
|
|
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarQueryParams := _neturl.Values{}
|
|
|
|
localVarFormParams := _neturl.Values{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// to determine the Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentTypes := []string{"application/json"}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
|
|
if localVarHTTPContentType != "" {
|
|
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// to determine the Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccepts := []string{"application/json"}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
|
|
if localVarHTTPHeaderAccept != "" {
|
|
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
// body params
|
|
|
|
localVarPostBody = &vmCreate
|
|
|
|
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["x-project"] = key
|
|
|
|
}
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
return localVarReturnValue, nil, err
|
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
|
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
|
|
|
localVarHTTPResponse.Body.Close()
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
2019-02-08 05:15:45 -05:00
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
2019-12-03 08:18:49 -05:00
|
|
|
error: localVarHTTPResponse.Status,
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode == 200 {
|
2019-02-08 05:15:45 -05:00
|
|
|
var v Vm
|
2019-12-03 08:18:49 -05:00
|
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr.error = err.Error()
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
newErr.model = v
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode == 202 {
|
|
|
|
var v Vm
|
|
|
|
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 InlineResponse400
|
|
|
|
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
|
|
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
|
|
|
error: err.Error(),
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2019-12-03 08:18:49 -05:00
|
|
|
VmDelete Delete
|
|
|
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
2019-02-08 05:15:45 -05:00
|
|
|
* @param vmId ID of vm
|
|
|
|
* @param vmDelete
|
|
|
|
*/
|
2019-12-03 08:18:49 -05:00
|
|
|
func (a *VmApiService) VmDelete(ctx _context.Context, vmId string, vmDelete VmDelete) (*_nethttp.Response, error) {
|
2019-02-08 05:15:45 -05:00
|
|
|
var (
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPMethod = _nethttp.MethodDelete
|
2019-02-08 05:15:45 -05:00
|
|
|
localVarPostBody interface{}
|
|
|
|
localVarFormFileName string
|
|
|
|
localVarFileName string
|
|
|
|
localVarFileBytes []byte
|
|
|
|
)
|
|
|
|
|
|
|
|
// create path and map variables
|
|
|
|
localVarPath := a.client.cfg.BasePath + "/vm/{vmId}"
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarPath = strings.Replace(localVarPath, "{"+"vmId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", vmId)), -1)
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarQueryParams := _neturl.Values{}
|
|
|
|
localVarFormParams := _neturl.Values{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// to determine the Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentTypes := []string{"application/json"}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
|
|
if localVarHTTPContentType != "" {
|
|
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// to determine the Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccepts := []string{"application/json"}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
|
|
if localVarHTTPHeaderAccept != "" {
|
|
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
// body params
|
|
|
|
localVarPostBody = &vmDelete
|
|
|
|
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["x-project"] = key
|
|
|
|
}
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
|
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
|
|
return localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
|
|
|
localVarHTTPResponse.Body.Close()
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
2019-02-08 05:15:45 -05:00
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
2019-12-03 08:18:49 -05:00
|
|
|
error: localVarHTTPResponse.Status,
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode == 400 {
|
|
|
|
var v InlineResponse400
|
|
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
|
|
if err != nil {
|
|
|
|
newErr.error = err.Error()
|
|
|
|
return localVarHTTPResponse, newErr
|
|
|
|
}
|
|
|
|
newErr.model = v
|
|
|
|
return localVarHTTPResponse, newErr
|
|
|
|
}
|
|
|
|
return localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarHTTPResponse, nil
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2019-12-03 08:18:49 -05:00
|
|
|
VmDeleteAccessrightsIdentity /accessrights/:identity
|
|
|
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
2019-02-08 05:15:45 -05:00
|
|
|
* @param vmId ID of vm
|
|
|
|
* @param identity identity
|
|
|
|
@return Vm
|
|
|
|
*/
|
2019-12-03 08:18:49 -05:00
|
|
|
func (a *VmApiService) VmDeleteAccessrightsIdentity(ctx _context.Context, vmId string, identity string) (Vm, *_nethttp.Response, error) {
|
2019-02-08 05:15:45 -05:00
|
|
|
var (
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPMethod = _nethttp.MethodDelete
|
2019-02-08 05:15:45 -05:00
|
|
|
localVarPostBody interface{}
|
|
|
|
localVarFormFileName string
|
|
|
|
localVarFileName string
|
|
|
|
localVarFileBytes []byte
|
|
|
|
localVarReturnValue Vm
|
|
|
|
)
|
|
|
|
|
|
|
|
// create path and map variables
|
|
|
|
localVarPath := a.client.cfg.BasePath + "/vm/{vmId}/accessrights/{identity}"
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarPath = strings.Replace(localVarPath, "{"+"vmId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", vmId)), -1)
|
|
|
|
localVarPath = strings.Replace(localVarPath, "{"+"identity"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", identity)), -1)
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarQueryParams := _neturl.Values{}
|
|
|
|
localVarFormParams := _neturl.Values{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// to determine the Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentTypes := []string{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
|
|
if localVarHTTPContentType != "" {
|
|
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// to determine the Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccepts := []string{"application/json"}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
|
|
if localVarHTTPHeaderAccept != "" {
|
|
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
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["x-project"] = key
|
|
|
|
}
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
return localVarReturnValue, nil, err
|
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
|
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
|
|
|
localVarHTTPResponse.Body.Close()
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
2019-02-08 05:15:45 -05:00
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
2019-12-03 08:18:49 -05:00
|
|
|
error: localVarHTTPResponse.Status,
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode == 200 {
|
2019-02-08 05:15:45 -05:00
|
|
|
var v Vm
|
2019-12-03 08:18:49 -05:00
|
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr.error = err.Error()
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
newErr.model = v
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode == 202 {
|
2019-02-08 05:15:45 -05:00
|
|
|
var v Vm
|
2019-12-03 08:18:49 -05:00
|
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr.error = err.Error()
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
newErr.model = v
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode == 400 {
|
|
|
|
var v InlineResponse400
|
|
|
|
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
|
|
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
|
|
|
error: err.Error(),
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2019-12-03 08:18:49 -05:00
|
|
|
VmDeleteHddDiskId /hdd/:diskId
|
|
|
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
2019-02-08 05:15:45 -05:00
|
|
|
* @param vmId ID of vm
|
|
|
|
* @param diskId diskId
|
2019-12-03 08:18:49 -05:00
|
|
|
@return Hdd
|
2019-02-08 05:15:45 -05:00
|
|
|
*/
|
2019-12-03 08:18:49 -05:00
|
|
|
func (a *VmApiService) VmDeleteHddDiskId(ctx _context.Context, vmId string, diskId string) (Hdd, *_nethttp.Response, error) {
|
2019-02-08 05:15:45 -05:00
|
|
|
var (
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPMethod = _nethttp.MethodDelete
|
2019-02-08 05:15:45 -05:00
|
|
|
localVarPostBody interface{}
|
|
|
|
localVarFormFileName string
|
|
|
|
localVarFileName string
|
|
|
|
localVarFileBytes []byte
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarReturnValue Hdd
|
2019-02-08 05:15:45 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
// create path and map variables
|
|
|
|
localVarPath := a.client.cfg.BasePath + "/vm/{vmId}/hdd/{diskId}"
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarPath = strings.Replace(localVarPath, "{"+"vmId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", vmId)), -1)
|
|
|
|
localVarPath = strings.Replace(localVarPath, "{"+"diskId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", diskId)), -1)
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarQueryParams := _neturl.Values{}
|
|
|
|
localVarFormParams := _neturl.Values{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// to determine the Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentTypes := []string{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
|
|
if localVarHTTPContentType != "" {
|
|
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// to determine the Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccepts := []string{"application/json"}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
|
|
if localVarHTTPHeaderAccept != "" {
|
|
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
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["x-project"] = key
|
|
|
|
}
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
return localVarReturnValue, nil, err
|
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
|
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
|
|
|
localVarHTTPResponse.Body.Close()
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
2019-02-08 05:15:45 -05:00
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
2019-12-03 08:18:49 -05:00
|
|
|
error: localVarHTTPResponse.Status,
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode == 200 {
|
|
|
|
var v Hdd
|
|
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr.error = err.Error()
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
newErr.model = v
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode == 400 {
|
|
|
|
var v InlineResponse400
|
|
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr.error = err.Error()
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
newErr.model = v
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
|
|
|
error: err.Error(),
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2019-12-03 08:18:49 -05:00
|
|
|
VmDeleteNetadpNetadpId /netadp/:netadpId
|
|
|
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
2019-02-08 05:15:45 -05:00
|
|
|
* @param vmId ID of vm
|
|
|
|
* @param netadpId netadpId
|
2019-12-03 08:18:49 -05:00
|
|
|
@return Netadp
|
2019-02-08 05:15:45 -05:00
|
|
|
*/
|
2019-12-03 08:18:49 -05:00
|
|
|
func (a *VmApiService) VmDeleteNetadpNetadpId(ctx _context.Context, vmId string, netadpId string) (Netadp, *_nethttp.Response, error) {
|
2019-02-08 05:15:45 -05:00
|
|
|
var (
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPMethod = _nethttp.MethodDelete
|
2019-02-08 05:15:45 -05:00
|
|
|
localVarPostBody interface{}
|
|
|
|
localVarFormFileName string
|
|
|
|
localVarFileName string
|
|
|
|
localVarFileBytes []byte
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarReturnValue Netadp
|
2019-02-08 05:15:45 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
// create path and map variables
|
|
|
|
localVarPath := a.client.cfg.BasePath + "/vm/{vmId}/netadp/{netadpId}"
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarPath = strings.Replace(localVarPath, "{"+"vmId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", vmId)), -1)
|
|
|
|
localVarPath = strings.Replace(localVarPath, "{"+"netadpId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", netadpId)), -1)
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarQueryParams := _neturl.Values{}
|
|
|
|
localVarFormParams := _neturl.Values{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// to determine the Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentTypes := []string{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
|
|
if localVarHTTPContentType != "" {
|
|
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// to determine the Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccepts := []string{"application/json"}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
|
|
if localVarHTTPHeaderAccept != "" {
|
|
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
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["x-project"] = key
|
|
|
|
}
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
return localVarReturnValue, nil, err
|
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
|
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
|
|
|
localVarHTTPResponse.Body.Close()
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
2019-02-08 05:15:45 -05:00
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
2019-12-03 08:18:49 -05:00
|
|
|
error: localVarHTTPResponse.Status,
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode == 200 {
|
|
|
|
var v Netadp
|
|
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr.error = err.Error()
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
newErr.model = v
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode == 400 {
|
|
|
|
var v InlineResponse400
|
|
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr.error = err.Error()
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
newErr.model = v
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
|
|
|
error: err.Error(),
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2019-12-03 08:18:49 -05:00
|
|
|
VmDeleteTagKey /tag/:key
|
|
|
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
2019-02-08 05:15:45 -05:00
|
|
|
* @param vmId ID of vm
|
|
|
|
* @param key key
|
2019-12-03 08:18:49 -05:00
|
|
|
@return map[string]string
|
2019-02-08 05:15:45 -05:00
|
|
|
*/
|
2019-12-03 08:18:49 -05:00
|
|
|
func (a *VmApiService) VmDeleteTagKey(ctx _context.Context, vmId string, key string) (map[string]string, *_nethttp.Response, error) {
|
2019-02-08 05:15:45 -05:00
|
|
|
var (
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPMethod = _nethttp.MethodDelete
|
2019-02-08 05:15:45 -05:00
|
|
|
localVarPostBody interface{}
|
|
|
|
localVarFormFileName string
|
|
|
|
localVarFileName string
|
|
|
|
localVarFileBytes []byte
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarReturnValue map[string]string
|
2019-02-08 05:15:45 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
// create path and map variables
|
|
|
|
localVarPath := a.client.cfg.BasePath + "/vm/{vmId}/tag/{key}"
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarPath = strings.Replace(localVarPath, "{"+"vmId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", vmId)), -1)
|
|
|
|
localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", key)), -1)
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarQueryParams := _neturl.Values{}
|
|
|
|
localVarFormParams := _neturl.Values{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// to determine the Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentTypes := []string{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
|
|
if localVarHTTPContentType != "" {
|
|
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// to determine the Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccepts := []string{"application/json"}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
|
|
if localVarHTTPHeaderAccept != "" {
|
|
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
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["x-project"] = key
|
|
|
|
}
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
return localVarReturnValue, nil, err
|
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
|
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
|
|
|
localVarHTTPResponse.Body.Close()
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
2019-02-08 05:15:45 -05:00
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
2019-12-03 08:18:49 -05:00
|
|
|
error: localVarHTTPResponse.Status,
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode == 200 {
|
|
|
|
var v map[string]string
|
|
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr.error = err.Error()
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
newErr.model = v
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode == 400 {
|
|
|
|
var v InlineResponse400
|
|
|
|
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
|
|
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
|
|
|
error: err.Error(),
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2019-12-03 08:18:49 -05:00
|
|
|
VmGetConsole /console
|
|
|
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
2019-02-08 05:15:45 -05:00
|
|
|
* @param vmId ID of vm
|
|
|
|
*/
|
2019-12-03 08:18:49 -05:00
|
|
|
func (a *VmApiService) VmGetConsole(ctx _context.Context, vmId string) (*_nethttp.Response, error) {
|
2019-02-08 05:15:45 -05:00
|
|
|
var (
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPMethod = _nethttp.MethodGet
|
2019-02-08 05:15:45 -05:00
|
|
|
localVarPostBody interface{}
|
|
|
|
localVarFormFileName string
|
|
|
|
localVarFileName string
|
|
|
|
localVarFileBytes []byte
|
|
|
|
)
|
|
|
|
|
|
|
|
// create path and map variables
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarPath := a.client.cfg.BasePath + "/vm/{vmId}/console"
|
|
|
|
localVarPath = strings.Replace(localVarPath, "{"+"vmId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", vmId)), -1)
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarQueryParams := _neturl.Values{}
|
|
|
|
localVarFormParams := _neturl.Values{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// to determine the Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentTypes := []string{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
|
|
if localVarHTTPContentType != "" {
|
|
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// to determine the Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccepts := []string{"application/json"}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
|
|
if localVarHTTPHeaderAccept != "" {
|
|
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
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["x-project"] = key
|
|
|
|
}
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
|
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
|
|
return localVarHTTPResponse, err
|
|
|
|
}
|
|
|
|
|
|
|
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
|
|
|
localVarHTTPResponse.Body.Close()
|
|
|
|
if err != nil {
|
|
|
|
return localVarHTTPResponse, err
|
|
|
|
}
|
|
|
|
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
|
|
|
error: localVarHTTPResponse.Status,
|
|
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode == 400 {
|
|
|
|
var v InlineResponse400
|
|
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
|
|
if err != nil {
|
|
|
|
newErr.error = err.Error()
|
|
|
|
return localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
newErr.model = v
|
|
|
|
return localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarHTTPResponse, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
VmGetServicesServiceId /services/:serviceId
|
|
|
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
|
|
* @param vmId ID of vm
|
|
|
|
* @param serviceId serviceId
|
|
|
|
@return VmServices
|
|
|
|
*/
|
|
|
|
func (a *VmApiService) VmGetServicesServiceId(ctx _context.Context, vmId string, serviceId string) (VmServices, *_nethttp.Response, error) {
|
|
|
|
var (
|
|
|
|
localVarHTTPMethod = _nethttp.MethodGet
|
|
|
|
localVarPostBody interface{}
|
|
|
|
localVarFormFileName string
|
|
|
|
localVarFileName string
|
|
|
|
localVarFileBytes []byte
|
|
|
|
localVarReturnValue VmServices
|
|
|
|
)
|
|
|
|
|
|
|
|
// create path and map variables
|
|
|
|
localVarPath := a.client.cfg.BasePath + "/vm/{vmId}/services/{serviceId}"
|
|
|
|
localVarPath = strings.Replace(localVarPath, "{"+"vmId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", vmId)), -1)
|
|
|
|
localVarPath = strings.Replace(localVarPath, "{"+"serviceId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", serviceId)), -1)
|
|
|
|
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
|
|
localVarQueryParams := _neturl.Values{}
|
|
|
|
localVarFormParams := _neturl.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
|
|
|
|
}
|
2019-02-08 05:15:45 -05:00
|
|
|
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
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHeaderParams["x-project"] = key
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
return localVarReturnValue, nil, err
|
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
|
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
|
|
|
localVarHTTPResponse.Body.Close()
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
2019-02-08 05:15:45 -05:00
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
2019-12-03 08:18:49 -05:00
|
|
|
error: localVarHTTPResponse.Status,
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode == 200 {
|
2019-02-08 05:15:45 -05:00
|
|
|
var v VmServices
|
2019-12-03 08:18:49 -05:00
|
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr.error = err.Error()
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
newErr.model = v
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode == 400 {
|
|
|
|
var v InlineResponse400
|
|
|
|
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
|
|
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
|
|
|
error: err.Error(),
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2019-12-03 08:18:49 -05:00
|
|
|
VmGetTag /tag
|
|
|
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
2019-02-08 05:15:45 -05:00
|
|
|
* @param vmId ID of vm
|
2019-12-03 08:18:49 -05:00
|
|
|
@return map[string]string
|
2019-02-08 05:15:45 -05:00
|
|
|
*/
|
2019-12-03 08:18:49 -05:00
|
|
|
func (a *VmApiService) VmGetTag(ctx _context.Context, vmId string) (map[string]string, *_nethttp.Response, error) {
|
2019-02-08 05:15:45 -05:00
|
|
|
var (
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPMethod = _nethttp.MethodGet
|
2019-02-08 05:15:45 -05:00
|
|
|
localVarPostBody interface{}
|
|
|
|
localVarFormFileName string
|
|
|
|
localVarFileName string
|
|
|
|
localVarFileBytes []byte
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarReturnValue map[string]string
|
2019-02-08 05:15:45 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
// create path and map variables
|
|
|
|
localVarPath := a.client.cfg.BasePath + "/vm/{vmId}/tag"
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarPath = strings.Replace(localVarPath, "{"+"vmId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", vmId)), -1)
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarQueryParams := _neturl.Values{}
|
|
|
|
localVarFormParams := _neturl.Values{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// to determine the Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentTypes := []string{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
|
|
if localVarHTTPContentType != "" {
|
|
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// to determine the Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccepts := []string{"application/json"}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
|
|
if localVarHTTPHeaderAccept != "" {
|
|
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
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["x-project"] = key
|
|
|
|
}
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
return localVarReturnValue, nil, err
|
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
|
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
|
|
|
localVarHTTPResponse.Body.Close()
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
2019-02-08 05:15:45 -05:00
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
2019-12-03 08:18:49 -05:00
|
|
|
error: localVarHTTPResponse.Status,
|
|
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode == 200 {
|
|
|
|
var v map[string]string
|
|
|
|
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
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode == 400 {
|
|
|
|
var v InlineResponse400
|
|
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr.error = err.Error()
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
newErr.model = v
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
|
|
|
error: err.Error(),
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// VmListOpts Optional parameters for the method 'VmList'
|
|
|
|
type VmListOpts struct {
|
|
|
|
Name optional.String
|
|
|
|
Tag optional.Interface
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2019-12-03 08:18:49 -05:00
|
|
|
VmList List
|
2019-02-08 05:15:45 -05:00
|
|
|
List vm
|
2019-12-03 08:18:49 -05:00
|
|
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
2019-02-08 05:15:45 -05:00
|
|
|
* @param optional nil or *VmListOpts - Optional Parameters:
|
|
|
|
* @param "Name" (optional.String) - Filter by name
|
2019-12-03 08:18:49 -05:00
|
|
|
* @param "Tag" (optional.Interface of map[string]string) - Filter by tag
|
2019-02-08 05:15:45 -05:00
|
|
|
@return []Vm
|
|
|
|
*/
|
2019-12-03 08:18:49 -05:00
|
|
|
func (a *VmApiService) VmList(ctx _context.Context, localVarOptionals *VmListOpts) ([]Vm, *_nethttp.Response, error) {
|
2019-02-08 05:15:45 -05:00
|
|
|
var (
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPMethod = _nethttp.MethodGet
|
2019-02-08 05:15:45 -05:00
|
|
|
localVarPostBody interface{}
|
|
|
|
localVarFormFileName string
|
|
|
|
localVarFileName string
|
|
|
|
localVarFileBytes []byte
|
|
|
|
localVarReturnValue []Vm
|
|
|
|
)
|
|
|
|
|
|
|
|
// create path and map variables
|
|
|
|
localVarPath := a.client.cfg.BasePath + "/vm"
|
|
|
|
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarQueryParams := _neturl.Values{}
|
|
|
|
localVarFormParams := _neturl.Values{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
if localVarOptionals != nil && localVarOptionals.Name.IsSet() {
|
|
|
|
localVarQueryParams.Add("name", parameterToString(localVarOptionals.Name.Value(), ""))
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarOptionals != nil && localVarOptionals.Tag.IsSet() {
|
|
|
|
localVarQueryParams.Add("tag", parameterToString(localVarOptionals.Tag.Value(), ""))
|
|
|
|
}
|
2019-02-08 05:15:45 -05:00
|
|
|
// to determine the Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentTypes := []string{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
|
|
if localVarHTTPContentType != "" {
|
|
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// to determine the Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccepts := []string{"application/json"}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
|
|
if localVarHTTPHeaderAccept != "" {
|
|
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
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["x-project"] = key
|
|
|
|
}
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
return localVarReturnValue, nil, err
|
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
|
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
|
|
|
localVarHTTPResponse.Body.Close()
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
2019-02-08 05:15:45 -05:00
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
2019-12-03 08:18:49 -05:00
|
|
|
error: localVarHTTPResponse.Status,
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode == 200 {
|
2019-02-08 05:15:45 -05:00
|
|
|
var v []Vm
|
2019-12-03 08:18:49 -05:00
|
|
|
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 InlineResponse400
|
|
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr.error = err.Error()
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
newErr.model = v
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
|
|
|
error: err.Error(),
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2019-12-03 08:18:49 -05:00
|
|
|
VmListAccessrights /accessrights
|
|
|
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
2019-02-08 05:15:45 -05:00
|
|
|
* @param vmId ID of vm
|
|
|
|
@return []string
|
|
|
|
*/
|
2019-12-03 08:18:49 -05:00
|
|
|
func (a *VmApiService) VmListAccessrights(ctx _context.Context, vmId string) ([]string, *_nethttp.Response, error) {
|
2019-02-08 05:15:45 -05:00
|
|
|
var (
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPMethod = _nethttp.MethodGet
|
2019-02-08 05:15:45 -05:00
|
|
|
localVarPostBody interface{}
|
|
|
|
localVarFormFileName string
|
|
|
|
localVarFileName string
|
|
|
|
localVarFileBytes []byte
|
|
|
|
localVarReturnValue []string
|
|
|
|
)
|
|
|
|
|
|
|
|
// create path and map variables
|
|
|
|
localVarPath := a.client.cfg.BasePath + "/vm/{vmId}/accessrights"
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarPath = strings.Replace(localVarPath, "{"+"vmId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", vmId)), -1)
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarQueryParams := _neturl.Values{}
|
|
|
|
localVarFormParams := _neturl.Values{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// to determine the Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentTypes := []string{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
|
|
if localVarHTTPContentType != "" {
|
|
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// to determine the Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccepts := []string{"application/json"}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
|
|
if localVarHTTPHeaderAccept != "" {
|
|
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
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["x-project"] = key
|
|
|
|
}
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
return localVarReturnValue, nil, err
|
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
|
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
|
|
|
localVarHTTPResponse.Body.Close()
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
2019-02-08 05:15:45 -05:00
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
2019-12-03 08:18:49 -05:00
|
|
|
error: localVarHTTPResponse.Status,
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode == 200 {
|
2019-02-08 05:15:45 -05:00
|
|
|
var v []string
|
2019-12-03 08:18:49 -05:00
|
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr.error = err.Error()
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
newErr.model = v
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode == 400 {
|
|
|
|
var v InlineResponse400
|
|
|
|
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
|
|
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
|
|
|
error: err.Error(),
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2019-12-03 08:18:49 -05:00
|
|
|
VmListHdd /hdd
|
|
|
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
2019-02-08 05:15:45 -05:00
|
|
|
* @param vmId ID of vm
|
|
|
|
@return []Hdd
|
|
|
|
*/
|
2019-12-03 08:18:49 -05:00
|
|
|
func (a *VmApiService) VmListHdd(ctx _context.Context, vmId string) ([]Hdd, *_nethttp.Response, error) {
|
2019-02-08 05:15:45 -05:00
|
|
|
var (
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPMethod = _nethttp.MethodGet
|
2019-02-08 05:15:45 -05:00
|
|
|
localVarPostBody interface{}
|
|
|
|
localVarFormFileName string
|
|
|
|
localVarFileName string
|
|
|
|
localVarFileBytes []byte
|
|
|
|
localVarReturnValue []Hdd
|
|
|
|
)
|
|
|
|
|
|
|
|
// create path and map variables
|
|
|
|
localVarPath := a.client.cfg.BasePath + "/vm/{vmId}/hdd"
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarPath = strings.Replace(localVarPath, "{"+"vmId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", vmId)), -1)
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarQueryParams := _neturl.Values{}
|
|
|
|
localVarFormParams := _neturl.Values{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// to determine the Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentTypes := []string{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
|
|
if localVarHTTPContentType != "" {
|
|
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// to determine the Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccepts := []string{"application/json"}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
|
|
if localVarHTTPHeaderAccept != "" {
|
|
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
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["x-project"] = key
|
|
|
|
}
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
return localVarReturnValue, nil, err
|
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
|
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
|
|
|
localVarHTTPResponse.Body.Close()
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
2019-02-08 05:15:45 -05:00
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
2019-12-03 08:18:49 -05:00
|
|
|
error: localVarHTTPResponse.Status,
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode == 200 {
|
2019-02-08 05:15:45 -05:00
|
|
|
var v []Hdd
|
2019-12-03 08:18:49 -05:00
|
|
|
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 InlineResponse400
|
|
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr.error = err.Error()
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
newErr.model = v
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
|
|
|
error: err.Error(),
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2019-12-03 08:18:49 -05:00
|
|
|
VmListNetadp /netadp
|
|
|
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
2019-02-08 05:15:45 -05:00
|
|
|
* @param vmId ID of vm
|
|
|
|
@return []Netadp
|
|
|
|
*/
|
2019-12-03 08:18:49 -05:00
|
|
|
func (a *VmApiService) VmListNetadp(ctx _context.Context, vmId string) ([]Netadp, *_nethttp.Response, error) {
|
2019-02-08 05:15:45 -05:00
|
|
|
var (
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPMethod = _nethttp.MethodGet
|
2019-02-08 05:15:45 -05:00
|
|
|
localVarPostBody interface{}
|
|
|
|
localVarFormFileName string
|
|
|
|
localVarFileName string
|
|
|
|
localVarFileBytes []byte
|
|
|
|
localVarReturnValue []Netadp
|
|
|
|
)
|
|
|
|
|
|
|
|
// create path and map variables
|
|
|
|
localVarPath := a.client.cfg.BasePath + "/vm/{vmId}/netadp"
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarPath = strings.Replace(localVarPath, "{"+"vmId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", vmId)), -1)
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarQueryParams := _neturl.Values{}
|
|
|
|
localVarFormParams := _neturl.Values{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// to determine the Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentTypes := []string{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
|
|
if localVarHTTPContentType != "" {
|
|
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// to determine the Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccepts := []string{"application/json"}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
|
|
if localVarHTTPHeaderAccept != "" {
|
|
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
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["x-project"] = key
|
|
|
|
}
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
return localVarReturnValue, nil, err
|
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
|
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
|
|
|
localVarHTTPResponse.Body.Close()
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
2019-02-08 05:15:45 -05:00
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
2019-12-03 08:18:49 -05:00
|
|
|
error: localVarHTTPResponse.Status,
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode == 200 {
|
2019-02-08 05:15:45 -05:00
|
|
|
var v []Netadp
|
2019-12-03 08:18:49 -05:00
|
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr.error = err.Error()
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
newErr.model = v
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode == 400 {
|
|
|
|
var v InlineResponse400
|
|
|
|
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
|
|
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
|
|
|
error: err.Error(),
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// VmListQueueOpts Optional parameters for the method 'VmListQueue'
|
|
|
|
type VmListQueueOpts struct {
|
|
|
|
Limit optional.Float32
|
|
|
|
Skip optional.Float32
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2019-12-03 08:18:49 -05:00
|
|
|
VmListQueue /queue
|
|
|
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
2019-02-08 05:15:45 -05:00
|
|
|
* @param vmId ID of vm
|
2019-12-03 08:18:49 -05:00
|
|
|
* @param optional nil or *VmListQueueOpts - Optional Parameters:
|
|
|
|
* @param "Limit" (optional.Float32) - $limit
|
|
|
|
* @param "Skip" (optional.Float32) - $skip
|
2019-02-08 05:15:45 -05:00
|
|
|
@return []Event
|
|
|
|
*/
|
2019-12-03 08:18:49 -05:00
|
|
|
func (a *VmApiService) VmListQueue(ctx _context.Context, vmId string, localVarOptionals *VmListQueueOpts) ([]Event, *_nethttp.Response, error) {
|
2019-02-08 05:15:45 -05:00
|
|
|
var (
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPMethod = _nethttp.MethodGet
|
2019-02-08 05:15:45 -05:00
|
|
|
localVarPostBody interface{}
|
|
|
|
localVarFormFileName string
|
|
|
|
localVarFileName string
|
|
|
|
localVarFileBytes []byte
|
|
|
|
localVarReturnValue []Event
|
|
|
|
)
|
|
|
|
|
|
|
|
// create path and map variables
|
|
|
|
localVarPath := a.client.cfg.BasePath + "/vm/{vmId}/queue"
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarPath = strings.Replace(localVarPath, "{"+"vmId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", vmId)), -1)
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarQueryParams := _neturl.Values{}
|
|
|
|
localVarFormParams := _neturl.Values{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarOptionals != nil && localVarOptionals.Limit.IsSet() {
|
|
|
|
localVarQueryParams.Add("$limit", parameterToString(localVarOptionals.Limit.Value(), ""))
|
|
|
|
}
|
|
|
|
if localVarOptionals != nil && localVarOptionals.Skip.IsSet() {
|
|
|
|
localVarQueryParams.Add("$skip", parameterToString(localVarOptionals.Skip.Value(), ""))
|
|
|
|
}
|
2019-02-08 05:15:45 -05:00
|
|
|
// to determine the Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentTypes := []string{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
|
|
if localVarHTTPContentType != "" {
|
|
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
// to determine the Accept header
|
|
|
|
localVarHTTPHeaderAccepts := []string{"application/json"}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
// set Accept header
|
|
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
|
|
if localVarHTTPHeaderAccept != "" {
|
|
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
|
|
}
|
2019-02-08 05:15:45 -05:00
|
|
|
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
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHeaderParams["x-project"] = key
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
return localVarReturnValue, nil, err
|
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
|
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
|
|
|
localVarHTTPResponse.Body.Close()
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
2019-02-08 05:15:45 -05:00
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
2019-12-03 08:18:49 -05:00
|
|
|
error: localVarHTTPResponse.Status,
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode == 200 {
|
2019-02-08 05:15:45 -05:00
|
|
|
var v []Event
|
2019-12-03 08:18:49 -05:00
|
|
|
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 InlineResponse400
|
|
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr.error = err.Error()
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
newErr.model = v
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
|
|
|
error: err.Error(),
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2019-12-03 08:18:49 -05:00
|
|
|
VmListServices /services
|
|
|
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
2019-02-08 05:15:45 -05:00
|
|
|
* @param vmId ID of vm
|
|
|
|
@return []VmServices
|
|
|
|
*/
|
2019-12-03 08:18:49 -05:00
|
|
|
func (a *VmApiService) VmListServices(ctx _context.Context, vmId string) ([]VmServices, *_nethttp.Response, error) {
|
2019-02-08 05:15:45 -05:00
|
|
|
var (
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPMethod = _nethttp.MethodGet
|
2019-02-08 05:15:45 -05:00
|
|
|
localVarPostBody interface{}
|
|
|
|
localVarFormFileName string
|
|
|
|
localVarFileName string
|
|
|
|
localVarFileBytes []byte
|
|
|
|
localVarReturnValue []VmServices
|
|
|
|
)
|
|
|
|
|
|
|
|
// create path and map variables
|
|
|
|
localVarPath := a.client.cfg.BasePath + "/vm/{vmId}/services"
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarPath = strings.Replace(localVarPath, "{"+"vmId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", vmId)), -1)
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarQueryParams := _neturl.Values{}
|
|
|
|
localVarFormParams := _neturl.Values{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// to determine the Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentTypes := []string{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
|
|
if localVarHTTPContentType != "" {
|
|
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// to determine the Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccepts := []string{"application/json"}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
|
|
if localVarHTTPHeaderAccept != "" {
|
|
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
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["x-project"] = key
|
|
|
|
}
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
return localVarReturnValue, nil, err
|
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
|
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
|
|
|
localVarHTTPResponse.Body.Close()
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
2019-02-08 05:15:45 -05:00
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
2019-12-03 08:18:49 -05:00
|
|
|
error: localVarHTTPResponse.Status,
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode == 200 {
|
2019-02-08 05:15:45 -05:00
|
|
|
var v []VmServices
|
2019-12-03 08:18:49 -05:00
|
|
|
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 InlineResponse400
|
|
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr.error = err.Error()
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
newErr.model = v
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
|
|
|
error: err.Error(),
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2019-12-03 08:18:49 -05:00
|
|
|
VmPatchTag /tag
|
|
|
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
2019-02-08 05:15:45 -05:00
|
|
|
* @param vmId ID of vm
|
2019-12-03 08:18:49 -05:00
|
|
|
* @param requestBody
|
|
|
|
@return map[string]string
|
2019-02-08 05:15:45 -05:00
|
|
|
*/
|
2019-12-03 08:18:49 -05:00
|
|
|
func (a *VmApiService) VmPatchTag(ctx _context.Context, vmId string, requestBody map[string]string) (map[string]string, *_nethttp.Response, error) {
|
2019-02-08 05:15:45 -05:00
|
|
|
var (
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPMethod = _nethttp.MethodPatch
|
2019-02-08 05:15:45 -05:00
|
|
|
localVarPostBody interface{}
|
|
|
|
localVarFormFileName string
|
|
|
|
localVarFileName string
|
|
|
|
localVarFileBytes []byte
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarReturnValue map[string]string
|
2019-02-08 05:15:45 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
// create path and map variables
|
|
|
|
localVarPath := a.client.cfg.BasePath + "/vm/{vmId}/tag"
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarPath = strings.Replace(localVarPath, "{"+"vmId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", vmId)), -1)
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarQueryParams := _neturl.Values{}
|
|
|
|
localVarFormParams := _neturl.Values{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// to determine the Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentTypes := []string{"application/json"}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
|
|
if localVarHTTPContentType != "" {
|
|
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// to determine the Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccepts := []string{"application/json"}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
|
|
if localVarHTTPHeaderAccept != "" {
|
|
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
// body params
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarPostBody = &requestBody
|
2019-02-08 05:15:45 -05:00
|
|
|
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["x-project"] = key
|
|
|
|
}
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
return localVarReturnValue, nil, err
|
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
|
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
|
|
|
localVarHTTPResponse.Body.Close()
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
2019-02-08 05:15:45 -05:00
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
2019-12-03 08:18:49 -05:00
|
|
|
error: localVarHTTPResponse.Status,
|
|
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode == 200 {
|
|
|
|
var v map[string]string
|
|
|
|
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
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode == 400 {
|
|
|
|
var v InlineResponse400
|
|
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr.error = err.Error()
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
newErr.model = v
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
|
|
|
error: err.Error(),
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2019-12-03 08:18:49 -05:00
|
|
|
VmPostAccessrights /accessrights
|
|
|
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
2019-02-08 05:15:45 -05:00
|
|
|
* @param vmId ID of vm
|
|
|
|
* @param vmPostAccessrights
|
|
|
|
@return Vm
|
|
|
|
*/
|
2019-12-03 08:18:49 -05:00
|
|
|
func (a *VmApiService) VmPostAccessrights(ctx _context.Context, vmId string, vmPostAccessrights VmPostAccessrights) (Vm, *_nethttp.Response, error) {
|
2019-02-08 05:15:45 -05:00
|
|
|
var (
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPMethod = _nethttp.MethodPost
|
2019-02-08 05:15:45 -05:00
|
|
|
localVarPostBody interface{}
|
|
|
|
localVarFormFileName string
|
|
|
|
localVarFileName string
|
|
|
|
localVarFileBytes []byte
|
|
|
|
localVarReturnValue Vm
|
|
|
|
)
|
|
|
|
|
|
|
|
// create path and map variables
|
|
|
|
localVarPath := a.client.cfg.BasePath + "/vm/{vmId}/accessrights"
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarPath = strings.Replace(localVarPath, "{"+"vmId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", vmId)), -1)
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarQueryParams := _neturl.Values{}
|
|
|
|
localVarFormParams := _neturl.Values{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// to determine the Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentTypes := []string{"application/json"}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
|
|
if localVarHTTPContentType != "" {
|
|
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// to determine the Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccepts := []string{"application/json"}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
|
|
if localVarHTTPHeaderAccept != "" {
|
|
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
// body params
|
|
|
|
localVarPostBody = &vmPostAccessrights
|
|
|
|
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["x-project"] = key
|
|
|
|
}
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
return localVarReturnValue, nil, err
|
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
|
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
|
|
|
localVarHTTPResponse.Body.Close()
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
2019-02-08 05:15:45 -05:00
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
2019-12-03 08:18:49 -05:00
|
|
|
error: localVarHTTPResponse.Status,
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode == 200 {
|
2019-02-08 05:15:45 -05:00
|
|
|
var v Vm
|
2019-12-03 08:18:49 -05:00
|
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr.error = err.Error()
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
newErr.model = v
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode == 202 {
|
2019-02-08 05:15:45 -05:00
|
|
|
var v Vm
|
2019-12-03 08:18:49 -05:00
|
|
|
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 InlineResponse400
|
|
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr.error = err.Error()
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
newErr.model = v
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
|
|
|
error: err.Error(),
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2019-12-03 08:18:49 -05:00
|
|
|
VmPostHdd /hdd
|
|
|
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
2019-02-08 05:15:45 -05:00
|
|
|
* @param vmId ID of vm
|
|
|
|
* @param vmPostHdd
|
2019-12-03 08:18:49 -05:00
|
|
|
@return Hdd
|
2019-02-08 05:15:45 -05:00
|
|
|
*/
|
2019-12-03 08:18:49 -05:00
|
|
|
func (a *VmApiService) VmPostHdd(ctx _context.Context, vmId string, vmPostHdd VmPostHdd) (Hdd, *_nethttp.Response, error) {
|
2019-02-08 05:15:45 -05:00
|
|
|
var (
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPMethod = _nethttp.MethodPost
|
2019-02-08 05:15:45 -05:00
|
|
|
localVarPostBody interface{}
|
|
|
|
localVarFormFileName string
|
|
|
|
localVarFileName string
|
|
|
|
localVarFileBytes []byte
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarReturnValue Hdd
|
2019-02-08 05:15:45 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
// create path and map variables
|
|
|
|
localVarPath := a.client.cfg.BasePath + "/vm/{vmId}/hdd"
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarPath = strings.Replace(localVarPath, "{"+"vmId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", vmId)), -1)
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarQueryParams := _neturl.Values{}
|
|
|
|
localVarFormParams := _neturl.Values{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// to determine the Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentTypes := []string{"application/json"}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
|
|
if localVarHTTPContentType != "" {
|
|
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// to determine the Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccepts := []string{"application/json"}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
|
|
if localVarHTTPHeaderAccept != "" {
|
|
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
// body params
|
|
|
|
localVarPostBody = &vmPostHdd
|
|
|
|
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["x-project"] = key
|
|
|
|
}
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
return localVarReturnValue, nil, err
|
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
|
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
|
|
|
localVarHTTPResponse.Body.Close()
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
2019-02-08 05:15:45 -05:00
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
2019-12-03 08:18:49 -05:00
|
|
|
error: localVarHTTPResponse.Status,
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode == 200 {
|
|
|
|
var v Hdd
|
|
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr.error = err.Error()
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
newErr.model = v
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode == 400 {
|
|
|
|
var v InlineResponse400
|
|
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr.error = err.Error()
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
newErr.model = v
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
|
|
|
error: err.Error(),
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2019-12-03 08:18:49 -05:00
|
|
|
VmPostNetadp /netadp
|
|
|
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
2019-02-08 05:15:45 -05:00
|
|
|
* @param vmId ID of vm
|
|
|
|
* @param vmPostNetadp
|
2019-12-03 08:18:49 -05:00
|
|
|
@return Netadp
|
2019-02-08 05:15:45 -05:00
|
|
|
*/
|
2019-12-03 08:18:49 -05:00
|
|
|
func (a *VmApiService) VmPostNetadp(ctx _context.Context, vmId string, vmPostNetadp VmPostNetadp) (Netadp, *_nethttp.Response, error) {
|
2019-02-08 05:15:45 -05:00
|
|
|
var (
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPMethod = _nethttp.MethodPost
|
2019-02-08 05:15:45 -05:00
|
|
|
localVarPostBody interface{}
|
|
|
|
localVarFormFileName string
|
|
|
|
localVarFileName string
|
|
|
|
localVarFileBytes []byte
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarReturnValue Netadp
|
2019-02-08 05:15:45 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
// create path and map variables
|
|
|
|
localVarPath := a.client.cfg.BasePath + "/vm/{vmId}/netadp"
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarPath = strings.Replace(localVarPath, "{"+"vmId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", vmId)), -1)
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarQueryParams := _neturl.Values{}
|
|
|
|
localVarFormParams := _neturl.Values{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// to determine the Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentTypes := []string{"application/json"}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
|
|
if localVarHTTPContentType != "" {
|
|
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// to determine the Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccepts := []string{"application/json"}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
|
|
if localVarHTTPHeaderAccept != "" {
|
|
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
// body params
|
|
|
|
localVarPostBody = &vmPostNetadp
|
|
|
|
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["x-project"] = key
|
|
|
|
}
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
|
|
|
if err != nil {
|
|
|
|
return localVarReturnValue, nil, err
|
|
|
|
}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
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 Netadp
|
|
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
|
|
if err != nil {
|
|
|
|
newErr.error = err.Error()
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
newErr.model = v
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode == 400 {
|
|
|
|
var v InlineResponse400
|
|
|
|
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
|
|
|
|
}
|
|
|
|
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(),
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
|
|
}
|
|
|
|
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
VmPutTag /tag
|
|
|
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
|
|
* @param vmId ID of vm
|
|
|
|
* @param requestBody
|
|
|
|
@return map[string]string
|
|
|
|
*/
|
|
|
|
func (a *VmApiService) VmPutTag(ctx _context.Context, vmId string, requestBody map[string]string) (map[string]string, *_nethttp.Response, error) {
|
|
|
|
var (
|
|
|
|
localVarHTTPMethod = _nethttp.MethodPut
|
|
|
|
localVarPostBody interface{}
|
|
|
|
localVarFormFileName string
|
|
|
|
localVarFileName string
|
|
|
|
localVarFileBytes []byte
|
|
|
|
localVarReturnValue map[string]string
|
|
|
|
)
|
|
|
|
|
|
|
|
// create path and map variables
|
|
|
|
localVarPath := a.client.cfg.BasePath + "/vm/{vmId}/tag"
|
|
|
|
localVarPath = strings.Replace(localVarPath, "{"+"vmId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", vmId)), -1)
|
|
|
|
|
|
|
|
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
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
// to determine the Accept header
|
|
|
|
localVarHTTPHeaderAccepts := []string{"application/json"}
|
|
|
|
|
|
|
|
// set Accept header
|
|
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
|
|
if localVarHTTPHeaderAccept != "" {
|
|
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
|
|
}
|
|
|
|
// body params
|
|
|
|
localVarPostBody = &requestBody
|
2019-02-08 05:15:45 -05:00
|
|
|
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
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHeaderParams["x-project"] = key
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
return localVarReturnValue, nil, err
|
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
|
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
|
|
|
localVarHTTPResponse.Body.Close()
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
2019-02-08 05:15:45 -05:00
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
2019-12-03 08:18:49 -05:00
|
|
|
error: localVarHTTPResponse.Status,
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode == 200 {
|
|
|
|
var v map[string]string
|
|
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr.error = err.Error()
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
newErr.model = v
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode == 400 {
|
|
|
|
var v InlineResponse400
|
|
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr.error = err.Error()
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
newErr.model = v
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
|
|
|
error: err.Error(),
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2019-12-03 08:18:49 -05:00
|
|
|
VmShow Get
|
2019-02-08 05:15:45 -05:00
|
|
|
Returns a single vm
|
2019-12-03 08:18:49 -05:00
|
|
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
2019-02-08 05:15:45 -05:00
|
|
|
* @param vmId ID of vm
|
|
|
|
@return Vm
|
|
|
|
*/
|
2019-12-03 08:18:49 -05:00
|
|
|
func (a *VmApiService) VmShow(ctx _context.Context, vmId string) (Vm, *_nethttp.Response, error) {
|
2019-02-08 05:15:45 -05:00
|
|
|
var (
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPMethod = _nethttp.MethodGet
|
2019-02-08 05:15:45 -05:00
|
|
|
localVarPostBody interface{}
|
|
|
|
localVarFormFileName string
|
|
|
|
localVarFileName string
|
|
|
|
localVarFileBytes []byte
|
|
|
|
localVarReturnValue Vm
|
|
|
|
)
|
|
|
|
|
|
|
|
// create path and map variables
|
|
|
|
localVarPath := a.client.cfg.BasePath + "/vm/{vmId}"
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarPath = strings.Replace(localVarPath, "{"+"vmId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", vmId)), -1)
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarQueryParams := _neturl.Values{}
|
|
|
|
localVarFormParams := _neturl.Values{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// to determine the Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentTypes := []string{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
|
|
if localVarHTTPContentType != "" {
|
|
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// to determine the Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccepts := []string{"application/json"}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
|
|
if localVarHTTPHeaderAccept != "" {
|
|
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
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["x-project"] = key
|
|
|
|
}
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
return localVarReturnValue, nil, err
|
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
|
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
|
|
|
localVarHTTPResponse.Body.Close()
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
2019-02-08 05:15:45 -05:00
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
2019-12-03 08:18:49 -05:00
|
|
|
error: localVarHTTPResponse.Status,
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode == 200 {
|
2019-02-08 05:15:45 -05:00
|
|
|
var v Vm
|
2019-12-03 08:18:49 -05:00
|
|
|
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 InlineResponse400
|
|
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr.error = err.Error()
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
newErr.model = v
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
|
|
|
error: err.Error(),
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2019-12-03 08:18:49 -05:00
|
|
|
VmUpdate Update
|
2019-02-08 05:15:45 -05:00
|
|
|
Returns modified vm
|
2019-12-03 08:18:49 -05:00
|
|
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
2019-02-08 05:15:45 -05:00
|
|
|
* @param vmId ID of vm
|
|
|
|
* @param vmUpdate
|
|
|
|
@return Vm
|
|
|
|
*/
|
2019-12-03 08:18:49 -05:00
|
|
|
func (a *VmApiService) VmUpdate(ctx _context.Context, vmId string, vmUpdate VmUpdate) (Vm, *_nethttp.Response, error) {
|
2019-02-08 05:15:45 -05:00
|
|
|
var (
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPMethod = _nethttp.MethodPatch
|
2019-02-08 05:15:45 -05:00
|
|
|
localVarPostBody interface{}
|
|
|
|
localVarFormFileName string
|
|
|
|
localVarFileName string
|
|
|
|
localVarFileBytes []byte
|
|
|
|
localVarReturnValue Vm
|
|
|
|
)
|
|
|
|
|
|
|
|
// create path and map variables
|
|
|
|
localVarPath := a.client.cfg.BasePath + "/vm/{vmId}"
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarPath = strings.Replace(localVarPath, "{"+"vmId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", vmId)), -1)
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarQueryParams := _neturl.Values{}
|
|
|
|
localVarFormParams := _neturl.Values{}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// to determine the Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentTypes := []string{"application/json"}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Content-Type header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
|
|
if localVarHTTPContentType != "" {
|
|
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// to determine the Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccepts := []string{"application/json"}
|
2019-02-08 05:15:45 -05:00
|
|
|
|
|
|
|
// set Accept header
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
|
|
if localVarHTTPHeaderAccept != "" {
|
|
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
// body params
|
|
|
|
localVarPostBody = &vmUpdate
|
|
|
|
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["x-project"] = key
|
|
|
|
}
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
return localVarReturnValue, nil, err
|
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
|
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
|
|
|
localVarHTTPResponse.Body.Close()
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
2019-02-08 05:15:45 -05:00
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
2019-12-03 08:18:49 -05:00
|
|
|
error: localVarHTTPResponse.Status,
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
if localVarHTTPResponse.StatusCode == 200 {
|
2019-02-08 05:15:45 -05:00
|
|
|
var v Vm
|
2019-12-03 08:18:49 -05:00
|
|
|
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 InlineResponse400
|
|
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr.error = err.Error()
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
newErr.model = v
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
2019-02-08 05:15:45 -05:00
|
|
|
if err != nil {
|
|
|
|
newErr := GenericOpenAPIError{
|
|
|
|
body: localVarBody,
|
|
|
|
error: err.Error(),
|
|
|
|
}
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 08:18:49 -05:00
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
2019-02-08 05:15:45 -05:00
|
|
|
}
|