Skip to content

add readme file #1387

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

add readme file #1387

wants to merge 1 commit into from

Conversation

hghalebi
Copy link

Pull Request: Refactor Tutorial to Google Cloud Style Documentation

Description

This PR refactors the existing web tutorial to follow Google Cloud's documentation style guidelines, improving readability and usability for developers.

Changes Made

  • Restructured content to follow Google Cloud's progressive disclosure pattern
  • Added comprehensive authentication examples
  • Introduced detailed error handling patterns
  • Included troubleshooting section with common issues
  • Added clear setup instructions and prerequisites
  • Improved code examples with detailed comments
  • Added next steps and additional resources sections

Key Features

  1. Authentication Examples

    • Application Default Credentials (ADC)
    • Service Account authentication
    • Clear setup instructions
  2. Error Handling

    • Comprehensive error handling patterns
    • Service error management
    • Type-safe error handling examples
  3. Long-running Operations

    • Added examples for handling async operations
    • Implemented backoff policies
    • Proper operation management
  4. Troubleshooting Guide

    • Common authentication issues
    • API enablement instructions
    • Permission management

Testing Done

  • Verified all code examples compile
  • Tested documentation links
  • Validated markdown formatting
  • Ensured code snippets follow Rust best practices

Screenshots

N/A (Documentation changes only)

Related Issues

Closes #[issue_number] - Add Google Cloud style documentation

Checklist

  • Documentation follows Google Cloud style guide
  • Code examples are properly formatted and commented
  • All links are valid and working
  • Markdown syntax is correct
  • Examples include error handling
  • Prerequisites are clearly stated

Notes for Reviewers

Please pay special attention to:

  • Documentation flow and progression
  • Code example completeness
  • Error handling patterns
  • Authentication examples

Copy link

google-cla bot commented Feb 27, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@coryan
Copy link
Collaborator

coryan commented Feb 27, 2025

This change is really useful, thanks! Please sign the CLA and let us know, we cannot accept the change until then.

Do you think we should refactor this to a chapter in the User Guide (see guide/src for the source).

@hghalebi
Copy link
Author

This change is really useful, thanks! Please sign the CLA and let us know, we cannot accept the change until then.

Do you think we should refactor this to a chapter in the User Guide (see guide/src for the source).

yes I do think we need documentation in tutorial style. And if you support I could try to contribute more in this way

@hghalebi
Copy link
Author

i have tired to sign CLA but i got error:
CleanShot 2025-02-28 at 16 51 31@2x

@coryan
Copy link
Collaborator

coryan commented Feb 28, 2025

i have tired to sign CLA but i got error:

I cannot find a place where either of us can file a bug or otherwise troubleshoot the problem. Best advice I can give you is to try again in a few hours or something.

@hghalebi
Copy link
Author

hghalebi commented Mar 5, 2025

i have tired to sign CLA but i got error:

I cannot find a place where either of us can file a bug or otherwise troubleshoot the problem. Best advice I can give you is to try again in a few hours or something.

I just sigh. @coryan

@coryan
Copy link
Collaborator

coryan commented Mar 5, 2025

One thing of note, the PR includes contributions using two different emails:

image

Could you create a new PR with whatever email you used to sign the CLA (assuming you are able to sign the CLA at all).

If that does not work, we should close the PR. I think your idea would be valuable as a chapter in the book. Happy to do it ourselves.

@hghalebi
Copy link
Author

hghalebi commented Mar 6, 2025

I will retry this weekend ( Paris time zone). I hope that solves the issue. If not, you could add yourself directly. I will be more than happy to add more tutorial-style docs.

@hghalebi
Copy link
Author

hghalebi commented Mar 8, 2025

@coryan, I updated my CLA signature. Please recheck. If the issue is still present, please add it yourself the way that you prefer.

@coryan
Copy link
Collaborator

coryan commented Mar 8, 2025

Looks much better. It seems that this PR is mixing two commits and the robots only recognize one for the CLA:

image


I can tell that this is a single author, but it would be nice if you can clean this up to make the merge easier.

In the interim, let me start reviewing this.

Copy link

codecov bot commented Mar 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.96%. Comparing base (dfcd1c4) to head (da8a2dd).
Report is 31 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1387   +/-   ##
=======================================
  Coverage   95.96%   95.96%           
=======================================
  Files          37       37           
  Lines        1462     1462           
=======================================
  Hits         1403     1403           
  Misses         59       59           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move this file to guide/src/. I think we will need to break this down, you are covering too much ground for a single document.

First, the initialization of a simple client is already covered in "Setting up your development environment". We can probably skip that.

Second, the long running operations are already covered too, we can skip that.

We should use your example of how to initialize using service account credentials into a new chapter titled "Using service account credentials" (or something similar).

We should break the section on error handling to its own chapter also.


You will need to use mdformat to fix a number of formatting issues:

https://github.com/googleapis/google-cloud-rust/actions/runs/13572960728/job/38427364311?pr=1387

And need to rebase to get the latest build scripts going.

#### Listing secrets

```rust
use google_cloud_secretmanager_v1::client::SecretManagerServiceClient;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the client name is simply SecretManagerService. This is why we write the code samples as actual code in guide/samples/* and embed the code using {{#include }} to ensure the code actually compiles.

Please refactor all the code compilable code samples.

Comment on lines +180 to +183
## Troubleshooting

### Common issues

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a really good idea.

2. **API not enabled**
- Enable the required APIs in your project:
```bash
gcloud services enable secretmanager.googleapis.com
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are missing some APIs used above, like speech.googleapis.com. Keeping the tutorial focused on one topic makes it easier to catch these problems.

.await?;

// Wait for completion
let result = operation.await_complete().await?;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think this would compile.

Some Google Cloud operations may take a long time to complete. Here's how to handle them:

```rust
use google_cloud_speech_v2::client::SpeechClient;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name of this client is incorrect again.

}
```

### Working with long-running operations
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok(())
}
Err(e) => {
if let Some(status) = e.downcast_ref::<ServiceError>() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type of status would be ServiceError, but you are using it as if it was Status.... does this code compile?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants