本文整理汇总了Golang中github.com/cloudfoundry-incubator/ltc/config.Config.S3BlobStore方法的典型用法代码示例。如果您正苦于以下问题:Golang Config.S3BlobStore方法的具体用法?Golang Config.S3BlobStore怎么用?Golang Config.S3BlobStore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cloudfoundry-incubator/ltc/config.Config
的用法示例。
在下文中一共展示了Config.S3BlobStore方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: New
func New(config *config_package.Config) BlobStore {
switch config.ActiveBlobStore() {
case config_package.DAVBlobStore:
return dav_blob_store.New(config.BlobStore())
case config_package.S3BlobStore:
return s3_blob_store.New(config.S3BlobStore())
}
return dav_blob_store.New(config.BlobStore())
}
示例2: Verify
func (v Verifier) Verify(config *config_package.Config) (authorized bool, err error) {
blobStoreConfig := config.S3BlobStore()
client := s3.New(session.New(&aws.Config{
Credentials: credentials.NewStaticCredentials(blobStoreConfig.AccessKey, blobStoreConfig.SecretKey, ""),
Region: aws.String(blobStoreConfig.Region),
S3ForcePathStyle: aws.Bool(true),
}))
if v.Endpoint != "" {
client.Endpoint = v.Endpoint
}
_, err = client.ListObjects(&s3.ListObjectsInput{
Bucket: aws.String(blobStoreConfig.BucketName),
})
if err != nil {
if awsErr, ok := err.(awserr.RequestFailure); ok && awsErr.StatusCode() == 403 {
return false, nil
}
return false, err
}
return true, nil
}
示例3:
fakePasswordReader.PromptForPasswordReturns("some-secret")
doneChan := test_helpers.AsyncExecuteCommandWithArgs(targetCommand, []string{"myapi.com", "--s3"})
Eventually(outputBuffer).Should(test_helpers.Say("S3 Access Key: "))
stdinWriter.Write([]byte("some-access\n"))
Eventually(outputBuffer).Should(test_helpers.Say("S3 Bucket: "))
stdinWriter.Write([]byte("some-bucket\n"))
Eventually(outputBuffer).Should(test_helpers.Say("S3 Region: "))
stdinWriter.Write([]byte("some-region\n"))
Eventually(doneChan, 3).Should(BeClosed())
Expect(fakeBlobStoreVerifier.VerifyCallCount()).To(Equal(1))
config := fakeBlobStoreVerifier.VerifyArgsForCall(0)
s3BlobTargetInfo := config.S3BlobStore()
Expect(s3BlobTargetInfo.AccessKey).To(Equal("some-access"))
Expect(s3BlobTargetInfo.SecretKey).To(Equal("some-secret"))
Expect(s3BlobTargetInfo.BucketName).To(Equal("some-bucket"))
Expect(s3BlobTargetInfo.Region).To(Equal("some-region"))
newConfig := config_package.New(configPersister)
Expect(newConfig.Load()).To(Succeed())
newS3BlobTargetInfo := newConfig.S3BlobStore()
Expect(newS3BlobTargetInfo.AccessKey).To(Equal("some-access"))
Expect(newS3BlobTargetInfo.SecretKey).To(Equal("some-secret"))
Expect(newS3BlobTargetInfo.BucketName).To(Equal("some-bucket"))
Expect(newS3BlobTargetInfo.Region).To(Equal("some-region"))
})
})
示例4:
Password: "some-password",
}))
})
It("sets the activeBlobStore to 'dav'", func() {
testConfig.SetS3BlobStore("some-access-key", "some-secret-key", "some-bucket-name", "some-region")
testConfig.SetBlobStore("some-host", "7474", "some-username", "some-password")
Expect(testConfig.ActiveBlobStore().String()).To(Equal("dav"))
})
})
Describe("TargetS3Blob", func() {
It("sets the s3 blob target", func() {
testConfig.SetS3BlobStore("some-access-key", "some-secret-key", "some-bucket-name", "some-region")
Expect(testConfig.S3BlobStore()).To(Equal(config.S3BlobStoreConfig{
Region: "some-region",
AccessKey: "some-access-key",
SecretKey: "some-secret-key",
BucketName: "some-bucket-name",
}))
})
It("sets the activeBlobStore to 's3'", func() {
testConfig.SetS3BlobStore("some-access-key", "some-secret-key", "some-bucket-name", "some-region")
Expect(testConfig.ActiveBlobStore().String()).To(Equal("s3"))
})
})
})
type fakePersister struct {