http

package
v0.0.0-...-159d35f Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: Apache-2.0 Imports: 13 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 ToObjects

func ToObjects(urlPath string) ([]client.Object, error)

ToObjects 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

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

Client is client used to simplified http requests for tarballs

func NewClient

func NewClient() *Client

NewClient creates HTTP client

func (*Client) Download

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

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

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

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