policymgmt

package
v0.3.85 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

README

Go API client for policymgmt

Read and manage OPA Governance policies, policy sets and evaluations

Overview

This API client was generated by the swagger-codegen project. By using the swagger-spec from a remote server, you can easily generate an API client.

  • API version: 1.2.0
  • Package version: 1.0.0
  • Build package: io.swagger.codegen.v3.generators.go.GoClientCodegen

Installation

Put the package under your project folder and add the following in import:

import "./policymgmt"

Documentation for API Endpoints

All URIs are relative to https://app.harness.io/gateway/pm/

Class Method HTTP request Description
AidaApi AidaAnalyze Post /api/v1/aida/analyze
AidaApi AidaGenerate Post /api/v1/aida/generate
DashboardApi DashboardMetrics Get /api/v1/dashboard
EvaluateApi EvaluateEvaluate Post /api/v1/evaluate
EvaluateApi EvaluateEvaluateByIds Post /api/v1/evaluate-by-ids
EvaluateApi EvaluateEvaluateByType Post /api/v1/evaluate-by-type
EvaluateApi EvaluateEvaluateByTypeCheck Get /api/v1/evaluate-by-type-check evaluate-by-type-check evaluate
EvaluationsApi EvaluationsFind Get /api/v1/evaluations/{id}
EvaluationsApi EvaluationsList Get /api/v1/evaluations
ExamplesApi ExamplesList Get /api/v1/examples
PoliciesApi PoliciesCreate Post /api/v1/policies
PoliciesApi PoliciesDelete Delete /api/v1/policies/{identifier}
PoliciesApi PoliciesFind Get /api/v1/policies/{identifier}
PoliciesApi PoliciesList Get /api/v1/policies
PoliciesApi PoliciesUpdate Patch /api/v1/policies/{identifier}
PolicysetsApi PolicysetsCreate Post /api/v1/policysets
PolicysetsApi PolicysetsDelete Delete /api/v1/policysets/{identifier}
PolicysetsApi PolicysetsFind Get /api/v1/policysets/{identifier}
PolicysetsApi PolicysetsList Get /api/v1/policysets
PolicysetsApi PolicysetsUpdate Patch /api/v1/policysets/{identifier}
SystemApi SystemHealth Get /api/v1/system/health
SystemApi SystemVersion Get /api/v1/system/version

Documentation For Models

Documentation For Authorization

api_key_header_x-api-key

  • Type: API key

Example

auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
	Key: "APIKEY",
	Prefix: "Bearer", // Omit if not necessary.
})
r, err := client.Service.Operation(auth, args)

jwt_header_Authorization

Author

Documentation

Overview

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Governance Policy Management API * * Read and manage OPA Governance policies, policy sets and evaluations * * API version: 1.2.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

Index

Constants

This section is empty.

Variables

View Source
var (
	// ContextOAuth2 takes a oauth2.TokenSource as authentication for the request.
	ContextOAuth2 = contextKey("token")

	// ContextBasicAuth takes BasicAuth as authentication for the request.
	ContextBasicAuth = contextKey("basic")

	// ContextAccessToken takes a string oauth2 access token as authentication for the request.
	ContextAccessToken = contextKey("accesstoken")

	// ContextAPIKey takes an APIKey as authentication for the request
	ContextAPIKey = contextKey("apikey")
)

Functions

func CacheExpires

func CacheExpires(r *http.Response) time.Time

CacheExpires helper function to determine remaining time before repeating a request.

Types

type APIClient

type APIClient struct {
	AidaApi *AidaApiService

	DashboardApi *DashboardApiService

	EvaluateApi *EvaluateApiService

	EvaluationsApi *EvaluationsApiService

	ExamplesApi *ExamplesApiService

	PoliciesApi *PoliciesApiService

	PolicysetsApi *PolicysetsApiService

	SystemApi *SystemApiService
	// contains filtered or unexported fields
}

APIClient manages communication with the Governance Policy Management API API v1.2.0 In most cases there should be only one, shared, APIClient.

func NewAPIClient

func NewAPIClient(cfg *Configuration) *APIClient

NewAPIClient creates a new API client. Requires a userAgent string describing your application. optionally a custom http.Client to allow for advanced features such as caching.

func (*APIClient) ChangeBasePath

func (c *APIClient) ChangeBasePath(path string)

Change base path to allow switching to mocks

type APIKey

type APIKey struct {
	Key    string
	Prefix string
}

APIKey provides API key based authentication to a request passed via context using ContextAPIKey

type APIResponse

