fixtures

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2025 License: BSD-3-Clause-Clear Imports: 16 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
	LimitDefault int32
	LimitMax     int32
}

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"`
	CustomActions struct {
		Metadata FixtureMetadata              `yaml:"metadata"`
		Data     map[string]FixtureDataAction `yaml:"data"`
	} `yaml:"custom_actions"`
	SubjectMappingActions struct {
		Metadata FixtureMetadata                                     `yaml:"metadata"`
		Data     map[string]FixtureDataSubjectMappingsActionRelation `yaml:"data"`
	} `yaml:"subject_mapping_actions_relation"`
	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"`
	ValueKeyMap struct {
		Metadata FixtureMetadata          `yaml:"metadata"`
		Data     []FixtureDataValueKeyMap `yaml:"data"`
	} `yaml:"value_key_map"`
	DefinitionKeyMap struct {
		Metadata FixtureMetadata               `yaml:"metadata"`
		Data     []FixtureDataDefinitionKeyMap `yaml:"data"`
	} `yaml:"definition_key_map"`
	NamespaceKeyMap struct {
		Metadata FixtureMetadata              `yaml:"metadata"`
		Data     []FixtureDataNamespaceKeyMap `yaml:"data"`
	} `yaml:"namespace_key_map"`
	RegisteredResources struct {
		Metadata FixtureMetadata                          `yaml:"metadata"`
		Data     map[string]FixtureDataRegisteredResource `yaml:"data"`
	} `yaml:"registered_resources"`
	RegisteredResourceValues struct {
		Metadata FixtureMetadata                               `yaml:"metadata"`
		Data     map[string]FixtureDataRegisteredResourceValue `yaml:"data"`
	} `yaml:"registered_resource_values"`
	RegisteredResourceActionAttributeValues struct {
		Metadata FixtureMetadata                                              `yaml:"metadata"`
		Data     map[string]FixtureDataRegisteredResourceActionAttributeValue `yaml:"data"`
	} `yaml:"registered_resource_action_attribute_values"`
	KasRegistryKeys struct {
		Metadata FixtureMetadata                      `yaml:"metadata"`
		Data     map[string]FixtureDataKasRegistryKey `yaml:"data"`
	} `yaml:"kas_registry_keys"`
	ProviderConfigs struct {
		Metadata FixtureMetadata                      `yaml:"metadata"`
		Data     map[string]FixtureDataProviderConfig `yaml:"data"`
	} `yaml:"provider_configs"`
}

type FixtureDataAction added in v0.5.3

type FixtureDataAction struct {
	ID         string `yaml:"id"`
	Name       string `yaml:"name"`
	IsStandard bool   `yaml:"is_standard"`
}

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 FixtureDataDefinitionKeyMap added in v0.4.39

type FixtureDataDefinitionKeyMap struct {
	DefinitionID string `yaml:"definition_id"`
	KeyID        string `yaml:"key_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"`
	Name string `yaml:"name"`
}

type FixtureDataKasRegistryKey added in v0.5.3

type FixtureDataKasRegistryKey struct {
	ID                string  `yaml:"id"`
	KeyAccessServerID string  `yaml:"key_access_server_id"`
	KeyAlgorithm      string  `yaml:"key_algorithm"`
	KeyID             string  `yaml:"key_id"`
	KeyMode           string  `yaml:"key_mode"`
	KeyStatus         string  `yaml:"key_status"`
	PrivateKeyCtx     string  `yaml:"private_key_ctx"`
	PublicKeyCtx      string  `yaml:"public_key_ctx"`
	ProviderConfigID  *string `yaml:"provider_config_id"`
}

type FixtureDataNamespace

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

type FixtureDataNamespaceKeyMap added in v0.4.39

type FixtureDataNamespaceKeyMap struct {
	NamespaceID string `yaml:"namespace_id"`
	KeyID       string `yaml:"key_id"`
}

type FixtureDataProviderConfig added in v0.5.3

