variables

package
v2.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2022 License: Apache-2.0 Imports: 15 Imported by: 18

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNil

func IsNil(i interface{}) bool

func ValidateLibraryVariableSetValues

func ValidateLibraryVariableSetValues(LibraryVariableSet *LibraryVariableSet) error

ValidateLibraryVariableSetValues checks the values of a library variable set to see if they are suitable for sending to Octopus Deploy. Used when adding or updating library variable sets.

Types

type DisplaySettings

type DisplaySettings struct {
	ControlType   string            `json:"Octopus.ControlType"`
	SelectOptions map[string]string `json:"Octopus.SelectOptions,omitempty"`
}

func NewDisplaySettings

func NewDisplaySettings(controlType string, selectOptions map[string]string) *DisplaySettings

func (*DisplaySettings) MarshalJSON

func (d *DisplaySettings) MarshalJSON() ([]byte, error)

MarshalJSON returns display settings as its JSON encoding.

func (*DisplaySettings) UnmarshalJSON

func (d *DisplaySettings) UnmarshalJSON(b []byte) error

UnmarshalJSON sets display settings from its representation in JSON.

type Library

type Library struct {
	LibraryVariableSetID   string                                     `json:"LibraryVariableSetId,omitempty"`
	LibraryVariableSetName string                                     `json:"LibraryVariableSetName,omitempty"`
	Links                  map[string]string                          `json:"Links,omitempty"`
	Templates              []*actiontemplates.ActionTemplateParameter `json:"Templates"`
	Variables              map[string]core.PropertyValue              `json:"Variables,omitempty"`
}

type LibraryVariable

type LibraryVariable struct {
	LibraryVariableSetID   string                                     `json:"LibraryVariableSetId,omitempty"`
	LibraryVariableSetName string                                     `json:"LibraryVariableSetName,omitempty"`
	Links                  map[string]string                          `json:"Links,omitempty"`
	Templates              []*actiontemplates.ActionTemplateParameter `json:"Templates"`
	Variables              map[string]core.PropertyValue              `json:"Variables,omitempty"`
}

func NewLibraryVariable

func NewLibraryVariable() *LibraryVariable

type LibraryVariableSet

type LibraryVariableSet struct {
	ContentType   string                                    `json:"ContentType" validate:"required,oneof=ScriptModule Variables"`
	Description   string                                    `json:"Description,omitempty"`
	Name          string                                    `json:"Name" validate:"required"`
	SpaceID       string                                    `json:"SpaceId,omitempty"`
	Templates     []actiontemplates.ActionTemplateParameter `json:"Templates,omitempty"`
	VariableSetID string                                    `json:"VariableSetId,omitempty"`

	resources.Resource
}

func NewLibraryVariableSet

func NewLibraryVariableSet(name string) *LibraryVariableSet

func (LibraryVariableSet) Validate

func (l LibraryVariableSet) Validate() error

Validate checks the state of the library variable set and returns an error if invalid.

type LibraryVariableSetService

type LibraryVariableSetService struct {
	services.CanDeleteService
}

func NewLibraryVariableSetService

func NewLibraryVariableSetService(sling *sling.Sling, uriTemplate string) *LibraryVariableSetService

func (*LibraryVariableSetService) Add

func (s *LibraryVariableSetService) Add(libraryVariableSet *LibraryVariableSet) (*LibraryVariableSet, error)

Add creates a new library variable set.

func (*LibraryVariableSetService) Get

Get returns a collection of library variable sets based on the criteria defined by its input query parameter. If an error occurs, an empty collection is returned along with the associated error.

func (*LibraryVariableSetService) GetAll

GetAll returns all library variable sets. If none can be found or an error occurs, it returns an empty collection.

func (*LibraryVariableSetService) GetByID

GetByID returns the library variable set that matches the input ID. If one cannot be found, it returns nil and an error.

func (*LibraryVariableSetService) GetByPartialName

func (s *LibraryVariableSetService) GetByPartialName(partialName string) ([]*LibraryVariableSet, error)

GetByPartialName performs a lookup and returns a list of library variable sets with a matching partial name.

func (*LibraryVariableSetService) Update