type APIResponse struct {
	*http.Response `json:"-"`
	Message        string `json:"message,omitempty"`
	// Operation is the name of the swagger operation.
	Operation string `json:"operation,omitempty"`
	// RequestURL is the request URL. This value is always available, even if the
	// embedded *http.Response is nil.
	RequestURL string `json:"url,omitempty"`
	// Method is the HTTP method used for the request.  This value is always
	// available, even if the embedded *http.Response is nil.
	Method string `json:"method,omitempty"`
	// Payload holds the contents of the response body (which may be nil or empty).
	// This is provided here as the raw response.Body() reader will have already
	// been drained.
	Payload []byte `json:"-"`
}

func NewAPIResponse

func NewAPIResponse(r *http.Response) *APIResponse

func NewAPIResponseWithError

func NewAPIResponseWithError(errorMessage string) *APIResponse

type AggregateStatus

type AggregateStatus struct {
	// Count of evaluations that have a status of 'error'
	Error_ int64 `json:"error"`
	// Count of evaluations that have a status of 'pass'
	Pass int64 `json:"pass"`
	// The Unix time of this particular aggregation
	Time int64 `json:"time"`
	// Count of evaluations that have a status of 'warning'
	Warning int64 `json:"warning"`
}

Aggregate metrics for evaluations on a single day

type AidaApiAidaAnalyzeOpts added in v0.3.53

type AidaApiAidaAnalyzeOpts struct {
	XApiKey           optional.String
	AccountIdentifier optional.String
	OrgIdentifier     optional.String
	ProjectIdentifier optional.String
}

type AidaApiAidaGenerateOpts added in v0.3.53

type AidaApiAidaGenerateOpts struct {
	XApiKey           optional.String
	AccountIdentifier optional.String
	OrgIdentifier     optional.String
	ProjectIdentifier optional.String
}

type AidaApiService added in v0.3.53

type AidaApiService service

func (*AidaApiService) AidaAnalyze added in v0.3.53

func (a *AidaApiService) AidaAnalyze(ctx context.Context, body AnalyzeRequestBody, localVarOptionals *AidaApiAidaAnalyzeOpts) (AnalyzeResponse, *http.Response, error)

func (*AidaApiService) AidaGenerate added in v0.3.53

func (a *AidaApiService) AidaGenerate(ctx context.Context, body GenerateRequestBody, localVarOptionals *AidaApiAidaGenerateOpts) (PolicySample, *http.Response, error)

type AnalyzeRequestBody added in v0.3.53

type AnalyzeRequestBody struct {
	// Type of entity on which rego is written on
	EntityType string `json:"entityType,omitempty"`
	// Rego Policy
	Rego string `json:"rego,omitempty"`
}

type AnalyzeResponse added in v0.3.53

type AnalyzeResponse struct {
	// Build identifier
	Desc string `json:"desc"`
	// status
	Status string `json:"status"`
}

type BasicAuth

type BasicAuth struct {
	UserName string `json:"userName,omitempty"`
	Password string `json:"password,omitempty"`
}

BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth

type Configuration

type Configuration struct {
	BasePath      string            `json:"basePath,omitempty"`
	Host          string            `json:"host,omitempty"`
	Scheme        string            `json:"scheme,omitempty"`
	DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
	UserAgent     string            `json:"userAgent,omitempty"`
	HTTPClient    *http.Client
}

func NewConfiguration

func NewConfiguration() *Configuration

func (*Configuration) AddDefaultHeader

func (c *Configuration) AddDefaultHeader(key string, value string)

type CreateRequestBody

type CreateRequestBody struct {
	// The harness connector used for authenticating on the git provider
	GitConnectorRef string `json:"git_connector_ref,omitempty"`
	// The path to the file in the git repo
	GitPath string `json:"git_path,omitempty"`
	// The git repo the policy resides in
	GitRepo string `json:"git_repo,omitempty"`
	// Identifier for the policy
	Identifier string `json:"identifier"`
	// Name of the policy
	Name string `json:"name"`
	// Rego that defines the policy policy
	Rego string `json:"rego"`
}

type CreateRequestBody2

type CreateRequestBody2 struct {
	// Action that triggers the policy set
	Action string `json:"action"`
	// Description of the policy set
	Description string `json:"description,omitempty"`
	// Only enabled policy sets are evaluated when evaluating by type/action
	Enabled bool `json:"enabled"`
	// Identifier for the policy set
	Identifier string `json:"identifier"`
	// Name of the policy set
	Name string `json:"name"`
	// Type of input suitable for the policy set
	Type_ string `json:"type"`
}

type DashboardApiDashboardMetricsOpts

type DashboardApiDashboardMetricsOpts struct {
	Range_            optional.String
	AccountIdentifier optional.String
	OrgIdentifier     optional.String
	ProjectIdentifier optional.String
	XApiKey           optional.String
}

type DashboardApiService

type DashboardApiService service

func (*DashboardApiService) DashboardMetrics

func (a *DashboardApiService) DashboardMetrics(ctx context.Context, localVarOptionals *DashboardApiDashboardMetricsOpts) (DashboardMetrics, *http.Response, error)

