// This file is @generated by prost-build.
/// Represents resource cloud locations.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CloudLocation {
    /// Identifier. Name of the cloud location. Unique name of the cloud location
    /// including project and location using the form:
    /// `projects/{project_id}/locations/{location}/cloudLocations/{cloud_location}`
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    /// Output only. The containing cloud location in the strict nesting hierarchy.
    /// For example, the containing cloud location of a zone is a region.
    #[prost(string, tag = "2")]
    pub containing_cloud_location: ::prost::alloc::string::String,
    /// Optional. The human-readable name of the cloud location. Example:
    /// us-east-2, us-east1.
    #[prost(string, tag = "3")]
    pub display_name: ::prost::alloc::string::String,
    /// Optional. The provider of the cloud location. Values can be Google Cloud or
    /// third-party providers, including AWS, Azure, or Oracle Cloud
    /// Infrastructure.
    #[prost(enumeration = "cloud_location::CloudProvider", tag = "4")]
    pub cloud_provider: i32,
    /// Optional. The two-letter ISO 3166-1 alpha-2 code of the cloud location.
    /// Examples: US, JP, KR.
    #[prost(string, tag = "5")]
    pub territory_code: ::prost::alloc::string::String,
    /// Optional. The type of the cloud location.
    #[prost(enumeration = "cloud_location::CloudLocationType", tag = "6")]
    pub cloud_location_type: i32,
    /// Optional. The carbon free energy percentage of the cloud location. This
    /// represents the average percentage of time customers' application will be
    /// running on carbon-free energy. See
    /// <https://cloud.google.com/sustainability/region-carbon> for more details.
    /// There is a difference between default value 0 and unset value. 0 means the
    /// carbon free energy percentage is 0%, while unset value means the carbon
    /// footprint data is not available.
    #[prost(float, optional, tag = "7")]
    pub carbon_free_energy_percentage: ::core::option::Option<f32>,
}
/// Nested message and enum types in `CloudLocation`.
pub mod cloud_location {
    /// The type of the cloud provider. This enum lists all possible providers of
    /// cloud locations.
    #[derive(
        Clone,
        Copy,
        Debug,
        PartialEq,
        Eq,
        Hash,
        PartialOrd,
        Ord,
        ::prost::Enumeration
    )]
    #[repr(i32)]
    pub enum CloudProvider {
        /// Unspecified type.
        Unspecified = 0,
        /// Cloud provider type for Google Cloud.
        Gcp = 1,
        /// Cloud provider type for AWS.
        Aws = 2,
        /// Cloud provider type for Azure.
        Azure = 3,
        /// Cloud provider type for OCI.
        Oci = 4,
    }
    impl CloudProvider {
        /// 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 {
                Self::Unspecified => "CLOUD_PROVIDER_UNSPECIFIED",
                Self::Gcp => "CLOUD_PROVIDER_GCP",
                Self::Aws => "CLOUD_PROVIDER_AWS",
                Self::Azure => "CLOUD_PROVIDER_AZURE",
                Self::Oci => "CLOUD_PROVIDER_OCI",
            }
        }
        /// Creates an enum from field names used in the ProtoBuf definition.
        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
            match value {
                "CLOUD_PROVIDER_UNSPECIFIED" => Some(Self::Unspecified),
                "CLOUD_PROVIDER_GCP" => Some(Self::Gcp),
                "CLOUD_PROVIDER_AWS" => Some(Self::Aws),
                "CLOUD_PROVIDER_AZURE" => Some(Self::Azure),
                "CLOUD_PROVIDER_OCI" => Some(Self::Oci),
                _ => None,
            }
        }
    }
    /// The type of the cloud location. This enum lists all possible categories of
    /// cloud locations.
    #[derive(
        Clone,
        Copy,
        Debug,
        PartialEq,
        Eq,
        Hash,
        PartialOrd,
        Ord,
        ::prost::Enumeration
    )]
    #[repr(i32)]
    pub enum CloudLocationType {
        /// Unspecified type.
        Unspecified = 0,
        /// CloudLocation type for region.
        Region = 1,
        /// CloudLocation type for zone.
        Zone = 2,
        /// CloudLocation type for region extension.
        RegionExtension = 3,
        /// CloudLocation type for Google Distributed Cloud Connected Zone.
        GdccZone = 4,
    }
    impl CloudLocationType {
        /// 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 {
                Self::Unspecified => "CLOUD_LOCATION_TYPE_UNSPECIFIED",
                Self::Region => "CLOUD_LOCATION_TYPE_REGION",
                Self::Zone => "CLOUD_LOCATION_TYPE_ZONE",
                Self::RegionExtension => "CLOUD_LOCATION_TYPE_REGION_EXTENSION",
                Self::GdccZone => "CLOUD_LOCATION_TYPE_GDCC_ZONE",
            }
        }
        /// Creates an enum from field names used in the ProtoBuf definition.
        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
            match value {
                "CLOUD_LOCATION_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
                "CLOUD_LOCATION_TYPE_REGION" => Some(Self::Region),
                "CLOUD_LOCATION_TYPE_ZONE" => Some(Self::Zone),
                "CLOUD_LOCATION_TYPE_REGION_EXTENSION" => Some(Self::RegionExtension),
                "CLOUD_LOCATION_TYPE_GDCC_ZONE" => Some(Self::GdccZone),
                _ => None,
            }
        }
    }
}
/// Message for requesting list of cloud locations..
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ListCloudLocationsRequest {
    /// Required. The parent, which owns this collection of cloud locations.
    /// Format: projects/{project}/locations/{location}
    #[prost(string, tag = "1")]
    pub parent: ::prost::alloc::string::String,
    /// Optional. The maximum number of cloud locations to return per page. The
    /// service might return fewer cloud locations than this value. If unspecified,
    /// server will pick an appropriate default.
    #[prost(int32, tag = "2")]
    pub page_size: i32,
    /// Optional. A token identifying a page of results the server should return.
    /// Provide page token returned by a previous 'ListCloudLocations' call to
    /// retrieve the next page of results. When paginating, all other parameters
    /// provided to 'ListCloudLocations' must match the call that provided the page
    /// token.
    #[prost(string, tag = "3")]
    pub page_token: ::prost::alloc::string::String,
    /// Optional. A filter expression that filters resources listed in the
    /// response. The expression is in the form of field=value. For example,
    /// 'cloud_location_type=CLOUD_LOCATION_TYPE_REGION'. Multiple filter queries
    /// are space-separated. For example,
    /// 'cloud_location_type=CLOUD_LOCATION_TYPE_REGION territory_code="US"' By
    /// default, each expression is an AND expression. However, you can include AND
    /// and OR expressions explicitly.
    #[prost(string, tag = "4")]
    pub filter: ::prost::alloc::string::String,
}
/// Message for response to listing cloud locations.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListCloudLocationsResponse {
    /// Output only. List of cloud locations.
    #[prost(message, repeated, tag = "1")]
    pub cloud_locations: ::prost::alloc::vec::Vec<CloudLocation>,
    /// Output only. The continuation token, used to page through large result
    /// sets. Provide this value in a subsequent request as page_token in
    /// subsequent requests to retrieve the next page. If this field is not
    /// present, there are no subsequent results.
    #[prost(string, tag = "2")]
    pub next_page_token: ::prost::alloc::string::String,
}
/// Message for getting a cloud location.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetCloudLocationRequest {
    /// Required. Name of the resource.
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
}
/// Message for searching cloud locations from a given source location.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SearchCloudLocationsRequest {
    /// Required. The parent, which owns this collection of cloud locations.
    /// Format: projects/{project}/locations/{location}
    #[prost(string, tag = "1")]
    pub parent: ::prost::alloc::string::String,
    /// Required. The source cloud location to search from.
    /// Example search can be searching nearby cloud locations from the source
    /// cloud location by latency.
    #[prost(string, tag = "2")]
    pub source_cloud_location: ::prost::alloc::string::String,
    /// Optional. The maximum number of cloud locations to return. The service
    /// might return fewer cloud locations than this value. If unspecified, server
    /// will pick an appropriate default.
    #[prost(int32, tag = "3")]
    pub page_size: i32,
    /// Optional. A token identifying a page of results the server should return.
    /// Provide Page token returned by a previous 'ListCloudLocations' call to
    /// retrieve the next page of results. When paginating, all other parameters
    /// provided to 'ListCloudLocations' must match the call that provided the page
    /// token.
    #[prost(string, tag = "4")]
    pub page_token: ::prost::alloc::string::String,
    /// Optional. The query string in search query syntax. While filter is used to
    /// filter the search results by attributes, query is used to specify the
    /// search requirements.
    #[prost(string, tag = "6")]
    pub query: ::prost::alloc::string::String,
}
/// Message for response to searching cloud locations.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SearchCloudLocationsResponse {
    /// Output only. List of cloud locations.
    #[prost(message, repeated, tag = "1")]
    pub cloud_locations: ::prost::alloc::vec::Vec<CloudLocation>,
    /// Output only. The continuation token, used to page through large result
    /// sets. Provide this value in a subsequent request as page_token in
    /// subsequent requests to retrieve the next page. If this field is not
    /// present, there are no subsequent results.
    #[prost(string, tag = "2")]
    pub next_page_token: ::prost::alloc::string::String,
}
/// Generated client implementations.
pub mod cloud_location_finder_client {
    #![allow(
        unused_variables,
        dead_code,
        missing_docs,
        clippy::wildcard_imports,
        clippy::let_unit_value,
    )]
    use tonic::codegen::*;
    use tonic::codegen::http::Uri;
    /// Service describing handlers for resources
    #[derive(Debug, Clone)]
    pub struct CloudLocationFinderClient<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl CloudLocationFinderClient<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> CloudLocationFinderClient<T>
    where
        T: tonic::client::GrpcService<tonic::body::Body>,
        T::Error: Into<StdError>,
        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::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,
        ) -> CloudLocationFinderClient<InterceptedService<T, F>>
        where
            F: tonic::service::Interceptor,
            T::ResponseBody: Default,
            T: tonic::codegen::Service<
                http::Request<tonic::body::Body>,
                Response = http::Response<
                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
                >,
            >,
            <T as tonic::codegen::Service<
                http::Request<tonic::body::Body>,
            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
        {
            CloudLocationFinderClient::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
        }
        /// Lists cloud locations under a given project and location.
        pub async fn list_cloud_locations(
            &mut self,
            request: impl tonic::IntoRequest<super::ListCloudLocationsRequest>,
        ) -> std::result::Result<
            tonic::Response<super::ListCloudLocationsResponse>,
            tonic::Status,
        > {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::unknown(
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic_prost::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/google.cloud.locationfinder.v1.CloudLocationFinder/ListCloudLocations",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "google.cloud.locationfinder.v1.CloudLocationFinder",
                        "ListCloudLocations",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        /// Retrieves a resource containing information about a cloud location.
        pub async fn get_cloud_location(
            &mut self,
            request: impl tonic::IntoRequest<super::GetCloudLocationRequest>,
        ) -> std::result::Result<tonic::Response<super::CloudLocation>, tonic::Status> {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::unknown(
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic_prost::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/google.cloud.locationfinder.v1.CloudLocationFinder/GetCloudLocation",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "google.cloud.locationfinder.v1.CloudLocationFinder",
                        "GetCloudLocation",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        /// Searches for cloud locations from a given source location.
        pub async fn search_cloud_locations(
            &mut self,
            request: impl tonic::IntoRequest<super::SearchCloudLocationsRequest>,
        ) -> std::result::Result<
            tonic::Response<super::SearchCloudLocationsResponse>,
            tonic::Status,
        > {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::unknown(
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic_prost::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/google.cloud.locationfinder.v1.CloudLocationFinder/SearchCloudLocations",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "google.cloud.locationfinder.v1.CloudLocationFinder",
                        "SearchCloudLocations",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
    }
}
