func ExampleGlacier_SetDataRetrievalPolicy() { svc := glacier.New(nil) params := &glacier.SetDataRetrievalPolicyInput{ AccountID: aws.String("string"), // Required Policy: &glacier.DataRetrievalPolicy{ Rules: []*glacier.DataRetrievalRule{ &glacier.DataRetrievalRule{ // Required BytesPerHour: aws.Long(1), Strategy: aws.String("string"), }, // More values... }, }, } resp, err := svc.SetDataRetrievalPolicy(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(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 awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(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 awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func ExampleGlacier_GetDataRetrievalPolicy() { svc := glacier.New(nil) params := &glacier.GetDataRetrievalPolicyInput{ AccountID: aws.String("string"), // Required } resp, err := svc.GetDataRetrievalPolicy(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(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 awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(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 awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(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 awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(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 awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
"github.com/datacratic/aws-sdk-go/aws/awsutil" "github.com/datacratic/aws-sdk-go/service/glacier" "github.com/stretchr/testify/assert" ) var ( 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(&aws.Config{ Region: "mock-region", }) ) 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