rest_util

package
v0.22.84 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package rest_util provides helper functions to generate a client for the Ziti Fabric REST APIs. It is a meat and potato API that is meant to be consumed by higher level implementations (e.g. CLIs).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetControllerWellKnownCas

func GetControllerWellKnownCas(controllerAddr string) ([]*x509.Certificate, error)

GetControllerWellKnownCas will attempt to connect to a controller and retrieve its PKCS11 well-known CA bundle.

func NewFabricClient

func NewFabricClient(transportFactory TransportFactory, apiAddress string) (*fabric_rest_client.ZitiFabric, error)

NewFabricClient will return a ZitiFabric REST client given a transport factory and api address

func NewFabricClientWithIdentity

func NewFabricClientWithIdentity(identity identity.Identity, apiAddress string) (*fabric_rest_client.ZitiFabric, error)

NewFabricClientWithIdentity will return a ZitiFabric REST client given an identity and an apiAddress. This assumes that the fabric is running without the edge and is using cert based authentication. If the fabric is running with the edge, an appropriate edge based TransportFactory will need to be provided

func NewHttpClientWithTlsConfig

func NewHttpClientWithTlsConfig(tlsClientConfig *tls.Config) (*http.Client, error)

NewHttpClientWithTlsConfig provides a default HTTP client with generous default timeouts.

func NewTlsConfig

func NewTlsConfig() (*tls.Config, error)

NewTlsConfig creates a tls.Config with default min/max TSL versions.

Types

type IdentityTransportFactory

type IdentityTransportFactory struct {
	// contains filtered or unexported fields
}

IdentityTransportFactory will use the client TLSConfig provided by the given identity to configure a ClientTransport

func (*IdentityTransportFactory) New

type TransportConfig

type TransportConfig interface {
	// GetHost returns the host and port
	GetHost() string
	// GetBasePath returns the path to the REST API
	GetBasePath() string
	// GetSchemes returns the schemes (such as http or https) by which the REST API can be accessed
	GetSchemes() []string
}

TransportConfig provides information about how to access a REST API

func NewZitiFabricTransportConfig

func NewZitiFabricTransportConfig(apiAddress string) TransportConfig

NewZitiFabricTransportConfig will create a TransportConfig using the given API address and the default ziti fabric rest client values for base path and schema.

type TransportConfigImpl

type TransportConfigImpl struct {
	ApiAddress string
	BasePath   string
	Schemes    []string
}

TransportConfigImpl provides a default implementation of TransportConfig

func (*TransportConfigImpl) GetBasePath

func (self *TransportConfigImpl) GetBasePath() string

func (*TransportConfigImpl) GetHost

func (self *TransportConfigImpl) GetHost() string

func (*TransportConfigImpl) GetSchemes

func (self *TransportConfigImpl) GetSchemes() []string

type TransportFactory

type TransportFactory interface {
	New(config TransportConfig) (runtime.ClientTransport, error)
}

TransportFactory will provide a runtime.ClientTransport given a TransportConfig

type TransportFactoryF

type TransportFactoryF func(config TransportConfig) (runtime.ClientTransport, error)

TransportFactoryF is a func version of TransportFactory

func (TransportFactoryF) New

Jump to

Keyboard shortcuts

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