fixtures

package
v0.4.22 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2024 License: BSD-3-Clause-Clear Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadFixtureData

func LoadFixtureData(file string)

Types

type DBInterface

type DBInterface struct {
	Client       *db.Client
	PolicyClient policydb.PolicyDBClient
	Schema       string
}

func NewDBInterface

func NewDBInterface(cfg config.Config) DBInterface

func (*DBInterface) BoolWrap

func (d *DBInterface) BoolWrap(b bool) string

func (*DBInterface) DropSchema

func (d *DBInterface) DropSchema() error

func (*DBInterface) ExecInsert

func (d *DBInterface) ExecInsert(table string, columns []string, values ...[]string) (int64, error)

func (*DBInterface) OptionalStringWrap

func (d *DBInterface) OptionalStringWrap(v string) string

func (*DBInterface) StringArrayWrap

func (d *DBInterface) StringArrayWrap(values []string) string

func (*DBInterface) StringWrap

func (d *DBInterface) StringWrap(v string) string

func (*DBInterface) TableName

func (d *DBInterface) TableName(v string) string

func (*DBInterface) UUIDArrayWrap

func (d *DBInterface) UUIDArrayWrap(v []string) string

func (*DBInterface) UUIDWrap

func (d *DBInterface) UUIDWrap(v string) string

type FixtureData

type FixtureData struct {
	Namespaces struct {
		Metadata FixtureMetadata                 `yaml:"metadata"`
		Data     map[string]FixtureDataNamespace `yaml:"data"`
	} `yaml:"attribute_namespaces"`
	Attributes struct {
		Metadata FixtureMetadata                 `yaml:"metadata"`
		Data     map[string]FixtureDataAttribute `yaml:"data"`
	} `yaml:"attributes"`
	AttributeKeyAccessServer []FixtureDataAttributeKeyAccessServer `yaml:"attribute_key_access_servers"`
	AttributeValues          struct {
		Metadata FixtureMetadata                      `yaml:"metadata"`
		Data     map[string]FixtureDataAttributeValue `yaml:"data"`
	} `yaml:"attribute_values"`
	AttributeValueKeyAccessServer []FixtureDataAttributeValueKeyAccessServer `yaml:"attribute_value_key_access_servers"`
	SubjectMappings               struct {
		Metadata FixtureMetadata                      `yaml:"metadata"`
		Data     map[string]FixtureDataSubjectMapping `yaml:"data"`
	} `yaml:"subject_mappings"`
	SubjectConditionSet struct {
		Metadata FixtureMetadata                `yaml:"metadata"`
		Data     map[string]SubjectConditionSet `yaml:"data"`
	} `yaml:"subject_condition_set"`
	ResourceMappingGroups struct {
		Metadata FixtureMetadata                            `yaml:"metadata"`
		Data     map[string]FixtureDataResourceMappingGroup `yaml:"data"`
	} `yaml:"resource_mapping_groups"`
	ResourceMappings struct {
		Metadata FixtureMetadata                       `yaml:"metadata"`
		Data     map[string]FixtureDataResourceMapping `yaml:"data"`
	} `yaml:"resource_mappings"`
	KasRegistries struct {
		Metadata FixtureMetadata                   `yaml:"metadata"`
		Data     map[string]FixtureDataKasRegistry `yaml:"data"`
	} `yaml:"kas_registry"`
}

type FixtureDataAttribute

type FixtureDataAttribute struct {
	ID          string `yaml:"id"`
	NamespaceID string `yaml:"namespace_id"`
	Name        string `yaml:"name"`
	Rule        string `yaml:"rule"`
	Active      bool   `yaml:"active"`
}

type FixtureDataAttributeKeyAccessServer

type FixtureDataAttributeKeyAccessServer struct {
	AttributeID       string `yaml:"attribute_id"`
	KeyAccessServerID string `yaml:"key_access_server_id"`
}

type FixtureDataAttributeValue

type FixtureDataAttributeValue struct {
	ID                    string `yaml:"id"`
	AttributeDefinitionID string `yaml:"attribute_definition_id"`
	Value                 string `yaml:"value"`
	Active                bool   `yaml:"active"`
}

type FixtureDataAttributeValueKeyAccessServer

type FixtureDataAttributeValueKeyAccessServer struct {
	ValueID           string `yaml:"value_id"`
	KeyAccessServerID string `yaml:"key_access_server_id"`
}

