http

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsURL

func IsURL(str string) bool

IsURL returns true if string is an URL

func Read

func Read(urlPath string) (*bytes.Buffer, error)

Read returns a buffer for the file at the url

func ToRuntimeObjects

func ToRuntimeObjects(urlPath string) ([]runtime.Object, error)

ToRuntimeObjects takes a url, pulls the file and returns []runtime.Object url must be a full path to a manifest file. that file can have multiple runtime objects.

Types

type Client added in v0.6.0

type Client struct {
	UserAgent string
	// contains filtered or unexported fields
}

Client is client used to simplified http requests for tarballs

func NewClient added in v0.6.0

func NewClient() *Client

NewClient creates HTTP client

func (*Client) Download added in v0.6.0

func (c *Client) Download(url string, path string) error

Download takes a url to download and a filepath to write it to this will write the response to any url request to a file.

func (*Client) DownloadFile added in v0.6.0

func (c *Client) DownloadFile(url, path string) (string, error)

DownloadFile expects a url with a file and will save that file to the path provided preserving the file name.

func (*Client) Get added in v0.6.0

func (c *Client) Get(url string) (*http.Response, error)

Get performs an HTTP get and returns the Response. The caller is responsible for closing the response.

func (*Client) GetByteBuffer added in v0.6.0

func (c *Client) GetByteBuffer(url string) (*bytes.Buffer, error)

Get performs HTTP get, retrieves the contents and returns a bytes.Buffer of the entire contents this could be dangerous against an extremely large file

Jump to

Keyboard shortcuts

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