Пример #1
0
class PoolPOST(BasePoolType):
    """Defines mandatory and optional attributes of a POST request."""
    name = wtypes.wsattr(wtypes.StringType(max_length=255))
    description = wtypes.wsattr(wtypes.StringType(max_length=255))
    admin_state_up = wtypes.wsattr(bool, default=True)
    listener_id = wtypes.wsattr(wtypes.UuidType())
    loadbalancer_id = wtypes.wsattr(wtypes.UuidType())
    protocol = wtypes.wsattr(wtypes.Enum(
        str, *lib_constants.POOL_SUPPORTED_PROTOCOLS),
                             mandatory=True)
    lb_algorithm = wtypes.wsattr(wtypes.Enum(
        str, *constants.SUPPORTED_LB_ALGORITHMS),
                                 mandatory=True)
    session_persistence = wtypes.wsattr(SessionPersistencePOST)
    # TODO(johnsom) Remove after deprecation (R series)
    project_id = wtypes.wsattr(wtypes.StringType(max_length=36))
    healthmonitor = wtypes.wsattr(health_monitor.HealthMonitorSingleCreate)
    members = wtypes.wsattr([member.MemberSingleCreate])
    tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType(max_length=255)))
    tls_container_ref = wtypes.wsattr(wtypes.StringType(max_length=255))
    ca_tls_container_ref = wtypes.wsattr(wtypes.StringType(max_length=255))
    crl_container_ref = wtypes.wsattr(wtypes.StringType(max_length=255))
    tls_enabled = wtypes.wsattr(bool, default=False)
    tls_ciphers = wtypes.wsattr(wtypes.StringType(max_length=2048))
    tls_versions = wtypes.wsattr(
        wtypes.ArrayType(wtypes.StringType(max_length=32)))
    alpn_protocols = wtypes.wsattr(wtypes.ArrayType(types.AlpnProtocolType()))
Пример #2
0
class ListenerResponse(BaseListenerType):
    """Defines which attributes are to be shown on any response."""
    id = wtypes.wsattr(wtypes.UuidType())
    name = wtypes.wsattr(wtypes.StringType())
    description = wtypes.wsattr(wtypes.StringType())
    provisioning_status = wtypes.wsattr(wtypes.StringType())
    operating_status = wtypes.wsattr(wtypes.StringType())
    admin_state_up = wtypes.wsattr(bool)
    protocol = wtypes.wsattr(wtypes.text)
    protocol_port = wtypes.wsattr(wtypes.IntegerType())
    connection_limit = wtypes.wsattr(wtypes.IntegerType())
    default_tls_container_ref = wtypes.wsattr(wtypes.StringType())
    sni_container_refs = [wtypes.StringType()]
    project_id = wtypes.wsattr(wtypes.StringType())
    default_pool_id = wtypes.wsattr(wtypes.UuidType())
    l7policies = wtypes.wsattr([types.IdOnlyType])
    insert_headers = wtypes.wsattr(wtypes.DictType(str, str))
    created_at = wtypes.wsattr(wtypes.datetime.datetime)
    updated_at = wtypes.wsattr(wtypes.datetime.datetime)
    loadbalancers = wtypes.wsattr([types.IdOnlyType])
    timeout_client_data = wtypes.wsattr(wtypes.IntegerType())
    timeout_member_connect = wtypes.wsattr(wtypes.IntegerType())
    timeout_member_data = wtypes.wsattr(wtypes.IntegerType())
    timeout_tcp_inspect = wtypes.wsattr(wtypes.IntegerType())
    tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType()))
    client_ca_tls_container_ref = wtypes.StringType()
    client_authentication = wtypes.wsattr(wtypes.StringType())
    client_crl_container_ref = wtypes.wsattr(wtypes.StringType())
    allowed_cidrs = wtypes.wsattr([types.CidrType()])
    tls_ciphers = wtypes.StringType()
    tls_versions = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType()))
    alpn_protocols = wtypes.wsattr(wtypes.ArrayType(types.AlpnProtocolType()))

    @classmethod
    def from_data_model(cls, data_model, children=False):
        listener = super(ListenerResponse,
                         cls).from_data_model(data_model, children=children)

        listener.sni_container_refs = [
            sni_c.tls_container_id for sni_c in data_model.sni_containers
        ]
        listener.allowed_cidrs = [c.cidr
                                  for c in data_model.allowed_cidrs] or None
        if cls._full_response():
            del listener.loadbalancers
            l7policy_type = l7policy.L7PolicyFullResponse
        else:
            listener.loadbalancers = [
                types.IdOnlyType.from_data_model(data_model.load_balancer)
            ]
            l7policy_type = types.IdOnlyType

        listener.l7policies = [
            l7policy_type.from_data_model(i) for i in data_model.l7policies
        ]

        listener.tls_versions = data_model.tls_versions
        listener.alpn_protocols = data_model.alpn_protocols

        return listener
Пример #3
0
class ListenerPUT(BaseListenerType):
    """Defines attributes that are acceptable of a PUT request."""
    name = wtypes.wsattr(wtypes.StringType(max_length=255))
    description = wtypes.wsattr(wtypes.StringType(max_length=255))
    admin_state_up = wtypes.wsattr(bool)
    connection_limit = wtypes.wsattr(
        wtypes.IntegerType(minimum=constants.MIN_CONNECTION_LIMIT))
    default_tls_container_ref = wtypes.wsattr(
        wtypes.StringType(max_length=255))
    sni_container_refs = [wtypes.StringType(max_length=255)]
    default_pool_id = wtypes.wsattr(wtypes.UuidType())
    insert_headers = wtypes.wsattr(
        wtypes.DictType(str, wtypes.StringType(max_length=255)))
    timeout_client_data = wtypes.wsattr(
        wtypes.IntegerType(minimum=constants.MIN_TIMEOUT,
                           maximum=constants.MAX_TIMEOUT))
    timeout_member_connect = wtypes.wsattr(
        wtypes.IntegerType(minimum=constants.MIN_TIMEOUT,
                           maximum=constants.MAX_TIMEOUT))
    timeout_member_data = wtypes.wsattr(
        wtypes.IntegerType(minimum=constants.MIN_TIMEOUT,
                           maximum=constants.MAX_TIMEOUT))
    timeout_tcp_inspect = wtypes.wsattr(
        wtypes.IntegerType(minimum=constants.MIN_TIMEOUT,
                           maximum=constants.MAX_TIMEOUT))
    tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType(max_length=255)))
    client_ca_tls_container_ref = wtypes.StringType(max_length=255)
    client_authentication = wtypes.wsattr(
        wtypes.Enum(str, *constants.SUPPORTED_CLIENT_AUTH_MODES))
    client_crl_container_ref = wtypes.StringType(max_length=255)
    allowed_cidrs = wtypes.wsattr([types.CidrType()])
    tls_ciphers = wtypes.StringType(max_length=2048)
    tls_versions = wtypes.wsattr(
        wtypes.ArrayType(wtypes.StringType(max_length=32)))
Пример #4
0
class NotificationWay(types.Base):
    notificationway_name = wsme.wsattr(wtypes.text, mandatory=False)
    host_notification_period = wsme.wsattr(wtypes.text, mandatory=False)
    service_notification_period = wsme.wsattr(wtypes.text, mandatory=False)
    host_notification_options = wsme.wsattr(wtypes.ArrayType(wtypes.text),
                                            mandatory=False)
    service_notification_options = wsme.wsattr(wtypes.ArrayType(wtypes.text),
                                               mandatory=False)
    host_notification_commands = wsme.wsattr(wtypes.ArrayType(wtypes.text),
                                             mandatory=False)
    service_notification_commands = wsme.wsattr(wtypes.ArrayType(wtypes.text),
                                                mandatory=False)
    min_business_impact = wsme.wsattr(int, mandatory=False)

    @classmethod
    def sample(cls):
        return cls(
            notificationway_name="email_in_day",
            host_notification_period="24x7",
            service_notification_period="24x7",
            host_notification_options=["d", "u", "r", "f", "s"],
            service_notification_options=["w", "u", "c", "r", "f"],
            service_notification_commands=["notify-service"],
            host_notification_commands=["notify-host"]
            )
Пример #5
0
class PoolResponse(BasePoolType):
    """Defines which attributes are to be shown on any response."""
    id = wtypes.wsattr(wtypes.UuidType())
    name = wtypes.wsattr(wtypes.StringType())
    description = wtypes.wsattr(wtypes.StringType())
    provisioning_status = wtypes.wsattr(wtypes.StringType())
    operating_status = wtypes.wsattr(wtypes.StringType())
    admin_state_up = wtypes.wsattr(bool)
    protocol = wtypes.wsattr(wtypes.text)
    lb_algorithm = wtypes.wsattr(wtypes.text)
    session_persistence = wtypes.wsattr(SessionPersistenceResponse)
    project_id = wtypes.wsattr(wtypes.StringType())
    loadbalancers = wtypes.wsattr([types.IdOnlyType])
    listeners = wtypes.wsattr([types.IdOnlyType])
    created_at = wtypes.wsattr(wtypes.datetime.datetime)
    updated_at = wtypes.wsattr(wtypes.datetime.datetime)
    healthmonitor_id = wtypes.wsattr(wtypes.UuidType())
    members = wtypes.wsattr([types.IdOnlyType])
    tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType()))
    tls_container_ref = wtypes.wsattr(wtypes.StringType())
    ca_tls_container_ref = wtypes.wsattr(wtypes.StringType())
    crl_container_ref = wtypes.wsattr(wtypes.StringType())
    tls_enabled = wtypes.wsattr(bool)
    tls_ciphers = wtypes.wsattr(wtypes.StringType())
    tls_versions = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType()))

    @classmethod
    def from_data_model(cls, data_model, children=False):
        pool = super(PoolResponse, cls).from_data_model(
            data_model, children=children)
        if data_model.session_persistence:
            pool.session_persistence = (
                SessionPersistenceResponse.from_data_model(
                    data_model.session_persistence))

        if cls._full_response():
            del pool.loadbalancers
            member_model = member.MemberFullResponse
            if pool.healthmonitor:
                pool.healthmonitor = (
                    health_monitor.HealthMonitorFullResponse
                    .from_data_model(data_model.health_monitor))
        else:
            if data_model.load_balancer:
                pool.loadbalancers = [
                    types.IdOnlyType.from_data_model(data_model.load_balancer)]
            else:
                pool.loadbalancers = []
            member_model = types.IdOnlyType
            if data_model.health_monitor:
                pool.healthmonitor_id = data_model.health_monitor.id
        pool.listeners = [
            types.IdOnlyType.from_data_model(i) for i in data_model.listeners]
        pool.members = [
            member_model.from_data_model(i) for i in data_model.members]

        pool.tls_versions = data_model.tls_versions

        return pool
