@@ -18,6 +18,7 @@ package google.cloud.orgpolicy.v2;
1818
1919import "google/api/field_behavior.proto" ;
2020import "google/api/resource.proto" ;
21+ import "google/protobuf/struct.proto" ;
2122import "google/protobuf/timestamp.proto" ;
2223
2324option csharp_namespace = "Google.Cloud.OrgPolicy.V2" ;
@@ -36,8 +37,8 @@ option ruby_package = "Google::Cloud::OrgPolicy::V2";
3637// organization by setting a policy that includes constraints at different
3738// locations in the organization's resource hierarchy. Policies are inherited
3839// down the resource hierarchy from higher levels, but can also be overridden.
39- // For details about the inheritance rules please read about
40- // [`policies `][google.cloud.OrgPolicy .v2.Policy].
40+ // For details about the inheritance rules, see
41+ // [`Policy `][google.cloud.orgpolicy .v2.Policy].
4142//
4243// Constraints have a default behavior determined by the `constraint_default`
4344// field, which is the enforcement behavior that is used in the absence of a
@@ -56,7 +57,7 @@ message Constraint {
5657 // Immutable after creation.
5758 enum ConstraintDefault {
5859 // This is only used for distinguishing unset values and should never be
59- // used.
60+ // used. Results in an error.
6061 CONSTRAINT_DEFAULT_UNSPECIFIED = 0 ;
6162
6263 // Indicate that all values are allowed for list constraints.
@@ -68,8 +69,9 @@ message Constraint {
6869 DENY = 2 ;
6970 }
7071
71- // A constraint that allows or disallows a list of string values, which are
72- // configured by an Organization Policy administrator with a policy.
72+ // A constraint type that allows or disallows a list of string values, which
73+ // are configured in the
74+ // [`PolicyRule`][google.cloud.orgpolicy.v2.PolicySpec.PolicyRule].
7375 message ListConstraint {
7476 // Indicates whether values grouped into categories can be used in
7577 // `Policy.allowed_values` and `Policy.denied_values`. For example,
@@ -83,12 +85,131 @@ message Constraint {
8385 bool supports_under = 2 ;
8486 }
8587
86- // A constraint that is either enforced or not.
88+ // Custom constraint definition. Defines this as a managed constraint.
89+ message CustomConstraintDefinition {
90+ // The operation for which this constraint will be applied. To apply this
91+ // constraint only when creating new resources, the `method_types` should be
92+ // `CREATE` only. To apply this constraint when creating or deleting
93+ // resources, the `method_types` should be `CREATE` and `DELETE`.
94+ //
95+ // `UPDATE`-only custom constraints are not supported. Use `CREATE` or
96+ // `CREATE, UPDATE`.
97+ enum MethodType {
98+ // This is only used for distinguishing unset values and should never be
99+ // used. Results in an error.
100+ METHOD_TYPE_UNSPECIFIED = 0 ;
101+
102+ // Constraint applied when creating the resource.
103+ CREATE = 1 ;
104+
105+ // Constraint applied when updating the resource.
106+ UPDATE = 2 ;
107+
108+ // Constraint applied when deleting the resource.
109+ // Not currently supported.
110+ DELETE = 3 ;
111+
112+ // Constraint applied when removing an IAM grant.
113+ REMOVE_GRANT = 4 ;
114+
115+ // Constraint applied when enforcing forced tagging.
116+ GOVERN_TAGS = 5 ;
117+ }
118+
119+ // Allow or deny type.
120+ enum ActionType {
121+ // This is only used for distinguishing unset values and should never be
122+ // used. Results in an error.
123+ ACTION_TYPE_UNSPECIFIED = 0 ;
124+
125+ // Allowed action type.
126+ ALLOW = 1 ;
127+
128+ // Deny action type.
129+ DENY = 2 ;
130+ }
131+
132+ // Defines a parameter structure.
133+ message Parameter {
134+ // All valid types of parameter.
135+ enum Type {
136+ // This is only used for distinguishing unset values and should never be
137+ // used. Results in an error.
138+ TYPE_UNSPECIFIED = 0 ;
139+
140+ // List parameter type.
141+ LIST = 1 ;
142+
143+ // String parameter type.
144+ STRING = 2 ;
145+
146+ // Boolean parameter type.
147+ BOOLEAN = 3 ;
148+ }
149+
150+ // Defines Metadata structure.
151+ message Metadata {
152+ // Detailed description of what this `parameter` is and use of it.
153+ // Mutable.
154+ string description = 1 ;
155+ }
156+
157+ // Type of the parameter.
158+ Type type = 1 ;
159+
160+ // Sets the value of the parameter in an assignment if no value is given.
161+ google.protobuf.Value default_value = 2 ;
162+
163+ // Provides a CEL expression to specify the acceptable parameter values
164+ // during assignment.
165+ // For example, parameterName in ("parameterValue1", "parameterValue2")
166+ string valid_values_expr = 3 ;
167+
168+ // Defines subproperties primarily used by the UI to display user-friendly
169+ // information.
170+ Metadata metadata = 4 ;
171+
172+ // Determines the parameter's value structure.
173+ // For example, `LIST<STRING>` can be specified by defining `type: LIST`,
174+ // and `item: STRING`.
175+ Type item = 5 ;
176+ }
177+
178+ // The resource instance type on which this policy applies. Format will be
179+ // of the form : `<service name>/<type>` Example:
180+ //
181+ // * `compute.googleapis.com/Instance`.
182+ repeated string resource_types = 1 ;
183+
184+ // All the operations being applied for this constraint.
185+ repeated MethodType method_types = 2 ;
186+
187+ // Org policy condition/expression. For example:
188+ // `resource.instanceName.matches("[production|test]_.*_(\d)+")` or,
189+ // `resource.management.auto_upgrade == true`
190+ //
191+ // The max length of the condition is 1000 characters.
192+ string condition = 3 ;
193+
194+ // Allow or deny type.
195+ ActionType action_type = 4 ;
196+
197+ // Stores the structure of
198+ // [`Parameters`][google.cloud.orgpolicy.v2.Constraint.CustomConstraintDefinition.Parameter]
199+ // used by the constraint condition. The key of `map` represents the name of
200+ // the parameter.
201+ map <string , Parameter > parameters = 5 ;
202+ }
203+
204+ // A constraint type is enforced or not enforced, which is configured in the
205+ // [`PolicyRule`][google.cloud.orgpolicy.v2.PolicySpec.PolicyRule].
87206 //
88- // For example, a constraint `constraints/compute.disableSerialPortAccess`.
89- // If it is enforced on a VM instance, serial port connections will not be
90- // opened to that instance.
91- message BooleanConstraint {}
207+ // If `customConstraintDefinition` is defined, this constraint is a managed
208+ // constraint.
209+ message BooleanConstraint {
210+ // Custom constraint definition. Defines this as a managed constraint.
211+ CustomConstraintDefinition custom_constraint_definition = 1 ;
212+ }
92213
93214 // Immutable. The resource name of the constraint. Must be in one of
94215 // the following forms:
@@ -118,15 +239,22 @@ message Constraint {
118239 //
119240 // Immutable after creation.
120241 oneof constraint_type {
121- // Defines this constraint as being a ListConstraint .
242+ // Defines this constraint as being a list constraint .
122243 ListConstraint list_constraint = 5 ;
123244
124- // Defines this constraint as being a BooleanConstraint .
245+ // Defines this constraint as being a boolean constraint .
125246 BooleanConstraint boolean_constraint = 6 ;
126247 }
127248
128249 // Shows if dry run is supported for this constraint or not.
129250 bool supports_dry_run = 7 ;
251+
252+ // Managed constraint and canned constraint sometimes can have
253+ // equivalents. This field is used to store the equivalent constraint name.
254+ string equivalent_constraint = 8 ;
255+
256+ // Shows if simulation is supported for this constraint or not.
257+ bool supports_simulation = 9 ;
130258}
131259
132260// A custom constraint defined by customers which can *only* be applied to the
@@ -142,14 +270,15 @@ message CustomConstraint {
142270 };
143271
144272 // The operation for which this constraint will be applied. To apply this
145- // constraint only when creating new VMs , the `method_types` should be
273+ // constraint only when creating new resources , the `method_types` should be
146274 // `CREATE` only. To apply this constraint when creating or deleting
147- // VMs , the `method_types` should be `CREATE` and `DELETE`.
275+ // resources , the `method_types` should be `CREATE` and `DELETE`.
148276 //
149277 // `UPDATE` only custom constraints are not supported. Use `CREATE` or
150278 // `CREATE, UPDATE`.
151279 enum MethodType {
152- // Unspecified. Results in an error.
280+ // This is only used for distinguishing unset values and should never be
281+ // used. Results in an error.
153282 METHOD_TYPE_UNSPECIFIED = 0 ;
154283
155284 // Constraint applied when creating the resource.
@@ -159,7 +288,7 @@ message CustomConstraint {
159288 UPDATE = 2 ;
160289
161290 // Constraint applied when deleting the resource.
162- // Not supported yet .
291+ // Not currently supported .
163292 DELETE = 3 ;
164293
165294 // Constraint applied when removing an IAM grant.
@@ -171,7 +300,8 @@ message CustomConstraint {
171300
172301 // Allow or deny type.
173302 enum ActionType {
174- // Unspecified. Results in an error.
303+ // This is only used for distinguishing unset values and should never be
304+ // used. Results in an error.
175305 ACTION_TYPE_UNSPECIFIED = 0 ;
176306
177307 // Allowed action type.
@@ -193,15 +323,16 @@ message CustomConstraint {
193323 string name = 1 [(google.api.field_behavior ) = IMMUTABLE ];
194324
195325 // Immutable. The resource instance type on which this policy applies. Format
196- // will be of the form : `<canonical service name>/<type>` Example:
326+ // will be of the form : `<service name>/<type>` Example:
197327 //
198328 // * `compute.googleapis.com/Instance`.
199329 repeated string resource_types = 2 [(google.api.field_behavior ) = IMMUTABLE ];
200330
201331 // All the operations being applied for this constraint.
202332 repeated MethodType method_types = 3 ;
203333
204- // Org policy condition/expression. For example:
334+ // A Common Expression Language (CEL) condition which is used in the
335+ // evaluation of the constraint. For example:
205336 // `resource.instanceName.matches("[production|test]_.*_(\d)+")` or,
206337 // `resource.management.auto_upgrade == true`
207338 //
@@ -221,7 +352,7 @@ message CustomConstraint {
221352
222353 // Output only. The last time this custom constraint was updated. This
223354 // represents the last time that the `CreateCustomConstraint` or
224- // `UpdateCustomConstraint` RPC was called
355+ // `UpdateCustomConstraint` methods were called.
225356 google.protobuf.Timestamp update_time = 8
226357 [(google.api.field_behavior ) = OUTPUT_ONLY ];
227358}
0 commit comments