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 ¶
- func GetControllerWellKnownCas(controllerAddr string) ([]*x509.Certificate, error)
- func NewFabricClient(transportFactory TransportFactory, apiAddress string) (*fabric_rest_client.ZitiFabric, error)
- func NewFabricClientWithIdentity(identity identity.Identity, apiAddress string) (*fabric_rest_client.ZitiFabric, error)
- func NewHttpClientWithTlsConfig(tlsClientConfig *tls.Config) (*http.Client, error)
- func NewTlsConfig() (*tls.Config, error)
- type IdentityTransportFactory
- type TransportConfig
- type TransportConfigImpl
- type TransportFactory
- type TransportFactoryF
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 ¶
NewHttpClientWithTlsConfig provides a default HTTP client with generous default timeouts.
func NewTlsConfig ¶
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 ¶
func (self *IdentityTransportFactory) New(config TransportConfig) (runtime.ClientTransport, error)
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 ¶
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 ¶
func (self TransportFactoryF) New(config TransportConfig) (runtime.ClientTransport, error)