Help us shape the future of Go! Take the 2026 Go Developer Survey

client

package module
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

README

enum Go API Client

Go client for the enum API.

Install

go get github.com/enumco/client-go

Usage

package main

import (
 "context"
 "fmt"
 "log"

 client "github.com/enumco/client-go"
 apiv1 "github.com/enumco/proto-gen-go/gen/enum/api/v1"
)

func main() {
 c, err := client.New(client.WithToken("your-api-token"))
 if err != nil {
  log.Fatal(err)
 }
 defer c.Close()

 resp, err := c.Organizations.ListOrganizations(context.Background(), &apiv1.ListOrganizationsRequest{})
 if err != nil {
  log.Fatal(err)
 }

 for _, org := range resp.GetOrganizations() {
  fmt.Println(org.GetName())
 }
}

Services

Field Service
c.Organizations OrganizationService
c.Projects ProjectService
c.Regions RegionService
c.Users UserService
c.Kubernetes.Clusters KubernetesClusterService
c.Storage.Users ObjectStorageUserService
c.Storage.AccessKeys ObjectStorageAccessKeyService
c.Storage.Buckets ObjectStorageBucketService
c.Storage.Policies ObjectStorageUserPolicyService
c.DNS DnsService
c.ServiceAccounts ServiceAccountService

Options

Option Description
WithToken(token string) Bearer token for authentication
WithAddr(addr string) Override the API endpoint (default: api.enum.co:443)
WithTLS(creds credentials.TransportCredentials) Custom TLS configuration
WithInsecure() Disable TLS - for local development only

The client uses TLS with system roots by default. No extra configuration needed for production use.

Documentation

See enum Docs.

License

Apache License 2.0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Organizations   apiv1.OrganizationServiceClient
	Projects        apiv1.ProjectServiceClient
	Regions         apiv1.RegionServiceClient
	Users           apiv1.UserServiceClient
	Registration    apiv1.RegistrationServiceClient
	Kubernetes      KubernetesClient
	Storage         ObjectStorageClient
	DNS             apiv1.DnsServiceClient
	ServiceAccounts apiv1.ServiceAccountServiceClient
	// contains filtered or unexported fields
}

func New

func New(opts ...ClientOption) (*Client, error)

c, err := client.New(client.WithToken("..."))

func (*Client) Close

func (c *Client) Close() error

type ClientOption

type ClientOption func(*options)

func WithAddr

func WithAddr(addr string) ClientOption

WithAddr overrides the default API endpoint (api.enum.co:443).

func WithInsecure

func WithInsecure() ClientOption

WithInsecure disables TLS. For local development only.

func WithTLS

WithTLS overrides the default TLS configuration (system roots).

func WithToken

func WithToken(token string) ClientOption

type KubernetesClient

type KubernetesClient struct {
	Clusters apiv1.KubernetesClusterServiceClient
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL