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 { if awsErr, ok := err.(awserr.Error); ok { // Generic AWS error with Code, Message, and original error (if any) fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) if reqErr, ok := err.(awserr.RequestFailure); ok { // A service error occurred fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) } } else { // This case should never be hit, the SDK should always return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.Prettify(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 { if awsErr, ok := err.(awserr.Error); ok { // Generic AWS error with Code, Message, and original error (if any) fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) if reqErr, ok := err.(awserr.RequestFailure); ok { // A service error occurred fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) } } else { // This case should never be hit, the SDK should always return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.Prettify(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 { if awsErr, ok := err.(awserr.Error); ok { // Generic AWS error with Code, Message, and original error (if any) fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) if reqErr, ok := err.(awserr.RequestFailure); ok { // A service error occurred fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) } } else { // This case should never be hit, the SDK should always return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.Prettify(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 { if awsErr, ok := err.(awserr.Error); ok { // Generic AWS error with Code, Message, and original error (if any) fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) if reqErr, ok := err.(awserr.RequestFailure); ok { // A service error occurred fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) } } else { // This case should never be hit, the SDK should always return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.Prettify(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 { if awsErr, ok := err.(awserr.Error); ok { // Generic AWS error with Code, Message, and original error (if any) fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) if reqErr, ok := err.(awserr.RequestFailure); ok { // A service error occurred fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) } } else { // This case should never be hit, the SDK should always return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.Prettify(resp)) }
func TestInterface(t *testing.T) { assert.Implements(t, (*glacieriface.GlacierAPI)(nil), glacier.New(nil)) }
func init() { Before("@glacier", func() { World["client"] = glacier.New(nil) }) }
"github.com/tetrafolium/aws-sdk-go/internal/test/unit" "github.com/tetrafolium/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")