本文整理汇总了Golang中github.com/aws/aws-sdk-go/service/elasticache.New函数的典型用法代码示例。如果您正苦于以下问题:Golang New函数的具体用法?Golang New怎么用?Golang New使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了New函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: ExampleElastiCache_PurchaseReservedCacheNodesOffering
func ExampleElastiCache_PurchaseReservedCacheNodesOffering() {
svc := elasticache.New(nil)
params := &elasticache.PurchaseReservedCacheNodesOfferingInput{
ReservedCacheNodesOfferingID: aws.String("String"), // Required
CacheNodeCount: aws.Long(1),
ReservedCacheNodeID: aws.String("String"),
}
resp, err := svc.PurchaseReservedCacheNodesOffering(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.StringValue(resp))
}
示例2: ExampleElastiCache_AuthorizeCacheSecurityGroupIngress
func ExampleElastiCache_AuthorizeCacheSecurityGroupIngress() {
svc := elasticache.New(nil)
params := &elasticache.AuthorizeCacheSecurityGroupIngressInput{
CacheSecurityGroupName: aws.String("String"), // Required
EC2SecurityGroupName: aws.String("String"), // Required
EC2SecurityGroupOwnerID: aws.String("String"), // Required
}
resp, err := svc.AuthorizeCacheSecurityGroupIngress(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.StringValue(resp))
}
示例3: 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))
}
示例4: ExampleElastiCache_DescribeReservedCacheNodes
func ExampleElastiCache_DescribeReservedCacheNodes() {
svc := elasticache.New(nil)
params := &elasticache.DescribeReservedCacheNodesInput{
CacheNodeType: aws.String("String"),
Duration: aws.String("String"),
Marker: aws.String("String"),
MaxRecords: aws.Int64(1),
OfferingType: aws.String("String"),
ProductDescription: aws.String("String"),
ReservedCacheNodeId: aws.String("String"),
ReservedCacheNodesOfferingId: aws.String("String"),
}
resp, err := svc.DescribeReservedCacheNodes(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)
}
示例5: 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))
}
示例6: 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))
}
示例7: ExampleElastiCache_DescribeEvents
func ExampleElastiCache_DescribeEvents() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := elasticache.New(sess)
params := &elasticache.DescribeEventsInput{
Duration: aws.Int64(1),
EndTime: aws.Time(time.Now()),
Marker: aws.String("String"),
MaxRecords: aws.Int64(1),
SourceIdentifier: aws.String("String"),
SourceType: aws.String("SourceType"),
StartTime: aws.Time(time.Now()),
}
resp, err := svc.DescribeEvents(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)
}
示例8: ExampleElastiCache_DescribeCacheEngineVersions
func ExampleElastiCache_DescribeCacheEngineVersions() {
svc := elasticache.New(nil)
params := &elasticache.DescribeCacheEngineVersionsInput{
CacheParameterGroupFamily: aws.String("String"),
DefaultOnly: aws.Boolean(true),
Engine: aws.String("String"),
EngineVersion: aws.String("String"),
Marker: aws.String("String"),
MaxRecords: aws.Long(1),
}
resp, err := svc.DescribeCacheEngineVersions(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.StringValue(resp))
}
示例9: ExampleElastiCache_AuthorizeCacheSecurityGroupIngress
func ExampleElastiCache_AuthorizeCacheSecurityGroupIngress() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := elasticache.New(sess)
params := &elasticache.AuthorizeCacheSecurityGroupIngressInput{
CacheSecurityGroupName: aws.String("String"), // Required
EC2SecurityGroupName: aws.String("String"), // Required
EC2SecurityGroupOwnerId: aws.String("String"), // Required
}
resp, err := svc.AuthorizeCacheSecurityGroupIngress(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)
}
示例10: ExampleElastiCache_DescribeEngineDefaultParameters
func ExampleElastiCache_DescribeEngineDefaultParameters() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := elasticache.New(sess)
params := &elasticache.DescribeEngineDefaultParametersInput{
CacheParameterGroupFamily: aws.String("String"), // Required
Marker: aws.String("String"),
MaxRecords: aws.Int64(1),
}
resp, err := svc.DescribeEngineDefaultParameters(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)
}
示例11: ExampleElastiCache_DeleteReplicationGroup
func ExampleElastiCache_DeleteReplicationGroup() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := elasticache.New(sess)
params := &elasticache.DeleteReplicationGroupInput{
ReplicationGroupId: aws.String("String"), // Required
FinalSnapshotIdentifier: aws.String("String"),
RetainPrimaryCluster: aws.Bool(true),
}
resp, err := svc.DeleteReplicationGroup(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)
}
示例12: ExampleElastiCache_CreateCacheParameterGroup
func ExampleElastiCache_CreateCacheParameterGroup() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := elasticache.New(sess)
params := &elasticache.CreateCacheParameterGroupInput{
CacheParameterGroupFamily: aws.String("String"), // Required
CacheParameterGroupName: aws.String("String"), // Required
Description: aws.String("String"), // Required
}
resp, err := svc.CreateCacheParameterGroup(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)
}
示例13: ExampleElastiCache_RemoveTagsFromResource
func ExampleElastiCache_RemoveTagsFromResource() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := elasticache.New(sess)
params := &elasticache.RemoveTagsFromResourceInput{
ResourceName: aws.String("String"), // Required
TagKeys: []*string{ // Required
aws.String("String"), // Required
// More values...
},
}
resp, err := svc.RemoveTagsFromResource(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)
}
示例14: ExampleElastiCache_RebootCacheCluster
func ExampleElastiCache_RebootCacheCluster() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := elasticache.New(sess)
params := &elasticache.RebootCacheClusterInput{
CacheClusterId: aws.String("String"), // Required
CacheNodeIdsToReboot: []*string{ // Required
aws.String("String"), // Required
// More values...
},
}
resp, err := svc.RebootCacheCluster(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)
}
示例15: ExampleElastiCache_CopySnapshot
func ExampleElastiCache_CopySnapshot() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := elasticache.New(sess)
params := &elasticache.CopySnapshotInput{
SourceSnapshotName: aws.String("String"), // Required
TargetSnapshotName: aws.String("String"), // Required
TargetBucket: aws.String("String"),
}
resp, err := svc.CopySnapshot(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)
}