model

package
v0.0.0-...-d31a008 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClaimAnnotationPrefix = "cinderella/claim."
)

Variables

View Source
var (
	ErrorRequireNamespace = &ClaimValidationError{mes: "Require Namespace field", field: "Namespaces", errorType: "empty value"}
	ErrorRequireSubject   = &ClaimValidationError{mes: "Require Subject field", field: "Subject", errorType: "empty value"}
)

Functions

func NormalizeDNS1123

func NormalizeDNS1123(str string) (string, error)

TODO utilへ

Types

type Claim

type Claim struct {
	ClaimAt          time.Time           `json:"claim_date"`
	Description      string              `json:"description"`
	Email            string              `json:"email,omitempty" validate:"email"`
	EncryptType      encrypt.EncryptType `json:"encrypt_type,omitempty"`
	Name             string              `json:"name,omitempty"`
	Namespaces       []string            `json:"namespace"`
	State            ClaimStatus         `json:"status"`
	Subject          string              `json:"subject,omitempty" validate:"required"`
	ZipEncryptOption `json:"zip_option,omitempty"`
	GPGEncryptOption `json:"gpg_option,omitempty"`

	AcceptedAt time.Time `json:"accepted_at,omitempty"`
	RejectedAt time.Time `json:"rejected_at,omitempty"`
	ExpredAt   time.Time `json:"expred_at,omitempty"`
}

TODO: implement period(制限時間)

func NewClaimBase

func NewClaimBase(opts ...ClaimOption) *Claim

func (*Claim) Accept

func (c *Claim) Accept()

func (*Claim) GetAnnotations

func (c *Claim) GetAnnotations() map[string]string

func (*Claim) GetClaimAt

func (c *Claim) GetClaimAt() time.Time

func (*Claim) GetDescription

func (c *Claim) GetDescription() string

func (*Claim) GetEmail

func (c *Claim) GetEmail() string

func (*Claim) GetEncryptType

func (c *Claim) GetEncryptType() encrypt.EncryptType

func (*Claim) GetLabels

func (c *Claim) GetLabels() map[string]string

func (*Claim) GetName

func (c *Claim) GetName() string

func (*Claim) GetNamespaces

func (c *Claim) GetNamespaces() []string

func (*Claim) GetServiceAccountName

func (c *Claim) GetServiceAccountName() (string, error)

func (*Claim) GetState

func (c *Claim) GetState() ClaimStatus

func (*Claim) GetSubject

func (c *Claim) GetSubject() string

func (*Claim) GetZipPassword

func (c *Claim) GetZipPassword() string

TODO: 暫定

func (*Claim) Reject

func (c *Claim) Reject()

func (*Claim) SetZipPassword

func (c *Claim) SetZipPassword(password string)

TODO: 暫定

func (*Claim) Validate

func (c *Claim) Validate() error

type ClaimOption

type ClaimOption interface {
	Apply(*Claim)
}

type ClaimRegisterEvent

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

func (*ClaimRegisterEvent) EventAt

func (e *ClaimRegisterEvent) EventAt() time.Time

func (*ClaimRegisterEvent) GetMessage

func (e *ClaimRegisterEvent) GetMessage() string

func (*ClaimRegisterEvent) GetType

func (e *ClaimRegisterEvent) GetType() audit.AuditType

type ClaimStatus

type ClaimStatus string
const (
	ClaimStatusAccepted ClaimStatus = "accepted"
	ClaimStatusRejected ClaimStatus = "rejected"
	ClaimStatusPending  ClaimStatus = "pending"
	ClaimStatusExpired  ClaimStatus = "expired"
)

type ClaimValidationError

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

func (*ClaimValidationError) Error

func (err *ClaimValidationError) Error() string

func (*ClaimValidationError) Is

func (err *ClaimValidationError) Is(e error) bool

type GPGEncryptOption

type GPGEncryptOption struct {
	PublicKey string `json:"-"`
}

type ZipEncryptOption

type ZipEncryptOption struct {
	ZipPassword string `json:"-"`
}

func WithZipEncryptOption

func WithZipEncryptOption(opt ZipEncryptOption) ZipEncryptOption

func (ZipEncryptOption) Apply

func (opt ZipEncryptOption) Apply(c *Claim)

Jump to

Keyboard shortcuts

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