// Copyright 2022 Luca Casonato. All rights reserved. MIT license. /** * Cloud TPU API Client for Deno * ============================= * * TPU API provides customers with access to Google TPU technology. * * Docs: https://cloud.google.com/tpu/ * Source: https://googleapis.deno.dev/v1/tpu:v2.ts */ import { auth, CredentialsClient, GoogleAuth, request } from "/_/base@v1/mod.ts"; export { auth, GoogleAuth }; export type { CredentialsClient }; /** * TPU API provides customers with access to Google TPU technology. */ export class TPU { #client: CredentialsClient | undefined; #baseUrl: string; constructor(client?: CredentialsClient, baseUrl: string = "https://tpu.googleapis.com/") { this.#client = client; this.#baseUrl = baseUrl; } /** * Gets AcceleratorType. * * @param name Required. The resource name. */ async projectsLocationsAcceleratorTypesGet(name: string): Promise { const url = new URL(`${this.#baseUrl}v2/${ name }`); const data = await request(url.href, { client: this.#client, method: "GET", }); return data as AcceleratorType; } /** * Lists accelerator types supported by this API. * * @param parent Required. The parent resource name. */ async projectsLocationsAcceleratorTypesList(parent: string, opts: ProjectsLocationsAcceleratorTypesListOptions = {}): Promise { const url = new URL(`${this.#baseUrl}v2/${ parent }/acceleratorTypes`); if (opts.filter !== undefined) { url.searchParams.append("filter", String(opts.filter)); } if (opts.orderBy !== undefined) { url.searchParams.append("orderBy", String(opts.orderBy)); } if (opts.pageSize !== undefined) { url.searchParams.append("pageSize", String(opts.pageSize)); } if (opts.pageToken !== undefined) { url.searchParams.append("pageToken", String(opts.pageToken)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return data as ListAcceleratorTypesResponse; } /** * Generates the Cloud TPU service identity for the project. * * @param parent Required. The parent resource name. */ async projectsLocationsGenerateServiceIdentity(parent: string, req: GenerateServiceIdentityRequest): Promise { const url = new URL(`${this.#baseUrl}v2/${ parent }:generateServiceIdentity`); const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return data as GenerateServiceIdentityResponse; } /** * Gets information about a location. * * @param name Resource name for the location. */ async projectsLocationsGet(name: string): Promise { const url = new URL(`${this.#baseUrl}v2/${ name }`); const data = await request(url.href, { client: this.#client, method: "GET", }); return data as Location; } /** * Lists information about the supported locations for this service. * * @param name The resource that owns the locations collection, if applicable. */ async projectsLocationsList(name: string, opts: ProjectsLocationsListOptions = {}): Promise { const url = new URL(`${this.#baseUrl}v2/${ name }/locations`); if (opts.filter !== undefined) { url.searchParams.append("filter", String(opts.filter)); } if (opts.pageSize !== undefined) { url.searchParams.append("pageSize", String(opts.pageSize)); } if (opts.pageToken !== undefined) { url.searchParams.append("pageToken", String(opts.pageToken)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return data as ListLocationsResponse; } /** * Creates a node. * * @param parent Required. The parent resource name. */ async projectsLocationsNodesCreate(parent: string, req: Node, opts: ProjectsLocationsNodesCreateOptions = {}): Promise { const url = new URL(`${this.#baseUrl}v2/${ parent }/nodes`); if (opts.nodeId !== undefined) { url.searchParams.append("nodeId", String(opts.nodeId)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return data as Operation; } /** * Deletes a node. * * @param name Required. The resource name. */ async projectsLocationsNodesDelete(name: string): Promise { const url = new URL(`${this.#baseUrl}v2/${ name }`); const data = await request(url.href, { client: this.#client, method: "DELETE", }); return data as Operation; } /** * Gets the details of a node. * * @param name Required. The resource name. */ async projectsLocationsNodesGet(name: string): Promise { const url = new URL(`${this.#baseUrl}v2/${ name }`); const data = await request(url.href, { client: this.#client, method: "GET", }); return data as Node; } /** * Retrieves the guest attributes for the node. * * @param name Required. The resource name. */ async projectsLocationsNodesGetGuestAttributes(name: string, req: GetGuestAttributesRequest): Promise { const url = new URL(`${this.#baseUrl}v2/${ name }:getGuestAttributes`); const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return data as GetGuestAttributesResponse; } /** * Lists nodes. * * @param parent Required. The parent resource name. */ async projectsLocationsNodesList(parent: string, opts: ProjectsLocationsNodesListOptions = {}): Promise { const url = new URL(`${this.#baseUrl}v2/${ parent }/nodes`); if (opts.pageSize !== undefined) { url.searchParams.append("pageSize", String(opts.pageSize)); } if (opts.pageToken !== undefined) { url.searchParams.append("pageToken", String(opts.pageToken)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return data as ListNodesResponse; } /** * Updates the configurations of a node. * * @param name Output only. Immutable. The name of the TPU. */ async projectsLocationsNodesPatch(name: string, req: Node, opts: ProjectsLocationsNodesPatchOptions = {}): Promise { opts = serializeProjectsLocationsNodesPatchOptions(opts); const url = new URL(`${this.#baseUrl}v2/${ name }`); if (opts.updateMask !== undefined) { url.searchParams.append("updateMask", String(opts.updateMask)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "PATCH", body, }); return data as Operation; } /** * Starts a node. * * @param name Required. The resource name. */ async projectsLocationsNodesStart(name: string, req: StartNodeRequest): Promise { const url = new URL(`${this.#baseUrl}v2/${ name }:start`); const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return data as Operation; } /** * Stops a node. This operation is only available with single TPU nodes. * * @param name Required. The resource name. */ async projectsLocationsNodesStop(name: string, req: StopNodeRequest): Promise { const url = new URL(`${this.#baseUrl}v2/${ name }:stop`); const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return data as Operation; } /** * Starts asynchronous cancellation on a long-running operation. The server * makes a best effort to cancel the operation, but success is not guaranteed. * If the server doesn't support this method, it returns * `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or * other methods to check whether the cancellation succeeded or whether the * operation completed despite cancellation. On successful cancellation, the * operation is not deleted; instead, it becomes an operation with an * Operation.error value with a google.rpc.Status.code of 1, corresponding to * `Code.CANCELLED`. * * @param name The name of the operation resource to be cancelled. */ async projectsLocationsOperationsCancel(name: string): Promise { const url = new URL(`${this.#baseUrl}v2/${ name }:cancel`); const data = await request(url.href, { client: this.#client, method: "POST", }); return data as Empty; } /** * Deletes a long-running operation. This method indicates that the client is * no longer interested in the operation result. It does not cancel the * operation. If the server doesn't support this method, it returns * `google.rpc.Code.UNIMPLEMENTED`. * * @param name The name of the operation resource to be deleted. */ async projectsLocationsOperationsDelete(name: string): Promise { const url = new URL(`${this.#baseUrl}v2/${ name }`); const data = await request(url.href, { client: this.#client, method: "DELETE", }); return data as Empty; } /** * Gets the latest state of a long-running operation. Clients can use this * method to poll the operation result at intervals as recommended by the API * service. * * @param name The name of the operation resource. */ async projectsLocationsOperationsGet(name: string): Promise { const url = new URL(`${this.#baseUrl}v2/${ name }`); const data = await request(url.href, { client: this.#client, method: "GET", }); return data as Operation; } /** * Lists operations that match the specified filter in the request. If the * server doesn't support this method, it returns `UNIMPLEMENTED`. * * @param name The name of the operation's parent resource. */ async projectsLocationsOperationsList(name: string, opts: ProjectsLocationsOperationsListOptions = {}): Promise { const url = new URL(`${this.#baseUrl}v2/${ name }/operations`); if (opts.filter !== undefined) { url.searchParams.append("filter", String(opts.filter)); } if (opts.pageSize !== undefined) { url.searchParams.append("pageSize", String(opts.pageSize)); } if (opts.pageToken !== undefined) { url.searchParams.append("pageToken", String(opts.pageToken)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return data as ListOperationsResponse; } /** * Creates a QueuedResource TPU instance. * * @param parent Required. The parent resource name. */ async projectsLocationsQueuedResourcesCreate(parent: string, req: QueuedResource, opts: ProjectsLocationsQueuedResourcesCreateOptions = {}): Promise { req = serializeQueuedResource(req); const url = new URL(`${this.#baseUrl}v2/${ parent }/queuedResources`); if (opts.queuedResourceId !== undefined) { url.searchParams.append("queuedResourceId", String(opts.queuedResourceId)); } if (opts.requestId !== undefined) { url.searchParams.append("requestId", String(opts.requestId)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return data as Operation; } /** * Deletes a QueuedResource TPU instance. * * @param name Required. The resource name. */ async projectsLocationsQueuedResourcesDelete(name: string, opts: ProjectsLocationsQueuedResourcesDeleteOptions = {}): Promise { const url = new URL(`${this.#baseUrl}v2/${ name }`); if (opts.force !== undefined) { url.searchParams.append("force", String(opts.force)); } if (opts.requestId !== undefined) { url.searchParams.append("requestId", String(opts.requestId)); } const data = await request(url.href, { client: this.#client, method: "DELETE", }); return data as Operation; } /** * Gets details of a queued resource. * * @param name Required. The resource name. */ async projectsLocationsQueuedResourcesGet(name: string): Promise { const url = new URL(`${this.#baseUrl}v2/${ name }`); const data = await request(url.href, { client: this.#client, method: "GET", }); return deserializeQueuedResource(data); } /** * Lists queued resources. * * @param parent Required. The parent resource name. */ async projectsLocationsQueuedResourcesList(parent: string, opts: ProjectsLocationsQueuedResourcesListOptions = {}): Promise { const url = new URL(`${this.#baseUrl}v2/${ parent }/queuedResources`); if (opts.pageSize !== undefined) { url.searchParams.append("pageSize", String(opts.pageSize)); } if (opts.pageToken !== undefined) { url.searchParams.append("pageToken", String(opts.pageToken)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return deserializeListQueuedResourcesResponse(data); } /** * Resets a QueuedResource TPU instance * * @param name Required. The name of the queued resource. */ async projectsLocationsQueuedResourcesReset(name: string, req: ResetQueuedResourceRequest): Promise { const url = new URL(`${this.#baseUrl}v2/${ name }:reset`); const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return data as Operation; } /** * Gets a runtime version. * * @param name Required. The resource name. */ async projectsLocationsRuntimeVersionsGet(name: string): Promise { const url = new URL(`${this.#baseUrl}v2/${ name }`); const data = await request(url.href, { client: this.#client, method: "GET", }); return data as RuntimeVersion; } /** * Lists runtime versions supported by this API. * * @param parent Required. The parent resource name. */ async projectsLocationsRuntimeVersionsList(parent: string, opts: ProjectsLocationsRuntimeVersionsListOptions = {}): Promise { const url = new URL(`${this.#baseUrl}v2/${ parent }/runtimeVersions`); if (opts.filter !== undefined) { url.searchParams.append("filter", String(opts.filter)); } if (opts.orderBy !== undefined) { url.searchParams.append("orderBy", String(opts.orderBy)); } if (opts.pageSize !== undefined) { url.searchParams.append("pageSize", String(opts.pageSize)); } if (opts.pageToken !== undefined) { url.searchParams.append("pageToken", String(opts.pageToken)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return data as ListRuntimeVersionsResponse; } } /** * A TPU accelerator configuration. */ export interface AcceleratorConfig { /** * Required. Topology of TPU in chips. */ topology?: string; /** * Required. Type of TPU. */ type?: | "TYPE_UNSPECIFIED" | "V2" | "V3" | "V4" | "V5LITE_POD" | "V5P"; } /** * A accelerator type that a Node can be configured with. */ export interface AcceleratorType { /** * The accelerator config. */ acceleratorConfigs?: AcceleratorConfig[]; /** * The resource name. */ name?: string; /** * The accelerator type. */ type?: string; } /** * Further data for the accepted state. */ export interface AcceptedData { } /** * An access config attached to the TPU worker. */ export interface AccessConfig { /** * Output only. An external IP address associated with the TPU worker. */ readonly externalIp?: string; } /** * Further data for the active state. */ export interface ActiveData { } /** * A node-attached disk resource. Next ID: 8; */ export interface AttachedDisk { /** * The mode in which to attach this disk. If not specified, the default is * READ_WRITE mode. Only applicable to data_disks. */ mode?: | "DISK_MODE_UNSPECIFIED" | "READ_WRITE" | "READ_ONLY"; /** * Specifies the full path to an existing disk. For example: * "projects/my-project/zones/us-central1-c/disks/my-disk". */ sourceDisk?: string; } /** * Further data for the creating state. */ export interface CreatingData { } /** * Further data for the deleting state. */ export interface DeletingData { } /** * A generic empty message that you can re-use to avoid defining duplicated * empty messages in your APIs. A typical example is to use it as the request or * the response type of an API method. For instance: service Foo { rpc * Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } */ export interface Empty { } /** * Further data for the failed state. */ export interface FailedData { /** * Output only. The error that caused the queued resource to enter the FAILED * state. */ readonly error?: Status; } /** * Request for GenerateServiceIdentity. */ export interface GenerateServiceIdentityRequest { } /** * Response for GenerateServiceIdentity. */ export interface GenerateServiceIdentityResponse { /** * ServiceIdentity that was created or retrieved. */ identity?: ServiceIdentity; } /** * Request for GetGuestAttributes. */ export interface GetGuestAttributesRequest { /** * The guest attributes path to be queried. */ queryPath?: string; /** * The 0-based worker ID. If it is empty, all workers' GuestAttributes will * be returned. */ workerIds?: string[]; } /** * Response for GetGuestAttributes. */ export interface GetGuestAttributesResponse { /** * The guest attributes for the TPU workers. */ guestAttributes?: GuestAttributes[]; } /** * Guaranteed tier definition. */ export interface Guaranteed { /** * Optional. Defines the minimum duration of the guarantee. If specified, the * requested resources will only be provisioned if they can be allocated for * at least the given duration. */ minDuration?: number /* Duration */; } function serializeGuaranteed(data: any): Guaranteed { return { ...data, minDuration: data["minDuration"] !== undefined ? data["minDuration"] : undefined, }; } function deserializeGuaranteed(data: any): Guaranteed { return { ...data, minDuration: data["minDuration"] !== undefined ? data["minDuration"] : undefined, }; } /** * A guest attributes. */ export interface GuestAttributes { /** * The path to be queried. This can be the default namespace ('/') or a * nested namespace ('/\/') or a specified key ('/\/\') */ queryPath?: string; /** * The value of the requested queried path. */ queryValue?: GuestAttributesValue; } /** * A guest attributes namespace/key/value entry. */ export interface GuestAttributesEntry { /** * Key for the guest attribute entry. */ key?: string; /** * Namespace for the guest attribute entry. */ namespace?: string; /** * Value for the guest attribute entry. */ value?: string; } /** * Array of guest attribute namespace/key/value tuples. */ export interface GuestAttributesValue { /** * The list of guest attributes entries. */ items?: GuestAttributesEntry[]; } /** * Represents a time interval, encoded as a Timestamp start (inclusive) and a * Timestamp end (exclusive). The start must be less than or equal to the end. * When the start equals the end, the interval is empty (matches no time). When * both start and end are unspecified, the interval matches any time. */ export interface Interval { /** * Optional. Exclusive end of the interval. If specified, a Timestamp * matching this interval will have to be before the end. */ endTime?: Date; /** * Optional. Inclusive start of the interval. If specified, a Timestamp * matching this interval will have to be the same or after the start. */ startTime?: Date; } function serializeInterval(data: any): Interval { return { ...data, endTime: data["endTime"] !== undefined ? data["endTime"].toISOString() : undefined, startTime: data["startTime"] !== undefined ? data["startTime"].toISOString() : undefined, }; } function deserializeInterval(data: any): Interval { return { ...data, endTime: data["endTime"] !== undefined ? new Date(data["endTime"]) : undefined, startTime: data["startTime"] !== undefined ? new Date(data["startTime"]) : undefined, }; } /** * Response for ListAcceleratorTypes. */ export interface ListAcceleratorTypesResponse { /** * The listed nodes. */ acceleratorTypes?: AcceleratorType[]; /** * The next page token or empty if none. */ nextPageToken?: string; /** * Locations that could not be reached. */ unreachable?: string[]; } /** * The response message for Locations.ListLocations. */ export interface ListLocationsResponse { /** * A list of locations that matches the specified filter in the request. */ locations?: Location[]; /** * The standard List next-page token. */ nextPageToken?: string; } /** * Response for ListNodes. */ export interface ListNodesResponse { /** * The next page token or empty if none. */ nextPageToken?: string; /** * The listed nodes. */ nodes?: Node[]; /** * Locations that could not be reached. */ unreachable?: string[]; } /** * The response message for Operations.ListOperations. */ export interface ListOperationsResponse { /** * The standard List next-page token. */ nextPageToken?: string; /** * A list of operations that matches the specified filter in the request. */ operations?: Operation[]; } /** * Response for ListQueuedResources. */ export interface ListQueuedResourcesResponse { /** * The next page token or empty if none. */ nextPageToken?: string; /** * The listed queued resources. */ queuedResources?: QueuedResource[]; /** * Locations that could not be reached. */ unreachable?: string[]; } function serializeListQueuedResourcesResponse(data: any): ListQueuedResourcesResponse { return { ...data, queuedResources: data["queuedResources"] !== undefined ? data["queuedResources"].map((item: any) => (serializeQueuedResource(item))) : undefined, }; } function deserializeListQueuedResourcesResponse(data: any): ListQueuedResourcesResponse { return { ...data, queuedResources: data["queuedResources"] !== undefined ? data["queuedResources"].map((item: any) => (deserializeQueuedResource(item))) : undefined, }; } /** * Response for ListRuntimeVersions. */ export interface ListRuntimeVersionsResponse { /** * The next page token or empty if none. */ nextPageToken?: string; /** * The listed nodes. */ runtimeVersions?: RuntimeVersion[]; /** * Locations that could not be reached. */ unreachable?: string[]; } /** * A resource that represents a Google Cloud location. */ export interface Location { /** * The friendly name for this location, typically a nearby city name. For * example, "Tokyo". */ displayName?: string; /** * Cross-service attributes for the location. For example * {"cloud.googleapis.com/region": "us-east1"} */ labels?: { [key: string]: string }; /** * The canonical id for this location. For example: `"us-east1"`. */ locationId?: string; /** * Service-specific metadata. For example the available capacity at the given * location. */ metadata?: { [key: string]: any }; /** * Resource name for the location, which may vary between implementations. * For example: `"projects/example-project/locations/us-east1"` */ name?: string; } /** * Parameters to specify for multislice QueuedResource requests. This message * must be populated in case of multislice requests instead of node_id. */ export interface MultisliceParams { /** * Required. Number of nodes with this spec. The system will attempt to * provison "node_count" nodes as part of the request. This needs to be > 1. */ nodeCount?: number; /** * Optional. Prefix of node_ids in case of multislice request. Should follow * the `^[A-Za-z0-9_.~+%-]+$` regex format. If node_count = 3 and * node_id_prefix = "np", node ids of nodes created will be "np-0", "np-1", * "np-2". If this field is not provided we use queued_resource_id as the * node_id_prefix. */ nodeIdPrefix?: string; } /** * Network related configurations. */ export interface NetworkConfig { /** * 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. */ canIpForward?: boolean; /** * 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. */ enableExternalIps?: boolean; /** * 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. */ network?: string; /** * Optional. Specifies networking queue count for TPU VM instance's network * interface. */ queueCount?: number; /** * 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. */ subnetwork?: string; } /** * A network endpoint over which a TPU worker can be reached. */ export interface NetworkEndpoint { /** * The access config for the TPU worker. */ accessConfig?: AccessConfig; /** * The internal IP address of this network endpoint. */ ipAddress?: string; /** * The port of this network endpoint. */ port?: number; } /** * A TPU instance. */ export interface Node { /** * The AccleratorConfig for the TPU Node. */ acceleratorConfig?: AcceleratorConfig; /** * Optional. The type of hardware accelerators associated with this node. */ acceleratorType?: string; /** * Output only. The API version that created this Node. */ readonly apiVersion?: | "API_VERSION_UNSPECIFIED" | "V1_ALPHA1" | "V1" | "V2_ALPHA1" | "V2"; /** * 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. */ cidrBlock?: string; /** * Output only. The time when the node was created. */ readonly createTime?: Date; /** * The additional data disks for the Node. */ dataDisks?: AttachedDisk[]; /** * The user-supplied description of the TPU. Maximum of 512 characters. */ description?: string; /** * The health status of the TPU node. */ health?: | "HEALTH_UNSPECIFIED" | "HEALTHY" | "TIMEOUT" | "UNHEALTHY_TENSORFLOW" | "UNHEALTHY_MAINTENANCE"; /** * Output only. If this field is populated, it contains a description of why * the TPU Node is unhealthy. */ readonly healthDescription?: string; /** * Output only. The unique identifier for the TPU Node. */ readonly id?: bigint; /** * Resource labels to represent user-provided metadata. */ labels?: { [key: string]: string }; /** * Custom metadata to apply to the TPU Node. Can set startup-script and * shutdown-script */ metadata?: { [key: string]: string }; /** * Output only. Whether the Node belongs to a Multislice group. */ readonly multisliceNode?: boolean; /** * Output only. Immutable. The name of the TPU. */ readonly name?: string; /** * Network configurations for the TPU node. */ networkConfig?: NetworkConfig; /** * 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. */ readonly networkEndpoints?: NetworkEndpoint[]; /** * Output only. The qualified name of the QueuedResource that requested this * Node. */ readonly queuedResource?: string; /** * Required. The runtime version running in the Node. */ runtimeVersion?: string; /** * The scheduling options for this node. */ schedulingConfig?: SchedulingConfig; /** * 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. */ serviceAccount?: ServiceAccount; /** * Shielded Instance options. */ shieldedInstanceConfig?: ShieldedInstanceConfig; /** * Output only. The current state for the TPU Node. */ readonly state?: | "STATE_UNSPECIFIED" | "CREATING" | "READY" | "RESTARTING" | "REIMAGING" | "DELETING" | "REPAIRING" | "STOPPED" | "STOPPING" | "STARTING" | "PREEMPTED" | "TERMINATED" | "HIDING" | "HIDDEN" | "UNHIDING" | "UNKNOWN"; /** * Output only. The Symptoms that have occurred to the TPU Node. */ readonly symptoms?: Symptom[]; /** * Tags to apply to the TPU Node. Tags are used to identify valid sources or * targets for network firewalls. */ tags?: string[]; } /** * Details of the TPU node(s) being requested. Users can request either a * single node or multiple nodes. NodeSpec provides the specification for * node(s) to be created. */ export interface NodeSpec { /** * Optional. Fields to specify in case of multislice request. */ multisliceParams?: MultisliceParams; /** * Required. The node. */ node?: Node; /** * Optional. The unqualified resource name. Should follow the * `^[A-Za-z0-9_.~+%-]+$` regex format. This is only specified when requesting * a single node. In case of multislice requests, multislice_params must be * populated instead. */ nodeId?: string; /** * Required. The parent resource name. */ parent?: string; } /** * This resource represents a long-running operation that is the result of a * network API call. */ export interface Operation { /** * 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. */ done?: boolean; /** * The error result of the operation in case of failure or cancellation. */ error?: Status; /** * 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. */ metadata?: { [key: string]: any }; /** * 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}`. */ name?: string; /** * The normal, successful response of the operation. 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`. */ response?: { [key: string]: any }; } /** * Metadata describing an Operation */ export interface OperationMetadata { /** * API version. */ apiVersion?: string; /** * Specifies if cancellation was requested for the operation. */ cancelRequested?: boolean; /** * The time the operation was created. */ createTime?: Date; /** * The time the operation finished running. */ endTime?: Date; /** * Human-readable status of the operation, if any. */ statusDetail?: string; /** * Target of the operation - for example * projects/project-1/connectivityTests/test-1 */ target?: string; /** * Name of the verb executed by the operation. */ verb?: string; } function serializeOperationMetadata(data: any): OperationMetadata { return { ...data, createTime: data["createTime"] !== undefined ? data["createTime"].toISOString() : undefined, endTime: data["endTime"] !== undefined ? data["endTime"].toISOString() : undefined, }; } function deserializeOperationMetadata(data: any): OperationMetadata { return { ...data, createTime: data["createTime"] !== undefined ? new Date(data["createTime"]) : undefined, endTime: data["endTime"] !== undefined ? new Date(data["endTime"]) : undefined, }; } /** * Additional options for TPU#projectsLocationsAcceleratorTypesList. */ export interface ProjectsLocationsAcceleratorTypesListOptions { /** * List filter. */ filter?: string; /** * Sort results. */ orderBy?: string; /** * The maximum number of items to return. */ pageSize?: number; /** * The next_page_token value returned from a previous List request, if any. */ pageToken?: string; } /** * Additional options for TPU#projectsLocationsList. */ export interface ProjectsLocationsListOptions { /** * A filter to narrow down results to a preferred subset. The filtering * language accepts strings like `"displayName=tokyo"`, and is documented in * more detail in [AIP-160](https://google.aip.dev/160). */ filter?: string; /** * The maximum number of results to return. If not set, the service selects a * default. */ pageSize?: number; /** * A page token received from the `next_page_token` field in the response. * Send that page token to receive the subsequent page. */ pageToken?: string; } /** * Additional options for TPU#projectsLocationsNodesCreate. */ export interface ProjectsLocationsNodesCreateOptions { /** * The unqualified resource name. */ nodeId?: string; } /** * Additional options for TPU#projectsLocationsNodesList. */ export interface ProjectsLocationsNodesListOptions { /** * The maximum number of items to return. */ pageSize?: number; /** * The next_page_token value returned from a previous List request, if any. */ pageToken?: string; } /** * Additional options for TPU#projectsLocationsNodesPatch. */ export interface ProjectsLocationsNodesPatchOptions { /** * Required. Mask of fields from Node to update. Supported fields: * [description, tags, labels, metadata, network_config.enable_external_ips]. */ updateMask?: string /* FieldMask */; } function serializeProjectsLocationsNodesPatchOptions(data: any): ProjectsLocationsNodesPatchOptions { return { ...data, updateMask: data["updateMask"] !== undefined ? data["updateMask"] : undefined, }; } function deserializeProjectsLocationsNodesPatchOptions(data: any): ProjectsLocationsNodesPatchOptions { return { ...data, updateMask: data["updateMask"] !== undefined ? data["updateMask"] : undefined, }; } /** * Additional options for TPU#projectsLocationsOperationsList. */ export interface ProjectsLocationsOperationsListOptions { /** * The standard list filter. */ filter?: string; /** * The standard list page size. */ pageSize?: number; /** * The standard list page token. */ pageToken?: string; } /** * Additional options for TPU#projectsLocationsQueuedResourcesCreate. */ export interface ProjectsLocationsQueuedResourcesCreateOptions { /** * Optional. The unqualified resource name. Should follow the * `^[A-Za-z0-9_.~+%-]+$` regex format. */ queuedResourceId?: string; /** * Optional. Idempotent request UUID. */ requestId?: string; } /** * Additional options for TPU#projectsLocationsQueuedResourcesDelete. */ export interface ProjectsLocationsQueuedResourcesDeleteOptions { /** * Optional. If set to true, all running nodes belonging to this queued * resource will be deleted first and then the queued resource will be * deleted. Otherwise (i.e. force=false), the queued resource will only be * deleted if its nodes have already been deleted or the queued resource is in * the ACCEPTED, FAILED, or SUSPENDED state. */ force?: boolean; /** * Optional. Idempotent request UUID. */ requestId?: string; } /** * Additional options for TPU#projectsLocationsQueuedResourcesList. */ export interface ProjectsLocationsQueuedResourcesListOptions { /** * Optional. The maximum number of items to return. */ pageSize?: number; /** * Optional. The next_page_token value returned from a previous List request, * if any. */ pageToken?: string; } /** * Additional options for TPU#projectsLocationsRuntimeVersionsList. */ export interface ProjectsLocationsRuntimeVersionsListOptions { /** * List filter. */ filter?: string; /** * Sort results. */ orderBy?: string; /** * The maximum number of items to return. */ pageSize?: number; /** * The next_page_token value returned from a previous List request, if any. */ pageToken?: string; } /** * Further data for the provisioning state. */ export interface ProvisioningData { } /** * A QueuedResource represents a request for resources that will be placed in a * queue and fulfilled when the necessary resources are available. */ export interface QueuedResource { /** * Output only. The time when the QueuedResource was created. */ readonly createTime?: Date; /** * Optional. The Guaranteed tier */ guaranteed?: Guaranteed; /** * Output only. Immutable. The name of the QueuedResource. */ readonly name?: string; /** * Optional. The queueing policy of the QueuedRequest. */ queueingPolicy?: QueueingPolicy; /** * Optional. Name of the reservation in which the resource should be * provisioned. Format: * projects/{project}/locations/{zone}/reservations/{reservation} */ reservationName?: string; /** * Optional. The Spot tier. */ spot?: Spot; /** * Output only. State of the QueuedResource request. */ readonly state?: QueuedResourceState; /** * Optional. Defines a TPU resource. */ tpu?: Tpu; } function serializeQueuedResource(data: any): QueuedResource { return { ...data, guaranteed: data["guaranteed"] !== undefined ? serializeGuaranteed(data["guaranteed"]) : undefined, queueingPolicy: data["queueingPolicy"] !== undefined ? serializeQueueingPolicy(data["queueingPolicy"]) : undefined, }; } function deserializeQueuedResource(data: any): QueuedResource { return { ...data, createTime: data["createTime"] !== undefined ? new Date(data["createTime"]) : undefined, guaranteed: data["guaranteed"] !== undefined ? deserializeGuaranteed(data["guaranteed"]) : undefined, queueingPolicy: data["queueingPolicy"] !== undefined ? deserializeQueueingPolicy(data["queueingPolicy"]) : undefined, }; } /** * QueuedResourceState defines the details of the QueuedResource request. */ export interface QueuedResourceState { /** * Output only. Further data for the accepted state. */ readonly acceptedData?: AcceptedData; /** * Output only. Further data for the active state. */ readonly activeData?: ActiveData; /** * Output only. Further data for the creating state. */ readonly creatingData?: CreatingData; /** * Output only. Further data for the deleting state. */ readonly deletingData?: DeletingData; /** * Output only. Further data for the failed state. */ readonly failedData?: FailedData; /** * Output only. Further data for the provisioning state. */ readonly provisioningData?: ProvisioningData; /** * Output only. State of the QueuedResource request. */ readonly state?: | "STATE_UNSPECIFIED" | "CREATING" | "ACCEPTED" | "PROVISIONING" | "FAILED" | "DELETING" | "ACTIVE" | "SUSPENDING" | "SUSPENDED" | "WAITING_FOR_RESOURCES"; /** * Output only. The initiator of the QueuedResources's current state. Used to * indicate whether the SUSPENDING/SUSPENDED state was initiated by the user * or the service. */ readonly stateInitiator?: | "STATE_INITIATOR_UNSPECIFIED" | "USER" | "SERVICE"; /** * Output only. Further data for the suspended state. */ readonly suspendedData?: SuspendedData; /** * Output only. Further data for the suspending state. */ readonly suspendingData?: SuspendingData; } /** * Defines the policy of the QueuedRequest. */ export interface QueueingPolicy { /** * Optional. A relative time after which resources may be created. */ validAfterDuration?: number /* Duration */; /** * Optional. An absolute time after which resources may be created. */ validAfterTime?: Date; /** * Optional. An absolute time interval within which resources may be created. */ validInterval?: Interval; /** * Optional. A relative time after which resources should not be created. If * the request cannot be fulfilled by this time the request will be failed. */ validUntilDuration?: number /* Duration */; /** * Optional. An absolute time after which resources should not be created. If * the request cannot be fulfilled by this time the request will be failed. */ validUntilTime?: Date; } function serializeQueueingPolicy(data: any): QueueingPolicy { return { ...data, validAfterDuration: data["validAfterDuration"] !== undefined ? data["validAfterDuration"] : undefined, validAfterTime: data["validAfterTime"] !== undefined ? data["validAfterTime"].toISOString() : undefined, validInterval: data["validInterval"] !== undefined ? serializeInterval(data["validInterval"]) : undefined, validUntilDuration: data["validUntilDuration"] !== undefined ? data["validUntilDuration"] : undefined, validUntilTime: data["validUntilTime"] !== undefined ? data["validUntilTime"].toISOString() : undefined, }; } function deserializeQueueingPolicy(data: any): QueueingPolicy { return { ...data, validAfterDuration: data["validAfterDuration"] !== undefined ? data["validAfterDuration"] : undefined, validAfterTime: data["validAfterTime"] !== undefined ? new Date(data["validAfterTime"]) : undefined, validInterval: data["validInterval"] !== undefined ? deserializeInterval(data["validInterval"]) : undefined, validUntilDuration: data["validUntilDuration"] !== undefined ? data["validUntilDuration"] : undefined, validUntilTime: data["validUntilTime"] !== undefined ? new Date(data["validUntilTime"]) : undefined, }; } /** * Request for ResetQueuedResource. */ export interface ResetQueuedResourceRequest { } /** * A runtime version that a Node can be configured with. */ export interface RuntimeVersion { /** * The resource name. */ name?: string; /** * The runtime version. */ version?: string; } /** * Sets the scheduling options for this node. */ export interface SchedulingConfig { /** * Defines whether the node is preemptible. */ preemptible?: boolean; /** * Whether the node is created under a reservation. */ reserved?: boolean; /** * Optional. Defines whether the node is Spot VM. */ spot?: boolean; } /** * A service account. */ export interface ServiceAccount { /** * Email address of the service account. If empty, default Compute service * account will be used. */ email?: string; /** * The list of scopes to be made available for this service account. If * empty, access to all Cloud APIs will be allowed. */ scope?: string[]; } /** * The per-product per-project service identity for Cloud TPU service. */ export interface ServiceIdentity { /** * The email address of the service identity. */ email?: string; } /** * A set of Shielded Instance options. */ export interface ShieldedInstanceConfig { /** * Defines whether the instance has Secure Boot enabled. */ enableSecureBoot?: boolean; } /** * Spot tier definition. */ export interface Spot { } /** * Request for StartNode. */ export interface StartNodeRequest { } /** * The `Status` type defines a logical error model that is suitable for * different programming environments, including REST APIs and RPC APIs. It is * used by [gRPC](https://github.com/grpc). Each `Status` message contains three * pieces of data: error code, error message, and error details. You can find * out more about this error model and how to work with it in the [API Design * Guide](https://cloud.google.com/apis/design/errors). */ export interface Status { /** * The status code, which should be an enum value of google.rpc.Code. */ code?: number; /** * A list of messages that carry the error details. There is a common set of * message types for APIs to use. */ details?: { [key: string]: any }[]; /** * 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. */ message?: string; } /** * Request for StopNode. */ export interface StopNodeRequest { } /** * Further data for the suspended state. */ export interface SuspendedData { } /** * Further data for the suspending state. */ export interface SuspendingData { } /** * A Symptom instance. */ export interface Symptom { /** * Timestamp when the Symptom is created. */ createTime?: Date; /** * Detailed information of the current Symptom. */ details?: string; /** * Type of the Symptom. */ symptomType?: | "SYMPTOM_TYPE_UNSPECIFIED" | "LOW_MEMORY" | "OUT_OF_MEMORY" | "EXECUTE_TIMED_OUT" | "MESH_BUILD_FAIL" | "HBM_OUT_OF_MEMORY" | "PROJECT_ABUSE"; /** * A string used to uniquely distinguish a worker within a TPU node. */ workerId?: string; } function serializeSymptom(data: any): Symptom { return { ...data, createTime: data["createTime"] !== undefined ? data["createTime"].toISOString() : undefined, }; } function deserializeSymptom(data: any): Symptom { return { ...data, createTime: data["createTime"] !== undefined ? new Date(data["createTime"]) : undefined, }; } /** * Details of the TPU resource(s) being requested. */ export interface Tpu { /** * Optional. The TPU node(s) being requested. */ nodeSpec?: NodeSpec[]; }