Documentation
¶
Index ¶
- Variables
- func JwtName(name string) string
- func NotEmpty(s ...string) error
- type Account
- type AccountData
- func (a *AccountData) ClusterTraffic() string
- func (a *AccountData) Expiry() int64
- func (a *AccountData) Exports() Exports
- func (a *AccountData) ExternalAuthorization() ([]string, []string, string)
- func (a *AccountData) GetByName(name string) (StreamImport, error)
- func (a *AccountData) GetTracingContext() *TracingContext
- func (a *AccountData) Imports() Imports
- func (a *AccountData) IssueAuthorizationResponse(claim *jwt.AuthorizationResponseClaims, key string) (string, error)
- func (a *AccountData) IssueClaim(claim jwt.Claims, key string) (string, error)
- func (a *AccountData) Issuer() string
- func (a *AccountData) Limits() AccountLimits
- func (a *AccountData) MarshalJSON() ([]byte, error)
- func (a *AccountData) Name() string
- func (a *AccountData) Revocations() Revocations
- func (a *AccountData) ScopedSigningKeys() ScopedKeys
- func (a *AccountData) SetClusterTraffic(traffic string) error
- func (a *AccountData) SetExpiry(exp int64) error
- func (a *AccountData) SetExternalAuthorizationUser(users []interface{}, accounts []interface{}, encryption string) error
- func (a *AccountData) SetIssuer(issuer string) error
- func (a *AccountData) SetTracingContext(opts *TracingContext) error
- func (a *AccountData) Subject() string
- func (a *AccountData) SubjectMappings() SubjectMappings
- func (a *AccountData) Tags() Tags
- func (a *AccountData) UnmarshalJSON(data []byte) error
- func (a *AccountData) Users() Users
- type AccountLimits
- type AccountTags
- type Accounts
- type Auth
- type AuthImpl
- func (a *AuthImpl) Commit() error
- func (a *AuthImpl) MarshalJSON() ([]byte, error)
- func (a *AuthImpl) NewKey(prefixByte nkeys.PrefixByte) (*Key, error)
- func (a *AuthImpl) Operators() Operators
- func (a *AuthImpl) Reload() error
- func (a *AuthImpl) Sign(c jwt.Claims, key *Key) (string, error)
- func (a *AuthImpl) UnmarshalJSON(data []byte) error
- type AuthProvider
- type BaseData
- type ConnectionSources
- type ConnectionSourcesImpl
- type ConnectionTimes
- type ConnectionTimesImpl
- type ConnectionTypes
- type ConnectionTypesImpl
- type EditableNatsLimits
- type EditableUserLimits
- type Export
- type Exports
- type Import
- type Imports
- type IssuingService
- type JetStreamLimits
- type JetStreamTieredLimits
- type Key
- type Keys
- type KeysFn
- type LatencyOpts
- type Mapping
- type Mappings
- type MemResolverConfigBuilder
- func (cb *MemResolverConfigBuilder) Add(rawClaim []byte) error
- func (cb *MemResolverConfigBuilder) Generate() ([]byte, error)
- func (cb *MemResolverConfigBuilder) GenerateConfig() ([]byte, error)
- func (cb *MemResolverConfigBuilder) GenerateDir() ([]byte, error)
- func (cb *MemResolverConfigBuilder) SetOutputDir(fp string) error
- func (cb *MemResolverConfigBuilder) SetSystemAccount(id string) error
- type NameSubject
- type NatsLimits
- type Operator
- type OperatorData
- func (o *OperatorData) AccountServerURL() string
- func (o *OperatorData) Accounts() Accounts
- func (o *OperatorData) Add(name string) (Account, error)
- func (o *OperatorData) Delete(name string) error
- func (o *OperatorData) Expiry() int64
- func (o *OperatorData) Get(name string) (Account, error)
- func (o *OperatorData) IssueClaim(claim jwt.Claims, key string) (string, error)
- func (o *OperatorData) List() []Account
- func (o *OperatorData) MarshalJSON() ([]byte, error)
- func (o *OperatorData) MemResolver() ([]byte, error)
- func (o *OperatorData) Name() string
- func (o *OperatorData) OperatorServiceURLs() []string
- func (o *OperatorData) SetAccountServerURL(url string) error
- func (o *OperatorData) SetExpiry(exp int64) error
- func (o *OperatorData) SetOperatorServiceURL(url ...string) error
- func (o *OperatorData) SetSystemAccount(account Account) error
- func (o *OperatorData) SigningKeys() Keys
- func (o *OperatorData) String() string
- func (o *OperatorData) Subject() string
- func (o *OperatorData) SystemAccount() (Account, error)
- func (o *OperatorData) Tags() Tags
- func (o *OperatorData) UnmarshalJSON(data []byte) error
- type OperatorTags
- type Operators
- type OperatorsImpl
- type Options
- type Permissions
- type PermissionsImpl
- type ResponsePermissions
- type ResponsePermissionsImpl
- func (r *ResponsePermissionsImpl) Expires() time.Duration
- func (r *ResponsePermissionsImpl) MaxMessages() int
- func (r *ResponsePermissionsImpl) SetExpires(expires time.Duration) error
- func (r *ResponsePermissionsImpl) SetMaxMessages(maxMessages int) error
- func (r *ResponsePermissionsImpl) Unset() error
- type Revocable
- type RevocationEntry
- type Revocations
- type SamplingRate
- type ScopeImpl
- type ScopeLimits
- type ScopedKeys
- type ScopedSigningKeys
- type ServiceExport
- type ServiceExportImpl
- func (b *ServiceExportImpl) AccountTokenPosition() uint
- func (b *ServiceExportImpl) AllowTracing() bool
- func (b *ServiceExportImpl) Description() string
- func (b *ServiceExportImpl) GenerateActivation(account string, issuer string) (string, error)
- func (b *ServiceExportImpl) GenerateActivationForSubject(account string, issuer string, subject string) (string, error)
- func (b *ServiceExportImpl) GenerateImport() (ServiceImport, error)
- func (b *ServiceExportImpl) GetLatencyOptions() *LatencyOpts
- func (b *ServiceExportImpl) InfoURL() string
- func (b *ServiceExportImpl) IsAdvertised() bool
- func (b *ServiceExportImpl) Name() string
- func (b *ServiceExportImpl) ResponseType() string
- func (b *ServiceExportImpl) Revocations() Revocations
- func (b *ServiceExportImpl) SetAccountTokenPosition(n uint) error
- func (b *ServiceExportImpl) SetAdvertised(tf bool) error
- func (b *ServiceExportImpl) SetAllowTracing(tf bool) error
- func (b *ServiceExportImpl) SetDescription(s string) error
- func (b *ServiceExportImpl) SetInfoURL(u string) error
- func (b *ServiceExportImpl) SetLatencyOptions(t *LatencyOpts) error
- func (b *ServiceExportImpl) SetName(n string) error
- func (b *ServiceExportImpl) SetResponseType(tf string) error
- func (b *ServiceExportImpl) SetSubject(subject string) error
- func (b *ServiceExportImpl) SetTokenRequired(tf bool) error
- func (b *ServiceExportImpl) Subject() string
- func (b *ServiceExportImpl) TokenRequired() bool
- type ServiceExports
- type ServiceImport
- type ServiceImportImpl
- func (b *ServiceImportImpl) Account() string
- func (b *ServiceImportImpl) IsShareConnectionInfo() bool
- func (b *ServiceImportImpl) LocalSubject() string
- func (b *ServiceImportImpl) Name() string
- func (b *ServiceImportImpl) SetAccount(account string) error
- func (b *ServiceImportImpl) SetLocalSubject(subject string) error
- func (b *ServiceImportImpl) SetName(n string) error
- func (b *ServiceImportImpl) SetShareConnectionInfo(t bool) error
- func (b *ServiceImportImpl) SetSubject(subject string) error
- func (b *ServiceImportImpl) SetToken(s string) error
- func (b *ServiceImportImpl) Subject() string
- func (b *ServiceImportImpl) Token() string
- func (b *ServiceImportImpl) Type() jwt.ExportType
- type ServiceImports
- type SigningKeys
- type StreamExport
- type StreamExportImpl
- func (b *StreamExportImpl) AccountTokenPosition() uint
- func (b *StreamExportImpl) Description() string
- func (b *StreamExportImpl) GenerateActivation(account string, issuer string) (string, error)
- func (b *StreamExportImpl) GenerateActivationForSubject(account string, issuer string, subject string) (string, error)
- func (b *StreamExportImpl) GenerateImport() (StreamImport, error)
- func (b *StreamExportImpl) InfoURL() string
- func (b *StreamExportImpl) IsAdvertised() bool
- func (b *StreamExportImpl) Name() string
- func (b *StreamExportImpl) Revocations() Revocations
- func (b *StreamExportImpl) SetAccountTokenPosition(n uint) error
- func (b *StreamExportImpl) SetAdvertised(tf bool) error
- func (b *StreamExportImpl) SetDescription(s string) error
- func (b *StreamExportImpl) SetInfoURL(u string) error
- func (b *StreamExportImpl) SetName(n string) error
- func (b *StreamExportImpl) SetSubject(subject string) error
- func (b *StreamExportImpl) SetTokenRequired(tf bool) error
- func (b *StreamExportImpl) Subject() string
- func (b *StreamExportImpl) TokenRequired() bool
- type StreamExports
- type StreamImport
- type StreamImportImpl
- func (b *StreamImportImpl) Account() string
- func (b *StreamImportImpl) AllowTracing() bool
- func (b *StreamImportImpl) IsShareConnectionInfo() bool
- func (b *StreamImportImpl) LocalSubject() string
- func (b *StreamImportImpl) Name() string
- func (b *StreamImportImpl) SetAccount(account string) error
- func (b *StreamImportImpl) SetAllowTracing(tf bool) error
- func (b *StreamImportImpl) SetLocalSubject(subject string) error
- func (b *StreamImportImpl) SetName(n string) error
- func (b *StreamImportImpl) SetShareConnectionInfo(t bool) error
- func (b *StreamImportImpl) SetSubject(subject string) error
- func (b *StreamImportImpl) SetToken(s string) error
- func (b *StreamImportImpl) Subject() string
- func (b *StreamImportImpl) Token() string
- func (b *StreamImportImpl) Type() jwt.ExportType
- type StreamImports
- type SubjectMappings
- type SubjectMappingsImpl
- type Tags
- type TimeRange
- type TracingContext
- type User
- type UserData
- func (u *UserData) BearerToken() bool
- func (u *UserData) ConnectionSources() ConnectionSources
- func (u *UserData) ConnectionTimes() ConnectionTimes
- func (u *UserData) ConnectionTypes() ConnectionTypes
- func (u *UserData) Creds(expiry time.Duration) ([]byte, error)
- func (u *UserData) IsScoped() bool
- func (u *UserData) Issuer() string
- func (u *UserData) IssuerAccount() string
- func (u *UserData) Locale() string
- func (u *UserData) MarshalJSON() ([]byte, error)
- func (u *UserData) MaxData() int64
- func (u *UserData) MaxPayload() int64
- func (u *UserData) MaxSubscriptions() int64
- func (u *UserData) Name() string
- func (u *UserData) PubPermissions() Permissions
- func (u *UserData) ResponsePermissions() ResponsePermissions
- func (u *UserData) SetBearerToken(tf bool) error
- func (u *UserData) SetLocale(locale string) error
- func (u *UserData) SetMaxData(max int64) error
- func (u *UserData) SetMaxPayload(max int64) error
- func (u *UserData) SetMaxSubscriptions(max int64) error
- func (u *UserData) SetUserPermissionLimits(limits jwt.UserPermissionLimits) error
- func (u *UserData) SubPermissions() Permissions
- func (u *UserData) Subject() string
- func (u *UserData) Tags() Tags
- func (u *UserData) UnmarshalJSON(data []byte) error
- func (u *UserData) UserPermissionLimits() jwt.UserPermissionLimits
- type UserLimits
- type UserPermissions
- func (u *UserPermissions) BearerToken() bool
- func (u *UserPermissions) ConnectionSources() ConnectionSources
- func (u *UserPermissions) ConnectionTimes() ConnectionTimes
- func (u *UserPermissions) ConnectionTypes() ConnectionTypes
- func (u *UserPermissions) Locale() string
- func (u *UserPermissions) MaxData() int64
- func (u *UserPermissions) MaxPayload() int64
- func (u *UserPermissions) MaxSubscriptions() int64
- func (u *UserPermissions) PubPermissions() Permissions
- func (u *UserPermissions) ResponsePermissions() ResponsePermissions
- func (u *UserPermissions) SetBearerToken(tf bool) error
- func (u *UserPermissions) SetLocale(locale string) error
- func (u *UserPermissions) SetMaxData(max int64) error
- func (u *UserPermissions) SetMaxPayload(max int64) error
- func (u *UserPermissions) SetMaxSubscriptions(max int64) error
- func (u *UserPermissions) SetUserPermissionLimits(limits jwt.UserPermissionLimits) error
- func (u *UserPermissions) SubPermissions() Permissions
- func (u *UserPermissions) UserPermissionLimits() jwt.UserPermissionLimits
- type UserTags
- type Users
- type UsersImpl
- func (a *UsersImpl) Add(name string, key string) (User, error)
- func (a *UsersImpl) AddWithIdentity(name string, key string, id string) (User, error)
- func (a *UsersImpl) Delete(name string) error
- func (a *UsersImpl) Get(name string) (User, error)
- func (a *UsersImpl) ImportEphemeral(c *jwt.UserClaims, key string) (User, error)
- func (a *UsersImpl) List() []User
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("not found")
var ErrRevocationPublicExportsNotAllowed = fmt.Errorf("public exports are not allowed")
var ErrUserIsScoped = errors.New("user is scoped")
Functions ¶
Types ¶
type Account ¶
type Account interface {
// Name returns the name of the account
Name() string
// Subject returns the identity of the account
Subject() string
// Issuer returns the identity of the account issuer
Issuer() string
// Users returns an interface for managing users in the account
Users() Users
// ScopedSigningKeys returns an interface for managing signing keys
ScopedSigningKeys() ScopedKeys
// Imports returns an interface for managing imports
Imports() Imports
// Exports returns an interface for managing exports
Exports() Exports
// Limits returns an interface for managing account limits
Limits() AccountLimits
// SetExpiry sets the expiry for the account in Unix Time Seconds.
// 0 never expires.
SetExpiry(exp int64) error
// SetIssuer sets the operator key to use (default is operator). If
// set to empty string, it will use the operator identity key
SetIssuer(issuer string) error
// Expiry returns the expiry for the account in Unix Time Seconds.
// 0 never expires
Expiry() int64
// JWT returns the encoded token
JWT() string
// Revocations manage user revocations
Revocations() Revocations
// GetTracingContext returns the TracingContext or nil if not set
GetTracingContext() *TracingContext
// SetTracingContext sets the TracingContext - if null the tracing context is removed
SetTracingContext(opts *TracingContext) error
// Tags returns an object that you can use to manage tags for the account
Tags() Tags
// SetExternalAuthorizationUser updates external authorization by associating users public keys, account public keys, and an encryption key.
// ExternalAuthorization requires at the very list one user
// users can pass reference to User or the public key of the user
// accounts can pass references to Account or the public key of the account
SetExternalAuthorizationUser(users []interface{}, accounts []interface{}, encryption string) error
// ExternalAuthorization retrieves a list of authorized users, associated accounts, and encryption key.
// if the users value is nil, ExternalAuthorization is not enabled
ExternalAuthorization() ([]string, []string, string)
// IssueAuthorizationResponse generates a signed JWT token for an AuthorizationResponseClaims using the specified key.
IssueAuthorizationResponse(claim *jwt.AuthorizationResponseClaims, key string) (string, error)
// IssueClaim issues the specified jwt.Claim using the specified account key
IssueClaim(claim jwt.Claims, key string) (string, error)
// SubjectMappings returns the interface for interacting with SubjectMappings
SubjectMappings() SubjectMappings
// SetClusterTraffic configures the JetStream traffic to go through the system account (default)
// or through this account. Possible values to this option are "" (empty string, default), routing
// via the system account, "system" route through the system account, "owner" routing through this
// account.
SetClusterTraffic(traffic string) error
// ClusterTraffic returns how JetStream traffic is configured for the account.
// An empty string or "system" denotes traffic through the system account (the default).
// "owner" denotes traffic through this account.
ClusterTraffic() string
}
Account is an interface for editing an account
func NewAccountFromJWT ¶
type AccountData ¶
type AccountData struct {
BaseData
// Operator the operator that manages the account
Operator *OperatorData
// AccountSigningKeys is the list of all current signing keys for
// the account. All keys should be reachable by the API
AccountSigningKeys []*Key `json:"signingKeys,omitempty"`
// Claim is the currently decoded version of the JWT. Always up-to-date by
// the APIs
Claim *jwt.AccountClaims
// UserData is the list of account users
UserDatas []*UserData `json:"users"`
// DeletedUsers is a list of users that will be deleted on the next commit
DeletedUsers []*UserData
}
func (*AccountData) ClusterTraffic ¶ added in v0.0.7
func (a *AccountData) ClusterTraffic() string
func (*AccountData) Expiry ¶
func (a *AccountData) Expiry() int64
func (*AccountData) Exports ¶
func (a *AccountData) Exports() Exports
func (*AccountData) ExternalAuthorization ¶
func (a *AccountData) ExternalAuthorization() ([]string, []string, string)
func (*AccountData) GetByName ¶
func (a *AccountData) GetByName(name string) (StreamImport, error)
func (*AccountData) GetTracingContext ¶
func (a *AccountData) GetTracingContext() *TracingContext
func (*AccountData) Imports ¶
func (a *AccountData) Imports() Imports
func (*AccountData) IssueAuthorizationResponse ¶ added in v0.0.2
func (a *AccountData) IssueAuthorizationResponse(claim *jwt.AuthorizationResponseClaims, key string) (string, error)
func (*AccountData) IssueClaim ¶ added in v0.0.3
func (*AccountData) Issuer ¶
func (a *AccountData) Issuer() string
func (*AccountData) Limits ¶
func (a *AccountData) Limits() AccountLimits
func (*AccountData) MarshalJSON ¶
func (a *AccountData) MarshalJSON() ([]byte, error)
func (*AccountData) Name ¶
func (a *AccountData) Name() string
func (*AccountData) Revocations ¶
func (a *AccountData) Revocations() Revocations
func (*AccountData) ScopedSigningKeys ¶
func (a *AccountData) ScopedSigningKeys() ScopedKeys
func (*AccountData) SetClusterTraffic ¶ added in v0.0.7
func (a *AccountData) SetClusterTraffic(traffic string) error
func (*AccountData) SetExpiry ¶
func (a *AccountData) SetExpiry(exp int64) error
func (*AccountData) SetExternalAuthorizationUser ¶
func (a *AccountData) SetExternalAuthorizationUser(users []interface{}, accounts []interface{}, encryption string) error
func (*AccountData) SetIssuer ¶ added in v0.0.7
func (a *AccountData) SetIssuer(issuer string) error
func (*AccountData) SetTracingContext ¶
func (a *AccountData) SetTracingContext(opts *TracingContext) error
func (*AccountData) Subject ¶
func (a *AccountData) Subject() string
func (*AccountData) SubjectMappings ¶ added in v0.0.6
func (a *AccountData) SubjectMappings() SubjectMappings
func (*AccountData) Tags ¶
func (a *AccountData) Tags() Tags
func (*AccountData) UnmarshalJSON ¶
func (a *AccountData) UnmarshalJSON(data []byte) error
func (*AccountData) Users ¶
func (a *AccountData) Users() Users
type AccountLimits ¶
type AccountLimits interface {
NatsLimits
EditableNatsLimits
// MaxConnections is the maximum number of connections that can be created
// by the account
MaxConnections() int64
// SetMaxConnections sets the maximum number of connections that can be created
// by the account
SetMaxConnections(max int64) error
// MaxLeafNodeConnections is the maximum number of leaf node connections that can be created
// by the account
MaxLeafNodeConnections() int64
// SetMaxLeafNodeConnections sets the maximum number of leaf node connections that can be created
// by the account
SetMaxLeafNodeConnections(max int64) error
// MaxImports is the maximum number of imports that can be used by the account.
// Note that if some environments may not count environment specific imports to this limit.
MaxImports() int64
// SetMaxImports sets the maximum number of imports that can be used by the account.
SetMaxImports(max int64) error
// MaxExports is the maximum number of exports that can be created by the account.
MaxExports() int64
// SetMaxExports sets the maximum number of exports that can be created by the account.
SetMaxExports(max int64) error
// AllowWildcardExports returns true if the account can create wildcard exports
AllowWildcardExports() bool
// SetAllowWildcardExports sets whether the account can create wildcard exports
SetAllowWildcardExports(tf bool) error
// DisallowBearerTokens returns true if the server should reject bearer tokens for the account.
DisallowBearerTokens() bool
// SetDisallowBearerTokens sets whether the server should reject bearer tokens for the account.
SetDisallowBearerTokens(tf bool) error
// JetStream returns an interface for managing JetStream limits for the account
JetStream() JetStreamTieredLimits
}
AccountLimits is an interface for managing account limits. Normally AccountLimits are managed by the Operator. When managed, any value you set here may be discarded by the Operator.
type AccountTags ¶
type AccountTags struct {
// contains filtered or unexported fields
}
func (*AccountTags) Add ¶
func (at *AccountTags) Add(tag ...string) error
func (*AccountTags) All ¶
func (at *AccountTags) All() ([]string, error)
func (*AccountTags) Contains ¶
func (at *AccountTags) Contains(tag string) bool
func (*AccountTags) Set ¶
func (at *AccountTags) Set(tag ...string) error
type Accounts ¶
type Accounts interface {
// Add creates a new Account with the specified name
Add(name string) (Account, error)
// Delete an Account by matching its name or subject
Delete(name string) error
// Get returns an Account by matching its name or subject
Get(name string) (Account, error)
// List returns a list of Account
List() []Account
}
Accounts is an interface for managing accounts
type Auth ¶
type Auth interface {
// Commit persists the changes made to operators, accounts, users, etc.
Commit() error
// Reload reloads the store from its persisted state
Reload() error
// Operators returns an interface for managing operators
Operators() Operators
}
Auth is the interface for managing the auth store. Auth is created using the NewAuth function
type AuthImpl ¶
type AuthImpl struct {
// contains filtered or unexported fields
}
func NewAuth ¶
func NewAuth(provider AuthProvider) (*AuthImpl, error)
func NewAuthWithOptions ¶
func NewAuthWithOptions(provider AuthProvider, opts *Options) (*AuthImpl, error)
func (*AuthImpl) MarshalJSON ¶
func (*AuthImpl) UnmarshalJSON ¶
type AuthProvider ¶
type AuthProvider interface {
Load() ([]*OperatorData, error)
Store(operators []*OperatorData) error
}
AuthProvider is the interface that wraps the basic Load and Store methods to read/store data into a store. The provider and Auth APIs communicate using the OperatorData, AccountData, and UserData structures.
type BaseData ¶
type BaseData struct {
// Loaded matches the issue time of a loaded JWT (UTC in seconds). When
// the entity is new, it should be 0. The AuthProvider
// stores claims that have been modified and have
// an issue time greater than this value or have been Modified. On Store(),
// it should be set to the tokens issue time.
Loaded int64 `json:"-"`
// Modified is true if the entity has been modified since it was loaded
Modified bool `json:"-"`
// EntityName is the name for the entity - in some cases NSC
// will display simple name which differs from the actual name
// of the entity stored in the JWT.
EntityName string `json:"name"`
// Key is the main identity key for the entity.
Key *Key `json:"key"`
// Token is the JWT for the entity, always kept up-to-date
// by the APIs
Token string `json:"token"`
// contains filtered or unexported fields
}
BaseData is shared across all entities
type ConnectionSources ¶
type ConnectionSources interface {
// Sources returns a list of allowed connection sources
Sources() []string
// Contains returns true if the source is in the list of allowed connection sources
Contains(p string) bool
// Add the specified connection source to the list of allowed sources
Add(p ...string) error
// Remove the specified connection source from the list of allowed sources
Remove(p ...string) error
// Set the list of allowed connection sources
Set(values string) error
}
ConnectionSources is an interface for managing the allowed connection sources. ConnectionSources is a CIDR list of IP addresses that the client is allowed to connect from. If the client is connecting from an IP address that is not in the list, the connection will be rejected.
type ConnectionSourcesImpl ¶
type ConnectionSourcesImpl struct {
UserPermissions
}
func (*ConnectionSourcesImpl) Add ¶
func (c *ConnectionSourcesImpl) Add(p ...string) error
func (*ConnectionSourcesImpl) Contains ¶
func (c *ConnectionSourcesImpl) Contains(p string) bool
func (*ConnectionSourcesImpl) Remove ¶
func (c *ConnectionSourcesImpl) Remove(p ...string) error
func (*ConnectionSourcesImpl) Set ¶
func (c *ConnectionSourcesImpl) Set(values string) error
func (*ConnectionSourcesImpl) Sources ¶
func (c *ConnectionSourcesImpl) Sources() []string
type ConnectionTimes ¶
type ConnectionTimes interface {
// Set sets the allowed connection times
Set(r ...TimeRange) error
// List returns the allowed connection times
List() []TimeRange
}
ConnectionTimes is an interface for managing connection times
type ConnectionTimesImpl ¶
type ConnectionTimesImpl struct {
UserPermissions
}
func (*ConnectionTimesImpl) List ¶
func (t *ConnectionTimesImpl) List() []TimeRange
func (*ConnectionTimesImpl) Set ¶
func (t *ConnectionTimesImpl) Set(r ...TimeRange) error
type ConnectionTypes ¶
type ConnectionTypes interface {
// Set the possible connection types
Set(connType ...string) error
// Types returns a list of connection types that are currently set
Types() []string
}
ConnectionTypes is an interface for managing connection types that the connection can use. You can specify "STANDARD", "WEBSOCKET", "LEAFNODE", "LEAFNODE_WS", "MQTT"
type ConnectionTypesImpl ¶
type ConnectionTypesImpl struct {
UserPermissions
}
func (*ConnectionTypesImpl) Set ¶
func (c *ConnectionTypesImpl) Set(connType ...string) error
func (*ConnectionTypesImpl) Types ¶
func (c *ConnectionTypesImpl) Types() []string
type EditableNatsLimits ¶
type EditableNatsLimits interface {
// SetMaxSubscriptions sets the maximum number of subscriptions that the client can have.
// Set to -1 for unlimited.
SetMaxSubscriptions(max int64) error
// SetMaxPayload sets the maximum payload size that the client can publish in bytes
// Set to -1 for unlimited.
SetMaxPayload(max int64) error
// SetMaxData sets the maximum data size that the client can send bytes
// Set to -1 for unlimited.
SetMaxData(max int64) error
}
type EditableUserLimits ¶
type EditableUserLimits interface {
EditableNatsLimits
// SetBearerToken sets whether the client can use bearer tokens. A bearer token
// is a JWT that doesn't require the client to sign the nonce when connecting. Thus,
// the private key for the client is not required.
SetBearerToken(tf bool) error
// SetLocale sets the locale for the client.
SetLocale(locale string) error
}
EditableUserLimits is an interface for editing the user limits
type Export ¶
type Export interface {
NameSubject
Revocable
TokenRequired() bool
SetTokenRequired(tf bool) error
Description() string
SetDescription(s string) error
InfoURL() string
SetInfoURL(u string) error
AccountTokenPosition() uint
SetAccountTokenPosition(n uint) error
// IsAdvertised returns true if the export is advertised - note that
// the notion of Advertised may not be implemented by the operator
IsAdvertised() bool
// SetAdvertised sets whether the export is advertised - note that
// the notion of Advertised may not be implemented by the operator
SetAdvertised(tf bool) error
// GenerateActivation an activation token for the specified account signed with the specified issuer
GenerateActivation(account string, issuer string) (string, error)
}
type Exports ¶
type Exports interface {
Services() ServiceExports
Streams() StreamExports
}
type Imports ¶
type Imports interface {
Services() ServiceImports
Streams() StreamImports
}
type IssuingService ¶
type JetStreamLimits ¶
type JetStreamLimits interface {
// MaxMemoryStorage returns the maximum amount of memory that
// memory streamExports can allocate across all streamExports in the account.
MaxMemoryStorage() (int64, error)
// SetMaxMemoryStorage sets the maximum amount of memory that
// can be allocated for all streamExports in the account
SetMaxMemoryStorage(max int64) error
// MaxDiskStorage returns the maximum amount of disk storage
// that disk streamExports can allocate across all streamExports in the account.
MaxDiskStorage() (int64, error)
// SetMaxDiskStorage sets the maximum amount of disk storage
// that can be allocated for all streamExports in the account
SetMaxDiskStorage(max int64) error
// MaxMemoryStreamSize returns the maximum size of a memory stream
MaxMemoryStreamSize() (int64, error)
// SetMaxMemoryStreamSize sets the maximum size of a memory stream
SetMaxMemoryStreamSize(max int64) error
// MaxDiskStreamSize returns the maximum size of a disk stream
MaxDiskStreamSize() (int64, error)
// SetMaxDiskStreamSize sets the maximum size of a disk stream
SetMaxDiskStreamSize(max int64) error
// MaxStreamSizeRequired when true requires all stream allocations
// to specify their maximum size.
MaxStreamSizeRequired() (bool, error)
// SetMaxStreamSizeRequired sets whether all stream allocations
// require setting a maximum size
SetMaxStreamSizeRequired(tf bool) error
// MaxStreams is the maximum number of streamExports that can be created
// by the account
MaxStreams() (int64, error)
// SetMaxStreams sets the maximum number of streamExports that can be created
// by the account
SetMaxStreams(max int64) error
// MaxConsumers is the maximum number of consumers that can be created
// by the account
MaxConsumers() (int64, error)
// SetMaxConsumers sets the maximum number of consumers that can be created
// by the account
SetMaxConsumers(max int64) error
// MaxAckPending is the maximum number of messages that can be pending
// for a consumer by default
MaxAckPending() (int64, error)
// SetMaxAckPending sets the maximum number of messages that can be pending
// for a consumer by default
SetMaxAckPending(max int64) error
// IsUnlimited returns true if the limits are unlimited
IsUnlimited() (bool, error)
// SetUnlimited Sets all options to be Unlimited (-1)
SetUnlimited() error
// Delete removes the JetStreamLimit. If the tier is 0, it will disable JetStream.
// Note that after using this function, any update to the limit will fail as the
// limit reference is invalid.
Delete() error
}
JetStreamLimits is an interface for managing JetStream limits
type JetStreamTieredLimits ¶
type JetStreamTieredLimits interface {
// Get returns the JetStreamLimits for the specified tier or nil
// if the tier doesn't exist. Tier 0 is the default tier, and always
// exists, but may be unlimited.
Get(tier int8) (JetStreamLimits, error)
// Add creates a default JetStreamLimits for the specified tier, and
// returns the JetStreamLimits interface for editing the limits.
// Note that you cannot Add tier 0, as it is the default tier and it
// always exists.
Add(tier int8) (JetStreamLimits, error)
// Delete removes the specified tier. If tier is 0, it will disable JetStream.
Delete(tier int8) (bool, error)
// IsJetStreamEnabled returns true if JetStream is enabled for the account
IsJetStreamEnabled() bool
}
JetStreamTieredLimits is an interface for managing JetStreamLimits tiers are expressed as a replication factor. With factor 0 being the default tier, which is applied to non-specified tiers. Use of the global tier is discouraged.
type Keys ¶
type Keys interface {
// Add creates a new signing key returning the public key that was generated. When
// adding an entity specify the public key and the library will locate the private
// key and sign it. Mutations to the entity will re-sign using the same key
Add() (string, error)
// Delete the signing key by matching its public key
Delete(string) (bool, error)
// Rotate the specified signing key with a new one. The new key will be used to
// reissue entities that were issued by the old key. Note that if the account is
// deployed, users issued by the old key will not be able to connect until handed
// new credentials. Rotate is a mechanism for invalidating a signing key and reissuing.
Rotate(string) (string, error)
// List returns a list of signing keys
List() []string
}
Keys is an interface for managing signing keys.
type LatencyOpts ¶
type LatencyOpts struct {
SamplingRate SamplingRate
Subject string
}
type Mapping ¶ added in v0.0.6
type Mapping struct {
// Destination subject
Subject string
// Weight of the mapping from 0 to 100 (representing 100%)
// Note that the sum of all the mappings must not have a weight greater than 100
// If Cluster is specified, the total of each cluster grouping must not exceed 100
Weight uint8
// Optional cluster name, if specified the weight for the cluster is independent
// of the other Cluster or non-clustered mappings
Cluster string
}
type MemResolverConfigBuilder ¶
type MemResolverConfigBuilder struct {
// contains filtered or unexported fields
}
func NewMemResolverConfigBuilder ¶
func NewMemResolverConfigBuilder() *MemResolverConfigBuilder
func (*MemResolverConfigBuilder) Add ¶
func (cb *MemResolverConfigBuilder) Add(rawClaim []byte) error
func (*MemResolverConfigBuilder) Generate ¶
func (cb *MemResolverConfigBuilder) Generate() ([]byte, error)
func (*MemResolverConfigBuilder) GenerateConfig ¶
func (cb *MemResolverConfigBuilder) GenerateConfig() ([]byte, error)
func (*MemResolverConfigBuilder) GenerateDir ¶
func (cb *MemResolverConfigBuilder) GenerateDir() ([]byte, error)
func (*MemResolverConfigBuilder) SetOutputDir ¶
func (cb *MemResolverConfigBuilder) SetOutputDir(fp string) error
func (*MemResolverConfigBuilder) SetSystemAccount ¶
func (cb *MemResolverConfigBuilder) SetSystemAccount(id string) error
type NameSubject ¶
type NatsLimits ¶
type NatsLimits interface {
// MaxSubscriptions returns the maximum number of subscriptions that the client can have
MaxSubscriptions() int64
// MaxPayload returns the maximum payload size that the client can publish in bytes
MaxPayload() int64
// MaxData returns the maximum amount of data that the client can send in bytes
MaxData() int64
}
type Operator ¶
type Operator interface {
// Name returns the name of the operator
Name() string
// Subject returns the identity of the operator
Subject() string
// Accounts returns an interface for managing accounts
Accounts() Accounts
// SigningKeys returns an interface for managing signing keys
SigningKeys() Keys
// SetAccountServerURL sets the account server URL
SetAccountServerURL(url string) error
// AccountServerURL returns the account server URL
AccountServerURL() string
// SetOperatorServiceURL sets the operator service URLs
SetOperatorServiceURL(url ...string) error
// OperatorServiceURLs returns the operator service URLs
OperatorServiceURLs() []string
// SystemAccount returns the system account. If the system account is
// not found or not set, the bool argument is set to false
SystemAccount() (Account, error)
// SetSystemAccount sets the system account
SetSystemAccount(account Account) error
// MemResolver generates a mem resolver server configuration
MemResolver() ([]byte, error)
// SetExpiry sets the expiry for the operator in Unix Time Seconds.
// 0 never expires.
SetExpiry(exp int64) error
// Expiry returns the expiry for the operator in Unix Time Seconds.
// 0 never expires
Expiry() int64
// JWT returns the encoded token
JWT() string
// Tags returns an object that you can use to manage tags for the operator
Tags() Tags
// IssueClaim issues the specified jwt.Claim using the specified operator key
IssueClaim(claim jwt.Claims, key string) (string, error)
}
Operator is an interface for editing the operator
type OperatorData ¶
type OperatorData struct {
BaseData
// OperatorSigningKeys is the list of all current signing keys for
// the operator. All keys should be reachable by the APIs.
OperatorSigningKeys []*Key `json:"signingKeys,omitempty"`
// Claim is the currently decoded version of the JWT. Always up-to-date by
// the APIs.
Claim *jwt.OperatorClaims
// AccountDatas The list of all Accounts for the operator
AccountDatas []*AccountData `json:"accounts"`
// DeletedAccounts is a list of all accounts that were deleted using
// the API. On calling Commit() the AuthProvider will remove them
// and set this to nil.
DeletedAccounts []*AccountData `json:"-"`
// AddedKeys is a list of added keys related to the operator entity tree
AddedKeys []*Key `json:"-"`
// List of deleted keys related to the operator entity tree
DeletedKeys []string `json:"-"`
SigningService IssuingService `json:"-"`
}
func (*OperatorData) AccountServerURL ¶
func (o *OperatorData) AccountServerURL() string
func (*OperatorData) Accounts ¶
func (o *OperatorData) Accounts() Accounts
func (*OperatorData) Delete ¶
func (o *OperatorData) Delete(name string) error
func (*OperatorData) Expiry ¶
func (o *OperatorData) Expiry() int64
func (*OperatorData) IssueClaim ¶ added in v0.0.3
func (*OperatorData) List ¶
func (o *OperatorData) List() []Account
func (*OperatorData) MarshalJSON ¶
func (o *OperatorData) MarshalJSON() ([]byte, error)
func (*OperatorData) MemResolver ¶
func (o *OperatorData) MemResolver() ([]byte, error)
func (*OperatorData) Name ¶
func (o *OperatorData) Name() string
func (*OperatorData) OperatorServiceURLs ¶
func (o *OperatorData) OperatorServiceURLs() []string
func (*OperatorData) SetAccountServerURL ¶
func (o *OperatorData) SetAccountServerURL(url string) error
func (*OperatorData) SetExpiry ¶
func (o *OperatorData) SetExpiry(exp int64) error
func (*OperatorData) SetOperatorServiceURL ¶
func (o *OperatorData) SetOperatorServiceURL(url ...string) error
func (*OperatorData) SetSystemAccount ¶
func (o *OperatorData) SetSystemAccount(account Account) error
func (*OperatorData) SigningKeys ¶
func (o *OperatorData) SigningKeys() Keys
func (*OperatorData) String ¶
func (o *OperatorData) String() string
func (*OperatorData) Subject ¶
func (o *OperatorData) Subject() string
func (*OperatorData) SystemAccount ¶
func (o *OperatorData) SystemAccount() (Account, error)
func (*OperatorData) Tags ¶
func (o *OperatorData) Tags() Tags
func (*OperatorData) UnmarshalJSON ¶
func (o *OperatorData) UnmarshalJSON(data []byte) error
type OperatorTags ¶
type OperatorTags struct {
// contains filtered or unexported fields
}
func (*OperatorTags) Add ¶
func (ot *OperatorTags) Add(tag ...string) error
func (*OperatorTags) All ¶
func (ot *OperatorTags) All() ([]string, error)
func (*OperatorTags) Contains ¶
func (ot *OperatorTags) Contains(tag string) bool
func (*OperatorTags) Set ¶
func (ot *OperatorTags) Set(tag ...string) error
type Operators ¶
type Operators interface {
// List returns a list of Operator
List() []Operator
// Add creates a new Operator with the specified name
Add(name string) (Operator, error)
// Get returns an Operator by name or matching the specified ID
Get(name string) (Operator, error)
// Delete an Operator by name or matching the specified ID
Delete(name string) error
// Import an Operator from JWT bytes and keys
Import(jwt []byte, keys []string) (Operator, error)
}
Operators is an interface for managing operators
type OperatorsImpl ¶
type OperatorsImpl struct {
// contains filtered or unexported fields
}
func (*OperatorsImpl) Delete ¶
func (a *OperatorsImpl) Delete(name string) error
func (*OperatorsImpl) Import ¶
func (a *OperatorsImpl) Import(token []byte, keys []string) (Operator, error)
func (*OperatorsImpl) List ¶
func (a *OperatorsImpl) List() []Operator
type Permissions ¶
type Permissions interface {
// Allow returns a list of allowed NATS subjects
Allow() []string
// SetAllow sets the allowed NATS subjects
SetAllow(subjects ...string) error
// Deny returns a list of NATS subjects that the client is not able to use
Deny() []string
// SetDeny sets the NATS subjects that the client is not able to use
SetDeny(subjects ...string) error
}
Permissions is an interface for managing NATS subject permissions
type PermissionsImpl ¶
type PermissionsImpl struct {
UserPermissions
// contains filtered or unexported fields
}
func (*PermissionsImpl) Allow ¶
func (p *PermissionsImpl) Allow() []string
func (*PermissionsImpl) Deny ¶
func (p *PermissionsImpl) Deny() []string
func (*PermissionsImpl) SetAllow ¶
func (p *PermissionsImpl) SetAllow(subjects ...string) error
func (*PermissionsImpl) SetDeny ¶
func (p *PermissionsImpl) SetDeny(subjects ...string) error
type ResponsePermissions ¶
type ResponsePermissions interface {
// SetMaxMessages sets the maximum number of messages that the client can
// send when responding to a request.
SetMaxMessages(maxMessages int) error
// SetExpires sets the maximum amount of time that the client will be allowed
// to send a response on a reply subject
SetExpires(expires time.Duration) error
// MaxMessages returns the maximum number of messages that the client can
// send when responding to a request.
MaxMessages() int
// Expires returns the amount of time that the client will be allowed
// to send a response on a reply subject
Expires() time.Duration
// Unset removes the response permission
Unset() error
}
ResponsePermissions is an interface for managing whether the client can respond to requests from other clients on the subject of the request. By default, clients are only able to public on publish permissions that is on subjects that the client can publish. ResponsePermissions allow you to allow a requester to set any reply subject it can subscribe to, while constraining the responding client from publishing on unexpected subjects.
type ResponsePermissionsImpl ¶
type ResponsePermissionsImpl struct {
UserPermissions
}
func (*ResponsePermissionsImpl) Expires ¶
func (r *ResponsePermissionsImpl) Expires() time.Duration
func (*ResponsePermissionsImpl) MaxMessages ¶
func (r *ResponsePermissionsImpl) MaxMessages() int
func (*ResponsePermissionsImpl) SetExpires ¶
func (r *ResponsePermissionsImpl) SetExpires(expires time.Duration) error
func (*ResponsePermissionsImpl) SetMaxMessages ¶
func (r *ResponsePermissionsImpl) SetMaxMessages(maxMessages int) error
func (*ResponsePermissionsImpl) Unset ¶
func (r *ResponsePermissionsImpl) Unset() error
type Revocable ¶
type Revocable interface {
Revocations() Revocations
}
type RevocationEntry ¶
func NewRevocationEntry ¶
func NewRevocationEntry(key string, before time.Time) RevocationEntry
type Revocations ¶
type Revocations interface {
// Add revoke the specified nkey for credentials issued on the specified date or earlier
// The special `*` key targets all entities
Add(key string, at time.Time) error
// Delete deletes the specified nkey from the revocation list
Delete(key string) (bool, error)
// Compact removes revocations that are handled by a more recent wildcard revocation
Compact() ([]RevocationEntry, error)
// List returns a copy of current Revocations
List() []RevocationEntry
// Set replaces the current revocation list with the provided one
Set(revocations []RevocationEntry) error
// Contains returns true if the public key or "*" is in the revocation list
Contains(key string) (bool, error)
}
type SamplingRate ¶
type SamplingRate int
type ScopeImpl ¶
type ScopeImpl struct {
UserPermissions
}
func (*ScopeImpl) Description ¶
func (*ScopeImpl) SetDescription ¶
type ScopeLimits ¶
type ScopeLimits interface {
UserLimits
// Key returns the public key associated with the scope
Key() string
// Role returns the role associated with the scope. The role is simply a name
// that you can use to identify the scope. It is not used by the server.
Role() string
// SetRole sets the role associated with the scope. The role is simply a name
// that you can use to identify the scope. It is not used by the server.
SetRole(name string) error
// Description returns an user-assigned description associated with the scope.
Description() string
// SetDescription sets an user-assigned description associated with the scope.
SetDescription(description string) error
}
ScopeLimits is an interface for managing the limits and permissions for a connection by simply issuing the user with a signing key.
type ScopedKeys ¶
type ScopedKeys interface {
// Add creates a new signing key returning the public key that was generated. Note
// this is not a scoped key, but a general signing key
Add() (string, error)
// Delete the specified signing key and any underlying scope
Delete(string) (bool, error)
// Rotate the specified key with a new one. The old key is deleted and the new key
// is used to reissue any entities that were issued by the old key.
Rotate(string) (string, error)
// AddScope creates a new scope with the specified role, and associates it with
// a new signing key.
AddScope(role string) (ScopeLimits, error)
// GetScope returns the scope associated with the specified key.
// Note that if the signing key is not scoped, it returns a not found error
GetScope(string) (ScopeLimits, error)
// GetScopeByRole returns the first scope that matches the specified role.
// Note that the search must be an exact match of the scope role, and
GetScopeByRole(string) ([]ScopeLimits, error)
// List returns a list of signing keys
List() []string
// ListRoles returns the names of roles associated with the account
// Note that role names can be duplicated, and this name of roles
// will not contain duplicates so long as roles have the same capitalization, etc.
ListRoles() []string
// Contains returns found as true if the signing key was found, and isScoped as true
// if the signing key is scoped.
Contains(sk string) (found bool, isScoped bool)
}
ScopedKeys is an interface for managing scoped signing keys
type ScopedSigningKeys ¶
type ScopedSigningKeys interface {
// SigningKeys returns an interface for managing scoped signing keys
SigningKeys() ScopedKeys
}
ScopedSigningKeys is an interface for managing scoped signing keys that have an associated ScopeLimits with them. When a signing key has an associated ScopeLimits, the ScopeLimits are applied to the user at runtime by the NATS server.
type ServiceExport ¶
type ServiceExport interface {
Export
// GetLatencyOptions returns the LatencyOpts if enabled otherwise nil
GetLatencyOptions() *LatencyOpts
// SetLatencyOptions enables latency tracing for a service, if nil, the latency tracing is disabled
SetLatencyOptions(config *LatencyOpts) error
// GenerateImport generates an import that can be added to an Account
GenerateImport() (ServiceImport, error)
// AllowTracing returns true if the service export allows tracing
AllowTracing() bool
// SetAllowTracing enables tracing messages to follow the service implementation
SetAllowTracing(tf bool) error
// SetResponseType sets the response type for the export
SetResponseType(string) error
// ResponseType returns the response type for the export
ResponseType() string
}
func NewServiceExport ¶
func NewServiceExport(name string, subject string) (ServiceExport, error)
type ServiceExportImpl ¶
type ServiceExportImpl struct {
// contains filtered or unexported fields
}
func (*ServiceExportImpl) AccountTokenPosition ¶
func (b *ServiceExportImpl) AccountTokenPosition() uint
func (*ServiceExportImpl) AllowTracing ¶
func (b *ServiceExportImpl) AllowTracing() bool
func (*ServiceExportImpl) Description ¶
func (b *ServiceExportImpl) Description() string
func (*ServiceExportImpl) GenerateActivation ¶
func (*ServiceExportImpl) GenerateActivationForSubject ¶
func (*ServiceExportImpl) GenerateImport ¶
func (b *ServiceExportImpl) GenerateImport() (ServiceImport, error)
func (*ServiceExportImpl) GetLatencyOptions ¶
func (b *ServiceExportImpl) GetLatencyOptions() *LatencyOpts
func (*ServiceExportImpl) IsAdvertised ¶
func (b *ServiceExportImpl) IsAdvertised() bool
func (*ServiceExportImpl) ResponseType ¶ added in v0.0.10
func (b *ServiceExportImpl) ResponseType() string
func (*ServiceExportImpl) Revocations ¶
func (b *ServiceExportImpl) Revocations() Revocations
func (*ServiceExportImpl) SetAccountTokenPosition ¶
func (*ServiceExportImpl) SetAdvertised ¶
func (*ServiceExportImpl) SetAllowTracing ¶
func (b *ServiceExportImpl) SetAllowTracing(tf bool) error
func (*ServiceExportImpl) SetDescription ¶
func (*ServiceExportImpl) SetInfoURL ¶
func (*ServiceExportImpl) SetLatencyOptions ¶
func (b *ServiceExportImpl) SetLatencyOptions(t *LatencyOpts) error
func (*ServiceExportImpl) SetResponseType ¶ added in v0.0.10
func (b *ServiceExportImpl) SetResponseType(tf string) error
func (*ServiceExportImpl) SetSubject ¶
func (*ServiceExportImpl) SetTokenRequired ¶
func (*ServiceExportImpl) TokenRequired ¶
func (b *ServiceExportImpl) TokenRequired() bool
type ServiceExports ¶
type ServiceExports interface {
// Add creates and adds a new public service with the specified name and subject
Add(name string, subject string) (ServiceExport, error)
// AddWithConfig adds a copy of the specified configuration to the account
AddWithConfig(e ServiceExport) error
// Get returns the ServiceExport matching the subject
Get(subject string) (ServiceExport, error)
// Delete deletes the ServiceExport matching the subject
Delete(subject string) (bool, error)
// GetByName returns the ServiceExport matching the specified name,
// note that the first service is returned
GetByName(name string) (ServiceExport, error)
// List returns a list of ServiceExport in the account
List() []ServiceExport
// Set replaces all serviceExports with the specified ones
Set(exports ...ServiceExport) error
}
type ServiceImport ¶
type ServiceImport interface {
Import
}
func NewServiceImport ¶
func NewServiceImport(name string, account string, subject string) (ServiceImport, error)
type ServiceImportImpl ¶
type ServiceImportImpl struct {
// contains filtered or unexported fields
}
func (*ServiceImportImpl) IsShareConnectionInfo ¶
func (b *ServiceImportImpl) IsShareConnectionInfo() bool
func (*ServiceImportImpl) LocalSubject ¶
func (b *ServiceImportImpl) LocalSubject() string
func (*ServiceImportImpl) SetAccount ¶
func (*ServiceImportImpl) SetLocalSubject ¶
func (*ServiceImportImpl) SetShareConnectionInfo ¶
func (*ServiceImportImpl) SetSubject ¶
func (*ServiceImportImpl) Type ¶
func (b *ServiceImportImpl) Type() jwt.ExportType
type ServiceImports ¶
type ServiceImports interface {
// Add creates and adds a new import of a public service importing the
// specified subject from the specified account
Add(name string, account string, subject string) (ServiceImport, error)
// AddWithConfig adds a copy of the specified import configuration to the account
AddWithConfig(i ServiceImport) error
// Get returns imports that are exported by accounts under the specified subject
Get(subject string) (ServiceImport, error)
// GetByName returns an import stored under the specified name. Note that
// the first import is returned.
GetByName(name string) (ServiceImport, error)
Delete(subject string) (bool, error)
List() []ServiceImport
Set(imports ...ServiceImport) error
}
type SigningKeys ¶
type SigningKeys interface {
SigningKeys() Keys
}
SigningKeys is an interface for managing signing keys
type StreamExport ¶
type StreamExport interface {
Export
GenerateImport() (StreamImport, error)
}
func NewStreamExport ¶
func NewStreamExport(name string, subject string) (StreamExport, error)
type StreamExportImpl ¶
type StreamExportImpl struct {
// contains filtered or unexported fields
}
func (*StreamExportImpl) AccountTokenPosition ¶
func (b *StreamExportImpl) AccountTokenPosition() uint
func (*StreamExportImpl) Description ¶
func (b *StreamExportImpl) Description() string
func (*StreamExportImpl) GenerateActivation ¶
func (*StreamExportImpl) GenerateActivationForSubject ¶
func (*StreamExportImpl) GenerateImport ¶
func (b *StreamExportImpl) GenerateImport() (StreamImport, error)
func (*StreamExportImpl) IsAdvertised ¶
func (b *StreamExportImpl) IsAdvertised() bool
func (*StreamExportImpl) Revocations ¶
func (b *StreamExportImpl) Revocations() Revocations
func (*StreamExportImpl) SetAccountTokenPosition ¶
func (*StreamExportImpl) SetAdvertised ¶
func (*StreamExportImpl) SetDescription ¶
func (*StreamExportImpl) SetInfoURL ¶
func (*StreamExportImpl) SetSubject ¶
func (*StreamExportImpl) SetTokenRequired ¶
func (*StreamExportImpl) TokenRequired ¶
func (b *StreamExportImpl) TokenRequired() bool
type StreamExports ¶
type StreamExports interface {
// Add creates and add a new public stream with the specified name and subject
Add(name string, subject string) (StreamExport, error)
// AddWithConfig adds a copy of the specified configuration to the account
AddWithConfig(e StreamExport) error
// Get returns the StreamExport matching the subject or nil if not found
Get(subject string) (StreamExport, error)
// Delete deletes the StreamExport matching the subject
Delete(subject string) (bool, error)
// GetByName returns the StreamExport matching the specified name,
// note that the first stream is returned
GetByName(name string) (StreamExport, error)
// List returns a list of StreamExport in the account
List() []StreamExport
// Set replaces all streamExports with the specified ones
Set(exports ...StreamExport) error
}
type StreamImport ¶
type StreamImport interface {
Import
// AllowTracing returns true if the service export allows tracing
AllowTracing() bool
// SetAllowTracing enables tracing messages to follow the service implementation
SetAllowTracing(tf bool) error
}
func NewStreamImport ¶
func NewStreamImport(name string, account string, subject string) (StreamImport, error)
type StreamImportImpl ¶
type StreamImportImpl struct {
// contains filtered or unexported fields
}
func (*StreamImportImpl) AllowTracing ¶
func (b *StreamImportImpl) AllowTracing() bool
func (*StreamImportImpl) IsShareConnectionInfo ¶
func (b *StreamImportImpl) IsShareConnectionInfo() bool
func (*StreamImportImpl) LocalSubject ¶
func (b *StreamImportImpl) LocalSubject() string
func (*StreamImportImpl) SetAccount ¶
func (*StreamImportImpl) SetAllowTracing ¶
func (b *StreamImportImpl) SetAllowTracing(tf bool) error
func (*StreamImportImpl) SetLocalSubject ¶
func (*StreamImportImpl) SetShareConnectionInfo ¶
func (*StreamImportImpl) SetSubject ¶
func (*StreamImportImpl) Type ¶
func (b *StreamImportImpl) Type() jwt.ExportType
type StreamImports ¶
type StreamImports interface {
Add(name string, account string, subject string) (StreamImport, error)
Get(subject string) (StreamImport, error)
GetByName(name string) (StreamImport, error)
Delete(subject string) (bool, error)
List() []StreamImport
Set(imports ...StreamImport) error
AddWithConfig(i StreamImport) error
}
type SubjectMappings ¶ added in v0.0.6
type SubjectMappingsImpl ¶ added in v0.0.6
type SubjectMappingsImpl struct {
// contains filtered or unexported fields
}
func (*SubjectMappingsImpl) Delete ¶ added in v0.0.6
func (m *SubjectMappingsImpl) Delete(subject string) error
func (*SubjectMappingsImpl) Get ¶ added in v0.0.6
func (m *SubjectMappingsImpl) Get(subject string) Mappings
func (*SubjectMappingsImpl) List ¶ added in v0.0.6
func (m *SubjectMappingsImpl) List() []string
type TimeRange ¶
type TimeRange struct {
// Start is the start time in the format HH:MM:SS
Start string
// End is the end time in the format HH:MM:SS
End string
}
TimeRange is a time range
type TracingContext ¶
type User ¶
type User interface {
// Name returns the name for the user
Name() string
// IsScoped returns true if the user is a scoped user - that is signed
// with a signing key that has associated user permissions or ScopeLimits.
// If a user is scoped, you cannot edit its limits or permissions, as
// a scoped user must have no permissions associated with it. At runtime
// the server will assign the exact permissions defined by the ScopeLimits
IsScoped() bool
// Subject returns the identity of the user
Subject() string
// Creds generates a credentials for the specified user. A credentials file is
// an armored JWT and nkey secret that a client can use to connect to NATS.
Creds(expiry time.Duration) ([]byte, error)
// Issuer returns the issuer of the user. Typically, this will be the account's
// ID or a signing key. If it is a signing key, IssuerAccount will return the
// ID of the account owning the user
Issuer() string
// IssuerAccount returns the ID of the account owning the user. Note that if not set,
// it returns Issuer
IssuerAccount() string
// JWT returns the encoded token
JWT() string
// Tags returns an object that you can use to manage tags for the account
Tags() Tags
UserLimits
}
User is an interface for editing a User
type UserData ¶
type UserData struct {
BaseData
AccountData *AccountData
RejectEdits bool
Claim *jwt.UserClaims
Ephemeral bool
}
func (*UserData) BearerToken ¶
func (*UserData) ConnectionSources ¶
func (u *UserData) ConnectionSources() ConnectionSources
func (*UserData) ConnectionTimes ¶
func (u *UserData) ConnectionTimes() ConnectionTimes
func (*UserData) ConnectionTypes ¶
func (u *UserData) ConnectionTypes() ConnectionTypes
func (*UserData) IssuerAccount ¶
func (*UserData) MarshalJSON ¶
func (*UserData) MaxPayload ¶
func (*UserData) MaxSubscriptions ¶
func (*UserData) PubPermissions ¶
func (u *UserData) PubPermissions() Permissions
func (*UserData) ResponsePermissions ¶
func (u *UserData) ResponsePermissions() ResponsePermissions
func (*UserData) SetBearerToken ¶
func (*UserData) SetMaxData ¶
func (*UserData) SetMaxPayload ¶
func (*UserData) SetMaxSubscriptions ¶
func (*UserData) SetUserPermissionLimits ¶
func (u *UserData) SetUserPermissionLimits(limits jwt.UserPermissionLimits) error
func (*UserData) SubPermissions ¶
func (u *UserData) SubPermissions() Permissions
func (*UserData) UnmarshalJSON ¶
func (*UserData) UserPermissionLimits ¶
func (u *UserData) UserPermissionLimits() jwt.UserPermissionLimits
type UserLimits ¶
type UserLimits interface {
EditableUserLimits
NatsLimits
// BearerToken returns true if the client can use bearer tokens
BearerToken() bool
// Locale returns the locale for the client.
Locale() string
// ConnectionTypes returns an interface for managing connection types
ConnectionTypes() ConnectionTypes
// ConnectionSources returns an interface for managing connection sources
ConnectionSources() ConnectionSources
// ConnectionTimes returns an interface for maintaining connection times
ConnectionTimes() ConnectionTimes
// PubPermissions returns an interface for managing NATS subjects that the client can publish.
PubPermissions() Permissions
// SubPermissions returns an interface for managing NATS subjects that a client can create subscriptions on.
SubPermissions() Permissions
// ResponsePermissions returns an interface for managing whether the client can respond
// to requests that have a reply subject different from its publish permissions.
ResponsePermissions() ResponsePermissions
}
UserLimits is an interface for managing the user limits
type UserPermissions ¶
type UserPermissions struct {
// contains filtered or unexported fields
}
func (*UserPermissions) BearerToken ¶
func (u *UserPermissions) BearerToken() bool
func (*UserPermissions) ConnectionSources ¶
func (u *UserPermissions) ConnectionSources() ConnectionSources
func (*UserPermissions) ConnectionTimes ¶
func (u *UserPermissions) ConnectionTimes() ConnectionTimes
func (*UserPermissions) ConnectionTypes ¶
func (u *UserPermissions) ConnectionTypes() ConnectionTypes
func (*UserPermissions) Locale ¶
func (u *UserPermissions) Locale() string
func (*UserPermissions) MaxData ¶
func (u *UserPermissions) MaxData() int64
func (*UserPermissions) MaxPayload ¶
func (u *UserPermissions) MaxPayload() int64
func (*UserPermissions) MaxSubscriptions ¶
func (u *UserPermissions) MaxSubscriptions() int64
func (*UserPermissions) PubPermissions ¶
func (u *UserPermissions) PubPermissions() Permissions
func (*UserPermissions) ResponsePermissions ¶
func (u *UserPermissions) ResponsePermissions() ResponsePermissions
func (*UserPermissions) SetBearerToken ¶
func (u *UserPermissions) SetBearerToken(tf bool) error
func (*UserPermissions) SetLocale ¶
func (u *UserPermissions) SetLocale(locale string) error
func (*UserPermissions) SetMaxData ¶
func (u *UserPermissions) SetMaxData(max int64) error
func (*UserPermissions) SetMaxPayload ¶
func (u *UserPermissions) SetMaxPayload(max int64) error
func (*UserPermissions) SetMaxSubscriptions ¶
func (u *UserPermissions) SetMaxSubscriptions(max int64) error
func (*UserPermissions) SetUserPermissionLimits ¶
func (u *UserPermissions) SetUserPermissionLimits(limits jwt.UserPermissionLimits) error
func (*UserPermissions) SubPermissions ¶
func (u *UserPermissions) SubPermissions() Permissions
func (*UserPermissions) UserPermissionLimits ¶
func (u *UserPermissions) UserPermissionLimits() jwt.UserPermissionLimits
type Users ¶
type Users interface {
// Add creates a new User with the specified name and signed using
// the specified signer key. Note that you simply specify the public key
// you want to use for signing, and the key must be one of the account's
// signing keys. If the key is associated with a scope, the user will
// be a scoped user.
Add(name string, signer string) (User, error)
// AddWithIdentity creates user with the specified name and signed using
// the specified signer key.
// If the provided ID is only a public key the user will be ephemeral and will not stored,
// other operations, as cred generation will fail
AddWithIdentity(name string, signer string, id string) (User, error)
// ImportEphemeral imports an ephemeral user from a claim
ImportEphemeral(c *jwt.UserClaims, key string) (User, error)
// Delete the user by matching its name or subject
Delete(name string) error
// Get returns the user by matching its name or subject
Get(name string) (User, error)
// List returns a list of User from the account
List() []User
}
Users is an interface for managing users
type UsersImpl ¶
type UsersImpl struct {
// contains filtered or unexported fields
}