472 lines
16 KiB
Go
472 lines
16 KiB
Go
|
/*
|
||
|
* 3DS OUTSCALE API
|
||
|
*
|
||
|
* Welcome to the 3DS OUTSCALE's API documentation.<br /><br /> The 3DS OUTSCALE API enables you to manage your resources in the 3DS OUTSCALE Cloud. This documentation describes the different actions available along with code examples.<br /><br /> Note that the 3DS OUTSCALE Cloud is compatible with Amazon Web Services (AWS) APIs, but some resources have different names in AWS than in the 3DS OUTSCALE API. You can find a list of the differences [here](https://wiki.outscale.net/display/EN/3DS+OUTSCALE+APIs+Reference).<br /><br /> You can also manage your resources using the [Cockpit](https://wiki.outscale.net/display/EN/About+Cockpit) web interface.
|
||
|
*
|
||
|
* API version: 1.8
|
||
|
* Contact: support@outscale.com
|
||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||
|
*/
|
||
|
|
||
|
package osc
|
||
|
|
||
|
import (
|
||
|
_context "context"
|
||
|
"github.com/antihax/optional"
|
||
|
_ioutil "io/ioutil"
|
||
|
_nethttp "net/http"
|
||
|
_neturl "net/url"
|
||
|
)
|
||
|
|
||
|
// Linger please
|
||
|
var (
|
||
|
_ _context.Context
|
||
|
)
|
||
|
|
||
|
// CaApiService CaApi service
|
||
|
type CaApiService service
|
||
|
|
||
|
// CreateCaOpts Optional parameters for the method 'CreateCa'
|
||
|
type CreateCaOpts struct {
|
||
|
CreateCaRequest optional.Interface
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
CreateCa Method for CreateCa
|
||
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||
|
* @param optional nil or *CreateCaOpts - Optional Parameters:
|
||
|
* @param "CreateCaRequest" (optional.Interface of CreateCaRequest) -
|
||
|
@return CreateCaResponse
|
||
|
*/
|
||
|
func (a *CaApiService) CreateCa(ctx _context.Context, localVarOptionals *CreateCaOpts) (CreateCaResponse, *_nethttp.Response, error) {
|
||
|
var (
|
||
|
localVarHTTPMethod = _nethttp.MethodPost
|
||
|
localVarPostBody interface{}
|
||
|
localVarFormFileName string
|
||
|
localVarFileName string
|
||
|
localVarFileBytes []byte
|
||
|
localVarReturnValue CreateCaResponse
|
||
|
)
|
||
|
|
||
|
// create path and map variables
|
||
|
localVarPath := a.client.cfg.BasePath + "/CreateCa"
|
||
|
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.CreateCaRequest.IsSet() {
|
||
|
localVarOptionalCreateCaRequest, localVarOptionalCreateCaRequestok := localVarOptionals.CreateCaRequest.Value().(CreateCaRequest)
|
||
|
if !localVarOptionalCreateCaRequestok {
|
||
|
return localVarReturnValue, nil, reportError("createCaRequest should be CreateCaRequest")
|
||
|
}
|
||
|
localVarPostBody = &localVarOptionalCreateCaRequest
|
||
|
}
|
||
|
|
||
|
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 CreateCaResponse
|
||
|
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
|
||
|
}
|
||
|
|
||
|
// DeleteCaOpts Optional parameters for the method 'DeleteCa'
|
||
|
type DeleteCaOpts struct {
|
||
|
DeleteCaRequest optional.Interface
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
DeleteCa Method for DeleteCa
|
||
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||
|
* @param optional nil or *DeleteCaOpts - Optional Parameters:
|
||
|
* @param "DeleteCaRequest" (optional.Interface of DeleteCaRequest) -
|
||
|
@return DeleteCaResponse
|
||
|
*/
|
||
|
func (a *CaApiService) DeleteCa(ctx _context.Context, localVarOptionals *DeleteCaOpts) (DeleteCaResponse, *_nethttp.Response, error) {
|
||
|
var (
|
||
|
localVarHTTPMethod = _nethttp.MethodPost
|
||
|
localVarPostBody interface{}
|
||
|
localVarFormFileName string
|
||
|
localVarFileName string
|
||
|
localVarFileBytes []byte
|
||
|
localVarReturnValue DeleteCaResponse
|
||
|
)
|
||
|
|
||
|
// create path and map variables
|
||
|
localVarPath := a.client.cfg.BasePath + "/DeleteCa"
|
||
|
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.DeleteCaRequest.IsSet() {
|
||
|
localVarOptionalDeleteCaRequest, localVarOptionalDeleteCaRequestok := localVarOptionals.DeleteCaRequest.Value().(DeleteCaRequest)
|
||
|
if !localVarOptionalDeleteCaRequestok {
|
||
|
return localVarReturnValue, nil, reportError("deleteCaRequest should be DeleteCaRequest")
|
||
|
}
|
||
|
localVarPostBody = &localVarOptionalDeleteCaRequest
|
||
|
}
|
||
|
|
||
|
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 DeleteCaResponse
|
||
|
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
|
||
|
}
|
||
|
|
||
|
// ReadCasOpts Optional parameters for the method 'ReadCas'
|
||
|
type ReadCasOpts struct {
|
||
|
ReadCasRequest optional.Interface
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
ReadCas Method for ReadCas
|
||
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||
|
* @param optional nil or *ReadCasOpts - Optional Parameters:
|
||
|
* @param "ReadCasRequest" (optional.Interface of ReadCasRequest) -
|
||
|
@return ReadCasResponse
|
||
|
*/
|
||
|
func (a *CaApiService) ReadCas(ctx _context.Context, localVarOptionals *ReadCasOpts) (ReadCasResponse, *_nethttp.Response, error) {
|
||
|
var (
|
||
|
localVarHTTPMethod = _nethttp.MethodPost
|
||
|
localVarPostBody interface{}
|
||
|
localVarFormFileName string
|
||
|
localVarFileName string
|
||
|
localVarFileBytes []byte
|
||
|
localVarReturnValue ReadCasResponse
|
||
|
)
|
||
|
|
||
|
// create path and map variables
|
||
|
localVarPath := a.client.cfg.BasePath + "/ReadCas"
|
||
|
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.ReadCasRequest.IsSet() {
|
||
|
localVarOptionalReadCasRequest, localVarOptionalReadCasRequestok := localVarOptionals.ReadCasRequest.Value().(ReadCasRequest)
|
||
|
if !localVarOptionalReadCasRequestok {
|
||
|
return localVarReturnValue, nil, reportError("readCasRequest should be ReadCasRequest")
|
||
|
}
|
||
|
localVarPostBody = &localVarOptionalReadCasRequest
|
||
|
}
|
||
|
|
||
|
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 ReadCasResponse
|
||
|
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
|
||
|
}
|
||
|
|
||
|
// UpdateCaOpts Optional parameters for the method 'UpdateCa'
|
||
|
type UpdateCaOpts struct {
|
||
|
UpdateCaRequest optional.Interface
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
UpdateCa Method for UpdateCa
|
||
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||
|
* @param optional nil or *UpdateCaOpts - Optional Parameters:
|
||
|
* @param "UpdateCaRequest" (optional.Interface of UpdateCaRequest) -
|
||
|
@return UpdateCaResponse
|
||
|
*/
|
||
|
func (a *CaApiService) UpdateCa(ctx _context.Context, localVarOptionals *UpdateCaOpts) (UpdateCaResponse, *_nethttp.Response, error) {
|
||
|
var (
|
||
|
localVarHTTPMethod = _nethttp.MethodPost
|
||
|
localVarPostBody interface{}
|
||
|
localVarFormFileName string
|
||
|
localVarFileName string
|
||
|
localVarFileBytes []byte
|
||
|
localVarReturnValue UpdateCaResponse
|
||
|
)
|
||
|
|
||
|
// create path and map variables
|
||
|
localVarPath := a.client.cfg.BasePath + "/UpdateCa"
|
||
|
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.UpdateCaRequest.IsSet() {
|
||
|
localVarOptionalUpdateCaRequest, localVarOptionalUpdateCaRequestok := localVarOptionals.UpdateCaRequest.Value().(UpdateCaRequest)
|
||
|
if !localVarOptionalUpdateCaRequestok {
|
||
|
return localVarReturnValue, nil, reportError("updateCaRequest should be UpdateCaRequest")
|
||
|
}
|
||
|
localVarPostBody = &localVarOptionalUpdateCaRequest
|
||
|
}
|
||
|
|
||
|
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 UpdateCaResponse
|
||
|
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
|
||
|
}
|