123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705 |
- // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
- package glacier_test
- import (
- "bytes"
- "fmt"
- "time"
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/service/glacier"
- )
- var _ time.Duration
- var _ bytes.Buffer
- func ExampleGlacier_AbortMultipartUpload() {
- svc := glacier.New(nil)
- 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() {
- svc := glacier.New(nil)
- 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() {
- 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)
- }
- func ExampleGlacier_CompleteMultipartUpload() {
- svc := glacier.New(nil)
- 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() {
- svc := glacier.New(nil)
- 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() {
- svc := glacier.New(nil)
- 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() {
- svc := glacier.New(nil)
- 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() {
- svc := glacier.New(nil)
- 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() {
- svc := glacier.New(nil)
- 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() {
- svc := glacier.New(nil)
- 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() {
- svc := glacier.New(nil)
- 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() {
- svc := glacier.New(nil)
- 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() {
- 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)
- }
- func ExampleGlacier_GetJobOutput() {
- svc := glacier.New(nil)
- 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() {
- svc := glacier.New(nil)
- 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() {
- svc := glacier.New(nil)
- 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() {
- svc := glacier.New(nil)
- 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() {
- 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)
- }
- 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)
- }
- func ExampleGlacier_InitiateVaultLock() {
- svc := glacier.New(nil)
- 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() {
- 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)
- }
- func ExampleGlacier_ListMultipartUploads() {
- svc := glacier.New(nil)
- 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() {
- svc := glacier.New(nil)
- 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_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)
- }
- func ExampleGlacier_ListVaults() {
- svc := glacier.New(nil)
- 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_RemoveTagsFromVault() {
- svc := glacier.New(nil)
- 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() {
- 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)
- }
- 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)
- }
- 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)
- }
- 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)
- }
- func ExampleGlacier_UploadMultipartPart() {
- svc := glacier.New(nil)
- 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)
- }
|