Skip to content

TRITON-2545 - Add CloudAPI Client for Go#24

Merged
travispaul merged 18 commits intomainfrom
go-cloudapi-client
Apr 29, 2026
Merged

TRITON-2545 - Add CloudAPI Client for Go#24
travispaul merged 18 commits intomainfrom
go-cloudapi-client

Conversation

@travispaul
Copy link
Copy Markdown
Member

@travispaul travispaul commented Apr 27, 2026

Testing notes in ticket

Comment thread apis/cloudapi-api/src/lib.rs
Comment thread clients/internal/cloudapi-client/src/lib.rs
Comment thread docs/design/action-dispatch-openapi.md
@travispaul travispaul changed the title Add CloudAPI Client for Go TRITON-2545 - Add CloudAPI Client for Go Apr 28, 2026
@travispaul travispaul marked this pull request as ready for review April 29, 2026 02:59
Copy link
Copy Markdown
Collaborator

@nshalman nshalman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!!

Comment thread Makefile Outdated
travispaul and others added 18 commits April 29, 2026 12:12
Rename VMAPI Brand to VmBrand and CreateAccessKeyResponse to
AccessKeyCredentials to resolve oapi-codegen schema name collisions.
Replace Services and Datacenters type aliases with newtype wrappers
so schemars preserves named schemas through to generated clients.

Change Timestamp from String to chrono::DateTime<Utc>, propagating
typed datetimes through the full pipeline and eliminating manual
RFC3339 parsing in the CLI.

Add Go CloudAPI client generated with oapi-codegen v2.6.0 (required
for correct omitempty on nullable optional fields). Add missing
address fields to user create/update requests. Fix
CreateImageRequest.version to be required. Add action-dispatch
design doc.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit adds support for keys in the form SHA256:fingerprint in
addition to MD5:fingerprint and fingerprints with no additional
information regarding their contents. This is useful since the Triton
documentation suggests using `ssh-keygen -l -f ~/.ssh/id_rsa` which by
default returns a SHA256 formatted fingerprint in newer versions of
OpenSSH.
* Introduce some unit testing around client.New
* Remove commented out Endpoint attribute from Client
* Document test signer
* Add support to triton-go for RBAC

This will allow users to pass a username to the SSH Agent signers so that
accounts other than the main triton account can be used

* Updating the examples to take into account SDC_USER

If there is no SDC_USER set, then we will pass an empty string to the SSH Signers and
everything will continue as it used to do so! This is no change of functionality other
than passing an extra variable to the func

* Updating the README with the addition for SDC_USER support

* Updating Create_instance example to cleanup machine after use

* Change SSHAgent funcs to accept an Input struct to future-proof additions

* Rename SDC_ env vars to TRITON_ env vars
* Rename `KeyFringerPrint` to `KeyID`.

Internally we differentiate between IDs and Fingerprints, but in the
public API, we should be good with just an ID for now.  Shorter is
better.

* Fix two formatting issues from `goimport(1)`.

* Whitespace nit

* Comment nit: TRITON_KEY_ID is preferred over SDC_KEY_ID.

* Add a comment for GetTritonEnv().

* Rename `UserName` to `Username` in the input structs for signers.

Fixes: #84

* Rename SDC variables to be Triton variables.

* Move examples into their own directory.

Having `gorename(1)` just work is a "good thing(tm)."
* pkg/compute: Replacing errwrap in the compute package

* pkg/client: Removal of errwrap from the client package

* pkg/errors: Exposing all of the Errors in 1 specific package

This consolidates the work of the errors in client/errors.go and compute/errors.go

We have a specific type of errors we can check for now

* Changing auth pkg to use an errors alias to allow expansion going forward

* Final cleanup of errwrap from the packages

* Removing the errwrap vendoring from the solution

* WIP

* pkg/client: Introduce the concept of a APIError for all Joyent API interations

We wrap every response from Triton and Manta with a DecodeError *If* the state code
is not in the 2xx range
This introduces a standward way of respresenting errors from the Joyent API to our
consumers

This also standardises the User-Agent that we pass to the Joyent APIs

* Followup on the review
The RBAC HTTP Signatures between manta and triton are slightly different

Therefore, we need to generate the signature based on whether the request
is for RBAC AND for Manta or not

We therefore, moved the logic to a central generate func rather than being
handled different;y between private key and ssh agent signers

Paired on this with @cheapRoc
Co-authored-by: Bruce Smith <b.smith@us.imshealth.com>
Replace hand-written Go types with oapi-codegen generated client from
the patched OpenAPI spec. Add HTTP Signature authentication (RSA, ECDSA,
Ed25519), typed wrappers for action-dispatch endpoints, and integration
tests covering all CloudAPI endpoints against a live instance.

Introduce newtype wrappers (Tags, RoleTags, NetworkIds, etc.) to replace
type aliases that schemars erased, giving downstream code generators
named schemas instead of anonymous inline types.

Fix HEAD endpoints to return Response<Body> instead of HttpResponseOk<T>
so generated clients don't try to parse empty bodies as JSON. Fix wire
format mismatches discovered via live testing (Role.members/policies as
objects, ProvisioningLimits as array, get_datacenter as 302 redirect).

Disable redirect following in the HTTP client because Signature auth
headers are path-bound and cannot survive redirects. Add polling for
async VMAPI operations (tags, metadata, snapshots). Add illumos build
support with prebuilt Go toolchain and CGO_ENABLED=0.

Co-Authored-By: Nahum Shalman <nshalman@edgecast.io>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@travispaul travispaul merged commit 5c9940b into main Apr 29, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants