http

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Z1 = "Z1" // Zeta Protocol Version
	// Zeta HTTP Header
	AUTHORIZATION           = "Authorization"
	ZETA_PROTOCOL           = "Zeta-Protocol"
	ZETA_AUTHORIZATION      = "X-Zeta-Authorization"
	ZETA_COMMAND_OLDREV     = "X-Zeta-Command-OldRev"
	ZETA_COMMAND_NEWREV     = "X-Zeta-Command-NewRev"
	ZETA_TERMINAL           = "X-Zeta-Terminal"
	ZETA_OBJECTS_STATS      = "X-Zeta-Objects-Stats"
	ZETA_COMPRESSED_SIZE    = "X-Zeta-Compressed-Size"
	ZETA_PUSH_OPTION_COUNT  = "X-Zeta-Push-Option-Count"
	ZETA_PUSH_OPTION_PREFIX = "X-Zeta-Push-Option-"
	// ZETA Protocol Content Type
	ZETA_MIME_BLOB              = "application/x-zeta-blob"
	ZETA_MIME_BLOBS             = "application/x-zeta-blobs"
	ZETA_MIME_MULTI_OBJECTS     = "application/x-zeta-multi-objects"
	ZETA_MIME_METADATA          = "application/x-zeta-metadata"
	ZETA_MIME_COMPRESS_METADATA = "application/x-zeta-compress-metadata"
	ZETA_MIME_REPORT_RESULT     = "application/x-zeta-report-result"
	ZETA_MIME_JSON_METADATA     = "application/vnd.zeta+json"
)
View Source
const (
	PseudoUserName = "ZetaPseudo"
)

Variables

View Source
var (
	ErrNoValidCredentials = errors.New("no valid credentials")
	ErrRedirect           = errors.New("redirect")
)
View Source
var (
	W = tr.W
)

Functions

func NewTransport

func NewTransport(ctx context.Context, endpoint *transport.Endpoint, operation transport.Operation, verbose bool) (transport.Transport, error)

NewTransport: new transport

Types

type Credentials

type Credentials struct {
	UserName string
	Password string
}

func (*Credentials) BasicAuth

func (cred *Credentials) BasicAuth() string

type Downloader

type Downloader interface {
	Download(ctx context.Context, o *transport.Representation, offset int64) (transport.SizeReader, error)
}

func NewDownloader

func NewDownloader(verbose bool, insecure bool) Downloader

type Error

type Error struct {
	StatusCode int    // HTTP status code (200, 403, ...)
	Code       string // OSS error code ("UnsupportedOperation", ...)
	Message    string // The human-oriented error message
	BucketName string
	RequestId  string
	HostId     string
}

Error represents an error in an operation with OSS.

func (*Error) Error

func (e *Error) Error() string

type ErrorCode

type ErrorCode struct {
	Code    int    `json:"code,omitempty"`
	Message string `json:"message,omitempty"`
	// contains filtered or unexported fields
}

func (*ErrorCode) Error

func (e *ErrorCode) Error() string

func (*ErrorCode) Status

func (e *ErrorCode) Status() int

type ServiceError

type ServiceError struct {
	XMLName    xml.Name `xml:"Error"`
	Code       string   `xml:"Code"`      // The error code returned from OSS to the caller
	Message    string   `xml:"Message"`   // The detail error message from OSS
	RequestID  string   `xml:"RequestId"` // The UUID used to uniquely identify the request
	HostID     string   `xml:"HostId"`    // The OSS server cluster's Id
	Endpoint   string   `xml:"Endpoint"`
	Ec         string   `xml:"EC"`
	RawMessage string   // The raw messages from OSS
	StatusCode int      // HTTP status code

}

ServiceError contains fields of the error response from Oss Service REST API.

func (*ServiceError) Error

func (e *ServiceError) Error() string

Error implements interface error

Jump to

Keyboard shortcuts

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