func (s *LibraryVariableSetService) Update(libraryVariableSet *LibraryVariableSet) (*LibraryVariableSet, error)

Update modifies a library variable set based on the one provided as input.

type LibraryVariableSetUsageEntry

type LibraryVariableSetUsageEntry struct {
	LibraryVariableSetID   string `json:"LibraryVariableSetId,omitempty"`
	LibraryVariableSetName string `json:"LibraryVariableSetName,omitempty"`

	resources.Resource
}

func NewLibraryVariableSetUsageEntry

func NewLibraryVariableSetUsageEntry() *LibraryVariableSetUsageEntry

type LibraryVariablesQuery

type LibraryVariablesQuery struct {
	ContentType string   `uri:"contentType,omitempty" url:"contentType,omitempty"`
	IDs         []string `uri:"ids,omitempty" url:"ids,omitempty"`
	PartialName string   `uri:"partialName,omitempty" url:"partialName,omitempty"`
	Skip        int      `uri:"skip,omitempty" url:"skip,omitempty"`
	Take        int      `uri:"take,omitempty" url:"take,omitempty"`
}

type MissingVariable

type MissingVariable struct {
	EnvironmentID        string            `json:"EnvironmentId,omitempty"`
	LibraryVariableSetID string            `json:"LibraryVariableSetId,omitempty"`
	Links                map[string]string `json:"Links,omitempty"`
	ProjectID            string            `json:"ProjectId,omitempty"`
	VariableTemplateID   string            `json:"VariableTemplateId,omitempty"`
	VariableTemplateName string            `json:"VariableTemplateName,omitempty"`
}

type MissingVariablesQuery

type MissingVariablesQuery struct {
	EnvironmentID  string `uri:"environmentId,omitempty" url:"environmentId,omitempty"`
	IncludeDetails bool   `uri:"includeDetails,omitempty" url:"includeDetails,omitempty"`
	ProjectID      string `uri:"projectId,omitempty" url:"projectId,omitempty"`
	TenantID       string `uri:"tenantId,omitempty" url:"tenantId,omitempty"`
}

type ProjectVariable

type ProjectVariable struct {
	Links       map[string]string                          `json:"Links,omitempty"`
	ProjectID   string                                     `json:"ProjectId,omitempty"`
	ProjectName string                                     `json:"ProjectName,omitempty"`
	Templates   []*actiontemplates.ActionTemplateParameter `json:"Templates"`
	Variables   map[string]map[string]core.PropertyValue   `json:"Variables,omitempty"`
}

type ProjectVariableSetUsage

type ProjectVariableSetUsage struct {
	IsCurrentlyBeingUsedInProject bool                                  `json:"IsCurrentlyBeingUsedInProject"`
	ProjectID                     string                                `json:"ProjectId,omitempty"`
	ProjectName                   string                                `json:"ProjectName,omitempty"`
	ProjectSlug                   string                                `json:"ProjectSlug,omitempty"`
	Releases                      []*releases.ReleaseUsageEntry         `json:"Releases"`
	RunbookSnapshots              []*runbooks.RunbookSnapshotUsageEntry `json:"RunbookSnapshots"`
}

type ScriptModule

type ScriptModule struct {
	Description   string `json:"Description,omitempty"`
	Name          string `json:"Name" validate:"required"`
	ScriptBody    string `json:"scriptBody" validate:"required"`
	SpaceID       string `json:"SpaceId,omitempty"`
	Syntax        string `json:"syntax" validate:"required"`
	VariableSetID string `json:"VariableSetId,omitempty"`

	resources.Resource
}

func NewScriptModule

func NewScriptModule(name string) *ScriptModule

NewScriptModule creates and initializes a script module.

func (*ScriptModule) MarshalJSON

func (s *ScriptModule) MarshalJSON() ([]byte, error)

MarshalJSON returns a script module as its JSON encoding.

func (*ScriptModule) Validate

func (s *ScriptModule) Validate() error

Validate checks the state of the script module and returns an error if invalid.

type ScriptModuleService

type ScriptModuleService struct {
	services.CanDeleteService
}

func NewScriptModuleService

func NewScriptModuleService(sling *sling.Sling, uriTemplate string) *ScriptModuleService

func (*ScriptModuleService) Add

