本文整理汇总了Golang中github.com/upstartmobile/aws-sdk-go/service/glacier.New函数的典型用法代码示例。如果您正苦于以下问题:Golang New函数的具体用法?Golang New怎么用?Golang New使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了New函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: ExampleGlacier_SetVaultNotifications
func ExampleGlacier_SetVaultNotifications() {
svc := glacier.New(nil)
params := &glacier.SetVaultNotificationsInput{
AccountId: aws.String("string"), // Required
VaultName: aws.String("string"), // Required
VaultNotificationConfig: &glacier.VaultNotificationConfig{
Events: []*string{
aws.String("string"), // Required
// More values...
},
SNSTopic: aws.String("string"),
},
}
resp, err := svc.SetVaultNotifications(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例2: ExampleGlacier_SetDataRetrievalPolicy
func ExampleGlacier_SetDataRetrievalPolicy() {
svc := glacier.New(nil)
params := &glacier.SetDataRetrievalPolicyInput{
AccountId: aws.String("string"), // Required
Policy: &glacier.DataRetrievalPolicy{
Rules: []*glacier.DataRetrievalRule{
{ // Required
BytesPerHour: aws.Int64(1),
Strategy: aws.String("string"),
},
// More values...
},
},
}
resp, err := svc.SetDataRetrievalPolicy(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例3: ExampleGlacier_InitiateJob
func ExampleGlacier_InitiateJob() {
svc := glacier.New(nil)
params := &glacier.InitiateJobInput{
AccountId: aws.String("string"), // Required
VaultName: aws.String("string"), // Required
JobParameters: &glacier.JobParameters{
ArchiveId: aws.String("string"),
Description: aws.String("string"),
Format: aws.String("string"),
InventoryRetrievalParameters: &glacier.InventoryRetrievalJobInput{
EndDate: aws.String("string"),
Limit: aws.String("string"),
Marker: aws.String("string"),
StartDate: aws.String("string"),
},
RetrievalByteRange: aws.String("string"),
SNSTopic: aws.String("string"),
Type: aws.String("string"),
},
}
resp, err := svc.InitiateJob(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例4: ExampleGlacier_GetDataRetrievalPolicy
func ExampleGlacier_GetDataRetrievalPolicy() {
svc := glacier.New(nil)
params := &glacier.GetDataRetrievalPolicyInput{
AccountId: aws.String("string"), // Required
}
resp, err := svc.GetDataRetrievalPolicy(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例5: ExampleGlacier_ListTagsForVault
func ExampleGlacier_ListTagsForVault() {
svc := glacier.New(nil)
params := &glacier.ListTagsForVaultInput{
AccountId: aws.String("string"), // Required
VaultName: aws.String("string"), // Required
}
resp, err := svc.ListTagsForVault(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例6: ExampleGlacier_InitiateMultipartUpload
func ExampleGlacier_InitiateMultipartUpload() {
svc := glacier.New(nil)
params := &glacier.InitiateMultipartUploadInput{
AccountId: aws.String("string"), // Required
VaultName: aws.String("string"), // Required
ArchiveDescription: aws.String("string"),
PartSize: aws.String("string"),
}
resp, err := svc.InitiateMultipartUpload(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例7: ExampleGlacier_UploadArchive
func ExampleGlacier_UploadArchive() {
svc := glacier.New(nil)
params := &glacier.UploadArchiveInput{
AccountId: aws.String("string"), // Required
VaultName: aws.String("string"), // Required
ArchiveDescription: aws.String("string"),
Body: bytes.NewReader([]byte("PAYLOAD")),
Checksum: aws.String("string"),
}
resp, err := svc.UploadArchive(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例8: ExampleGlacier_SetVaultAccessPolicy
func ExampleGlacier_SetVaultAccessPolicy() {
svc := glacier.New(nil)
params := &glacier.SetVaultAccessPolicyInput{
AccountId: aws.String("string"), // Required
VaultName: aws.String("string"), // Required
Policy: &glacier.VaultAccessPolicy{
Policy: aws.String("string"),
},
}
resp, err := svc.SetVaultAccessPolicy(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例9: ExampleGlacier_AddTagsToVault
func ExampleGlacier_AddTagsToVault() {
svc := glacier.New(nil)
params := &glacier.AddTagsToVaultInput{
AccountId: aws.String("string"), // Required
VaultName: aws.String("string"), // Required
Tags: map[string]*string{
"Key": aws.String("TagValue"), // Required
// More values...
},
}
resp, err := svc.AddTagsToVault(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例10: ExampleGlacier_ListJobs
func ExampleGlacier_ListJobs() {
svc := glacier.New(nil)
params := &glacier.ListJobsInput{
AccountId: aws.String("string"), // Required
VaultName: aws.String("string"), // Required
Completed: aws.String("string"),
Limit: aws.String("string"),
Marker: aws.String("string"),
Statuscode: aws.String("string"),
}
resp, err := svc.ListJobs(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例11: init
func init() {
Before("@glacier", func() {
World["client"] = glacier.New(nil)
})
}
示例12: TestCustomizations
"github.com/upstartmobile/aws-sdk-go/awstesting/unit"
"github.com/upstartmobile/aws-sdk-go/service/glacier"
)
var (
_ = unit.Imported
payloadBuf = func() *bytes.Reader {
buf := make([]byte, 5767168) // 5.5MB buffer
for i := range buf {
buf[i] = '0' // Fill with zero characters
}
return bytes.NewReader(buf)
}()
svc = glacier.New(nil)
)
func TestCustomizations(t *testing.T) {
req, _ := svc.UploadArchiveRequest(&glacier.UploadArchiveInput{
VaultName: aws.String("vault"),
Body: payloadBuf,
})
err := req.Build()
assert.NoError(t, err)
// Sets API version
assert.Equal(t, req.Service.APIVersion, req.HTTPRequest.Header.Get("x-amz-glacier-version"))
// Sets Account ID
v := awsutil.ValuesAtPath(req.Params, "AccountId")
示例13: TestInterface
func TestInterface(t *testing.T) {
assert.Implements(t, (*glacieriface.GlacierAPI)(nil), glacier.New(nil))
}