Giter VIP home page Giter VIP logo

lua-resty-gcp's Introduction

lua-resty-gcp

GCP SDK libary for OpenResty.

Status

This library is under early development. New releases may contain breaking changes until further notice.

Pre-requisites

Installation

Installation is easiest using LuaRocks in the local folder

luarocks make

Testing

The test will go through:

  1. Test if GCP services imported
  2. Test getting Access Token (Will need to set environment variable GCP_SERVICE_ACCOUNT)
  3. Test using GCP services (Will need to change thew service and param in spec/01-test_spec.lua)
busted

Using the SDK

This is an example. This creates a Secret Manager client and retrieves the secret versions:

local base64 = require "base64"
local GCP = require "resty.gcp"
local AccessToken = require "resty.gcp.request.credentials.accesstoken"
local gcp = GCP()
local gcpToken = AccessToken()

local params = {
    projectsId = "kong-supersecret-project",
    secretsId = "kong-secret-cmek",
    versionsId = 1
}

local response = gcp.secretmanager_v1.versions.access(gcpToken, params)

print("The secret is: " .. base64.decode(response.payload.data))

TLS and certificate failures

The http client defaults to tls name verification. For this to work, the CA store must be set. With OpenResty this is done through the lua_ssl_trusted_certificate directive. However; the compatibility module used, lua-resty-luasocket, cannot automatically read that setting, hence you have to set it manually, see the docs.

Development

Updating the API Definitions

Use the update-api-defs file in the scripts directory to update all API definitions:

$ ./scripts/update-api-defs

Take special care to note and investigate any failures logged by this script (i.e. download failures) before commiting the changes.

Adding/Removing Source Files

Use the update-rockspec script to write the updated module list to the rockspec file if files are added or removed during development.

$ ./scripts/update-rockspec

Releasing New Versions

Before releasing a new version, please make sure the API Definitions and rockspec files are up-to-date.

As an example, let's assuming that we are releasing 0.1.0.

  1. Change the filename of the rockspec to the new version: lua-resty-gcp-0.1.0-1.rockspec;
  2. Then change the version in rockspec file to 0.1.0-1, and source.tag to 0.1.0;
  3. Create new tag with command: git tag 0.1.0, and push that tag with git push --tags;
  4. Create new release for github with the new tag, and make sure the change is included in the description;
  5. Upload the rock to with Luarocks: luarocks upload lua-resty-gcp-0.1.0-1.rockspec.

lua-resty-gcp's People

Contributors

lokesh-chechani avatar starlightibuki avatar flrgh avatar hanshuebner avatar windmgc avatar fffonion avatar saisatishkarra avatar

Stargazers

3500 avatar

Watchers

 avatar Guanlan D. avatar Xiaochen Wang avatar Yvonne Lam avatar Marco Palladino avatar Aapo Talvensaari avatar Wanny Morellato avatar Thijs Schreijer avatar Datong Sun avatar Zhongwei Yao avatar  avatar Christian Johannsen avatar  avatar Chrono avatar Brent Yarger avatar Yufu Zhao avatar  avatar Shiroko avatar  avatar Felderi Santiago avatar  avatar  avatar

lua-resty-gcp's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.