# Package Classes (1.18.0)

1.18.0 (latest) 1.17.0 1.16.1 1.15.0 1.14.0 1.13.0 1.12.0 1.11.1 1.10.0 1.9.0 1.8.3 1.7.1 1.6.0 1.5.0 1.4.1 1.3.3 1.2.1 1.1.0 1.0.2 0.3.0 0.2.0 0.1.2 Summary of entries of Classes for orgpolicy.

## Classes

### [OrgPolicyAsyncClient](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.services.org_policy.OrgPolicyAsyncClient)

An interface for managing organization policies.

The Organization Policy Service provides a simple mechanism for
organizations to restrict the allowed configurations across
their entire resource hierarchy.

You can use a policy to configure restrictions on resources. For
example, you can enforce a policy that restricts which Google
Cloud APIs can be activated in a certain part of your resource
hierarchy, or prevents serial port access to VM instances in a
particular folder.

Policies are inherited down through the resource hierarchy. A
policy applied to a parent resource automatically applies to all
its child resources unless overridden with a policy lower in the
hierarchy.

A constraint defines an aspect of a resource's configuration
that can be controlled by an organization's policy
administrator. Policies are a collection of constraints that
defines their allowable configuration on a particular resource
and its child resources.

### [OrgPolicyClient](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.services.org_policy.OrgPolicyClient)

An interface for managing organization policies.

The Organization Policy Service provides a simple mechanism for
organizations to restrict the allowed configurations across
their entire resource hierarchy.

You can use a policy to configure restrictions on resources. For
example, you can enforce a policy that restricts which Google
Cloud APIs can be activated in a certain part of your resource
hierarchy, or prevents serial port access to VM instances in a
particular folder.

Policies are inherited down through the resource hierarchy. A
policy applied to a parent resource automatically applies to all
its child resources unless overridden with a policy lower in the
hierarchy.

A constraint defines an aspect of a resource's configuration
that can be controlled by an organization's policy
administrator. Policies are a collection of constraints that
defines their allowable configuration on a particular resource
and its child resources.

### [ListConstraintsAsyncPager](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.services.org_policy.pagers.ListConstraintsAsyncPager)

A pager for iterating through `list_constraints` requests.

This class thinly wraps an initial
[ListConstraintsResponse](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.ListConstraintsResponse) object, and
provides an `__aiter__` method to iterate through its
`constraints` field.

If there are more pages, the `__aiter__` method will make additional
`ListConstraints` requests and continue to iterate
through the `constraints` field on the
corresponding responses.

All the usual [ListConstraintsResponse](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.ListConstraintsResponse)
attributes are available on the pager. If multiple requests are made, only
the most recent response is retained, and thus used for attribute lookup.

### [ListConstraintsPager](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.services.org_policy.pagers.ListConstraintsPager)

A pager for iterating through `list_constraints` requests.

This class thinly wraps an initial
[ListConstraintsResponse](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.ListConstraintsResponse) object, and
provides an `__iter__` method to iterate through its
`constraints` field.

If there are more pages, the `__iter__` method will make additional
`ListConstraints` requests and continue to iterate
through the `constraints` field on the
corresponding responses.

All the usual [ListConstraintsResponse](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.ListConstraintsResponse)
attributes are available on the pager. If multiple requests are made, only
the most recent response is retained, and thus used for attribute lookup.

### [ListCustomConstraintsAsyncPager](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.services.org_policy.pagers.ListCustomConstraintsAsyncPager)

A pager for iterating through `list_custom_constraints` requests.

This class thinly wraps an initial
[ListCustomConstraintsResponse](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.ListCustomConstraintsResponse) object, and
provides an `__aiter__` method to iterate through its
`custom_constraints` field.

If there are more pages, the `__aiter__` method will make additional
`ListCustomConstraints` requests and continue to iterate
through the `custom_constraints` field on the
corresponding responses.

All the usual [ListCustomConstraintsResponse](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.ListCustomConstraintsResponse)
attributes are available on the pager. If multiple requests are made, only
the most recent response is retained, and thus used for attribute lookup.

### [ListCustomConstraintsPager](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.services.org_policy.pagers.ListCustomConstraintsPager)

A pager for iterating through `list_custom_constraints` requests.

This class thinly wraps an initial
[ListCustomConstraintsResponse](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.ListCustomConstraintsResponse) object, and
provides an `__iter__` method to iterate through its
`custom_constraints` field.

If there are more pages, the `__iter__` method will make additional
`ListCustomConstraints` requests and continue to iterate
through the `custom_constraints` field on the
corresponding responses.

All the usual [ListCustomConstraintsResponse](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.ListCustomConstraintsResponse)
attributes are available on the pager. If multiple requests are made, only
the most recent response is retained, and thus used for attribute lookup.

