def create_rds_read_only_instance()

in footmark/rds/connection.py [0:0]


    def create_rds_read_only_instance(self, source_instance, zone, engine_version, db_instance_class,
                                      db_instance_storage, instance_description, pay_type, instance_network_type=None,
                                      vpc_id=None, vswitch_id=None, private_ip_address=None):
        """
        Create RDS Read-Only Instance

        :type source_instance: string
        :param source_instance: ID of the database to replicate.
        :type zone: string
        :param zone:  ID of a zone to which an instance belongs
        :type engine_version: string
        :param engine_version: Version number of the database engine to use
        :type db_instance_class: string
        :param db_instance_class: The instance type of the database.
        :type db_instance_storage: integer
        :param db_instance_storage: Size in gigabytes of the initial storage for the DB instance.
        :type instance_description: string
        :param instance_description: Instance description or remarks, no more than 256 bytes.
        :type pay_type: string
        :param pay_type: The pay type of the DB instance.
        :type instance_network_type: string
        :param instance_network_type: The network type of the instance.
        :type vpc_id: string
        :param vpc_id: The ID of the VPC
        :type vswitch_id: string
        :param vswitch_id: ID of VSwitch
        :type private_ip_address: string
        :param private_ip_address: IP address of an VPC under VSwitchId.
        :return:
            changed: If ready-only instance is created successfully the changed will be set to True else False
            result: detailed server response
        """
        params = {}
        results = []
        changed = False

        if zone:
            self.build_list_params(params, zone, 'ZoneId')
        if source_instance:
            self.build_list_params(params, source_instance, 'DBInstanceId')
        if engine_version:
            self.build_list_params(params, engine_version, 'EngineVersion')
        if db_instance_class:
            self.build_list_params(params, db_instance_class, 'DBInstanceClass')
        if db_instance_storage:
            self.build_list_params(params, db_instance_storage, 'DBInstanceStorage')
        if instance_description:
            self.build_list_params(params, instance_description, 'DBInstanceDescription')
        if pay_type:
            self.build_list_params(params, pay_type, 'PayType')
        if instance_network_type:
            self.build_list_params(params, instance_network_type, 'InstanceNetworkType')
        if vpc_id:
            self.build_list_params(params, vpc_id, 'VPCId')
        if vswitch_id:
            self.build_list_params(params, vswitch_id, 'VSwitchId')
        if private_ip_address:
            self.build_list_params(params, private_ip_address, 'PrivateIpAddress')
        try:
            results = self.get_status('CreateReadOnlyDBInstance', params)
            changed = True
        except Exception as ex:
            error_code = str(ex.error_code)
            error_msg = str(ex.message)
            results.append({"Error Code": error_code, "Error Message": error_msg})

        return changed, results