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
)
// RouteTableApiService RouteTableApi service
type RouteTableApiService service
// CreateRouteTableOpts Optional parameters for the method 'CreateRouteTable'
type CreateRouteTableOpts struct {
2021-04-20 11:18:45 -04:00
CreateRouteTableRequest optional . Interface
2020-10-13 11:17:37 -04:00
}
/ *
CreateRouteTable Method for CreateRouteTable
* @ param ctx _context . Context - for authentication , logging , cancellation , deadlines , tracing , etc . Passed from http . Request or context . Background ( ) .
* @ param optional nil or * CreateRouteTableOpts - Optional Parameters :
2021-04-20 11:18:45 -04:00
* @ param "CreateRouteTableRequest" ( optional . Interface of CreateRouteTableRequest ) -
2020-10-13 11:17:37 -04:00
@ return CreateRouteTableResponse
* /
func ( a * RouteTableApiService ) CreateRouteTable ( ctx _context . Context , localVarOptionals * CreateRouteTableOpts ) ( CreateRouteTableResponse , * _nethttp . Response , error ) {
var (
localVarHTTPMethod = _nethttp . MethodPost
localVarPostBody interface { }
localVarFormFileName string
localVarFileName string
localVarFileBytes [ ] byte
localVarReturnValue CreateRouteTableResponse
)
// create path and map variables
localVarPath := a . client . cfg . BasePath + "/CreateRouteTable"
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 . CreateRouteTableRequest . IsSet ( ) {
localVarOptionalCreateRouteTableRequest , localVarOptionalCreateRouteTableRequestok := localVarOptionals . CreateRouteTableRequest . Value ( ) . ( CreateRouteTableRequest )
if ! localVarOptionalCreateRouteTableRequestok {
return localVarReturnValue , nil , reportError ( "createRouteTableRequest should be CreateRouteTableRequest" )
}
localVarPostBody = & localVarOptionalCreateRouteTableRequest
}
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 CreateRouteTableResponse
err = a . client . decode ( & v , localVarBody , localVarHTTPResponse . Header . Get ( "Content-Type" ) )
if err != nil {
newErr . error = err . Error ( )
return localVarReturnValue , localVarHTTPResponse , newErr
}
newErr . model = v
return localVarReturnValue , localVarHTTPResponse , newErr
}
if localVarHTTPResponse . StatusCode == 400 {
var v ErrorResponse
err = a . client . decode ( & v , localVarBody , localVarHTTPResponse . Header . Get ( "Content-Type" ) )
if err != nil {
newErr . error = err . Error ( )
return localVarReturnValue , localVarHTTPResponse , newErr
}
newErr . model = v
return localVarReturnValue , localVarHTTPResponse , newErr
}
if localVarHTTPResponse . StatusCode == 401 {
var v ErrorResponse
err = a . client . decode ( & v , localVarBody , localVarHTTPResponse . Header . Get ( "Content-Type" ) )
if err != nil {
newErr . error = err . Error ( )
return localVarReturnValue , localVarHTTPResponse , newErr
}
newErr . model = v
return localVarReturnValue , localVarHTTPResponse , newErr
}
if localVarHTTPResponse . StatusCode == 500 {
var v ErrorResponse
err = a . client . decode ( & v , localVarBody , localVarHTTPResponse . Header . Get ( "Content-Type" ) )
if err != nil {
newErr . error = err . Error ( )
return localVarReturnValue , localVarHTTPResponse , newErr
}
newErr . model = v
}
return localVarReturnValue , localVarHTTPResponse , newErr
}
err = a . client . decode ( & localVarReturnValue , localVarBody , localVarHTTPResponse . Header . Get ( "Content-Type" ) )
if err != nil {
newErr := GenericOpenAPIError {
body : localVarBody ,
error : err . Error ( ) ,
}
return localVarReturnValue , localVarHTTPResponse , newErr
}
return localVarReturnValue , localVarHTTPResponse , nil
}
// DeleteRouteTableOpts Optional parameters for the method 'DeleteRouteTable'
type DeleteRouteTableOpts struct {
2021-04-20 11:18:45 -04:00
DeleteRouteTableRequest optional . Interface
2020-10-13 11:17:37 -04:00
}
/ *
DeleteRouteTable Method for DeleteRouteTable
* @ param ctx _context . Context - for authentication , logging , cancellation , deadlines , tracing , etc . Passed from http . Request or context . Background ( ) .
* @ param optional nil or * DeleteRouteTableOpts - Optional Parameters :
2021-04-20 11:18:45 -04:00
* @ param "DeleteRouteTableRequest" ( optional . Interface of DeleteRouteTableRequest ) -
2020-10-13 11:17:37 -04:00
@ return DeleteRouteTableResponse
* /
func ( a * RouteTableApiService ) DeleteRouteTable ( ctx _context . Context , localVarOptionals * DeleteRouteTableOpts ) ( DeleteRouteTableResponse , * _nethttp . Response , error ) {
var (
localVarHTTPMethod = _nethttp . MethodPost
localVarPostBody interface { }
localVarFormFileName string
localVarFileName string
localVarFileBytes [ ] byte
localVarReturnValue DeleteRouteTableResponse
)
// create path and map variables
localVarPath := a . client . cfg . BasePath + "/DeleteRouteTable"
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 . DeleteRouteTableRequest . IsSet ( ) {
localVarOptionalDeleteRouteTableRequest , localVarOptionalDeleteRouteTableRequestok := localVarOptionals . DeleteRouteTableRequest . Value ( ) . ( DeleteRouteTableRequest )
if ! localVarOptionalDeleteRouteTableRequestok {
return localVarReturnValue , nil , reportError ( "deleteRouteTableRequest should be DeleteRouteTableRequest" )
}
localVarPostBody = & localVarOptionalDeleteRouteTableRequest
}
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 DeleteRouteTableResponse
err = a . client . decode ( & v , localVarBody , localVarHTTPResponse . Header . Get ( "Content-Type" ) )
if err != nil {
newErr . error = err . Error ( )
return localVarReturnValue , localVarHTTPResponse , newErr
}
newErr . model = v
return localVarReturnValue , localVarHTTPResponse , newErr
}
if localVarHTTPResponse . StatusCode == 400 {
var v ErrorResponse
err = a . client . decode ( & v , localVarBody , localVarHTTPResponse . Header . Get ( "Content-Type" ) )
if err != nil {
newErr . error = err . Error ( )
return localVarReturnValue , localVarHTTPResponse , newErr
}
newErr . model = v
return localVarReturnValue , localVarHTTPResponse , newErr
}
if localVarHTTPResponse . StatusCode == 401 {
var v ErrorResponse
err = a . client . decode ( & v , localVarBody , localVarHTTPResponse . Header . Get ( "Content-Type" ) )
if err != nil {
newErr . error = err . Error ( )
return localVarReturnValue , localVarHTTPResponse , newErr
}
newErr . model = v
return localVarReturnValue , localVarHTTPResponse , newErr
}
if localVarHTTPResponse . StatusCode == 500 {
var v ErrorResponse
err = a . client . decode ( & v , localVarBody , localVarHTTPResponse . Header . Get ( "Content-Type" ) )
if err != nil {
newErr . error = err . Error ( )
return localVarReturnValue , localVarHTTPResponse , newErr
}
newErr . model = v
}
return localVarReturnValue , localVarHTTPResponse , newErr
}
err = a . client . decode ( & localVarReturnValue , localVarBody , localVarHTTPResponse . Header . Get ( "Content-Type" ) )
if err != nil {
newErr := GenericOpenAPIError {
body : localVarBody ,
error : err . Error ( ) ,
}
return localVarReturnValue , localVarHTTPResponse , newErr
}
return localVarReturnValue , localVarHTTPResponse , nil
}
// LinkRouteTableOpts Optional parameters for the method 'LinkRouteTable'
type LinkRouteTableOpts struct {
2021-04-20 11:18:45 -04:00
LinkRouteTableRequest optional . Interface
2020-10-13 11:17:37 -04:00
}
/ *
LinkRouteTable Method for LinkRouteTable
* @ param ctx _context . Context - for authentication , logging , cancellation , deadlines , tracing , etc . Passed from http . Request or context . Background ( ) .
* @ param optional nil or * LinkRouteTableOpts - Optional Parameters :
2021-04-20 11:18:45 -04:00
* @ param "LinkRouteTableRequest" ( optional . Interface of LinkRouteTableRequest ) -
2020-10-13 11:17:37 -04:00
@ return LinkRouteTableResponse
* /
func ( a * RouteTableApiService ) LinkRouteTable ( ctx _context . Context , localVarOptionals * LinkRouteTableOpts ) ( LinkRouteTableResponse , * _nethttp . Response , error ) {
var (
localVarHTTPMethod = _nethttp . MethodPost
localVarPostBody interface { }
localVarFormFileName string
localVarFileName string
localVarFileBytes [ ] byte
localVarReturnValue LinkRouteTableResponse
)
// create path and map variables
localVarPath := a . client . cfg . BasePath + "/LinkRouteTable"
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 . LinkRouteTableRequest . IsSet ( ) {
localVarOptionalLinkRouteTableRequest , localVarOptionalLinkRouteTableRequestok := localVarOptionals . LinkRouteTableRequest . Value ( ) . ( LinkRouteTableRequest )
if ! localVarOptionalLinkRouteTableRequestok {
return localVarReturnValue , nil , reportError ( "linkRouteTableRequest should be LinkRouteTableRequest" )
}
localVarPostBody = & localVarOptionalLinkRouteTableRequest
}
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 LinkRouteTableResponse
err = a . client . decode ( & v , localVarBody , localVarHTTPResponse . Header . Get ( "Content-Type" ) )
if err != nil {
newErr . error = err . Error ( )
return localVarReturnValue , localVarHTTPResponse , newErr
}
newErr . model = v
return localVarReturnValue , localVarHTTPResponse , newErr
}
if localVarHTTPResponse . StatusCode == 400 {
var v ErrorResponse
err = a . client . decode ( & v , localVarBody , localVarHTTPResponse . Header . Get ( "Content-Type" ) )
if err != nil {
newErr . error = err . Error ( )
return localVarReturnValue , localVarHTTPResponse , newErr
}
newErr . model = v
return localVarReturnValue , localVarHTTPResponse , newErr
}
if localVarHTTPResponse . StatusCode == 401 {
var v ErrorResponse
err = a . client . decode ( & v , localVarBody , localVarHTTPResponse . Header . Get ( "Content-Type" ) )
if err != nil {
newErr . error = err . Error ( )
return localVarReturnValue , localVarHTTPResponse , newErr
}
newErr . model = v
return localVarReturnValue , localVarHTTPResponse , newErr
}
if localVarHTTPResponse . StatusCode == 500 {
var v ErrorResponse
err = a . client . decode ( & v , localVarBody , localVarHTTPResponse . Header . Get ( "Content-Type" ) )
if err != nil {
newErr . error = err . Error ( )
return localVarReturnValue , localVarHTTPResponse , newErr
}
newErr . model = v
}
return localVarReturnValue , localVarHTTPResponse , newErr
}
err = a . client . decode ( & localVarReturnValue , localVarBody , localVarHTTPResponse . Header . Get ( "Content-Type" ) )
if err != nil {
newErr := GenericOpenAPIError {
body : localVarBody ,
error : err . Error ( ) ,
}
return localVarReturnValue , localVarHTTPResponse , newErr
}
return localVarReturnValue , localVarHTTPResponse , nil
}
// ReadRouteTablesOpts Optional parameters for the method 'ReadRouteTables'
type ReadRouteTablesOpts struct {
2021-04-20 11:18:45 -04:00
ReadRouteTablesRequest optional . Interface
2020-10-13 11:17:37 -04:00
}
/ *
ReadRouteTables Method for ReadRouteTables
* @ param ctx _context . Context - for authentication , logging , cancellation , deadlines , tracing , etc . Passed from http . Request or context . Background ( ) .
* @ param optional nil or * ReadRouteTablesOpts - Optional Parameters :
2021-04-20 11:18:45 -04:00
* @ param "ReadRouteTablesRequest" ( optional . Interface of ReadRouteTablesRequest ) -
2020-10-13 11:17:37 -04:00
@ return ReadRouteTablesResponse
* /
func ( a * RouteTableApiService ) ReadRouteTables ( ctx _context . Context , localVarOptionals * ReadRouteTablesOpts ) ( ReadRouteTablesResponse , * _nethttp . Response , error ) {
var (
localVarHTTPMethod = _nethttp . MethodPost
localVarPostBody interface { }
localVarFormFileName string
localVarFileName string
localVarFileBytes [ ] byte
localVarReturnValue ReadRouteTablesResponse
)
// create path and map variables
localVarPath := a . client . cfg . BasePath + "/ReadRouteTables"
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 . ReadRouteTablesRequest . IsSet ( ) {
localVarOptionalReadRouteTablesRequest , localVarOptionalReadRouteTablesRequestok := localVarOptionals . ReadRouteTablesRequest . Value ( ) . ( ReadRouteTablesRequest )
if ! localVarOptionalReadRouteTablesRequestok {
return localVarReturnValue , nil , reportError ( "readRouteTablesRequest should be ReadRouteTablesRequest" )
}
localVarPostBody = & localVarOptionalReadRouteTablesRequest
}
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 ReadRouteTablesResponse
err = a . client . decode ( & v , localVarBody , localVarHTTPResponse . Header . Get ( "Content-Type" ) )
if err != nil {
newErr . error = err . Error ( )
return localVarReturnValue , localVarHTTPResponse , newErr
}
newErr . model = v
return localVarReturnValue , localVarHTTPResponse , newErr
}
if localVarHTTPResponse . StatusCode == 400 {
var v ErrorResponse
err = a . client . decode ( & v , localVarBody , localVarHTTPResponse . Header . Get ( "Content-Type" ) )
if err != nil {
newErr . error = err . Error ( )
return localVarReturnValue , localVarHTTPResponse , newErr
}
newErr . model = v
return localVarReturnValue , localVarHTTPResponse , newErr
}
if localVarHTTPResponse . StatusCode == 401 {
var v ErrorResponse
err = a . client . decode ( & v , localVarBody , localVarHTTPResponse . Header . Get ( "Content-Type" ) )
if err != nil {
newErr . error = err . Error ( )
return localVarReturnValue , localVarHTTPResponse , newErr
}
newErr . model = v
return localVarReturnValue , localVarHTTPResponse , newErr
}
if localVarHTTPResponse . StatusCode == 500 {
var v ErrorResponse
err = a . client . decode ( & v , localVarBody , localVarHTTPResponse . Header . Get ( "Content-Type" ) )
if err != nil {
newErr . error = err . Error ( )
return localVarReturnValue , localVarHTTPResponse , newErr
}
newErr . model = v
}
return localVarReturnValue , localVarHTTPResponse , newErr
}
err = a . client . decode ( & localVarReturnValue , localVarBody , localVarHTTPResponse . Header . Get ( "Content-Type" ) )
if err != nil {
newErr := GenericOpenAPIError {
body : localVarBody ,
error : err . Error ( ) ,
}
return localVarReturnValue , localVarHTTPResponse , newErr
}
return localVarReturnValue , localVarHTTPResponse , nil
}
// UnlinkRouteTableOpts Optional parameters for the method 'UnlinkRouteTable'
type UnlinkRouteTableOpts struct {
2021-04-20 11:18:45 -04:00
UnlinkRouteTableRequest optional . Interface
2020-10-13 11:17:37 -04:00
}
/ *
UnlinkRouteTable Method for UnlinkRouteTable
* @ param ctx _context . Context - for authentication , logging , cancellation , deadlines , tracing , etc . Passed from http . Request or context . Background ( ) .
* @ param optional nil or * UnlinkRouteTableOpts - Optional Parameters :
2021-04-20 11:18:45 -04:00
* @ param "UnlinkRouteTableRequest" ( optional . Interface of UnlinkRouteTableRequest ) -
2020-10-13 11:17:37 -04:00
@ return UnlinkRouteTableResponse
* /
func ( a * RouteTableApiService ) UnlinkRouteTable ( ctx _context . Context , localVarOptionals * UnlinkRouteTableOpts ) ( UnlinkRouteTableResponse , * _nethttp . Response , error ) {
var (
localVarHTTPMethod = _nethttp . MethodPost
localVarPostBody interface { }
localVarFormFileName string
localVarFileName string
localVarFileBytes [ ] byte
localVarReturnValue UnlinkRouteTableResponse
)
// create path and map variables
localVarPath := a . client . cfg . BasePath + "/UnlinkRouteTable"
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 . UnlinkRouteTableRequest . IsSet ( ) {
localVarOptionalUnlinkRouteTableRequest , localVarOptionalUnlinkRouteTableRequestok := localVarOptionals . UnlinkRouteTableRequest . Value ( ) . ( UnlinkRouteTableRequest )
if ! localVarOptionalUnlinkRouteTableRequestok {
return localVarReturnValue , nil , reportError ( "unlinkRouteTableRequest should be UnlinkRouteTableRequest" )
}
localVarPostBody = & localVarOptionalUnlinkRouteTableRequest
}
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 UnlinkRouteTableResponse
err = a . client . decode ( & v , localVarBody , localVarHTTPResponse . Header . Get ( "Content-Type" ) )
if err != nil {
newErr . error = err . Error ( )
return localVarReturnValue , localVarHTTPResponse , newErr
}
newErr . model = v
return localVarReturnValue , localVarHTTPResponse , newErr
}
if localVarHTTPResponse . StatusCode == 400 {
var v ErrorResponse
err = a . client . decode ( & v , localVarBody , localVarHTTPResponse . Header . Get ( "Content-Type" ) )
if err != nil {
newErr . error = err . Error ( )
return localVarReturnValue , localVarHTTPResponse , newErr
}
newErr . model = v
return localVarReturnValue , localVarHTTPResponse , newErr
}
if localVarHTTPResponse . StatusCode == 401 {
var v ErrorResponse
err = a . client . decode ( & v , localVarBody , localVarHTTPResponse . Header . Get ( "Content-Type" ) )
if err != nil {
newErr . error = err . Error ( )
return localVarReturnValue , localVarHTTPResponse , newErr
}
newErr . model = v
return localVarReturnValue , localVarHTTPResponse , newErr
}
if localVarHTTPResponse . StatusCode == 500 {
var v ErrorResponse
err = a . client . decode ( & v , localVarBody , localVarHTTPResponse . Header . Get ( "Content-Type" ) )
if err != nil {
newErr . error = err . Error ( )
return localVarReturnValue , localVarHTTPResponse , newErr
}
newErr . model = v
}
return localVarReturnValue , localVarHTTPResponse , newErr
}
err = a . client . decode ( & localVarReturnValue , localVarBody , localVarHTTPResponse . Header . Get ( "Content-Type" ) )
if err != nil {
newErr := GenericOpenAPIError {
body : localVarBody ,
error : err . Error ( ) ,
}
return localVarReturnValue , localVarHTTPResponse , newErr
}
return localVarReturnValue , localVarHTTPResponse , nil
}