| // 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 |
| // |
| // http://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. |
| |
| #![allow(clippy::all)] |
| // This file is @generated by prost-build. |
| /// |
| /// The number of operands is decided by the operator. |
| /// Nested LogicalOperation is allowed. |
| #[allow(clippy::derive_partial_eq_without_eq)] |
| #[derive(Clone, PartialEq, ::prost::Message)] |
| pub struct LogicalOperation { |
| #[prost(enumeration = "FiltOp", tag = "1")] |
| pub logical_operator: i32, |
| #[prost(message, repeated, tag = "2")] |
| pub operands: ::prost::alloc::vec::Vec<FiltExpr>, |
| } |
| #[allow(clippy::derive_partial_eq_without_eq)] |
| #[derive(Clone, PartialEq, ::prost::Message)] |
| pub struct Filters { |
| #[prost(message, repeated, tag = "1")] |
| pub expressions: ::prost::alloc::vec::Vec<FiltExpr>, |
| } |
| /// |
| /// The field is a Property in Redfish. In other data models, it is typically |
| /// a scalar value. An example Redfish filter expr is: |
| /// "SystemType=Physical&PowerState=On". |
| #[allow(clippy::derive_partial_eq_without_eq)] |
| #[derive(Clone, PartialEq, ::prost::Message)] |
| pub struct Comparison { |
| #[prost(string, tag = "1")] |
| pub field: ::prost::alloc::string::String, |
| #[prost(enumeration = "FiltOp", tag = "2")] |
| pub filter_operator: i32, |
| #[prost(string, tag = "3")] |
| pub value: ::prost::alloc::string::String, |
| } |
| #[allow(clippy::derive_partial_eq_without_eq)] |
| #[derive(Clone, PartialEq, ::prost::Message)] |
| pub struct FiltExpr { |
| #[prost(oneof = "filt_expr::Expr", tags = "1, 2")] |
| pub expr: ::core::option::Option<filt_expr::Expr>, |
| } |
| /// Nested message and enum types in `FiltExpr`. |
| pub mod filt_expr { |
| #[allow(clippy::derive_partial_eq_without_eq)] |
| #[derive(Clone, PartialEq, ::prost::Oneof)] |
| pub enum Expr { |
| #[prost(message, tag = "1")] |
| Comparison(super::Comparison), |
| #[prost(message, tag = "2")] |
| LogicalOperation(super::LogicalOperation), |
| } |
| } |
| /// |
| /// Fqp (Fully Qualified Path) is used for identifying a telemetry resource |
| /// (Redfish Resource, Yang Container or other similar metrics group). |
| /// |
| /// This Protobuf allows a generic path with placeholders in the Identifier |
| /// segments. The Identifiers are in the identifiers map. |
| /// For FQP_TYPE_NOT_SET, the FQP: /redfish/v1/Systems/izumi/Processors/0 can be |
| /// encoded as: |
| /// |
| /// specifier: "/redfish/v1/Systems/{SystemId}/Processors/{ProcessorId}" |
| /// identifiers: { |
| /// "SystemId": "izumi", |
| /// "ProcessorId": "0" |
| /// } |
| /// |
| /// Optional filters: |
| /// When a resource identifier is a wildcard '*', the requester can use filters |
| /// to select a subset from the target resource set. Filters are associated with |
| /// resource types. |
| /// |
| /// For FQP_TYPE_REDFISH_RESOURCE, the FQP is an odata.type and the identifier |
| /// contains verbosity as a well-known string |
| /// specifier: "#ProcessorMetrics.v1_6_4.ProcessorMetrics" |
| #[allow(clippy::derive_partial_eq_without_eq)] |
| #[derive(Clone, PartialEq, ::prost::Message)] |
| pub struct Fqp { |
| #[prost(string, tag = "1")] |
| pub specifier: ::prost::alloc::string::String, |
| #[prost(map = "string, string", tag = "2")] |
| pub identifiers: |
| ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>, |
| #[prost(map = "string, message", tag = "3")] |
| pub filters: ::std::collections::HashMap<::prost::alloc::string::String, Filters>, |
| #[prost(enumeration = "FqpType", tag = "4")] |
| pub r#type: i32, |
| } |
| /// |
| /// google.protobuf.Struct also uses google.protobuf.Value and hence does not |
| /// encode all scalar Protobuf types. TypedStruct is a more complete variant |
| /// defined here. |
| #[allow(clippy::derive_partial_eq_without_eq)] |
| #[derive(Clone, PartialEq, ::prost::Message)] |
| pub struct TypedStruct { |
| #[prost(map = "string, message", tag = "1")] |
| pub fields: ::std::collections::HashMap<::prost::alloc::string::String, TypedValue>, |
| } |
| #[allow(clippy::derive_partial_eq_without_eq)] |
| #[derive(Clone, PartialEq, ::prost::Message)] |
| pub struct TypedValue { |
| #[prost(oneof = "typed_value::Value", tags = "1, 2, 3, 4, 5, 6, 7")] |
| pub value: ::core::option::Option<typed_value::Value>, |
| } |
| /// Nested message and enum types in `TypedValue`. |
| pub mod typed_value { |
| #[allow(clippy::derive_partial_eq_without_eq)] |
| #[derive(Clone, PartialEq, ::prost::Oneof)] |
| pub enum Value { |
| #[prost(bool, tag = "1")] |
| BoolVal(bool), |
| #[prost(int64, tag = "2")] |
| IntVal(i64), |
| #[prost(uint64, tag = "3")] |
| UintVal(u64), |
| #[prost(double, tag = "4")] |
| DoubleVal(f64), |
| #[prost(string, tag = "5")] |
| StringVal(::prost::alloc::string::String), |
| #[prost(bytes, tag = "6")] |
| BytesVal(::prost::alloc::vec::Vec<u8>), |
| #[prost(message, tag = "7")] |
| StructVal(super::TypedStruct), |
| } |
| } |
| /// |
| /// This Protobuf encodes a single instance of a Datapoint. A datapoint is one |
| /// instance of a datum/related data (e.g., sensor values) sourced/sampled |
| /// together. Related data must resolve to the same timestamp at the source; any |
| /// variance must be within the sourcing system's timestamp precision. |
| /// timestamp: always overrides Update.timestamp if present. |
| /// res_fqp: is always the Resolved FQP. |
| #[allow(clippy::derive_partial_eq_without_eq)] |
| #[derive(Clone, PartialEq, ::prost::Message)] |
| pub struct DataPoint { |
| #[prost(message, optional, tag = "1")] |
| pub res_fqp: ::core::option::Option<Fqp>, |
| /// Nanoseconds since Unix epoch |
| #[prost(uint64, tag = "2")] |
| pub timestamp_ns: u64, |
| #[prost(oneof = "data_point::Data", tags = "3, 4, 5")] |
| pub data: ::core::option::Option<data_point::Data>, |
| } |
| /// Nested message and enum types in `DataPoint`. |
| pub mod data_point { |
| #[allow(clippy::derive_partial_eq_without_eq)] |
| #[derive(Clone, PartialEq, ::prost::Oneof)] |
| pub enum Data { |
| #[prost(message, tag = "3")] |
| KeyValue(super::TypedStruct), |
| #[prost(message, tag = "4")] |
| Native(::prost_types::Any), |
| #[prost(string, tag = "5")] |
| Json(::prost::alloc::string::String), |
| } |
| } |
| /// |
| /// Telemetry response is encapsulated in an Update message. |
| /// req_id: Request.req_id - reflected back in the Update message as context |
| /// to the client. |
| /// epoch_ns: Typically the boot timestamp (since Unix epoch typically) of the |
| /// producer. Usage: when data across different Updates need to be |
| /// correlated, but keys for the same entity can change, correlations |
| /// can be scoped to the same epoch. |
| #[allow(clippy::derive_partial_eq_without_eq)] |
| #[derive(Clone, PartialEq, ::prost::Message)] |
| pub struct Update { |
| /// Nanoseconds since Unix epoch |
| #[prost(uint64, tag = "1")] |
| pub timestamp_ns: u64, |
| #[prost(uint64, tag = "8")] |
| pub epoch_ns: u64, |
| /// Unused in Set RPCs |
| #[prost(message, optional, tag = "2")] |
| pub req_fqp: ::core::option::Option<Fqp>, |
| #[prost(string, tag = "3")] |
| pub req_id: ::prost::alloc::string::String, |
| /// Useful when going through proxies |
| #[prost(string, tag = "4")] |
| pub hostname: ::prost::alloc::string::String, |
| #[prost(map = "string, string", tag = "5")] |
| pub http_headers: |
| ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>, |
| /// Typically HTTP return code |
| #[prost(uint32, tag = "6")] |
| pub code: u32, |
| /// Contains telemetry data for Get, Subscribe RPCs, response data for Set |
| /// RPCs |
| #[prost(message, repeated, tag = "7")] |
| pub data_points: ::prost::alloc::vec::Vec<DataPoint>, |
| } |
| /// |
| /// Thresholds is a config for one Fqp. |
| /// It contains an array of Threshold for different sampling and exporting |
| /// rate. The array forms a logically consecutive threshold group, with array |
| /// index used to address an individual Threshold. The active Threshold can |
| /// change dynamically to its adjacent Threshold node, based on metric values |
| /// crossing its cross_below_value or cross_above_value. |
| #[allow(clippy::derive_partial_eq_without_eq)] |
| #[derive(Clone, PartialEq, ::prost::Message)] |
| pub struct Thresholds { |
| #[prost(message, repeated, tag = "1")] |
| pub threshold: ::prost::alloc::vec::Vec<Threshold>, |
| } |
| /// |
| /// Threshold represents a single configuration level within a Thresholds group. |
| /// |
| /// index: the index of this Threshold in the container Thresholds array. |
| /// |
| /// sample_frequency_expect_ns, sample_frequency_max_ns and export_frequency_ns |
| /// follow same definition in RequestFqp. |
| /// |
| /// cross_above_value: upper threshold for metric value. If crossed, the next |
| /// Threshold (index + 1) becomes active. |
| /// cross_below_value: lower threshold for metric value. If crossed, the previous |
| /// Threshold (index - 1) becomes active. |
| /// |
| /// name: the name of this Threshold, can be used by the same fields in RequestFqp |
| /// to select one Threshold from Thresholds array. |
| #[allow(clippy::derive_partial_eq_without_eq)] |
| #[derive(Clone, PartialEq, ::prost::Message)] |
| pub struct Threshold { |
| #[prost(uint32, tag = "1")] |
| pub index: u32, |
| #[prost(uint64, tag = "2")] |
| pub sample_frequency_expect_ns: u64, |
| #[prost(uint64, tag = "3")] |
| pub sample_frequency_max_ns: u64, |
| #[prost(uint64, tag = "4")] |
| pub export_frequency_ns: u64, |
| #[prost(message, optional, tag = "5")] |
| pub cross_above_value: ::core::option::Option<TypedValue>, |
| #[prost(message, optional, tag = "6")] |
| pub cross_below_value: ::core::option::Option<TypedValue>, |
| #[prost(string, tag = "7")] |
| pub name: ::prost::alloc::string::String, |
| } |
| /// |
| /// Technically frequencies in this proto are periods between samples or (batch) |
| /// exports. |
| /// sample_frequency_ vs. export_frequency_: when RequestFqp is used in Subscribe |
| /// RPCs, separating the sampling frequency from the export frequency allows for |
| /// message batching efficiencies while retaining sampling resolution. |
| /// export_frequency_ns is ignored for other RPCs. |
| /// |
| /// If the following conditions are not met, a subscription is treated as an |
| /// error: |
| /// sample_frequency_max_ns > sample_frequency_expect_ns |
| /// (sample_frequency_max_ns == sample_frequency_expect_ns is treated as if |
| /// sample_frequency_max_is not present) |
| /// export_frequency_ns > sample_frequency_expect_ns or sample_frequency_max_ns, |
| /// whichever is greater) |
| /// (export_frequency_ns == sample_frequency_expect_ns or sample_frequency_max_ns |
| /// is treated as if export_frequency_ns is not present) |
| /// |
| /// When the export_frequency_ns window expires, the producer packs and sends all |
| /// the collected samples and resets its samples buffer. |
| /// |
| /// sample_frequency_max_ns, sample_frequency_expect_ns, export_frequency_ns will |
| /// be ignored in SAMPLING_MODE_ON_CHANGE, server will try to send an Update |
| /// immediately when event happens. |
| /// |
| /// variant_fields_only: when true, the server sends only the fields that change |
| /// (sensors values, statistic counters, ...) associated with the Fqp. Otherwise, |
| /// all fields including the ones deemed invariant (sensor units in a Redfish |
| /// Resource for e.g.) are also included. |
| /// |
| /// threshold_policy: RequestFqp can also be used in server-side configuration. |
| /// In this case, either thresholds or threshold_config can be set. In a dynamic |
| /// subscription (where the Request message contains RequestFqp's), only |
| /// thresholds are legal. The configuration construct of threshold_config must |
| /// not be mixed with dynamic subscriptions. |
| /// |
| /// RequestFqp can be used in both config-based and inband (a.k.a. dynamic) |
| /// subscriptions. In the config-based subscription mode, a set of RequestFqp's |
| /// are grouped together in a named config group on the server. A config group |
| /// could be "repairability_basic" or "high_rate_thermal_sensors" or |
| /// "medium_rate_system_metrics" or equivalent useful groupings. The subscriber |
| /// passes the config group name in Request.req_config_group. Multiple such |
| /// config groups can exist on the server. Each config group needs a separate |
| /// subscription request. RequestFqp.req_fqp_name is used defined named |
| /// RequestFqp's for the server state management. In the dynamic subscription |
| /// mode, the subscriber sends the fully defined set of RequestFqp's in the |
| /// Request message. RequestFqp.req_fqp_name is optional in this mode (the |
| /// server may internally assign names if necessary in its implementation). |
| #[allow(clippy::derive_partial_eq_without_eq)] |
| #[derive(Clone, PartialEq, ::prost::Message)] |
| pub struct RequestFqp { |
| #[prost(message, optional, tag = "1")] |
| pub fqp: ::core::option::Option<Fqp>, |
| #[prost(enumeration = "FqpPriority", tag = "2")] |
| pub priority: i32, |
| #[prost(enumeration = "SamplingMode", tag = "3")] |
| pub mode: i32, |
| #[prost(enumeration = "Encoding", tag = "4")] |
| pub encoding: i32, |
| #[prost(uint64, tag = "5")] |
| pub sample_frequency_expect_ns: u64, |
| #[prost(uint64, tag = "6")] |
| pub sample_frequency_max_ns: u64, |
| #[prost(uint64, tag = "7")] |
| pub export_frequency_ns: u64, |
| #[prost(bool, tag = "8")] |
| pub suppress_redundant: bool, |
| #[prost(bool, tag = "9")] |
| pub variant_fields_only: bool, |
| #[prost(string, tag = "12")] |
| pub req_fqp_name: ::prost::alloc::string::String, |
| #[prost(oneof = "request_fqp::Config", tags = "10, 11")] |
| pub config: ::core::option::Option<request_fqp::Config>, |
| } |
| /// Nested message and enum types in `RequestFqp`. |
| pub mod request_fqp { |
| #[allow(clippy::derive_partial_eq_without_eq)] |
| #[derive(Clone, PartialEq, ::prost::Oneof)] |
| pub enum Config { |
| #[prost(message, tag = "10")] |
| Thresholds(super::Thresholds), |
| #[prost(string, tag = "11")] |
| ThresholdConfig(::prost::alloc::string::String), |
| } |
| } |
| /// |
| /// - req_id can be used as context by the client and is reflected back in the |
| /// Update message. |
| /// - Only one of req_fqp or req_config_group can be present. If both are |
| /// present, req_config_group takes precedence. |
| /// - If req_config_group is present (non-NULL), the telemetry server looks up |
| /// the req_fqp list on req_fqp_name from locally available state that is |
| /// populated via other out-of-band methods (e.g., a configuration file), the |
| /// out-of-band methods will provide equivalent result as passing the |
| /// parameters over req_fqp, the inband method. |
| /// - hostname_fqdn - is useful when requests are proxied, and for debugging. |
| #[allow(clippy::derive_partial_eq_without_eq)] |
| #[derive(Clone, PartialEq, ::prost::Message)] |
| pub struct Request { |
| #[prost(string, tag = "1")] |
| pub req_id: ::prost::alloc::string::String, |
| #[prost(string, tag = "2")] |
| pub req_config_group: ::prost::alloc::string::String, |
| #[prost(message, repeated, tag = "3")] |
| pub req_fqp: ::prost::alloc::vec::Vec<RequestFqp>, |
| /// DSCP treatment for the subscription response messages |
| #[prost(uint32, tag = "4")] |
| pub req_qos: u32, |
| #[prost(map = "string, string", tag = "5")] |
| pub http_headers: |
| ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>, |
| #[prost(string, tag = "6")] |
| pub hostname_fqdn: ::prost::alloc::string::String, |
| } |
| /// |
| /// req_data is the HTTP request body, typically in req_data.json. |
| /// Only one instance of req_fqp is accepted if req_data is present. Typically, |
| /// multiple instances of req_fqp can be used for Delete() RPCs. |
| /// |
| /// No QoS to avoid out-of-order processing possibilities. |
| /// |
| /// hostname_fqdn - is useful when requests are proxied, and for debugging. |
| #[allow(clippy::derive_partial_eq_without_eq)] |
| #[derive(Clone, PartialEq, ::prost::Message)] |
| pub struct SetRequest { |
| #[prost(string, tag = "1")] |
| pub req_id: ::prost::alloc::string::String, |
| #[prost(message, repeated, tag = "2")] |
| pub req_fqp: ::prost::alloc::vec::Vec<RequestFqp>, |
| #[prost(map = "string, string", tag = "5")] |
| pub http_headers: |
| ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>, |
| #[prost(string, tag = "7")] |
| pub hostname_fqdn: ::prost::alloc::string::String, |
| #[prost(oneof = "set_request::ReqData", tags = "3, 4, 6")] |
| pub req_data: ::core::option::Option<set_request::ReqData>, |
| } |
| /// Nested message and enum types in `SetRequest`. |
| pub mod set_request { |
| #[allow(clippy::derive_partial_eq_without_eq)] |
| #[derive(Clone, PartialEq, ::prost::Oneof)] |
| pub enum ReqData { |
| #[prost(message, tag = "3")] |
| KeyValue(super::TypedStruct), |
| #[prost(string, tag = "4")] |
| Json(::prost::alloc::string::String), |
| #[prost(message, tag = "6")] |
| Native(::prost_types::Any), |
| } |
| } |
| #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] |
| #[repr(i32)] |
| pub enum FqpType { |
| /// When the type is not specified, the rest of the Fqp message is sufficient |
| /// to identify a resource uniquely |
| NotSet = 0, |
| /// When Fqp is this type, then Fqp.specifier represents an odata.type, which |
| /// can be used to select all telemetry sources of this type. |
| RedfishResource = 1, |
| } |
| impl FqpType { |
| /// String value of the enum field names used in the ProtoBuf definition. |
| /// |
| /// The values are not transformed in any way and thus are considered stable |
| /// (if the ProtoBuf definition does not change) and safe for programmatic use. |
| pub fn as_str_name(&self) -> &'static str { |
| match self { |
| FqpType::NotSet => "FQP_TYPE_NOT_SET", |
| FqpType::RedfishResource => "FQP_TYPE_REDFISH_RESOURCE", |
| } |
| } |
| /// Creates an enum from field names used in the ProtoBuf definition. |
| pub fn from_str_name(value: &str) -> ::core::option::Option<Self> { |
| match value { |
| "FQP_TYPE_NOT_SET" => Some(Self::NotSet), |
| "FQP_TYPE_REDFISH_RESOURCE" => Some(Self::RedfishResource), |
| _ => None, |
| } |
| } |
| } |
| #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] |
| #[repr(i32)] |
| pub enum FiltOp { |
| OperatorUnsupported = 0, |
| OperatorEqual = 1, |
| OperatorLessThan = 2, |
| OperatorGreaterThan = 3, |
| OperatorAnd = 4, |
| OperatorOr = 5, |
| OperatorNot = 6, |
| } |
| impl FiltOp { |
| /// String value of the enum field names used in the ProtoBuf definition. |
| /// |
| /// The values are not transformed in any way and thus are considered stable |
| /// (if the ProtoBuf definition does not change) and safe for programmatic use. |
| pub fn as_str_name(&self) -> &'static str { |
| match self { |
| FiltOp::OperatorUnsupported => "OPERATOR_UNSUPPORTED", |
| FiltOp::OperatorEqual => "OPERATOR_EQUAL", |
| FiltOp::OperatorLessThan => "OPERATOR_LESS_THAN", |
| FiltOp::OperatorGreaterThan => "OPERATOR_GREATER_THAN", |
| FiltOp::OperatorAnd => "OPERATOR_AND", |
| FiltOp::OperatorOr => "OPERATOR_OR", |
| FiltOp::OperatorNot => "OPERATOR_NOT", |
| } |
| } |
| /// Creates an enum from field names used in the ProtoBuf definition. |
| pub fn from_str_name(value: &str) -> ::core::option::Option<Self> { |
| match value { |
| "OPERATOR_UNSUPPORTED" => Some(Self::OperatorUnsupported), |
| "OPERATOR_EQUAL" => Some(Self::OperatorEqual), |
| "OPERATOR_LESS_THAN" => Some(Self::OperatorLessThan), |
| "OPERATOR_GREATER_THAN" => Some(Self::OperatorGreaterThan), |
| "OPERATOR_AND" => Some(Self::OperatorAnd), |
| "OPERATOR_OR" => Some(Self::OperatorOr), |
| "OPERATOR_NOT" => Some(Self::OperatorNot), |
| _ => None, |
| } |
| } |
| } |
| #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] |
| #[repr(i32)] |
| pub enum SamplingMode { |
| Unspecified = 0, |
| /// == eventing |
| OnChange = 1, |
| Periodic = 2, |
| Threshold = 3, |
| /// Server will send the data set once and disconnect. |
| Once = 4, |
| } |
| impl SamplingMode { |
| /// String value of the enum field names used in the ProtoBuf definition. |
| /// |
| /// The values are not transformed in any way and thus are considered stable |
| /// (if the ProtoBuf definition does not change) and safe for programmatic use. |
| pub fn as_str_name(&self) -> &'static str { |
| match self { |
| SamplingMode::Unspecified => "SAMPLING_MODE_UNSPECIFIED", |
| SamplingMode::OnChange => "SAMPLING_MODE_ON_CHANGE", |
| SamplingMode::Periodic => "SAMPLING_MODE_PERIODIC", |
| SamplingMode::Threshold => "SAMPLING_MODE_THRESHOLD", |
| SamplingMode::Once => "SAMPLING_MODE_ONCE", |
| } |
| } |
| /// Creates an enum from field names used in the ProtoBuf definition. |
| pub fn from_str_name(value: &str) -> ::core::option::Option<Self> { |
| match value { |
| "SAMPLING_MODE_UNSPECIFIED" => Some(Self::Unspecified), |
| "SAMPLING_MODE_ON_CHANGE" => Some(Self::OnChange), |
| "SAMPLING_MODE_PERIODIC" => Some(Self::Periodic), |
| "SAMPLING_MODE_THRESHOLD" => Some(Self::Threshold), |
| "SAMPLING_MODE_ONCE" => Some(Self::Once), |
| _ => None, |
| } |
| } |
| } |
| #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] |
| #[repr(i32)] |
| pub enum Encoding { |
| Unspecified = 0, |
| Json = 1, |
| ProtoNative = 2, |
| ProtoKeyvalue = 3, |
| /// encode unstructured/opaque data |
| Bytes = 4, |
| /// encode unstructured strings |
| String = 5, |
| } |
| impl Encoding { |
| /// String value of the enum field names used in the ProtoBuf definition. |
| /// |
| /// The values are not transformed in any way and thus are considered stable |
| /// (if the ProtoBuf definition does not change) and safe for programmatic use. |
| pub fn as_str_name(&self) -> &'static str { |
| match self { |
| Encoding::Unspecified => "ENCODING_UNSPECIFIED", |
| Encoding::Json => "ENCODING_JSON", |
| Encoding::ProtoNative => "ENCODING_PROTO_NATIVE", |
| Encoding::ProtoKeyvalue => "ENCODING_PROTO_KEYVALUE", |
| Encoding::Bytes => "ENCODING_BYTES", |
| Encoding::String => "ENCODING_STRING", |
| } |
| } |
| /// Creates an enum from field names used in the ProtoBuf definition. |
| pub fn from_str_name(value: &str) -> ::core::option::Option<Self> { |
| match value { |
| "ENCODING_UNSPECIFIED" => Some(Self::Unspecified), |
| "ENCODING_JSON" => Some(Self::Json), |
| "ENCODING_PROTO_NATIVE" => Some(Self::ProtoNative), |
| "ENCODING_PROTO_KEYVALUE" => Some(Self::ProtoKeyvalue), |
| "ENCODING_BYTES" => Some(Self::Bytes), |
| "ENCODING_STRING" => Some(Self::String), |
| _ => None, |
| } |
| } |
| } |
| /// |
| /// Relative priorities for the producer per Fqp. Note that this is global across |
| /// all subscriptions |
| #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] |
| #[repr(i32)] |
| pub enum FqpPriority { |
| FqpPriUnspecified = 0, |
| FqpPriHig = 1, |
| FqpPriMed = 2, |
| FqpPriLow = 3, |
| } |
| impl FqpPriority { |
| /// String value of the enum field names used in the ProtoBuf definition. |
| /// |
| /// The values are not transformed in any way and thus are considered stable |
| /// (if the ProtoBuf definition does not change) and safe for programmatic use. |
| pub fn as_str_name(&self) -> &'static str { |
| match self { |
| FqpPriority::FqpPriUnspecified => "FQP_PRI_UNSPECIFIED", |
| FqpPriority::FqpPriHig => "FQP_PRI_HIG", |
| FqpPriority::FqpPriMed => "FQP_PRI_MED", |
| FqpPriority::FqpPriLow => "FQP_PRI_LOW", |
| } |
| } |
| /// Creates an enum from field names used in the ProtoBuf definition. |
| pub fn from_str_name(value: &str) -> ::core::option::Option<Self> { |
| match value { |
| "FQP_PRI_UNSPECIFIED" => Some(Self::FqpPriUnspecified), |
| "FQP_PRI_HIG" => Some(Self::FqpPriHig), |
| "FQP_PRI_MED" => Some(Self::FqpPriMed), |
| "FQP_PRI_LOW" => Some(Self::FqpPriLow), |
| _ => None, |
| } |
| } |
| } |
| /// Generated client implementations. |
| pub mod machine_telemetry_client { |
| #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] |
| use tonic::codegen::http::Uri; |
| use tonic::codegen::*; |
| #[derive(Debug, Clone)] |
| pub struct MachineTelemetryClient<T> { |
| inner: tonic::client::Grpc<T>, |
| } |
| impl MachineTelemetryClient<tonic::transport::Channel> { |
| /// Attempt to create a new client by connecting to a given endpoint. |
| pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error> |
| where |
| D: TryInto<tonic::transport::Endpoint>, |
| D::Error: Into<StdError>, |
| { |
| let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; |
| Ok(Self::new(conn)) |
| } |
| } |
| impl<T> MachineTelemetryClient<T> |
| where |
| T: tonic::client::GrpcService<tonic::body::BoxBody>, |
| T::Error: Into<StdError>, |
| T::ResponseBody: Body<Data = Bytes> + Send + 'static, |
| <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_origin(inner: T, origin: Uri) -> Self { |
| let inner = tonic::client::Grpc::with_origin(inner, origin); |
| Self { inner } |
| } |
| pub fn with_interceptor<F>( |
| inner: T, |
| interceptor: F, |
| ) -> MachineTelemetryClient<InterceptedService<T, F>> |
| where |
| F: tonic::service::Interceptor, |
| T::ResponseBody: Default, |
| 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, |
| { |
| MachineTelemetryClient::new(InterceptedService::new(inner, interceptor)) |
| } |
| /// Compress requests with the given encoding. |
| /// |
| /// This requires the server to support it otherwise it might respond with an |
| /// error. |
| #[must_use] |
| pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { |
| self.inner = self.inner.send_compressed(encoding); |
| self |
| } |
| /// Enable decompressing responses. |
| #[must_use] |
| pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { |
| self.inner = self.inner.accept_compressed(encoding); |
| self |
| } |
| /// Limits the maximum size of a decoded message. |
| /// |
| /// Default: `4MB` |
| #[must_use] |
| pub fn max_decoding_message_size(mut self, limit: usize) -> Self { |
| self.inner = self.inner.max_decoding_message_size(limit); |
| self |
| } |
| /// Limits the maximum size of an encoded message. |
| /// |
| /// Default: `usize::MAX` |
| #[must_use] |
| pub fn max_encoding_message_size(mut self, limit: usize) -> Self { |
| self.inner = self.inner.max_encoding_message_size(limit); |
| self |
| } |
| pub async fn subscribe( |
| &mut self, |
| request: impl tonic::IntoRequest<super::Request>, |
| ) -> std::result::Result< |
| tonic::Response<tonic::codec::Streaming<super::Update>>, |
| 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( |
| "/third_party_voyager.MachineTelemetry/Subscribe", |
| ); |
| let mut req = request.into_request(); |
| req.extensions_mut().insert(GrpcMethod::new( |
| "third_party_voyager.MachineTelemetry", |
| "Subscribe", |
| )); |
| self.inner.server_streaming(req, path, codec).await |
| } |
| pub async fn get( |
| &mut self, |
| request: impl tonic::IntoRequest<super::Request>, |
| ) -> std::result::Result<tonic::Response<super::Update>, 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("/third_party_voyager.MachineTelemetry/Get"); |
| let mut req = request.into_request(); |
| req.extensions_mut().insert(GrpcMethod::new( |
| "third_party_voyager.MachineTelemetry", |
| "Get", |
| )); |
| self.inner.unary(req, path, codec).await |
| } |
| pub async fn put( |
| &mut self, |
| request: impl tonic::IntoRequest<super::SetRequest>, |
| ) -> std::result::Result<tonic::Response<super::Update>, 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("/third_party_voyager.MachineTelemetry/Put"); |
| let mut req = request.into_request(); |
| req.extensions_mut().insert(GrpcMethod::new( |
| "third_party_voyager.MachineTelemetry", |
| "Put", |
| )); |
| self.inner.unary(req, path, codec).await |
| } |
| pub async fn post( |
| &mut self, |
| request: impl tonic::IntoRequest<super::SetRequest>, |
| ) -> std::result::Result<tonic::Response<super::Update>, 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("/third_party_voyager.MachineTelemetry/Post"); |
| let mut req = request.into_request(); |
| req.extensions_mut().insert(GrpcMethod::new( |
| "third_party_voyager.MachineTelemetry", |
| "Post", |
| )); |
| self.inner.unary(req, path, codec).await |
| } |
| pub async fn patch( |
| &mut self, |
| request: impl tonic::IntoRequest<super::SetRequest>, |
| ) -> std::result::Result<tonic::Response<super::Update>, 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("/third_party_voyager.MachineTelemetry/Patch"); |
| let mut req = request.into_request(); |
| req.extensions_mut().insert(GrpcMethod::new( |
| "third_party_voyager.MachineTelemetry", |
| "Patch", |
| )); |
| self.inner.unary(req, path, codec).await |
| } |
| pub async fn delete( |
| &mut self, |
| request: impl tonic::IntoRequest<super::SetRequest>, |
| ) -> std::result::Result<tonic::Response<super::Update>, 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( |
| "/third_party_voyager.MachineTelemetry/Delete", |
| ); |
| let mut req = request.into_request(); |
| req.extensions_mut().insert(GrpcMethod::new( |
| "third_party_voyager.MachineTelemetry", |
| "Delete", |
| )); |
| self.inner.unary(req, path, codec).await |
| } |
| pub async fn subscribe_v2( |
| &mut self, |
| request: impl tonic::IntoStreamingRequest<Message = super::Request>, |
| ) -> std::result::Result< |
| tonic::Response<tonic::codec::Streaming<super::Update>>, |
| 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( |
| "/third_party_voyager.MachineTelemetry/SubscribeV2", |
| ); |
| let mut req = request.into_streaming_request(); |
| req.extensions_mut().insert(GrpcMethod::new( |
| "third_party_voyager.MachineTelemetry", |
| "SubscribeV2", |
| )); |
| self.inner.streaming(req, path, codec).await |
| } |
| } |
| } |
| /// Generated server implementations. |
| pub mod machine_telemetry_server { |
| #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] |
| use tonic::codegen::*; |
| /// Generated trait containing gRPC methods that should be implemented for use with MachineTelemetryServer. |
| #[async_trait] |
| pub trait MachineTelemetry: Send + Sync + 'static { |
| /// Server streaming response type for the Subscribe method. |
| type SubscribeStream: tonic::codegen::tokio_stream::Stream< |
| Item = std::result::Result<super::Update, tonic::Status>, |
| > + Send |
| + 'static; |
| async fn subscribe( |
| &self, |
| request: tonic::Request<super::Request>, |
| ) -> std::result::Result<tonic::Response<Self::SubscribeStream>, tonic::Status>; |
| async fn get( |
| &self, |
| request: tonic::Request<super::Request>, |
| ) -> std::result::Result<tonic::Response<super::Update>, tonic::Status>; |
| async fn put( |
| &self, |
| request: tonic::Request<super::SetRequest>, |
| ) -> std::result::Result<tonic::Response<super::Update>, tonic::Status>; |
| async fn post( |
| &self, |
| request: tonic::Request<super::SetRequest>, |
| ) -> std::result::Result<tonic::Response<super::Update>, tonic::Status>; |
| async fn patch( |
| &self, |
| request: tonic::Request<super::SetRequest>, |
| ) -> std::result::Result<tonic::Response<super::Update>, tonic::Status>; |
| async fn delete( |
| &self, |
| request: tonic::Request<super::SetRequest>, |
| ) -> std::result::Result<tonic::Response<super::Update>, tonic::Status>; |
| /// Server streaming response type for the SubscribeV2 method. |
| type SubscribeV2Stream: tonic::codegen::tokio_stream::Stream< |
| Item = std::result::Result<super::Update, tonic::Status>, |
| > + Send |
| + 'static; |
| async fn subscribe_v2( |
| &self, |
| request: tonic::Request<tonic::Streaming<super::Request>>, |
| ) -> std::result::Result<tonic::Response<Self::SubscribeV2Stream>, tonic::Status>; |
| } |
| #[derive(Debug)] |
| pub struct MachineTelemetryServer<T: MachineTelemetry> { |
| inner: _Inner<T>, |
| accept_compression_encodings: EnabledCompressionEncodings, |
| send_compression_encodings: EnabledCompressionEncodings, |
| max_decoding_message_size: Option<usize>, |
| max_encoding_message_size: Option<usize>, |
| } |
| struct _Inner<T>(Arc<T>); |
| impl<T: MachineTelemetry> MachineTelemetryServer<T> { |
| pub fn new(inner: T) -> Self { |
| Self::from_arc(Arc::new(inner)) |
| } |
| pub fn from_arc(inner: Arc<T>) -> Self { |
| let inner = _Inner(inner); |
| Self { |
| inner, |
| accept_compression_encodings: Default::default(), |
| send_compression_encodings: Default::default(), |
| max_decoding_message_size: None, |
| max_encoding_message_size: None, |
| } |
| } |
| pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F> |
| where |
| F: tonic::service::Interceptor, |
| { |
| InterceptedService::new(Self::new(inner), interceptor) |
| } |
| /// Enable decompressing requests with the given encoding. |
| #[must_use] |
| pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { |
| self.accept_compression_encodings.enable(encoding); |
| self |
| } |
| /// Compress responses with the given encoding, if the client supports it. |
| #[must_use] |
| pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { |
| self.send_compression_encodings.enable(encoding); |
| self |
| } |
| /// Limits the maximum size of a decoded message. |
| /// |
| /// Default: `4MB` |
| #[must_use] |
| pub fn max_decoding_message_size(mut self, limit: usize) -> Self { |
| self.max_decoding_message_size = Some(limit); |
| self |
| } |
| /// Limits the maximum size of an encoded message. |
| /// |
| /// Default: `usize::MAX` |
| #[must_use] |
| pub fn max_encoding_message_size(mut self, limit: usize) -> Self { |
| self.max_encoding_message_size = Some(limit); |
| self |
| } |
| } |
| impl<T, B> tonic::codegen::Service<http::Request<B>> for MachineTelemetryServer<T> |
| where |
| T: MachineTelemetry, |
| B: Body + Send + 'static, |
| B::Error: Into<StdError> + Send + 'static, |
| { |
| type Response = http::Response<tonic::body::BoxBody>; |
| type Error = std::convert::Infallible; |
| type Future = BoxFuture<Self::Response, Self::Error>; |
| fn poll_ready( |
| &mut self, |
| _cx: &mut Context<'_>, |
| ) -> Poll<std::result::Result<(), Self::Error>> { |
| Poll::Ready(Ok(())) |
| } |
| fn call(&mut self, req: http::Request<B>) -> Self::Future { |
| let inner = self.inner.clone(); |
| match req.uri().path() { |
| "/third_party_voyager.MachineTelemetry/Subscribe" => { |
| #[allow(non_camel_case_types)] |
| struct SubscribeSvc<T: MachineTelemetry>(pub Arc<T>); |
| impl<T: MachineTelemetry> tonic::server::ServerStreamingService<super::Request> |
| for SubscribeSvc<T> |
| { |
| type Response = super::Update; |
| type ResponseStream = T::SubscribeStream; |
| type Future = |
| BoxFuture<tonic::Response<Self::ResponseStream>, tonic::Status>; |
| fn call( |
| &mut self, |
| request: tonic::Request<super::Request>, |
| ) -> Self::Future { |
| let inner = Arc::clone(&self.0); |
| let fut = async move { |
| <T as MachineTelemetry>::subscribe(&inner, request).await |
| }; |
| Box::pin(fut) |
| } |
| } |
| let accept_compression_encodings = self.accept_compression_encodings; |
| let send_compression_encodings = self.send_compression_encodings; |
| let max_decoding_message_size = self.max_decoding_message_size; |
| let max_encoding_message_size = self.max_encoding_message_size; |
| let inner = self.inner.clone(); |
| let fut = async move { |
| let inner = inner.0; |
| let method = SubscribeSvc(inner); |
| let codec = tonic::codec::ProstCodec::default(); |
| let mut grpc = tonic::server::Grpc::new(codec) |
| .apply_compression_config( |
| accept_compression_encodings, |
| send_compression_encodings, |
| ) |
| .apply_max_message_size_config( |
| max_decoding_message_size, |
| max_encoding_message_size, |
| ); |
| let res = grpc.server_streaming(method, req).await; |
| Ok(res) |
| }; |
| Box::pin(fut) |
| } |
| "/third_party_voyager.MachineTelemetry/Get" => { |
| #[allow(non_camel_case_types)] |
| struct GetSvc<T: MachineTelemetry>(pub Arc<T>); |
| impl<T: MachineTelemetry> tonic::server::UnaryService<super::Request> for GetSvc<T> { |
| type Response = super::Update; |
| type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>; |
| fn call( |
| &mut self, |
| request: tonic::Request<super::Request>, |
| ) -> Self::Future { |
| let inner = Arc::clone(&self.0); |
| let fut = |
| async move { <T as MachineTelemetry>::get(&inner, request).await }; |
| Box::pin(fut) |
| } |
| } |
| let accept_compression_encodings = self.accept_compression_encodings; |
| let send_compression_encodings = self.send_compression_encodings; |
| let max_decoding_message_size = self.max_decoding_message_size; |
| let max_encoding_message_size = self.max_encoding_message_size; |
| let inner = self.inner.clone(); |
| let fut = async move { |
| let inner = inner.0; |
| let method = GetSvc(inner); |
| let codec = tonic::codec::ProstCodec::default(); |
| let mut grpc = tonic::server::Grpc::new(codec) |
| .apply_compression_config( |
| accept_compression_encodings, |
| send_compression_encodings, |
| ) |
| .apply_max_message_size_config( |
| max_decoding_message_size, |
| max_encoding_message_size, |
| ); |
| let res = grpc.unary(method, req).await; |
| Ok(res) |
| }; |
| Box::pin(fut) |
| } |
| "/third_party_voyager.MachineTelemetry/Put" => { |
| #[allow(non_camel_case_types)] |
| struct PutSvc<T: MachineTelemetry>(pub Arc<T>); |
| impl<T: MachineTelemetry> tonic::server::UnaryService<super::SetRequest> for PutSvc<T> { |
| type Response = super::Update; |
| type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>; |
| fn call( |
| &mut self, |
| request: tonic::Request<super::SetRequest>, |
| ) -> Self::Future { |
| let inner = Arc::clone(&self.0); |
| let fut = |
| async move { <T as MachineTelemetry>::put(&inner, request).await }; |
| Box::pin(fut) |
| } |
| } |
| let accept_compression_encodings = self.accept_compression_encodings; |
| let send_compression_encodings = self.send_compression_encodings; |
| let max_decoding_message_size = self.max_decoding_message_size; |
| let max_encoding_message_size = self.max_encoding_message_size; |
| let inner = self.inner.clone(); |
| let fut = async move { |
| let inner = inner.0; |
| let method = PutSvc(inner); |
| let codec = tonic::codec::ProstCodec::default(); |
| let mut grpc = tonic::server::Grpc::new(codec) |
| .apply_compression_config( |
| accept_compression_encodings, |
| send_compression_encodings, |
| ) |
| .apply_max_message_size_config( |
| max_decoding_message_size, |
| max_encoding_message_size, |
| ); |
| let res = grpc.unary(method, req).await; |
| Ok(res) |
| }; |
| Box::pin(fut) |
| } |
| "/third_party_voyager.MachineTelemetry/Post" => { |
| #[allow(non_camel_case_types)] |
| struct PostSvc<T: MachineTelemetry>(pub Arc<T>); |
| impl<T: MachineTelemetry> tonic::server::UnaryService<super::SetRequest> for PostSvc<T> { |
| type Response = super::Update; |
| type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>; |
| fn call( |
| &mut self, |
| request: tonic::Request<super::SetRequest>, |
| ) -> Self::Future { |
| let inner = Arc::clone(&self.0); |
| let fut = |
| async move { <T as MachineTelemetry>::post(&inner, request).await }; |
| Box::pin(fut) |
| } |
| } |
| let accept_compression_encodings = self.accept_compression_encodings; |
| let send_compression_encodings = self.send_compression_encodings; |
| let max_decoding_message_size = self.max_decoding_message_size; |
| let max_encoding_message_size = self.max_encoding_message_size; |
| let inner = self.inner.clone(); |
| let fut = async move { |
| let inner = inner.0; |
| let method = PostSvc(inner); |
| let codec = tonic::codec::ProstCodec::default(); |
| let mut grpc = tonic::server::Grpc::new(codec) |
| .apply_compression_config( |
| accept_compression_encodings, |
| send_compression_encodings, |
| ) |
| .apply_max_message_size_config( |
| max_decoding_message_size, |
| max_encoding_message_size, |
| ); |
| let res = grpc.unary(method, req).await; |
| Ok(res) |
| }; |
| Box::pin(fut) |
| } |
| "/third_party_voyager.MachineTelemetry/Patch" => { |
| #[allow(non_camel_case_types)] |
| struct PatchSvc<T: MachineTelemetry>(pub Arc<T>); |
| impl<T: MachineTelemetry> tonic::server::UnaryService<super::SetRequest> for PatchSvc<T> { |
| type Response = super::Update; |
| type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>; |
| fn call( |
| &mut self, |
| request: tonic::Request<super::SetRequest>, |
| ) -> Self::Future { |
| let inner = Arc::clone(&self.0); |
| let fut = async move { |
| <T as MachineTelemetry>::patch(&inner, request).await |
| }; |
| Box::pin(fut) |
| } |
| } |
| let accept_compression_encodings = self.accept_compression_encodings; |
| let send_compression_encodings = self.send_compression_encodings; |
| let max_decoding_message_size = self.max_decoding_message_size; |
| let max_encoding_message_size = self.max_encoding_message_size; |
| let inner = self.inner.clone(); |
| let fut = async move { |
| let inner = inner.0; |
| let method = PatchSvc(inner); |
| let codec = tonic::codec::ProstCodec::default(); |
| let mut grpc = tonic::server::Grpc::new(codec) |
| .apply_compression_config( |
| accept_compression_encodings, |
| send_compression_encodings, |
| ) |
| .apply_max_message_size_config( |
| max_decoding_message_size, |
| max_encoding_message_size, |
| ); |
| let res = grpc.unary(method, req).await; |
| Ok(res) |
| }; |
| Box::pin(fut) |
| } |
| "/third_party_voyager.MachineTelemetry/Delete" => { |
| #[allow(non_camel_case_types)] |
| struct DeleteSvc<T: MachineTelemetry>(pub Arc<T>); |
| impl<T: MachineTelemetry> tonic::server::UnaryService<super::SetRequest> for DeleteSvc<T> { |
| type Response = super::Update; |
| type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>; |
| fn call( |
| &mut self, |
| request: tonic::Request<super::SetRequest>, |
| ) -> Self::Future { |
| let inner = Arc::clone(&self.0); |
| let fut = async move { |
| <T as MachineTelemetry>::delete(&inner, request).await |
| }; |
| Box::pin(fut) |
| } |
| } |
| let accept_compression_encodings = self.accept_compression_encodings; |
| let send_compression_encodings = self.send_compression_encodings; |
| let max_decoding_message_size = self.max_decoding_message_size; |
| let max_encoding_message_size = self.max_encoding_message_size; |
| let inner = self.inner.clone(); |
| let fut = async move { |
| let inner = inner.0; |
| let method = DeleteSvc(inner); |
| let codec = tonic::codec::ProstCodec::default(); |
| let mut grpc = tonic::server::Grpc::new(codec) |
| .apply_compression_config( |
| accept_compression_encodings, |
| send_compression_encodings, |
| ) |
| .apply_max_message_size_config( |
| max_decoding_message_size, |
| max_encoding_message_size, |
| ); |
| let res = grpc.unary(method, req).await; |
| Ok(res) |
| }; |
| Box::pin(fut) |
| } |
| "/third_party_voyager.MachineTelemetry/SubscribeV2" => { |
| #[allow(non_camel_case_types)] |
| struct SubscribeV2Svc<T: MachineTelemetry>(pub Arc<T>); |
| impl<T: MachineTelemetry> tonic::server::StreamingService<super::Request> for SubscribeV2Svc<T> { |
| type Response = super::Update; |
| type ResponseStream = T::SubscribeV2Stream; |
| type Future = |
| BoxFuture<tonic::Response<Self::ResponseStream>, tonic::Status>; |
| fn call( |
| &mut self, |
| request: tonic::Request<tonic::Streaming<super::Request>>, |
| ) -> Self::Future { |
| let inner = Arc::clone(&self.0); |
| let fut = async move { |
| <T as MachineTelemetry>::subscribe_v2(&inner, request).await |
| }; |
| Box::pin(fut) |
| } |
| } |
| let accept_compression_encodings = self.accept_compression_encodings; |
| let send_compression_encodings = self.send_compression_encodings; |
| let max_decoding_message_size = self.max_decoding_message_size; |
| let max_encoding_message_size = self.max_encoding_message_size; |
| let inner = self.inner.clone(); |
| let fut = async move { |
| let inner = inner.0; |
| let method = SubscribeV2Svc(inner); |
| let codec = tonic::codec::ProstCodec::default(); |
| let mut grpc = tonic::server::Grpc::new(codec) |
| .apply_compression_config( |
| accept_compression_encodings, |
| send_compression_encodings, |
| ) |
| .apply_max_message_size_config( |
| max_decoding_message_size, |
| max_encoding_message_size, |
| ); |
| let res = grpc.streaming(method, req).await; |
| Ok(res) |
| }; |
| Box::pin(fut) |
| } |
| _ => Box::pin(async move { |
| Ok(http::Response::builder() |
| .status(200) |
| .header("grpc-status", "12") |
| .header("content-type", "application/grpc") |
| .body(empty_body()) |
| .unwrap()) |
| }), |
| } |
| } |
| } |
| impl<T: MachineTelemetry> Clone for MachineTelemetryServer<T> { |
| fn clone(&self) -> Self { |
| let inner = self.inner.clone(); |
| Self { |
| inner, |
| accept_compression_encodings: self.accept_compression_encodings, |
| send_compression_encodings: self.send_compression_encodings, |
| max_decoding_message_size: self.max_decoding_message_size, |
| max_encoding_message_size: self.max_encoding_message_size, |
| } |
| } |
| } |
| impl<T: MachineTelemetry> Clone for _Inner<T> { |
| fn clone(&self) -> Self { |
| Self(Arc::clone(&self.0)) |
| } |
| } |
| impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> { |
| fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
| write!(f, "{:?}", self.0) |
| } |
| } |
| impl<T: MachineTelemetry> tonic::server::NamedService for MachineTelemetryServer<T> { |
| const NAME: &'static str = "third_party_voyager.MachineTelemetry"; |
| } |
| } |
| #[allow(clippy::derive_partial_eq_without_eq)] |
| #[derive(Clone, PartialEq, ::prost::Message)] |
| pub struct ConfigGroup { |
| #[prost(string, repeated, tag = "1")] |
| pub req_fqp_names: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, |
| } |
| #[allow(clippy::derive_partial_eq_without_eq)] |
| #[derive(Clone, PartialEq, ::prost::Message)] |
| pub struct ReqFqpConfig { |
| #[prost(message, repeated, tag = "1")] |
| pub req_fqp: ::prost::alloc::vec::Vec<RequestFqp>, |
| } |
| /// ServerConfig is the root telemetry configuration container maintained on |
| /// the server. This is typically applied OOB as a configuration file. It can |
| /// also be applied as an idempotent "replace configuration" RPC that the server |
| /// accepts (not defined here).req_fqp |
| #[allow(clippy::derive_partial_eq_without_eq)] |
| #[derive(Clone, PartialEq, ::prost::Message)] |
| pub struct ServerConfig { |
| /// Top-level configuration groups, use a name like |
| /// "repairability_basic_cfg_group" to select a ConfigGroup, which may |
| /// contains a vector of names like "thermal_sensors", "mem_metrics", |
| /// "proc_metrics", "fan", "proc_info", "mem_info", each then can be used |
| /// to select a vector of event sources defined as RequestFqp, these |
| /// RequestFqp will have FqpType as FQP_TYPE_NOT_SET, so they have a full |
| /// Redfish odata.id to uniquely address an event source. |
| /// Each RequestFqp also has a threshold_config defined to select one |
| /// ThresholdConfig from its entry at ServerThresholdsConfig, as its initial |
| /// threshold_config. |
| #[prost(map = "string, message", tag = "1")] |
| pub cfg_groups: ::std::collections::HashMap<::prost::alloc::string::String, ConfigGroup>, |
| /// Second-level configurations, keys are names like "thermal_sensors", "fan" |
| /// "mem_metrics", etc. |
| #[prost(map = "string, message", tag = "2")] |
| pub req_fqp_configs: ::std::collections::HashMap<::prost::alloc::string::String, ReqFqpConfig>, |
| /// |
| /// threshold_config is a map from resource ID to its Thresholds config. |
| #[prost(map = "string, message", tag = "3")] |
| pub threshold_config: ::std::collections::HashMap<::prost::alloc::string::String, Thresholds>, |
| } |