# \KeyApi All URIs are relative to *http://localhost:3903/v1* Method | HTTP request | Description ------------- | ------------- | ------------- [**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 | List all keys [**UpdateKey**](KeyApi.md#UpdateKey) | **Post** /key | Update a key ## AddKey > KeyInfo AddKey(ctx).AddKeyRequest(addKeyRequest).Execute() Create a new API key ### Example ```go package main import ( "context" "fmt" "os" openapiclient "./openapi" ) func main() { addKeyRequest := *openapiclient.NewAddKeyRequest() // AddKeyRequest | You can set a friendly name for this key. If you don't want to, you can set the name to `null`. *Note: the secret key is returned in the response.* configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.KeyApi.AddKey(context.Background()).AddKeyRequest(addKeyRequest).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `KeyApi.AddKey``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `AddKey`: KeyInfo fmt.Fprintf(os.Stdout, "Response from `KeyApi.AddKey`: %v\n", resp) } ``` ### Path Parameters ### Other Parameters Other parameters are passed through a pointer to a apiAddKeyRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **addKeyRequest** | [**AddKeyRequest**](AddKeyRequest.md) | You can set a friendly name for this key. If you don't want to, you can set the name to `null`. *Note: the secret key is returned in the response.* | ### Return type [**KeyInfo**](KeyInfo.md) ### Authorization [bearerAuth](../README.md#bearerAuth) ### HTTP request headers - **Content-Type**: application/json - **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) ## DeleteKey > DeleteKey(ctx).Id(id).Execute() Delete a key ### Example ```go package main import ( "context" "fmt" "os" openapiclient "./openapi" ) func main() { 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()).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) } } ``` ### Path Parameters ### Other Parameters Other parameters are passed through a pointer to a apiDeleteKeyRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **string** | The exact API access key generated by Garage | ### Return type (empty response body) ### Authorization [bearerAuth](../README.md#bearerAuth) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: Not defined [[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) ## GetKey > KeyInfo GetKey(ctx).Id(id).Search(search).ShowSecretKey(showSecretKey).Execute() Get key information ### Example ```go package main import ( "context" "fmt" "os" openapiclient "./openapi" ) func main() { 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()).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) } // response from `GetKey`: KeyInfo fmt.Fprintf(os.Stdout, "Response from `KeyApi.GetKey`: %v\n", resp) } ``` ### Path Parameters ### Other Parameters Other parameters are passed through a pointer to a apiGetKeyRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **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 [**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) ## ImportKey > KeyInfo ImportKey(ctx).ImportKeyRequest(importKeyRequest).Execute() Import an existing key ### Example ```go package main import ( "context" "fmt" "os" openapiclient "./openapi" ) func main() { importKeyRequest := *openapiclient.NewImportKeyRequest("test-key", "GK31c2f218a2e44f485b94239e", "b892c0665f0ada8a4755dae98baa3b133590e11dae3bcc1f9d769d67f16c3835") // ImportKeyRequest | Information on the key to import configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.KeyApi.ImportKey(context.Background()).ImportKeyRequest(importKeyRequest).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `KeyApi.ImportKey``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `ImportKey`: KeyInfo fmt.Fprintf(os.Stdout, "Response from `KeyApi.ImportKey`: %v\n", resp) } ``` ### Path Parameters ### Other Parameters Other parameters are passed through a pointer to a apiImportKeyRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **importKeyRequest** | [**ImportKeyRequest**](ImportKeyRequest.md) | Information on the key to import | ### Return type [**KeyInfo**](KeyInfo.md) ### Authorization [bearerAuth](../README.md#bearerAuth) ### HTTP request headers - **Content-Type**: application/json - **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) ## ListKeys > []ListKeys200ResponseInner ListKeys(ctx).Execute() List all keys ### Example ```go package main import ( "context" "fmt" "os" openapiclient "./openapi" ) func main() { configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.KeyApi.ListKeys(context.Background()).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `KeyApi.ListKeys``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `ListKeys`: []ListKeys200ResponseInner fmt.Fprintf(os.Stdout, "Response from `KeyApi.ListKeys`: %v\n", resp) } ``` ### Path Parameters This endpoint does not need any parameter. ### Other Parameters Other parameters are passed through a pointer to a apiListKeysRequest struct via the builder pattern ### Return type [**[]ListKeys200ResponseInner**](ListKeys200ResponseInner.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).Id(id).UpdateKeyRequest(updateKeyRequest).Execute() Update a key ### Example ```go package main import ( "context" "fmt" "os" openapiclient "./openapi" ) func main() { 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()).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) } // response from `UpdateKey`: KeyInfo fmt.Fprintf(os.Stdout, "Response from `KeyApi.UpdateKey`: %v\n", resp) } ``` ### Path Parameters ### Other Parameters Other parameters are passed through a pointer to a apiUpdateKeyRequest struct via the builder pattern 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 [**KeyInfo**](KeyInfo.md) ### Authorization [bearerAuth](../README.md#bearerAuth) ### HTTP request headers - **Content-Type**: application/json - **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)