镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content
enumcoPublic

About

enum Go API Client

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

9 Commits

Folders and files

Repository files navigation

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

About

enum Go API Client

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages