PolicyRestClient class
Base class that should be used (derived from) to make requests to VSS REST apis
- Extends
Constructors
Policy |
Properties
RESOURCE_AREA_ID |
Methods
create |
Create a policy configuration of a given policy type. |
delete |
Delete a policy configuration by its ID. |
get |
Get a policy configuration by its ID. |
get |
Retrieve a specific revision of a given policy by ID. |
get |
Retrieve all revisions for a given policy. |
get |
Get a list of policy configurations in a project. |
get |
Gets the present evaluation state of a policy. |
get |
Retrieves a list of all the policy evaluation statuses for a specific pull request. |
get |
Retrieve a specific policy type by ID. |
get |
Retrieve all available policy types. |
requeue |
Requeue the policy evaluation. |
update |
Update a policy configuration by its ID. |
Constructor Details
PolicyRestClient(IVssRestClientOptions)
Property Details
RESOURCE_AREA_ID
static RESOURCE_AREA_ID: string
Property Value
string
Method Details
createPolicyConfiguration(PolicyConfiguration, string)
Create a policy configuration of a given policy type.
function createPolicyConfiguration(configuration: PolicyConfiguration, project: string): Promise<PolicyConfiguration>
Parameters
- configuration
- PolicyConfiguration
The policy configuration to create.
- project
-
string
Project ID or project name
Returns
Promise<PolicyConfiguration>
deletePolicyConfiguration(string, number)
Delete a policy configuration by its ID.
function deletePolicyConfiguration(project: string, configurationId: number): Promise<void>
Parameters
- project
-
string
Project ID or project name
- configurationId
-
number
ID of the policy configuration to delete.
Returns
Promise<void>
getPolicyConfiguration(string, number)
Get a policy configuration by its ID.
function getPolicyConfiguration(project: string, configurationId: number): Promise<PolicyConfiguration>
Parameters
- project
-
string
Project ID or project name
- configurationId
-
number
ID of the policy configuration
Returns
Promise<PolicyConfiguration>
getPolicyConfigurationRevision(string, number, number)
Retrieve a specific revision of a given policy by ID.
function getPolicyConfigurationRevision(project: string, configurationId: number, revisionId: number): Promise<PolicyConfiguration>
Parameters
- project
-
string
Project ID or project name
- configurationId
-
number
The policy configuration ID.
- revisionId
-
number
The revision ID.
Returns
Promise<PolicyConfiguration>
getPolicyConfigurationRevisions(string, number, number, number)
Retrieve all revisions for a given policy.
function getPolicyConfigurationRevisions(project: string, configurationId: number, top?: number, skip?: number): Promise<PolicyConfiguration[]>
Parameters
- project
-
string
Project ID or project name
- configurationId
-
number
The policy configuration ID.
- top
-
number
The number of revisions to retrieve.
- skip
-
number
The number of revisions to ignore. For example, to retrieve results 101-150, set top to 50 and skip to 100.
Returns
Promise<PolicyConfiguration[]>
getPolicyConfigurations(string, string, string)
Get a list of policy configurations in a project.
function getPolicyConfigurations(project: string, scope?: string, policyType?: string): Promise<PagedList<PolicyConfiguration>>
Parameters
- project
-
string
Project ID or project name
- scope
-
string
[Provided for legacy reasons] The scope on which a subset of policies is defined.
- policyType
-
string
Filter returned policies to only this type
Returns
Promise<PagedList<PolicyConfiguration>>
getPolicyEvaluation(string, string)
Gets the present evaluation state of a policy.
function getPolicyEvaluation(project: string, evaluationId: string): Promise<PolicyEvaluationRecord>
Parameters
- project
-
string
Project ID or project name
- evaluationId
-
string
ID of the policy evaluation to be retrieved.
Returns
Promise<PolicyEvaluationRecord>
getPolicyEvaluations(string, string, boolean, number, number)
Retrieves a list of all the policy evaluation statuses for a specific pull request.
function getPolicyEvaluations(project: string, artifactId: string, includeNotApplicable?: boolean, top?: number, skip?: number): Promise<PolicyEvaluationRecord[]>
Parameters
- project
-
string
Project ID or project name
- artifactId
-
string
A string which uniquely identifies the target of a policy evaluation.
- includeNotApplicable
-
boolean
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.
- top
-
number
The number of policy evaluation records to retrieve.
- skip
-
number
The number of policy evaluation records to ignore. For example, to retrieve results 101-150, set top to 50 and skip to 100.
Returns
Promise<PolicyEvaluationRecord[]>
getPolicyType(string, string)
Retrieve a specific policy type by ID.
function getPolicyType(project: string, typeId: string): Promise<PolicyType>
Parameters
- project
-
string
Project ID or project name
- typeId
-
string
The policy ID.
Returns
Promise<PolicyType>
getPolicyTypes(string)
Retrieve all available policy types.
function getPolicyTypes(project: string): Promise<PolicyType[]>
Parameters
- project
-
string
Project ID or project name
Returns
Promise<PolicyType[]>
requeuePolicyEvaluation(string, string)
Requeue the policy evaluation.
function requeuePolicyEvaluation(project: string, evaluationId: string): Promise<PolicyEvaluationRecord>
Parameters
- project
-
string
Project ID or project name
- evaluationId
-
string
ID of the policy evaluation to be retrieved.
Returns
Promise<PolicyEvaluationRecord>
updatePolicyConfiguration(PolicyConfiguration, string, number)
Update a policy configuration by its ID.
function updatePolicyConfiguration(configuration: PolicyConfiguration, project: string, configurationId: number): Promise<PolicyConfiguration>
Parameters
- configuration
- PolicyConfiguration
The policy configuration to update.
- project
-
string
Project ID or project name
- configurationId
-
number
ID of the existing policy configuration to be updated.
Returns
Promise<PolicyConfiguration>