type DashboardMetrics

type DashboardMetrics struct {
	// Aggregate evaluation counts by day
	Aggregates   []AggregateStatus `json:"aggregates"`
	PolicyHealth *PolicyHealth     `json:"policy_health"`
}

type ErrorResultWithIdentifier

type ErrorResultWithIdentifier struct {
	// Is the error a server-side fault?
	Fault bool `json:"fault"`
	// ID is a unique identifier for this particular occurrence of the problem.
	Id string `json:"id"`
	// the identifier associated with the error
	Identifier string `json:"identifier,omitempty"`
	// Message is a human-readable explanation specific to this occurrence of the problem.
	Message string `json:"message"`
	// Name is the name of this class of errors.
	Name string `json:"name"`
	// Is the error temporary?
	Temporary bool `json:"temporary"`
	// Is the error a timeout?
	Timeout bool `json:"timeout"`
}

type EvaluateApiEvaluateEvaluateByIdsOpts

type EvaluateApiEvaluateEvaluateByIdsOpts struct {
	AccountIdentifier   optional.String
	OrgIdentifier       optional.String
	ProjectIdentifier   optional.String
	Entity              optional.String
	EntityMetadata      optional.String
	PrincipalIdentifier optional.String
	PrincipalType       optional.String
	UserIdentifier      optional.String
	XApiKey             optional.String
}

type EvaluateApiEvaluateEvaluateByTypeCheckOpts added in v0.3.53

type EvaluateApiEvaluateEvaluateByTypeCheckOpts struct {
	AccountIdentifier optional.String
	OrgIdentifier     optional.String
	ProjectIdentifier optional.String
	Entity            optional.String
	XApiKey           optional.String
}

type EvaluateApiEvaluateEvaluateByTypeOpts

type EvaluateApiEvaluateEvaluateByTypeOpts struct {
	AccountIdentifier   optional.String
	OrgIdentifier       optional.String
	ProjectIdentifier   optional.String
	Entity              optional.String
	EntityMetadata      optional.String
	PrincipalIdentifier optional.String
	PrincipalType       optional.String
	UserIdentifier      optional.String
	XApiKey             optional.String
}

type EvaluateApiEvaluateEvaluateOpts

type EvaluateApiEvaluateEvaluateOpts struct {
	XApiKey           optional.String
	AccountIdentifier optional.String
	OrgIdentifier     optional.String
	ProjectIdentifier optional.String
}

type EvaluateApiService

type EvaluateApiService service

func (*EvaluateApiService) EvaluateEvaluate

func (*EvaluateApiService) EvaluateEvaluateByIds

func (a *EvaluateApiService) EvaluateEvaluateByIds(ctx context.Context, ids string, localVarOptionals *EvaluateApiEvaluateEvaluateByIdsOpts) (Evaluation, *http.Response, error)

func (*EvaluateApiService) EvaluateEvaluateByType

func (a *EvaluateApiService) EvaluateEvaluateByType(ctx context.Context, type_ string, action string, localVarOptionals *EvaluateApiEvaluateEvaluateByTypeOpts) (Evaluation, *http.Response, error)

func (*EvaluateApiService) EvaluateEvaluateByTypeCheck added in v0.3.53

func (a *EvaluateApiService) EvaluateEvaluateByTypeCheck(ctx context.Context, type_ string, action string, localVarOptionals *EvaluateApiEvaluateEvaluateByTypeCheckOpts) (EvaluateByTypeCheckResponseBody, *http.Response, error)

type EvaluateByTypeCheckResponseBody added in v0.3.53

type EvaluateByTypeCheckResponseBody struct {
	// Boolean value that indicates if there are policies to evaluate for the given type, action and acc/org/proj scope.
	ShouldEvaluate bool `json:"should_evaluate"`
}

type EvaluateRequestBody

type EvaluateRequestBody struct {
	// Input to evaluate
	Input **os.File `json:"input"`
	// Arbitrary rego to be evaluated
	Rego string `json:"rego"`
}

type EvaluatedPolicy

type EvaluatedPolicy struct {
	// The values of any `deny` rego rules as returned by the rego engine
	DenyMessages []string `json:"deny_messages"`
	// Any errors returned by the rego engine when this policy was evaluated
	Error_ string `json:"error"`
	// The output returned by the rego engine when this policy was evaluated
	Output **os.File `json:"output"`
	Policy *Policy   `json:"policy"`
	// The overall status for this individual policy indicating whether it passed
	Status string `json:"status"`
}

type Evaluation

type Evaluation struct {
	// The Harness account in which the evaluation was performed
	AccountId string `json:"account_id"`
	// The action that triggered evaluation
	Action string `json:"action"`
	// The time at which the evaluation was performed in Unix time millseconds
	Created int64 `json:"created"`
	// The detailed results of te evaluation
	Details []EvaluationDetail `json:"details"`
	// An arbtrary user-supplied string that globally identifies the entity under evaluation
	Entity string `json:"entity"`
	// Additional arbtrary user-supplied metadta about the entity under evaluation
	EntityMetadata string `json:"entity_metadata"`
	// The ID of this evaluation
	Id int64 `json:"id"`
	// The input provided at evaluation time
	Input **os.File `json:"input"`
	// The Harness organisation in which the evaluation was performed
	OrgId string `json:"org_id"`
	// The Harness project in which the evaluation was performed
	ProjectId string `json:"project_id"`
	// The overall status of the evaluation indicating whether it passed
	Status string `json:"status"`
	// The types of the entity under evaluation
	Type_ string `json:"type"`
}

type Evaluation2

type Evaluation2 struct {
	// The Harness account in which the evaluation was performed
	AccountId string `json:"account_id"`
	// The action that triggered evaluation
	Action string `json:"action"`
	// The time at which the evaluation was performed in Unix time millseconds
	Created int64 `json:"created"`
	// The detailed results of te evaluation
	Details []EvaluationDetail2 `json:"details"`
	// An arbtrary user-supplied string that globally identifies the entity under evaluation
	Entity string `json:"entity"`
	// Additional arbtrary user-supplied metadta about the entity under evaluation
	EntityMetadata string `json:"entity_metadata"`
	// The ID of this evaluation
	Id int64 `json:"id"`
	// The input provided at evaluation time
	Input **os.File `json:"input"`
	// The Harness organisation in which the evaluation was performed
	OrgId string `json:"org_id"`
	// The Harness project in which the evaluation was performed
	ProjectId string `json:"project_id"`
	// The overall status of the evaluation indicating whether it passed
	Status string `json:"status"`
	// The type of the entity under evaluation
	Type_ string `json:"type"`
}

The result of a single evaluation

type EvaluationCounts

type EvaluationCounts struct {
	// Count of evaluations that have a status of 'error'
	Error_ int64 `json:"error"`
	// Count of evaluations that have a status of 'pass'
	Pass int64 `json:"pass"`
	// Count of evaluations that have a status of 'warning'
	Warning int64 `json:"warning"`
}

Evaluation counts by status

type EvaluationDetail

type EvaluationDetail struct {
	// Harness account ID associated with this policy set
	AccountId string `json:"account_id"`
	// Action that triggers the policy set
	Action string `json:"action"`
	// Time the policy set was created
	Created int64 `json:"created"`
	// Description of the policy set
	Description string            `json:"description,omitempty"`
	Details     []EvaluatedPolicy `json:"details"`
	// Only enabled policy sets are evaluated when evaluating by type/action
	Enabled bool `json:"enabled"`
	// Identifier of the policy set
	Identifier string `json:"identifier"`
	// Name of the policy set
	Name string `json:"name"`
	// Harness organization ID associated with this policy set
	OrgId string `json:"org_id"`
	// Harness project ID associated with this policy set
	ProjectId string `json:"project_id"`
	// The overall status for this policy set indicating whether it passed
	Status string `json:"status"`
	// Type of input suitable for the policy set
	Type_ string `json:"type"`
	// Time the policy set was last updated
	Updated int64 `json:"updated"`
}

type EvaluationDetail2

type EvaluationDetail2 struct {
	// Harness account ID associated with this policy set
	AccountId string `json:"account_id,omitempty"`
	// Action that triggers the policy set
	Action string `json:"action,omitempty"`
	// Time the policy set was created
	Created int64 `json:"created,omitempty"`
	// Description of the policy set
	Description string            `json:"description,omitempty"`
	Details     []EvaluatedPolicy `json:"details"`
	// Only enabled policy sets are evaluated when evaluating by type/action
	Enabled bool `json:"enabled,omitempty"`
	// Identifier of the policy set
	Identifier string `json:"identifier,omitempty"`
	// Name of the policy set
	Name string `json:"name,omitempty"`
	// Harness organization ID associated with this policy set
	OrgId string `json:"org_id,omitempty"`
	// Harness project ID associated with this policy set
	ProjectId string `json:"project_id,omitempty"`
	// The overall status for this policy set indicating whether it passed
	Status string `json:"status"`
	// Type of input suitable for the policy set
	Type_ string `json:"type,omitempty"`
	// Time the policy set was last updated
	Updated int64 `json:"updated,omitempty"`
}

type EvaluationsApiEvaluationsFindOpts

type EvaluationsApiEvaluationsFindOpts struct {
	AccountIdentifier optional.String
	OrgIdentifier     optional.String
	ProjectIdentifier optional.String
	XApiKey           optional.String
}

type EvaluationsApiEvaluationsListOpts

