def modify_rds_instance_network_type()

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


    def modify_rds_instance_network_type(self, instance_id, instance_network_type, vpc_id, vswitch_id,
                                         private_ip_address=None):
        """
        Modify RDS Instance Network Type

        :type instance_id: string
        :param instance_id: Id of instances to change
        :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. Value depends on network_type.
        :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 network type of the instance modified successfully. the changed para will be set to True else
            False
            result: detailed server response
        """
        params = {}
        results = []
        changed = False  
        if instance_id:
            self.build_list_params(params, instance_id, 'DBInstanceId')
        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('ModifyDBInstanceNetworkType', params)  
            changed = True          
        except Exception as ex:
            if (ex.args is None) or (ex.args == "need more than 2 values to unpack") \
                    or (ex.message == "need more than 2 values to unpack") or ex.error_code is None:
                results.append({"Error Message": "The API is showing None error code and error"
                                                 " message while modifying instance network type "})
            else:
                error_code = ex.error_code
                error_msg = ex.message
                results.append("Failed to modify instance network type with error code " + error_code +
                               " and message: " + error_msg)

        return changed, results