sign

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2022 License: MIT Imports: 10 Imported by: 1

README

aliyun-api-gateway-sign-golang

Unofficial golang sdk for Aliyun API Gateway.

Install

go get github.com/k8scat/aliyun-api-gateway-sign-golang

Usage

package main

import (
	"fmt"
	"github.com/k8scat/aliyun-api-gateway-sign-golang"
	"net/http"
)

func main() {
	appKey := ""
	appSecret := ""
	api := sign.NewAPIGateway(appKey, appSecret)

	rawurl := ""
	req, err := http.NewRequest(http.MethodGet, rawurl, nil)
	if err != nil {
		panic(err)
	}

	err = api.Sign(req)
	if err != nil {
		panic(err)
	}

	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	fmt.Println(resp.StatusCode)
}

Used by

k8scat/Articli

License

MIT

Documentation

Index

Constants

View Source
const (
	HTTPHeaderAccept      = "Accept"
	HTTPHeaderContentMD5  = "Content-MD5"
	HTTPHeaderContentType = "Content-Type"
	HTTPHeaderDate        = "Date"

	HTTPHeaderCAPrefix           = "X-Ca-"
	HTTPHeaderCASignature        = "X-Ca-Signature"
	HTTPHeaderCATimestamp        = "X-Ca-Timestamp"
	HTTPHeaderCANonce            = "X-Ca-Nonce"
	HTTPHeaderCAKey              = "X-Ca-Key"
	HTTPHeaderCASignatureHeaders = "X-Ca-Signature-Headers"

	ContentTypeForm   = "application/x-www-form-urlencoded"
	ContentTypeStream = "application/octet-stream"
	ContentTypeJSON   = "application/json"
	ContentTypeXML    = "application/xml"
	ContentTypeText   = "application/text"

	LF = "\n"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIGateway

type APIGateway struct {
	Key    string
	Secret string
}

func NewAPIGateway

func NewAPIGateway(key, secret string) (*APIGateway, error)

func (*APIGateway) Sign

func (api *APIGateway) Sign(req *http.Request) error

Jump to

Keyboard shortcuts

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