connection

package
v0.5.9 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2023 License: Apache-2.0 Imports: 11 Imported by: 14

README

connection

This directory contains a Go package that can be used to get a Registry API client that authenticates using passed Config.

Configurations can be automatically loaded from files in ~/.config/registry. This includes the file active_config - which contains only the bare name (no path) of a config file in the same directory. The config file it points to should contain yaml configuration similar to this:

registry:
    address: localhost:8080
    insecure: true

Note: These configuration files can be maintained by way of the registry config and the registry config configurations commands. See the help on those commands for more details.

The properties from these config files can be overridden using the following flags:

      --registry.address string   the server and port of the registry api (eg. localhost:8080)
      --registry.insecure         if specified, client connects via http (not https)
      --registry.token string     the token to use for authorization to registry

See config.go for more programming details.

The following environment variables are also used for overrides for testing and internal purposes, but should be avoided for production as they are not guaranteed:

  • APG_REGISTRY_ADDRESS
  • APG_REGISTRY_INSECURE

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetConfig added in v0.5.7

func SetConfig(config Config)

SetConfig forces the active configuration to use the specified value.

Types

type AdminClient

type AdminClient = *gapic.AdminClient

func NewAdminClient

func NewAdminClient(ctx context.Context) (AdminClient, error)

NewAdminClient creates a new client using the active Config.

func NewAdminClientWithSettings

func NewAdminClientWithSettings(ctx context.Context, config Config) (AdminClient, error)

NewAdminClientWithSettings creates a client with specified Config.

type Config added in v0.5.5

type Config struct {
	Address  string `mapstructure:"address"`  // service address
	Insecure bool   `mapstructure:"insecure"` // if true, connect over HTTP
	Location string `mapstructure:"location"` // optional
	Project  string `mapstructure:"project"`  // optional
	Token    string `mapstructure:"token"`    // bearer token
}

Config configures the client.

func ActiveConfig added in v0.5.5

func ActiveConfig() (Config, error)

ActiveConfig returns the active config.

func ReadConfig added in v0.5.5

func ReadConfig(name string) (Config, error)

Reads a Config from a file. If name is empty, no file will be loaded and only bound flags and env vars will be used.

func (Config) FQName added in v0.5.6

func (c Config) FQName(name string) string

FQName ensures the project and location, if available, are properly included to make ensure the resource name is fully qualified.

func (Config) ProjectWithLocation added in v0.5.7

func (c Config) ProjectWithLocation() (string, error)

type ProvisioningClient added in v0.5.5

type ProvisioningClient = *gapic.ProvisioningClient

func NewProvisioningClient added in v0.5.5

func NewProvisioningClient(ctx context.Context) (ProvisioningClient, error)

NewAdminClient creates a new client using the active Config.

func NewProvisioningClientWithSettings added in v0.5.5

func NewProvisioningClientWithSettings(ctx context.Context, config Config) (ProvisioningClient, error)

NewAdminClientWithSettings creates a GAPIC client with specified Config.

type RegistryClient

type RegistryClient = *gapic.RegistryClient

RegistryClient is a client of the Registry API

func NewRegistryClient added in v0.5.5

func NewRegistryClient(ctx context.Context) (RegistryClient, error)

NewRegistryClient creates a new client using the active Config.

func NewRegistryClientWithSettings added in v0.5.5

func NewRegistryClientWithSettings(ctx context.Context, config Config) (RegistryClient, error)

NewRegistryClientWithSettings creates a client with specified Config.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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