Skip to content

Commit

Permalink
Generate samples
Browse files Browse the repository at this point in the history
  • Loading branch information
coryan committed Oct 28, 2022
1 parent 9015b1f commit 4269017
Show file tree
Hide file tree
Showing 197 changed files with 11,664 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Generated by the Codegen C++ plugin.
// If you make any local changes, they will be lost.
// source: google/cloud/accessapproval/v1/accessapproval.proto

#include "google/cloud/accessapproval/access_approval_client.h"
#include "google/cloud/common_options.h"
#include "google/cloud/testing_util/example_driver.h"
#include <iostream>
#include <string>
#include <vector>

namespace {

void SetClientEndpoint(std::vector<std::string> const& argv) {
if (!argv.empty()) {
throw google::cloud::testing_util::Usage{"set-client-endpoint"};
}
//! [set-client-endpoint]
// This configuration is common with Private Google Access:
// https://cloud.google.com/vpc/docs/private-google-access
auto options = google::cloud::Options{}.set<google::cloud::EndpointOption>(
"private.googleapis.com");
auto client = google::cloud::accessapproval::AccessApprovalClient(
google::cloud::accessapproval::MakeAccessApprovalConnection(options));
// Use the `client` object as usual
//! [set-client-endpoint]
}

// main-dox-marker: AccessApprovalClient
void AutoRun(std::vector<std::string> const& argv) {
if (!argv.empty()) throw google::cloud::testing_util::Usage{"auto"};

std::cout << "\nRunning SetClientEndpoint() example" << std::endl;
SetClientEndpoint({});
}

} // namespace

