utils

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2021 License: Apache-2.0 Imports: 3 Imported by: 20

Documentation

Index

Constants

View Source
const (
	// WatchBuildAll is the option where all builds are watched
	WatchBuildAll WatchBuildType = "all"
	// WatchBuildByName is the option where builds are selected by name to be watched
	WatchBuildByName WatchBuildType = "byname"

	// WatchRepositoryLocal is a local repository
	WatchRepositoryLocal WatchRepositoryType = "local"
	// WatchRepositoryRemote is a remote repository
	WatchRepositoryRemote WatchRepositoryType = "remote"

	// WatchRepositoriesAll is the option where all repositories are watched
	WatchRepositoriesAll WatchRepositoriesType = "all"
	// WatchRepositoriesByName is the option where repositories are selected by name to be watched
	WatchRepositoriesByName WatchRepositoriesType = "byname"
)

Variables

This section is empty.

Functions

func UnpackWatchBody

func UnpackWatchBody(watch *WatchParams, body *WatchBody)

UnpackWatchBody unpacks a payload response from Xray. It transforms the data into the params object so that a consumer can interact with a watch in a consistent way.

Types

type AssignedPolicy

type AssignedPolicy struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

AssignedPolicy struct is used to define a policy associated with a watch

type WatchBody

type WatchBody struct {
	GeneralData      watchGeneralParams    `json:"general_data"`
	ProjectResources watchProjectResources `json:"project_resources,omitempty"`
	AssignedPolicies []AssignedPolicy      `json:"assigned_policies,omitempty"`
}

WatchBody is the top level payload to be sent to xray

func CreateBody

func CreateBody(params WatchParams) (*WatchBody, error)

CreateBody creates a payload to configure a Watch in Xray This can configure repositories and builds However, bundles are not supported.

type WatchBuildType

type WatchBuildType string

WatchBuildType defines the type of filter for a builds on a watch

type WatchBuildsAllParams

type WatchBuildsAllParams struct {
	BinMgrID string
	WatchPathFilters
}

WatchBuildsAllParams is used to define the parameters when a watch uses all builds

type WatchBuildsByNameParams

type WatchBuildsByNameParams struct {
	Name     string
	BinMgrID string
}

WatchBuildsByNameParams is used to define a specific build in a watch

type WatchBuildsParams

type WatchBuildsParams struct {
	Type    WatchBuildType
	All     WatchBuildsAllParams
	ByNames map[string]WatchBuildsByNameParams
}

WatchBuildsParams is a struct that stores the build configuration for watch

type WatchParams

type WatchParams struct {
	Name        string
	Description string
	Active      bool

	Repositories WatchRepositoriesParams

	Builds   WatchBuildsParams
	Policies []AssignedPolicy
}

WatchParams defines all the properties to create an Xray watch

func NewWatchParams

func NewWatchParams() WatchParams

NewWatchParams creates a new struct to configure an Xray watch

type WatchPathFilters

type WatchPathFilters struct {
	ExcludePatterns []string `json:"ExcludePatterns"`
	IncludePatterns []string `json:"IncludePatterns"`
}

WatchPathFilters is used to define path filters on a repository or a build in a watch

type WatchRepositoriesParams

type WatchRepositoriesParams struct {
	Type         WatchRepositoriesType
	All          WatchRepositoryAll
	Repositories map[string]WatchRepository
	WatchPathFilters
}

WatchRepositoriesParams is a struct that stores the repository configuration for watch

type WatchRepositoriesType

type WatchRepositoriesType string

WatchRepositoriesType defines the type of filter for a repositories on a watch

type WatchRepository

type WatchRepository struct {
	Name     string
	BinMgrID string
	RepoType WatchRepositoryType
	Filters  watchFilters
}

WatchRepository is used to define a specific repository in a watch

func NewWatchRepository

func NewWatchRepository(name string, binMgrID string, repoType WatchRepositoryType) WatchRepository

NewWatchRepository creates a new repository struct to configure an Xray Watch

type WatchRepositoryAll

type WatchRepositoryAll struct {
	Filters watchFilters
}

WatchRepositoryAll is used to define the parameters when a watch uses all repositories

type WatchRepositoryType added in v0.17.0

type WatchRepositoryType string

WatchRepositoryType defines the type of Repository for a watch

Jump to

Keyboard shortcuts

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