本文整理汇总了Golang中github.com/aws/aws-sdk-go/aws/awsutil.Prettify函数的典型用法代码示例。如果您正苦于以下问题:Golang Prettify函数的具体用法?Golang Prettify怎么用?Golang Prettify使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Prettify函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: Destroy
// Destroy remove the storage backend bucket
func (s *S3) Destroy() error {
log.Printf("[DEBUG] Amazon S3 Delete bucket objects")
objects, err := s.List()
if err != nil {
return err
}
for _, key := range objects {
resp, err := s.Client.DeleteObject(&s3.DeleteObjectInput{
Bucket: &s.Bucket,
Key: aws.String(key),
})
if err != nil {
return err
}
log.Printf("[DEBUG] %s", awsutil.Prettify(resp))
}
log.Printf("[DEBUG] Delete bucket")
resp, err := s.Client.DeleteBucket(&s3.DeleteBucketInput{
Bucket: &s.Bucket,
})
if err != nil {
return err
}
log.Printf("[DEBUG] Amazon S3 %s", awsutil.Prettify(resp))
return nil
}
开发者ID:nlamirault,项目名称:enigma,代码行数:27,代码来源:s3.go
示例2: TestToVolumesFrom
func TestToVolumesFrom(t *testing.T) {
input := []string{
"container1",
"container2:ro",
}
actual, err := toVolumesFroms(input)
if err != nil {
t.Error(err)
}
if len(input) != len(actual) {
t.Errorf("expect length = %d, but actual length = %d", len(input), len(actual))
}
if *actual[0].SourceContainer != "container1" ||
*actual[0].ReadOnly != false {
t.Errorf("Unexpected value. Actual = %s", awsutil.Prettify(actual[0]))
}
if *actual[1].SourceContainer != "container2" ||
*actual[1].ReadOnly != true {
t.Errorf("Unexpected value. Actual = %s", awsutil.Prettify(actual[0]))
}
}
开发者ID:TanUkkii007,项目名称:ecs-formation,代码行数:27,代码来源:converter_test.go
示例3: listArtifacts
func listArtifacts(svc *devicefarm.DeviceFarm, filterArn string, artifactType string) {
fmt.Println(filterArn)
listReq := &devicefarm.ListArtifactsInput{
Arn: aws.String(filterArn),
}
listReq.Type = aws.String("LOG")
resp, err := svc.ListArtifacts(listReq)
failOnErr(err, "error listing artifacts")
fmt.Println(awsutil.Prettify(resp))
listReq.Type = aws.String("SCREENSHOT")
resp, err = svc.ListArtifacts(listReq)
failOnErr(err, "error listing artifacts")
fmt.Println(awsutil.Prettify(resp))
listReq.Type = aws.String("FILE")
resp, err = svc.ListArtifacts(listReq)
failOnErr(err, "error listing artifacts")
fmt.Println(awsutil.Prettify(resp))
}
开发者ID:ainoya,项目名称:devicefarm-cli,代码行数:25,代码来源:devicefarm-cli.go
示例4: compareObjects
func compareObjects(t *testing.T, expected interface{}, actual interface{}) {
if !reflect.DeepEqual(expected, actual) {
t.Errorf("\nExpected %s:\n%s\nActual %s:\n%s\n",
reflect.ValueOf(expected).Kind(),
awsutil.Prettify(expected),
reflect.ValueOf(actual).Kind(),
awsutil.Prettify(actual))
}
}
开发者ID:CyCoreSystems,项目名称:coreos-kubernetes,代码行数:9,代码来源:converter_test.go
示例5: main
func main() {
interval, _ := strconv.ParseInt(os.Getenv("LABELGUN_INTERVAL"), 10, 64)
kube_master = os.Getenv("KUBE_MASTER")
for {
// Get Kube Node name
n, _ := sh.Command("kubectl", "-s", kube_master, "describe", "pod", os.Getenv("HOSTNAME")).Command("grep", "Node").Command("awk", "{print $2}").Command("sed", "[email protected]/.*@@").Output()
node = string(n)
node = strings.TrimSpace(node)
fmt.Println(node)
// Get instance id
instance_id, _ := sh.Command("curl", "-s", "http://169.254.169.254/latest/meta-data/instance-id").Output()
fmt.Println(string(instance_id))
// Get AWS instance metadata
params := &ec2.DescribeInstancesInput{
InstanceIds: []*string{
aws.String(string(instance_id)),
},
}
resp, err := svc.DescribeInstances(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.Reservations[0].Instances[0].InstanceType)
meta = resp.Reservations[0].Instances[0]
// Apply Availability Zone
availabilityZone, _ := strconv.Unquote(string(awsutil.Prettify(meta.Placement.AvailabilityZone)))
label("AvailabilityZone=" + availabilityZone)
// Apply Instance Type
instanceType, _ := strconv.Unquote(string(awsutil.Prettify(meta.InstanceType)))
label("InstanceType=" + instanceType)
// Apply EC2 Tags
tags := meta.Tags
for _, tag := range tags {
label(*tag.Key + "=" + *tag.Value)
}
// Sleep until interval
fmt.Println("Sleeping for " + os.Getenv("LABELGUN_INTERVAL") + " seconds")
time.Sleep(time.Duration(interval) * time.Second)
}
}
开发者ID:Vungle,项目名称:labelgun,代码行数:52,代码来源:labelgun.go
示例6: compareObjects
func compareObjects(t *testing.T, expected interface{}, actual interface{}) {
if !reflect.DeepEqual(expected, actual) {
ev := reflect.ValueOf(expected)
av := reflect.ValueOf(actual)
t.Errorf("\nExpected kind(%s,%T):\n%s\nActual kind(%s,%T):\n%s\n",
ev.Kind(),
ev.Interface(),
awsutil.Prettify(expected),
av.Kind(),
ev.Interface(),
awsutil.Prettify(actual))
}
}
开发者ID:ColourboxDevelopment,项目名称:aws-sdk-go,代码行数:13,代码来源:marshaler_test.go
示例7: deleteAwsRoute
func deleteAwsRoute(conn *ec2.EC2, routeTableId string, cidr string) error {
deleteOpts := &ec2.DeleteRouteInput{
RouteTableId: aws.String(routeTableId),
DestinationCidrBlock: aws.String(cidr),
}
log.Printf("[DEBUG] Route delete opts: %s", awsutil.Prettify(deleteOpts))
resp, err := conn.DeleteRoute(deleteOpts)
log.Printf("[DEBUG] Route delete result: %s", awsutil.Prettify(resp))
if err != nil {
return err
}
return nil
}
开发者ID:MDL,项目名称:terraform,代码行数:14,代码来源:resource_aws_route.go
示例8: ExampleLambda_UpdateFunctionConfiguration
func ExampleLambda_UpdateFunctionConfiguration() {
svc := lambda.New(nil)
params := &lambda.UpdateFunctionConfigurationInput{
FunctionName: aws.String("FunctionName"), // Required
Description: aws.String("Description"),
Handler: aws.String("Handler"),
MemorySize: aws.Int64(1),
Role: aws.String("RoleArn"),
Timeout: aws.Int64(1),
}
resp, err := svc.UpdateFunctionConfiguration(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))
}
开发者ID:Talos208,项目名称:aws-sdk-go,代码行数:31,代码来源:examples_test.go
示例9: ExampleLambda_RemovePermission
func ExampleLambda_RemovePermission() {
svc := lambda.New(nil)
params := &lambda.RemovePermissionInput{
FunctionName: aws.String("FunctionName"), // Required
StatementID: aws.String("StatementId"), // Required
}
resp, err := svc.RemovePermission(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))
}
开发者ID:Talos208,项目名称:aws-sdk-go,代码行数:27,代码来源:examples_test.go
示例10: ExampleLambda_Invoke
func ExampleLambda_Invoke() {
svc := lambda.New(nil)
params := &lambda.InvokeInput{
FunctionName: aws.String("FunctionName"), // Required
ClientContext: aws.String("String"),
InvocationType: aws.String("InvocationType"),
LogType: aws.String("LogType"),
Payload: []byte("PAYLOAD"),
}
resp, err := svc.Invoke(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))
}
开发者ID:Talos208,项目名称:aws-sdk-go,代码行数:30,代码来源:examples_test.go
示例11: ExampleGlacier_SetVaultNotifications
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))
}
开发者ID:strife25,项目名称:aws-sdk-go,代码行数:34,代码来源:examples_test.go
示例12: ExampleGlacier_ListVaults
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))
}
开发者ID:strife25,项目名称:aws-sdk-go,代码行数:28,代码来源:examples_test.go
示例13: ExampleElasticBeanstalk_TerminateEnvironment
func ExampleElasticBeanstalk_TerminateEnvironment() {
svc := elasticbeanstalk.New(nil)
params := &elasticbeanstalk.TerminateEnvironmentInput{
EnvironmentId: aws.String("EnvironmentId"),
EnvironmentName: aws.String("EnvironmentName"),
TerminateResources: aws.Bool(true),
}
resp, err := svc.TerminateEnvironment(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))
}
开发者ID:strife25,项目名称:aws-sdk-go,代码行数:28,代码来源:examples_test.go
示例14: ExampleStorageGateway_CreateStorediSCSIVolume
func ExampleStorageGateway_CreateStorediSCSIVolume() {
svc := storagegateway.New(nil)
params := &storagegateway.CreateStorediSCSIVolumeInput{
DiskId: aws.String("DiskId"), // Required
GatewayARN: aws.String("GatewayARN"), // Required
NetworkInterfaceId: aws.String("NetworkInterfaceId"), // Required
PreserveExistingData: aws.Bool(true), // Required
TargetName: aws.String("TargetName"), // Required
SnapshotId: aws.String("SnapshotId"),
}
resp, err := svc.CreateStorediSCSIVolume(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))
}
开发者ID:strife25,项目名称:aws-sdk-go,代码行数:31,代码来源:examples_test.go
示例15: ExampleStorageGateway_ActivateGateway
func ExampleStorageGateway_ActivateGateway() {
svc := storagegateway.New(nil)
params := &storagegateway.ActivateGatewayInput{
ActivationKey: aws.String("ActivationKey"), // Required
GatewayName: aws.String("GatewayName"), // Required
GatewayRegion: aws.String("RegionId"), // Required
GatewayTimezone: aws.String("GatewayTimezone"), // Required
GatewayType: aws.String("GatewayType"),
MediumChangerType: aws.String("MediumChangerType"),
TapeDriveType: aws.String("TapeDriveType"),
}
resp, err := svc.ActivateGateway(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))
}
开发者ID:strife25,项目名称:aws-sdk-go,代码行数:32,代码来源:examples_test.go
示例16: ExampleElasticBeanstalk_CheckDNSAvailability
func ExampleElasticBeanstalk_CheckDNSAvailability() {
svc := elasticbeanstalk.New(nil)
params := &elasticbeanstalk.CheckDNSAvailabilityInput{
CNAMEPrefix: aws.String("DNSCnamePrefix"), // Required
}
resp, err := svc.CheckDNSAvailability(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))
}
开发者ID:strife25,项目名称:aws-sdk-go,代码行数:26,代码来源:examples_test.go
示例17: ExampleElasticBeanstalk_DescribeInstancesHealth
func ExampleElasticBeanstalk_DescribeInstancesHealth() {
svc := elasticbeanstalk.New(nil)
params := &elasticbeanstalk.DescribeInstancesHealthInput{
AttributeNames: []*string{
aws.String("InstancesHealthAttribute"), // Required
// More values...
},
EnvironmentId: aws.String("EnvironmentId"),
EnvironmentName: aws.String("EnvironmentName"),
NextToken: aws.String("NextToken"),
}
resp, err := svc.DescribeInstancesHealth(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))
}
开发者ID:strife25,项目名称:aws-sdk-go,代码行数:32,代码来源:examples_test.go
示例18: ExampleStorageGateway_CreateTapes
func ExampleStorageGateway_CreateTapes() {
svc := storagegateway.New(nil)
params := &storagegateway.CreateTapesInput{
ClientToken: aws.String("ClientToken"), // Required
GatewayARN: aws.String("GatewayARN"), // Required
NumTapesToCreate: aws.Int64(1), // Required
TapeBarcodePrefix: aws.String("TapeBarcodePrefix"), // Required
TapeSizeInBytes: aws.Int64(1), // Required
}
resp, err := svc.CreateTapes(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))
}
开发者ID:strife25,项目名称:aws-sdk-go,代码行数:30,代码来源:examples_test.go
示例19: ExampleElasticBeanstalk_UpdateApplicationVersion
func ExampleElasticBeanstalk_UpdateApplicationVersion() {
svc := elasticbeanstalk.New(nil)
params := &elasticbeanstalk.UpdateApplicationVersionInput{
ApplicationName: aws.String("ApplicationName"), // Required
VersionLabel: aws.String("VersionLabel"), // Required
Description: aws.String("Description"),
}
resp, err := svc.UpdateApplicationVersion(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))
}
开发者ID:strife25,项目名称:aws-sdk-go,代码行数:28,代码来源:examples_test.go
示例20: ExampleStorageGateway_DescribeSnapshotSchedule
func ExampleStorageGateway_DescribeSnapshotSchedule() {
svc := storagegateway.New(nil)
params := &storagegateway.DescribeSnapshotScheduleInput{
VolumeARN: aws.String("VolumeARN"), // Required
}
resp, err := svc.DescribeSnapshotSchedule(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))
}
开发者ID:strife25,项目名称:aws-sdk-go,代码行数:26,代码来源:examples_test.go
注:本文中的github.com/aws/aws-sdk-go/aws/awsutil.Prettify函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论