summaryrefslogtreecommitdiffstats
path: root/test/lib/ansible_test/_internal/cli/actions.py
blob: 3359a848e43d258c704146754a24b98968a8259d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
"""Actions for handling composite arguments with argparse."""
from __future__ import annotations

from .argparsing import (
    CompositeAction,
    NamespaceParser,
)

from .parsers import (
    DelegatedControllerParser,
    NetworkSshTargetParser,
    NetworkTargetParser,
    OriginControllerParser,
    PosixSshTargetParser,
    PosixTargetParser,
    SanityPythonTargetParser,
    UnitsPythonTargetParser,
    WindowsSshTargetParser,
    WindowsTargetParser,
)


class OriginControllerAction(CompositeAction):
    """Composite action parser for the controller when the only option is `origin`."""
    def create_parser(self) -> NamespaceParser:
        """Return a namespace parser to parse the argument associated with this action."""
        return OriginControllerParser()


class DelegatedControllerAction(CompositeAction):
    """Composite action parser for the controller when delegation is supported."""
    def create_parser(self) -> NamespaceParser:
        """Return a namespace parser to parse the argument associated with this action."""
        return DelegatedControllerParser()


class PosixTargetAction(CompositeAction):
    """Composite action parser for a POSIX target."""
    def create_parser(self) -> NamespaceParser:
        """Return a namespace parser to parse the argument associated with this action."""
        return PosixTargetParser()


class WindowsTargetAction(CompositeAction):
    """Composite action parser for a Windows target."""
    def create_parser(self) -> NamespaceParser:
        """Return a namespace parser to parse the argument associated with this action."""
        return WindowsTargetParser()


class NetworkTargetAction(CompositeAction):
    """Composite action parser for a network target."""
    def create_parser(self) -> NamespaceParser:
        """Return a namespace parser to parse the argument associated with this action."""
        return NetworkTargetParser()


class SanityPythonTargetAction(CompositeAction):
    """Composite action parser for a sanity target."""
    def create_parser(self) -> NamespaceParser:
        """Return a namespace parser to parse the argument associated with this action."""
        return SanityPythonTargetParser()


class UnitsPythonTargetAction(CompositeAction):
    """Composite action parser for a units target."""
    def create_parser(self) -> NamespaceParser:
        """Return a namespace parser to parse the argument associated with this action."""
        return UnitsPythonTargetParser()


class PosixSshTargetAction(CompositeAction):
    """Composite action parser for a POSIX SSH target."""
    def create_parser(self) -> NamespaceParser:
        """Return a namespace parser to parse the argument associated with this action."""
        return PosixSshTargetParser()


class WindowsSshTargetAction(CompositeAction):
    """Composite action parser for a Windows SSH target."""
    def create_parser(self) -> NamespaceParser:
        """Return a namespace parser to parse the argument associated with this action."""
        return WindowsSshTargetParser()


class NetworkSshTargetAction(CompositeAction):
    """Composite action parser for a network SSH target."""
    def create_parser(self) -> NamespaceParser:
        """Return a namespace parser to parse the argument associated with this action."""
        return NetworkSshTargetParser()