src/lsi/utils/hosts.py
def from_boto_instance(cls, instance):
        """
        Loads a ``HostEntry`` from a boto instance.

        :param instance: A boto instance object.
        :type instance: :py:class:`boto.ec2.instanceInstance`

        :rtype: :py:class:`HostEntry`
        """
        return cls(
            name=instance.tags.get('Name'),
            private_ip=instance.private_ip_address,
            public_ip=instance.ip_address,
            instance_type=instance.instance_type,
            instance_id=instance.id,
            hostname=instance.dns_name,
            stack_id=instance.tags.get('aws:cloudformation:stack-id'),
            stack_name=instance.tags.get('aws:cloudformation:stack-name'),
            logical_id=instance.tags.get('aws:cloudformation:logical-id'),
            security_groups=[g.name for g in instance.groups],
            launch_time=instance.launch_time,
            ami_id=instance.image_id,
            tags={k.lower(): v for k, v in six.iteritems(instance.tags)}
        )
def from_boto_instance(cls, instance):
        return cls(
            name=instance.tags.get('Name'),
            private_ip=instance.private_ip_address,
            public_ip=instance.ip_address,
            instance_type=instance.instance_type,
            instance_id=instance.id,
            hostname=instance.dns_name,
            stack_id=instance.tags.get('aws:cloudformation:stack-id'),
            stack_name=instance.tags.get('aws:cloudformation:stack-name'),
            logical_id=instance.tags.get('aws:cloudformation:logical-id'),
            security_groups=[g.name for g in instance.groups],
            launch_time=instance.launch_time,
            ami_id=instance.image_id,
            tags={k.lower(): v for k, v in six.iteritems(instance.tags)}
        )
def from_boto_instance ( cls , instance ) : return cls ( name = instance . tags . get ( 'Name' ) , private_ip = instance . private_ip_address , public_ip = instance . ip_address , instance_type = instance . instance_type , instance_id = instance . id , hostname = instance . dns_name , stack_id = instance . tags . get ( 'aws:cloudformation:stack-id' ) , stack_name = instance . tags . get ( 'aws:cloudformation:stack-name' ) , logical_id = instance . tags . get ( 'aws:cloudformation:logical-id' ) , security_groups = [ g . name for g in instance . groups ] , launch_time = instance . launch_time , ami_id = instance . image_id , tags = { k . lower ( ) : v for k , v in six . iteritems ( instance . tags ) } )
Loads a ``HostEntry`` from a boto instance.

        :param instance: A boto instance object.
        :type instance: :py:class:`boto.ec2.instanceInstance`

        :rtype: :py:class:`HostEntry`
Loads a HostEntry from a boto instance .