forked from googleapis/google-cloud-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(discoveryengine): generate library (googleapis#12505)
PiperOrigin-RevId: 534896621
- Loading branch information
Showing
168 changed files
with
14,629 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,7 @@ datastream | |
deploy | ||
dialogflow_cx | ||
dialogflow_es | ||
discoveryengine | ||
dlp | ||
documentai | ||
domains | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
@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:http_proto | ||
@com_google_googleapis//google/api:httpbody_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 | ||
@com_google_googleapis//google/type:date_proto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
@com_google_googleapis//google/cloud/discoveryengine/v1:common.proto | ||
@com_google_googleapis//google/cloud/discoveryengine/v1:completion_service.proto | ||
@com_google_googleapis//google/cloud/discoveryengine/v1:document.proto | ||
@com_google_googleapis//google/cloud/discoveryengine/v1:document_service.proto | ||
@com_google_googleapis//google/cloud/discoveryengine/v1:import_config.proto | ||
@com_google_googleapis//google/cloud/discoveryengine/v1:purge_config.proto | ||
@com_google_googleapis//google/cloud/discoveryengine/v1:schema.proto | ||
@com_google_googleapis//google/cloud/discoveryengine/v1:schema_service.proto | ||
@com_google_googleapis//google/cloud/discoveryengine/v1:search_service.proto | ||
@com_google_googleapis//google/cloud/discoveryengine/v1:user_event.proto | ||
@com_google_googleapis//google/cloud/discoveryengine/v1:user_event_service.proto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# Copyright 2023 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. | ||
|
||
package(default_visibility = ["//visibility:private"]) | ||
|
||
licenses(["notice"]) # Apache 2.0 | ||
|
||
service_dirs = ["v1/"] | ||
|
||
src_dirs = service_dirs + [d + "internal/" for d in service_dirs] | ||
|
||
filegroup( | ||
name = "srcs", | ||
srcs = glob([d + "*.cc" for d in src_dirs]), | ||
) | ||
|
||
filegroup( | ||
name = "hdrs", | ||
srcs = glob([d + "*.h" for d in src_dirs]), | ||
) | ||
|
||
filegroup( | ||
name = "mocks", | ||
srcs = glob([d + "mocks/*.h" for d in service_dirs]), | ||
) | ||
|
||
cc_library( | ||
name = "google_cloud_cpp_discoveryengine", | ||
srcs = [":srcs"], | ||
hdrs = [":hdrs"], | ||
visibility = ["//:__pkg__"], | ||
deps = [ | ||
"//:common", | ||
"//:grpc_utils", | ||
"@com_google_googleapis//google/cloud/discoveryengine/v1:discoveryengine_cc_grpc", | ||
], | ||
) | ||
|
||
cc_library( | ||
name = "google_cloud_cpp_discoveryengine_mocks", | ||
hdrs = [":mocks"], | ||
visibility = ["//:__pkg__"], | ||
deps = [ | ||
":google_cloud_cpp_discoveryengine", | ||
"@com_google_googletest//:gtest", | ||
], | ||
) | ||
|
||
[cc_test( | ||
name = sample.replace("/", "_").replace(".cc", ""), | ||
srcs = [sample], | ||
tags = ["integration-test"], | ||
deps = [ | ||
"//:discoveryengine", | ||
"//google/cloud/testing_util:google_cloud_cpp_testing_private", | ||
], | ||
) for sample in glob([d + "samples/*.cc" for d in service_dirs])] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# ~~~ | ||
# Copyright 2023 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) | ||
|
||
set(GOOGLE_CLOUD_CPP_SERVICE_DIRS "v1/") | ||
|
||
google_cloud_cpp_add_ga_grpc_library(discoveryengine "Discovery Engine API") | ||
|
||
if (BUILD_TESTING AND GOOGLE_CLOUD_CPP_ENABLE_CXX_EXCEPTIONS) | ||
add_executable(discoveryengine_quickstart "quickstart/quickstart.cc") | ||
target_link_libraries(discoveryengine_quickstart | ||
PRIVATE google-cloud-cpp::discoveryengine) | ||
google_cloud_cpp_add_common_options(discoveryengine_quickstart) | ||
add_test( | ||
NAME discoveryengine_quickstart | ||
COMMAND cmake -P "${PROJECT_SOURCE_DIR}/cmake/quickstart-runner.cmake" | ||
$<TARGET_FILE:discoveryengine_quickstart> GOOGLE_CLOUD_PROJECT) | ||
set_tests_properties(discoveryengine_quickstart | ||
PROPERTIES LABELS "integration-test;quickstart") | ||
endif () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Discovery Engine API C++ Client Library | ||
|
||
This directory contains an idiomatic C++ client library for the | ||
[Discovery Engine API][cloud-service-docs], a service that powers high-quality | ||
content recommendations on your digital properties. | ||
|
||
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/discoveryengine/v1/document_client.h" | ||
#include <iostream> | ||
|
||
int main(int argc, char* argv[]) try { | ||
if (argc != 2) { | ||
std::cerr << "Usage: " << argv[0] << " project-id\n"; | ||
return 1; | ||
} | ||
|
||
namespace discoveryengine = ::google::cloud::discoveryengine_v1; | ||
auto client = discoveryengine::DocumentServiceClient( | ||
discoveryengine::MakeDocumentServiceConnection()); | ||
|
||
auto const parent = std::string{"projects/"} + argv[1] + "/locations/global" + | ||
"/dataStores/default_data_store/branches/default_branch"; | ||
for (auto d : client.ListDocuments(parent)) { | ||
if (!d) throw std::move(d).status(); | ||
std::cout << d->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 [Discovery Engine 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/discovery-engine | ||
[doxygen-link]: https://cloud.google.com/cpp/docs/reference/discoveryengine/latest/ | ||
[source-link]: /~https://github.com/googleapis/google-cloud-cpp/tree/main/google/cloud/discoveryengine |
66 changes: 66 additions & 0 deletions
66
google/cloud/discoveryengine/doc/environment-variables.dox
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/*! | ||
|
||
@page discoveryengine-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 discoveryengine-env-endpoint Endpoint Overrides | ||
|
||
<!-- inject-endpoint-env-vars-start --> | ||
|
||
- `GOOGLE_CLOUD_CPP_COMPLETION_SERVICE_ENDPOINT=...` overrides the | ||
`EndpointOption` (which defaults to "discoveryengine.googleapis.com") | ||
used by `MakeCompletionServiceConnection()`. | ||
|
||
- `GOOGLE_CLOUD_CPP_DOCUMENT_SERVICE_ENDPOINT=...` overrides the | ||
`EndpointOption` (which defaults to "discoveryengine.googleapis.com") | ||
used by `MakeDocumentServiceConnection()`. | ||
|
||
- `GOOGLE_CLOUD_CPP_SCHEMA_SERVICE_ENDPOINT=...` overrides the | ||
`EndpointOption` (which defaults to "discoveryengine.googleapis.com") | ||
used by `MakeSchemaServiceConnection()`. | ||
|
||
- `GOOGLE_CLOUD_CPP_SEARCH_SERVICE_ENDPOINT=...` overrides the | ||
`EndpointOption` (which defaults to "discoveryengine.googleapis.com") | ||
used by `MakeSearchServiceConnection()`. | ||
|
||
- `GOOGLE_CLOUD_CPP_USER_EVENT_SERVICE_ENDPOINT=...` overrides the | ||
`EndpointOption` (which defaults to "discoveryengine.googleapis.com") | ||
used by `MakeUserEventServiceConnection()`. | ||
|
||
<!-- inject-endpoint-env-vars-end --> | ||
|
||
@see google::cloud::EndpointOption | ||
|
||
@section discoveryengine-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::TracingComponentsOption | ||
|
||
`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 discoveryengine-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. | ||
|
||
*/ |
Oops, something went wrong.