2022-11-13 13:22:00 +00:00
/ *
2023-11-22 17:28:14 +00:00
Garage Administration API v0 + garage - v0 .9 .0
2022-11-13 13:22:00 +00:00
Administrate your Garage cluster programatically , including status , layout , keys , buckets , and maintainance tasks . * Disclaimer : The API is not stable yet , hence its v0 tag . The API can change at any time , and changes can include breaking backward compatibility . Read the changelog and upgrade your scripts before upgrading . Additionnaly , this specification is very early stage and can contain bugs , especially on error return codes / types that are not tested yet . Do not expect a well finished and polished product ! *
2023-11-22 17:28:14 +00:00
API version : v0 .9 .0
2022-11-13 13:22:00 +00:00
* /
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package garage
import (
"bytes"
"context"
"io/ioutil"
"net/http"
"net/url"
)
// KeyApiService KeyApi service
type KeyApiService service
type ApiAddKeyRequest struct {
ctx context . Context
ApiService * KeyApiService
addKeyRequest * AddKeyRequest
}
2023-11-22 17:28:14 +00:00
// You can set a friendly name for this key. If you don't want to, you can set the name to `null`. *Note: the secret key is returned in the response.*
2022-11-13 13:22:00 +00:00
func ( r ApiAddKeyRequest ) AddKeyRequest ( addKeyRequest AddKeyRequest ) ApiAddKeyRequest {
r . addKeyRequest = & addKeyRequest
return r
}
func ( r ApiAddKeyRequest ) Execute ( ) ( * KeyInfo , * http . Response , error ) {
return r . ApiService . AddKeyExecute ( r )
}
/ *
AddKey Create a new API key
Creates a new API access key .
@ param ctx context . Context - for authentication , logging , cancellation , deadlines , tracing , etc . Passed from http . Request or context . Background ( ) .
@ return ApiAddKeyRequest
* /
func ( a * KeyApiService ) AddKey ( ctx context . Context ) ApiAddKeyRequest {
return ApiAddKeyRequest {
ApiService : a ,
ctx : ctx ,
}
}
// Execute executes the request
// @return KeyInfo
func ( a * KeyApiService ) AddKeyExecute ( r ApiAddKeyRequest ) ( * KeyInfo , * http . Response , error ) {
var (
localVarHTTPMethod = http . MethodPost
localVarPostBody interface { }
formFiles [ ] formFile
localVarReturnValue * KeyInfo
)
localBasePath , err := a . client . cfg . ServerURLWithContext ( r . ctx , "KeyApiService.AddKey" )
if err != nil {
return localVarReturnValue , nil , & GenericOpenAPIError { error : err . Error ( ) }
}
2023-11-22 20:17:35 +00:00
localVarPath := localBasePath + "/key?list"
2022-11-13 13:22:00 +00:00
localVarHeaderParams := make ( map [ string ] string )
localVarQueryParams := url . Values { }
localVarFormParams := url . Values { }
if r . addKeyRequest == nil {
return localVarReturnValue , nil , reportError ( "addKeyRequest is required and must be specified" )
}
// 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
localVarPostBody = r . addKeyRequest
req , err := a . client . prepareRequest ( r . ctx , localVarPath , localVarHTTPMethod , localVarPostBody , localVarHeaderParams , localVarQueryParams , localVarFormParams , formFiles )
if err != nil {
return localVarReturnValue , nil , err
}
localVarHTTPResponse , err := a . client . callAPI ( req )
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue , localVarHTTPResponse , err
}
localVarBody , err := ioutil . ReadAll ( localVarHTTPResponse . Body )
localVarHTTPResponse . Body . Close ( )
localVarHTTPResponse . Body = ioutil . NopCloser ( bytes . NewBuffer ( localVarBody ) )
if err != nil {
return localVarReturnValue , localVarHTTPResponse , err
}
if localVarHTTPResponse . StatusCode >= 300 {
newErr := & GenericOpenAPIError {
body : localVarBody ,
error : localVarHTTPResponse . Status ,
}
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
}
type ApiDeleteKeyRequest struct {
ctx context . Context
ApiService * KeyApiService
2023-11-23 07:54:51 +00:00
id * string
}
// The exact API access key generated by Garage
func ( r ApiDeleteKeyRequest ) Id ( id string ) ApiDeleteKeyRequest {
r . id = & id
return r
2022-11-13 13:22:00 +00:00
}
func ( r ApiDeleteKeyRequest ) Execute ( ) ( * http . Response , error ) {
return r . ApiService . DeleteKeyExecute ( r )
}
/ *
DeleteKey Delete a key
Delete a key from the cluster . Its access will be removed from all the buckets . Buckets are not automatically deleted and can be dangling . You should manually delete them before .
@ param ctx context . Context - for authentication , logging , cancellation , deadlines , tracing , etc . Passed from http . Request or context . Background ( ) .
@ return ApiDeleteKeyRequest
* /
2023-11-23 07:54:51 +00:00
func ( a * KeyApiService ) DeleteKey ( ctx context . Context ) ApiDeleteKeyRequest {
2022-11-13 13:22:00 +00:00
return ApiDeleteKeyRequest {
ApiService : a ,
ctx : ctx ,
}
}
// Execute executes the request
func ( a * KeyApiService ) DeleteKeyExecute ( r ApiDeleteKeyRequest ) ( * http . Response , error ) {
var (
localVarHTTPMethod = http . MethodDelete
localVarPostBody interface { }
formFiles [ ] formFile
)
localBasePath , err := a . client . cfg . ServerURLWithContext ( r . ctx , "KeyApiService.DeleteKey" )
if err != nil {
return nil , & GenericOpenAPIError { error : err . Error ( ) }
}
2023-11-22 20:17:35 +00:00
localVarPath := localBasePath + "/key"
2022-11-13 13:22:00 +00:00
localVarHeaderParams := make ( map [ string ] string )
localVarQueryParams := url . Values { }
localVarFormParams := url . Values { }
2023-11-23 07:54:51 +00:00
if r . id == nil {
return nil , reportError ( "id is required and must be specified" )
}
2022-11-13 13:22:00 +00:00
2023-11-23 07:54:51 +00:00
localVarQueryParams . Add ( "id" , parameterToString ( * r . id , "" ) )
2022-11-13 13:22:00 +00:00
// 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 { }
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept ( localVarHTTPHeaderAccepts )
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams [ "Accept" ] = localVarHTTPHeaderAccept
}
req , err := a . client . prepareRequest ( r . ctx , localVarPath , localVarHTTPMethod , localVarPostBody , localVarHeaderParams , localVarQueryParams , localVarFormParams , formFiles )
if err != nil {
return nil , err
}
localVarHTTPResponse , err := a . client . callAPI ( req )
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse , err
}
localVarBody , err := ioutil . ReadAll ( localVarHTTPResponse . Body )
localVarHTTPResponse . Body . Close ( )
localVarHTTPResponse . Body = ioutil . NopCloser ( bytes . NewBuffer ( localVarBody ) )
if err != nil {
return localVarHTTPResponse , err
}
if localVarHTTPResponse . StatusCode >= 300 {
newErr := & GenericOpenAPIError {
body : localVarBody ,
error : localVarHTTPResponse . Status ,
}
return localVarHTTPResponse , newErr
}
return localVarHTTPResponse , nil
}
type ApiGetKeyRequest struct {
ctx context . Context
ApiService * KeyApiService
2023-11-22 20:17:35 +00:00
id * string
search * string
showSecretKey * string
}
// The exact API access key generated by Garage. Incompatible with `search`.
func ( r ApiGetKeyRequest ) Id ( id string ) ApiGetKeyRequest {
r . id = & id
return r
}
// A pattern (beginning or full string) corresponding to a key identifier or friendly name. Incompatible with `id`.
func ( r ApiGetKeyRequest ) Search ( search string ) ApiGetKeyRequest {
r . search = & search
return r
2023-11-22 17:28:14 +00:00
}
// Wether or not the secret key should be returned in the response
2023-11-22 20:17:35 +00:00
func ( r ApiGetKeyRequest ) ShowSecretKey ( showSecretKey string ) ApiGetKeyRequest {
2023-11-22 17:28:14 +00:00
r . showSecretKey = & showSecretKey
return r
2022-11-13 13:22:00 +00:00
}
func ( r ApiGetKeyRequest ) Execute ( ) ( * KeyInfo , * http . Response , error ) {
return r . ApiService . GetKeyExecute ( r )
}
/ *
GetKey Get key information
2023-11-22 17:28:14 +00:00
Return information about a specific key like its identifiers , its permissions and buckets on which it has permissions .
2023-11-22 20:17:35 +00:00
You can search by specifying the exact key identifier ( ` id ` ) or by specifying a pattern ( ` search ` ) .
2023-11-22 17:28:14 +00:00
For confidentiality reasons , the secret key is not returned by default : you must pass the ` showSecretKey ` query parameter to get it .
2022-11-13 13:22:00 +00:00
@ param ctx context . Context - for authentication , logging , cancellation , deadlines , tracing , etc . Passed from http . Request or context . Background ( ) .
@ return ApiGetKeyRequest
* /
2023-11-22 20:17:35 +00:00
func ( a * KeyApiService ) GetKey ( ctx context . Context ) ApiGetKeyRequest {
2022-11-13 13:22:00 +00:00
return ApiGetKeyRequest {
ApiService : a ,
ctx : ctx ,
}
}
// Execute executes the request
// @return KeyInfo
func ( a * KeyApiService ) GetKeyExecute ( r ApiGetKeyRequest ) ( * KeyInfo , * http . Response , error ) {
var (
localVarHTTPMethod = http . MethodGet
localVarPostBody interface { }
formFiles [ ] formFile
localVarReturnValue * KeyInfo
)
localBasePath , err := a . client . cfg . ServerURLWithContext ( r . ctx , "KeyApiService.GetKey" )
if err != nil {
return localVarReturnValue , nil , & GenericOpenAPIError { error : err . Error ( ) }
}
2023-11-22 20:17:35 +00:00
localVarPath := localBasePath + "/key"
2022-11-13 13:22:00 +00:00
localVarHeaderParams := make ( map [ string ] string )
localVarQueryParams := url . Values { }
localVarFormParams := url . Values { }
2023-11-22 20:17:35 +00:00
if r . id != nil {
localVarQueryParams . Add ( "id" , parameterToString ( * r . id , "" ) )
}
if r . search != nil {
localVarQueryParams . Add ( "search" , parameterToString ( * r . search , "" ) )
}
2023-11-22 17:28:14 +00:00
if r . showSecretKey != nil {
localVarQueryParams . Add ( "showSecretKey" , parameterToString ( * r . showSecretKey , "" ) )
}
2022-11-13 13:22:00 +00:00
// 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
}
req , err := a . client . prepareRequest ( r . ctx , localVarPath , localVarHTTPMethod , localVarPostBody , localVarHeaderParams , localVarQueryParams , localVarFormParams , formFiles )
if err != nil {
return localVarReturnValue , nil , err
}
localVarHTTPResponse , err := a . client . callAPI ( req )
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue , localVarHTTPResponse , err
}
localVarBody , err := ioutil . ReadAll ( localVarHTTPResponse . Body )
localVarHTTPResponse . Body . Close ( )
localVarHTTPResponse . Body = ioutil . NopCloser ( bytes . NewBuffer ( localVarBody ) )
if err != nil {
return localVarReturnValue , localVarHTTPResponse , err
}
if localVarHTTPResponse . StatusCode >= 300 {
newErr := & GenericOpenAPIError {
body : localVarBody ,
error : localVarHTTPResponse . Status ,
}
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
}
type ApiImportKeyRequest struct {
ctx context . Context
ApiService * KeyApiService
importKeyRequest * ImportKeyRequest
}
// Information on the key to import
func ( r ApiImportKeyRequest ) ImportKeyRequest ( importKeyRequest ImportKeyRequest ) ApiImportKeyRequest {
r . importKeyRequest = & importKeyRequest
return r
}
func ( r ApiImportKeyRequest ) Execute ( ) ( * KeyInfo , * http . Response , error ) {
return r . ApiService . ImportKeyExecute ( r )
}
/ *
ImportKey Import an existing key
Imports an existing API key . This feature must only be used for migrations and backup restore .
* * Do not use it to generate custom key identifiers or you will break your Garage cluster . * *
@ param ctx context . Context - for authentication , logging , cancellation , deadlines , tracing , etc . Passed from http . Request or context . Background ( ) .
@ return ApiImportKeyRequest
* /
func ( a * KeyApiService ) ImportKey ( ctx context . Context ) ApiImportKeyRequest {
return ApiImportKeyRequest {
ApiService : a ,
ctx : ctx ,
}
}
// Execute executes the request
// @return KeyInfo
func ( a * KeyApiService ) ImportKeyExecute ( r ApiImportKeyRequest ) ( * KeyInfo , * http . Response , error ) {
var (
localVarHTTPMethod = http . MethodPost
localVarPostBody interface { }
formFiles [ ] formFile
localVarReturnValue * KeyInfo
)
localBasePath , err := a . client . cfg . ServerURLWithContext ( r . ctx , "KeyApiService.ImportKey" )
if err != nil {
return localVarReturnValue , nil , & GenericOpenAPIError { error : err . Error ( ) }
}
localVarPath := localBasePath + "/key/import"
localVarHeaderParams := make ( map [ string ] string )
localVarQueryParams := url . Values { }
localVarFormParams := url . Values { }
if r . importKeyRequest == nil {
return localVarReturnValue , nil , reportError ( "importKeyRequest is required and must be specified" )
}
// 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
localVarPostBody = r . importKeyRequest
req , err := a . client . prepareRequest ( r . ctx , localVarPath , localVarHTTPMethod , localVarPostBody , localVarHeaderParams , localVarQueryParams , localVarFormParams , formFiles )
if err != nil {
return localVarReturnValue , nil , err
}
localVarHTTPResponse , err := a . client . callAPI ( req )
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue , localVarHTTPResponse , err
}
localVarBody , err := ioutil . ReadAll ( localVarHTTPResponse . Body )
localVarHTTPResponse . Body . Close ( )
localVarHTTPResponse . Body = ioutil . NopCloser ( bytes . NewBuffer ( localVarBody ) )
if err != nil {
return localVarReturnValue , localVarHTTPResponse , err
}
if localVarHTTPResponse . StatusCode >= 300 {
newErr := & GenericOpenAPIError {
body : localVarBody ,
error : localVarHTTPResponse . Status ,
}
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
}
type ApiListKeysRequest struct {
ctx context . Context
ApiService * KeyApiService
}
func ( r ApiListKeysRequest ) Execute ( ) ( [ ] ListKeys200ResponseInner , * http . Response , error ) {
return r . ApiService . ListKeysExecute ( r )
}
/ *
ListKeys List all keys
Returns all API access keys in the cluster .
@ param ctx context . Context - for authentication , logging , cancellation , deadlines , tracing , etc . Passed from http . Request or context . Background ( ) .
@ return ApiListKeysRequest
* /
func ( a * KeyApiService ) ListKeys ( ctx context . Context ) ApiListKeysRequest {
return ApiListKeysRequest {
ApiService : a ,
ctx : ctx ,
}
}
// Execute executes the request
// @return []ListKeys200ResponseInner
func ( a * KeyApiService ) ListKeysExecute ( r ApiListKeysRequest ) ( [ ] ListKeys200ResponseInner , * http . Response , error ) {
var (
localVarHTTPMethod = http . MethodGet
localVarPostBody interface { }
formFiles [ ] formFile
localVarReturnValue [ ] ListKeys200ResponseInner
)
localBasePath , err := a . client . cfg . ServerURLWithContext ( r . ctx , "KeyApiService.ListKeys" )
if err != nil {
return localVarReturnValue , nil , & GenericOpenAPIError { error : err . Error ( ) }
}
2023-11-22 20:17:35 +00:00
localVarPath := localBasePath + "/key?list"
2022-11-13 13:22:00 +00:00
localVarHeaderParams := make ( map [ string ] string )
localVarQueryParams := url . Values { }
localVarFormParams := url . 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
}
req , err := a . client . prepareRequest ( r . ctx , localVarPath , localVarHTTPMethod , localVarPostBody , localVarHeaderParams , localVarQueryParams , localVarFormParams , formFiles )
if err != nil {
return localVarReturnValue , nil , err
}
localVarHTTPResponse , err := a . client . callAPI ( req )
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue , localVarHTTPResponse , err
}
localVarBody , err := ioutil . ReadAll ( localVarHTTPResponse . Body )
localVarHTTPResponse . Body . Close ( )
localVarHTTPResponse . Body = ioutil . NopCloser ( bytes . NewBuffer ( localVarBody ) )
if err != nil {
return localVarReturnValue , localVarHTTPResponse , err
}
if localVarHTTPResponse . StatusCode >= 300 {
newErr := & GenericOpenAPIError {
body : localVarBody ,
error : localVarHTTPResponse . Status ,
}
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
}
type ApiUpdateKeyRequest struct {
ctx context . Context
ApiService * KeyApiService
2023-11-23 07:54:51 +00:00
id * string
2022-11-13 13:22:00 +00:00
updateKeyRequest * UpdateKeyRequest
}
2023-11-23 07:54:51 +00:00
// The exact API access key generated by Garage
func ( r ApiUpdateKeyRequest ) Id ( id string ) ApiUpdateKeyRequest {
r . id = & id
return r
}
2022-11-13 13:22:00 +00:00
// For a given key, provide a first set with the permissions to grant, and a second set with the permissions to remove
func ( r ApiUpdateKeyRequest ) UpdateKeyRequest ( updateKeyRequest UpdateKeyRequest ) ApiUpdateKeyRequest {
r . updateKeyRequest = & updateKeyRequest
return r
}
func ( r ApiUpdateKeyRequest ) Execute ( ) ( * KeyInfo , * http . Response , error ) {
return r . ApiService . UpdateKeyExecute ( r )
}
/ *
UpdateKey Update a key
Updates information about the specified API access key .
2023-11-22 17:28:14 +00:00
* Note : the secret key is not returned in the response , ` null ` is sent instead . *
2022-11-13 13:22:00 +00:00
@ param ctx context . Context - for authentication , logging , cancellation , deadlines , tracing , etc . Passed from http . Request or context . Background ( ) .
@ return ApiUpdateKeyRequest
* /
2023-11-23 07:54:51 +00:00
func ( a * KeyApiService ) UpdateKey ( ctx context . Context ) ApiUpdateKeyRequest {
2022-11-13 13:22:00 +00:00
return ApiUpdateKeyRequest {
ApiService : a ,
ctx : ctx ,
}
}
// Execute executes the request
// @return KeyInfo
func ( a * KeyApiService ) UpdateKeyExecute ( r ApiUpdateKeyRequest ) ( * KeyInfo , * http . Response , error ) {
var (
localVarHTTPMethod = http . MethodPost
localVarPostBody interface { }
formFiles [ ] formFile
localVarReturnValue * KeyInfo
)
localBasePath , err := a . client . cfg . ServerURLWithContext ( r . ctx , "KeyApiService.UpdateKey" )
if err != nil {
return localVarReturnValue , nil , & GenericOpenAPIError { error : err . Error ( ) }
}
2023-11-22 20:17:35 +00:00
localVarPath := localBasePath + "/key"
2022-11-13 13:22:00 +00:00
localVarHeaderParams := make ( map [ string ] string )
localVarQueryParams := url . Values { }
localVarFormParams := url . Values { }
2023-11-23 07:54:51 +00:00
if r . id == nil {
return localVarReturnValue , nil , reportError ( "id is required and must be specified" )
}
2022-11-13 13:22:00 +00:00
if r . updateKeyRequest == nil {
return localVarReturnValue , nil , reportError ( "updateKeyRequest is required and must be specified" )
}
2023-11-23 07:54:51 +00:00
localVarQueryParams . Add ( "id" , parameterToString ( * r . id , "" ) )
2022-11-13 13:22:00 +00:00
// 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
localVarPostBody = r . updateKeyRequest
req , err := a . client . prepareRequest ( r . ctx , localVarPath , localVarHTTPMethod , localVarPostBody , localVarHeaderParams , localVarQueryParams , localVarFormParams , formFiles )
if err != nil {
return localVarReturnValue , nil , err
}
localVarHTTPResponse , err := a . client . callAPI ( req )
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue , localVarHTTPResponse , err
}
localVarBody , err := ioutil . ReadAll ( localVarHTTPResponse . Body )
localVarHTTPResponse . Body . Close ( )
localVarHTTPResponse . Body = ioutil . NopCloser ( bytes . NewBuffer ( localVarBody ) )
if err != nil {
return localVarReturnValue , localVarHTTPResponse , err
}
if localVarHTTPResponse . StatusCode >= 300 {
newErr := & GenericOpenAPIError {
body : localVarBody ,
error : localVarHTTPResponse . Status ,
}
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
}