Files
orchard/pkg/client/controller.go
T
Nikolay EdigaryevandFedor Korotkov 77656517fd Controller info endpoint and API integration examples (#75)
* Controller API: introduce controller's information endpoint

* Prevent generation of empty events after channel closure

* Allow events to be buffered in the events channel

* Controller API: introduce controller's information endpoint[1]

* IntegrationGuide.md: a couple of Python and Golang examples

* Rephrase a sentence

Co-authored-by: Fedor Korotkov <fedor.korotkov@gmail.com>

---------

Co-authored-by: Fedor Korotkov <fedor.korotkov@gmail.com>
2023-04-11 07:28:46 +00:00

24 lines
462 B
Go

package client
import (
"context"
v1 "github.com/cirruslabs/orchard/pkg/resource/v1"
"net/http"
)
type ControllerService struct {
client *Client
}
func (service *ControllerService) Info(ctx context.Context) (v1.ControllerInfo, error) {
var controllerInfo v1.ControllerInfo
err := service.client.request(ctx, http.MethodGet, "controller/info", nil, &controllerInfo,
nil)
if err != nil {
return controllerInfo, err
}
return controllerInfo, nil
}