def endpoint_present(name,
                     publicurl=None,
                     internalurl=None,
                     adminurl=None,
                     region='RegionOne', profile=None, **connection_args):
    ret = {'name': name,
           'changes': {},
           'result': True,
           'comment': 'endpoint for service "{0}" already exists'.format(name)}
    endpoint = __salt__['keystone.endpoint_get'](name,
                                                 profile=profile,
                                                 **connection_args)
    cur_endpoint = dict(region=region,
                        publicurl=publicurl,
                        adminurl=adminurl,
                        internalurl=internalurl)
    if endpoint and 'Error' not in endpoint:
        endpoint.pop('id')
        endpoint.pop('service_id')
        if endpoint == cur_endpoint:
            return ret
        else:
            if __opts__['test']:
                ret['result'] = None
                ret['comment'] = 'Endpoint for service "{0}" will be updated'.format(name)
                ret['changes']['endpoint'] = 'Will be updated'
                return ret
            __salt__['keystone.endpoint_delete'](name,
                                                 profile=profile,
                                                 **connection_args)
            ret['comment'] = 'Endpoint for service "{0}" has been updated'.format(name)
    else:
        if __opts__['test']:
            ret['result'] = None
            ret['comment'] = 'Endpoint for service "{0}" will be added'.format(name)
            ret['changes']['endpoint'] = 'Will be created'
            return ret
        ret['comment'] = 'Endpoint for service "{0}" has been added'.format(name)

    if not __opts__['test']:
        ret['changes'] = __salt__['keystone.endpoint_create'](
            name,
            region=region,
            publicurl=publicurl,
            adminurl=adminurl,
            internalurl=internalurl,
            profile=profile,
            **connection_args)
    return ret
Ensure the specified endpoints exists for service
dataset/ETHPy150Open saltstack/salt/salt/states/keystone.py/endpoint_present