Exemplo n.º 1
0
from flask_restplus import fields
from cortex.api import api_manager
from cortex.api.serializers import pagination

dns_serializer = api_manager.model(
    'DNS', {
        'ip':
        fields.String(required=True, description='Host IP Address'),
        'hostname':
        fields.String(required=True, description='Host name'),
        'error':
        fields.String(required=False, description='Error Resposne'),
        'success':
        fields.Integer(
            required=True,
            description='DNS Lookup Status - 0: failure 1: success'),
    })
Exemplo n.º 2
0
from flask_restx import fields

from cortex.api import api_manager

pagination = api_manager.model('A page of results', {
	'page': fields.Integer(description='Number of this page of results'),
	'pages': fields.Integer(description='Total number of pages of results'),
	'per_page': fields.Integer(description='Number of items per page of results'),
	'total': fields.Integer(description='Total number of results'),
})
Exemplo n.º 3
0
systems_info_view_serializer = api_manager.model(
    'systems_info_view', {
        'id':
        fields.Integer(required=True, description='System\'s ID.'),
        'type':
        fields.Integer(required=False, description='System\'s Type.'),
        'class':
        fields.String(required=False, description='System\'s Class.'),
        'number':
        fields.Integer(required=False, description='System\'s Number.'),
        'name':
        fields.String(required=False, description='System\'s Name.'),
        'allocation_date':
        fields.DateTime(required=False,
                        description='The date this System was allocated.'),
        'expiry_date':
        fields.DateTime(required=False,
                        description='The date this System will expire.'),
        'decom_date':
        fields.DateTime(
            required=False,
            description='The date this System was decommissioned.'),
        'allocation_who':
        fields.String(required=False,
                      description='Who allocated this System.'),
        'allocation_who_realname':
        fields.String(
            required=False,
            description='Real name of the user who allocated this System.'),
        'allocation_comment':
        fields.String(
            required=False,
            description=
            'Comment provided to Cortex when allocating this System.'),
        'review_status':
        fields.Integer(required=False, description='System\'s Review Status.'),
        'review_task':
        fields.String(required=False, description='System\'s Review Task.'),
        'cmdb_id':
        fields.String(required=False, description='System\'s ID in the CMDB.'),
        'build_count':
        fields.Integer(
            required=False,
            description=
            'System\'s build count, the number of times the system has been built.'
        ),
        'primary_owner_who':
        fields.String(required=False, description='System\'s primary owner.'),
        'primary_owner_role':
        fields.String(required=False,
                      description='System\'s primary owner\'s role.'),
        'primary_owner_who_realname':
        fields.String(required=False,
                      description='System\'s primary owner\'s realname.'),
        'secondary_owner_who':
        fields.String(required=False,
                      description='System\'s secondary owner.'),
        'secondary_owner_role':
        fields.String(required=False,
                      description='System\'s secondary owner\'s role.'),
        'secondary_owner_who_realname':
        fields.String(required=False,
                      description='System\'s secondary owner\'s realname.'),
        'cmdb_sys_class_name':
        fields.String(required=False,
                      description='System\'s class name in the CMDB.'),
        'cmdb_name':
        fields.String(required=False,
                      description='System\'s name in the CMDB.'),
        'cmdb_operational_status':
        fields.String(required=False,
                      description='System\'s operational status in the CMDB.'),
        'cmdb_u_number':
        fields.String(required=False, description='System\'s CMDB ID.'),
        'cmdb_environment':
        fields.String(required=False,
                      description='System\'s environment in the CMDB.'),
        'cmdb_description':
        fields.String(required=False,
                      description='System\'s description in the CMDB.'),
        'cmdb_comments':
        fields.String(
            required=False,
            description='Comments provided about the system in the CMDB.'),
        'cmdb_os':
        fields.String(required=False,
                      description='The System\'s OS recorded in the CMDB.'),
        'cmdb_short_description':
        fields.String(required=False,
                      description='System\'s short description in the CMDB.'),
        'cmdb_is_virtual':
        fields.Boolean(
            required=False,
            description='Whether the System is flagged as virtual in the CMDB.'
        ),
        'vmware_name':
        fields.String(required=False, description='System\'s name in VMware.'),
        'vmware_vcenter':
        fields.String(
            required=False,
            description='The VMware vCenter this System is managed by.'),
        'vmware_uuid':
        fields.String(required=False, description='System\'s VMware UUID.'),
        'vmware_cpus':
        fields.Integer(required=False,
                       description='System\'s CPU count in VMware.'),
        'vmware_ram':
        fields.Integer(required=False, description='System\'s RAM in VMware.'),
        'vmware_guest_state':
        fields.String(required=False,
                      description='System\'s guest state in VMware.'),
        'vmware_os':
        fields.String(required=False,
                      description='System\'s OS recorded in VMware.'),
        'vmware_hwversion':
        fields.String(required=False,
                      description='System\'s VMware hardware version.'),
        'vmware_ipaddr':
        fields.String(required=False,
                      description='System\'s IP Address in VMware.'),
        'vmware_tools_version_status':
        fields.String(required=False,
                      description='VMware tools status on this Guest.'),
        'vmware_hostname':
        fields.String(required=False,
                      description='System\'s hostname in VMware.'),
        'puppet_certname':
        fields.String(required=False,
                      description='System\'s Puppet certificate name.'),
        'puppet_env':
        fields.String(required=False,
                      description='System\'s Puppet environment.'),
        'puppet_include_default':
        fields.Boolean(
            required=False,
            description='Whether to include the Puppet default classes.'),
        'puppet_classes':
        fields.String(required=False,
                      description='Puppet classes applied to this System'),
        'puppet_variables':
        fields.String(required=False,
                      description='Puppet variables applied to this System.'),
    })
