types

package
v0.1.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidWebhookRequest is returned when the given webhook request is not valid.
	ErrInvalidWebhookRequest = errors.New("invalid authorization webhook request")

	// ErrInvalidWebhookResponse is returned when the given webhook response is not valid.
	ErrInvalidWebhookResponse = errors.New("invalid authorization webhook response")
)

Functions

func IsAuthMethod added in v0.1.6

func IsAuthMethod(method string) bool

IsAuthMethod returns whether the given method can be used for authorization.

Types

type AccessAttribute added in v0.1.5

type AccessAttribute struct {
	Key  string   `json:"key"`
	Verb VerbType `json:"verb"`
}

AccessAttribute represents an access attribute.

type AccessInfo added in v0.1.5

type AccessInfo struct {
	Method     Method
	Attributes []AccessAttribute
}

AccessInfo represents an access information.

type AuthWebhookRequest added in v0.1.5

type AuthWebhookRequest struct {
	Token      string            `json:"token"`
	Method     Method            `json:"method"`
	Attributes []AccessAttribute `json:"attributes"`
}

AuthWebhookRequest represents the request of authentication webhook.

func NewAuthWebhookRequest added in v0.1.5

func NewAuthWebhookRequest(reader io.Reader) (*AuthWebhookRequest, error)

NewAuthWebhookRequest creates a new instance of AuthWebhookRequest.

type AuthWebhookResponse added in v0.1.5

type AuthWebhookResponse struct {
	Allowed bool   `json:"allowed"`
	Reason  string `json:"reason"`
}

AuthWebhookResponse represents the response of authentication webhook.

func NewAuthWebhookResponse added in v0.1.5

func NewAuthWebhookResponse(reader io.Reader) (*AuthWebhookResponse, error)

NewAuthWebhookResponse creates a new instance of AuthWebhookResponse.

func (*AuthWebhookResponse) Write added in v0.1.5

func (r *AuthWebhookResponse) Write(writer io.Writer) (int, error)

Write writes this response to the given writer.

type Client added in v0.1.2

type Client struct {
	ID           *time.ActorID
	MetadataInfo MetadataInfo
}

Client represents the Client that communicates with the Agent.

func NewClient added in v0.1.7

func NewClient(encoded []byte) (*Client, error)

NewClient creates a new Client from the given JSON.

func (*Client) Marshal added in v0.1.7

func (c *Client) Marshal() (string, error)

Marshal serializes the Client to JSON.

type DocEventType added in v0.1.6

type DocEventType string

DocEventType represents the event that the Agent delivers to the client.

const (
	// DocumentsChangedEvent is an event indicating that documents are being
	// modified by a change.
	DocumentsChangedEvent DocEventType = "documents-changed"

	// DocumentsWatchedEvent is an event that occurs when documents are watched
	// by other clients.
	DocumentsWatchedEvent DocEventType = "documents-watched"

	// DocumentsUnwatchedEvent is an event that occurs when documents are
	// unwatched by other clients.
	DocumentsUnwatchedEvent DocEventType = "documents-unwatched"

	// MetadataChangedEvent is an event indicating that metadata is changed.
	MetadataChangedEvent DocEventType = "metadata-changed"
)

type Metadata added in v0.1.7

type Metadata map[string]string

Metadata represents custom metadata that can be defined in the client.

type MetadataInfo added in v0.1.7

type MetadataInfo struct {
	Clock int32
	Data  Metadata
}

MetadataInfo is a metadata information with logical clock.

func (*MetadataInfo) Update added in v0.1.7

func (i *MetadataInfo) Update(info MetadataInfo) bool

Update updates the given metadata information with the given clock.

type Method added in v0.1.5

type Method string

Method represents a method name of RPC.

const (
	ActivateClient   Method = "ActivateClient"
	DeactivateClient Method = "DeactivateClient"
	AttachDocument   Method = "AttachDocument"
	DetachDocument   Method = "DetachDocument"
	PushPull         Method = "PushPull"
	WatchDocuments   Method = "WatchDocuments"
)

Belows are the names of RPCs.

func AuthMethods added in v0.1.6

func AuthMethods() []Method

AuthMethods returns a slice of methods that can be used for authorization.

type VerbType added in v0.1.5

type VerbType string

VerbType represents an action taken on the document.

const (

	// Read represents the case of only reading the given document.
	Read VerbType = "r"

	// ReadWrite represents the case of reading and writing the given document.
	ReadWrite VerbType = "rw"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL