networking

package
v5.6.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: Apache-2.0 Imports: 16 Imported by: 3

Documentation

Index

Constants

View Source
const ContentCRC32 string = "Content-CRC32"

Http Headers

View Source
const ContentCRC32C string = "Content-CRC32C"
View Source
const ContentMd5 string = "Content-MD5"
View Source
const ContentSha256 string = "Content-SHA256"
View Source
const ContentSha512 string = "Content-SHA512"
View Source
const ContentTypeKey string = "Content-Type" // This header describes the format of the contents

Variables

This section is empty.

Functions

func BoolPtrToStrPtr

func BoolPtrToStrPtr(bool *bool) *string

Converts a *bool into a *string

func Float64PtrToStrPtr

func Float64PtrToStrPtr(float *float64) *string

Converts a *float64 into a *string

func Int64PtrToStrPtr

func Int64PtrToStrPtr(int *int64) *string

Converts an *int64 into a *string

func IntPtrToStrPtr

func IntPtrToStrPtr(int *int) *string

Converts an *int into a *string

func InterfaceToStrPtr

func InterfaceToStrPtr(item ToStringPtrInterface) *string

Converts an item that meets the ToStringInterface into a *string

func NewLimitReadCloser

func NewLimitReadCloser(readCloser models.ReadCloserWithSizeDecorator) io.ReadCloser

Creates a ReadCloser that wraps the reader in a LimitedReader, and preserves the closability of the original reader

Types

type CanonicalHeader

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

Used to correctly sort headers when creating the stringToSign for the authorization header.

type CanonicalHeaders

type CanonicalHeaders []CanonicalHeader

func (CanonicalHeaders) Len

func (p CanonicalHeaders) Len() int

func (CanonicalHeaders) Less

func (p CanonicalHeaders) Less(i, j int) bool

func (CanonicalHeaders) Swap

func (p CanonicalHeaders) Swap(i, j int)

type ConnectionInfo

type ConnectionInfo struct {
	Endpoint                *url.URL
	Credentials             *Credentials
	Proxy                   *url.URL
	IgnoreServerCertificate bool
}

type Credentials

type Credentials struct {
	AccessId string
	Key      string
}

type CustomUrlValues

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

Wrapper for url.Values to be used for encoding query parameters without the '=' sign when there is no corresponding value, ex: key, value -> key=value key, ” -> key

func NewCustomUrlValues

func NewCustomUrlValues() CustomUrlValues

func (CustomUrlValues) Add

func (customValues CustomUrlValues) Add(key string, value string)

func (CustomUrlValues) Encode

func (customValues CustomUrlValues) Encode() string

Copied and modified from url.Values to remove '=' when there are no values to add

func (CustomUrlValues) Size

func (customValues CustomUrlValues) Size() int

type HttpRequestBuilder

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

func NewHttpRequestBuilder

func NewHttpRequestBuilder() *HttpRequestBuilder

func (*HttpRequestBuilder) Build

func (builder *HttpRequestBuilder) Build(conn *ConnectionInfo) (*http.Request, error)

func (*HttpRequestBuilder) WithChecksum

func (builder *HttpRequestBuilder) WithChecksum(checksum models.Checksum) *HttpRequestBuilder

func (*HttpRequestBuilder) WithContentType

func (builder *HttpRequestBuilder) WithContentType(contentType string) *HttpRequestBuilder

func (*HttpRequestBuilder) WithHeader

func (builder *HttpRequestBuilder) WithHeader(key string, value string) *HttpRequestBuilder

func (*HttpRequestBuilder) WithHeaders

func (builder *HttpRequestBuilder) WithHeaders(headers map[string]string) *HttpRequestBuilder

func (*HttpRequestBuilder) WithHttpVerb

func (builder *HttpRequestBuilder) WithHttpVerb(verb string) *HttpRequestBuilder

func (*HttpRequestBuilder) WithOptionalQueryParam

func (builder *HttpRequestBuilder) WithOptionalQueryParam(key string, value *string) *HttpRequestBuilder

func (*HttpRequestBuilder) WithOptionalVoidQueryParam

func (builder *HttpRequestBuilder) WithOptionalVoidQueryParam(key string, value bool) *HttpRequestBuilder

func (*HttpRequestBuilder) WithPath

func (builder *HttpRequestBuilder) WithPath(path string) *HttpRequestBuilder

func (*HttpRequestBuilder) WithQueryParam

func (builder *HttpRequestBuilder) WithQueryParam(key string, value string) *HttpRequestBuilder

func (*HttpRequestBuilder) WithReadCloser

Internally converts reader with size decorator to limit reader to ensure size is respected and adds the closer functionality to the limit reader. The send network will automatically close the reader when finished.

func (*HttpRequestBuilder) WithReader

Internally converts reader with size decorator to limit reader to ensure size is respected

type HttpTempRedirectDecorator

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

Decorator for Network which handles 307 temporary redirect retries

func (*HttpTempRedirectDecorator) Invoke

func (tempRedirectDecorator *HttpTempRedirectDecorator) Invoke(httpRequest *http.Request) (models.WebResponse, error)

type LimitReadCloser

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

Defines a limited reader that also supports closing

func (*LimitReadCloser) Close

func (limitedReadCloser *LimitReadCloser) Close() error

Closes the original reader

func (*LimitReadCloser) Read

func (limitedReadCloser *LimitReadCloser) Read(p []byte) (n int, err error)

Reads from the limited reader

type Network

type Network interface {
	Invoke(httpRequest *http.Request) (models.WebResponse, error)
}

func NewHttpTempRedirectDecorator

func NewHttpTempRedirectDecorator(network Network, maxRedirect int) Network

func NewNetworkRetryDecorator

func NewNetworkRetryDecorator(network Network, maxRetires int) Network

func NewSendNetwork

func NewSendNetwork(connectionInfo *ConnectionInfo) Network

type NetworkRetryDecorator

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

Decorator for Network which handles network related retries

func (*NetworkRetryDecorator) Invoke

func (networkRetryDecorator *NetworkRetryDecorator) Invoke(httpRequest *http.Request) (models.WebResponse, error)

type SendNetwork

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

Performs http requests

func (*SendNetwork) Invoke

func (sendNetwork *SendNetwork) Invoke(httpRequest *http.Request) (models.WebResponse, error)

type ToStringPtrInterface

type ToStringPtrInterface interface {
	StringPtr() *string
}

Interface for a to string method

Jump to

Keyboard shortcuts

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