UNPKG

7.22 kBTypeScriptView Raw
1import basem = require('./ClientApiBases');
2import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
3import PolicyInterfaces = require("./interfaces/PolicyInterfaces");
4import VSSInterfaces = require("./interfaces/common/VSSInterfaces");
5export interface IPolicyApi extends basem.ClientApiBase {
6 createPolicyConfiguration(configuration: PolicyInterfaces.PolicyConfiguration, project: string): Promise<PolicyInterfaces.PolicyConfiguration>;
7 deletePolicyConfiguration(project: string, configurationId: number): Promise<void>;
8 getPolicyConfiguration(project: string, configurationId: number): Promise<PolicyInterfaces.PolicyConfiguration>;
9 getPolicyConfigurations(project: string, scope?: string, policyType?: string): Promise<VSSInterfaces.PagedList<PolicyInterfaces.PolicyConfiguration>>;
10 updatePolicyConfiguration(configuration: PolicyInterfaces.PolicyConfiguration, project: string, configurationId: number): Promise<PolicyInterfaces.PolicyConfiguration>;
11 getPolicyEvaluation(project: string, evaluationId: string): Promise<PolicyInterfaces.PolicyEvaluationRecord>;
12 requeuePolicyEvaluation(project: string, evaluationId: string): Promise<PolicyInterfaces.PolicyEvaluationRecord>;
13 getPolicyEvaluations(project: string, artifactId: string, includeNotApplicable?: boolean, top?: number, skip?: number): Promise<PolicyInterfaces.PolicyEvaluationRecord[]>;
14 getPolicyConfigurationRevision(project: string, configurationId: number, revisionId: number): Promise<PolicyInterfaces.PolicyConfiguration>;
15 getPolicyConfigurationRevisions(project: string, configurationId: number, top?: number, skip?: number): Promise<PolicyInterfaces.PolicyConfiguration[]>;
16 getPolicyType(project: string, typeId: string): Promise<PolicyInterfaces.PolicyType>;
17 getPolicyTypes(project: string): Promise<PolicyInterfaces.PolicyType[]>;
18}
19export declare class PolicyApi extends basem.ClientApiBase implements IPolicyApi {
20 constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[], options?: VsoBaseInterfaces.IRequestOptions);
21 static readonly RESOURCE_AREA_ID = "fb13a388-40dd-4a04-b530-013a739c72ef";
22 /**
23 * Create a policy configuration of a given policy type.
24 *
25 * @param {PolicyInterfaces.PolicyConfiguration} configuration - The policy configuration to create.
26 * @param {string} project - Project ID or project name
27 */
28 createPolicyConfiguration(configuration: PolicyInterfaces.PolicyConfiguration, project: string): Promise<PolicyInterfaces.PolicyConfiguration>;
29 /**
30 * Delete a policy configuration by its ID.
31 *
32 * @param {string} project - Project ID or project name
33 * @param {number} configurationId - ID of the policy configuration to delete.
34 */
35 deletePolicyConfiguration(project: string, configurationId: number): Promise<void>;
36 /**
37 * Get a policy configuration by its ID.
38 *
39 * @param {string} project - Project ID or project name
40 * @param {number} configurationId - ID of the policy configuration
41 */
42 getPolicyConfiguration(project: string, configurationId: number): Promise<PolicyInterfaces.PolicyConfiguration>;
43 /**
44 * Get a list of policy configurations in a project.
45 *
46 * @param {string} project - Project ID or project name
47 * @param {string} scope - [Provided for legacy reasons] The scope on which a subset of policies is defined.
48 * @param {string} policyType - Filter returned policies to only this type
49 */
50 getPolicyConfigurations(project: string, scope?: string, policyType?: string): Promise<VSSInterfaces.PagedList<PolicyInterfaces.PolicyConfiguration>>;
51 /**
52 * Update a policy configuration by its ID.
53 *
54 * @param {PolicyInterfaces.PolicyConfiguration} configuration - The policy configuration to update.
55 * @param {string} project - Project ID or project name
56 * @param {number} configurationId - ID of the existing policy configuration to be updated.
57 */
58 updatePolicyConfiguration(configuration: PolicyInterfaces.PolicyConfiguration, project: string, configurationId: number): Promise<PolicyInterfaces.PolicyConfiguration>;
59 /**
60 * Gets the present evaluation state of a policy.
61 *
62 * @param {string} project - Project ID or project name
63 * @param {string} evaluationId - ID of the policy evaluation to be retrieved.
64 */
65 getPolicyEvaluation(project: string, evaluationId: string): Promise<PolicyInterfaces.PolicyEvaluationRecord>;
66 /**
67 * Requeue the policy evaluation.
68 *
69 * @param {string} project - Project ID or project name
70 * @param {string} evaluationId - ID of the policy evaluation to be retrieved.
71 */
72 requeuePolicyEvaluation(project: string, evaluationId: string): Promise<PolicyInterfaces.PolicyEvaluationRecord>;
73 /**
74 * Retrieves a list of all the policy evaluation statuses for a specific pull request.
75 *
76 * @param {string} project - Project ID or project name
77 * @param {string} artifactId - A string which uniquely identifies the target of a policy evaluation.
78 * @param {boolean} includeNotApplicable - 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.
79 * @param {number} top - The number of policy evaluation records to retrieve.
80 * @param {number} skip - The number of policy evaluation records to ignore. For example, to retrieve results 101-150, set top to 50 and skip to 100.
81 */
82 getPolicyEvaluations(project: string, artifactId: string, includeNotApplicable?: boolean, top?: number, skip?: number): Promise<PolicyInterfaces.PolicyEvaluationRecord[]>;
83 /**
84 * Retrieve a specific revision of a given policy by ID.
85 *
86 * @param {string} project - Project ID or project name
87 * @param {number} configurationId - The policy configuration ID.
88 * @param {number} revisionId - The revision ID.
89 */
90 getPolicyConfigurationRevision(project: string, configurationId: number, revisionId: number): Promise<PolicyInterfaces.PolicyConfiguration>;
91 /**
92 * Retrieve all revisions for a given policy.
93 *
94 * @param {string} project - Project ID or project name
95 * @param {number} configurationId - The policy configuration ID.
96 * @param {number} top - The number of revisions to retrieve.
97 * @param {number} skip - The number of revisions to ignore. For example, to retrieve results 101-150, set top to 50 and skip to 100.
98 */
99 getPolicyConfigurationRevisions(project: string, configurationId: number, top?: number, skip?: number): Promise<PolicyInterfaces.PolicyConfiguration[]>;
100 /**
101 * Retrieve a specific policy type by ID.
102 *
103 * @param {string} project - Project ID or project name
104 * @param {string} typeId - The policy ID.
105 */
106 getPolicyType(project: string, typeId: string): Promise<PolicyInterfaces.PolicyType>;
107 /**
108 * Retrieve all available policy types.
109 *
110 * @param {string} project - Project ID or project name
111 */
112 getPolicyTypes(project: string): Promise<PolicyInterfaces.PolicyType[]>;
113}