FROM ubuntu:22.04
WORKDIR /app
RUN apt-get update && \
apt-get install -y -q --allow-unauthenticated \
build-essential \
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import csv | |
| import click | |
| from ibm_cloud_sdk_core.authenticators import IAMAuthenticator | |
| from ibm_cloud_sdk_core.api_exception import ApiException | |
| from ibm_platform_services.resource_controller_v2 import * | |
| from ibm_platform_services import IamIdentityV1, ResourceManagerV2 | |
| from rich.console import Console | |
| from rich.table import Table | |
| from rich.text import Text |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # https://taskfile.dev/ | |
| version: "3" | |
| vars: | |
| TERM: screen-256color | |
| MAIN_PYTHON: python3 | |
| LOCAL_PATH: | |
| sh: 'echo "$(cd "$( dirname -- "$0" )" && pwd)"' | |
| venv_path: "{{.LOCAL_PATH}}/.venv" | |
| venv_bin_path: "{{.LOCAL_PATH}}/.venv/bin" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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' | |
| } | |
| function get_windows_images() { | |
| ibmcloud login -r "$@" -q >/dev/null 2>&1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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
- IBM Cloud CLI installed.
- Github CLI client installed and authenticated.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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() |
