@@ -109,12 +109,11 @@ void SetClientUniverseDomain(std::vector<std::string> const& argv) {
109109 // in the provided Options for the Universe Domain associated with the
110110 // credentials and adds it to the set of Options.
111111 // If no UnifiedCredentialsOption is set, GoogleDefaultCredentials are used.
112- ud_options = google::cloud::AddUniverseDomainOption(std::move(options));
112+ auto ud_options = google::cloud::AddUniverseDomainOption(std::move(options));
113113
114114 if (!ud_options.ok()) throw std::move(ud_options).status();
115115 auto ud_client = google::cloud::$product_namespace$::$client_class_name$(
116- google::cloud::$product_namespace$::Make$connection_class_name$(ud_options));
117-
116+ google::cloud::$product_namespace$::Make$connection_class_name$(*ud_options));
118117 //! [set-client-universe-domain]
119118}
120119)""" );
@@ -137,6 +136,7 @@ Status SampleGenerator::GenerateHeader() {
137136 vars (" idempotency_policy_header_path" ),
138137 " google/cloud/common_options.h" ,
139138 " google/cloud/credentials.h" ,
139+ " google/cloud/universe_domain.h" ,
140140 HasLongrunningMethod () ? " google/cloud/polling_policy.h" : " " ,
141141 " google/cloud/internal/getenv.h" ,
142142 " google/cloud/testing_util/example_driver.h" ,
@@ -374,6 +374,9 @@ void AutoRun(std::vector<std::string> const& argv) {
374374 HeaderPrint (R"""(
375375 std::cout << "\nRunning WithServiceAccount() example" << std::endl;
376376 WithServiceAccount({keyfile});
377+
378+ std::cout << "\nRunning SetClientUniverseDomain() example" << std::endl;
379+ SetClientUniverseDomain({});
377380}
378381
379382} // namespace
@@ -388,6 +391,7 @@ int main(int argc, char* argv[]) { // NOLINT(bugprone-exception-escape)
388391 )""" );
389392 }
390393 HeaderPrint (R"""( {"with-service-account", WithServiceAccount},
394+ {"set-client-universe-domain", SetClientUniverseDomain},
391395 {"auto", AutoRun},
392396 });
393397 return example.Run(argc, argv);
0 commit comments