type FixtureDataProviderConfig struct {
	ID             string `yaml:"id"`
	ProviderName   string `yaml:"provider_name"`
	ProviderConfig string `yaml:"config"`
}

type FixtureDataRegisteredResource added in v0.5.3

type FixtureDataRegisteredResource struct {
	ID   string `yaml:"id"`
	Name string `yaml:"name"`
}

type FixtureDataRegisteredResourceActionAttributeValue added in v0.5.3

type FixtureDataRegisteredResourceActionAttributeValue struct {
	ID                        string `yaml:"id"`
	RegisteredResourceValueID string `yaml:"registered_resource_value_id"`
	ActionName                string `yaml:"action_name"`
	AttributeValueID          string `yaml:"attribute_value_id"`
}

type FixtureDataRegisteredResourceValue added in v0.5.3

type FixtureDataRegisteredResourceValue struct {
	ID                   string `yaml:"id"`
	RegisteredResourceID string `yaml:"registered_resource_id"`
	Value                string `yaml:"value"`
}

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"`
	SubjectConditionSetID string `yaml:"subject_condition_set_id"`
}

type FixtureDataSubjectMappingsActionRelation added in v0.5.3

type FixtureDataSubjectMappingsActionRelation struct {
	SubjectMappingID string `yaml:"subject_mapping_id"`
	ActionName       string `yaml:"action_name"`
}

Relation table intermediating subject mappings and actions

type FixtureDataValueKeyMap added in v0.4.39

type FixtureDataValueKeyMap struct {
	ValueID string `yaml:"value_id"`
	KeyID   string `yaml:"key_id"`
}

type FixtureMetadata

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

type Fixtures

type Fixtures struct {
	MigratedData struct {
		// name -> id
		StandardActions map[string]string
	}
	// 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) GetCustomActionKey added in v0.5.3

func (f *Fixtures) GetCustomActionKey(key string) FixtureDataAction

func (*Fixtures) GetDefinitionKeyMap added in v0.4.39

func (f *Fixtures) GetDefinitionKeyMap(key string) []FixtureDataDefinitionKeyMap

func (*Fixtures) GetKasRegistryKey

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

func (*Fixtures) GetKasRegistryServerKeys added in v0.5.3

func (f *Fixtures) GetKasRegistryServerKeys(key string) FixtureDataKasRegistryKey

func (*Fixtures) GetNamespaceKey

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

func (*Fixtures) GetNamespaceKeyMap added in v0.4.39

func (f *Fixtures) GetNamespaceKeyMap(key string) []FixtureDataNamespaceKeyMap

func (*Fixtures) GetRegisteredResourceKey added in v0.5.3

func (f *Fixtures) GetRegisteredResourceKey(key string) FixtureDataRegisteredResource

func (*Fixtures) GetRegisteredResourceValueKey added in v0.5.3

func (f *Fixtures) GetRegisteredResourceValueKey(key string) FixtureDataRegisteredResourceValue

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) GetStandardAction added in v0.5.3

func (f *Fixtures) GetStandardAction(name string) *policypb.Action

func (*Fixtures) GetSubjectConditionSetKey

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

func (*Fixtures) GetSubjectMappingKey

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

func (*Fixtures) GetValueMap added in v0.4.39

func (f *Fixtures) GetValueMap(key string) []FixtureDataValueKeyMap

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:"booleanOperator" json:"booleanOperator"`
				Conditions      []struct {
					SubjectExternalSelectorValue string   `yaml:"subjectExternalSelectorValue" json:"subjectExternalSelectorValue"`
					Operator                     string   `yaml:"operator" json:"operator"`
					SubjectExternalValues        []string `yaml:"subjectExternalValues" json:"subjectExternalValues"`
				} `yaml:"conditions" json:"conditions"`
			} `yaml:"conditionGroups" json:"conditionGroups"`
		} `yaml:"subjectSets" json:"subjectSets"`
	} `yaml:"condition" json:"condition"`
}

Jump to

Keyboard shortcuts

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