19 lines
		
	
	
		
			409 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
			
		
		
	
	
			19 lines
		
	
	
		
			409 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
#!/usr/bin/env bash
 | 
						|
# Copyright (C) 2023  Umorpha Systems
 | 
						|
# SPDX-License-Identifier: AGPL-3.0-or-later
 | 
						|
 | 
						|
if out="$(curl \
 | 
						|
	--no-progress-meter \
 | 
						|
	--fail-with-body \
 | 
						|
	-H "Authorization: Bearer ${VULTR_API_KEY:-$(cat secrets/vultr-api-key.txt)}" \
 | 
						|
	-H "Content-Type: application/json" \
 | 
						|
	"https://api.vultr.com/v2/$@")"
 | 
						|
then
 | 
						|
	if [[ -n "$out" ]]; then
 | 
						|
		printf '%s\n' "$out"
 | 
						|
	fi
 | 
						|
else
 | 
						|
	jq <<<"$out" >&2
 | 
						|
	exit 1
 | 
						|
fi
 |