def _get_target()

in ec2instanceconnectcli/EC2InstanceConnectCommand.py [0:0]


    def _get_target(instance_bundle):
        """
        Determines the ssh target (and potentially sftp file target) for a given EC2 instance bundle dict
        :param instance_bundle: dict of information on the desired EC2 instance
        :type instance_bundle: dict
        :return: target in the form "user@host[:file]"
        :rtype: basestring
        """
        target = ''
        if instance_bundle.get('host_info', None):
            target = "{0}@{1}".format(instance_bundle['username'], instance_bundle['host_info'])
        # file will exist only for SFTP and SCP operations.
        if instance_bundle.get('file', None):
            target = "{0}:{1}".format(target, instance_bundle['file']).lstrip(':')

        return target