Пример #6
0
class ContactGroup(types.Base):
    contactgroup_name = wsme.wsattr(wtypes.text, mandatory=False)
    members = wsme.wsattr(wtypes.ArrayType(wtypes.text), mandatory=False)
    alias = wsme.wsattr(wtypes.text, mandatory=False)
    contactgroup_members = wsme.wsattr(wtypes.ArrayType(wtypes.text),
                                       mandatory=False)

    @classmethod
    def sample(cls):
        return cls(contactgroup_name='novell-admins',
                   alias='Novell Administrators',
                   members=['jdoe', 'rtobert', 'tzach'])
Пример #7
0
class Host(types.Base):
    host_name = wsme.wsattr(wtypes.text, mandatory=False)
    """The name of the host"""

    address = wsme.wsattr(wtypes.text, mandatory=False)
    """The address of the host. Normally, this is an IP address."""

    max_check_attempts = wsme.wsattr(int, mandatory=False)

    check_period = wsme.wsattr(wtypes.text, mandatory=False)
    """The time period during which active checks of this host can be made."""

    contacts = wsme.wsattr(wtypes.ArrayType(wtypes.text), mandatory=False)
    """A list of the short names of the contacts that should be notified."""

    contact_groups = wsme.wsattr(wtypes.ArrayType(wtypes.text),
                                 mandatory=False)
    """List of the short names of contact groups that should be notified"""

    notification_interval = wsme.wsattr(int, mandatory=False)

    notification_period = wsme.wsattr(wtypes.text, mandatory=False)

    use = wsme.wsattr(wtypes.ArrayType(wtypes.text), mandatory=False)
    """The template to use for this host"""

    name = wsme.wsattr(wtypes.text, mandatory=False)

    # TODO(aviau): int!
    register = wsme.wsattr(wtypes.text, mandatory=False)

    check_interval = wsme.wsattr(int, mandatory=False)

    retry_interval = wsme.wsattr(int, mandatory=False)

    passive_checks_enabled = wsme.wsattr(wtypes.text, mandatory=False)

    # TODO(aviau): Custom fields starting without '_' should raise an error.
    custom_fields = wsme.wsattr(wtypes.DictType(wtypes.text, wtypes.text),
                                mandatory=False)
    """Custom fields for the host"""
    @classmethod
    def sample(cls):
        return cls(use=["generic-host"],
                   host_name="bogus-router",
                   address="192.168.1.254",
                   max_check_attempts=5,
                   check_period="24x7",
                   contacts=["admin", "carl"],
                   contact_groups=["router-admins"],
                   notification_interval=30,
                   notification_period="24x7",
                   custom_fields={"OS_AUTH_URL": "http://localhost:8080/v2"})
Пример #8
0
class Lease(base._Base):

    id = types.UuidType()
    "The UUID of the lease"

    name = wtypes.text
    "The name of the lease"

    start_date = types.Datetime(service.LEASE_DATE_FORMAT)
    "Datetime when the lease should start"

    end_date = types.Datetime(service.LEASE_DATE_FORMAT)
    "Datetime when the lease should end"

    user_id = types.UuidType(without_dashes=True)
    "The ID of the user who creates the lease"

    project_id = types.UuidType(without_dashes=True)
    "The ID of the project or tenant the lease belongs to"

    trust_id = types.UuidType(without_dashes=True)
    "The ID of the trust created for delegating the rights of the user"

    reservations = wtypes.ArrayType(wtypes.DictType(wtypes.text, wtypes.text))
    "The list of reservations belonging to the lease"

    events = wtypes.ArrayType(wtypes.DictType(wtypes.text, wtypes.text))
    "The list of events attached to the lease"

    before_end_date = types.Datetime(service.LEASE_DATE_FORMAT)
    "Datetime when some actions will be taken before lease ending"

    status = wtypes.text
    "The status of the lease"

    @classmethod
    def sample(cls):
        return cls(
            id=u'2bb8720a-0873-4d97-babf-0d906851a1eb',
            name=u'lease_test',
            start_date=u'2014-01-01 01:23',
            end_date=u'2014-02-01 13:37',
            user_id=u'efd8780712d24b389c705f5c2ac427ff',
            project_id=u'bd9431c18d694ad3803a8d4a6b89fd36',
            trust_id=u'35b17138b3644e6aa1318f3099c5be68',
            reservations=[{
                u'resource_id': u'1234',
                u'resource_type': u'physical:host'
            }],
            events=[],
            before_end_date=u'2014-02-01 10:37',
            status=u'ACTIVE',
        )
Пример #9
0
class ListenerPOST(BaseListenerType):
    """Defines mandatory and optional attributes of a POST request."""
    name = wtypes.wsattr(wtypes.StringType(max_length=255))
    description = wtypes.wsattr(wtypes.StringType(max_length=255))
    admin_state_up = wtypes.wsattr(bool, default=True)
    protocol = wtypes.wsattr(wtypes.Enum(str, *constants.SUPPORTED_PROTOCOLS),
                             mandatory=True)
    protocol_port = wtypes.wsattr(wtypes.IntegerType(
        minimum=constants.MIN_PORT_NUMBER, maximum=constants.MAX_PORT_NUMBER),
                                  mandatory=True)
    connection_limit = wtypes.wsattr(
        wtypes.IntegerType(minimum=constants.MIN_CONNECTION_LIMIT),
        default=constants.DEFAULT_CONNECTION_LIMIT)
    default_tls_container_ref = wtypes.wsattr(
        wtypes.StringType(max_length=255))
    sni_container_refs = [wtypes.StringType(max_length=255)]
    # TODO(johnsom) Remove after deprecation (R series)
    project_id = wtypes.wsattr(wtypes.StringType(max_length=36))
    default_pool_id = wtypes.wsattr(wtypes.UuidType())
    default_pool = wtypes.wsattr(pool.PoolSingleCreate)
    l7policies = wtypes.wsattr([l7policy.L7PolicySingleCreate], default=[])
    insert_headers = wtypes.wsattr(
        wtypes.DictType(str, wtypes.StringType(max_length=255)))
    loadbalancer_id = wtypes.wsattr(wtypes.UuidType(), mandatory=True)
    timeout_client_data = wtypes.wsattr(
        wtypes.IntegerType(minimum=constants.MIN_TIMEOUT,
                           maximum=constants.MAX_TIMEOUT),
        default=CONF.haproxy_amphora.timeout_client_data)
    timeout_member_connect = wtypes.wsattr(
        wtypes.IntegerType(minimum=constants.MIN_TIMEOUT,
                           maximum=constants.MAX_TIMEOUT),
        default=CONF.haproxy_amphora.timeout_member_connect)
    timeout_member_data = wtypes.wsattr(
        wtypes.IntegerType(minimum=constants.MIN_TIMEOUT,
                           maximum=constants.MAX_TIMEOUT),
        default=CONF.haproxy_amphora.timeout_member_data)
    timeout_tcp_inspect = wtypes.wsattr(
        wtypes.IntegerType(minimum=constants.MIN_TIMEOUT,
                           maximum=constants.MAX_TIMEOUT),
        default=CONF.haproxy_amphora.timeout_tcp_inspect)
    tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType(max_length=255)))
    client_ca_tls_container_ref = wtypes.StringType(max_length=255)
    client_authentication = wtypes.wsattr(wtypes.Enum(
        str, *constants.SUPPORTED_CLIENT_AUTH_MODES),
                                          default=constants.CLIENT_AUTH_NONE)
    client_crl_container_ref = wtypes.StringType(max_length=255)
    allowed_cidrs = wtypes.wsattr([types.CidrType()])
    tls_ciphers = wtypes.StringType(max_length=2048)
    tls_versions = wtypes.wsattr(
        wtypes.ArrayType(wtypes.StringType(max_length=32)))
    alpn_protocols = wtypes.wsattr(wtypes.ArrayType(types.AlpnProtocolType()))
Пример #10
0
class Service(types.Base):
    host_name = wsme.wsattr(wtypes.ArrayType(wtypes.text), mandatory=False)

    service_description = wsme.wsattr(wtypes.text, mandatory=False)

    check_command = wsme.wsattr(wtypes.text, mandatory=False)

    max_check_attempts = wsme.wsattr(int, mandatory=False)

    check_interval = wsme.wsattr(int, mandatory=False)

    retry_interval = wsme.wsattr(int, mandatory=False)

    check_period = wsme.wsattr(wtypes.text, mandatory=False)

    notification_interval = wsme.wsattr(int, mandatory=False)

    notification_period = wsme.wsattr(wtypes.text, mandatory=False)

    contacts = wsme.wsattr(wtypes.ArrayType(wtypes.text), mandatory=False)

    contact_groups = wsme.wsattr(wtypes.ArrayType(wtypes.text),
                                 mandatory=False)

    passive_checks_enabled = wsme.wsattr(wtypes.text, mandatory=False)

    use = wsme.wsattr(wtypes.ArrayType(wtypes.text), mandatory=False)

    name = wsme.wsattr(wtypes.text, mandatory=False)

    register = wsme.wsattr(wtypes.text, mandatory=False)

    @classmethod
    def sample(cls):
        return cls(
            host_name=["sample-server"],
            service_description="check-disk-sdb",
            check_command="check-disk!/dev/sdb1",
            max_check_attempts=5,
            check_interval=5,
            retry_interval=3,
            check_period="24x7",
            notification_interval=3,
            notification_period="24x7",
            contacts=["surveil-ptl", "surveil-bob"],
            contact_groups=["linux-admins"],
            passive_checks_enabled='1',
        )