type EvaluationsApiEvaluationsListOpts struct {
	AccountIdentifier  optional.String
	OrgIdentifier      optional.String
	ProjectIdentifier  optional.String
	PerPage            optional.Int32
	Page               optional.Int32
	Entity             optional.String
	Type_              optional.String
	Action             optional.String
	LastSeen           optional.Int64
	CreatedDateFrom    optional.Int64
	CreatedDateTo      optional.Int64
	Status             optional.String
	IncludeChildScopes optional.Bool
	XApiKey            optional.String
}

type EvaluationsApiService

type EvaluationsApiService service

func (*EvaluationsApiService) EvaluationsFind

func (a *EvaluationsApiService) EvaluationsFind(ctx context.Context, id int64, localVarOptionals *EvaluationsApiEvaluationsFindOpts) (Evaluation, *http.Response, error)

func (*EvaluationsApiService) EvaluationsList

func (a *EvaluationsApiService) EvaluationsList(ctx context.Context, localVarOptionals *EvaluationsApiEvaluationsListOpts) ([]Evaluation, *http.Response, error)

type ExamplesApiExamplesListOpts

type ExamplesApiExamplesListOpts struct {
	AccountIdentifier optional.String
	OrgIdentifier     optional.String
	ProjectIdentifier optional.String
	XApiKey           optional.String
}

type ExamplesApiService

type ExamplesApiService service

func (*ExamplesApiService) ExamplesList

func (a *ExamplesApiService) ExamplesList(ctx context.Context, localVarOptionals *ExamplesApiExamplesListOpts) ([]PolicyExample, *http.Response, error)

type GenerateRequestBody added in v0.3.53

type GenerateRequestBody struct {
	// policySample Data
	PolicyData string `json:"policyData,omitempty"`
	// Text query
	Query string `json:"query,omitempty"`
}

type GenericSwaggerError

type GenericSwaggerError struct {
	// contains filtered or unexported fields
}

GenericSwaggerError Provides access to the body, error and model on returned errors.

func (GenericSwaggerError) Body

func (e GenericSwaggerError) Body() []byte

Body returns the raw bytes of the response

func (GenericSwaggerError) Error

func (e GenericSwaggerError) Error() string

Error returns non-empty string if there was an error.

func (GenericSwaggerError) Model

func (e GenericSwaggerError) Model() interface{}

Model returns the unpacked model of the error

type GitErrorResult

type GitErrorResult struct {
	// the explanation of the error
	Explanation string `json:"explanation"`
	// the hint on how to resolve the error
	Hint string `json:"hint"`
	// the message is a human-readable explanation specific to this occurrence of the problem
	Message string `json:"message"`
}

type LinkedPolicy

type LinkedPolicy struct {
	// Harness account ID associated with this policy
	AccountId string `json:"account_id"`
	// Time the policy was created
	Created int64 `json:"created"`
	// identifier of the policy
	Identifier string `json:"identifier"`
	// Name of the policy
	Name string `json:"name"`
	// Harness organization ID associated with this policy
	OrgId string `json:"org_id"`
	// Harness project ID associated with this policy
	ProjectId string `json:"project_id"`
	// Rego that defines the policy
	Rego string `json:"rego"`
	// The severity of this policy in this context
	Severity string `json:"severity"`
	// Time the policy was last updated
	Updated int64 `json:"updated"`
}

type LinkedPolicy2

type LinkedPolicy2 struct {
	// Harness account ID associated with this policy
	AccountId string `json:"account_id"`
	// Time the policy was created
	Created int64 `json:"created"`
	// identifier of the policy
	Identifier string `json:"identifier"`
	// Name of the policy
	Name string `json:"name"`
	// Harness organization ID associated with this policy
	OrgId string `json:"org_id"`
	// Harness project ID associated with this policy
	ProjectId string `json:"project_id"`
	// Rego that defines the policy
	Rego string `json:"rego"`
	// The severity of this policy in this context
	Severity string `json:"severity"`
	// Time the policy was last updated
	Updated int64 `json:"updated"`
}

type Linkedpolicyidentifier

type Linkedpolicyidentifier struct {
	// identifier of the policy with account. or org. prefix if needed
	Identifier string `json:"identifier"`
	// The severity of this policy in this context
	Severity string `json:"severity"`
}

type ModelError

type ModelError struct {
	// Is the error a server-side fault?
	Fault bool `json:"fault"`
	// ID is a unique identifier for this particular occurrence of the problem.
	Id string `json:"id"`
	// Message is a human-readable explanation specific to this occurrence of the problem.
	Message string `json:"message"`
	// Name is the name of this class of errors.
	Name string `json:"name"`
	// Is the error temporary?
	Temporary bool `json:"temporary"`
	// Is the error a timeout?
	Timeout bool `json:"timeout"`
}

type PoliciesApiPoliciesCreateOpts

