models.py•13 kB
# generated by fastapi-codegen:
# filename: openapi.yaml
# timestamp: 2025-06-29T02:34:10+00:00
from __future__ import annotations
from enum import Enum
from typing import List, Optional
from pydantic import BaseModel, Field
class ConstraintDefault(Enum):
CONSTRAINT_DEFAULT_UNSPECIFIED = 'CONSTRAINT_DEFAULT_UNSPECIFIED'
ALLOW = 'ALLOW'
DENY = 'DENY'
class GoogleCloudOrgpolicyV2ConstraintBooleanConstraint(BaseModel):
pass
class GoogleCloudOrgpolicyV2ConstraintListConstraint(BaseModel):
supportsIn: Optional[bool] = Field(
None,
description='Indicates whether values grouped into categories can be used in `Policy.allowed_values` and `Policy.denied_values`. For example, `"in:Python"` would match any value in the \'Python\' group.',
)
supportsUnder: Optional[bool] = Field(
None,
description='Indicates whether subtrees of the Resource Manager resource hierarchy can be used in `Policy.allowed_values` and `Policy.denied_values`. For example, `"under:folders/123"` would match any resource under the \'folders/123\' folder.',
)
class ActionType(Enum):
ACTION_TYPE_UNSPECIFIED = 'ACTION_TYPE_UNSPECIFIED'
ALLOW = 'ALLOW'
DENY = 'DENY'
class MethodType(Enum):
METHOD_TYPE_UNSPECIFIED = 'METHOD_TYPE_UNSPECIFIED'
CREATE = 'CREATE'
UPDATE = 'UPDATE'
DELETE = 'DELETE'
class GoogleCloudOrgpolicyV2CustomConstraint(BaseModel):
actionType: Optional[ActionType] = Field(None, description='Allow or deny type.')
condition: Optional[str] = Field(
None,
description='Org policy condition/expression. For example: `resource.instanceName.matches("[production|test]_.*_(\\d)+")\'` or, `resource.management.auto_upgrade == true` The max length of the condition is 1000 characters.',
)
description: Optional[str] = Field(
None,
description='Detailed information about this custom policy constraint. The max length of the description is 2000 characters.',
)
displayName: Optional[str] = Field(
None,
description='One line display name for the UI. The max length of the display_name is 200 characters.',
)
methodTypes: Optional[List[MethodType]] = Field(
None, description='All the operations being applied for this constraint.'
)
name: Optional[str] = Field(
None,
description='Immutable. Name of the constraint. This is unique within the organization. Format of the name should be * `organizations/{organization_id}/customConstraints/{custom_constraint_id}` Example: `organizations/123/customConstraints/custom.createOnlyE2TypeVms` The max length is 70 characters and the minimum length is 1. Note that the prefix `organizations/{organization_id}/customConstraints/` is not counted.',
)
resourceTypes: Optional[List[str]] = Field(
None,
description='Immutable. The resource instance type on which this policy applies. Format will be of the form : `/` Example: * `compute.googleapis.com/Instance`.',
)
updateTime: Optional[str] = Field(
None,
description='Output only. The last time this custom constraint was updated. This represents the last time that the `CreateCustomConstraint` or `UpdateCustomConstraint` RPC was called',
)
class GoogleCloudOrgpolicyV2ListCustomConstraintsResponse(BaseModel):
customConstraints: Optional[List[GoogleCloudOrgpolicyV2CustomConstraint]] = Field(
None,
description='All custom constraints that exist on the organization resource. It will be empty if no custom constraints are set.',
)
nextPageToken: Optional[str] = Field(
None,
description='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.',
)
class GoogleCloudOrgpolicyV2PolicySpecPolicyRuleStringValues(BaseModel):
allowedValues: Optional[List[str]] = Field(
None, description='List of values allowed at this resource.'
)
deniedValues: Optional[List[str]] = Field(
None, description='List of values denied at this resource.'
)
class GoogleProtobufEmpty(BaseModel):
pass
class GoogleTypeExpr(BaseModel):
description: Optional[str] = Field(
None,
description='Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.',
)
expression: Optional[str] = Field(
None,
description='Textual representation of an expression in Common Expression Language syntax.',
)
location: Optional[str] = Field(
None,
description='Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.',
)
title: Optional[str] = Field(
None,
description='Optional. Title for the expression, i.e. a short string describing its purpose. This can be used e.g. in UIs which allow to enter the expression.',
)
class FieldXgafv(Enum):
field_1 = '1'
field_2 = '2'
class Alt(Enum):
json = 'json'
media = 'media'
proto = 'proto'
class GoogleCloudOrgpolicyV2Constraint(BaseModel):
booleanConstraint: Optional[GoogleCloudOrgpolicyV2ConstraintBooleanConstraint] = (
Field(None, description='Defines this constraint as being a BooleanConstraint.')
)
constraintDefault: Optional[ConstraintDefault] = Field(
None,
description='The evaluation behavior of this constraint in the absence of a policy.',
)
description: Optional[str] = Field(
None,
description='Detailed description of what this constraint controls as well as how and where it is enforced. Mutable.',
)
displayName: Optional[str] = Field(
None, description='The human readable name. Mutable.'
)
listConstraint: Optional[GoogleCloudOrgpolicyV2ConstraintListConstraint] = Field(
None, description='Defines this constraint as being a ListConstraint.'
)
name: Optional[str] = Field(
None,
description='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".',
)
supportsDryRun: Optional[bool] = Field(
None, description='Shows if dry run is supported for this constraint or not.'
)
class GoogleCloudOrgpolicyV2ListConstraintsResponse(BaseModel):
constraints: Optional[List[GoogleCloudOrgpolicyV2Constraint]] = Field(
None,
description='The collection of constraints that are available on the targeted resource.',
)
nextPageToken: Optional[str] = Field(
None,
description='Page token used to retrieve the next page. This is currently not used.',
)
class GoogleCloudOrgpolicyV2PolicySpecPolicyRule(BaseModel):
allowAll: Optional[bool] = Field(
None,
description='Setting this to true means that all values are allowed. This field can be set only in policies for list constraints.',
)
condition: Optional[GoogleTypeExpr] = Field(
None,
description='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.matchTag(\'/tag_key_short_name, \'tag_value_short_name\')". or "resource.matchTagId(\'tagKeys/key_id\', \'tagValues/value_id\')". where key_name and value_name are the resource names for Label Keys and Values. These names are available from the Tag Manager Service. An example expression is: "resource.matchTag(\'123456789/environment, \'prod\')". or "resource.matchTagId(\'tagKeys/123\', \'tagValues/456\')".',
)
denyAll: Optional[bool] = Field(
None,
description='Setting this to true means that all values are denied. This field can be set only in policies for list constraints.',
)
enforce: Optional[bool] = Field(
None,
description='If `true`, then the policy is enforced. If `false`, then any configuration is acceptable. This field can be set only in policies for boolean constraints.',
)
values: Optional[GoogleCloudOrgpolicyV2PolicySpecPolicyRuleStringValues] = Field(
None,
description='List of values to be used for this policy rule. This field can be set only in policies for list constraints.',
)
class GoogleCloudOrgpolicyV2PolicySpec(BaseModel):
etag: Optional[str] = Field(
None,
description='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 a `GetPolicy` or a `ListPolicies` request, this `etag` indicates the version of the current policy to use when executing a read-modify-write loop. When the policy is returned from a `GetEffectivePolicy` request, the `etag` will be unset.',
)
inheritFromParent: Optional[bool] = Field(
None,
description='Determines the inheritance behavior for this policy. If `inherit_from_parent` is true, policy rules 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.',
)
reset: Optional[bool] = Field(
None,
description='Ignores policies set above this resource and restores the `constraint_default` enforcement behavior of the specific constraint at this resource. This field can be set in policies for either list or boolean constraints. If set, `rules` must be empty and `inherit_from_parent` must be set to false.',
)
rules: Optional[List[GoogleCloudOrgpolicyV2PolicySpecPolicyRule]] = Field(
None,
description='In policies for boolean constraints, the following requirements apply: - There must be one and only one policy rule where condition is unset. - Boolean policy rules with conditions must set `enforced` to the opposite of the policy rule without a condition. - During policy evaluation, policy rules with conditions that are true for a target resource take precedence.',
)
updateTime: Optional[str] = Field(
None,
description='Output only. The time stamp this was previously updated. This represents the last time a call to `CreatePolicy` or `UpdatePolicy` was made for that policy.',
)
class GoogleCloudOrgpolicyV2AlternatePolicySpec(BaseModel):
launch: Optional[str] = Field(
None,
description='Reference to the launch that will be used while audit logging and to control the launch. Should be set only in the alternate policy.',
)
spec: Optional[GoogleCloudOrgpolicyV2PolicySpec] = Field(
None,
description='Specify constraint for configurations of Google Cloud resources.',
)
class GoogleCloudOrgpolicyV2Policy(BaseModel):
alternate: Optional[GoogleCloudOrgpolicyV2AlternatePolicySpec] = Field(
None, description='Deprecated.'
)
dryRunSpec: Optional[GoogleCloudOrgpolicyV2PolicySpec] = Field(
None,
description="Dry-run policy. Audit-only policy, can be used to monitor how the policy would have impacted the existing and future resources if it's enforced.",
)
name: Optional[str] = Field(
None,
description='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.',
)
spec: Optional[GoogleCloudOrgpolicyV2PolicySpec] = Field(
None, description='Basic information about the Organization Policy.'
)
class GoogleCloudOrgpolicyV2ListPoliciesResponse(BaseModel):
nextPageToken: Optional[str] = Field(
None,
description='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.',
)
policies: Optional[List[GoogleCloudOrgpolicyV2Policy]] = Field(
None,
description='All policies that exist on the resource. It will be empty if no policies are set.',
)