policy

package
v7.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2023 License: MIT Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PolicyEvaluationStatusValues = policyEvaluationStatusValuesType{

	Queued: "queued",

	Running: "running",

	Approved: "approved",

	Rejected: "rejected",

	NotApplicable: "notApplicable",

	Broken: "broken",
}
View Source
var ResourceAreaId, _ = uuid.Parse("fb13a388-40dd-4a04-b530-013a739c72ef")

Functions

This section is empty.

Types

type Client

type Client interface {
	// [Preview API] Create a policy configuration of a given policy type.
	CreatePolicyConfiguration(context.Context, CreatePolicyConfigurationArgs) (*PolicyConfiguration, error)
	// [Preview API] Delete a policy configuration by its ID.
	DeletePolicyConfiguration(context.Context, DeletePolicyConfigurationArgs) error
	// [Preview API] Get a policy configuration by its ID.
	GetPolicyConfiguration(context.Context, GetPolicyConfigurationArgs) (*PolicyConfiguration, error)
	// [Preview API] Retrieve a specific revision of a given policy by ID.
	GetPolicyConfigurationRevision(context.Context, GetPolicyConfigurationRevisionArgs) (*PolicyConfiguration, error)
	// [Preview API] Retrieve all revisions for a given policy.
	GetPolicyConfigurationRevisions(context.Context, GetPolicyConfigurationRevisionsArgs) (*[]PolicyConfiguration, error)
	// [Preview API] Get a list of policy configurations in a project.
	GetPolicyConfigurations(context.Context, GetPolicyConfigurationsArgs) (*GetPolicyConfigurationsResponseValue, error)
	// [Preview API] Gets the present evaluation state of a policy.
	GetPolicyEvaluation(context.Context, GetPolicyEvaluationArgs) (*PolicyEvaluationRecord, error)
	// [Preview API] Retrieves a list of all the policy evaluation statuses for a specific pull request.
	GetPolicyEvaluations(context.Context, GetPolicyEvaluationsArgs) (*[]PolicyEvaluationRecord, error)
	// [Preview API] Retrieve a specific policy type by ID.
	GetPolicyType(context.Context, GetPolicyTypeArgs) (*PolicyType, error)
	// [Preview API] Retrieve all available policy types.
	GetPolicyTypes(context.Context, GetPolicyTypesArgs) (*[]PolicyType, error)
	// [Preview API] Requeue the policy evaluation.
	RequeuePolicyEvaluation(context.Context, RequeuePolicyEvaluationArgs) (*PolicyEvaluationRecord, error)
	// [Preview API] Update a policy configuration by its ID.
	UpdatePolicyConfiguration(context.Context, UpdatePolicyConfigurationArgs) (*PolicyConfiguration, error)
}

func NewClient

func NewClient(ctx context.Context, connection *azuredevops.Connection) (Client, error)

type ClientImpl

type ClientImpl struct {
	Client azuredevops.Client
}

func (*ClientImpl) CreatePolicyConfiguration

func (client *ClientImpl) CreatePolicyConfiguration(ctx context.Context, args CreatePolicyConfigurationArgs) (*PolicyConfiguration, error)

[Preview API] Create a policy configuration of a given policy type.

func (*ClientImpl) DeletePolicyConfiguration

func (client *ClientImpl) DeletePolicyConfiguration(ctx context.Context, args DeletePolicyConfigurationArgs) error

[Preview API] Delete a policy configuration by its ID.

func (*ClientImpl) GetPolicyConfiguration

func (client *ClientImpl) GetPolicyConfiguration(ctx context.Context, args GetPolicyConfigurationArgs) (*PolicyConfiguration, error)

[Preview API] Get a policy configuration by its ID.

func (*ClientImpl) GetPolicyConfigurationRevision

func (client *ClientImpl) GetPolicyConfigurationRevision(ctx context.Context, args GetPolicyConfigurationRevisionArgs) (*PolicyConfiguration, error)

[Preview API] Retrieve a specific revision of a given policy by ID.

func (*ClientImpl) GetPolicyConfigurationRevisions

func (client *ClientImpl) GetPolicyConfigurationRevisions(ctx context.Context, args GetPolicyConfigurationRevisionsArgs) (*[]PolicyConfiguration, error)

[Preview API] Retrieve all revisions for a given policy.

func (*ClientImpl) GetPolicyConfigurations

[Preview API] Get a list of policy configurations in a project.

func (*ClientImpl) GetPolicyEvaluation

func (client *ClientImpl) GetPolicyEvaluation(ctx context.Context, args GetPolicyEvaluationArgs) (*PolicyEvaluationRecord, error)

[Preview API] Gets the present evaluation state of a policy.

func (*ClientImpl) GetPolicyEvaluations

func (client *ClientImpl) GetPolicyEvaluations(ctx context.Context, args GetPolicyEvaluationsArgs) (*[]PolicyEvaluationRecord, error)