int main(int argc, char* argv[]) { // NOLINT(bugprone-exception-escape)
google::cloud::testing_util::Example example({
{"set-client-endpoint", SetClientEndpoint},
{"auto", AutoRun},
});
return example.Run(argc, argv);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Generated by the Codegen C++ plugin.
// If you make any local changes, they will be lost.
// source: google/identity/accesscontextmanager/v1/access_context_manager.proto

#include "google/cloud/accesscontextmanager/access_context_manager_client.h"
#include "google/cloud/common_options.h"
#include "google/cloud/testing_util/example_driver.h"
#include <iostream>
#include <string>
#include <vector>

namespace {

void SetClientEndpoint(std::vector<std::string> const& argv) {
if (!argv.empty()) {
throw google::cloud::testing_util::Usage{"set-client-endpoint"};
}
//! [set-client-endpoint]
// This configuration is common with Private Google Access:
// https://cloud.google.com/vpc/docs/private-google-access
auto options = google::cloud::Options{}.set<google::cloud::EndpointOption>(
"private.googleapis.com");
auto client = google::cloud::accesscontextmanager::AccessContextManagerClient(
google::cloud::accesscontextmanager::MakeAccessContextManagerConnection(
options));
// Use the `client` object as usual
//! [set-client-endpoint]
}

// main-dox-marker: AccessContextManagerClient
void AutoRun(std::vector<std::string> const& argv) {
if (!argv.empty()) throw google::cloud::testing_util::Usage{"auto"};

std::cout << "\nRunning SetClientEndpoint() example" << std::endl;
SetClientEndpoint({});
}

} // namespace

int main(int argc, char* argv[]) { // NOLINT(bugprone-exception-escape)
google::cloud::testing_util::Example example({
{"set-client-endpoint", SetClientEndpoint},
{"auto", AutoRun},
});
return example.Run(argc, argv);
}
59 changes: 59 additions & 0 deletions google/cloud/apigateway/samples/api_gateway_client_samples.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Generated by the Codegen C++ plugin.
// If you make any local changes, they will be lost.
// source: google/cloud/apigateway/v1/apigateway_service.proto

#include "google/cloud/apigateway/api_gateway_client.h"
#include "google/cloud/common_options.h"
#include "google/cloud/testing_util/example_driver.h"
#include <iostream>
#include <string>
#include <vector>

namespace {

void SetClientEndpoint(std::vector<std::string> const& argv) {
if (!argv.empty()) {
throw google::cloud::testing_util::Usage{"set-client-endpoint"};
}
//! [set-client-endpoint]
// This configuration is common with Private Google Access:
// https://cloud.google.com/vpc/docs/private-google-access
auto options = google::cloud::Options{}.set<google::cloud::EndpointOption>(
"private.googleapis.com");
auto client = google::cloud::apigateway::ApiGatewayServiceClient(
google::cloud::apigateway::MakeApiGatewayServiceConnection(options));
// Use the `client` object as usual
//! [set-client-endpoint]
}

// main-dox-marker: ApiGatewayServiceClient
void AutoRun(std::vector<std::string> const& argv) {
if (!argv.empty()) throw google::cloud::testing_util::Usage{"auto"};

std::cout << "\nRunning SetClientEndpoint() example" << std::endl;
SetClientEndpoint({});
}

} // namespace

int main(int argc, char* argv[]) { // NOLINT(bugprone-exception-escape)
google::cloud::testing_util::Example example({
{"set-client-endpoint", SetClientEndpoint},
{"auto", AutoRun},
});
return example.Run(argc, argv);
}
59 changes: 59 additions & 0 deletions google/cloud/apigeeconnect/samples/connection_client_samples.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Generated by the Codegen C++ plugin.
// If you make any local changes, they will be lost.
// source: google/cloud/apigeeconnect/v1/connection.proto

#include "google/cloud/apigeeconnect/connection_client.h"
#include "google/cloud/common_options.h"
#include "google/cloud/testing_util/example_driver.h"
#include <iostream>
#include <string>
#include <vector>

namespace {

void SetClientEndpoint(std::vector<std::string> const& argv) {
if (!argv.empty()) {
throw google::cloud::testing_util::Usage{"set-client-endpoint"};
}
//! [set-client-endpoint]
// This configuration is common with Private Google Access:
// https://cloud.google.com/vpc/docs/private-google-access
auto options = google::cloud::Options{}.set<google::cloud::EndpointOption>(
"private.googleapis.com");
auto client = google::cloud::apigeeconnect::ConnectionServiceClient(
google::cloud::apigeeconnect::MakeConnectionServiceConnection(options));
// Use the `client` object as usual
//! [set-client-endpoint]
}

// main-dox-marker: ConnectionServiceClient
void AutoRun(std::vector<std::string> const& argv) {
if (!argv.empty()) throw google::cloud::testing_util::Usage{"auto"};

std::cout << "\nRunning SetClientEndpoint() example" << std::endl;
SetClientEndpoint({});
}

} // namespace

int main(int argc, char* argv[]) { // NOLINT(bugprone-exception-escape)
google::cloud::testing_util::Example example({
{"set-client-endpoint", SetClientEndpoint},
{"auto", AutoRun},
});
return example.Run(argc, argv);
}
59 changes: 59 additions & 0 deletions google/cloud/apikeys/samples/api_keys_client_samples.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Generated by the Codegen C++ plugin.
// If you make any local changes, they will be lost.
// source: google/api/apikeys/v2/apikeys.proto

#include "google/cloud/apikeys/api_keys_client.h"
#include "google/cloud/common_options.h"
#include "google/cloud/testing_util/example_driver.h"
#include <iostream>
#include <string>
#include <vector>

namespace {

void SetClientEndpoint(std::vector<std::string> const& argv) {
if (!argv.empty()) {
throw google::cloud::testing_util::Usage{"set-client-endpoint"};
}
//! [set-client-endpoint]
// This configuration is common with Private Google Access:
// https://cloud.google.com/vpc/docs/private-google-access
auto options = google::cloud::Options{}.set<google::cloud::EndpointOption>(
"private.googleapis.com");
auto client = google::cloud::apikeys::ApiKeysClient(
google::cloud::apikeys::MakeApiKeysConnection(options));
// Use the `client` object as usual
//! [set-client-endpoint]
}

// main-dox-marker: ApiKeysClient
void AutoRun(std::vector<std::string> const& argv) {
if (!argv.empty()) throw google::cloud::testing_util::Usage{"auto"};

std::cout << "\nRunning SetClientEndpoint() example" << std::endl;
SetClientEndpoint({});
}

} // namespace

int main(int argc, char* argv[]) { // NOLINT(bugprone-exception-escape)
google::cloud::testing_util::Example example({
{"set-client-endpoint", SetClientEndpoint},
{"auto", AutoRun},
});
return example.Run(argc, argv);
}
59 changes: 59 additions & 0 deletions google/cloud/appengine/samples/applications_client_samples.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Generated by the Codegen C++ plugin.
// If you make any local changes, they will be lost.
// source: google/appengine/v1/appengine.proto

#include "google/cloud/appengine/applications_client.h"
#include "google/cloud/common_options.h"
#include "google/cloud/testing_util/example_driver.h"
#include <iostream>
#include <string>
#include <vector>

namespace {

void SetClientEndpoint(std::vector<std::string> const& argv) {
if (!argv.empty()) {
throw google::cloud::testing_util::Usage{"set-client-endpoint"};
}
//! [set-client-endpoint]
// This configuration is common with Private Google Access:
// https://cloud.google.com/vpc/docs/private-google-access
auto options = google::cloud::Options{}.set<google::cloud::EndpointOption>(
"private.googleapis.com");
auto client = google::cloud::appengine::ApplicationsClient(
google::cloud::appengine::MakeApplicationsConnection(options));
// Use the `client` object as usual
//! [set-client-endpoint]
}

// main-dox-marker: ApplicationsClient
void AutoRun(std::vector<std::string> const& argv) {
if (!argv.empty()) throw google::cloud::testing_util::Usage{"auto"};

std::cout << "\nRunning SetClientEndpoint() example" << std::endl;
SetClientEndpoint({});
}

} // namespace

int main(int argc, char* argv[]) { // NOLINT(bugprone-exception-escape)
google::cloud::testing_util::Example example({
{"set-client-endpoint", SetClientEndpoint},
{"auto", AutoRun},
});
return example.Run(argc, argv);
}
Loading

0 comments on commit 4269017

Please sign in to comment.