當前位置: 首頁>>代碼示例>>Golang>>正文


Golang s3.Sign函數代碼示例

本文整理匯總了Golang中github.com/crowdmob/goamz/s3.Sign函數的典型用法代碼示例。如果您正苦於以下問題:Golang Sign函數的具體用法?Golang Sign怎麽用?Golang Sign使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了Sign函數的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: TestSignExampleUnicodeKeys

func (s *S) TestSignExampleUnicodeKeys(c *gocheck.C) {
	method := "GET"
	path := "/dictionary/fran%C3%A7ais/pr%c3%a9f%c3%a8re"
	headers := map[string][]string{
		"Host": {"s3.amazonaws.com"},
		"Date": {"Wed, 28 Mar 2007 01:49:49 +0000"},
	}
	s3.Sign(testAuth, method, path, nil, headers)
	expected := "AWS 0PN5J17HBGZHT7JJ3X82:dxhSBHoI6eVSPcXJqEghlUzZMnY="
	c.Assert(headers["Authorization"], gocheck.DeepEquals, []string{expected})
}
開發者ID:nkts,項目名稱:golang-devops-stuff,代碼行數:11,代碼來源:sign_test.go

示例2: TestSignExampleObjectGet

func (s *S) TestSignExampleObjectGet(c *gocheck.C) {
	method := "GET"
	path := "/johnsmith/photos/puppy.jpg"
	headers := map[string][]string{
		"Host": {"johnsmith.s3.amazonaws.com"},
		"Date": {"Tue, 27 Mar 2007 19:36:42 +0000"},
	}
	s3.Sign(testAuth, method, path, nil, headers)
	expected := "AWS 0PN5J17HBGZHT7JJ3X82:xXjDGYUmKxnwqr5KXNPGldn5LbA="
	c.Assert(headers["Authorization"], gocheck.DeepEquals, []string{expected})
}
開發者ID:nkts,項目名稱:golang-devops-stuff,代碼行數:11,代碼來源:sign_test.go

示例3: TestSignExampleListAllMyBuckets

func (s *S) TestSignExampleListAllMyBuckets(c *gocheck.C) {
	method := "GET"
	path := "/"
	headers := map[string][]string{
		"Host": {"s3.amazonaws.com"},
		"Date": {"Wed, 28 Mar 2007 01:29:59 +0000"},
	}
	s3.Sign(testAuth, method, path, nil, headers)
	expected := "AWS 0PN5J17HBGZHT7JJ3X82:Db+gepJSUbZKwpx1FR0DLtEYoZA="
	c.Assert(headers["Authorization"], gocheck.DeepEquals, []string{expected})
}
開發者ID:nkts,項目名稱:golang-devops-stuff,代碼行數:11,代碼來源:sign_test.go

示例4: TestSignExampleObjectPut

func (s *S) TestSignExampleObjectPut(c *gocheck.C) {
	method := "PUT"
	path := "/johnsmith/photos/puppy.jpg"
	headers := map[string][]string{
		"Host":           {"johnsmith.s3.amazonaws.com"},
		"Date":           {"Tue, 27 Mar 2007 21:15:45 +0000"},
		"Content-Type":   {"image/jpeg"},
		"Content-Length": {"94328"},
	}
	s3.Sign(testAuth, method, path, nil, headers)
	expected := "AWS 0PN5J17HBGZHT7JJ3X82:hcicpDDvL9SsO6AkvxqmIWkmOuQ="
	c.Assert(headers["Authorization"], gocheck.DeepEquals, []string{expected})
}
開發者ID:nkts,項目名稱:golang-devops-stuff,代碼行數:13,代碼來源:sign_test.go

示例5: TestSignExampleDelete

func (s *S) TestSignExampleDelete(c *gocheck.C) {
	method := "DELETE"
	path := "/johnsmith/photos/puppy.jpg"
	params := map[string][]string{}
	headers := map[string][]string{
		"Host":       {"s3.amazonaws.com"},
		"Date":       {"Tue, 27 Mar 2007 21:20:27 +0000"},
		"User-Agent": {"dotnet"},
		"x-amz-date": {"Tue, 27 Mar 2007 21:20:26 +0000"},
	}
	s3.Sign(testAuth, method, path, params, headers)
	expected := "AWS 0PN5J17HBGZHT7JJ3X82:k3nL7gH3+PadhTEVn5Ip83xlYzk="
	c.Assert(headers["Authorization"], gocheck.DeepEquals, []string{expected})
}
開發者ID:nkts,項目名稱:golang-devops-stuff,代碼行數:14,代碼來源:sign_test.go

