UNPKG

4.4 kBTypeScriptView Raw
1import VSSInterfaces = require("../interfaces/common/VSSInterfaces");
2/**
3 * The full policy configuration with settings.
4 */
5export interface PolicyConfiguration extends VersionedPolicyConfigurationRef {
6 /**
7 * The links to other objects related to this object.
8 */
9 _links?: any;
10 /**
11 * A reference to the identity that created the policy.
12 */
13 createdBy?: VSSInterfaces.IdentityRef;
14 /**
15 * The date and time when the policy was created.
16 */
17 createdDate?: Date;
18 /**
19 * Indicates whether the policy is blocking.
20 */
21 isBlocking: boolean;
22 /**
23 * Indicates whether the policy has been (soft) deleted.
24 */
25 isDeleted?: boolean;
26 /**
27 * Indicates whether the policy is enabled.
28 */
29 isEnabled: boolean;
30 /**
31 * If set, this policy requires "Manage Enterprise Policies" permission to create, edit, or delete.
32 */
33 isEnterpriseManaged?: boolean;
34 /**
35 * The policy configuration settings.
36 */
37 settings: any;
38}
39/**
40 * Policy configuration reference.
41 */
42export interface PolicyConfigurationRef {
43 /**
44 * The policy configuration ID.
45 */
46 id?: number;
47 /**
48 * The policy configuration type.
49 */
50 type?: PolicyTypeRef;
51 /**
52 * The URL where the policy configuration can be retrieved.
53 */
54 url?: string;
55}
56/**
57 * 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.
58 */
59export interface PolicyEvaluationRecord {
60 /**
61 * Links to other related objects
62 */
63 _links?: any;
64 /**
65 * A string which uniquely identifies the target of a policy evaluation.
66 */
67 artifactId?: string;
68 /**
69 * Time when this policy finished evaluating on this pull request.
70 */
71 completedDate?: Date;
72 /**
73 * Contains all configuration data for the policy which is being evaluated.
74 */
75 configuration?: PolicyConfiguration;
76 /**
77 * Internal context data of this policy evaluation.
78 */
79 context?: any;
80 /**
81 * Guid which uniquely identifies this evaluation record (one policy running on one pull request).
82 */
83 evaluationId?: string;
84 /**
85 * Time when this policy was first evaluated on this pull request.
86 */
87 startedDate?: Date;
88 /**
89 * Status of the policy (Running, Approved, Failed, etc.)
90 */
91 status?: PolicyEvaluationStatus;
92}
93/**
94 * Status of a policy which is running against a specific pull request.
95 */
96export declare enum PolicyEvaluationStatus {
97 /**
98 * The policy is either queued to run, or is waiting for some event before progressing.
99 */
100 Queued = 0,
101 /**
102 * The policy is currently running.
103 */
104 Running = 1,
105 /**
106 * The policy has been fulfilled for this pull request.
107 */
108 Approved = 2,
109 /**
110 * The policy has rejected this pull request.
111 */
112 Rejected = 3,
113 /**
114 * The policy does not apply to this pull request.
115 */
116 NotApplicable = 4,
117 /**
118 * The policy has encountered an unexpected error.
119 */
120 Broken = 5
121}
122/**
123 * User-friendly policy type with description (used for querying policy types).
124 */
125export interface PolicyType extends PolicyTypeRef {
126 /**
127 * The links to other objects related to this object.
128 */
129 _links?: any;
130 /**
131 * Detailed description of the policy type.
132 */
133 description?: string;
134}
135/**
136 * Policy type reference.
137 */
138export interface PolicyTypeRef {
139 /**
140 * Display name of the policy type.
141 */
142 displayName?: string;
143 /**
144 * The policy type ID.
145 */
146 id: string;
147 /**
148 * The URL where the policy type can be retrieved.
149 */
150 url?: string;
151}
152/**
153 * A particular revision for a policy configuration.
154 */
155export interface VersionedPolicyConfigurationRef extends PolicyConfigurationRef {
156 /**
157 * The policy configuration revision ID.
158 */
159 revision?: number;
160}
161export declare var TypeInfo: {
162 PolicyConfiguration: any;
163 PolicyEvaluationRecord: any;
164 PolicyEvaluationStatus: {
165 enumValues: {
166 queued: number;
167 running: number;
168 approved: number;
169 rejected: number;
170 notApplicable: number;
171 broken: number;
172 };
173 };
174};