runtime: github.com/go-openapi/runtime/client Index | Files

package client

import "github.com/go-openapi/runtime/client"

Index

Package Files

auth_info.go keepalive.go request.go response.go runtime.go

Variables

var DefaultTimeout = 30 * time.Second

DefaultTimeout the default request timeout

var PassThroughAuth runtime.ClientAuthInfoWriter

PassThroughAuth never manipulates the request

func APIKeyAuth Uses

func APIKeyAuth(name, in, value string) runtime.ClientAuthInfoWriter

APIKeyAuth provides an API key auth info writer

func BasicAuth Uses

func BasicAuth(username, password string) runtime.ClientAuthInfoWriter

BasicAuth provides a basic auth info writer

func BearerToken Uses

func BearerToken(token string) runtime.ClientAuthInfoWriter

BearerToken provides a header based oauth2 bearer access token auth info writer

func KeepAliveTransport Uses

func KeepAliveTransport(rt http.RoundTripper) http.RoundTripper

KeepAliveTransport drains the remaining body from a response so that go will reuse the TCP connections. This is not enabled by default because there are servers where the response never gets closed and that would make the code hang forever. So instead it's provided as a http client middleware that can be used to override any request.

func TLSClient Uses

func TLSClient(opts TLSClientOptions) (*http.Client, error)

TLSClient creates a http.Client for mutual auth

func TLSClientAuth Uses

func TLSClientAuth(opts TLSClientOptions) (*tls.Config, error)

TLSClientAuth creates a tls.Config for mutual auth

func TLSTransport Uses

func TLSTransport(opts TLSClientOptions) (http.RoundTripper, error)

TLSTransport creates a http client transport suitable for mutual tls auth

type Runtime Uses

type Runtime struct {
    DefaultMediaType      string
    DefaultAuthentication runtime.ClientAuthInfoWriter
    Consumers             map[string]runtime.Consumer
    Producers             map[string]runtime.Producer

    Transport http.RoundTripper
    Jar       http.CookieJar
    //Spec      *spec.Document
    Host     string
    BasePath string
    Formats  strfmt.Registry
    Context  context.Context

    Debug bool
    // contains filtered or unexported fields
}

Runtime represents an API client that uses the transport to make http requests based on a swagger specification.

func New Uses

func New(host, basePath string, schemes []string) *Runtime

New creates a new default runtime for a swagger api runtime.Client

func NewWithClient Uses

func NewWithClient(host, basePath string, schemes []string, client *http.Client) *Runtime

NewWithClient allows you to create a new transport with a configured http.Client

func (*Runtime) EnableConnectionReuse Uses

func (r *Runtime) EnableConnectionReuse()

EnableConnectionReuse drains the remaining body from a response so that go will reuse the TCP connections.

This is not enabled by default because there are servers where the response never gets closed and that would make the code hang forever. So instead it's provided as a http client middleware that can be used to override any request.

func (*Runtime) SetDebug Uses

func (r *Runtime) SetDebug(debug bool)

SetDebug changes the debug flag. It ensures that client and middlewares have the set debug level.

func (*Runtime) SetLogger Uses

func (r *Runtime) SetLogger(logger logger.Logger)

SetLogger changes the logger stream. It ensures that client and middlewares use the same logger.

func (*Runtime) Submit Uses

func (r *Runtime) Submit(operation *runtime.ClientOperation) (interface{}, error)

Submit a request and when there is a body on success it will turn that into the result all other things are turned into an api error for swagger which retains the status code

type TLSClientOptions Uses

type TLSClientOptions struct {
    // Certificate is the path to a PEM-encoded certificate to be used for
    // client authentication. If set then Key must also be set.
    Certificate string

    // LoadedCertificate is the certificate to be used for client authentication.
    // This field is ignored if Certificate is set. If this field is set, LoadedKey
    // is also required.
    LoadedCertificate *x509.Certificate

    // Key is the path to an unencrypted PEM-encoded private key for client
    // authentication. This field is required if Certificate is set.
    Key string

    // LoadedKey is the key for client authentication. This field is required if
    // LoadedCertificate is set.
    LoadedKey crypto.PrivateKey

    // CA is a path to a PEM-encoded certificate that specifies the root certificate
    // to use when validating the TLS certificate presented by the server. If this field
    // (and LoadedCA) is not set, the system certificate pool is used. This field is ignored if LoadedCA
    // is set.
    CA  string

    // LoadedCA specifies the root certificate to use when validating the server's TLS certificate.
    // If this field (and CA) is not set, the system certificate pool is used.
    LoadedCA *x509.Certificate

    // ServerName specifies the hostname to use when verifying the server certificate.
    // If this field is set then InsecureSkipVerify will be ignored and treated as
    // false.
    ServerName string

    // InsecureSkipVerify controls whether the certificate chain and hostname presented
    // by the server are validated. If false, any certificate is accepted.
    InsecureSkipVerify bool
    // contains filtered or unexported fields
}

TLSClientOptions to configure client authentication with mutual TLS

Package client imports 29 packages (graph) and is imported by 858 packages. Updated 2019-03-03. Refresh now. Tools for package owners.