[Preview API] Retrieves a list of all the policy evaluation statuses for a specific pull request.

func (*ClientImpl) GetPolicyType

func (client *ClientImpl) GetPolicyType(ctx context.Context, args GetPolicyTypeArgs) (*PolicyType, error)

[Preview API] Retrieve a specific policy type by ID.

func (*ClientImpl) GetPolicyTypes

func (client *ClientImpl) GetPolicyTypes(ctx context.Context, args GetPolicyTypesArgs) (*[]PolicyType, error)

[Preview API] Retrieve all available policy types.

func (*ClientImpl) RequeuePolicyEvaluation

func (client *ClientImpl) RequeuePolicyEvaluation(ctx context.Context, args RequeuePolicyEvaluationArgs) (*PolicyEvaluationRecord, error)

[Preview API] Requeue the policy evaluation.

func (*ClientImpl) UpdatePolicyConfiguration

func (client *ClientImpl) UpdatePolicyConfiguration(ctx context.Context, args UpdatePolicyConfigurationArgs) (*PolicyConfiguration, error)

[Preview API] Update a policy configuration by its ID.

type CreatePolicyConfigurationArgs

type CreatePolicyConfigurationArgs struct {
	// (required) The policy configuration to create.
	Configuration *PolicyConfiguration
	// (required) Project ID or project name
	Project *string
}

Arguments for the CreatePolicyConfiguration function

type DeletePolicyConfigurationArgs

type DeletePolicyConfigurationArgs struct {
	// (required) Project ID or project name
	Project *string
	// (required) ID of the policy configuration to delete.
	ConfigurationId *int
}

Arguments for the DeletePolicyConfiguration function

type GetPolicyConfigurationArgs

type GetPolicyConfigurationArgs struct {
	// (required) Project ID or project name
	Project *string
	// (required) ID of the policy configuration
	ConfigurationId *int
}

Arguments for the GetPolicyConfiguration function

type GetPolicyConfigurationRevisionArgs

type GetPolicyConfigurationRevisionArgs struct {
	// (required) Project ID or project name
	Project *string
	// (required) The policy configuration ID.
	ConfigurationId *int
	// (required) The revision ID.
	RevisionId *int
}

Arguments for the GetPolicyConfigurationRevision function

type GetPolicyConfigurationRevisionsArgs

type GetPolicyConfigurationRevisionsArgs struct {
	// (required) Project ID or project name
	Project *string
	// (required) The policy configuration ID.
	ConfigurationId *int
	// (optional) The number of revisions to retrieve.
	Top *int
	// (optional) The number of revisions to ignore. For example, to retrieve results 101-150, set top to 50 and skip to 100.
	Skip *int
}

Arguments for the GetPolicyConfigurationRevisions function

type GetPolicyConfigurationsArgs

type GetPolicyConfigurationsArgs struct {
	// (required) Project ID or project name
	Project *string
	// (optional) [Provided for legacy reasons] The scope on which a subset of policies is defined.
	Scope *string
	// (optional) Filter returned policies to only this type
	PolicyType *uuid.UUID
}

Arguments for the GetPolicyConfigurations function

type GetPolicyConfigurationsResponseValue

type GetPolicyConfigurationsResponseValue struct {
	Value             []PolicyConfiguration
	ContinuationToken string
}

Return type for the GetPolicyConfigurations function

type GetPolicyEvaluationArgs

type GetPolicyEvaluationArgs struct {
	// (required) Project ID or project name
	Project *string
	// (required) ID of the policy evaluation to be retrieved.
	EvaluationId *uuid.UUID
}

Arguments for the GetPolicyEvaluation function

type GetPolicyEvaluationsArgs

type GetPolicyEvaluationsArgs struct {
	// (required) Project ID or project name
	Project *string
	// (required) A string which uniquely identifies the target of a policy evaluation.
	ArtifactId *string
	// (optional) Some policies might determine that they do not apply to a specific pull request. Setting this parameter to true will return evaluation records even for policies which don't apply to this pull request.
	IncludeNotApplicable *bool
	// (optional) The number of policy evaluation records to retrieve.
	Top *int
	// (optional) The number of policy evaluation records to ignore. For example, to retrieve results 101-150, set top to 50 and skip to 100.
	Skip *int
}

Arguments for the GetPolicyEvaluations function

type GetPolicyTypeArgs

type GetPolicyTypeArgs struct {
	// (required) Project ID or project name
	Project *string
	// (required) The policy ID.
	TypeId *uuid.UUID
}

Arguments for the GetPolicyType function

type GetPolicyTypesArgs

type GetPolicyTypesArgs struct {
	// (required) Project ID or project name
	Project *string
}

Arguments for the GetPolicyTypes function

type PolicyConfiguration

