Documentation
¶
Index ¶
- Constants
- func AuthHeaderValue(signatureStr, accessKeyStr string, signedHeaders []string) string
- func CanonicalHeaders(request *http.Request, signerHeaders []string) string
- func CanonicalQueryString(request *http.Request) string
- func CanonicalRequest(request *http.Request, signedHeaders []string) (string, error)
- func CanonicalURI(request *http.Request) string
- func HexEncodeSHA256Hash(body []byte) (string, error)
- func RequestPayload(request *http.Request) ([]byte, error)
- func SignStringToSign(stringToSign string, signingKey []byte) (string, error)
- func SignedHeaders(r *http.Request) []string
- func StringToSign(canonicalRequest string, t time.Time) (string, error)
- type Client
- func (c *Client) AppendRecord(ctx context.Context, zone string, record RecordSet) (*RecordSet, error)
- func (c *Client) DeleteRecord(ctx context.Context, zone string, recordId string) (*RecordSet, error)
- func (c *Client) GetRecordId(ctx context.Context, zone, recName, recType string, recVal ...string) (string, error)
- func (c *Client) GetRecords(ctx context.Context, zone string) ([]RecordSet, error)
- func (c *Client) UpdateRecord(ctx context.Context, zone string, record RecordSet) (*RecordSet, error)
- type ListRecordsResponse
- type ListZonesResponse
- type Provider
- func (p *Provider) AppendRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
- func (p *Provider) DeleteRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
- func (p *Provider) GetRecords(ctx context.Context, zone string) ([]libdns.Record, error)
- func (p *Provider) SetRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
- type RecordSet
- type Signer
- type Zone
Constants ¶
const ( DateFormat = "20060102T150405Z" SignAlgorithm = "SDK-HMAC-SHA256" HeaderXDateTime = "X-Sdk-Date" HeaderXHost = "host" HeaderXAuthorization = "Authorization" HeaderXContentSha256 = "X-Sdk-Content-Sha256" )
Variables ¶
This section is empty.
Functions ¶
func AuthHeaderValue ¶ added in v1.0.0
AuthHeaderValue Get the finalized value for the "Authorization" header. The signature parameter is the output from SignStringToSign
func CanonicalHeaders ¶ added in v1.0.0
CanonicalHeaders returns the canonical headers
func CanonicalQueryString ¶ added in v1.0.0
CanonicalQueryString returns the canonical query string
func CanonicalRequest ¶ added in v1.0.0
CanonicalRequest Build a CanonicalRequest from a regular request string
func CanonicalURI ¶ added in v1.0.0
CanonicalURI returns request uri
func HexEncodeSHA256Hash ¶ added in v1.0.0
HexEncodeSHA256Hash returns hexcode of sha256
func RequestPayload ¶ added in v1.0.0
RequestPayload returns the request body
func SignStringToSign ¶ added in v1.0.0
SignStringToSign Create the HWS Signature
func SignedHeaders ¶ added in v1.0.0
SignedHeaders returns the headers that are signed
Types ¶
type Client ¶ added in v1.0.0
type Client struct {
// contains filtered or unexported fields
}
func (*Client) AppendRecord ¶ added in v1.0.0
func (*Client) DeleteRecord ¶ added in v1.0.0
func (*Client) GetRecordId ¶ added in v1.0.0
func (*Client) GetRecords ¶ added in v1.0.0
type ListRecordsResponse ¶ added in v1.0.0
type ListRecordsResponse struct {
RecordSets []RecordSet `json:"recordsets,omitempty"`
}
type ListZonesResponse ¶ added in v1.0.0
type ListZonesResponse struct {
Zones []Zone `json:"zones,omitempty"`
}
type Provider ¶
type Provider struct { // AccessKeyId is required by the Huawei Cloud API for authentication. AccessKeyId string `json:"access_key_id,omitempty"` // SecretAccessKey is required by the Huawei Cloud API for authentication. SecretAccessKey string `json:"secret_access_key,omitempty"` // RegionId is optional and defaults to "cn-south-1". RegionId string `json:"region_id,omitempty"` // contains filtered or unexported fields }
Provider facilitates DNS record manipulation with Huawei Cloud
func (*Provider) AppendRecords ¶
func (p *Provider) AppendRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
AppendRecords adds records to the zone. It returns the records that were added. NOTE: This implementation is NOT atomic.
func (*Provider) DeleteRecords ¶
func (p *Provider) DeleteRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
DeleteRecords deletes the records from the zone. It returns the records that were deleted. NOTE: This implementation is NOT atomic.
func (*Provider) GetRecords ¶
GetRecords lists all the records in the zone.
func (*Provider) SetRecords ¶
func (p *Provider) SetRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
SetRecords sets the records in the zone, either by updating existing records or creating new ones. It returns the updated records. NOTE: This implementation is NOT atomic.
type RecordSet ¶ added in v1.0.0
type RecordSet struct { // Record Set的ID Id string `json:"id,omitempty"` // Record Set的名称(FQDN形式) Name string `json:"name,omitempty"` // 记录类型。 Type string `json:"type,omitempty"` // 解析记录在本地DNS服务器的缓存时间,缓存时间越长更新生效越慢,以秒为单位。 Ttl int32 `json:"ttl,omitempty"` // 域名解析后的值。 Records []string `json:"records,omitempty"` }