Update core client

This commit is contained in:
Ingo Oppermann
2023-09-21 00:18:40 +02:00
parent 48cc454314
commit 9ece518525
10 changed files with 43 additions and 20 deletions

2
go.mod
View File

@@ -9,7 +9,7 @@ require (
github.com/atrox/haikunatorgo/v2 v2.0.1
github.com/caddyserver/certmagic v0.19.2
github.com/casbin/casbin/v2 v2.77.2
github.com/datarhei/core-client-go/v16 v16.11.1-0.20230809104853-391c13f9d400
github.com/datarhei/core-client-go/v16 v16.11.1-0.20230920220938-7a37b8ea80ef
github.com/datarhei/gosrt v0.5.4
github.com/datarhei/joy4 v0.0.0-20230505074825-fde05957445a
github.com/fujiwara/shapeio v1.0.0

4
go.sum
View File

@@ -46,8 +46,8 @@ github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp
github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/datarhei/core-client-go/v16 v16.11.1-0.20230809104853-391c13f9d400 h1:xk4R13HF2vdG3aXKQ3Bce7hBMDnjBGC+HU4daun4wJI=
github.com/datarhei/core-client-go/v16 v16.11.1-0.20230809104853-391c13f9d400/go.mod h1:3eKfwhPKoW7faTn+luShRVNMqcIskvlIKjRJ7ShjyL8=
github.com/datarhei/core-client-go/v16 v16.11.1-0.20230920220938-7a37b8ea80ef h1:6uBGPAbVZpg6/BxJQ/5sM35YbyXVKI+6oD30eEX0V2k=
github.com/datarhei/core-client-go/v16 v16.11.1-0.20230920220938-7a37b8ea80ef/go.mod h1:3eKfwhPKoW7faTn+luShRVNMqcIskvlIKjRJ7ShjyL8=
github.com/datarhei/gosrt v0.5.4 h1:dE3mmSB+n1GeviGM8xQAW3+UD3mKeFmd84iefDul5Vs=
github.com/datarhei/gosrt v0.5.4/go.mod h1:MiUCwCG+LzFMzLM/kTA+3wiTtlnkVvGbW/F0XzyhtG8=
github.com/datarhei/joy4 v0.0.0-20230505074825-fde05957445a h1:Tf4DSHY1xruBglr+yYP5Wct7czM86GKMYgbXH8a7OFo=

View File

@@ -19,4 +19,5 @@ type AVstream struct {
LoopingRuntime uint64 `json:"looping_runtime" format:"uint64"`
Duplicating bool `json:"duplicating"`
GOP string `json:"gop"`
Mode string `json:"mode"`
}

View File

@@ -368,8 +368,12 @@ type ConfigV3 struct {
Username string `json:"username"` // Deprecated, use IAM
Password string `json:"password"` // Deprecated, use IAM
} `json:"auth"` // Deprecated, use IAM
Size int64 `json:"max_size_mbytes" format:"int64"`
Purge bool `json:"purge"`
Size int64 `json:"max_size_mbytes" format:"int64"`
Purge bool `json:"purge"`
Backup struct {
Dir string `json:"dir"`
Patterns []string `json:"patterns"`
} `json:"backup"`
} `json:"memory"`
S3 []S3Storage `json:"s3"`
CORS struct {

View File

@@ -1,6 +1,8 @@
package api
type IAMUser struct {
CreatedAt int64 `json:"created_at" format:"int64"`
UpdatedAt int64 `json:"updated_at" format:"int64"`
Name string `json:"name"`
Alias string `json:"alias"`
Superuser bool `json:"superuser"`
@@ -38,6 +40,7 @@ type IAMAuth0Tenant struct {
type IAMPolicy struct {
Name string `json:"name,omitempty"`
Domain string `json:"domain"`
Types []string `json:"types"`
Resource string `json:"resource"`
Actions []string `json:"actions"`
}

View File

@@ -123,15 +123,16 @@ type RestClient interface {
ClusterDBKeyValues() (api.ClusterKVS, error) // GET /v3/cluster/db/kv
ClusterDBProcessMap() (api.ClusterProcessMap, error) // GET /v3/cluster/db/map/process
ClusterProcessList(opts ProcessListOptions) ([]api.Process, error) // GET /v3/cluster/process
ClusterProcess(id ProcessID, filter []string) (api.Process, error) // POST /v3/cluster/process
ClusterProcessAdd(p api.ProcessConfig) error // GET /v3/cluster/process/{id}
ClusterProcessUpdate(id ProcessID, p api.ProcessConfig) error // PUT /v3/cluster/process/{id}
ClusterProcessDelete(id ProcessID) error // DELETE /v3/cluster/process/{id}
ClusterProcessCommand(id ProcessID, command string) error // PUT /v3/cluster/process/{id}/command
ClusterProcessMetadata(id ProcessID, key string) (api.Metadata, error) // GET /v3/cluster/process/{id}/metadata/{key}
ClusterProcessMetadataSet(id ProcessID, key string, metadata api.Metadata) error // PUT /v3/cluster/process/{id}/metadata/{key}
ClusterProcessProbe(id ProcessID) (api.Probe, error) // GET /v3/cluster/process/{id}/probe
ClusterProcessList(opts ProcessListOptions) ([]api.Process, error) // GET /v3/cluster/process
ClusterProcess(id ProcessID, filter []string) (api.Process, error) // POST /v3/cluster/process
ClusterProcessAdd(p api.ProcessConfig) error // GET /v3/cluster/process/{id}
ClusterProcessUpdate(id ProcessID, p api.ProcessConfig) error // PUT /v3/cluster/process/{id}
ClusterProcessDelete(id ProcessID) error // DELETE /v3/cluster/process/{id}
ClusterProcessCommand(id ProcessID, command string) error // PUT /v3/cluster/process/{id}/command
ClusterProcessMetadata(id ProcessID, key string) (api.Metadata, error) // GET /v3/cluster/process/{id}/metadata/{key}
ClusterProcessMetadataSet(id ProcessID, key string, metadata api.Metadata) error // PUT /v3/cluster/process/{id}/metadata/{key}
ClusterProcessProbe(id ProcessID) (api.Probe, error) // GET /v3/cluster/process/{id}/probe
ClusterProcessProbeConfig(config api.ProcessConfig, coreid string) (api.Probe, error) // POST /v3/cluster/process/probe
ClusterIdentitiesList() ([]api.IAMUser, error) // GET /v3/cluster/iam/user
ClusterIdentity(name string) (api.IAMUser, error) // GET /v3/cluster/iam/user/{name}
@@ -446,6 +447,10 @@ func New(config Config) (RestClient, error) {
path: mustNewGlob("/v3/process/probe"),
constraint: mustNewConstraint("^16.14.0"),
},
{
path: mustNewGlob("/v3/cluster/process/probe"),
constraint: mustNewConstraint("^16.14.0"),
},
},
"PUT": {
{

View File

@@ -37,3 +37,7 @@ func (r *restclient) ClusterProcessMetadataSet(id ProcessID, key string, metadat
func (r *restclient) ClusterProcessProbe(id ProcessID) (api.Probe, error) {
return r.processProbe("cluster", id)
}
func (r *restclient) ClusterProcessProbeConfig(config api.ProcessConfig, coreid string) (api.Probe, error) {
return r.processProbeConfig("cluster", config, coreid)
}

View File

@@ -102,9 +102,9 @@ func (r *restclient) identitySetPolicies(where, name string, p []api.IAMPolicy)
}
func (r *restclient) identityDelete(where, name string) error {
path := "/v3/iam/user" + url.PathEscape(name)
path := "/v3/iam/user/" + url.PathEscape(name)
if where == "cluster" {
path = "/v3/cluster/iam/user" + url.PathEscape(name)
path = "/v3/cluster/iam/user/" + url.PathEscape(name)
}
_, err := r.call("DELETE", path, nil, nil, "", nil)

View File

@@ -250,12 +250,18 @@ func (r *restclient) processProbe(where string, id ProcessID) (api.Probe, error)
return p, err
}
func (r *restclient) processProbeConfig(where string, config api.ProcessConfig) (api.Probe, error) {
func (r *restclient) processProbeConfig(where string, config api.ProcessConfig, coreid string) (api.Probe, error) {
var p api.Probe
query := &url.Values{}
path := "/v3/process/probe"
if where == "cluster" {
path = "/v3/cluster/process/probe"
if len(coreid) != 0 {
query.Set("coreid", coreid)
}
}
var buf bytes.Buffer
@@ -263,7 +269,7 @@ func (r *restclient) processProbeConfig(where string, config api.ProcessConfig)
e := json.NewEncoder(&buf)
e.Encode(config)
data, err := r.call("POST", path, nil, nil, "application/json", &buf)
data, err := r.call("POST", path, query, nil, "application/json", &buf)
if err != nil {
return p, err
}
@@ -310,7 +316,7 @@ func (r *restclient) ProcessProbe(id ProcessID) (api.Probe, error) {
}
func (r *restclient) ProcessProbeConfig(config api.ProcessConfig) (api.Probe, error) {
return r.processProbeConfig("", config)
return r.processProbeConfig("", config, "")
}
func (r *restclient) ProcessConfig(id ProcessID) (api.ProcessConfig, error) {

2
vendor/modules.txt vendored
View File

@@ -78,7 +78,7 @@ github.com/cespare/xxhash/v2
# github.com/cpuguy83/go-md2man/v2 v2.0.2
## explicit; go 1.11
github.com/cpuguy83/go-md2man/v2/md2man
# github.com/datarhei/core-client-go/v16 v16.11.1-0.20230809104853-391c13f9d400
# github.com/datarhei/core-client-go/v16 v16.11.1-0.20230920220938-7a37b8ea80ef
## explicit; go 1.18
github.com/datarhei/core-client-go/v16
github.com/datarhei/core-client-go/v16/api