fixtures

package
v0.0.0-...-ab689eb Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: BSD-3-Clause-Clear Imports: 11 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
	KASRClient   *kasdb.KasRegistryDbClient
	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"`
	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"`
	ValueMembers struct {
		Metadata FixtureMetadata                   `yaml:"metadata"`
		Data     map[string]FixtureDataValueMember `yaml:"data"`
	} `yaml:"attribute_value_members"`
}

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"`
	Members               []string `yaml:"members"`
	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"`
		Local  string `yaml:"local" json:"local,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"`
}

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) 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) GetValueMemberKey

func (f *Fixtures) GetValueMemberKey(key string) FixtureDataValueMember

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 {
					SubjectExternalField  string   `yaml:"subject_external_field" json:"subject_external_field"`
					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