google-cloud-cpp icon indicating copy to clipboard operation
google-cloud-cpp copied to clipboard

Helper function for regional endpoints

Open coryan opened this issue 3 years ago • 2 comments

We need a helper function (for a future PR), something like:

namespace google::cloud::dataproc {
gc::Options WithRegionalEndpoint(Options options, std::string const& region);
}

Originally posted by @coryan in https://github.com/googleapis/google-cloud-cpp/pull/8231#discussion_r799474901

coryan avatar Feb 04 '22 13:02 coryan

Could this make use of the new generator support for ServiceConfiguration.EndpointLocationStyle?

devbww avatar Aug 11 '22 03:08 devbww

Could this make use of the new generator support for ServiceConfiguration.EndpointLocationStyle?

Probably. How would the code for this dataproc/quickstart would look like?

coryan avatar Aug 11 '22 12:08 coryan

Could this make use of the new generator support for ServiceConfiguration.EndpointLocationStyle?

Probably. How would the code for this dataproc/quickstart would look like?

I guess the strawman would be something like ...

  auto client = dataproc::ClusterControllerClient(
      dataproc::MakeClusterControllerConnection(
          region == "global" ? "" : region, options));

Alternatively, if we just used region == "" to mean the global endpoint, it could just be ...

  auto client = dataproc::ClusterControllerClient(
      dataproc::MakeClusterControllerConnection(region, options));

devbww avatar Aug 23 '22 17:08 devbww

I think the first option is more explicit and we should go with it.

coryan avatar Aug 23 '22 19:08 coryan