Using configuration
gcloud deployment-manager deployments create sample-deployment --config vm_config.yamlUse your service account's key JSON file to get an access token to call Google APIs.
Good for seeing how things work, including the creation of JWT token.
To create a JWT token, you can replace create-jwt-token.sh script with tools like step.
If you just want to get an access token for a service account,
| import java.io.*; | |
| import java.net.URL; | |
| import java.util.Scanner; | |
| class GetPage { | |
| public static void main(String[] args) throws IOException { | |
| String endpoint = System.getProperty("endpoint"); | |
| if (endpoint == null) printUsage(); | |
| else printPage(endpoint); |
| export AWS_PROFILE := your-aws-profile | |
| auto_approve_target = apply destroy | |
| init apply destroy: | |
| cd infra && terraform $@ $(if $(filter $@,$(auto_approve_target)),-auto-approve) |
| const locationId = "KMS key's region ID" | |
| const projectId = "KMS key's project ID" | |
| const keyRring = "KMS key's key ring" | |
| const keyId = "KMS key's ID" | |
| const encryptedText = 'CiQAfn8U68PD1weop5nXO43I8srZ2pMLaxXci2tcaDnfwLt2YOUSMwDNtppaQLU82bYtoRXx/NCnLnUt05WtHl8Y2QKUNCq6QS9FJdoxCszzjsnpym7SktWn+g=='; | |
| async function useGoogleapisModule() { | |
| console.log('Use `googleapis` module to decrypt KMS encrypted secret') | |
| const {google} = require('googleapis') |
| ; src/clojure__gcp/core.clj | |
| (ns clojure--gcp.core | |
| (:import (com.google.cloud.logging LoggingOptions Logging$EntryListOption Logging))) | |
| ; Advanced logs queries: https://cloud.google.com/logging/docs/view/advanced-queries | |
| (defn make-filter [project-id] | |
| (str "logName = \"projects/" project-id "/logs/dialogflow_agent\" | |
| labels.type = \"dialogflow_response\" | |
| timestamp >= \"2020-04-05T00:00:00+11:00\"")) |
| module WithReader where | |
| import Prelude | |
| import Control.Monad.Reader (Reader, asks, runReader) | |
| import Data.String (toLower) | |
| import Effect (Effect) | |
| import Effect.Console (log) | |
| type Config = {username :: String} |
| // src/App.kt | |
| import io.vertx.core.Vertx | |
| import io.vertx.ext.web.Router | |
| fun main(args: Array<String>) { | |
| val vertx = Vertx.vertx() | |
| val router = Router.router(vertx) | |
| router.get("/health").handler { ctx -> ctx.response().end("OK") } |
| export AWS_REGION := ap-southeast-2 | |
| export AWS_ACCESS_KEY_ID := fakeForLocalDynamodb | |
| export AWS_SECRET_ACCESS_KEY := fakeSecretForLocalDynamodb | |
| endpoint := --endpoint-url http://localhost:8000 | |
| table_name := people | |
| container_name := dynamodb-local | |
| dynamo = aws dynamodb $(endpoint) |
| # Usage: | |
| # | |
| # 1. `make qube` to bring up SonarQube server | |
| # 2. Open http://localhost:9000 with your browser, | |
| # setup a new project (e.g. my-first-project) and generate a token. | |
| # Put the token and project key in this Makefile | |
| # 3. `make scan` against the repository you want to analyse | |
| # Refs | |
| # |