func (s *ScriptModuleService) Add(scriptModule *ScriptModule) (*ScriptModule, error)

Add creates a new script module.

func (*ScriptModuleService) Get

func (s *ScriptModuleService) Get(libraryVariablesQuery LibraryVariablesQuery) (*resources.Resources[*ScriptModule], error)

Get returns a collection of script modules based on the criteria defined by its input query parameter. If an error occurs, an empty collection is returned along with the associated error.

func (*ScriptModuleService) GetAll

GetAll returns all script modules. If none can be found or an error occurs, it returns an empty collection.

func (*ScriptModuleService) GetByID

func (s *ScriptModuleService) GetByID(id string) (*ScriptModule, error)

GetByID returns the script module that matches the input ID. If one cannot be found, it returns nil and an error.

func (*ScriptModuleService) GetByPartialName

func (s *ScriptModuleService) GetByPartialName(partialName string) ([]*ScriptModule, error)

GetByPartialName performs a lookup and returns a list of script modules with a matching partial name.

func (*ScriptModuleService) Update

func (s *ScriptModuleService) Update(scriptModule *ScriptModule) (*ScriptModule, error)

Update modifies a script module based on the one provided as input.

type TenantVariableService

type TenantVariableService struct {
	services.Service
}

func NewTenantVariableService

func NewTenantVariableService(sling *sling.Sling, uriTemplate string) *TenantVariableService

func (*TenantVariableService) GetAll

func (s *TenantVariableService) GetAll() ([]TenantVariables, error)

type TenantVariables

type TenantVariables struct {
	LibraryVariables map[string]LibraryVariable `json:"LibraryVariables,omitempty"`
	ProjectVariables map[string]ProjectVariable `json:"ProjectVariables,omitempty"`
	SpaceID          string                     `json:"SpaceId,omitempty"`
	TenantID         string                     `json:"TenantId,omitempty"`
	TenantName       string                     `json:"TenantName,omitempty"`

	resources.Resource
}

func NewTenantVariables

func NewTenantVariables(tenantID string) *TenantVariables

type TenantsMissingVariables

type TenantsMissingVariables struct {
	Links            map[string]string `json:"Links,omitempty"`
	MissingVariables []MissingVariable `json:"MissingVariables,omitempty"`
	TenantID         string            `json:"TenantId,omitempty"`
}

type Variable

type Variable struct {
	Description string                 `json:"Description"`
	IsEditable  bool                   `json:"IsEditable"`
	IsSensitive bool                   `json:"IsSensitive"`
	Name        string                 `json:"Name"`
	Prompt      *VariablePromptOptions `json:"Prompt,omitempty"`
	Scope       VariableScope          `json:"Scope"`
	Type        string                 `json:"Type"`
	Value       string                 `json:"Value"`

	resources.Resource
}

func NewVariable

func NewVariable(name string) *Variable

type VariableNamesQuery

type VariableNamesQuery struct {
	Project                   string `uri:"project,omitempty" url:"project,omitempty"`
	ProjectEnvironmentsFilter string `uri:"projectEnvironmentsFilter,omitempty" url:"projectEnvironmentsFilter,omitempty"`
	Runbook                   string `uri:"runbook,omitempty" url:"runbook,omitempty"`
}

type VariablePreviewQuery

type VariablePreviewQuery struct {
	Action      string `uri:"action,omitempty" url:"action,omitempty"`
	Channel     string `uri:"channel,omitempty" url:"channel,omitempty"`
	Environment string `uri:"environment,omitempty" url:"environment,omitempty"`
	Machine     string `uri:"machine,omitempty" url:"machine,omitempty"`
	Project     string `uri:"project,omitempty" url:"project,omitempty"`
	Role        string `uri:"role,omitempty" url:"role,omitempty"`
	Runbook     string `uri:"runbook,omitempty" url:"runbook,omitempty"`
	Tenant      string `uri:"tenant,omitempty" url:"tenant,omitempty"`
}

type VariablePromptOptions

type VariablePromptOptions struct {
	Description     string           `json:"Description"`
	DisplaySettings *DisplaySettings `json:"DisplaySettings,omitempty"`
	IsRequired      bool             `json:"Required"`
	Label           string           `json:"Label"`
}

