diff --git a/tpu/v2/tpu-api.json b/tpu/v2/tpu-api.json index 7f6126c6001..56e951572eb 100644 --- a/tpu/v2/tpu-api.json +++ b/tpu/v2/tpu-api.json @@ -641,6 +641,172 @@ } } }, + "queuedResources": { + "methods": { + "create": { + "description": "Creates a QueuedResource TPU instance.", + "flatPath": "v2/projects/{projectsId}/locations/{locationsId}/queuedResources", + "httpMethod": "POST", + "id": "tpu.projects.locations.queuedResources.create", + "parameterOrder": [ + "parent" + ], + "parameters": { + "parent": { + "description": "Required. The parent resource name.", + "location": "path", + "pattern": "^projects/[^/]+/locations/[^/]+$", + "required": true, + "type": "string" + }, + "queuedResourceId": { + "description": "Optional. The unqualified resource name. Should follow the `^[A-Za-z0-9_.~+%-]+$` regex format.", + "location": "query", + "type": "string" + }, + "requestId": { + "description": "Optional. Idempotent request UUID.", + "location": "query", + "type": "string" + } + }, + "path": "v2/{+parent}/queuedResources", + "request": { + "$ref": "QueuedResource" + }, + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "delete": { + "description": "Deletes a QueuedResource TPU instance.", + "flatPath": "v2/projects/{projectsId}/locations/{locationsId}/queuedResources/{queuedResourcesId}", + "httpMethod": "DELETE", + "id": "tpu.projects.locations.queuedResources.delete", + "parameterOrder": [ + "name" + ], + "parameters": { + "force": { + "description": "Optional. If set to true, all running nodes belonging to this queued resource will be deleted first and then the queued resource will be deleted. Otherwise (i.e. force=false), the queued resource will only be deleted if its nodes have already been deleted or the queued resource is in the ACCEPTED, FAILED, or SUSPENDED state.", + "location": "query", + "type": "boolean" + }, + "name": { + "description": "Required. The resource name.", + "location": "path", + "pattern": "^projects/[^/]+/locations/[^/]+/queuedResources/[^/]+$", + "required": true, + "type": "string" + }, + "requestId": { + "description": "Optional. Idempotent request UUID.", + "location": "query", + "type": "string" + } + }, + "path": "v2/{+name}", + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "get": { + "description": "Gets details of a queued resource.", + "flatPath": "v2/projects/{projectsId}/locations/{locationsId}/queuedResources/{queuedResourcesId}", + "httpMethod": "GET", + "id": "tpu.projects.locations.queuedResources.get", + "parameterOrder": [ + "name" + ], + "parameters": { + "name": { + "description": "Required. The resource name.", + "location": "path", + "pattern": "^projects/[^/]+/locations/[^/]+/queuedResources/[^/]+$", + "required": true, + "type": "string" + } + }, + "path": "v2/{+name}", + "response": { + "$ref": "QueuedResource" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "list": { + "description": "Lists queued resources.", + "flatPath": "v2/projects/{projectsId}/locations/{locationsId}/queuedResources", + "httpMethod": "GET", + "id": "tpu.projects.locations.queuedResources.list", + "parameterOrder": [ + "parent" + ], + "parameters": { + "pageSize": { + "description": "Optional. The maximum number of items to return.", + "format": "int32", + "location": "query", + "type": "integer" + }, + "pageToken": { + "description": "Optional. The next_page_token value returned from a previous List request, if any.", + "location": "query", + "type": "string" + }, + "parent": { + "description": "Required. The parent resource name.", + "location": "path", + "pattern": "^projects/[^/]+/locations/[^/]+$", + "required": true, + "type": "string" + } + }, + "path": "v2/{+parent}/queuedResources", + "response": { + "$ref": "ListQueuedResourcesResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "reset": { + "description": "Resets a QueuedResource TPU instance", + "flatPath": "v2/projects/{projectsId}/locations/{locationsId}/queuedResources/{queuedResourcesId}:reset", + "httpMethod": "POST", + "id": "tpu.projects.locations.queuedResources.reset", + "parameterOrder": [ + "name" + ], + "parameters": { + "name": { + "description": "Required. The name of the queued resource.", + "location": "path", + "pattern": "^projects/[^/]+/locations/[^/]+/queuedResources/[^/]+$", + "required": true, + "type": "string" + } + }, + "path": "v2/{+name}:reset", + "request": { + "$ref": "ResetQueuedResourceRequest" + }, + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + } + } + }, "runtimeVersions": { "methods": { "get": { @@ -721,7 +887,7 @@ } } }, - "revision": "20240126", + "revision": "20240205", "rootUrl": "https://tpu.googleapis.com/", "schemas": { "AcceleratorConfig": { @@ -773,6 +939,12 @@ }, "type": "object" }, + "AcceptedData": { + "description": "Further data for the accepted state.", + "id": "AcceptedData", + "properties": {}, + "type": "object" + }, "AccessConfig": { "description": "An access config attached to the TPU worker.", "id": "AccessConfig", @@ -785,6 +957,12 @@ }, "type": "object" }, + "ActiveData": { + "description": "Further data for the active state.", + "id": "ActiveData", + "properties": {}, + "type": "object" + }, "AttachedDisk": { "description": "A node-attached disk resource. Next ID: 8;", "id": "AttachedDisk", @@ -810,12 +988,36 @@ }, "type": "object" }, + "CreatingData": { + "description": "Further data for the creating state.", + "id": "CreatingData", + "properties": {}, + "type": "object" + }, + "DeletingData": { + "description": "Further data for the deleting state.", + "id": "DeletingData", + "properties": {}, + "type": "object" + }, "Empty": { "description": "A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }", "id": "Empty", "properties": {}, "type": "object" }, + "FailedData": { + "description": "Further data for the failed state.", + "id": "FailedData", + "properties": { + "error": { + "$ref": "Status", + "description": "Output only. The error that caused the queued resource to enter the FAILED state.", + "readOnly": true + } + }, + "type": "object" + }, "GenerateServiceIdentityRequest": { "description": "Request for GenerateServiceIdentity.", "id": "GenerateServiceIdentityRequest", @@ -865,6 +1067,18 @@ }, "type": "object" }, + "Guaranteed": { + "description": "Guaranteed tier definition.", + "id": "Guaranteed", + "properties": { + "minDuration": { + "description": "Optional. Defines the minimum duration of the guarantee. If specified, the requested resources will only be provisioned if they can be allocated for at least the given duration.", + "format": "google-duration", + "type": "string" + } + }, + "type": "object" + }, "GuestAttributes": { "description": "A guest attributes.", "id": "GuestAttributes", @@ -913,6 +1127,23 @@ }, "type": "object" }, + "Interval": { + "description": "Represents a time interval, encoded as a Timestamp start (inclusive) and a Timestamp end (exclusive). The start must be less than or equal to the end. When the start equals the end, the interval is empty (matches no time). When both start and end are unspecified, the interval matches any time.", + "id": "Interval", + "properties": { + "endTime": { + "description": "Optional. Exclusive end of the interval. If specified, a Timestamp matching this interval will have to be before the end.", + "format": "google-datetime", + "type": "string" + }, + "startTime": { + "description": "Optional. Inclusive start of the interval. If specified, a Timestamp matching this interval will have to be the same or after the start.", + "format": "google-datetime", + "type": "string" + } + }, + "type": "object" + }, "ListAcceleratorTypesResponse": { "description": "Response for ListAcceleratorTypes.", "id": "ListAcceleratorTypesResponse", @@ -999,6 +1230,31 @@ }, "type": "object" }, + "ListQueuedResourcesResponse": { + "description": "Response for ListQueuedResources.", + "id": "ListQueuedResourcesResponse", + "properties": { + "nextPageToken": { + "description": "The next page token or empty if none.", + "type": "string" + }, + "queuedResources": { + "description": "The listed queued resources.", + "items": { + "$ref": "QueuedResource" + }, + "type": "array" + }, + "unreachable": { + "description": "Locations that could not be reached.", + "items": { + "type": "string" + }, + "type": "array" + } + }, + "type": "object" + }, "ListRuntimeVersionsResponse": { "description": "Response for ListRuntimeVersions.", "id": "ListRuntimeVersionsResponse", @@ -1058,6 +1314,22 @@ }, "type": "object" }, + "MultisliceParams": { + "description": "Parameters to specify for multislice QueuedResource requests. This message must be populated in case of multislice requests instead of node_id.", + "id": "MultisliceParams", + "properties": { + "nodeCount": { + "description": "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 \u003e 1.", + "format": "int32", + "type": "integer" + }, + "nodeIdPrefix": { + "description": "Optional. Prefix of node_ids in case of multislice request. Should follow the `^[A-Za-z0-9_.~+%-]+$` regex format. If node_count = 3 and node_id_prefix = \"np\", node ids of nodes created will be \"np-0\", \"np-1\", \"np-2\". If this field is not provided we use queued_resource_id as the node_id_prefix.", + "type": "string" + } + }, + "type": "object" + }, "NetworkConfig": { "description": "Network related configurations.", "id": "NetworkConfig", @@ -1301,6 +1573,29 @@ }, "type": "object" }, + "NodeSpec": { + "description": "Details of the TPU node(s) being requested. Users can request either a single node or multiple nodes. NodeSpec provides the specification for node(s) to be created.", + "id": "NodeSpec", + "properties": { + "multisliceParams": { + "$ref": "MultisliceParams", + "description": "Optional. Fields to specify in case of multislice request." + }, + "node": { + "$ref": "Node", + "description": "Required. The node." + }, + "nodeId": { + "description": "Optional. The unqualified resource name. Should follow the `^[A-Za-z0-9_.~+%-]+$` regex format. This is only specified when requesting a single node. In case of multislice requests, multislice_params must be populated instead.", + "type": "string" + }, + "parent": { + "description": "Required. The parent resource name.", + "type": "string" + } + }, + "type": "object" + }, "Operation": { "description": "This resource represents a long-running operation that is the result of a network API call.", "id": "Operation", @@ -1373,6 +1668,183 @@ }, "type": "object" }, + "ProvisioningData": { + "description": "Further data for the provisioning state.", + "id": "ProvisioningData", + "properties": {}, + "type": "object" + }, + "QueuedResource": { + "description": "A QueuedResource represents a request for resources that will be placed in a queue and fulfilled when the necessary resources are available.", + "id": "QueuedResource", + "properties": { + "createTime": { + "description": "Output only. The time when the QueuedResource was created.", + "format": "google-datetime", + "readOnly": true, + "type": "string" + }, + "guaranteed": { + "$ref": "Guaranteed", + "description": "Optional. The Guaranteed tier" + }, + "name": { + "description": "Output only. Immutable. The name of the QueuedResource.", + "readOnly": true, + "type": "string" + }, + "queueingPolicy": { + "$ref": "QueueingPolicy", + "description": "Optional. The queueing policy of the QueuedRequest." + }, + "reservationName": { + "description": "Optional. Name of the reservation in which the resource should be provisioned. Format: projects/{project}/locations/{zone}/reservations/{reservation}", + "type": "string" + }, + "spot": { + "$ref": "Spot", + "description": "Optional. The Spot tier." + }, + "state": { + "$ref": "QueuedResourceState", + "description": "Output only. State of the QueuedResource request.", + "readOnly": true + }, + "tpu": { + "$ref": "Tpu", + "description": "Optional. Defines a TPU resource." + } + }, + "type": "object" + }, + "QueuedResourceState": { + "description": "QueuedResourceState defines the details of the QueuedResource request.", + "id": "QueuedResourceState", + "properties": { + "acceptedData": { + "$ref": "AcceptedData", + "description": "Output only. Further data for the accepted state.", + "readOnly": true + }, + "activeData": { + "$ref": "ActiveData", + "description": "Output only. Further data for the active state.", + "readOnly": true + }, + "creatingData": { + "$ref": "CreatingData", + "description": "Output only. Further data for the creating state.", + "readOnly": true + }, + "deletingData": { + "$ref": "DeletingData", + "description": "Output only. Further data for the deleting state.", + "readOnly": true + }, + "failedData": { + "$ref": "FailedData", + "description": "Output only. Further data for the failed state.", + "readOnly": true + }, + "provisioningData": { + "$ref": "ProvisioningData", + "description": "Output only. Further data for the provisioning state.", + "readOnly": true + }, + "state": { + "description": "Output only. State of the QueuedResource request.", + "enum": [ + "STATE_UNSPECIFIED", + "CREATING", + "ACCEPTED", + "PROVISIONING", + "FAILED", + "DELETING", + "ACTIVE", + "SUSPENDING", + "SUSPENDED", + "WAITING_FOR_RESOURCES" + ], + "enumDescriptions": [ + "State of the QueuedResource request is not known/set.", + "The QueuedResource request has been received. We're still working on determining if we will be able to honor this request.", + "The QueuedResource request has passed initial validation/admission control and has been persisted in the queue.", + "The QueuedResource request has been selected. The associated resources are currently being provisioned (or very soon will begin provisioning).", + "The request could not be completed. This may be due to some late-discovered problem with the request itself, or due to unavailability of resources within the constraints of the request (e.g., the 'valid until' start timing constraint expired).", + "The QueuedResource is being deleted.", + "The resources specified in the QueuedResource request have been provisioned and are ready for use by the end-user/consumer.", + "The resources specified in the QueuedResource request are being deleted. This may have been initiated by the user, or the Cloud TPU service. Inspect the state data for more details.", + "The resources specified in the QueuedResource request have been deleted.", + "The QueuedResource request has passed initial validation and has been persisted in the queue. It will remain in this state until there are sufficient free resources to begin provisioning your request. Wait times will vary significantly depending on demand levels. When demand is high, not all requests can be immediately provisioned. If you need more reliable obtainability of TPUs consider purchasing a reservation. To put a limit on how long you are willing to wait, use [timing constraints](https://cloud.google.com/tpu/docs/queued-resources#request_a_queued_resource_before_a_specified_time)." + ], + "readOnly": true, + "type": "string" + }, + "stateInitiator": { + "description": "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.", + "enum": [ + "STATE_INITIATOR_UNSPECIFIED", + "USER", + "SERVICE" + ], + "enumDescriptions": [ + "The state initiator is unspecified.", + "The current QueuedResource state was initiated by the user.", + "The current QueuedResource state was initiated by the service." + ], + "readOnly": true, + "type": "string" + }, + "suspendedData": { + "$ref": "SuspendedData", + "description": "Output only. Further data for the suspended state.", + "readOnly": true + }, + "suspendingData": { + "$ref": "SuspendingData", + "description": "Output only. Further data for the suspending state.", + "readOnly": true + } + }, + "type": "object" + }, + "QueueingPolicy": { + "description": "Defines the policy of the QueuedRequest.", + "id": "QueueingPolicy", + "properties": { + "validAfterDuration": { + "description": "Optional. A relative time after which resources may be created.", + "format": "google-duration", + "type": "string" + }, + "validAfterTime": { + "description": "Optional. An absolute time after which resources may be created.", + "format": "google-datetime", + "type": "string" + }, + "validInterval": { + "$ref": "Interval", + "description": "Optional. An absolute time interval within which resources may be created." + }, + "validUntilDuration": { + "description": "Optional. A relative time after which resources should not be created. If the request cannot be fulfilled by this time the request will be failed.", + "format": "google-duration", + "type": "string" + }, + "validUntilTime": { + "description": "Optional. An absolute time after which resources should not be created. If the request cannot be fulfilled by this time the request will be failed.", + "format": "google-datetime", + "type": "string" + } + }, + "type": "object" + }, + "ResetQueuedResourceRequest": { + "description": "Request for ResetQueuedResource.", + "id": "ResetQueuedResourceRequest", + "properties": {}, + "type": "object" + }, "RuntimeVersion": { "description": "A runtime version that a Node can be configured with.", "id": "RuntimeVersion", @@ -1447,6 +1919,12 @@ }, "type": "object" }, + "Spot": { + "description": "Spot tier definition.", + "id": "Spot", + "properties": {}, + "type": "object" + }, "StartNodeRequest": { "description": "Request for StartNode.", "id": "StartNodeRequest", @@ -1486,6 +1964,18 @@ "properties": {}, "type": "object" }, + "SuspendedData": { + "description": "Further data for the suspended state.", + "id": "SuspendedData", + "properties": {}, + "type": "object" + }, + "SuspendingData": { + "description": "Further data for the suspending state.", + "id": "SuspendingData", + "properties": {}, + "type": "object" + }, "Symptom": { "description": "A Symptom instance.", "id": "Symptom", @@ -1527,6 +2017,20 @@ } }, "type": "object" + }, + "Tpu": { + "description": "Details of the TPU resource(s) being requested.", + "id": "Tpu", + "properties": { + "nodeSpec": { + "description": "Optional. The TPU node(s) being requested.", + "items": { + "$ref": "NodeSpec" + }, + "type": "array" + } + }, + "type": "object" } }, "servicePath": "", diff --git a/tpu/v2/tpu-gen.go b/tpu/v2/tpu-gen.go index d2de86d32bc..10ed6746977 100644 --- a/tpu/v2/tpu-gen.go +++ b/tpu/v2/tpu-gen.go @@ -172,6 +172,7 @@ func NewProjectsLocationsService(s *Service) *ProjectsLocationsService { rs.AcceleratorTypes = NewProjectsLocationsAcceleratorTypesService(s) rs.Nodes = NewProjectsLocationsNodesService(s) rs.Operations = NewProjectsLocationsOperationsService(s) + rs.QueuedResources = NewProjectsLocationsQueuedResourcesService(s) rs.RuntimeVersions = NewProjectsLocationsRuntimeVersionsService(s) return rs } @@ -185,6 +186,8 @@ type ProjectsLocationsService struct { Operations *ProjectsLocationsOperationsService + QueuedResources *ProjectsLocationsQueuedResourcesService + RuntimeVersions *ProjectsLocationsRuntimeVersionsService } @@ -215,6 +218,15 @@ type ProjectsLocationsOperationsService struct { s *Service } +func NewProjectsLocationsQueuedResourcesService(s *Service) *ProjectsLocationsQueuedResourcesService { + rs := &ProjectsLocationsQueuedResourcesService{s: s} + return rs +} + +type ProjectsLocationsQueuedResourcesService struct { + s *Service +} + func NewProjectsLocationsRuntimeVersionsService(s *Service) *ProjectsLocationsRuntimeVersionsService { rs := &ProjectsLocationsRuntimeVersionsService{s: s} return rs @@ -301,6 +313,10 @@ func (s *AcceleratorType) MarshalJSON() ([]byte, error) { return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } +// AcceptedData: Further data for the accepted state. +type AcceptedData struct { +} + // AccessConfig: An access config attached to the TPU worker. type AccessConfig struct { // ExternalIp: Output only. An external IP address associated with the @@ -330,6 +346,10 @@ func (s *AccessConfig) MarshalJSON() ([]byte, error) { return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } +// ActiveData: Further data for the active state. +type ActiveData struct { +} + // AttachedDisk: A node-attached disk resource. Next ID: 8; type AttachedDisk struct { // Mode: The mode in which to attach this disk. If not specified, the @@ -370,6 +390,14 @@ func (s *AttachedDisk) MarshalJSON() ([]byte, error) { return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } +// CreatingData: Further data for the creating state. +type CreatingData struct { +} + +// DeletingData: Further data for the deleting state. +type DeletingData struct { +} + // Empty: A generic empty message that you can re-use to avoid defining // duplicated empty messages in your APIs. A typical example is to use // it as the request or the response type of an API method. For @@ -381,6 +409,35 @@ type Empty struct { googleapi.ServerResponse `json:"-"` } +// FailedData: Further data for the failed state. +type FailedData struct { + // Error: Output only. The error that caused the queued resource to + // enter the FAILED state. + Error *Status `json:"error,omitempty"` + + // ForceSendFields is a list of field names (e.g. "Error") to + // unconditionally include in API requests. By default, fields with + // empty or default values are omitted from API requests. However, any + // non-pointer, non-interface field appearing in ForceSendFields will be + // sent to the server regardless of whether the field is empty or not. + // This may be used to include empty fields in Patch requests. + ForceSendFields []string `json:"-"` + + // NullFields is a list of field names (e.g. "Error") to include in API + // requests with the JSON null value. By default, fields with empty + // values are omitted from API requests. However, any field with an + // empty value appearing in NullFields will be sent to the server as + // null. It is an error if a field in this list has a non-empty value. + // This may be used to include null fields in Patch requests. + NullFields []string `json:"-"` +} + +func (s *FailedData) MarshalJSON() ([]byte, error) { + type NoMethod FailedData + raw := NoMethod(*s) + return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) +} + // GenerateServiceIdentityRequest: Request for GenerateServiceIdentity. type GenerateServiceIdentityRequest struct { } @@ -483,6 +540,36 @@ func (s *GetGuestAttributesResponse) MarshalJSON() ([]byte, error) { return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } +// Guaranteed: Guaranteed tier definition. +type Guaranteed struct { + // MinDuration: Optional. Defines the minimum duration of the guarantee. + // If specified, the requested resources will only be provisioned if + // they can be allocated for at least the given duration. + MinDuration string `json:"minDuration,omitempty"` + + // ForceSendFields is a list of field names (e.g. "MinDuration") to + // unconditionally include in API requests. By default, fields with + // empty or default values are omitted from API requests. However, any + // non-pointer, non-interface field appearing in ForceSendFields will be + // sent to the server regardless of whether the field is empty or not. + // This may be used to include empty fields in Patch requests. + ForceSendFields []string `json:"-"` + + // NullFields is a list of field names (e.g. "MinDuration") to include + // in API requests with the JSON null value. By default, fields with + // empty values are omitted from API requests. However, any field with + // an empty value appearing in NullFields will be sent to the server as + // null. It is an error if a field in this list has a non-empty value. + // This may be used to include null fields in Patch requests. + NullFields []string `json:"-"` +} + +func (s *Guaranteed) MarshalJSON() ([]byte, error) { + type NoMethod Guaranteed + raw := NoMethod(*s) + return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) +} + // GuestAttributes: A guest attributes. type GuestAttributes struct { // QueryPath: The path to be queried. This can be the default namespace @@ -578,6 +665,44 @@ func (s *GuestAttributesValue) MarshalJSON() ([]byte, error) { return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } +// Interval: Represents a time interval, encoded as a Timestamp start +// (inclusive) and a Timestamp end (exclusive). The start must be less +// than or equal to the end. When the start equals the end, the interval +// is empty (matches no time). When both start and end are unspecified, +// the interval matches any time. +type Interval struct { + // EndTime: Optional. Exclusive end of the interval. If specified, a + // Timestamp matching this interval will have to be before the end. + EndTime string `json:"endTime,omitempty"` + + // StartTime: Optional. Inclusive start of the interval. If specified, a + // Timestamp matching this interval will have to be the same or after + // the start. + StartTime string `json:"startTime,omitempty"` + + // ForceSendFields is a list of field names (e.g. "EndTime") to + // unconditionally include in API requests. By default, fields with + // empty or default values are omitted from API requests. However, any + // non-pointer, non-interface field appearing in ForceSendFields will be + // sent to the server regardless of whether the field is empty or not. + // This may be used to include empty fields in Patch requests. + ForceSendFields []string `json:"-"` + + // NullFields is a list of field names (e.g. "EndTime") to include in + // API requests with the JSON null value. By default, fields with empty + // values are omitted from API requests. However, any field with an + // empty value appearing in NullFields will be sent to the server as + // null. It is an error if a field in this list has a non-empty value. + // This may be used to include null fields in Patch requests. + NullFields []string `json:"-"` +} + +func (s *Interval) MarshalJSON() ([]byte, error) { + type NoMethod Interval + raw := NoMethod(*s) + return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) +} + // ListAcceleratorTypesResponse: Response for ListAcceleratorTypes. type ListAcceleratorTypesResponse struct { // AcceleratorTypes: The listed nodes. @@ -729,6 +854,44 @@ func (s *ListOperationsResponse) MarshalJSON() ([]byte, error) { return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } +// ListQueuedResourcesResponse: Response for ListQueuedResources. +type ListQueuedResourcesResponse struct { + // NextPageToken: The next page token or empty if none. + NextPageToken string `json:"nextPageToken,omitempty"` + + // QueuedResources: The listed queued resources. + QueuedResources []*QueuedResource `json:"queuedResources,omitempty"` + + // Unreachable: Locations that could not be reached. + Unreachable []string `json:"unreachable,omitempty"` + + // ServerResponse contains the HTTP response code and headers from the + // server. + googleapi.ServerResponse `json:"-"` + + // ForceSendFields is a list of field names (e.g. "NextPageToken") to + // unconditionally include in API requests. By default, fields with + // empty or default values are omitted from API requests. However, any + // non-pointer, non-interface field appearing in ForceSendFields will be + // sent to the server regardless of whether the field is empty or not. + // This may be used to include empty fields in Patch requests. + ForceSendFields []string `json:"-"` + + // NullFields is a list of field names (e.g. "NextPageToken") to include + // in API requests with the JSON null value. By default, fields with + // empty values are omitted from API requests. However, any field with + // an empty value appearing in NullFields will be sent to the server as + // null. It is an error if a field in this list has a non-empty value. + // This may be used to include null fields in Patch requests. + NullFields []string `json:"-"` +} + +func (s *ListQueuedResourcesResponse) MarshalJSON() ([]byte, error) { + type NoMethod ListQueuedResourcesResponse + raw := NoMethod(*s) + return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) +} + // ListRuntimeVersionsResponse: Response for ListRuntimeVersions. type ListRuntimeVersionsResponse struct { // NextPageToken: The next page token or empty if none. @@ -817,6 +980,45 @@ func (s *Location) MarshalJSON() ([]byte, error) { return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } +// MultisliceParams: Parameters to specify for multislice QueuedResource +// requests. This message must be populated in case of multislice +// requests instead of node_id. +type MultisliceParams struct { + // NodeCount: Required. Number of nodes with this spec. The system will + // attempt to provison "node_count" nodes as part of the request. This + // needs to be > 1. + NodeCount int64 `json:"nodeCount,omitempty"` + + // NodeIdPrefix: Optional. Prefix of node_ids in case of multislice + // request. Should follow the `^[A-Za-z0-9_.~+%-]+$` regex format. If + // node_count = 3 and node_id_prefix = "np", node ids of nodes created + // will be "np-0", "np-1", "np-2". If this field is not provided we use + // queued_resource_id as the node_id_prefix. + NodeIdPrefix string `json:"nodeIdPrefix,omitempty"` + + // ForceSendFields is a list of field names (e.g. "NodeCount") to + // unconditionally include in API requests. By default, fields with + // empty or default values are omitted from API requests. However, any + // non-pointer, non-interface field appearing in ForceSendFields will be + // sent to the server regardless of whether the field is empty or not. + // This may be used to include empty fields in Patch requests. + ForceSendFields []string `json:"-"` + + // NullFields is a list of field names (e.g. "NodeCount") to include in + // API requests with the JSON null value. By default, fields with empty + // values are omitted from API requests. However, any field with an + // empty value appearing in NullFields will be sent to the server as + // null. It is an error if a field in this list has a non-empty value. + // This may be used to include null fields in Patch requests. + NullFields []string `json:"-"` +} + +func (s *MultisliceParams) MarshalJSON() ([]byte, error) { + type NoMethod MultisliceParams + raw := NoMethod(*s) + return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) +} + // NetworkConfig: Network related configurations. type NetworkConfig struct { // CanIpForward: Allows the TPU node to send and receive packets with @@ -1058,6 +1260,50 @@ func (s *Node) MarshalJSON() ([]byte, error) { return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } +// NodeSpec: Details of the TPU node(s) being requested. Users can +// request either a single node or multiple nodes. NodeSpec provides the +// specification for node(s) to be created. +type NodeSpec struct { + // MultisliceParams: Optional. Fields to specify in case of multislice + // request. + MultisliceParams *MultisliceParams `json:"multisliceParams,omitempty"` + + // Node: Required. The node. + Node *Node `json:"node,omitempty"` + + // NodeId: Optional. The unqualified resource name. Should follow the + // `^[A-Za-z0-9_.~+%-]+$` regex format. This is only specified when + // requesting a single node. In case of multislice requests, + // multislice_params must be populated instead. + NodeId string `json:"nodeId,omitempty"` + + // Parent: Required. The parent resource name. + Parent string `json:"parent,omitempty"` + + // ForceSendFields is a list of field names (e.g. "MultisliceParams") to + // unconditionally include in API requests. By default, fields with + // empty or default values are omitted from API requests. However, any + // non-pointer, non-interface field appearing in ForceSendFields will be + // sent to the server regardless of whether the field is empty or not. + // This may be used to include empty fields in Patch requests. + ForceSendFields []string `json:"-"` + + // NullFields is a list of field names (e.g. "MultisliceParams") to + // include in API requests with the JSON null value. By default, fields + // with empty values are omitted from API requests. However, any field + // with an empty value appearing in NullFields will be sent to the + // server as null. It is an error if a field in this list has a + // non-empty value. This may be used to include null fields in Patch + // requests. + NullFields []string `json:"-"` +} + +func (s *NodeSpec) MarshalJSON() ([]byte, error) { + type NoMethod NodeSpec + raw := NoMethod(*s) + return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) +} + // Operation: This resource represents a long-running operation that is // the result of a network API call. type Operation struct { @@ -1168,6 +1414,220 @@ func (s *OperationMetadata) MarshalJSON() ([]byte, error) { return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } +// ProvisioningData: Further data for the provisioning state. +type ProvisioningData struct { +} + +// QueuedResource: A QueuedResource represents a request for resources +// that will be placed in a queue and fulfilled when the necessary +// resources are available. +type QueuedResource struct { + // CreateTime: Output only. The time when the QueuedResource was + // created. + CreateTime string `json:"createTime,omitempty"` + + // Guaranteed: Optional. The Guaranteed tier + Guaranteed *Guaranteed `json:"guaranteed,omitempty"` + + // Name: Output only. Immutable. The name of the QueuedResource. + Name string `json:"name,omitempty"` + + // QueueingPolicy: Optional. The queueing policy of the QueuedRequest. + QueueingPolicy *QueueingPolicy `json:"queueingPolicy,omitempty"` + + // ReservationName: Optional. Name of the reservation in which the + // resource should be provisioned. Format: + // projects/{project}/locations/{zone}/reservations/{reservation} + ReservationName string `json:"reservationName,omitempty"` + + // Spot: Optional. The Spot tier. + Spot *Spot `json:"spot,omitempty"` + + // State: Output only. State of the QueuedResource request. + State *QueuedResourceState `json:"state,omitempty"` + + // Tpu: Optional. Defines a TPU resource. + Tpu *Tpu `json:"tpu,omitempty"` + + // ServerResponse contains the HTTP response code and headers from the + // server. + googleapi.ServerResponse `json:"-"` + + // ForceSendFields is a list of field names (e.g. "CreateTime") to + // unconditionally include in API requests. By default, fields with + // empty or default values are omitted from API requests. However, any + // non-pointer, non-interface field appearing in ForceSendFields will be + // sent to the server regardless of whether the field is empty or not. + // This may be used to include empty fields in Patch requests. + ForceSendFields []string `json:"-"` + + // NullFields is a list of field names (e.g. "CreateTime") to include in + // API requests with the JSON null value. By default, fields with empty + // values are omitted from API requests. However, any field with an + // empty value appearing in NullFields will be sent to the server as + // null. It is an error if a field in this list has a non-empty value. + // This may be used to include null fields in Patch requests. + NullFields []string `json:"-"` +} + +func (s *QueuedResource) MarshalJSON() ([]byte, error) { + type NoMethod QueuedResource + raw := NoMethod(*s) + return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) +} + +// QueuedResourceState: QueuedResourceState defines the details of the +// QueuedResource request. +type QueuedResourceState struct { + // AcceptedData: Output only. Further data for the accepted state. + AcceptedData *AcceptedData `json:"acceptedData,omitempty"` + + // ActiveData: Output only. Further data for the active state. + ActiveData *ActiveData `json:"activeData,omitempty"` + + // CreatingData: Output only. Further data for the creating state. + CreatingData *CreatingData `json:"creatingData,omitempty"` + + // DeletingData: Output only. Further data for the deleting state. + DeletingData *DeletingData `json:"deletingData,omitempty"` + + // FailedData: Output only. Further data for the failed state. + FailedData *FailedData `json:"failedData,omitempty"` + + // ProvisioningData: Output only. Further data for the provisioning + // state. + ProvisioningData *ProvisioningData `json:"provisioningData,omitempty"` + + // State: Output only. State of the QueuedResource request. + // + // Possible values: + // "STATE_UNSPECIFIED" - State of the QueuedResource request is not + // known/set. + // "CREATING" - The QueuedResource request has been received. We're + // still working on determining if we will be able to honor this + // request. + // "ACCEPTED" - The QueuedResource request has passed initial + // validation/admission control and has been persisted in the queue. + // "PROVISIONING" - The QueuedResource request has been selected. The + // associated resources are currently being provisioned (or very soon + // will begin provisioning). + // "FAILED" - The request could not be completed. This may be due to + // some late-discovered problem with the request itself, or due to + // unavailability of resources within the constraints of the request + // (e.g., the 'valid until' start timing constraint expired). + // "DELETING" - The QueuedResource is being deleted. + // "ACTIVE" - The resources specified in the QueuedResource request + // have been provisioned and are ready for use by the end-user/consumer. + // "SUSPENDING" - The resources specified in the QueuedResource + // request are being deleted. This may have been initiated by the user, + // or the Cloud TPU service. Inspect the state data for more details. + // "SUSPENDED" - The resources specified in the QueuedResource request + // have been deleted. + // "WAITING_FOR_RESOURCES" - The QueuedResource request has passed + // initial validation and has been persisted in the queue. It will + // remain in this state until there are sufficient free resources to + // begin provisioning your request. Wait times will vary significantly + // depending on demand levels. When demand is high, not all requests can + // be immediately provisioned. If you need more reliable obtainability + // of TPUs consider purchasing a reservation. To put a limit on how long + // you are willing to wait, use [timing + // constraints](https://cloud.google.com/tpu/docs/queued-resources#reques + // t_a_queued_resource_before_a_specified_time). + State string `json:"state,omitempty"` + + // StateInitiator: 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. + // + // Possible values: + // "STATE_INITIATOR_UNSPECIFIED" - The state initiator is unspecified. + // "USER" - The current QueuedResource state was initiated by the + // user. + // "SERVICE" - The current QueuedResource state was initiated by the + // service. + StateInitiator string `json:"stateInitiator,omitempty"` + + // SuspendedData: Output only. Further data for the suspended state. + SuspendedData *SuspendedData `json:"suspendedData,omitempty"` + + // SuspendingData: Output only. Further data for the suspending state. + SuspendingData *SuspendingData `json:"suspendingData,omitempty"` + + // ForceSendFields is a list of field names (e.g. "AcceptedData") to + // unconditionally include in API requests. By default, fields with + // empty or default values are omitted from API requests. However, any + // non-pointer, non-interface field appearing in ForceSendFields will be + // sent to the server regardless of whether the field is empty or not. + // This may be used to include empty fields in Patch requests. + ForceSendFields []string `json:"-"` + + // NullFields is a list of field names (e.g. "AcceptedData") to include + // in API requests with the JSON null value. By default, fields with + // empty values are omitted from API requests. However, any field with + // an empty value appearing in NullFields will be sent to the server as + // null. It is an error if a field in this list has a non-empty value. + // This may be used to include null fields in Patch requests. + NullFields []string `json:"-"` +} + +func (s *QueuedResourceState) MarshalJSON() ([]byte, error) { + type NoMethod QueuedResourceState + raw := NoMethod(*s) + return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) +} + +// QueueingPolicy: Defines the policy of the QueuedRequest. +type QueueingPolicy struct { + // ValidAfterDuration: Optional. A relative time after which resources + // may be created. + ValidAfterDuration string `json:"validAfterDuration,omitempty"` + + // ValidAfterTime: Optional. An absolute time after which resources may + // be created. + ValidAfterTime string `json:"validAfterTime,omitempty"` + + // ValidInterval: Optional. An absolute time interval within which + // resources may be created. + ValidInterval *Interval `json:"validInterval,omitempty"` + + // ValidUntilDuration: Optional. A relative time after which resources + // should not be created. If the request cannot be fulfilled by this + // time the request will be failed. + ValidUntilDuration string `json:"validUntilDuration,omitempty"` + + // ValidUntilTime: Optional. An absolute time after which resources + // should not be created. If the request cannot be fulfilled by this + // time the request will be failed. + ValidUntilTime string `json:"validUntilTime,omitempty"` + + // ForceSendFields is a list of field names (e.g. "ValidAfterDuration") + // to unconditionally include in API requests. By default, fields with + // empty or default values are omitted from API requests. However, any + // non-pointer, non-interface field appearing in ForceSendFields will be + // sent to the server regardless of whether the field is empty or not. + // This may be used to include empty fields in Patch requests. + ForceSendFields []string `json:"-"` + + // NullFields is a list of field names (e.g. "ValidAfterDuration") to + // include in API requests with the JSON null value. By default, fields + // with empty values are omitted from API requests. However, any field + // with an empty value appearing in NullFields will be sent to the + // server as null. It is an error if a field in this list has a + // non-empty value. This may be used to include null fields in Patch + // requests. + NullFields []string `json:"-"` +} + +func (s *QueueingPolicy) MarshalJSON() ([]byte, error) { + type NoMethod QueueingPolicy + raw := NoMethod(*s) + return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) +} + +// ResetQueuedResourceRequest: Request for ResetQueuedResource. +type ResetQueuedResourceRequest struct { +} + // RuntimeVersion: A runtime version that a Node can be configured with. type RuntimeVersion struct { // Name: The resource name. @@ -1329,6 +1789,10 @@ func (s *ShieldedInstanceConfig) MarshalJSON() ([]byte, error) { return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } +// Spot: Spot tier definition. +type Spot struct { +} + // StartNodeRequest: Request for StartNode. type StartNodeRequest struct { } @@ -1381,7 +1845,15 @@ func (s *Status) MarshalJSON() ([]byte, error) { type StopNodeRequest struct { } -// Symptom: A Symptom instance. +// SuspendedData: Further data for the suspended state. +type SuspendedData struct { +} + +// SuspendingData: Further data for the suspending state. +type SuspendingData struct { +} + +// Symptom: A Symptom instance. type Symptom struct { // CreateTime: Timestamp when the Symptom is created. CreateTime string `json:"createTime,omitempty"` @@ -1430,6 +1902,34 @@ func (s *Symptom) MarshalJSON() ([]byte, error) { return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } +// Tpu: Details of the TPU resource(s) being requested. +type Tpu struct { + // NodeSpec: Optional. The TPU node(s) being requested. + NodeSpec []*NodeSpec `json:"nodeSpec,omitempty"` + + // ForceSendFields is a list of field names (e.g. "NodeSpec") to + // unconditionally include in API requests. By default, fields with + // empty or default values are omitted from API requests. However, any + // non-pointer, non-interface field appearing in ForceSendFields will be + // sent to the server regardless of whether the field is empty or not. + // This may be used to include empty fields in Patch requests. + ForceSendFields []string `json:"-"` + + // NullFields is a list of field names (e.g. "NodeSpec") to include in + // API requests with the JSON null value. By default, fields with empty + // values are omitted from API requests. However, any field with an + // empty value appearing in NullFields will be sent to the server as + // null. It is an error if a field in this list has a non-empty value. + // This may be used to include null fields in Patch requests. + NullFields []string `json:"-"` +} + +func (s *Tpu) MarshalJSON() ([]byte, error) { + type NoMethod Tpu + raw := NoMethod(*s) + return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) +} + // method id "tpu.projects.locations.generateServiceIdentity": type ProjectsLocationsGenerateServiceIdentityCall struct { @@ -4125,6 +4625,813 @@ func (c *ProjectsLocationsOperationsListCall) Pages(ctx context.Context, f func( } } +// method id "tpu.projects.locations.queuedResources.create": + +type ProjectsLocationsQueuedResourcesCreateCall struct { + s *Service + parent string + queuedresource *QueuedResource + urlParams_ gensupport.URLParams + ctx_ context.Context + header_ http.Header +} + +// Create: Creates a QueuedResource TPU instance. +// +// - parent: The parent resource name. +func (r *ProjectsLocationsQueuedResourcesService) Create(parent string, queuedresource *QueuedResource) *ProjectsLocationsQueuedResourcesCreateCall { + c := &ProjectsLocationsQueuedResourcesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} + c.parent = parent + c.queuedresource = queuedresource + return c +} + +// QueuedResourceId sets the optional parameter "queuedResourceId": The +// unqualified resource name. Should follow the `^[A-Za-z0-9_.~+%-]+$` +// regex format. +func (c *ProjectsLocationsQueuedResourcesCreateCall) QueuedResourceId(queuedResourceId string) *ProjectsLocationsQueuedResourcesCreateCall { + c.urlParams_.Set("queuedResourceId", queuedResourceId) + return c +} + +// RequestId sets the optional parameter "requestId": Idempotent request +// UUID. +func (c *ProjectsLocationsQueuedResourcesCreateCall) RequestId(requestId string) *ProjectsLocationsQueuedResourcesCreateCall { + c.urlParams_.Set("requestId", requestId) + return c +} + +// Fields allows partial responses to be retrieved. See +// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse +// for more information. +func (c *ProjectsLocationsQueuedResourcesCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsQueuedResourcesCreateCall { + c.urlParams_.Set("fields", googleapi.CombineFields(s)) + return c +} + +// Context sets the context to be used in this call's Do method. Any +// pending HTTP request will be aborted if the provided context is +// canceled. +func (c *ProjectsLocationsQueuedResourcesCreateCall) Context(ctx context.Context) *ProjectsLocationsQueuedResourcesCreateCall { + c.ctx_ = ctx + return c +} + +// Header returns an http.Header that can be modified by the caller to +// add HTTP headers to the request. +func (c *ProjectsLocationsQueuedResourcesCreateCall) Header() http.Header { + if c.header_ == nil { + c.header_ = make(http.Header) + } + return c.header_ +} + +func (c *ProjectsLocationsQueuedResourcesCreateCall) doRequest(alt string) (*http.Response, error) { + reqHeaders := make(http.Header) + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) + for k, v := range c.header_ { + reqHeaders[k] = v + } + reqHeaders.Set("User-Agent", c.s.userAgent()) + var body io.Reader = nil + body, err := googleapi.WithoutDataWrapper.JSONReader(c.queuedresource) + if err != nil { + return nil, err + } + reqHeaders.Set("Content-Type", "application/json") + c.urlParams_.Set("alt", alt) + c.urlParams_.Set("prettyPrint", "false") + urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/queuedResources") + urls += "?" + c.urlParams_.Encode() + req, err := http.NewRequest("POST", urls, body) + if err != nil { + return nil, err + } + req.Header = reqHeaders + googleapi.Expand(req.URL, map[string]string{ + "parent": c.parent, + }) + return gensupport.SendRequest(c.ctx_, c.s.client, req) +} + +// Do executes the "tpu.projects.locations.queuedResources.create" call. +// Exactly one of *Operation or error will be non-nil. Any non-2xx +// status code is an error. Response headers are in either +// *Operation.ServerResponse.Header or (if a response was returned at +// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified +// to check whether the returned error was because +// http.StatusNotModified was returned. +func (c *ProjectsLocationsQueuedResourcesCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error) { + gensupport.SetOptions(c.urlParams_, opts...) + res, err := c.doRequest("json") + if res != nil && res.StatusCode == http.StatusNotModified { + if res.Body != nil { + res.Body.Close() + } + return nil, gensupport.WrapError(&googleapi.Error{ + Code: res.StatusCode, + Header: res.Header, + }) + } + if err != nil { + return nil, err + } + defer googleapi.CloseBody(res) + if err := googleapi.CheckResponse(res); err != nil { + return nil, gensupport.WrapError(err) + } + ret := &Operation{ + ServerResponse: googleapi.ServerResponse{ + Header: res.Header, + HTTPStatusCode: res.StatusCode, + }, + } + target := &ret + if err := gensupport.DecodeResponse(target, res); err != nil { + return nil, err + } + return ret, nil + // { + // "description": "Creates a QueuedResource TPU instance.", + // "flatPath": "v2/projects/{projectsId}/locations/{locationsId}/queuedResources", + // "httpMethod": "POST", + // "id": "tpu.projects.locations.queuedResources.create", + // "parameterOrder": [ + // "parent" + // ], + // "parameters": { + // "parent": { + // "description": "Required. The parent resource name.", + // "location": "path", + // "pattern": "^projects/[^/]+/locations/[^/]+$", + // "required": true, + // "type": "string" + // }, + // "queuedResourceId": { + // "description": "Optional. The unqualified resource name. Should follow the `^[A-Za-z0-9_.~+%-]+$` regex format.", + // "location": "query", + // "type": "string" + // }, + // "requestId": { + // "description": "Optional. Idempotent request UUID.", + // "location": "query", + // "type": "string" + // } + // }, + // "path": "v2/{+parent}/queuedResources", + // "request": { + // "$ref": "QueuedResource" + // }, + // "response": { + // "$ref": "Operation" + // }, + // "scopes": [ + // "https://www.googleapis.com/auth/cloud-platform" + // ] + // } + +} + +// method id "tpu.projects.locations.queuedResources.delete": + +type ProjectsLocationsQueuedResourcesDeleteCall struct { + s *Service + name string + urlParams_ gensupport.URLParams + ctx_ context.Context + header_ http.Header +} + +// Delete: Deletes a QueuedResource TPU instance. +// +// - name: The resource name. +func (r *ProjectsLocationsQueuedResourcesService) Delete(name string) *ProjectsLocationsQueuedResourcesDeleteCall { + c := &ProjectsLocationsQueuedResourcesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} + c.name = name + return c +} + +// Force sets the optional parameter "force": If set to true, all +// running nodes belonging to this queued resource will be deleted first +// and then the queued resource will be deleted. Otherwise (i.e. +// force=false), the queued resource will only be deleted if its nodes +// have already been deleted or the queued resource is in the ACCEPTED, +// FAILED, or SUSPENDED state. +func (c *ProjectsLocationsQueuedResourcesDeleteCall) Force(force bool) *ProjectsLocationsQueuedResourcesDeleteCall { + c.urlParams_.Set("force", fmt.Sprint(force)) + return c +} + +// RequestId sets the optional parameter "requestId": Idempotent request +// UUID. +func (c *ProjectsLocationsQueuedResourcesDeleteCall) RequestId(requestId string) *ProjectsLocationsQueuedResourcesDeleteCall { + c.urlParams_.Set("requestId", requestId) + return c +} + +// Fields allows partial responses to be retrieved. See +// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse +// for more information. +func (c *ProjectsLocationsQueuedResourcesDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsQueuedResourcesDeleteCall { + c.urlParams_.Set("fields", googleapi.CombineFields(s)) + return c +} + +// Context sets the context to be used in this call's Do method. Any +// pending HTTP request will be aborted if the provided context is +// canceled. +func (c *ProjectsLocationsQueuedResourcesDeleteCall) Context(ctx context.Context) *ProjectsLocationsQueuedResourcesDeleteCall { + c.ctx_ = ctx + return c +} + +// Header returns an http.Header that can be modified by the caller to +// add HTTP headers to the request. +func (c *ProjectsLocationsQueuedResourcesDeleteCall) Header() http.Header { + if c.header_ == nil { + c.header_ = make(http.Header) + } + return c.header_ +} + +func (c *ProjectsLocationsQueuedResourcesDeleteCall) doRequest(alt string) (*http.Response, error) { + reqHeaders := make(http.Header) + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) + for k, v := range c.header_ { + reqHeaders[k] = v + } + reqHeaders.Set("User-Agent", c.s.userAgent()) + var body io.Reader = nil + c.urlParams_.Set("alt", alt) + c.urlParams_.Set("prettyPrint", "false") + urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}") + urls += "?" + c.urlParams_.Encode() + req, err := http.NewRequest("DELETE", urls, body) + if err != nil { + return nil, err + } + req.Header = reqHeaders + googleapi.Expand(req.URL, map[string]string{ + "name": c.name, + }) + return gensupport.SendRequest(c.ctx_, c.s.client, req) +} + +// Do executes the "tpu.projects.locations.queuedResources.delete" call. +// Exactly one of *Operation or error will be non-nil. Any non-2xx +// status code is an error. Response headers are in either +// *Operation.ServerResponse.Header or (if a response was returned at +// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified +// to check whether the returned error was because +// http.StatusNotModified was returned. +func (c *ProjectsLocationsQueuedResourcesDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) { + gensupport.SetOptions(c.urlParams_, opts...) + res, err := c.doRequest("json") + if res != nil && res.StatusCode == http.StatusNotModified { + if res.Body != nil { + res.Body.Close() + } + return nil, gensupport.WrapError(&googleapi.Error{ + Code: res.StatusCode, + Header: res.Header, + }) + } + if err != nil { + return nil, err + } + defer googleapi.CloseBody(res) + if err := googleapi.CheckResponse(res); err != nil { + return nil, gensupport.WrapError(err) + } + ret := &Operation{ + ServerResponse: googleapi.ServerResponse{ + Header: res.Header, + HTTPStatusCode: res.StatusCode, + }, + } + target := &ret + if err := gensupport.DecodeResponse(target, res); err != nil { + return nil, err + } + return ret, nil + // { + // "description": "Deletes a QueuedResource TPU instance.", + // "flatPath": "v2/projects/{projectsId}/locations/{locationsId}/queuedResources/{queuedResourcesId}", + // "httpMethod": "DELETE", + // "id": "tpu.projects.locations.queuedResources.delete", + // "parameterOrder": [ + // "name" + // ], + // "parameters": { + // "force": { + // "description": "Optional. If set to true, all running nodes belonging to this queued resource will be deleted first and then the queued resource will be deleted. Otherwise (i.e. force=false), the queued resource will only be deleted if its nodes have already been deleted or the queued resource is in the ACCEPTED, FAILED, or SUSPENDED state.", + // "location": "query", + // "type": "boolean" + // }, + // "name": { + // "description": "Required. The resource name.", + // "location": "path", + // "pattern": "^projects/[^/]+/locations/[^/]+/queuedResources/[^/]+$", + // "required": true, + // "type": "string" + // }, + // "requestId": { + // "description": "Optional. Idempotent request UUID.", + // "location": "query", + // "type": "string" + // } + // }, + // "path": "v2/{+name}", + // "response": { + // "$ref": "Operation" + // }, + // "scopes": [ + // "https://www.googleapis.com/auth/cloud-platform" + // ] + // } + +} + +// method id "tpu.projects.locations.queuedResources.get": + +type ProjectsLocationsQueuedResourcesGetCall struct { + s *Service + name string + urlParams_ gensupport.URLParams + ifNoneMatch_ string + ctx_ context.Context + header_ http.Header +} + +// Get: Gets details of a queued resource. +// +// - name: The resource name. +func (r *ProjectsLocationsQueuedResourcesService) Get(name string) *ProjectsLocationsQueuedResourcesGetCall { + c := &ProjectsLocationsQueuedResourcesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} + c.name = name + return c +} + +// Fields allows partial responses to be retrieved. See +// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse +// for more information. +func (c *ProjectsLocationsQueuedResourcesGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsQueuedResourcesGetCall { + c.urlParams_.Set("fields", googleapi.CombineFields(s)) + return c +} + +// IfNoneMatch sets the optional parameter which makes the operation +// fail if the object's ETag matches the given value. This is useful for +// getting updates only after the object has changed since the last +// request. Use googleapi.IsNotModified to check whether the response +// error from Do is the result of In-None-Match. +func (c *ProjectsLocationsQueuedResourcesGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsQueuedResourcesGetCall { + c.ifNoneMatch_ = entityTag + return c +} + +// Context sets the context to be used in this call's Do method. Any +// pending HTTP request will be aborted if the provided context is +// canceled. +func (c *ProjectsLocationsQueuedResourcesGetCall) Context(ctx context.Context) *ProjectsLocationsQueuedResourcesGetCall { + c.ctx_ = ctx + return c +} + +// Header returns an http.Header that can be modified by the caller to +// add HTTP headers to the request. +func (c *ProjectsLocationsQueuedResourcesGetCall) Header() http.Header { + if c.header_ == nil { + c.header_ = make(http.Header) + } + return c.header_ +} + +func (c *ProjectsLocationsQueuedResourcesGetCall) doRequest(alt string) (*http.Response, error) { + reqHeaders := make(http.Header) + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) + for k, v := range c.header_ { + reqHeaders[k] = v + } + reqHeaders.Set("User-Agent", c.s.userAgent()) + if c.ifNoneMatch_ != "" { + reqHeaders.Set("If-None-Match", c.ifNoneMatch_) + } + var body io.Reader = nil + c.urlParams_.Set("alt", alt) + c.urlParams_.Set("prettyPrint", "false") + urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}") + urls += "?" + c.urlParams_.Encode() + req, err := http.NewRequest("GET", urls, body) + if err != nil { + return nil, err + } + req.Header = reqHeaders + googleapi.Expand(req.URL, map[string]string{ + "name": c.name, + }) + return gensupport.SendRequest(c.ctx_, c.s.client, req) +} + +// Do executes the "tpu.projects.locations.queuedResources.get" call. +// Exactly one of *QueuedResource or error will be non-nil. Any non-2xx +// status code is an error. Response headers are in either +// *QueuedResource.ServerResponse.Header or (if a response was returned +// at all) in error.(*googleapi.Error).Header. Use +// googleapi.IsNotModified to check whether the returned error was +// because http.StatusNotModified was returned. +func (c *ProjectsLocationsQueuedResourcesGetCall) Do(opts ...googleapi.CallOption) (*QueuedResource, error) { + gensupport.SetOptions(c.urlParams_, opts...) + res, err := c.doRequest("json") + if res != nil && res.StatusCode == http.StatusNotModified { + if res.Body != nil { + res.Body.Close() + } + return nil, gensupport.WrapError(&googleapi.Error{ + Code: res.StatusCode, + Header: res.Header, + }) + } + if err != nil { + return nil, err + } + defer googleapi.CloseBody(res) + if err := googleapi.CheckResponse(res); err != nil { + return nil, gensupport.WrapError(err) + } + ret := &QueuedResource{ + ServerResponse: googleapi.ServerResponse{ + Header: res.Header, + HTTPStatusCode: res.StatusCode, + }, + } + target := &ret + if err := gensupport.DecodeResponse(target, res); err != nil { + return nil, err + } + return ret, nil + // { + // "description": "Gets details of a queued resource.", + // "flatPath": "v2/projects/{projectsId}/locations/{locationsId}/queuedResources/{queuedResourcesId}", + // "httpMethod": "GET", + // "id": "tpu.projects.locations.queuedResources.get", + // "parameterOrder": [ + // "name" + // ], + // "parameters": { + // "name": { + // "description": "Required. The resource name.", + // "location": "path", + // "pattern": "^projects/[^/]+/locations/[^/]+/queuedResources/[^/]+$", + // "required": true, + // "type": "string" + // } + // }, + // "path": "v2/{+name}", + // "response": { + // "$ref": "QueuedResource" + // }, + // "scopes": [ + // "https://www.googleapis.com/auth/cloud-platform" + // ] + // } + +} + +// method id "tpu.projects.locations.queuedResources.list": + +type ProjectsLocationsQueuedResourcesListCall struct { + s *Service + parent string + urlParams_ gensupport.URLParams + ifNoneMatch_ string + ctx_ context.Context + header_ http.Header +} + +// List: Lists queued resources. +// +// - parent: The parent resource name. +func (r *ProjectsLocationsQueuedResourcesService) List(parent string) *ProjectsLocationsQueuedResourcesListCall { + c := &ProjectsLocationsQueuedResourcesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} + c.parent = parent + return c +} + +// PageSize sets the optional parameter "pageSize": The maximum number +// of items to return. +func (c *ProjectsLocationsQueuedResourcesListCall) PageSize(pageSize int64) *ProjectsLocationsQueuedResourcesListCall { + c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) + return c +} + +// PageToken sets the optional parameter "pageToken": The +// next_page_token value returned from a previous List request, if any. +func (c *ProjectsLocationsQueuedResourcesListCall) PageToken(pageToken string) *ProjectsLocationsQueuedResourcesListCall { + c.urlParams_.Set("pageToken", pageToken) + return c +} + +// Fields allows partial responses to be retrieved. See +// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse +// for more information. +func (c *ProjectsLocationsQueuedResourcesListCall) Fields(s ...googleapi.Field) *ProjectsLocationsQueuedResourcesListCall { + c.urlParams_.Set("fields", googleapi.CombineFields(s)) + return c +} + +// IfNoneMatch sets the optional parameter which makes the operation +// fail if the object's ETag matches the given value. This is useful for +// getting updates only after the object has changed since the last +// request. Use googleapi.IsNotModified to check whether the response +// error from Do is the result of In-None-Match. +func (c *ProjectsLocationsQueuedResourcesListCall) IfNoneMatch(entityTag string) *ProjectsLocationsQueuedResourcesListCall { + c.ifNoneMatch_ = entityTag + return c +} + +// Context sets the context to be used in this call's Do method. Any +// pending HTTP request will be aborted if the provided context is +// canceled. +func (c *ProjectsLocationsQueuedResourcesListCall) Context(ctx context.Context) *ProjectsLocationsQueuedResourcesListCall { + c.ctx_ = ctx + return c +} + +// Header returns an http.Header that can be modified by the caller to +// add HTTP headers to the request. +func (c *ProjectsLocationsQueuedResourcesListCall) Header() http.Header { + if c.header_ == nil { + c.header_ = make(http.Header) + } + return c.header_ +} + +func (c *ProjectsLocationsQueuedResourcesListCall) doRequest(alt string) (*http.Response, error) { + reqHeaders := make(http.Header) + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) + for k, v := range c.header_ { + reqHeaders[k] = v + } + reqHeaders.Set("User-Agent", c.s.userAgent()) + if c.ifNoneMatch_ != "" { + reqHeaders.Set("If-None-Match", c.ifNoneMatch_) + } + var body io.Reader = nil + c.urlParams_.Set("alt", alt) + c.urlParams_.Set("prettyPrint", "false") + urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/queuedResources") + urls += "?" + c.urlParams_.Encode() + req, err := http.NewRequest("GET", urls, body) + if err != nil { + return nil, err + } + req.Header = reqHeaders + googleapi.Expand(req.URL, map[string]string{ + "parent": c.parent, + }) + return gensupport.SendRequest(c.ctx_, c.s.client, req) +} + +// Do executes the "tpu.projects.locations.queuedResources.list" call. +// Exactly one of *ListQueuedResourcesResponse or error will be non-nil. +// Any non-2xx status code is an error. Response headers are in either +// *ListQueuedResourcesResponse.ServerResponse.Header or (if a response +// was returned at all) in error.(*googleapi.Error).Header. Use +// googleapi.IsNotModified to check whether the returned error was +// because http.StatusNotModified was returned. +func (c *ProjectsLocationsQueuedResourcesListCall) Do(opts ...googleapi.CallOption) (*ListQueuedResourcesResponse, error) { + gensupport.SetOptions(c.urlParams_, opts...) + res, err := c.doRequest("json") + if res != nil && res.StatusCode == http.StatusNotModified { + if res.Body != nil { + res.Body.Close() + } + return nil, gensupport.WrapError(&googleapi.Error{ + Code: res.StatusCode, + Header: res.Header, + }) + } + if err != nil { + return nil, err + } + defer googleapi.CloseBody(res) + if err := googleapi.CheckResponse(res); err != nil { + return nil, gensupport.WrapError(err) + } + ret := &ListQueuedResourcesResponse{ + ServerResponse: googleapi.ServerResponse{ + Header: res.Header, + HTTPStatusCode: res.StatusCode, + }, + } + target := &ret + if err := gensupport.DecodeResponse(target, res); err != nil { + return nil, err + } + return ret, nil + // { + // "description": "Lists queued resources.", + // "flatPath": "v2/projects/{projectsId}/locations/{locationsId}/queuedResources", + // "httpMethod": "GET", + // "id": "tpu.projects.locations.queuedResources.list", + // "parameterOrder": [ + // "parent" + // ], + // "parameters": { + // "pageSize": { + // "description": "Optional. The maximum number of items to return.", + // "format": "int32", + // "location": "query", + // "type": "integer" + // }, + // "pageToken": { + // "description": "Optional. The next_page_token value returned from a previous List request, if any.", + // "location": "query", + // "type": "string" + // }, + // "parent": { + // "description": "Required. The parent resource name.", + // "location": "path", + // "pattern": "^projects/[^/]+/locations/[^/]+$", + // "required": true, + // "type": "string" + // } + // }, + // "path": "v2/{+parent}/queuedResources", + // "response": { + // "$ref": "ListQueuedResourcesResponse" + // }, + // "scopes": [ + // "https://www.googleapis.com/auth/cloud-platform" + // ] + // } + +} + +// Pages invokes f for each page of results. +// A non-nil error returned from f will halt the iteration. +// The provided context supersedes any context provided to the Context method. +func (c *ProjectsLocationsQueuedResourcesListCall) Pages(ctx context.Context, f func(*ListQueuedResourcesResponse) error) error { + c.ctx_ = ctx + defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point + for { + x, err := c.Do() + if err != nil { + return err + } + if err := f(x); err != nil { + return err + } + if x.NextPageToken == "" { + return nil + } + c.PageToken(x.NextPageToken) + } +} + +// method id "tpu.projects.locations.queuedResources.reset": + +type ProjectsLocationsQueuedResourcesResetCall struct { + s *Service + name string + resetqueuedresourcerequest *ResetQueuedResourceRequest + urlParams_ gensupport.URLParams + ctx_ context.Context + header_ http.Header +} + +// Reset: Resets a QueuedResource TPU instance +// +// - name: The name of the queued resource. +func (r *ProjectsLocationsQueuedResourcesService) Reset(name string, resetqueuedresourcerequest *ResetQueuedResourceRequest) *ProjectsLocationsQueuedResourcesResetCall { + c := &ProjectsLocationsQueuedResourcesResetCall{s: r.s, urlParams_: make(gensupport.URLParams)} + c.name = name + c.resetqueuedresourcerequest = resetqueuedresourcerequest + return c +} + +// Fields allows partial responses to be retrieved. See +// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse +// for more information. +func (c *ProjectsLocationsQueuedResourcesResetCall) Fields(s ...googleapi.Field) *ProjectsLocationsQueuedResourcesResetCall { + c.urlParams_.Set("fields", googleapi.CombineFields(s)) + return c +} + +// Context sets the context to be used in this call's Do method. Any +// pending HTTP request will be aborted if the provided context is +// canceled. +func (c *ProjectsLocationsQueuedResourcesResetCall) Context(ctx context.Context) *ProjectsLocationsQueuedResourcesResetCall { + c.ctx_ = ctx + return c +} + +// Header returns an http.Header that can be modified by the caller to +// add HTTP headers to the request. +func (c *ProjectsLocationsQueuedResourcesResetCall) Header() http.Header { + if c.header_ == nil { + c.header_ = make(http.Header) + } + return c.header_ +} + +func (c *ProjectsLocationsQueuedResourcesResetCall) doRequest(alt string) (*http.Response, error) { + reqHeaders := make(http.Header) + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) + for k, v := range c.header_ { + reqHeaders[k] = v + } + reqHeaders.Set("User-Agent", c.s.userAgent()) + var body io.Reader = nil + body, err := googleapi.WithoutDataWrapper.JSONReader(c.resetqueuedresourcerequest) + if err != nil { + return nil, err + } + reqHeaders.Set("Content-Type", "application/json") + c.urlParams_.Set("alt", alt) + c.urlParams_.Set("prettyPrint", "false") + urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}:reset") + urls += "?" + c.urlParams_.Encode() + req, err := http.NewRequest("POST", urls, body) + if err != nil { + return nil, err + } + req.Header = reqHeaders + googleapi.Expand(req.URL, map[string]string{ + "name": c.name, + }) + return gensupport.SendRequest(c.ctx_, c.s.client, req) +} + +// Do executes the "tpu.projects.locations.queuedResources.reset" call. +// Exactly one of *Operation or error will be non-nil. Any non-2xx +// status code is an error. Response headers are in either +// *Operation.ServerResponse.Header or (if a response was returned at +// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified +// to check whether the returned error was because +// http.StatusNotModified was returned. +func (c *ProjectsLocationsQueuedResourcesResetCall) Do(opts ...googleapi.CallOption) (*Operation, error) { + gensupport.SetOptions(c.urlParams_, opts...) + res, err := c.doRequest("json") + if res != nil && res.StatusCode == http.StatusNotModified { + if res.Body != nil { + res.Body.Close() + } + return nil, gensupport.WrapError(&googleapi.Error{ + Code: res.StatusCode, + Header: res.Header, + }) + } + if err != nil { + return nil, err + } + defer googleapi.CloseBody(res) + if err := googleapi.CheckResponse(res); err != nil { + return nil, gensupport.WrapError(err) + } + ret := &Operation{ + ServerResponse: googleapi.ServerResponse{ + Header: res.Header, + HTTPStatusCode: res.StatusCode, + }, + } + target := &ret + if err := gensupport.DecodeResponse(target, res); err != nil { + return nil, err + } + return ret, nil + // { + // "description": "Resets a QueuedResource TPU instance", + // "flatPath": "v2/projects/{projectsId}/locations/{locationsId}/queuedResources/{queuedResourcesId}:reset", + // "httpMethod": "POST", + // "id": "tpu.projects.locations.queuedResources.reset", + // "parameterOrder": [ + // "name" + // ], + // "parameters": { + // "name": { + // "description": "Required. The name of the queued resource.", + // "location": "path", + // "pattern": "^projects/[^/]+/locations/[^/]+/queuedResources/[^/]+$", + // "required": true, + // "type": "string" + // } + // }, + // "path": "v2/{+name}:reset", + // "request": { + // "$ref": "ResetQueuedResourceRequest" + // }, + // "response": { + // "$ref": "Operation" + // }, + // "scopes": [ + // "https://www.googleapis.com/auth/cloud-platform" + // ] + // } + +} + // method id "tpu.projects.locations.runtimeVersions.get": type ProjectsLocationsRuntimeVersionsGetCall struct { diff --git a/tpu/v2alpha1/tpu-api.json b/tpu/v2alpha1/tpu-api.json index 045ac87ed46..82f556e7d30 100644 --- a/tpu/v2alpha1/tpu-api.json +++ b/tpu/v2alpha1/tpu-api.json @@ -965,7 +965,7 @@ } } }, - "revision": "20240126", + "revision": "20240205", "rootUrl": "https://tpu.googleapis.com/", "schemas": { "AcceleratorConfig": { @@ -1917,7 +1917,7 @@ "type": "string" }, "stateInitiator": { - "description": "Output only. The initiator of the QueuedResources's current state.", + "description": "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.", "enum": [ "STATE_INITIATOR_UNSPECIFIED", "USER", diff --git a/tpu/v2alpha1/tpu-gen.go b/tpu/v2alpha1/tpu-gen.go index dc44f6a38f6..ca0f574064c 100644 --- a/tpu/v2alpha1/tpu-gen.go +++ b/tpu/v2alpha1/tpu-gen.go @@ -1670,7 +1670,8 @@ type QueuedResourceState struct { State string `json:"state,omitempty"` // StateInitiator: Output only. The initiator of the QueuedResources's - // current state. + // current state. Used to indicate whether the SUSPENDING/SUSPENDED + // state was initiated by the user or the service. // // Possible values: // "STATE_INITIATOR_UNSPECIFIED" - The state initiator is unspecified.