当前位置: 首页>>代码示例>>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;未经允许,请勿转载。