Skip to content

Commit

Permalink
fix!: rm uneccesary code
Browse files Browse the repository at this point in the history
  • Loading branch information
1riatsila1 committed Nov 27, 2024
1 parent ff5e95e commit 07daaad
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 173 deletions.
25 changes: 3 additions & 22 deletions Justfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
OPEN_API_TMP_DIR := "tmp"
CLIENT_DIR := "pkg/config-api-client"
TOOLS_PROVIDER_DIR := "tools"
OPENAPI_SPEC := "pkg/config-api-client/api"
Expand All @@ -8,18 +7,10 @@ SOURCE_OPEN_API_SPEC_FILE := ".openapi.source.yaml"
help:
@just --list

_retrieve-config-api-openapi-spec:
rm -rf {{ OPEN_API_TMP_DIR }}
git clone [email protected]:aruba-uxi/configuration-api.git --depth=1 {{ OPEN_API_TMP_DIR }}
mkdir -p {{ OPENAPI_SPEC }}
cp {{ OPEN_API_TMP_DIR }}/oas/openapi.yaml {{ OPENAPI_SPEC }}/{{ SOURCE_OPEN_API_SPEC_FILE }}
rm -rf {{ OPEN_API_TMP_DIR }}

_remove-client-files:
cd {{ CLIENT_DIR }} && cat .openapi-generator/FILES | xargs -n 1 rm -f

generate-config-api-client: _retrieve-config-api-openapi-spec
just _remove-client-files
generate-config-api-client: _remove-client-files
docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli generate \
--input-spec /local/{{ OPENAPI_SPEC }}/{{ SOURCE_OPEN_API_SPEC_FILE }} \
--generator-name go \
Expand All @@ -33,11 +24,11 @@ generate-config-api-client: _retrieve-config-api-openapi-spec
just tidy-client
just fmt-client

setup-dev:
setup-run:
grep -q "registry.terraform.io/arubauxi/hpeuxi" ~/.terraformrc && echo "Dev override found - installing provider locally" || { echo "Dev override not found - please follow README setup guide"; exit 1; }
go install .

remove-dev-override:
remove-setup-run-dev-override:
sed -i '' '/registry\.terraform\.io\/arubauxi\/hpeuxi/d' ~/.terraformrc

build-local:
Expand Down Expand Up @@ -140,13 +131,3 @@ tidy:

clean:
find . -name ".coverage*" -type f -delete

DEFAULT_EXAMPLE := "full-demo"

plan example=DEFAULT_EXAMPLE +ARGS='':
go install .
cd examples/{{example}} && terraform plan {{ ARGS }}

apply example=DEFAULT_EXAMPLE +ARGS='':
go install .
cd examples/{{example}} && terraform apply {{ ARGS }}
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- [Justfile](#justfile)
- [Installing the provider locally](#installing-the-provider-locally)
- [Running Local Test Suite](#running-local-test-suite)
- [Updating the client](#updating-the-client)
- [Running Acceptance Tests](#running-acceptance-tests)
- [Building and Distribution](#building-and-distribution)

Expand Down Expand Up @@ -134,7 +135,7 @@ just help
### Installing the provider locally

```shell
just setup-dev
just setup-run
```

## Running Local Test Suite
Expand All @@ -143,6 +144,14 @@ just setup-dev
just test
```

## Updating the client

The client used for interfacing with the UXI backend is autogenerated using an API Spec and [openapitools](https://github.com/OpenAPITools/openapi-generator-cli). In order to generate a client, ensure that the desired OpenAPI spec is copied to `./pkg/config-api-client/api/openapi.yaml`. Thereafter run:

```shell
just generate-config-api-client
```

## Running Acceptance Tests

Set the `GREENLAKE_UXI_CLIENT_ID` and `GREENLAKE_UXI_CLIENT_SECRET` environment variables for the acceptance test customer. The client credentials must have sufficient permissions execute create, read, update and destroy operations for the UXI customer. Also set the `UXI_HOST` environment variable to target the staging
Expand Down
150 changes: 0 additions & 150 deletions examples/full-demo/main.tf

This file was deleted.

0 comments on commit 07daaad

Please sign in to comment.