api

package
v0.2102.1 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2021 License: Apache-2.0 Imports: 8 Imported by: 3

Documentation

Overview

Package api implements the sentry backend API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterService

func RegisterService(server *grpc.Server, service Backend)

RegisterService registers a new sentry service with the given gRPC server.

Types

type Backend

type Backend interface {
	// Get addresses returns the list of consensus and TLS addresses of the sentry node.
	GetAddresses(context.Context) (*SentryAddresses, error)

	// SetUpstreamTLSPubKeys notifies the sentry node of the new TLS public keys used by its
	// upstream node.
	SetUpstreamTLSPubKeys(context.Context, []signature.PublicKey) error

	// GetUpstreamTLSPubKeys returns the TLS public keys of the sentry node's upstream node.
	GetUpstreamTLSPubKeys(context.Context) ([]signature.PublicKey, error)

	// UpdatePolicies notifies the sentry node of policy changes.
	UpdatePolicies(context.Context, ServicePolicies) error
}

Backend is a sentry backend implementation.

func NewSentryClient

func NewSentryClient(c *grpc.ClientConn) Backend

NewSentryClient creates a new gRPC sentry client service.

type LocalBackend

type LocalBackend interface {
	Backend

	// GetPolicyChecker returns the current access policy checker for the given service.
	GetPolicyChecker(context.Context, cmnGrpc.ServiceName) (*policy.DynamicRuntimePolicyChecker, error)
}

LocalBackend is a local sentry backend implementation.

type SentryAddresses

type SentryAddresses struct {
	Consensus []node.ConsensusAddress `json:"consensus"`
	TLS       []node.TLSAddress       `json:"tls"`
}

SentryAddresses contains sentry node consensus and TLS addresses.

type ServicePolicies

type ServicePolicies struct {
	Service        grpc.ServiceName                      `json:"service"`
	AccessPolicies map[common.Namespace]accessctl.Policy `json:"access_policies"`
}

ServicePolicies contains policies for a GRPC service.

Jump to

Keyboard shortcuts

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