Пример #1
0
class MessageModel(object):
    id = wtypes.StringType(min_length=1, max_length=255)
    message = wtypes.StringType(min_length=1, max_length=255)
    message_size = wtypes.IntegerType(minimum=1)
    message_from = wtypes.Enum(str, '1.OSOMATSU', '2.KARAMATSU',
                               '3.CHOROMATSU', '4.ICHIMATSU', '5.JUSHIMATSU',
                               '6.TODOMATSU')
Пример #2
0
class L7PolicyResponse(base.BaseType):
    """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())
    enabled = wtypes.wsattr(bool)
    action = wtypes.wsattr(wtypes.StringType())
    redirect_pool_id = wtypes.wsattr(wtypes.UuidType())
    redirect_url = wtypes.wsattr(wtypes.StringType())
    position = wtypes.wsattr(wtypes.IntegerType())
    l7rules = wtypes.wsattr([l7rule.L7RuleResponse])
    redirect_pool = wtypes.wsattr(pool.PoolResponse)

    @classmethod
    def from_data_model(cls, data_model, children=False):
        policy = super(L7PolicyResponse,
                       cls).from_data_model(data_model, children=children)
        if not children:
            del policy.l7rules
            del policy.redirect_pool
            return policy
        policy.l7rules = [
            l7rule.L7RuleResponse.from_data_model(l7rule_dm, children=children)
            for l7rule_dm in data_model.l7rules
        ]
        if policy.redirect_pool_id:
            policy.redirect_pool = pool.PoolResponse.from_data_model(
                data_model.redirect_pool, children=children)
        else:
            del policy.redirect_pool
            del policy.redirect_pool_id
        return policy
Пример #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))
Пример #4
0
class AvailabilityZoneProfilePOST(BaseAvailabilityZoneProfileType):
    """Defines mandatory and optional attributes of a POST request."""
    name = wtypes.wsattr(wtypes.StringType(max_length=255), mandatory=True)
    provider_name = wtypes.wsattr(wtypes.StringType(max_length=255),
                                  mandatory=True)
    availability_zone_data = wtypes.wsattr(wtypes.StringType(max_length=4096),
                                           mandatory=True)
Пример #5
0
class LoadBalancerResponse(base.BaseType):
    """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())
    enabled = wtypes.wsattr(bool)
    vip = wtypes.wsattr(VIP)
    project_id = wtypes.wsattr(wtypes.StringType())
    listeners = wtypes.wsattr([listener.ListenerResponse])
    created_at = wtypes.wsattr(wtypes.datetime.datetime)
    updated_at = wtypes.wsattr(wtypes.datetime.datetime)

    @classmethod
    def from_data_model(cls, data_model, children=False):
        lb = super(LoadBalancerResponse,
                   cls).from_data_model(data_model, children=children)
        # NOTE(blogan): VIP is technically a child but its the main piece of
        # a load balancer so it makes sense to show it no matter what.
        lb.vip = VIP.from_data_model(data_model.vip)
        if not children:
            # NOTE(blogan): don't show listeners if the request does not want
            # to see children
            del lb.listeners
            return lb
        lb.listeners = [
            listener.ListenerResponse.from_data_model(listener_dm,
                                                      children=children)
            for listener_dm in data_model.listeners
        ]
        return lb
Пример #6
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)
Пример #7
0
class MemberResponse(BaseMemberType):
    """Defines which attributes are to be shown on any response."""
    id = wtypes.wsattr(wtypes.UuidType())
    name = wtypes.wsattr(wtypes.StringType())
    operating_status = wtypes.wsattr(wtypes.StringType())
    provisioning_status = wtypes.wsattr(wtypes.StringType())
    admin_state_up = wtypes.wsattr(bool)
    address = wtypes.wsattr(types.IPAddressType())
    protocol_port = wtypes.wsattr(wtypes.IntegerType())
    weight = wtypes.wsattr(wtypes.IntegerType())
    subnet_id = wtypes.wsattr(wtypes.UuidType())
    # TODO(johnsom) Remove after deprecation (R series)
    project_id = wtypes.wsattr(wtypes.StringType())
    # TODO(johnsom) Remove after deprecation (R series)
    tenant_id = wtypes.wsattr(wtypes.StringType())
    created_at = wtypes.wsattr(wtypes.datetime.datetime)
    updated_at = wtypes.wsattr(wtypes.datetime.datetime)

    @classmethod
    def from_data_model(cls, data_model, children=False):
        member = super(MemberResponse, cls).from_data_model(
            data_model, children=children)
        member.tenant_id = data_model.project_id
        if not member.name:
            member.name = ""

        return member
Пример #8
0
class AvailabilityZonePOST(BaseAvailabilityZoneType):
    """Defines mandatory and optional attributes of a POST request."""
    name = wtypes.wsattr(wtypes.StringType(max_length=255), mandatory=True)
    description = wtypes.wsattr(wtypes.StringType(max_length=255))
    enabled = wtypes.wsattr(bool, default=True)
    availability_zone_profile_id = wtypes.wsattr(wtypes.UuidType(),
                                                 mandatory=True)
Пример #9
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
Пример #10
0
class LoadBalancerPOST(base.BaseType):
    """Defines mandatory and optional attributes of a POST request."""
    id = wtypes.wsattr(wtypes.UuidType())
    name = wtypes.wsattr(wtypes.StringType(max_length=255))
    description = wtypes.wsattr(wtypes.StringType(max_length=255))
    enabled = wtypes.wsattr(bool, default=True)
    vip = wtypes.wsattr(VIP, mandatory=True)
Пример #11
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))
Пример #12
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)))
Пример #13
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)
    # TODO(johnsom) Remove after deprecation (R series)
    project_id = wtypes.wsattr(wtypes.StringType())
    # TODO(johnsom) Remove after deprecation (R series)
    tenant_id = wtypes.wsattr(wtypes.StringType())
    pools = wtypes.wsattr([MinimalPool])
    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)

    @classmethod
    def from_data_model(cls, data_model, children=False):
        healthmonitor = super(HealthMonitorResponse,
                              cls).from_data_model(data_model,
                                                   children=children)
        healthmonitor.tenant_id = data_model.project_id
        healthmonitor.pools = [MinimalPool.from_data_model(data_model.pool)]
        return healthmonitor
Пример #14
0
class FlavorProfilePOST(BaseFlavorProfileType):
    """Defines mandatory and optional attributes of a POST request."""
    name = wtypes.wsattr(wtypes.StringType(max_length=255), mandatory=True)
    provider_name = wtypes.wsattr(wtypes.StringType(max_length=255),
                                  mandatory=True)
    flavor_data = wtypes.wsattr(wtypes.StringType(max_length=4096),
                                mandatory=True)
Пример #15
0
class MagnumService(base.APIBase):

    host = wtypes.StringType(min_length=1, max_length=255)
    """Name of the host """

    binary = wtypes.Enum(str, *fields.MagnumServiceBinary.ALL)
    """Name of the binary"""

    state = wtypes.Enum(str, *fields.MagnumServiceState.ALL)
    """State of the binary"""

    id = wsme.wsattr(wtypes.IntegerType(minimum=1))
    """The id for the healthcheck record """

    report_count = wsme.wsattr(wtypes.IntegerType(minimum=0))
    """The number of times the heartbeat was reported """

    # disabled = wsme.wsattr(wtypes.BoolType(default=False))
    """If the service is 'disabled' administratively """

    disabled_reason = wtypes.StringType(min_length=0, max_length=255)
    """Reason for disabling """
    def __init__(self, state, **kwargs):
        super(MagnumService, self).__init__()

        self.fields = ['state']
        setattr(self, 'state', state)
        for field in objects.MagnumService.fields:
            self.fields.append(field)
            setattr(self, field, kwargs.get(field, wtypes.Unset))
