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

docs: Fix broken links in readme #1520

Merged
merged 9 commits into from
Aug 10, 2022
17 changes: 4 additions & 13 deletions .readme-partials.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ custom_content: |
Storage storage = StorageOptions.getDefaultInstance().getService();
```

For other authentication options, see the [Authentication](https://github.com/googleapis/google-cloud-java#authentication) page.
For other authentication options, see the [Authentication](https://github.com/googleapis/google-cloud-java#authentication) page in Google Cloud Java.

#### Storing data
Stored objects are called "blobs" in `google-cloud` and are organized into containers called "buckets". `Blob`, a
Expand Down Expand Up @@ -51,7 +51,7 @@ custom_content: |
```

A complete example for creating a blob can be found at
[CreateBlob.java](https://github.com/googleapis/google-cloud-java/tree/main/google-cloud-examples/src/main/java/com/google/cloud/examples/storage/snippets/CreateBlob.java).
[UploadObject.java](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/object/UploadObject.java).

At this point, you will be able to see your newly created bucket and blob on the Google Developers Console.

Expand All @@ -66,7 +66,7 @@ custom_content: |
```

A complete example for accessing blobs can be found at
[CreateBlob.java](https://github.com/googleapis/google-cloud-java/tree/main/google-cloud-examples/src/main/java/com/google/cloud/examples/storage/snippets/CreateBlob.java).
[DownloadObject.java](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/object/DownloadObject.java).

#### Updating data
Another thing we may want to do is update a blob. The following snippet shows how to update a Storage blob if it exists.
Expand All @@ -83,9 +83,6 @@ custom_content: |
}
```

The complete source code can be found at
[UpdateBlob.java](https://github.com/googleapis/google-cloud-java/tree/main/google-cloud-examples/src/main/java/com/google/cloud/examples/storage/snippets/UpdateBlob.java).

#### Listing buckets and contents of buckets
Suppose that you've added more buckets and blobs, and now you want to see the names of your buckets and the contents
of each one. Add the following code to list all your buckets and all the blobs inside each bucket.
Expand All @@ -106,16 +103,10 @@ custom_content: |

#### Complete source code

In
[CreateAndListBucketsAndBlobs.java](https://github.com/googleapis/google-cloud-java/tree/main/google-cloud-examples/src/main/java/com/google/cloud/examples/storage/snippets/CreateAndListBucketsAndBlobs.java)
we put together examples creating and listing buckets and blobs into one program. The program assumes that you are
running on Compute Engine or from your own desktop. To run the example on App Engine, simply move
the code from the main method to your application's servlet class and change the print statements to
display on your webpage.
See [ListObjects.java](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/object/ListObjects.java) for a complete example.

### Example Applications

- [`StorageExample`](https://github.com/googleapis/google-cloud-java/tree/main/google-cloud-examples/src/main/java/com/google/cloud/examples/storage/StorageExample.java) is a simple command line interface that provides some of Cloud Storage's functionality. Read more about using the application on the [`StorageExample` docs page](https://github.com/googleapis/google-cloud-java/blob/main/google-cloud-examples/README.md).
- [`Bookshelf`](https://github.com/GoogleCloudPlatform/getting-started-java/tree/main/bookshelf) - An App Engine application that manages a virtual bookshelf.
- This app uses `google-cloud` to interface with Cloud Datastore and Cloud Storage. It also uses Cloud SQL, another Google Cloud Platform service.
- [`Flexible Environment/Storage example`](https://github.com/GoogleCloudPlatform/java-docs-samples/tree/main/flexible/cloudstorage) - An app that uploads files to a public Cloud Storage bucket on the App Engine Flexible Environment runtime.
Expand Down
21 changes: 6 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ implementation 'com.google.cloud:google-cloud-storage'
If you are using Gradle without BOM, add this to your dependencies:

```Groovy
implementation 'com.google.cloud:google-cloud-storage:2.9.3'
implementation 'com.google.cloud:google-cloud-storage:2.11.3'
```

If you are using SBT, add this to your dependencies:

```Scala
libraryDependencies += "com.google.cloud" % "google-cloud-storage" % "2.9.3"
libraryDependencies += "com.google.cloud" % "google-cloud-storage" % "2.11.3"
```

## Authentication
Expand Down Expand Up @@ -112,7 +112,7 @@ import com.google.cloud.storage.StorageOptions;
Storage storage = StorageOptions.getDefaultInstance().getService();
```

For other authentication options, see the [Authentication](https://github.com/googleapis/google-cloud-java#authentication) page.
For other authentication options, see the [Authentication](https://github.com/googleapis/google-cloud-java#authentication) page in Google Cloud Java.

#### Storing data
Stored objects are called "blobs" in `google-cloud` and are organized into containers called "buckets". `Blob`, a
Expand Down Expand Up @@ -149,7 +149,7 @@ Blob blob = storage.create(blobInfo, "a simple blob".getBytes(UTF_8));
```

A complete example for creating a blob can be found at
[CreateBlob.java](https://github.com/googleapis/google-cloud-java/tree/main/google-cloud-examples/src/main/java/com/google/cloud/examples/storage/snippets/CreateBlob.java).
[UploadObject.java](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/object/UploadObject.java).

At this point, you will be able to see your newly created bucket and blob on the Google Developers Console.

Expand All @@ -164,7 +164,7 @@ String contentString = new String(content, UTF_8);
```

A complete example for accessing blobs can be found at
[CreateBlob.java](https://github.com/googleapis/google-cloud-java/tree/main/google-cloud-examples/src/main/java/com/google/cloud/examples/storage/snippets/CreateBlob.java).
[DownloadObject.java](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/object/DownloadObject.java).

#### Updating data
Another thing we may want to do is update a blob. The following snippet shows how to update a Storage blob if it exists.
Expand All @@ -181,9 +181,6 @@ if (blob != null) {
}
```

The complete source code can be found at
[UpdateBlob.java](https://github.com/googleapis/google-cloud-java/tree/main/google-cloud-examples/src/main/java/com/google/cloud/examples/storage/snippets/UpdateBlob.java).

#### Listing buckets and contents of buckets
Suppose that you've added more buckets and blobs, and now you want to see the names of your buckets and the contents
of each one. Add the following code to list all your buckets and all the blobs inside each bucket.
Expand All @@ -204,16 +201,10 @@ for (Bucket bucket : storage.list().iterateAll()) {

#### Complete source code

In
[CreateAndListBucketsAndBlobs.java](https://github.com/googleapis/google-cloud-java/tree/main/google-cloud-examples/src/main/java/com/google/cloud/examples/storage/snippets/CreateAndListBucketsAndBlobs.java)
we put together examples creating and listing buckets and blobs into one program. The program assumes that you are
running on Compute Engine or from your own desktop. To run the example on App Engine, simply move
the code from the main method to your application's servlet class and change the print statements to
display on your webpage.
See [ListObjects.java](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/object/ListObjects.java) for a complete example.
Copy link
Member

Choose a reason for hiding this comment

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

Was this the regenerated changes? Not sure if they will be clobbered once merged again.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, these are the result of owlbot updates after i edited the yaml file, so these changes are safe from clobbering


### Example Applications

- [`StorageExample`](https://github.com/googleapis/google-cloud-java/tree/main/google-cloud-examples/src/main/java/com/google/cloud/examples/storage/StorageExample.java) is a simple command line interface that provides some of Cloud Storage's functionality. Read more about using the application on the [`StorageExample` docs page](https://github.com/googleapis/google-cloud-java/blob/main/google-cloud-examples/README.md).
- [`Bookshelf`](https://github.com/GoogleCloudPlatform/getting-started-java/tree/main/bookshelf) - An App Engine application that manages a virtual bookshelf.
- This app uses `google-cloud` to interface with Cloud Datastore and Cloud Storage. It also uses Cloud SQL, another Google Cloud Platform service.
- [`Flexible Environment/Storage example`](https://github.com/GoogleCloudPlatform/java-docs-samples/tree/main/flexible/cloudstorage) - An app that uploads files to a public Cloud Storage bucket on the App Engine Flexible Environment runtime.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@
/**
* A client for Cloud Storage - Unified object storage.
*
* <p>Here's a simple usage example for using google-cloud from App/Compute Engine. This example
* shows how to create a Storage blob. For the complete source code see <a
* href="https://github.com/googleapis/google-cloud-java/tree/master/google-cloud-examples/src/main/java/com/google/cloud/examples/storage/snippets/GetOrCreateBlob.java">
* CreateBlob.java</a>.
* <p>Here's a simple usage example the Java Storage client. This example shows how to create a
* Storage object.
*
* <pre>{@code
* Storage storage = StorageOptions.getDefaultInstance().getService();
Expand All @@ -29,10 +27,7 @@
* Blob blob = storage.create(blobInfo, "Hello, Cloud Storage!".getBytes(UTF_8));
* }</pre>
*
* <p>This second example shows how to update the blob's content if the blob exists. For the
* complete source code see <a
* href="https://github.com/googleapis/google-cloud-java/tree/master/google-cloud-examples/src/main/java/com/google/cloud/examples/storage/snippets/UpdateBlob.java">
* UpdateBlob.java</a>.
* <p>This second example shows how to update an object's content if the object exists.
*
* <pre>{@code
* Storage storage = StorageOptions.getDefaultInstance().getService();
Expand All @@ -47,6 +42,9 @@
* }
* }</pre>
*
* <p>For more detailed code examples, see the <a
* href="https://cloud.google.com/storage/docs/samples">sample library</a>.
*
* <p>When using google-cloud from outside of App/Compute Engine, you have to <a
* href="https://github.com/googleapis/google-cloud-java#specifying-a-project-id">specify a project
* ID</a> and <a href="https://github.com/googleapis/google-cloud-java#authentication">provide
Expand Down