本文整理汇总了Golang中gopkg/in/goose/v1/swift.New函数的典型用法代码示例。如果您正苦于以下问题:Golang New函数的具体用法?Golang New怎么用?Golang New使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了New函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: ImageMetadataStorage
// ImageMetadataStorage returns a Storage object pointing where the goose
// infrastructure sets up its keystone entry for image metadata
func ImageMetadataStorage(e environs.Environ) envstorage.Storage {
env := e.(*environ)
return &openstackstorage{
containerName: "imagemetadata",
swift: swift.New(env.client),
}
}
示例2: CreateCustomStorage
// CreateCustomStorage creates a swift container and returns the Storage object
// so you can put data into it.
func CreateCustomStorage(e environs.Environ, containerName string) envstorage.Storage {
env := e.(*environ)
swiftClient := swift.New(env.client)
if err := swiftClient.CreateContainer(containerName, swift.PublicRead); err != nil {
panic(err)
}
return &openstackstorage{
containerName: containerName,
swift: swiftClient,
}
}
示例3: MetadataStorage
// MetadataStorage returns a Storage instance which is used to store simplestreams metadata for tests.
func MetadataStorage(e environs.Environ) envstorage.Storage {
ecfg := e.(*environ).ecfg()
container := "juju-dist-test"
metadataStorage := &openstackstorage{
containerName: container,
swift: swift.New(authClient(ecfg)),
}
// Ensure the container exists.
err := metadataStorage.makeContainer(container, swift.PublicRead)
if err != nil {
panic(fmt.Errorf("cannot create %s container: %v", container, err))
}
return metadataStorage
}