Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Bookshelf/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Binary Data
# Bookshelf Sample

This folder contains an ASP.NET end-to-end sample application written in C# that
uses Google Cloud services like Firestore and Cloud Storage.
This folder contains an ASP.NET Core end-to-end sample application written in C# that
uses Google Cloud services like Firestore, Cloud Storage, and Cloud SQL.

## Tutorial
See https://cloud.google.com/dotnet/docs/getting-started/tutorial-app for
Expand Down
44 changes: 19 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,31 @@
## Getting Started for .NET
# Getting Started for .NET

This repo contains sample applications written in C# that run on Google Cloud Platform.
This repository contains sample applications written in C# and ASP.NET Core that run on Google Cloud.

See [https://cloud.google.com/dotnet/getting-started/hello-world](https://cloud.google.com/dotnet/getting-started/hello-world) for instructions on how to build, run, and deploy the samples.
See [the documentation](https://cloud.google.com/dotnet/getting-started/hello-world) for instructions on how to build, run, and deploy the samples.

The applications make use of two client libraries:
## Samples

* [.NET Cloud Client Library]
* [Google API Client Library]
* **[HelloWorld](./HelloWorld)**: A basic ASP.NET Core application that can be deployed to Cloud Run or Compute Engine.
* **[Bookshelf](./Bookshelf)**: An end-to-end sample application showing how to use Cloud Firestore, Cloud Storage, and Cloud SQL.
* **[BackgroundProcessing](./BackgroundProcessing)**: Demonstrates how to perform background tasks using Cloud Pub/Sub and the Cloud Translation API.
* **[Sessions](./Sessions)**: Shows how to manage user sessions using Cloud Firestore.

## aspnet
## Cloud APIs used

The [aspnet] directory contains ASP.NET samples that demonstrate how to access and use Google's APIs from C#.
Review this section to learn how use Visual Studio to deploy an ASP.NET sample bookshelf app to the Google Cloud Platform.
The sample bookshelf app provides examples of using the following Cloud APIs:
* [Cloud Datastore API]
* [Cloud SQL API]
* [Cloud Storage API]
* [Cloud Pub/Sub API]
The samples demonstrate how to use several Google Cloud APIs:

* [Cloud Firestore](https://cloud.google.com/firestore/docs/)
* [Cloud SQL](https://cloud.google.com/sql/docs/)
* [Cloud Storage](https://cloud.google.com/storage/docs/)
* [Cloud Pub/Sub](https://cloud.google.com/pubsub/docs/)
* [Cloud Translation](https://cloud.google.com/translate/docs/)
* [Cloud Key Management Service (KMS)](https://cloud.google.com/kms/docs/)

## Contributing changes

* See [CONTRIBUTING.md](CONTRIBUTING.md)
* See [CONTRIBUTING.md](CONTRIBUTING.md)

## Licensing

* See [LICENSE](LICENSE)

[.NET Cloud Client Library]: https://github.com/googlecloudplatform/gcloud-dotnet
[Google API Client Library]: https://github.com/google/google-api-dotnet-client
[aspnet]: ./aspnet
[Cloud Datastore API]: https://developers.google.com/api-client-library/dotnet/apis/datastore/v1beta3
[Cloud SQL API]: https://cloud.google.com/sql/docs/admin-api/
[Cloud Storage API]: http://googlecloudplatform.github.io/gcloud-dotnet/index.html
[Cloud Pub/Sub API]: https://developers.google.com/api-client-library/dotnet/apis/pubsub/v1
* See [LICENSE](LICENSE)
47 changes: 22 additions & 25 deletions TESTING.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
# Testing

## Running tests
1. **Create a project in the Google Cloud Platform Console**.
1. **Create a project in the Google Cloud Console**.
If you haven't already created a project, create one now. Projects enable
you to manage all Google Cloud Platform resources for your app, including
you to manage all Google Cloud resources for your app, including
deployment, access control, billing, and services.
1. Open the [Cloud Platform Console](https://console.cloud.google.com/).
1. Open the [Cloud Console](https://console.cloud.google.com/).
2. In the drop-down menu at the top, select Create a project.
3. Click Show advanced options. Under App Engine location, select a
United States location.
4. Give your project a name.
5. Make a note of the project ID, which might be different from the project
3. Give your project a name.
4. Make a note of the project ID, which might be different from the project
name. The project ID is used in commands and in configurations.

2. **Enable billing for your project**.
Expand All @@ -23,11 +21,16 @@
If you haven't already installed the Google Cloud SDK, [install and
initialize the Google Cloud SDK](https://cloud.google.com/sdk/docs/) now.
The SDK contains tools and libraries that enable you to create and manage
resources on Google Cloud Platform.
resources on Google Cloud.

4. **Enable APIs for your project**.
[Click here](https://console.cloud.google.com/flows/enableapi?apiid=datastore,pubsub,storage_api,logging,plus&showconfirmation=true)
to visit Cloud Platform Console and enable the APIs.
Enable the following APIs in the Cloud Console:
* Cloud Firestore API
* Cloud Pub/Sub API
* Cloud Storage API
* Cloud Translation API
* Cloud SQL Admin API
* Cloud Key Management Service (KMS) API

5. Download or clone this repo with

Expand All @@ -36,22 +39,16 @@
```

6. Set the environment variables:
- GoogleCloudSamples:ProjectId = your project id displayed on the Google Developers Console.
- GoogleCloudSamples:BucketName = the name of the Google Cloud Storage bucket you created.
- GoogleCloudSamples:ApplicationName = the name for your application.
- GoogleCloudSamples:AuthClientId = the service account id of the service account you created.
- GoogleCloudSamples:AuthClientSecret = the local path to the JSON file containing the service account's private key.
- GoogleCloudSamples:ConnectionStringCloudSql= the connection string for the Cloud SQL database you created, in the format of "Server=1.2.3.4;Database=bookshelf;Uid=dotnetapp;Pwd=password".
- GoogleCloudSamples:ConnectionStringSqlServer= the connection string for the SQL Server database you created, in the format of "Data Source=ServerName;Initial Catalog=DatabaseName;Integrated Security=False;User Id=userid;Password=password".
* `GoogleCloudSamples:ProjectId` = your project id displayed on the Google Cloud Console.
* `GoogleCloudSamples:BucketName` = the name of the Google Cloud Storage bucket you created.
* `GoogleCloudSamples:ConnectionStringCloudSql` = the connection string for the Cloud SQL database you created, in the format of "Server=1.2.3.4;Database=bookshelf;Uid=dotnetapp;Pwd=password".

7. Add the following tools to your path:
- MSBuild
- MSTest
- Nuget
7. Ensure you have the following tools installed and in your PATH:
* [.NET Core SDK](https://dotnet.microsoft.com/download)
* PowerShell

8. Run the test script:
8. Run the test script from the root of the repository:

```powershell
.\BuildAndRunTests.ps1
```
C:\...\getting-started-dotnet\aspnet> powershell ..\BuildAndRunTests.ps1
```