Open mristok opened 1 year ago
@mristok api.equinix.com should be used, it is used in other integrations including ClusterAPI, Terraform, MetalCLI and the new Ansible Equinix collection.
In the Ansible Equinix collection we are using https://github.com/equinix-labs/metal-python/ (v0.1.0) / https://pypi.org/project/equinix-metal/.
This package is generated from the API spec so it is much more complete than packet-python.
Using the following local helper script, I didn't run into problems using api.packet.net:
#!/usr/bin/env bash
# emget: helper to GET Metal API requests. uses Metal CLI for auth defaults.
eval $(metal env)
P="$1"
DATA="$2"
METAL_API_URL="${METAL_API_URL:-https://api.equinix.com/metal/v1}"
CURL_OPT="${CURL_OPT:--s}"
curl ${CURL_OPT} -X GET \
-H "X-Auth-Token: $METAL_AUTH_TOKEN" \
-H "Content-Type: application/json" \
"${METAL_API_URL}/$P" | jq .
$ METAL_API_URL=https://api.packet.net CURL_OPT="-s -v" emget /projects
...
> GET //projects HTTP/2
> Host: api.packet.net
> user-agent: curl/7.87.0
> accept: */*
> x-auth-token: ...
> content-type: application/json
>
* Connection state changed (MAX_CONCURRENT_STREAMS == 256)!
< HTTP/2 200
...
All that aside, packet-python should get an update to api.equinix.com/metal/v1 and perhaps an environment variable way to override that ahead of any deprecation.
I am encountering HTTP 403 with a verified valid token against the client package default API endpoint
api.packet.net
. I suspected that this is due to deprecation of the endpoint in favor ofapi.equinix.com
. Testing with the client endpoint changed (overridden) toapi.equinix.com/metal/v1
indeed results is successful API calls with the client, however my testing was fairly limited in scope.Please review if the
api.packet.net
endpoint is in fact deprecated, and make all necessary adjustments to account for (if necessary) the new appropriate endpoint.