Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces support for talking to Apstra via the API-ops cloud proxy.
When talking via the proxy, we need to know:
url
configuration element - it is now either the URL of Apstra, or the URL of the proxy, depending on other configuration)We don't need to know the username/password and we'll never authenticate or handle an authentication token.
Payloads to and from the API-ops proxy are encapsulated in extra messaging layers.
Changes in this PR:
ClientCfg
struct has sprouted a new element:apiOpsDcId *string
. When not-nil, the element signals that we should be talking via proxy.ClientCfg.NewClient()
setsapiOpsDcId
based on environment variableAPI_OPS_DATACENTER_EDGE_ID
.ClientCfg.validate()
does not complain about missing credentails whenAPI_OPS_DATACENTER_EDGE_ID
is set.Client.login()
andClient.logout
functions no longer start/stop the task monitor goroutine. That behavior has been moved toClient.Login()
andClient.Logout()
. The public methods do not invoke their respective private methods when the proxy is enabled. Clients running in proxy mode have the task monitor pre-started.Client.talkToApstra()
callsClient.talkToApiOps()
(same function signature) when in proxy mode.talkToApiOps()
defaults to requesting gzip compression from Apstra. This is an attempt to keep payloads below the 1MB limit imposed by the API-ops proxy. Payloads exceeding the limit will be relayed through S3. TODOtalkToApstra()
functionality is reimplemented intalToApiOps()
with proxy-specific behaviors.Login()
orLogout()
must now be skipped.getTestClients()