type VariableScope

type VariableScope struct {
	Environments []string `json:"Environment,omitempty"`
	Machines     []string `json:"Machine,omitempty"`
	Actions      []string `json:"Action,omitempty"`
	Roles        []string `json:"Role,omitempty"`
	Channels     []string `json:"Channel,omitempty"`
	TenantTags   []string `json:"TenantTag,omitempty"`
}

func (VariableScope) IsEmpty

func (scope VariableScope) IsEmpty() bool

type VariableScopeValues

type VariableScopeValues struct {
	Actions      []*resources.ReferenceDataItem        `json:"Actions"`
	Channels     []*resources.ReferenceDataItem        `json:"Channels"`
	Environments []*resources.ReferenceDataItem        `json:"Environments"`
	Machines     []*resources.ReferenceDataItem        `json:"Machines"`
	Processes    []*resources.ProcessReferenceDataItem `json:"Processes"`
	Roles        []*resources.ReferenceDataItem        `json:"Roles"`
	TenantTags   []*resources.ReferenceDataItem        `json:"TenantTags"`
}

type VariableService

type VariableService struct {
	services.Service
	// contains filtered or unexported fields
}

func NewVariableService

func NewVariableService(sling *sling.Sling, uriTemplate string, namesPath string, previewPath string) *VariableService

func (*VariableService) AddSingle

func (s *VariableService) AddSingle(ownerID string, variable *Variable) (VariableSet, error)

AddSingle adds a single variable to a owner ID. This automates the act of fetching the variable set, adding a new item to it, and posting back to Octopus

func (*VariableService) DeleteSingle

func (s *VariableService) DeleteSingle(ownerID string, variableID string) (VariableSet, error)

DeleteSingle removes a single variable from a owner ID. This automates the act of fetching the variable set, removing the existing item, and posting back to Octopus

func (*VariableService) GetAll

func (s *VariableService) GetAll(ownerID string) (VariableSet, error)

GetAll fetches a collection of variables for a owner ID.

func (*VariableService) GetByID

func (s *VariableService) GetByID(ownerID string, variableID string) (*Variable, error)

GetByID fetches a single variable, located by its ID, from Octopus Deploy for a given owner ID.

func (*VariableService) GetByName

func (s *VariableService) GetByName(ownerID string, name string, scope *VariableScope) ([]*Variable, error)

GetByName fetches variables, located by their name, from Octopus Deploy for a given owner ID. As variable names can appear more than once under different scopes, a VariableScope must also be provided, which will be used to locate the appropriate variables.

func (*VariableService) MatchesScope

func (s *VariableService) MatchesScope(variableScope VariableScope, definedScope *VariableScope) (bool, *VariableScope, error)

MatchesScope compares two different scopes to see if they match. Generally used for comparing the scope of an existing variable against a desired state. Only supports Environment, Role, Machine, Action and Channel for scope options. Returns true if definedScope is nil or all elements are empty. Also returns a VariableScope of all the scopes that were matched

func (*VariableService) Update

func (s *VariableService) Update(ownerID string, variableSet VariableSet) (VariableSet, error)

Update takes an entire variable set and posts the entire set back to Octopus Deploy. There are individual functions like AddSingle and UpdateSingle that can make this process more of a "typical" CRUD Octopus command.

func (*VariableService) UpdateSingle

func (s *VariableService) UpdateSingle(ownerID string, variable *Variable) (VariableSet, error)

UpdateSingle adds a single variable to a owner ID. This automates the act of fetching the variable set, updating the existing item, and posting back to Octopus

type VariableSet

type VariableSet struct {
	OwnerID     string               `json:"OwnerId,omitempty"`
	ScopeValues *VariableScopeValues `json:"ScopeValues,omitempty"`
	SpaceID     string               `json:"SpaceId,omitempty"`
	Variables   []*Variable          `json:"Variables"`
	Version     int32                `json:"Version"`

	resources.Resource
}

func NewVariableSet

func NewVariableSet() *VariableSet

type VariablesQuery

type VariablesQuery struct {
	IDs []string `uri:"ids,omitempty" url:"ids,omitempty"`
}

Jump to

Keyboard shortcuts

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