rclone/vendor/github.com/aws/aws-sdk-go/service/glacier/examples_test.go

812 lines
19 KiB
Go
Raw Normal View History

// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package glacier_test
import (
"bytes"
"fmt"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/glacier"
)
var _ time.Duration
var _ bytes.Buffer
func ExampleGlacier_AbortMultipartUpload() {
sess := session.Must(session.NewSession())
svc := glacier.New(sess)
params := &glacier.AbortMultipartUploadInput{
AccountId: aws.String("string"), // Required
UploadId: aws.String("string"), // Required
VaultName: aws.String("string"), // Required
}
resp, err := svc.AbortMultipartUpload(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)
}
func ExampleGlacier_AbortVaultLock() {
sess := session.Must(session.NewSession())
svc := glacier.New(sess)
params := &glacier.AbortVaultLockInput{
AccountId: aws.String("string"), // Required
VaultName: aws.String("string"), // Required
}
resp, err := svc.AbortVaultLock(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)
}
func ExampleGlacier_AddTagsToVault() {
sess := session.Must(session.NewSession())
svc := glacier.New(sess)
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)
}
func ExampleGlacier_CompleteMultipartUpload() {
sess := session.Must(session.NewSession())
svc := glacier.New(sess)
params := &glacier.CompleteMultipartUploadInput{
AccountId: aws.String("string"), // Required
UploadId: aws.String("string"), // Required
VaultName: aws.String("string"), // Required
ArchiveSize: aws.String("string"),
Checksum: aws.String("string"),
}
resp, err := svc.CompleteMultipartUpload(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)
}
func ExampleGlacier_CompleteVaultLock() {
sess := session.Must(session.NewSession())
svc := glacier.New(sess)
params := &glacier.CompleteVaultLockInput{
AccountId: aws.String("string"), // Required
LockId: aws.String("string"), // Required
VaultName: aws.String("string"), // Required
}
resp, err := svc.CompleteVaultLock(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)
}
func ExampleGlacier_CreateVault() {
sess := session.Must(session.NewSession())
svc := glacier.New(sess)
params := &glacier.CreateVaultInput{
AccountId: aws.String("string"), // Required
VaultName: aws.String("string"), // Required
}
resp, err := svc.CreateVault(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)
}
func ExampleGlacier_DeleteArchive() {
sess := session.Must(session.NewSession())
svc := glacier.New(sess)
params := &glacier.DeleteArchiveInput{
AccountId: aws.String("string"), // Required
ArchiveId: aws.String("string"), // Required
VaultName: aws.String("string"), // Required
}
resp, err := svc.DeleteArchive(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)
}
func ExampleGlacier_DeleteVault() {
sess := session.Must(session.NewSession())
svc := glacier.New(sess)
params := &glacier.DeleteVaultInput{
AccountId: aws.String("string"), // Required
VaultName: aws.String("string"), // Required
}
resp, err := svc.DeleteVault(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)
}
func ExampleGlacier_DeleteVaultAccessPolicy() {
sess := session.Must(session.NewSession())
svc := glacier.New(sess)
params := &glacier.DeleteVaultAccessPolicyInput{
AccountId: aws.String("string"), // Required
VaultName: aws.String("string"), // Required
}
resp, err := svc.DeleteVaultAccessPolicy(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)
}
func ExampleGlacier_DeleteVaultNotifications() {
sess := session.Must(session.NewSession())
svc := glacier.New(sess)
params := &glacier.DeleteVaultNotificationsInput{
AccountId: aws.String("string"), // Required
VaultName: aws.String("string"), // Required
}
resp, err := svc.DeleteVaultNotifications(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)
}
func ExampleGlacier_DescribeJob() {
sess := session.Must(session.NewSession())
svc := glacier.New(sess)
params := &glacier.DescribeJobInput{
AccountId: aws.String("string"), // Required
JobId: aws.String("string"), // Required
VaultName: aws.String("string"), // Required
}
resp, err := svc.DescribeJob(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)
}
func ExampleGlacier_DescribeVault() {
sess := session.Must(session.NewSession())
svc := glacier.New(sess)
params := &glacier.DescribeVaultInput{
AccountId: aws.String("string"), // Required
VaultName: aws.String("string"), // Required
}
resp, err := svc.DescribeVault(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)
}
func ExampleGlacier_GetDataRetrievalPolicy() {
sess := session.Must(session.NewSession())
svc := glacier.New(sess)
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)
}
func ExampleGlacier_GetJobOutput() {
sess := session.Must(session.NewSession())
svc := glacier.New(sess)
params := &glacier.GetJobOutputInput{
AccountId: aws.String("string"), // Required
JobId: aws.String("string"), // Required
VaultName: aws.String("string"), // Required
Range: aws.String("string"),
}
resp, err := svc.GetJobOutput(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)
}
func ExampleGlacier_GetVaultAccessPolicy() {
sess := session.Must(session.NewSession())
svc := glacier.New(sess)
params := &glacier.GetVaultAccessPolicyInput{
AccountId: aws.String("string"), // Required
VaultName: aws.String("string"), // Required
}
resp, err := svc.GetVaultAccessPolicy(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)
}
func ExampleGlacier_GetVaultLock() {
sess := session.Must(session.NewSession())
svc := glacier.New(sess)
params := &glacier.GetVaultLockInput{
AccountId: aws.String("string"), // Required
VaultName: aws.String("string"), // Required
}
resp, err := svc.GetVaultLock(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)
}
func ExampleGlacier_GetVaultNotifications() {
sess := session.Must(session.NewSession())
svc := glacier.New(sess)
params := &glacier.GetVaultNotificationsInput{
AccountId: aws.String("string"), // Required
VaultName: aws.String("string"), // Required
}
resp, err := svc.GetVaultNotifications(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)
}
func ExampleGlacier_InitiateJob() {
sess := session.Must(session.NewSession())
svc := glacier.New(sess)
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"),
Tier: 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)
}
func ExampleGlacier_InitiateMultipartUpload() {
sess := session.Must(session.NewSession())
svc := glacier.New(sess)
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)
}
func ExampleGlacier_InitiateVaultLock() {
sess := session.Must(session.NewSession())
svc := glacier.New(sess)
params := &glacier.InitiateVaultLockInput{
AccountId: aws.String("string"), // Required
VaultName: aws.String("string"), // Required
Policy: &glacier.VaultLockPolicy{
Policy: aws.String("string"),
},
}
resp, err := svc.InitiateVaultLock(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)
}
func ExampleGlacier_ListJobs() {
sess := session.Must(session.NewSession())
svc := glacier.New(sess)
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)
}
func ExampleGlacier_ListMultipartUploads() {
sess := session.Must(session.NewSession())
svc := glacier.New(sess)
params := &glacier.ListMultipartUploadsInput{
AccountId: aws.String("string"), // Required
VaultName: aws.String("string"), // Required
Limit: aws.String("string"),
Marker: aws.String("string"),
}
resp, err := svc.ListMultipartUploads(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)
}
func ExampleGlacier_ListParts() {
sess := session.Must(session.NewSession())
svc := glacier.New(sess)
params := &glacier.ListPartsInput{
AccountId: aws.String("string"), // Required
UploadId: aws.String("string"), // Required
VaultName: aws.String("string"), // Required
Limit: aws.String("string"),
Marker: aws.String("string"),
}
resp, err := svc.ListParts(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)
}
func ExampleGlacier_ListProvisionedCapacity() {
sess := session.Must(session.NewSession())
svc := glacier.New(sess)
params := &glacier.ListProvisionedCapacityInput{
AccountId: aws.String("string"), // Required
}
resp, err := svc.ListProvisionedCapacity(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)
}
func ExampleGlacier_ListTagsForVault() {
sess := session.Must(session.NewSession())
svc := glacier.New(sess)
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)
}
func ExampleGlacier_ListVaults() {
sess := session.Must(session.NewSession())
svc := glacier.New(sess)
params := &glacier.ListVaultsInput{
AccountId: aws.String("string"), // Required
Limit: aws.String("string"),
Marker: aws.String("string"),
}
resp, err := svc.ListVaults(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)
}
func ExampleGlacier_PurchaseProvisionedCapacity() {
sess := session.Must(session.NewSession())
svc := glacier.New(sess)
params := &glacier.PurchaseProvisionedCapacityInput{
AccountId: aws.String("string"), // Required
}
resp, err := svc.PurchaseProvisionedCapacity(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)
}
func ExampleGlacier_RemoveTagsFromVault() {
sess := session.Must(session.NewSession())
svc := glacier.New(sess)
params := &glacier.RemoveTagsFromVaultInput{
AccountId: aws.String("string"), // Required
VaultName: aws.String("string"), // Required
TagKeys: []*string{
aws.String("string"), // Required
// More values...
},
}
resp, err := svc.RemoveTagsFromVault(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)
}
func ExampleGlacier_SetDataRetrievalPolicy() {
sess := session.Must(session.NewSession())
svc := glacier.New(sess)
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)
}
func ExampleGlacier_SetVaultAccessPolicy() {
sess := session.Must(session.NewSession())
svc := glacier.New(sess)
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)
}
func ExampleGlacier_SetVaultNotifications() {
sess := session.Must(session.NewSession())
svc := glacier.New(sess)
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)
}
func ExampleGlacier_UploadArchive() {
sess := session.Must(session.NewSession())
svc := glacier.New(sess)
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)
}
func ExampleGlacier_UploadMultipartPart() {
sess := session.Must(session.NewSession())
svc := glacier.New(sess)
params := &glacier.UploadMultipartPartInput{
AccountId: aws.String("string"), // Required
UploadId: aws.String("string"), // Required
VaultName: aws.String("string"), // Required
Body: bytes.NewReader([]byte("PAYLOAD")),
Checksum: aws.String("string"),
Range: aws.String("string"),
}
resp, err := svc.UploadMultipartPart(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)
}