Python boto 模块,rds2() 实例源码

我们从Python开源项目中,提取了以下9个代码示例,用于说明如何使用boto.rds2()

项目:DevOps    作者:YoLoveLife    | 项目源码 | 文件源码
def await_resource(conn, resource, status, module):
    wait_timeout = module.params.get('wait_timeout') + time.time()
    while wait_timeout > time.time() and resource.status != status:
        time.sleep(5)
        if wait_timeout <= time.time():
            module.fail_json(msg="Timeout waiting for RDS resource %s" % resource.name)
        if module.params.get('command') == 'snapshot':
            # Temporary until all the rds2 commands have their responses parsed
            if resource.name is None:
                module.fail_json(msg="There was a problem waiting for RDS snapshot %s" % resource.snapshot)
            resource = conn.get_db_snapshot(resource.name)
        else:
            # Temporary until all the rds2 commands have their responses parsed
            if resource.name is None:
                module.fail_json(msg="There was a problem waiting for RDS instance %s" % resource.instance)
            resource = conn.get_db_instance(resource.name)
            if resource is None:
                break
    return resource
项目:ansible_mysql_rds_playbook    作者:codingenesis    | 项目源码 | 文件源码
def await_resource(conn, resource, status, module):
    wait_timeout = module.params.get('wait_timeout') + time.time()
    while wait_timeout > time.time() and resource.status != status:
        time.sleep(5)
        if wait_timeout <= time.time():
            module.fail_json(msg="Timeout waiting for RDS resource %s" % resource.name)
        if module.params.get('command') == 'snapshot':
            # Temporary until all the rds2 commands have their responses parsed
            if resource.name is None:
                module.fail_json(msg="There was a problem waiting for RDS snapshot %s" % resource.snapshot)
            resource = conn.get_db_snapshot(resource.name)
        else:
            # Temporary until all the rds2 commands have their responses parsed
            if resource.name is None:
                module.fail_json(msg="There was a problem waiting for RDS instance %s" % resource.instance)
            resource = conn.get_db_instance(resource.name)
            if resource is None:
                break
    return resource
项目:DevOps    作者:YoLoveLife    | 项目源码 | 文件源码
def __init__(self, module, region, **aws_connect_params):
        try:
            self.connection  = connect_to_aws(boto.rds2, region, **aws_connect_params)
        except boto.exception.BotoServerError as e:
             module.fail_json(msg=e.error_message)
项目:DevOps    作者:YoLoveLife    | 项目源码 | 文件源码
def get_db_instance(self, instancename):
        try:
            dbinstances = self.connection.describe_db_instances(db_instance_identifier=instancename)['DescribeDBInstancesResponse']['DescribeDBInstancesResult']['DBInstances']
            result =  RDS2DBInstance(dbinstances[0])
            return result
        except boto.rds2.exceptions.DBInstanceNotFound as e:
            return None
        except Exception as e:
            raise e
项目:DevOps    作者:YoLoveLife    | 项目源码 | 文件源码
def get_db_snapshot(self, snapshotid):
        try:
            snapshots = self.connection.describe_db_snapshots(db_snapshot_identifier=snapshotid, snapshot_type='manual')['DescribeDBSnapshotsResponse']['DescribeDBSnapshotsResult']['DBSnapshots']
            result = RDS2Snapshot(snapshots[0])
            return result
        except boto.rds2.exceptions.DBSnapshotNotFound as e:
            return None
项目:ansible_mysql_rds_playbook    作者:codingenesis    | 项目源码 | 文件源码
def __init__(self, module, region, **aws_connect_params):
        try:
            self.connection  = connect_to_aws(boto.rds2, region, **aws_connect_params)
        except boto.exception.BotoServerError, e:
             module.fail_json(msg=e.error_message)
项目:ansible_mysql_rds_playbook    作者:codingenesis    | 项目源码 | 文件源码
def get_db_instance(self, instancename):
        try:
            dbinstances = self.connection.describe_db_instances(db_instance_identifier=instancename)['DescribeDBInstancesResponse']['DescribeDBInstancesResult']['DBInstances']
            result =  RDS2DBInstance(dbinstances[0])
            return result
        except boto.rds2.exceptions.DBInstanceNotFound, e:
            return None
        except Exception, e:
            raise e
项目:ansible_mysql_rds_playbook    作者:codingenesis    | 项目源码 | 文件源码
def get_db_snapshot(self, snapshotid):
        try:
            snapshots = self.connection.describe_db_snapshots(db_snapshot_identifier=snapshotid, snapshot_type='manual')['DescribeDBSnapshotsResponse']['DescribeDBSnapshotsResult']['DBSnapshots']
            result = RDS2Snapshot(snapshots[0])
            return result
        except boto.rds2.exceptions.DBSnapshotNotFound, e:
            return None
项目:edx-configuration    作者:kola-er    | 项目源码 | 文件源码
def rds_subnet_group_name_for_stack_name(stack_name, region='us-east-1', aws_id=None, aws_secret=None):
    # Helper function to look up a subnet group name by stack name
    rds = boto.rds2.connect_to_region(region)
    vpc = vpc_for_stack_name(stack_name)
    for group in rds.describe_db_subnet_groups()['DescribeDBSubnetGroupsResponse']['DescribeDBSubnetGroupsResult']['DBSubnetGroups']:
        if group['VpcId'] == vpc:
            return group['DBSubnetGroupName']
    return None