A Policy Experiment is a nested resource used to preview changes to a live policy without affecting live traffic. Experiments are stored as a collection under a parent Policy resource.
Resource Naming Convention:
- Live Policy:
projects/{project}/locations/{location}/policies/{policy} - Experiment:
projects/{project}/locations/{location}/policies/{policy}/experiments/{experiment} - Experiment Resource Type: Must follow the pattern
*RegularResourceType*Experiment (e.g., FirewallPolicyExperiment).
Workflow:
- Create an Experiment: Define the intended new state in the
policy field of the experiment. - Start Preview: Use the
startPreview method to begin generating logs for evaluation. - Evaluate: Inspect logs using the system-generated
log_prefix to compare experiment behavior against the live policy. - Promote (Commit): Use the
commit method (or manually copy the policy and delete the experiment) to apply the changes to the live policy.
message PolicyExperiment {
// google.api.resource, name, and other annotations and fields
// The policy experiment. This Policy will be used to preview the effects of
// the change but will not affect live traffic.
Policy policy = 2;
// The metadata associated with this policy experiment.
PolicyPreviewMetadata preview_metadata = 3
[(google.api.field_behavior) = OUTPUT_ONLY];
// Allows clients to store small amounts of arbitrary data.
map<string, string> annotations = 4;
}