Пример #11
0
class Person(wtypes.Base):
    user_id = wtypes.text
    name = wtypes.text
    gender = wtypes.text
    age = int
    email = wtypes.text
    phone = wtypes.ArrayType(wtypes.text)
Пример #12
0
class L7PolicyResponse(BaseL7PolicyType):
    """Defines which attributes are to be shown on any response."""
    id = wtypes.wsattr(wtypes.UuidType())
    name = wtypes.wsattr(wtypes.StringType())
    description = wtypes.wsattr(wtypes.StringType())
    provisioning_status = wtypes.wsattr(wtypes.StringType())
    operating_status = wtypes.wsattr(wtypes.StringType())
    admin_state_up = wtypes.wsattr(bool)
    project_id = wtypes.wsattr(wtypes.StringType())
    action = wtypes.wsattr(wtypes.StringType())
    listener_id = wtypes.wsattr(wtypes.UuidType())
    redirect_pool_id = wtypes.wsattr(wtypes.UuidType())
    redirect_url = wtypes.wsattr(wtypes.StringType())
    redirect_prefix = wtypes.wsattr(wtypes.StringType())
    position = wtypes.wsattr(wtypes.IntegerType())
    rules = wtypes.wsattr([types.IdOnlyType])
    created_at = wtypes.wsattr(wtypes.datetime.datetime)
    updated_at = wtypes.wsattr(wtypes.datetime.datetime)
    tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType()))
    redirect_http_code = wtypes.wsattr(wtypes.IntegerType())

    @classmethod
    def from_data_model(cls, data_model, children=False):
        policy = super(L7PolicyResponse,
                       cls).from_data_model(data_model, children=children)

        if cls._full_response():
            rule_model = l7rule.L7RuleFullResponse
        else:
            rule_model = types.IdOnlyType
        policy.rules = [
            rule_model.from_data_model(i) for i in data_model.l7rules
        ]
        return policy
Пример #13
0
class WorklistFilter(base.APIBase):
    """Represents a set of criteria to filter items using AND."""

    type = wtypes.text
    """The type of objects to filter, Story or Task."""

    list_id = int
    """The ID of the Worklist this filter is for."""

    filter_criteria = wtypes.ArrayType(FilterCriterion)
    """The list of criteria to apply."""
    @nodoc
    def resolve_criteria(self, filter):
        self.filter_criteria = [
            FilterCriterion.from_db_model(criterion)
            for criterion in filter.criteria
        ]

    @classmethod
    def sample(cls):
        return cls(type='Task',
                   list_id=1,
                   filter_criteria=[
                       FilterCriterion(type='Task',
                                       title='TaskStatus',
                                       filter_id=1,
                                       negative=True,
                                       value='merged',
                                       field='status')
                   ])
Пример #14
0
class ListenerPUT(BaseListenerType):
    """Defines attributes that are acceptable of a PUT request."""
    name = wtypes.wsattr(wtypes.StringType(max_length=255))
    description = wtypes.wsattr(wtypes.StringType(max_length=255))
    admin_state_up = wtypes.wsattr(bool)
    connection_limit = wtypes.wsattr(
        wtypes.IntegerType(minimum=constants.MIN_CONNECTION_LIMIT))
    default_tls_container_ref = wtypes.wsattr(
        wtypes.StringType(max_length=255))
    sni_container_refs = [wtypes.StringType(max_length=255)]
    default_pool_id = wtypes.wsattr(wtypes.UuidType())
    insert_headers = wtypes.wsattr(
        wtypes.DictType(str, wtypes.StringType(max_length=255)))
    timeout_client_data = wtypes.wsattr(
        wtypes.IntegerType(minimum=constants.MIN_TIMEOUT,
                           maximum=constants.MAX_TIMEOUT))
    timeout_member_connect = wtypes.wsattr(
        wtypes.IntegerType(minimum=constants.MIN_TIMEOUT,
                           maximum=constants.MAX_TIMEOUT))
    timeout_member_data = wtypes.wsattr(
        wtypes.IntegerType(minimum=constants.MIN_TIMEOUT,
                           maximum=constants.MAX_TIMEOUT))
    timeout_tcp_inspect = wtypes.wsattr(
        wtypes.IntegerType(minimum=constants.MIN_TIMEOUT,
                           maximum=constants.MAX_TIMEOUT))
    tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType(max_length=255)))
Пример #15
0
class PoolPUT(BasePoolType):
    """Defines attributes that are acceptable of a PUT request."""
    name = wtypes.wsattr(wtypes.StringType(max_length=255))
    description = wtypes.wsattr(wtypes.StringType(max_length=255))
    admin_state_up = wtypes.wsattr(bool)
    lb_algorithm = wtypes.wsattr(
        wtypes.Enum(str, *constants.SUPPORTED_LB_ALGORITHMS))
    session_persistence = wtypes.wsattr(SessionPersistencePUT)
    tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType(max_length=255)))
    tls_container_ref = wtypes.wsattr(wtypes.StringType(max_length=255))
    ca_tls_container_ref = wtypes.wsattr(wtypes.StringType(max_length=255))
    crl_container_ref = wtypes.wsattr(wtypes.StringType(max_length=255))
    tls_enabled = wtypes.wsattr(bool)
    tls_ciphers = wtypes.wsattr(wtypes.StringType(max_length=2048))
    tls_versions = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType(
        max_length=32)))
