policy

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotParsable indicates that a policies file could not be parsed against
	// the specification.
	ErrNotParsable = errors.New("policies not parsable")
	// ErrUnknownFields indicates that a policies file contains an unknown field.
	ErrUnknownFields = errors.New("policies contains unknown fields")
	// ErrNotFound indicates that policies are not found for a service.
	ErrNotFound = errors.New("not found")
)

Functions

func ApplyAutoRelease

func ApplyAutoRelease(ctx context.Context, configRepoURL, sshPrivateKeyPath string, svc, branch, env, committerName, committerEmail string) (string, error)

ApplyAutoRelease applies an auto-release policy for service svc from branch to environment env.

func Delete

func Delete(ctx context.Context, configRepoURL, sshPrivateKeyPath string, svc string, ids []string, committerName, committerEmail string) (int, error)

Delete deletes policies by ID for service svc.

Types

type AutoReleasePolicy

type AutoReleasePolicy struct {
	ID          string `json:"id,omitempty"`
	Branch      string `json:"branch,omitempty"`
	Environment string `json:"environment,omitempty"`
}

func GetAutoReleases

func GetAutoReleases(ctx context.Context, configRepoURL, sshPrivateKeyPath string, svc, branch string) ([]AutoReleasePolicy, error)

GetAutoReleases gets stored auto-release policies for service svc. If no policies are found a nil slice is returned.

type Policies

type Policies struct {
	Service      string              `json:"service,omitempty"`
	AutoReleases []AutoReleasePolicy `json:"autoReleases,omitempty"`
}

func Get

func Get(ctx context.Context, configRepoURL, sshPrivateKeyPath string, svc string) (Policies, error)

Get gets stored policies for service svc. If no policies are stored ErrNotFound is returned.

func (*Policies) Delete

func (p *Policies) Delete(ids ...string) int

Delete deletes any policies with a matching id.

func (*Policies) HasPolicies

func (p *Policies) HasPolicies() bool

HasPolicies returns whether any policies are applied.

func (*Policies) SetAutoRelease

func (p *Policies) SetAutoRelease(branch, env string) string

SetAutoRelease sets an auto-release policy for specified branch and environment.

If an auto-release policy exists for the same environment it is overwritten.

Jump to

Keyboard shortcuts

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