Beispiel #1
0
class _ConfigureDHCP_V2(amp.Command):
    """Configure a DHCP server.

    :since: 2.1
    """
    arguments = [
        (b"omapi_key", amp.Unicode()),
        (b"failover_peers", AmpList([
            (b"name", amp.Unicode()),
            (b"mode", amp.Unicode()),
            (b"address", amp.Unicode()),
            (b"peer_address", amp.Unicode()),
            ])),
        (b"shared_networks", CompressedAmpList([
            (b"name", amp.Unicode()),
            (b"subnets", AmpList([
                (b"subnet", amp.Unicode()),
                (b"subnet_mask", amp.Unicode()),
                (b"subnet_cidr", amp.Unicode()),
                (b"broadcast_ip", amp.Unicode()),
                (b"router_ip", amp.Unicode()),
                (b"dns_servers", amp.ListOf(IPAddress())),
                (b"ntp_servers", amp.ListOf(amp.Unicode())),
                (b"domain_name", amp.Unicode()),
                (b"search_list", amp.ListOf(amp.Unicode(), optional=True)),
                (b"pools", AmpList([
                    (b"ip_range_low", amp.Unicode()),
                    (b"ip_range_high", amp.Unicode()),
                    (b"failover_peer", amp.Unicode(optional=True)),
                    ])),
                (b"dhcp_snippets", AmpList([
                    (b"name", amp.Unicode()),
                    (b"description", amp.Unicode(optional=True)),
                    (b"value", amp.Unicode()),
                    ], optional=True)),
                ])),
            (b"mtu", amp.Integer(optional=True)),
            (b"interface", amp.Unicode(optional=True)),
        ])),
        (b"hosts", CompressedAmpList([
            (b"host", amp.Unicode()),
            (b"mac", amp.Unicode()),
            (b"ip", amp.Unicode()),
            (b"dhcp_snippets", AmpList([
                (b"name", amp.Unicode()),
                (b"description", amp.Unicode(optional=True)),
                (b"value", amp.Unicode()),
                ], optional=True)),
            ])),
        (b"interfaces", AmpList([
            (b"name", amp.Unicode()),
            ])),
        (b"global_dhcp_snippets", CompressedAmpList([
            (b"name", amp.Unicode()),
            (b"description", amp.Unicode(optional=True)),
            (b"value", amp.Unicode()),
            ], optional=True)),
        ]
    response = []
    errors = {exceptions.CannotConfigureDHCP: b"CannotConfigureDHCP"}
Beispiel #2
0
class ImportBootImages(amp.Command):
    """Import boot images and report the final
    boot images that exist on the cluster.

    :since: 1.7
    """

    arguments = [
        (
            b"sources",
            AmpList([
                (b"url", amp.Unicode()),
                (b"keyring_data", Bytes()),
                (
                    b"selections",
                    AmpList([
                        (b"os", amp.Unicode()),
                        (b"release", amp.Unicode()),
                        (b"arches", amp.ListOf(amp.Unicode())),
                        (b"subarches", amp.ListOf(amp.Unicode())),
                        (b"labels", amp.ListOf(amp.Unicode())),
                    ]),
                ),
            ]),
        ),
        (b"http_proxy", ParsedURL(optional=True)),
        (b"https_proxy", ParsedURL(optional=True)),
    ]
    response = []
    errors = []
Beispiel #3
0
class GetBootSources(amp.Command):
    """Report boot sources and selections for the given cluster.

    Includes the new os field for the selections.

    :since: 1.7
    """

    arguments = [
        # The cluster UUID.
        (b"uuid", amp.Unicode())
    ]
    response = [(
        b"sources",
        AmpList([
            (b"url", amp.Unicode()),
            (b"keyring_data", Bytes()),
            (
                b"selections",
                AmpList([
                    (b"os", amp.Unicode()),
                    (b"release", amp.Unicode()),
                    (b"arches", amp.ListOf(amp.Unicode())),
                    (b"subarches", amp.ListOf(amp.Unicode())),
                    (b"labels", amp.ListOf(amp.Unicode())),
                ]),
            ),
        ]),
    )]
    errors = []
Beispiel #4
0
class ReceiveHeaders(amp.Command):
    arguments = [('PositiveHeaders', amp.ListOf(amp.Unicode())),
                ('NeutralHeaders', amp.ListOf(amp.Unicode())),
                ('NegativeHeaders', amp.ListOf(amp.Unicode())),
                ('TopicHeaders', amp.ListOf(amp.Unicode())),
                ('TotalNumberOfPackets', amp.Integer()),
                ('CurrentPacketNo', amp.Integer())]
    response = []
Beispiel #5
0
class Count(amp.Command):
    arguments = [('n', amp.Integer())]
    response = [('oki', amp.Integer()), ('oks', amp.String()),
                ('oku', amp.Unicode()), ('okb', amp.Boolean()),
                ('okf', amp.Float()), ('okd', amp.Decimal()),
                ('okt', amp.DateTime()), ('okl1', amp.ListOf(amp.Integer())),
                ('okl2', amp.ListOf(amp.ListOf(amp.String()))),
                ('okla',
                 amp.AmpList([('a', amp.Integer()), ('b', amp.Unicode())]))]
Beispiel #6
0
class FetchRequestLengthStats(amp.Command):
    "A command to request request length statistics from a running weasyl backend."
    arguments = [
        ('percentiles', amp.ListOf(amp.Integer())),
        ('lengths', amp.ListOf(amp.Float())),
    ]
    response = [
        ('lengths', amp.ListOf(amp.Float(), optional=True)),
        ('percentiles', amp.ListOf(amp.Float(), optional=True)),
    ]
Beispiel #7
0
class RecordsMatchingTokensCommand(amp.Command):
    arguments = [
        ('tokens', amp.ListOf(amp.String())),
        ('context', amp.String(optional=True)),
        ('limitResults', amp.Integer(optional=True)),
        ('timeoutSeconds', amp.Integer(optional=True)),
    ]
    response = [
        ('items', amp.ListOf(amp.String())),
        ('continuation', amp.String(optional=True)),
    ]
Beispiel #8
0
class RecordsMatchingFieldsCommand(amp.Command):
    arguments = [
        ('fields', amp.ListOf(amp.ListOf(amp.String()))),
        ('operand', amp.String()),
        ('recordType', amp.String(optional=True)),
        ('limitResults', amp.Integer(optional=True)),
        ('timeoutSeconds', amp.Integer(optional=True)),
    ]
    response = [
        ('items', amp.ListOf(amp.String())),
        ('continuation', amp.String(optional=True)),
    ]
Beispiel #9
0
class GetTimeConfiguration(amp.Command):
    """Get settings to use for configuring NTP for a given system identifier.

    :since: 2.1
    """

    arguments = [(b"system_id", amp.Unicode())]
    response = [
        (b"servers", amp.ListOf(amp.Unicode())),
        (b"peers", amp.ListOf(amp.Unicode())),
    ]
    errors = {NoSuchNode: b"NoSuchNode"}
Beispiel #10
0
class RemoveRecordsCommand(amp.Command):
    arguments = [
        ('uids', amp.ListOf(amp.String())),
    ]
    response = [
        ('success', amp.Boolean()),
    ]
Beispiel #11
0
class FetchRequestBreakdownStats(amp.Command):
    "A command to request request breakdown statistics from a running weasyl backend."
    arguments = [
        ('percentiles', amp.ListOf(amp.Integer())),
    ]
    response = [
        ('averageTimeQueued', amp.Float(optional=True)),
        ('averageTimeInSQL', amp.Float(optional=True)),
        ('averageTimeInMemcached', amp.Float(optional=True)),
        ('averageTimeInPython', amp.Float(optional=True)),
        ('totalTimeQueued', amp.Float(optional=True)),
        ('totalTimeInSQL', amp.Float(optional=True)),
        ('totalTimeInMemcached', amp.Float(optional=True)),
        ('totalTimeInPython', amp.Float(optional=True)),
        ('queries', amp.ListOf(amp.Float(), optional=True)),
    ]
Beispiel #12
0
class UpdateRecordsCommand(amp.Command):
    arguments = [
        ('uids', amp.ListOf(amp.String())),
        ('create', amp.Boolean(optional=True)),
    ]
    response = [
        ('success', amp.Boolean()),
    ]
Beispiel #13
0
class SetMembersCommand(amp.Command):
    arguments = [
        ('uid', amp.String()),
        ('memberUIDs', amp.ListOf(amp.String())),
    ]
    response = [
        ('success', amp.Boolean()),
    ]
Beispiel #14
0
class ExpandedMemberUIDsCommand(amp.Command):
    arguments = [
        ('uid', amp.String()),
    ]
    response = [
        ('items', amp.ListOf(amp.String())),
        ('continuation', amp.String(optional=True)),
    ]
Beispiel #15
0
class ContinuationCommand(amp.Command):
    arguments = [
        ('continuation', amp.String(optional=True)),
    ]
    response = [
        ('items', amp.ListOf(amp.String())),
        ('continuation', amp.String(optional=True)),
    ]
Beispiel #16
0
class WhoConnectedCmd(amp.Command):
    """
    Command for asking the proxy for which accounts are connected.
    """

    arguments = []
    response = [
        ('accounts', amp.ListOf(amp.Unicode())),
    ]
Beispiel #17
0
class GetDNSConfiguration(amp.Command):
    """Get settings to use for configuring DNS for a given system identifier.

    :since: 2.5
    """

    arguments = [(b"system_id", amp.Unicode())]
    response = [(b"trusted_networks", amp.ListOf(amp.Unicode()))]
    errors = {NoSuchNode: b"NoSuchNode"}
Beispiel #18
0
class RecordsWithEmailAddressCommand(amp.Command):
    arguments = [
        ('emailAddress', amp.String()),
        ('limitResults', amp.Integer(optional=True)),
        ('timeoutSeconds', amp.Integer(optional=True)),
    ]
    response = [
        ('items', amp.ListOf(amp.String())),
        ('continuation', amp.String(optional=True)),
    ]
class GetSupportedSettings(amp.Command):
    '''
    Returns a list of strings which indicate which account settings the
    client should display to the user.
    Possible values are 'password'
    '''
    arguments = []
    response = [
        (b'result', amp.ListOf(amp.Unicode())),
    ]
Beispiel #20
0
class PowerDriverCheck(amp.Command):
    """Check power driver on cluster for missing packages

    :since: 1.9
    """

    arguments = [(b"power_type", amp.Unicode())]
    response = [(b"missing_packages", amp.ListOf(amp.Unicode()))]
    errors = {
        exceptions.UnknownPowerType: b"UnknownPowerType",
        NotImplementedError: b"NotImplementedError",
    }
Beispiel #21
0
class UpdateClient(amp.Command):
    arguments = [('playerNames', amp.ListOf(amp.String())),
                 ('playerStacks', amp.ListOf(amp.Integer())),
                 ('playerBets', amp.ListOf(amp.Integer())),
                 ('playersAlive', amp.ListOf(amp.Boolean())),
                 ('playerHands', amp.ListOf(amp.ListOf(amp.Integer()))),
                 ('gameDealer', amp.Integer()), ('gameActor', amp.Integer()),
                 ('gameToCall', amp.Integer()), ('gamePot', amp.Integer()),
                 ('gameCommunityCards', amp.ListOf(amp.Integer()))]
    response = []
Beispiel #22
0
class RegisterUser(amp.Command):
    arguments = [
        ('mport', amp.Integer()),
    ]
    response = [
        ('mport', amp.Integer()),
        ('use_codec', amp.Boolean()),
        ('keys_pair', amp.Integer()),
        ('self_nick', amp.Unicode()),
        ('participants', amp.ListOf(amp.Unicode())),
    ]
    errors = {
        RegistrationError: 'reg_err',
    }
Beispiel #23
0
class GetProxyConfiguration(amp.Command):
    """Get settings to use for configuring proxy for a given system identifier.

    :since: 2.5
    """

    arguments = [(b"system_id", amp.Unicode())]
    response = [
        (b"enabled", amp.Boolean()),
        (b"port", amp.Integer()),
        (b"allowed_cidrs", amp.ListOf(amp.Unicode())),
        (b"prefer_v4_proxy", amp.Boolean()),
    ]
    errors = {NoSuchNode: b"NoSuchNode"}
Beispiel #24
0
Datei: pool.py Projekt: hmpf/nav
class Job(amp.Command):
    """Represent a job for sending to a worker"""

    arguments = [
        (b'netbox', amp.Integer()),
        (b'job', amp.Unicode()),
        (b'plugins', amp.ListOf(amp.Unicode())),
        (b'interval', amp.Integer()),  # Needs to be included in database record.
        # Not used for scheduling
        (b'serial', amp.Integer()),  # Serial number needed for cancelling
    ]
    response = [(b'result', amp.Boolean()), (b'reschedule', amp.Integer())]
    errors = {
        jobs.AbortedJobError: b'AbortedJob',
    }
Beispiel #25
0
class CreateNode(amp.Command):
    """Create a node on a given cluster.

    :since: 2.0
    """

    arguments = [
        (b"architecture", amp.Unicode()),
        (b"power_type", amp.Unicode()),
        (b"power_parameters", amp.Unicode()),
        (b"mac_addresses", amp.ListOf(amp.Unicode())),
        (b"hostname", amp.Unicode(optional=True)),
        (b"domain", amp.Unicode(optional=True)),
    ]
    response = [(b"system_id", amp.Unicode())]
    errors = {NodeAlreadyExists: b"NodeAlreadyExists"}
Beispiel #26
0
class CreateNode(amp.Command):
    """Create a node on a given cluster.

    :since: 2.0
    """

    arguments = [
        (b'architecture', amp.Unicode()),
        (b'power_type', amp.Unicode()),
        (b'power_parameters', amp.Unicode()),
        (b'mac_addresses', amp.ListOf(amp.Unicode())),
        (b'hostname', amp.Unicode(optional=True)),
        (b'domain', amp.Unicode(optional=True)),
    ]
    response = [
        (b'system_id', amp.Unicode()),
    ]
    errors = {
        NodeAlreadyExists: b"NodeAlreadyExists",
    }
Beispiel #27
0
class ScanNetworks(amp.Command):
    """Requests an immediate scan of attached networks.

    If the `scan_all` parameter is True, scans all subnets on Ethernet
    interfaces known to the rack controller.

    If the `force_ping` parameter is True, forces the use of `ping` even if
    `nmap` is installed.

    If the `threads` parameter is supplied, overrides the number of concurrent
    threads the rack controller is allowed to spawn while scanning the network.

    If the `cidrs` parameter is supplied, scans the specified CIDRs on the
    rack controller.

    If the `interface` paramter is supplied, limits the scan to the specified
    interface.

    If both the `cidrs` and the `interface` parameters are supplied, the rack
    will scan for the specified `cidrs` on the specified interface, no
    matter if those CIDRs appear to be configured on that interface or not.

    If a scan is already in progress, this call raises a
    `ScanNetworksAlreadyInProgress` error.

    :since: 2.1
    """

    arguments = [
        (b"scan_all", amp.Boolean(optional=True)),
        (b"force_ping", amp.Boolean(optional=True)),
        (b"slow", amp.Boolean(optional=True)),
        (b"threads", amp.Integer(optional=True)),
        (b"cidrs", amp.ListOf(IPNetwork(), optional=True)),
        (b"interface", amp.Unicode(optional=True)),
    ]
    errors = {
        exceptions.ScanNetworksAlreadyInProgress:
        (b"ScanNetworksAlreadyInProgress")
    }
Beispiel #28
0
class DiscoverPodProjects(amp.Command):
    """Discover pod projects names.

    :since: 2.10
    """

    arguments = [
        (b"type", amp.Unicode()),
        # We can't define a tighter schema here because this is a highly
        # variable bag of arguments from a variety of sources.
        (b"context", StructureAsJSON()),
    ]
    response = [(
        b"projects",
        amp.ListOf(
            AttrsClassArgument(
                "provisioningserver.drivers.pod.DiscoveredPodProject")),
    )]
    errors = {
        exceptions.UnknownPodType: b"UnknownPodType",
        NotImplementedError: b"NotImplementedError",
        exceptions.PodActionFail: b"PodActionFail",
    }
Beispiel #29
0
class Render(amp.Command):
    """
    Render I{XHTML} markup and I{CSS} documents to a I{PDF} document.

    Accepts the following arguments:

    * C{markup}, a L{str}, that is the I{XHTML} markup byte data;
    * C{stylesheets}, a L{list} of L{str}, that is a list of stylesheet byte
      data.

    Returns a L{dict} mapping C{'data'} to a C{str} of rendered byte data, and
    C{'contentType'} to the content type of the byte data.
    """
    arguments = [
        ('markup', BigString()),
        ('stylesheets', amp.ListOf(amp.String()))]

    response = [
        ('data', BigString()),
        ('contentType', amp.String())]

    errors = {
        XMLSyntaxError: 'XML_SYNTAX_ERROR',
        RemoteExternalProcessError: 'EXTERNAL_PROCESS_ERROR'}
Beispiel #30
0
class EnumerateClients(amp.Command):
    """Command for uiconnection.py->Daemon.enumerate_clients
     to remotely call guiplex.py->GUI.enumerate_clients.
     """
    arguments = []
    response = [(b'handles', amp.ListOf(amp.Unicode()))]