Пример #16
0
class UserDetailRespone(base.BaseType):
    user_id = wtypes.wsattr(wtypes.UuidType())
    name = wtypes.text
    gender = wtypes.text
    age = int
    email = wtypes.text
    telephone = wtypes.ArrayType(wtypes.text)
Пример #17
0
class DeployablesController(base.CyborgController, DeployableCollection):
    """REST controller for Deployables."""
    @policy.authorize_wsgi("cyborg:deployable", "get_one")
    @expose.expose(Deployable, types.uuid)
    def get_one(self, uuid):
        """Retrieve information about the given deployable.

        :param uuid: UUID of a deployable.
        """
        obj_dep = objects.Deployable.get(pecan.request.context, uuid)
        return self.convert_with_link(obj_dep)

    @policy.authorize_wsgi("cyborg:deployable", "get_all")
    @expose.expose(DeployableCollection, wtypes.ArrayType(types.FilterType))
    def get_all(self, filters=None):
        """Retrieve a list of deployables.
        :param filters: a filter of FilterType to get deployables list by
        filter.
        """
        filters_dict = {}
        if filters:
            for filter in filters:
                filters_dict.update(filter.as_dict())
        context = pecan.request.context
        obj_deps = objects.Deployable.list(context, filters=filters_dict)
        return self.convert_with_links(obj_deps)
Пример #18
0
class HealthMonitorResponse(BaseHealthMonitorType):
    """Defines which attributes are to be shown on any response."""
    id = wtypes.wsattr(wtypes.UuidType())
    name = wtypes.wsattr(wtypes.StringType())
    type = wtypes.wsattr(wtypes.text)
    delay = wtypes.wsattr(wtypes.IntegerType())
    timeout = wtypes.wsattr(wtypes.IntegerType())
    max_retries = wtypes.wsattr(wtypes.IntegerType())
    max_retries_down = wtypes.wsattr(wtypes.IntegerType())
    http_method = wtypes.wsattr(wtypes.text)
    url_path = wtypes.wsattr(wtypes.text)
    expected_codes = wtypes.wsattr(wtypes.text)
    admin_state_up = wtypes.wsattr(bool)
    project_id = wtypes.wsattr(wtypes.StringType())
    pools = wtypes.wsattr([types.IdOnlyType])
    provisioning_status = wtypes.wsattr(wtypes.StringType())
    operating_status = wtypes.wsattr(wtypes.StringType())
    created_at = wtypes.wsattr(wtypes.datetime.datetime)
    updated_at = wtypes.wsattr(wtypes.datetime.datetime)
    tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType()))

    @classmethod
    def from_data_model(cls, data_model, children=False):
        healthmonitor = super(HealthMonitorResponse, cls).from_data_model(
            data_model, children=children)

        if cls._full_response():
            del healthmonitor.pools
        else:
            healthmonitor.pools = [
                types.IdOnlyType.from_data_model(data_model.pool)]
        return healthmonitor
Пример #19
0
class HealthMonitorPOST(BaseHealthMonitorType):
    """Defines mandatory and optional attributes of a POST request."""
    name = wtypes.wsattr(wtypes.StringType(max_length=255))
    type = wtypes.wsattr(
        wtypes.Enum(str, *constants.SUPPORTED_HEALTH_MONITOR_TYPES),
        mandatory=True)
    delay = wtypes.wsattr(wtypes.IntegerType(minimum=0), mandatory=True)
    timeout = wtypes.wsattr(wtypes.IntegerType(minimum=0), mandatory=True)
    max_retries_down = wtypes.wsattr(
        wtypes.IntegerType(minimum=constants.MIN_HM_RETRIES,
                           maximum=constants.MAX_HM_RETRIES), default=3)
    max_retries = wtypes.wsattr(
        wtypes.IntegerType(minimum=constants.MIN_HM_RETRIES,
                           maximum=constants.MAX_HM_RETRIES),
        mandatory=True)
    http_method = wtypes.wsattr(
        wtypes.Enum(str, *constants.SUPPORTED_HEALTH_MONITOR_HTTP_METHODS))
    url_path = wtypes.wsattr(
        types.URLPathType())
    expected_codes = wtypes.wsattr(
        wtypes.StringType(pattern=r'^(\d{3}(\s*,\s*\d{3})*)$|^(\d{3}-\d{3})$'))
    admin_state_up = wtypes.wsattr(bool, default=True)
    # TODO(johnsom) Remove after deprecation (R series)
    project_id = wtypes.wsattr(wtypes.StringType(max_length=36))
    pool_id = wtypes.wsattr(wtypes.UuidType(), mandatory=True)
    tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType(max_length=255)))