### [ListPoliciesAsyncPager](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.services.org_policy.pagers.ListPoliciesAsyncPager)

A pager for iterating through `list_policies` requests.

This class thinly wraps an initial
[ListPoliciesResponse](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.ListPoliciesResponse) object, and
provides an `__aiter__` method to iterate through its
`policies` field.

If there are more pages, the `__aiter__` method will make additional
`ListPolicies` requests and continue to iterate
through the `policies` field on the
corresponding responses.

All the usual [ListPoliciesResponse](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.ListPoliciesResponse)
attributes are available on the pager. If multiple requests are made, only
the most recent response is retained, and thus used for attribute lookup.

### [ListPoliciesPager](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.services.org_policy.pagers.ListPoliciesPager)

A pager for iterating through `list_policies` requests.

This class thinly wraps an initial
[ListPoliciesResponse](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.ListPoliciesResponse) object, and
provides an `__iter__` method to iterate through its
`policies` field.

If there are more pages, the `__iter__` method will make additional
`ListPolicies` requests and continue to iterate
through the `policies` field on the
corresponding responses.

All the usual [ListPoliciesResponse](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.ListPoliciesResponse)
attributes are available on the pager. If multiple requests are made, only
the most recent response is retained, and thus used for attribute lookup.

### [AlternatePolicySpec](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.AlternatePolicySpec)

Similar to PolicySpec but with an extra 'launch' field for
launch reference. The PolicySpec here is specific for dry-run.

### [Constraint](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.Constraint)

A constraint describes a way to restrict resource's configuration.
For example, you could enforce a constraint that controls which
Google 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
policy administrator to fit the needs of the organization by setting
a policy that includes constraints 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, see
\[`Policy`\]\[google.cloud.orgpolicy.v2.Policy\].

Constraints have a default behavior determined by the
`constraint_default` field, which is the enforcement behavior that
is used in the absence of a policy being defined or inherited for
the resource in question.

This message has `oneof`_ fields (mutually exclusive fields).
For each oneof, at most one member field can be set at the same time.
Setting any member of the oneof automatically clears all other
members.

.. _oneof: <https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields>

### [BooleanConstraint](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.Constraint.BooleanConstraint)

A constraint type is enforced or not enforced, which is configured
in the
\[`PolicyRule`\]\[google.cloud.orgpolicy.v2.PolicySpec.PolicyRule\].

If `customConstraintDefinition` is defined, this constraint is a
managed constraint.

### [ConstraintDefault](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.Constraint.ConstraintDefault)

Specifies the default behavior in the absence of any policy for the
constraint. This must not be `CONSTRAINT_DEFAULT_UNSPECIFIED`.

Immutable after creation.

### [CustomConstraintDefinition](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.Constraint.CustomConstraintDefinition)

Custom constraint definition. Defines this as a managed
constraint.

### [ActionType](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.Constraint.CustomConstraintDefinition.ActionType)

Allow or deny type.

### [MethodType](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.Constraint.CustomConstraintDefinition.MethodType)

The operation for which this constraint will be applied. To apply
this constraint only when creating new resources, the
`method_types` should be `CREATE` only. To apply this constraint
when creating or deleting resources, the `method_types` should be
`CREATE` and `DELETE`.

`UPDATE`-only custom constraints are not supported. Use `CREATE`
or `CREATE, UPDATE`.

### [Parameter](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.Constraint.CustomConstraintDefinition.Parameter)

Defines a parameter structure.

### [Metadata](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.Constraint.CustomConstraintDefinition.Parameter.Metadata)

Defines Metadata structure.

### [Type](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.Constraint.CustomConstraintDefinition.Parameter.Type)

All valid types of parameter.

### [ParametersEntry](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.Constraint.CustomConstraintDefinition.ParametersEntry)

The abstract base class for a message.

### [ListConstraint](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.Constraint.ListConstraint)

A constraint type that allows or disallows a list of string values,
which are configured in the
\[`PolicyRule`\]\[google.cloud.orgpolicy.v2.PolicySpec.PolicyRule\].

### [CreateCustomConstraintRequest](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.CreateCustomConstraintRequest)

The request sent to the \[CreateCustomConstraintRequest\]
\[google.cloud.orgpolicy.v2.OrgPolicy.CreateCustomConstraint\] method.

### [CreatePolicyRequest](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.CreatePolicyRequest)

The request sent to the \[CreatePolicyRequest\]
\[google.cloud.orgpolicy.v2.OrgPolicy.CreatePolicy\] method.

### [CustomConstraint](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.CustomConstraint)

A custom constraint defined by customers which can *only* be applied
to the given resource types and organization.

By creating a custom constraint, customers can apply policies of
this custom constraint. *Creating a custom constraint itself does
NOT apply any policy enforcement*.

