Skip to content

Latest commit

 

History

History
67 lines (47 loc) · 1.69 KB

README.md

File metadata and controls

67 lines (47 loc) · 1.69 KB

Genesis Cloud Go Client

The Genesis Cloud Go client provides the ability to manage each services resources programmatically from scripts or applications.

This repository is licensed under Mozilla Public License 2.0 (no copyleft exception) (see LICENSE.txt).

Maintainers

This client is maintained by Genesis Cloud. If you encounter any problems, feel free to create issues or pull requests.

Requirements

  • Go >= 1.19

Installation

go get github.com/genesiscloud/genesiscloud-go

Getting Started

import "github.com/genesiscloud/genesiscloud-go"

// Generic pointer in Go 1.18+. Alternatively use "k8s.io/utils/pointer"
func pointer[T any](v T) *T {
	return &v
}

client, err := genesiscloud.NewGenesisCloudClient(genesiscloud.ClientConfig{
	Token: os.Getenv("GENESISCLOUD_TOKEN"),
})
if err != nil {
	// ...
}

resp, err := client.ListInstancesWithResponse(ctx, &genesiscloud.ListInstancesParams{
	Page:    pointer(1),
	PerPage: pointer(100),
})
if err != nil {
	// ...
}

Examples

You can find additional examples in the GoDoc or check the examples folder.

GENESISCLOUD_TOKEN="XXXX" go run ./examples/list-instances

Development or update of OpenAPI document

# Update openapi.yaml (./codegen/openapi.yaml)

# Generate code
go generate ./...