Пример #20
0
class HealthMonitorSingleCreate(BaseHealthMonitorType):
    """Defines mandatory and optional attributes of a POST request."""
    name = wtypes.wsattr(wtypes.StringType(max_length=255))
    type = wtypes.wsattr(wtypes.Enum(
        str, *constants.SUPPORTED_HEALTH_MONITOR_TYPES),
                         mandatory=True)
    delay = wtypes.wsattr(wtypes.IntegerType(minimum=0), mandatory=True)
    timeout = wtypes.wsattr(wtypes.IntegerType(minimum=0), mandatory=True)
    max_retries_down = wtypes.wsattr(
        wtypes.IntegerType(minimum=constants.MIN_HM_RETRIES,
                           maximum=constants.MAX_HM_RETRIES),
        default=constants.DEFAULT_MAX_RETRIES_DOWN)
    max_retries = wtypes.wsattr(wtypes.IntegerType(
        minimum=constants.MIN_HM_RETRIES, maximum=constants.MAX_HM_RETRIES),
                                mandatory=True)
    http_method = wtypes.wsattr(
        wtypes.Enum(str, *constants.SUPPORTED_HEALTH_MONITOR_HTTP_METHODS))
    url_path = wtypes.wsattr(types.URLPathType())
    expected_codes = wtypes.wsattr(
        wtypes.StringType(pattern=r'^(\d{3}(\s*,\s*\d{3})*)$|^(\d{3}-\d{3})$'))
    admin_state_up = wtypes.wsattr(bool, default=True)
    tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType(max_length=255)))
    http_version = wtypes.wsattr(
        wtypes.Enum(float, *constants.SUPPORTED_HTTP_VERSIONS))
    domain_name = wtypes.wsattr(
        wtypes.StringType(min_length=1,
                          max_length=255,
                          pattern=constants.DOMAIN_NAME_REGEX))
Пример #21
0
class LoadBalancerPUT(BaseLoadBalancerType):
    """Defines attributes that are acceptable of a PUT request."""

    name = wtypes.wsattr(wtypes.StringType(max_length=255))
    description = wtypes.wsattr(wtypes.StringType(max_length=255))
    vip_qos_policy_id = wtypes.wsattr(wtypes.UuidType())
    admin_state_up = wtypes.wsattr(bool)
    tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType(max_length=255)))
Пример #22
0
class ServiceGroup(types.Base):
    servicegroup_name = wsme.wsattr(wtypes.text, mandatory=False)
    members = wsme.wsattr(wtypes.ArrayType(wtypes.text), mandatory=False)
    alias = wsme.wsattr(wtypes.text, mandatory=False)
    servicegroup_members = wsme.wsattr(wtypes.ArrayType(wtypes.text),
                                       mandatory=False)
    notes = wsme.wsattr(wtypes.text, mandatory=False)
    notes_url = wsme.wsattr(wtypes.text, mandatory=False)
    action_url = wsme.wsattr(wtypes.text, mandatory=False)

    @classmethod
    def sample(cls):
        return cls(servicegroup_name='dbservices',
                   alias='Database Services',
                   members=[
                       'ms1', 'SQL Server', 'ms1', 'SQL Serverc Agent', 'ms1',
                       'SQL DTC'
                   ])
Пример #23
0
class Contact(types.Base):
    contact_name = wsme.wsattr(wtypes.text, mandatory=False)

    host_notifications_enabled = wsme.wsattr(int, mandatory=False)

    service_notifications_enabled = wsme.wsattr(int, mandatory=False)

    host_notification_period = wsme.wsattr(wtypes.text, mandatory=False)

    service_notification_period = wsme.wsattr(wtypes.text, mandatory=False)

    host_notification_options = wsme.wsattr(wtypes.ArrayType(wtypes.text),
                                            mandatory=False)

    service_notification_options = wsme.wsattr(wtypes.ArrayType(wtypes.text),
                                               mandatory=False)

    host_notification_commands = wsme.wsattr(wtypes.ArrayType(wtypes.text),
                                             mandatory=False)

    service_notification_commands = wsme.wsattr(wtypes.ArrayType(wtypes.text),
                                                mandatory=False)

    email = wsme.wsattr(wtypes.text, mandatory=False)

    pager = wsme.wsattr(wtypes.text, mandatory=False)

    can_submit_commands = wsme.wsattr(int, mandatory=False)

    is_admin = wsme.wsattr(int, mandatory=False)

    retain_status_information = wsme.wsattr(int, mandatory=False)

    retain_nonstatus_information = wsme.wsattr(int, mandatory=False)

    min_business_impact = wsme.wsattr(int, mandatory=False)

    @classmethod
    def sample(cls):
        return cls(
            contact_name='admin',
            host_notifications_enabled=1,
            service_notifications_enabled=1,
        )
