本文整理汇总了Golang中github.com/tetrafolium/aws-sdk-go/service/elasticache.New函数的典型用法代码示例。如果您正苦于以下问题:Golang New函数的具体用法?Golang New怎么用?Golang New使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了New函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: ExampleElastiCache_ListTagsForResource
func ExampleElastiCache_ListTagsForResource() {
svc := elasticache.New(nil)
params := &elasticache.ListTagsForResourceInput{
ResourceName: aws.String("String"), // Required
}
resp, err := svc.ListTagsForResource(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))
}
示例2: ExampleElastiCache_ModifyCacheParameterGroup
func ExampleElastiCache_ModifyCacheParameterGroup() {
svc := elasticache.New(nil)
params := &elasticache.ModifyCacheParameterGroupInput{
CacheParameterGroupName: aws.String("String"), // Required
ParameterNameValues: []*elasticache.ParameterNameValue{ // Required
{ // Required
ParameterName: aws.String("String"),
ParameterValue: aws.String("String"),
},
// More values...
},
}
resp, err := svc.ModifyCacheParameterGroup(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))
}
示例3: ExampleElastiCache_DescribeSnapshots
func ExampleElastiCache_DescribeSnapshots() {
svc := elasticache.New(nil)
params := &elasticache.DescribeSnapshotsInput{
CacheClusterId: aws.String("String"),
Marker: aws.String("String"),
MaxRecords: aws.Int64(1),
SnapshotName: aws.String("String"),
SnapshotSource: aws.String("String"),
}
resp, err := svc.DescribeSnapshots(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))
}
示例4: ExampleElastiCache_DeleteReplicationGroup
func ExampleElastiCache_DeleteReplicationGroup() {
svc := elasticache.New(nil)
params := &elasticache.DeleteReplicationGroupInput{
ReplicationGroupId: aws.String("String"), // Required
FinalSnapshotIdentifier: aws.String("String"),
RetainPrimaryCluster: aws.Bool(true),
}
resp, err := svc.DeleteReplicationGroup(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))
}
示例5: ExampleElastiCache_ModifyCacheCluster
func ExampleElastiCache_ModifyCacheCluster() {
svc := elasticache.New(nil)
params := &elasticache.ModifyCacheClusterInput{
CacheClusterId: aws.String("String"), // Required
AZMode: aws.String("AZMode"),
ApplyImmediately: aws.Bool(true),
AutoMinorVersionUpgrade: aws.Bool(true),
CacheNodeIdsToRemove: []*string{
aws.String("String"), // Required
// More values...
},
CacheParameterGroupName: aws.String("String"),
CacheSecurityGroupNames: []*string{
aws.String("String"), // Required
// More values...
},
EngineVersion: aws.String("String"),
NewAvailabilityZones: []*string{
aws.String("String"), // Required
// More values...
},
NotificationTopicArn: aws.String("String"),
NotificationTopicStatus: aws.String("String"),
NumCacheNodes: aws.Int64(1),
PreferredMaintenanceWindow: aws.String("String"),
SecurityGroupIds: []*string{
aws.String("String"), // Required
// More values...
},
SnapshotRetentionLimit: aws.Int64(1),
SnapshotWindow: aws.String("String"),
}
resp, err := svc.ModifyCacheCluster(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))
}
示例6: TestInterface
func TestInterface(t *testing.T) {
assert.Implements(t, (*elasticacheiface.ElastiCacheAPI)(nil), elasticache.New(nil))
}
示例7: ExampleElastiCache_CreateReplicationGroup
func ExampleElastiCache_CreateReplicationGroup() {
svc := elasticache.New(nil)
params := &elasticache.CreateReplicationGroupInput{
ReplicationGroupDescription: aws.String("String"), // Required
ReplicationGroupId: aws.String("String"), // Required
AutoMinorVersionUpgrade: aws.Bool(true),
AutomaticFailoverEnabled: aws.Bool(true),
CacheNodeType: aws.String("String"),
CacheParameterGroupName: aws.String("String"),
CacheSecurityGroupNames: []*string{
aws.String("String"), // Required
// More values...
},
CacheSubnetGroupName: aws.String("String"),
Engine: aws.String("String"),
EngineVersion: aws.String("String"),
NotificationTopicArn: aws.String("String"),
NumCacheClusters: aws.Int64(1),
Port: aws.Int64(1),
PreferredCacheClusterAZs: []*string{
aws.String("String"), // Required
// More values...
},
PreferredMaintenanceWindow: aws.String("String"),
PrimaryClusterId: aws.String("String"),
SecurityGroupIds: []*string{
aws.String("String"), // Required
// More values...
},
SnapshotArns: []*string{
aws.String("String"), // Required
// More values...
},
SnapshotName: aws.String("String"),
SnapshotRetentionLimit: aws.Int64(1),
SnapshotWindow: aws.String("String"),
Tags: []*elasticache.Tag{
{ // Required
Key: aws.String("String"),
Value: aws.String("String"),
},
// More values...
},
}
resp, err := svc.CreateReplicationGroup(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))
}
示例8: init
func init() {
Before("@elasticache", func() {
World["client"] = elasticache.New(nil)
})
}