Skip to content

Commit

Permalink
Manually update READMEs, quickstart, and top-level stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
cuiy0006 committed Oct 25, 2024
1 parent f477100 commit 0b5eaf8
Show file tree
Hide file tree
Showing 42 changed files with 2,096 additions and 1,755 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,9 @@ See each library's `README.md` file for more information about:
- [Cloud OS Login API](google/cloud/oslogin/README.md)
[\[quickstart\]](google/cloud/oslogin/quickstart/README.md)
[\[reference\]](https://cloud.google.com/cpp/docs/reference/oslogin/latest)
- [Parallelstore API](google/cloud/parallelstore/README.md)
[\[quickstart\]](google/cloud/parallelstore/quickstart/README.md)
[\[reference\]](https://cloud.google.com/cpp/docs/reference/parallelstore/latest)
- [Policy Simulator API](google/cloud/policysimulator/README.md)
[\[quickstart\]](google/cloud/policysimulator/quickstart/README.md)
[\[reference\]](https://cloud.google.com/cpp/docs/reference/policysimulator/latest)
Expand Down
1 change: 1 addition & 0 deletions cmake/GoogleCloudCppFeatures.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ set(GOOGLE_CLOUD_CPP_GA_LIBRARIES
"orgpolicy"
"osconfig"
"oslogin"
"parallelstore"
"policysimulator"
"policytroubleshooter"
"privateca"
Expand Down
9 changes: 9 additions & 0 deletions external/googleapis/protodeps/parallelstore.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/parallelstore.list
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@com_google_googleapis//google/cloud/parallelstore/v1:parallelstore.proto
17 changes: 10 additions & 7 deletions google/cloud/parallelstore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
include(GoogleCloudCppLibrary)

google_cloud_cpp_add_gapic_library(parallelstore "Parallelstore API"
SERVICE_DIRS "v1/")
SERVICE_DIRS "v1/")

if (BUILD_TESTING AND GOOGLE_CLOUD_CPP_ENABLE_CXX_EXCEPTIONS)
add_executable(parallelstore_quickstart "quickstart/quickstart.cc")
Expand All @@ -26,10 +26,13 @@ if (BUILD_TESTING AND GOOGLE_CLOUD_CPP_ENABLE_CXX_EXCEPTIONS)
google_cloud_cpp_add_common_options(parallelstore_quickstart)
add_test(
NAME parallelstore_quickstart
COMMAND cmake -P "${PROJECT_SOURCE_DIR}/cmake/quickstart-runner.cmake"
$<TARGET_FILE:parallelstore_quickstart> GOOGLE_CLOUD_PROJECT
GOOGLE_CLOUD_CPP_TEST_REGION # EDIT HERE
)
set_tests_properties(parallelstore_quickstart
PROPERTIES LABELS "integration-test;quickstart")
COMMAND
cmake -P "${PROJECT_SOURCE_DIR}/cmake/quickstart-runner.cmake"
$<TARGET_FILE:parallelstore_quickstart> GOOGLE_CLOUD_PROJECT
GOOGLE_CLOUD_CPP_TEST_REGION)
set_tests_properties(
parallelstore_quickstart
PROPERTIES
LABELS "integration-test;quickstart" PASS_REGULAR_EXPRESSION
"google::cloud::Status thrown: PERMISSION_DENIED: Permanent error")
endif ()
39 changes: 34 additions & 5 deletions google/cloud/parallelstore/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
This directory contains an idiomatic C++ client library for the
[Parallelstore API][cloud-service-docs].

<UNKNOWN - NO SERVICE CONFIG DOCUMENTATION SUMMARY>

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

Expand All @@ -16,14 +14,45 @@ to get started using this client library in a larger project. The following
this library.

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

```cc
#include "google/cloud/parallelstore/v1/parallelstore_client.h"
#include "google/cloud/location.h"
#include <iostream>

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

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

namespace parallelstore = ::google::cloud::parallelstore_v1;
auto client = parallelstore::ParallelstoreClient(
parallelstore::MakeParallelstoreConnection());

for (auto r : client.ListInstances(location.FullName())) {
if (!r) throw std::move(r).status();
std::cout << r->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 [Parallelstore API][cloud-service-docs] service
* [Reference doxygen documentation][doxygen-link] for each release of this
- Official documentation about the [Parallelstore 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
- Detailed header comments in our [public `.h`][source-link] files
[cloud-service-docs]: https://cloud.google.com/parallelstore?hl=en
[doxygen-link]: https://cloud.google.com/cpp/docs/reference/parallelstore/latest/
Expand Down
5 changes: 5 additions & 0 deletions google/cloud/parallelstore/doc/environment-variables.dox
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ environment variables are convenient when troubleshooting problems.
@section parallelstore-env-endpoint Endpoint Overrides

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

- `GOOGLE_CLOUD_CPP_PARALLELSTORE_ENDPOINT=...` overrides the
`EndpointOption` (which defaults to "parallelstore.googleapis.com")
used by `MakeParallelstoreConnection()`.

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

@see google::cloud::EndpointOption
Expand Down
8 changes: 6 additions & 2 deletions google/cloud/parallelstore/doc/main.dox
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

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

<UNKNOWN - NO SERVICE CONFIG DOCUMENTATION SUMMARY>

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

Expand All @@ -22,6 +20,12 @@ which should give you a taste of the Parallelstore API C++ client library API.
## Main classes

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

## More Information
Expand Down
8 changes: 8 additions & 0 deletions google/cloud/parallelstore/doc/override-authentication.dox
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ this default. You can do so by providing the
The following example shows how to explicitly load a service account key file:

<!-- inject-service-account-snippet-start -->
@snippet parallelstore_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
Expand All @@ -24,4 +26,10 @@ guide for more details.
*/

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

/*! @page parallelstore_v1::ParallelstoreClient-service-account-snippet Override parallelstore_v1::ParallelstoreClient Authentication Defaults

@snippet google/cloud/parallelstore/v1/samples/parallelstore_client_samples.cc with-service-account

*/
// <!-- inject-authentication-pages-end -->
10 changes: 10 additions & 0 deletions google/cloud/parallelstore/doc/override-endpoint.dox
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,19 @@ library. Use the
client library to change this default.

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

@snippet parallelstore_client_samples.cc set-client-endpoint

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

*/

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

/*! @page parallelstore_v1::ParallelstoreClient-endpoint-snippet Override parallelstore_v1::ParallelstoreClient Endpoint Configuration

@snippet google/cloud/parallelstore/v1/samples/parallelstore_client_samples.cc set-client-endpoint

*/
// <!-- inject-endpoint-pages-end -->
25 changes: 25 additions & 0 deletions google/cloud/parallelstore/doc/override-retry-policies.dox
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,19 @@ will use `FooBarIdempotencyPolicy`. This policy is very conservative.
@section parallelstore-override-retry-example Example

<!-- inject-retry-snippet-start -->
For example, this will override the retry policies for `parallelstore_v1::ParallelstoreClient`:

@snippet parallelstore_client_samples.cc set-retry-policy

This assumes you have created a custom idempotency policy. Such as:

@snippet parallelstore_client_samples.cc custom-idempotency-policy

This will override the polling policies for `parallelstore_v1::ParallelstoreClient`

@snippet parallelstore_client_samples.cc set-polling-policy


<!-- inject-retry-snippet-end -->

@section parallelstore-override-retry-more-information More Information
Expand All @@ -80,4 +93,16 @@ will use `FooBarIdempotencyPolicy`. This policy is very conservative.
*/

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

/*! @page parallelstore_v1::ParallelstoreClient-retry-snippet Override parallelstore_v1::ParallelstoreClient Retry Policies

This shows how to override the retry policies for parallelstore_v1::ParallelstoreClient:

@snippet google/cloud/parallelstore/v1/samples/parallelstore_client_samples.cc set-retry-policy

Assuming you have created a custom idempotency policy. Such as:

@snippet google/cloud/parallelstore/v1/samples/parallelstore_client_samples.cc custom-idempotency-policy

*/
// <!-- inject-retry-pages-end -->
4 changes: 2 additions & 2 deletions google/cloud/parallelstore/quickstart/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# License for the specific language governing permissions and limitations under
# the License.

# This file shows how to use the Parallelstore API C++ client library from a larger
# CMake project.
# This file shows how to use the Parallelstore API C++ client library from a
# larger CMake project.

cmake_minimum_required(VERSION 3.10...3.24)
project(google-cloud-cpp-parallelstore-quickstart CXX)
Expand Down
38 changes: 18 additions & 20 deletions google/cloud/parallelstore/quickstart/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# HOWTO: using the Parallelstore API C++ client in your project

This directory contains small examples showing how to use the Parallelstore API C++
client library in your own project. These instructions assume that you have
This directory contains small examples showing how to use the Parallelstore API
C++ client library in your own project. These instructions assume that you have
some experience as a C++ developer and that you have a working C++ toolchain
(compiler, linker, etc.) installed on your platform.

Expand All @@ -14,15 +14,13 @@ some experience as a C++ developer and that you have a working C++ toolchain
- Developers wanting to use the libraries as part of a larger CMake or Bazel
project should consult the current document. Note that there are similar
documents for each library in their corresponding directories.
- Developers wanting to compile the library just to run some examples or
tests should consult the
- Developers wanting to compile the library just to run some examples or tests
should consult the
[building and installing](/README.md#building-and-installing) section of the
top-level README file.
- Contributors and developers to `google-cloud-cpp` should consult the guide to
[set up a development workstation][howto-setup-dev-workstation].

[howto-setup-dev-workstation]: /doc/contributor/howto-guide-setup-development-workstation.md

## Before you begin

To run the quickstart examples you will need a working Google Cloud Platform
Expand All @@ -37,19 +35,19 @@ review the [Authentication Overview][authentication-quickstart]. This library
uses the `GOOGLE_APPLICATION_CREDENTIALS` environment variable to find the
credentials file. For example:

| Shell | Command |
| :----------------- | ---------------------------------------------- |
| Bash/zsh/ksh/etc. | `export GOOGLE_APPLICATION_CREDENTIALS=[PATH]` |
| Shell | Command |
| :----------------- | ------------------------------------------------------------------------------------ |
| Bash/zsh/ksh/etc. | `export GOOGLE_APPLICATION_CREDENTIALS=[PATH]` |
| sh | `GOOGLE_APPLICATION_CREDENTIALS=[PATH];`<br> `export GOOGLE_APPLICATION_CREDENTIALS` |
| csh/tsch | `setenv GOOGLE_APPLICATION_CREDENTIALS [PATH]` |
| Windows Powershell | `$env:GOOGLE_APPLICATION_CREDENTIALS=[PATH]` |
| Windows cmd.exe | `set GOOGLE_APPLICATION_CREDENTIALS=[PATH]` |
| csh/tsch | `setenv GOOGLE_APPLICATION_CREDENTIALS [PATH]` |
| Windows Powershell | `$env:GOOGLE_APPLICATION_CREDENTIALS=[PATH]` |
| Windows cmd.exe | `set GOOGLE_APPLICATION_CREDENTIALS=[PATH]` |

Setting this environment variable is the recommended way to configure the
authentication preferences, though if the environment variable is not set, the
library searches for a credentials file in the same location as the [Cloud
SDK](https://cloud.google.com/sdk/). For more information about *Application
Default Credentials*, see
library searches for a credentials file in the same location as the
[Cloud SDK](https://cloud.google.com/sdk/). For more information about
*Application Default Credentials*, see
https://cloud.google.com/docs/authentication/production

## Using with Bazel
Expand Down Expand Up @@ -129,8 +127,8 @@ export GRPC_DEFAULT_SSL_ROOTS_FILE_PATH="$PWD/roots.pem"
### Windows

Bazel tends to create very long file names and paths. You may need to use a
short directory to store the build output, such as `c:\b`, and instruct Bazel
to use it via:
short directory to store the build output, such as `c:\b`, and instruct Bazel to
use it via:

```shell
bazel --output_user_root=c:\b build ...
Expand All @@ -146,9 +144,9 @@ trust store for SSL certificates, you can download and configure this using:
set GRPC_DEFAULT_SSL_ROOTS_FILE_PATH=%cd%\roots.pem
```

[authentication-quickstart]: https://cloud.google.com/docs/authentication/getting-started "Authentication Getting Started"
[bazel-install]: https://docs.bazel.build/versions/main/install.html
[grpc-roots-pem-bug]: https://github.com/grpc/grpc/issues/16571
[choco-cmake-link]: https://chocolatey.org/packages/cmake
[grpc-roots-pem-bug]: https://github.com/grpc/grpc/issues/16571
[homebrew-cmake-link]: https://formulae.brew.sh/formula/cmake
[cmake-download-link]: https://cmake.org/download/
[authentication-quickstart]: https://cloud.google.com/docs/authentication/getting-started 'Authentication Getting Started'
[howto-setup-dev-workstation]: /doc/contributor/howto-guide-setup-development-workstation.md
8 changes: 4 additions & 4 deletions google/cloud/parallelstore/quickstart/quickstart.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

//! [all]
#include "google/cloud/parallelstore/v1/ EDIT HERE _client.h"
#include "google/cloud/parallelstore/v1/parallelstore_client.h"
#include "google/cloud/location.h"
#include <iostream>

Expand All @@ -26,10 +26,10 @@ int main(int argc, char* argv[]) try {
auto const location = google::cloud::Location(argv[1], argv[2]);

namespace parallelstore = ::google::cloud::parallelstore_v1;
auto client = parallelstore::ServiceClient(
parallelstore::MakeServiceConnection()); // EDIT HERE
auto client = parallelstore::ParallelstoreClient(
parallelstore::MakeParallelstoreConnection());

for (auto r : client.List/*EDIT HERE*/(location.FullName())) {
for (auto r : client.ListInstances(location.FullName())) {
if (!r) throw std::move(r).status();
std::cout << r->DebugString() << "\n";
}
Expand Down
Loading

0 comments on commit 0b5eaf8

Please sign in to comment.