type PoliciesApiPoliciesCreateOpts struct {
	XApiKey           optional.String
	AccountIdentifier optional.String
	OrgIdentifier     optional.String
	ProjectIdentifier optional.String
	GitCommitMsg      optional.String
	GitImport         optional.Bool
	GitBranch         optional.String
	GitIsNewBranch    optional.Bool
	GitBaseBranch     optional.String
}

type PoliciesApiPoliciesDeleteOpts

type PoliciesApiPoliciesDeleteOpts struct {
	AccountIdentifier optional.String
	OrgIdentifier     optional.String
	ProjectIdentifier optional.String
	XApiKey           optional.String
}

type PoliciesApiPoliciesFindOpts

type PoliciesApiPoliciesFindOpts struct {
	AccountIdentifier optional.String
	OrgIdentifier     optional.String
	ProjectIdentifier optional.String
	GitBranch         optional.String
	ShowSummary       optional.Bool
	XApiKey           optional.String
}

type PoliciesApiPoliciesListOpts

type PoliciesApiPoliciesListOpts struct {
	AccountIdentifier optional.String
	OrgIdentifier     optional.String
	ProjectIdentifier optional.String
	PerPage           optional.Int32
	Page              optional.Int32
	SearchTerm        optional.String
	Sort              optional.String
	XApiKey           optional.String
}

type PoliciesApiPoliciesUpdateOpts

type PoliciesApiPoliciesUpdateOpts struct {
	XApiKey           optional.String
	GitCommitMsg      optional.String
	GitIsNewBranch    optional.Bool
	GitBaseBranch     optional.String
	GitBranch         optional.String
	GitCommitSha      optional.String
	GitFileId         optional.String
	AccountIdentifier optional.String
	OrgIdentifier     optional.String
	ProjectIdentifier optional.String
}

type PoliciesApiService

type PoliciesApiService service

func (*PoliciesApiService) PoliciesCreate

func (a *PoliciesApiService) PoliciesCreate(ctx context.Context, body CreateRequestBody, localVarOptionals *PoliciesApiPoliciesCreateOpts) (Policy, *http.Response, error)

func (*PoliciesApiService) PoliciesDelete

func (a *PoliciesApiService) PoliciesDelete(ctx context.Context, identifier string, localVarOptionals *PoliciesApiPoliciesDeleteOpts) (*http.Response, error)

func (*PoliciesApiService) PoliciesFind

func (a *PoliciesApiService) PoliciesFind(ctx context.Context, identifier string, localVarOptionals *PoliciesApiPoliciesFindOpts) (Policy, *http.Response, error)

func (*PoliciesApiService) PoliciesList

func (a *PoliciesApiService) PoliciesList(ctx context.Context, localVarOptionals *PoliciesApiPoliciesListOpts) ([]Policy, *http.Response, error)

func (*PoliciesApiService) PoliciesUpdate

func (a *PoliciesApiService) PoliciesUpdate(ctx context.Context, body UpdateRequestBody, identifier string, localVarOptionals *PoliciesApiPoliciesUpdateOpts) (*http.Response, error)

type Policy

type Policy struct {
	// Harness account ID associated with this policy
	AccountId string `json:"account_id"`
	// Time the policy was created
	Created int64 `json:"created"`
	// The commit sha of the commit that last effected the file
	GitCommitSha string `json:"git_commit_sha,omitempty"`
	// The harness connector used for authenticating on the git provider
	GitConnectorRef string `json:"git_connector_ref,omitempty"`
	// The default branch, the service pulls in changes from from this branch for policy evaluation
	GitDefaultBranch string `json:"git_default_branch,omitempty"`
	// The commit sha of the commit that last effected the file in the default branch
	GitDefaultBranchCommitSha string `json:"git_default_branch_commit_sha,omitempty"`
	// The file id of the file in the default branch, may be empty for bitbucket files
	GitDefaultBranchFileId string `json:"git_default_branch_file_id,omitempty"`
	// The url of the file in the default branch
	GitDefaultBranchFileUrl     string          `json:"git_default_branch_file_url,omitempty"`
	GitDefaultBranchUpdateError *GitErrorResult `json:"git_default_branch_update_error,omitempty"`
	// The last time the service successfully pulled in changes from the default branch
	GitDefaultBranchUpdated int64 `json:"git_default_branch_updated,omitempty"`
	// The file id of the file, may be empty for bitbucket files
	GitFileId string `json:"git_file_id,omitempty"`
	// The url of the file on the fit provider
	GitFileUrl string `json:"git_file_url,omitempty"`
	// The path to the file in the git repo
	GitPath string `json:"git_path,omitempty"`
	// The git repo the policy resides in
	GitRepo string `json:"git_repo,omitempty"`
	// identifier of the policy
	Identifier string `json:"identifier"`
	// Name of the policy
	Name string `json:"name"`
	// Harness organization ID associated with this policy
	OrgId string `json:"org_id"`
	// Harness project ID associated with this policy
	ProjectId string `json:"project_id"`
	// Rego that defines the policy
	Rego string `json:"rego"`
	// Time the policy was last updated
	Updated int64 `json:"updated"`
}

