net

package
v0.0.23 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2022 License: Apache-2.0 Imports: 17 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// AccessTokenIndex specifies the index of the Reva access token in a context.
	AccessTokenIndex ctxKey = iota
	// AccessTokenName specifies the name of the Reva access token used during requests.
	AccessTokenName = ctxpkg.TokenHeader
	// TransportTokenName specifies the name of the Reva transport token used during data transfers.
	TransportTokenName = datagateway.TokenTransportHeader
)
View Source
const (
	// WebDAVTokenName is the header name of the WebDAV token.
	WebDAVTokenName = "webdav-token"
	// WebDAVPathName is the header name of the WebDAV file path.
	WebDAVPathName = "webdav-file-path"
)

Variables

This section is empty.

Functions

func CheckRPCInvocation

func CheckRPCInvocation(operation string, res rpcStatusGetter, callErr error) error

CheckRPCInvocation checks if an RPC invocation has succeeded. For this, the error from the original call is first checked; after that, the actual RPC response status is checked.

func CheckRPCStatus

func CheckRPCStatus(operation string, res rpcStatusGetter) error

CheckRPCStatus checks the returned status of an RPC call.

Types

type HTTPRequest

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

HTTPRequest performs Reva-specific requests through an HTTP endpoint.

func NewHTTPRequest

func NewHTTPRequest(ctx context.Context, endpoint string, method string, accessToken string, transportToken string, data io.Reader) (*HTTPRequest, error)

NewHTTPRequest creates a new HTTP request.

func (*HTTPRequest) AddParameters

func (request *HTTPRequest) AddParameters(params map[string]string)

AddParameters adds the specified parameters to the request. The parameters are passed in the query URL.

func (*HTTPRequest) Do

func (request *HTTPRequest) Do(checkStatus bool) ([]byte, error)

Do performs the request on the HTTP endpoint and returns the body data. If checkStatus is set to true, the call will only succeed if the server returns a status code of 200.

type TUSClient

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

TUSClient is a simple client wrapper for uploading files via TUS.

func NewTUSClient

func NewTUSClient(endpoint string, accessToken string, transportToken string) (*TUSClient, error)

NewTUSClient creates a new TUS client.

func (*TUSClient) Write

func (client *TUSClient) Write(data io.Reader, target string, fileInfo os.FileInfo, checksumType string, checksum string) error

Write writes the provided data to the endpoint. The target is used as the filename on the remote site. The file information and checksum are used to create a fingerprint.

type WebDAVClient

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

WebDAVClient is a simple client wrapper for down- and uploading files via WebDAV.

func NewWebDAVClient

func NewWebDAVClient(endpoint string, userName string, password string) (*WebDAVClient, error)

NewWebDAVClient creates a new WebDAV client with user credentials.

func NewWebDAVClientWithAccessToken

func NewWebDAVClientWithAccessToken(endpoint string, accessToken string) (*WebDAVClient, error)

NewWebDAVClientWithAccessToken creates a new WebDAV client using an access token.

func NewWebDAVClientWithOpaque

func NewWebDAVClientWithOpaque(endpoint string, opaque *types.Opaque) (*WebDAVClient, map[string]string, error)

NewWebDAVClientWithOpaque creates a new WebDAV client using the information stored in the opaque.

func (*WebDAVClient) Read

func (webdav *WebDAVClient) Read(file string) ([]byte, error)

Read reads all data of the specified remote file.

func (*WebDAVClient) Remove

func (webdav *WebDAVClient) Remove(path string) error

Remove deletes the entire file/path.

func (*WebDAVClient) Write

func (webdav *WebDAVClient) Write(file string, data io.Reader, size int64) error

Write writes data to the specified remote file.

Jump to

Keyboard shortcuts

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