variables

package
v2.41.1 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: Apache-2.0 Imports: 17 Imported by: 17

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 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 deprecated

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

Add creates a new library variable set.

Deprecated: Use libraryvariablesets.Add

func (*LibraryVariableSetService) Get deprecated

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.

Deprecated: Use libraryvariablesets.Get

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 deprecated

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

Deprecated: Use libraryvariablesets.GetByID

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 deprecated

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

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

Deprecated: Use libraryvariablesets.Update

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 deprecated

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

Add creates a new script module.

Deprecated: Use scriptmodules.Add

func (*ScriptModuleService) Get deprecated

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.

Deprecated: Use scriptmodules.Get

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 deprecated

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.

Deprecated: Use scriptmodules.GetByID

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 deprecated

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

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

Deprecated: Use scriptmodules.Update

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"`
	SpaceID     string                 `json:"SpaceId,omitempty"`

	resources.Resource
}

func GetByID added in v2.33.0

func GetByID(client newclient.Client, spaceID string, ownerID string, variableID string) (*Variable, error)

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

func GetByName added in v2.33.0

func GetByName(client newclient.Client, spaceID string, 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 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 *resources.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"`
	ProcessOwners []string `json:"ProcessOwner,omitempty"`
}

func MatchesScope added in v2.33.0

func 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 (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 deprecated

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

Deprecated: Use variables.AddSingle

func (*VariableService) DeleteSingle deprecated

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

Deprecated: Use variables.DeleteSingle

func (*VariableService) GetAll

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

GetAll fetches a collection of variables for an owner ID.

func (*VariableService) GetByID deprecated

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.

Deprecated: Use variables.GetByID

func (*VariableService) GetByName deprecated

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.

Deprecated: Use variables.GetByName

func (*VariableService) MatchesScope deprecated

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

Deprecated: Use variables.MatchesScope

func (*VariableService) Update deprecated

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.

Deprecated: Use variables.Update

func (*VariableService) UpdateSingle deprecated

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

Deprecated: Use variables.UpdateSingle

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 AddSingle added in v2.33.0

func AddSingle(client newclient.Client, spaceID string, ownerID string, variable *Variable) (VariableSet, error)

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

func DeleteSingle added in v2.33.0

func DeleteSingle(client newclient.Client, spaceID string, ownerID string, variableID string) (VariableSet, error)

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

func GetAll added in v2.33.0

func GetAll(client newclient.Client, spaceID string, ownerID string) (VariableSet, error)

GetAll fetches a collection of variables for an owner ID.

func GetVariableSet added in v2.4.0

func GetVariableSet(client newclient.Client, spaceID string, ID string) (*VariableSet, error)

GetVariableSet returns the variable set with matching ID for a given space ID. This might be a project level variable set (ID might be 'variableset-Projects-314') or it might be a release snapshot variable set (ID might be 'variableset-Projects-314-s-2-XM74V')

func NewVariableSet

func NewVariableSet() *VariableSet

func Update added in v2.33.0

func Update(client newclient.Client, spaceID string, 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 UpdateSingle added in v2.33.0

func UpdateSingle(client newclient.Client, spaceID string, ownerID string, variable *Variable) (VariableSet, error)

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

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