loginrule

package
v0.0.0-...-5c79d48 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UnmarshalLoginRule

func UnmarshalLoginRule(raw []byte) (*loginrulepb.LoginRule, error)

UnmarshalLoginRule parses a login rule in the Resource format which matches the expected YAML format for Teleport resources, sets default values, and converts to *loginrulepb.LoginRule.

Types

type Command

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

Command implements all commands under "tctl login_rule".

func (*Command) Initialize

func (t *Command) Initialize(app *kingpin.Application, cfg *servicecfg.Config)

Initialize installs the base "login_rule" command and all subcommands.

func (*Command) TryRun

func (t *Command) TryRun(ctx context.Context, selectedCommand string, c auth.ClientI) (match bool, err error)

TryRun calls tryRun for each subcommand, and if none of them match returns (false, nil)

type Resource

type Resource struct {
	// ResourceHeader is embedded to implement types.Resource
	types.ResourceHeader
	// Spec is the login rule specification
	Spec spec `json:"spec"`
}

Resource is a type to represent login rules which implements types.Resource and custom YAML (un)marshaling. This satisfies the expected YAML format for the resource, which would be hard/impossible to do for loginrulepb.LoginRule directly. Specifically, protoc-gen-go does not have good support for parsing a map[string][]string from YAML.

func ProtoToResource

func ProtoToResource(rule *loginrulepb.LoginRule) *Resource

ProtoToResource converts a *loginrulepb.LoginRule into a *Resource which implements types.Resource and can be marshaled to YAML or JSON in a human-friendly format.

func (*Resource) CheckAndSetDefaults

func (r *Resource) CheckAndSetDefaults() error

CheckAndSetDefaults sanity checks Resource fields to catch simple errors, and sets default values for all fields with defaults.

Jump to

Keyboard shortcuts

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