admin

package
v0.4.15 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: Apache-2.0 Imports: 15 Imported by: 1

Documentation

Overview

Package admin provides the client for the admin service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthInterceptor added in v0.2.14

type AuthInterceptor struct {
	// contains filtered or unexported fields
}

AuthInterceptor is an interceptor for authentication.

func NewAuthInterceptor added in v0.2.14

func NewAuthInterceptor(token string) *AuthInterceptor

NewAuthInterceptor creates a new instance of AuthInterceptor.

func (*AuthInterceptor) SetToken added in v0.2.14

func (i *AuthInterceptor) SetToken(token string)

SetToken sets the token of the client.

func (*AuthInterceptor) WrapStreamingClient added in v0.4.11

WrapStreamingClient creates a stream client interceptor for authorization.

func (*AuthInterceptor) WrapStreamingHandler added in v0.4.11

WrapStreamingHandler creates a stream server interceptor for authorization.

func (*AuthInterceptor) WrapUnary added in v0.4.11

func (i *AuthInterceptor) WrapUnary(next connect.UnaryFunc) connect.UnaryFunc

WrapUnary creates a unary server interceptor for authorization.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a client for admin service.

func Dial

func Dial(rpcAddr string, opts ...Option) (*Client, error)

Dial creates an instance of Client and dials to the admin service.

func New

func New(opts ...Option) (*Client, error)

New creates an instance of Client.

func (*Client) Close

func (c *Client) Close()

Close closes the connection to the admin service.

func (*Client) CreateProject

func (c *Client) CreateProject(ctx context.Context, name string) (*types.Project, error)

CreateProject creates a new project.

func (*Client) Dial

func (c *Client) Dial(rpcAddr string) error

Dial dials to the admin service.

func (*Client) GetProject added in v0.2.16

func (c *Client) GetProject(ctx context.Context, name string) (*types.Project, error)

GetProject gets the project by name.

func (*Client) ListChangeSummaries added in v0.2.9

func (c *Client) ListChangeSummaries(
	ctx context.Context,
	projectName string,
	key key.Key,
	previousSeq int64,
	pageSize int32,
	isForward bool,
) ([]*types.ChangeSummary, error)

ListChangeSummaries returns the change summaries of the given document.

func (*Client) ListDocuments added in v0.2.13

func (c *Client) ListDocuments(
	ctx context.Context,
	projectName string,
	previousID string,
	pageSize int32,
	isForward bool,
	includeSnapshot bool,
) ([]*types.DocumentSummary, error)

ListDocuments lists documents.

func (*Client) ListProjects

func (c *Client) ListProjects(ctx context.Context) ([]*types.Project, error)

ListProjects lists all projects.

func (*Client) LogIn added in v0.2.14

func (c *Client) LogIn(
	ctx context.Context,
	username,
	password string,
) (string, error)

LogIn logs in a user.

func (*Client) RemoveDocument added in v0.4.0

func (c *Client) RemoveDocument(
	ctx context.Context,
	projectName string,
	documentKey string,
	force bool,
) error

RemoveDocument removes a document of the given key.

func (*Client) SignUp added in v0.2.14

func (c *Client) SignUp(
	ctx context.Context,
	username,
	password string,
) (*types.User, error)

SignUp signs up a new user.

func (*Client) UpdateProject

func (c *Client) UpdateProject(
	ctx context.Context,
	id string,
	fields *types.UpdatableProjectFields,
) (*types.Project, error)

UpdateProject updates an existing project.

type Option

type Option func(*Options)

Option configures Options.

func WithInsecure added in v0.4.2

func WithInsecure(isInsecure bool) Option

WithInsecure configures insecure option of the client.

func WithLogger

func WithLogger(logger *zap.Logger) Option

WithLogger configures the Logger of the client.

func WithToken added in v0.2.14

func WithToken(token string) Option

WithToken configures the token of the client.

type Options

type Options struct {
	// Token is the token of the user.
	Token string

	// Logger is the Logger of the client.
	Logger *zap.Logger

	// IsInsecure is whether to disable the TLS connection of the client.
	IsInsecure bool
}

Options configures how we set up the client.

Jump to

Keyboard shortcuts

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