tokens

package
v0.0.0-...-982e07a Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package tokens defines reusable business logic of "acra-tokens" utility.

Index

Constants

View Source
const CmdTokenDisable = "disable"

CmdTokenDisable is the name of "acra-tokens disable" subcommand.

View Source
const CmdTokenEnable = "enable"

CmdTokenEnable is the name of "acra-tokens enable" subcommand.

View Source
const CmdTokenRemove = "remove"

CmdTokenRemove is the name of "acra-tokens remove" subcommand.

View Source
const CmdTokenStatus = "status"

CmdTokenStatus is the name of "acra-tokens status" subcommand.

View Source
const ServiceName = "acra-tokens"

ServiceName constant for logging and configuration parsing.

Variables

DefaultConfigPath is the default path to service configuration file.

View Source
var ErrInvalidDateTime = errors.New("unrecognized date format")

ErrInvalidDateTime is returned when we can't parse the time string provided by the user.

View Source
var (
	ErrInvalidTokenStorage = errors.New("token storage is configured incorrectly")
)

Errors returned by token storage parameter parsing.

View Source
var (
	ErrRemoveNotSpecified = errors.New("underspecified removal conditions")
)

Errors returned by "acra-tokens remove" subcommand.

View Source
var (
	ErrUnknownSubCommand = errors.New("unknown command")
)

Comman-line parsing errors:

Functions

This section is empty.

Types

type CommonDateParameters

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

CommonDateParameters is a mix-in of command line parameters for date limits.

func (*CommonDateParameters) AccessedWithinLimits

func (p *CommonDateParameters) AccessedWithinLimits(accessTime time.Time) bool

AccessedWithinLimits returns true if the access time is within specified limits.

func (*CommonDateParameters) CreatedWithinLimits

func (p *CommonDateParameters) CreatedWithinLimits(creationTime time.Time) bool

CreatedWithinLimits returns true if the creation time is within specified limits.

func (*CommonDateParameters) Register

func (p *CommonDateParameters) Register(flags *flag.FlagSet)

Register registers token storage flags with the given flag set.

func (*CommonDateParameters) Validate

func (p *CommonDateParameters) Validate() error

Validate date limit parameters.

type CommonTokenStorageParameters

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

CommonTokenStorageParameters is a mix-in of command line parameters for token storage construction.

func (*CommonTokenStorageParameters) BoltDBConfigured

func (p *CommonTokenStorageParameters) BoltDBConfigured() bool

BoltDBConfigured returns true if BoltDB is configured.

func (*CommonTokenStorageParameters) Open

Open a token storage based on the command-line configuration.

func (*CommonTokenStorageParameters) Register

func (p *CommonTokenStorageParameters) Register(flags *flag.FlagSet)

Register registers token storage flags with the given flag set.

func (*CommonTokenStorageParameters) Validate

func (p *CommonTokenStorageParameters) Validate(extractor *args.ServiceExtractor) error

Validate token storage parameter set.

type DisableSubcommand

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

DisableSubcommand is the "acra-tokens disable" subcommand.

func (*DisableSubcommand) Execute

func (s *DisableSubcommand) Execute()

Execute this subcommand.

func (*DisableSubcommand) FlagSet

func (s *DisableSubcommand) FlagSet() *flag.FlagSet

FlagSet returns flag set of this subcommand.

func (*DisableSubcommand) Name

func (s *DisableSubcommand) Name() string

Name returns the same of this subcommand.

func (*DisableSubcommand) Parse

func (s *DisableSubcommand) Parse(arguments []string) error

Parse command-line parameters of the subcommand.

func (*DisableSubcommand) RegisterFlags

func (s *DisableSubcommand) RegisterFlags()

RegisterFlags registers command-line flags of this subcommand.

type EnableSubcommand

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

EnableSubcommand is the "acra-tokens enable" subcommand.

func (*EnableSubcommand) Execute

func (s *EnableSubcommand) Execute()

Execute this subcommand.

func (*EnableSubcommand) FlagSet

func (s *EnableSubcommand) FlagSet() *flag.FlagSet

FlagSet returns flag set of this subcommand.

func (*EnableSubcommand) Name

func (s *EnableSubcommand) Name() string

Name returns the same of this subcommand.

func (*EnableSubcommand) Parse

func (s *EnableSubcommand) Parse(arguments []string) error

Parse command-line parameters of the subcommand.

func (*EnableSubcommand) RegisterFlags

func (s *EnableSubcommand) RegisterFlags()

RegisterFlags registers command-line flags of this subcommand.

type RemoveSubcommand

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

RemoveSubcommand is the "acra-tokens remove" subcommand.

func (*RemoveSubcommand) Execute

func (s *RemoveSubcommand) Execute()

Execute this subcommand.

func (*RemoveSubcommand) FlagSet

func (s *RemoveSubcommand) FlagSet() *flag.FlagSet

FlagSet returns flag set of this subcommand.

func (*RemoveSubcommand) Name

func (s *RemoveSubcommand) Name() string

Name returns the same of this subcommand.

func (*RemoveSubcommand) Parse

func (s *RemoveSubcommand) Parse(arguments []string) error

Parse command-line parameters of the subcommand.

func (*RemoveSubcommand) RegisterFlags

func (s *RemoveSubcommand) RegisterFlags()

RegisterFlags registers command-line flags of this subcommand.

type StatusSubcommand

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

StatusSubcommand is the "acra-tokens status" subcommand.

func (*StatusSubcommand) Execute

func (s *StatusSubcommand) Execute()

Execute this subcommand.

func (*StatusSubcommand) FlagSet

func (s *StatusSubcommand) FlagSet() *flag.FlagSet

FlagSet returns flag set of this subcommand.

func (*StatusSubcommand) Name

func (s *StatusSubcommand) Name() string

Name returns the same of this subcommand.

func (*StatusSubcommand) Parse

func (s *StatusSubcommand) Parse(arguments []string) error

Parse command-line parameters of the subcommand.

func (*StatusSubcommand) RegisterFlags

func (s *StatusSubcommand) RegisterFlags()

RegisterFlags registers command-line flags of this subcommand.

type Subcommand

type Subcommand interface {
	Name() string
	RegisterFlags()
	FlagSet() *flag.FlagSet
	Parse(arguments []string) error
	Execute()
}

Subcommand is "acra-tokens" subcommand.

func ParseParameters

func ParseParameters(subcommands []Subcommand) Subcommand

ParseParameters parses command-line parameters and returns the selected subcommand. There may be no subcommand selected, in which case nil is returned. It terminates the process on error.

Jump to

Keyboard shortcuts

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