httpclient_go

package
v0.0.0-...-63319d1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MethodGet    = "GET"
	MethodPost   = "POST"
	MethodPut    = "PUT"
	MethodDelete = "DELETE"
)
View Source
const (
	BasicDateFormat     = "20060102T150405Z"
	Algorithm           = "SDK-HMAC-SHA256"
	HeaderXDate         = "X-Sdk-Date"
	HeaderHost          = "host"
	HeaderAuthorization = "Authorization"
	HeaderContentSha256 = "X-Sdk-content-sha256"
)

Variables

This section is empty.

Functions

func AuthHeaderValue

func AuthHeaderValue(signature, accessKey string, signedHeaders []string) string

func CanonicalHeaders

func CanonicalHeaders(r *http.Request, signerHeaders []string) string

func CanonicalQueryString

func CanonicalQueryString(r *http.Request) string

func CanonicalRequest

func CanonicalRequest(r *http.Request, signedHeaders []string) (string, error)

func CanonicalURI

func CanonicalURI(r *http.Request) string

func HexEncodeSHA256Hash

func HexEncodeSHA256Hash(body []byte) (string, error)

func RequestPayload

func RequestPayload(r *http.Request) ([]byte, error)

func SignStringToSign

func SignStringToSign(stringToSign string, signingKey []byte) (string, error)

Create the HWS Signature.

func SignedHeaders

func SignedHeaders(r *http.Request) []string

func StringToSign

func StringToSign(canonicalRequest string, t time.Time) (string, error)

Types

type HttpClientGo

type HttpClientGo struct {
	Client      *golangsdk.ServiceClient
	Method      string
	Url         string
	RequestOpts golangsdk.RequestOpts
	Header      map[string]string
	Error       error
	Transport   *http.Transport
}

func NewHttpClientGo

func NewHttpClientGo(c *config.HcsConfig, product, region string) (*HttpClientGo, error)

func (HttpClientGo) CheckDeletedDiag

func (client HttpClientGo) CheckDeletedDiag(d *schema.ResourceData, err error, response *http.Response, msg string) ([]byte, diag.Diagnostics)

func (*HttpClientGo) Do

func (client *HttpClientGo) Do() (*http.Response, error)

func (*HttpClientGo) WithBody

func (client *HttpClientGo) WithBody(body interface{}) *HttpClientGo

func (*HttpClientGo) WithHeader

func (client *HttpClientGo) WithHeader(header map[string]string) *HttpClientGo

func (*HttpClientGo) WithMethod

func (client *HttpClientGo) WithMethod(method string) *HttpClientGo

func (*HttpClientGo) WithOKCodes

func (client *HttpClientGo) WithOKCodes(arr []int) *HttpClientGo

func (*HttpClientGo) WithTransport

func (client *HttpClientGo) WithTransport() *HttpClientGo

func (*HttpClientGo) WithUrl

func (client *HttpClientGo) WithUrl(url string) *HttpClientGo

func (*HttpClientGo) WithUrlWithoutEndpoint

func (client *HttpClientGo) WithUrlWithoutEndpoint(cfg *config.HcsConfig, srv, region, path string) *HttpClientGo

type Signer

type Signer struct {
	Key    string
	Secret string
}

func (*Signer) Sign

func (s *Signer) Sign(r *http.Request) error

Jump to

Keyboard shortcuts

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