builder

package
v0.1.15 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package builder provides simple and easy-to-use way to construct Aptomi Policy in the source code, primarily for unit tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PolicyBuilder

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

PolicyBuilder provides simple and easy-to-use way to construct a complete Policy for Aptomi in the source code. It is primarily used in unit tests. When objects are created/added by the policy builder, they get created in the specified namespace with randomly generated IDs/names, so that a user doesn't have to specify them.

func NewPolicyBuilder

func NewPolicyBuilder() *PolicyBuilder

NewPolicyBuilder creates a new PolicyBuilder with a default "main" namespace

func NewPolicyBuilderWithNS

func NewPolicyBuilderWithNS(namespace string) *PolicyBuilder

NewPolicyBuilderWithNS creates a new PolicyBuilder

func (*PolicyBuilder) AddBundle added in v0.1.15

func (builder *PolicyBuilder) AddBundle() *lang.Bundle

AddBundle creates a new bundle and adds it to the policy

func (*PolicyBuilder) AddBundleComponent added in v0.1.15

func (builder *PolicyBuilder) AddBundleComponent(bundle *lang.Bundle, component *lang.BundleComponent) *lang.BundleComponent

AddBundleComponent adds a given bundle component to the bundle

func (*PolicyBuilder) AddClaim added in v0.1.15

func (builder *PolicyBuilder) AddClaim(user *lang.User, service *lang.Service) *lang.Claim

AddClaim creates a new claim and adds it to the policy

func (*PolicyBuilder) AddCluster

func (builder *PolicyBuilder) AddCluster() *lang.Cluster

AddCluster creates a new cluster and adds it to the policy

func (*PolicyBuilder) AddComponentClaim added in v0.1.15

func (builder *PolicyBuilder) AddComponentClaim(component *lang.BundleComponent, dependsOn *lang.BundleComponent)

AddComponentClaim adds a component claim on another component

func (*PolicyBuilder) AddRule

func (builder *PolicyBuilder) AddRule(criteria *lang.Criteria, actions *lang.RuleActions) *lang.Rule

AddRule creates a new rule and adds it to the policy

func (*PolicyBuilder) AddService

func (builder *PolicyBuilder) AddService(bundle *lang.Bundle, criteria *lang.Criteria) *lang.Service

AddService creates a new service for a given bundle and adds it to the policy

func (*PolicyBuilder) AddServiceMultipleContexts added in v0.1.15

func (builder *PolicyBuilder) AddServiceMultipleContexts(bundle *lang.Bundle, criteriaArray ...*lang.Criteria) *lang.Service

AddServiceMultipleContexts creates service with multiple contexts for a given bundle and adds it to the policy

func (*PolicyBuilder) AddUser

func (builder *PolicyBuilder) AddUser() *lang.User

AddUser creates a new user who can consume bundles from the 'main' namespace and adds it to the policy

func (*PolicyBuilder) AddUserDomainAdmin

func (builder *PolicyBuilder) AddUserDomainAdmin() *lang.User

AddUserDomainAdmin creates a new user who is a domain admin and adds it to the policy

func (*PolicyBuilder) AllocationKeys

func (builder *PolicyBuilder) AllocationKeys(key ...string) []string

AllocationKeys creates allocation keys

func (*PolicyBuilder) CodeComponent

func (builder *PolicyBuilder) CodeComponent(codeParams util.NestedParameterMap, discoveryParams util.NestedParameterMap) *lang.BundleComponent

CodeComponent creates a new code component for a bundle

func (*PolicyBuilder) Criteria

func (builder *PolicyBuilder) Criteria(all string, any string, none string) *lang.Criteria

Criteria creates a criteria with one require-all, one require-any, and one require-none

func (*PolicyBuilder) CriteriaTrue

func (builder *PolicyBuilder) CriteriaTrue() *lang.Criteria

CriteriaTrue creates a criteria which always evaluates to true

func (*PolicyBuilder) External

func (builder *PolicyBuilder) External() *external.Data

External returns the generated external data

func (*PolicyBuilder) Namespace

func (builder *PolicyBuilder) Namespace() string

Namespace returns the current namespace

func (*PolicyBuilder) PanicWhenLoadingUsers added in v0.1.2

func (builder *PolicyBuilder) PanicWhenLoadingUsers()

PanicWhenLoadingUsers tells mock user loader to start panicking when loading users

func (*PolicyBuilder) Policy

func (builder *PolicyBuilder) Policy() *lang.Policy

Policy returns the generated policy

func (*PolicyBuilder) RuleActions

func (builder *PolicyBuilder) RuleActions(labelOps lang.LabelOperations) *lang.RuleActions

RuleActions creates a new RuleActions object

func (*PolicyBuilder) ServiceComponent added in v0.1.15

func (builder *PolicyBuilder) ServiceComponent(service *lang.Service) *lang.BundleComponent

ServiceComponent creates a new service component for a bundle

func (*PolicyBuilder) SwitchNamespace

func (builder *PolicyBuilder) SwitchNamespace(namespace string)

SwitchNamespace switches the current namespace where objects will be generated

func (*PolicyBuilder) UnknownComponent

func (builder *PolicyBuilder) UnknownComponent() *lang.BundleComponent

UnknownComponent creates an unknown component for a bundle (not code and not service)

Jump to

Keyboard shortcuts

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