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

Re-Add Google Cloud Functions documentation #3365

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
75 changes: 74 additions & 1 deletion docs/README.md
Expand Up @@ -5,6 +5,7 @@ layout: Doc
menuItems:
- {menuText: AWS, path: /framework/docs/providers/aws/}
- {menuText: Azure, path: /framework/docs/providers/azure/}
- {menuText: Google, path: /framework/docs/providers/google/}
- {menuText: OpenWhisk, path: /framework/docs/providers/openwhisk/}
-->

Expand All @@ -14,7 +15,7 @@ menuItems:

# Documentation

The Serverless Framework allows you to deploy auto-scaling, pay-per-execution, event-driven functions to any cloud. We currently support AWS Lambda, Apache OpenWhisk, Microsoft Azure, and are expanding to support other cloud providers.
The Serverless Framework allows you to deploy auto-scaling, pay-per-execution, event-driven functions to any cloud. We currently support AWS Lambda, Apache OpenWhisk, Microsoft Azure, Google Cloud Functions and are expanding to support other cloud providers.

<div class="docsSections">
<div class="docsSection">
Expand Down Expand Up @@ -266,3 +267,75 @@ The Serverless Framework allows you to deploy auto-scaling, pay-per-execution, e
</div>
</div>
</div>

<div class="docsSections">
<div class="docsSection">
<div class="docsSectionHeader">
<a href="./providers/google/guide/">
<img src="https://s3-us-west-2.amazonaws.com/assets.site.serverless.com/images/docs_guide_google.jpg" alt="Serverless Framework Google Cloud Functions Guide" width="250" draggable="false"/>
</a>
</div>
<div class="test">
<ul>
<li><a href="./providers/google/guide/intro.md">Intro</a></li>
<li><a href="./providers/google/guide/quickstart.md">Quickstart</a></li>
<li><a href="./providers/google/guide/installation.md">Installation</a></li>
<li><a href="./providers/google/guide/credentials.md">Credentials</a></li>
<li><a href="./providers/google/guide/services.md">Services</a></li>
<li><a href="./providers/google/guide/functions.md">Functions</a></li>
<li><a href="./providers/google/guide/events.md">Events</a></li>
<li><a href="./providers/google/guide/deploying.md">Deploying</a></li>
<li><a href="./providers/google/guide/variables.md">Variables</a></li>
<li><a href="./providers/google/guide/plugins.md">Plugins</a></li>
<li><a href="./providers/google/guide/workflow.md">Workflow</a></li>
</ul>
</div>
</div>

<div class="docsSection">
<div class="docsSectionHeader">
<a href="./providers/google/cli-reference/">
<img src="https://s3-us-west-2.amazonaws.com/assets.site.serverless.com/images/docs_cli_google.jpg" alt="Serverless Framework Google Cloud Functions CLI Reference" width="250" draggable="false"/>
</a>
</div>
<div>
<ul>
<li><a href="./providers/google/cli-reference/install.md">Install</a></li>
<li><a href="./providers/google/cli-reference/deploy.md">Deploy</a></li>
<li><a href="./providers/google/cli-reference/info.md">Info</a></li>
<li><a href="./providers/google/cli-reference/invoke.md">Invoke</a></li>
<li><a href="./providers/google/cli-reference/logs.md">Logs</a></li>
<li><a href="./providers/google/cli-reference/remove.md">Remove</a></li>
</ul>
</div>
</div>

<div class="docsSection">
<div class="docsSectionHeader">
<a href="./providers/google/events/">
<img src="https://s3-us-west-2.amazonaws.com/assets.site.serverless.com/images/docs_events_google.jpg" alt="Serverless Framework Google Cloud Functions EventsEvents" width="250" draggable="false"/>
</a>
</div>
<div>
<ul>
<li><a href="./providers/google/events/http.md">HTTP</a></li>
<li><a href="./providers/google/events/event.md">Event</a></li>
</ul>
</div>
</div>

<div class="docsSection">
<div class="docsSectionHeader">
<a href="./providers/google/examples/">
<img src="https://s3-us-west-2.amazonaws.com/assets.site.serverless.com/images/docs_examples_google.jpg" alt="Serverless Framework Microsoft Google Cloud Functions Examples" width="250" draggable="false"/>
</a>
</div>
<div>
<div>
<ul>
<li><a href="./providers/google/examples/hello-world">Hello World</a></li>
</ul>
</div>
</div>
</div>
</div>
19 changes: 19 additions & 0 deletions docs/providers/google/README.md
@@ -0,0 +1,19 @@
<!--
title: Serverless - Google Cloud Functions Documentation
menuText: Google
layout: Doc
-->

<!-- DOCS-SITE-LINK:START automatically generated -->
### [Read this on the main serverless docs site](https://www.serverless.com/framework/docs/providers/google/)
<!-- DOCS-SITE-LINK:END -->

