garage-admin-sdk-golang/docs/LayoutApi.md
2022-11-13 14:22:00 +01:00

265 lines
7.6 KiB
Markdown

# \LayoutApi
All URIs are relative to *http://localhost:3903/v0*
Method | HTTP request | Description
------------- | ------------- | -------------
[**AddLayout**](LayoutApi.md#AddLayout) | **Post** /layout | Send modifications to the cluster layout
[**ApplyLayout**](LayoutApi.md#ApplyLayout) | **Post** /layout/apply | Apply staged layout
[**GetLayout**](LayoutApi.md#GetLayout) | **Get** /layout | Details on the current and staged layout
[**RevertLayout**](LayoutApi.md#RevertLayout) | **Post** /layout/revert | Clear staged layout
## AddLayout
> AddLayout(ctx).RequestBody(requestBody).Execute()
Send modifications to the cluster layout
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
requestBody := map[string]NodeClusterInfo{"key": *openapiclient.NewNodeClusterInfo("dc1", NullableInt32(4), []string{"Tags_example"})} // map[string]NodeClusterInfo | To add a new node to the layout or to change the configuration of an existing node, simply set the values you want. To remove a node, set it to `null` instead of passing a configuration object. Contrary to the CLI that may update only a subset of the fields capacity, zone and tags, when calling this API all of these values must be specified.
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.LayoutApi.AddLayout(context.Background()).RequestBody(requestBody).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `LayoutApi.AddLayout``: %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 apiAddLayoutRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**requestBody** | [**map[string]NodeClusterInfo**](NodeClusterInfo.md) | To add a new node to the layout or to change the configuration of an existing node, simply set the values you want. To remove a node, set it to `null` instead of passing a configuration object. Contrary to the CLI that may update only a subset of the fields capacity, zone and tags, when calling this API all of these values must be specified. |
### Return type
(empty response body)
### Authorization
[bearerAuth](../README.md#bearerAuth)
### HTTP request headers
- **Content-Type**: application/json
- **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)
## ApplyLayout
> ApplyLayout(ctx).LayoutVersion(layoutVersion).Execute()
Apply staged layout
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
layoutVersion := *openapiclient.NewLayoutVersion() // LayoutVersion | Similarly to the CLI, the body must include the version of the new layout that will be created, which MUST be 1 + the value of the currently existing layout in the cluster.
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.LayoutApi.ApplyLayout(context.Background()).LayoutVersion(layoutVersion).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `LayoutApi.ApplyLayout``: %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 apiApplyLayoutRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**layoutVersion** | [**LayoutVersion**](LayoutVersion.md) | Similarly to the CLI, the body must include the version of the new layout that will be created, which MUST be 1 + the value of the currently existing layout in the cluster. |
### Return type
(empty response body)
### Authorization
[bearerAuth](../README.md#bearerAuth)
### HTTP request headers
- **Content-Type**: application/json
- **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)
## GetLayout
> ClusterLayout GetLayout(ctx).Execute()
Details on the current and staged layout
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.LayoutApi.GetLayout(context.Background()).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `LayoutApi.GetLayout``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetLayout`: ClusterLayout
fmt.Fprintf(os.Stdout, "Response from `LayoutApi.GetLayout`: %v\n", resp)
}
```
### Path Parameters
This endpoint does not need any parameter.
### Other Parameters
Other parameters are passed through a pointer to a apiGetLayoutRequest struct via the builder pattern
### Return type
[**ClusterLayout**](ClusterLayout.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)
## RevertLayout
> RevertLayout(ctx).LayoutVersion(layoutVersion).Execute()
Clear staged layout
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
layoutVersion := *openapiclient.NewLayoutVersion() // LayoutVersion | Reverting the staged changes is done by incrementing the version number and clearing the contents of the staged change list. Similarly to the CLI, the body must include the incremented version number, which MUST be 1 + the value of the currently existing layout in the cluster.
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.LayoutApi.RevertLayout(context.Background()).LayoutVersion(layoutVersion).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `LayoutApi.RevertLayout``: %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 apiRevertLayoutRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**layoutVersion** | [**LayoutVersion**](LayoutVersion.md) | Reverting the staged changes is done by incrementing the version number and clearing the contents of the staged change list. Similarly to the CLI, the body must include the incremented version number, which MUST be 1 + the value of the currently existing layout in the cluster. |
### Return type
(empty response body)
### Authorization
[bearerAuth](../README.md#bearerAuth)
### HTTP request headers
- **Content-Type**: application/json
- **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)