id

package
v0.0.0-...-860e413 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultWebhookPath = "http://metadata.google.internal/computeMetadata/v1/instance/id"
)

Variables

This section is empty.

Functions

func Configure

func Configure(config *Config)

Types

type Config

type Config struct {
	// Configuration for the identification of machines.
	Identification Identification
}
var (
	GeneratorConfig *Config = nil
)

type Generator

type Generator interface {
	Next() (string, error)
}

func SonyFlakeGenerator

func SonyFlakeGenerator() Generator

SonyFlakeGenerator creates a new id generator the function panics if the generator cannot be created

type Hostname

type Hostname struct {
	// Try to use hostname when identifying the machine uniquely
	Enabled bool
}

type Identification

type Identification struct {
	// Configuration for using private IP to identify a machine.
	PrivateIp PrivateIp
	// Configuration for using hostname to identify a machine.
	Hostname Hostname
	// Configuration for using a webhook to identify a machine.
	Webhook Webhook
}

type PrivateIp

type PrivateIp struct {
	// Try to use private IP when identifying the machine uniquely
	Enabled bool
}

type Webhook

type Webhook struct {
	// Try to use webhook when identifying the machine uniquely
	Enabled bool
	// The URL of the metadata endpoint to query
	Url string
	// (Optional) A JSONPath expression for the data to extract from the response from the metadata endpoint
	JPath *string
	// (Optional) Headers to pass in the metadata request
	Headers *map[string]string
}

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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