@@ -16,6 +16,78 @@ This repository contains idiomatic C++ client libraries for the following
1616> Please check the [ CHANGELOG] for important announcements and upcoming
1717> changes.
1818
19+ ## Quickstart
20+
21+ Each library (see below) contains a directory named ` quickstart/ ` that's
22+ intended to help you get up and running in a matter of minutes. This
23+ ` quickstart/ ` directory contains a minimal "Hello World" program demonstrating
24+ how to use the library, along with minimal build files for common build
25+ systems, such as CMake and Bazel.
26+
27+ As an example, the following code snippet, taken from [ Google Cloud
28+ Storage] ( google/cloud/storage/README.md ) , should give you a sense of what it's
29+ like to use one of these C++ libraries.
30+
31+ <!-- inject-quickstart-start -->
32+
33+ ``` cc
34+ #include " google/cloud/storage/client.h"
35+ #include < iostream>
36+
37+ int main (int argc, char* argv[ ] ) {
38+ if (argc != 2) {
39+ std::cerr << "Missing bucket name.\n";
40+ std::cerr << "Usage: quickstart <bucket-name >\n";
41+ return 1;
42+ }
43+ std::string const bucket_name = argv[ 1] ;
44+
45+ // Create aliases to make the code easier to read.
46+ namespace gcs = ::google::cloud : :storage;
47+
48+ // Create a client to communicate with Google Cloud Storage. This client
49+ // uses the default configuration for authentication and project id.
50+ auto client = gcs::Client();
51+
52+ auto writer = client.WriteObject(bucket_name, "quickstart.txt");
53+ writer << "Hello World!";
54+ writer.Close();
55+ if (writer.metadata()) {
56+ std::cout << "Successfully created object: " << * writer.metadata() << "\n";
57+ } else {
58+ std::cerr << "Error creating object: " << writer.metadata().status()
59+ << "\n";
60+ return 1;
61+ }
62+
63+ auto reader = client.ReadObject(bucket_name, "quickstart.txt");
64+ if (!reader) {
65+ std::cerr << "Error reading object: " << reader.status() << "\n";
66+ return 1;
67+ }
68+
69+ std::string contents{std::istreambuf_iterator<char >{reader}, {}};
70+ std::cout << contents << "\n";
71+
72+ return 0;
73+ }
74+ ```
75+
76+ <!-- inject-quickstart-end -->
77+
78+ ## GA Libraries
79+
80+ See each library's `README.md` file for more information about:
81+
82+ - Where to find the documentation for the library and the service.
83+ - How to get started using the library.
84+ - How to incorporate the library into your build system.
85+ - The library's support status if not Generally Available (GA); unless noted in
86+ a library's `README.md`, these libraries are all GA and supported by Google.
87+
88+ <details>
89+ <summary>Expand to see the full list of GA libraries</summary>
90+
1991<!-- inject-GA-libraries-start -->
2092
2193- [Access Approval API](google/cloud/accessapproval/README.md)
@@ -309,13 +381,7 @@ This repository contains idiomatic C++ client libraries for the following
309381
310382<!-- inject-GA-libraries-end -->
311383
312- See each library's ` README.md ` file for more information about:
313-
314- - Where to find the documentation for the library and the service.
315- - How to get started using the library.
316- - How to incorporate the library into your build system.
317- - The library's support status if not Generally Available (GA); unless noted in
318- a library's ` README.md ` , these libraries are all GA and supported by Google.
384+ </details>
319385
320386## Building and Installing
321387
@@ -364,65 +430,6 @@ cmake --build cmake-out -- -j $(nproc)
364430
365431The binary artifacts, such as examples, will be placed in ` cmake-out/ ` .
366432
367- ## Quickstart
368-
369- Each library (linked above) contains a directory named ` quickstart/ ` that's
370- intended to help you get up and running in a matter of minutes. This
371- ` quickstart/ ` directory contains a minimal "Hello World" program demonstrating
372- how to use the library, along with minimal build files for common build
373- systems, such as CMake and Bazel.
374-
375- As an example, the following code snippet, taken from [ Google Cloud
376- Storage] ( google/cloud/storage/README.md ) , should give you a taste of what it's
377- like to use one of these C++ libraries.
378-
379- <!-- inject-quickstart-start -->
380-
381- ``` cc
382- #include " google/cloud/storage/client.h"
383- #include < iostream>
384-
385- int main (int argc, char* argv[ ] ) {
386- if (argc != 2) {
387- std::cerr << "Missing bucket name.\n";
388- std::cerr << "Usage: quickstart <bucket-name >\n";
389- return 1;
390- }
391- std::string const bucket_name = argv[ 1] ;
392-
393- // Create aliases to make the code easier to read.
394- namespace gcs = ::google::cloud : :storage;
395-
396- // Create a client to communicate with Google Cloud Storage. This client
397- // uses the default configuration for authentication and project id.
398- auto client = gcs::Client();
399-
400- auto writer = client.WriteObject(bucket_name, "quickstart.txt");
401- writer << "Hello World!";
402- writer.Close();
403- if (writer.metadata()) {
404- std::cout << "Successfully created object: " << * writer.metadata() << "\n";
405- } else {
406- std::cerr << "Error creating object: " << writer.metadata().status()
407- << "\n";
408- return 1;
409- }
410-
411- auto reader = client.ReadObject(bucket_name, "quickstart.txt");
412- if (!reader) {
413- std::cerr << "Error reading object: " << reader.status() << "\n";
414- return 1;
415- }
416-
417- std::string contents{std::istreambuf_iterator<char >{reader}, {}};
418- std::cout << contents << "\n";
419-
420- return 0;
421- }
422- ```
423-
424- <!-- inject-quickstart-end -->
425-
426433## Support
427434
428435- This project follows Google's [ Foundational C++ Support Policy] [ support-policy ] ,
0 commit comments