approvalpolicies

package
v2.113.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteByID

func DeleteByID(client newclient.Client, spaceID string, ID string) error

DeleteByID deletes the approval policy that matches the input ID.

func Get

Get returns a paginated collection of approval policies matching the query.

Types

type ApprovalPoliciesQuery

type ApprovalPoliciesQuery struct {
	PartialName string `uri:"partialName,omitempty" url:"partialName,omitempty"`
	Skip        int    `uri:"skip" url:"skip"`
	Take        int    `uri:"take,omitempty" url:"take,omitempty"`
}

ApprovalPoliciesQuery is the query for the paginated approval-policies list endpoint.

type ApprovalPolicy

type ApprovalPolicy struct {
	SpaceID     string `json:"SpaceId,omitempty"`
	Name        string `json:"Name" validate:"required"`
	Description string `json:"Description,omitempty"`

	ScopingStrategy ApprovalPolicyScopingStrategy `json:"ScopingStrategy"`
	TagScopes       []ApprovalPolicyTagScope      `json:"TagScopes"`
	IdScopes        []ApprovalPolicyIdScope       `json:"IdScopes"`

	MinimumApproversRequired int `json:"MinimumApproversRequired"`

	// AllowSelfApproval controls whether the deployment creator may approve their own
	// deployment. There is no separate "block by creator" field — this is it, inverted.
	AllowSelfApproval bool `json:"AllowSelfApproval"`

	// IsDisabled disables the policy. There is no "Enabled" field — this is it, inverted.
	IsDisabled bool `json:"IsDisabled"`

	ApprovingUserIds []string `json:"ApprovingUserIds"`
	ApprovingTeamIds []string `json:"ApprovingTeamIds"`

	resources.Resource
}

ApprovalPolicy is the reusable approval configuration applied to a set of projects/environments (by tag or by id).

func Add

func Add(client newclient.Client, spaceID string, policy *ApprovalPolicy) (*ApprovalPolicy, error)

Add creates a new approval policy.

func GetAll

func GetAll(client newclient.Client, spaceID string) ([]*ApprovalPolicy, error)

GetAll returns all approval policies in the space. The list endpoint requires the skip and take query parameters, so this issues a single request with the maximum take rather than relying on the generic paginated helper (which omits them and would be rejected by the server).

func GetByID

func GetByID(client newclient.Client, spaceID string, ID string) (*ApprovalPolicy, error)

GetByID returns the approval policy that matches the input ID.

func NewApprovalPolicy

func NewApprovalPolicy(name string) *ApprovalPolicy

NewApprovalPolicy creates an ApprovalPolicy with server-friendly defaults (Tag scoping, 2 minimum approvers, empty scope/approver slices).

func Update

func Update(client newclient.Client, spaceID string, policy *ApprovalPolicy) (*ApprovalPolicy, error)

Update modifies an existing approval policy.

func (*ApprovalPolicy) GetName

func (p *ApprovalPolicy) GetName() string

func (*ApprovalPolicy) SetName

func (p *ApprovalPolicy) SetName(name string)

type ApprovalPolicyIdScope

type ApprovalPolicyIdScope struct {
	Id             string   `json:"Id,omitempty"`
	ProjectId      string   `json:"ProjectId"`
	EnvironmentIds []string `json:"EnvironmentIds"`
}

ApprovalPolicyIdScope scopes a policy by a project + specific environments (ScopingStrategy = "Id").

type ApprovalPolicyScopingStrategy

type ApprovalPolicyScopingStrategy string

ApprovalPolicyScopingStrategy selects whether a policy is scoped by tags or by ids.

const (
	ApprovalPolicyScopingStrategyTag ApprovalPolicyScopingStrategy = "Tag"
	ApprovalPolicyScopingStrategyId  ApprovalPolicyScopingStrategy = "Id"
)

type ApprovalPolicyTagScope

type ApprovalPolicyTagScope struct {
	Id              string   `json:"Id,omitempty"`
	ProjectTags     []string `json:"ProjectTags"`
	EnvironmentTags []string `json:"EnvironmentTags"`
}

ApprovalPolicyTagScope scopes a policy by project/environment tags (ScopingStrategy = "Tag").

Jump to

Keyboard shortcuts

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