type PolicyExample

type PolicyExample struct {
	// Longer description of the example
	Desc string `json:"desc"`
	// Example input to illustrate the rego policy
	Input string `json:"input"`
	// Example name
	Name string `json:"name"`
	// Example rego policy
	Rego string `json:"rego"`
	// The type of entity illustrated in this example
	Type_ string `json:"type"`
	// The list of substitutable variables in the policy example
	Variables []Variable `json:"variables,omitempty"`
}

Example policies and input

type PolicyHealth

type PolicyHealth struct {
	// Total number of evaluations that have occurred
	TotalEvaluationCount       int64             `json:"total_evaluation_count"`
	TotalEvaluationEntityCount *EvaluationCounts `json:"total_evaluation_entity_count"`
	// Total number of policies stored
	TotalPolicyCount int64 `json:"total_policy_count"`
	// Total number of policy sets stored
	TotalPolicySetCount int64 `json:"total_policy_set_count"`
	// Total number of policy sets by type
	TotalPolicySetEntityCount map[string]int64 `json:"total_policy_set_entity_count"`
}

Policy health metrics

type PolicySample added in v0.3.53

type PolicySample struct {
	// Build identifier
	Policy string `json:"policy"`
	// status
	Status string `json:"status"`
}

type PolicySet

type PolicySet struct {
	// Harness account ID associated with this policy set
	AccountId string `json:"account_id"`
	// Action that triggers the policy set
	Action string `json:"action"`
	// Time the policy set was created
	Created int64 `json:"created"`
	// Description of the policy set
	Description string `json:"description,omitempty"`
	// Only enabled policy sets are evaluated when evaluating by type/action
	Enabled bool `json:"enabled"`
	// A string enum value which determines which entities the policy set applies to during evaluation
	EntitySelector string `json:"entity_selector"`
	// Identifier of the policy set
	Identifier string `json:"identifier"`
	// Name of the policy set
	Name string `json:"name"`
	// Harness organization ID associated with this policy set
	OrgId string `json:"org_id"`
	// Policies linked to this policy set
	Policies []LinkedPolicy `json:"policies,omitempty"`
	// Harness project ID associated with this policy set
	ProjectId string `json:"project_id"`
	// The groups of resources that this policy set should be applied to
	ResourceGroups []ResourceGroup `json:"resource_groups,omitempty"`
	// Type of input suitable for the policy set
	Type_ string `json:"type"`
	// Time the policy set was last updated
	Updated int64 `json:"updated"`
}

type PolicySet2

type PolicySet2 struct {
	// Harness account ID associated with this policy set
	AccountId string `json:"account_id"`
	// Action that triggers the policy set
	Action string `json:"action"`
	// Time the policy set was created
	Created int64 `json:"created"`
	// Description of the policy set
	Description string `json:"description,omitempty"`
	// Only enabled policy sets are evaluated when evaluating by type/action
	Enabled bool `json:"enabled"`
	// Identifier of the policy set
	Identifier string `json:"identifier"`
	// Name of the policy set
	Name string `json:"name"`
	// Harness organization ID associated with this policy set
	OrgId string `json:"org_id"`
	// Policies linked to this policy set
	Policies []LinkedPolicy2 `json:"policies,omitempty"`
	// Harness project ID associated with this policy set
	ProjectId string `json:"project_id"`
	// Type of input suitable for the policy set
	Type_ string `json:"type"`
	// Time the policy set was last updated
	Updated int64 `json:"updated"`
}

type PolicysetsApiPolicysetsCreateOpts

type PolicysetsApiPolicysetsCreateOpts struct {
	XApiKey           optional.String
	AccountIdentifier optional.String
	OrgIdentifier     optional.String
	ProjectIdentifier optional.String
}

type PolicysetsApiPolicysetsDeleteOpts

type PolicysetsApiPolicysetsDeleteOpts struct {
	AccountIdentifier optional.String
	OrgIdentifier     optional.String
	ProjectIdentifier optional.String
	XApiKey           optional.String
}

type PolicysetsApiPolicysetsFindOpts

type PolicysetsApiPolicysetsFindOpts struct {
	AccountIdentifier optional.String
	OrgIdentifier     optional.String
	ProjectIdentifier optional.String
	XApiKey           optional.String
}

type PolicysetsApiPolicysetsListOpts

type PolicysetsApiPolicysetsListOpts struct {
	AccountIdentifier optional.String
	OrgIdentifier     optional.String
	ProjectIdentifier optional.String
	PerPage           optional.Int32
	Page              optional.Int32
	SearchTerm        optional.String
	Sort              optional.String
	Type_             optional.String
	Action            optional.String
	XApiKey           optional.String
}

