Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(developerconnect): generate library #14278

Merged
merged 7 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ breaking changes in the upcoming 3.x release. This release is scheduled for
We are happy to announce the following GA libraries. Unless specifically noted,
the APIs in these libraries are stable, and are ready for production use.

- [Developer Connect API](/google/cloud/developerconnect/README.md)
- [Privileged Access Manager API](/google/cloud/privilegedaccessmanager/README.md)

The following experimental libraries are now available:
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,9 @@ See each library's `README.md` file for more information about:
- [Google Cloud Deploy API](google/cloud/deploy/README.md)
[\[quickstart\]](google/cloud/deploy/quickstart/README.md)
[\[reference\]](https://cloud.google.com/cpp/docs/reference/deploy/latest)
- [Developer Connect API](google/cloud/developerconnect/README.md)
[\[quickstart\]](google/cloud/developerconnect/quickstart/README.md)
[\[reference\]](https://cloud.google.com/cpp/docs/reference/developerconnect/latest)
- [Dialogflow CX API](google/cloud/dialogflow_cx/README.md)
[\[quickstart\]](google/cloud/dialogflow_cx/quickstart/README.md)
[\[reference\]](https://cloud.google.com/cpp/docs/reference/dialogflow_cx/latest)
Expand Down
Binary file not shown.
6 changes: 6 additions & 0 deletions ci/etc/expected_install_directories
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,10 @@
./include/google/cloud/deploy/v1
./include/google/cloud/deploy/v1/internal
./include/google/cloud/deploy/v1/mocks
./include/google/cloud/developerconnect
./include/google/cloud/developerconnect/v1
./include/google/cloud/developerconnect/v1/internal
./include/google/cloud/developerconnect/v1/mocks
./include/google/cloud/dialogflow
./include/google/cloud/dialogflow/cx
./include/google/cloud/dialogflow/cx/v3
Expand Down Expand Up @@ -1334,6 +1338,8 @@
./lib64/cmake/google_cloud_cpp_datastream_mocks
./lib64/cmake/google_cloud_cpp_deploy
./lib64/cmake/google_cloud_cpp_deploy_mocks
./lib64/cmake/google_cloud_cpp_developerconnect
./lib64/cmake/google_cloud_cpp_developerconnect_mocks
./lib64/cmake/google_cloud_cpp_dialogflow_cx
./lib64/cmake/google_cloud_cpp_dialogflow_cx_mocks
./lib64/cmake/google_cloud_cpp_dialogflow_es
Expand Down
1 change: 1 addition & 0 deletions cmake/GoogleCloudCppFeatures.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ set(GOOGLE_CLOUD_CPP_GA_LIBRARIES
"datastore"
"datastream"
"deploy"
"developerconnect"
"dialogflow_cx"
"dialogflow_es"
"discoveryengine"
Expand Down
9 changes: 9 additions & 0 deletions external/googleapis/protodeps/developerconnect.deps
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@com_google_googleapis//google/api:annotations_proto
@com_google_googleapis//google/api:client_proto
@com_google_googleapis//google/api:field_behavior_proto
@com_google_googleapis//google/api:field_info_proto
@com_google_googleapis//google/api:http_proto
@com_google_googleapis//google/api:launch_stage_proto
@com_google_googleapis//google/api:resource_proto
@com_google_googleapis//google/longrunning:operations_proto
@com_google_googleapis//google/rpc:status_proto
1 change: 1 addition & 0 deletions external/googleapis/protolists/developerconnect.list
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@com_google_googleapis//google/cloud/developerconnect/v1:developer_connect.proto
1 change: 1 addition & 0 deletions external/googleapis/update_libraries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ declare -A -r LIBRARIES=(
)"
["datastream"]="@com_google_googleapis//google/cloud/datastream/v1:datastream_cc_grpc"
["deploy"]="@com_google_googleapis//google/cloud/deploy/v1:deploy_cc_grpc"
["developerconnect"]="@com_google_googleapis//google/cloud/developerconnect/v1:developerconnect_cc_grpc"
["dialogflow_es"]="@com_google_googleapis//google/cloud/dialogflow/v2:dialogflow_cc_grpc"
["dialogflow_cx"]="@com_google_googleapis//google/cloud/dialogflow/cx/v3:cx_cc_grpc"
["discoveryengine"]="@com_google_googleapis//google/cloud/discoveryengine/v1:discoveryengine_cc_grpc"
Expand Down
8 changes: 8 additions & 0 deletions generator/generator_config.textproto
Original file line number Diff line number Diff line change
Expand Up @@ -1969,6 +1969,14 @@ service {
retryable_status_codes: ["kUnavailable"]
}

# Developer Connect
service {
service_proto_path: "google/cloud/developerconnect/v1/developer_connect.proto"
product_path: "google/cloud/developerconnect/v1"
initial_copyright_year: "2024"
retryable_status_codes: ["kUnavailable"]
}

# Dialogflow CX
service {
service_proto_path: "google/cloud/dialogflow/cx/v3/environment.proto"
Expand Down
31 changes: 31 additions & 0 deletions google/cloud/developerconnect/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright 2024 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.

load("@google_cloud_cpp//bazel:gapic.bzl", "cc_gapic_library")

package(default_visibility = ["//visibility:private"])

licenses(["notice"]) # Apache 2.0

service_dirs = ["v1/"]

googleapis_deps = [
"@com_google_googleapis//google/cloud/developerconnect/v1:developerconnect_cc_grpc",
]

cc_gapic_library(
name = "developerconnect",
googleapis_deps = googleapis_deps,
service_dirs = service_dirs,
)
33 changes: 33 additions & 0 deletions google/cloud/developerconnect/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# ~~~
# Copyright 2024 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.
# ~~~

include(GoogleCloudCppLibrary)

google_cloud_cpp_add_gapic_library(developerconnect "Developer Connect API"
SERVICE_DIRS "v1/")

if (BUILD_TESTING AND GOOGLE_CLOUD_CPP_ENABLE_CXX_EXCEPTIONS)
add_executable(developerconnect_quickstart "quickstart/quickstart.cc")
target_link_libraries(developerconnect_quickstart
PRIVATE google-cloud-cpp::developerconnect)
google_cloud_cpp_add_common_options(developerconnect_quickstart)
add_test(
NAME developerconnect_quickstart
COMMAND cmake -P "${PROJECT_SOURCE_DIR}/cmake/quickstart-runner.cmake"
$<TARGET_FILE:developerconnect_quickstart> GOOGLE_CLOUD_PROJECT)
set_tests_properties(developerconnect_quickstart
PROPERTIES LABELS "integration-test;quickstart")
endif ()
61 changes: 61 additions & 0 deletions google/cloud/developerconnect/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Developer Connect API C++ Client Library

This directory contains an idiomatic C++ client library for the
[Developer Connect API][cloud-service-docs].

Connect third-party source code management to Google

While this library is **GA**, please note that the Google Cloud C++ client
libraries do **not** follow [Semantic Versioning](https://semver.org/).

## Quickstart

The [quickstart/](quickstart/README.md) directory contains a minimal environment
to get started using this client library in a larger project. The following
"Hello World" program is used in this quickstart, and should give you a taste of
this library.

<!-- inject-quickstart-start -->

```cc
#include "google/cloud/developerconnect/v1/developer_connect_client.h"
#include "google/cloud/location.h"
#include <iostream>

int main(int argc, char* argv[]) try {
if (argc != 2) {
std::cerr << "Usage: " << argv[0] << " project-id\n";
return 1;
}

auto const location = google::cloud::Location(argv[1], "global");

namespace developerconnect = ::google::cloud::developerconnect_v1;
auto client = developerconnect::DeveloperConnectClient(
developerconnect::MakeDeveloperConnectConnection());

for (auto c : client.ListConnections(location.FullName())) {
if (!c) throw std::move(c).status();
std::cout << c->DebugString() << "\n";
}

return 0;
} catch (google::cloud::Status const& status) {
std::cerr << "google::cloud::Status thrown: " << status << "\n";
return 1;
}
```

<!-- inject-quickstart-end -->

## More Information

- Official documentation about the [Developer Connect API][cloud-service-docs]
service
- [Reference doxygen documentation][doxygen-link] for each release of this
client library
- Detailed header comments in our [public `.h`][source-link] files

[cloud-service-docs]: https://cloud.google.com/developer-connect/docs/overview
[doxygen-link]: https://cloud.google.com/cpp/docs/reference/developerconnect/latest/
[source-link]: https://github.com/googleapis/google-cloud-cpp/tree/main/google/cloud/developerconnect
50 changes: 50 additions & 0 deletions google/cloud/developerconnect/doc/environment-variables.dox
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*!

@page developerconnect-env Environment Variables

A number of environment variables can be used to configure the behavior of
the library. There are also functions to configure this behavior in code. The
environment variables are convenient when troubleshooting problems.

@section developerconnect-env-endpoint Endpoint Overrides

<!-- inject-endpoint-env-vars-start -->

- `GOOGLE_CLOUD_CPP_DEVELOPER_CONNECT_ENDPOINT=...` overrides the
`EndpointOption` (which defaults to "developerconnect.googleapis.com")
used by `MakeDeveloperConnectConnection()`.

<!-- inject-endpoint-env-vars-end -->

@see google::cloud::EndpointOption

@section developerconnect-env-logging Logging

`GOOGLE_CLOUD_CPP_ENABLE_TRACING=rpc`: turns on tracing for most gRPC
calls. The library injects an additional Stub decorator that prints each gRPC
request and response. Unless you have configured your own logging backend,
you should also set `GOOGLE_CLOUD_CPP_ENABLE_CLOG` to produce any output on
the program's console.

@see google::cloud::LoggingComponentsOption

`GOOGLE_CLOUD_CPP_TRACING_OPTIONS=...`: modifies the behavior of gRPC tracing,
including whether messages will be output on multiple lines, or whether
string/bytes fields will be truncated.

@see google::cloud::GrpcTracingOptionsOption

`GOOGLE_CLOUD_CPP_ENABLE_CLOG=yes`: turns on logging in the library, basically
the library always "logs" but the logging infrastructure has no backend to
actually print anything until the application sets a backend or they set this
environment variable.

@see google::cloud::LogBackend
@see google::cloud::LogSink

@section developerconnect-env-project Setting the Default Project

`GOOGLE_CLOUD_PROJECT=...`: is used in examples and integration tests to
configure the GCP project. This has no effect in the library.

*/
47 changes: 47 additions & 0 deletions google/cloud/developerconnect/doc/main.dox
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*!

@mainpage Developer Connect API C++ Client Library

An idiomatic C++ client library for the [Developer Connect API][cloud-service-docs].

Connect third-party source code management to Google

While this library is **GA**, please note that the Google Cloud C++ client libraries do **not** follow
[Semantic Versioning](https://semver.org/).

@tableofcontents{HTML:2}

## Quickstart

The following shows the code that you'll run in the
`google/cloud/developerconnect/quickstart/` directory,
which should give you a taste of the Developer Connect API C++ client library API.

@snippet quickstart.cc all

## Main classes

<!-- inject-client-list-start -->
The main class in this library is
[`developerconnect_v1::DeveloperConnectClient`](@ref google::cloud::developerconnect_v1::DeveloperConnectClient). All RPCs are exposed
as member functions of this class. Other classes provide helpers, configuration
parameters, and infrastructure to mock
[`developerconnect_v1::DeveloperConnectClient`](@ref google::cloud::developerconnect_v1::DeveloperConnectClient) when testing your
application.
<!-- inject-client-list-end -->

## More Information

- @ref common-error-handling - describes how the library reports errors.
- @ref developerconnect-override-endpoint - describes how to override the default
endpoint.
- @ref developerconnect-override-authentication - describes how to change the
authentication credentials used by the library.
- @ref developerconnect-override-retry - describes how to change the default retry
policies.
- @ref developerconnect-env - describes environment variables that can configure the
behavior of the library.

[cloud-service-docs]: https://cloud.google.com/developer-connect/docs/overview

*/
10 changes: 10 additions & 0 deletions google/cloud/developerconnect/doc/options.dox
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*!
@defgroup google-cloud-developerconnect-options Developer Connect API Configuration Options

This library uses the same mechanism (`google::cloud::Options`) and the common
[options](@ref options) as all other C++ client libraries for its configuration.
Some `*Option` classes, which are only used in this library, are documented in
this page.

@see @ref options - for an overview of client library configuration.
*/
35 changes: 35 additions & 0 deletions google/cloud/developerconnect/doc/override-authentication.dox
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*!
@page developerconnect-override-authentication How to Override the Authentication Credentials

Unless otherwise configured, the client libraries use
[Application Default Credentials] to authenticate with Google Cloud Services.
While this works for most applications, in some cases you may need to override
this default. You can do so by providing the
[UnifiedCredentialsOption](@ref google::cloud::UnifiedCredentialsOption)
The following example shows how to explicitly load a service account key file:

<!-- inject-service-account-snippet-start -->
@snippet developer_connect_client_samples.cc with-service-account

<!-- inject-service-account-snippet-end -->

Keep in mind that we chose this as an example because it is relatively easy to
understand. Consult the [Best practices for managing service account keys]
guide for more details.

@see @ref guac - for more information on the factory functions to create
`google::cloud::Credentials` objects.

[Best practices for managing service account keys]: https://cloud.google.com/iam/docs/best-practices-for-managing-service-account-keys
[Application Default Credentials]: https://cloud.google.com/docs/authentication#adc

*/

// <!-- inject-authentication-pages-start -->

/*! @page developerconnect_v1::DeveloperConnectClient-service-account-snippet Override developerconnect_v1::DeveloperConnectClient Authentication Defaults

@snippet google/cloud/developerconnect/v1/samples/developer_connect_client_samples.cc with-service-account

*/
// <!-- inject-authentication-pages-end -->
25 changes: 25 additions & 0 deletions google/cloud/developerconnect/doc/override-endpoint.dox
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*!
@page developerconnect-override-endpoint How to Override the Default Endpoint

In some cases, you may need to override the default endpoint used by the client
library. Use the
[EndpointOption](@ref google::cloud::EndpointOption) when initializing the
client library to change this default.

<!-- inject-endpoint-snippet-start -->
For example, this will override the default endpoint for `developerconnect_v1::DeveloperConnectClient`:

@snippet developer_connect_client_samples.cc set-client-endpoint

<!-- inject-endpoint-snippet-end -->

*/

// <!-- inject-endpoint-pages-start -->

/*! @page developerconnect_v1::DeveloperConnectClient-endpoint-snippet Override developerconnect_v1::DeveloperConnectClient Endpoint Configuration

@snippet google/cloud/developerconnect/v1/samples/developer_connect_client_samples.cc set-client-endpoint

*/
// <!-- inject-endpoint-pages-end -->
Loading
Loading