aiven

package module
v0.73.0 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 55 Imported by: 4

README

go-client-codegen

go-client-codegen is an automatically code generated Aiven Go Client from the Aiven API specification.

Warning: this client is under heavy development.

Setup

go get github.com/aiven/go-client-codegen
Configuration and Usage
Via Environment Variables
Name Type Description
AIVEN_TOKEN string Aiven API Authentication Token
AIVEN_WEB_URL string Aiven API URL
AIVEN_USER_AGENT string User Agent
AIVEN_DEBUG bool Debug Output Flag (stderr)
Via Constructor Options
import "github.com/aiven/go-client-codegen"

client, err := aiven.NewClient(DebugOpt(true), UserAgentOpt("foo"))
if err != nil {
	return err
}

services, err := client.ServiceList(ctx, "bar-project")

See CONTRIBUTING.md for instructions on how to contribute to the development of go-client-codegen.

License

go-client-codegen is licensed under the Apache license, version 2.0. Full license text is available in the LICENSE file.

Please note that the project explicitly does not require a CLA (Contributor License Agreement) from its contributors.

Contact

Bug reports and patches are very welcome, please post them as GitHub issues and pull requests at https://github.com/aiven/go-client-codegen. To report any possible vulnerabilities or other serious issues please see our security policy.

Documentation

Overview

Package aiven provides a client for interacting with the Aiven API.

Package aiven provides a client for interacting with the Aiven API.

Package aiven provides a client for interacting with the Aiven API.

Package aiven provides a client for interacting with the Aiven API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAlreadyExists

func IsAlreadyExists(err error) bool

IsAlreadyExists returns true if the error message and error code that indicates that entity already exists

func IsNotFound

func IsNotFound(err error) bool

IsNotFound returns true if the specified error has status 404

func Version added in v0.5.0

func Version() string

Version returns aiven-go-client version string

Types

type Doer

type Doer interface {
	Do(req *http.Request) (*http.Response, error)
}

Doer aka http.Client

type Error

type Error struct {
	// Aiven error response fields https://api.aiven.io/doc/#section/Responses/Failed-responses
	Message string `json:"message"`
	Errors  any    `json:"errors"`

	// Internal fields
	OperationID string `json:"-"`
	Status      int    `json:"-"`
}

Error represents an Aiven API Error.

func (Error) Error

func (e Error) Error() string

Error concatenates all the fields.

type OperationIDKey

type OperationIDKey struct{}

OperationIDKey is the key used to store the operation ID in the context.

type Option

type Option func(*aivenClient)

Option is a function that configures the client.

func DebugOpt

func DebugOpt(debug bool) Option

DebugOpt whether should the client run in debug mode. For instance, to output debug information

func DoerOpt

func DoerOpt(doer Doer) Option

DoerOpt replaces underlying http client in aivenClient

func HostOpt

func HostOpt(host string) Option

HostOpt API host url

func RetryMaxOpt added in v0.56.0

func RetryMaxOpt(retryMax int) Option

RetryMaxOpt sets the maximum number of retries

func RetryWaitMaxOpt added in v0.56.0

func RetryWaitMaxOpt(retryWaitMax time.Duration) Option

RetryWaitMaxOpt sets the maximum wait time between retries

func RetryWaitMinOpt added in v0.56.0

func RetryWaitMinOpt(retryWaitMin time.Duration) Option

RetryWaitMinOpt sets the minimum wait time between retries

func TokenOpt

func TokenOpt(token string) Option

TokenOpt runs the client with the given token

func UserAgentOpt

func UserAgentOpt(userAgent string) Option

UserAgentOpt sets User-Agent header

Jump to

Keyboard shortcuts

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