refactor(connector): the SDK and Alertmanager connector use encoding/json/v2 and jsontext (archie #1980)
publish / publish (push) Successful in 56s
publish / publish (push) Successful in 56s
This commit is contained in:
3 files changed
+7
-7
No files matched your search
@@ -2,7 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
json "encoding/json/v2"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
json "encoding/json/v2"
|
||||
"testing"
|
||||
)
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"context"
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"time"
|
||||
|
||||
connectorv1 "github.com/samcharles93/archipelago/sdk/connector/v1"
|
||||
@@ -33,7 +33,7 @@ type Description struct {
|
||||
type Event struct {
|
||||
Type string
|
||||
SourceEventID string
|
||||
Fields json.RawMessage
|
||||
Fields jsontext.Value
|
||||
LinkKey string
|
||||
OccurredAt time.Time
|
||||
}
|
||||
@@ -52,13 +52,13 @@ type Parser interface {
|
||||
// any action that isn't read-only, and returns unknown=true when it can't
|
||||
// confirm what its effect did.
|
||||
type Actor interface {
|
||||
Resolve(ctx context.Context, action string, input json.RawMessage) (*connectorv1.ResolveResponse, error)
|
||||
Invoke(ctx context.Context, action string, input json.RawMessage, idempotencyKey string) (output json.RawMessage, unknown bool, err error)
|
||||
Resolve(ctx context.Context, action string, input jsontext.Value) (*connectorv1.ResolveResponse, error)
|
||||
Invoke(ctx context.Context, action string, input jsontext.Value, idempotencyKey string) (output jsontext.Value, unknown bool, err error)
|
||||
}
|
||||
|
||||
// Looker answers read-only lookups. found=false means nothing was found.
|
||||
type Looker interface {
|
||||
Lookup(ctx context.Context, name string, input json.RawMessage) (output json.RawMessage, found bool, err error)
|
||||
Lookup(ctx context.Context, name string, input jsontext.Value) (output jsontext.Value, found bool, err error)
|
||||
}
|
||||
|
||||
// Digest identifies one concrete action, the same way archie-core does: its
|
||||
|
||||
Reference in new issue
Block a user