outscale_api 1.19.0

Outscale API SDK
Documentation
API_VERSION=$(shell cat api_version)
SDK_VERSION=$(shell cat sdk_version)
USER_ID=$(shell id -u)
GROUP_ID=$(shell id -g)
OPENAPI_IMAGE=openapitools/openapi-generator-cli:v6.0.1
PWD=$(shell pwd)

all: help

.PHONY: help
help:
	@echo "help:"
	@echo "- make gen  : regenerate SDK"
	@echo "- make test : run all tests"

.PNONY: openapi-generator-help
openapi-generator-help:
	docker run --rm $(OPENAPI_IMAGE) config-help -g rust

.PHONY: gen
gen: clean osc-api/outscale.yaml
	rm -rf .sdk || true
	mkdir .sdk
	docker run -v $(PWD):/sdk --rm $(OPENAPI_IMAGE) generate -i /sdk/osc-api/outscale.yaml -g rust -t ./sdk/templates -c /sdk/gen.yml -o /sdk/.sdk --additional-properties=packageVersion=$(SDK_VERSION)
	# Set default user agent including sdk version using reproductible sed.
	docker run -v $(PWD):/sdk --rm $(OPENAPI_IMAGE) chown -R $(USER_ID).$(GROUP_ID) /sdk/.sdk
	rm -rf .sdk/git_push.sh
	mv .sdk/README.md .sdk/docs/README.md
	mv .sdk/* .
	rm -rf .sdk
	cargo fmt

osc-api/outscale.yaml:
	git clone https://github.com/outscale/osc-api-deploy.git osc-api && cd osc-api && git checkout -b $(API_VERSION) $(API_VERSION)

.PHONY: clean
clean:
	rm -rf .sdk osc-api Cargo.toml docs src || true

.PHONY: test
test: build-test reuse-test examples-test regen-test
	@echo all tests OK

.PHONY: build-test
build-test:
	cargo build --all-targets

.PHONY: reuse-test
reuse-test:
	docker run --rm --volume $(PWD):/data fsfe/reuse:5.1 lint

.PHONY: examples-test
examples-test:
	cargo run --example volume
	cargo run --example region
	cargo run --example keypair
	cargo run --example config_file

# try to regen, should not have any difference
.PHONY: regen-test
regen-test: gen
	git add Cargo.toml docs src
	git diff --cached -s --exit-code
	git diff -s --exit-code

.PHONY: osc-api-check
osc-api-check:
	bash .github/scripts/osc-api-check.sh

.PHONY: release-build
release-build:
	bash .github/scripts/release-build.sh