Skip to content

Add labels support #94

@jbutz

Description

@jbutz

This is a Feature Proposal

Description

Google Cloud Engine Functions support labels to allow the grouping of functions and other resources. These are supported by Google's API, and could already be used with the version included in this plugin.

Google requires that the labels be key-value pairs. I suggest a new labels property be added to the function definition and that the new property accepts an object. An example with a single label is below.

...
functions:
  first:
    handler: http
    labels:
      application: Serverless Example
    events:
      - http: path
...

I also suggest allowing global labels to be defined in a labels property on the provider property, as in the example below.

service: my-gcloud-service

provider:
  name: google
  labels:
    application: Serverless Example
...

These two objects should be merged to allow overriding values and to decrease repetition.

service: my-gcloud-service

provider:
  name: google
  labels:
    application: Serverless Example
    team: Experienced Devs

plugins:
  - serverless-google-cloudfunctions

functions:
  helloWorld:
    handler: helloWorld
    labels:
      team: Interns
    events:
      - http: path
  fooBar:
    handler: fooBar
    events:
      - http: path

Given the above configuration both the helloWorld and fooBar functions would have an application label with Serverless Example as the value. Both would also have a team label. The value for the fooBar function would be Experienced Devs and the value for the helloWorld function would be Interns.

I was able to rough this feature in very quickly. I'd like to fully implement it and the tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions