本文整理汇总了Golang中github.com/aws/aws-sdk-go/service/rds.RDS类的典型用法代码示例。如果您正苦于以下问题:Golang RDS类的具体用法?Golang RDS怎么用?Golang RDS使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RDS类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: resourceAwsDbSecurityGroupRevokeRule
// Revokes the ingress rule on the db security group
func resourceAwsDbSecurityGroupRevokeRule(ingress interface{}, dbSecurityGroupName string, conn *rds.RDS) error {
ing := ingress.(map[string]interface{})
opts := rds.RevokeDBSecurityGroupIngressInput{
DBSecurityGroupName: aws.String(dbSecurityGroupName),
}
if attr, ok := ing["cidr"]; ok && attr != "" {
opts.CIDRIP = aws.String(attr.(string))
}
if attr, ok := ing["security_group_name"]; ok && attr != "" {
opts.EC2SecurityGroupName = aws.String(attr.(string))
}
if attr, ok := ing["security_group_id"]; ok && attr != "" {
opts.EC2SecurityGroupId = aws.String(attr.(string))
}
if attr, ok := ing["security_group_owner_id"]; ok && attr != "" {
opts.EC2SecurityGroupOwnerId = aws.String(attr.(string))
}
log.Printf("[DEBUG] Revoking ingress rule configuration: %#v", opts)
_, err := conn.RevokeDBSecurityGroupIngress(&opts)
if err != nil {
return fmt.Errorf("Error revoking security group ingress: %s", err)
}
return nil
}
开发者ID:paultyng,项目名称:terraform,代码行数:34,代码来源:resource_aws_db_security_group.go
示例2: tailLogFile
func tailLogFile(r *rds.RDS, db, name string, numLines int64, marker string) (string, string, error) {
req := &rds.DownloadDBLogFilePortionInput{
DBInstanceIdentifier: aws.String(db),
LogFileName: aws.String(name),
}
if numLines != 0 {
req.NumberOfLines = aws.Int64(numLines)
}
if marker != "" {
req.Marker = aws.String(marker)
}
var buf bytes.Buffer
var markerPtr *string
err := r.DownloadDBLogFilePortionPages(req, func(p *rds.DownloadDBLogFilePortionOutput, lastPage bool) bool {
if p.LogFileData != nil {
buf.WriteString(*p.LogFileData)
}
if lastPage {
markerPtr = p.Marker
}
return true
})
marker = ""
if markerPtr != nil {
marker = *markerPtr
}
return buf.String(), marker, err
}
开发者ID:snormore,项目名称:rdstail,代码行数:31,代码来源:rdstail.go
示例3: getRDSInstanceById
func getRDSInstanceById(rdsc *rds.RDS, rdsid *string) (*rds.DBInstance, error) {
ddbii := &rds.DescribeDBInstancesInput{DBInstanceIdentifier: rdsid}
ddbo, err := rdsc.DescribeDBInstances(ddbii)
if err != nil {
return nil, err
}
return ddbo.DBInstances[0], nil
}
开发者ID:jamesunger,项目名称:saws,代码行数:10,代码来源:saws.go
示例4: describeLogFiles
func describeLogFiles(r *rds.RDS, db string, since int64) (details []*rds.DescribeDBLogFilesDetails, err error) {
req := &rds.DescribeDBLogFilesInput{
DBInstanceIdentifier: aws.String(db),
}
if since != 0 {
req.FileLastWritten = aws.Int64(since)
}
err = r.DescribeDBLogFilesPages(req, func(p *rds.DescribeDBLogFilesOutput, lastPage bool) bool {
details = append(details, p.DescribeDBLogFiles...)
return true
})
return
}
开发者ID:snormore,项目名称:rdstail,代码行数:15,代码来源:rdstail.go
示例5: saveTagsRDS
func saveTagsRDS(conn *rds.RDS, d *schema.ResourceData, arn string) error {
resp, err := conn.ListTagsForResource(&rds.ListTagsForResourceInput{
ResourceName: aws.String(arn),
})
if err != nil {
return fmt.Errorf("[DEBUG] Error retreiving tags for ARN: %s", arn)
}
var dt []*rds.Tag
if len(resp.TagList) > 0 {
dt = resp.TagList
}
return d.Set("tags", tagsToMapRDS(dt))
}
开发者ID:devendraPSL,项目名称:terraform-api,代码行数:16,代码来源:tagsRDS.go
示例6: AddTagsToResource
func AddTagsToResource(resourceARN string, tags []*rds.Tag, rdssvc *rds.RDS, logger lager.Logger) error {
addTagsToResourceInput := &rds.AddTagsToResourceInput{
ResourceName: aws.String(resourceARN),
Tags: tags,
}
logger.Debug("add-tags-to-resource", lager.Data{"input": addTagsToResourceInput})
addTagsToResourceOutput, err := rdssvc.AddTagsToResource(addTagsToResourceInput)
if err != nil {
logger.Error("aws-rds-error", err)
if awsErr, ok := err.(awserr.Error); ok {
return errors.New(awsErr.Code() + ": " + awsErr.Message())
}
return err
}
logger.Debug("add-tags-to-resource", lager.Data{"output": addTagsToResourceOutput})
return nil
}
开发者ID:x6j8x,项目名称:rds-broker,代码行数:21,代码来源:utils.go
示例7: resourceAwsDbEventSubscriptionRetrieve
func resourceAwsDbEventSubscriptionRetrieve(
name string, rdsconn *rds.RDS) (*rds.EventSubscription, error) {
request := &rds.DescribeEventSubscriptionsInput{
SubscriptionName: aws.String(name),
}
describeResp, err := rdsconn.DescribeEventSubscriptions(request)
if err != nil {
if rdserr, ok := err.(awserr.Error); ok && rdserr.Code() == "SubscriptionNotFound" {
log.Printf("[WARN] No RDS Event Subscription by name (%s) found", name)
return nil, nil
}
return nil, fmt.Errorf("Error reading RDS Event Subscription %s: %s", name, err)
}
if len(describeResp.EventSubscriptionsList) != 1 {
return nil, fmt.Errorf("Unable to find RDS Event Subscription: %#v", describeResp.EventSubscriptionsList)
}
return describeResp.EventSubscriptionsList[0], nil
}
开发者ID:paultyng,项目名称:terraform,代码行数:22,代码来源:resource_aws_db_event_subscription.go
示例8: setTagsRDS
// setTags is a helper to set the tags for a resource. It expects the
// tags field to be named "tags"
func setTagsRDS(conn *rds.RDS, d *schema.ResourceData, arn string) error {
if d.HasChange("tags") {
oraw, nraw := d.GetChange("tags")
o := oraw.(map[string]interface{})
n := nraw.(map[string]interface{})
create, remove := diffTagsRDS(tagsFromMapRDS(o), tagsFromMapRDS(n))
// Set tags
if len(remove) > 0 {
log.Printf("[DEBUG] Removing tags: %s", remove)
k := make([]*string, len(remove), len(remove))
for i, t := range remove {
k[i] = t.Key
}
_, err := conn.RemoveTagsFromResource(&rds.RemoveTagsFromResourceInput{
ResourceName: aws.String(arn),
TagKeys: k,
})
if err != nil {
return err
}
}
if len(create) > 0 {
log.Printf("[DEBUG] Creating tags: %s", create)
_, err := conn.AddTagsToResource(&rds.AddTagsToResourceInput{
ResourceName: aws.String(arn),
Tags: create,
})
if err != nil {
return err
}
}
}
return nil
}
开发者ID:devendraPSL,项目名称:terraform-api,代码行数:39,代码来源:tagsRDS.go
注:本文中的github.com/aws/aws-sdk-go/service/rds.RDS类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论