#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SchedulingConfig {
#[prost(bool, tag = "1")]
pub preemptible: bool,
#[prost(bool, tag = "2")]
pub reserved: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct NetworkEndpoint {
#[prost(string, tag = "1")]
pub ip_address: ::prost::alloc::string::String,
#[prost(int32, tag = "2")]
pub port: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Node {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub description: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub accelerator_type: ::prost::alloc::string::String,
#[deprecated]
#[prost(string, tag = "8")]
pub ip_address: ::prost::alloc::string::String,
#[deprecated]
#[prost(string, tag = "14")]
pub port: ::prost::alloc::string::String,
#[prost(enumeration = "node::State", tag = "9")]
pub state: i32,
#[prost(string, tag = "10")]
pub health_description: ::prost::alloc::string::String,
#[prost(string, tag = "11")]
pub tensorflow_version: ::prost::alloc::string::String,
#[prost(string, tag = "12")]
pub network: ::prost::alloc::string::String,
#[prost(string, tag = "13")]
pub cidr_block: ::prost::alloc::string::String,
#[prost(string, tag = "15")]
pub service_account: ::prost::alloc::string::String,
#[prost(message, optional, tag = "16")]
pub create_time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, optional, tag = "17")]
pub scheduling_config: ::core::option::Option<SchedulingConfig>,
#[prost(message, repeated, tag = "21")]
pub network_endpoints: ::prost::alloc::vec::Vec<NetworkEndpoint>,
#[prost(enumeration = "node::Health", tag = "22")]
pub health: i32,
#[prost(map = "string, string", tag = "24")]
pub labels:
::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
#[prost(bool, tag = "27")]
pub use_service_networking: bool,
#[prost(enumeration = "node::ApiVersion", tag = "38")]
pub api_version: i32,
#[prost(message, repeated, tag = "39")]
pub symptoms: ::prost::alloc::vec::Vec<Symptom>,
}
pub mod node {
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum State {
Unspecified = 0,
Creating = 1,
Ready = 2,
Restarting = 3,
Reimaging = 4,
Deleting = 5,
Repairing = 6,
Stopped = 8,
Stopping = 9,
Starting = 10,
Preempted = 11,
Terminated = 12,
Hiding = 13,
Hidden = 14,
Unhiding = 15,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum Health {
Unspecified = 0,
Healthy = 1,
DeprecatedUnhealthy = 2,
Timeout = 3,
UnhealthyTensorflow = 4,
UnhealthyMaintenance = 5,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ApiVersion {
Unspecified = 0,
V1Alpha1 = 1,
V1 = 2,
V2Alpha1 = 3,
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListNodesRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(int32, tag = "2")]
pub page_size: i32,
#[prost(string, tag = "3")]
pub page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListNodesResponse {
#[prost(message, repeated, tag = "1")]
pub nodes: ::prost::alloc::vec::Vec<Node>,
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
#[prost(string, repeated, tag = "3")]
pub unreachable: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetNodeRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateNodeRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub node_id: ::prost::alloc::string::String,
#[prost(message, optional, tag = "3")]
pub node: ::core::option::Option<Node>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteNodeRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReimageNodeRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub tensorflow_version: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StopNodeRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StartNodeRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TensorFlowVersion {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub version: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetTensorFlowVersionRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListTensorFlowVersionsRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(int32, tag = "2")]
pub page_size: i32,
#[prost(string, tag = "3")]
pub page_token: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub filter: ::prost::alloc::string::String,
#[prost(string, tag = "6")]
pub order_by: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListTensorFlowVersionsResponse {
#[prost(message, repeated, tag = "1")]
pub tensorflow_versions: ::prost::alloc::vec::Vec<TensorFlowVersion>,
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
#[prost(string, repeated, tag = "3")]
pub unreachable: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AcceleratorType {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub r#type: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetAcceleratorTypeRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListAcceleratorTypesRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(int32, tag = "2")]
pub page_size: i32,
#[prost(string, tag = "3")]
pub page_token: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub filter: ::prost::alloc::string::String,
#[prost(string, tag = "6")]
pub order_by: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListAcceleratorTypesResponse {
#[prost(message, repeated, tag = "1")]
pub accelerator_types: ::prost::alloc::vec::Vec<AcceleratorType>,
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
#[prost(string, repeated, tag = "3")]
pub unreachable: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OperationMetadata {
#[prost(message, optional, tag = "1")]
pub create_time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, optional, tag = "2")]
pub end_time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(string, tag = "3")]
pub target: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub verb: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub status_detail: ::prost::alloc::string::String,
#[prost(bool, tag = "6")]
pub cancel_requested: bool,
#[prost(string, tag = "7")]
pub api_version: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Symptom {
#[prost(message, optional, tag = "1")]
pub create_time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(enumeration = "symptom::SymptomType", tag = "2")]
pub symptom_type: i32,
#[prost(string, tag = "3")]
pub details: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub worker_id: ::prost::alloc::string::String,
}
pub mod symptom {
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum SymptomType {
Unspecified = 0,
LowMemory = 1,
OutOfMemory = 2,
ExecuteTimedOut = 3,
MeshBuildFail = 4,
HbmOutOfMemory = 5,
ProjectAbuse = 6,
}
}
#[doc = r" Generated client implementations."]
pub mod tpu_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[doc = " Manages TPU nodes and other resources"]
#[doc = ""]
#[doc = " TPU API v1"]
#[derive(Debug, Clone)]
pub struct TpuClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> TpuClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::ResponseBody: Body + Send + 'static,
T::Error: Into<StdError>,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_interceptor<F>(inner: T, interceptor: F) -> TpuClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
Into<StdError> + Send + Sync,
{
TpuClient::new(InterceptedService::new(inner, interceptor))
}
#[doc = r" Compress requests with `gzip`."]
#[doc = r""]
#[doc = r" This requires the server to support it otherwise it might respond with an"]
#[doc = r" error."]
pub fn send_gzip(mut self) -> Self {
self.inner = self.inner.send_gzip();
self
}
#[doc = r" Enable decompressing responses with `gzip`."]
pub fn accept_gzip(mut self) -> Self {
self.inner = self.inner.accept_gzip();
self
}
#[doc = " Lists nodes."]
pub async fn list_nodes(
&mut self,
request: impl tonic::IntoRequest<super::ListNodesRequest>,
) -> Result<tonic::Response<super::ListNodesResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/google.cloud.tpu.v1.Tpu/ListNodes");
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Gets the details of a node."]
pub async fn get_node(
&mut self,
request: impl tonic::IntoRequest<super::GetNodeRequest>,
) -> Result<tonic::Response<super::Node>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/google.cloud.tpu.v1.Tpu/GetNode");
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Creates a node."]
pub async fn create_node(
&mut self,
request: impl tonic::IntoRequest<super::CreateNodeRequest>,
) -> Result<
tonic::Response<super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/google.cloud.tpu.v1.Tpu/CreateNode");
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Deletes a node."]
pub async fn delete_node(
&mut self,
request: impl tonic::IntoRequest<super::DeleteNodeRequest>,
) -> Result<
tonic::Response<super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/google.cloud.tpu.v1.Tpu/DeleteNode");
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Reimages a node's OS."]
pub async fn reimage_node(
&mut self,
request: impl tonic::IntoRequest<super::ReimageNodeRequest>,
) -> Result<
tonic::Response<super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/google.cloud.tpu.v1.Tpu/ReimageNode");
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Stops a node."]
pub async fn stop_node(
&mut self,
request: impl tonic::IntoRequest<super::StopNodeRequest>,
) -> Result<
tonic::Response<super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/google.cloud.tpu.v1.Tpu/StopNode");
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Starts a node."]
pub async fn start_node(
&mut self,
request: impl tonic::IntoRequest<super::StartNodeRequest>,
) -> Result<
tonic::Response<super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/google.cloud.tpu.v1.Tpu/StartNode");
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " List TensorFlow versions supported by this API."]
pub async fn list_tensor_flow_versions(
&mut self,
request: impl tonic::IntoRequest<super::ListTensorFlowVersionsRequest>,
) -> Result<tonic::Response<super::ListTensorFlowVersionsResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.tpu.v1.Tpu/ListTensorFlowVersions",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Gets TensorFlow Version."]
pub async fn get_tensor_flow_version(
&mut self,
request: impl tonic::IntoRequest<super::GetTensorFlowVersionRequest>,
) -> Result<tonic::Response<super::TensorFlowVersion>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.tpu.v1.Tpu/GetTensorFlowVersion",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Lists accelerator types supported by this API."]
pub async fn list_accelerator_types(
&mut self,
request: impl tonic::IntoRequest<super::ListAcceleratorTypesRequest>,
) -> Result<tonic::Response<super::ListAcceleratorTypesResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.tpu.v1.Tpu/ListAcceleratorTypes",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Gets AcceleratorType."]
pub async fn get_accelerator_type(
&mut self,
request: impl tonic::IntoRequest<super::GetAcceleratorTypeRequest>,
) -> Result<tonic::Response<super::AcceleratorType>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path =
http::uri::PathAndQuery::from_static("/google.cloud.tpu.v1.Tpu/GetAcceleratorType");
self.inner.unary(request.into_request(), path, codec).await
}
}
}