Terminal commands for setting up a Code Engine webhook and example application repository
- IBM Cloud CLI installed.
- Github CLI client installed and authenticated.
SHELL:=/bin/zsh | |
.SHELLFLAGS := -eu -o pipefail -c | |
.ONESHELL: | |
PY_VERSION = 3.11.0 | |
VENV = .venv | |
PY = $$(if [ -f $(VENV)/bin/python ]; then echo $(VENV)/bin/python; else echo python; fi) | |
PIP = $(PY) -m pip | |
PWD = $(shell pwd) |
Terminal commands for setting up a Code Engine webhook and example application repository
import hmac | |
import os | |
import json | |
import hashlib | |
import httpx | |
def main(params): | |
"""Main parameter for function.""" | |
ibmcloud_api_key = os.environ.get('IBMCLOUD_API_KEY') |
#!/usr/bin/env python3 | |
# Author: Ryan Tiffany | |
# Copyright (c) 2024 | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, |
# usage: get_ubuntu_images VPC_REGION | |
function get_ubuntu_images() { | |
ibmcloud login -r "$@" -q >/dev/null 2>&1 | |
vpc_region=$(ibmcloud target --output json | jq -r '.region.name') | |
printf "%b" "\e[1;34mGetting Ubuntu images in ${vpc_region}:.\e[0m" | |
printf '\n' | |
ibmcloud is images --visibility public --output json | jq -r '.[] | select(.status=="available") | select(.operating_system.architecture=="amd64") | select(.name | startswith("ibm-ubuntu")) | .name,.id' | |
} | |
# usage: get_windows_images VPC_REGION |
import SoftLayer | |
from prettytable import PrettyTable | |
import click | |
from datetime import datetime | |
from rich.console import Console | |
from rich.table import Column, Table | |
class VSIExample(): | |
def __init__(self): | |
client = SoftLayer.Client() |
import SoftLayer | |
from prettytable import PrettyTable | |
import click | |
class LBaasExample(): | |
def __init__(self): | |
client = SoftLayer.Client() | |
self.lbaas_service = client['Network_LBaaS_LoadBalancer'] | |
def get_list(self, dc=None): |
┌─[ryan@europa] - [~/Desktop/ibmcloud-icd-mysql] - [Tue Jul 18, 10:10] | |
└─[$] <> export TF_LOG=DEBUG | |
┌─[ryan@europa] - [~/Desktop/ibmcloud-icd-mysql] - [Tue Jul 18, 10:11] | |
└─[$] <> terraform apply | |
2023-07-18T10:11:18.531-0500 [INFO] Terraform version: 1.5.3 | |
2023-07-18T10:11:18.531-0500 [DEBUG] using github.com/hashicorp/go-tfe v1.26.0 | |
2023-07-18T10:11:18.531-0500 [DEBUG] using github.com/hashicorp/hcl/v2 v2.16.2 | |
2023-07-18T10:11:18.531-0500 [DEBUG] using github.com/hashicorp/terraform-svchost v0.1.0 | |
2023-07-18T10:11:18.531-0500 [DEBUG] using github.com/zclconf/go-cty v1.12.2 | |
2023-07-18T10:11:18.531-0500 [INFO] Go runtime version: go1.20 |
2023-07-18T10:01:06.313-0500 [DEBUG] provider.terraform-provider-ibm_v1.55.0: Strict-Transport-Security: max-age=63072000; includeSubDomains | |
2023-07-18T10:01:06.313-0500 [DEBUG] provider.terraform-provider-ibm_v1.55.0: X-Content-Type-Options: nosniff | |
2023-07-18T10:01:06.313-0500 [DEBUG] provider.terraform-provider-ibm_v1.55.0: X-Download-Options: noopen | |
2023-07-18T10:01:06.313-0500 [DEBUG] provider.terraform-provider-ibm_v1.55.0: X-Envoy-Upstream-Service-Time: 1038 | |
2023-07-18T10:01:06.313-0500 [DEBUG] provider.terraform-provider-ibm_v1.55.0: X-Permitted-Cross-Domain-Policies: none | |
2023-07-18T10:01:06.313-0500 [DEBUG] provider.terraform-provider-ibm_v1.55.0: X-Request-Id: d1b0443a-82fd-4a11-ba59-afa650267ba5 | |
2023-07-18T10:01:06.313-0500 [DEBUG] provider.terraform-provider-ibm_v1.55.0: X-Runtime: 1.034365 | |
2023-07-18T10:01:06.313-0500 [DEBUG] provider.terraform-provider-ibm_v1.55.0: X-Xss-Protection: 1; mode=block | |
2023-07-18T10:01:06.313-0500 [DEBUG] provider.terraform-provider-ibm_v1.55.0: | |
2023-07-18T10:01:06. |