api-v1, 2nd iter

This commit is contained in:
Quentin 2023-11-22 21:17:35 +01:00
parent bdb4b9b29f
commit f442d10b10
Signed by: quentin
GPG Key ID: E9602264D639FF68
7 changed files with 268 additions and 638 deletions

View File

@ -9,7 +9,7 @@ Administrate your Garage cluster programatically, including status, layout, keys
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client.
- API version: v0.9.0
- Package version: 0.8.0
- Package version: 0.9.0
- Build package: org.openapitools.codegen.languages.GoClientCodegen
## Installation
@ -83,23 +83,21 @@ Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*BucketApi* | [**AllowBucketKey**](docs/BucketApi.md#allowbucketkey) | **Post** /bucket/allow | Allow key
*BucketApi* | [**CreateBucket**](docs/BucketApi.md#createbucket) | **Post** /bucket | Create a bucket
*BucketApi* | [**DeleteBucket**](docs/BucketApi.md#deletebucket) | **Delete** /bucket?id={bucket_id} | Delete a bucket
*BucketApi* | [**DeleteBucket**](docs/BucketApi.md#deletebucket) | **Delete** /bucket | Delete a bucket
*BucketApi* | [**DeleteBucketGlobalAlias**](docs/BucketApi.md#deletebucketglobalalias) | **Delete** /bucket/alias/global | Delete a global alias
*BucketApi* | [**DeleteBucketLocalAlias**](docs/BucketApi.md#deletebucketlocalalias) | **Delete** /bucket/alias/local | Delete a local alias
*BucketApi* | [**DenyBucketKey**](docs/BucketApi.md#denybucketkey) | **Post** /bucket/deny | Deny key
*BucketApi* | [**FindBucketInfo**](docs/BucketApi.md#findbucketinfo) | **Get** /bucket?globalAlias={alias} | Find a bucket
*BucketApi* | [**GetBucketInfo**](docs/BucketApi.md#getbucketinfo) | **Get** /bucket?id={bucket_id} | Get a bucket
*BucketApi* | [**ListBuckets**](docs/BucketApi.md#listbuckets) | **Get** /bucket | List all buckets
*BucketApi* | [**GetBucketInfo**](docs/BucketApi.md#getbucketinfo) | **Get** /bucket | Get a bucket
*BucketApi* | [**ListBuckets**](docs/BucketApi.md#listbuckets) | **Get** /bucket?list | List all buckets
*BucketApi* | [**PutBucketGlobalAlias**](docs/BucketApi.md#putbucketglobalalias) | **Put** /bucket/alias/global | Add a global alias
*BucketApi* | [**PutBucketLocalAlias**](docs/BucketApi.md#putbucketlocalalias) | **Put** /bucket/alias/local | Add a local alias
*BucketApi* | [**UpdateBucket**](docs/BucketApi.md#updatebucket) | **Put** /bucket?id={bucket_id} | Update a bucket
*KeyApi* | [**AddKey**](docs/KeyApi.md#addkey) | **Post** /key | Create a new API key
*KeyApi* | [**DeleteKey**](docs/KeyApi.md#deletekey) | **Delete** /key?id={access_key} | Delete a key
*KeyApi* | [**GetKey**](docs/KeyApi.md#getkey) | **Get** /key?id={access_key} | Get key information
*BucketApi* | [**UpdateBucket**](docs/BucketApi.md#updatebucket) | **Put** /bucket | Update a bucket
*KeyApi* | [**AddKey**](docs/KeyApi.md#addkey) | **Post** /key?list | Create a new API key
*KeyApi* | [**DeleteKey**](docs/KeyApi.md#deletekey) | **Delete** /key | Delete a key
*KeyApi* | [**GetKey**](docs/KeyApi.md#getkey) | **Get** /key | Get key information
*KeyApi* | [**ImportKey**](docs/KeyApi.md#importkey) | **Post** /key/import | Import an existing key
*KeyApi* | [**ListKeys**](docs/KeyApi.md#listkeys) | **Get** /key | List all keys
*KeyApi* | [**SearchKey**](docs/KeyApi.md#searchkey) | **Get** /key?search={pattern} | Select key by pattern
*KeyApi* | [**UpdateKey**](docs/KeyApi.md#updatekey) | **Post** /key?id={access_key} | Update a key
*KeyApi* | [**ListKeys**](docs/KeyApi.md#listkeys) | **Get** /key?list | List all keys
*KeyApi* | [**UpdateKey**](docs/KeyApi.md#updatekey) | **Post** /key | Update a key
*LayoutApi* | [**AddLayout**](docs/LayoutApi.md#addlayout) | **Post** /layout | Send modifications to the cluster layout
*LayoutApi* | [**ApplyLayout**](docs/LayoutApi.md#applylayout) | **Post** /layout/apply | Apply staged layout
*LayoutApi* | [**GetLayout**](docs/LayoutApi.md#getlayout) | **Get** /layout | Details on the current and staged layout

View File

@ -203,7 +203,7 @@ paths:
summary: Clear staged layout
tags:
- Layout
/key:
/key?list:
get:
description: |
Returns all API access keys in the cluster.
@ -259,7 +259,7 @@ paths:
summary: Create a new API key
tags:
- Key
/key?id={access_key}:
/key:
delete:
description: "Delete a key from the cluster. Its access will be removed from\
\ all the buckets. Buckets are not automatically deleted and can be dangling.\
@ -286,29 +286,48 @@ paths:
- Key
get:
description: "Return information about a specific key like its identifiers,\
\ its permissions and buckets on which it has permissions. \n\nFor confidentiality\
\ reasons, the secret key is not returned by default: you must pass the `showSecretKey`\
\ query parameter to get it.\n"
\ its permissions and buckets on which it has permissions. \nYou can search\
\ by specifying the exact key identifier (`id`) or by specifying a pattern\
\ (`search`).\n\nFor confidentiality reasons, the secret key is not returned\
\ by default: you must pass the `showSecretKey` query parameter to get it.\n"
operationId: GetKey
parameters:
- description: The exact API access key generated by Garage
- description: |
The exact API access key generated by Garage.
Incompatible with `search`.
example: GK31c2f218a2e44f485b94239e
explode: false
in: path
name: access_key
required: true
explode: true
in: query
name: id
required: false
schema:
type: string
style: simple
style: form
- description: |
A pattern (beginning or full string) corresponding to a key identifier or friendly name.
Incompatible with `id`.
example: test-k
explode: true
in: query
name: search
required: false
schema:
type: string
style: form
- description: Wether or not the secret key should be returned in the response
example: true
example: "true"
explode: true
in: query
name: showSecretKey
required: false
schema:
default: false
type: boolean
default: "false"
enum:
- "true"
- "false"
type: string
style: form
responses:
"500":
@ -364,48 +383,6 @@ paths:
summary: Update a key
tags:
- Key
/key?search={pattern}:
get:
description: |
Find the first key matching the given pattern based on its identifier or friendly name and return its information.
For confidentiality reasons, the secret key is not returned by default: you must pass the `showSecretKey` query parameter to get it.
operationId: SearchKey
parameters:
- description: A pattern (beginning or full string) corresponding to a key identifier
or friendly name
example: test-k
explode: false
in: path
name: pattern
required: true
schema:
type: string
style: simple
- description: Wether or not the secret key should be returned in the response
example: true
explode: true
in: query
name: showSecretKey
required: false
schema:
default: false
type: boolean
style: form
responses:
"500":
description: The server can not handle your request. Check your connectivity
with the rest of the cluster.
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/KeyInfo'
description: |
Returns information about the key
summary: Select key by pattern
tags:
- Key
/key/import:
post:
description: |
@ -436,7 +413,7 @@ paths:
summary: Import an existing key
tags:
- Key
/bucket:
/bucket?list:
get:
description: |
List all the buckets on the cluster with their UUID and their global and local aliases.
@ -475,6 +452,83 @@ paths:
summary: List all buckets
tags:
- Bucket
/bucket:
delete:
description: |
Delete a bucket.Deletes a storage bucket. A bucket cannot be deleted if it is not empty.
**Warning:** this will delete all aliases associated with the bucket!
operationId: DeleteBucket
parameters:
- description: "The exact bucket identifier, a 32 bytes hexadecimal string"
example: b4018dc61b27ccb5c64ec1b24f53454bbbd180697c758c4d47a22a8921864a87
explode: true
in: query
name: id
required: true
schema:
type: string
style: form
responses:
"500":
description: The server can not handle your request. Check your connectivity
with the rest of the cluster.
"400":
description: Bucket is not empty
"404":
description: Bucket not found
"204":
description: Bucket has been deleted
summary: Delete a bucket
tags:
- Bucket
get:
description: |
Given a bucket identifier (`id`) or a global alias (`alias`), get its information.
It includes its aliases, its web configuration, keys that have some permissions
on it, some statistics (number of objects, size), number of dangling multipart uploads,
and its quotas (if any).
operationId: GetBucketInfo
parameters:
- description: |
The exact bucket identifier, a 32 bytes hexadecimal string.
Incompatible with `alias`.
example: b4018dc61b27ccb5c64ec1b24f53454bbbd180697c758c4d47a22a8921864a87
explode: true
in: query
name: id
required: false
schema:
type: string
style: form
- description: |
The exact global alias of one of the existing buckets.
Incompatible with `id`.
example: my_documents
explode: true
in: query
name: alias
required: false
schema:
type: string
style: form
responses:
"500":
description: The server can not handle your request. Check your connectivity
with the rest of the cluster.
"404":
description: Bucket not found
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/BucketInfo'
description: Returns exhaustive information about the bucket
summary: Get a bucket
tags:
- Bucket
post:
description: |
Creates a new bucket, either with a global alias, a local one, or no alias at all.
@ -503,68 +557,6 @@ paths:
summary: Create a bucket
tags:
- Bucket
/bucket?id={bucket_id}:
delete:
description: |
Delete a bucket.Deletes a storage bucket. A bucket cannot be deleted if it is not empty.
**Warning:** this will delete all aliases associated with the bucket!
operationId: DeleteBucket
parameters:
- description: "The exact bucket identifier, a 32 bytes hexadecimal string"
example: b4018dc61b27ccb5c64ec1b24f53454bbbd180697c758c4d47a22a8921864a87
explode: false
in: path
name: bucket_id
required: true
schema:
type: string
style: simple
responses:
"500":
description: The server can not handle your request. Check your connectivity
with the rest of the cluster.
"400":
description: Bucket is not empty
"404":
description: Bucket not found
"204":
description: Bucket has been deleted
summary: Delete a bucket
tags:
- Bucket
get:
description: |
Given a bucket identifier, get its information.
It includes its aliases, its web configuration, keys that have some permissions
on it, some statistics (number of objects, size), number of dangling multipart uploads,
and its quotas (if any).
operationId: GetBucketInfo
parameters:
- description: "The exact bucket identifier, a 32 bytes hexadecimal string"
example: b4018dc61b27ccb5c64ec1b24f53454bbbd180697c758c4d47a22a8921864a87
explode: false
in: path
name: bucket_id
required: true
schema:
type: string
style: simple
responses:
"500":
description: The server can not handle your request. Check your connectivity
with the rest of the cluster.
"404":
description: Bucket not found
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/BucketInfo'
description: Returns exhaustive information about the bucket
summary: Get a bucket
tags:
- Bucket
put:
description: |
All fields (`websiteAccess` and `quotas`) are optional.
@ -582,13 +574,13 @@ paths:
parameters:
- description: "The exact bucket identifier, a 32 bytes hexadecimal string"
example: b4018dc61b27ccb5c64ec1b24f53454bbbd180697c758c4d47a22a8921864a87
explode: false
in: path
name: bucket_id
explode: true
in: query
name: id
required: true
schema:
type: string
style: simple
style: form
requestBody:
content:
application/json:
@ -614,36 +606,6 @@ paths:
summary: Update a bucket
tags:
- Bucket
/bucket?globalAlias={alias}:
get:
description: |
Find a bucket by its global alias
operationId: FindBucketInfo
parameters:
- description: The exact global alias of one of the existing buckets
example: my_documents
explode: false
in: path
name: alias
required: true
schema:
type: string
style: simple
responses:
"500":
description: The server can not handle your request. Check your connectivity
with the rest of the cluster.
"404":
description: Bucket not found
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/BucketInfo'
description: Returns exhaustive information about the bucket
summary: Find a bucket
tags:
- Bucket
/bucket/allow:
post:
description: |
@ -1458,6 +1420,38 @@ components:
required:
- id
type: object
UpdateBucket_request_websiteAccess:
properties:
enabled:
example: true
type: boolean
indexDocument:
example: index.html
type: string
errorDocument:
example: error/400.html
type: string
type: object
UpdateBucket_request_quotas:
properties:
maxSize:
example: 19029801
format: int64
nullable: true
type: integer
maxObjects:
format: int64
nullable: true
type: integer
example: null
type: object
UpdateBucket_request:
properties:
websiteAccess:
$ref: '#/components/schemas/UpdateBucket_request_websiteAccess'
quotas:
$ref: '#/components/schemas/UpdateBucket_request_quotas'
type: object
CreateBucket_request_localAlias_allow:
example:
owner: true
@ -1491,38 +1485,6 @@ components:
localAlias:
$ref: '#/components/schemas/CreateBucket_request_localAlias'
type: object
UpdateBucket_request_websiteAccess:
properties:
enabled:
example: true
type: boolean
indexDocument:
example: index.html
type: string
errorDocument:
example: error/400.html
type: string
type: object
UpdateBucket_request_quotas:
properties:
maxSize:
example: 19029801
format: int64
nullable: true
type: integer
maxObjects:
format: int64
nullable: true
type: integer
example: null
type: object
UpdateBucket_request:
properties:
websiteAccess:
$ref: '#/components/schemas/UpdateBucket_request_websiteAccess'
quotas:
$ref: '#/components/schemas/UpdateBucket_request_quotas'
type: object
AllowBucketKey_request_permissions:
properties:
read:

View File

@ -16,7 +16,6 @@ import (
"io/ioutil"
"net/http"
"net/url"
"strings"
)
@ -259,7 +258,13 @@ func (a *BucketApiService) CreateBucketExecute(r ApiCreateBucketRequest) (*Bucke
type ApiDeleteBucketRequest struct {
ctx context.Context
ApiService *BucketApiService
bucketId string
id *string
}
// The exact bucket identifier, a 32 bytes hexadecimal string
func (r ApiDeleteBucketRequest) Id(id string) ApiDeleteBucketRequest {
r.id = &id
return r
}
func (r ApiDeleteBucketRequest) Execute() (*http.Response, error) {
@ -275,14 +280,12 @@ Delete a bucket.Deletes a storage bucket. A bucket cannot be deleted if it is no
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param bucketId The exact bucket identifier, a 32 bytes hexadecimal string
@return ApiDeleteBucketRequest
*/
func (a *BucketApiService) DeleteBucket(ctx context.Context, bucketId string) ApiDeleteBucketRequest {
func (a *BucketApiService) DeleteBucket(ctx context.Context) ApiDeleteBucketRequest {
return ApiDeleteBucketRequest{
ApiService: a,
ctx: ctx,
bucketId: bucketId,
}
}
@ -299,13 +302,16 @@ func (a *BucketApiService) DeleteBucketExecute(r ApiDeleteBucketRequest) (*http.
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/bucket?id={bucket_id}"
localVarPath = strings.Replace(localVarPath, "{"+"bucket_id"+"}", url.PathEscape(parameterToString(r.bucketId, "")), -1)
localVarPath := localBasePath + "/bucket"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.id == nil {
return nil, reportError("id is required and must be specified")
}
localVarQueryParams.Add("id", parameterToString(*r.id, ""))
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
@ -721,114 +727,23 @@ func (a *BucketApiService) DenyBucketKeyExecute(r ApiDenyBucketKeyRequest) (*Buc
return localVarReturnValue, localVarHTTPResponse, nil
}
type ApiFindBucketInfoRequest struct {
ctx context.Context
ApiService *BucketApiService
alias string
}
func (r ApiFindBucketInfoRequest) Execute() (*BucketInfo, *http.Response, error) {
return r.ApiService.FindBucketInfoExecute(r)
}
/*
FindBucketInfo Find a bucket
Find a bucket by its global alias
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param alias The exact global alias of one of the existing buckets
@return ApiFindBucketInfoRequest
*/
func (a *BucketApiService) FindBucketInfo(ctx context.Context, alias string) ApiFindBucketInfoRequest {
return ApiFindBucketInfoRequest{
ApiService: a,
ctx: ctx,
alias: alias,
}
}
// Execute executes the request
// @return BucketInfo
func (a *BucketApiService) FindBucketInfoExecute(r ApiFindBucketInfoRequest) (*BucketInfo, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *BucketInfo
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BucketApiService.FindBucketInfo")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/bucket?globalAlias={alias}"
localVarPath = strings.Replace(localVarPath, "{"+"alias"+"}", url.PathEscape(parameterToString(r.alias, "")), -1)
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 ApiGetBucketInfoRequest struct {
ctx context.Context
ApiService *BucketApiService
bucketId string
id *string
alias *string
}
// The exact bucket identifier, a 32 bytes hexadecimal string. Incompatible with `alias`.
func (r ApiGetBucketInfoRequest) Id(id string) ApiGetBucketInfoRequest {
r.id = &id
return r
}
// The exact global alias of one of the existing buckets. Incompatible with `id`.
func (r ApiGetBucketInfoRequest) Alias(alias string) ApiGetBucketInfoRequest {
r.alias = &alias
return r
}
func (r ApiGetBucketInfoRequest) Execute() (*BucketInfo, *http.Response, error) {
@ -838,21 +753,19 @@ func (r ApiGetBucketInfoRequest) Execute() (*BucketInfo, *http.Response, error)
/*
GetBucketInfo Get a bucket
Given a bucket identifier, get its information.
Given a bucket identifier (`id`) or a global alias (`alias`), get its information.
It includes its aliases, its web configuration, keys that have some permissions
on it, some statistics (number of objects, size), number of dangling multipart uploads,
and its quotas (if any).
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param bucketId The exact bucket identifier, a 32 bytes hexadecimal string
@return ApiGetBucketInfoRequest
*/
func (a *BucketApiService) GetBucketInfo(ctx context.Context, bucketId string) ApiGetBucketInfoRequest {
func (a *BucketApiService) GetBucketInfo(ctx context.Context) ApiGetBucketInfoRequest {
return ApiGetBucketInfoRequest{
ApiService: a,
ctx: ctx,
bucketId: bucketId,
}
}
@ -871,13 +784,18 @@ func (a *BucketApiService) GetBucketInfoExecute(r ApiGetBucketInfoRequest) (*Buc
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/bucket?id={bucket_id}"
localVarPath = strings.Replace(localVarPath, "{"+"bucket_id"+"}", url.PathEscape(parameterToString(r.bucketId, "")), -1)
localVarPath := localBasePath + "/bucket"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.id != nil {
localVarQueryParams.Add("id", parameterToString(*r.id, ""))
}
if r.alias != nil {
localVarQueryParams.Add("alias", parameterToString(*r.alias, ""))
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
@ -972,7 +890,7 @@ func (a *BucketApiService) ListBucketsExecute(r ApiListBucketsRequest) ([]ListBu
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/bucket"
localVarPath := localBasePath + "/bucket?list"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
@ -1285,10 +1203,16 @@ func (a *BucketApiService) PutBucketLocalAliasExecute(r ApiPutBucketLocalAliasRe
type ApiUpdateBucketRequest struct {
ctx context.Context
ApiService *BucketApiService
bucketId string
id *string
updateBucketRequest *UpdateBucketRequest
}
// The exact bucket identifier, a 32 bytes hexadecimal string
func (r ApiUpdateBucketRequest) Id(id string) ApiUpdateBucketRequest {
r.id = &id
return r
}
// Requested changes on the bucket. Both root fields are optionals.
func (r ApiUpdateBucketRequest) UpdateBucketRequest(updateBucketRequest UpdateBucketRequest) ApiUpdateBucketRequest {
r.updateBucketRequest = &updateBucketRequest
@ -1316,14 +1240,12 @@ to change only one of the two quotas.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param bucketId The exact bucket identifier, a 32 bytes hexadecimal string
@return ApiUpdateBucketRequest
*/
func (a *BucketApiService) UpdateBucket(ctx context.Context, bucketId string) ApiUpdateBucketRequest {
func (a *BucketApiService) UpdateBucket(ctx context.Context) ApiUpdateBucketRequest {
return ApiUpdateBucketRequest{
ApiService: a,
ctx: ctx,
bucketId: bucketId,
}
}
@ -1342,16 +1264,19 @@ func (a *BucketApiService) UpdateBucketExecute(r ApiUpdateBucketRequest) (*Bucke
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/bucket?id={bucket_id}"
localVarPath = strings.Replace(localVarPath, "{"+"bucket_id"+"}", url.PathEscape(parameterToString(r.bucketId, "")), -1)
localVarPath := localBasePath + "/bucket"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.id == nil {
return localVarReturnValue, nil, reportError("id is required and must be specified")
}
if r.updateBucketRequest == nil {
return localVarReturnValue, nil, reportError("updateBucketRequest is required and must be specified")
}
localVarQueryParams.Add("id", parameterToString(*r.id, ""))
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"application/json"}

View File

@ -70,7 +70,7 @@ func (a *KeyApiService) AddKeyExecute(r ApiAddKeyRequest) (*KeyInfo, *http.Respo
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/key"
localVarPath := localBasePath + "/key?list"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
@ -176,7 +176,7 @@ func (a *KeyApiService) DeleteKeyExecute(r ApiDeleteKeyRequest) (*http.Response,
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/key?id={access_key}"
localVarPath := localBasePath + "/key"
localVarPath = strings.Replace(localVarPath, "{"+"access_key"+"}", url.PathEscape(parameterToString(r.accessKey, "")), -1)
localVarHeaderParams := make(map[string]string)
@ -231,12 +231,25 @@ func (a *KeyApiService) DeleteKeyExecute(r ApiDeleteKeyRequest) (*http.Response,
type ApiGetKeyRequest struct {
ctx context.Context
ApiService *KeyApiService
accessKey string
showSecretKey *bool
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
}
// Wether or not the secret key should be returned in the response
func (r ApiGetKeyRequest) ShowSecretKey(showSecretKey bool) ApiGetKeyRequest {
func (r ApiGetKeyRequest) ShowSecretKey(showSecretKey string) ApiGetKeyRequest {
r.showSecretKey = &showSecretKey
return r
}
@ -249,19 +262,18 @@ func (r ApiGetKeyRequest) Execute() (*KeyInfo, *http.Response, error) {
GetKey Get key information
Return information about a specific key like its identifiers, its permissions and buckets on which it has permissions.
You can search by specifying the exact key identifier (`id`) or by specifying a pattern (`search`).
For confidentiality reasons, the secret key is not returned by default: you must pass the `showSecretKey` query parameter to get it.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param accessKey The exact API access key generated by Garage
@return ApiGetKeyRequest
*/
func (a *KeyApiService) GetKey(ctx context.Context, accessKey string) ApiGetKeyRequest {
func (a *KeyApiService) GetKey(ctx context.Context) ApiGetKeyRequest {
return ApiGetKeyRequest{
ApiService: a,
ctx: ctx,
accessKey: accessKey,
}
}
@ -280,13 +292,18 @@ func (a *KeyApiService) GetKeyExecute(r ApiGetKeyRequest) (*KeyInfo, *http.Respo
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/key?id={access_key}"
localVarPath = strings.Replace(localVarPath, "{"+"access_key"+"}", url.PathEscape(parameterToString(r.accessKey, "")), -1)
localVarPath := localBasePath + "/key"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.id != nil {
localVarQueryParams.Add("id", parameterToString(*r.id, ""))
}
if r.search != nil {
localVarQueryParams.Add("search", parameterToString(*r.search, ""))
}
if r.showSecretKey != nil {
localVarQueryParams.Add("showSecretKey", parameterToString(*r.showSecretKey, ""))
}
@ -498,7 +515,7 @@ func (a *KeyApiService) ListKeysExecute(r ApiListKeysRequest) ([]ListKeys200Resp
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/key"
localVarPath := localBasePath + "/key?list"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
@ -558,122 +575,6 @@ func (a *KeyApiService) ListKeysExecute(r ApiListKeysRequest) ([]ListKeys200Resp
return localVarReturnValue, localVarHTTPResponse, nil
}
type ApiSearchKeyRequest struct {
ctx context.Context
ApiService *KeyApiService
pattern string
showSecretKey *bool
}
// Wether or not the secret key should be returned in the response
func (r ApiSearchKeyRequest) ShowSecretKey(showSecretKey bool) ApiSearchKeyRequest {
r.showSecretKey = &showSecretKey
return r
}
func (r ApiSearchKeyRequest) Execute() (*KeyInfo, *http.Response, error) {
return r.ApiService.SearchKeyExecute(r)
}
/*
SearchKey Select key by pattern
Find the first key matching the given pattern based on its identifier or friendly name and return its information.
For confidentiality reasons, the secret key is not returned by default: you must pass the `showSecretKey` query parameter to get it.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param pattern A pattern (beginning or full string) corresponding to a key identifier or friendly name
@return ApiSearchKeyRequest
*/
func (a *KeyApiService) SearchKey(ctx context.Context, pattern string) ApiSearchKeyRequest {
return ApiSearchKeyRequest{
ApiService: a,
ctx: ctx,
pattern: pattern,
}
}
// Execute executes the request
// @return KeyInfo
func (a *KeyApiService) SearchKeyExecute(r ApiSearchKeyRequest) (*KeyInfo, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *KeyInfo
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KeyApiService.SearchKey")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/key?search={pattern}"
localVarPath = strings.Replace(localVarPath, "{"+"pattern"+"}", url.PathEscape(parameterToString(r.pattern, "")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.showSecretKey != nil {
localVarQueryParams.Add("showSecretKey", parameterToString(*r.showSecretKey, ""))
}
// 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
@ -726,7 +627,7 @@ func (a *KeyApiService) UpdateKeyExecute(r ApiUpdateKeyRequest) (*KeyInfo, *http
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/key?id={access_key}"
localVarPath := localBasePath + "/key"
localVarPath = strings.Replace(localVarPath, "{"+"access_key"+"}", url.PathEscape(parameterToString(r.accessKey, "")), -1)
localVarHeaderParams := make(map[string]string)

View File

@ -101,7 +101,7 @@ type Configuration struct {
func NewConfiguration() *Configuration {
cfg := &Configuration{
DefaultHeader: make(map[string]string),
UserAgent: "OpenAPI-Generator/0.8.0/go",
UserAgent: "OpenAPI-Generator/0.9.0/go",
Debug: false,
Servers: ServerConfigurations{
{

View File

@ -6,16 +6,15 @@ Method | HTTP request | Description
------------- | ------------- | -------------
[**AllowBucketKey**](BucketApi.md#AllowBucketKey) | **Post** /bucket/allow | Allow key
[**CreateBucket**](BucketApi.md#CreateBucket) | **Post** /bucket | Create a bucket
[**DeleteBucket**](BucketApi.md#DeleteBucket) | **Delete** /bucket?id={bucket_id} | Delete a bucket
[**DeleteBucket**](BucketApi.md#DeleteBucket) | **Delete** /bucket | Delete a bucket
[**DeleteBucketGlobalAlias**](BucketApi.md#DeleteBucketGlobalAlias) | **Delete** /bucket/alias/global | Delete a global alias
[**DeleteBucketLocalAlias**](BucketApi.md#DeleteBucketLocalAlias) | **Delete** /bucket/alias/local | Delete a local alias
[**DenyBucketKey**](BucketApi.md#DenyBucketKey) | **Post** /bucket/deny | Deny key
[**FindBucketInfo**](BucketApi.md#FindBucketInfo) | **Get** /bucket?globalAlias={alias} | Find a bucket
[**GetBucketInfo**](BucketApi.md#GetBucketInfo) | **Get** /bucket?id={bucket_id} | Get a bucket
[**ListBuckets**](BucketApi.md#ListBuckets) | **Get** /bucket | List all buckets
[**GetBucketInfo**](BucketApi.md#GetBucketInfo) | **Get** /bucket | Get a bucket
[**ListBuckets**](BucketApi.md#ListBuckets) | **Get** /bucket?list | List all buckets
[**PutBucketGlobalAlias**](BucketApi.md#PutBucketGlobalAlias) | **Put** /bucket/alias/global | Add a global alias
[**PutBucketLocalAlias**](BucketApi.md#PutBucketLocalAlias) | **Put** /bucket/alias/local | Add a local alias
[**UpdateBucket**](BucketApi.md#UpdateBucket) | **Put** /bucket?id={bucket_id} | Update a bucket
[**UpdateBucket**](BucketApi.md#UpdateBucket) | **Put** /bucket | Update a bucket
@ -153,7 +152,7 @@ Name | Type | Description | Notes
## DeleteBucket
> DeleteBucket(ctx, bucketId).Execute()
> DeleteBucket(ctx).Id(id).Execute()
Delete a bucket
@ -172,11 +171,11 @@ import (
)
func main() {
bucketId := "b4018dc61b27ccb5c64ec1b24f53454bbbd180697c758c4d47a22a8921864a87" // string | The exact bucket identifier, a 32 bytes hexadecimal string
id := "b4018dc61b27ccb5c64ec1b24f53454bbbd180697c758c4d47a22a8921864a87" // string | The exact bucket identifier, a 32 bytes hexadecimal string
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.BucketApi.DeleteBucket(context.Background(), bucketId).Execute()
resp, r, err := apiClient.BucketApi.DeleteBucket(context.Background()).Id(id).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `BucketApi.DeleteBucket``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
@ -187,10 +186,6 @@ func main() {
### Path Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**bucketId** | **string** | The exact bucket identifier, a 32 bytes hexadecimal string |
### Other Parameters
@ -199,7 +194,7 @@ Other parameters are passed through a pointer to a apiDeleteBucketRequest struct
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **string** | The exact bucket identifier, a 32 bytes hexadecimal string |
### Return type
@ -423,79 +418,9 @@ Name | Type | Description | Notes
[[Back to README]](../README.md)
## FindBucketInfo
> BucketInfo FindBucketInfo(ctx, alias).Execute()
Find a bucket
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
alias := "my_documents" // string | The exact global alias of one of the existing buckets
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.BucketApi.FindBucketInfo(context.Background(), alias).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `BucketApi.FindBucketInfo``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `FindBucketInfo`: BucketInfo
fmt.Fprintf(os.Stdout, "Response from `BucketApi.FindBucketInfo`: %v\n", resp)
}
```
### Path Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**alias** | **string** | The exact global alias of one of the existing buckets |
### Other Parameters
Other parameters are passed through a pointer to a apiFindBucketInfoRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
### Return type
[**BucketInfo**](BucketInfo.md)
### Authorization
[bearerAuth](../README.md#bearerAuth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
[[Back to Model list]](../README.md#documentation-for-models)
[[Back to README]](../README.md)
## GetBucketInfo
> BucketInfo GetBucketInfo(ctx, bucketId).Execute()
> BucketInfo GetBucketInfo(ctx).Id(id).Alias(alias).Execute()
Get a bucket
@ -514,11 +439,12 @@ import (
)
func main() {
bucketId := "b4018dc61b27ccb5c64ec1b24f53454bbbd180697c758c4d47a22a8921864a87" // string | The exact bucket identifier, a 32 bytes hexadecimal string
id := "b4018dc61b27ccb5c64ec1b24f53454bbbd180697c758c4d47a22a8921864a87" // string | The exact bucket identifier, a 32 bytes hexadecimal string. Incompatible with `alias`. (optional)
alias := "my_documents" // string | The exact global alias of one of the existing buckets. Incompatible with `id`. (optional)
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.BucketApi.GetBucketInfo(context.Background(), bucketId).Execute()
resp, r, err := apiClient.BucketApi.GetBucketInfo(context.Background()).Id(id).Alias(alias).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `BucketApi.GetBucketInfo``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
@ -531,10 +457,6 @@ func main() {
### Path Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**bucketId** | **string** | The exact bucket identifier, a 32 bytes hexadecimal string |
### Other Parameters
@ -543,7 +465,8 @@ Other parameters are passed through a pointer to a apiGetBucketInfoRequest struc
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **string** | The exact bucket identifier, a 32 bytes hexadecimal string. Incompatible with `alias`. |
**alias** | **string** | The exact global alias of one of the existing buckets. Incompatible with `id`. |
### Return type
@ -764,7 +687,7 @@ Name | Type | Description | Notes
## UpdateBucket
> BucketInfo UpdateBucket(ctx, bucketId).UpdateBucketRequest(updateBucketRequest).Execute()
> BucketInfo UpdateBucket(ctx).Id(id).UpdateBucketRequest(updateBucketRequest).Execute()
Update a bucket
@ -783,12 +706,12 @@ import (
)
func main() {
bucketId := "b4018dc61b27ccb5c64ec1b24f53454bbbd180697c758c4d47a22a8921864a87" // string | The exact bucket identifier, a 32 bytes hexadecimal string
id := "b4018dc61b27ccb5c64ec1b24f53454bbbd180697c758c4d47a22a8921864a87" // string | The exact bucket identifier, a 32 bytes hexadecimal string
updateBucketRequest := *openapiclient.NewUpdateBucketRequest() // UpdateBucketRequest | Requested changes on the bucket. Both root fields are optionals.
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.BucketApi.UpdateBucket(context.Background(), bucketId).UpdateBucketRequest(updateBucketRequest).Execute()
resp, r, err := apiClient.BucketApi.UpdateBucket(context.Background()).Id(id).UpdateBucketRequest(updateBucketRequest).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `BucketApi.UpdateBucket``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
@ -801,10 +724,6 @@ func main() {
### Path Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**bucketId** | **string** | The exact bucket identifier, a 32 bytes hexadecimal string |
### Other Parameters
@ -813,7 +732,7 @@ Other parameters are passed through a pointer to a apiUpdateBucketRequest struct
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **string** | The exact bucket identifier, a 32 bytes hexadecimal string |
**updateBucketRequest** | [**UpdateBucketRequest**](UpdateBucketRequest.md) | Requested changes on the bucket. Both root fields are optionals. |
### Return type

View File

@ -4,13 +4,12 @@ All URIs are relative to *http://localhost:3903/v1*
Method | HTTP request | Description
------------- | ------------- | -------------
[**AddKey**](KeyApi.md#AddKey) | **Post** /key | Create a new API key
[**DeleteKey**](KeyApi.md#DeleteKey) | **Delete** /key?id={access_key} | Delete a key
[**GetKey**](KeyApi.md#GetKey) | **Get** /key?id={access_key} | Get key information
[**AddKey**](KeyApi.md#AddKey) | **Post** /key?list | Create a new API key
[**DeleteKey**](KeyApi.md#DeleteKey) | **Delete** /key | Delete a key
[**GetKey**](KeyApi.md#GetKey) | **Get** /key | Get key information
[**ImportKey**](KeyApi.md#ImportKey) | **Post** /key/import | Import an existing key
[**ListKeys**](KeyApi.md#ListKeys) | **Get** /key | List all keys
[**SearchKey**](KeyApi.md#SearchKey) | **Get** /key?search={pattern} | Select key by pattern
[**UpdateKey**](KeyApi.md#UpdateKey) | **Post** /key?id={access_key} | Update a key
[**ListKeys**](KeyApi.md#ListKeys) | **Get** /key?list | List all keys
[**UpdateKey**](KeyApi.md#UpdateKey) | **Post** /key | Update a key
@ -150,7 +149,7 @@ Name | Type | Description | Notes
## GetKey
> KeyInfo GetKey(ctx, accessKey).ShowSecretKey(showSecretKey).Execute()
> KeyInfo GetKey(ctx).Id(id).Search(search).ShowSecretKey(showSecretKey).Execute()
Get key information
@ -169,12 +168,13 @@ import (
)
func main() {
accessKey := "GK31c2f218a2e44f485b94239e" // string | The exact API access key generated by Garage
showSecretKey := true // bool | Wether or not the secret key should be returned in the response (optional) (default to false)
id := "GK31c2f218a2e44f485b94239e" // string | The exact API access key generated by Garage. Incompatible with `search`. (optional)
search := "test-k" // string | A pattern (beginning or full string) corresponding to a key identifier or friendly name. Incompatible with `id`. (optional)
showSecretKey := "true" // string | Wether or not the secret key should be returned in the response (optional) (default to "false")
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.KeyApi.GetKey(context.Background(), accessKey).ShowSecretKey(showSecretKey).Execute()
resp, r, err := apiClient.KeyApi.GetKey(context.Background()).Id(id).Search(search).ShowSecretKey(showSecretKey).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `KeyApi.GetKey``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
@ -187,10 +187,6 @@ func main() {
### Path Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**accessKey** | **string** | The exact API access key generated by Garage |
### Other Parameters
@ -199,8 +195,9 @@ Other parameters are passed through a pointer to a apiGetKeyRequest struct via t
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**showSecretKey** | **bool** | Wether or not the secret key should be returned in the response | [default to false]
**id** | **string** | The exact API access key generated by Garage. Incompatible with `search`. |
**search** | **string** | A pattern (beginning or full string) corresponding to a key identifier or friendly name. Incompatible with `id`. |
**showSecretKey** | **string** | Wether or not the secret key should be returned in the response | [default to "false"]
### Return type
@ -347,78 +344,6 @@ Other parameters are passed through a pointer to a apiListKeysRequest struct via
[[Back to README]](../README.md)
## SearchKey
> KeyInfo SearchKey(ctx, pattern).ShowSecretKey(showSecretKey).Execute()
Select key by pattern
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
pattern := "test-k" // string | A pattern (beginning or full string) corresponding to a key identifier or friendly name
showSecretKey := true // bool | Wether or not the secret key should be returned in the response (optional) (default to false)
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.KeyApi.SearchKey(context.Background(), pattern).ShowSecretKey(showSecretKey).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `KeyApi.SearchKey``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `SearchKey`: KeyInfo
fmt.Fprintf(os.Stdout, "Response from `KeyApi.SearchKey`: %v\n", resp)
}
```
### Path Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**pattern** | **string** | A pattern (beginning or full string) corresponding to a key identifier or friendly name |
### Other Parameters
Other parameters are passed through a pointer to a apiSearchKeyRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**showSecretKey** | **bool** | Wether or not the secret key should be returned in the response | [default to false]
### Return type
[**KeyInfo**](KeyInfo.md)
### Authorization
[bearerAuth](../README.md#bearerAuth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
[[Back to Model list]](../README.md#documentation-for-models)
[[Back to README]](../README.md)
## UpdateKey
> KeyInfo UpdateKey(ctx, accessKey).UpdateKeyRequest(updateKeyRequest).Execute()