type FixtureDataKasRegistry

type FixtureDataKasRegistry struct {
	ID     string `yaml:"id"`
	URI    string `yaml:"uri"`
	PubKey struct {
		Remote string                    `yaml:"remote" json:"remote,omitempty"`
		Cached *policypb.KasPublicKeySet `yaml:"cached" json:"cached,omitempty"`
	} `yaml:"public_key" json:"public_key"`
}

type FixtureDataNamespace

type FixtureDataNamespace struct {
	ID     string `yaml:"id"`
	Name   string `yaml:"name"`
	Active bool   `yaml:"active"`
}

type FixtureDataResourceMapping

type FixtureDataResourceMapping struct {
	ID               string   `yaml:"id"`
	AttributeValueID string   `yaml:"attribute_value_id"`
	Terms            []string `yaml:"terms"`
	GroupID          string   `yaml:"group_id"`
}

type FixtureDataResourceMappingGroup added in v0.4.19

type FixtureDataResourceMappingGroup struct {
	ID          string `yaml:"id"`
	NamespaceID string `yaml:"namespace_id"`
	Name        string `yaml:"name"`
}

type FixtureDataSubjectMapping

type FixtureDataSubjectMapping struct {
	ID               string `yaml:"id"`
	AttributeValueID string `yaml:"attribute_value_id"`
	Actions          []struct {
		Standard string `yaml:"standard" json:"standard,omitempty"`
		Custom   string `yaml:"custom" json:"custom,omitempty"`
	} `yaml:"actions"`
	SubjectConditionSetID string `yaml:"subject_condition_set_id"`
}

type FixtureDataValueMember

type FixtureDataValueMember struct {
	ID       string `yaml:"id"`
	ValueID  string `yaml:"value_id"`
	MemberID string `yaml:"member_id"`
}

type FixtureMetadata

type FixtureMetadata struct {
	TableName string   `yaml:"table_name"`
	Columns   []string `yaml:"columns"`
}

type Fixtures

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

func NewFixture

func NewFixture(db DBInterface) Fixtures

func (*Fixtures) GetAttributeKey

func (f *Fixtures) GetAttributeKey(key string) FixtureDataAttribute

func (*Fixtures) GetAttributeValueKey

func (f *Fixtures) GetAttributeValueKey(key string) FixtureDataAttributeValue

func (*Fixtures) GetKasRegistryKey

func (f *Fixtures) GetKasRegistryKey(key string) FixtureDataKasRegistry

func (*Fixtures) GetNamespaceKey

func (f *Fixtures) GetNamespaceKey(key string) FixtureDataNamespace

func (*Fixtures) GetResourceMappingGroupKey added in v0.4.19

func (f *Fixtures) GetResourceMappingGroupKey(key string) FixtureDataResourceMappingGroup

func (*Fixtures) GetResourceMappingKey

func (f *Fixtures) GetResourceMappingKey(key string) FixtureDataResourceMapping

func (*Fixtures) GetSubjectConditionSetKey

func (f *Fixtures) GetSubjectConditionSetKey(key string) SubjectConditionSet

func (*Fixtures) GetSubjectMappingKey

func (f *Fixtures) GetSubjectMappingKey(key string) FixtureDataSubjectMapping

func (*Fixtures) Provision

func (f *Fixtures) Provision()

func (*Fixtures) TearDown

func (f *Fixtures) TearDown()

type SubjectConditionSet

type SubjectConditionSet struct {
	ID        string `yaml:"id"`
	Condition struct {
		SubjectSets []struct {
			ConditionGroups []struct {
				BooleanOperator string `yaml:"boolean_operator" json:"boolean_operator"`
				Conditions      []struct {
					SubjectExternalSelectorValue string   `yaml:"subject_external_selector_value" json:"subject_external_selector_value"`
					Operator                     string   `yaml:"operator" json:"operator"`
					SubjectExternalValues        []string `yaml:"subject_external_values" json:"subject_external_values"`
				} `yaml:"conditions" json:"conditions"`
			} `yaml:"condition_groups" json:"condition_groups"`
		} `yaml:"subject_sets" json:"subject_sets"`
	} `yaml:"condition" json:"condition"`
}

Jump to

Keyboard shortcuts

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