ticket

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package ticket provides functionality to work with MapR tickets, including parsing tickets either from their raw string representation or from Kubernetes secrets.

The package relies on https://pkg.go.dev/github.com/nobbs/mapr-ticket-parser for the actual ticket parsing. Most of the functionality in this package is just a wrapper around the parser to add some convenience methods.

Index

Constants

View Source
const (
	// SecretMaprTicketKey is the key used for MapR tickets in secrets
	SecretMaprTicketKey = "CONTAINER_TICKET"

	// DefaultTimeFormat is the default time format used for human readable time strings
	DefaultTimeFormat = time.RFC3339
)

Variables

This section is empty.

Functions

func SecretContainsMaprTicket

func SecretContainsMaprTicket(secret *coreV1.Secret) bool

SecretContainsMaprTicket returns true if the secret contains the key typically used for MapR tickets

Types

type ErrSecretDoesNotContainMaprTicket

type ErrSecretDoesNotContainMaprTicket struct {
	Name      string
	Namespace string
}

SecretContainsMaprTicket returns true if the secret contains the key typically used for MapR tickets

func NewErrSecretDoesNotContainMaprTicket

func NewErrSecretDoesNotContainMaprTicket(namespace, name string) ErrSecretDoesNotContainMaprTicket

NewErrSecretDoesNotContainMaprTicket returns a new ErrSecretDoesNotContainMaprTicket

func (ErrSecretDoesNotContainMaprTicket) Error

Error returns the error message for ErrSecretDoesNotContainMaprTicket

type Ticket

type Ticket parse.MaprTicket

Wrapper around parse.Ticket to add methods

func NewMaprTicket

func NewMaprTicket() *Ticket

NewMaprTicket returns a new empty MaprTicket

func NewMaprTicketFromBytes added in v0.4.0

func NewMaprTicketFromBytes(ticketBytes []byte) (*Ticket, error)

NewMaprTicketFromBytes parses the ticket from the given bytes and returns it

func NewMaprTicketFromSecret

func NewMaprTicketFromSecret(secret *coreV1.Secret) (*Ticket, error)

NewMaprTicketFromSecret parses the ticket from the secret and returns it

func (*Ticket) AsMaprTicket

func (ticket *Ticket) AsMaprTicket() *parse.MaprTicket

AsMaprTicket returns the ticket as a parse.MaprTicket object

func (*Ticket) CreationTime

func (ticket *Ticket) CreationTime() time.Time

CreationTime returns the creation time of the ticket as a time.Time object

func (*Ticket) ExpirationTime

func (ticket *Ticket) ExpirationTime() time.Time

ExpirationTime returns the expiry time of the ticket as a time.Time object

func (*Ticket) ExpiresBefore

func (ticket *Ticket) ExpiresBefore(duration time.Duration) bool

ExpiresBefore returns true if the ticket expires before the given duration

func (*Ticket) GetCluster

func (ticket *Ticket) GetCluster() string

GetCluster returns the cluster that the ticket is for

func (*Ticket) GetUser

func (ticket *Ticket) GetUser() string

GetUser returns the user that the ticket is for

func (*Ticket) IsExpired

func (ticket *Ticket) IsExpired() bool

isExpired returns true if the ticket is expired

Jump to

Keyboard shortcuts

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