2020-10-13 11:17:37 -04:00
/ *
* 3 DS OUTSCALE API
*
* Welcome to the 3 DS OUTSCALE ' s API documentation . < br / > < br / > The 3 DS OUTSCALE API enables you to manage your resources in the 3 DS OUTSCALE Cloud . This documentation describes the different actions available along with code examples . < br / > < br / > Note that the 3 DS OUTSCALE Cloud is compatible with Amazon Web Services ( AWS ) APIs , but some resources have different names in AWS than in the 3 DS OUTSCALE API . You can find a list of the differences [ here ] ( https : //wiki.outscale.net/display/EN/3DS+OUTSCALE+APIs+Reference).<br /><br /> You can also manage your resources using the [Cockpit](https://wiki.outscale.net/display/EN/About+Cockpit) web interface.
*
2021-04-20 11:18:45 -04:00
* API version : 1.8
2020-10-13 11:17:37 -04:00
* Contact : support @ outscale . com
* Generated by : OpenAPI Generator ( https : //openapi-generator.tech)
* /
package osc
import (
_context "context"
2021-04-20 11:18:45 -04:00
"github.com/antihax/optional"
2020-10-13 11:17:37 -04:00
_ioutil "io/ioutil"
_nethttp "net/http"
_neturl "net/url"
)
// Linger please
var (
_ _context . Context
)
// FlexibleGpuApiService FlexibleGpuApi service
type FlexibleGpuApiService service
// CreateFlexibleGpuOpts Optional parameters for the method 'CreateFlexibleGpu'
type CreateFlexibleGpuOpts struct {
2021-04-20 11:18:45 -04:00
CreateFlexibleGpuRequest optional . Interface
2020-10-13 11:17:37 -04:00
}
/ *
CreateFlexibleGpu Method for CreateFlexibleGpu
* @ param ctx _context . Context - for authentication , logging , cancellation , deadlines , tracing , etc . Passed from http . Request or context . Background ( ) .
* @ param optional nil or * CreateFlexibleGpuOpts - Optional Parameters :
2021-04-20 11:18:45 -04:00
* @ param "CreateFlexibleGpuRequest" ( optional . Interface of CreateFlexibleGpuRequest ) -
2020-10-13 11:17:37 -04:00
@ return CreateFlexibleGpuResponse
* /
func ( a * FlexibleGpuApiService ) CreateFlexibleGpu ( ctx _context . Context , localVarOptionals * CreateFlexibleGpuOpts ) ( CreateFlexibleGpuResponse , * _nethttp . Response , error ) {
var (
localVarHTTPMethod = _nethttp . MethodPost
localVarPostBody interface { }
localVarFormFileName string
localVarFileName string
localVarFileBytes [ ] byte
localVarReturnValue CreateFlexibleGpuResponse
)
// create path and map variables
localVarPath := a . client . cfg . BasePath + "/CreateFlexibleGpu"
localVarHeaderParams := make ( map [ string ] string )
localVarQueryParams := _neturl . Values { }
localVarFormParams := _neturl . Values { }
// to determine the Content-Type header
localVarHTTPContentTypes := [ ] string { "application/json" }
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType ( localVarHTTPContentTypes )
if localVarHTTPContentType != "" {
localVarHeaderParams [ "Content-Type" ] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := [ ] string { "application/json" }
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept ( localVarHTTPHeaderAccepts )
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams [ "Accept" ] = localVarHTTPHeaderAccept
}
// body params
if localVarOptionals != nil && localVarOptionals . CreateFlexibleGpuRequest . IsSet ( ) {
localVarOptionalCreateFlexibleGpuRequest , localVarOptionalCreateFlexibleGpuRequestok := localVarOptionals . CreateFlexibleGpuRequest . Value ( ) . ( CreateFlexibleGpuRequest )
if ! localVarOptionalCreateFlexibleGpuRequestok {
return localVarReturnValue , nil , reportError ( "createFlexibleGpuRequest should be CreateFlexibleGpuRequest" )
}
localVarPostBody = & localVarOptionalCreateFlexibleGpuRequest
}
if ctx != nil {
// API Key Authentication
if auth , ok := ctx . Value ( ContextAPIKey ) . ( APIKey ) ; ok {
var key string
if auth . Prefix != "" {
key = auth . Prefix + " " + auth . Key
} else {
key = auth . Key
}
localVarHeaderParams [ "Authorization" ] = key
}
}
r , err := a . client . prepareRequest ( ctx , localVarPath , localVarHTTPMethod , localVarPostBody , localVarHeaderParams , localVarQueryParams , localVarFormParams , localVarFormFileName , localVarFileName , localVarFileBytes )
if err != nil {
return localVarReturnValue , nil , err
}
localVarHTTPResponse , err := a . client . callAPI ( r )
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue , localVarHTTPResponse , err
}
localVarBody , err := _ioutil . ReadAll ( localVarHTTPResponse . Body )
localVarHTTPResponse . Body . Close ( )
if err != nil {
return localVarReturnValue , localVarHTTPResponse , err
}
if localVarHTTPResponse . StatusCode >= 300 {
newErr := GenericOpenAPIError {
body : localVarBody ,
error : localVarHTTPResponse . Status ,
}
if localVarHTTPResponse . StatusCode == 200 {
var v CreateFlexibleGpuResponse
err = a . client . decode ( & v , localVarBody , localVarHTTPResponse . Header . Get ( "Content-Type" ) )
if err != nil {
newErr . error = err . Error ( )
return localVarReturnValue , localVarHTTPResponse , newErr
}
newErr . model = v
}
return localVarReturnValue , localVarHTTPResponse , newErr
}
err = a . client . decode ( & localVarReturnValue , localVarBody , localVarHTTPResponse . Header . Get ( "Content-Type" ) )
if err != nil {
newErr := GenericOpenAPIError {
body : localVarBody ,
error : err . Error ( ) ,
}
return localVarReturnValue , localVarHTTPResponse , newErr
}
return localVarReturnValue , localVarHTTPResponse , nil
}
// DeleteFlexibleGpuOpts Optional parameters for the method 'DeleteFlexibleGpu'
type DeleteFlexibleGpuOpts struct {
2021-04-20 11:18:45 -04:00
DeleteFlexibleGpuRequest optional . Interface
2020-10-13 11:17:37 -04:00
}
/ *
DeleteFlexibleGpu Method for DeleteFlexibleGpu
* @ param ctx _context . Context - for authentication , logging , cancellation , deadlines , tracing , etc . Passed from http . Request or context . Background ( ) .
* @ param optional nil or * DeleteFlexibleGpuOpts - Optional Parameters :
2021-04-20 11:18:45 -04:00
* @ param "DeleteFlexibleGpuRequest" ( optional . Interface of DeleteFlexibleGpuRequest ) -
2020-10-13 11:17:37 -04:00
@ return DeleteFlexibleGpuResponse
* /
func ( a * FlexibleGpuApiService ) DeleteFlexibleGpu ( ctx _context . Context , localVarOptionals * DeleteFlexibleGpuOpts ) ( DeleteFlexibleGpuResponse , * _nethttp . Response , error ) {
var (
localVarHTTPMethod = _nethttp . MethodPost
localVarPostBody interface { }
localVarFormFileName string
localVarFileName string
localVarFileBytes [ ] byte
localVarReturnValue DeleteFlexibleGpuResponse
)
// create path and map variables
localVarPath := a . client . cfg . BasePath + "/DeleteFlexibleGpu"
localVarHeaderParams := make ( map [ string ] string )
localVarQueryParams := _neturl . Values { }
localVarFormParams := _neturl . Values { }
// to determine the Content-Type header
localVarHTTPContentTypes := [ ] string { "application/json" }
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType ( localVarHTTPContentTypes )
if localVarHTTPContentType != "" {
localVarHeaderParams [ "Content-Type" ] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := [ ] string { "application/json" }
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept ( localVarHTTPHeaderAccepts )
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams [ "Accept" ] = localVarHTTPHeaderAccept
}
// body params
if localVarOptionals != nil && localVarOptionals . DeleteFlexibleGpuRequest . IsSet ( ) {
localVarOptionalDeleteFlexibleGpuRequest , localVarOptionalDeleteFlexibleGpuRequestok := localVarOptionals . DeleteFlexibleGpuRequest . Value ( ) . ( DeleteFlexibleGpuRequest )
if ! localVarOptionalDeleteFlexibleGpuRequestok {
return localVarReturnValue , nil , reportError ( "deleteFlexibleGpuRequest should be DeleteFlexibleGpuRequest" )
}
localVarPostBody = & localVarOptionalDeleteFlexibleGpuRequest
}
if ctx != nil {
// API Key Authentication
if auth , ok := ctx . Value ( ContextAPIKey ) . ( APIKey ) ; ok {
var key string
if auth . Prefix != "" {
key = auth . Prefix + " " + auth . Key
} else {
key = auth . Key
}
localVarHeaderParams [ "Authorization" ] = key
}
}
r , err := a . client . prepareRequest ( ctx , localVarPath , localVarHTTPMethod , localVarPostBody , localVarHeaderParams , localVarQueryParams , localVarFormParams , localVarFormFileName , localVarFileName , localVarFileBytes )
if err != nil {
return localVarReturnValue , nil , err
}
localVarHTTPResponse , err := a . client . callAPI ( r )
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue , localVarHTTPResponse , err
}
localVarBody , err := _ioutil . ReadAll ( localVarHTTPResponse . Body )
localVarHTTPResponse . Body . Close ( )
if err != nil {
return localVarReturnValue , localVarHTTPResponse , err
}
if localVarHTTPResponse . StatusCode >= 300 {
newErr := GenericOpenAPIError {
body : localVarBody ,
error : localVarHTTPResponse . Status ,
}
if localVarHTTPResponse . StatusCode == 200 {
var v DeleteFlexibleGpuResponse
err = a . client . decode ( & v , localVarBody , localVarHTTPResponse . Header . Get ( "Content-Type" ) )
if err != nil {
newErr . error = err . Error ( )
return localVarReturnValue , localVarHTTPResponse , newErr
}
newErr . model = v
}
return localVarReturnValue , localVarHTTPResponse , newErr
}
err = a . client . decode ( & localVarReturnValue , localVarBody , localVarHTTPResponse . Header . Get ( "Content-Type" ) )
if err != nil {
newErr := GenericOpenAPIError {
body : localVarBody ,
error : err . Error ( ) ,
}
return localVarReturnValue , localVarHTTPResponse , newErr
}
return localVarReturnValue , localVarHTTPResponse , nil
}
// LinkFlexibleGpuOpts Optional parameters for the method 'LinkFlexibleGpu'
type LinkFlexibleGpuOpts struct {
2021-04-20 11:18:45 -04:00
LinkFlexibleGpuRequest optional . Interface
2020-10-13 11:17:37 -04:00
}
/ *
LinkFlexibleGpu Method for LinkFlexibleGpu
* @ param ctx _context . Context - for authentication , logging , cancellation , deadlines , tracing , etc . Passed from http . Request or context . Background ( ) .
* @ param optional nil or * LinkFlexibleGpuOpts - Optional Parameters :
2021-04-20 11:18:45 -04:00
* @ param "LinkFlexibleGpuRequest" ( optional . Interface of LinkFlexibleGpuRequest ) -
2020-10-13 11:17:37 -04:00
@ return LinkFlexibleGpuResponse
* /
func ( a * FlexibleGpuApiService ) LinkFlexibleGpu ( ctx _context . Context , localVarOptionals * LinkFlexibleGpuOpts ) ( LinkFlexibleGpuResponse , * _nethttp . Response , error ) {
var (
localVarHTTPMethod = _nethttp . MethodPost
localVarPostBody interface { }
localVarFormFileName string
localVarFileName string
localVarFileBytes [ ] byte
localVarReturnValue LinkFlexibleGpuResponse
)
// create path and map variables
localVarPath := a . client . cfg . BasePath + "/LinkFlexibleGpu"
localVarHeaderParams := make ( map [ string ] string )
localVarQueryParams := _neturl . Values { }
localVarFormParams := _neturl . Values { }
// to determine the Content-Type header
localVarHTTPContentTypes := [ ] string { "application/json" }
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType ( localVarHTTPContentTypes )
if localVarHTTPContentType != "" {
localVarHeaderParams [ "Content-Type" ] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := [ ] string { "application/json" }
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept ( localVarHTTPHeaderAccepts )
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams [ "Accept" ] = localVarHTTPHeaderAccept
}
// body params
if localVarOptionals != nil && localVarOptionals . LinkFlexibleGpuRequest . IsSet ( ) {
localVarOptionalLinkFlexibleGpuRequest , localVarOptionalLinkFlexibleGpuRequestok := localVarOptionals . LinkFlexibleGpuRequest . Value ( ) . ( LinkFlexibleGpuRequest )
if ! localVarOptionalLinkFlexibleGpuRequestok {
return localVarReturnValue , nil , reportError ( "linkFlexibleGpuRequest should be LinkFlexibleGpuRequest" )
}
localVarPostBody = & localVarOptionalLinkFlexibleGpuRequest
}
if ctx != nil {
// API Key Authentication
if auth , ok := ctx . Value ( ContextAPIKey ) . ( APIKey ) ; ok {
var key string
if auth . Prefix != "" {
key = auth . Prefix + " " + auth . Key
} else {
key = auth . Key
}
localVarHeaderParams [ "Authorization" ] = key
}
}
r , err := a . client . prepareRequest ( ctx , localVarPath , localVarHTTPMethod , localVarPostBody , localVarHeaderParams , localVarQueryParams , localVarFormParams , localVarFormFileName , localVarFileName , localVarFileBytes )
if err != nil {
return localVarReturnValue , nil , err
}
localVarHTTPResponse , err := a . client . callAPI ( r )
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue , localVarHTTPResponse , err
}
localVarBody , err := _ioutil . ReadAll ( localVarHTTPResponse . Body )
localVarHTTPResponse . Body . Close ( )
if err != nil {
return localVarReturnValue , localVarHTTPResponse , err
}
if localVarHTTPResponse . StatusCode >= 300 {
newErr := GenericOpenAPIError {
body : localVarBody ,
error : localVarHTTPResponse . Status ,
}
if localVarHTTPResponse . StatusCode == 200 {
var v LinkFlexibleGpuResponse
err = a . client . decode ( & v , localVarBody , localVarHTTPResponse . Header . Get ( "Content-Type" ) )
if err != nil {
newErr . error = err . Error ( )
return localVarReturnValue , localVarHTTPResponse , newErr
}
newErr . model = v
}
return localVarReturnValue , localVarHTTPResponse , newErr
}
err = a . client . decode ( & localVarReturnValue , localVarBody , localVarHTTPResponse . Header . Get ( "Content-Type" ) )
if err != nil {
newErr := GenericOpenAPIError {
body : localVarBody ,
error : err . Error ( ) ,
}
return localVarReturnValue , localVarHTTPResponse , newErr
}
return localVarReturnValue , localVarHTTPResponse , nil
}
// ReadFlexibleGpuCatalogOpts Optional parameters for the method 'ReadFlexibleGpuCatalog'
type ReadFlexibleGpuCatalogOpts struct {
2021-04-20 11:18:45 -04:00
ReadFlexibleGpuCatalogRequest optional . Interface
2020-10-13 11:17:37 -04:00
}
/ *
ReadFlexibleGpuCatalog Method for ReadFlexibleGpuCatalog
* @ param ctx _context . Context - for authentication , logging , cancellation , deadlines , tracing , etc . Passed from http . Request or context . Background ( ) .
* @ param optional nil or * ReadFlexibleGpuCatalogOpts - Optional Parameters :
2021-04-20 11:18:45 -04:00
* @ param "ReadFlexibleGpuCatalogRequest" ( optional . Interface of ReadFlexibleGpuCatalogRequest ) -
2020-10-13 11:17:37 -04:00
@ return ReadFlexibleGpuCatalogResponse
* /
func ( a * FlexibleGpuApiService ) ReadFlexibleGpuCatalog ( ctx _context . Context , localVarOptionals * ReadFlexibleGpuCatalogOpts ) ( ReadFlexibleGpuCatalogResponse , * _nethttp . Response , error ) {
var (
localVarHTTPMethod = _nethttp . MethodPost
localVarPostBody interface { }
localVarFormFileName string
localVarFileName string
localVarFileBytes [ ] byte
localVarReturnValue ReadFlexibleGpuCatalogResponse
)
// create path and map variables
localVarPath := a . client . cfg . BasePath + "/ReadFlexibleGpuCatalog"
localVarHeaderParams := make ( map [ string ] string )
localVarQueryParams := _neturl . Values { }
localVarFormParams := _neturl . Values { }
// to determine the Content-Type header
localVarHTTPContentTypes := [ ] string { "application/json" }
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType ( localVarHTTPContentTypes )
if localVarHTTPContentType != "" {
localVarHeaderParams [ "Content-Type" ] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := [ ] string { "application/json" }
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept ( localVarHTTPHeaderAccepts )
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams [ "Accept" ] = localVarHTTPHeaderAccept
}
// body params
if localVarOptionals != nil && localVarOptionals . ReadFlexibleGpuCatalogRequest . IsSet ( ) {
localVarOptionalReadFlexibleGpuCatalogRequest , localVarOptionalReadFlexibleGpuCatalogRequestok := localVarOptionals . ReadFlexibleGpuCatalogRequest . Value ( ) . ( ReadFlexibleGpuCatalogRequest )
if ! localVarOptionalReadFlexibleGpuCatalogRequestok {
return localVarReturnValue , nil , reportError ( "readFlexibleGpuCatalogRequest should be ReadFlexibleGpuCatalogRequest" )
}
localVarPostBody = & localVarOptionalReadFlexibleGpuCatalogRequest
}
r , err := a . client . prepareRequest ( ctx , localVarPath , localVarHTTPMethod , localVarPostBody , localVarHeaderParams , localVarQueryParams , localVarFormParams , localVarFormFileName , localVarFileName , localVarFileBytes )
if err != nil {
return localVarReturnValue , nil , err
}
localVarHTTPResponse , err := a . client . callAPI ( r )
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue , localVarHTTPResponse , err
}
localVarBody , err := _ioutil . ReadAll ( localVarHTTPResponse . Body )
localVarHTTPResponse . Body . Close ( )
if err != nil {
return localVarReturnValue , localVarHTTPResponse , err
}
if localVarHTTPResponse . StatusCode >= 300 {
newErr := GenericOpenAPIError {
body : localVarBody ,
error : localVarHTTPResponse . Status ,
}
if localVarHTTPResponse . StatusCode == 200 {
var v ReadFlexibleGpuCatalogResponse
err = a . client . decode ( & v , localVarBody , localVarHTTPResponse . Header . Get ( "Content-Type" ) )
if err != nil {
newErr . error = err . Error ( )
return localVarReturnValue , localVarHTTPResponse , newErr
}
newErr . model = v
}
return localVarReturnValue , localVarHTTPResponse , newErr
}
err = a . client . decode ( & localVarReturnValue , localVarBody , localVarHTTPResponse . Header . Get ( "Content-Type" ) )
if err != nil {
newErr := GenericOpenAPIError {
body : localVarBody ,
error : err . Error ( ) ,
}
return localVarReturnValue , localVarHTTPResponse , newErr
}
return localVarReturnValue , localVarHTTPResponse , nil
}
// ReadFlexibleGpusOpts Optional parameters for the method 'ReadFlexibleGpus'
type ReadFlexibleGpusOpts struct {
2021-04-20 11:18:45 -04:00
ReadFlexibleGpusRequest optional . Interface
2020-10-13 11:17:37 -04:00
}
/ *
ReadFlexibleGpus Method for ReadFlexibleGpus
* @ param ctx _context . Context - for authentication , logging , cancellation , deadlines , tracing , etc . Passed from http . Request or context . Background ( ) .
* @ param optional nil or * ReadFlexibleGpusOpts - Optional Parameters :
2021-04-20 11:18:45 -04:00
* @ param "ReadFlexibleGpusRequest" ( optional . Interface of ReadFlexibleGpusRequest ) -
2020-10-13 11:17:37 -04:00
@ return ReadFlexibleGpusResponse
* /
func ( a * FlexibleGpuApiService ) ReadFlexibleGpus ( ctx _context . Context , localVarOptionals * ReadFlexibleGpusOpts ) ( ReadFlexibleGpusResponse , * _nethttp . Response , error ) {
var (
localVarHTTPMethod = _nethttp . MethodPost
localVarPostBody interface { }
localVarFormFileName string
localVarFileName string
localVarFileBytes [ ] byte
localVarReturnValue ReadFlexibleGpusResponse
)
// create path and map variables
localVarPath := a . client . cfg . BasePath + "/ReadFlexibleGpus"
localVarHeaderParams := make ( map [ string ] string )
localVarQueryParams := _neturl . Values { }
localVarFormParams := _neturl . Values { }
// to determine the Content-Type header
localVarHTTPContentTypes := [ ] string { "application/json" }
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType ( localVarHTTPContentTypes )
if localVarHTTPContentType != "" {
localVarHeaderParams [ "Content-Type" ] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := [ ] string { "application/json" }
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept ( localVarHTTPHeaderAccepts )
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams [ "Accept" ] = localVarHTTPHeaderAccept
}
// body params
if localVarOptionals != nil && localVarOptionals . ReadFlexibleGpusRequest . IsSet ( ) {
localVarOptionalReadFlexibleGpusRequest , localVarOptionalReadFlexibleGpusRequestok := localVarOptionals . ReadFlexibleGpusRequest . Value ( ) . ( ReadFlexibleGpusRequest )
if ! localVarOptionalReadFlexibleGpusRequestok {
return localVarReturnValue , nil , reportError ( "readFlexibleGpusRequest should be ReadFlexibleGpusRequest" )
}
localVarPostBody = & localVarOptionalReadFlexibleGpusRequest
}
if ctx != nil {
// API Key Authentication
if auth , ok := ctx . Value ( ContextAPIKey ) . ( APIKey ) ; ok {
var key string
if auth . Prefix != "" {
key = auth . Prefix + " " + auth . Key
} else {
key = auth . Key
}
localVarHeaderParams [ "Authorization" ] = key
}
}
r , err := a . client . prepareRequest ( ctx , localVarPath , localVarHTTPMethod , localVarPostBody , localVarHeaderParams , localVarQueryParams , localVarFormParams , localVarFormFileName , localVarFileName , localVarFileBytes )
if err != nil {
return localVarReturnValue , nil , err
}
localVarHTTPResponse , err := a . client . callAPI ( r )
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue , localVarHTTPResponse , err
}
localVarBody , err := _ioutil . ReadAll ( localVarHTTPResponse . Body )
localVarHTTPResponse . Body . Close ( )
if err != nil {
return localVarReturnValue , localVarHTTPResponse , err
}
if localVarHTTPResponse . StatusCode >= 300 {
newErr := GenericOpenAPIError {
body : localVarBody ,
error : localVarHTTPResponse . Status ,
}
if localVarHTTPResponse . StatusCode == 200 {
var v ReadFlexibleGpusResponse
err = a . client . decode ( & v , localVarBody , localVarHTTPResponse . Header . Get ( "Content-Type" ) )
if err != nil {
newErr . error = err . Error ( )
return localVarReturnValue , localVarHTTPResponse , newErr
}
newErr . model = v
}
return localVarReturnValue , localVarHTTPResponse , newErr
}
err = a . client . decode ( & localVarReturnValue , localVarBody , localVarHTTPResponse . Header . Get ( "Content-Type" ) )
if err != nil {
newErr := GenericOpenAPIError {
body : localVarBody ,
error : err . Error ( ) ,
}
return localVarReturnValue , localVarHTTPResponse , newErr
}
return localVarReturnValue , localVarHTTPResponse , nil
}
// UnlinkFlexibleGpuOpts Optional parameters for the method 'UnlinkFlexibleGpu'
type UnlinkFlexibleGpuOpts struct {
2021-04-20 11:18:45 -04:00
UnlinkFlexibleGpuRequest optional . Interface
2020-10-13 11:17:37 -04:00
}
/ *
UnlinkFlexibleGpu Method for UnlinkFlexibleGpu
* @ param ctx _context . Context - for authentication , logging , cancellation , deadlines , tracing , etc . Passed from http . Request or context . Background ( ) .
* @ param optional nil or * UnlinkFlexibleGpuOpts - Optional Parameters :
2021-04-20 11:18:45 -04:00
* @ param "UnlinkFlexibleGpuRequest" ( optional . Interface of UnlinkFlexibleGpuRequest ) -
2020-10-13 11:17:37 -04:00
@ return UnlinkFlexibleGpuResponse
* /
func ( a * FlexibleGpuApiService ) UnlinkFlexibleGpu ( ctx _context . Context , localVarOptionals * UnlinkFlexibleGpuOpts ) ( UnlinkFlexibleGpuResponse , * _nethttp . Response , error ) {
var (
localVarHTTPMethod = _nethttp . MethodPost
localVarPostBody interface { }
localVarFormFileName string
localVarFileName string
localVarFileBytes [ ] byte
localVarReturnValue UnlinkFlexibleGpuResponse
)
// create path and map variables
localVarPath := a . client . cfg . BasePath + "/UnlinkFlexibleGpu"
localVarHeaderParams := make ( map [ string ] string )
localVarQueryParams := _neturl . Values { }
localVarFormParams := _neturl . Values { }
// to determine the Content-Type header
localVarHTTPContentTypes := [ ] string { "application/json" }
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType ( localVarHTTPContentTypes )
if localVarHTTPContentType != "" {
localVarHeaderParams [ "Content-Type" ] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := [ ] string { "application/json" }
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept ( localVarHTTPHeaderAccepts )
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams [ "Accept" ] = localVarHTTPHeaderAccept
}
// body params
if localVarOptionals != nil && localVarOptionals . UnlinkFlexibleGpuRequest . IsSet ( ) {
localVarOptionalUnlinkFlexibleGpuRequest , localVarOptionalUnlinkFlexibleGpuRequestok := localVarOptionals . UnlinkFlexibleGpuRequest . Value ( ) . ( UnlinkFlexibleGpuRequest )
if ! localVarOptionalUnlinkFlexibleGpuRequestok {
return localVarReturnValue , nil , reportError ( "unlinkFlexibleGpuRequest should be UnlinkFlexibleGpuRequest" )
}
localVarPostBody = & localVarOptionalUnlinkFlexibleGpuRequest
}
if ctx != nil {
// API Key Authentication
if auth , ok := ctx . Value ( ContextAPIKey ) . ( APIKey ) ; ok {
var key string
if auth . Prefix != "" {
key = auth . Prefix + " " + auth . Key
} else {
key = auth . Key
}
localVarHeaderParams [ "Authorization" ] = key
}
}
r , err := a . client . prepareRequest ( ctx , localVarPath , localVarHTTPMethod , localVarPostBody , localVarHeaderParams , localVarQueryParams , localVarFormParams , localVarFormFileName , localVarFileName , localVarFileBytes )
if err != nil {
return localVarReturnValue , nil , err
}
localVarHTTPResponse , err := a . client . callAPI ( r )
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue , localVarHTTPResponse , err
}
localVarBody , err := _ioutil . ReadAll ( localVarHTTPResponse . Body )
localVarHTTPResponse . Body . Close ( )
if err != nil {
return localVarReturnValue , localVarHTTPResponse , err
}
if localVarHTTPResponse . StatusCode >= 300 {
newErr := GenericOpenAPIError {
body : localVarBody ,
error : localVarHTTPResponse . Status ,
}
if localVarHTTPResponse . StatusCode == 200 {
var v UnlinkFlexibleGpuResponse
err = a . client . decode ( & v , localVarBody , localVarHTTPResponse . Header . Get ( "Content-Type" ) )
if err != nil {
newErr . error = err . Error ( )
return localVarReturnValue , localVarHTTPResponse , newErr
}
newErr . model = v
}
return localVarReturnValue , localVarHTTPResponse , newErr
}
err = a . client . decode ( & localVarReturnValue , localVarBody , localVarHTTPResponse . Header . Get ( "Content-Type" ) )
if err != nil {
newErr := GenericOpenAPIError {
body : localVarBody ,
error : err . Error ( ) ,
}
return localVarReturnValue , localVarHTTPResponse , newErr
}
return localVarReturnValue , localVarHTTPResponse , nil
}
// UpdateFlexibleGpuOpts Optional parameters for the method 'UpdateFlexibleGpu'
type UpdateFlexibleGpuOpts struct {
2021-04-20 11:18:45 -04:00
UpdateFlexibleGpuRequest optional . Interface
2020-10-13 11:17:37 -04:00
}
/ *
UpdateFlexibleGpu Method for UpdateFlexibleGpu
* @ param ctx _context . Context - for authentication , logging , cancellation , deadlines , tracing , etc . Passed from http . Request or context . Background ( ) .
* @ param optional nil or * UpdateFlexibleGpuOpts - Optional Parameters :
2021-04-20 11:18:45 -04:00
* @ param "UpdateFlexibleGpuRequest" ( optional . Interface of UpdateFlexibleGpuRequest ) -
2020-10-13 11:17:37 -04:00
@ return UpdateFlexibleGpuResponse
* /
func ( a * FlexibleGpuApiService ) UpdateFlexibleGpu ( ctx _context . Context , localVarOptionals * UpdateFlexibleGpuOpts ) ( UpdateFlexibleGpuResponse , * _nethttp . Response , error ) {
var (
localVarHTTPMethod = _nethttp . MethodPost
localVarPostBody interface { }
localVarFormFileName string
localVarFileName string
localVarFileBytes [ ] byte
localVarReturnValue UpdateFlexibleGpuResponse
)
// create path and map variables
localVarPath := a . client . cfg . BasePath + "/UpdateFlexibleGpu"
localVarHeaderParams := make ( map [ string ] string )
localVarQueryParams := _neturl . Values { }
localVarFormParams := _neturl . Values { }
// to determine the Content-Type header
localVarHTTPContentTypes := [ ] string { "application/json" }
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType ( localVarHTTPContentTypes )
if localVarHTTPContentType != "" {
localVarHeaderParams [ "Content-Type" ] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := [ ] string { "application/json" }
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept ( localVarHTTPHeaderAccepts )
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams [ "Accept" ] = localVarHTTPHeaderAccept
}
// body params
if localVarOptionals != nil && localVarOptionals . UpdateFlexibleGpuRequest . IsSet ( ) {
localVarOptionalUpdateFlexibleGpuRequest , localVarOptionalUpdateFlexibleGpuRequestok := localVarOptionals . UpdateFlexibleGpuRequest . Value ( ) . ( UpdateFlexibleGpuRequest )
if ! localVarOptionalUpdateFlexibleGpuRequestok {
return localVarReturnValue , nil , reportError ( "updateFlexibleGpuRequest should be UpdateFlexibleGpuRequest" )
}
localVarPostBody = & localVarOptionalUpdateFlexibleGpuRequest
}
if ctx != nil {
// API Key Authentication
if auth , ok := ctx . Value ( ContextAPIKey ) . ( APIKey ) ; ok {
var key string
if auth . Prefix != "" {
key = auth . Prefix + " " + auth . Key
} else {
key = auth . Key
}
localVarHeaderParams [ "Authorization" ] = key
}
}
r , err := a . client . prepareRequest ( ctx , localVarPath , localVarHTTPMethod , localVarPostBody , localVarHeaderParams , localVarQueryParams , localVarFormParams , localVarFormFileName , localVarFileName , localVarFileBytes )
if err != nil {
return localVarReturnValue , nil , err
}
localVarHTTPResponse , err := a . client . callAPI ( r )
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue , localVarHTTPResponse , err
}
localVarBody , err := _ioutil . ReadAll ( localVarHTTPResponse . Body )
localVarHTTPResponse . Body . Close ( )
if err != nil {
return localVarReturnValue , localVarHTTPResponse , err
}
if localVarHTTPResponse . StatusCode >= 300 {
newErr := GenericOpenAPIError {
body : localVarBody ,
error : localVarHTTPResponse . Status ,
}
if localVarHTTPResponse . StatusCode == 200 {
var v UpdateFlexibleGpuResponse
err = a . client . decode ( & v , localVarBody , localVarHTTPResponse . Header . Get ( "Content-Type" ) )
if err != nil {
newErr . error = err . Error ( )
return localVarReturnValue , localVarHTTPResponse , newErr
}
newErr . model = v
}
return localVarReturnValue , localVarHTTPResponse , newErr
}
err = a . client . decode ( & localVarReturnValue , localVarBody , localVarHTTPResponse . Header . Get ( "Content-Type" ) )
if err != nil {
newErr := GenericOpenAPIError {
body : localVarBody ,
error : err . Error ( ) ,
}
return localVarReturnValue , localVarHTTPResponse , newErr
}
return localVarReturnValue , localVarHTTPResponse , nil
}