api-v1 golang #1

Merged
quentin merged 8 commits from v0.9.x into main 2023-11-28 15:36:13 +00:00
7 changed files with 268 additions and 638 deletions
Showing only changes of commit f442d10b10 - Show all commits

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. 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 - API version: v0.9.0
- Package version: 0.8.0 - Package version: 0.9.0
- Build package: org.openapitools.codegen.languages.GoClientCodegen - Build package: org.openapitools.codegen.languages.GoClientCodegen
## Installation ## Installation
@ -83,23 +83,21 @@ Class | Method | HTTP request | Description
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
*BucketApi* | [**AllowBucketKey**](docs/BucketApi.md#allowbucketkey) | **Post** /bucket/allow | Allow key *BucketApi* | [**AllowBucketKey**](docs/BucketApi.md#allowbucketkey) | **Post** /bucket/allow | Allow key
*BucketApi* | [**CreateBucket**](docs/BucketApi.md#createbucket) | **Post** /bucket | Create a bucket *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* | [**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* | [**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* | [**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 | Get 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 | List all buckets
*BucketApi* | [**ListBuckets**](docs/BucketApi.md#listbuckets) | **Get** /bucket | List all buckets
*BucketApi* | [**PutBucketGlobalAlias**](docs/BucketApi.md#putbucketglobalalias) | **Put** /bucket/alias/global | Add a global alias *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* | [**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 *BucketApi* | [**UpdateBucket**](docs/BucketApi.md#updatebucket) | **Put** /bucket | Update a bucket
*KeyApi* | [**AddKey**](docs/KeyApi.md#addkey) | **Post** /key | Create a new API key *KeyApi* | [**AddKey**](docs/KeyApi.md#addkey) | **Post** /key?list | Create a new API key
*KeyApi* | [**DeleteKey**](docs/KeyApi.md#deletekey) | **Delete** /key?id={access_key} | Delete a key *KeyApi* | [**DeleteKey**](docs/KeyApi.md#deletekey) | **Delete** /key | Delete a key
*KeyApi* | [**GetKey**](docs/KeyApi.md#getkey) | **Get** /key?id={access_key} | Get key information *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* | [**ImportKey**](docs/KeyApi.md#importkey) | **Post** /key/import | Import an existing key
*KeyApi* | [**ListKeys**](docs/KeyApi.md#listkeys) | **Get** /key | List all keys *KeyApi* | [**ListKeys**](docs/KeyApi.md#listkeys) | **Get** /key?list | 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 | Update a key
*KeyApi* | [**UpdateKey**](docs/KeyApi.md#updatekey) | **Post** /key?id={access_key} | Update a key
*LayoutApi* | [**AddLayout**](docs/LayoutApi.md#addlayout) | **Post** /layout | Send modifications to the cluster layout *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* | [**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 *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 summary: Clear staged layout
tags: tags:
- Layout - Layout
/key: /key?list:
get: get:
description: | description: |
Returns all API access keys in the cluster. Returns all API access keys in the cluster.
@ -259,7 +259,7 @@ paths:
summary: Create a new API key summary: Create a new API key
tags: tags:
- Key - Key
/key?id={access_key}: /key:
delete: delete:
description: "Delete a key from the cluster. Its access will be removed from\ 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.\ \ all the buckets. Buckets are not automatically deleted and can be dangling.\
@ -286,29 +286,48 @@ paths:
- Key - Key
get: get:
description: "Return information about a specific key like its identifiers,\ description: "Return information about a specific key like its identifiers,\
\ its permissions and buckets on which it has permissions. \n\nFor confidentiality\ \ its permissions and buckets on which it has permissions. \nYou can search\
\ reasons, the secret key is not returned by default: you must pass the `showSecretKey`\ \ by specifying the exact key identifier (`id`) or by specifying a pattern\
\ query parameter to get it.\n" \ (`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 operationId: GetKey
parameters: parameters:
- description: The exact API access key generated by Garage - description: |
The exact API access key generated by Garage.
Incompatible with `search`.
example: GK31c2f218a2e44f485b94239e example: GK31c2f218a2e44f485b94239e
explode: false explode: true
in: path in: query
name: access_key name: id
required: true required: false
schema: schema:
type: string 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 - description: Wether or not the secret key should be returned in the response
example: true example: "true"
explode: true explode: true
in: query in: query
name: showSecretKey name: showSecretKey
required: false required: false
schema: schema:
default: false default: "false"
type: boolean enum:
- "true"
- "false"
type: string
style: form style: form
responses: responses:
"500": "500":
@ -364,48 +383,6 @@ paths:
summary: Update a key summary: Update a key
tags: tags:
- Key - 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: /key/import:
post: post:
description: | description: |
@ -436,7 +413,7 @@ paths:
summary: Import an existing key summary: Import an existing key
tags: tags:
- Key - Key
/bucket: /bucket?list:
get: get:
description: | description: |
List all the buckets on the cluster with their UUID and their global and local aliases. 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 summary: List all buckets
tags: tags:
- Bucket - 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: post:
description: | description: |
Creates a new bucket, either with a global alias, a local one, or no alias at all. 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 summary: Create a bucket
tags: tags:
- Bucket - 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: put:
description: | description: |
All fields (`websiteAccess` and `quotas`) are optional. All fields (`websiteAccess` and `quotas`) are optional.
@ -582,13 +574,13 @@ paths:
parameters: parameters:
- description: "The exact bucket identifier, a 32 bytes hexadecimal string" - description: "The exact bucket identifier, a 32 bytes hexadecimal string"
example: b4018dc61b27ccb5c64ec1b24f53454bbbd180697c758c4d47a22a8921864a87 example: b4018dc61b27ccb5c64ec1b24f53454bbbd180697c758c4d47a22a8921864a87
explode: false explode: true
in: path in: query
name: bucket_id name: id
required: true required: true
schema: schema:
type: string type: string
style: simple style: form
requestBody: requestBody:
content: content:
application/json: application/json:
@ -614,36 +606,6 @@ paths:
summary: Update a bucket summary: Update a bucket
tags: tags:
- Bucket - 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: /bucket/allow:
post: post:
description: | description: |
@ -1458,6 +1420,38 @@ components:
required: required:
- id - id
type: object 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: CreateBucket_request_localAlias_allow:
example: example:
owner: true owner: true
@ -1491,38 +1485,6 @@ components:
localAlias: localAlias:
$ref: '#/components/schemas/CreateBucket_request_localAlias' $ref: '#/components/schemas/CreateBucket_request_localAlias'
type: object 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: AllowBucketKey_request_permissions:
properties: properties:
read: read:

View file

@ -16,7 +16,6 @@ import (
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"net/url" "net/url"
"strings"
) )
@ -259,7 +258,13 @@ func (a *BucketApiService) CreateBucketExecute(r ApiCreateBucketRequest) (*Bucke
type ApiDeleteBucketRequest struct { type ApiDeleteBucketRequest struct {
ctx context.Context ctx context.Context
ApiService *BucketApiService 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) { 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 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 @return ApiDeleteBucketRequest
*/ */
func (a *BucketApiService) DeleteBucket(ctx context.Context, bucketId string) ApiDeleteBucketRequest { func (a *BucketApiService) DeleteBucket(ctx context.Context) ApiDeleteBucketRequest {
return ApiDeleteBucketRequest{ return ApiDeleteBucketRequest{
ApiService: a, ApiService: a,
ctx: ctx, ctx: ctx,
bucketId: bucketId,
} }
} }
@ -299,13 +302,16 @@ func (a *BucketApiService) DeleteBucketExecute(r ApiDeleteBucketRequest) (*http.
return nil, &GenericOpenAPIError{error: err.Error()} return nil, &GenericOpenAPIError{error: err.Error()}
} }
localVarPath := localBasePath + "/bucket?id={bucket_id}" localVarPath := localBasePath + "/bucket"
localVarPath = strings.Replace(localVarPath, "{"+"bucket_id"+"}", url.PathEscape(parameterToString(r.bucketId, "")), -1)
localVarHeaderParams := make(map[string]string) localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{} localVarQueryParams := url.Values{}
localVarFormParams := 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 // to determine the Content-Type header
localVarHTTPContentTypes := []string{} localVarHTTPContentTypes := []string{}
@ -721,114 +727,23 @@ func (a *BucketApiService) DenyBucketKeyExecute(r ApiDenyBucketKeyRequest) (*Buc
return localVarReturnValue, localVarHTTPResponse, nil 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 { type ApiGetBucketInfoRequest struct {
ctx context.Context ctx context.Context
ApiService *BucketApiService 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) { func (r ApiGetBucketInfoRequest) Execute() (*BucketInfo, *http.Response, error) {
@ -838,21 +753,19 @@ func (r ApiGetBucketInfoRequest) Execute() (*BucketInfo, *http.Response, error)
/* /*
GetBucketInfo Get a bucket 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 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, on it, some statistics (number of objects, size), number of dangling multipart uploads,
and its quotas (if any). and its quotas (if any).
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @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 @return ApiGetBucketInfoRequest
*/ */
func (a *BucketApiService) GetBucketInfo(ctx context.Context, bucketId string) ApiGetBucketInfoRequest { func (a *BucketApiService) GetBucketInfo(ctx context.Context) ApiGetBucketInfoRequest {
return ApiGetBucketInfoRequest{ return ApiGetBucketInfoRequest{
ApiService: a, ApiService: a,
ctx: ctx, ctx: ctx,
bucketId: bucketId,
} }
} }
@ -871,13 +784,18 @@ func (a *BucketApiService) GetBucketInfoExecute(r ApiGetBucketInfoRequest) (*Buc
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
} }
localVarPath := localBasePath + "/bucket?id={bucket_id}" localVarPath := localBasePath + "/bucket"
localVarPath = strings.Replace(localVarPath, "{"+"bucket_id"+"}", url.PathEscape(parameterToString(r.bucketId, "")), -1)
localVarHeaderParams := make(map[string]string) localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{} localVarQueryParams := url.Values{}
localVarFormParams := 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 // to determine the Content-Type header
localVarHTTPContentTypes := []string{} localVarHTTPContentTypes := []string{}
@ -972,7 +890,7 @@ func (a *BucketApiService) ListBucketsExecute(r ApiListBucketsRequest) ([]ListBu
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
} }
localVarPath := localBasePath + "/bucket" localVarPath := localBasePath + "/bucket?list"
localVarHeaderParams := make(map[string]string) localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{} localVarQueryParams := url.Values{}
@ -1285,10 +1203,16 @@ func (a *BucketApiService) PutBucketLocalAliasExecute(r ApiPutBucketLocalAliasRe
type ApiUpdateBucketRequest struct { type ApiUpdateBucketRequest struct {
ctx context.Context ctx context.Context
ApiService *BucketApiService ApiService *BucketApiService
bucketId string id *string
updateBucketRequest *UpdateBucketRequest 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. // Requested changes on the bucket. Both root fields are optionals.
func (r ApiUpdateBucketRequest) UpdateBucketRequest(updateBucketRequest UpdateBucketRequest) ApiUpdateBucketRequest { func (r ApiUpdateBucketRequest) UpdateBucketRequest(updateBucketRequest UpdateBucketRequest) ApiUpdateBucketRequest {
r.updateBucketRequest = &updateBucketRequest 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 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 @return ApiUpdateBucketRequest
*/ */
func (a *BucketApiService) UpdateBucket(ctx context.Context, bucketId string) ApiUpdateBucketRequest { func (a *BucketApiService) UpdateBucket(ctx context.Context) ApiUpdateBucketRequest {
return ApiUpdateBucketRequest{ return ApiUpdateBucketRequest{
ApiService: a, ApiService: a,
ctx: ctx, ctx: ctx,
bucketId: bucketId,
} }
} }
@ -1342,16 +1264,19 @@ func (a *BucketApiService) UpdateBucketExecute(r ApiUpdateBucketRequest) (*Bucke
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
} }
localVarPath := localBasePath + "/bucket?id={bucket_id}" localVarPath := localBasePath + "/bucket"
localVarPath = strings.Replace(localVarPath, "{"+"bucket_id"+"}", url.PathEscape(parameterToString(r.bucketId, "")), -1)
localVarHeaderParams := make(map[string]string) localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{} localVarQueryParams := url.Values{}
localVarFormParams := url.Values{} localVarFormParams := url.Values{}
if r.id == nil {
return localVarReturnValue, nil, reportError("id is required and must be specified")
}
if r.updateBucketRequest == nil { if r.updateBucketRequest == nil {
return localVarReturnValue, nil, reportError("updateBucketRequest is required and must be specified") return localVarReturnValue, nil, reportError("updateBucketRequest is required and must be specified")
} }
localVarQueryParams.Add("id", parameterToString(*r.id, ""))
// to determine the Content-Type header // to determine the Content-Type header
localVarHTTPContentTypes := []string{"application/json"} 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()} return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
} }
localVarPath := localBasePath + "/key" localVarPath := localBasePath + "/key?list"
localVarHeaderParams := make(map[string]string) localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{} localVarQueryParams := url.Values{}
@ -176,7 +176,7 @@ func (a *KeyApiService) DeleteKeyExecute(r ApiDeleteKeyRequest) (*http.Response,
return nil, &GenericOpenAPIError{error: err.Error()} 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) localVarPath = strings.Replace(localVarPath, "{"+"access_key"+"}", url.PathEscape(parameterToString(r.accessKey, "")), -1)
localVarHeaderParams := make(map[string]string) localVarHeaderParams := make(map[string]string)
@ -231,12 +231,25 @@ func (a *KeyApiService) DeleteKeyExecute(r ApiDeleteKeyRequest) (*http.Response,
type ApiGetKeyRequest struct { type ApiGetKeyRequest struct {
ctx context.Context ctx context.Context
ApiService *KeyApiService ApiService *KeyApiService
accessKey string id *string
showSecretKey *bool 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 // 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 r.showSecretKey = &showSecretKey
return r return r
} }
@ -249,19 +262,18 @@ func (r ApiGetKeyRequest) Execute() (*KeyInfo, *http.Response, error) {
GetKey Get key information GetKey Get key information
Return information about a specific key like its identifiers, its permissions and buckets on which it has permissions. 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. 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 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 @return ApiGetKeyRequest
*/ */
func (a *KeyApiService) GetKey(ctx context.Context, accessKey string) ApiGetKeyRequest { func (a *KeyApiService) GetKey(ctx context.Context) ApiGetKeyRequest {
return ApiGetKeyRequest{ return ApiGetKeyRequest{
ApiService: a, ApiService: a,
ctx: ctx, ctx: ctx,
accessKey: accessKey,
} }
} }
@ -280,13 +292,18 @@ func (a *KeyApiService) GetKeyExecute(r ApiGetKeyRequest) (*KeyInfo, *http.Respo
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} 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) localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{} localVarQueryParams := url.Values{}
localVarFormParams := 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 { if r.showSecretKey != nil {
localVarQueryParams.Add("showSecretKey", parameterToString(*r.showSecretKey, "")) localVarQueryParams.Add("showSecretKey", parameterToString(*r.showSecretKey, ""))
} }
@ -498,7 +515,7 @@ func (a *KeyApiService) ListKeysExecute(r ApiListKeysRequest) ([]ListKeys200Resp
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
} }
localVarPath := localBasePath + "/key" localVarPath := localBasePath + "/key?list"
localVarHeaderParams := make(map[string]string) localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{} localVarQueryParams := url.Values{}
@ -558,122 +575,6 @@ func (a *KeyApiService) ListKeysExecute(r ApiListKeysRequest) ([]ListKeys200Resp
return localVarReturnValue, localVarHTTPResponse, nil 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 { type ApiUpdateKeyRequest struct {
ctx context.Context ctx context.Context
ApiService *KeyApiService ApiService *KeyApiService
@ -726,7 +627,7 @@ func (a *KeyApiService) UpdateKeyExecute(r ApiUpdateKeyRequest) (*KeyInfo, *http
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} 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) localVarPath = strings.Replace(localVarPath, "{"+"access_key"+"}", url.PathEscape(parameterToString(r.accessKey, "")), -1)
localVarHeaderParams := make(map[string]string) localVarHeaderParams := make(map[string]string)

View file

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

View file

@ -6,16 +6,15 @@ Method | HTTP request | Description
------------- | ------------- | ------------- ------------- | ------------- | -------------
[**AllowBucketKey**](BucketApi.md#AllowBucketKey) | **Post** /bucket/allow | Allow key [**AllowBucketKey**](BucketApi.md#AllowBucketKey) | **Post** /bucket/allow | Allow key
[**CreateBucket**](BucketApi.md#CreateBucket) | **Post** /bucket | Create a bucket [**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 [**DeleteBucketGlobalAlias**](BucketApi.md#DeleteBucketGlobalAlias) | **Delete** /bucket/alias/global | Delete a global alias
[**DeleteBucketLocalAlias**](BucketApi.md#DeleteBucketLocalAlias) | **Delete** /bucket/alias/local | Delete a local alias [**DeleteBucketLocalAlias**](BucketApi.md#DeleteBucketLocalAlias) | **Delete** /bucket/alias/local | Delete a local alias
[**DenyBucketKey**](BucketApi.md#DenyBucketKey) | **Post** /bucket/deny | Deny key [**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 | Get a bucket
[**GetBucketInfo**](BucketApi.md#GetBucketInfo) | **Get** /bucket?id={bucket_id} | Get a bucket [**ListBuckets**](BucketApi.md#ListBuckets) | **Get** /bucket?list | List all buckets
[**ListBuckets**](BucketApi.md#ListBuckets) | **Get** /bucket | List all buckets
[**PutBucketGlobalAlias**](BucketApi.md#PutBucketGlobalAlias) | **Put** /bucket/alias/global | Add a global alias [**PutBucketGlobalAlias**](BucketApi.md#PutBucketGlobalAlias) | **Put** /bucket/alias/global | Add a global alias
[**PutBucketLocalAlias**](BucketApi.md#PutBucketLocalAlias) | **Put** /bucket/alias/local | Add a local 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
> DeleteBucket(ctx, bucketId).Execute() > DeleteBucket(ctx).Id(id).Execute()
Delete a bucket Delete a bucket
@ -172,11 +171,11 @@ import (
) )
func main() { 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() configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration) 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 { if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `BucketApi.DeleteBucket``: %v\n", err) fmt.Fprintf(os.Stderr, "Error when calling `BucketApi.DeleteBucket``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
@ -187,10 +186,6 @@ func main() {
### Path Parameters ### 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 ### Other Parameters
@ -199,7 +194,7 @@ Other parameters are passed through a pointer to a apiDeleteBucketRequest struct
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**id** | **string** | The exact bucket identifier, a 32 bytes hexadecimal string |
### Return type ### Return type
@ -423,79 +418,9 @@ Name | Type | Description | Notes
[[Back to README]](../README.md) [[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 ## GetBucketInfo
> BucketInfo GetBucketInfo(ctx, bucketId).Execute() > BucketInfo GetBucketInfo(ctx).Id(id).Alias(alias).Execute()
Get a bucket Get a bucket
@ -514,11 +439,12 @@ import (
) )
func main() { 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() configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration) 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 { if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `BucketApi.GetBucketInfo``: %v\n", err) fmt.Fprintf(os.Stderr, "Error when calling `BucketApi.GetBucketInfo``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
@ -531,10 +457,6 @@ func main() {
### Path Parameters ### 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 ### Other Parameters
@ -543,7 +465,8 @@ Other parameters are passed through a pointer to a apiGetBucketInfoRequest struc
Name | Type | Description | Notes 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 ### Return type
@ -764,7 +687,7 @@ Name | Type | Description | Notes
## UpdateBucket ## UpdateBucket
> BucketInfo UpdateBucket(ctx, bucketId).UpdateBucketRequest(updateBucketRequest).Execute() > BucketInfo UpdateBucket(ctx).Id(id).UpdateBucketRequest(updateBucketRequest).Execute()
Update a bucket Update a bucket
@ -783,12 +706,12 @@ import (
) )
func main() { 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. updateBucketRequest := *openapiclient.NewUpdateBucketRequest() // UpdateBucketRequest | Requested changes on the bucket. Both root fields are optionals.
configuration := openapiclient.NewConfiguration() configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration) 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 { if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `BucketApi.UpdateBucket``: %v\n", err) fmt.Fprintf(os.Stderr, "Error when calling `BucketApi.UpdateBucket``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
@ -801,10 +724,6 @@ func main() {
### Path Parameters ### 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 ### Other Parameters
@ -813,7 +732,7 @@ Other parameters are passed through a pointer to a apiUpdateBucketRequest struct
Name | Type | Description | Notes 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. | **updateBucketRequest** | [**UpdateBucketRequest**](UpdateBucketRequest.md) | Requested changes on the bucket. Both root fields are optionals. |
### Return type ### Return type

View file

@ -4,13 +4,12 @@ All URIs are relative to *http://localhost:3903/v1*
Method | HTTP request | Description Method | HTTP request | Description
------------- | ------------- | ------------- ------------- | ------------- | -------------
[**AddKey**](KeyApi.md#AddKey) | **Post** /key | Create a new API key [**AddKey**](KeyApi.md#AddKey) | **Post** /key?list | Create a new API key
[**DeleteKey**](KeyApi.md#DeleteKey) | **Delete** /key?id={access_key} | Delete a key [**DeleteKey**](KeyApi.md#DeleteKey) | **Delete** /key | Delete a key
[**GetKey**](KeyApi.md#GetKey) | **Get** /key?id={access_key} | Get key information [**GetKey**](KeyApi.md#GetKey) | **Get** /key | Get key information
[**ImportKey**](KeyApi.md#ImportKey) | **Post** /key/import | Import an existing key [**ImportKey**](KeyApi.md#ImportKey) | **Post** /key/import | Import an existing key
[**ListKeys**](KeyApi.md#ListKeys) | **Get** /key | List all keys [**ListKeys**](KeyApi.md#ListKeys) | **Get** /key?list | List all keys
[**SearchKey**](KeyApi.md#SearchKey) | **Get** /key?search={pattern} | Select key by pattern [**UpdateKey**](KeyApi.md#UpdateKey) | **Post** /key | Update a key
[**UpdateKey**](KeyApi.md#UpdateKey) | **Post** /key?id={access_key} | Update a key
@ -150,7 +149,7 @@ Name | Type | Description | Notes
## GetKey ## GetKey
> KeyInfo GetKey(ctx, accessKey).ShowSecretKey(showSecretKey).Execute() > KeyInfo GetKey(ctx).Id(id).Search(search).ShowSecretKey(showSecretKey).Execute()
Get key information Get key information
@ -169,12 +168,13 @@ import (
) )
func main() { func main() {
accessKey := "GK31c2f218a2e44f485b94239e" // string | The exact API access key generated by Garage id := "GK31c2f218a2e44f485b94239e" // string | The exact API access key generated by Garage. Incompatible with `search`. (optional)
showSecretKey := true // bool | Wether or not the secret key should be returned in the response (optional) (default to false) 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() configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration) 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 { if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `KeyApi.GetKey``: %v\n", err) fmt.Fprintf(os.Stderr, "Error when calling `KeyApi.GetKey``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
@ -187,10 +187,6 @@ func main() {
### Path Parameters ### 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 ### Other Parameters
@ -199,8 +195,9 @@ Other parameters are passed through a pointer to a apiGetKeyRequest struct via t
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**id** | **string** | The exact API access key generated by Garage. Incompatible with `search`. |
**showSecretKey** | **bool** | Wether or not the secret key should be returned in the response | [default to false] **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 ### Return type
@ -347,78 +344,6 @@ Other parameters are passed through a pointer to a apiListKeysRequest struct via
[[Back to README]](../README.md) [[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 ## UpdateKey
> KeyInfo UpdateKey(ctx, accessKey).UpdateKeyRequest(updateKeyRequest).Execute() > KeyInfo UpdateKey(ctx, accessKey).UpdateKeyRequest(updateKeyRequest).Execute()