garage-admin-sdk-golang/docs/LayoutApi.md

270 lines
8.2 KiB
Markdown
Raw Permalink Normal View History

2022-11-13 13:22:00 +00:00
# \LayoutApi
2023-11-22 17:28:14 +00:00
All URIs are relative to *http://localhost:3903/v1*
2022-11-13 13:22:00 +00:00
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
2023-11-22 17:28:14 +00:00
> ClusterLayout AddLayout(ctx).NodeRoleChange(nodeRoleChange).Execute()
2022-11-13 13:22:00 +00:00
Send modifications to the cluster layout
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
2023-11-23 09:04:11 +00:00
nodeRoleChange := []openapiclient.NodeRoleChange{openapiclient.NodeRoleChange{NodeRoleRemove: openapiclient.NewNodeRoleRemove("6a8e08af2aab1083ebab9b22165ea8b5b9d333b60a39ecd504e85cc1f432c36f", true)}} // []NodeRoleChange | To add a new node to the layout or to change the configuration of an existing node, simply set the values you want (`zone`, `capacity`, and `tags`). To remove a node, simply pass the `remove: true` field. This logic is represented in OpenAPI with a \"One Of\" 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.
2022-11-13 13:22:00 +00:00
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
2023-11-22 17:28:14 +00:00
resp, r, err := apiClient.LayoutApi.AddLayout(context.Background()).NodeRoleChange(nodeRoleChange).Execute()
2022-11-13 13:22:00 +00:00
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)
}
2023-11-22 17:28:14 +00:00
// response from `AddLayout`: ClusterLayout
fmt.Fprintf(os.Stdout, "Response from `LayoutApi.AddLayout`: %v\n", resp)
2022-11-13 13:22:00 +00:00
}
```
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiAddLayoutRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
2023-11-22 17:28:14 +00:00
**nodeRoleChange** | [**[]NodeRoleChange**](NodeRoleChange.md) | To add a new node to the layout or to change the configuration of an existing node, simply set the values you want (`zone`, `capacity`, and `tags`). To remove a node, simply pass the `remove: true` field. This logic is represented in OpenAPI with a \"One Of\" 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. |
2022-11-13 13:22:00 +00:00
### Return type
2023-11-22 17:28:14 +00:00
[**ClusterLayout**](ClusterLayout.md)
2022-11-13 13:22:00 +00:00
### Authorization
[bearerAuth](../README.md#bearerAuth)
### HTTP request headers
- **Content-Type**: application/json
2023-11-22 17:28:14 +00:00
- **Accept**: application/json
2022-11-13 13:22:00 +00:00
[[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
2023-11-22 17:28:14 +00:00
> ApplyLayout200Response ApplyLayout(ctx).LayoutVersion(layoutVersion).Execute()
2022-11-13 13:22:00 +00:00
Apply staged layout
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
2023-11-23 09:21:13 +00:00
layoutVersion := *openapiclient.NewLayoutVersion(int32(13)) // 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.
2022-11-13 13:22:00 +00:00
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)
}
2023-11-22 17:28:14 +00:00
// response from `ApplyLayout`: ApplyLayout200Response
fmt.Fprintf(os.Stdout, "Response from `LayoutApi.ApplyLayout`: %v\n", resp)
2022-11-13 13:22:00 +00:00
}
```
### 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
2023-11-22 17:28:14 +00:00
[**ApplyLayout200Response**](ApplyLayout200Response.md)
2022-11-13 13:22:00 +00:00
### Authorization
[bearerAuth](../README.md#bearerAuth)
### HTTP request headers
- **Content-Type**: application/json
2023-11-22 17:28:14 +00:00
- **Accept**: application/json
2022-11-13 13:22:00 +00:00
[[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() {
2023-11-23 09:21:13 +00:00
layoutVersion := *openapiclient.NewLayoutVersion(int32(13)) // 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.
2022-11-13 13:22:00 +00:00
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)