# garage.KeyApi 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 [**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 ## addKey > KeyInfo addKey(addKeyRequest) Create a new API key Creates a new API access key. ### Example ```javascript import garage from 'garage_administration_api_v0garage_v0_9_0'; let defaultClient = garage.ApiClient.instance; // Configure Bearer access token for authorization: bearerAuth let bearerAuth = defaultClient.authentications['bearerAuth']; bearerAuth.accessToken = "YOUR ACCESS TOKEN" let apiInstance = new garage.KeyApi(); let addKeyRequest = new garage.AddKeyRequest(); // 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.* apiInstance.addKey(addKeyRequest).then((data) => { console.log('API called successfully. Returned data: ' + data); }, (error) => { console.error(error); }); ``` ### Parameters 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 ## deleteKey > deleteKey(accessKey) Delete a key Delete a key from the cluster. Its access will be removed from all the buckets. Buckets are not automatically deleted and can be dangling. You should manually delete them before. ### Example ```javascript import garage from 'garage_administration_api_v0garage_v0_9_0'; let defaultClient = garage.ApiClient.instance; // Configure Bearer access token for authorization: bearerAuth let bearerAuth = defaultClient.authentications['bearerAuth']; bearerAuth.accessToken = "YOUR ACCESS TOKEN" let apiInstance = new garage.KeyApi(); let accessKey = GK31c2f218a2e44f485b94239e; // String | The exact API access key generated by Garage apiInstance.deleteKey(accessKey).then(() => { console.log('API called successfully.'); }, (error) => { console.error(error); }); ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **accessKey** | **String**| The exact API access key generated by Garage | ### Return type null (empty response body) ### Authorization [bearerAuth](../README.md#bearerAuth) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: Not defined ## getKey > KeyInfo getKey(accessKey, opts) Get key information Return information about a specific key like its identifiers, its permissions and buckets on which it has permissions. For confidentiality reasons, the secret key is not returned by default: you must pass the `showSecretKey` query parameter to get it. ### Example ```javascript import garage from 'garage_administration_api_v0garage_v0_9_0'; let defaultClient = garage.ApiClient.instance; // Configure Bearer access token for authorization: bearerAuth let bearerAuth = defaultClient.authentications['bearerAuth']; bearerAuth.accessToken = "YOUR ACCESS TOKEN" let apiInstance = new garage.KeyApi(); let accessKey = GK31c2f218a2e44f485b94239e; // String | The exact API access key generated by Garage let opts = { 'showSecretKey': true // Boolean | Wether or not the secret key should be returned in the response }; apiInstance.getKey(accessKey, opts).then((data) => { console.log('API called successfully. Returned data: ' + data); }, (error) => { console.error(error); }); ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **accessKey** | **String**| The exact API access key generated by Garage | **showSecretKey** | **Boolean**| Wether or not the secret key should be returned in the response | [optional] [default to false] ### Return type [**KeyInfo**](KeyInfo.md) ### Authorization [bearerAuth](../README.md#bearerAuth) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json ## importKey > KeyInfo importKey(importKeyRequest) Import an existing key Imports an existing API key. This feature must only be used for migrations and backup restore. **Do not use it to generate custom key identifiers or you will break your Garage cluster.** ### Example ```javascript import garage from 'garage_administration_api_v0garage_v0_9_0'; let defaultClient = garage.ApiClient.instance; // Configure Bearer access token for authorization: bearerAuth let bearerAuth = defaultClient.authentications['bearerAuth']; bearerAuth.accessToken = "YOUR ACCESS TOKEN" let apiInstance = new garage.KeyApi(); let importKeyRequest = new garage.ImportKeyRequest(); // ImportKeyRequest | Information on the key to import apiInstance.importKey(importKeyRequest).then((data) => { console.log('API called successfully. Returned data: ' + data); }, (error) => { console.error(error); }); ``` ### Parameters 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 ## listKeys > [ListKeys200ResponseInner] listKeys() List all keys Returns all API access keys in the cluster. ### Example ```javascript import garage from 'garage_administration_api_v0garage_v0_9_0'; let defaultClient = garage.ApiClient.instance; // Configure Bearer access token for authorization: bearerAuth let bearerAuth = defaultClient.authentications['bearerAuth']; bearerAuth.accessToken = "YOUR ACCESS TOKEN" let apiInstance = new garage.KeyApi(); apiInstance.listKeys().then((data) => { console.log('API called successfully. Returned data: ' + data); }, (error) => { console.error(error); }); ``` ### Parameters This endpoint does not need any parameter. ### Return type [**[ListKeys200ResponseInner]**](ListKeys200ResponseInner.md) ### Authorization [bearerAuth](../README.md#bearerAuth) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json ## searchKey > KeyInfo searchKey(pattern, opts) 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. ### Example ```javascript import garage from 'garage_administration_api_v0garage_v0_9_0'; let defaultClient = garage.ApiClient.instance; // Configure Bearer access token for authorization: bearerAuth let bearerAuth = defaultClient.authentications['bearerAuth']; bearerAuth.accessToken = "YOUR ACCESS TOKEN" let apiInstance = new garage.KeyApi(); let pattern = test-k; // String | A pattern (beginning or full string) corresponding to a key identifier or friendly name let opts = { 'showSecretKey': true // Boolean | Wether or not the secret key should be returned in the response }; apiInstance.searchKey(pattern, opts).then((data) => { console.log('API called successfully. Returned data: ' + data); }, (error) => { console.error(error); }); ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **pattern** | **String**| A pattern (beginning or full string) corresponding to a key identifier or friendly name | **showSecretKey** | **Boolean**| Wether or not the secret key should be returned in the response | [optional] [default to false] ### Return type [**KeyInfo**](KeyInfo.md) ### Authorization [bearerAuth](../README.md#bearerAuth) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json ## updateKey > KeyInfo updateKey(accessKey, updateKeyRequest) Update a key Updates information about the specified API access key. *Note: the secret key is not returned in the response, `null` is sent instead.* ### Example ```javascript import garage from 'garage_administration_api_v0garage_v0_9_0'; let defaultClient = garage.ApiClient.instance; // Configure Bearer access token for authorization: bearerAuth let bearerAuth = defaultClient.authentications['bearerAuth']; bearerAuth.accessToken = "YOUR ACCESS TOKEN" let apiInstance = new garage.KeyApi(); let accessKey = GK31c2f218a2e44f485b94239e; // String | The exact API access key generated by Garage let updateKeyRequest = new garage.UpdateKeyRequest(); // UpdateKeyRequest | For a given key, provide a first set with the permissions to grant, and a second set with the permissions to remove apiInstance.updateKey(accessKey, updateKeyRequest).then((data) => { console.log('API called successfully. Returned data: ' + data); }, (error) => { console.error(error); }); ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **accessKey** | **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