Пример #24
0
class Task(base.APIBase):
    """A Task represents an actionable work item, targeting a specific Project
    and a specific branch. It is part of a Story. There may be multiple tasks
    in a story, pointing to different projects or different branches. Each task
    is generally linked to a code change proposed in Gerrit.
    """

    title = wtypes.text
    """An optional short label for the task, to show in listings."""

    # TODO(ruhe): replace with enum
    status = wtypes.text
    """Status.
    Allowed values: ['todo', 'inprogress', 'invalid', 'review', 'merged'].
    Human readable versions are left to the UI.
    """

    creator_id = int
    """Id of the User who has created this Task"""

    story_id = int
    """The ID of the corresponding Story."""

    link = wtypes.text
    """A related resource for this task."""

    project_id = int
    """The ID of the corresponding Project."""

    assignee_id = int
    """The ID of the invidiual to whom this task is assigned."""

    priority = wtypes.text
    """The priority for this task, one of 'low', 'medium', 'high'"""

    branch_id = int
    """The ID of corresponding Branch"""

    milestone_id = int
    """The ID of corresponding Milestone"""

    due_dates = wtypes.ArrayType(int)
    """The IDs of due dates related to this task."""
    @classmethod
    def sample(cls):
        return cls(title="My really important task.",
                   status="todo",
                   creator_id=1,
                   story_id=3456,
                   link="Some notes about the task, this name is bad.",
                   project_id=1,
                   assignee_id=1,
                   priority="medium",
                   branch_id=1,
                   milestone_id=1,
                   due_dates=[1, 2, 3])
Пример #25
0
class L7RulePUT(BaseL7Type):
    """Defines attributes that are acceptable of a PUT request."""
    type = wtypes.wsattr(wtypes.Enum(str, *constants.SUPPORTED_L7RULE_TYPES))
    compare_type = wtypes.wsattr(
        wtypes.Enum(str, *constants.SUPPORTED_L7RULE_COMPARE_TYPES))
    key = wtypes.wsattr(wtypes.StringType(max_length=255))
    value = wtypes.wsattr(wtypes.StringType(max_length=255))
    invert = wtypes.wsattr(bool)
    admin_state_up = wtypes.wsattr(bool)
    tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType(max_length=255)))
Пример #26
0
class PoolSingleCreate(BasePoolType):
    """Defines mandatory and optional attributes of a POST request."""
    name = wtypes.wsattr(wtypes.StringType(max_length=255))
    description = wtypes.wsattr(wtypes.StringType(max_length=255))
    admin_state_up = wtypes.wsattr(bool, default=True)
    protocol = wtypes.wsattr(wtypes.Enum(str, *constants.SUPPORTED_PROTOCOLS))
    lb_algorithm = wtypes.wsattr(
        wtypes.Enum(str, *constants.SUPPORTED_LB_ALGORITHMS))
    session_persistence = wtypes.wsattr(SessionPersistencePOST)
    healthmonitor = wtypes.wsattr(health_monitor.HealthMonitorSingleCreate)
    members = wtypes.wsattr([member.MemberSingleCreate])
    tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType(max_length=255)))
    tls_container_ref = wtypes.wsattr(wtypes.StringType(max_length=255))
    ca_tls_container_ref = wtypes.wsattr(wtypes.StringType(max_length=255))
    crl_container_ref = wtypes.wsattr(wtypes.StringType(max_length=255))
    tls_enabled = wtypes.wsattr(bool, default=False)
    tls_ciphers = wtypes.StringType(max_length=2048)
    tls_versions = wtypes.wsattr(
        wtypes.ArrayType(wtypes.StringType(max_length=32)))
Пример #27
0
class Realm(types.Base):
    realm_name = wsme.wsattr(wtypes.text, mandatory=False)
    realm_members = wsme.wsattr(wtypes.ArrayType(wtypes.text), mandatory=False)
    default = wsme.wsattr(int, mandatory=False)

    @classmethod
    def sample(cls):
        return cls(realm_name='World',
                   realm_members=['Europe', 'America', 'Asia'],
                   default=0)
Пример #28
0
class HostGroup(types.Base):
    hostgroup_name = wsme.wsattr(wtypes.text, mandatory=False)
    members = wsme.wsattr(wtypes.ArrayType(wtypes.text), mandatory=False)
    alias = wsme.wsattr(wtypes.text, mandatory=False)
    hostgroup_members = wsme.wsattr(wtypes.ArrayType(wtypes.text),
                                    mandatory=False)
    notes = wsme.wsattr(wtypes.text, mandatory=False)
    notes_url = wsme.wsattr(wtypes.text, mandatory=False)
    action_url = wsme.wsattr(wtypes.text, mandatory=False)

    @classmethod
    def sample(cls):
        return cls(
            hostgroup_name='dbservices',
            alias='Novell Servers',
            members=['netware1',
                     'netware2',
                     'netware3',
                     'netware4']
        )
Пример #29
0
class APIVersions(resources.Resource):
    """API Versions."""
    versions = wtypes.ArrayType(APIVersion)

    @classmethod
    def sample(cls):
        v1 = APIVersion(id='v1.0',
                        status='CURRENT',
                        rel="self",
                        href='http://example.com:7070/v1')
        return cls(versions=[v1])
Пример #30
0
class APIVersions(resource.Resource):
    """API Versions."""
    versions = wtypes.ArrayType(APIVersion)

    @classmethod
    def sample(cls):
        v2 = APIVersion(id='v2.0',
                        status='CURRENT',
                        rel="self",
                        href='http://example.com:9777/v2')
        return cls(versions=[v2])