This repository is the Go client for the Scalingo APIs.
package main
import (
"github.com/Scalingo/go-scalingo/v7"
)
func getClient() (*scalingo.Client, error) {
config := scalingo.ClientConfig{
APIEndpoint: "https://api.osc-fr1.scalingo.com", // Possible endpoints can be found at https://developers.scalingo.com/#endpoints
APIToken: "tk-us-XYZXYZYZ", // You can create a token in the dashboard at Profile > Token > Create new token
}
return scalingo.New(config)
}
func main() {
client, err := getClient()
if err != nil {
panic(err)
}
apps, err := client.AppsList()
if err != nil {
panic(err)
}
for _, app := range apps {
println("App: " + app.Name)
}
}
As this Go client maps all the public Scalingo APIs, you can explore the API documentation. If you need an implementation example, you can take a look at the Scalingo CLI code.
A couple of files must be updated when adding support for a new event type. For
instance if your event type is named my_event
:
events_struct.go
:- Add the
EventMyEvent
constant - Add the
EventMyEventTypeData
structure - Add
EventMyEventType
structure which embeds a fieldTypeData
of the typeEventMyEventTypeData
. - Implement function
String
forEventMyEventType
- [optional] Implement
Who
function forEventMyEventType
. E.g. if the event type can be created by an addon.
- Add the
Once the Event has been added run the following command to update boilerplate code
go generate
HTTP errors are managed in the file http/errors.go. It follows the Scalingo standards detailed in the developers documentation.
Bump new version number in:
CHANGELOG.md
README.md
version.go
Commit, tag and create a new release:
version="7.0.2"
git switch --create release/${version}
git add CHANGELOG.md README.md version.go
git commit -m "Bump v${version}"
git push --set-upstream origin release/${version}
gh pr create --reviewer=EtienneM --title "$(git log -1 --pretty=%B)"
Once the pull request merged, you can tag the new release.
git tag v${version}
git push origin master v${version}
gh release create v${version}
The title of the release should be the version number and the text of the release is the same as the changelog.