yandex-cloud 2025.4.14

Generated gRPC clients for the Yandex Cloud API
Documentation
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Resource {
    /// The id if the resource.
    #[prost(string, tag = "1")]
    pub id: ::prost::alloc::string::String,
    /// The type of the resource, e.g. resource-manager.cloud, billing.account.
    #[prost(string, tag = "2")]
    pub r#type: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetQuotaLimitRequest {
    /// The resource for which the quota limit is being requested.
    #[prost(message, optional, tag = "1")]
    pub resource: ::core::option::Option<Resource>,
    /// The id of the quota to retrieve.
    #[prost(string, tag = "2")]
    pub quota_id: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListQuotaLimitsRequest {
    /// The resource for which quota limits are being listed.
    #[prost(message, optional, tag = "1")]
    pub resource: ::core::option::Option<Resource>,
    /// The service for which quota limits are being requested.
    #[prost(string, tag = "2")]
    pub service: ::prost::alloc::string::String,
    /// The maximum number of quota limits to return per response.
    #[prost(int64, tag = "3")]
    pub page_size: i64,
    /// Token to retrieve the next page of results. Omitted on the first request.
    #[prost(string, tag = "4")]
    pub page_token: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListQuotaLimitsResponse {
    /// The associated resource for these quota limits.
    #[prost(message, optional, tag = "1")]
    pub resource: ::core::option::Option<Resource>,
    /// List of quota limits for the specified resource and service.
    #[prost(message, repeated, tag = "2")]
    pub quota_limits: ::prost::alloc::vec::Vec<QuotaLimit>,
    /// Token to retrieve the next page of results.
    #[prost(string, tag = "3")]
    pub next_page_token: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListServicesRequest {
    /// The type of resources for which services are being requested.
    #[prost(string, tag = "1")]
    pub resource_type: ::prost::alloc::string::String,
    /// The maximum number of services to return per response.
    #[prost(int64, tag = "2")]
    pub page_size: i64,
    /// Token to retrieve the next page of results. Omitted on the first request.
    #[prost(string, tag = "3")]
    pub page_token: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListServicesResponse {
    /// List of services available for quota management.
    #[prost(message, repeated, tag = "1")]
    pub services: ::prost::alloc::vec::Vec<Service>,
    /// Token to retrieve the next page of results.
    #[prost(string, tag = "2")]
    pub next_page_token: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QuotaLimit {
    /// The unique id of the quota.
    #[prost(string, tag = "1")]
    pub quota_id: ::prost::alloc::string::String,
    /// The limit value set for this quota.
    #[prost(message, optional, tag = "2")]
    pub limit: ::core::option::Option<f64>,
    /// The current usage level of this quota.
    #[prost(message, optional, tag = "3")]
    pub usage: ::core::option::Option<f64>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Service {
    /// The unique id of the service.
    #[prost(string, tag = "1")]
    pub id: ::prost::alloc::string::String,
    /// The name of the service.
    #[prost(string, tag = "2")]
    pub name: ::prost::alloc::string::String,
}
/// Generated client implementations.
pub mod quota_limit_service_client {
    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
    use tonic::codegen::*;
    use tonic::codegen::http::Uri;
    /// A set of methods for managing quota limits.
    #[derive(Debug, Clone)]
    pub struct QuotaLimitServiceClient<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl QuotaLimitServiceClient<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> QuotaLimitServiceClient<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,
        ) -> QuotaLimitServiceClient<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,
        {
            QuotaLimitServiceClient::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
        }
        /// Returns the specified quota limit.
        pub async fn get(
            &mut self,
            request: impl tonic::IntoRequest<super::GetQuotaLimitRequest>,
        ) -> std::result::Result<tonic::Response<super::QuotaLimit>, 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(
                "/yandex.cloud.quotamanager.v1.QuotaLimitService/Get",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "yandex.cloud.quotamanager.v1.QuotaLimitService",
                        "Get",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        /// Retrieves the list of quota limits for a given service.
        pub async fn list(
            &mut self,
            request: impl tonic::IntoRequest<super::ListQuotaLimitsRequest>,
        ) -> std::result::Result<
            tonic::Response<super::ListQuotaLimitsResponse>,
            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(
                "/yandex.cloud.quotamanager.v1.QuotaLimitService/List",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "yandex.cloud.quotamanager.v1.QuotaLimitService",
                        "List",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        /// Retrieves the list of services available for quota management.
        pub async fn list_services(
            &mut self,
            request: impl tonic::IntoRequest<super::ListServicesRequest>,
        ) -> std::result::Result<
            tonic::Response<super::ListServicesResponse>,
            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(
                "/yandex.cloud.quotamanager.v1.QuotaLimitService/ListServices",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "yandex.cloud.quotamanager.v1.QuotaLimitService",
                        "ListServices",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
    }
}