This API Client provides a Go Library for using Waypoint's Public API
Fetch and install the package:
go get github.com/hashicorp/waypoint-clientThis Waypoint Client can authenticate against Self-Managed Waypoint instances or HCP Waypoint instance.
Client credentials are required for authentication against HCP Waypoint. In order to use this API Client with HCP Waypoint, you will need to provide the API Client with the following config values for authentication. Found in the HCP Portal https://portal.cloud.hashicorp.com/
the organization id.
the hcp project id.
The application id.
The application secret.
To authenticate against a Self Managed Instance of Waypoint, you will need to provide the API Client with the following config values:
The URL of the Waypoint Server.
The user token used for auth in self-managed Waypoint.
Waypoint by default runs with a self-signed certificate.
-
Add the API Client Library to your go.mod
require ( github.com/hashicorp/waypoint-client {latest release}
-
Example code for initializing a HCP Waypoint API Client
clientConfig, err := apiclient.NewWithHCP("hcp_org_id",
"hcp_project_id",
"client_id",
"client_secret", context.Background())
if err != nil {
panic(err)
}
client, err := apiclient.New(*clientConfig)
if err != nil {
log.Fatal(err)- Example code for initializing a Self Managed Waypoint API Client
clientConfig, err := client.NewWithSelfManaged("waypoint-user-token", "localhost:9702", true)
if err != nil {
panic(err)
}
client, err := client.New(*clientConfig)
if err != nil {
log.Fatal("Unable to setup client", err)
}See examples/hcp/main.go for a complete example for HCP and examples/self-managed/main.go for a self-managed Waypoint server.