api

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account added in v0.2.0

type Account struct {
	// Users that belong to the account.
	Users []*ConfigUser `json:"users,omitempty"`

	// Exports are the exports from this account.
	Exports []*Export `json:"exports,omitempty"`

	// Imports are the imports from this account.
	Imports []*Import `json:"imports,omitempty"`

	// JetStream enables the JS config.
	JetStream *AccountJetStreamConfig `json:"jetstream,omitempty"`

	// Subject mapping enables remapping subject and partitions
	Mappings map[string][]*SubjectMap `json:"mappings,omitempty"`
}

Account with users.

func (*Account) AsJSON added in v0.3.0

func (u *Account) AsJSON() ([]byte, error)

AsJSON returns a byte slice of the type.

type AccountJetStream added in v0.6.0

type AccountJetStream struct {
	MaxMemoryStore *int64 `json:"max_mem,omitempty"`
	MaxFileStore   *int64 `json:"max_file,omitempty"`
	MaxStreams     *int64 `json:"max_streams,omitempty"`
	MaxConsumers   *int64 `json:"max_consumers,omitempty"`
}

AccountJetStreamConfig maps to the NATS Config.

type AccountJetStreamConfig added in v0.6.0

type AccountJetStreamConfig struct {
	Enabled          bool `json:"enabled,omitempty"`
	AccountJetStream `json:",inline"`
}

type AuthConfig

type AuthConfig struct {
	// Users that belong to the global account.
	Users []*ConfigUser `json:"users"`

	// Accounts that separate the subject namespaces.
	Accounts map[string]*Account `json:"accounts,omitempty"`
}

AuthConfig represents the complete authorization config for the NATS Server.

func (*AuthConfig) AsJSON

func (ac *AuthConfig) AsJSON() ([]byte, error)

AsJSON returns the JSON representation of the AuthConfig.

type ConfigUser

type ConfigUser struct {
	Username    string       `json:"username,omitempty"`
	Password    string       `json:"password,omitempty"`
	Nkey        string       `json:"nkey,omitempty"`
	Permissions *Permissions `json:"permissions,omitempty"`
}

ConfigUser is a user as it will be represented in the configuration of the NATS Server.

type Export added in v0.3.0

type Export struct {
	Stream   string   `json:"stream,omitempty"`
	Service  string   `json:"service,omitempty"`
	Accounts []string `json:"accounts,omitempty"`
	Response string   `json:"response,omitempty"`
}

Export

type GenericImport added in v0.3.0

type GenericImport struct {
	Account string `json:"account,omitempty"`
	Subject string `json:"subject,omitempty"`
}

GenericImport

type GlobalJetStream added in v0.7.0

type GlobalJetStream struct {
	StoreDir         string `json:"store_dir,omitempty"`
	AccountJetStream `json:",inline"`
}

type Import added in v0.3.0

type Import struct {
	Service      *GenericImport `json:"service,omitempty"`
	Stream       *GenericImport `json:"stream,omitempty"`
	StreamPrefix string         `json:"prefix,omitempty"`
	ServiceTo    string         `json:"to,omitempty"`
}

Import

type PermissionRules

type PermissionRules struct {
	Allow []string `json:"allow,omitempty"`
	Deny  []string `json:"deny,omitempty"`
}

PermissionRules represents the allow/deny rules for publish/subscribe.

type Permissions

type Permissions struct {
	// Publish are the publish permissions.
	Publish *PermissionRules `json:"publish,omitempty"`

	// Subscribe are the subscriber permissions.
	Subscribe *PermissionRules `json:"subscribe,omitempty"`

	// Responses are response rules permissions.
	Responses *ResponseRules `json:"allow_responses,omitempty"`
}

Permissions are the publish/subscribe rules.

func (*Permissions) AsJSON

func (p *Permissions) AsJSON() ([]byte, error)

AsJSON returns a byte slice of the type.

type ResponseRules added in v0.6.0

type ResponseRules struct {
	Max     int    `json:"max,omitempty"`
	Expires string `json:"expires,omitempty"`
}

ResponseRules represents the reponse permissions.

type SubjectMap added in v0.8.0

type SubjectMap struct {
	Destination string `json:"destination,omitempty"`
	Weight      string `json:"weight,omitempty"`
	Cluster     string `json:"cluster,omitempty"`
}

Subject mapping destination is for mapping subjects globally, by account, or by import.

type User

type User struct {
	// Username
	Username string `json:"username,omitempty"`

	// Password
	Password string `json:"password,omitempty"`

	// Nkey
	Nkey string `json:"nkey,omitempty"`

	// FIXME: Change into role and consolidate into a single type?
	// it would have to be filtered out on export though since
	// cannot have an extra field that is not recognized by the
	// server.
	Permissions string `json:"permissions,omitempty"`

	// Account is the account on which this user exists,
	// by default being the global account.
	Account string `json:"account,omitempty"`
}

User represents the payload that a client can make.

func (*User) AsJSON

func (u *User) AsJSON() ([]byte, error)

AsJSON returns a byte slice of the type.

Jump to

Keyboard shortcuts

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