#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Setting {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(message, optional, tag = "7")]
pub metadata: ::core::option::Option<SettingMetadata>,
#[prost(message, optional, tag = "8")]
pub local_value: ::core::option::Option<Value>,
#[prost(message, optional, tag = "9")]
pub effective_value: ::core::option::Option<Value>,
#[prost(string, tag = "10")]
pub etag: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SettingMetadata {
#[prost(string, tag = "1")]
pub display_name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub description: ::prost::alloc::string::String,
#[prost(bool, tag = "3")]
pub read_only: bool,
#[prost(enumeration = "setting_metadata::DataType", tag = "4")]
pub data_type: i32,
#[prost(message, optional, tag = "5")]
pub default_value: ::core::option::Option<Value>,
}
pub mod setting_metadata {
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum DataType {
Unspecified = 0,
Boolean = 1,
String = 2,
StringSet = 3,
EnumValue = 4,
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Value {
#[prost(oneof = "value::Value", tags = "1, 2, 3, 4")]
pub value: ::core::option::Option<value::Value>,
}
pub mod value {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StringSet {
#[prost(string, repeated, tag = "1")]
pub values: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EnumValue {
#[prost(string, tag = "1")]
pub value: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Value {
#[prost(bool, tag = "1")]
BooleanValue(bool),
#[prost(string, tag = "2")]
StringValue(::prost::alloc::string::String),
#[prost(message, tag = "3")]
StringSetValue(StringSet),
#[prost(message, tag = "4")]
EnumValue(EnumValue),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListSettingsRequest {
#[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(enumeration = "SettingView", tag = "4")]
pub view: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListSettingsResponse {
#[prost(message, repeated, tag = "1")]
pub settings: ::prost::alloc::vec::Vec<Setting>,
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetSettingRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(enumeration = "SettingView", tag = "2")]
pub view: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateSettingRequest {
#[prost(message, optional, tag = "1")]
pub setting: ::core::option::Option<Setting>,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum SettingView {
Unspecified = 0,
Basic = 1,
EffectiveValue = 2,
LocalValue = 3,
}
#[doc = r" Generated client implementations."]
pub mod resource_settings_service_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[doc = " An interface to interact with resource settings and setting values throughout"]
#[doc = " the resource hierarchy."]
#[doc = ""]
#[doc = " Services may surface a number of settings for users to control how their"]
#[doc = " resources behave. Values of settings applied on a given Cloud resource are"]
#[doc = " evaluated hierarchically and inherited by all descendants of that resource."]
#[doc = ""]
#[doc = " For all requests, returns a `google.rpc.Status` with"]
#[doc = " `google.rpc.Code.PERMISSION_DENIED` if the IAM check fails or the `parent`"]
#[doc = " resource is not in a Cloud Organization."]
#[doc = " For all requests, returns a `google.rpc.Status` with"]
#[doc = " `google.rpc.Code.INVALID_ARGUMENT` if the request is malformed."]
#[derive(Debug, Clone)]
pub struct ResourceSettingsServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> ResourceSettingsServiceClient<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,
) -> ResourceSettingsServiceClient<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,
{
ResourceSettingsServiceClient::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 all the settings that are available on the Cloud resource `parent`."]
pub async fn list_settings(
&mut self,
request: impl tonic::IntoRequest<super::ListSettingsRequest>,
) -> Result<tonic::Response<super::ListSettingsResponse>, 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.resourcesettings.v1.ResourceSettingsService/ListSettings",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Gets a setting."]
#[doc = ""]
#[doc = " Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the"]
#[doc = " setting does not exist."]
pub async fn get_setting(
&mut self,
request: impl tonic::IntoRequest<super::GetSettingRequest>,
) -> Result<tonic::Response<super::Setting>, 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.resourcesettings.v1.ResourceSettingsService/GetSetting",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Updates a setting."]
#[doc = ""]
#[doc = " Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the"]
#[doc = " setting does not exist."]
#[doc = " Returns a `google.rpc.Status` with `google.rpc.Code.FAILED_PRECONDITION` if"]
#[doc = " the setting is flagged as read only."]
#[doc = " Returns a `google.rpc.Status` with `google.rpc.Code.ABORTED` if the etag"]
#[doc = " supplied in the request does not match the persisted etag of the setting"]
#[doc = " value."]
#[doc = ""]
#[doc = " On success, the response will contain only `name`, `local_value` and"]
#[doc = " `etag`. The `metadata` and `effective_value` cannot be updated through"]
#[doc = " this API."]
#[doc = ""]
#[doc = " Note: the supplied setting will perform a full overwrite of the"]
#[doc = " `local_value` field."]
pub async fn update_setting(
&mut self,
request: impl tonic::IntoRequest<super::UpdateSettingRequest>,
) -> Result<tonic::Response<super::Setting>, 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.resourcesettings.v1.ResourceSettingsService/UpdateSetting",
);
self.inner.unary(request.into_request(), path, codec).await
}
}
}