Exemplo n.º 4
0
certificates_serializer = api_manager.model(
    'certificate', {
        'digest':
        fields.String(required=True,
                      description='The SHA-1 digest of the certificate'),
        'subjectCN':
        fields.String(
            required=False,
            description='The common name (CN) of the subject of the certificate'
        ),
        'subjectDN':
        fields.String(
            required=True,
            description=
            'The distinguished name (DN) of the subject of the certificate'),
        'notBefore':
        fields.DateTime(
            required=True,
            description='The date and time this certificate is valid from'),
        'notAfter':
        fields.DateTime(
            required=True,
            description='The date and time this certificate expires'),
        'issuerCN':
        fields.String(
            required=False,
            description='The common name (CN) of the issuer of the certificate'
        ),
        'issuerDN':
        fields.String(
            required=True,
            description=
            'The distinguished name (DN) of the issuer of the certificate'),
        'lastSeen':
        fields.DateTime(
            required=False,
            description=
            'The date and time that a certificate scan last identified this certificate on the network'
        ),
        'numHosts':
        fields.Integer(
            required=True,
            description=
            'The number of unique locations that the certificate has been discovered by certificate scans'
        ),
        'keySize':
        fields.Integer(
            required=True,
            description=
            'The size (in bits) of the key used with the certificate')
    })
Exemplo n.º 5
0
from cortex.api import api_manager
from cortex.api.serializers import pagination

tasks_serializer = api_manager.model(
    'task', {
        'id':
        fields.Integer(required=True, description='Task ID.'),
        'module':
        fields.String(required=True,
                      description='The module that started the task'),
        'username':
        fields.String(required=True,
                      description='The user that started the task'),
        'start':
        fields.DateTime(required=False,
                        description='The date and time this task was started'),
        'end':
        fields.DateTime(required=False,
                        description='The date and time this task finished'),
        'status':
        fields.Integer(
            required=True,
            description=
            'The status of the task - 0: in progress, 1: success, 2: failure, 3: warnings'
        ),
        'description':
        fields.String(required=False,
                      description='The description of the task'),
    })

page_tasks_serializer = api_manager.inherit(
    'Paginated tasks', pagination,
Exemplo n.º 6
0
from flask_restplus import fields
from cortex.api import api_manager
from cortex.api.serializers import pagination

# This is not actually getting used since nothing should be returned

puppet_serializer = api_manager.model(
    'puppet', {
        'id':
        fields.Integer(required=True, description='Entry ID'),
        'module_name':
        fields.String(required=True, description='Name of the puppet module'),
        'class_name':
        fields.String(required=True, description='Name of the puppet class'),
        'class_parameter':
        fields.String(required=False,
                      description='Name of the parameter in that class'),
        'description':
        fields.String(required=False,
                      description='The description of the parameter'),
        'tag_name':
        fields.String(required=False, description='Tag name for this entry'),
    })

page_puppet_serializer = api_manager.inherit(
    'Paginated puppet', pagination,
    {'items': fields.List(fields.Nested(puppet_serializer))})