Get names of HTTP methods that can be used at requested URI.

        Arguments:
            :actions_map: Map of actions. Must have the same structure as
                self._item_actions and self._collection_actions
489619
def _get_handled_methods(self, actions_map):
        
        methods = ('OPTIONS',)

        defined_actions = []
        for action_name in actions_map.keys():
            view_method = getattr(self, action_name, None)
            method_exists = view_method is not None
            method_defined = view_method != self.not_allowed_action
            if method_exists and method_defined:
                defined_actions.append(action_name)

        for action in defined_actions:
            methods += actions_map[action]

        return methods
1169951
def get_actions(self):
        """"""
        self._read_state_variables()
        actions = []
        nodes = self.root.iterfind(
            './/ns:action', namespaces={'ns': self.namespace})
        for node in nodes:
            action = FritzAction(self.service.service_type,
                                 self.service.control_url)
            action.name = node.find(self.nodename('name')).text
            action.arguments = self._get_arguments(node)
            actions.append(action)
        return actions
888051
function getActions( state, resource ) {
	var list = state.actionList[ resource.name ] = [];
	_.each( resource.actions, function( action, actionName ) {
		list.push( [ resource.name, actionName ].join( '.' ) );
	} );
}
32547
def all_possible_actions(self) -> List[str]:
        
        all_actions = set()
        for _, action_list in self.valid_actions.items():
            for action in action_list:
                all_actions.add(action)
        return sorted(all_actions)
211235
def _route(self, action, method):
        

        # First thing, determine the path for the method
        path = method._wsgi_path
        methods = None
        if path is None:
            map_rule = self.wsgi_method_map.get(method.__name__)
            if map_rule is None:
                # Can't connect this method
                LOG.warning("No path specified for action method %s() of "
                            "resource %s" % (method.__name__, self.wsgi_name))
                return

            # Compute the path and the method list
            path = utils.norm_path(map_rule[0] % self.wsgi_name)
            methods = map_rule[1]

        # Compute route name
        name = '%s_%s' % (self.wsgi_name, action)

        # Set up path
        path = getattr(self, 'wsgi_path_prefix', '') + path

        # Build up the conditions
        conditions = {}
        if hasattr(method, '_wsgi_methods'):
            conditions['method'] = methods if methods else method._wsgi_methods
        if hasattr(method, '_wsgi_condition'):
            conditions['function'] = method._wsgi_condition

        # Create the route
        self.wsgi_mapper.connect(name, path,
                                 controller=self,
                                 action=action,
                                 conditions=conditions,
                                 **getattr(method, '_wsgi_keywords', {}))
611043
def get_routes(self, viewset):
        

        known_actions = list(flatten([route.mapping.values() for route in self.routes if isinstance(route, Route)]))

        # Determine any `@detail_route` or `@list_route` decorated methods on the viewset
        detail_routes = []
        list_routes = []

        for methodname in dir(viewset):
            attr = getattr(viewset, methodname)
            httpmethods = getattr(attr, 'bind_to_methods', None)
            detail = getattr(attr, 'detail', True)

            if httpmethods:
                # check against know actions list
                if methodname in known_actions:
                    raise ImproperlyConfigured('Cannot use @detail_route or @list_route '
                                               'decorators on method "%s" '
                                               'as it is an existing route'.format(methodname))

                httpmethods = [method.lower() for method in httpmethods]

                if detail:
                    detail_routes.append((httpmethods, methodname))
                else:
                    list_routes.append((httpmethods, methodname))

        def _get_dynamic_routes(route, dynamic_routes):
            ret = []

            for httpmethods, methodname in dynamic_routes:
                method_kwargs = getattr(viewset, methodname).kwargs
                initkwargs = route.initkwargs.copy()
                initkwargs.update(method_kwargs)
                url_path = initkwargs.pop("url_path", None) or methodname

                ret.append(Route(
                    url=replace_methodname(route.url, url_path),
                    mapping={httpmethod: methodname for httpmethod in httpmethods},
                    name=replace_methodname(route.name, url_path),
                    initkwargs=initkwargs,
                ))

            return ret

        ret = []

        for route in self.routes:
            if isinstance(route, DynamicDetailRoute):
                # Dynamic detail routes (@detail_route decorator)
                ret += _get_dynamic_routes(route, detail_routes)
            elif isinstance(route, DynamicListRoute):
                # Dynamic list routes (@list_route decorator)
                ret += _get_dynamic_routes(route, list_routes)
            else:
                # Standard route
                ret.append(route)

        return ret
1340644
def list_actions(cls):
        """"""
        # Make sure these are always at the beginning of the list
        actions = ['start', 'stop', 'restart', 'status']
        # Iterate over the instance attributes checking for actions that
        # have been exposed
        for func_name in dir(cls):
            func = getattr(cls, func_name)
            if (not hasattr(func, '__call__') or
                    not getattr(func, '__daemonocle_exposed__', False)):
                # Not a function or not exposed
                continue
            action = func_name.replace('_', '-')
            if action not in actions:
                actions.append(action)

        return actions
173535
def list_actions(self):
        

        actions = []
        for path, actionName, action in self:
            actions.append(self.__namespace_splitter.join(itertools.chain(path, (actionName,))))
        return sorted(actions)
394208
private void parseActions(String actions)
   {
      boolean exclusionListNeeded = actions != null && actions.startsWith("!");
      if (exclusionListNeeded)
         actions = actions.substring(1);

      Object[] methodInfo = canonicalMethods(actions);
      if (exclusionListNeeded)
      {
         this.httpExceptionList = (TreeSet<String>) methodInfo[0];
         this.httpExceptionString = (String) methodInfo[1];
      }
      else
      {
         this.httpMethods = (TreeSet<String>) methodInfo[0];
         this.httpMethodsString = (String) methodInfo[1];
      }
   }
137259
def action(context, request, action=None, resource=None, uid=None):
    

    # allow to set the method via the header
    if action is None:
        action = request.get_header("HTTP_X_HTTP_METHOD_OVERRIDE", "CREATE").lower()

    # Fetch and call the action function of the API
    func_name = "{}_items".format(action)
    action_func = getattr(api, func_name, None)
    if action_func is None:
        api.fail(500, "API has no member named '{}'".format(func_name))

    portal_type = api.resource_to_portal_type(resource)
    items = action_func(portal_type=portal_type, uid=uid)

    return {
        "count": len(items),
        "items": items,
        "url": api.url_for("senaite.jsonapi.v1.action", action=action),
    }
896817
private ArrayList<String> getActions() {
        String actionList = getString(KEY_ACTIONS);
        if (actionList.equals(NO_STRING_VALUE)) {
            return new ArrayList<>();
        } else {
            return deserializeString(actionList);
        }
    }
919896
def action_set(method_name):
    

    def action_set(value, context, **_params):
        method = getattr(context["action"], method_name)
        return _set(method, context["key"], value, (), {})

    return action_set
993192
def action(self, item, action_type, body={}):
        
        uri = "/%s/%s/action" % (self.uri_base, utils.get_id(item))
        action_body = {action_type: body}
        return self.api.method_post(uri, body=action_body)
665039
def get_urls(self):
        
        urls = []

        for action in self.get_extra_actions():
            regex = r'^{}/$'.format(self._get_action_href(action))
            view = self.admin_site.admin_view(action)
            urls.append(url(regex, view))

        return urls + super(ExtraActionsMixin, self).get_urls()
645985
def get_urls(self):
        
        parts = []
        seen = set()

        # Process item views in order
        for v in list(self._meta.item_views)+list(self._meta.action_views):
            if not v in seen:
                view, name = self.get_view_and_name(v)
                if view and name:
                    parts.append(self.get_url(name, view, v))
                seen.add(v)

        # Process everything else that we have not seen
        for v in set(self._views).difference(seen):
            # Get the url name
            view, name = self.get_view_and_name(v)
            if view and name:
                parts.append(self.get_url(name, view, v))

        return parts
354976
def get_actions_permission_description(view, method):
    
    action = getattr(view, 'action', None)
    if action is None:
        return ''

    if hasattr(view, action + '_permissions'):
        permission_types = (action,)
    elif method in SAFE_METHODS:
        permission_types = ('safe_methods', '%s_extra' % action)
    else:
        permission_types = ('unsafe_methods', '%s_extra' % action)

    description = ''
    for permission_type in permission_types:
        action_perms = getattr(view, permission_type + '_permissions', [])
        for permission in action_perms:
            action_perm_description = get_entity_description(permission)
            description += '\n' + action_perm_description if description else action_perm_description

    return description
212948
def actions(self):
        
        actions = []
        for a in dir(self):
            a = getattr(self, a)
            if isinstance(a, TableAction):
                actions.append(a)

        # We are not caching this because array len should be low enough
        actions.sort(key=lambda action: action.creation_counter)
        return actions