### [ActionType](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.CustomConstraint.ActionType)

Allow or deny type.

### [MethodType](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.CustomConstraint.MethodType)

The operation for which this constraint will be applied. To apply
this constraint only when creating new resources, the
`method_types` should be `CREATE` only. To apply this constraint
when creating or deleting resources, the `method_types` should be
`CREATE` and `DELETE`.

`UPDATE` only custom constraints are not supported. Use `CREATE`
or `CREATE, UPDATE`.

### [DeleteCustomConstraintRequest](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.DeleteCustomConstraintRequest)

The request sent to the \[DeleteCustomConstraint\]
\[google.cloud.orgpolicy.v2.OrgPolicy.DeleteCustomConstraint\] method.

### [DeletePolicyRequest](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.DeletePolicyRequest)

The request sent to the \[DeletePolicy\]
\[google.cloud.orgpolicy.v2.OrgPolicy.DeletePolicy\] method.

### [GetCustomConstraintRequest](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.GetCustomConstraintRequest)

The request sent to the \[GetCustomConstraint\]
\[google.cloud.orgpolicy.v2.OrgPolicy.GetCustomConstraint\] method.

### [GetEffectivePolicyRequest](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.GetEffectivePolicyRequest)

The request sent to the \[GetEffectivePolicy\]
\[google.cloud.orgpolicy.v2.OrgPolicy.GetEffectivePolicy\] method.

### [GetPolicyRequest](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.GetPolicyRequest)

The request sent to the \[GetPolicy\]
\[google.cloud.orgpolicy.v2.OrgPolicy.GetPolicy\] method.

### [ListConstraintsRequest](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.ListConstraintsRequest)

The request sent to the \[ListConstraints\]
\[google.cloud.orgpolicy.v2.OrgPolicy.ListConstraints\] method.

### [ListConstraintsResponse](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.ListConstraintsResponse)

The response returned from the \[ListConstraints\]
\[google.cloud.orgpolicy.v2.OrgPolicy.ListConstraints\] method.

### [ListCustomConstraintsRequest](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.ListCustomConstraintsRequest)

The request sent to the \[ListCustomConstraints\]
\[google.cloud.orgpolicy.v2.OrgPolicy.ListCustomConstraints\] method.

### [ListCustomConstraintsResponse](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.ListCustomConstraintsResponse)

The response returned from the \[ListCustomConstraints\]
\[google.cloud.orgpolicy.v2.OrgPolicy.ListCustomConstraints\] method.
It will be empty if no custom or managed constraints are set on the
organization resource.

### [ListPoliciesRequest](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.ListPoliciesRequest)

The request sent to the \[ListPolicies\]
\[google.cloud.orgpolicy.v2.OrgPolicy.ListPolicies\] method.

### [ListPoliciesResponse](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.ListPoliciesResponse)

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.

### [Policy](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.Policy)

Defines an organization policy which is used to specify
constraints for configurations of Google Cloud resources.

### [PolicySpec](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.PolicySpec)

Defines a Google Cloud policy specification which is used to
specify constraints for configurations of Google Cloud
resources.

### [PolicyRule](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.PolicySpec.PolicyRule)

A rule used to express this policy.

This message has `oneof`_ fields (mutually exclusive fields).
For each oneof, at most one member field can be set at the same time.
Setting any member of the oneof automatically clears all other
members.

.. _oneof: <https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields>

### [StringValues](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.PolicySpec.PolicyRule.StringValues)

A message that holds specific allowed and denied values. This
message can define specific values and subtrees of the Resource
Manager resource hierarchy (`Organizations`, `Folders`,
`Projects`) that are allowed or denied. This is achieved by using
the `under:` and optional `is:` prefixes. The `under:` prefix
is used to denote resource subtree values. The `is:` 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/<project-id>` (for example, `projects/tokyo-rain-123`)
- `folders/<folder-id>` (for example, `folders/1234`)
- `organizations/<organization-id>` (for example, `organizations/1234`)

The `supports_under` field of the associated `Constraint`
defines whether ancestry prefixes can be used.

### [UpdateCustomConstraintRequest](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.UpdateCustomConstraintRequest)

The request sent to the \[UpdateCustomConstraintRequest\]
\[google.cloud.orgpolicy.v2.OrgPolicy.UpdateCustomConstraint\] method.

### [UpdatePolicyRequest](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.types.UpdatePolicyRequest)

The request sent to the \[UpdatePolicyRequest\]
\[google.cloud.orgpolicy.v2.OrgPolicy.UpdatePolicy\] method.

## Modules

### [pagers](https://docs.cloud.google.com/python/docs/reference/orgpolicy/latest/google.cloud.orgpolicy_v2.services.org_policy.pagers)

API documentation for `orgpolicy_v2.services.org_policy.pagers` module.