# generated by fastapi-codegen:
# filename: openapi.yaml
# timestamp: 2025-06-29T03:03:21+00:00
from __future__ import annotations
from enum import Enum
from typing import Any, Dict, List, Optional
from pydantic import BaseModel, Field
class Type(Enum):
TYPE_UNSPECIFIED = 'TYPE_UNSPECIFIED'
V2 = 'V2'
V3 = 'V3'
V4 = 'V4'
class AcceleratorConfig(BaseModel):
topology: Optional[str] = Field(
None, description='Required. Topology of TPU in chips.'
)
type: Optional[Type] = Field(None, description='Required. Type of TPU.')
class AcceleratorType(BaseModel):
acceleratorConfigs: Optional[List[AcceleratorConfig]] = Field(
None, description='The accelerator config.'
)
name: Optional[str] = Field(None, description='The resource name.')
type: Optional[str] = Field(None, description='the accelerator type.')
class AccessConfig(BaseModel):
externalIp: Optional[str] = Field(
None,
description='Output only. An external IP address associated with the TPU worker.',
)
class Mode(Enum):
DISK_MODE_UNSPECIFIED = 'DISK_MODE_UNSPECIFIED'
READ_WRITE = 'READ_WRITE'
READ_ONLY = 'READ_ONLY'
class AttachedDisk(BaseModel):
mode: Optional[Mode] = Field(
None,
description='The mode in which to attach this disk. If not specified, the default is READ_WRITE mode. Only applicable to data_disks.',
)
sourceDisk: Optional[str] = Field(
None,
description='Specifies the full path to an existing disk. For example: "projects/my-project/zones/us-central1-c/disks/my-disk".',
)
class Empty(BaseModel):
pass
class GenerateServiceIdentityRequest(BaseModel):
pass
class GetGuestAttributesRequest(BaseModel):
queryPath: Optional[str] = Field(
None, description='The guest attributes path to be queried.'
)
workerIds: Optional[List[str]] = Field(
None,
description="The 0-based worker ID. If it is empty, all workers' GuestAttributes will be returned.",
)
class GuestAttributesEntry(BaseModel):
key: Optional[str] = Field(None, description='Key for the guest attribute entry.')
namespace: Optional[str] = Field(
None, description='Namespace for the guest attribute entry.'
)
value: Optional[str] = Field(
None, description='Value for the guest attribute entry.'
)
class GuestAttributesValue(BaseModel):
items: Optional[List[GuestAttributesEntry]] = Field(
None, description='The list of guest attributes entries.'
)
class ListAcceleratorTypesResponse(BaseModel):
acceleratorTypes: Optional[List[AcceleratorType]] = Field(
None, description='The listed nodes.'
)
nextPageToken: Optional[str] = Field(
None, description='The next page token or empty if none.'
)
unreachable: Optional[List[str]] = Field(
None, description='Locations that could not be reached.'
)
class Location(BaseModel):
displayName: Optional[str] = Field(
None,
description='The friendly name for this location, typically a nearby city name. For example, "Tokyo".',
)
labels: Optional[Dict[str, str]] = Field(
None,
description='Cross-service attributes for the location. For example {"cloud.googleapis.com/region": "us-east1"}',
)
locationId: Optional[str] = Field(
None,
description='The canonical id for this location. For example: `"us-east1"`.',
)
metadata: Optional[Dict[str, Any]] = Field(
None,
description='Service-specific metadata. For example the available capacity at the given location.',
)
name: Optional[str] = Field(
None,
description='Resource name for the location, which may vary between implementations. For example: `"projects/example-project/locations/us-east1"`',
)
class NetworkConfig(BaseModel):
canIpForward: Optional[bool] = Field(
None,
description='Allows the TPU node to send and receive packets with non-matching destination or source IPs. This is required if you plan to use the TPU workers to forward routes.',
)
enableExternalIps: Optional[bool] = Field(
None,
description='Indicates that external IP addresses would be associated with the TPU workers. If set to false, the specified subnetwork or network should have Private Google Access enabled.',
)
network: Optional[str] = Field(
None,
description='The name of the network for the TPU node. It must be a preexisting Google Compute Engine network. If none is provided, "default" will be used.',
)
subnetwork: Optional[str] = Field(
None,
description='The name of the subnetwork for the TPU node. It must be a preexisting Google Compute Engine subnetwork. If none is provided, "default" will be used.',
)
class NetworkEndpoint(BaseModel):
accessConfig: Optional[AccessConfig] = Field(
None, description='The access config for the TPU worker.'
)
ipAddress: Optional[str] = Field(
None, description='The internal IP address of this network endpoint.'
)
port: Optional[int] = Field(None, description='The port of this network endpoint.')
class ApiVersion(Enum):
API_VERSION_UNSPECIFIED = 'API_VERSION_UNSPECIFIED'
V1_ALPHA1 = 'V1_ALPHA1'
V1 = 'V1'
V2_ALPHA1 = 'V2_ALPHA1'
V2 = 'V2'
class Health(Enum):
HEALTH_UNSPECIFIED = 'HEALTH_UNSPECIFIED'
HEALTHY = 'HEALTHY'
TIMEOUT = 'TIMEOUT'
UNHEALTHY_TENSORFLOW = 'UNHEALTHY_TENSORFLOW'
UNHEALTHY_MAINTENANCE = 'UNHEALTHY_MAINTENANCE'
class State(Enum):
STATE_UNSPECIFIED = 'STATE_UNSPECIFIED'
CREATING = 'CREATING'
READY = 'READY'
RESTARTING = 'RESTARTING'
REIMAGING = 'REIMAGING'
DELETING = 'DELETING'
REPAIRING = 'REPAIRING'
STOPPED = 'STOPPED'
STOPPING = 'STOPPING'
STARTING = 'STARTING'
PREEMPTED = 'PREEMPTED'
TERMINATED = 'TERMINATED'
HIDING = 'HIDING'
HIDDEN = 'HIDDEN'
UNHIDING = 'UNHIDING'
class OperationMetadata(BaseModel):
apiVersion: Optional[str] = Field(None, description='API version.')
cancelRequested: Optional[bool] = Field(
None, description='Specifies if cancellation was requested for the operation.'
)
createTime: Optional[str] = Field(
None, description='The time the operation was created.'
)
endTime: Optional[str] = Field(
None, description='The time the operation finished running.'
)
statusDetail: Optional[str] = Field(
None, description='Human-readable status of the operation, if any.'
)
target: Optional[str] = Field(
None,
description='Target of the operation - for example projects/project-1/connectivityTests/test-1',
)
verb: Optional[str] = Field(
None, description='Name of the verb executed by the operation.'
)
class RuntimeVersion(BaseModel):
name: Optional[str] = Field(None, description='The resource name.')
version: Optional[str] = Field(None, description='The runtime version.')
class SchedulingConfig(BaseModel):
preemptible: Optional[bool] = Field(
None, description='Defines whether the node is preemptible.'
)
reserved: Optional[bool] = Field(
None, description='Whether the node is created under a reservation.'
)
class ServiceAccount(BaseModel):
email: Optional[str] = Field(
None,
description='Email address of the service account. If empty, default Compute service account will be used.',
)
scope: Optional[List[str]] = Field(
None,
description='The list of scopes to be made available for this service account. If empty, access to all Cloud APIs will be allowed.',
)
class ServiceIdentity(BaseModel):
email: Optional[str] = Field(
None, description='The email address of the service identity.'
)
class ShieldedInstanceConfig(BaseModel):
enableSecureBoot: Optional[bool] = Field(
None, description='Defines whether the instance has Secure Boot enabled.'
)
class StartNodeRequest(BaseModel):
pass
class Status(BaseModel):
code: Optional[int] = Field(
None,
description='The status code, which should be an enum value of google.rpc.Code.',
)
details: Optional[List[Dict[str, Any]]] = Field(
None,
description='A list of messages that carry the error details. There is a common set of message types for APIs to use.',
)
message: Optional[str] = Field(
None,
description='A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.',
)
class StopNodeRequest(BaseModel):
pass
class SymptomType(Enum):
SYMPTOM_TYPE_UNSPECIFIED = 'SYMPTOM_TYPE_UNSPECIFIED'
LOW_MEMORY = 'LOW_MEMORY'
OUT_OF_MEMORY = 'OUT_OF_MEMORY'
EXECUTE_TIMED_OUT = 'EXECUTE_TIMED_OUT'
MESH_BUILD_FAIL = 'MESH_BUILD_FAIL'
HBM_OUT_OF_MEMORY = 'HBM_OUT_OF_MEMORY'
PROJECT_ABUSE = 'PROJECT_ABUSE'
class Symptom(BaseModel):
createTime: Optional[str] = Field(
None, description='Timestamp when the Symptom is created.'
)
details: Optional[str] = Field(
None, description='Detailed information of the current Symptom.'
)
symptomType: Optional[SymptomType] = Field(None, description='Type of the Symptom.')
workerId: Optional[str] = Field(
None,
description='A string used to uniquely distinguish a worker within a TPU node.',
)
class FieldXgafv(Enum):
field_1 = '1'
field_2 = '2'
class Alt(Enum):
json = 'json'
media = 'media'
proto = 'proto'
class GenerateServiceIdentityResponse(BaseModel):
identity: Optional[ServiceIdentity] = Field(
None, description='ServiceIdentity that was created or retrieved.'
)
class GuestAttributes(BaseModel):
queryPath: Optional[str] = Field(
None,
description="The path to be queried. This can be the default namespace ('/') or a nested namespace ('/\\/') or a specified key ('/\\/\\')",
)
queryValue: Optional[GuestAttributesValue] = Field(
None, description='The value of the requested queried path.'
)
class ListLocationsResponse(BaseModel):
locations: Optional[List[Location]] = Field(
None,
description='A list of locations that matches the specified filter in the request.',
)
nextPageToken: Optional[str] = Field(
None, description='The standard List next-page token.'
)
class ListRuntimeVersionsResponse(BaseModel):
nextPageToken: Optional[str] = Field(
None, description='The next page token or empty if none.'
)
runtimeVersions: Optional[List[RuntimeVersion]] = Field(
None, description='The listed nodes.'
)
unreachable: Optional[List[str]] = Field(
None, description='Locations that could not be reached.'
)
class Node(BaseModel):
acceleratorConfig: Optional[AcceleratorConfig] = Field(
None, description='The AccleratorConfig for the TPU Node.'
)
acceleratorType: Optional[str] = Field(
None,
description='Required. The type of hardware accelerators associated with this node.',
)
apiVersion: Optional[ApiVersion] = Field(
None, description='Output only. The API version that created this Node.'
)
cidrBlock: Optional[str] = Field(
None,
description="The CIDR block that the TPU node will use when selecting an IP address. This CIDR block must be a /29 block; the Compute Engine networks API forbids a smaller block, and using a larger block would be wasteful (a node can only consume one IP address). Errors will occur if the CIDR block has already been used for a currently existing TPU node, the CIDR block conflicts with any subnetworks in the user's provided network, or the provided network is peered with another network that is using that CIDR block.",
)
createTime: Optional[str] = Field(
None, description='Output only. The time when the node was created.'
)
dataDisks: Optional[List[AttachedDisk]] = Field(
None, description='The additional data disks for the Node.'
)
description: Optional[str] = Field(
None,
description='The user-supplied description of the TPU. Maximum of 512 characters.',
)
health: Optional[Health] = Field(
None, description='The health status of the TPU node.'
)
healthDescription: Optional[str] = Field(
None,
description='Output only. If this field is populated, it contains a description of why the TPU Node is unhealthy.',
)
id: Optional[str] = Field(
None, description='Output only. The unique identifier for the TPU Node.'
)
labels: Optional[Dict[str, str]] = Field(
None, description='Resource labels to represent user-provided metadata.'
)
metadata: Optional[Dict[str, str]] = Field(
None,
description='Custom metadata to apply to the TPU Node. Can set startup-script and shutdown-script',
)
name: Optional[str] = Field(
None, description='Output only. Immutable. The name of the TPU.'
)
networkConfig: Optional[NetworkConfig] = Field(
None, description='Network configurations for the TPU node.'
)
networkEndpoints: Optional[List[NetworkEndpoint]] = Field(
None,
description='Output only. The network endpoints where TPU workers can be accessed and sent work. It is recommended that runtime clients of the node reach out to the 0th entry in this map first.',
)
runtimeVersion: Optional[str] = Field(
None, description='Required. The runtime version running in the Node.'
)
schedulingConfig: Optional[SchedulingConfig] = Field(
None, description='The scheduling options for this node.'
)
serviceAccount: Optional[ServiceAccount] = Field(
None,
description='The Google Cloud Platform Service Account to be used by the TPU node VMs. If None is specified, the default compute service account will be used.',
)
shieldedInstanceConfig: Optional[ShieldedInstanceConfig] = Field(
None, description='Shielded Instance options.'
)
state: Optional[State] = Field(
None, description='Output only. The current state for the TPU Node.'
)
symptoms: Optional[List[Symptom]] = Field(
None,
description='Output only. The Symptoms that have occurred to the TPU Node.',
)
tags: Optional[List[str]] = Field(
None,
description='Tags to apply to the TPU Node. Tags are used to identify valid sources or targets for network firewalls.',
)
class Operation(BaseModel):
done: Optional[bool] = Field(
None,
description='If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available.',
)
error: Optional[Status] = Field(
None,
description='The error result of the operation in case of failure or cancellation.',
)
metadata: Optional[Dict[str, Any]] = Field(
None,
description='Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.',
)
name: Optional[str] = Field(
None,
description='The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`.',
)
response: Optional[Dict[str, Any]] = Field(
None,
description='The normal response of the operation in case of success. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.',
)
class GetGuestAttributesResponse(BaseModel):
guestAttributes: Optional[List[GuestAttributes]] = Field(
None, description='The guest attributes for the TPU workers.'
)
class ListNodesResponse(BaseModel):
nextPageToken: Optional[str] = Field(
None, description='The next page token or empty if none.'
)
nodes: Optional[List[Node]] = Field(None, description='The listed nodes.')
unreachable: Optional[List[str]] = Field(
None, description='Locations that could not be reached.'
)
class ListOperationsResponse(BaseModel):
nextPageToken: Optional[str] = Field(
None, description='The standard List next-page token.'
)
operations: Optional[List[Operation]] = Field(
None,
description='A list of operations that matches the specified filter in the request.',
)