示例6: TestSignExampleFetch

func (s *S) TestSignExampleFetch(c *gocheck.C) {
	method := "GET"
	path := "/johnsmith/"
	params := map[string][]string{
		"acl": {""},
	}
	headers := map[string][]string{
		"Host": {"johnsmith.s3.amazonaws.com"},
		"Date": {"Tue, 27 Mar 2007 19:44:46 +0000"},
	}
	s3.Sign(testAuth, method, path, params, headers)
	expected := "AWS 0PN5J17HBGZHT7JJ3X82:thdUi9VAkzhkniLj96JIrOPGi0g="
	c.Assert(headers["Authorization"], gocheck.DeepEquals, []string{expected})
}
開發者ID:nkts,項目名稱:golang-devops-stuff,代碼行數:14,代碼來源:sign_test.go

示例7: TestSignExampleCustomSSE

func (s *S) TestSignExampleCustomSSE(c *check.C) {
	method := "GET"
	path := "/secret/config"
	params := map[string][]string{}
	headers := map[string][]string{
		"Host": {"secret.johnsmith.net:8080"},
		"Date": {"Tue, 27 Mar 2007 21:06:08 +0000"},
		"x-amz-server-side-encryption-customer-key":       {"MWJhakVna1dQT1B0SDFMeGtVVnRQRTFGaU1ldFJrU0I="},
		"x-amz-server-side-encryption-customer-key-MD5":   {"glIqxpqQ4a9aoK/iLttKzQ=="},
		"x-amz-server-side-encryption-customer-algorithm": {"AES256"},
	}
	s3.Sign(testAuth, method, path, params, headers)
	expected := "AWS 0PN5J17HBGZHT7JJ3X82:Xq6PWmIo0aOWq+LDjCEiCGgbmHE="
	c.Assert(headers["Authorization"], check.DeepEquals, []string{expected})
}
開發者ID:jigish,項目名稱:goamz,代碼行數:15,代碼來源:sign_test.go

示例8: TestSignExampleList

func (s *S) TestSignExampleList(c *gocheck.C) {
	method := "GET"
	path := "/johnsmith/"
	params := map[string][]string{
		"prefix":   {"photos"},
		"max-keys": {"50"},
		"marker":   {"puppy"},
	}
	headers := map[string][]string{
		"Host":       {"johnsmith.s3.amazonaws.com"},
		"Date":       {"Tue, 27 Mar 2007 19:42:41 +0000"},
		"User-Agent": {"Mozilla/5.0"},
	}
	s3.Sign(testAuth, method, path, params, headers)
	expected := "AWS 0PN5J17HBGZHT7JJ3X82:jsRt/rhG+Vtp88HrYL706QhE4w4="
	c.Assert(headers["Authorization"], gocheck.DeepEquals, []string{expected})
}
開發者ID:nkts,項目名稱:golang-devops-stuff,代碼行數:17,代碼來源:sign_test.go

示例9: TestSignExampleUpload

func (s *S) TestSignExampleUpload(c *gocheck.C) {
	method := "PUT"
	path := "/static.johnsmith.net/db-backup.dat.gz"
	params := map[string][]string{}
	headers := map[string][]string{
		"Host":                         {"static.johnsmith.net:8080"},
		"Date":                         {"Tue, 27 Mar 2007 21:06:08 +0000"},
		"User-Agent":                   {"curl/7.15.5"},
		"x-amz-acl":                    {"public-read"},
		"content-type":                 {"application/x-download"},
		"Content-MD5":                  {"4gJE4saaMU4BqNR0kLY+lw=="},
		"X-Amz-Meta-ReviewedBy":        {"[email protected],[email protected]"},
		"X-Amz-Meta-FileChecksum":      {"0x02661779"},
		"X-Amz-Meta-ChecksumAlgorithm": {"crc32"},
		"Content-Disposition":          {"attachment; filename=database.dat"},
		"Content-Encoding":             {"gzip"},
		"Content-Length":               {"5913339"},
	}
	s3.Sign(testAuth, method, path, params, headers)
	expected := "AWS 0PN5J17HBGZHT7JJ3X82:C0FlOtU8Ylb9KDTpZqYkZPX91iI="
	c.Assert(headers["Authorization"], gocheck.DeepEquals, []string{expected})
}
開發者ID:nkts,項目名稱:golang-devops-stuff,代碼行數:22,代碼來源:sign_test.go


注:本文中的github.com/crowdmob/goamz/s3.Sign函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。