本文整理汇总了Golang中github.com/datacratic/aws-sdk-go/aws.Error函数的典型用法代码示例。如果您正苦于以下问题:Golang Error函数的具体用法?Golang Error怎么用?Golang Error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Error函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: ExampleRDS_PurchaseReservedDBInstancesOffering
func ExampleRDS_PurchaseReservedDBInstancesOffering() {
svc := rds.New(nil)
params := &rds.PurchaseReservedDBInstancesOfferingInput{
ReservedDBInstancesOfferingID: aws.String("String"), // Required
DBInstanceCount: aws.Long(1),
ReservedDBInstanceID: aws.String("String"),
Tags: []*rds.Tag{
&rds.Tag{ // Required
Key: aws.String("String"),
Value: aws.String("String"),
},
// More values...
},
}
resp, err := svc.PurchaseReservedDBInstancesOffering(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))
}
开发者ID:datacratic,项目名称:aws-sdk-go,代码行数:28,代码来源:examples_test.go
示例2: TestValidateCRC32AlreadyErrorSkip
func TestValidateCRC32AlreadyErrorSkip(t *testing.T) {
req := mockCRCResponse(db, 400, "{}", "1234")
assert.Error(t, req.Error)
aerr := aws.Error(req.Error)
assert.NotEqual(t, "CRC32CheckFailed", aerr.Code)
}
开发者ID:datacratic,项目名称:aws-sdk-go,代码行数:7,代码来源:customizations_test.go
示例3: ExampleLambda_UploadFunction
func ExampleLambda_UploadFunction() {
svc := lambda.New(nil)
params := &lambda.UploadFunctionInput{
FunctionName: aws.String("FunctionName"), // Required
FunctionZip: bytes.NewReader([]byte("PAYLOAD")), // Required
Handler: aws.String("Handler"), // Required
Mode: aws.String("Mode"), // Required
Role: aws.String("RoleArn"), // Required
Runtime: aws.String("Runtime"), // Required
Description: aws.String("Description"),
MemorySize: aws.Long(1),
Timeout: aws.Long(1),
}
resp, err := svc.UploadFunction(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))
}
开发者ID:datacratic,项目名称:aws-sdk-go,代码行数:27,代码来源:examples_test.go
示例4: ExampleS3_ListObjectVersions
func ExampleS3_ListObjectVersions() {
svc := s3.New(nil)
params := &s3.ListObjectVersionsInput{
Bucket: aws.String("BucketName"), // Required
Delimiter: aws.String("Delimiter"),
EncodingType: aws.String("EncodingType"),
KeyMarker: aws.String("KeyMarker"),
MaxKeys: aws.Long(1),
Prefix: aws.String("Prefix"),
VersionIDMarker: aws.String("VersionIdMarker"),
}
resp, err := svc.ListObjectVersions(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))
}
开发者ID:datacratic,项目名称:aws-sdk-go,代码行数:25,代码来源:examples_test.go
示例5: ExampleSSM_UpdateAssociationStatus
func ExampleSSM_UpdateAssociationStatus() {
svc := ssm.New(nil)
params := &ssm.UpdateAssociationStatusInput{
AssociationStatus: &ssm.AssociationStatus{ // Required
Date: aws.Time(time.Now()), // Required
Message: aws.String("StatusMessage"), // Required
Name: aws.String("AssociationStatusName"), // Required
AdditionalInfo: aws.String("StatusAdditionalInfo"),
},
InstanceID: aws.String("InstanceId"), // Required
Name: aws.String("DocumentName"), // Required
}
resp, err := svc.UpdateAssociationStatus(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))
}
开发者ID:datacratic,项目名称:aws-sdk-go,代码行数:26,代码来源:examples_test.go
示例6: ExampleS3_UploadPartCopy
func ExampleS3_UploadPartCopy() {
svc := s3.New(nil)
params := &s3.UploadPartCopyInput{
Bucket: aws.String("BucketName"), // Required
CopySource: aws.String("CopySource"), // Required
Key: aws.String("ObjectKey"), // Required
PartNumber: aws.Long(1), // Required
UploadID: aws.String("MultipartUploadId"), // Required
CopySourceIfMatch: aws.String("CopySourceIfMatch"),
CopySourceIfModifiedSince: aws.Time(time.Now()),
CopySourceIfNoneMatch: aws.String("CopySourceIfNoneMatch"),
CopySourceIfUnmodifiedSince: aws.Time(time.Now()),
CopySourceRange: aws.String("CopySourceRange"),
CopySourceSSECustomerAlgorithm: aws.String("CopySourceSSECustomerAlgorithm"),
CopySourceSSECustomerKey: aws.String("CopySourceSSECustomerKey"),
CopySourceSSECustomerKeyMD5: aws.String("CopySourceSSECustomerKeyMD5"),
RequestPayer: aws.String("RequestPayer"),
SSECustomerAlgorithm: aws.String("SSECustomerAlgorithm"),
SSECustomerKey: aws.String("SSECustomerKey"),
SSECustomerKeyMD5: aws.String("SSECustomerKeyMD5"),
}
resp, err := svc.UploadPartCopy(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))
}
开发者ID:datacratic,项目名称:aws-sdk-go,代码行数:35,代码来源:examples_test.go
示例7: ExampleS3_CompleteMultipartUpload
func ExampleS3_CompleteMultipartUpload() {
svc := s3.New(nil)
params := &s3.CompleteMultipartUploadInput{
Bucket: aws.String("BucketName"), // Required
Key: aws.String("ObjectKey"), // Required
UploadID: aws.String("MultipartUploadId"), // Required
MultipartUpload: &s3.CompletedMultipartUpload{
Parts: []*s3.CompletedPart{
&s3.CompletedPart{ // Required
ETag: aws.String("ETag"),
PartNumber: aws.Long(1),
},
// More values...
},
},
RequestPayer: aws.String("RequestPayer"),
}
resp, err := svc.CompleteMultipartUpload(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))
}
开发者ID:datacratic,项目名称:aws-sdk-go,代码行数:31,代码来源:examples_test.go
示例8: ExampleRDS_DescribeDBEngineVersions
func ExampleRDS_DescribeDBEngineVersions() {
svc := rds.New(nil)
params := &rds.DescribeDBEngineVersionsInput{
DBParameterGroupFamily: aws.String("String"),
DefaultOnly: aws.Boolean(true),
Engine: aws.String("String"),
EngineVersion: aws.String("String"),
Filters: []*rds.Filter{
&rds.Filter{ // Required
Name: aws.String("String"), // Required
Values: []*string{ // Required
aws.String("String"), // Required
// More values...
},
},
// More values...
},
ListSupportedCharacterSets: aws.Boolean(true),
Marker: aws.String("String"),
MaxRecords: aws.Long(1),
}
resp, err := svc.DescribeDBEngineVersions(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))
}
开发者ID:datacratic,项目名称:aws-sdk-go,代码行数:35,代码来源:examples_test.go
示例9: ExampleRDS_DescribeDBLogFiles
func ExampleRDS_DescribeDBLogFiles() {
svc := rds.New(nil)
params := &rds.DescribeDBLogFilesInput{
DBInstanceIdentifier: aws.String("String"), // Required
FileLastWritten: aws.Long(1),
FileSize: aws.Long(1),
FilenameContains: aws.String("String"),
Filters: []*rds.Filter{
&rds.Filter{ // Required
Name: aws.String("String"), // Required
Values: []*string{ // Required
aws.String("String"), // Required
// More values...
},
},
// More values...
},
Marker: aws.String("String"),
MaxRecords: aws.Long(1),
}
resp, err := svc.DescribeDBLogFiles(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))
}
开发者ID:datacratic,项目名称:aws-sdk-go,代码行数:34,代码来源:examples_test.go
示例10: ExampleRDS_AddTagsToResource
func ExampleRDS_AddTagsToResource() {
svc := rds.New(nil)
params := &rds.AddTagsToResourceInput{
ResourceName: aws.String("String"), // Required
Tags: []*rds.Tag{ // Required
&rds.Tag{ // Required
Key: aws.String("String"),
Value: aws.String("String"),
},
// More values...
},
}
resp, err := svc.AddTagsToResource(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))
}
开发者ID:datacratic,项目名称:aws-sdk-go,代码行数:26,代码来源:examples_test.go
示例11: ExampleRDS_CreateOptionGroup
func ExampleRDS_CreateOptionGroup() {
svc := rds.New(nil)
params := &rds.CreateOptionGroupInput{
EngineName: aws.String("String"), // Required
MajorEngineVersion: aws.String("String"), // Required
OptionGroupDescription: aws.String("String"), // Required
OptionGroupName: aws.String("String"), // Required
Tags: []*rds.Tag{
&rds.Tag{ // Required
Key: aws.String("String"),
Value: aws.String("String"),
},
// More values...
},
}
resp, err := svc.CreateOptionGroup(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))
}
开发者ID:datacratic,项目名称:aws-sdk-go,代码行数:29,代码来源:examples_test.go
示例12: ExampleRDS_CreateDBSnapshot
func ExampleRDS_CreateDBSnapshot() {
svc := rds.New(nil)
params := &rds.CreateDBSnapshotInput{
DBInstanceIdentifier: aws.String("String"), // Required
DBSnapshotIdentifier: aws.String("String"), // Required
Tags: []*rds.Tag{
&rds.Tag{ // Required
Key: aws.String("String"),
Value: aws.String("String"),
},
// More values...
},
}
resp, err := svc.CreateDBSnapshot(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))
}
开发者ID:datacratic,项目名称:aws-sdk-go,代码行数:27,代码来源:examples_test.go
示例13: ExampleRDS_CreateDBInstance
func ExampleRDS_CreateDBInstance() {
svc := rds.New(nil)
params := &rds.CreateDBInstanceInput{
AllocatedStorage: aws.Long(1), // Required
DBInstanceClass: aws.String("String"), // Required
DBInstanceIdentifier: aws.String("String"), // Required
Engine: aws.String("String"), // Required
MasterUserPassword: aws.String("String"), // Required
MasterUsername: aws.String("String"), // Required
AutoMinorVersionUpgrade: aws.Boolean(true),
AvailabilityZone: aws.String("String"),
BackupRetentionPeriod: aws.Long(1),
CharacterSetName: aws.String("String"),
DBName: aws.String("String"),
DBParameterGroupName: aws.String("String"),
DBSecurityGroups: []*string{
aws.String("String"), // Required
// More values...
},
DBSubnetGroupName: aws.String("String"),
EngineVersion: aws.String("String"),
IOPS: aws.Long(1),
KMSKeyID: aws.String("String"),
LicenseModel: aws.String("String"),
MultiAZ: aws.Boolean(true),
OptionGroupName: aws.String("String"),
Port: aws.Long(1),
PreferredBackupWindow: aws.String("String"),
PreferredMaintenanceWindow: aws.String("String"),
PubliclyAccessible: aws.Boolean(true),
StorageEncrypted: aws.Boolean(true),
StorageType: aws.String("String"),
TDECredentialARN: aws.String("String"),
TDECredentialPassword: aws.String("String"),
Tags: []*rds.Tag{
&rds.Tag{ // Required
Key: aws.String("String"),
Value: aws.String("String"),
},
// More values...
},
VPCSecurityGroupIDs: []*string{
aws.String("String"), // Required
// More values...
},
}
resp, err := svc.CreateDBInstance(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))
}
开发者ID:datacratic,项目名称:aws-sdk-go,代码行数:60,代码来源:examples_test.go
示例14: ExampleRDS_ResetDBParameterGroup
func ExampleRDS_ResetDBParameterGroup() {
svc := rds.New(nil)
params := &rds.ResetDBParameterGroupInput{
DBParameterGroupName: aws.String("String"), // Required
Parameters: []*rds.Parameter{
&rds.Parameter{ // Required
AllowedValues: aws.String("String"),
ApplyMethod: aws.String("ApplyMethod"),
ApplyType: aws.String("String"),
DataType: aws.String("String"),
Description: aws.String("String"),
IsModifiable: aws.Boolean(true),
MinimumEngineVersion: aws.String("String"),
ParameterName: aws.String("String"),
ParameterValue: aws.String("String"),
Source: aws.String("String"),
},
// More values...
},
ResetAllParameters: aws.Boolean(true),
}
resp, err := svc.ResetDBParameterGroup(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))
}
开发者ID:datacratic,项目名称:aws-sdk-go,代码行数:35,代码来源:examples_test.go
示例15: ExampleS3_RestoreObject
func ExampleS3_RestoreObject() {
svc := s3.New(nil)
params := &s3.RestoreObjectInput{
Bucket: aws.String("BucketName"), // Required
Key: aws.String("ObjectKey"), // Required
RequestPayer: aws.String("RequestPayer"),
RestoreRequest: &s3.RestoreRequest{
Days: aws.Long(1), // Required
},
VersionID: aws.String("ObjectVersionId"),
}
resp, err := svc.RestoreObject(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))
}
开发者ID:datacratic,项目名称:aws-sdk-go,代码行数:25,代码来源:examples_test.go
示例16: ExampleRDS_DescribeEventSubscriptions
func ExampleRDS_DescribeEventSubscriptions() {
svc := rds.New(nil)
params := &rds.DescribeEventSubscriptionsInput{
Filters: []*rds.Filter{
&rds.Filter{ // Required
Name: aws.String("String"), // Required
Values: []*string{ // Required
aws.String("String"), // Required
// More values...
},
},
// More values...
},
Marker: aws.String("String"),
MaxRecords: aws.Long(1),
SubscriptionName: aws.String("String"),
}
resp, err := svc.DescribeEventSubscriptions(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))
}
开发者ID:datacratic,项目名称:aws-sdk-go,代码行数:31,代码来源:examples_test.go
示例17: ExampleS3_UploadPart
func ExampleS3_UploadPart() {
svc := s3.New(nil)
params := &s3.UploadPartInput{
Bucket: aws.String("BucketName"), // Required
Key: aws.String("ObjectKey"), // Required
PartNumber: aws.Long(1), // Required
UploadID: aws.String("MultipartUploadId"), // Required
Body: bytes.NewReader([]byte("PAYLOAD")),
ContentLength: aws.Long(1),
RequestPayer: aws.String("RequestPayer"),
SSECustomerAlgorithm: aws.String("SSECustomerAlgorithm"),
SSECustomerKey: aws.String("SSECustomerKey"),
SSECustomerKeyMD5: aws.String("SSECustomerKeyMD5"),
}
resp, err := svc.UploadPart(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))
}
开发者ID:datacratic,项目名称:aws-sdk-go,代码行数:28,代码来源:examples_test.go
示例18: TestCreateDistribution
func TestCreateDistribution(t *testing.T) {
client := cloudfront.New(nil)
_, serr := client.CreateDistribution(&cloudfront.CreateDistributionInput{
DistributionConfig: &cloudfront.DistributionConfig{
CallerReference: aws.String("ID1"),
Enabled: aws.Boolean(true),
Comment: aws.String("A comment"),
Origins: &cloudfront.Origins{Quantity: aws.Long(0)},
DefaultCacheBehavior: &cloudfront.DefaultCacheBehavior{
ForwardedValues: &cloudfront.ForwardedValues{
Cookies: &cloudfront.CookiePreference{Forward: aws.String("cookie")},
QueryString: aws.Boolean(true),
},
TargetOriginID: aws.String("origin"),
TrustedSigners: &cloudfront.TrustedSigners{
Enabled: aws.Boolean(true),
Quantity: aws.Long(0),
},
ViewerProtocolPolicy: aws.String("policy"),
MinTTL: aws.Long(0),
},
},
})
err := aws.Error(serr)
assert.NotNil(t, err)
assert.Equal(t, "MalformedXML", err.Code)
assertMatches(t, "validation errors detected", err.Message)
}
开发者ID:datacratic,项目名称:aws-sdk-go,代码行数:29,代码来源:integration_test.go
示例19: ExampleS3_DeleteObjects
func ExampleS3_DeleteObjects() {
svc := s3.New(nil)
params := &s3.DeleteObjectsInput{
Bucket: aws.String("BucketName"), // Required
Delete: &s3.Delete{ // Required
Objects: []*s3.ObjectIdentifier{ // Required
&s3.ObjectIdentifier{ // Required
Key: aws.String("ObjectKey"), // Required
VersionID: aws.String("ObjectVersionId"),
},
// More values...
},
Quiet: aws.Boolean(true),
},
MFA: aws.String("MFA"),
RequestPayer: aws.String("RequestPayer"),
}
resp, err := svc.DeleteObjects(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))
}
开发者ID:datacratic,项目名称:aws-sdk-go,代码行数:31,代码来源:examples_test.go
示例20: ExampleCloudTrail_LookupEvents
func ExampleCloudTrail_LookupEvents() {
svc := cloudtrail.New(nil)
params := &cloudtrail.LookupEventsInput{
EndTime: aws.Time(time.Now()),
LookupAttributes: []*cloudtrail.LookupAttribute{
&cloudtrail.LookupAttribute{ // Required
AttributeKey: aws.String("LookupAttributeKey"), // Required
AttributeValue: aws.String("String"), // Required
},
// More values...
},
MaxResults: aws.Long(1),
NextToken: aws.String("NextToken"),
StartTime: aws.Time(time.Now()),
}
resp, err := svc.LookupEvents(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))
}
开发者ID:datacratic,项目名称:aws-sdk-go,代码行数:29,代码来源:examples_test.go
注:本文中的github.com/datacratic/aws-sdk-go/aws.Error函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论