api-v1 golang #1
3 changed files with 40 additions and 35 deletions
|
@ -268,13 +268,13 @@ paths:
|
|||
parameters:
|
||||
- description: The exact API access key generated by Garage
|
||||
example: GK31c2f218a2e44f485b94239e
|
||||
explode: false
|
||||
in: path
|
||||
name: access_key
|
||||
explode: true
|
||||
in: query
|
||||
name: id
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
style: simple
|
||||
style: form
|
||||
responses:
|
||||
"500":
|
||||
description: The server can not handle your request. Check your connectivity
|
||||
|
@ -352,13 +352,13 @@ paths:
|
|||
parameters:
|
||||
- description: The exact API access key generated by Garage
|
||||
example: GK31c2f218a2e44f485b94239e
|
||||
explode: false
|
||||
in: path
|
||||
name: access_key
|
||||
explode: true
|
||||
in: query
|
||||
name: id
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
style: simple
|
||||
style: form
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
|
|
35
api_key.go
35
api_key.go
|
@ -16,7 +16,6 @@ import (
|
|||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
||||
|
||||
|
@ -138,7 +137,13 @@ func (a *KeyApiService) AddKeyExecute(r ApiAddKeyRequest) (*KeyInfo, *http.Respo
|
|||
type ApiDeleteKeyRequest struct {
|
||||
ctx context.Context
|
||||
ApiService *KeyApiService
|
||||
accessKey string
|
||||
id *string
|
||||
}
|
||||
|
||||
// The exact API access key generated by Garage
|
||||
func (r ApiDeleteKeyRequest) Id(id string) ApiDeleteKeyRequest {
|
||||
r.id = &id
|
||||
return r
|
||||
}
|
||||
|
||||
func (r ApiDeleteKeyRequest) Execute() (*http.Response, error) {
|
||||
|
@ -152,14 +157,12 @@ Delete a key from the cluster. Its access will be removed from all the buckets.
|
|||
|
||||
|
||||
@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 ApiDeleteKeyRequest
|
||||
*/
|
||||
func (a *KeyApiService) DeleteKey(ctx context.Context, accessKey string) ApiDeleteKeyRequest {
|
||||
func (a *KeyApiService) DeleteKey(ctx context.Context) ApiDeleteKeyRequest {
|
||||
return ApiDeleteKeyRequest{
|
||||
ApiService: a,
|
||||
ctx: ctx,
|
||||
accessKey: accessKey,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -177,12 +180,15 @@ func (a *KeyApiService) DeleteKeyExecute(r ApiDeleteKeyRequest) (*http.Response,
|
|||
}
|
||||
|
||||
localVarPath := localBasePath + "/key"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"access_key"+"}", url.PathEscape(parameterToString(r.accessKey, "")), -1)
|
||||
|
||||
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{}
|
||||
|
||||
|
@ -578,10 +584,16 @@ func (a *KeyApiService) ListKeysExecute(r ApiListKeysRequest) ([]ListKeys200Resp
|
|||
type ApiUpdateKeyRequest struct {
|
||||
ctx context.Context
|
||||
ApiService *KeyApiService
|
||||
accessKey string
|
||||
id *string
|
||||
updateKeyRequest *UpdateKeyRequest
|
||||
}
|
||||
|
||||
// The exact API access key generated by Garage
|
||||
func (r ApiUpdateKeyRequest) Id(id string) ApiUpdateKeyRequest {
|
||||
r.id = &id
|
||||
return r
|
||||
}
|
||||
|
||||
// For a given key, provide a first set with the permissions to grant, and a second set with the permissions to remove
|
||||
func (r ApiUpdateKeyRequest) UpdateKeyRequest(updateKeyRequest UpdateKeyRequest) ApiUpdateKeyRequest {
|
||||
r.updateKeyRequest = &updateKeyRequest
|
||||
|
@ -601,14 +613,12 @@ Updates information about the specified API access key.
|
|||
|
||||
|
||||
@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 ApiUpdateKeyRequest
|
||||
*/
|
||||
func (a *KeyApiService) UpdateKey(ctx context.Context, accessKey string) ApiUpdateKeyRequest {
|
||||
func (a *KeyApiService) UpdateKey(ctx context.Context) ApiUpdateKeyRequest {
|
||||
return ApiUpdateKeyRequest{
|
||||
ApiService: a,
|
||||
ctx: ctx,
|
||||
accessKey: accessKey,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -628,15 +638,18 @@ func (a *KeyApiService) UpdateKeyExecute(r ApiUpdateKeyRequest) (*KeyInfo, *http
|
|||
}
|
||||
|
||||
localVarPath := localBasePath + "/key"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"access_key"+"}", url.PathEscape(parameterToString(r.accessKey, "")), -1)
|
||||
|
||||
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.updateKeyRequest == nil {
|
||||
return localVarReturnValue, nil, reportError("updateKeyRequest is required and must be specified")
|
||||
}
|
||||
|
||||
localVarQueryParams.Add("id", parameterToString(*r.id, ""))
|
||||
// to determine the Content-Type header
|
||||
localVarHTTPContentTypes := []string{"application/json"}
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ Name | Type | Description | Notes
|
|||
|
||||
## DeleteKey
|
||||
|
||||
> DeleteKey(ctx, accessKey).Execute()
|
||||
> DeleteKey(ctx).Id(id).Execute()
|
||||
|
||||
Delete a key
|
||||
|
||||
|
@ -100,11 +100,11 @@ import (
|
|||
)
|
||||
|
||||
func main() {
|
||||
accessKey := "GK31c2f218a2e44f485b94239e" // string | The exact API access key generated by Garage
|
||||
id := "GK31c2f218a2e44f485b94239e" // string | The exact API access key generated by Garage
|
||||
|
||||
configuration := openapiclient.NewConfiguration()
|
||||
apiClient := openapiclient.NewAPIClient(configuration)
|
||||
resp, r, err := apiClient.KeyApi.DeleteKey(context.Background(), accessKey).Execute()
|
||||
resp, r, err := apiClient.KeyApi.DeleteKey(context.Background()).Id(id).Execute()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error when calling `KeyApi.DeleteKey``: %v\n", err)
|
||||
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
|
||||
|
@ -115,10 +115,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
|
||||
|
||||
|
@ -127,7 +123,7 @@ Other parameters are passed through a pointer to a apiDeleteKeyRequest struct vi
|
|||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
|
||||
**id** | **string** | The exact API access key generated by Garage |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -346,7 +342,7 @@ Other parameters are passed through a pointer to a apiListKeysRequest struct via
|
|||
|
||||
## UpdateKey
|
||||
|
||||
> KeyInfo UpdateKey(ctx, accessKey).UpdateKeyRequest(updateKeyRequest).Execute()
|
||||
> KeyInfo UpdateKey(ctx).Id(id).UpdateKeyRequest(updateKeyRequest).Execute()
|
||||
|
||||
Update a key
|
||||
|
||||
|
@ -365,12 +361,12 @@ import (
|
|||
)
|
||||
|
||||
func main() {
|
||||
accessKey := "GK31c2f218a2e44f485b94239e" // string | The exact API access key generated by Garage
|
||||
id := "GK31c2f218a2e44f485b94239e" // string | The exact API access key generated by Garage
|
||||
updateKeyRequest := *openapiclient.NewUpdateKeyRequest() // UpdateKeyRequest | For a given key, provide a first set with the permissions to grant, and a second set with the permissions to remove
|
||||
|
||||
configuration := openapiclient.NewConfiguration()
|
||||
apiClient := openapiclient.NewAPIClient(configuration)
|
||||
resp, r, err := apiClient.KeyApi.UpdateKey(context.Background(), accessKey).UpdateKeyRequest(updateKeyRequest).Execute()
|
||||
resp, r, err := apiClient.KeyApi.UpdateKey(context.Background()).Id(id).UpdateKeyRequest(updateKeyRequest).Execute()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error when calling `KeyApi.UpdateKey``: %v\n", err)
|
||||
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
|
||||
|
@ -383,10 +379,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
|
||||
|
||||
|
@ -395,7 +387,7 @@ Other parameters are passed through a pointer to a apiUpdateKeyRequest struct vi
|
|||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
|
||||
**id** | **string** | The exact API access key generated by Garage |
|
||||
**updateKeyRequest** | [**UpdateKeyRequest**](UpdateKeyRequest.md) | For a given key, provide a first set with the permissions to grant, and a second set with the permissions to remove |
|
||||
|
||||
### Return type
|
||||
|
|
Loading…
Reference in a new issue