type PolicysetsApiPolicysetsUpdateOpts

type PolicysetsApiPolicysetsUpdateOpts struct {
	XApiKey           optional.String
	AccountIdentifier optional.String
	OrgIdentifier     optional.String
	ProjectIdentifier optional.String
}

type PolicysetsApiService

type PolicysetsApiService service

func (*PolicysetsApiService) PolicysetsCreate

func (*PolicysetsApiService) PolicysetsDelete

func (a *PolicysetsApiService) PolicysetsDelete(ctx context.Context, identifier string, localVarOptionals *PolicysetsApiPolicysetsDeleteOpts) (*http.Response, error)

func (*PolicysetsApiService) PolicysetsFind

func (a *PolicysetsApiService) PolicysetsFind(ctx context.Context, identifier string, localVarOptionals *PolicysetsApiPolicysetsFindOpts) (PolicySet, *http.Response, error)

func (*PolicysetsApiService) PolicysetsList

func (a *PolicysetsApiService) PolicysetsList(ctx context.Context, localVarOptionals *PolicysetsApiPolicysetsListOpts) ([]PolicySet, *http.Response, error)

func (*PolicysetsApiService) PolicysetsUpdate

func (a *PolicysetsApiService) PolicysetsUpdate(ctx context.Context, body UpdateRequestBody2, identifier string, localVarOptionals *PolicysetsApiPolicysetsUpdateOpts) (*http.Response, error)

type ResourceGroup added in v0.3.53

type ResourceGroup struct {
	// resource group account id
	AccountId string `json:"account_id"`
	// resource group timestamp
	Created int64 `json:"created"`
	// resource group identifier
	Identifier string `json:"identifier"`
	// resource group name
	Name string `json:"name"`
	// resource group org id
	OrgId string `json:"org_id"`
	// resource group project identifier
	ProjectId string `json:"project_id"`
}

type ResourceGroupIdentifier added in v0.3.53

type ResourceGroupIdentifier struct {
	// resource group account id
	AccountId string `json:"account_id"`
	// resource group identifier
	Identifier string `json:"identifier"`
	// resource group org id
	OrgId string `json:"org_id"`
	// resource group project identifier
	ProjectId string `json:"project_id"`
}

type ServiceVersion

type ServiceVersion struct {
	// Build identifier
	Commit string `json:"commit"`
	// Version number
	Version string `json:"version"`
}

type SystemApiService

type SystemApiService service

func (*SystemApiService) SystemHealth

func (a *SystemApiService) SystemHealth(ctx context.Context) (*http.Response, error)

SystemApiService Check service health

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

func (*SystemApiService) SystemVersion

func (a *SystemApiService) SystemVersion(ctx context.Context) (ServiceVersion, *http.Response, error)

SystemApiService Check service version

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

@return ServiceVersion

type UpdateRequestBody

type UpdateRequestBody struct {
	// The name of the policy
	Name string `json:"name,omitempty"`
	// The rego that defines the policy policy
	Rego string `json:"rego,omitempty"`
}

type UpdateRequestBody2

type UpdateRequestBody2 struct {
	// Action that triggers the policy set
	Action string `json:"action,omitempty"`
	// Description of the policy set
	Description string `json:"description,omitempty"`
	// Only enabled policy sets are evaluated when evaluating by type/action
	Enabled bool `json:"enabled"`
	// A string enum value which determines which entities the policy set applies to during evaluation. This feature is not available for all accounts, Contact support if you wish to have it enabled.
	EntitySelector string `json:"entity_selector,omitempty"`
	// Name of the policy set
	Name string `json:"name,omitempty"`
	// Policies linked to this policy set
	Policies []Linkedpolicyidentifier `json:"policies,omitempty"`
	// Resource groups that contain the resources that this policy set should be evaluated for. Resource groups are not supported for flag or custom policy sets. This feature is not available for all accounts, Contact support if you wish to have it enabled.
	ResourceGroups []ResourceGroupIdentifier `json:"resource_groups,omitempty"`
	// Type of input suitable for the policy set
	Type_ string `json:"type,omitempty"`
}

type Variable added in v0.3.53

type Variable struct {
	// The values that are selected by default
	Default_ []string `json:"default,omitempty"`
	// Longer description of the variable to substitute
	Desc string `json:"desc,omitempty"`
	// The id of the variable to substitute in the rego
	Id string `json:"id,omitempty"`
	// The human readable name of the variable to substitute in the rego
	Name string `json:"name,omitempty"`
	// The variable type
	Type_ string `json:"type,omitempty"`
	// Pre populated sample values to substitute the variable with
	Values []string `json:"values,omitempty"`
}

Jump to

Keyboard shortcuts

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