# Serverless Google Cloud Functions Provider Documentation

Welcome to the Serverless Google Cloud Functions documentation!

Please select a section on the left to get started.

If you have questions, join the [chat in gitter](https://gitter.im/serverless/serverless) or [post over on the forums](https://gitter.im/serverless/serverless)

**Note:** Before continuing [Google Cloud system credentials](./guide/credentials.md) are required for using the CLI.
17 changes: 17 additions & 0 deletions docs/providers/google/cli-reference/README.md
@@ -0,0 +1,17 @@
<!--
title: Serverless - Google Cloud Functions - CLI Reference
menuText: CLI Reference
layout: Doc
-->

<!-- DOCS-SITE-LINK:START automatically generated -->
### [Read this on the main serverless docs site](https://www.serverless.com/framework/docs/providers/google/cli-reference/)
<!-- DOCS-SITE-LINK:END -->

# Serverless Google Cloud Functions CLI Reference

Welcome to the Serverless Google Cloud Functions CLI Reference! Please select a section on the left to get started.

If you have questions, join the [chat in gitter](https://gitter.im/serverless/serverless) or [post over on the forums](http://forum.serverless.com/).

**Note:** Before continuing [Google Cloud system credentials](../guide/credentials.md) are required for using the CLI.
23 changes: 23 additions & 0 deletions docs/providers/google/cli-reference/deploy.md
@@ -0,0 +1,23 @@
<!--
title: Serverless Framework Commands - Google Cloud Functions - Deploy
menuText: Deploy
menuOrder: 4
description: Deploy your service to the specified provider
layout: Doc
-->

<!-- DOCS-SITE-LINK:START automatically generated -->
### [Read this on the main serverless docs site](https://www.serverless.com/framework/docs/providers/google/cli-reference/deploy)
<!-- DOCS-SITE-LINK:END -->

# Deploy

The `serverless deploy` command deploys your entire service via the Google Cloud API. Run this command when you have made service changes (i.e., you edited `serverless.yml`).

```bash
serverless deploy
```

## Artifacts

After the `serverless deploy` command runs all created deployment artifacts are placed in the `.serverless` folder of the service.
19 changes: 19 additions & 0 deletions docs/providers/google/cli-reference/info.md
@@ -0,0 +1,19 @@
<!--
title: Serverless Framework Commands - Google Cloud Functions - Info
menuText: Info
menuOrder: 5
description: Get information about your deployed service
layout: Doc
-->

<!-- DOCS-SITE-LINK:START automatically generated -->
### [Read this on the main serverless docs site](https://www.serverless.com/framework/docs/providers/google/cli-reference/info)
<!-- DOCS-SITE-LINK:END -->

# Info

The `serverless info` command displays information about the deployed service. Make sure to run this command in your services directory.

```bash
serverless info
```
50 changes: 50 additions & 0 deletions docs/providers/google/cli-reference/install.md
@@ -0,0 +1,50 @@
<!--
title: Serverless Framework Commands - Google Cloud Functions - Install
menuText: Install
menuOrder: 3
description: Install pre-written Google Cloud Functions Functions, Events and Resources with the Serverless Framework
layout: Doc
-->

<!-- DOCS-SITE-LINK:START automatically generated -->
### [Read this on the main serverless docs site](https://www.serverless.com/framework/docs/providers/google/cli-reference/install)
<!-- DOCS-SITE-LINK:END -->

# Install

Installs a service from a GitHub URL in the current working directory.

```bash
serverless install --url https://github.com/some/service
```

## Options

- `--url` or `-u` The services GitHub URL. **Required**.
- `--name` or `-n` Name for the service.

## Examples

### Installing a service from a GitHub URL

```bash
serverless install --url https://github.com/serverless/boilerplate-googlecloudfunctions-nodejs
```

This example will download the .zip file of the `boilerplate-googlecloudfunctions-nodejs` service from GitHub, create a new directory with the name `boilerplate-googlecloudfunctions-nodejs` in the current working directory and unzips the files in this directory.

### Installing a service from a GitHub URL with a new service name

```bash
serverless install --url https://github.com/serverless/boilerplate-googlecloudfunctions-nodejs --name my-gcloud-service
```

This example will download the .zip file of the `boilerplate-googlecloudfunctions-nodejs` service from GitHub, create a new directory with the name `my-gcloud-service` in the current working directory and unzips the files in this directory and renames the service to `my-gcloud-service` if `serverless.yml` exists in the service root.

### Installing a service from a directory in a GitHub URL

```bash
serverless install --url https://github.com/serverless/examples/tree/master/google-node-simple-http-endpoint
```

This example will download the `google-node-simple-http-endpoint` service from GitHub.
42 changes: 42 additions & 0 deletions docs/providers/google/cli-reference/invoke.md
@@ -0,0 +1,42 @@
<!--
title: Serverless Framework Commands - Google Cloud Functions - Invoke
menuText: Invoke
menuOrder: 7
description: Invoke an Google Cloud Functions Function using the Serverless Framework
layout: Doc
-->

<!-- DOCS-SITE-LINK:START automatically generated -->
### [Read this on the main serverless docs site](https://www.serverless.com/framework/docs/providers/google/cli-reference/invoke)
<!-- DOCS-SITE-LINK:END -->

# Invoke

Invokes deployed function. It allows to send event data to the function, read logs and display other important information of the function invocation.

```bash
serverless invoke --function functionName
```

## Options

- `--function` or `-f` The name of the function in your service that you want to invoke. **Required**.
- `--data` or `-d` Data you want to pass into the function.

## Examples

### Simple function invocation

```bash
serverless invoke --function functionName
```

This example will invoke the deployed function and output the result of the invocation in the terminal.

### Function invocation with data

```bash
serverless invoke --function functionName --data '{"name": "Bernie"}'
```

This example will invoke the function with the provided data and output the result in the terminal.
34 changes: 34 additions & 0 deletions docs/providers/google/cli-reference/logs.md
@@ -0,0 +1,34 @@
<!--
title: Serverless Framework Commands - Google Cloud Functions - Logs
menuText: Logs
menuOrder: 9
description: View logs of your Google Cloud Functions Function within your terminal using the Serverless Framework
layout: Doc
-->

<!-- DOCS-SITE-LINK:START automatically generated -->
### [Read this on the main serverless docs site](https://www.serverless.com/framework/docs/providers/google/cli-reference/logs)
<!-- DOCS-SITE-LINK:END -->

# Logs

Lets you watch the logs of a specific function.

```bash
serverless logs --function functionName
```

## Options

- `--function` or `-f` The function you want to fetch the logs for. **Required**
- `--count` or `-c` The number of logs to display.

## Examples

### Retrieving logs

```bash
serverless logs --function functionName
```

This will display logs for the specified function.
31 changes: 31 additions & 0 deletions docs/providers/google/cli-reference/remove.md
@@ -0,0 +1,31 @@
<!--
title: Serverless Framework Commands - Google Cloud Functions - Remove
menuText: Remove
menuOrder: 13
description: Remove a deployed Service and all of its Google Cloud Functions Functions, Events and Resources
layout: Doc
-->

<!-- DOCS-SITE-LINK:START automatically generated -->
### [Read this on the main serverless docs site](https://www.serverless.com/framework/docs/providers/google/cli-reference/remove)
<!-- DOCS-SITE-LINK:END -->

# Remove

The `serverless remove` command will remove the deployed service, defined in your current working directory, from the provider.

**Note:** Only the deployed service with all its resources will be removed. The code on your local machine will remain.

```bash
serverless remove
```

## Examples

### Service removal

```bash
serverless remove
```

This example will remove the deployed service of your current working directory.
19 changes: 19 additions & 0 deletions docs/providers/google/events/README.md
@@ -0,0 +1,19 @@
<!--
title: Serverless - Google Cloud Functions - Events
menuText: Google Cloud Functions Events
layout: Doc
-->

<!-- DOCS-SITE-LINK:START automatically generated -->
### [Read this on the main serverless docs site](https://www.serverless.com/framework/docs/providers/google/events/)
<!-- DOCS-SITE-LINK:END -->

# Serverless Google Cloud Functions Events

Welcome to the Serverless Google Cloud Functions Events Glossary!

Please select a section on the left to get started.

If you have questions, join the [chat in gitter](https://gitter.im/serverless/serverless) or [post over on the forums](http://forum.serverless.com/)

**Note:** Before continuing [Google Cloud system credentials](../guide/credentials.md) are required for using the CLI.
42 changes: 42 additions & 0 deletions docs/providers/google/events/event.md
@@ -0,0 +1,42 @@
<!--
title: Serverless Framework - Google Cloud Functions Events - Event
menuText: Event
menuOrder: 2
description: Setting up Event events with Google Cloud Functions via the Serverless Framework
layout: Doc
-->

<!-- DOCS-SITE-LINK:START automatically generated -->
### [Read this on the main serverless docs site](https://www.serverless.com/framework/docs/providers/google/events/event)
<!-- DOCS-SITE-LINK:END -->

## Event

Your Google Cloud Function can be triggered by different `event` sources. Those event sources can be defined and configured with the help of the `event` event.

## Event events

This example sets up a `pubSub` event which will trigger the `first` function whenever a message is published to the `my-topic` topic.

```yml
# serverless.yml

functions:
first:
handler: pubSub
events:
- event:
eventType: providers/cloud.pubsub/eventTypes/topics.publish
resource: projects/*/topics/my-topic
```

```javascript
// index.js

exports.pubSub = (event, callback) => {
console.log('Hello World!');
callback();
};
```

**Note:** See the documentation about the [function handlers](../guide/functions.md) to learn how your handler signature should look like to work this type of event.