gcloud

command module
v0.0.0-...-8835833 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 4, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

README


{ "image": "direktiv/gcloud", "desc": "Executes a gcloud cli command using a golang wrapper to provide authentication via service account key file." }

Googlecli

Executes a gcloud cli command using a golang wrapper to provide authentication via service account key file.

Direktiv

An example workflow that lists all instances in a Google cloud project

id: get-instances-list
functions:
- id: post
  image: direktiv/gcloud:v1
  size: medium
description: "Displays a gcp project instances"
states:
- id: listProjectInstances
  type: action
  action:
    function: post
    input: jq(.)

Input

The input needed to run the above workflow properly is the following:

input:
  project: "GCP_PROJECT"
  serviceAccountKey: "SERVICE_ACCOUNT_KEY"
  command: ["compute", "instances", "list"]

When authenticating with the CLI nothing will be logged to the stdout of the container.

The SERVICE_ACCOUNT_KEY is a string of a Google Cloud service account json key.

To generate a service account key please refer to Google Clouds documentation.

Output

The gcloud container will append "--format=json" to the command array when executing, so the container will respond in json format.

Error

In the case that an error is encountered, it will present in the following format:

{
    "errorCode": "com.googlecli.error",
    "errorMsg": "Something went wrong"
}

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL