eid

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: MIT Imports: 6 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SortFunc

func SortFunc(a, b EID) int

Types

type EID

type EID struct {
	// Type of the entity.
	// e.g. in GCP::Project::dev
	// it is 'GCP::Project'
	Type string `json:"type"`

	// ID of the entity.
	// e.g. in GCP::Project::dev
	// it is 'dev'
	ID string `json:"id"`
}

EID is a unique identifier for an entity which includes both it's type and ID.

e.g. 'GCP::Project::dev'

func FromAPI

func FromAPI(eid *entityv1alpha1.EID) EID

func New

func New(entityType string, id string) EID

New creates a EID from a provided entity type and ID.

func Parse

func Parse(input string) (EID, error)

Parse extracts a EID from the input string. Unlike Cedar policies, we accept EIDs without mandatory double quotes around the ID component.

For example: AWS::Account::123456789012 is a valid Common Fate EID, but is an invalid Cedar EID.

We are more relaxed about parsing because nearly all of our EIDs do not contain any whitespace, so it saves users having to type additional quote characters when using our CLI.

If the ID component of the EID contains any whitespace it must be enclosed in double quotes.

func Ptr

func Ptr(entityType string, id string) *EID

Ptr creates a EID from a provided entity type and ID and returns it as a pointer.

func (EID) Equals

func (u EID) Equals(other EID) bool

func (EID) String

func (u EID) String() string

func (EID) ToAPI

func (u EID) ToAPI() *entityv1alpha1.EID

func (EID) ToSpecifier

func (u EID) ToSpecifier() *accessv1alpha1.Specifier

ToSpecifier returns a Specifier which will match the EID.

func (EID) Valid

func (u EID) Valid() error

Valid returns true if the EID has both a type and an ID.

Jump to

Keyboard shortcuts

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