Пример #16
0
class AmphoraResponse(BaseAmphoraType):
    """Defines which attributes are to be shown on any response."""
    id = wtypes.wsattr(wtypes.UuidType())
    loadbalancer_id = wtypes.wsattr(wtypes.UuidType())
    compute_id = wtypes.wsattr(wtypes.UuidType())
    lb_network_ip = wtypes.wsattr(types.IPAddressType())
    vrrp_ip = wtypes.wsattr(types.IPAddressType())
    ha_ip = wtypes.wsattr(types.IPAddressType())
    vrrp_port_id = wtypes.wsattr(wtypes.UuidType())
    ha_port_id = wtypes.wsattr(wtypes.UuidType())
    cert_expiration = wtypes.wsattr(wtypes.datetime.datetime)
    cert_busy = wtypes.wsattr(bool)
    role = wtypes.wsattr(wtypes.StringType())
    status = wtypes.wsattr(wtypes.StringType())
    vrrp_interface = wtypes.wsattr(wtypes.StringType())
    vrrp_id = wtypes.wsattr(wtypes.IntegerType())
    vrrp_priority = wtypes.wsattr(wtypes.IntegerType())
    cached_zone = wtypes.wsattr(wtypes.StringType())
    created_at = wtypes.wsattr(wtypes.datetime.datetime)
    updated_at = wtypes.wsattr(wtypes.datetime.datetime)
    image_id = wtypes.wsattr(wtypes.UuidType())
    compute_flavor = wtypes.wsattr(wtypes.StringType())

    @classmethod
    def from_data_model(cls, data_model, children=False):
        amphorae = super(AmphoraResponse,
                         cls).from_data_model(data_model, children=children)

        return amphorae
Пример #17
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)))
Пример #18
0
class HealthMonitorStatusResponse(BaseHealthMonitorType):
    """Defines which attributes are to be shown on status response."""
    id = wtypes.wsattr(wtypes.UuidType())
    name = wtypes.wsattr(wtypes.StringType())
    type = wtypes.wsattr(wtypes.text)
    provisioning_status = wtypes.wsattr(wtypes.StringType())
    operating_status = wtypes.wsattr(wtypes.StringType())
Пример #19
0
class Cpulse(base.APIBase):
    """API representation of a test.

    This class enforces type checking and value constraints, and converts
    between the internal object model and the API representation of a test.
    """
    id = wtypes.IntegerType(minimum=1)

    uuid = types.uuid
    """Unique UUID for this test"""

    name = wtypes.StringType(min_length=1, max_length=255)
    """Name of this test"""

    state = wtypes.StringType(min_length=1, max_length=255)
    """State of this test"""

    cpulse_create_timeout = wtypes.IntegerType(minimum=0)
    """Timeout for creating the test in minutes. Set to 0 for no timeout."""
    links = wsme.wsattr([link.Link], readonly=True)
    """A list containing a self link and associated test links"""

    result = wtypes.StringType(min_length=1, max_length=4048)
    """Result of this test"""

    testtype = wtypes.StringType(min_length=1, max_length=255)

    def __init__(self, **kwargs):
        super(Cpulse, self).__init__()

        self.fields = []
        for field in objects.Cpulse.fields:
            # Skip fields we do not expose.
            if not hasattr(self, field):
                continue
            self.fields.append(field)
            setattr(self, field, kwargs.get(field, wtypes.Unset))

    @staticmethod
    def _convert_with_links(cpulse, url, expand=True):
        if not expand:
            cpulse.unset_fields_except(
                ['uuid', 'name', 'state', 'id', 'result', 'testtype'])
        return cpulse

    @classmethod
    def convert_with_links(cls, rpc_test, expand=True):
        test = Cpulse(**rpc_test.as_dict())
        return cls._convert_with_links(test, pecan.request.host_url, expand)

    @classmethod
    def sample(cls, expand=True):
        sample = cls(uuid='27e3153e-d5bf-4b7e-b517-fb518e17f34c',
                     name='example',
                     state="CREATED",
                     result="NotYetRun",
                     created_at=datetime.datetime.utcnow(),
                     updated_at=datetime.datetime.utcnow())
        return cls._convert_with_links(sample, 'http://localhost:9511', expand)
