Types for Google Cloud Orgpolicy v2 API¶
- class google.cloud.orgpolicy_v2.types.AlternatePolicySpec(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]¶
Bases:
proto.message.Message
Similar to PolicySpec but with an extra ‘launch’ field for launch reference. The PolicySpec here is specific for dry- run/darklaunch.
- launch¶
Reference to the launch that will be used while audit logging and to control the launch. Should be set only in the alternate policy.
- Type
str
- spec¶
Specify
Constraint
for configurations of Cloud Platform resources.
- class google.cloud.orgpolicy_v2.types.Constraint(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]¶
Bases:
proto.message.Message
A
constraint
describes a way to restrict resource’s configuration. For example, you could enforce a constraint that controls which cloud services can be activated across an organization, or whether a Compute Engine instance can have serial port connections established.Constraints
can be configured by the organization’s policy adminstrator to fit the needs of the organzation by setting apolicy
that includesconstraints
at different locations in the organization’s resource hierarchy. Policies are inherited down the resource hierarchy from higher levels, but can also be overridden. For details about the inheritance rules please read about [policies
][google.cloud.OrgPolicy.v2.Policy].Constraints
have a default behavior determined by theconstraint_default
field, which is the enforcement behavior that is used in the absence of apolicy
being defined or inherited for the resource in question.- name¶
Immutable. The resource name of the Constraint. Must be in one of the following forms:
projects/{project_number}/constraints/{constraint_name}
folders/{folder_id}/constraints/{constraint_name}
organizations/{organization_id}/constraints/{constraint_name}
For example, “/projects/123/constraints/compute.disableSerialPortAccess”.
- Type
str
- display_name¶
The human readable name. Mutable.
- Type
str
- description¶
Detailed description of what this
Constraint
controls as well as how and where it is enforced.Mutable.
- Type
str
- constraint_default¶
The evaluation behavior of this constraint in the absence of ‘Policy’.
- list_constraint¶
Defines this constraint as being a ListConstraint.
- boolean_constraint¶
Defines this constraint as being a BooleanConstraint.
- class BooleanConstraint(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]¶
Bases:
proto.message.Message
A
Constraint
that is either enforced or not.For example a constraint
constraints/compute.disableSerialPortAccess
. If it is enforced on a VM instance, serial port connections will not be opened to that instance.
- class ConstraintDefault(value)[source]¶
Bases:
proto.enums.Enum
Specifies the default behavior in the absence of any
Policy
for theConstraint
. This must not beCONSTRAINT_DEFAULT_UNSPECIFIED
.Immutable after creation.
- ALLOW = 1¶
- CONSTRAINT_DEFAULT_UNSPECIFIED = 0¶
- DENY = 2¶
- class ListConstraint(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]¶
Bases:
proto.message.Message
A
Constraint
that allows or disallows a list of string values, which are configured by an Organization’s policy administrator with aPolicy
.- supports_in¶
Indicates whether values grouped into categories can be used in
Policy.allowed_values
andPolicy.denied_values
. For example,"in:Python"
would match any value in the ‘Python’ group.- Type
bool
- supports_under¶
Indicates whether subtrees of Cloud Resource Manager resource hierarchy can be used in
Policy.allowed_values
andPolicy.denied_values
. For example,"under:folders/123"
would match any resource under the ‘folders/123’ folder.- Type
bool
- class google.cloud.orgpolicy_v2.types.CreatePolicyRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]¶
Bases:
proto.message.Message
The request sent to the [CreatePolicyRequest] [google.cloud.orgpolicy.v2.OrgPolicy.CreatePolicy] method.
- parent¶
Required. The Cloud resource that will parent the new Policy. Must be in one of the following forms:
projects/{project_number}
projects/{project_id}
folders/{folder_id}
organizations/{organization_id}
- Type
str
- policy¶
Required.
Policy
to create.
- class google.cloud.orgpolicy_v2.types.DeletePolicyRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]¶
Bases:
proto.message.Message
The request sent to the [DeletePolicy] [google.cloud.orgpolicy.v2.OrgPolicy.DeletePolicy] method.
- name¶
Required. Name of the policy to delete. See
Policy
for naming rules.- Type
str
- class google.cloud.orgpolicy_v2.types.GetEffectivePolicyRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]¶
Bases:
proto.message.Message
The request sent to the [GetEffectivePolicy] [google.cloud.orgpolicy.v2.OrgPolicy.GetEffectivePolicy] method.
- name¶
Required. The effective policy to compute. See
Policy
for naming rules.- Type
str
- class google.cloud.orgpolicy_v2.types.GetPolicyRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]¶
Bases:
proto.message.Message
The request sent to the [GetPolicy] [google.cloud.orgpolicy.v2.OrgPolicy.GetPolicy] method.
- name¶
Required. Resource name of the policy. See
Policy
for naming requirements.- Type
str
- class google.cloud.orgpolicy_v2.types.ListConstraintsRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]¶
Bases:
proto.message.Message
The request sent to the [ListConstraints] [google.cloud.orgpolicy.v2.OrgPolicy.ListConstraints] method.
- parent¶
Required. The Cloud resource that parents the constraint. Must be in one of the following forms:
projects/{project_number}
projects/{project_id}
folders/{folder_id}
organizations/{organization_id}
- Type
str
- page_size¶
Size of the pages to be returned. This is currently unsupported and will be ignored. The server may at any point start using this field to limit page size.
- Type
int
- page_token¶
Page token used to retrieve the next page. This is currently unsupported and will be ignored. The server may at any point start using this field.
- Type
str
- class google.cloud.orgpolicy_v2.types.ListConstraintsResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]¶
Bases:
proto.message.Message
The response returned from the [ListConstraints] [google.cloud.orgpolicy.v2.OrgPolicy.ListConstraints] method.
- constraints¶
The collection of constraints that are available on the targeted resource.
- Type
- next_page_token¶
Page token used to retrieve the next page. This is currently not used.
- Type
str
- property raw_page¶
- class google.cloud.orgpolicy_v2.types.ListPoliciesRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]¶
Bases:
proto.message.Message
The request sent to the [ListPolicies] [google.cloud.orgpolicy.v2.OrgPolicy.ListPolicies] method.
- parent¶
Required. The target Cloud resource that parents the set of constraints and policies that will be returned from this call. Must be in one of the following forms:
projects/{project_number}
projects/{project_id}
folders/{folder_id}
organizations/{organization_id}
- Type
str
- page_size¶
Size of the pages to be returned. This is currently unsupported and will be ignored. The server may at any point start using this field to limit page size.
- Type
int
- page_token¶
Page token used to retrieve the next page. This is currently unsupported and will be ignored. The server may at any point start using this field.
- Type
str
- class google.cloud.orgpolicy_v2.types.ListPoliciesResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]¶
Bases:
proto.message.Message
The response returned from the [ListPolicies] [google.cloud.orgpolicy.v2.OrgPolicy.ListPolicies] method. It will be empty if no
Policies
are set on the resource.- policies¶
All
Policies
that exist on the resource. It will be empty if noPolicies
are set.- Type
Sequence[google.cloud.orgpolicy_v2.types.Policy]
- next_page_token¶
Page token used to retrieve the next page. This is currently not used, but the server may at any point start supplying a valid token.
- Type
str
- property raw_page¶
- class google.cloud.orgpolicy_v2.types.Policy(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]¶
Bases:
proto.message.Message
Defines a Cloud Organization
Policy
which is used to specifyConstraints
for configurations of Cloud Platform resources.- name¶
Immutable. The resource name of the Policy. Must be one of the following forms, where constraint_name is the name of the constraint which this Policy configures:
projects/{project_number}/policies/{constraint_name}
folders/{folder_id}/policies/{constraint_name}
organizations/{organization_id}/policies/{constraint_name}
For example, “projects/123/policies/compute.disableSerialPortAccess”.
Note:
projects/{project_id}/policies/{constraint_name}
is also an acceptable name for API requests, but responses will return the name using the equivalent project number.- Type
str
- spec¶
Basic information about the Organization Policy.
- alternate¶
An alternate policy configuration that will be used instead of the baseline policy configurations as determined by the launch. Currently the only way the launch can trigger the alternate configuration is via dry- run/darklaunch.
- class google.cloud.orgpolicy_v2.types.PolicySpec(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]¶
Bases:
proto.message.Message
Defines a Cloud Organization
PolicySpec
which is used to specifyConstraints
for configurations of Cloud Platform resources.- etag¶
An opaque tag indicating the current version of the
Policy
, used for concurrency control.This field is ignored if used in a
CreatePolicy
request.When the
Policy
is returned from either aGetPolicy
or aListPolicies
request, thisetag
indicates the version of the currentPolicy
to use when executing a read-modify-write loop.When the
Policy
is returned from aGetEffectivePolicy
request, theetag
will be unset.- Type
str
- update_time¶
Output only. The time stamp this was previously updated. This represents the last time a call to
CreatePolicy
orUpdatePolicy
was made for thatPolicy
.- Type
google.protobuf.timestamp_pb2.Timestamp
- rules¶
Up to 10 PolicyRules are allowed.
In Policies for boolean constraints, the following requirements apply:
There must be one and only one PolicyRule where condition is unset.
BooleanPolicyRules with conditions must set
enforced
to the opposite of the PolicyRule without a condition.During policy evaluation, PolicyRules with conditions that are true for a target resource take precedence.
- Type
Sequence[google.cloud.orgpolicy_v2.types.PolicySpec.PolicyRule]
- inherit_from_parent¶
Determines the inheritance behavior for this
Policy
.If
inherit_from_parent
is true, PolicyRules set higher up in the hierarchy (up to the closest root) are inherited and present in the effective policy. If it is false, then no rules are inherited, and this Policy becomes the new root for evaluation. This field can be set only for Policies which configure list constraints.- Type
bool
- reset¶
Ignores policies set above this resource and restores the
constraint_default
enforcement behavior of the specificConstraint
at this resource. This field can be set in policies for either list or boolean constraints. If set,rules
must be empty andinherit_from_parent
must be set to false.- Type
bool
- class PolicyRule(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]¶
Bases:
proto.message.Message
A rule used to express this policy. .. attribute:: values
List of values to be used for this PolicyRule. This field can be set only in Policies for list constraints.
- type
google.cloud.orgpolicy_v2.types.PolicySpec.PolicyRule.StringValues
- allow_all¶
Setting this to true means that all values are allowed. This field can be set only in Policies for list constraints.
- Type
bool
- deny_all¶
Setting this to true means that all values are denied. This field can be set only in Policies for list constraints.
- Type
bool
- enforce¶
If
true
, then thePolicy
is enforced. Iffalse
, then any configuration is acceptable. This field can be set only in Policies for boolean constraints.- Type
bool
- condition¶
A condition which determines whether this rule is used in the evaluation of the policy. When set, the
expression
field in the `Expr’ must include from 1 to 10 subexpressions, joined by the “||” or “&&” operators. Each subexpression must be of the form “resource.matchLabels(key_name, value_name)”, where key_name and value_name are the resource names for Label Keys and Values. These names are available from the Label Manager Service. An example expression is: “resource.matchLabels(‘labelKeys/123, ‘labelValues/456’)”.- Type
google.type.expr_pb2.Expr
- class StringValues(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]¶
Bases:
proto.message.Message
A message that holds specific allowed and denied values. This message can define specific values and subtrees of Cloud Resource Manager resource hierarchy (
Organizations
,Folders
,Projects
) that are allowed or denied. This is achieved by using theunder:
and optionalis:
prefixes. Theunder:
prefix is used to denote resource subtree values. Theis:
prefix is used to denote specific values, and is required only if the value contains a “:”. Values prefixed with “is:” are treated the same as values with no prefix. Ancestry subtrees must be in one of the following formats: - “projects/”, e.g. “projects/tokyo-rain-123” - “folders/”, e.g. “folders/1234” - “organizations/”, e.g. “organizations/1234” Thesupports_under
field of the associatedConstraint
defines whether ancestry prefixes can be used.- allowed_values¶
List of values allowed at this resource.
- Type
Sequence[str]
- denied_values¶
List of values denied at this resource.
- Type
Sequence[str]