diff --git a/packages/google-cloud-tpu/README.md b/packages/google-cloud-tpu/README.md index 6c793806300..458674d5e4b 100644 --- a/packages/google-cloud-tpu/README.md +++ b/packages/google-cloud-tpu/README.md @@ -129,7 +129,10 @@ Samples are in the [`samples/`](https://github.com/googleapis/google-cloud-node/ | Tpu.list_accelerator_types | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_accelerator_types.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_accelerator_types.js,packages/google-cloud-tpu/samples/README.md) | | Tpu.list_nodes | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_nodes.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_nodes.js,packages/google-cloud-tpu/samples/README.md) | | Tpu.list_queued_resources | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_queued_resources.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_queued_resources.js,packages/google-cloud-tpu/samples/README.md) | +| Tpu.list_reservations | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_reservations.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_reservations.js,packages/google-cloud-tpu/samples/README.md) | | Tpu.list_runtime_versions | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_runtime_versions.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_runtime_versions.js,packages/google-cloud-tpu/samples/README.md) | +| Tpu.perform_maintenance | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.perform_maintenance.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.perform_maintenance.js,packages/google-cloud-tpu/samples/README.md) | +| Tpu.perform_maintenance_queued_resource | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.perform_maintenance_queued_resource.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.perform_maintenance_queued_resource.js,packages/google-cloud-tpu/samples/README.md) | | Tpu.reset_queued_resource | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.reset_queued_resource.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.reset_queued_resource.js,packages/google-cloud-tpu/samples/README.md) | | Tpu.simulate_maintenance_event | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.simulate_maintenance_event.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.simulate_maintenance_event.js,packages/google-cloud-tpu/samples/README.md) | | Tpu.start_node | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.start_node.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.start_node.js,packages/google-cloud-tpu/samples/README.md) | diff --git a/packages/google-cloud-tpu/protos/google/cloud/tpu/v2alpha1/cloud_tpu.proto b/packages/google-cloud-tpu/protos/google/cloud/tpu/v2alpha1/cloud_tpu.proto index 7bddd747f2e..657a871286b 100644 --- a/packages/google-cloud-tpu/protos/google/cloud/tpu/v2alpha1/cloud_tpu.proto +++ b/packages/google-cloud-tpu/protos/google/cloud/tpu/v2alpha1/cloud_tpu.proto @@ -19,6 +19,7 @@ package google.cloud.tpu.v2alpha1; import "google/api/annotations.proto"; import "google/api/client.proto"; import "google/api/field_behavior.proto"; +import "google/api/field_info.proto"; import "google/api/resource.proto"; import "google/longrunning/operations.proto"; import "google/protobuf/duration.proto"; @@ -119,6 +120,19 @@ service Tpu { }; } + // Perform manual maintenance on a node. + rpc PerformMaintenance(PerformMaintenanceRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2alpha1/{name=projects/*/locations/*/nodes/*}:performMaintenance" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "Node" + metadata_type: "OperationMetadata" + }; + } + // Lists queued resources. rpc ListQueuedResources(ListQueuedResourcesRequest) returns (ListQueuedResourcesResponse) { @@ -178,6 +192,19 @@ service Tpu { }; } + // Perform manual maintenance on specific nodes of a QueuedResource. + rpc PerformMaintenanceQueuedResource(PerformMaintenanceQueuedResourceRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2alpha1/{name=projects/*/locations/*/queuedResources/*}:performMaintenanceQueuedResource" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "QueuedResource" + metadata_type: "OperationMetadata" + }; + } + // Generates the Cloud TPU service identity for the project. rpc GenerateServiceIdentity(GenerateServiceIdentityRequest) returns (GenerateServiceIdentityResponse) { @@ -230,6 +257,14 @@ service Tpu { }; } + // Retrieves the reservations for the given project in the given location. + rpc ListReservations(ListReservationsRequest) + returns (ListReservationsResponse) { + option (google.api.http) = { + get: "/v2alpha1/{parent=projects/*/locations/*}/reservations" + }; + } + // Simulates a maintenance event. rpc SimulateMaintenanceEvent(SimulateMaintenanceEventRequest) returns (google.longrunning.Operation) { @@ -307,6 +342,9 @@ message SchedulingConfig { // Whether the node is created under a reservation. bool reserved = 2; + + // Optional. Defines whether the node is Spot VM. + bool spot = 3 [(google.api.field_behavior) = OPTIONAL]; } // A network endpoint over which a TPU worker can be reached. @@ -347,6 +385,10 @@ message NetworkConfig { // destination or source IPs. This is required if you plan to use the TPU // workers to forward routes. bool can_ip_forward = 4; + + // Optional. Specifies networking queue count for TPU VM instance's network + // interface. + int32 queue_count = 6 [(google.api.field_behavior) = OPTIONAL]; } // A service account. @@ -415,6 +457,9 @@ message Node { // TPU node is currently unhiding. UNHIDING = 15; + + // TPU node has unknown state after a failed repair. + UNKNOWN = 16; } // Health defines the status of a TPU node as reported by @@ -474,9 +519,18 @@ message Node { // Required. The runtime version running in the Node. string runtime_version = 11 [(google.api.field_behavior) = REQUIRED]; - // Network configurations for the TPU node. + // Network configurations for the TPU node. network_config and network_configs + // are mutually exclusive, you can only specify one of them. If both are + // specified, an error will be returned. NetworkConfig network_config = 36; + // Optional. Repeated network configurations for the TPU node. This field is + // used to specify multiple networks configs for the TPU node. network_config + // and network_configs are mutually exclusive, you can only specify one of + // them. If both are specified, an error will be returned. + repeated NetworkConfig network_configs = 50 + [(google.api.field_behavior) = OPTIONAL]; + // 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 @@ -543,8 +597,15 @@ message Node { // Output only. Whether the Node belongs to a Multislice group. bool multislice_node = 47 [(google.api.field_behavior) = OUTPUT_ONLY]; + // Optional. Whether Autocheckpoint is enabled. + bool autocheckpoint_enabled = 48 [(google.api.field_behavior) = OPTIONAL]; + // Optional. Boot disk configuration. BootDiskConfig boot_disk_config = 49 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. Upcoming maintenance on this TPU node. + UpcomingMaintenance upcoming_maintenance = 51 + [(google.api.field_behavior) = OUTPUT_ONLY]; } // A QueuedResource represents a request for resources that will be placed @@ -565,6 +626,20 @@ message QueuedResource { // field must be populated in case of multi-node requests instead of // node_id. It's an error to specify both node_id and multi_node_params. message MultiNodeParams { + // The workload type for the multi-node request. + enum WorkloadType { + // Not specified. + WORKLOAD_TYPE_UNSPECIFIED = 0; + + // All of the nodes are available most of the time. + // Recommended for training workloads. + THROUGHPUT_OPTIMIZED = 1; + + // Most of the nodes are available all of the time. + // Recommended for serving workloads. + AVAILABILITY_OPTIMIZED = 2; + } + // 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. @@ -576,6 +651,9 @@ message QueuedResource { // 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. string node_id_prefix = 2; + + // Optional. The workload type for the multi-node request. + WorkloadType workload_type = 4 [(google.api.field_behavior) = OPTIONAL]; } // Required. The parent resource name. @@ -653,6 +731,10 @@ message QueuedResource { (google.api.field_behavior) = IMMUTABLE ]; + // Output only. The time when the QueuedResource was created. + google.protobuf.Timestamp create_time = 11 + [(google.api.field_behavior) = OUTPUT_ONLY]; + // Resource specification. oneof resource { // Defines a TPU resource. @@ -805,7 +887,9 @@ message QueuedResourceState { SuspendedData suspended_data = 9; } - // Output only. The initiator of the QueuedResources's current state. + // 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. StateInitiator state_initiator = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; } @@ -1267,6 +1351,145 @@ message SimulateMaintenanceEventRequest { repeated string worker_ids = 2; } +// Request for +// [PerformMaintenance][google.cloud.tpu.v2alpha1.Tpu.PerformMaintenance]. +message PerformMaintenanceRequest { + // Required. The resource name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "tpu.googleapis.com/Node" } + ]; +} + +// Request for +// [PerformMaintenanceQueuedResource][google.cloud.tpu.v2alpha1.Tpu.PerformMaintenanceQueuedResource]. +message PerformMaintenanceQueuedResourceRequest { + // Required. The name of the QueuedResource which holds the nodes to perform + // maintenance on. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "tpu.googleapis.com/QueuedResource" + } + ]; + + // The names of the nodes to perform maintenance on. + repeated string node_names = 2; +} + +// A reservation describes the amount of a resource 'allotted' for a defined +// period of time. +message Reservation { + option (google.api.resource) = { + type: "tpu.googleapis.com/Reservation" + pattern: "projects/{project}/locations/{location}/reservations/{reservation}" + }; + + // Details of a standard reservation. + message Standard { + // Units in which capacity for a reservation is measured. + enum CapacityUnits { + // The capacity units is not known/set. + CAPACITY_UNITS_UNSPECIFIED = 0; + + // The capacity unit is set to CORES. + CORES = 1; + + // The capacity unit is set to CHIPS. + CHIPS = 2; + } + + // Usage details of a reservation. + message Usage { + // The real-time value of usage within the reservation, with the unit + // specified in field capacity_units. + int64 total = 1; + } + + // The size of the reservation, in the units specified in the + // 'capacity_units' field. + int32 size = 1; + + // Capacity units this reservation is measured in. + CapacityUnits capacity_units = 2; + + // The resource type of the reservation. + string resource_type = 3; + + // The start and end time of the reservation. + google.type.Interval interval = 4; + + // The current usage of the reservation. + Usage usage = 5; + } + + // State of the Reservation. + enum State { + // The Reservation state is unspecified. + STATE_UNSPECIFIED = 0; + + // The Reservation has been approved. + APPROVED = 3; + + // The Reservation is being provisioned. + PROVISIONING = 4; + + // The Reservation is active. + ACTIVE = 5; + + // The Reservation is being deprovisioned. + DEPROVISIONING = 6; + + // The Reservation is past its end date. + EXPIRED = 7; + + // The Reservation encountered a failure during mutation. + FAILED = 8; + } + + // The reservation name with the format: + // projects/{projectID}/locations/{location}/reservations/{reservationID} + string name = 1; + + // The kind of reservation. + oneof kind { + // A standard reservation. + Standard standard = 2; + } + + // Output only. The state of the Reservation. + State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request for +// [ListReservations][google.cloud.tpu.v2alpha1.Tpu.ListReservations]. +message ListReservationsRequest { + // Required. The parent for reservations. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "tpu.googleapis.com/Reservation" + } + ]; + + // The maximum number of items to return. Defaults to 0 if not specified, + // which means no limit. + int32 page_size = 2; + + // The next_page_token value returned from a previous List request, if any. + string page_token = 3; +} + +// Response for +// [ListReservations][google.cloud.tpu.v2alpha1.Tpu.ListReservations]. +message ListReservationsResponse { + // The listed reservations. + repeated Reservation reservations = 1; + + // The next page token or empty if none. + string next_page_token = 2; +} + // A TPU accelerator configuration. message AcceleratorConfig { // TPU type. @@ -1282,6 +1505,15 @@ message AcceleratorConfig { // TPU v4. V4 = 7; + + // TPU v5lite pod. + V5LITE_POD = 9; + + // TPU v5. + V5P = 10; + + // TPU v6e. + V6E = 11; } // Required. Type of TPU. @@ -1328,3 +1560,53 @@ message CustomerEncryptionKey { string kms_key_name = 7; } } + +// Upcoming Maintenance notification information. +message UpcomingMaintenance { + // The type of maintenance for this notification. + enum MaintenanceType { + // No type specified. Do not use this value. + UNKNOWN_TYPE = 0; + + // Scheduled maintenance (e.g. maintenance after uptime guarantee is + // complete). + SCHEDULED = 1; + + // Unscheduled maintenance (e.g. emergency maintenance during + // uptime guarantee). + UNSCHEDULED = 2; + } + + // The status of the maintenance for this notification. + enum MaintenanceStatus { + // Unknown maintenance status. Do not use this value. + UNKNOWN = 0; + + // There is pending maintenance. + PENDING = 1; + + // There is ongoing maintenance on this VM. + ONGOING = 2; + } + + // Defines the type of maintenance. + optional MaintenanceType type = 1; + + // Indicates if the maintenance can be customer triggered. + optional bool can_reschedule = 5; + + // The current start time of the maintenance window. + // This timestamp value is in RFC3339 text format. + optional string window_start_time = 6; + + // The time by which the maintenance disruption will be completed. + // This timestamp value is in RFC3339 text format. + optional string window_end_time = 7; + + // The latest time for the planned maintenance window to start. + // This timestamp value is in RFC3339 text format. + optional string latest_window_start_time = 8; + + // The status of the maintenance. + optional MaintenanceStatus maintenance_status = 9; +} diff --git a/packages/google-cloud-tpu/protos/protos.d.ts b/packages/google-cloud-tpu/protos/protos.d.ts index f8a5191cb45..31669253679 100644 --- a/packages/google-cloud-tpu/protos/protos.d.ts +++ b/packages/google-cloud-tpu/protos/protos.d.ts @@ -9433,6 +9433,20 @@ export namespace google { */ public updateNode(request: google.cloud.tpu.v2alpha1.IUpdateNodeRequest): Promise; + /** + * Calls PerformMaintenance. + * @param request PerformMaintenanceRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public performMaintenance(request: google.cloud.tpu.v2alpha1.IPerformMaintenanceRequest, callback: google.cloud.tpu.v2alpha1.Tpu.PerformMaintenanceCallback): void; + + /** + * Calls PerformMaintenance. + * @param request PerformMaintenanceRequest message or plain object + * @returns Promise + */ + public performMaintenance(request: google.cloud.tpu.v2alpha1.IPerformMaintenanceRequest): Promise; + /** * Calls ListQueuedResources. * @param request ListQueuedResourcesRequest message or plain object @@ -9503,6 +9517,20 @@ export namespace google { */ public resetQueuedResource(request: google.cloud.tpu.v2alpha1.IResetQueuedResourceRequest): Promise; + /** + * Calls PerformMaintenanceQueuedResource. + * @param request PerformMaintenanceQueuedResourceRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public performMaintenanceQueuedResource(request: google.cloud.tpu.v2alpha1.IPerformMaintenanceQueuedResourceRequest, callback: google.cloud.tpu.v2alpha1.Tpu.PerformMaintenanceQueuedResourceCallback): void; + + /** + * Calls PerformMaintenanceQueuedResource. + * @param request PerformMaintenanceQueuedResourceRequest message or plain object + * @returns Promise + */ + public performMaintenanceQueuedResource(request: google.cloud.tpu.v2alpha1.IPerformMaintenanceQueuedResourceRequest): Promise; + /** * Calls GenerateServiceIdentity. * @param request GenerateServiceIdentityRequest message or plain object @@ -9587,6 +9615,20 @@ export namespace google { */ public getGuestAttributes(request: google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest): Promise; + /** + * Calls ListReservations. + * @param request ListReservationsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListReservationsResponse + */ + public listReservations(request: google.cloud.tpu.v2alpha1.IListReservationsRequest, callback: google.cloud.tpu.v2alpha1.Tpu.ListReservationsCallback): void; + + /** + * Calls ListReservations. + * @param request ListReservationsRequest message or plain object + * @returns Promise + */ + public listReservations(request: google.cloud.tpu.v2alpha1.IListReservationsRequest): Promise; + /** * Calls SimulateMaintenanceEvent. * @param request SimulateMaintenanceEventRequest message or plain object @@ -9653,6 +9695,13 @@ export namespace google { */ type UpdateNodeCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|performMaintenance}. + * @param error Error, if any + * @param [response] Operation + */ + type PerformMaintenanceCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + /** * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|listQueuedResources}. * @param error Error, if any @@ -9688,6 +9737,13 @@ export namespace google { */ type ResetQueuedResourceCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|performMaintenanceQueuedResource}. + * @param error Error, if any + * @param [response] Operation + */ + type PerformMaintenanceQueuedResourceCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + /** * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|generateServiceIdentity}. * @param error Error, if any @@ -9730,6 +9786,13 @@ export namespace google { */ type GetGuestAttributesCallback = (error: (Error|null), response?: google.cloud.tpu.v2alpha1.GetGuestAttributesResponse) => void; + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|listReservations}. + * @param error Error, if any + * @param [response] ListReservationsResponse + */ + type ListReservationsCallback = (error: (Error|null), response?: google.cloud.tpu.v2alpha1.ListReservationsResponse) => void; + /** * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|simulateMaintenanceEvent}. * @param error Error, if any @@ -10168,6 +10231,9 @@ export namespace google { /** SchedulingConfig reserved */ reserved?: (boolean|null); + + /** SchedulingConfig spot */ + spot?: (boolean|null); } /** Represents a SchedulingConfig. */ @@ -10185,6 +10251,9 @@ export namespace google { /** SchedulingConfig reserved. */ public reserved: boolean; + /** SchedulingConfig spot. */ + public spot: boolean; + /** * Creates a new SchedulingConfig instance using the specified properties. * @param [properties] Properties to set @@ -10483,6 +10552,9 @@ export namespace google { /** NetworkConfig canIpForward */ canIpForward?: (boolean|null); + + /** NetworkConfig queueCount */ + queueCount?: (number|null); } /** Represents a NetworkConfig. */ @@ -10506,6 +10578,9 @@ export namespace google { /** NetworkConfig canIpForward. */ public canIpForward: boolean; + /** NetworkConfig queueCount. */ + public queueCount: number; + /** * Creates a new NetworkConfig instance using the specified properties. * @param [properties] Properties to set @@ -10711,6 +10786,9 @@ export namespace google { /** Node networkConfig */ networkConfig?: (google.cloud.tpu.v2alpha1.INetworkConfig|null); + /** Node networkConfigs */ + networkConfigs?: (google.cloud.tpu.v2alpha1.INetworkConfig[]|null); + /** Node cidrBlock */ cidrBlock?: (string|null); @@ -10762,8 +10840,14 @@ export namespace google { /** Node multisliceNode */ multisliceNode?: (boolean|null); + /** Node autocheckpointEnabled */ + autocheckpointEnabled?: (boolean|null); + /** Node bootDiskConfig */ bootDiskConfig?: (google.cloud.tpu.v2alpha1.IBootDiskConfig|null); + + /** Node upcomingMaintenance */ + upcomingMaintenance?: (google.cloud.tpu.v2alpha1.IUpcomingMaintenance|null); } /** Represents a Node. */ @@ -10796,6 +10880,9 @@ export namespace google { /** Node networkConfig. */ public networkConfig?: (google.cloud.tpu.v2alpha1.INetworkConfig|null); + /** Node networkConfigs. */ + public networkConfigs: google.cloud.tpu.v2alpha1.INetworkConfig[]; + /** Node cidrBlock. */ public cidrBlock: string; @@ -10847,9 +10934,15 @@ export namespace google { /** Node multisliceNode. */ public multisliceNode: boolean; + /** Node autocheckpointEnabled. */ + public autocheckpointEnabled: boolean; + /** Node bootDiskConfig. */ public bootDiskConfig?: (google.cloud.tpu.v2alpha1.IBootDiskConfig|null); + /** Node upcomingMaintenance. */ + public upcomingMaintenance?: (google.cloud.tpu.v2alpha1.IUpcomingMaintenance|null); + /** * Creates a new Node instance using the specified properties. * @param [properties] Properties to set @@ -10946,7 +11039,8 @@ export namespace google { TERMINATED = 12, HIDING = 13, HIDDEN = 14, - UNHIDING = 15 + UNHIDING = 15, + UNKNOWN = 16 } /** Health enum. */ @@ -10973,6 +11067,9 @@ export namespace google { /** QueuedResource name */ name?: (string|null); + /** QueuedResource createTime */ + createTime?: (google.protobuf.ITimestamp|null); + /** QueuedResource tpu */ tpu?: (google.cloud.tpu.v2alpha1.QueuedResource.ITpu|null); @@ -11007,6 +11104,9 @@ export namespace google { /** QueuedResource name. */ public name: string; + /** QueuedResource createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + /** QueuedResource tpu. */ public tpu?: (google.cloud.tpu.v2alpha1.QueuedResource.ITpu|null); @@ -11338,6 +11438,9 @@ export namespace google { /** MultiNodeParams nodeIdPrefix */ nodeIdPrefix?: (string|null); + + /** MultiNodeParams workloadType */ + workloadType?: (google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec.MultiNodeParams.WorkloadType|keyof typeof google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec.MultiNodeParams.WorkloadType|null); } /** Represents a MultiNodeParams. */ @@ -11355,6 +11458,9 @@ export namespace google { /** MultiNodeParams nodeIdPrefix. */ public nodeIdPrefix: string; + /** MultiNodeParams workloadType. */ + public workloadType: (google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec.MultiNodeParams.WorkloadType|keyof typeof google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec.MultiNodeParams.WorkloadType); + /** * Creates a new MultiNodeParams instance using the specified properties. * @param [properties] Properties to set @@ -11432,6 +11538,16 @@ export namespace google { */ public static getTypeUrl(typeUrlPrefix?: string): string; } + + namespace MultiNodeParams { + + /** WorkloadType enum. */ + enum WorkloadType { + WORKLOAD_TYPE_UNSPECIFIED = 0, + THROUGHPUT_OPTIMIZED = 1, + AVAILABILITY_OPTIMIZED = 2 + } + } } } @@ -15951,381 +16067,1150 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of an AcceleratorConfig. */ - interface IAcceleratorConfig { - - /** AcceleratorConfig type */ - type?: (google.cloud.tpu.v2alpha1.AcceleratorConfig.Type|keyof typeof google.cloud.tpu.v2alpha1.AcceleratorConfig.Type|null); + /** Properties of a PerformMaintenanceRequest. */ + interface IPerformMaintenanceRequest { - /** AcceleratorConfig topology */ - topology?: (string|null); + /** PerformMaintenanceRequest name */ + name?: (string|null); } - /** Represents an AcceleratorConfig. */ - class AcceleratorConfig implements IAcceleratorConfig { + /** Represents a PerformMaintenanceRequest. */ + class PerformMaintenanceRequest implements IPerformMaintenanceRequest { /** - * Constructs a new AcceleratorConfig. + * Constructs a new PerformMaintenanceRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.tpu.v2alpha1.IAcceleratorConfig); - - /** AcceleratorConfig type. */ - public type: (google.cloud.tpu.v2alpha1.AcceleratorConfig.Type|keyof typeof google.cloud.tpu.v2alpha1.AcceleratorConfig.Type); + constructor(properties?: google.cloud.tpu.v2alpha1.IPerformMaintenanceRequest); - /** AcceleratorConfig topology. */ - public topology: string; + /** PerformMaintenanceRequest name. */ + public name: string; /** - * Creates a new AcceleratorConfig instance using the specified properties. + * Creates a new PerformMaintenanceRequest instance using the specified properties. * @param [properties] Properties to set - * @returns AcceleratorConfig instance + * @returns PerformMaintenanceRequest instance */ - public static create(properties?: google.cloud.tpu.v2alpha1.IAcceleratorConfig): google.cloud.tpu.v2alpha1.AcceleratorConfig; + public static create(properties?: google.cloud.tpu.v2alpha1.IPerformMaintenanceRequest): google.cloud.tpu.v2alpha1.PerformMaintenanceRequest; /** - * Encodes the specified AcceleratorConfig message. Does not implicitly {@link google.cloud.tpu.v2alpha1.AcceleratorConfig.verify|verify} messages. - * @param message AcceleratorConfig message or plain object to encode + * Encodes the specified PerformMaintenanceRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.PerformMaintenanceRequest.verify|verify} messages. + * @param message PerformMaintenanceRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.tpu.v2alpha1.IAcceleratorConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.tpu.v2alpha1.IPerformMaintenanceRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified AcceleratorConfig message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.AcceleratorConfig.verify|verify} messages. - * @param message AcceleratorConfig message or plain object to encode + * Encodes the specified PerformMaintenanceRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.PerformMaintenanceRequest.verify|verify} messages. + * @param message PerformMaintenanceRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IAcceleratorConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IPerformMaintenanceRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an AcceleratorConfig message from the specified reader or buffer. + * Decodes a PerformMaintenanceRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns AcceleratorConfig + * @returns PerformMaintenanceRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.tpu.v2alpha1.AcceleratorConfig; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.tpu.v2alpha1.PerformMaintenanceRequest; /** - * Decodes an AcceleratorConfig message from the specified reader or buffer, length delimited. + * Decodes a PerformMaintenanceRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns AcceleratorConfig + * @returns PerformMaintenanceRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.tpu.v2alpha1.AcceleratorConfig; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.tpu.v2alpha1.PerformMaintenanceRequest; /** - * Verifies an AcceleratorConfig message. + * Verifies a PerformMaintenanceRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an AcceleratorConfig message from a plain object. Also converts values to their respective internal types. + * Creates a PerformMaintenanceRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns AcceleratorConfig + * @returns PerformMaintenanceRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.AcceleratorConfig; + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.PerformMaintenanceRequest; /** - * Creates a plain object from an AcceleratorConfig message. Also converts values to other types if specified. - * @param message AcceleratorConfig + * Creates a plain object from a PerformMaintenanceRequest message. Also converts values to other types if specified. + * @param message PerformMaintenanceRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.tpu.v2alpha1.AcceleratorConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.tpu.v2alpha1.PerformMaintenanceRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this AcceleratorConfig to JSON. + * Converts this PerformMaintenanceRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for AcceleratorConfig + * Gets the default type url for PerformMaintenanceRequest * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - namespace AcceleratorConfig { - - /** Type enum. */ - enum Type { - TYPE_UNSPECIFIED = 0, - V2 = 2, - V3 = 4, - V4 = 7 - } - } + /** Properties of a PerformMaintenanceQueuedResourceRequest. */ + interface IPerformMaintenanceQueuedResourceRequest { - /** Properties of a ShieldedInstanceConfig. */ - interface IShieldedInstanceConfig { + /** PerformMaintenanceQueuedResourceRequest name */ + name?: (string|null); - /** ShieldedInstanceConfig enableSecureBoot */ - enableSecureBoot?: (boolean|null); + /** PerformMaintenanceQueuedResourceRequest nodeNames */ + nodeNames?: (string[]|null); } - /** Represents a ShieldedInstanceConfig. */ - class ShieldedInstanceConfig implements IShieldedInstanceConfig { + /** Represents a PerformMaintenanceQueuedResourceRequest. */ + class PerformMaintenanceQueuedResourceRequest implements IPerformMaintenanceQueuedResourceRequest { /** - * Constructs a new ShieldedInstanceConfig. + * Constructs a new PerformMaintenanceQueuedResourceRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.tpu.v2alpha1.IShieldedInstanceConfig); + constructor(properties?: google.cloud.tpu.v2alpha1.IPerformMaintenanceQueuedResourceRequest); - /** ShieldedInstanceConfig enableSecureBoot. */ - public enableSecureBoot: boolean; + /** PerformMaintenanceQueuedResourceRequest name. */ + public name: string; + + /** PerformMaintenanceQueuedResourceRequest nodeNames. */ + public nodeNames: string[]; /** - * Creates a new ShieldedInstanceConfig instance using the specified properties. + * Creates a new PerformMaintenanceQueuedResourceRequest instance using the specified properties. * @param [properties] Properties to set - * @returns ShieldedInstanceConfig instance + * @returns PerformMaintenanceQueuedResourceRequest instance */ - public static create(properties?: google.cloud.tpu.v2alpha1.IShieldedInstanceConfig): google.cloud.tpu.v2alpha1.ShieldedInstanceConfig; + public static create(properties?: google.cloud.tpu.v2alpha1.IPerformMaintenanceQueuedResourceRequest): google.cloud.tpu.v2alpha1.PerformMaintenanceQueuedResourceRequest; /** - * Encodes the specified ShieldedInstanceConfig message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ShieldedInstanceConfig.verify|verify} messages. - * @param message ShieldedInstanceConfig message or plain object to encode + * Encodes the specified PerformMaintenanceQueuedResourceRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.PerformMaintenanceQueuedResourceRequest.verify|verify} messages. + * @param message PerformMaintenanceQueuedResourceRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.tpu.v2alpha1.IShieldedInstanceConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.tpu.v2alpha1.IPerformMaintenanceQueuedResourceRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ShieldedInstanceConfig message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ShieldedInstanceConfig.verify|verify} messages. - * @param message ShieldedInstanceConfig message or plain object to encode + * Encodes the specified PerformMaintenanceQueuedResourceRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.PerformMaintenanceQueuedResourceRequest.verify|verify} messages. + * @param message PerformMaintenanceQueuedResourceRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IShieldedInstanceConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IPerformMaintenanceQueuedResourceRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ShieldedInstanceConfig message from the specified reader or buffer. + * Decodes a PerformMaintenanceQueuedResourceRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ShieldedInstanceConfig + * @returns PerformMaintenanceQueuedResourceRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.tpu.v2alpha1.ShieldedInstanceConfig; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.tpu.v2alpha1.PerformMaintenanceQueuedResourceRequest; /** - * Decodes a ShieldedInstanceConfig message from the specified reader or buffer, length delimited. + * Decodes a PerformMaintenanceQueuedResourceRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ShieldedInstanceConfig + * @returns PerformMaintenanceQueuedResourceRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.tpu.v2alpha1.ShieldedInstanceConfig; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.tpu.v2alpha1.PerformMaintenanceQueuedResourceRequest; /** - * Verifies a ShieldedInstanceConfig message. + * Verifies a PerformMaintenanceQueuedResourceRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ShieldedInstanceConfig message from a plain object. Also converts values to their respective internal types. + * Creates a PerformMaintenanceQueuedResourceRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ShieldedInstanceConfig + * @returns PerformMaintenanceQueuedResourceRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.ShieldedInstanceConfig; + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.PerformMaintenanceQueuedResourceRequest; /** - * Creates a plain object from a ShieldedInstanceConfig message. Also converts values to other types if specified. - * @param message ShieldedInstanceConfig + * Creates a plain object from a PerformMaintenanceQueuedResourceRequest message. Also converts values to other types if specified. + * @param message PerformMaintenanceQueuedResourceRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.tpu.v2alpha1.ShieldedInstanceConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.tpu.v2alpha1.PerformMaintenanceQueuedResourceRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ShieldedInstanceConfig to JSON. + * Converts this PerformMaintenanceQueuedResourceRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for ShieldedInstanceConfig + * Gets the default type url for PerformMaintenanceQueuedResourceRequest * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of a BootDiskConfig. */ - interface IBootDiskConfig { + /** Properties of a Reservation. */ + interface IReservation { - /** BootDiskConfig customerEncryptionKey */ - customerEncryptionKey?: (google.cloud.tpu.v2alpha1.ICustomerEncryptionKey|null); + /** Reservation name */ + name?: (string|null); - /** BootDiskConfig enableConfidentialCompute */ - enableConfidentialCompute?: (boolean|null); + /** Reservation standard */ + standard?: (google.cloud.tpu.v2alpha1.Reservation.IStandard|null); + + /** Reservation state */ + state?: (google.cloud.tpu.v2alpha1.Reservation.State|keyof typeof google.cloud.tpu.v2alpha1.Reservation.State|null); } - /** Represents a BootDiskConfig. */ - class BootDiskConfig implements IBootDiskConfig { + /** Represents a Reservation. */ + class Reservation implements IReservation { /** - * Constructs a new BootDiskConfig. + * Constructs a new Reservation. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.tpu.v2alpha1.IBootDiskConfig); + constructor(properties?: google.cloud.tpu.v2alpha1.IReservation); - /** BootDiskConfig customerEncryptionKey. */ - public customerEncryptionKey?: (google.cloud.tpu.v2alpha1.ICustomerEncryptionKey|null); + /** Reservation name. */ + public name: string; - /** BootDiskConfig enableConfidentialCompute. */ - public enableConfidentialCompute: boolean; + /** Reservation standard. */ + public standard?: (google.cloud.tpu.v2alpha1.Reservation.IStandard|null); + + /** Reservation state. */ + public state: (google.cloud.tpu.v2alpha1.Reservation.State|keyof typeof google.cloud.tpu.v2alpha1.Reservation.State); + + /** Reservation kind. */ + public kind?: "standard"; /** - * Creates a new BootDiskConfig instance using the specified properties. + * Creates a new Reservation instance using the specified properties. * @param [properties] Properties to set - * @returns BootDiskConfig instance + * @returns Reservation instance */ - public static create(properties?: google.cloud.tpu.v2alpha1.IBootDiskConfig): google.cloud.tpu.v2alpha1.BootDiskConfig; + public static create(properties?: google.cloud.tpu.v2alpha1.IReservation): google.cloud.tpu.v2alpha1.Reservation; /** - * Encodes the specified BootDiskConfig message. Does not implicitly {@link google.cloud.tpu.v2alpha1.BootDiskConfig.verify|verify} messages. - * @param message BootDiskConfig message or plain object to encode + * Encodes the specified Reservation message. Does not implicitly {@link google.cloud.tpu.v2alpha1.Reservation.verify|verify} messages. + * @param message Reservation message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.tpu.v2alpha1.IBootDiskConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.tpu.v2alpha1.IReservation, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified BootDiskConfig message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.BootDiskConfig.verify|verify} messages. - * @param message BootDiskConfig message or plain object to encode + * Encodes the specified Reservation message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.Reservation.verify|verify} messages. + * @param message Reservation message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IBootDiskConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IReservation, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a BootDiskConfig message from the specified reader or buffer. + * Decodes a Reservation message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns BootDiskConfig + * @returns Reservation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.tpu.v2alpha1.BootDiskConfig; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.tpu.v2alpha1.Reservation; /** - * Decodes a BootDiskConfig message from the specified reader or buffer, length delimited. + * Decodes a Reservation message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns BootDiskConfig + * @returns Reservation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.tpu.v2alpha1.BootDiskConfig; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.tpu.v2alpha1.Reservation; /** - * Verifies a BootDiskConfig message. + * Verifies a Reservation message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a BootDiskConfig message from a plain object. Also converts values to their respective internal types. + * Creates a Reservation message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns BootDiskConfig + * @returns Reservation */ - public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.BootDiskConfig; + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.Reservation; /** - * Creates a plain object from a BootDiskConfig message. Also converts values to other types if specified. - * @param message BootDiskConfig + * Creates a plain object from a Reservation message. Also converts values to other types if specified. + * @param message Reservation * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.tpu.v2alpha1.BootDiskConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.tpu.v2alpha1.Reservation, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this BootDiskConfig to JSON. + * Converts this Reservation to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for BootDiskConfig + * Gets the default type url for Reservation * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of a CustomerEncryptionKey. */ - interface ICustomerEncryptionKey { + namespace Reservation { - /** CustomerEncryptionKey kmsKeyName */ - kmsKeyName?: (string|null); - } + /** Properties of a Standard. */ + interface IStandard { - /** Represents a CustomerEncryptionKey. */ - class CustomerEncryptionKey implements ICustomerEncryptionKey { + /** Standard size */ + size?: (number|null); - /** - * Constructs a new CustomerEncryptionKey. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.tpu.v2alpha1.ICustomerEncryptionKey); + /** Standard capacityUnits */ + capacityUnits?: (google.cloud.tpu.v2alpha1.Reservation.Standard.CapacityUnits|keyof typeof google.cloud.tpu.v2alpha1.Reservation.Standard.CapacityUnits|null); - /** CustomerEncryptionKey kmsKeyName. */ - public kmsKeyName?: (string|null); + /** Standard resourceType */ + resourceType?: (string|null); - /** CustomerEncryptionKey key. */ - public key?: "kmsKeyName"; + /** Standard interval */ + interval?: (google.type.IInterval|null); - /** - * Creates a new CustomerEncryptionKey instance using the specified properties. - * @param [properties] Properties to set - * @returns CustomerEncryptionKey instance - */ - public static create(properties?: google.cloud.tpu.v2alpha1.ICustomerEncryptionKey): google.cloud.tpu.v2alpha1.CustomerEncryptionKey; + /** Standard usage */ + usage?: (google.cloud.tpu.v2alpha1.Reservation.Standard.IUsage|null); + } - /** - * Encodes the specified CustomerEncryptionKey message. Does not implicitly {@link google.cloud.tpu.v2alpha1.CustomerEncryptionKey.verify|verify} messages. - * @param message CustomerEncryptionKey message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.tpu.v2alpha1.ICustomerEncryptionKey, writer?: $protobuf.Writer): $protobuf.Writer; + /** Represents a Standard. */ + class Standard implements IStandard { - /** - * Encodes the specified CustomerEncryptionKey message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.CustomerEncryptionKey.verify|verify} messages. - * @param message CustomerEncryptionKey message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.tpu.v2alpha1.ICustomerEncryptionKey, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Constructs a new Standard. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.Reservation.IStandard); - /** - * Decodes a CustomerEncryptionKey message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns CustomerEncryptionKey - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.tpu.v2alpha1.CustomerEncryptionKey; + /** Standard size. */ + public size: number; - /** - * Decodes a CustomerEncryptionKey message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns CustomerEncryptionKey - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + /** Standard capacityUnits. */ + public capacityUnits: (google.cloud.tpu.v2alpha1.Reservation.Standard.CapacityUnits|keyof typeof google.cloud.tpu.v2alpha1.Reservation.Standard.CapacityUnits); + + /** Standard resourceType. */ + public resourceType: string; + + /** Standard interval. */ + public interval?: (google.type.IInterval|null); + + /** Standard usage. */ + public usage?: (google.cloud.tpu.v2alpha1.Reservation.Standard.IUsage|null); + + /** + * Creates a new Standard instance using the specified properties. + * @param [properties] Properties to set + * @returns Standard instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.Reservation.IStandard): google.cloud.tpu.v2alpha1.Reservation.Standard; + + /** + * Encodes the specified Standard message. Does not implicitly {@link google.cloud.tpu.v2alpha1.Reservation.Standard.verify|verify} messages. + * @param message Standard message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.Reservation.IStandard, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Standard message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.Reservation.Standard.verify|verify} messages. + * @param message Standard message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.Reservation.IStandard, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Standard message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Standard + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.tpu.v2alpha1.Reservation.Standard; + + /** + * Decodes a Standard message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Standard + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.tpu.v2alpha1.Reservation.Standard; + + /** + * Verifies a Standard message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Standard message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Standard + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.Reservation.Standard; + + /** + * Creates a plain object from a Standard message. Also converts values to other types if specified. + * @param message Standard + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.Reservation.Standard, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Standard to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Standard + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Standard { + + /** CapacityUnits enum. */ + enum CapacityUnits { + CAPACITY_UNITS_UNSPECIFIED = 0, + CORES = 1, + CHIPS = 2 + } + + /** Properties of a Usage. */ + interface IUsage { + + /** Usage total */ + total?: (number|Long|string|null); + } + + /** Represents a Usage. */ + class Usage implements IUsage { + + /** + * Constructs a new Usage. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.Reservation.Standard.IUsage); + + /** Usage total. */ + public total: (number|Long|string); + + /** + * Creates a new Usage instance using the specified properties. + * @param [properties] Properties to set + * @returns Usage instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.Reservation.Standard.IUsage): google.cloud.tpu.v2alpha1.Reservation.Standard.Usage; + + /** + * Encodes the specified Usage message. Does not implicitly {@link google.cloud.tpu.v2alpha1.Reservation.Standard.Usage.verify|verify} messages. + * @param message Usage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.Reservation.Standard.IUsage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Usage message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.Reservation.Standard.Usage.verify|verify} messages. + * @param message Usage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.Reservation.Standard.IUsage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Usage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Usage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.tpu.v2alpha1.Reservation.Standard.Usage; + + /** + * Decodes a Usage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Usage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.tpu.v2alpha1.Reservation.Standard.Usage; + + /** + * Verifies a Usage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Usage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Usage + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.Reservation.Standard.Usage; + + /** + * Creates a plain object from a Usage message. Also converts values to other types if specified. + * @param message Usage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.Reservation.Standard.Usage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Usage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Usage + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + APPROVED = 3, + PROVISIONING = 4, + ACTIVE = 5, + DEPROVISIONING = 6, + EXPIRED = 7, + FAILED = 8 + } + } + + /** Properties of a ListReservationsRequest. */ + interface IListReservationsRequest { + + /** ListReservationsRequest parent */ + parent?: (string|null); + + /** ListReservationsRequest pageSize */ + pageSize?: (number|null); + + /** ListReservationsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListReservationsRequest. */ + class ListReservationsRequest implements IListReservationsRequest { + + /** + * Constructs a new ListReservationsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IListReservationsRequest); + + /** ListReservationsRequest parent. */ + public parent: string; + + /** ListReservationsRequest pageSize. */ + public pageSize: number; + + /** ListReservationsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListReservationsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListReservationsRequest instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IListReservationsRequest): google.cloud.tpu.v2alpha1.ListReservationsRequest; + + /** + * Encodes the specified ListReservationsRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListReservationsRequest.verify|verify} messages. + * @param message ListReservationsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IListReservationsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListReservationsRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListReservationsRequest.verify|verify} messages. + * @param message ListReservationsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IListReservationsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListReservationsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListReservationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.tpu.v2alpha1.ListReservationsRequest; + + /** + * Decodes a ListReservationsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListReservationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.tpu.v2alpha1.ListReservationsRequest; + + /** + * Verifies a ListReservationsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListReservationsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListReservationsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.ListReservationsRequest; + + /** + * Creates a plain object from a ListReservationsRequest message. Also converts values to other types if specified. + * @param message ListReservationsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.ListReservationsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListReservationsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListReservationsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListReservationsResponse. */ + interface IListReservationsResponse { + + /** ListReservationsResponse reservations */ + reservations?: (google.cloud.tpu.v2alpha1.IReservation[]|null); + + /** ListReservationsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListReservationsResponse. */ + class ListReservationsResponse implements IListReservationsResponse { + + /** + * Constructs a new ListReservationsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IListReservationsResponse); + + /** ListReservationsResponse reservations. */ + public reservations: google.cloud.tpu.v2alpha1.IReservation[]; + + /** ListReservationsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListReservationsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListReservationsResponse instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IListReservationsResponse): google.cloud.tpu.v2alpha1.ListReservationsResponse; + + /** + * Encodes the specified ListReservationsResponse message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListReservationsResponse.verify|verify} messages. + * @param message ListReservationsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IListReservationsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListReservationsResponse message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListReservationsResponse.verify|verify} messages. + * @param message ListReservationsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IListReservationsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListReservationsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListReservationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.tpu.v2alpha1.ListReservationsResponse; + + /** + * Decodes a ListReservationsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListReservationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.tpu.v2alpha1.ListReservationsResponse; + + /** + * Verifies a ListReservationsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListReservationsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListReservationsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.ListReservationsResponse; + + /** + * Creates a plain object from a ListReservationsResponse message. Also converts values to other types if specified. + * @param message ListReservationsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.ListReservationsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListReservationsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListReservationsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an AcceleratorConfig. */ + interface IAcceleratorConfig { + + /** AcceleratorConfig type */ + type?: (google.cloud.tpu.v2alpha1.AcceleratorConfig.Type|keyof typeof google.cloud.tpu.v2alpha1.AcceleratorConfig.Type|null); + + /** AcceleratorConfig topology */ + topology?: (string|null); + } + + /** Represents an AcceleratorConfig. */ + class AcceleratorConfig implements IAcceleratorConfig { + + /** + * Constructs a new AcceleratorConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IAcceleratorConfig); + + /** AcceleratorConfig type. */ + public type: (google.cloud.tpu.v2alpha1.AcceleratorConfig.Type|keyof typeof google.cloud.tpu.v2alpha1.AcceleratorConfig.Type); + + /** AcceleratorConfig topology. */ + public topology: string; + + /** + * Creates a new AcceleratorConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns AcceleratorConfig instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IAcceleratorConfig): google.cloud.tpu.v2alpha1.AcceleratorConfig; + + /** + * Encodes the specified AcceleratorConfig message. Does not implicitly {@link google.cloud.tpu.v2alpha1.AcceleratorConfig.verify|verify} messages. + * @param message AcceleratorConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IAcceleratorConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AcceleratorConfig message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.AcceleratorConfig.verify|verify} messages. + * @param message AcceleratorConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IAcceleratorConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AcceleratorConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AcceleratorConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.tpu.v2alpha1.AcceleratorConfig; + + /** + * Decodes an AcceleratorConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AcceleratorConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.tpu.v2alpha1.AcceleratorConfig; + + /** + * Verifies an AcceleratorConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AcceleratorConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AcceleratorConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.AcceleratorConfig; + + /** + * Creates a plain object from an AcceleratorConfig message. Also converts values to other types if specified. + * @param message AcceleratorConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.AcceleratorConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AcceleratorConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AcceleratorConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace AcceleratorConfig { + + /** Type enum. */ + enum Type { + TYPE_UNSPECIFIED = 0, + V2 = 2, + V3 = 4, + V4 = 7, + V5LITE_POD = 9, + V5P = 10, + V6E = 11 + } + } + + /** Properties of a ShieldedInstanceConfig. */ + interface IShieldedInstanceConfig { + + /** ShieldedInstanceConfig enableSecureBoot */ + enableSecureBoot?: (boolean|null); + } + + /** Represents a ShieldedInstanceConfig. */ + class ShieldedInstanceConfig implements IShieldedInstanceConfig { + + /** + * Constructs a new ShieldedInstanceConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IShieldedInstanceConfig); + + /** ShieldedInstanceConfig enableSecureBoot. */ + public enableSecureBoot: boolean; + + /** + * Creates a new ShieldedInstanceConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ShieldedInstanceConfig instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IShieldedInstanceConfig): google.cloud.tpu.v2alpha1.ShieldedInstanceConfig; + + /** + * Encodes the specified ShieldedInstanceConfig message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ShieldedInstanceConfig.verify|verify} messages. + * @param message ShieldedInstanceConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IShieldedInstanceConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ShieldedInstanceConfig message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ShieldedInstanceConfig.verify|verify} messages. + * @param message ShieldedInstanceConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IShieldedInstanceConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ShieldedInstanceConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ShieldedInstanceConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.tpu.v2alpha1.ShieldedInstanceConfig; + + /** + * Decodes a ShieldedInstanceConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ShieldedInstanceConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.tpu.v2alpha1.ShieldedInstanceConfig; + + /** + * Verifies a ShieldedInstanceConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ShieldedInstanceConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ShieldedInstanceConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.ShieldedInstanceConfig; + + /** + * Creates a plain object from a ShieldedInstanceConfig message. Also converts values to other types if specified. + * @param message ShieldedInstanceConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.ShieldedInstanceConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ShieldedInstanceConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ShieldedInstanceConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BootDiskConfig. */ + interface IBootDiskConfig { + + /** BootDiskConfig customerEncryptionKey */ + customerEncryptionKey?: (google.cloud.tpu.v2alpha1.ICustomerEncryptionKey|null); + + /** BootDiskConfig enableConfidentialCompute */ + enableConfidentialCompute?: (boolean|null); + } + + /** Represents a BootDiskConfig. */ + class BootDiskConfig implements IBootDiskConfig { + + /** + * Constructs a new BootDiskConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IBootDiskConfig); + + /** BootDiskConfig customerEncryptionKey. */ + public customerEncryptionKey?: (google.cloud.tpu.v2alpha1.ICustomerEncryptionKey|null); + + /** BootDiskConfig enableConfidentialCompute. */ + public enableConfidentialCompute: boolean; + + /** + * Creates a new BootDiskConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns BootDiskConfig instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IBootDiskConfig): google.cloud.tpu.v2alpha1.BootDiskConfig; + + /** + * Encodes the specified BootDiskConfig message. Does not implicitly {@link google.cloud.tpu.v2alpha1.BootDiskConfig.verify|verify} messages. + * @param message BootDiskConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IBootDiskConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BootDiskConfig message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.BootDiskConfig.verify|verify} messages. + * @param message BootDiskConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IBootDiskConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BootDiskConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BootDiskConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.tpu.v2alpha1.BootDiskConfig; + + /** + * Decodes a BootDiskConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BootDiskConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.tpu.v2alpha1.BootDiskConfig; + + /** + * Verifies a BootDiskConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BootDiskConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BootDiskConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.BootDiskConfig; + + /** + * Creates a plain object from a BootDiskConfig message. Also converts values to other types if specified. + * @param message BootDiskConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.BootDiskConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BootDiskConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BootDiskConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CustomerEncryptionKey. */ + interface ICustomerEncryptionKey { + + /** CustomerEncryptionKey kmsKeyName */ + kmsKeyName?: (string|null); + } + + /** Represents a CustomerEncryptionKey. */ + class CustomerEncryptionKey implements ICustomerEncryptionKey { + + /** + * Constructs a new CustomerEncryptionKey. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.ICustomerEncryptionKey); + + /** CustomerEncryptionKey kmsKeyName. */ + public kmsKeyName?: (string|null); + + /** CustomerEncryptionKey key. */ + public key?: "kmsKeyName"; + + /** + * Creates a new CustomerEncryptionKey instance using the specified properties. + * @param [properties] Properties to set + * @returns CustomerEncryptionKey instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.ICustomerEncryptionKey): google.cloud.tpu.v2alpha1.CustomerEncryptionKey; + + /** + * Encodes the specified CustomerEncryptionKey message. Does not implicitly {@link google.cloud.tpu.v2alpha1.CustomerEncryptionKey.verify|verify} messages. + * @param message CustomerEncryptionKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.ICustomerEncryptionKey, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CustomerEncryptionKey message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.CustomerEncryptionKey.verify|verify} messages. + * @param message CustomerEncryptionKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.ICustomerEncryptionKey, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CustomerEncryptionKey message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CustomerEncryptionKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.tpu.v2alpha1.CustomerEncryptionKey; + + /** + * Decodes a CustomerEncryptionKey message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CustomerEncryptionKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.tpu.v2alpha1.CustomerEncryptionKey; @@ -16364,6 +17249,168 @@ export namespace google { */ public static getTypeUrl(typeUrlPrefix?: string): string; } + + /** Properties of an UpcomingMaintenance. */ + interface IUpcomingMaintenance { + + /** UpcomingMaintenance type */ + type?: (google.cloud.tpu.v2alpha1.UpcomingMaintenance.MaintenanceType|keyof typeof google.cloud.tpu.v2alpha1.UpcomingMaintenance.MaintenanceType|null); + + /** UpcomingMaintenance canReschedule */ + canReschedule?: (boolean|null); + + /** UpcomingMaintenance windowStartTime */ + windowStartTime?: (string|null); + + /** UpcomingMaintenance windowEndTime */ + windowEndTime?: (string|null); + + /** UpcomingMaintenance latestWindowStartTime */ + latestWindowStartTime?: (string|null); + + /** UpcomingMaintenance maintenanceStatus */ + maintenanceStatus?: (google.cloud.tpu.v2alpha1.UpcomingMaintenance.MaintenanceStatus|keyof typeof google.cloud.tpu.v2alpha1.UpcomingMaintenance.MaintenanceStatus|null); + } + + /** Represents an UpcomingMaintenance. */ + class UpcomingMaintenance implements IUpcomingMaintenance { + + /** + * Constructs a new UpcomingMaintenance. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IUpcomingMaintenance); + + /** UpcomingMaintenance type. */ + public type?: (google.cloud.tpu.v2alpha1.UpcomingMaintenance.MaintenanceType|keyof typeof google.cloud.tpu.v2alpha1.UpcomingMaintenance.MaintenanceType|null); + + /** UpcomingMaintenance canReschedule. */ + public canReschedule?: (boolean|null); + + /** UpcomingMaintenance windowStartTime. */ + public windowStartTime?: (string|null); + + /** UpcomingMaintenance windowEndTime. */ + public windowEndTime?: (string|null); + + /** UpcomingMaintenance latestWindowStartTime. */ + public latestWindowStartTime?: (string|null); + + /** UpcomingMaintenance maintenanceStatus. */ + public maintenanceStatus?: (google.cloud.tpu.v2alpha1.UpcomingMaintenance.MaintenanceStatus|keyof typeof google.cloud.tpu.v2alpha1.UpcomingMaintenance.MaintenanceStatus|null); + + /** UpcomingMaintenance _type. */ + public _type?: "type"; + + /** UpcomingMaintenance _canReschedule. */ + public _canReschedule?: "canReschedule"; + + /** UpcomingMaintenance _windowStartTime. */ + public _windowStartTime?: "windowStartTime"; + + /** UpcomingMaintenance _windowEndTime. */ + public _windowEndTime?: "windowEndTime"; + + /** UpcomingMaintenance _latestWindowStartTime. */ + public _latestWindowStartTime?: "latestWindowStartTime"; + + /** UpcomingMaintenance _maintenanceStatus. */ + public _maintenanceStatus?: "maintenanceStatus"; + + /** + * Creates a new UpcomingMaintenance instance using the specified properties. + * @param [properties] Properties to set + * @returns UpcomingMaintenance instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IUpcomingMaintenance): google.cloud.tpu.v2alpha1.UpcomingMaintenance; + + /** + * Encodes the specified UpcomingMaintenance message. Does not implicitly {@link google.cloud.tpu.v2alpha1.UpcomingMaintenance.verify|verify} messages. + * @param message UpcomingMaintenance message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IUpcomingMaintenance, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpcomingMaintenance message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.UpcomingMaintenance.verify|verify} messages. + * @param message UpcomingMaintenance message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IUpcomingMaintenance, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpcomingMaintenance message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpcomingMaintenance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.tpu.v2alpha1.UpcomingMaintenance; + + /** + * Decodes an UpcomingMaintenance message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpcomingMaintenance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.tpu.v2alpha1.UpcomingMaintenance; + + /** + * Verifies an UpcomingMaintenance message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UpcomingMaintenance message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpcomingMaintenance + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.UpcomingMaintenance; + + /** + * Creates a plain object from an UpcomingMaintenance message. Also converts values to other types if specified. + * @param message UpcomingMaintenance + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.UpcomingMaintenance, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpcomingMaintenance to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpcomingMaintenance + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace UpcomingMaintenance { + + /** MaintenanceType enum. */ + enum MaintenanceType { + UNKNOWN_TYPE = 0, + SCHEDULED = 1, + UNSCHEDULED = 2 + } + + /** MaintenanceStatus enum. */ + enum MaintenanceStatus { + UNKNOWN = 0, + PENDING = 1, + ONGOING = 2 + } + } } } } @@ -18482,6 +19529,115 @@ export namespace google { */ public static getTypeUrl(typeUrlPrefix?: string): string; } + + /** Properties of a FieldInfo. */ + interface IFieldInfo { + + /** FieldInfo format */ + format?: (google.api.FieldInfo.Format|keyof typeof google.api.FieldInfo.Format|null); + } + + /** Represents a FieldInfo. */ + class FieldInfo implements IFieldInfo { + + /** + * Constructs a new FieldInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IFieldInfo); + + /** FieldInfo format. */ + public format: (google.api.FieldInfo.Format|keyof typeof google.api.FieldInfo.Format); + + /** + * Creates a new FieldInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns FieldInfo instance + */ + public static create(properties?: google.api.IFieldInfo): google.api.FieldInfo; + + /** + * Encodes the specified FieldInfo message. Does not implicitly {@link google.api.FieldInfo.verify|verify} messages. + * @param message FieldInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IFieldInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FieldInfo message, length delimited. Does not implicitly {@link google.api.FieldInfo.verify|verify} messages. + * @param message FieldInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IFieldInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FieldInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FieldInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.FieldInfo; + + /** + * Decodes a FieldInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FieldInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.FieldInfo; + + /** + * Verifies a FieldInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FieldInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FieldInfo + */ + public static fromObject(object: { [k: string]: any }): google.api.FieldInfo; + + /** + * Creates a plain object from a FieldInfo message. Also converts values to other types if specified. + * @param message FieldInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.FieldInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FieldInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FieldInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace FieldInfo { + + /** Format enum. */ + enum Format { + FORMAT_UNSPECIFIED = 0, + UUID4 = 1, + IPV4 = 2, + IPV6 = 3, + IPV4_OR_IPV6 = 4 + } + } } /** Namespace protobuf. */ @@ -20656,6 +21812,9 @@ export namespace google { /** FieldOptions .google.api.resourceReference */ ".google.api.resourceReference"?: (google.api.IResourceReference|null); + + /** FieldOptions .google.api.fieldInfo */ + ".google.api.fieldInfo"?: (google.api.IFieldInfo|null); } /** Represents a FieldOptions. */ diff --git a/packages/google-cloud-tpu/protos/protos.js b/packages/google-cloud-tpu/protos/protos.js index 6a3ba2b1e28..f4326b9af27 100644 --- a/packages/google-cloud-tpu/protos/protos.js +++ b/packages/google-cloud-tpu/protos/protos.js @@ -22489,6 +22489,39 @@ * @variation 2 */ + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|performMaintenance}. + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @typedef PerformMaintenanceCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls PerformMaintenance. + * @function performMaintenance + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IPerformMaintenanceRequest} request PerformMaintenanceRequest message or plain object + * @param {google.cloud.tpu.v2alpha1.Tpu.PerformMaintenanceCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Tpu.prototype.performMaintenance = function performMaintenance(request, callback) { + return this.rpcCall(performMaintenance, $root.google.cloud.tpu.v2alpha1.PerformMaintenanceRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "PerformMaintenance" }); + + /** + * Calls PerformMaintenance. + * @function performMaintenance + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IPerformMaintenanceRequest} request PerformMaintenanceRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + /** * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|listQueuedResources}. * @memberof google.cloud.tpu.v2alpha1.Tpu @@ -22654,6 +22687,39 @@ * @variation 2 */ + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|performMaintenanceQueuedResource}. + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @typedef PerformMaintenanceQueuedResourceCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls PerformMaintenanceQueuedResource. + * @function performMaintenanceQueuedResource + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IPerformMaintenanceQueuedResourceRequest} request PerformMaintenanceQueuedResourceRequest message or plain object + * @param {google.cloud.tpu.v2alpha1.Tpu.PerformMaintenanceQueuedResourceCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Tpu.prototype.performMaintenanceQueuedResource = function performMaintenanceQueuedResource(request, callback) { + return this.rpcCall(performMaintenanceQueuedResource, $root.google.cloud.tpu.v2alpha1.PerformMaintenanceQueuedResourceRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "PerformMaintenanceQueuedResource" }); + + /** + * Calls PerformMaintenanceQueuedResource. + * @function performMaintenanceQueuedResource + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IPerformMaintenanceQueuedResourceRequest} request PerformMaintenanceQueuedResourceRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + /** * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|generateServiceIdentity}. * @memberof google.cloud.tpu.v2alpha1.Tpu @@ -22852,6 +22918,39 @@ * @variation 2 */ + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|listReservations}. + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @typedef ListReservationsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.tpu.v2alpha1.ListReservationsResponse} [response] ListReservationsResponse + */ + + /** + * Calls ListReservations. + * @function listReservations + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IListReservationsRequest} request ListReservationsRequest message or plain object + * @param {google.cloud.tpu.v2alpha1.Tpu.ListReservationsCallback} callback Node-style callback called with the error, if any, and ListReservationsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Tpu.prototype.listReservations = function listReservations(request, callback) { + return this.rpcCall(listReservations, $root.google.cloud.tpu.v2alpha1.ListReservationsRequest, $root.google.cloud.tpu.v2alpha1.ListReservationsResponse, request, callback); + }, "name", { value: "ListReservations" }); + + /** + * Calls ListReservations. + * @function listReservations + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IListReservationsRequest} request ListReservationsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + /** * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|simulateMaintenanceEvent}. * @memberof google.cloud.tpu.v2alpha1.Tpu @@ -23869,6 +23968,7 @@ * @interface ISchedulingConfig * @property {boolean|null} [preemptible] SchedulingConfig preemptible * @property {boolean|null} [reserved] SchedulingConfig reserved + * @property {boolean|null} [spot] SchedulingConfig spot */ /** @@ -23902,6 +24002,14 @@ */ SchedulingConfig.prototype.reserved = false; + /** + * SchedulingConfig spot. + * @member {boolean} spot + * @memberof google.cloud.tpu.v2alpha1.SchedulingConfig + * @instance + */ + SchedulingConfig.prototype.spot = false; + /** * Creates a new SchedulingConfig instance using the specified properties. * @function create @@ -23930,6 +24038,8 @@ writer.uint32(/* id 1, wireType 0 =*/8).bool(message.preemptible); if (message.reserved != null && Object.hasOwnProperty.call(message, "reserved")) writer.uint32(/* id 2, wireType 0 =*/16).bool(message.reserved); + if (message.spot != null && Object.hasOwnProperty.call(message, "spot")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.spot); return writer; }; @@ -23972,6 +24082,10 @@ message.reserved = reader.bool(); break; } + case 3: { + message.spot = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -24013,6 +24127,9 @@ if (message.reserved != null && message.hasOwnProperty("reserved")) if (typeof message.reserved !== "boolean") return "reserved: boolean expected"; + if (message.spot != null && message.hasOwnProperty("spot")) + if (typeof message.spot !== "boolean") + return "spot: boolean expected"; return null; }; @@ -24032,6 +24149,8 @@ message.preemptible = Boolean(object.preemptible); if (object.reserved != null) message.reserved = Boolean(object.reserved); + if (object.spot != null) + message.spot = Boolean(object.spot); return message; }; @@ -24051,11 +24170,14 @@ if (options.defaults) { object.preemptible = false; object.reserved = false; + object.spot = false; } if (message.preemptible != null && message.hasOwnProperty("preemptible")) object.preemptible = message.preemptible; if (message.reserved != null && message.hasOwnProperty("reserved")) object.reserved = message.reserved; + if (message.spot != null && message.hasOwnProperty("spot")) + object.spot = message.spot; return object; }; @@ -24556,6 +24678,7 @@ * @property {string|null} [subnetwork] NetworkConfig subnetwork * @property {boolean|null} [enableExternalIps] NetworkConfig enableExternalIps * @property {boolean|null} [canIpForward] NetworkConfig canIpForward + * @property {number|null} [queueCount] NetworkConfig queueCount */ /** @@ -24605,6 +24728,14 @@ */ NetworkConfig.prototype.canIpForward = false; + /** + * NetworkConfig queueCount. + * @member {number} queueCount + * @memberof google.cloud.tpu.v2alpha1.NetworkConfig + * @instance + */ + NetworkConfig.prototype.queueCount = 0; + /** * Creates a new NetworkConfig instance using the specified properties. * @function create @@ -24637,6 +24768,8 @@ writer.uint32(/* id 3, wireType 0 =*/24).bool(message.enableExternalIps); if (message.canIpForward != null && Object.hasOwnProperty.call(message, "canIpForward")) writer.uint32(/* id 4, wireType 0 =*/32).bool(message.canIpForward); + if (message.queueCount != null && Object.hasOwnProperty.call(message, "queueCount")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.queueCount); return writer; }; @@ -24687,6 +24820,10 @@ message.canIpForward = reader.bool(); break; } + case 6: { + message.queueCount = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -24734,6 +24871,9 @@ if (message.canIpForward != null && message.hasOwnProperty("canIpForward")) if (typeof message.canIpForward !== "boolean") return "canIpForward: boolean expected"; + if (message.queueCount != null && message.hasOwnProperty("queueCount")) + if (!$util.isInteger(message.queueCount)) + return "queueCount: integer expected"; return null; }; @@ -24757,6 +24897,8 @@ message.enableExternalIps = Boolean(object.enableExternalIps); if (object.canIpForward != null) message.canIpForward = Boolean(object.canIpForward); + if (object.queueCount != null) + message.queueCount = object.queueCount | 0; return message; }; @@ -24778,6 +24920,7 @@ object.subnetwork = ""; object.enableExternalIps = false; object.canIpForward = false; + object.queueCount = 0; } if (message.network != null && message.hasOwnProperty("network")) object.network = message.network; @@ -24787,6 +24930,8 @@ object.enableExternalIps = message.enableExternalIps; if (message.canIpForward != null && message.hasOwnProperty("canIpForward")) object.canIpForward = message.canIpForward; + if (message.queueCount != null && message.hasOwnProperty("queueCount")) + object.queueCount = message.queueCount; return object; }; @@ -25075,6 +25220,7 @@ * @property {string|null} [healthDescription] Node healthDescription * @property {string|null} [runtimeVersion] Node runtimeVersion * @property {google.cloud.tpu.v2alpha1.INetworkConfig|null} [networkConfig] Node networkConfig + * @property {Array.|null} [networkConfigs] Node networkConfigs * @property {string|null} [cidrBlock] Node cidrBlock * @property {google.cloud.tpu.v2alpha1.IServiceAccount|null} [serviceAccount] Node serviceAccount * @property {google.protobuf.ITimestamp|null} [createTime] Node createTime @@ -25092,7 +25238,9 @@ * @property {google.cloud.tpu.v2alpha1.IAcceleratorConfig|null} [acceleratorConfig] Node acceleratorConfig * @property {google.cloud.tpu.v2alpha1.IShieldedInstanceConfig|null} [shieldedInstanceConfig] Node shieldedInstanceConfig * @property {boolean|null} [multisliceNode] Node multisliceNode + * @property {boolean|null} [autocheckpointEnabled] Node autocheckpointEnabled * @property {google.cloud.tpu.v2alpha1.IBootDiskConfig|null} [bootDiskConfig] Node bootDiskConfig + * @property {google.cloud.tpu.v2alpha1.IUpcomingMaintenance|null} [upcomingMaintenance] Node upcomingMaintenance */ /** @@ -25104,6 +25252,7 @@ * @param {google.cloud.tpu.v2alpha1.INode=} [properties] Properties to set */ function Node(properties) { + this.networkConfigs = []; this.networkEndpoints = []; this.labels = {}; this.metadata = {}; @@ -25172,6 +25321,14 @@ */ Node.prototype.networkConfig = null; + /** + * Node networkConfigs. + * @member {Array.} networkConfigs + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.networkConfigs = $util.emptyArray; + /** * Node cidrBlock. * @member {string} cidrBlock @@ -25308,6 +25465,14 @@ */ Node.prototype.multisliceNode = false; + /** + * Node autocheckpointEnabled. + * @member {boolean} autocheckpointEnabled + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.autocheckpointEnabled = false; + /** * Node bootDiskConfig. * @member {google.cloud.tpu.v2alpha1.IBootDiskConfig|null|undefined} bootDiskConfig @@ -25316,6 +25481,14 @@ */ Node.prototype.bootDiskConfig = null; + /** + * Node upcomingMaintenance. + * @member {google.cloud.tpu.v2alpha1.IUpcomingMaintenance|null|undefined} upcomingMaintenance + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.upcomingMaintenance = null; + /** * Creates a new Node instance using the specified properties. * @function create @@ -25394,8 +25567,15 @@ $root.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig.encode(message.shieldedInstanceConfig, writer.uint32(/* id 45, wireType 2 =*/362).fork()).ldelim(); if (message.multisliceNode != null && Object.hasOwnProperty.call(message, "multisliceNode")) writer.uint32(/* id 47, wireType 0 =*/376).bool(message.multisliceNode); + if (message.autocheckpointEnabled != null && Object.hasOwnProperty.call(message, "autocheckpointEnabled")) + writer.uint32(/* id 48, wireType 0 =*/384).bool(message.autocheckpointEnabled); if (message.bootDiskConfig != null && Object.hasOwnProperty.call(message, "bootDiskConfig")) $root.google.cloud.tpu.v2alpha1.BootDiskConfig.encode(message.bootDiskConfig, writer.uint32(/* id 49, wireType 2 =*/394).fork()).ldelim(); + if (message.networkConfigs != null && message.networkConfigs.length) + for (var i = 0; i < message.networkConfigs.length; ++i) + $root.google.cloud.tpu.v2alpha1.NetworkConfig.encode(message.networkConfigs[i], writer.uint32(/* id 50, wireType 2 =*/402).fork()).ldelim(); + if (message.upcomingMaintenance != null && Object.hasOwnProperty.call(message, "upcomingMaintenance")) + $root.google.cloud.tpu.v2alpha1.UpcomingMaintenance.encode(message.upcomingMaintenance, writer.uint32(/* id 51, wireType 2 =*/410).fork()).ldelim(); return writer; }; @@ -25458,6 +25638,12 @@ message.networkConfig = $root.google.cloud.tpu.v2alpha1.NetworkConfig.decode(reader, reader.uint32()); break; } + case 50: { + if (!(message.networkConfigs && message.networkConfigs.length)) + message.networkConfigs = []; + message.networkConfigs.push($root.google.cloud.tpu.v2alpha1.NetworkConfig.decode(reader, reader.uint32())); + break; + } case 13: { message.cidrBlock = reader.string(); break; @@ -25572,10 +25758,18 @@ message.multisliceNode = reader.bool(); break; } + case 48: { + message.autocheckpointEnabled = reader.bool(); + break; + } case 49: { message.bootDiskConfig = $root.google.cloud.tpu.v2alpha1.BootDiskConfig.decode(reader, reader.uint32()); break; } + case 51: { + message.upcomingMaintenance = $root.google.cloud.tpu.v2alpha1.UpcomingMaintenance.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -25639,6 +25833,7 @@ case 13: case 14: case 15: + case 16: break; } if (message.healthDescription != null && message.hasOwnProperty("healthDescription")) @@ -25652,6 +25847,15 @@ if (error) return "networkConfig." + error; } + if (message.networkConfigs != null && message.hasOwnProperty("networkConfigs")) { + if (!Array.isArray(message.networkConfigs)) + return "networkConfigs: array expected"; + for (var i = 0; i < message.networkConfigs.length; ++i) { + var error = $root.google.cloud.tpu.v2alpha1.NetworkConfig.verify(message.networkConfigs[i]); + if (error) + return "networkConfigs." + error; + } + } if (message.cidrBlock != null && message.hasOwnProperty("cidrBlock")) if (!$util.isString(message.cidrBlock)) return "cidrBlock: string expected"; @@ -25760,11 +25964,19 @@ if (message.multisliceNode != null && message.hasOwnProperty("multisliceNode")) if (typeof message.multisliceNode !== "boolean") return "multisliceNode: boolean expected"; + if (message.autocheckpointEnabled != null && message.hasOwnProperty("autocheckpointEnabled")) + if (typeof message.autocheckpointEnabled !== "boolean") + return "autocheckpointEnabled: boolean expected"; if (message.bootDiskConfig != null && message.hasOwnProperty("bootDiskConfig")) { var error = $root.google.cloud.tpu.v2alpha1.BootDiskConfig.verify(message.bootDiskConfig); if (error) return "bootDiskConfig." + error; } + if (message.upcomingMaintenance != null && message.hasOwnProperty("upcomingMaintenance")) { + var error = $root.google.cloud.tpu.v2alpha1.UpcomingMaintenance.verify(message.upcomingMaintenance); + if (error) + return "upcomingMaintenance." + error; + } return null; }; @@ -25853,6 +26065,10 @@ case 15: message.state = 15; break; + case "UNKNOWN": + case 16: + message.state = 16; + break; } if (object.healthDescription != null) message.healthDescription = String(object.healthDescription); @@ -25863,6 +26079,16 @@ throw TypeError(".google.cloud.tpu.v2alpha1.Node.networkConfig: object expected"); message.networkConfig = $root.google.cloud.tpu.v2alpha1.NetworkConfig.fromObject(object.networkConfig); } + if (object.networkConfigs) { + if (!Array.isArray(object.networkConfigs)) + throw TypeError(".google.cloud.tpu.v2alpha1.Node.networkConfigs: array expected"); + message.networkConfigs = []; + for (var i = 0; i < object.networkConfigs.length; ++i) { + if (typeof object.networkConfigs[i] !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.Node.networkConfigs: object expected"); + message.networkConfigs[i] = $root.google.cloud.tpu.v2alpha1.NetworkConfig.fromObject(object.networkConfigs[i]); + } + } if (object.cidrBlock != null) message.cidrBlock = String(object.cidrBlock); if (object.serviceAccount != null) { @@ -26006,11 +26232,18 @@ } if (object.multisliceNode != null) message.multisliceNode = Boolean(object.multisliceNode); + if (object.autocheckpointEnabled != null) + message.autocheckpointEnabled = Boolean(object.autocheckpointEnabled); if (object.bootDiskConfig != null) { if (typeof object.bootDiskConfig !== "object") throw TypeError(".google.cloud.tpu.v2alpha1.Node.bootDiskConfig: object expected"); message.bootDiskConfig = $root.google.cloud.tpu.v2alpha1.BootDiskConfig.fromObject(object.bootDiskConfig); } + if (object.upcomingMaintenance != null) { + if (typeof object.upcomingMaintenance !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.Node.upcomingMaintenance: object expected"); + message.upcomingMaintenance = $root.google.cloud.tpu.v2alpha1.UpcomingMaintenance.fromObject(object.upcomingMaintenance); + } return message; }; @@ -26032,6 +26265,7 @@ object.symptoms = []; object.tags = []; object.dataDisks = []; + object.networkConfigs = []; } if (options.objects || options.defaults) { object.labels = {}; @@ -26060,7 +26294,9 @@ object.acceleratorConfig = null; object.shieldedInstanceConfig = null; object.multisliceNode = false; + object.autocheckpointEnabled = false; object.bootDiskConfig = null; + object.upcomingMaintenance = null; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -26132,8 +26368,17 @@ object.shieldedInstanceConfig = $root.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig.toObject(message.shieldedInstanceConfig, options); if (message.multisliceNode != null && message.hasOwnProperty("multisliceNode")) object.multisliceNode = message.multisliceNode; + if (message.autocheckpointEnabled != null && message.hasOwnProperty("autocheckpointEnabled")) + object.autocheckpointEnabled = message.autocheckpointEnabled; if (message.bootDiskConfig != null && message.hasOwnProperty("bootDiskConfig")) object.bootDiskConfig = $root.google.cloud.tpu.v2alpha1.BootDiskConfig.toObject(message.bootDiskConfig, options); + if (message.networkConfigs && message.networkConfigs.length) { + object.networkConfigs = []; + for (var j = 0; j < message.networkConfigs.length; ++j) + object.networkConfigs[j] = $root.google.cloud.tpu.v2alpha1.NetworkConfig.toObject(message.networkConfigs[j], options); + } + if (message.upcomingMaintenance != null && message.hasOwnProperty("upcomingMaintenance")) + object.upcomingMaintenance = $root.google.cloud.tpu.v2alpha1.UpcomingMaintenance.toObject(message.upcomingMaintenance, options); return object; }; @@ -26182,6 +26427,7 @@ * @property {number} HIDING=13 HIDING value * @property {number} HIDDEN=14 HIDDEN value * @property {number} UNHIDING=15 UNHIDING value + * @property {number} UNKNOWN=16 UNKNOWN value */ Node.State = (function() { var valuesById = {}, values = Object.create(valuesById); @@ -26200,6 +26446,7 @@ values[valuesById[13] = "HIDING"] = 13; values[valuesById[14] = "HIDDEN"] = 14; values[valuesById[15] = "UNHIDING"] = 15; + values[valuesById[16] = "UNKNOWN"] = 16; return values; })(); @@ -26251,6 +26498,7 @@ * @memberof google.cloud.tpu.v2alpha1 * @interface IQueuedResource * @property {string|null} [name] QueuedResource name + * @property {google.protobuf.ITimestamp|null} [createTime] QueuedResource createTime * @property {google.cloud.tpu.v2alpha1.QueuedResource.ITpu|null} [tpu] QueuedResource tpu * @property {google.cloud.tpu.v2alpha1.QueuedResource.IBestEffort|null} [bestEffort] QueuedResource bestEffort * @property {google.cloud.tpu.v2alpha1.QueuedResource.IGuaranteed|null} [guaranteed] QueuedResource guaranteed @@ -26283,6 +26531,14 @@ */ QueuedResource.prototype.name = ""; + /** + * QueuedResource createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.tpu.v2alpha1.QueuedResource + * @instance + */ + QueuedResource.prototype.createTime = null; + /** * QueuedResource tpu. * @member {google.cloud.tpu.v2alpha1.QueuedResource.ITpu|null|undefined} tpu @@ -26404,6 +26660,8 @@ writer.uint32(/* id 8, wireType 2 =*/66).string(message.reservationName); if (message.spot != null && Object.hasOwnProperty.call(message, "spot")) $root.google.cloud.tpu.v2alpha1.QueuedResource.Spot.encode(message.spot, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); return writer; }; @@ -26442,6 +26700,10 @@ message.name = reader.string(); break; } + case 11: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } case 2: { message.tpu = $root.google.cloud.tpu.v2alpha1.QueuedResource.Tpu.decode(reader, reader.uint32()); break; @@ -26509,6 +26771,11 @@ if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } if (message.tpu != null && message.hasOwnProperty("tpu")) { properties.resource = 1; { @@ -26575,6 +26842,11 @@ var message = new $root.google.cloud.tpu.v2alpha1.QueuedResource(); if (object.name != null) message.name = String(object.name); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.QueuedResource.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } if (object.tpu != null) { if (typeof object.tpu !== "object") throw TypeError(".google.cloud.tpu.v2alpha1.QueuedResource.tpu: object expected"); @@ -26628,6 +26900,7 @@ object.queueingPolicy = null; object.state = null; object.reservationName = ""; + object.createTime = null; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -26657,6 +26930,8 @@ if (options.oneofs) object.tier = "spot"; } + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); return object; }; @@ -27195,6 +27470,7 @@ * @interface IMultiNodeParams * @property {number|null} [nodeCount] MultiNodeParams nodeCount * @property {string|null} [nodeIdPrefix] MultiNodeParams nodeIdPrefix + * @property {google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec.MultiNodeParams.WorkloadType|null} [workloadType] MultiNodeParams workloadType */ /** @@ -27228,6 +27504,14 @@ */ MultiNodeParams.prototype.nodeIdPrefix = ""; + /** + * MultiNodeParams workloadType. + * @member {google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec.MultiNodeParams.WorkloadType} workloadType + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec.MultiNodeParams + * @instance + */ + MultiNodeParams.prototype.workloadType = 0; + /** * Creates a new MultiNodeParams instance using the specified properties. * @function create @@ -27256,6 +27540,8 @@ writer.uint32(/* id 1, wireType 0 =*/8).int32(message.nodeCount); if (message.nodeIdPrefix != null && Object.hasOwnProperty.call(message, "nodeIdPrefix")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.nodeIdPrefix); + if (message.workloadType != null && Object.hasOwnProperty.call(message, "workloadType")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.workloadType); return writer; }; @@ -27298,6 +27584,10 @@ message.nodeIdPrefix = reader.string(); break; } + case 4: { + message.workloadType = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -27339,6 +27629,15 @@ if (message.nodeIdPrefix != null && message.hasOwnProperty("nodeIdPrefix")) if (!$util.isString(message.nodeIdPrefix)) return "nodeIdPrefix: string expected"; + if (message.workloadType != null && message.hasOwnProperty("workloadType")) + switch (message.workloadType) { + default: + return "workloadType: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; @@ -27358,6 +27657,26 @@ message.nodeCount = object.nodeCount | 0; if (object.nodeIdPrefix != null) message.nodeIdPrefix = String(object.nodeIdPrefix); + switch (object.workloadType) { + default: + if (typeof object.workloadType === "number") { + message.workloadType = object.workloadType; + break; + } + break; + case "WORKLOAD_TYPE_UNSPECIFIED": + case 0: + message.workloadType = 0; + break; + case "THROUGHPUT_OPTIMIZED": + case 1: + message.workloadType = 1; + break; + case "AVAILABILITY_OPTIMIZED": + case 2: + message.workloadType = 2; + break; + } return message; }; @@ -27377,11 +27696,14 @@ if (options.defaults) { object.nodeCount = 0; object.nodeIdPrefix = ""; + object.workloadType = options.enums === String ? "WORKLOAD_TYPE_UNSPECIFIED" : 0; } if (message.nodeCount != null && message.hasOwnProperty("nodeCount")) object.nodeCount = message.nodeCount; if (message.nodeIdPrefix != null && message.hasOwnProperty("nodeIdPrefix")) object.nodeIdPrefix = message.nodeIdPrefix; + if (message.workloadType != null && message.hasOwnProperty("workloadType")) + object.workloadType = options.enums === String ? $root.google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec.MultiNodeParams.WorkloadType[message.workloadType] === undefined ? message.workloadType : $root.google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec.MultiNodeParams.WorkloadType[message.workloadType] : message.workloadType; return object; }; @@ -27411,6 +27733,22 @@ return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec.MultiNodeParams"; }; + /** + * WorkloadType enum. + * @name google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec.MultiNodeParams.WorkloadType + * @enum {number} + * @property {number} WORKLOAD_TYPE_UNSPECIFIED=0 WORKLOAD_TYPE_UNSPECIFIED value + * @property {number} THROUGHPUT_OPTIMIZED=1 THROUGHPUT_OPTIMIZED value + * @property {number} AVAILABILITY_OPTIMIZED=2 AVAILABILITY_OPTIMIZED value + */ + MultiNodeParams.WorkloadType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "WORKLOAD_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "THROUGHPUT_OPTIMIZED"] = 1; + values[valuesById[2] = "AVAILABILITY_OPTIMIZED"] = 2; + return values; + })(); + return MultiNodeParams; })(); @@ -37934,25 +38272,24 @@ return SimulateMaintenanceEventRequest; })(); - v2alpha1.AcceleratorConfig = (function() { + v2alpha1.PerformMaintenanceRequest = (function() { /** - * Properties of an AcceleratorConfig. + * Properties of a PerformMaintenanceRequest. * @memberof google.cloud.tpu.v2alpha1 - * @interface IAcceleratorConfig - * @property {google.cloud.tpu.v2alpha1.AcceleratorConfig.Type|null} [type] AcceleratorConfig type - * @property {string|null} [topology] AcceleratorConfig topology + * @interface IPerformMaintenanceRequest + * @property {string|null} [name] PerformMaintenanceRequest name */ /** - * Constructs a new AcceleratorConfig. + * Constructs a new PerformMaintenanceRequest. * @memberof google.cloud.tpu.v2alpha1 - * @classdesc Represents an AcceleratorConfig. - * @implements IAcceleratorConfig + * @classdesc Represents a PerformMaintenanceRequest. + * @implements IPerformMaintenanceRequest * @constructor - * @param {google.cloud.tpu.v2alpha1.IAcceleratorConfig=} [properties] Properties to set + * @param {google.cloud.tpu.v2alpha1.IPerformMaintenanceRequest=} [properties] Properties to set */ - function AcceleratorConfig(properties) { + function PerformMaintenanceRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -37960,54 +38297,1905 @@ } /** - * AcceleratorConfig type. - * @member {google.cloud.tpu.v2alpha1.AcceleratorConfig.Type} type - * @memberof google.cloud.tpu.v2alpha1.AcceleratorConfig - * @instance - */ - AcceleratorConfig.prototype.type = 0; - - /** - * AcceleratorConfig topology. - * @member {string} topology - * @memberof google.cloud.tpu.v2alpha1.AcceleratorConfig + * PerformMaintenanceRequest name. + * @member {string} name + * @memberof google.cloud.tpu.v2alpha1.PerformMaintenanceRequest * @instance */ - AcceleratorConfig.prototype.topology = ""; + PerformMaintenanceRequest.prototype.name = ""; /** - * Creates a new AcceleratorConfig instance using the specified properties. + * Creates a new PerformMaintenanceRequest instance using the specified properties. * @function create - * @memberof google.cloud.tpu.v2alpha1.AcceleratorConfig + * @memberof google.cloud.tpu.v2alpha1.PerformMaintenanceRequest * @static - * @param {google.cloud.tpu.v2alpha1.IAcceleratorConfig=} [properties] Properties to set - * @returns {google.cloud.tpu.v2alpha1.AcceleratorConfig} AcceleratorConfig instance + * @param {google.cloud.tpu.v2alpha1.IPerformMaintenanceRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.PerformMaintenanceRequest} PerformMaintenanceRequest instance */ - AcceleratorConfig.create = function create(properties) { - return new AcceleratorConfig(properties); + PerformMaintenanceRequest.create = function create(properties) { + return new PerformMaintenanceRequest(properties); }; /** - * Encodes the specified AcceleratorConfig message. Does not implicitly {@link google.cloud.tpu.v2alpha1.AcceleratorConfig.verify|verify} messages. + * Encodes the specified PerformMaintenanceRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.PerformMaintenanceRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.tpu.v2alpha1.AcceleratorConfig + * @memberof google.cloud.tpu.v2alpha1.PerformMaintenanceRequest * @static - * @param {google.cloud.tpu.v2alpha1.IAcceleratorConfig} message AcceleratorConfig message or plain object to encode + * @param {google.cloud.tpu.v2alpha1.IPerformMaintenanceRequest} message PerformMaintenanceRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AcceleratorConfig.encode = function encode(message, writer) { + PerformMaintenanceRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type); - if (message.topology != null && Object.hasOwnProperty.call(message, "topology")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.topology); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); return writer; }; /** - * Encodes the specified AcceleratorConfig message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.AcceleratorConfig.verify|verify} messages. + * Encodes the specified PerformMaintenanceRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.PerformMaintenanceRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.PerformMaintenanceRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IPerformMaintenanceRequest} message PerformMaintenanceRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PerformMaintenanceRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PerformMaintenanceRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.PerformMaintenanceRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.PerformMaintenanceRequest} PerformMaintenanceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PerformMaintenanceRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.tpu.v2alpha1.PerformMaintenanceRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PerformMaintenanceRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.PerformMaintenanceRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.PerformMaintenanceRequest} PerformMaintenanceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PerformMaintenanceRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PerformMaintenanceRequest message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.PerformMaintenanceRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PerformMaintenanceRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a PerformMaintenanceRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.PerformMaintenanceRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.PerformMaintenanceRequest} PerformMaintenanceRequest + */ + PerformMaintenanceRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.PerformMaintenanceRequest) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.PerformMaintenanceRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a PerformMaintenanceRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.PerformMaintenanceRequest + * @static + * @param {google.cloud.tpu.v2alpha1.PerformMaintenanceRequest} message PerformMaintenanceRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PerformMaintenanceRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this PerformMaintenanceRequest to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.PerformMaintenanceRequest + * @instance + * @returns {Object.} JSON object + */ + PerformMaintenanceRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PerformMaintenanceRequest + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.PerformMaintenanceRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PerformMaintenanceRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.PerformMaintenanceRequest"; + }; + + return PerformMaintenanceRequest; + })(); + + v2alpha1.PerformMaintenanceQueuedResourceRequest = (function() { + + /** + * Properties of a PerformMaintenanceQueuedResourceRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IPerformMaintenanceQueuedResourceRequest + * @property {string|null} [name] PerformMaintenanceQueuedResourceRequest name + * @property {Array.|null} [nodeNames] PerformMaintenanceQueuedResourceRequest nodeNames + */ + + /** + * Constructs a new PerformMaintenanceQueuedResourceRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a PerformMaintenanceQueuedResourceRequest. + * @implements IPerformMaintenanceQueuedResourceRequest + * @constructor + * @param {google.cloud.tpu.v2alpha1.IPerformMaintenanceQueuedResourceRequest=} [properties] Properties to set + */ + function PerformMaintenanceQueuedResourceRequest(properties) { + this.nodeNames = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PerformMaintenanceQueuedResourceRequest name. + * @member {string} name + * @memberof google.cloud.tpu.v2alpha1.PerformMaintenanceQueuedResourceRequest + * @instance + */ + PerformMaintenanceQueuedResourceRequest.prototype.name = ""; + + /** + * PerformMaintenanceQueuedResourceRequest nodeNames. + * @member {Array.} nodeNames + * @memberof google.cloud.tpu.v2alpha1.PerformMaintenanceQueuedResourceRequest + * @instance + */ + PerformMaintenanceQueuedResourceRequest.prototype.nodeNames = $util.emptyArray; + + /** + * Creates a new PerformMaintenanceQueuedResourceRequest instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.PerformMaintenanceQueuedResourceRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IPerformMaintenanceQueuedResourceRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.PerformMaintenanceQueuedResourceRequest} PerformMaintenanceQueuedResourceRequest instance + */ + PerformMaintenanceQueuedResourceRequest.create = function create(properties) { + return new PerformMaintenanceQueuedResourceRequest(properties); + }; + + /** + * Encodes the specified PerformMaintenanceQueuedResourceRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.PerformMaintenanceQueuedResourceRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.PerformMaintenanceQueuedResourceRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IPerformMaintenanceQueuedResourceRequest} message PerformMaintenanceQueuedResourceRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PerformMaintenanceQueuedResourceRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.nodeNames != null && message.nodeNames.length) + for (var i = 0; i < message.nodeNames.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nodeNames[i]); + return writer; + }; + + /** + * Encodes the specified PerformMaintenanceQueuedResourceRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.PerformMaintenanceQueuedResourceRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.PerformMaintenanceQueuedResourceRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IPerformMaintenanceQueuedResourceRequest} message PerformMaintenanceQueuedResourceRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PerformMaintenanceQueuedResourceRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PerformMaintenanceQueuedResourceRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.PerformMaintenanceQueuedResourceRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.PerformMaintenanceQueuedResourceRequest} PerformMaintenanceQueuedResourceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PerformMaintenanceQueuedResourceRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.tpu.v2alpha1.PerformMaintenanceQueuedResourceRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.nodeNames && message.nodeNames.length)) + message.nodeNames = []; + message.nodeNames.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PerformMaintenanceQueuedResourceRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.PerformMaintenanceQueuedResourceRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.PerformMaintenanceQueuedResourceRequest} PerformMaintenanceQueuedResourceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PerformMaintenanceQueuedResourceRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PerformMaintenanceQueuedResourceRequest message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.PerformMaintenanceQueuedResourceRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PerformMaintenanceQueuedResourceRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.nodeNames != null && message.hasOwnProperty("nodeNames")) { + if (!Array.isArray(message.nodeNames)) + return "nodeNames: array expected"; + for (var i = 0; i < message.nodeNames.length; ++i) + if (!$util.isString(message.nodeNames[i])) + return "nodeNames: string[] expected"; + } + return null; + }; + + /** + * Creates a PerformMaintenanceQueuedResourceRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.PerformMaintenanceQueuedResourceRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.PerformMaintenanceQueuedResourceRequest} PerformMaintenanceQueuedResourceRequest + */ + PerformMaintenanceQueuedResourceRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.PerformMaintenanceQueuedResourceRequest) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.PerformMaintenanceQueuedResourceRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.nodeNames) { + if (!Array.isArray(object.nodeNames)) + throw TypeError(".google.cloud.tpu.v2alpha1.PerformMaintenanceQueuedResourceRequest.nodeNames: array expected"); + message.nodeNames = []; + for (var i = 0; i < object.nodeNames.length; ++i) + message.nodeNames[i] = String(object.nodeNames[i]); + } + return message; + }; + + /** + * Creates a plain object from a PerformMaintenanceQueuedResourceRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.PerformMaintenanceQueuedResourceRequest + * @static + * @param {google.cloud.tpu.v2alpha1.PerformMaintenanceQueuedResourceRequest} message PerformMaintenanceQueuedResourceRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PerformMaintenanceQueuedResourceRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.nodeNames = []; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.nodeNames && message.nodeNames.length) { + object.nodeNames = []; + for (var j = 0; j < message.nodeNames.length; ++j) + object.nodeNames[j] = message.nodeNames[j]; + } + return object; + }; + + /** + * Converts this PerformMaintenanceQueuedResourceRequest to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.PerformMaintenanceQueuedResourceRequest + * @instance + * @returns {Object.} JSON object + */ + PerformMaintenanceQueuedResourceRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PerformMaintenanceQueuedResourceRequest + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.PerformMaintenanceQueuedResourceRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PerformMaintenanceQueuedResourceRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.PerformMaintenanceQueuedResourceRequest"; + }; + + return PerformMaintenanceQueuedResourceRequest; + })(); + + v2alpha1.Reservation = (function() { + + /** + * Properties of a Reservation. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IReservation + * @property {string|null} [name] Reservation name + * @property {google.cloud.tpu.v2alpha1.Reservation.IStandard|null} [standard] Reservation standard + * @property {google.cloud.tpu.v2alpha1.Reservation.State|null} [state] Reservation state + */ + + /** + * Constructs a new Reservation. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a Reservation. + * @implements IReservation + * @constructor + * @param {google.cloud.tpu.v2alpha1.IReservation=} [properties] Properties to set + */ + function Reservation(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Reservation name. + * @member {string} name + * @memberof google.cloud.tpu.v2alpha1.Reservation + * @instance + */ + Reservation.prototype.name = ""; + + /** + * Reservation standard. + * @member {google.cloud.tpu.v2alpha1.Reservation.IStandard|null|undefined} standard + * @memberof google.cloud.tpu.v2alpha1.Reservation + * @instance + */ + Reservation.prototype.standard = null; + + /** + * Reservation state. + * @member {google.cloud.tpu.v2alpha1.Reservation.State} state + * @memberof google.cloud.tpu.v2alpha1.Reservation + * @instance + */ + Reservation.prototype.state = 0; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Reservation kind. + * @member {"standard"|undefined} kind + * @memberof google.cloud.tpu.v2alpha1.Reservation + * @instance + */ + Object.defineProperty(Reservation.prototype, "kind", { + get: $util.oneOfGetter($oneOfFields = ["standard"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Reservation instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.Reservation + * @static + * @param {google.cloud.tpu.v2alpha1.IReservation=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.Reservation} Reservation instance + */ + Reservation.create = function create(properties) { + return new Reservation(properties); + }; + + /** + * Encodes the specified Reservation message. Does not implicitly {@link google.cloud.tpu.v2alpha1.Reservation.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.Reservation + * @static + * @param {google.cloud.tpu.v2alpha1.IReservation} message Reservation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Reservation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.standard != null && Object.hasOwnProperty.call(message, "standard")) + $root.google.cloud.tpu.v2alpha1.Reservation.Standard.encode(message.standard, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.state); + return writer; + }; + + /** + * Encodes the specified Reservation message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.Reservation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.Reservation + * @static + * @param {google.cloud.tpu.v2alpha1.IReservation} message Reservation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Reservation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Reservation message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.Reservation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.Reservation} Reservation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Reservation.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.tpu.v2alpha1.Reservation(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.standard = $root.google.cloud.tpu.v2alpha1.Reservation.Standard.decode(reader, reader.uint32()); + break; + } + case 3: { + message.state = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Reservation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.Reservation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.Reservation} Reservation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Reservation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Reservation message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.Reservation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Reservation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.standard != null && message.hasOwnProperty("standard")) { + properties.kind = 1; + { + var error = $root.google.cloud.tpu.v2alpha1.Reservation.Standard.verify(message.standard); + if (error) + return "standard." + error; + } + } + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + break; + } + return null; + }; + + /** + * Creates a Reservation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.Reservation + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.Reservation} Reservation + */ + Reservation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.Reservation) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.Reservation(); + if (object.name != null) + message.name = String(object.name); + if (object.standard != null) { + if (typeof object.standard !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.Reservation.standard: object expected"); + message.standard = $root.google.cloud.tpu.v2alpha1.Reservation.Standard.fromObject(object.standard); + } + switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "APPROVED": + case 3: + message.state = 3; + break; + case "PROVISIONING": + case 4: + message.state = 4; + break; + case "ACTIVE": + case 5: + message.state = 5; + break; + case "DEPROVISIONING": + case 6: + message.state = 6; + break; + case "EXPIRED": + case 7: + message.state = 7; + break; + case "FAILED": + case 8: + message.state = 8; + break; + } + return message; + }; + + /** + * Creates a plain object from a Reservation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.Reservation + * @static + * @param {google.cloud.tpu.v2alpha1.Reservation} message Reservation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Reservation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.standard != null && message.hasOwnProperty("standard")) { + object.standard = $root.google.cloud.tpu.v2alpha1.Reservation.Standard.toObject(message.standard, options); + if (options.oneofs) + object.kind = "standard"; + } + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.tpu.v2alpha1.Reservation.State[message.state] === undefined ? message.state : $root.google.cloud.tpu.v2alpha1.Reservation.State[message.state] : message.state; + return object; + }; + + /** + * Converts this Reservation to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.Reservation + * @instance + * @returns {Object.} JSON object + */ + Reservation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Reservation + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.Reservation + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Reservation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.Reservation"; + }; + + Reservation.Standard = (function() { + + /** + * Properties of a Standard. + * @memberof google.cloud.tpu.v2alpha1.Reservation + * @interface IStandard + * @property {number|null} [size] Standard size + * @property {google.cloud.tpu.v2alpha1.Reservation.Standard.CapacityUnits|null} [capacityUnits] Standard capacityUnits + * @property {string|null} [resourceType] Standard resourceType + * @property {google.type.IInterval|null} [interval] Standard interval + * @property {google.cloud.tpu.v2alpha1.Reservation.Standard.IUsage|null} [usage] Standard usage + */ + + /** + * Constructs a new Standard. + * @memberof google.cloud.tpu.v2alpha1.Reservation + * @classdesc Represents a Standard. + * @implements IStandard + * @constructor + * @param {google.cloud.tpu.v2alpha1.Reservation.IStandard=} [properties] Properties to set + */ + function Standard(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Standard size. + * @member {number} size + * @memberof google.cloud.tpu.v2alpha1.Reservation.Standard + * @instance + */ + Standard.prototype.size = 0; + + /** + * Standard capacityUnits. + * @member {google.cloud.tpu.v2alpha1.Reservation.Standard.CapacityUnits} capacityUnits + * @memberof google.cloud.tpu.v2alpha1.Reservation.Standard + * @instance + */ + Standard.prototype.capacityUnits = 0; + + /** + * Standard resourceType. + * @member {string} resourceType + * @memberof google.cloud.tpu.v2alpha1.Reservation.Standard + * @instance + */ + Standard.prototype.resourceType = ""; + + /** + * Standard interval. + * @member {google.type.IInterval|null|undefined} interval + * @memberof google.cloud.tpu.v2alpha1.Reservation.Standard + * @instance + */ + Standard.prototype.interval = null; + + /** + * Standard usage. + * @member {google.cloud.tpu.v2alpha1.Reservation.Standard.IUsage|null|undefined} usage + * @memberof google.cloud.tpu.v2alpha1.Reservation.Standard + * @instance + */ + Standard.prototype.usage = null; + + /** + * Creates a new Standard instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.Reservation.Standard + * @static + * @param {google.cloud.tpu.v2alpha1.Reservation.IStandard=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.Reservation.Standard} Standard instance + */ + Standard.create = function create(properties) { + return new Standard(properties); + }; + + /** + * Encodes the specified Standard message. Does not implicitly {@link google.cloud.tpu.v2alpha1.Reservation.Standard.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.Reservation.Standard + * @static + * @param {google.cloud.tpu.v2alpha1.Reservation.IStandard} message Standard message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Standard.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.size != null && Object.hasOwnProperty.call(message, "size")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.size); + if (message.capacityUnits != null && Object.hasOwnProperty.call(message, "capacityUnits")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.capacityUnits); + if (message.resourceType != null && Object.hasOwnProperty.call(message, "resourceType")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.resourceType); + if (message.interval != null && Object.hasOwnProperty.call(message, "interval")) + $root.google.type.Interval.encode(message.interval, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.usage != null && Object.hasOwnProperty.call(message, "usage")) + $root.google.cloud.tpu.v2alpha1.Reservation.Standard.Usage.encode(message.usage, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Standard message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.Reservation.Standard.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.Reservation.Standard + * @static + * @param {google.cloud.tpu.v2alpha1.Reservation.IStandard} message Standard message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Standard.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Standard message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.Reservation.Standard + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.Reservation.Standard} Standard + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Standard.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.tpu.v2alpha1.Reservation.Standard(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.size = reader.int32(); + break; + } + case 2: { + message.capacityUnits = reader.int32(); + break; + } + case 3: { + message.resourceType = reader.string(); + break; + } + case 4: { + message.interval = $root.google.type.Interval.decode(reader, reader.uint32()); + break; + } + case 5: { + message.usage = $root.google.cloud.tpu.v2alpha1.Reservation.Standard.Usage.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Standard message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.Reservation.Standard + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.Reservation.Standard} Standard + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Standard.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Standard message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.Reservation.Standard + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Standard.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.size != null && message.hasOwnProperty("size")) + if (!$util.isInteger(message.size)) + return "size: integer expected"; + if (message.capacityUnits != null && message.hasOwnProperty("capacityUnits")) + switch (message.capacityUnits) { + default: + return "capacityUnits: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.resourceType != null && message.hasOwnProperty("resourceType")) + if (!$util.isString(message.resourceType)) + return "resourceType: string expected"; + if (message.interval != null && message.hasOwnProperty("interval")) { + var error = $root.google.type.Interval.verify(message.interval); + if (error) + return "interval." + error; + } + if (message.usage != null && message.hasOwnProperty("usage")) { + var error = $root.google.cloud.tpu.v2alpha1.Reservation.Standard.Usage.verify(message.usage); + if (error) + return "usage." + error; + } + return null; + }; + + /** + * Creates a Standard message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.Reservation.Standard + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.Reservation.Standard} Standard + */ + Standard.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.Reservation.Standard) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.Reservation.Standard(); + if (object.size != null) + message.size = object.size | 0; + switch (object.capacityUnits) { + default: + if (typeof object.capacityUnits === "number") { + message.capacityUnits = object.capacityUnits; + break; + } + break; + case "CAPACITY_UNITS_UNSPECIFIED": + case 0: + message.capacityUnits = 0; + break; + case "CORES": + case 1: + message.capacityUnits = 1; + break; + case "CHIPS": + case 2: + message.capacityUnits = 2; + break; + } + if (object.resourceType != null) + message.resourceType = String(object.resourceType); + if (object.interval != null) { + if (typeof object.interval !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.Reservation.Standard.interval: object expected"); + message.interval = $root.google.type.Interval.fromObject(object.interval); + } + if (object.usage != null) { + if (typeof object.usage !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.Reservation.Standard.usage: object expected"); + message.usage = $root.google.cloud.tpu.v2alpha1.Reservation.Standard.Usage.fromObject(object.usage); + } + return message; + }; + + /** + * Creates a plain object from a Standard message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.Reservation.Standard + * @static + * @param {google.cloud.tpu.v2alpha1.Reservation.Standard} message Standard + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Standard.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.size = 0; + object.capacityUnits = options.enums === String ? "CAPACITY_UNITS_UNSPECIFIED" : 0; + object.resourceType = ""; + object.interval = null; + object.usage = null; + } + if (message.size != null && message.hasOwnProperty("size")) + object.size = message.size; + if (message.capacityUnits != null && message.hasOwnProperty("capacityUnits")) + object.capacityUnits = options.enums === String ? $root.google.cloud.tpu.v2alpha1.Reservation.Standard.CapacityUnits[message.capacityUnits] === undefined ? message.capacityUnits : $root.google.cloud.tpu.v2alpha1.Reservation.Standard.CapacityUnits[message.capacityUnits] : message.capacityUnits; + if (message.resourceType != null && message.hasOwnProperty("resourceType")) + object.resourceType = message.resourceType; + if (message.interval != null && message.hasOwnProperty("interval")) + object.interval = $root.google.type.Interval.toObject(message.interval, options); + if (message.usage != null && message.hasOwnProperty("usage")) + object.usage = $root.google.cloud.tpu.v2alpha1.Reservation.Standard.Usage.toObject(message.usage, options); + return object; + }; + + /** + * Converts this Standard to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.Reservation.Standard + * @instance + * @returns {Object.} JSON object + */ + Standard.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Standard + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.Reservation.Standard + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Standard.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.Reservation.Standard"; + }; + + /** + * CapacityUnits enum. + * @name google.cloud.tpu.v2alpha1.Reservation.Standard.CapacityUnits + * @enum {number} + * @property {number} CAPACITY_UNITS_UNSPECIFIED=0 CAPACITY_UNITS_UNSPECIFIED value + * @property {number} CORES=1 CORES value + * @property {number} CHIPS=2 CHIPS value + */ + Standard.CapacityUnits = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CAPACITY_UNITS_UNSPECIFIED"] = 0; + values[valuesById[1] = "CORES"] = 1; + values[valuesById[2] = "CHIPS"] = 2; + return values; + })(); + + Standard.Usage = (function() { + + /** + * Properties of a Usage. + * @memberof google.cloud.tpu.v2alpha1.Reservation.Standard + * @interface IUsage + * @property {number|Long|null} [total] Usage total + */ + + /** + * Constructs a new Usage. + * @memberof google.cloud.tpu.v2alpha1.Reservation.Standard + * @classdesc Represents a Usage. + * @implements IUsage + * @constructor + * @param {google.cloud.tpu.v2alpha1.Reservation.Standard.IUsage=} [properties] Properties to set + */ + function Usage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Usage total. + * @member {number|Long} total + * @memberof google.cloud.tpu.v2alpha1.Reservation.Standard.Usage + * @instance + */ + Usage.prototype.total = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new Usage instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.Reservation.Standard.Usage + * @static + * @param {google.cloud.tpu.v2alpha1.Reservation.Standard.IUsage=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.Reservation.Standard.Usage} Usage instance + */ + Usage.create = function create(properties) { + return new Usage(properties); + }; + + /** + * Encodes the specified Usage message. Does not implicitly {@link google.cloud.tpu.v2alpha1.Reservation.Standard.Usage.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.Reservation.Standard.Usage + * @static + * @param {google.cloud.tpu.v2alpha1.Reservation.Standard.IUsage} message Usage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Usage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.total != null && Object.hasOwnProperty.call(message, "total")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.total); + return writer; + }; + + /** + * Encodes the specified Usage message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.Reservation.Standard.Usage.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.Reservation.Standard.Usage + * @static + * @param {google.cloud.tpu.v2alpha1.Reservation.Standard.IUsage} message Usage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Usage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Usage message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.Reservation.Standard.Usage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.Reservation.Standard.Usage} Usage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Usage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.tpu.v2alpha1.Reservation.Standard.Usage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.total = reader.int64(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Usage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.Reservation.Standard.Usage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.Reservation.Standard.Usage} Usage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Usage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Usage message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.Reservation.Standard.Usage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Usage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.total != null && message.hasOwnProperty("total")) + if (!$util.isInteger(message.total) && !(message.total && $util.isInteger(message.total.low) && $util.isInteger(message.total.high))) + return "total: integer|Long expected"; + return null; + }; + + /** + * Creates a Usage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.Reservation.Standard.Usage + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.Reservation.Standard.Usage} Usage + */ + Usage.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.Reservation.Standard.Usage) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.Reservation.Standard.Usage(); + if (object.total != null) + if ($util.Long) + (message.total = $util.Long.fromValue(object.total)).unsigned = false; + else if (typeof object.total === "string") + message.total = parseInt(object.total, 10); + else if (typeof object.total === "number") + message.total = object.total; + else if (typeof object.total === "object") + message.total = new $util.LongBits(object.total.low >>> 0, object.total.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a Usage message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.Reservation.Standard.Usage + * @static + * @param {google.cloud.tpu.v2alpha1.Reservation.Standard.Usage} message Usage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Usage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.total = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.total = options.longs === String ? "0" : 0; + if (message.total != null && message.hasOwnProperty("total")) + if (typeof message.total === "number") + object.total = options.longs === String ? String(message.total) : message.total; + else + object.total = options.longs === String ? $util.Long.prototype.toString.call(message.total) : options.longs === Number ? new $util.LongBits(message.total.low >>> 0, message.total.high >>> 0).toNumber() : message.total; + return object; + }; + + /** + * Converts this Usage to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.Reservation.Standard.Usage + * @instance + * @returns {Object.} JSON object + */ + Usage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Usage + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.Reservation.Standard.Usage + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Usage.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.Reservation.Standard.Usage"; + }; + + return Usage; + })(); + + return Standard; + })(); + + /** + * State enum. + * @name google.cloud.tpu.v2alpha1.Reservation.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} APPROVED=3 APPROVED value + * @property {number} PROVISIONING=4 PROVISIONING value + * @property {number} ACTIVE=5 ACTIVE value + * @property {number} DEPROVISIONING=6 DEPROVISIONING value + * @property {number} EXPIRED=7 EXPIRED value + * @property {number} FAILED=8 FAILED value + */ + Reservation.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[3] = "APPROVED"] = 3; + values[valuesById[4] = "PROVISIONING"] = 4; + values[valuesById[5] = "ACTIVE"] = 5; + values[valuesById[6] = "DEPROVISIONING"] = 6; + values[valuesById[7] = "EXPIRED"] = 7; + values[valuesById[8] = "FAILED"] = 8; + return values; + })(); + + return Reservation; + })(); + + v2alpha1.ListReservationsRequest = (function() { + + /** + * Properties of a ListReservationsRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IListReservationsRequest + * @property {string|null} [parent] ListReservationsRequest parent + * @property {number|null} [pageSize] ListReservationsRequest pageSize + * @property {string|null} [pageToken] ListReservationsRequest pageToken + */ + + /** + * Constructs a new ListReservationsRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a ListReservationsRequest. + * @implements IListReservationsRequest + * @constructor + * @param {google.cloud.tpu.v2alpha1.IListReservationsRequest=} [properties] Properties to set + */ + function ListReservationsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListReservationsRequest parent. + * @member {string} parent + * @memberof google.cloud.tpu.v2alpha1.ListReservationsRequest + * @instance + */ + ListReservationsRequest.prototype.parent = ""; + + /** + * ListReservationsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.tpu.v2alpha1.ListReservationsRequest + * @instance + */ + ListReservationsRequest.prototype.pageSize = 0; + + /** + * ListReservationsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.tpu.v2alpha1.ListReservationsRequest + * @instance + */ + ListReservationsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListReservationsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.ListReservationsRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IListReservationsRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.ListReservationsRequest} ListReservationsRequest instance + */ + ListReservationsRequest.create = function create(properties) { + return new ListReservationsRequest(properties); + }; + + /** + * Encodes the specified ListReservationsRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListReservationsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.ListReservationsRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IListReservationsRequest} message ListReservationsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListReservationsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListReservationsRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListReservationsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.ListReservationsRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IListReservationsRequest} message ListReservationsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListReservationsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListReservationsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.ListReservationsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.ListReservationsRequest} ListReservationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListReservationsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.tpu.v2alpha1.ListReservationsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListReservationsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.ListReservationsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.ListReservationsRequest} ListReservationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListReservationsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListReservationsRequest message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.ListReservationsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListReservationsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a ListReservationsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.ListReservationsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.ListReservationsRequest} ListReservationsRequest + */ + ListReservationsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.ListReservationsRequest) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.ListReservationsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListReservationsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.ListReservationsRequest + * @static + * @param {google.cloud.tpu.v2alpha1.ListReservationsRequest} message ListReservationsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListReservationsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + return object; + }; + + /** + * Converts this ListReservationsRequest to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.ListReservationsRequest + * @instance + * @returns {Object.} JSON object + */ + ListReservationsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListReservationsRequest + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.ListReservationsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListReservationsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.ListReservationsRequest"; + }; + + return ListReservationsRequest; + })(); + + v2alpha1.ListReservationsResponse = (function() { + + /** + * Properties of a ListReservationsResponse. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IListReservationsResponse + * @property {Array.|null} [reservations] ListReservationsResponse reservations + * @property {string|null} [nextPageToken] ListReservationsResponse nextPageToken + */ + + /** + * Constructs a new ListReservationsResponse. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a ListReservationsResponse. + * @implements IListReservationsResponse + * @constructor + * @param {google.cloud.tpu.v2alpha1.IListReservationsResponse=} [properties] Properties to set + */ + function ListReservationsResponse(properties) { + this.reservations = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListReservationsResponse reservations. + * @member {Array.} reservations + * @memberof google.cloud.tpu.v2alpha1.ListReservationsResponse + * @instance + */ + ListReservationsResponse.prototype.reservations = $util.emptyArray; + + /** + * ListReservationsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.tpu.v2alpha1.ListReservationsResponse + * @instance + */ + ListReservationsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListReservationsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.ListReservationsResponse + * @static + * @param {google.cloud.tpu.v2alpha1.IListReservationsResponse=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.ListReservationsResponse} ListReservationsResponse instance + */ + ListReservationsResponse.create = function create(properties) { + return new ListReservationsResponse(properties); + }; + + /** + * Encodes the specified ListReservationsResponse message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListReservationsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.ListReservationsResponse + * @static + * @param {google.cloud.tpu.v2alpha1.IListReservationsResponse} message ListReservationsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListReservationsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.reservations != null && message.reservations.length) + for (var i = 0; i < message.reservations.length; ++i) + $root.google.cloud.tpu.v2alpha1.Reservation.encode(message.reservations[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListReservationsResponse message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListReservationsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.ListReservationsResponse + * @static + * @param {google.cloud.tpu.v2alpha1.IListReservationsResponse} message ListReservationsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListReservationsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListReservationsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.ListReservationsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.ListReservationsResponse} ListReservationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListReservationsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.tpu.v2alpha1.ListReservationsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.reservations && message.reservations.length)) + message.reservations = []; + message.reservations.push($root.google.cloud.tpu.v2alpha1.Reservation.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListReservationsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.ListReservationsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.ListReservationsResponse} ListReservationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListReservationsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListReservationsResponse message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.ListReservationsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListReservationsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.reservations != null && message.hasOwnProperty("reservations")) { + if (!Array.isArray(message.reservations)) + return "reservations: array expected"; + for (var i = 0; i < message.reservations.length; ++i) { + var error = $root.google.cloud.tpu.v2alpha1.Reservation.verify(message.reservations[i]); + if (error) + return "reservations." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListReservationsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.ListReservationsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.ListReservationsResponse} ListReservationsResponse + */ + ListReservationsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.ListReservationsResponse) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.ListReservationsResponse(); + if (object.reservations) { + if (!Array.isArray(object.reservations)) + throw TypeError(".google.cloud.tpu.v2alpha1.ListReservationsResponse.reservations: array expected"); + message.reservations = []; + for (var i = 0; i < object.reservations.length; ++i) { + if (typeof object.reservations[i] !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.ListReservationsResponse.reservations: object expected"); + message.reservations[i] = $root.google.cloud.tpu.v2alpha1.Reservation.fromObject(object.reservations[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListReservationsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.ListReservationsResponse + * @static + * @param {google.cloud.tpu.v2alpha1.ListReservationsResponse} message ListReservationsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListReservationsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.reservations = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.reservations && message.reservations.length) { + object.reservations = []; + for (var j = 0; j < message.reservations.length; ++j) + object.reservations[j] = $root.google.cloud.tpu.v2alpha1.Reservation.toObject(message.reservations[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListReservationsResponse to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.ListReservationsResponse + * @instance + * @returns {Object.} JSON object + */ + ListReservationsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListReservationsResponse + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.ListReservationsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListReservationsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.ListReservationsResponse"; + }; + + return ListReservationsResponse; + })(); + + v2alpha1.AcceleratorConfig = (function() { + + /** + * Properties of an AcceleratorConfig. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IAcceleratorConfig + * @property {google.cloud.tpu.v2alpha1.AcceleratorConfig.Type|null} [type] AcceleratorConfig type + * @property {string|null} [topology] AcceleratorConfig topology + */ + + /** + * Constructs a new AcceleratorConfig. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents an AcceleratorConfig. + * @implements IAcceleratorConfig + * @constructor + * @param {google.cloud.tpu.v2alpha1.IAcceleratorConfig=} [properties] Properties to set + */ + function AcceleratorConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AcceleratorConfig type. + * @member {google.cloud.tpu.v2alpha1.AcceleratorConfig.Type} type + * @memberof google.cloud.tpu.v2alpha1.AcceleratorConfig + * @instance + */ + AcceleratorConfig.prototype.type = 0; + + /** + * AcceleratorConfig topology. + * @member {string} topology + * @memberof google.cloud.tpu.v2alpha1.AcceleratorConfig + * @instance + */ + AcceleratorConfig.prototype.topology = ""; + + /** + * Creates a new AcceleratorConfig instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.AcceleratorConfig + * @static + * @param {google.cloud.tpu.v2alpha1.IAcceleratorConfig=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.AcceleratorConfig} AcceleratorConfig instance + */ + AcceleratorConfig.create = function create(properties) { + return new AcceleratorConfig(properties); + }; + + /** + * Encodes the specified AcceleratorConfig message. Does not implicitly {@link google.cloud.tpu.v2alpha1.AcceleratorConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.AcceleratorConfig + * @static + * @param {google.cloud.tpu.v2alpha1.IAcceleratorConfig} message AcceleratorConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AcceleratorConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type); + if (message.topology != null && Object.hasOwnProperty.call(message, "topology")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.topology); + return writer; + }; + + /** + * Encodes the specified AcceleratorConfig message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.AcceleratorConfig.verify|verify} messages. * @function encodeDelimited * @memberof google.cloud.tpu.v2alpha1.AcceleratorConfig * @static @@ -38088,6 +40276,9 @@ case 2: case 4: case 7: + case 9: + case 10: + case 11: break; } if (message.topology != null && message.hasOwnProperty("topology")) @@ -38131,6 +40322,18 @@ case 7: message.type = 7; break; + case "V5LITE_POD": + case 9: + message.type = 9; + break; + case "V5P": + case 10: + message.type = 10; + break; + case "V6E": + case 11: + message.type = 11; + break; } if (object.topology != null) message.topology = String(object.topology); @@ -38195,6 +40398,9 @@ * @property {number} V2=2 V2 value * @property {number} V3=4 V3 value * @property {number} V4=7 V4 value + * @property {number} V5LITE_POD=9 V5LITE_POD value + * @property {number} V5P=10 V5P value + * @property {number} V6E=11 V6E value */ AcceleratorConfig.Type = (function() { var valuesById = {}, values = Object.create(valuesById); @@ -38202,6 +40408,9 @@ values[valuesById[2] = "V2"] = 2; values[valuesById[4] = "V3"] = 4; values[valuesById[7] = "V4"] = 7; + values[valuesById[9] = "V5LITE_POD"] = 9; + values[valuesById[10] = "V5P"] = 10; + values[valuesById[11] = "V6E"] = 11; return values; })(); @@ -38798,70 +41007,561 @@ }; /** - * Creates a CustomerEncryptionKey message from a plain object. Also converts values to their respective internal types. + * Creates a CustomerEncryptionKey message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.CustomerEncryptionKey + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.CustomerEncryptionKey} CustomerEncryptionKey + */ + CustomerEncryptionKey.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.CustomerEncryptionKey) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.CustomerEncryptionKey(); + if (object.kmsKeyName != null) + message.kmsKeyName = String(object.kmsKeyName); + return message; + }; + + /** + * Creates a plain object from a CustomerEncryptionKey message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.CustomerEncryptionKey + * @static + * @param {google.cloud.tpu.v2alpha1.CustomerEncryptionKey} message CustomerEncryptionKey + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CustomerEncryptionKey.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.kmsKeyName != null && message.hasOwnProperty("kmsKeyName")) { + object.kmsKeyName = message.kmsKeyName; + if (options.oneofs) + object.key = "kmsKeyName"; + } + return object; + }; + + /** + * Converts this CustomerEncryptionKey to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.CustomerEncryptionKey + * @instance + * @returns {Object.} JSON object + */ + CustomerEncryptionKey.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CustomerEncryptionKey + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.CustomerEncryptionKey + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CustomerEncryptionKey.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.CustomerEncryptionKey"; + }; + + return CustomerEncryptionKey; + })(); + + v2alpha1.UpcomingMaintenance = (function() { + + /** + * Properties of an UpcomingMaintenance. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IUpcomingMaintenance + * @property {google.cloud.tpu.v2alpha1.UpcomingMaintenance.MaintenanceType|null} [type] UpcomingMaintenance type + * @property {boolean|null} [canReschedule] UpcomingMaintenance canReschedule + * @property {string|null} [windowStartTime] UpcomingMaintenance windowStartTime + * @property {string|null} [windowEndTime] UpcomingMaintenance windowEndTime + * @property {string|null} [latestWindowStartTime] UpcomingMaintenance latestWindowStartTime + * @property {google.cloud.tpu.v2alpha1.UpcomingMaintenance.MaintenanceStatus|null} [maintenanceStatus] UpcomingMaintenance maintenanceStatus + */ + + /** + * Constructs a new UpcomingMaintenance. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents an UpcomingMaintenance. + * @implements IUpcomingMaintenance + * @constructor + * @param {google.cloud.tpu.v2alpha1.IUpcomingMaintenance=} [properties] Properties to set + */ + function UpcomingMaintenance(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpcomingMaintenance type. + * @member {google.cloud.tpu.v2alpha1.UpcomingMaintenance.MaintenanceType|null|undefined} type + * @memberof google.cloud.tpu.v2alpha1.UpcomingMaintenance + * @instance + */ + UpcomingMaintenance.prototype.type = null; + + /** + * UpcomingMaintenance canReschedule. + * @member {boolean|null|undefined} canReschedule + * @memberof google.cloud.tpu.v2alpha1.UpcomingMaintenance + * @instance + */ + UpcomingMaintenance.prototype.canReschedule = null; + + /** + * UpcomingMaintenance windowStartTime. + * @member {string|null|undefined} windowStartTime + * @memberof google.cloud.tpu.v2alpha1.UpcomingMaintenance + * @instance + */ + UpcomingMaintenance.prototype.windowStartTime = null; + + /** + * UpcomingMaintenance windowEndTime. + * @member {string|null|undefined} windowEndTime + * @memberof google.cloud.tpu.v2alpha1.UpcomingMaintenance + * @instance + */ + UpcomingMaintenance.prototype.windowEndTime = null; + + /** + * UpcomingMaintenance latestWindowStartTime. + * @member {string|null|undefined} latestWindowStartTime + * @memberof google.cloud.tpu.v2alpha1.UpcomingMaintenance + * @instance + */ + UpcomingMaintenance.prototype.latestWindowStartTime = null; + + /** + * UpcomingMaintenance maintenanceStatus. + * @member {google.cloud.tpu.v2alpha1.UpcomingMaintenance.MaintenanceStatus|null|undefined} maintenanceStatus + * @memberof google.cloud.tpu.v2alpha1.UpcomingMaintenance + * @instance + */ + UpcomingMaintenance.prototype.maintenanceStatus = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * UpcomingMaintenance _type. + * @member {"type"|undefined} _type + * @memberof google.cloud.tpu.v2alpha1.UpcomingMaintenance + * @instance + */ + Object.defineProperty(UpcomingMaintenance.prototype, "_type", { + get: $util.oneOfGetter($oneOfFields = ["type"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * UpcomingMaintenance _canReschedule. + * @member {"canReschedule"|undefined} _canReschedule + * @memberof google.cloud.tpu.v2alpha1.UpcomingMaintenance + * @instance + */ + Object.defineProperty(UpcomingMaintenance.prototype, "_canReschedule", { + get: $util.oneOfGetter($oneOfFields = ["canReschedule"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * UpcomingMaintenance _windowStartTime. + * @member {"windowStartTime"|undefined} _windowStartTime + * @memberof google.cloud.tpu.v2alpha1.UpcomingMaintenance + * @instance + */ + Object.defineProperty(UpcomingMaintenance.prototype, "_windowStartTime", { + get: $util.oneOfGetter($oneOfFields = ["windowStartTime"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * UpcomingMaintenance _windowEndTime. + * @member {"windowEndTime"|undefined} _windowEndTime + * @memberof google.cloud.tpu.v2alpha1.UpcomingMaintenance + * @instance + */ + Object.defineProperty(UpcomingMaintenance.prototype, "_windowEndTime", { + get: $util.oneOfGetter($oneOfFields = ["windowEndTime"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * UpcomingMaintenance _latestWindowStartTime. + * @member {"latestWindowStartTime"|undefined} _latestWindowStartTime + * @memberof google.cloud.tpu.v2alpha1.UpcomingMaintenance + * @instance + */ + Object.defineProperty(UpcomingMaintenance.prototype, "_latestWindowStartTime", { + get: $util.oneOfGetter($oneOfFields = ["latestWindowStartTime"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * UpcomingMaintenance _maintenanceStatus. + * @member {"maintenanceStatus"|undefined} _maintenanceStatus + * @memberof google.cloud.tpu.v2alpha1.UpcomingMaintenance + * @instance + */ + Object.defineProperty(UpcomingMaintenance.prototype, "_maintenanceStatus", { + get: $util.oneOfGetter($oneOfFields = ["maintenanceStatus"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new UpcomingMaintenance instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.UpcomingMaintenance + * @static + * @param {google.cloud.tpu.v2alpha1.IUpcomingMaintenance=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.UpcomingMaintenance} UpcomingMaintenance instance + */ + UpcomingMaintenance.create = function create(properties) { + return new UpcomingMaintenance(properties); + }; + + /** + * Encodes the specified UpcomingMaintenance message. Does not implicitly {@link google.cloud.tpu.v2alpha1.UpcomingMaintenance.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.UpcomingMaintenance + * @static + * @param {google.cloud.tpu.v2alpha1.IUpcomingMaintenance} message UpcomingMaintenance message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpcomingMaintenance.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type); + if (message.canReschedule != null && Object.hasOwnProperty.call(message, "canReschedule")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.canReschedule); + if (message.windowStartTime != null && Object.hasOwnProperty.call(message, "windowStartTime")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.windowStartTime); + if (message.windowEndTime != null && Object.hasOwnProperty.call(message, "windowEndTime")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.windowEndTime); + if (message.latestWindowStartTime != null && Object.hasOwnProperty.call(message, "latestWindowStartTime")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.latestWindowStartTime); + if (message.maintenanceStatus != null && Object.hasOwnProperty.call(message, "maintenanceStatus")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.maintenanceStatus); + return writer; + }; + + /** + * Encodes the specified UpcomingMaintenance message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.UpcomingMaintenance.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.UpcomingMaintenance + * @static + * @param {google.cloud.tpu.v2alpha1.IUpcomingMaintenance} message UpcomingMaintenance message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpcomingMaintenance.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpcomingMaintenance message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.UpcomingMaintenance + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.UpcomingMaintenance} UpcomingMaintenance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpcomingMaintenance.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.tpu.v2alpha1.UpcomingMaintenance(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.type = reader.int32(); + break; + } + case 5: { + message.canReschedule = reader.bool(); + break; + } + case 6: { + message.windowStartTime = reader.string(); + break; + } + case 7: { + message.windowEndTime = reader.string(); + break; + } + case 8: { + message.latestWindowStartTime = reader.string(); + break; + } + case 9: { + message.maintenanceStatus = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpcomingMaintenance message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.UpcomingMaintenance + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.UpcomingMaintenance} UpcomingMaintenance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpcomingMaintenance.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpcomingMaintenance message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.UpcomingMaintenance + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpcomingMaintenance.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.type != null && message.hasOwnProperty("type")) { + properties._type = 1; + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + break; + } + } + if (message.canReschedule != null && message.hasOwnProperty("canReschedule")) { + properties._canReschedule = 1; + if (typeof message.canReschedule !== "boolean") + return "canReschedule: boolean expected"; + } + if (message.windowStartTime != null && message.hasOwnProperty("windowStartTime")) { + properties._windowStartTime = 1; + if (!$util.isString(message.windowStartTime)) + return "windowStartTime: string expected"; + } + if (message.windowEndTime != null && message.hasOwnProperty("windowEndTime")) { + properties._windowEndTime = 1; + if (!$util.isString(message.windowEndTime)) + return "windowEndTime: string expected"; + } + if (message.latestWindowStartTime != null && message.hasOwnProperty("latestWindowStartTime")) { + properties._latestWindowStartTime = 1; + if (!$util.isString(message.latestWindowStartTime)) + return "latestWindowStartTime: string expected"; + } + if (message.maintenanceStatus != null && message.hasOwnProperty("maintenanceStatus")) { + properties._maintenanceStatus = 1; + switch (message.maintenanceStatus) { + default: + return "maintenanceStatus: enum value expected"; + case 0: + case 1: + case 2: + break; + } + } + return null; + }; + + /** + * Creates an UpcomingMaintenance message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.tpu.v2alpha1.CustomerEncryptionKey + * @memberof google.cloud.tpu.v2alpha1.UpcomingMaintenance * @static * @param {Object.} object Plain object - * @returns {google.cloud.tpu.v2alpha1.CustomerEncryptionKey} CustomerEncryptionKey + * @returns {google.cloud.tpu.v2alpha1.UpcomingMaintenance} UpcomingMaintenance */ - CustomerEncryptionKey.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.tpu.v2alpha1.CustomerEncryptionKey) + UpcomingMaintenance.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.UpcomingMaintenance) return object; - var message = new $root.google.cloud.tpu.v2alpha1.CustomerEncryptionKey(); - if (object.kmsKeyName != null) - message.kmsKeyName = String(object.kmsKeyName); + var message = new $root.google.cloud.tpu.v2alpha1.UpcomingMaintenance(); + switch (object.type) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; + case "UNKNOWN_TYPE": + case 0: + message.type = 0; + break; + case "SCHEDULED": + case 1: + message.type = 1; + break; + case "UNSCHEDULED": + case 2: + message.type = 2; + break; + } + if (object.canReschedule != null) + message.canReschedule = Boolean(object.canReschedule); + if (object.windowStartTime != null) + message.windowStartTime = String(object.windowStartTime); + if (object.windowEndTime != null) + message.windowEndTime = String(object.windowEndTime); + if (object.latestWindowStartTime != null) + message.latestWindowStartTime = String(object.latestWindowStartTime); + switch (object.maintenanceStatus) { + default: + if (typeof object.maintenanceStatus === "number") { + message.maintenanceStatus = object.maintenanceStatus; + break; + } + break; + case "UNKNOWN": + case 0: + message.maintenanceStatus = 0; + break; + case "PENDING": + case 1: + message.maintenanceStatus = 1; + break; + case "ONGOING": + case 2: + message.maintenanceStatus = 2; + break; + } return message; }; /** - * Creates a plain object from a CustomerEncryptionKey message. Also converts values to other types if specified. + * Creates a plain object from an UpcomingMaintenance message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.tpu.v2alpha1.CustomerEncryptionKey + * @memberof google.cloud.tpu.v2alpha1.UpcomingMaintenance * @static - * @param {google.cloud.tpu.v2alpha1.CustomerEncryptionKey} message CustomerEncryptionKey + * @param {google.cloud.tpu.v2alpha1.UpcomingMaintenance} message UpcomingMaintenance * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CustomerEncryptionKey.toObject = function toObject(message, options) { + UpcomingMaintenance.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (message.kmsKeyName != null && message.hasOwnProperty("kmsKeyName")) { - object.kmsKeyName = message.kmsKeyName; + if (message.type != null && message.hasOwnProperty("type")) { + object.type = options.enums === String ? $root.google.cloud.tpu.v2alpha1.UpcomingMaintenance.MaintenanceType[message.type] === undefined ? message.type : $root.google.cloud.tpu.v2alpha1.UpcomingMaintenance.MaintenanceType[message.type] : message.type; if (options.oneofs) - object.key = "kmsKeyName"; + object._type = "type"; + } + if (message.canReschedule != null && message.hasOwnProperty("canReschedule")) { + object.canReschedule = message.canReschedule; + if (options.oneofs) + object._canReschedule = "canReschedule"; + } + if (message.windowStartTime != null && message.hasOwnProperty("windowStartTime")) { + object.windowStartTime = message.windowStartTime; + if (options.oneofs) + object._windowStartTime = "windowStartTime"; + } + if (message.windowEndTime != null && message.hasOwnProperty("windowEndTime")) { + object.windowEndTime = message.windowEndTime; + if (options.oneofs) + object._windowEndTime = "windowEndTime"; + } + if (message.latestWindowStartTime != null && message.hasOwnProperty("latestWindowStartTime")) { + object.latestWindowStartTime = message.latestWindowStartTime; + if (options.oneofs) + object._latestWindowStartTime = "latestWindowStartTime"; + } + if (message.maintenanceStatus != null && message.hasOwnProperty("maintenanceStatus")) { + object.maintenanceStatus = options.enums === String ? $root.google.cloud.tpu.v2alpha1.UpcomingMaintenance.MaintenanceStatus[message.maintenanceStatus] === undefined ? message.maintenanceStatus : $root.google.cloud.tpu.v2alpha1.UpcomingMaintenance.MaintenanceStatus[message.maintenanceStatus] : message.maintenanceStatus; + if (options.oneofs) + object._maintenanceStatus = "maintenanceStatus"; } return object; }; /** - * Converts this CustomerEncryptionKey to JSON. + * Converts this UpcomingMaintenance to JSON. * @function toJSON - * @memberof google.cloud.tpu.v2alpha1.CustomerEncryptionKey + * @memberof google.cloud.tpu.v2alpha1.UpcomingMaintenance * @instance * @returns {Object.} JSON object */ - CustomerEncryptionKey.prototype.toJSON = function toJSON() { + UpcomingMaintenance.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for CustomerEncryptionKey + * Gets the default type url for UpcomingMaintenance * @function getTypeUrl - * @memberof google.cloud.tpu.v2alpha1.CustomerEncryptionKey + * @memberof google.cloud.tpu.v2alpha1.UpcomingMaintenance * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - CustomerEncryptionKey.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + UpcomingMaintenance.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.CustomerEncryptionKey"; + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.UpcomingMaintenance"; }; - return CustomerEncryptionKey; + /** + * MaintenanceType enum. + * @name google.cloud.tpu.v2alpha1.UpcomingMaintenance.MaintenanceType + * @enum {number} + * @property {number} UNKNOWN_TYPE=0 UNKNOWN_TYPE value + * @property {number} SCHEDULED=1 SCHEDULED value + * @property {number} UNSCHEDULED=2 UNSCHEDULED value + */ + UpcomingMaintenance.MaintenanceType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNKNOWN_TYPE"] = 0; + values[valuesById[1] = "SCHEDULED"] = 1; + values[valuesById[2] = "UNSCHEDULED"] = 2; + return values; + })(); + + /** + * MaintenanceStatus enum. + * @name google.cloud.tpu.v2alpha1.UpcomingMaintenance.MaintenanceStatus + * @enum {number} + * @property {number} UNKNOWN=0 UNKNOWN value + * @property {number} PENDING=1 PENDING value + * @property {number} ONGOING=2 ONGOING value + */ + UpcomingMaintenance.MaintenanceStatus = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNKNOWN"] = 0; + values[valuesById[1] = "PENDING"] = 1; + values[valuesById[2] = "ONGOING"] = 2; + return values; + })(); + + return UpcomingMaintenance; })(); return v2alpha1; @@ -44486,6 +47186,263 @@ return ResourceReference; })(); + api.FieldInfo = (function() { + + /** + * Properties of a FieldInfo. + * @memberof google.api + * @interface IFieldInfo + * @property {google.api.FieldInfo.Format|null} [format] FieldInfo format + */ + + /** + * Constructs a new FieldInfo. + * @memberof google.api + * @classdesc Represents a FieldInfo. + * @implements IFieldInfo + * @constructor + * @param {google.api.IFieldInfo=} [properties] Properties to set + */ + function FieldInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FieldInfo format. + * @member {google.api.FieldInfo.Format} format + * @memberof google.api.FieldInfo + * @instance + */ + FieldInfo.prototype.format = 0; + + /** + * Creates a new FieldInfo instance using the specified properties. + * @function create + * @memberof google.api.FieldInfo + * @static + * @param {google.api.IFieldInfo=} [properties] Properties to set + * @returns {google.api.FieldInfo} FieldInfo instance + */ + FieldInfo.create = function create(properties) { + return new FieldInfo(properties); + }; + + /** + * Encodes the specified FieldInfo message. Does not implicitly {@link google.api.FieldInfo.verify|verify} messages. + * @function encode + * @memberof google.api.FieldInfo + * @static + * @param {google.api.IFieldInfo} message FieldInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.format != null && Object.hasOwnProperty.call(message, "format")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.format); + return writer; + }; + + /** + * Encodes the specified FieldInfo message, length delimited. Does not implicitly {@link google.api.FieldInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.FieldInfo + * @static + * @param {google.api.IFieldInfo} message FieldInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FieldInfo message from the specified reader or buffer. + * @function decode + * @memberof google.api.FieldInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.FieldInfo} FieldInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.FieldInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.format = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FieldInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.FieldInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.FieldInfo} FieldInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldInfo message. + * @function verify + * @memberof google.api.FieldInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.format != null && message.hasOwnProperty("format")) + switch (message.format) { + default: + return "format: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + return null; + }; + + /** + * Creates a FieldInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.FieldInfo + * @static + * @param {Object.} object Plain object + * @returns {google.api.FieldInfo} FieldInfo + */ + FieldInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.FieldInfo) + return object; + var message = new $root.google.api.FieldInfo(); + switch (object.format) { + default: + if (typeof object.format === "number") { + message.format = object.format; + break; + } + break; + case "FORMAT_UNSPECIFIED": + case 0: + message.format = 0; + break; + case "UUID4": + case 1: + message.format = 1; + break; + case "IPV4": + case 2: + message.format = 2; + break; + case "IPV6": + case 3: + message.format = 3; + break; + case "IPV4_OR_IPV6": + case 4: + message.format = 4; + break; + } + return message; + }; + + /** + * Creates a plain object from a FieldInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.FieldInfo + * @static + * @param {google.api.FieldInfo} message FieldInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.format = options.enums === String ? "FORMAT_UNSPECIFIED" : 0; + if (message.format != null && message.hasOwnProperty("format")) + object.format = options.enums === String ? $root.google.api.FieldInfo.Format[message.format] === undefined ? message.format : $root.google.api.FieldInfo.Format[message.format] : message.format; + return object; + }; + + /** + * Converts this FieldInfo to JSON. + * @function toJSON + * @memberof google.api.FieldInfo + * @instance + * @returns {Object.} JSON object + */ + FieldInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FieldInfo + * @function getTypeUrl + * @memberof google.api.FieldInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FieldInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.FieldInfo"; + }; + + /** + * Format enum. + * @name google.api.FieldInfo.Format + * @enum {number} + * @property {number} FORMAT_UNSPECIFIED=0 FORMAT_UNSPECIFIED value + * @property {number} UUID4=1 UUID4 value + * @property {number} IPV4=2 IPV4 value + * @property {number} IPV6=3 IPV6 value + * @property {number} IPV4_OR_IPV6=4 IPV4_OR_IPV6 value + */ + FieldInfo.Format = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "FORMAT_UNSPECIFIED"] = 0; + values[valuesById[1] = "UUID4"] = 1; + values[valuesById[2] = "IPV4"] = 2; + values[valuesById[3] = "IPV6"] = 3; + values[valuesById[4] = "IPV4_OR_IPV6"] = 4; + return values; + })(); + + return FieldInfo; + })(); + return api; })(); @@ -50660,6 +53617,7 @@ * @property {Array.|null} [uninterpretedOption] FieldOptions uninterpretedOption * @property {Array.|null} [".google.api.fieldBehavior"] FieldOptions .google.api.fieldBehavior * @property {google.api.IResourceReference|null} [".google.api.resourceReference"] FieldOptions .google.api.resourceReference + * @property {google.api.IFieldInfo|null} [".google.api.fieldInfo"] FieldOptions .google.api.fieldInfo */ /** @@ -50801,6 +53759,14 @@ */ FieldOptions.prototype[".google.api.resourceReference"] = null; + /** + * FieldOptions .google.api.fieldInfo. + * @member {google.api.IFieldInfo|null|undefined} .google.api.fieldInfo + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype[".google.api.fieldInfo"] = null; + /** * Creates a new FieldOptions instance using the specified properties. * @function create @@ -50862,6 +53828,8 @@ } if (message[".google.api.resourceReference"] != null && Object.hasOwnProperty.call(message, ".google.api.resourceReference")) $root.google.api.ResourceReference.encode(message[".google.api.resourceReference"], writer.uint32(/* id 1055, wireType 2 =*/8442).fork()).ldelim(); + if (message[".google.api.fieldInfo"] != null && Object.hasOwnProperty.call(message, ".google.api.fieldInfo")) + $root.google.api.FieldInfo.encode(message[".google.api.fieldInfo"], writer.uint32(/* id 291403980, wireType 2 =*/2331231842).fork()).ldelim(); return writer; }; @@ -50974,6 +53942,10 @@ message[".google.api.resourceReference"] = $root.google.api.ResourceReference.decode(reader, reader.uint32()); break; } + case 291403980: { + message[".google.api.fieldInfo"] = $root.google.api.FieldInfo.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -51121,6 +54093,11 @@ if (error) return ".google.api.resourceReference." + error; } + if (message[".google.api.fieldInfo"] != null && message.hasOwnProperty(".google.api.fieldInfo")) { + var error = $root.google.api.FieldInfo.verify(message[".google.api.fieldInfo"]); + if (error) + return ".google.api.fieldInfo." + error; + } return null; }; @@ -51340,6 +54317,11 @@ throw TypeError(".google.protobuf.FieldOptions..google.api.resourceReference: object expected"); message[".google.api.resourceReference"] = $root.google.api.ResourceReference.fromObject(object[".google.api.resourceReference"]); } + if (object[".google.api.fieldInfo"] != null) { + if (typeof object[".google.api.fieldInfo"] !== "object") + throw TypeError(".google.protobuf.FieldOptions..google.api.fieldInfo: object expected"); + message[".google.api.fieldInfo"] = $root.google.api.FieldInfo.fromObject(object[".google.api.fieldInfo"]); + } return message; }; @@ -51374,6 +54356,7 @@ object.retention = options.enums === String ? "RETENTION_UNKNOWN" : 0; object.features = null; object[".google.api.resourceReference"] = null; + object[".google.api.fieldInfo"] = null; } if (message.ctype != null && message.hasOwnProperty("ctype")) object.ctype = options.enums === String ? $root.google.protobuf.FieldOptions.CType[message.ctype] === undefined ? message.ctype : $root.google.protobuf.FieldOptions.CType[message.ctype] : message.ctype; @@ -51417,6 +54400,8 @@ } if (message[".google.api.resourceReference"] != null && message.hasOwnProperty(".google.api.resourceReference")) object[".google.api.resourceReference"] = $root.google.api.ResourceReference.toObject(message[".google.api.resourceReference"], options); + if (message[".google.api.fieldInfo"] != null && message.hasOwnProperty(".google.api.fieldInfo")) + object[".google.api.fieldInfo"] = $root.google.api.FieldInfo.toObject(message[".google.api.fieldInfo"], options); return object; }; diff --git a/packages/google-cloud-tpu/protos/protos.json b/packages/google-cloud-tpu/protos/protos.json index 8f8411236e3..b3a96b00e29 100644 --- a/packages/google-cloud-tpu/protos/protos.json +++ b/packages/google-cloud-tpu/protos/protos.json @@ -2630,6 +2630,30 @@ } ] }, + "PerformMaintenance": { + "requestType": "PerformMaintenanceRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2alpha1/{name=projects/*/locations/*/nodes/*}:performMaintenance", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "Node", + "(google.longrunning.operation_info).metadata_type": "OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha1/{name=projects/*/locations/*/nodes/*}:performMaintenance", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Node", + "metadata_type": "OperationMetadata" + } + } + ] + }, "ListQueuedResources": { "requestType": "ListQueuedResourcesRequest", "responseType": "ListQueuedResourcesResponse", @@ -2748,6 +2772,30 @@ } ] }, + "PerformMaintenanceQueuedResource": { + "requestType": "PerformMaintenanceQueuedResourceRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2alpha1/{name=projects/*/locations/*/queuedResources/*}:performMaintenanceQueuedResource", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "QueuedResource", + "(google.longrunning.operation_info).metadata_type": "OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha1/{name=projects/*/locations/*/queuedResources/*}:performMaintenanceQueuedResource", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "QueuedResource", + "metadata_type": "OperationMetadata" + } + } + ] + }, "GenerateServiceIdentity": { "requestType": "GenerateServiceIdentityRequest", "responseType": "GenerateServiceIdentityResponse", @@ -2852,6 +2900,20 @@ } ] }, + "ListReservations": { + "requestType": "ListReservationsRequest", + "responseType": "ListReservationsResponse", + "options": { + "(google.api.http).get": "/v2alpha1/{parent=projects/*/locations/*}/reservations" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2alpha1/{parent=projects/*/locations/*}/reservations" + } + } + ] + }, "SimulateMaintenanceEvent": { "requestType": "SimulateMaintenanceEventRequest", "responseType": "google.longrunning.Operation", @@ -2945,6 +3007,13 @@ "reserved": { "type": "bool", "id": 2 + }, + "spot": { + "type": "bool", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } } } }, @@ -2992,6 +3061,13 @@ "canIpForward": { "type": "bool", "id": 4 + }, + "queueCount": { + "type": "int32", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } } } }, @@ -3054,6 +3130,14 @@ "type": "NetworkConfig", "id": 36 }, + "networkConfigs": { + "rule": "repeated", + "type": "NetworkConfig", + "id": 50, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, "cidrBlock": { "type": "string", "id": 13 @@ -3149,12 +3233,26 @@ "(google.api.field_behavior)": "OUTPUT_ONLY" } }, + "autocheckpointEnabled": { + "type": "bool", + "id": 48, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, "bootDiskConfig": { "type": "BootDiskConfig", "id": 49, "options": { "(google.api.field_behavior)": "OPTIONAL" } + }, + "upcomingMaintenance": { + "type": "UpcomingMaintenance", + "id": 51, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } } }, "nested": { @@ -3174,7 +3272,8 @@ "TERMINATED": 12, "HIDING": 13, "HIDDEN": 14, - "UNHIDING": 15 + "UNHIDING": 15, + "UNKNOWN": 16 } }, "Health": { @@ -3223,6 +3322,13 @@ "(google.api.field_behavior)": "IMMUTABLE" } }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 11, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, "tpu": { "type": "Tpu", "id": 2 @@ -3310,6 +3416,22 @@ "nodeIdPrefix": { "type": "string", "id": 2 + }, + "workloadType": { + "type": "WorkloadType", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "WorkloadType": { + "values": { + "WORKLOAD_TYPE_UNSPECIFIED": 0, + "THROUGHPUT_OPTIMIZED": 1, + "AVAILABILITY_OPTIMIZED": 2 + } } } } @@ -4028,6 +4150,152 @@ } } }, + "PerformMaintenanceRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "tpu.googleapis.com/Node" + } + } + } + }, + "PerformMaintenanceQueuedResourceRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "tpu.googleapis.com/QueuedResource" + } + }, + "nodeNames": { + "rule": "repeated", + "type": "string", + "id": 2 + } + } + }, + "Reservation": { + "options": { + "(google.api.resource).type": "tpu.googleapis.com/Reservation", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/reservations/{reservation}" + }, + "oneofs": { + "kind": { + "oneof": [ + "standard" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "standard": { + "type": "Standard", + "id": 2 + }, + "state": { + "type": "State", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "Standard": { + "fields": { + "size": { + "type": "int32", + "id": 1 + }, + "capacityUnits": { + "type": "CapacityUnits", + "id": 2 + }, + "resourceType": { + "type": "string", + "id": 3 + }, + "interval": { + "type": "google.type.Interval", + "id": 4 + }, + "usage": { + "type": "Usage", + "id": 5 + } + }, + "nested": { + "CapacityUnits": { + "values": { + "CAPACITY_UNITS_UNSPECIFIED": 0, + "CORES": 1, + "CHIPS": 2 + } + }, + "Usage": { + "fields": { + "total": { + "type": "int64", + "id": 1 + } + } + } + } + }, + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "APPROVED": 3, + "PROVISIONING": 4, + "ACTIVE": 5, + "DEPROVISIONING": 6, + "EXPIRED": 7, + "FAILED": 8 + } + } + } + }, + "ListReservationsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "tpu.googleapis.com/Reservation" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "ListReservationsResponse": { + "fields": { + "reservations": { + "rule": "repeated", + "type": "Reservation", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, "AcceleratorConfig": { "fields": { "type": { @@ -4051,7 +4319,10 @@ "TYPE_UNSPECIFIED": 0, "V2": 2, "V3": 4, - "V4": 7 + "V4": 7, + "V5LITE_POD": 9, + "V5P": 10, + "V6E": 11 } } } @@ -4096,6 +4367,100 @@ "id": 7 } } + }, + "UpcomingMaintenance": { + "oneofs": { + "_type": { + "oneof": [ + "type" + ] + }, + "_canReschedule": { + "oneof": [ + "canReschedule" + ] + }, + "_windowStartTime": { + "oneof": [ + "windowStartTime" + ] + }, + "_windowEndTime": { + "oneof": [ + "windowEndTime" + ] + }, + "_latestWindowStartTime": { + "oneof": [ + "latestWindowStartTime" + ] + }, + "_maintenanceStatus": { + "oneof": [ + "maintenanceStatus" + ] + } + }, + "fields": { + "type": { + "type": "MaintenanceType", + "id": 1, + "options": { + "proto3_optional": true + } + }, + "canReschedule": { + "type": "bool", + "id": 5, + "options": { + "proto3_optional": true + } + }, + "windowStartTime": { + "type": "string", + "id": 6, + "options": { + "proto3_optional": true + } + }, + "windowEndTime": { + "type": "string", + "id": 7, + "options": { + "proto3_optional": true + } + }, + "latestWindowStartTime": { + "type": "string", + "id": 8, + "options": { + "proto3_optional": true + } + }, + "maintenanceStatus": { + "type": "MaintenanceStatus", + "id": 9, + "options": { + "proto3_optional": true + } + } + }, + "nested": { + "MaintenanceType": { + "values": { + "UNKNOWN_TYPE": 0, + "SCHEDULED": 1, + "UNSCHEDULED": 2 + } + }, + "MaintenanceStatus": { + "values": { + "UNKNOWN": 0, + "PENDING": 1, + "ONGOING": 2 + } + } + } } } } @@ -4107,7 +4472,7 @@ "options": { "go_package": "google.golang.org/genproto/googleapis/api/annotations;annotations", "java_multiple_files": true, - "java_outer_classname": "ResourceProto", + "java_outer_classname": "FieldInfoProto", "java_package": "com.google.api", "objc_class_prefix": "GAPI", "cc_enable_arenas": true @@ -4590,6 +4955,30 @@ "id": 2 } } + }, + "fieldInfo": { + "type": "google.api.FieldInfo", + "id": 291403980, + "extend": "google.protobuf.FieldOptions" + }, + "FieldInfo": { + "fields": { + "format": { + "type": "Format", + "id": 1 + } + }, + "nested": { + "Format": { + "values": { + "FORMAT_UNSPECIFIED": 0, + "UUID4": 1, + "IPV4": 2, + "IPV6": 3, + "IPV4_OR_IPV6": 4 + } + } + } } } }, diff --git a/packages/google-cloud-tpu/samples/README.md b/packages/google-cloud-tpu/samples/README.md index 5dd38144fe8..7a8b18ebd07 100644 --- a/packages/google-cloud-tpu/samples/README.md +++ b/packages/google-cloud-tpu/samples/README.md @@ -54,7 +54,10 @@ * [Tpu.list_accelerator_types](#tpu.list_accelerator_types) * [Tpu.list_nodes](#tpu.list_nodes) * [Tpu.list_queued_resources](#tpu.list_queued_resources) + * [Tpu.list_reservations](#tpu.list_reservations) * [Tpu.list_runtime_versions](#tpu.list_runtime_versions) + * [Tpu.perform_maintenance](#tpu.perform_maintenance) + * [Tpu.perform_maintenance_queued_resource](#tpu.perform_maintenance_queued_resource) * [Tpu.reset_queued_resource](#tpu.reset_queued_resource) * [Tpu.simulate_maintenance_event](#tpu.simulate_maintenance_event) * [Tpu.start_node](#tpu.start_node) @@ -791,6 +794,23 @@ __Usage:__ +### Tpu.list_reservations + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_reservations.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_reservations.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_reservations.js` + + +----- + + + + ### Tpu.list_runtime_versions View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_runtime_versions.js). @@ -808,6 +828,40 @@ __Usage:__ +### Tpu.perform_maintenance + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.perform_maintenance.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.perform_maintenance.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.perform_maintenance.js` + + +----- + + + + +### Tpu.perform_maintenance_queued_resource + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.perform_maintenance_queued_resource.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.perform_maintenance_queued_resource.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.perform_maintenance_queued_resource.js` + + +----- + + + + ### Tpu.reset_queued_resource View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.reset_queued_resource.js). diff --git a/packages/google-cloud-tpu/samples/generated/v2alpha1/snippet_metadata_google.cloud.tpu.v2alpha1.json b/packages/google-cloud-tpu/samples/generated/v2alpha1/snippet_metadata_google.cloud.tpu.v2alpha1.json index b8b070f55fa..5276fa6be18 100644 --- a/packages/google-cloud-tpu/samples/generated/v2alpha1/snippet_metadata_google.cloud.tpu.v2alpha1.json +++ b/packages/google-cloud-tpu/samples/generated/v2alpha1/snippet_metadata_google.cloud.tpu.v2alpha1.json @@ -319,6 +319,46 @@ } } }, + { + "regionTag": "tpu_v2alpha1_generated_Tpu_PerformMaintenance_async", + "title": "Tpu performMaintenance Sample", + "origin": "API_DEFINITION", + "description": " Perform manual maintenance on a node.", + "canonical": true, + "file": "tpu.perform_maintenance.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "PerformMaintenance", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.PerformMaintenance", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2alpha1.TpuClient" + }, + "method": { + "shortName": "PerformMaintenance", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.PerformMaintenance", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2alpha1.Tpu" + } + } + } + }, { "regionTag": "tpu_v2alpha1_generated_Tpu_ListQueuedResources_async", "title": "Tpu listQueuedResources Sample", @@ -547,6 +587,50 @@ } } }, + { + "regionTag": "tpu_v2alpha1_generated_Tpu_PerformMaintenanceQueuedResource_async", + "title": "Tpu performMaintenanceQueuedResource Sample", + "origin": "API_DEFINITION", + "description": " Perform manual maintenance on specific nodes of a QueuedResource.", + "canonical": true, + "file": "tpu.perform_maintenance_queued_resource.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "PerformMaintenanceQueuedResource", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.PerformMaintenanceQueuedResource", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "node_names", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2alpha1.TpuClient" + }, + "method": { + "shortName": "PerformMaintenanceQueuedResource", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.PerformMaintenanceQueuedResource", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2alpha1.Tpu" + } + } + } + }, { "regionTag": "tpu_v2alpha1_generated_Tpu_GenerateServiceIdentity_async", "title": "Tpu generateServiceIdentity Sample", @@ -827,6 +911,54 @@ } } }, + { + "regionTag": "tpu_v2alpha1_generated_Tpu_ListReservations_async", + "title": "Tpu listReservations Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the reservations for the given project in the given location.", + "canonical": true, + "file": "tpu.list_reservations.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListReservations", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.ListReservations", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.tpu.v2alpha1.ListReservationsResponse", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2alpha1.TpuClient" + }, + "method": { + "shortName": "ListReservations", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.ListReservations", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2alpha1.Tpu" + } + } + } + }, { "regionTag": "tpu_v2alpha1_generated_Tpu_SimulateMaintenanceEvent_async", "title": "Tpu simulateMaintenanceEvent Sample", diff --git a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_reservations.js b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_reservations.js new file mode 100644 index 00000000000..560cb2fba76 --- /dev/null +++ b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_reservations.js @@ -0,0 +1,72 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START tpu_v2alpha1_generated_Tpu_ListReservations_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent for reservations. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return. Defaults to 0 if not specified, + * which means no limit. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous List request, if any. + */ + // const pageToken = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2alpha1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callListReservations() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = tpuClient.listReservationsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListReservations(); + // [END tpu_v2alpha1_generated_Tpu_ListReservations_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.perform_maintenance.js b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.perform_maintenance.js new file mode 100644 index 00000000000..b5b0e86ad5a --- /dev/null +++ b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.perform_maintenance.js @@ -0,0 +1,62 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START tpu_v2alpha1_generated_Tpu_PerformMaintenance_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name. + */ + // const name = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2alpha1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callPerformMaintenance() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await tpuClient.performMaintenance(request); + const [response] = await operation.promise(); + console.log(response); + } + + callPerformMaintenance(); + // [END tpu_v2alpha1_generated_Tpu_PerformMaintenance_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.perform_maintenance_queued_resource.js b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.perform_maintenance_queued_resource.js new file mode 100644 index 00000000000..4cb7059a0c5 --- /dev/null +++ b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.perform_maintenance_queued_resource.js @@ -0,0 +1,67 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START tpu_v2alpha1_generated_Tpu_PerformMaintenanceQueuedResource_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the QueuedResource which holds the nodes to perform + * maintenance on. + */ + // const name = 'abc123' + /** + * The names of the nodes to perform maintenance on. + */ + // const nodeNames = ['abc','def'] + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2alpha1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callPerformMaintenanceQueuedResource() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await tpuClient.performMaintenanceQueuedResource(request); + const [response] = await operation.promise(); + console.log(response); + } + + callPerformMaintenanceQueuedResource(); + // [END tpu_v2alpha1_generated_Tpu_PerformMaintenanceQueuedResource_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-tpu/src/v2alpha1/gapic_metadata.json b/packages/google-cloud-tpu/src/v2alpha1/gapic_metadata.json index 8e1cbeb798b..3646f12a0e4 100644 --- a/packages/google-cloud-tpu/src/v2alpha1/gapic_metadata.json +++ b/packages/google-cloud-tpu/src/v2alpha1/gapic_metadata.json @@ -65,6 +65,11 @@ "updateNode" ] }, + "PerformMaintenance": { + "methods": [ + "performMaintenance" + ] + }, "CreateQueuedResource": { "methods": [ "createQueuedResource" @@ -80,6 +85,11 @@ "resetQueuedResource" ] }, + "PerformMaintenanceQueuedResource": { + "methods": [ + "performMaintenanceQueuedResource" + ] + }, "SimulateMaintenanceEvent": { "methods": [ "simulateMaintenanceEvent" @@ -112,6 +122,13 @@ "listRuntimeVersionsStream", "listRuntimeVersionsAsync" ] + }, + "ListReservations": { + "methods": [ + "listReservations", + "listReservationsStream", + "listReservationsAsync" + ] } } }, @@ -173,6 +190,11 @@ "updateNode" ] }, + "PerformMaintenance": { + "methods": [ + "performMaintenance" + ] + }, "CreateQueuedResource": { "methods": [ "createQueuedResource" @@ -188,6 +210,11 @@ "resetQueuedResource" ] }, + "PerformMaintenanceQueuedResource": { + "methods": [ + "performMaintenanceQueuedResource" + ] + }, "SimulateMaintenanceEvent": { "methods": [ "simulateMaintenanceEvent" @@ -220,6 +247,13 @@ "listRuntimeVersionsStream", "listRuntimeVersionsAsync" ] + }, + "ListReservations": { + "methods": [ + "listReservations", + "listReservationsStream", + "listReservationsAsync" + ] } } } diff --git a/packages/google-cloud-tpu/src/v2alpha1/tpu_client.ts b/packages/google-cloud-tpu/src/v2alpha1/tpu_client.ts index 4d5069dcf8b..07e1f4bbcda 100644 --- a/packages/google-cloud-tpu/src/v2alpha1/tpu_client.ts +++ b/packages/google-cloud-tpu/src/v2alpha1/tpu_client.ts @@ -226,6 +226,9 @@ export class TpuClient { queuedResourcePathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/queuedResources/{queued_resource}' ), + reservationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/reservations/{reservation}' + ), runtimeVersionPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/runtimeVersions/{runtime_version}' ), @@ -255,6 +258,11 @@ export class TpuClient { 'nextPageToken', 'runtimeVersions' ), + listReservations: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'reservations' + ), }; const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); @@ -327,6 +335,12 @@ export class TpuClient { const updateNodeMetadata = protoFilesRoot.lookup( '.google.cloud.tpu.v2alpha1.OperationMetadata' ) as gax.protobuf.Type; + const performMaintenanceResponse = protoFilesRoot.lookup( + '.google.cloud.tpu.v2alpha1.Node' + ) as gax.protobuf.Type; + const performMaintenanceMetadata = protoFilesRoot.lookup( + '.google.cloud.tpu.v2alpha1.OperationMetadata' + ) as gax.protobuf.Type; const createQueuedResourceResponse = protoFilesRoot.lookup( '.google.cloud.tpu.v2alpha1.QueuedResource' ) as gax.protobuf.Type; @@ -345,6 +359,12 @@ export class TpuClient { const resetQueuedResourceMetadata = protoFilesRoot.lookup( '.google.cloud.tpu.v2alpha1.OperationMetadata' ) as gax.protobuf.Type; + const performMaintenanceQueuedResourceResponse = protoFilesRoot.lookup( + '.google.cloud.tpu.v2alpha1.QueuedResource' + ) as gax.protobuf.Type; + const performMaintenanceQueuedResourceMetadata = protoFilesRoot.lookup( + '.google.cloud.tpu.v2alpha1.OperationMetadata' + ) as gax.protobuf.Type; const simulateMaintenanceEventResponse = protoFilesRoot.lookup( '.google.cloud.tpu.v2alpha1.Node' ) as gax.protobuf.Type; @@ -378,6 +398,11 @@ export class TpuClient { updateNodeResponse.decode.bind(updateNodeResponse), updateNodeMetadata.decode.bind(updateNodeMetadata) ), + performMaintenance: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + performMaintenanceResponse.decode.bind(performMaintenanceResponse), + performMaintenanceMetadata.decode.bind(performMaintenanceMetadata) + ), createQueuedResource: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createQueuedResourceResponse.decode.bind(createQueuedResourceResponse), @@ -393,6 +418,16 @@ export class TpuClient { resetQueuedResourceResponse.decode.bind(resetQueuedResourceResponse), resetQueuedResourceMetadata.decode.bind(resetQueuedResourceMetadata) ), + performMaintenanceQueuedResource: + new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + performMaintenanceQueuedResourceResponse.decode.bind( + performMaintenanceQueuedResourceResponse + ), + performMaintenanceQueuedResourceMetadata.decode.bind( + performMaintenanceQueuedResourceMetadata + ) + ), simulateMaintenanceEvent: new this._gaxModule.LongrunningDescriptor( this.operationsClient, simulateMaintenanceEventResponse.decode.bind( @@ -461,17 +496,20 @@ export class TpuClient { 'stopNode', 'startNode', 'updateNode', + 'performMaintenance', 'listQueuedResources', 'getQueuedResource', 'createQueuedResource', 'deleteQueuedResource', 'resetQueuedResource', + 'performMaintenanceQueuedResource', 'generateServiceIdentity', 'listAcceleratorTypes', 'getAcceleratorType', 'listRuntimeVersions', 'getRuntimeVersion', 'getGuestAttributes', + 'listReservations', 'simulateMaintenanceEvent', ]; for (const methodName of tpuStubMethods) { @@ -1830,6 +1868,142 @@ export class TpuClient { protos.google.cloud.tpu.v2alpha1.OperationMetadata >; } + /** + * Perform manual maintenance on a node. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2alpha1/tpu.perform_maintenance.js + * region_tag:tpu_v2alpha1_generated_Tpu_PerformMaintenance_async + */ + performMaintenance( + request?: protos.google.cloud.tpu.v2alpha1.IPerformMaintenanceRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; + performMaintenance( + request: protos.google.cloud.tpu.v2alpha1.IPerformMaintenanceRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + performMaintenance( + request: protos.google.cloud.tpu.v2alpha1.IPerformMaintenanceRequest, + callback: Callback< + LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + performMaintenance( + request?: protos.google.cloud.tpu.v2alpha1.IPerformMaintenanceRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.performMaintenance(request, options, callback); + } + /** + * Check the status of the long running operation returned by `performMaintenance()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2alpha1/tpu.perform_maintenance.js + * region_tag:tpu_v2alpha1_generated_Tpu_PerformMaintenance_async + */ + async checkPerformMaintenanceProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.tpu.v2alpha1.Node, + protos.google.cloud.tpu.v2alpha1.OperationMetadata + > + > { + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.performMaintenance, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.tpu.v2alpha1.Node, + protos.google.cloud.tpu.v2alpha1.OperationMetadata + >; + } /** * Creates a QueuedResource TPU instance. * @@ -2253,6 +2427,149 @@ export class TpuClient { protos.google.cloud.tpu.v2alpha1.OperationMetadata >; } + /** + * Perform manual maintenance on specific nodes of a QueuedResource. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the QueuedResource which holds the nodes to perform + * maintenance on. + * @param {string[]} request.nodeNames + * The names of the nodes to perform maintenance on. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2alpha1/tpu.perform_maintenance_queued_resource.js + * region_tag:tpu_v2alpha1_generated_Tpu_PerformMaintenanceQueuedResource_async + */ + performMaintenanceQueuedResource( + request?: protos.google.cloud.tpu.v2alpha1.IPerformMaintenanceQueuedResourceRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.tpu.v2alpha1.IQueuedResource, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; + performMaintenanceQueuedResource( + request: protos.google.cloud.tpu.v2alpha1.IPerformMaintenanceQueuedResourceRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.tpu.v2alpha1.IQueuedResource, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + performMaintenanceQueuedResource( + request: protos.google.cloud.tpu.v2alpha1.IPerformMaintenanceQueuedResourceRequest, + callback: Callback< + LROperation< + protos.google.cloud.tpu.v2alpha1.IQueuedResource, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + performMaintenanceQueuedResource( + request?: protos.google.cloud.tpu.v2alpha1.IPerformMaintenanceQueuedResourceRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.tpu.v2alpha1.IQueuedResource, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.tpu.v2alpha1.IQueuedResource, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.tpu.v2alpha1.IQueuedResource, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.performMaintenanceQueuedResource( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `performMaintenanceQueuedResource()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2alpha1/tpu.perform_maintenance_queued_resource.js + * region_tag:tpu_v2alpha1_generated_Tpu_PerformMaintenanceQueuedResource_async + */ + async checkPerformMaintenanceQueuedResourceProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.tpu.v2alpha1.QueuedResource, + protos.google.cloud.tpu.v2alpha1.OperationMetadata + > + > { + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.performMaintenanceQueuedResource, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.tpu.v2alpha1.QueuedResource, + protos.google.cloud.tpu.v2alpha1.OperationMetadata + >; + } /** * Simulates a maintenance event. * @@ -3160,6 +3477,195 @@ export class TpuClient { callSettings ) as AsyncIterable; } + /** + * Retrieves the reservations for the given project in the given location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent for reservations. + * @param {number} request.pageSize + * The maximum number of items to return. Defaults to 0 if not specified, + * which means no limit. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.cloud.tpu.v2alpha1.Reservation|Reservation}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listReservationsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listReservations( + request?: protos.google.cloud.tpu.v2alpha1.IListReservationsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.tpu.v2alpha1.IReservation[], + protos.google.cloud.tpu.v2alpha1.IListReservationsRequest | null, + protos.google.cloud.tpu.v2alpha1.IListReservationsResponse, + ] + >; + listReservations( + request: protos.google.cloud.tpu.v2alpha1.IListReservationsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.tpu.v2alpha1.IListReservationsRequest, + | protos.google.cloud.tpu.v2alpha1.IListReservationsResponse + | null + | undefined, + protos.google.cloud.tpu.v2alpha1.IReservation + > + ): void; + listReservations( + request: protos.google.cloud.tpu.v2alpha1.IListReservationsRequest, + callback: PaginationCallback< + protos.google.cloud.tpu.v2alpha1.IListReservationsRequest, + | protos.google.cloud.tpu.v2alpha1.IListReservationsResponse + | null + | undefined, + protos.google.cloud.tpu.v2alpha1.IReservation + > + ): void; + listReservations( + request?: protos.google.cloud.tpu.v2alpha1.IListReservationsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.tpu.v2alpha1.IListReservationsRequest, + | protos.google.cloud.tpu.v2alpha1.IListReservationsResponse + | null + | undefined, + protos.google.cloud.tpu.v2alpha1.IReservation + >, + callback?: PaginationCallback< + protos.google.cloud.tpu.v2alpha1.IListReservationsRequest, + | protos.google.cloud.tpu.v2alpha1.IListReservationsResponse + | null + | undefined, + protos.google.cloud.tpu.v2alpha1.IReservation + > + ): Promise< + [ + protos.google.cloud.tpu.v2alpha1.IReservation[], + protos.google.cloud.tpu.v2alpha1.IListReservationsRequest | null, + protos.google.cloud.tpu.v2alpha1.IListReservationsResponse, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listReservations(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent for reservations. + * @param {number} request.pageSize + * The maximum number of items to return. Defaults to 0 if not specified, + * which means no limit. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.tpu.v2alpha1.Reservation|Reservation} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listReservationsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listReservationsStream( + request?: protos.google.cloud.tpu.v2alpha1.IListReservationsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listReservations']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listReservations.createStream( + this.innerApiCalls.listReservations as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listReservations`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent for reservations. + * @param {number} request.pageSize + * The maximum number of items to return. Defaults to 0 if not specified, + * which means no limit. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.tpu.v2alpha1.Reservation|Reservation}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v2alpha1/tpu.list_reservations.js + * region_tag:tpu_v2alpha1_generated_Tpu_ListReservations_async + */ + listReservationsAsync( + request?: protos.google.cloud.tpu.v2alpha1.IListReservationsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listReservations']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listReservations.asyncIterate( + this.innerApiCalls['listReservations'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } /** * Gets information about a location. * @@ -3643,6 +4149,58 @@ export class TpuClient { ).queued_resource; } + /** + * Return a fully-qualified reservation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} reservation + * @returns {string} Resource name string. + */ + reservationPath(project: string, location: string, reservation: string) { + return this.pathTemplates.reservationPathTemplate.render({ + project: project, + location: location, + reservation: reservation, + }); + } + + /** + * Parse the project from Reservation resource. + * + * @param {string} reservationName + * A fully-qualified path representing Reservation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromReservationName(reservationName: string) { + return this.pathTemplates.reservationPathTemplate.match(reservationName) + .project; + } + + /** + * Parse the location from Reservation resource. + * + * @param {string} reservationName + * A fully-qualified path representing Reservation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromReservationName(reservationName: string) { + return this.pathTemplates.reservationPathTemplate.match(reservationName) + .location; + } + + /** + * Parse the reservation from Reservation resource. + * + * @param {string} reservationName + * A fully-qualified path representing Reservation resource. + * @returns {string} A string representing the reservation. + */ + matchReservationFromReservationName(reservationName: string) { + return this.pathTemplates.reservationPathTemplate.match(reservationName) + .reservation; + } + /** * Return a fully-qualified runtimeVersion resource name string. * diff --git a/packages/google-cloud-tpu/src/v2alpha1/tpu_client_config.json b/packages/google-cloud-tpu/src/v2alpha1/tpu_client_config.json index 73f0119221c..9fae4f2f633 100644 --- a/packages/google-cloud-tpu/src/v2alpha1/tpu_client_config.json +++ b/packages/google-cloud-tpu/src/v2alpha1/tpu_client_config.json @@ -55,6 +55,11 @@ "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, + "PerformMaintenance": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, "ListQueuedResources": { "timeout_millis": 60000, "retry_codes_name": "non_idempotent", @@ -80,6 +85,11 @@ "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, + "PerformMaintenanceQueuedResource": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, "GenerateServiceIdentity": { "timeout_millis": 60000, "retry_codes_name": "non_idempotent", @@ -110,6 +120,11 @@ "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, + "ListReservations": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, "SimulateMaintenanceEvent": { "timeout_millis": 60000, "retry_codes_name": "non_idempotent", diff --git a/packages/google-cloud-tpu/test/gapic_tpu_v2alpha1.ts b/packages/google-cloud-tpu/test/gapic_tpu_v2alpha1.ts index 731ccad3e06..c01acc8ce39 100644 --- a/packages/google-cloud-tpu/test/gapic_tpu_v2alpha1.ts +++ b/packages/google-cloud-tpu/test/gapic_tpu_v2alpha1.ts @@ -2080,6 +2080,200 @@ describe('v2alpha1.TpuClient', () => { }); }); + describe('performMaintenance', () => { + it('invokes performMaintenance without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.PerformMaintenanceRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.PerformMaintenanceRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.performMaintenance = + stubLongRunningCall(expectedResponse); + const [operation] = await client.performMaintenance(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.performMaintenance as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.performMaintenance as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes performMaintenance without error using callback', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.PerformMaintenanceRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.PerformMaintenanceRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.performMaintenance = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.performMaintenance( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.performMaintenance as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.performMaintenance as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes performMaintenance with call error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.PerformMaintenanceRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.PerformMaintenanceRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.performMaintenance = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.performMaintenance(request), expectedError); + const actualRequest = ( + client.innerApiCalls.performMaintenance as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.performMaintenance as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes performMaintenance with LRO error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.PerformMaintenanceRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.PerformMaintenanceRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.performMaintenance = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.performMaintenance(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.performMaintenance as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.performMaintenance as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkPerformMaintenanceProgress without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkPerformMaintenanceProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkPerformMaintenanceProgress with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkPerformMaintenanceProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + describe('createQueuedResource', () => { it('invokes createQueuedResource without error', async () => { const client = new tpuModule.v2alpha1.TpuClient({ @@ -2662,18 +2856,18 @@ describe('v2alpha1.TpuClient', () => { }); }); - describe('simulateMaintenanceEvent', () => { - it('invokes simulateMaintenanceEvent without error', async () => { + describe('performMaintenanceQueuedResource', () => { + it('invokes performMaintenanceQueuedResource without error', async () => { const client = new tpuModule.v2alpha1.TpuClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest() + new protos.google.cloud.tpu.v2alpha1.PerformMaintenanceQueuedResourceRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest', + '.google.cloud.tpu.v2alpha1.PerformMaintenanceQueuedResourceRequest', ['name'] ); request.name = defaultValue1; @@ -2681,32 +2875,33 @@ describe('v2alpha1.TpuClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.simulateMaintenanceEvent = + client.innerApiCalls.performMaintenanceQueuedResource = stubLongRunningCall(expectedResponse); - const [operation] = await client.simulateMaintenanceEvent(request); + const [operation] = + await client.performMaintenanceQueuedResource(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( - client.innerApiCalls.simulateMaintenanceEvent as SinonStub + client.innerApiCalls.performMaintenanceQueuedResource as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.simulateMaintenanceEvent as SinonStub + client.innerApiCalls.performMaintenanceQueuedResource as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes simulateMaintenanceEvent without error using callback', async () => { + it('invokes performMaintenanceQueuedResource without error using callback', async () => { const client = new tpuModule.v2alpha1.TpuClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest() + new protos.google.cloud.tpu.v2alpha1.PerformMaintenanceQueuedResourceRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest', + '.google.cloud.tpu.v2alpha1.PerformMaintenanceQueuedResourceRequest', ['name'] ); request.name = defaultValue1; @@ -2714,15 +2909,15 @@ describe('v2alpha1.TpuClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.simulateMaintenanceEvent = + client.innerApiCalls.performMaintenanceQueuedResource = stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { - client.simulateMaintenanceEvent( + client.performMaintenanceQueuedResource( request, ( err?: Error | null, result?: LROperation< - protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IQueuedResource, protos.google.cloud.tpu.v2alpha1.IOperationMetadata > | null ) => { @@ -2735,89 +2930,85 @@ describe('v2alpha1.TpuClient', () => { ); }); const operation = (await promise) as LROperation< - protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IQueuedResource, protos.google.cloud.tpu.v2alpha1.IOperationMetadata >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( - client.innerApiCalls.simulateMaintenanceEvent as SinonStub + client.innerApiCalls.performMaintenanceQueuedResource as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.simulateMaintenanceEvent as SinonStub + client.innerApiCalls.performMaintenanceQueuedResource as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes simulateMaintenanceEvent with call error', async () => { + it('invokes performMaintenanceQueuedResource with call error', async () => { const client = new tpuModule.v2alpha1.TpuClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest() + new protos.google.cloud.tpu.v2alpha1.PerformMaintenanceQueuedResourceRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest', + '.google.cloud.tpu.v2alpha1.PerformMaintenanceQueuedResourceRequest', ['name'] ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); - client.innerApiCalls.simulateMaintenanceEvent = stubLongRunningCall( - undefined, - expectedError - ); + client.innerApiCalls.performMaintenanceQueuedResource = + stubLongRunningCall(undefined, expectedError); await assert.rejects( - client.simulateMaintenanceEvent(request), + client.performMaintenanceQueuedResource(request), expectedError ); const actualRequest = ( - client.innerApiCalls.simulateMaintenanceEvent as SinonStub + client.innerApiCalls.performMaintenanceQueuedResource as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.simulateMaintenanceEvent as SinonStub + client.innerApiCalls.performMaintenanceQueuedResource as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes simulateMaintenanceEvent with LRO error', async () => { + it('invokes performMaintenanceQueuedResource with LRO error', async () => { const client = new tpuModule.v2alpha1.TpuClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest() + new protos.google.cloud.tpu.v2alpha1.PerformMaintenanceQueuedResourceRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest', + '.google.cloud.tpu.v2alpha1.PerformMaintenanceQueuedResourceRequest', ['name'] ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); - client.innerApiCalls.simulateMaintenanceEvent = stubLongRunningCall( - undefined, - undefined, - expectedError - ); - const [operation] = await client.simulateMaintenanceEvent(request); + client.innerApiCalls.performMaintenanceQueuedResource = + stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = + await client.performMaintenanceQueuedResource(request); await assert.rejects(operation.promise(), expectedError); const actualRequest = ( - client.innerApiCalls.simulateMaintenanceEvent as SinonStub + client.innerApiCalls.performMaintenanceQueuedResource as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.simulateMaintenanceEvent as SinonStub + client.innerApiCalls.performMaintenanceQueuedResource as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes checkSimulateMaintenanceEventProgress without error', async () => { + it('invokes checkPerformMaintenanceQueuedResourceProgress without error', async () => { const client = new tpuModule.v2alpha1.TpuClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', @@ -2832,7 +3023,7 @@ describe('v2alpha1.TpuClient', () => { client.operationsClient.getOperation = stubSimpleCall(expectedResponse); const decodedOperation = - await client.checkSimulateMaintenanceEventProgress( + await client.checkPerformMaintenanceQueuedResourceProgress( expectedResponse.name ); assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); @@ -2840,7 +3031,7 @@ describe('v2alpha1.TpuClient', () => { assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - it('invokes checkSimulateMaintenanceEventProgress with error', async () => { + it('invokes checkPerformMaintenanceQueuedResourceProgress with error', async () => { const client = new tpuModule.v2alpha1.TpuClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', @@ -2853,71 +3044,269 @@ describe('v2alpha1.TpuClient', () => { expectedError ); await assert.rejects( - client.checkSimulateMaintenanceEventProgress(''), + client.checkPerformMaintenanceQueuedResourceProgress(''), expectedError ); assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); }); - describe('listNodes', () => { - it('invokes listNodes without error', async () => { + describe('simulateMaintenanceEvent', () => { + it('invokes simulateMaintenanceEvent without error', async () => { const client = new tpuModule.v2alpha1.TpuClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListNodesRequest() + new protos.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.tpu.v2alpha1.ListNodesRequest', - ['parent'] + '.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest', + ['name'] ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), - ]; - client.innerApiCalls.listNodes = stubSimpleCall(expectedResponse); - const [response] = await client.listNodes(request); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.simulateMaintenanceEvent = + stubLongRunningCall(expectedResponse); + const [operation] = await client.simulateMaintenanceEvent(request); + const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( - client.innerApiCalls.listNodes as SinonStub + client.innerApiCalls.simulateMaintenanceEvent as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.listNodes as SinonStub + client.innerApiCalls.simulateMaintenanceEvent as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listNodes without error using callback', async () => { + it('invokes simulateMaintenanceEvent without error using callback', async () => { const client = new tpuModule.v2alpha1.TpuClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListNodesRequest() + new protos.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.tpu.v2alpha1.ListNodesRequest', - ['parent'] + '.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest', + ['name'] ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), - ]; - client.innerApiCalls.listNodes = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listNodes( + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.simulateMaintenanceEvent = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.simulateMaintenanceEvent( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.simulateMaintenanceEvent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.simulateMaintenanceEvent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes simulateMaintenanceEvent with call error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.simulateMaintenanceEvent = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.simulateMaintenanceEvent(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.simulateMaintenanceEvent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.simulateMaintenanceEvent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes simulateMaintenanceEvent with LRO error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.simulateMaintenanceEvent = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.simulateMaintenanceEvent(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.simulateMaintenanceEvent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.simulateMaintenanceEvent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkSimulateMaintenanceEventProgress without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = + await client.checkSimulateMaintenanceEventProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkSimulateMaintenanceEventProgress with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkSimulateMaintenanceEventProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listNodes', () => { + it('invokes listNodes without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListNodesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.ListNodesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), + ]; + client.innerApiCalls.listNodes = stubSimpleCall(expectedResponse); + const [response] = await client.listNodes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listNodes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listNodes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNodes without error using callback', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListNodesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.ListNodesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), + ]; + client.innerApiCalls.listNodes = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listNodes( request, ( err?: Error | null, @@ -3492,70 +3881,399 @@ describe('v2alpha1.TpuClient', () => { new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest', + '.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + ), + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + ), + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + ), + ]; + client.innerApiCalls.listAcceleratorTypes = + stubSimpleCall(expectedResponse); + const [response] = await client.listAcceleratorTypes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listAcceleratorTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAcceleratorTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAcceleratorTypes without error using callback', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + ), + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + ), + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + ), + ]; + client.innerApiCalls.listAcceleratorTypes = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAcceleratorTypes( + request, + ( + err?: Error | null, + result?: protos.google.cloud.tpu.v2alpha1.IAcceleratorType[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listAcceleratorTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAcceleratorTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAcceleratorTypes with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listAcceleratorTypes = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listAcceleratorTypes(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listAcceleratorTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAcceleratorTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAcceleratorTypesStream without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + ), + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + ), + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + ), + ]; + client.descriptors.page.listAcceleratorTypes.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listAcceleratorTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.tpu.v2alpha1.AcceleratorType[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.tpu.v2alpha1.AcceleratorType) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listAcceleratorTypes.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listAcceleratorTypes, request) + ); + assert( + (client.descriptors.page.listAcceleratorTypes.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) + ); + }); + + it('invokes listAcceleratorTypesStream with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAcceleratorTypes.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listAcceleratorTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.tpu.v2alpha1.AcceleratorType[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.tpu.v2alpha1.AcceleratorType) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listAcceleratorTypes.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listAcceleratorTypes, request) + ); + assert( + (client.descriptors.page.listAcceleratorTypes.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) + ); + }); + + it('uses async iteration with listAcceleratorTypes without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + ), + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + ), + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + ), + ]; + client.descriptors.page.listAcceleratorTypes.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.tpu.v2alpha1.IAcceleratorType[] = []; + const iterable = client.listAcceleratorTypesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) + ); + }); + + it('uses async iteration with listAcceleratorTypes with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAcceleratorTypes.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAcceleratorTypesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.tpu.v2alpha1.IAcceleratorType[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) + ); + }); + }); + + describe('listRuntimeVersions', () => { + it('invokes listRuntimeVersions without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() ), generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() ), generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() ), ]; - client.innerApiCalls.listAcceleratorTypes = + client.innerApiCalls.listRuntimeVersions = stubSimpleCall(expectedResponse); - const [response] = await client.listAcceleratorTypes(request); + const [response] = await client.listRuntimeVersions(request); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( - client.innerApiCalls.listAcceleratorTypes as SinonStub + client.innerApiCalls.listRuntimeVersions as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.listAcceleratorTypes as SinonStub + client.innerApiCalls.listRuntimeVersions as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listAcceleratorTypes without error using callback', async () => { + it('invokes listRuntimeVersions without error using callback', async () => { const client = new tpuModule.v2alpha1.TpuClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() + new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest', + '.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() ), generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() ), generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() ), ]; - client.innerApiCalls.listAcceleratorTypes = + client.innerApiCalls.listRuntimeVersions = stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { - client.listAcceleratorTypes( + client.listRuntimeVersions( request, ( err?: Error | null, - result?: protos.google.cloud.tpu.v2alpha1.IAcceleratorType[] | null + result?: protos.google.cloud.tpu.v2alpha1.IRuntimeVersion[] | null ) => { if (err) { reject(err); @@ -3568,81 +4286,80 @@ describe('v2alpha1.TpuClient', () => { const response = await promise; assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( - client.innerApiCalls.listAcceleratorTypes as SinonStub + client.innerApiCalls.listRuntimeVersions as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.listAcceleratorTypes as SinonStub + client.innerApiCalls.listRuntimeVersions as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listAcceleratorTypes with error', async () => { + it('invokes listRuntimeVersions with error', async () => { const client = new tpuModule.v2alpha1.TpuClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() + new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest', + '.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); - client.innerApiCalls.listAcceleratorTypes = stubSimpleCall( + client.innerApiCalls.listRuntimeVersions = stubSimpleCall( undefined, expectedError ); - await assert.rejects(client.listAcceleratorTypes(request), expectedError); + await assert.rejects(client.listRuntimeVersions(request), expectedError); const actualRequest = ( - client.innerApiCalls.listAcceleratorTypes as SinonStub + client.innerApiCalls.listRuntimeVersions as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.listAcceleratorTypes as SinonStub + client.innerApiCalls.listRuntimeVersions as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listAcceleratorTypesStream without error', async () => { + it('invokes listRuntimeVersionsStream without error', async () => { const client = new tpuModule.v2alpha1.TpuClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() + new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest', + '.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() ), generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() ), generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() ), ]; - client.descriptors.page.listAcceleratorTypes.createStream = + client.descriptors.page.listRuntimeVersions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAcceleratorTypesStream(request); + const stream = client.listRuntimeVersionsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.tpu.v2alpha1.AcceleratorType[] = - []; + const responses: protos.google.cloud.tpu.v2alpha1.RuntimeVersion[] = []; stream.on( 'data', - (response: protos.google.cloud.tpu.v2alpha1.AcceleratorType) => { + (response: protos.google.cloud.tpu.v2alpha1.RuntimeVersion) => { responses.push(response); } ); @@ -3656,12 +4373,12 @@ describe('v2alpha1.TpuClient', () => { const responses = await promise; assert.deepStrictEqual(responses, expectedResponse); assert( - (client.descriptors.page.listAcceleratorTypes.createStream as SinonStub) + (client.descriptors.page.listRuntimeVersions.createStream as SinonStub) .getCall(0) - .calledWith(client.innerApiCalls.listAcceleratorTypes, request) + .calledWith(client.innerApiCalls.listRuntimeVersions, request) ); assert( - (client.descriptors.page.listAcceleratorTypes.createStream as SinonStub) + (client.descriptors.page.listRuntimeVersions.createStream as SinonStub) .getCall(0) .args[2].otherArgs.headers[ 'x-goog-request-params' @@ -3669,31 +4386,30 @@ describe('v2alpha1.TpuClient', () => { ); }); - it('invokes listAcceleratorTypesStream with error', async () => { + it('invokes listRuntimeVersionsStream with error', async () => { const client = new tpuModule.v2alpha1.TpuClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() + new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest', + '.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); - client.descriptors.page.listAcceleratorTypes.createStream = + client.descriptors.page.listRuntimeVersions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAcceleratorTypesStream(request); + const stream = client.listRuntimeVersionsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.tpu.v2alpha1.AcceleratorType[] = - []; + const responses: protos.google.cloud.tpu.v2alpha1.RuntimeVersion[] = []; stream.on( 'data', - (response: protos.google.cloud.tpu.v2alpha1.AcceleratorType) => { + (response: protos.google.cloud.tpu.v2alpha1.RuntimeVersion) => { responses.push(response); } ); @@ -3706,12 +4422,12 @@ describe('v2alpha1.TpuClient', () => { }); await assert.rejects(promise, expectedError); assert( - (client.descriptors.page.listAcceleratorTypes.createStream as SinonStub) + (client.descriptors.page.listRuntimeVersions.createStream as SinonStub) .getCall(0) - .calledWith(client.innerApiCalls.listAcceleratorTypes, request) + .calledWith(client.innerApiCalls.listRuntimeVersions, request) ); assert( - (client.descriptors.page.listAcceleratorTypes.createStream as SinonStub) + (client.descriptors.page.listRuntimeVersions.createStream as SinonStub) .getCall(0) .args[2].otherArgs.headers[ 'x-goog-request-params' @@ -3719,48 +4435,48 @@ describe('v2alpha1.TpuClient', () => { ); }); - it('uses async iteration with listAcceleratorTypes without error', async () => { + it('uses async iteration with listRuntimeVersions without error', async () => { const client = new tpuModule.v2alpha1.TpuClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() + new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest', + '.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() ), generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() ), generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() ), ]; - client.descriptors.page.listAcceleratorTypes.asyncIterate = + client.descriptors.page.listRuntimeVersions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.tpu.v2alpha1.IAcceleratorType[] = []; - const iterable = client.listAcceleratorTypesAsync(request); + const responses: protos.google.cloud.tpu.v2alpha1.IRuntimeVersion[] = []; + const iterable = client.listRuntimeVersionsAsync(request); for await (const resource of iterable) { responses.push(resource!); } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( ( - client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub + client.descriptors.page.listRuntimeVersions.asyncIterate as SinonStub ).getCall(0).args[1], request ); assert( - (client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub) + (client.descriptors.page.listRuntimeVersions.asyncIterate as SinonStub) .getCall(0) .args[2].otherArgs.headers[ 'x-goog-request-params' @@ -3768,27 +4484,27 @@ describe('v2alpha1.TpuClient', () => { ); }); - it('uses async iteration with listAcceleratorTypes with error', async () => { + it('uses async iteration with listRuntimeVersions with error', async () => { const client = new tpuModule.v2alpha1.TpuClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() + new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest', + '.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); - client.descriptors.page.listAcceleratorTypes.asyncIterate = + client.descriptors.page.listRuntimeVersions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAcceleratorTypesAsync(request); + const iterable = client.listRuntimeVersionsAsync(request); await assert.rejects(async () => { - const responses: protos.google.cloud.tpu.v2alpha1.IAcceleratorType[] = + const responses: protos.google.cloud.tpu.v2alpha1.IRuntimeVersion[] = []; for await (const resource of iterable) { responses.push(resource!); @@ -3796,12 +4512,12 @@ describe('v2alpha1.TpuClient', () => { }); assert.deepStrictEqual( ( - client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub + client.descriptors.page.listRuntimeVersions.asyncIterate as SinonStub ).getCall(0).args[1], request ); assert( - (client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub) + (client.descriptors.page.listRuntimeVersions.asyncIterate as SinonStub) .getCall(0) .args[2].otherArgs.headers[ 'x-goog-request-params' @@ -3810,81 +4526,80 @@ describe('v2alpha1.TpuClient', () => { }); }); - describe('listRuntimeVersions', () => { - it('invokes listRuntimeVersions without error', async () => { + describe('listReservations', () => { + it('invokes listReservations without error', async () => { const client = new tpuModule.v2alpha1.TpuClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() + new protos.google.cloud.tpu.v2alpha1.ListReservationsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest', + '.google.cloud.tpu.v2alpha1.ListReservationsRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() + new protos.google.cloud.tpu.v2alpha1.Reservation() ), generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() + new protos.google.cloud.tpu.v2alpha1.Reservation() ), generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() + new protos.google.cloud.tpu.v2alpha1.Reservation() ), ]; - client.innerApiCalls.listRuntimeVersions = - stubSimpleCall(expectedResponse); - const [response] = await client.listRuntimeVersions(request); + client.innerApiCalls.listReservations = stubSimpleCall(expectedResponse); + const [response] = await client.listReservations(request); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( - client.innerApiCalls.listRuntimeVersions as SinonStub + client.innerApiCalls.listReservations as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.listRuntimeVersions as SinonStub + client.innerApiCalls.listReservations as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listRuntimeVersions without error using callback', async () => { + it('invokes listReservations without error using callback', async () => { const client = new tpuModule.v2alpha1.TpuClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() + new protos.google.cloud.tpu.v2alpha1.ListReservationsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest', + '.google.cloud.tpu.v2alpha1.ListReservationsRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() + new protos.google.cloud.tpu.v2alpha1.Reservation() ), generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() + new protos.google.cloud.tpu.v2alpha1.Reservation() ), generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() + new protos.google.cloud.tpu.v2alpha1.Reservation() ), ]; - client.innerApiCalls.listRuntimeVersions = + client.innerApiCalls.listReservations = stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { - client.listRuntimeVersions( + client.listReservations( request, ( err?: Error | null, - result?: protos.google.cloud.tpu.v2alpha1.IRuntimeVersion[] | null + result?: protos.google.cloud.tpu.v2alpha1.IReservation[] | null ) => { if (err) { reject(err); @@ -3897,80 +4612,80 @@ describe('v2alpha1.TpuClient', () => { const response = await promise; assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( - client.innerApiCalls.listRuntimeVersions as SinonStub + client.innerApiCalls.listReservations as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.listRuntimeVersions as SinonStub + client.innerApiCalls.listReservations as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listRuntimeVersions with error', async () => { + it('invokes listReservations with error', async () => { const client = new tpuModule.v2alpha1.TpuClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() + new protos.google.cloud.tpu.v2alpha1.ListReservationsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest', + '.google.cloud.tpu.v2alpha1.ListReservationsRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); - client.innerApiCalls.listRuntimeVersions = stubSimpleCall( + client.innerApiCalls.listReservations = stubSimpleCall( undefined, expectedError ); - await assert.rejects(client.listRuntimeVersions(request), expectedError); + await assert.rejects(client.listReservations(request), expectedError); const actualRequest = ( - client.innerApiCalls.listRuntimeVersions as SinonStub + client.innerApiCalls.listReservations as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.listRuntimeVersions as SinonStub + client.innerApiCalls.listReservations as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listRuntimeVersionsStream without error', async () => { + it('invokes listReservationsStream without error', async () => { const client = new tpuModule.v2alpha1.TpuClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() + new protos.google.cloud.tpu.v2alpha1.ListReservationsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest', + '.google.cloud.tpu.v2alpha1.ListReservationsRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() + new protos.google.cloud.tpu.v2alpha1.Reservation() ), generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() + new protos.google.cloud.tpu.v2alpha1.Reservation() ), generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() + new protos.google.cloud.tpu.v2alpha1.Reservation() ), ]; - client.descriptors.page.listRuntimeVersions.createStream = + client.descriptors.page.listReservations.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listRuntimeVersionsStream(request); + const stream = client.listReservationsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.tpu.v2alpha1.RuntimeVersion[] = []; + const responses: protos.google.cloud.tpu.v2alpha1.Reservation[] = []; stream.on( 'data', - (response: protos.google.cloud.tpu.v2alpha1.RuntimeVersion) => { + (response: protos.google.cloud.tpu.v2alpha1.Reservation) => { responses.push(response); } ); @@ -3984,12 +4699,12 @@ describe('v2alpha1.TpuClient', () => { const responses = await promise; assert.deepStrictEqual(responses, expectedResponse); assert( - (client.descriptors.page.listRuntimeVersions.createStream as SinonStub) + (client.descriptors.page.listReservations.createStream as SinonStub) .getCall(0) - .calledWith(client.innerApiCalls.listRuntimeVersions, request) + .calledWith(client.innerApiCalls.listReservations, request) ); assert( - (client.descriptors.page.listRuntimeVersions.createStream as SinonStub) + (client.descriptors.page.listReservations.createStream as SinonStub) .getCall(0) .args[2].otherArgs.headers[ 'x-goog-request-params' @@ -3997,30 +4712,30 @@ describe('v2alpha1.TpuClient', () => { ); }); - it('invokes listRuntimeVersionsStream with error', async () => { + it('invokes listReservationsStream with error', async () => { const client = new tpuModule.v2alpha1.TpuClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() + new protos.google.cloud.tpu.v2alpha1.ListReservationsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest', + '.google.cloud.tpu.v2alpha1.ListReservationsRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); - client.descriptors.page.listRuntimeVersions.createStream = + client.descriptors.page.listReservations.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listRuntimeVersionsStream(request); + const stream = client.listReservationsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.tpu.v2alpha1.RuntimeVersion[] = []; + const responses: protos.google.cloud.tpu.v2alpha1.Reservation[] = []; stream.on( 'data', - (response: protos.google.cloud.tpu.v2alpha1.RuntimeVersion) => { + (response: protos.google.cloud.tpu.v2alpha1.Reservation) => { responses.push(response); } ); @@ -4033,12 +4748,12 @@ describe('v2alpha1.TpuClient', () => { }); await assert.rejects(promise, expectedError); assert( - (client.descriptors.page.listRuntimeVersions.createStream as SinonStub) + (client.descriptors.page.listReservations.createStream as SinonStub) .getCall(0) - .calledWith(client.innerApiCalls.listRuntimeVersions, request) + .calledWith(client.innerApiCalls.listReservations, request) ); assert( - (client.descriptors.page.listRuntimeVersions.createStream as SinonStub) + (client.descriptors.page.listReservations.createStream as SinonStub) .getCall(0) .args[2].otherArgs.headers[ 'x-goog-request-params' @@ -4046,48 +4761,48 @@ describe('v2alpha1.TpuClient', () => { ); }); - it('uses async iteration with listRuntimeVersions without error', async () => { + it('uses async iteration with listReservations without error', async () => { const client = new tpuModule.v2alpha1.TpuClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() + new protos.google.cloud.tpu.v2alpha1.ListReservationsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest', + '.google.cloud.tpu.v2alpha1.ListReservationsRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() + new protos.google.cloud.tpu.v2alpha1.Reservation() ), generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() + new protos.google.cloud.tpu.v2alpha1.Reservation() ), generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() + new protos.google.cloud.tpu.v2alpha1.Reservation() ), ]; - client.descriptors.page.listRuntimeVersions.asyncIterate = + client.descriptors.page.listReservations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.tpu.v2alpha1.IRuntimeVersion[] = []; - const iterable = client.listRuntimeVersionsAsync(request); + const responses: protos.google.cloud.tpu.v2alpha1.IReservation[] = []; + const iterable = client.listReservationsAsync(request); for await (const resource of iterable) { responses.push(resource!); } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( ( - client.descriptors.page.listRuntimeVersions.asyncIterate as SinonStub + client.descriptors.page.listReservations.asyncIterate as SinonStub ).getCall(0).args[1], request ); assert( - (client.descriptors.page.listRuntimeVersions.asyncIterate as SinonStub) + (client.descriptors.page.listReservations.asyncIterate as SinonStub) .getCall(0) .args[2].otherArgs.headers[ 'x-goog-request-params' @@ -4095,40 +4810,39 @@ describe('v2alpha1.TpuClient', () => { ); }); - it('uses async iteration with listRuntimeVersions with error', async () => { + it('uses async iteration with listReservations with error', async () => { const client = new tpuModule.v2alpha1.TpuClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() + new protos.google.cloud.tpu.v2alpha1.ListReservationsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest', + '.google.cloud.tpu.v2alpha1.ListReservationsRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); - client.descriptors.page.listRuntimeVersions.asyncIterate = + client.descriptors.page.listReservations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listRuntimeVersionsAsync(request); + const iterable = client.listReservationsAsync(request); await assert.rejects(async () => { - const responses: protos.google.cloud.tpu.v2alpha1.IRuntimeVersion[] = - []; + const responses: protos.google.cloud.tpu.v2alpha1.IReservation[] = []; for await (const resource of iterable) { responses.push(resource!); } }); assert.deepStrictEqual( ( - client.descriptors.page.listRuntimeVersions.asyncIterate as SinonStub + client.descriptors.page.listReservations.asyncIterate as SinonStub ).getCall(0).args[1], request ); assert( - (client.descriptors.page.listRuntimeVersions.asyncIterate as SinonStub) + (client.descriptors.page.listReservations.asyncIterate as SinonStub) .getCall(0) .args[2].otherArgs.headers[ 'x-goog-request-params' @@ -4922,6 +5636,70 @@ describe('v2alpha1.TpuClient', () => { }); }); + describe('reservation', () => { + const fakePath = '/rendered/path/reservation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + reservation: 'reservationValue', + }; + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.reservationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.reservationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('reservationPath', () => { + const result = client.reservationPath( + 'projectValue', + 'locationValue', + 'reservationValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.reservationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromReservationName', () => { + const result = client.matchProjectFromReservationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.reservationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromReservationName', () => { + const result = client.matchLocationFromReservationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.reservationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchReservationFromReservationName', () => { + const result = client.matchReservationFromReservationName(fakePath); + assert.strictEqual(result, 'reservationValue'); + assert( + (client.pathTemplates.reservationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('runtimeVersion', () => { const fakePath = '/rendered/path/runtimeVersion'; const expectedParameters = {