Help us shape the future of Go! Take the 2026 Go Developer Survey

object

package
v0.45.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0, Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package object defines the provider-independent objects consumed by Writ. Providers resolve identity, eligibility, and membership before returning these facts. This package owns selectable values and the boundary between defined fields and additional attributes; it knows nothing about provisioning schemas.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GroupNames

func GroupNames(groups []Object) []string

GroupNames projects memberships for the existing name-based administration grants and displays. Authorization matching itself retains structured groups.

func ValuesFor

func ValuesFor(id string, names []string, attrs Attributes, key string) []string

Values returns the complete values of an attribute on one object. Missing IDs supply no values. Defined fields always take precedence over additional data; Validate rejects collisions before any evaluation takes place.

Types

type Attributes

type Attributes map[string]Values

Attributes contains only additional, flat fields. Defined name/id fields cannot be shadowed by provider attributes.

func FromStrings

func FromStrings(values map[string]string) Attributes

FromStrings maps an adapter's single-valued attributes into the fact model.

func (Attributes) Validate

func (a Attributes) Validate() error

type Object

type Object struct {
	ID         string     `json:"id,omitempty" yaml:"id,omitempty"`
	Names      Strings    `json:"name" yaml:"name"`
	Attributes Attributes `json:"attributes,omitempty" yaml:"attributes,omitempty"`
}

Object is a group membership's facts. ID is optional; Names is the set of names for this single object, not a set of unrelated same-named groups.

func (*Object) UnmarshalJSON

func (o *Object) UnmarshalJSON(data []byte) error

Memberships must be actual objects; a null element is not a group that can satisfy an empty group filter.

func (Object) Values

func (o Object) Values(key string) []string

type Strings

type Strings []string

Strings is a collection with no implicit conversion of scalar or null members. Unlike Values, the defined name field always uses an array.

func (*Strings) UnmarshalJSON

func (s *Strings) UnmarshalJSON(data []byte) error

func (*Strings) UnmarshalYAML

func (s *Strings) UnmarshalYAML(unmarshal func(any) error) error

type User

type User struct {
	ID         string     `json:"id" yaml:"id"`
	Names      Strings    `json:"name" yaml:"name"`
	UserName   string     `json:"userName,omitempty" yaml:"userName,omitempty"`
	Attributes Attributes `json:"attributes,omitempty" yaml:"attributes,omitempty"`
	Groups     []Object   `json:"groups" yaml:"groups"`
}

User is an eligible user resolved by a provider for an authenticated identity. UserName is certificate presentation, independent of selectable Names.

func (User) Validate

func (u User) Validate(authenticatedID string) error

func (User) Values

func (u User) Values(key string) []string

type Values

type Values []string

Values is a fact's collection of strings. JSON and YAML may supply a single string, a string collection, or null. Null and empty collections contain no values; the empty string is a value. Non-string elements are always invalid.

func (*Values) UnmarshalJSON

func (v *Values) UnmarshalJSON(data []byte) error

func (*Values) UnmarshalYAML

func (v *Values) UnmarshalYAML(unmarshal func(any) error) error

UnmarshalYAML uses the decoder callback so shared facts do not link a YAML implementation. JSON and static YAML enforce the same string-only contract.

Jump to

Keyboard shortcuts

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