@@ -34,7 +34,7 @@ The expected flow for previewing a policy is as follows:
3434
35351 . The user creates an experiment containing a new policy configuration
3636 intended to replace the live policy.
37- 2 . The user uses the "preview " method to start generating logs which compare
37+ 2 . The user uses the "startPreview " method to start generating logs which compare
3838 the live and experiment policy evaluations against live traffic.
39393 . The user inspects the logs to determine whether the experiment has the
4040 intended result.
@@ -86,6 +86,9 @@ message PolicyExperiment {
8686 // The metadata associated with this policy experiment.
8787 PolicyPreviewMetadata preview_metadata = 3
8888 [(google.api.field_behavior) = OUTPUT_ONLY];
89+
90+ // Allows clients to store small amounts of arbitrary data.
91+ map<string, string> annotations = 4;
8992}
9093```
9194
@@ -108,6 +111,8 @@ message PolicyExperiment {
108111 capped at a certain number and the cap ** must** be documented.
109112- Cascading deletes ** must** occur: if the live policy is deleted, all
110113 experiments ** must** also be deleted.
114+ - ` map<string,string> ` [ annotations] [ aip-128-annotations ] ** must** allow clients
115+ to store small amounts of arbitrary data.
111116
112117### Metadata
113118
@@ -118,9 +123,20 @@ same service with experiments.
118123
119124``` proto
120125message PolicyPreviewMetadata {
121- // The state of previewing the experiment. The possible values are ACTIVE
122- // and INACTIVE. ACTIVE indicates that results are being logged upstream.
123- string state = 1;
126+ // Possible values of the state of previewing the experiment.
127+ enum State {
128+ // Default value. This value is unused.
129+ STATE_UNDEFINED = 0;
130+
131+ // The experiment is actively previewing.
132+ ACTIVE = 1;
133+
134+ // The previewing of the experiment has been stopped.
135+ SUSPENDED = 2;
136+ }
137+
138+ // The state of previewing the experiment.
139+ State state = 1;
124140
125141 // An identifying string common to all logs generated when previewing the
126142 // experiment. Searching all logs for this string will isolate the results.
@@ -135,27 +151,27 @@ message PolicyPreviewMetadata {
135151```
136152
137153- ` PolicyPreviewMetadata ` ** must** have the fields defined in the proto above.
138- - ` state ` ** must** be ` ACTIVE ` or ` INACTIVE ` .
139154 - It ** may** have additional fields if the service or resource requires it.
140155- When an experiment is first previewed, ` preview_metadata ` ** must** be
141156 absent.
142- - It is present on the experiment once the "preview " method is used.
157+ - It is present on the experiment once the "startPreview " method is used.
143158- All ` preview_metadata ` fields ** must** be output only.
144- - ` state ` changes to and from ` ACTIVE ` and ` INACTIVE ` when the experiment is
145- started or stopped, which can only be done by the "preview" and "stop" custom
146- methods .
147- - The first time the "preview " custom method is used, the system ** must** create
148- ` preview_metadata ` and do the following:
159+ - ` state ` changes between ` ACTIVE ` and ` SUSPENDED ` when previewing is started
160+ or stopped. This happens when the "startPreview" or "stopPreview custom methods
161+ are invoked, respectively .
162+ - The first time the "startPreview " custom method is used, the system ** must**
163+ create ` preview_metadata ` and do the following:
149164 - It ** must** set the ` state ` to ` ACTIVE `
150165 - It ** must** populate ` start_time ` with the current time.
151- - ` start_time ` ** must** be updated every time the status is changed to
166+ - ` start_time ` ** must** be updated every time ` state ` is changed to
152167 ` ACTIVE ` .
153168 - It ** must** set a system generated ` log_prefix ` string, which is a
154169 predefined constant hard coded by the system developers.
155170 - The same value is used for previewing experiments for the given resource
156171 type. For example, "FirewallPolicyPreviewLog" for FirewallPolicy.
157- - When the "stop" custom method is used, the system ** must** do the following:
158- - It ** must** set the ` state ` to ` INACTIVE `
172+ - When the "stopPreview" custom method is used, the system ** must** do the
173+ following:
174+ - It ** must** set the ` state ` to ` SUSPENDED `
159175 - It ** must** populate the ` stop_time ` with the current time.
160176
161177### Methods
@@ -196,8 +212,8 @@ cases:
196212 order to change the experiment being previewed because this ` policy ` is
197213 intended to replace the live policy, and the name of the live policy
198214 ** must not** change.
199- - The system ** must** set the ` state ` to INACTIVE if the ` state ` was ACTIVE at
200- the time of an update.
215+ - The system ** must** set the ` state ` to ` SUSPENDED ` if the ` state ` was ` ACTIVE `
216+ at the time of an update.
201217 - This is so the user can easily distinguish between different versions of
202218 the experiment being previewed.
203219
@@ -221,25 +237,25 @@ cases:
221237 ` google.longrunning.operation_info.response_type ` ** must** be
222238 ` PolicyExperiment ` .
223239
224- #### preview
240+ #### startPreview
225241
226242``` proto
227243// Starts previewing a PolicyExperiment. This triggers the system to start
228244// generating logs to evaluate the PolicyExperiment.
229- rpc PreviewPolicyExperiment(PreviewPolicyExperimentRequest )
245+ rpc StartPreviewPolicyExperiment(StartPreviewPolicyExperimentRequest )
230246 returns (google.longrunning.Operation) {
231247 option (google.api.http) = {
232- post: "/v1/{name=policies/*/experiments/*}:preview "
248+ post: "/v1/{name=policies/*/experiments/*}:startPreview "
233249 body: "*"
234250 };
235251 option (google.longrunning.operation_info) = {
236252 response_type: "PolicyExperiment"
237- metadata_type: "PreviewPolicyExperimentMetadata "
253+ metadata_type: "StartPreviewPolicyExperimentMetadata "
238254 };
239255}
240256
241- // The request message for the preview custom method.
242- message PreviewPolicyExperimentRequest {
257+ // The request message for the startPreview custom method.
258+ message StartPreviewPolicyExperimentRequest {
243259 // The name of the PolicyExperiment.
244260 string name = 1;
245261}
@@ -258,25 +274,25 @@ message PreviewPolicyExperimentRequest {
258274- If the method is called on an experiment with the rules representing a no-op,
259275 then the system ** must** preview the deletion of the live policy.
260276
261- #### stop
277+ #### stopPreview
262278
263279``` proto
264280// Stops previewing a PolicyExperiment. This triggers the system to stop
265281// generating logs to evaluate the PolicyExperiment.
266- rpc StopPolicyExperiment(StopPolicyExperimentRequest )
282+ rpc StopPreviewPolicyExperiment(StopPreviewPolicyExperimentRequest )
267283 returns (google.longrunning.Operation) {
268284 option (google.api.http) = {
269- post: "/v1/{name=policies/*/experiments/*}:stop "
285+ post: "/v1/{name=policies/*/experiments/*}:stopPreview "
270286 body: "*"
271287 };
272288 option (google.longrunning.operation_info) = {
273289 response_type: "PolicyExperiment"
274- metadata_type: "StopPolicyExperimentMetadata "
290+ metadata_type: "StopPreviewPolicyExperimentMetadata "
275291 };
276292}
277293
278- // The request message for the stop custom method.
279- message StopPolicyExperimentRequest {
294+ // The request message for the stopPreview custom method.
295+ message StopPreviewPolicyExperimentRequest {
280296 // The name of the PolicyExperiment.
281297 string name = 1;
282298}
@@ -290,7 +306,7 @@ message StopPolicyExperimentRequest {
290306- Whenever the method is called successfully, the system ** must** set the
291307 following values in the ` PolicyPreviewMetadata ` :
292308 - ` stop_time ` to the current time
293- - ` state ` to ` INACTIVE `
309+ - ` state ` to ` SUSPENDED `
294310
295311#### commit
296312
@@ -371,8 +387,11 @@ experiment to live.
371387
372388## Changelog
373389
390+ - ** 2023-04-27:** Methods for start and stop renamed. State to enum. Annotations
391+ added.
374392- ** 2023-03-30:** Initial AIP written.
375393
394+ [ aip-128-annotations ] : https://aip.dev/128#annotations
376395[ aip-131 ] : https://aip.dev/131
377396[ aip-132 ] : https://aip.dev/132
378397[ aip-133-long-running ] : https://aip.dev/133#long-running-create
0 commit comments