Documentation ¶
Overview ¶
Package common will be a deprecated package, referring to old nafigos content
Index ¶
- Constants
- func CancelWhenSignaled(cancelFunc context.CancelFunc)
- type Cluster
- type EventID
- type EventType
- type EventTypeSet
- type HTTPStatus
- type HTTPUser
- type ID
- type QueryOp
- type Secret
- type SecretType
- type ServiceRequestResult
- type TokenID
- type TokenIDPrefix
- type TransactionID
- type User
- type UserSettings
Constants ¶
const EventTypePrefix = "org.cyverse.events."
EventTypePrefix is the prefix for EventType
const EventsSubject = "cyverse.events"
EventsSubject is the event channel that all cyverse events are posted
const NatsQueryOpPrefix = "cyverse."
NatsQueryOpPrefix is the prefix for NatsQueryOp
Variables ¶
This section is empty.
Functions ¶
func CancelWhenSignaled ¶
func CancelWhenSignaled(cancelFunc context.CancelFunc)
CancelWhenSignaled calls the cancel function when receiving SIGINT or SIGTERM.
This is useful for implementing graceful termination in service, create a context for the entire service, and then pass the cancel function to this function. The service will need to stop its different components upon context cancellation.
Types ¶
type Cluster ¶
type Cluster struct { ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` DefaultNamespace string `json:"default_namespace,omitempty"` Config string `json:"config,omitempty"` Host string `json:"host,omitempty"` // Slug is a seed for cluster resource naming. // Use the Slug value for naming if the name is not occupied. // Otherwise, use it as a prefix. Slug string `json:"slug,omitempty"` Admin bool `json:"admin,omitempty"` }
Cluster ...
func (*Cluster) GetRedacted ¶
GetRedacted will return a new Cluster with the Value set to "REDACTED"
type EventTypeSet ¶
type EventTypeSet = map[EventType]struct{}
EventTypeSet is a set of EventType
func NewEventTypeSet ¶
func NewEventTypeSet(eventTypes ...EventType) EventTypeSet
NewEventTypeSet construct a new EventTypeSet
type HTTPStatus ¶
type HTTPStatus struct { Message string `json:"message,omitempty"` // Human-readable text message Code int `json:"code,omitempty"` // HTTP status code }
HTTPStatus is used for responding to synchronous requests with an error that is JSON friendly
type HTTPUser ¶
type HTTPUser struct { Username string `json:"username"` FirstName string `json:"first_name"` LastName string `json:"last_name"` PrimaryEmail string `json:"primary_email"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` UpdatedBy string `json:"updated_by"` IsAdmin bool `json:"is_admin"` DisabledAt string `json:"disabled_at,omitempty"` UserSettings UserSettings `json:"settings,omitempty"` }
HTTPUser contains the json data structure for between the api service and the client
type ID ¶
type ID string
ID for entities, xid with a prefix. <prefix>-<xid>
func NewID ¶
NewID creates a new ID with a prefix. Prefix must be lowercase letters, No special characters or numbers may be used.
func NewIDFromXID ¶
NewIDFromXID creates a new ID from a prefix and an existing xid.
func (ID) FullPrefix ¶
FullPrefix returns the entire prefix which is anything before the last hyphen (the hyphen before the xid string).
func (ID) Prefix
deprecated
Prefix is the same as PrimaryType.
Deprecated: Even though this method is called Prefix, it only returns the primary type, not the full prefix. This is meant to maintain the behavior for existing usages of this method. For full prefix (everything before the last hyphen), use FullPrefix() instead.
func (ID) PrimaryType ¶
PrimaryType return the first hyphen separated field in the prefix, or anything before 1st hyphen. Behavior of this method on invalid ID should not be relied on.
func (ID) SubType ¶
SubType return the substring between first hyphen and last hyphen (the hyphen before xid string). Behavior of this method on invalid ID should not be relied on.
func (ID) XIDMustParse ¶
XIDMustParse convert to XID, panic if error
type Secret ¶
type Secret struct { Username string `json:"username,omitempty"` Value string `json:"value,omitempty"` Type SecretType `json:"type,omitempty"` ID string `json:"id,omitempty"` }
Secret ...
func (*Secret) GetRedacted ¶
GetRedacted will return a new Secret with the Value set to "REDACTED"
type SecretType ¶
type SecretType string
SecretType associates a type with a Secret
const ( // GCRSecret is used for Google Container Registry GCRSecret SecretType = "gcr" // DockerhubSecret is used for Dockerhub DockerhubSecret SecretType = "dockerhub" // GitSecret is used for Github, GitLab, etc. GitSecret SecretType = "git" )
type ServiceRequestResult ¶
type ServiceRequestResult struct { Data interface{} `json:"data"` // return object, can be nil Status HTTPStatus `json:"status,omitempty"` }
ServiceRequestResult can be used for result of query requests and streaming requests
type TokenID ¶
type TokenID string
TokenID is an id for Cacao Tokens, with format '<prefix>-<SHA3-hash>-<xid>'
func NewTokenID ¶
func NewTokenID(typeString, owner string, createdAt time.Time, tokenXid xid.ID) (id TokenID, hash string, salt string, err error)
NewTokenID creates a new TokenID for the given type, owner, + created time
type TokenIDPrefix ¶
type TokenIDPrefix string
TokenIDPrefix is the prefix for different types of tokens
const ( // PersonalTokenPrefix is the personal token type prefix PersonalTokenPrefix TokenIDPrefix = "cptoken" // DelegatedTokenPrefix is the delegated token type prefix DelegatedTokenPrefix TokenIDPrefix = "cdtoken" // InternalTokenPrefix is the internal token type prefix InternalTokenPrefix TokenIDPrefix = "citoken" )
type User ¶
type User struct { Username string `json:"username,omitempty"` Password string `json:"password,omitempty"` Secrets map[string]Secret `json:"secrets,omitempty"` Clusters map[string]Cluster `json:"clusters,omitempty"` IsAdmin bool `json:"is_admin"` }
User defines user attributes, primarily Secrets that are written to Vault. Note that the Password field is only used for creating the User
func (*User) GetRedacted ¶
GetRedacted will return a new User with sensitive fields redacted