type PolicyConfiguration struct {
	// The policy configuration ID.
	Id *int `json:"id,omitempty"`
	// The policy configuration type.
	Type *PolicyTypeRef `json:"type,omitempty"`
	// The URL where the policy configuration can be retrieved.
	Url *string `json:"url,omitempty"`
	// The policy configuration revision ID.
	Revision *int `json:"revision,omitempty"`
	// The links to other objects related to this object.
	Links interface{} `json:"_links,omitempty"`
	// A reference to the identity that created the policy.
	CreatedBy *webapi.IdentityRef `json:"createdBy,omitempty"`
	// The date and time when the policy was created.
	CreatedDate *azuredevops.Time `json:"createdDate,omitempty"`
	// Indicates whether the policy is blocking.
	IsBlocking *bool `json:"isBlocking,omitempty"`
	// Indicates whether the policy has been (soft) deleted.
	IsDeleted *bool `json:"isDeleted,omitempty"`
	// Indicates whether the policy is enabled.
	IsEnabled *bool `json:"isEnabled,omitempty"`
	// If set, this policy requires "Manage Enterprise Policies" permission to create, edit, or delete.
	IsEnterpriseManaged *bool `json:"isEnterpriseManaged,omitempty"`
	// The policy configuration settings.
	Settings interface{} `json:"settings,omitempty"`
}

The full policy configuration with settings.

type PolicyConfigurationRef

type PolicyConfigurationRef struct {
	// The policy configuration ID.
	Id *int `json:"id,omitempty"`
	// The policy configuration type.
	Type *PolicyTypeRef `json:"type,omitempty"`
	// The URL where the policy configuration can be retrieved.
	Url *string `json:"url,omitempty"`
}

Policy configuration reference.

type PolicyEvaluationRecord

type PolicyEvaluationRecord struct {
	// Links to other related objects
	Links interface{} `json:"_links,omitempty"`
	// A string which uniquely identifies the target of a policy evaluation.
	ArtifactId *string `json:"artifactId,omitempty"`
	// Time when this policy finished evaluating on this pull request.
	CompletedDate *azuredevops.Time `json:"completedDate,omitempty"`
	// Contains all configuration data for the policy which is being evaluated.
	Configuration *PolicyConfiguration `json:"configuration,omitempty"`
	// Internal context data of this policy evaluation.
	Context interface{} `json:"context,omitempty"`
	// Guid which uniquely identifies this evaluation record (one policy running on one pull request).
	EvaluationId *uuid.UUID `json:"evaluationId,omitempty"`
	// Time when this policy was first evaluated on this pull request.
	StartedDate *azuredevops.Time `json:"startedDate,omitempty"`
	// Status of the policy (Running, Approved, Failed, etc.)
	Status *PolicyEvaluationStatus `json:"status,omitempty"`
}

This record encapsulates the current state of a policy as it applies to one specific pull request. Each pull request has a unique PolicyEvaluationRecord for each pull request which the policy applies to.

type PolicyEvaluationStatus

type PolicyEvaluationStatus string

Status of a policy which is running against a specific pull request.

type PolicyType

type PolicyType struct {
	// Display name of the policy type.
	DisplayName *string `json:"displayName,omitempty"`
	// The policy type ID.
	Id *uuid.UUID `json:"id,omitempty"`
	// The URL where the policy type can be retrieved.
	Url *string `json:"url,omitempty"`
	// The links to other objects related to this object.
	Links interface{} `json:"_links,omitempty"`
	// Detailed description of the policy type.
	Description *string `json:"description,omitempty"`
}

User-friendly policy type with description (used for querying policy types).

type PolicyTypeRef

type PolicyTypeRef struct {
	// Display name of the policy type.
	DisplayName *string `json:"displayName,omitempty"`
	// The policy type ID.
	Id *uuid.UUID `json:"id,omitempty"`
	// The URL where the policy type can be retrieved.
	Url *string `json:"url,omitempty"`
}

Policy type reference.

type RequeuePolicyEvaluationArgs

type RequeuePolicyEvaluationArgs struct {
	// (required) Project ID or project name
	Project *string
	// (required) ID of the policy evaluation to be retrieved.
	EvaluationId *uuid.UUID
}

Arguments for the RequeuePolicyEvaluation function

type UpdatePolicyConfigurationArgs

type UpdatePolicyConfigurationArgs struct {
	// (required) The policy configuration to update.
	Configuration *PolicyConfiguration
	// (required) Project ID or project name
	Project *string
	// (required) ID of the existing policy configuration to be updated.
	ConfigurationId *int
}

Arguments for the UpdatePolicyConfiguration function

type VersionedPolicyConfigurationRef

type VersionedPolicyConfigurationRef struct {
	// The policy configuration ID.
	Id *int `json:"id,omitempty"`
	// The policy configuration type.
	Type *PolicyTypeRef `json:"type,omitempty"`
	// The URL where the policy configuration can be retrieved.
	Url *string `json:"url,omitempty"`
	// The policy configuration revision ID.
	Revision *int `json:"revision,omitempty"`
}

A particular revision for a policy configuration.

Jump to

Keyboard shortcuts

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