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


Golang Environ.PublicStorage方法代碼示例

本文整理匯總了Golang中launchpad/net/juju-core/environs.Environ.PublicStorage方法的典型用法代碼示例。如果您正苦於以下問題:Golang Environ.PublicStorage方法的具體用法?Golang Environ.PublicStorage怎麽用?Golang Environ.PublicStorage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在launchpad/net/juju-core/environs.Environ的用法示例。


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

示例1: WritablePublicStorage

// WritablePublicStorage returns a Storage instance which is authorised to write to the PublicStorage bucket.
// It is used by tests which need to upload files.
func WritablePublicStorage(e environs.Environ) environs.Storage {
	// In the case of ec2, access to the public storage instance is created with the user's AWS credentials.
	// So write access is there implicitly, and we just need to cast to a writable storage instance.
	// This contrasts with the openstack case, where the public storage instance truly is read only and we need
	// to create a separate writable instance. If the ec2 case ever changes, the changes are confined to this method.
	return e.PublicStorage().(environs.Storage)
}
開發者ID:johnvilsack,項目名稱:golang-stuff,代碼行數:9,代碼來源:export_test.go

示例2: putNames

// putNames puts a set of names into the environ's private
// and public storage. The data in the private storage is
// the name itself; in the public storage the name is preceded with "public-".
func putNames(c *C, env environs.Environ, private, public []string) {
	for _, name := range private {
		err := env.Storage().Put(name, strings.NewReader(name), int64(len(name)))
		c.Assert(err, IsNil)
	}
	// The contents of all files in the public storage is prefixed with "public-" so
	// that we can easily tell if we've got the right thing.
	for _, name := range public {
		data := "public-" + name
		err := env.PublicStorage().(environs.Storage).Put(name, strings.NewReader(data), int64(len(data)))
		c.Assert(err, IsNil)
	}
}
開發者ID:prabhakhar,項目名稱:juju-core,代碼行數:16,代碼來源:tools_test.go

示例3: RemoveAllTools

// RemoveAllTools deletes all tools from the supplied environment.
func RemoveAllTools(c *C, env environs.Environ) {
	c.Logf("clearing private storage")
	RemoveTools(c, env.Storage())
	c.Logf("clearing public storage")
	RemoveTools(c, env.PublicStorage().(environs.Storage))
}
開發者ID:CSRedRat,項目名稱:juju-core,代碼行數:7,代碼來源:tools.go


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