Documentation ¶
Overview ¶
Package http defines the structure of request and response which used to access the BCE services as well as the http constant headers and and methods. And finally implement the `Execute` funct- ion to do the work.
Index ¶
- Constants
- type Request
- func (r *Request) Body() io.ReadCloser
- func (r *Request) Endpoint() string
- func (r *Request) GenerateUrl(addPort bool) string
- func (r *Request) Header(key string) string
- func (r *Request) Headers() map[string]string
- func (r *Request) Host() string
- func (r *Request) Length() int64
- func (r *Request) Method() string
- func (r *Request) Param(key string) string
- func (r *Request) Params() map[string]string
- func (r *Request) Port() int
- func (r *Request) Protocol() string
- func (r *Request) ProxyUrl() string
- func (r *Request) QueryString() string
- func (r *Request) SetBody(stream io.ReadCloser)
- func (r *Request) SetEndpoint(endpoint string)
- func (r *Request) SetHeader(key, value string)
- func (r *Request) SetHeaders(headers map[string]string)
- func (r *Request) SetHost(host string)
- func (r *Request) SetLength(l int64)
- func (r *Request) SetMethod(method string)
- func (r *Request) SetParam(key, value string)
- func (r *Request) SetParams(params map[string]string)
- func (r *Request) SetPort(port int)
- func (r *Request) SetProtocol(protocol string)
- func (r *Request) SetProxyUrl(url string)
- func (r *Request) SetTimeout(timeout int)
- func (r *Request) SetUri(uri string)
- func (r *Request) String() string
- func (r *Request) Timeout() int
- func (r *Request) Uri() string
- type Response
- func (r *Response) Body() io.ReadCloser
- func (r *Response) ContentLength() int64
- func (r *Response) ElapsedTime() time.Duration
- func (r *Response) GetHeader(name string) string
- func (r *Response) GetHeaders() map[string]string
- func (r *Response) HttpResponse() *http.Response
- func (r *Response) Protocol() string
- func (r *Response) SetHttpResponse(response *http.Response)
- func (r *Response) StatusCode() int
- func (r *Response) StatusText() string
Constants ¶
View Source
const ( GET = "GET" PUT = "PUT" POST = "POST" DELETE = "DELETE" HEAD = "HEAD" )
Constants of the supported HTTP methods for BCE
View Source
const ( // Standard HTTP Headers AUTHORIZATION = "Authorization" CACHE_CONTROL = "Cache-Control" CONTENT_DISPOSITION = "Content-Disposition" CONTENT_ENCODING = "Content-Encoding" CONTENT_LANGUAGE = "Content-Language" CONTENT_LENGTH = "Content-Length" CONTENT_MD5 = "Content-Md5" CONTENT_RANGE = "Content-Range" CONTENT_TYPE = "Content-Type" DATE = "Date" ETAG = "Etag" EXPIRES = "Expires" HOST = "Host" LAST_MODIFIED = "Last-Modified" LOCATION = "Location" RANGE = "Range" SERVER = "Server" TRANSFER_ENCODING = "Transfer-Encoding" USER_AGENT = "User-Agent" // BCE Common HTTP Headers BCE_PREFIX = "x-bce-" BCE_ACL = "x-bce-acl" BCE_GRANT_READ = "x-bce-grant-read" BCE_GRANT_FULL_CONTROL = "x-bce-grant-full-control" BCE_CONTENT_SHA256 = "x-bce-content-sha256" BCE_CONTENT_CRC32 = "x-bce-content-crc32" BCE_REQUEST_ID = "x-bce-request-id" BCE_USER_METADATA_PREFIX = "x-bce-meta-" BCE_SECURITY_TOKEN = "x-bce-security-token" BCE_DATE = "x-bce-date" // BOS HTTP Headers BCE_COPY_METADATA_DIRECTIVE = "x-bce-metadata-directive" BCE_COPY_SOURCE = "x-bce-copy-source" BCE_COPY_SOURCE_IF_MATCH = "x-bce-copy-source-if-match" BCE_COPY_SOURCE_IF_MODIFIED_SINCE = "x-bce-copy-source-if-modified-since" BCE_COPY_SOURCE_IF_NONE_MATCH = "x-bce-copy-source-if-none-match" BCE_COPY_SOURCE_IF_UNMODIFIED_SINCE = "x-bce-copy-source-if-unmodified-since" BCE_COPY_SOURCE_RANGE = "x-bce-copy-source-range" BCE_DEBUG_ID = "x-bce-debug-id" BCE_OBJECT_TYPE = "x-bce-object-type" BCE_NEXT_APPEND_OFFSET = "x-bce-next-append-offset" BCE_STORAGE_CLASS = "x-bce-storage-class" BCE_PROCESS = "x-bce-process" BCE_RESTORE_TIER = "x-bce-restore-tier" BCE_RESTORE_DAYS = "x-bce-restore-days" )
Constants of the HTTP headers for BCE
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
Reauest stands for the general http request structure to make request to the BCE services.
func (*Request) Body ¶
func (r *Request) Body() io.ReadCloser
func (*Request) GenerateUrl ¶
func (*Request) QueryString ¶
func (*Request) SetBody ¶
func (r *Request) SetBody(stream io.ReadCloser)
func (*Request) SetEndpoint ¶
func (*Request) SetHeaders ¶
func (*Request) SetProtocol ¶
func (*Request) SetProxyUrl ¶
func (*Request) SetTimeout ¶
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
Response defines the general http response structure for accessing the BCE services.
func Execute ¶
Execute - do the http requset and get the response
PARAMS:
- request: the http request instance to be sent
RETURNS:
- response: the http response returned from the server
- error: nil if ok otherwise the specific error
func (*Response) Body ¶
func (r *Response) Body() io.ReadCloser
func (*Response) ContentLength ¶
func (*Response) ElapsedTime ¶
func (*Response) GetHeaders ¶
func (*Response) HttpResponse ¶
func (*Response) SetHttpResponse ¶
func (*Response) StatusCode ¶
func (*Response) StatusText ¶
Click to show internal directories.
Click to hide internal directories.