#
google_cloud_pubsub/generated/gapic/
transport.rs

    1// Copyright 2025 Google LLC
    2//
    3// Licensed under the Apache License, Version 2.0 (the "License");
    4// you may not use this file except in compliance with the License.
    5// You may obtain a copy of the License at
    6//
    7//     https://www.apache.org/licenses/LICENSE-2.0
    8//
    9// Unless required by applicable law or agreed to in writing, software
    10// distributed under the License is distributed on an "AS IS" BASIS,
    11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12// See the License for the specific language governing permissions and
    13// limitations under the License.
    14//
    15// Code generated by sidekick. DO NOT EDIT.
    16
    17use crate::Result;
    18#[allow(unused_imports)]
    19use gax::error::Error;
    20
    21/// Implements [TopicAdmin](super::stub::TopicAdmin) using a [gaxi::http::ReqwestClient].
    22#[derive(Clone)]
    23pub struct TopicAdmin {
    24    inner: gaxi::http::ReqwestClient,
    25}
    26
    27impl std::fmt::Debug for TopicAdmin {
    28    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
    29        f.debug_struct("TopicAdmin")
    30            .field("inner", &self.inner)
    31            .finish()
    32    }
    33}
    34
    35impl TopicAdmin {
    36    pub async fn new(config: gaxi::options::ClientConfig) -> gax::client_builder::Result<Self> {
    37        let inner = gaxi::http::ReqwestClient::new(config, crate::DEFAULT_HOST).await?;
    38        Ok(Self { inner })
    39    }
    40}
    41
    42impl super::stub::TopicAdmin for TopicAdmin {
    43    async fn create_topic(
    44        &self,
    45        req: crate::model::Topic,
    46        options: gax::options::RequestOptions,
    47    ) -> Result<gax::response::Response<crate::model::Topic>> {
    48        use gax::error::binding::BindingError;
    49        use gaxi::path_parameter::PathMismatchBuilder;
    50        use gaxi::path_parameter::try_match;
    51        use gaxi::routing_parameter::Segment;
    52        let (builder, method) = None
    53            .or_else(|| {
    54                let path = format!(
    55                    "/v1/{}",
    56                    try_match(
    57                        Some(&req).map(|m| &m.name).map(|s| s.as_str()),
    58                        &[
    59                            Segment::Literal("projects/"),
    60                            Segment::SingleWildcard,
    61                            Segment::Literal("/topics/"),
    62                            Segment::SingleWildcard
    63                        ]
    64                    )?,
    65                );
    66
    67                let builder = self.inner.builder(reqwest::Method::PUT, path);
    68                let builder = Ok(builder);
    69                Some(builder.map(|b| (b, reqwest::Method::PUT)))
    70            })
    71            .ok_or_else(|| {
    72                let mut paths = Vec::new();
    73                {
    74                    let builder = PathMismatchBuilder::default();
    75                    let builder = builder.maybe_add(
    76                        Some(&req).map(|m| &m.name).map(|s| s.as_str()),
    77                        &[
    78                            Segment::Literal("projects/"),
    79                            Segment::SingleWildcard,
    80                            Segment::Literal("/topics/"),
    81                            Segment::SingleWildcard,
    82                        ],
    83                        "name",
    84                        "projects/*/topics/*",
    85                    );
    86                    paths.push(builder.build());
    87                }
    88                gax::error::Error::binding(BindingError { paths })
    89            })??;
    90        let options = gax::options::internal::set_default_idempotency(
    91            options,
    92            gaxi::http::default_idempotency(&method),
    93        );
    94        let builder = builder.query(&[("$alt", "json;enum-encoding=int")]).header(
    95            "x-goog-api-client",
    96            reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER),
    97        );
    98        let body = gaxi::http::handle_empty(Some(req), &method);
    99        self.inner.execute(builder, body, options).await
    100    }
    101
    102    async fn update_topic(
    103        &self,
    104        req: crate::model::UpdateTopicRequest,
    105        options: gax::options::RequestOptions,
    106    ) -> Result<gax::response::Response<crate::model::Topic>> {
    107        use gax::error::binding::BindingError;
    108        use gaxi::path_parameter::PathMismatchBuilder;
    109        use gaxi::path_parameter::try_match;
    110        use gaxi::routing_parameter::Segment;
    111        let (builder, method) = None
    112            .or_else(|| {
    113                let path = format!(
    114                    "/v1/{}",
    115                    try_match(
    116                        Some(&req)
    117                            .and_then(|m| m.topic.as_ref())
    118                            .map(|m| &m.name)
    119                            .map(|s| s.as_str()),
    120                        &[
    121                            Segment::Literal("projects/"),
    122                            Segment::SingleWildcard,
    123                            Segment::Literal("/topics/"),
    124                            Segment::SingleWildcard
    125                        ]
    126                    )?,
    127                );
    128
    129                let builder = self.inner.builder(reqwest::Method::PATCH, path);
    130                let builder = Ok(builder);
    131                Some(builder.map(|b| (b, reqwest::Method::PATCH)))
    132            })
    133            .ok_or_else(|| {
    134                let mut paths = Vec::new();
    135                {
    136                    let builder = PathMismatchBuilder::default();
    137                    let builder = builder.maybe_add(
    138                        Some(&req)
    139                            .and_then(|m| m.topic.as_ref())
    140                            .map(|m| &m.name)
    141                            .map(|s| s.as_str()),
    142                        &[
    143                            Segment::Literal("projects/"),
    144                            Segment::SingleWildcard,
    145                            Segment::Literal("/topics/"),
    146                            Segment::SingleWildcard,
    147                        ],
    148                        "topic.name",
    149                        "projects/*/topics/*",
    150                    );
    151                    paths.push(builder.build());
    152                }
    153                gax::error::Error::binding(BindingError { paths })
    154            })??;
    155        let options = gax::options::internal::set_default_idempotency(
    156            options,
    157            gaxi::http::default_idempotency(&method),
    158        );
    159        let builder = builder.query(&[("$alt", "json;enum-encoding=int")]).header(
    160            "x-goog-api-client",
    161            reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER),
    162        );
    163        let body = gaxi::http::handle_empty(Some(req), &method);
    164        self.inner.execute(builder, body, options).await
    165    }
    166
    167    async fn get_topic(
    168        &self,
    169        req: crate::model::GetTopicRequest,
    170        options: gax::options::RequestOptions,
    171    ) -> Result<gax::response::Response<crate::model::Topic>> {
    172        use gax::error::binding::BindingError;
    173        use gaxi::path_parameter::PathMismatchBuilder;
    174        use gaxi::path_parameter::try_match;
    175        use gaxi::routing_parameter::Segment;
    176        let (builder, method) = None
    177            .or_else(|| {
    178                let path = format!(
    179                    "/v1/{}",
    180                    try_match(
    181                        Some(&req).map(|m| &m.topic).map(|s| s.as_str()),
    182                        &[
    183                            Segment::Literal("projects/"),
    184                            Segment::SingleWildcard,
    185                            Segment::Literal("/topics/"),
    186                            Segment::SingleWildcard
    187                        ]
    188                    )?,
    189                );
    190
    191                let builder = self.inner.builder(reqwest::Method::GET, path);
    192                let builder = Ok(builder);
    193                Some(builder.map(|b| (b, reqwest::Method::GET)))
    194            })
    195            .ok_or_else(|| {
    196                let mut paths = Vec::new();
    197                {
    198                    let builder = PathMismatchBuilder::default();
    199                    let builder = builder.maybe_add(
    200                        Some(&req).map(|m| &m.topic).map(|s| s.as_str()),
    201                        &[
    202                            Segment::Literal("projects/"),
    203                            Segment::SingleWildcard,
    204                            Segment::Literal("/topics/"),
    205                            Segment::SingleWildcard,
    206                        ],
    207                        "topic",
    208                        "projects/*/topics/*",
    209                    );
    210                    paths.push(builder.build());
    211                }
    212                gax::error::Error::binding(BindingError { paths })
    213            })??;
    214        let options = gax::options::internal::set_default_idempotency(
    215            options,
    216            gaxi::http::default_idempotency(&method),
    217        );
    218        let builder = builder.query(&[("$alt", "json;enum-encoding=int")]).header(
    219            "x-goog-api-client",
    220            reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER),
    221        );
    222        let body = gaxi::http::handle_empty(None::<gaxi::http::NoBody>, &method);
    223        self.inner.execute(builder, body, options).await
    224    }
    225
    226    async fn list_topics(
    227        &self,
    228        req: crate::model::ListTopicsRequest,
    229        options: gax::options::RequestOptions,
    230    ) -> Result<gax::response::Response<crate::model::ListTopicsResponse>> {
    231        use gax::error::binding::BindingError;
    232        use gaxi::path_parameter::PathMismatchBuilder;
    233        use gaxi::path_parameter::try_match;
    234        use gaxi::routing_parameter::Segment;
    235        let (builder, method) = None
    236            .or_else(|| {
    237                let path = format!(
    238                    "/v1/{}/topics",
    239                    try_match(
    240                        Some(&req).map(|m| &m.project).map(|s| s.as_str()),
    241                        &[Segment::Literal("projects/"), Segment::SingleWildcard]
    242                    )?,
    243                );
    244
    245                let builder = self.inner.builder(reqwest::Method::GET, path);
    246                let builder = builder.query(&[("pageSize", &req.page_size)]);
    247                let builder = builder.query(&[("pageToken", &req.page_token)]);
    248                let builder = Ok(builder);
    249                Some(builder.map(|b| (b, reqwest::Method::GET)))
    250            })
    251            .ok_or_else(|| {
    252                let mut paths = Vec::new();
    253                {
    254                    let builder = PathMismatchBuilder::default();
    255                    let builder = builder.maybe_add(
    256                        Some(&req).map(|m| &m.project).map(|s| s.as_str()),
    257                        &[Segment::Literal("projects/"), Segment::SingleWildcard],
    258                        "project",
    259                        "projects/*",
    260                    );
    261                    paths.push(builder.build());
    262                }
    263                gax::error::Error::binding(BindingError { paths })
    264            })??;
    265        let options = gax::options::internal::set_default_idempotency(
    266            options,
    267            gaxi::http::default_idempotency(&method),
    268        );
    269        let builder = builder.query(&[("$alt", "json;enum-encoding=int")]).header(
    270            "x-goog-api-client",
    271            reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER),
    272        );
    273        let body = gaxi::http::handle_empty(None::<gaxi::http::NoBody>, &method);
    274        self.inner.execute(builder, body, options).await
    275    }
    276
    277    async fn list_topic_subscriptions(
    278        &self,
    279        req: crate::model::ListTopicSubscriptionsRequest,
    280        options: gax::options::RequestOptions,
    281    ) -> Result<gax::response::Response<crate::model::ListTopicSubscriptionsResponse>> {
    282        use gax::error::binding::BindingError;
    283        use gaxi::path_parameter::PathMismatchBuilder;
    284        use gaxi::path_parameter::try_match;
    285        use gaxi::routing_parameter::Segment;
    286        let (builder, method) = None
    287            .or_else(|| {
    288                let path = format!(
    289                    "/v1/{}/subscriptions",
    290                    try_match(
    291                        Some(&req).map(|m| &m.topic).map(|s| s.as_str()),
    292                        &[
    293                            Segment::Literal("projects/"),
    294                            Segment::SingleWildcard,
    295                            Segment::Literal("/topics/"),
    296                            Segment::SingleWildcard
    297                        ]
    298                    )?,
    299                );
    300
    301                let builder = self.inner.builder(reqwest::Method::GET, path);
    302                let builder = builder.query(&[("pageSize", &req.page_size)]);
    303                let builder = builder.query(&[("pageToken", &req.page_token)]);
    304                let builder = Ok(builder);
    305                Some(builder.map(|b| (b, reqwest::Method::GET)))
    306            })
    307            .ok_or_else(|| {
    308                let mut paths = Vec::new();
    309                {
    310                    let builder = PathMismatchBuilder::default();
    311                    let builder = builder.maybe_add(
    312                        Some(&req).map(|m| &m.topic).map(|s| s.as_str()),
    313                        &[
    314                            Segment::Literal("projects/"),
    315                            Segment::SingleWildcard,
    316                            Segment::Literal("/topics/"),
    317                            Segment::SingleWildcard,
    318                        ],
    319                        "topic",
    320                        "projects/*/topics/*",
    321                    );
    322                    paths.push(builder.build());
    323                }
    324                gax::error::Error::binding(BindingError { paths })
    325            })??;
    326        let options = gax::options::internal::set_default_idempotency(
    327            options,
    328            gaxi::http::default_idempotency(&method),
    329        );
    330        let builder = builder.query(&[("$alt", "json;enum-encoding=int")]).header(
    331            "x-goog-api-client",
    332            reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER),
    333        );
    334        let body = gaxi::http::handle_empty(None::<gaxi::http::NoBody>, &method);
    335        self.inner.execute(builder, body, options).await
    336    }
    337
    338    async fn list_topic_snapshots(
    339        &self,
    340        req: crate::model::ListTopicSnapshotsRequest,
    341        options: gax::options::RequestOptions,
    342    ) -> Result<gax::response::Response<crate::model::ListTopicSnapshotsResponse>> {
    343        use gax::error::binding::BindingError;
    344        use gaxi::path_parameter::PathMismatchBuilder;
    345        use gaxi::path_parameter::try_match;
    346        use gaxi::routing_parameter::Segment;
    347        let (builder, method) = None
    348            .or_else(|| {
    349                let path = format!(
    350                    "/v1/{}/snapshots",
    351                    try_match(
    352                        Some(&req).map(|m| &m.topic).map(|s| s.as_str()),
    353                        &[
    354                            Segment::Literal("projects/"),
    355                            Segment::SingleWildcard,
    356                            Segment::Literal("/topics/"),
    357                            Segment::SingleWildcard
    358                        ]
    359                    )?,
    360                );
    361
    362                let builder = self.inner.builder(reqwest::Method::GET, path);
    363                let builder = builder.query(&[("pageSize", &req.page_size)]);
    364                let builder = builder.query(&[("pageToken", &req.page_token)]);
    365                let builder = Ok(builder);
    366                Some(builder.map(|b| (b, reqwest::Method::GET)))
    367            })
    368            .ok_or_else(|| {
    369                let mut paths = Vec::new();
    370                {
    371                    let builder = PathMismatchBuilder::default();
    372                    let builder = builder.maybe_add(
    373                        Some(&req).map(|m| &m.topic).map(|s| s.as_str()),
    374                        &[
    375                            Segment::Literal("projects/"),
    376                            Segment::SingleWildcard,
    377                            Segment::Literal("/topics/"),
    378                            Segment::SingleWildcard,
    379                        ],
    380                        "topic",
    381                        "projects/*/topics/*",
    382                    );
    383                    paths.push(builder.build());
    384                }
    385                gax::error::Error::binding(BindingError { paths })
    386            })??;
    387        let options = gax::options::internal::set_default_idempotency(
    388            options,
    389            gaxi::http::default_idempotency(&method),
    390        );
    391        let builder = builder.query(&[("$alt", "json;enum-encoding=int")]).header(
    392            "x-goog-api-client",
    393            reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER),
    394        );
    395        let body = gaxi::http::handle_empty(None::<gaxi::http::NoBody>, &method);
    396        self.inner.execute(builder, body, options).await
    397    }
    398
    399    async fn delete_topic(
    400        &self,
    401        req: crate::model::DeleteTopicRequest,
    402        options: gax::options::RequestOptions,
    403    ) -> Result<gax::response::Response<()>> {
    404        use gax::error::binding::BindingError;
    405        use gaxi::path_parameter::PathMismatchBuilder;
    406        use gaxi::path_parameter::try_match;
    407        use gaxi::routing_parameter::Segment;
    408        let (builder, method) = None
    409            .or_else(|| {
    410                let path = format!(
    411                    "/v1/{}",
    412                    try_match(
    413                        Some(&req).map(|m| &m.topic).map(|s| s.as_str()),
    414                        &[
    415                            Segment::Literal("projects/"),
    416                            Segment::SingleWildcard,
    417                            Segment::Literal("/topics/"),
    418                            Segment::SingleWildcard
    419                        ]
    420                    )?,
    421                );
    422
    423                let builder = self.inner.builder(reqwest::Method::DELETE, path);
    424                let builder = Ok(builder);
    425                Some(builder.map(|b| (b, reqwest::Method::DELETE)))
    426            })
    427            .ok_or_else(|| {
    428                let mut paths = Vec::new();
    429                {
    430                    let builder = PathMismatchBuilder::default();
    431                    let builder = builder.maybe_add(
    432                        Some(&req).map(|m| &m.topic).map(|s| s.as_str()),
    433                        &[
    434                            Segment::Literal("projects/"),
    435                            Segment::SingleWildcard,
    436                            Segment::Literal("/topics/"),
    437                            Segment::SingleWildcard,
    438                        ],
    439                        "topic",
    440                        "projects/*/topics/*",
    441                    );
    442                    paths.push(builder.build());
    443                }
    444                gax::error::Error::binding(BindingError { paths })
    445            })??;
    446        let options = gax::options::internal::set_default_idempotency(
    447            options,
    448            gaxi::http::default_idempotency(&method),
    449        );
    450        let builder = builder.query(&[("$alt", "json;enum-encoding=int")]).header(
    451            "x-goog-api-client",
    452            reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER),
    453        );
    454        let body = gaxi::http::handle_empty(None::<gaxi::http::NoBody>, &method);
    455        self.inner.execute(builder, body, options).await.map(
    456            |r: gax::response::Response<wkt::Empty>| {
    457                let (parts, _) = r.into_parts();
    458                gax::response::Response::from_parts(parts, ())
    459            },
    460        )
    461    }
    462
    463    async fn detach_subscription(
    464        &self,
    465        req: crate::model::DetachSubscriptionRequest,
    466        options: gax::options::RequestOptions,
    467    ) -> Result<gax::response::Response<crate::model::DetachSubscriptionResponse>> {
    468        use gax::error::binding::BindingError;
    469        use gaxi::path_parameter::PathMismatchBuilder;
    470        use gaxi::path_parameter::try_match;
    471        use gaxi::routing_parameter::Segment;
    472        let (builder, method) = None
    473            .or_else(|| {
    474                let path = format!(
    475                    "/v1/{}:detach",
    476                    try_match(
    477                        Some(&req).map(|m| &m.subscription).map(|s| s.as_str()),
    478                        &[
    479                            Segment::Literal("projects/"),
    480                            Segment::SingleWildcard,
    481                            Segment::Literal("/subscriptions/"),
    482                            Segment::SingleWildcard
    483                        ]
    484                    )?,
    485                );
    486
    487                let builder = self.inner.builder(reqwest::Method::POST, path);
    488                let builder = Ok(builder);
    489                Some(builder.map(|b| (b, reqwest::Method::POST)))
    490            })
    491            .ok_or_else(|| {
    492                let mut paths = Vec::new();
    493                {
    494                    let builder = PathMismatchBuilder::default();
    495                    let builder = builder.maybe_add(
    496                        Some(&req).map(|m| &m.subscription).map(|s| s.as_str()),
    497                        &[
    498                            Segment::Literal("projects/"),
    499                            Segment::SingleWildcard,
    500                            Segment::Literal("/subscriptions/"),
    501                            Segment::SingleWildcard,
    502                        ],
    503                        "subscription",
    504                        "projects/*/subscriptions/*",
    505                    );
    506                    paths.push(builder.build());
    507                }
    508                gax::error::Error::binding(BindingError { paths })
    509            })??;
    510        let options = gax::options::internal::set_default_idempotency(
    511            options,
    512            gaxi::http::default_idempotency(&method),
    513        );
    514        let builder = builder.query(&[("$alt", "json;enum-encoding=int")]).header(
    515            "x-goog-api-client",
    516            reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER),
    517        );
    518        let body = gaxi::http::handle_empty(None::<gaxi::http::NoBody>, &method);
    519        self.inner.execute(builder, body, options).await
    520    }
    521}
    522
    523/// Implements [SubscriptionAdmin](super::stub::SubscriptionAdmin) using a [gaxi::http::ReqwestClient].
    524#[derive(Clone)]
    525pub struct SubscriptionAdmin {
    526    inner: gaxi::http::ReqwestClient,
    527}
    528
    529impl std::fmt::Debug for SubscriptionAdmin {
    530    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
    531        f.debug_struct("SubscriptionAdmin")
    532            .field("inner", &self.inner)
    533            .finish()
    534    }
    535}
    536
    537impl SubscriptionAdmin {
    538    pub async fn new(config: gaxi::options::ClientConfig) -> gax::client_builder::Result<Self> {
    539        let inner = gaxi::http::ReqwestClient::new(config, crate::DEFAULT_HOST).await?;
    540        Ok(Self { inner })
    541    }
    542}
    543
    544impl super::stub::SubscriptionAdmin for SubscriptionAdmin {
    545    async fn create_subscription(
    546        &self,
    547        req: crate::model::Subscription,
    548        options: gax::options::RequestOptions,
    549    ) -> Result<gax::response::Response<crate::model::Subscription>> {
    550        use gax::error::binding::BindingError;
    551        use gaxi::path_parameter::PathMismatchBuilder;
    552        use gaxi::path_parameter::try_match;
    553        use gaxi::routing_parameter::Segment;
    554        let (builder, method) = None
    555            .or_else(|| {
    556                let path = format!(
    557                    "/v1/{}",
    558                    try_match(
    559                        Some(&req).map(|m| &m.name).map(|s| s.as_str()),
    560                        &[
    561                            Segment::Literal("projects/"),
    562                            Segment::SingleWildcard,
    563                            Segment::Literal("/subscriptions/"),
    564                            Segment::SingleWildcard
    565                        ]
    566                    )?,
    567                );
    568
    569                let builder = self.inner.builder(reqwest::Method::PUT, path);
    570                let builder = Ok(builder);
    571                Some(builder.map(|b| (b, reqwest::Method::PUT)))
    572            })
    573            .ok_or_else(|| {
    574                let mut paths = Vec::new();
    575                {
    576                    let builder = PathMismatchBuilder::default();
    577                    let builder = builder.maybe_add(
    578                        Some(&req).map(|m| &m.name).map(|s| s.as_str()),
    579                        &[
    580                            Segment::Literal("projects/"),
    581                            Segment::SingleWildcard,
    582                            Segment::Literal("/subscriptions/"),
    583                            Segment::SingleWildcard,
    584                        ],
    585                        "name",
    586                        "projects/*/subscriptions/*",
    587                    );
    588                    paths.push(builder.build());
    589                }
    590                gax::error::Error::binding(BindingError { paths })
    591            })??;
    592        let options = gax::options::internal::set_default_idempotency(
    593            options,
    594            gaxi::http::default_idempotency(&method),
    595        );
    596        let builder = builder.query(&[("$alt", "json;enum-encoding=int")]).header(
    597            "x-goog-api-client",
    598            reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER),
    599        );
    600        let body = gaxi::http::handle_empty(Some(req), &method);
    601        self.inner.execute(builder, body, options).await
    602    }
    603
    604    async fn get_subscription(
    605        &self,
    606        req: crate::model::GetSubscriptionRequest,
    607        options: gax::options::RequestOptions,
    608    ) -> Result<gax::response::Response<crate::model::Subscription>> {
    609        use gax::error::binding::BindingError;
    610        use gaxi::path_parameter::PathMismatchBuilder;
    611        use gaxi::path_parameter::try_match;
    612        use gaxi::routing_parameter::Segment;
    613        let (builder, method) = None
    614            .or_else(|| {
    615                let path = format!(
    616                    "/v1/{}",
    617                    try_match(
    618                        Some(&req).map(|m| &m.subscription).map(|s| s.as_str()),
    619                        &[
    620                            Segment::Literal("projects/"),
    621                            Segment::SingleWildcard,
    622                            Segment::Literal("/subscriptions/"),
    623                            Segment::SingleWildcard
    624                        ]
    625                    )?,
    626                );
    627
    628                let builder = self.inner.builder(reqwest::Method::GET, path);
    629                let builder = Ok(builder);
    630                Some(builder.map(|b| (b, reqwest::Method::GET)))
    631            })
    632            .ok_or_else(|| {
    633                let mut paths = Vec::new();
    634                {
    635                    let builder = PathMismatchBuilder::default();
    636                    let builder = builder.maybe_add(
    637                        Some(&req).map(|m| &m.subscription).map(|s| s.as_str()),
    638                        &[
    639                            Segment::Literal("projects/"),
    640                            Segment::SingleWildcard,
    641                            Segment::Literal("/subscriptions/"),
    642                            Segment::SingleWildcard,
    643                        ],
    644                        "subscription",
    645                        "projects/*/subscriptions/*",
    646                    );
    647                    paths.push(builder.build());
    648                }
    649                gax::error::Error::binding(BindingError { paths })
    650            })??;
    651        let options = gax::options::internal::set_default_idempotency(
    652            options,
    653            gaxi::http::default_idempotency(&method),
    654        );
    655        let builder = builder.query(&[("$alt", "json;enum-encoding=int")]).header(
    656            "x-goog-api-client",
    657            reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER),
    658        );
    659        let body = gaxi::http::handle_empty(None::<gaxi::http::NoBody>, &method);
    660        self.inner.execute(builder, body, options).await
    661    }
    662
    663    async fn update_subscription(
    664        &self,
    665        req: crate::model::UpdateSubscriptionRequest,
    666        options: gax::options::RequestOptions,
    667    ) -> Result<gax::response::Response<crate::model::Subscription>> {
    668        use gax::error::binding::BindingError;
    669        use gaxi::path_parameter::PathMismatchBuilder;
    670        use gaxi::path_parameter::try_match;
    671        use gaxi::routing_parameter::Segment;
    672        let (builder, method) = None
    673            .or_else(|| {
    674                let path = format!(
    675                    "/v1/{}",
    676                    try_match(
    677                        Some(&req)
    678                            .and_then(|m| m.subscription.as_ref())
    679                            .map(|m| &m.name)
    680                            .map(|s| s.as_str()),
    681                        &[
    682                            Segment::Literal("projects/"),
    683                            Segment::SingleWildcard,
    684                            Segment::Literal("/subscriptions/"),
    685                            Segment::SingleWildcard
    686                        ]
    687                    )?,
    688                );
    689
    690                let builder = self.inner.builder(reqwest::Method::PATCH, path);
    691                let builder = Ok(builder);
    692                Some(builder.map(|b| (b, reqwest::Method::PATCH)))
    693            })
    694            .ok_or_else(|| {
    695                let mut paths = Vec::new();
    696                {
    697                    let builder = PathMismatchBuilder::default();
    698                    let builder = builder.maybe_add(
    699                        Some(&req)
    700                            .and_then(|m| m.subscription.as_ref())
    701                            .map(|m| &m.name)
    702                            .map(|s| s.as_str()),
    703                        &[
    704                            Segment::Literal("projects/"),
    705                            Segment::SingleWildcard,
    706                            Segment::Literal("/subscriptions/"),
    707                            Segment::SingleWildcard,
    708                        ],
    709                        "subscription.name",
    710                        "projects/*/subscriptions/*",
    711                    );
    712                    paths.push(builder.build());
    713                }
    714                gax::error::Error::binding(BindingError { paths })
    715            })??;
    716        let options = gax::options::internal::set_default_idempotency(
    717            options,
    718            gaxi::http::default_idempotency(&method),
    719        );
    720        let builder = builder.query(&[("$alt", "json;enum-encoding=int")]).header(
    721            "x-goog-api-client",
    722            reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER),
    723        );
    724        let body = gaxi::http::handle_empty(Some(req), &method);
    725        self.inner.execute(builder, body, options).await
    726    }
    727
    728    async fn list_subscriptions(
    729        &self,
    730        req: crate::model::ListSubscriptionsRequest,
    731        options: gax::options::RequestOptions,
    732    ) -> Result<gax::response::Response<crate::model::ListSubscriptionsResponse>> {
    733        use gax::error::binding::BindingError;
    734        use gaxi::path_parameter::PathMismatchBuilder;
    735        use gaxi::path_parameter::try_match;
    736        use gaxi::routing_parameter::Segment;
    737        let (builder, method) = None
    738            .or_else(|| {
    739                let path = format!(
    740                    "/v1/{}/subscriptions",
    741                    try_match(
    742                        Some(&req).map(|m| &m.project).map(|s| s.as_str()),
    743                        &[Segment::Literal("projects/"), Segment::SingleWildcard]
    744                    )?,
    745                );
    746
    747                let builder = self.inner.builder(reqwest::Method::GET, path);
    748                let builder = builder.query(&[("pageSize", &req.page_size)]);
    749                let builder = builder.query(&[("pageToken", &req.page_token)]);
    750                let builder = Ok(builder);
    751                Some(builder.map(|b| (b, reqwest::Method::GET)))
    752            })
    753            .ok_or_else(|| {
    754                let mut paths = Vec::new();
    755                {
    756                    let builder = PathMismatchBuilder::default();
    757                    let builder = builder.maybe_add(
    758                        Some(&req).map(|m| &m.project).map(|s| s.as_str()),
    759                        &[Segment::Literal("projects/"), Segment::SingleWildcard],
    760                        "project",
    761                        "projects/*",
    762                    );
    763                    paths.push(builder.build());
    764                }
    765                gax::error::Error::binding(BindingError { paths })
    766            })??;
    767        let options = gax::options::internal::set_default_idempotency(
    768            options,
    769            gaxi::http::default_idempotency(&method),
    770        );
    771        let builder = builder.query(&[("$alt", "json;enum-encoding=int")]).header(
    772            "x-goog-api-client",
    773            reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER),
    774        );
    775        let body = gaxi::http::handle_empty(None::<gaxi::http::NoBody>, &method);
    776        self.inner.execute(builder, body, options).await
    777    }
    778
    779    async fn delete_subscription(
    780        &self,
    781        req: crate::model::DeleteSubscriptionRequest,
    782        options: gax::options::RequestOptions,
    783    ) -> Result<gax::response::Response<()>> {
    784        use gax::error::binding::BindingError;
    785        use gaxi::path_parameter::PathMismatchBuilder;
    786        use gaxi::path_parameter::try_match;
    787        use gaxi::routing_parameter::Segment;
    788        let (builder, method) = None
    789            .or_else(|| {
    790                let path = format!(
    791                    "/v1/{}",
    792                    try_match(
    793                        Some(&req).map(|m| &m.subscription).map(|s| s.as_str()),
    794                        &[
    795                            Segment::Literal("projects/"),
    796                            Segment::SingleWildcard,
    797                            Segment::Literal("/subscriptions/"),
    798                            Segment::SingleWildcard
    799                        ]
    800                    )?,
    801                );
    802
    803                let builder = self.inner.builder(reqwest::Method::DELETE, path);
    804                let builder = Ok(builder);
    805                Some(builder.map(|b| (b, reqwest::Method::DELETE)))
    806            })
    807            .ok_or_else(|| {
    808                let mut paths = Vec::new();
    809                {
    810                    let builder = PathMismatchBuilder::default();
    811                    let builder = builder.maybe_add(
    812                        Some(&req).map(|m| &m.subscription).map(|s| s.as_str()),
    813                        &[
    814                            Segment::Literal("projects/"),
    815                            Segment::SingleWildcard,
    816                            Segment::Literal("/subscriptions/"),
    817                            Segment::SingleWildcard,
    818                        ],
    819                        "subscription",
    820                        "projects/*/subscriptions/*",
    821                    );
    822                    paths.push(builder.build());
    823                }
    824                gax::error::Error::binding(BindingError { paths })
    825            })??;
    826        let options = gax::options::internal::set_default_idempotency(
    827            options,
    828            gaxi::http::default_idempotency(&method),
    829        );
    830        let builder = builder.query(&[("$alt", "json;enum-encoding=int")]).header(
    831            "x-goog-api-client",
    832            reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER),
    833        );
    834        let body = gaxi::http::handle_empty(None::<gaxi::http::NoBody>, &method);
    835        self.inner.execute(builder, body, options).await.map(
    836            |r: gax::response::Response<wkt::Empty>| {
    837                let (parts, _) = r.into_parts();
    838                gax::response::Response::from_parts(parts, ())
    839            },
    840        )
    841    }
    842
    843    async fn modify_push_config(
    844        &self,
    845        req: crate::model::ModifyPushConfigRequest,
    846        options: gax::options::RequestOptions,
    847    ) -> Result<gax::response::Response<()>> {
    848        use gax::error::binding::BindingError;
    849        use gaxi::path_parameter::PathMismatchBuilder;
    850        use gaxi::path_parameter::try_match;
    851        use gaxi::routing_parameter::Segment;
    852        let (builder, method) = None
    853            .or_else(|| {
    854                let path = format!(
    855                    "/v1/{}:modifyPushConfig",
    856                    try_match(
    857                        Some(&req).map(|m| &m.subscription).map(|s| s.as_str()),
    858                        &[
    859                            Segment::Literal("projects/"),
    860                            Segment::SingleWildcard,
    861                            Segment::Literal("/subscriptions/"),
    862                            Segment::SingleWildcard
    863                        ]
    864                    )?,
    865                );
    866
    867                let builder = self.inner.builder(reqwest::Method::POST, path);
    868                let builder = Ok(builder);
    869                Some(builder.map(|b| (b, reqwest::Method::POST)))
    870            })
    871            .ok_or_else(|| {
    872                let mut paths = Vec::new();
    873                {
    874                    let builder = PathMismatchBuilder::default();
    875                    let builder = builder.maybe_add(
    876                        Some(&req).map(|m| &m.subscription).map(|s| s.as_str()),
    877                        &[
    878                            Segment::Literal("projects/"),
    879                            Segment::SingleWildcard,
    880                            Segment::Literal("/subscriptions/"),
    881                            Segment::SingleWildcard,
    882                        ],
    883                        "subscription",
    884                        "projects/*/subscriptions/*",
    885                    );
    886                    paths.push(builder.build());
    887                }
    888                gax::error::Error::binding(BindingError { paths })
    889            })??;
    890        let options = gax::options::internal::set_default_idempotency(
    891            options,
    892            gaxi::http::default_idempotency(&method),
    893        );
    894        let builder = builder.query(&[("$alt", "json;enum-encoding=int")]).header(
    895            "x-goog-api-client",
    896            reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER),
    897        );
    898        let body = gaxi::http::handle_empty(Some(req), &method);
    899        self.inner.execute(builder, body, options).await.map(
    900            |r: gax::response::Response<wkt::Empty>| {
    901                let (parts, _) = r.into_parts();
    902                gax::response::Response::from_parts(parts, ())
    903            },
    904        )
    905    }
    906
    907    async fn get_snapshot(
    908        &self,
    909        req: crate::model::GetSnapshotRequest,
    910        options: gax::options::RequestOptions,
    911    ) -> Result<gax::response::Response<crate::model::Snapshot>> {
    912        use gax::error::binding::BindingError;
    913        use gaxi::path_parameter::PathMismatchBuilder;
    914        use gaxi::path_parameter::try_match;
    915        use gaxi::routing_parameter::Segment;
    916        let (builder, method) = None
    917            .or_else(|| {
    918                let path = format!(
    919                    "/v1/{}",
    920                    try_match(
    921                        Some(&req).map(|m| &m.snapshot).map(|s| s.as_str()),
    922                        &[
    923                            Segment::Literal("projects/"),
    924                            Segment::SingleWildcard,
    925                            Segment::Literal("/snapshots/"),
    926                            Segment::SingleWildcard
    927                        ]
    928                    )?,
    929                );
    930
    931                let builder = self.inner.builder(reqwest::Method::GET, path);
    932                let builder = Ok(builder);
    933                Some(builder.map(|b| (b, reqwest::Method::GET)))
    934            })
    935            .ok_or_else(|| {
    936                let mut paths = Vec::new();
    937                {
    938                    let builder = PathMismatchBuilder::default();
    939                    let builder = builder.maybe_add(
    940                        Some(&req).map(|m| &m.snapshot).map(|s| s.as_str()),
    941                        &[
    942                            Segment::Literal("projects/"),
    943                            Segment::SingleWildcard,
    944                            Segment::Literal("/snapshots/"),
    945                            Segment::SingleWildcard,
    946                        ],
    947                        "snapshot",
    948                        "projects/*/snapshots/*",
    949                    );
    950                    paths.push(builder.build());
    951                }
    952                gax::error::Error::binding(BindingError { paths })
    953            })??;
    954        let options = gax::options::internal::set_default_idempotency(
    955            options,
    956            gaxi::http::default_idempotency(&method),
    957        );
    958        let builder = builder.query(&[("$alt", "json;enum-encoding=int")]).header(
    959            "x-goog-api-client",
    960            reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER),
    961        );
    962        let body = gaxi::http::handle_empty(None::<gaxi::http::NoBody>, &method);
    963        self.inner.execute(builder, body, options).await
    964    }
    965
    966    async fn list_snapshots(
    967        &self,
    968        req: crate::model::ListSnapshotsRequest,
    969        options: gax::options::RequestOptions,
    970    ) -> Result<gax::response::Response<crate::model::ListSnapshotsResponse>> {
    971        use gax::error::binding::BindingError;
    972        use gaxi::path_parameter::PathMismatchBuilder;
    973        use gaxi::path_parameter::try_match;
    974        use gaxi::routing_parameter::Segment;
    975        let (builder, method) = None
    976            .or_else(|| {
    977                let path = format!(
    978                    "/v1/{}/snapshots",
    979                    try_match(
    980                        Some(&req).map(|m| &m.project).map(|s| s.as_str()),
    981                        &[Segment::Literal("projects/"), Segment::SingleWildcard]
    982                    )?,
    983                );
    984
    985                let builder = self.inner.builder(reqwest::Method::GET, path);
    986                let builder = builder.query(&[("pageSize", &req.page_size)]);
    987                let builder = builder.query(&[("pageToken", &req.page_token)]);
    988                let builder = Ok(builder);
    989                Some(builder.map(|b| (b, reqwest::Method::GET)))
    990            })
    991            .ok_or_else(|| {
    992                let mut paths = Vec::new();
    993                {
    994                    let builder = PathMismatchBuilder::default();
    995                    let builder = builder.maybe_add(
    996                        Some(&req).map(|m| &m.project).map(|s| s.as_str()),
    997                        &[Segment::Literal("projects/"), Segment::SingleWildcard],
    998                        "project",
    999                        "projects/*",
    1000                    );
    1001                    paths.push(builder.build());
    1002                }
    1003                gax::error::Error::binding(BindingError { paths })
    1004            })??;
    1005        let options = gax::options::internal::set_default_idempotency(
    1006            options,
    1007            gaxi::http::default_idempotency(&method),
    1008        );
    1009        let builder = builder.query(&[("$alt", "json;enum-encoding=int")]).header(
    1010            "x-goog-api-client",
    1011            reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER),
    1012        );
    1013        let body = gaxi::http::handle_empty(None::<gaxi::http::NoBody>, &method);
    1014        self.inner.execute(builder, body, options).await
    1015    }
    1016
    1017    async fn create_snapshot(
    1018        &self,
    1019        req: crate::model::CreateSnapshotRequest,
    1020        options: gax::options::RequestOptions,
    1021    ) -> Result<gax::response::Response<crate::model::Snapshot>> {
    1022        use gax::error::binding::BindingError;
    1023        use gaxi::path_parameter::PathMismatchBuilder;
    1024        use gaxi::path_parameter::try_match;
    1025        use gaxi::routing_parameter::Segment;
    1026        let (builder, method) = None
    1027            .or_else(|| {
    1028                let path = format!(
    1029                    "/v1/{}",
    1030                    try_match(
    1031                        Some(&req).map(|m| &m.name).map(|s| s.as_str()),
    1032                        &[
    1033                            Segment::Literal("projects/"),
    1034                            Segment::SingleWildcard,
    1035                            Segment::Literal("/snapshots/"),
    1036                            Segment::SingleWildcard
    1037                        ]
    1038                    )?,
    1039                );
    1040
    1041                let builder = self.inner.builder(reqwest::Method::PUT, path);
    1042                let builder = Ok(builder);
    1043                Some(builder.map(|b| (b, reqwest::Method::PUT)))
    1044            })
    1045            .ok_or_else(|| {
    1046                let mut paths = Vec::new();
    1047                {
    1048                    let builder = PathMismatchBuilder::default();
    1049                    let builder = builder.maybe_add(
    1050                        Some(&req).map(|m| &m.name).map(|s| s.as_str()),
    1051                        &[
    1052                            Segment::Literal("projects/"),
    1053                            Segment::SingleWildcard,
    1054                            Segment::Literal("/snapshots/"),
    1055                            Segment::SingleWildcard,
    1056                        ],
    1057                        "name",
    1058                        "projects/*/snapshots/*",
    1059                    );
    1060                    paths.push(builder.build());
    1061                }
    1062                gax::error::Error::binding(BindingError { paths })
    1063            })??;
    1064        let options = gax::options::internal::set_default_idempotency(
    1065            options,
    1066            gaxi::http::default_idempotency(&method),
    1067        );
    1068        let builder = builder.query(&[("$alt", "json;enum-encoding=int")]).header(
    1069            "x-goog-api-client",
    1070            reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER),
    1071        );
    1072        let body = gaxi::http::handle_empty(Some(req), &method);
    1073        self.inner.execute(builder, body, options).await
    1074    }
    1075
    1076    async fn update_snapshot(
    1077        &self,
    1078        req: crate::model::UpdateSnapshotRequest,
    1079        options: gax::options::RequestOptions,
    1080    ) -> Result<gax::response::Response<crate::model::Snapshot>> {
    1081        use gax::error::binding::BindingError;
    1082        use gaxi::path_parameter::PathMismatchBuilder;
    1083        use gaxi::path_parameter::try_match;
    1084        use gaxi::routing_parameter::Segment;
    1085        let (builder, method) = None
    1086            .or_else(|| {
    1087                let path = format!(
    1088                    "/v1/{}",
    1089                    try_match(
    1090                        Some(&req)
    1091                            .and_then(|m| m.snapshot.as_ref())
    1092                            .map(|m| &m.name)
    1093                            .map(|s| s.as_str()),
    1094                        &[
    1095                            Segment::Literal("projects/"),
    1096                            Segment::SingleWildcard,
    1097                            Segment::Literal("/snapshots/"),
    1098                            Segment::SingleWildcard
    1099                        ]
    1100                    )?,
    1101                );
    1102
    1103                let builder = self.inner.builder(reqwest::Method::PATCH, path);
    1104                let builder = Ok(builder);
    1105                Some(builder.map(|b| (b, reqwest::Method::PATCH)))
    1106            })
    1107            .ok_or_else(|| {
    1108                let mut paths = Vec::new();
    1109                {
    1110                    let builder = PathMismatchBuilder::default();
    1111                    let builder = builder.maybe_add(
    1112                        Some(&req)
    1113                            .and_then(|m| m.snapshot.as_ref())
    1114                            .map(|m| &m.name)
    1115                            .map(|s| s.as_str()),
    1116                        &[
    1117                            Segment::Literal("projects/"),
    1118                            Segment::SingleWildcard,
    1119                            Segment::Literal("/snapshots/"),
    1120                            Segment::SingleWildcard,
    1121                        ],
    1122                        "snapshot.name",
    1123                        "projects/*/snapshots/*",
    1124                    );
    1125                    paths.push(builder.build());
    1126                }
    1127                gax::error::Error::binding(BindingError { paths })
    1128            })??;
    1129        let options = gax::options::internal::set_default_idempotency(
    1130            options,
    1131            gaxi::http::default_idempotency(&method),
    1132        );
    1133        let builder = builder.query(&[("$alt", "json;enum-encoding=int")]).header(
    1134            "x-goog-api-client",
    1135            reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER),
    1136        );
    1137        let body = gaxi::http::handle_empty(Some(req), &method);
    1138        self.inner.execute(builder, body, options).await
    1139    }
    1140
    1141    async fn delete_snapshot(
    1142        &self,
    1143        req: crate::model::DeleteSnapshotRequest,
    1144        options: gax::options::RequestOptions,
    1145    ) -> Result<gax::response::Response<()>> {
    1146        use gax::error::binding::BindingError;
    1147        use gaxi::path_parameter::PathMismatchBuilder;
    1148        use gaxi::path_parameter::try_match;
    1149        use gaxi::routing_parameter::Segment;
    1150        let (builder, method) = None
    1151            .or_else(|| {
    1152                let path = format!(
    1153                    "/v1/{}",
    1154                    try_match(
    1155                        Some(&req).map(|m| &m.snapshot).map(|s| s.as_str()),
    1156                        &[
    1157                            Segment::Literal("projects/"),
    1158                            Segment::SingleWildcard,
    1159                            Segment::Literal("/snapshots/"),
    1160                            Segment::SingleWildcard
    1161                        ]
    1162                    )?,
    1163                );
    1164
    1165                let builder = self.inner.builder(reqwest::Method::DELETE, path);
    1166                let builder = Ok(builder);
    1167                Some(builder.map(|b| (b, reqwest::Method::DELETE)))
    1168            })
    1169            .ok_or_else(|| {
    1170                let mut paths = Vec::new();
    1171                {
    1172                    let builder = PathMismatchBuilder::default();
    1173                    let builder = builder.maybe_add(
    1174                        Some(&req).map(|m| &m.snapshot).map(|s| s.as_str()),
    1175                        &[
    1176                            Segment::Literal("projects/"),
    1177                            Segment::SingleWildcard,
    1178                            Segment::Literal("/snapshots/"),
    1179                            Segment::SingleWildcard,
    1180                        ],
    1181                        "snapshot",
    1182                        "projects/*/snapshots/*",
    1183                    );
    1184                    paths.push(builder.build());
    1185                }
    1186                gax::error::Error::binding(BindingError { paths })
    1187            })??;
    1188        let options = gax::options::internal::set_default_idempotency(
    1189            options,
    1190            gaxi::http::default_idempotency(&method),
    1191        );
    1192        let builder = builder.query(&[("$alt", "json;enum-encoding=int")]).header(
    1193            "x-goog-api-client",
    1194            reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER),
    1195        );
    1196        let body = gaxi::http::handle_empty(None::<gaxi::http::NoBody>, &method);
    1197        self.inner.execute(builder, body, options).await.map(
    1198            |r: gax::response::Response<wkt::Empty>| {
    1199                let (parts, _) = r.into_parts();
    1200                gax::response::Response::from_parts(parts, ())
    1201            },
    1202        )
    1203    }
    1204
    1205    async fn seek(
    1206        &self,
    1207        req: crate::model::SeekRequest,
    1208        options: gax::options::RequestOptions,
    1209    ) -> Result<gax::response::Response<crate::model::SeekResponse>> {
    1210        use gax::error::binding::BindingError;
    1211        use gaxi::path_parameter::PathMismatchBuilder;
    1212        use gaxi::path_parameter::try_match;
    1213        use gaxi::routing_parameter::Segment;
    1214        let (builder, method) = None
    1215            .or_else(|| {
    1216                let path = format!(
    1217                    "/v1/{}:seek",
    1218                    try_match(
    1219                        Some(&req).map(|m| &m.subscription).map(|s| s.as_str()),
    1220                        &[
    1221                            Segment::Literal("projects/"),
    1222                            Segment::SingleWildcard,
    1223                            Segment::Literal("/subscriptions/"),
    1224                            Segment::SingleWildcard
    1225                        ]
    1226                    )?,
    1227                );
    1228
    1229                let builder = self.inner.builder(reqwest::Method::POST, path);
    1230                let builder = Ok(builder);
    1231                Some(builder.map(|b| (b, reqwest::Method::POST)))
    1232            })
    1233            .ok_or_else(|| {
    1234                let mut paths = Vec::new();
    1235                {
    1236                    let builder = PathMismatchBuilder::default();
    1237                    let builder = builder.maybe_add(
    1238                        Some(&req).map(|m| &m.subscription).map(|s| s.as_str()),
    1239                        &[
    1240                            Segment::Literal("projects/"),
    1241                            Segment::SingleWildcard,
    1242                            Segment::Literal("/subscriptions/"),
    1243                            Segment::SingleWildcard,
    1244                        ],
    1245                        "subscription",
    1246                        "projects/*/subscriptions/*",
    1247                    );
    1248                    paths.push(builder.build());
    1249                }
    1250                gax::error::Error::binding(BindingError { paths })
    1251            })??;
    1252        let options = gax::options::internal::set_default_idempotency(
    1253            options,
    1254            gaxi::http::default_idempotency(&method),
    1255        );
    1256        let builder = builder.query(&[("$alt", "json;enum-encoding=int")]).header(
    1257            "x-goog-api-client",
    1258            reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER),
    1259        );
    1260        let body = gaxi::http::handle_empty(Some(req), &method);
    1261        self.inner.execute(builder, body, options).await
    1262    }
    1263}
    1264
    1265/// Implements [SchemaService](super::stub::SchemaService) using a [gaxi::http::ReqwestClient].
    1266#[derive(Clone)]
    1267pub struct SchemaService {
    1268    inner: gaxi::http::ReqwestClient,
    1269}
    1270
    1271impl std::fmt::Debug for SchemaService {
    1272    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
    1273        f.debug_struct("SchemaService")
    1274            .field("inner", &self.inner)
    1275            .finish()
    1276    }
    1277}
    1278
    1279impl SchemaService {
    1280    pub async fn new(config: gaxi::options::ClientConfig) -> gax::client_builder::Result<Self> {
    1281        let inner = gaxi::http::ReqwestClient::new(config, crate::DEFAULT_HOST).await?;
    1282        Ok(Self { inner })
    1283    }
    1284}
    1285
    1286impl super::stub::SchemaService for SchemaService {
    1287    async fn create_schema(
    1288        &self,
    1289        req: crate::model::CreateSchemaRequest,
    1290        options: gax::options::RequestOptions,
    1291    ) -> Result<gax::response::Response<crate::model::Schema>> {
    1292        use gax::error::binding::BindingError;
    1293        use gaxi::path_parameter::PathMismatchBuilder;
    1294        use gaxi::path_parameter::try_match;
    1295        use gaxi::routing_parameter::Segment;
    1296        let (builder, method) = None
    1297            .or_else(|| {
    1298                let path = format!(
    1299                    "/v1/{}/schemas",
    1300                    try_match(
    1301                        Some(&req).map(|m| &m.parent).map(|s| s.as_str()),
    1302                        &[Segment::Literal("projects/"), Segment::SingleWildcard]
    1303                    )?,
    1304                );
    1305
    1306                let builder = self.inner.builder(reqwest::Method::POST, path);
    1307                let builder = builder.query(&[("schemaId", &req.schema_id)]);
    1308                let builder = Ok(builder);
    1309                Some(builder.map(|b| (b, reqwest::Method::POST)))
    1310            })
    1311            .ok_or_else(|| {
    1312                let mut paths = Vec::new();
    1313                {
    1314                    let builder = PathMismatchBuilder::default();
    1315                    let builder = builder.maybe_add(
    1316                        Some(&req).map(|m| &m.parent).map(|s| s.as_str()),
    1317                        &[Segment::Literal("projects/"), Segment::SingleWildcard],
    1318                        "parent",
    1319                        "projects/*",
    1320                    );
    1321                    paths.push(builder.build());
    1322                }
    1323                gax::error::Error::binding(BindingError { paths })
    1324            })??;
    1325        let options = gax::options::internal::set_default_idempotency(
    1326            options,
    1327            gaxi::http::default_idempotency(&method),
    1328        );
    1329        let builder = builder.query(&[("$alt", "json;enum-encoding=int")]).header(
    1330            "x-goog-api-client",
    1331            reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER),
    1332        );
    1333        let body = gaxi::http::handle_empty(req.schema, &method);
    1334        self.inner.execute(builder, body, options).await
    1335    }
    1336
    1337    async fn get_schema(
    1338        &self,
    1339        req: crate::model::GetSchemaRequest,
    1340        options: gax::options::RequestOptions,
    1341    ) -> Result<gax::response::Response<crate::model::Schema>> {
    1342        use gax::error::binding::BindingError;
    1343        use gaxi::path_parameter::PathMismatchBuilder;
    1344        use gaxi::path_parameter::try_match;
    1345        use gaxi::routing_parameter::Segment;
    1346        let (builder, method) = None
    1347            .or_else(|| {
    1348                let path = format!(
    1349                    "/v1/{}",
    1350                    try_match(
    1351                        Some(&req).map(|m| &m.name).map(|s| s.as_str()),
    1352                        &[
    1353                            Segment::Literal("projects/"),
    1354                            Segment::SingleWildcard,
    1355                            Segment::Literal("/schemas/"),
    1356                            Segment::SingleWildcard
    1357                        ]
    1358                    )?,
    1359                );
    1360
    1361                let builder = self.inner.builder(reqwest::Method::GET, path);
    1362                let builder = builder.query(&[("view", &req.view)]);
    1363                let builder = Ok(builder);
    1364                Some(builder.map(|b| (b, reqwest::Method::GET)))
    1365            })
    1366            .ok_or_else(|| {
    1367                let mut paths = Vec::new();
    1368                {
    1369                    let builder = PathMismatchBuilder::default();
    1370                    let builder = builder.maybe_add(
    1371                        Some(&req).map(|m| &m.name).map(|s| s.as_str()),
    1372                        &[
    1373                            Segment::Literal("projects/"),
    1374                            Segment::SingleWildcard,
    1375                            Segment::Literal("/schemas/"),
    1376                            Segment::SingleWildcard,
    1377                        ],
    1378                        "name",
    1379                        "projects/*/schemas/*",
    1380                    );
    1381                    paths.push(builder.build());
    1382                }
    1383                gax::error::Error::binding(BindingError { paths })
    1384            })??;
    1385        let options = gax::options::internal::set_default_idempotency(
    1386            options,
    1387            gaxi::http::default_idempotency(&method),
    1388        );
    1389        let builder = builder.query(&[("$alt", "json;enum-encoding=int")]).header(
    1390            "x-goog-api-client",
    1391            reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER),
    1392        );
    1393        let body = gaxi::http::handle_empty(None::<gaxi::http::NoBody>, &method);
    1394        self.inner.execute(builder, body, options).await
    1395    }
    1396
    1397    async fn list_schemas(
    1398        &self,
    1399        req: crate::model::ListSchemasRequest,
    1400        options: gax::options::RequestOptions,
    1401    ) -> Result<gax::response::Response<crate::model::ListSchemasResponse>> {
    1402        use gax::error::binding::BindingError;
    1403        use gaxi::path_parameter::PathMismatchBuilder;
    1404        use gaxi::path_parameter::try_match;
    1405        use gaxi::routing_parameter::Segment;
    1406        let (builder, method) = None
    1407            .or_else(|| {
    1408                let path = format!(
    1409                    "/v1/{}/schemas",
    1410                    try_match(
    1411                        Some(&req).map(|m| &m.parent).map(|s| s.as_str()),
    1412                        &[Segment::Literal("projects/"), Segment::SingleWildcard]
    1413                    )?,
    1414                );
    1415
    1416                let builder = self.inner.builder(reqwest::Method::GET, path);
    1417                let builder = builder.query(&[("view", &req.view)]);
    1418                let builder = builder.query(&[("pageSize", &req.page_size)]);
    1419                let builder = builder.query(&[("pageToken", &req.page_token)]);
    1420                let builder = Ok(builder);
    1421                Some(builder.map(|b| (b, reqwest::Method::GET)))
    1422            })
    1423            .ok_or_else(|| {
    1424                let mut paths = Vec::new();
    1425                {
    1426                    let builder = PathMismatchBuilder::default();
    1427                    let builder = builder.maybe_add(
    1428                        Some(&req).map(|m| &m.parent).map(|s| s.as_str()),
    1429                        &[Segment::Literal("projects/"), Segment::SingleWildcard],
    1430                        "parent",
    1431                        "projects/*",
    1432                    );
    1433                    paths.push(builder.build());
    1434                }
    1435                gax::error::Error::binding(BindingError { paths })
    1436            })??;
    1437        let options = gax::options::internal::set_default_idempotency(
    1438            options,
    1439            gaxi::http::default_idempotency(&method),
    1440        );
    1441        let builder = builder.query(&[("$alt", "json;enum-encoding=int")]).header(
    1442            "x-goog-api-client",
    1443            reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER),
    1444        );
    1445        let body = gaxi::http::handle_empty(None::<gaxi::http::NoBody>, &method);
    1446        self.inner.execute(builder, body, options).await
    1447    }
    1448
    1449    async fn list_schema_revisions(
    1450        &self,
    1451        req: crate::model::ListSchemaRevisionsRequest,
    1452        options: gax::options::RequestOptions,
    1453    ) -> Result<gax::response::Response<crate::model::ListSchemaRevisionsResponse>> {
    1454        use gax::error::binding::BindingError;
    1455        use gaxi::path_parameter::PathMismatchBuilder;
    1456        use gaxi::path_parameter::try_match;
    1457        use gaxi::routing_parameter::Segment;
    1458        let (builder, method) = None
    1459            .or_else(|| {
    1460                let path = format!(
    1461                    "/v1/{}:listRevisions",
    1462                    try_match(
    1463                        Some(&req).map(|m| &m.name).map(|s| s.as_str()),
    1464                        &[
    1465                            Segment::Literal("projects/"),
    1466                            Segment::SingleWildcard,
    1467                            Segment::Literal("/schemas/"),
    1468                            Segment::SingleWildcard
    1469                        ]
    1470                    )?,
    1471                );
    1472
    1473                let builder = self.inner.builder(reqwest::Method::GET, path);
    1474                let builder = builder.query(&[("view", &req.view)]);
    1475                let builder = builder.query(&[("pageSize", &req.page_size)]);
    1476                let builder = builder.query(&[("pageToken", &req.page_token)]);
    1477                let builder = Ok(builder);
    1478                Some(builder.map(|b| (b, reqwest::Method::GET)))
    1479            })
    1480            .ok_or_else(|| {
    1481                let mut paths = Vec::new();
    1482                {
    1483                    let builder = PathMismatchBuilder::default();
    1484                    let builder = builder.maybe_add(
    1485                        Some(&req).map(|m| &m.name).map(|s| s.as_str()),
    1486                        &[
    1487                            Segment::Literal("projects/"),
    1488                            Segment::SingleWildcard,
    1489                            Segment::Literal("/schemas/"),
    1490                            Segment::SingleWildcard,
    1491                        ],
    1492                        "name",
    1493                        "projects/*/schemas/*",
    1494                    );
    1495                    paths.push(builder.build());
    1496                }
    1497                gax::error::Error::binding(BindingError { paths })
    1498            })??;
    1499        let options = gax::options::internal::set_default_idempotency(
    1500            options,
    1501            gaxi::http::default_idempotency(&method),
    1502        );
    1503        let builder = builder.query(&[("$alt", "json;enum-encoding=int")]).header(
    1504            "x-goog-api-client",
    1505            reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER),
    1506        );
    1507        let body = gaxi::http::handle_empty(None::<gaxi::http::NoBody>, &method);
    1508        self.inner.execute(builder, body, options).await
    1509    }
    1510
    1511    async fn commit_schema(
    1512        &self,
    1513        req: crate::model::CommitSchemaRequest,
    1514        options: gax::options::RequestOptions,
    1515    ) -> Result<gax::response::Response<crate::model::Schema>> {
    1516        use gax::error::binding::BindingError;
    1517        use gaxi::path_parameter::PathMismatchBuilder;
    1518        use gaxi::path_parameter::try_match;
    1519        use gaxi::routing_parameter::Segment;
    1520        let (builder, method) = None
    1521            .or_else(|| {
    1522                let path = format!(
    1523                    "/v1/{}:commit",
    1524                    try_match(
    1525                        Some(&req).map(|m| &m.name).map(|s| s.as_str()),
    1526                        &[
    1527                            Segment::Literal("projects/"),
    1528                            Segment::SingleWildcard,
    1529                            Segment::Literal("/schemas/"),
    1530                            Segment::SingleWildcard
    1531                        ]
    1532                    )?,
    1533                );
    1534
    1535                let builder = self.inner.builder(reqwest::Method::POST, path);
    1536                let builder = Ok(builder);
    1537                Some(builder.map(|b| (b, reqwest::Method::POST)))
    1538            })
    1539            .ok_or_else(|| {
    1540                let mut paths = Vec::new();
    1541                {
    1542                    let builder = PathMismatchBuilder::default();
    1543                    let builder = builder.maybe_add(
    1544                        Some(&req).map(|m| &m.name).map(|s| s.as_str()),
    1545                        &[
    1546                            Segment::Literal("projects/"),
    1547                            Segment::SingleWildcard,
    1548                            Segment::Literal("/schemas/"),
    1549                            Segment::SingleWildcard,
    1550                        ],
    1551                        "name",
    1552                        "projects/*/schemas/*",
    1553                    );
    1554                    paths.push(builder.build());
    1555                }
    1556                gax::error::Error::binding(BindingError { paths })
    1557            })??;
    1558        let options = gax::options::internal::set_default_idempotency(
    1559            options,
    1560            gaxi::http::default_idempotency(&method),
    1561        );
    1562        let builder = builder.query(&[("$alt", "json;enum-encoding=int")]).header(
    1563            "x-goog-api-client",
    1564            reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER),
    1565        );
    1566        let body = gaxi::http::handle_empty(Some(req), &method);
    1567        self.inner.execute(builder, body, options).await
    1568    }
    1569
    1570    async fn rollback_schema(
    1571        &self,
    1572        req: crate::model::RollbackSchemaRequest,
    1573        options: gax::options::RequestOptions,
    1574    ) -> Result<gax::response::Response<crate::model::Schema>> {
    1575        use gax::error::binding::BindingError;
    1576        use gaxi::path_parameter::PathMismatchBuilder;
    1577        use gaxi::path_parameter::try_match;
    1578        use gaxi::routing_parameter::Segment;
    1579        let (builder, method) = None
    1580            .or_else(|| {
    1581                let path = format!(
    1582                    "/v1/{}:rollback",
    1583                    try_match(
    1584                        Some(&req).map(|m| &m.name).map(|s| s.as_str()),
    1585                        &[
    1586                            Segment::Literal("projects/"),
    1587                            Segment::SingleWildcard,
    1588                            Segment::Literal("/schemas/"),
    1589                            Segment::SingleWildcard
    1590                        ]
    1591                    )?,
    1592                );
    1593
    1594                let builder = self.inner.builder(reqwest::Method::POST, path);
    1595                let builder = Ok(builder);
    1596                Some(builder.map(|b| (b, reqwest::Method::POST)))
    1597            })
    1598            .ok_or_else(|| {
    1599                let mut paths = Vec::new();
    1600                {
    1601                    let builder = PathMismatchBuilder::default();
    1602                    let builder = builder.maybe_add(
    1603                        Some(&req).map(|m| &m.name).map(|s| s.as_str()),
    1604                        &[
    1605                            Segment::Literal("projects/"),
    1606                            Segment::SingleWildcard,
    1607                            Segment::Literal("/schemas/"),
    1608                            Segment::SingleWildcard,
    1609                        ],
    1610                        "name",
    1611                        "projects/*/schemas/*",
    1612                    );
    1613                    paths.push(builder.build());
    1614                }
    1615                gax::error::Error::binding(BindingError { paths })
    1616            })??;
    1617        let options = gax::options::internal::set_default_idempotency(
    1618            options,
    1619            gaxi::http::default_idempotency(&method),
    1620        );
    1621        let builder = builder.query(&[("$alt", "json;enum-encoding=int")]).header(
    1622            "x-goog-api-client",
    1623            reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER),
    1624        );
    1625        let body = gaxi::http::handle_empty(Some(req), &method);
    1626        self.inner.execute(builder, body, options).await
    1627    }
    1628
    1629    async fn delete_schema_revision(
    1630        &self,
    1631        req: crate::model::DeleteSchemaRevisionRequest,
    1632        options: gax::options::RequestOptions,
    1633    ) -> Result<gax::response::Response<crate::model::Schema>> {
    1634        use gax::error::binding::BindingError;
    1635        use gaxi::path_parameter::PathMismatchBuilder;
    1636        use gaxi::path_parameter::try_match;
    1637        use gaxi::routing_parameter::Segment;
    1638        let (builder, method) = None
    1639            .or_else(|| {
    1640                let path = format!(
    1641                    "/v1/{}:deleteRevision",
    1642                    try_match(
    1643                        Some(&req).map(|m| &m.name).map(|s| s.as_str()),
    1644                        &[
    1645                            Segment::Literal("projects/"),
    1646                            Segment::SingleWildcard,
    1647                            Segment::Literal("/schemas/"),
    1648                            Segment::SingleWildcard
    1649                        ]
    1650                    )?,
    1651                );
    1652
    1653                let builder = self.inner.builder(reqwest::Method::DELETE, path);
    1654                let builder = builder.query(&[("revisionId", &req.revision_id)]);
    1655                let builder = Ok(builder);
    1656                Some(builder.map(|b| (b, reqwest::Method::DELETE)))
    1657            })
    1658            .ok_or_else(|| {
    1659                let mut paths = Vec::new();
    1660                {
    1661                    let builder = PathMismatchBuilder::default();
    1662                    let builder = builder.maybe_add(
    1663                        Some(&req).map(|m| &m.name).map(|s| s.as_str()),
    1664                        &[
    1665                            Segment::Literal("projects/"),
    1666                            Segment::SingleWildcard,
    1667                            Segment::Literal("/schemas/"),
    1668                            Segment::SingleWildcard,
    1669                        ],
    1670                        "name",
    1671                        "projects/*/schemas/*",
    1672                    );
    1673                    paths.push(builder.build());
    1674                }
    1675                gax::error::Error::binding(BindingError { paths })
    1676            })??;
    1677        let options = gax::options::internal::set_default_idempotency(
    1678            options,
    1679            gaxi::http::default_idempotency(&method),
    1680        );
    1681        let builder = builder.query(&[("$alt", "json;enum-encoding=int")]).header(
    1682            "x-goog-api-client",
    1683            reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER),
    1684        );
    1685        let body = gaxi::http::handle_empty(None::<gaxi::http::NoBody>, &method);
    1686        self.inner.execute(builder, body, options).await
    1687    }
    1688
    1689    async fn delete_schema(
    1690        &self,
    1691        req: crate::model::DeleteSchemaRequest,
    1692        options: gax::options::RequestOptions,
    1693    ) -> Result<gax::response::Response<()>> {
    1694        use gax::error::binding::BindingError;
    1695        use gaxi::path_parameter::PathMismatchBuilder;
    1696        use gaxi::path_parameter::try_match;
    1697        use gaxi::routing_parameter::Segment;
    1698        let (builder, method) = None
    1699            .or_else(|| {
    1700                let path = format!(
    1701                    "/v1/{}",
    1702                    try_match(
    1703                        Some(&req).map(|m| &m.name).map(|s| s.as_str()),
    1704                        &[
    1705                            Segment::Literal("projects/"),
    1706                            Segment::SingleWildcard,
    1707                            Segment::Literal("/schemas/"),
    1708                            Segment::SingleWildcard
    1709                        ]
    1710                    )?,
    1711                );
    1712
    1713                let builder = self.inner.builder(reqwest::Method::DELETE, path);
    1714                let builder = Ok(builder);
    1715                Some(builder.map(|b| (b, reqwest::Method::DELETE)))
    1716            })
    1717            .ok_or_else(|| {
    1718                let mut paths = Vec::new();
    1719                {
    1720                    let builder = PathMismatchBuilder::default();
    1721                    let builder = builder.maybe_add(
    1722                        Some(&req).map(|m| &m.name).map(|s| s.as_str()),
    1723                        &[
    1724                            Segment::Literal("projects/"),
    1725                            Segment::SingleWildcard,
    1726                            Segment::Literal("/schemas/"),
    1727                            Segment::SingleWildcard,
    1728                        ],
    1729                        "name",
    1730                        "projects/*/schemas/*",
    1731                    );
    1732                    paths.push(builder.build());
    1733                }
    1734                gax::error::Error::binding(BindingError { paths })
    1735            })??;
    1736        let options = gax::options::internal::set_default_idempotency(
    1737            options,
    1738            gaxi::http::default_idempotency(&method),
    1739        );
    1740        let builder = builder.query(&[("$alt", "json;enum-encoding=int")]).header(
    1741            "x-goog-api-client",
    1742            reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER),
    1743        );
    1744        let body = gaxi::http::handle_empty(None::<gaxi::http::NoBody>, &method);
    1745        self.inner.execute(builder, body, options).await.map(
    1746            |r: gax::response::Response<wkt::Empty>| {
    1747                let (parts, _) = r.into_parts();
    1748                gax::response::Response::from_parts(parts, ())
    1749            },
    1750        )
    1751    }
    1752
    1753    async fn validate_schema(
    1754        &self,
    1755        req: crate::model::ValidateSchemaRequest,
    1756        options: gax::options::RequestOptions,
    1757    ) -> Result<gax::response::Response<crate::model::ValidateSchemaResponse>> {
    1758        use gax::error::binding::BindingError;
    1759        use gaxi::path_parameter::PathMismatchBuilder;
    1760        use gaxi::path_parameter::try_match;
    1761        use gaxi::routing_parameter::Segment;
    1762        let (builder, method) = None
    1763            .or_else(|| {
    1764                let path = format!(
    1765                    "/v1/{}/schemas:validate",
    1766                    try_match(
    1767                        Some(&req).map(|m| &m.parent).map(|s| s.as_str()),
    1768                        &[Segment::Literal("projects/"), Segment::SingleWildcard]
    1769                    )?,
    1770                );
    1771
    1772                let builder = self.inner.builder(reqwest::Method::POST, path);
    1773                let builder = Ok(builder);
    1774                Some(builder.map(|b| (b, reqwest::Method::POST)))
    1775            })
    1776            .ok_or_else(|| {
    1777                let mut paths = Vec::new();
    1778                {
    1779                    let builder = PathMismatchBuilder::default();
    1780                    let builder = builder.maybe_add(
    1781                        Some(&req).map(|m| &m.parent).map(|s| s.as_str()),
    1782                        &[Segment::Literal("projects/"), Segment::SingleWildcard],
    1783                        "parent",
    1784                        "projects/*",
    1785                    );
    1786                    paths.push(builder.build());
    1787                }
    1788                gax::error::Error::binding(BindingError { paths })
    1789            })??;
    1790        let options = gax::options::internal::set_default_idempotency(
    1791            options,
    1792            gaxi::http::default_idempotency(&method),
    1793        );
    1794        let builder = builder.query(&[("$alt", "json;enum-encoding=int")]).header(
    1795            "x-goog-api-client",
    1796            reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER),
    1797        );
    1798        let body = gaxi::http::handle_empty(Some(req), &method);
    1799        self.inner.execute(builder, body, options).await
    1800    }
    1801
    1802    async fn validate_message(
    1803        &self,
    1804        req: crate::model::ValidateMessageRequest,
    1805        options: gax::options::RequestOptions,
    1806    ) -> Result<gax::response::Response<crate::model::ValidateMessageResponse>> {
    1807        use gax::error::binding::BindingError;
    1808        use gaxi::path_parameter::PathMismatchBuilder;
    1809        use gaxi::path_parameter::try_match;
    1810        use gaxi::routing_parameter::Segment;
    1811        let (builder, method) = None
    1812            .or_else(|| {
    1813                let path = format!(
    1814                    "/v1/{}/schemas:validateMessage",
    1815                    try_match(
    1816                        Some(&req).map(|m| &m.parent).map(|s| s.as_str()),
    1817                        &[Segment::Literal("projects/"), Segment::SingleWildcard]
    1818                    )?,
    1819                );
    1820
    1821                let builder = self.inner.builder(reqwest::Method::POST, path);
    1822                let builder = Ok(builder);
    1823                Some(builder.map(|b| (b, reqwest::Method::POST)))
    1824            })
    1825            .ok_or_else(|| {
    1826                let mut paths = Vec::new();
    1827                {
    1828                    let builder = PathMismatchBuilder::default();
    1829                    let builder = builder.maybe_add(
    1830                        Some(&req).map(|m| &m.parent).map(|s| s.as_str()),
    1831                        &[Segment::Literal("projects/"), Segment::SingleWildcard],
    1832                        "parent",
    1833                        "projects/*",
    1834                    );
    1835                    paths.push(builder.build());
    1836                }
    1837                gax::error::Error::binding(BindingError { paths })
    1838            })??;
    1839        let options = gax::options::internal::set_default_idempotency(
    1840            options,
    1841            gaxi::http::default_idempotency(&method),
    1842        );
    1843        let builder = builder.query(&[("$alt", "json;enum-encoding=int")]).header(
    1844            "x-goog-api-client",
    1845            reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER),
    1846        );
    1847        let body = gaxi::http::handle_empty(Some(req), &method);
    1848        self.inner.execute(builder, body, options).await
    1849    }
    1850
    1851    async fn set_iam_policy(
    1852        &self,
    1853        req: iam_v1::model::SetIamPolicyRequest,
    1854        options: gax::options::RequestOptions,
    1855    ) -> Result<gax::response::Response<iam_v1::model::Policy>> {
    1856        use gax::error::binding::BindingError;
    1857        use gaxi::path_parameter::PathMismatchBuilder;
    1858        use gaxi::path_parameter::try_match;
    1859        use gaxi::routing_parameter::Segment;
    1860        let (builder, method) = None
    1861            .or_else(|| {
    1862                let path = format!(
    1863                    "/v1/{}:setIamPolicy",
    1864                    try_match(
    1865                        Some(&req).map(|m| &m.resource).map(|s| s.as_str()),
    1866                        &[
    1867                            Segment::Literal("projects/"),
    1868                            Segment::SingleWildcard,
    1869                            Segment::Literal("/topics/"),
    1870                            Segment::SingleWildcard
    1871                        ]
    1872                    )?,
    1873                );
    1874
    1875                let builder = self.inner.builder(reqwest::Method::POST, path);
    1876                let builder = Ok(builder);
    1877                Some(builder.map(|b| (b, reqwest::Method::POST)))
    1878            })
    1879            .or_else(|| {
    1880                let path = format!(
    1881                    "/v1/{}:setIamPolicy",
    1882                    try_match(
    1883                        Some(&req).map(|m| &m.resource).map(|s| s.as_str()),
    1884                        &[
    1885                            Segment::Literal("projects/"),
    1886                            Segment::SingleWildcard,
    1887                            Segment::Literal("/subscriptions/"),
    1888                            Segment::SingleWildcard
    1889                        ]
    1890                    )?,
    1891                );
    1892
    1893                let builder = self.inner.builder(reqwest::Method::POST, path);
    1894                let builder = Ok(builder);
    1895                Some(builder.map(|b| (b, reqwest::Method::POST)))
    1896            })
    1897            .or_else(|| {
    1898                let path = format!(
    1899                    "/v1/{}:setIamPolicy",
    1900                    try_match(
    1901                        Some(&req).map(|m| &m.resource).map(|s| s.as_str()),
    1902                        &[
    1903                            Segment::Literal("projects/"),
    1904                            Segment::SingleWildcard,
    1905                            Segment::Literal("/snapshots/"),
    1906                            Segment::SingleWildcard
    1907                        ]
    1908                    )?,
    1909                );
    1910
    1911                let builder = self.inner.builder(reqwest::Method::POST, path);
    1912                let builder = Ok(builder);
    1913                Some(builder.map(|b| (b, reqwest::Method::POST)))
    1914            })
    1915            .or_else(|| {
    1916                let path = format!(
    1917                    "/v1/{}:setIamPolicy",
    1918                    try_match(
    1919                        Some(&req).map(|m| &m.resource).map(|s| s.as_str()),
    1920                        &[
    1921                            Segment::Literal("projects/"),
    1922                            Segment::SingleWildcard,
    1923                            Segment::Literal("/schemas/"),
    1924                            Segment::SingleWildcard
    1925                        ]
    1926                    )?,
    1927                );
    1928
    1929                let builder = self.inner.builder(reqwest::Method::POST, path);
    1930                let builder = Ok(builder);
    1931                Some(builder.map(|b| (b, reqwest::Method::POST)))
    1932            })
    1933            .ok_or_else(|| {
    1934                let mut paths = Vec::new();
    1935                {
    1936                    let builder = PathMismatchBuilder::default();
    1937                    let builder = builder.maybe_add(
    1938                        Some(&req).map(|m| &m.resource).map(|s| s.as_str()),
    1939                        &[
    1940                            Segment::Literal("projects/"),
    1941                            Segment::SingleWildcard,
    1942                            Segment::Literal("/topics/"),
    1943                            Segment::SingleWildcard,
    1944                        ],
    1945                        "resource",
    1946                        "projects/*/topics/*",
    1947                    );
    1948                    paths.push(builder.build());
    1949                }
    1950                {
    1951                    let builder = PathMismatchBuilder::default();
    1952                    let builder = builder.maybe_add(
    1953                        Some(&req).map(|m| &m.resource).map(|s| s.as_str()),
    1954                        &[
    1955                            Segment::Literal("projects/"),
    1956                            Segment::SingleWildcard,
    1957                            Segment::Literal("/subscriptions/"),
    1958                            Segment::SingleWildcard,
    1959                        ],
    1960                        "resource",
    1961                        "projects/*/subscriptions/*",
    1962                    );
    1963                    paths.push(builder.build());
    1964                }
    1965                {
    1966                    let builder = PathMismatchBuilder::default();
    1967                    let builder = builder.maybe_add(
    1968                        Some(&req).map(|m| &m.resource).map(|s| s.as_str()),
    1969                        &[
    1970                            Segment::Literal("projects/"),
    1971                            Segment::SingleWildcard,
    1972                            Segment::Literal("/snapshots/"),
    1973                            Segment::SingleWildcard,
    1974                        ],
    1975                        "resource",
    1976                        "projects/*/snapshots/*",
    1977                    );
    1978                    paths.push(builder.build());
    1979                }
    1980                {
    1981                    let builder = PathMismatchBuilder::default();
    1982                    let builder = builder.maybe_add(
    1983                        Some(&req).map(|m| &m.resource).map(|s| s.as_str()),
    1984                        &[
    1985                            Segment::Literal("projects/"),
    1986                            Segment::SingleWildcard,
    1987                            Segment::Literal("/schemas/"),
    1988                            Segment::SingleWildcard,
    1989                        ],
    1990                        "resource",
    1991                        "projects/*/schemas/*",
    1992                    );
    1993                    paths.push(builder.build());
    1994                }
    1995                gax::error::Error::binding(BindingError { paths })
    1996            })??;
    1997        let options = gax::options::internal::set_default_idempotency(
    1998            options,
    1999            gaxi::http::default_idempotency(&method),
    2000        );
    2001        let builder = builder.query(&[("$alt", "json;enum-encoding=int")]).header(
    2002            "x-goog-api-client",
    2003            reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER),
    2004        );
    2005        let body = gaxi::http::handle_empty(Some(req), &method);
    2006        self.inner.execute(builder, body, options).await
    2007    }
    2008
    2009    async fn get_iam_policy(
    2010        &self,
    2011        req: iam_v1::model::GetIamPolicyRequest,
    2012        options: gax::options::RequestOptions,
    2013    ) -> Result<gax::response::Response<iam_v1::model::Policy>> {
    2014        use gax::error::binding::BindingError;
    2015        use gaxi::path_parameter::PathMismatchBuilder;
    2016        use gaxi::path_parameter::try_match;
    2017        use gaxi::routing_parameter::Segment;
    2018        let (builder, method) = None
    2019            .or_else(|| {
    2020                let path = format!(
    2021                    "/v1/{}:getIamPolicy",
    2022                    try_match(
    2023                        Some(&req).map(|m| &m.resource).map(|s| s.as_str()),
    2024                        &[
    2025                            Segment::Literal("projects/"),
    2026                            Segment::SingleWildcard,
    2027                            Segment::Literal("/topics/"),
    2028                            Segment::SingleWildcard
    2029                        ]
    2030                    )?,
    2031                );
    2032
    2033                let builder = self.inner.builder(reqwest::Method::GET, path);
    2034                let builder = (|| {
    2035                    let builder = req
    2036                        .options
    2037                        .as_ref()
    2038                        .map(|p| serde_json::to_value(p).map_err(Error::ser))
    2039                        .transpose()?
    2040                        .into_iter()
    2041                        .fold(builder, |builder, v| {
    2042                            use gaxi::query_parameter::QueryParameter;
    2043                            v.add(builder, "options")
    2044                        });
    2045                    Ok(builder)
    2046                })();
    2047                Some(builder.map(|b| (b, reqwest::Method::GET)))
    2048            })
    2049            .or_else(|| {
    2050                let path = format!(
    2051                    "/v1/{}:getIamPolicy",
    2052                    try_match(
    2053                        Some(&req).map(|m| &m.resource).map(|s| s.as_str()),
    2054                        &[
    2055                            Segment::Literal("projects/"),
    2056                            Segment::SingleWildcard,
    2057                            Segment::Literal("/subscriptions/"),
    2058                            Segment::SingleWildcard
    2059                        ]
    2060                    )?,
    2061                );
    2062
    2063                let builder = self.inner.builder(reqwest::Method::GET, path);
    2064                let builder = (|| {
    2065                    let builder = req
    2066                        .options
    2067                        .as_ref()
    2068                        .map(|p| serde_json::to_value(p).map_err(Error::ser))
    2069                        .transpose()?
    2070                        .into_iter()
    2071                        .fold(builder, |builder, v| {
    2072                            use gaxi::query_parameter::QueryParameter;
    2073                            v.add(builder, "options")
    2074                        });
    2075                    Ok(builder)
    2076                })();
    2077                Some(builder.map(|b| (b, reqwest::Method::GET)))
    2078            })
    2079            .or_else(|| {
    2080                let path = format!(
    2081                    "/v1/{}:getIamPolicy",
    2082                    try_match(
    2083                        Some(&req).map(|m| &m.resource).map(|s| s.as_str()),
    2084                        &[
    2085                            Segment::Literal("projects/"),
    2086                            Segment::SingleWildcard,
    2087                            Segment::Literal("/snapshots/"),
    2088                            Segment::SingleWildcard
    2089                        ]
    2090                    )?,
    2091                );
    2092
    2093                let builder = self.inner.builder(reqwest::Method::GET, path);
    2094                let builder = (|| {
    2095                    let builder = req
    2096                        .options
    2097                        .as_ref()
    2098                        .map(|p| serde_json::to_value(p).map_err(Error::ser))
    2099                        .transpose()?
    2100                        .into_iter()
    2101                        .fold(builder, |builder, v| {
    2102                            use gaxi::query_parameter::QueryParameter;
    2103                            v.add(builder, "options")
    2104                        });
    2105                    Ok(builder)
    2106                })();
    2107                Some(builder.map(|b| (b, reqwest::Method::GET)))
    2108            })
    2109            .or_else(|| {
    2110                let path = format!(
    2111                    "/v1/{}:getIamPolicy",
    2112                    try_match(
    2113                        Some(&req).map(|m| &m.resource).map(|s| s.as_str()),
    2114                        &[
    2115                            Segment::Literal("projects/"),
    2116                            Segment::SingleWildcard,
    2117                            Segment::Literal("/schemas/"),
    2118                            Segment::SingleWildcard
    2119                        ]
    2120                    )?,
    2121                );
    2122
    2123                let builder = self.inner.builder(reqwest::Method::GET, path);
    2124                let builder = (|| {
    2125                    let builder = req
    2126                        .options
    2127                        .as_ref()
    2128                        .map(|p| serde_json::to_value(p).map_err(Error::ser))
    2129                        .transpose()?
    2130                        .into_iter()
    2131                        .fold(builder, |builder, v| {
    2132                            use gaxi::query_parameter::QueryParameter;
    2133                            v.add(builder, "options")
    2134                        });
    2135                    Ok(builder)
    2136                })();
    2137                Some(builder.map(|b| (b, reqwest::Method::GET)))
    2138            })
    2139            .ok_or_else(|| {
    2140                let mut paths = Vec::new();
    2141                {
    2142                    let builder = PathMismatchBuilder::default();
    2143                    let builder = builder.maybe_add(
    2144                        Some(&req).map(|m| &m.resource).map(|s| s.as_str()),
    2145                        &[
    2146                            Segment::Literal("projects/"),
    2147                            Segment::SingleWildcard,
    2148                            Segment::Literal("/topics/"),
    2149                            Segment::SingleWildcard,
    2150                        ],
    2151                        "resource",
    2152                        "projects/*/topics/*",
    2153                    );
    2154                    paths.push(builder.build());
    2155                }
    2156                {
    2157                    let builder = PathMismatchBuilder::default();
    2158                    let builder = builder.maybe_add(
    2159                        Some(&req).map(|m| &m.resource).map(|s| s.as_str()),
    2160                        &[
    2161                            Segment::Literal("projects/"),
    2162                            Segment::SingleWildcard,
    2163                            Segment::Literal("/subscriptions/"),
    2164                            Segment::SingleWildcard,
    2165                        ],
    2166                        "resource",
    2167                        "projects/*/subscriptions/*",
    2168                    );
    2169                    paths.push(builder.build());
    2170                }
    2171                {
    2172                    let builder = PathMismatchBuilder::default();
    2173                    let builder = builder.maybe_add(
    2174                        Some(&req).map(|m| &m.resource).map(|s| s.as_str()),
    2175                        &[
    2176                            Segment::Literal("projects/"),
    2177                            Segment::SingleWildcard,
    2178                            Segment::Literal("/snapshots/"),
    2179                            Segment::SingleWildcard,
    2180                        ],
    2181                        "resource",
    2182                        "projects/*/snapshots/*",
    2183                    );
    2184                    paths.push(builder.build());
    2185                }
    2186                {
    2187                    let builder = PathMismatchBuilder::default();
    2188                    let builder = builder.maybe_add(
    2189                        Some(&req).map(|m| &m.resource).map(|s| s.as_str()),
    2190                        &[
    2191                            Segment::Literal("projects/"),
    2192                            Segment::SingleWildcard,
    2193                            Segment::Literal("/schemas/"),
    2194                            Segment::SingleWildcard,
    2195                        ],
    2196                        "resource",
    2197                        "projects/*/schemas/*",
    2198                    );
    2199                    paths.push(builder.build());
    2200                }
    2201                gax::error::Error::binding(BindingError { paths })
    2202            })??;
    2203        let options = gax::options::internal::set_default_idempotency(
    2204            options,
    2205            gaxi::http::default_idempotency(&method),
    2206        );
    2207        let builder = builder.query(&[("$alt", "json;enum-encoding=int")]).header(
    2208            "x-goog-api-client",
    2209            reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER),
    2210        );
    2211        let body = gaxi::http::handle_empty(None::<gaxi::http::NoBody>, &method);
    2212        self.inner.execute(builder, body, options).await
    2213    }
    2214
    2215    async fn test_iam_permissions(
    2216        &self,
    2217        req: iam_v1::model::TestIamPermissionsRequest,
    2218        options: gax::options::RequestOptions,
    2219    ) -> Result<gax::response::Response<iam_v1::model::TestIamPermissionsResponse>> {
    2220        use gax::error::binding::BindingError;
    2221        use gaxi::path_parameter::PathMismatchBuilder;
    2222        use gaxi::path_parameter::try_match;
    2223        use gaxi::routing_parameter::Segment;
    2224        let (builder, method) = None
    2225            .or_else(|| {
    2226                let path = format!(
    2227                    "/v1/{}:testIamPermissions",
    2228                    try_match(
    2229                        Some(&req).map(|m| &m.resource).map(|s| s.as_str()),
    2230                        &[
    2231                            Segment::Literal("projects/"),
    2232                            Segment::SingleWildcard,
    2233                            Segment::Literal("/subscriptions/"),
    2234                            Segment::SingleWildcard
    2235                        ]
    2236                    )?,
    2237                );
    2238
    2239                let builder = self.inner.builder(reqwest::Method::POST, path);
    2240                let builder = Ok(builder);
    2241                Some(builder.map(|b| (b, reqwest::Method::POST)))
    2242            })
    2243            .or_else(|| {
    2244                let path = format!(
    2245                    "/v1/{}:testIamPermissions",
    2246                    try_match(
    2247                        Some(&req).map(|m| &m.resource).map(|s| s.as_str()),
    2248                        &[
    2249                            Segment::Literal("projects/"),
    2250                            Segment::SingleWildcard,
    2251                            Segment::Literal("/topics/"),
    2252                            Segment::SingleWildcard
    2253                        ]
    2254                    )?,
    2255                );
    2256
    2257                let builder = self.inner.builder(reqwest::Method::POST, path);
    2258                let builder = Ok(builder);
    2259                Some(builder.map(|b| (b, reqwest::Method::POST)))
    2260            })
    2261            .or_else(|| {
    2262                let path = format!(
    2263                    "/v1/{}:testIamPermissions",
    2264                    try_match(
    2265                        Some(&req).map(|m| &m.resource).map(|s| s.as_str()),
    2266                        &[
    2267                            Segment::Literal("projects/"),
    2268                            Segment::SingleWildcard,
    2269                            Segment::Literal("/snapshots/"),
    2270                            Segment::SingleWildcard
    2271                        ]
    2272                    )?,
    2273                );
    2274
    2275                let builder = self.inner.builder(reqwest::Method::POST, path);
    2276                let builder = Ok(builder);
    2277                Some(builder.map(|b| (b, reqwest::Method::POST)))
    2278            })
    2279            .or_else(|| {
    2280                let path = format!(
    2281                    "/v1/{}:testIamPermissions",
    2282                    try_match(
    2283                        Some(&req).map(|m| &m.resource).map(|s| s.as_str()),
    2284                        &[
    2285                            Segment::Literal("projects/"),
    2286                            Segment::SingleWildcard,
    2287                            Segment::Literal("/schemas/"),
    2288                            Segment::SingleWildcard
    2289                        ]
    2290                    )?,
    2291                );
    2292
    2293                let builder = self.inner.builder(reqwest::Method::POST, path);
    2294                let builder = Ok(builder);
    2295                Some(builder.map(|b| (b, reqwest::Method::POST)))
    2296            })
    2297            .ok_or_else(|| {
    2298                let mut paths = Vec::new();
    2299                {
    2300                    let builder = PathMismatchBuilder::default();
    2301                    let builder = builder.maybe_add(
    2302                        Some(&req).map(|m| &m.resource).map(|s| s.as_str()),
    2303                        &[
    2304                            Segment::Literal("projects/"),
    2305                            Segment::SingleWildcard,
    2306                            Segment::Literal("/subscriptions/"),
    2307                            Segment::SingleWildcard,
    2308                        ],
    2309                        "resource",
    2310                        "projects/*/subscriptions/*",
    2311                    );
    2312                    paths.push(builder.build());
    2313                }
    2314                {
    2315                    let builder = PathMismatchBuilder::default();
    2316                    let builder = builder.maybe_add(
    2317                        Some(&req).map(|m| &m.resource).map(|s| s.as_str()),
    2318                        &[
    2319                            Segment::Literal("projects/"),
    2320                            Segment::SingleWildcard,
    2321                            Segment::Literal("/topics/"),
    2322                            Segment::SingleWildcard,
    2323                        ],
    2324                        "resource",
    2325                        "projects/*/topics/*",
    2326                    );
    2327                    paths.push(builder.build());
    2328                }
    2329                {
    2330                    let builder = PathMismatchBuilder::default();
    2331                    let builder = builder.maybe_add(
    2332                        Some(&req).map(|m| &m.resource).map(|s| s.as_str()),
    2333                        &[
    2334                            Segment::Literal("projects/"),
    2335                            Segment::SingleWildcard,
    2336                            Segment::Literal("/snapshots/"),
    2337                            Segment::SingleWildcard,
    2338                        ],
    2339                        "resource",
    2340                        "projects/*/snapshots/*",
    2341                    );
    2342                    paths.push(builder.build());
    2343                }
    2344                {
    2345                    let builder = PathMismatchBuilder::default();
    2346                    let builder = builder.maybe_add(
    2347                        Some(&req).map(|m| &m.resource).map(|s| s.as_str()),
    2348                        &[
    2349                            Segment::Literal("projects/"),
    2350                            Segment::SingleWildcard,
    2351                            Segment::Literal("/schemas/"),
    2352                            Segment::SingleWildcard,
    2353                        ],
    2354                        "resource",
    2355                        "projects/*/schemas/*",
    2356                    );
    2357                    paths.push(builder.build());
    2358                }
    2359                gax::error::Error::binding(BindingError { paths })
    2360            })??;
    2361        let options = gax::options::internal::set_default_idempotency(
    2362            options,
    2363            gaxi::http::default_idempotency(&method),
    2364        );
    2365        let builder = builder.query(&[("$alt", "json;enum-encoding=int")]).header(
    2366            "x-goog-api-client",
    2367            reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER),
    2368        );
    2369        let body = gaxi::http::handle_empty(Some(req), &method);
    2370        self.inner.execute(builder, body, options).await
    2371    }
    2372}