• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang rds.RDS类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang redshift.New函数代码示例发布时间:2022-05-24
下一篇:
Golang rds.PromoteReadReplicaInput类代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap