Example #1
0
class Replicate(amp.Command):
    """
    Tell the agent to replicate the specified chunks.

    @param depth: replication depth, higher value means better
        availability but also increases preasure on upload.
    """
    arguments = [('chunks', amp.AmpList([('chunkName', amp.String)])),
                 ('depth', amp.Integer())]
Example #2
0
class RecordWithShortNameCommand(amp.Command):
    arguments = [
        ('recordType', amp.String()),
        ('shortName', amp.String()),
        ('timeoutSeconds', amp.Integer(optional=True)),
    ]
    response = [
        ('fields', amp.String()),
    ]
Example #3
0
class GetSyslogConfiguration(amp.Command):
    """Get settings to use for configuring syslog for a given system identifier.

    :since: 2.5
    """

    arguments = [(b"system_id", amp.Unicode())]
    response = [(b"port", amp.Integer())]
    errors = {NoSuchNode: b"NoSuchNode"}
Example #4
0
class ClientGenericEvent(amp.Command):
    """Generic client event.
    
    Message attributes:
    event - String code for an event.
    Response attributes:
    result - 1 for success.
    """
    arguments = [('event', amp.String())]
    response = [('result', amp.Integer())]
Example #5
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)),
    ]
Example #6
0
class SendThroughObjectCmd(amp.Command):
    """
    AMP command for sending player input from the proxy to the MUD server.
    """

    arguments = [
        ('object_id', amp.Integer()),
        ('input', amp.Unicode()),
    ]
    response = []
Example #7
0
class OnlineAccountVerifier_RegisterAddressToBallot(Command):
    arguments = [(b'ballot_id', amp.Integer()),
                 (b'pickled_signed_token', amp.String()),
                 (b'pickled_token', amp.String()),
                 (b'pickled_voter_address', amp.String())]
    response = [(b'ok', amp.Boolean())]
    errors = {
        #TODO add errors
        Exception: b'OnlineAccountVerifier_RegisterAddressToBallot'
    }
Example #8
0
class EmitToObjectCmd(amp.Command):
    """
    AMP command for sending output to a player connected on the proxy.
    """

    arguments = [
        ('object_id', amp.Integer()),
        ('message', amp.Unicode()),
    ]
    response = []
Example #9
0
class UpdateLease(amp.Command):
    """Report DHCP lease update from a cluster controller. Different from
    `UpdateLeases` as this call only updates one lease at a time.

    :since: 2.0
    """

    arguments = [
        (b"cluster_uuid", amp.Unicode()),
        (b"action", amp.Unicode()),
        (b"mac", amp.Unicode()),
        (b"ip_family", amp.Unicode()),
        (b"ip", amp.Unicode()),
        (b"timestamp", amp.Integer()),
        (b"lease_time", amp.Integer(optional=True)),
        (b"hostname", amp.Unicode(optional=True)),
    ]
    response = []
    errors = {NoSuchCluster: b"NoSuchCluster"}
Example #10
0
class AddClient(amp.Command):
    arguments = [('observer', amp.Boolean())]
    response = [
        ('added', amp.Boolean()),
        ('reason', amp.Unicode()),
        ('ready', amp.Boolean()),
        ('player_count', amp.Integer()),
        ('experiment_pickle', amp.String()),
        ('conditions_pickle', amp.String()),
    ]
Example #11
0
class TriggerAtSessionDisconnectForObjectCmd(amp.Command):
    """
    When a Session disconnects that was controlling an object, this AMP
    command asks the MUD Server to run said object's
    ``after_session_disconnect_event()`` method.
    """

    arguments = [
        ('object_id', amp.Integer()),
    ]
    response = []
Example #12
0
class RegisterGame(amp.Command):
    '''
    Registers a game running on the client with the server.
    '''
    arguments = [('game', amp.String()), ('version', amp.String()),
                 ('port', amp.Integer())]
    response = []
    errors = {
        NotAuthenticated: 'NO_AUTH',
        PortUnreachable: 'BAD_PORT',
    }
Example #13
0
class ListGames(amp.Command):
    '''
    Returns a list of the Trosnoth games available on this server.
    '''
    arguments = []
    response = [('games',
                 amp.AmpList([
                     ('id', amp.Integer()),
                     ('game', amp.String()),
                     ('version', amp.String()),
                 ]))]
class RegisterAuthTag(amp.Command):
    '''
    Auth -> Arena

    Registers the given auth token with an authorised user.
    '''

    arguments = [
        (b'username', amp.Unicode()),
        (b'authTag', amp.Integer()),
    ]
    response = []
Example #15
0
class NotifyFirstSessionConnectedOnObjectCmd(amp.Command):
    """
    Sent to an object upon a controlling PlayerAccount connecting via
    a Session on the proxy. This is only sent with the first connection. Any
    subsequent duplicate connections (IE: player connects with three different
    clients at the same time) will not trigger the event repeatedly.
    """

    arguments = [
        ('object_id', amp.Integer()),
    ]
    response = []
class ArenaInfoChanged(amp.Command):
    '''
    Arena -> Auth

    Gives info about the arena, to be displayed in the web interface.
    '''

    arguments = [
        (b'status', amp.Unicode(optional=True)),
        (b'players', amp.Integer(optional=True)),
        (b'paused', amp.Boolean(optional=True)),
    ]
Example #17
0
class RegisterEventType(amp.Command):
    """Register an event type.

    :since: 1.7
    """

    arguments = [
        (b"name", amp.Unicode()),
        (b"description", amp.Unicode()),
        (b"level", amp.Integer()),
    ]
    response = []
    errors = []
Example #18
0
class ListOtherGames(amp.Command):
    '''
    Returns a list of Trosnoth games this server knows about which are not
    hosted on this server.
    '''
    arguments = []
    response = [('games',
                 amp.AmpList([
                     ('ip', amp.String()),
                     ('port', amp.Integer()),
                     ('game', amp.String()),
                     ('version', amp.String()),
                 ]))]
class ListGames(amp.Command):
    '''
    Returns a list of the Trosnoth games available on this server.
    '''
    arguments = []
    response = [
        (b'games', amp.AmpList([
            (b'id', amp.Integer()),
            (b'game', amp.Unicode()),
            (b'version', amp.Unicode()),
            (b'name', amp.Unicode(optional=True)),
        ]))
    ]
Example #20
0
class ServerObjectJoinEvent(amp.Command):
    """Server object join/spawn event.
    
    Message attributes:
    objectid - Numeric ID of object.
    objecttype - Text representation of object type.
    objectname - Name of object.
    radius - Radius of the ship in pixels.
    image - Bitmap of the ship icon (pygame format).
    imagex - Width of image.
    imagey - Height of image.
    thrustimg - Bitmap of the ship thrusting image.
    bulletimg - Bitmap of the ship's bullet image.
    Response attributes:
    result - 1 for success.
    """
    arguments = [('objectid', amp.Integer()), ('objecttype', amp.String()),
                 ('objectname', amp.String()), ('radius', amp.Integer()),
                 ('image', amp.String()), ('imagex', amp.Integer()),
                 ('imagey', amp.Integer()), ('thrustimg', amp.String()),
                 ('bulletimg', amp.String())]
    response = [('result', amp.Integer())]
Example #21
0
class _ValidateDHCPConfig_V2(_ConfigureDHCP_V2):
    """Validate the configure the DHCPv4 server.

    :since: 2.1
    """
    response = [
        (b"errors", CompressedAmpList([
            (b"error", amp.Unicode()),
            (b"line_num", amp.Integer()),
            (b"line", amp.Unicode()),
            (b"position", amp.Unicode()),
            ], optional=True)),
    ]
Example #22
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"}
class CreateGame(amp.Command):
    '''
    Instructs the server to start a new game.
    '''
    arguments = [
        (b'game', amp.Unicode()),
    ]
    response = [
        (b'id', amp.Integer()),
        (b'version', amp.Unicode()),
    ]
    errors = {
        NotAuthenticated: b'NO_AUTH',
        CannotCreateGame: b'WONT',
    }
Example #24
0
class ServerObjectStateEvent(amp.Command):
    """Server object state change event.
    
    Message attributes:
    objectid - Numeric ID of object.
    objecttype - Text representation of object type.
    objectname - Name of object.
    eventtime - Timestamp of object event.
    x - X coordinate of object position.
    y - Y coordinate of object position.
    vx - X component of object velocity.
    vy - Y component of object velocity.
    a - Axial acceleration of object.
    r - Rotational position of object in radians (0 points up).
    rr - Rotational rate of object in radians/second.
    Response attributes:
    result - 1 for success.
    """
    arguments = [('objectid', amp.Integer()), ('objecttype', amp.String()),
                 ('objectname', amp.String()), ('eventtime', amp.Float()),
                 ('x', amp.Float()), ('y', amp.Float()), ('vx', amp.Float()),
                 ('vy', amp.Float()), ('a', amp.Float()), ('r', amp.Float()),
                 ('rr', amp.Float())]
    response = [('result', amp.Integer())]
Example #25
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)),
    ]
Example #26
0
class GetBootConfig(amp.Command):
    """Get the boot configuration for booting machine.

    :since: 2.0
    """

    arguments = [
        # The system_id for the rack controller.
        (b"system_id", amp.Unicode()),
        (b"local_ip", amp.Unicode()),
        (b"remote_ip", amp.Unicode()),
        (b"arch", amp.Unicode(optional=True)),
        (b"subarch", amp.Unicode(optional=True)),
        (b"mac", amp.Unicode(optional=True)),
        (b"hardware_uuid", amp.Unicode(optional=True)),
        (b"bios_boot_method", amp.Unicode(optional=True)),
    ]
    response = [
        (b"arch", amp.Unicode()),
        (b"subarch", amp.Unicode()),
        (b"osystem", amp.Unicode()),
        (b"release", amp.Unicode()),
        # Kernel and initrd are optional as they were introduced
        # in 2.1.1. After 2.2 they can be set to manditory.
        (b"kernel", amp.Unicode(optional=True)),
        (b"initrd", amp.Unicode(optional=True)),
        # boot_dtb is optional as not all archs require it.
        (b"boot_dtb", amp.Unicode(optional=True)),
        (b"purpose", amp.Unicode()),
        (b"hostname", amp.Unicode()),
        (b"domain", amp.Unicode()),
        (b"preseed_url", amp.Unicode()),
        (b"fs_host", amp.Unicode()),
        (b"log_host", amp.Unicode()),
        (b"log_port", amp.Integer(optional=True)),
        (b"extra_opts", amp.Unicode()),
        (b"system_id", amp.Unicode(optional=True)),
        # MAAS 2.3 introduced this parameter to toggle using TGT or HTTP to
        # boot. TGT support was removed in MAAS 2.4 however without this option
        # a MAAS 2.3 rack controller connected to a MAAS 2.4 region controller
        # will try to use TGT as Twisted sets optional parameters to False when
        # not defined.
        (b"http_boot", amp.Boolean(optional=True)),
    ]
    errors = {
        BootConfigNoResponse: b"BootConfigNoResponse",
    }
Example #27
0
class ClientJoinRequest(amp.Command):
    """Client join/respawn request.
    
    Message attributes:
    shipname - User/player name.
    radius - Radius of the ship in pixels.
    wmax - Weapon relative maximum level (0-100).
    fmax - Fuel relative maximum level (0-100).
    smax - Shield relative maximum level (0-100).
    image - Bitmap of the ship icon (pygame format).
    imagex - Width of image.
    imagey - Height of image.
    thrustimg - Bitmap of the ship thrusting image.
    bulletimg - Bitmap of the ship's bullet image.
    """
    arguments = [('shipname', amp.String()), ('radius', amp.Integer()),
                 ('wmax', amp.Integer()), ('fmax', amp.Integer()),
                 ('smax', amp.Integer()), ('image', amp.String()),
                 ('imagex', amp.Integer()), ('imagey', amp.Integer()),
                 ('thrustimg', amp.String()), ('bulletimg', amp.String())]
    response = [('shipid', amp.Integer()), ('time', amp.Float()),
                ('gamewidth', amp.Integer()), ('gameheight', amp.Integer())]
Example #28
0
class RequestNodeInfoByMACAddress(amp.Command):
    """Request Node information by mac address.

    :since: 1.7
    """

    arguments = [(b"mac_address", amp.Unicode())]
    response = [
        (b"system_id", amp.Unicode()),
        (b"hostname", amp.Unicode()),
        (b"status", amp.Integer()),
        (b"boot_type", amp.Unicode()),
        (b"osystem", amp.Unicode()),
        (b"distro_series", amp.Unicode()),
        (b"architecture", amp.Unicode()),
        (b"purpose", amp.Unicode()),
    ]
    errors = {NoSuchNode: b"NoSuchNode"}
Example #29
0
class AddChassis(amp.Command):
    """Probe and enlist the chassis which a rack controller can connect to.

    :since: 2.0
    """
    arguments = [
        (b"user", amp.Unicode()),
        (b"chassis_type", amp.Unicode()),
        (b"hostname", amp.Unicode()),
        (b"username", amp.Unicode(optional=True)),
        (b"password", amp.Unicode(optional=True)),
        (b"accept_all", amp.Boolean(optional=True)),
        (b"domain", amp.Unicode(optional=True)),
        (b"prefix_filter", amp.Unicode(optional=True)),
        (b"power_control", amp.Unicode(optional=True)),
        (b"port", amp.Integer(optional=True)),
        (b"protocol", amp.Unicode(optional=True)),
    ]
    errors = {}
Example #30
0
class DecomposeMachine(amp.Command):
    """Decompose a machine in a pod.

    :since: 2.2
    """

    arguments = [
        (b"pod_id", amp.Integer()),
        (b"name", amp.Unicode()),
        (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"hints", AmpDiscoveredPodHints())]
    errors = {
        exceptions.UnknownPodType: b"UnknownPodType",
        NotImplementedError: b"NotImplementedError",
        exceptions.PodActionFail: b"PodActionFail",
    }