Пример #20
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.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
        ]

        return pool
Пример #21
0
class TestTypeRenameSubset(types.BaseType):
    _type_to_model_map = {
        'renamed': 'original',
        'child_one': 'child.one',
        'child_two': 'child.two'
    }
    id = wtypes.wsattr(wtypes.StringType())
    renamed = wtypes.wsattr(wtypes.StringType())
Пример #22
0
class L7RulePUT(base.BaseType):
    """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)
Пример #23
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)
Пример #24
0
class PoolPUT(base.BaseType):
    """Defines attributes that are acceptable of a PUT request."""
    name = wtypes.wsattr(wtypes.StringType())
    description = wtypes.wsattr(wtypes.StringType())
    enabled = wtypes.wsattr(bool)
    protocol = wtypes.wsattr(wtypes.text)
    lb_algorithm = wtypes.wsattr(wtypes.text)
    session_persistence = wtypes.wsattr(SessionPersistencePUT)
Пример #25
0
class L7RuleResponse(base.BaseType):
    """Defines which attributes are to be shown on any response."""
    id = wtypes.wsattr(wtypes.UuidType())
    type = wtypes.wsattr(wtypes.StringType())
    compare_type = wtypes.wsattr(wtypes.StringType())
    key = wtypes.wsattr(wtypes.StringType())
    value = wtypes.wsattr(wtypes.StringType())
    invert = wtypes.wsattr(bool)
Пример #26
0
class PoolPOST(base.BaseType):
    """Defines mandatory and optional attributes of a POST request."""
    id = wtypes.wsattr(wtypes.UuidType())
    name = wtypes.wsattr(wtypes.StringType(max_length=255))
    description = wtypes.wsattr(wtypes.StringType(max_length=255))
    enabled = wtypes.wsattr(bool, default=True)
    protocol = wtypes.wsattr(wtypes.text, mandatory=True)
    lb_algorithm = wtypes.wsattr(wtypes.text, mandatory=True)
    session_persistence = wtypes.wsattr(SessionPersistencePOST)
Пример #27
0
class PoolPUT(base.BaseType):
    """Defines attributes that are acceptable of a PUT request."""
    name = wtypes.wsattr(wtypes.StringType())
    description = wtypes.wsattr(wtypes.StringType())
    enabled = wtypes.wsattr(bool)
    protocol = wtypes.wsattr(wtypes.Enum(str, *constants.SUPPORTED_PROTOCOLS))
    lb_algorithm = wtypes.wsattr(
        wtypes.Enum(str, *constants.SUPPORTED_LB_ALGORITHMS))
    session_persistence = wtypes.wsattr(SessionPersistencePUT)
Пример #28
0
class LoadBalancerResponse(base.BaseType):
    """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())
    enabled = wtypes.wsattr(bool)
    vip = wtypes.wsattr(VIP)
Пример #29
0
class L7PolicyResponse(base.BaseType):
    """Defines which attributes are to be shown on any response."""
    id = wtypes.wsattr(wtypes.UuidType())
    name = wtypes.wsattr(wtypes.StringType(max_length=255))
    description = wtypes.wsattr(wtypes.StringType(max_length=255))
    enabled = wtypes.wsattr(bool)
    action = wtypes.wsattr(wtypes.StringType(max_length=255))
    redirect_pool_id = wtypes.wsattr(wtypes.StringType(max_length=255))
    redirect_url = wtypes.wsattr(wtypes.StringType(max_length=255))
    position = wtypes.wsattr(wtypes.IntegerType())
Пример #30
0
class L7PolicyPUT(base.BaseType):
    """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))
    enabled = wtypes.wsattr(bool)
    action = wtypes.wsattr(
        wtypes.Enum(str, *constants.SUPPORTED_L7POLICY_ACTIONS))
    redirect_pool_id = wtypes.wsattr(wtypes.StringType(max_length=255))
    redirect_url = wtypes.wsattr(base.URLType())
    position = wtypes.wsattr(wtypes.IntegerType())