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
class MemberSingleCreate(BaseMemberType): """Defines mandatory and optional attributes of a POST request.""" name = wtypes.wsattr(wtypes.StringType(max_length=255)) admin_state_up = wtypes.wsattr(bool, default=True) address = wtypes.wsattr(types.IPAddressType(), mandatory=True) protocol_port = wtypes.wsattr(wtypes.IntegerType( minimum=constants.MIN_PORT_NUMBER, maximum=constants.MAX_PORT_NUMBER), mandatory=True) weight = wtypes.wsattr(wtypes.IntegerType( minimum=constants.MIN_WEIGHT, maximum=constants.MAX_WEIGHT), default=1) subnet_id = wtypes.wsattr(wtypes.UuidType()) monitor_port = wtypes.wsattr(wtypes.IntegerType( minimum=constants.MIN_PORT_NUMBER, maximum=constants.MAX_PORT_NUMBER)) monitor_address = wtypes.wsattr(types.IPAddressType())
class MemberPOST(base.BaseType): """Defines mandatory and optional attributes of a POST request.""" id = wtypes.wsattr(wtypes.UuidType()) enabled = wtypes.wsattr(bool, default=True) ip_address = wtypes.wsattr(base.IPAddressType(), mandatory=True) protocol_port = wtypes.wsattr(wtypes.IntegerType(), mandatory=True) weight = wtypes.wsattr(wtypes.IntegerType(), default=1) subnet_id = wtypes.wsattr(wtypes.UuidType()) # TODO(johnsom) Remove after deprecation (R series) project_id = wtypes.wsattr(wtypes.StringType(max_length=36)) monitor_port = wtypes.wsattr(wtypes.IntegerType( minimum=constants.MIN_PORT_NUMBER, maximum=constants.MAX_PORT_NUMBER), default=None) monitor_address = wtypes.wsattr(base.IPAddressType(), default=None)
class MemberResponse(base.BaseType): """Defines which attributes are to be shown on any response.""" id = wtypes.wsattr(wtypes.UuidType()) operating_status = wtypes.wsattr(wtypes.StringType()) enabled = wtypes.wsattr(bool) ip_address = wtypes.wsattr(base.IPAddressType()) protocol_port = wtypes.wsattr(wtypes.IntegerType()) weight = wtypes.wsattr(wtypes.IntegerType()) subnet_id = wtypes.wsattr(wtypes.UuidType()) project_id = wtypes.wsattr(wtypes.StringType()) created_at = wtypes.wsattr(wtypes.datetime.datetime) updated_at = wtypes.wsattr(wtypes.datetime.datetime) monitor_address = wtypes.wsattr(base.IPAddressType()) monitor_port = wtypes.wsattr(wtypes.IntegerType())
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
class SessionPersistencePUT(types.BaseType): """Defines attributes that are acceptable of a PUT request.""" type = wtypes.wsattr(wtypes.Enum(str, *constants.SUPPORTED_SP_TYPES)) cookie_name = wtypes.wsattr(wtypes.StringType(max_length=255), default=None) persistence_timeout = wtypes.wsattr(wtypes.IntegerType(), default=None) persistence_granularity = wtypes.wsattr(types.IPAddressType(), default=None)
class MemberPOST(BaseMemberType): """Defines mandatory and optional attributes of a POST request.""" name = wtypes.wsattr(wtypes.StringType(max_length=255)) admin_state_up = wtypes.wsattr(bool, default=True) address = wtypes.wsattr(types.IPAddressType(), mandatory=True) protocol_port = wtypes.wsattr(wtypes.IntegerType( minimum=constants.MIN_PORT_NUMBER, maximum=constants.MAX_PORT_NUMBER), mandatory=True) weight = wtypes.wsattr(wtypes.IntegerType( minimum=constants.MIN_WEIGHT, maximum=constants.MAX_WEIGHT), default=1) backup = wtypes.wsattr(bool, default=False) subnet_id = wtypes.wsattr(wtypes.UuidType()) # TODO(johnsom) Remove after deprecation (R series) project_id = wtypes.wsattr(wtypes.StringType(max_length=36)) monitor_port = wtypes.wsattr(wtypes.IntegerType( minimum=constants.MIN_PORT_NUMBER, maximum=constants.MAX_PORT_NUMBER), default=None) monitor_address = wtypes.wsattr(types.IPAddressType(), default=None)
class MemberPUT(BaseMemberType): """Defines attributes that are acceptable of a PUT request.""" name = wtypes.wsattr(wtypes.StringType(max_length=255)) admin_state_up = wtypes.wsattr(bool) weight = wtypes.wsattr(wtypes.IntegerType( minimum=constants.MIN_WEIGHT, maximum=constants.MAX_WEIGHT)) monitor_port = wtypes.wsattr(wtypes.IntegerType( minimum=constants.MIN_PORT_NUMBER, maximum=constants.MAX_PORT_NUMBER)) monitor_address = wtypes.wsattr(types.IPAddressType())
class SessionPersistencePOST(types.BaseType): """Defines mandatory and optional attributes of a POST request.""" type = wtypes.wsattr(wtypes.Enum(str, *constants.SUPPORTED_SP_TYPES), mandatory=True) cookie_name = wtypes.wsattr(wtypes.StringType(max_length=255), default=None) persistence_timeout = wtypes.wsattr(wtypes.IntegerType(), default=None) persistence_granularity = wtypes.wsattr(types.IPAddressType(), default=None)
class MemberPUT(base.BaseType): """Defines attributes that are acceptable of a PUT request.""" protocol_port = wtypes.wsattr(wtypes.IntegerType()) enabled = wtypes.wsattr(bool) weight = wtypes.wsattr(wtypes.IntegerType()) monitor_address = wtypes.wsattr(base.IPAddressType()) monitor_port = wtypes.wsattr( wtypes.IntegerType(minimum=constants.MIN_PORT_NUMBER, maximum=constants.MAX_PORT_NUMBER))
class LoadBalancerResponse(BaseLoadBalancerType): """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()) created_at = wtypes.wsattr(wtypes.datetime.datetime) updated_at = wtypes.wsattr(wtypes.datetime.datetime) vip_address = wtypes.wsattr(types.IPAddressType()) vip_port_id = wtypes.wsattr(wtypes.UuidType()) vip_subnet_id = wtypes.wsattr(wtypes.UuidType()) vip_network_id = wtypes.wsattr(wtypes.UuidType()) listeners = wtypes.wsattr([types.IdOnlyType]) pools = wtypes.wsattr([types.IdOnlyType]) provider = wtypes.wsattr(wtypes.StringType()) flavor_id = wtypes.wsattr(wtypes.UuidType()) vip_qos_policy_id = wtypes.wsattr(wtypes.UuidType()) tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType())) distributor = wtypes.wsattr(wtypes.UuidType()) amphora_number = wtypes.wsattr(wtypes.IntegerType()) expected_amphora_number = wtypes.wsattr(wtypes.IntegerType()) @classmethod def from_data_model(cls, data_model, children=False): result = super(LoadBalancerResponse, cls).from_data_model(data_model, children=children) if data_model.vip: result.vip_subnet_id = data_model.vip.subnet_id result.vip_port_id = data_model.vip.port_id result.vip_address = data_model.vip.ip_address result.vip_network_id = data_model.vip.network_id result.vip_qos_policy_id = data_model.vip.qos_policy_id if cls._full_response(): listener_model = listener.ListenerFullResponse pool_model = pool.PoolFullResponse else: listener_model = types.IdOnlyType pool_model = types.IdOnlyType result.listeners = [ listener_model.from_data_model(i) for i in data_model.listeners ] result.pools = [ pool_model.from_data_model(i) for i in data_model.pools ] if not result.provider: result.provider = "octavia" return result
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()) project_id = wtypes.wsattr(wtypes.StringType()) created_at = wtypes.wsattr(wtypes.datetime.datetime) updated_at = wtypes.wsattr(wtypes.datetime.datetime) monitor_address = wtypes.wsattr(types.IPAddressType()) monitor_port = wtypes.wsattr(wtypes.IntegerType()) @classmethod def from_data_model(cls, data_model, children=False): member = super(MemberResponse, cls).from_data_model(data_model, children=children) return member
class LoadBalancerPOST(BaseLoadBalancerType): """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) vip_address = wtypes.wsattr(types.IPAddressType()) vip_port_id = wtypes.wsattr(wtypes.UuidType()) vip_subnet_id = wtypes.wsattr(wtypes.UuidType()) vip_network_id = wtypes.wsattr(wtypes.UuidType()) project_id = wtypes.wsattr(wtypes.StringType(max_length=36)) tenant_id = wtypes.wsattr(wtypes.StringType(max_length=36)) listeners = wtypes.wsattr([listener.ListenerPOST], default=[])
class LoadBalancerPOST(BaseLoadBalancerType): """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) vip_address = wtypes.wsattr(types.IPAddressType()) vip_port_id = wtypes.wsattr(wtypes.UuidType()) vip_subnet_id = wtypes.wsattr(wtypes.UuidType()) vip_network_id = wtypes.wsattr(wtypes.UuidType()) vip_qos_policy_id = wtypes.wsattr(wtypes.UuidType()) project_id = wtypes.wsattr(wtypes.StringType(max_length=36)) listeners = wtypes.wsattr([listener.ListenerSingleCreate], default=[]) pools = wtypes.wsattr([pool.PoolSingleCreate], default=[]) provider = wtypes.wsattr(wtypes.StringType(max_length=64)) tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType(max_length=255))) flavor_id = wtypes.wsattr(wtypes.UuidType())
class LoadBalancerPOST(BaseLoadBalancerType): """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) vip_address = wtypes.wsattr(types.IPAddressType()) vip_port_id = wtypes.wsattr(wtypes.UuidType()) vip_subnet_id = wtypes.wsattr(wtypes.UuidType()) vip_network_id = wtypes.wsattr(wtypes.UuidType()) vip_qos_policy_id = wtypes.wsattr(wtypes.UuidType()) project_id = wtypes.wsattr(wtypes.StringType(max_length=36)) listeners = wtypes.wsattr([listener.ListenerSingleCreate], default=[]) pools = wtypes.wsattr([pool.PoolSingleCreate], default=[]) provider = wtypes.wsattr(wtypes.StringType(max_length=64)) # TODO(johnsom) This should be dynamic based on the loaded flavors # once flavors are implemented. flavor_id = wtypes.wsattr(wtypes.Enum(str, *constants.SUPPORTED_FLAVORS))
class MemberStatusResponse(BaseMemberType): """Defines which attributes are to be shown on status response.""" id = wtypes.wsattr(wtypes.UuidType()) name = wtypes.wsattr(wtypes.StringType()) operating_status = wtypes.wsattr(wtypes.StringType()) provisioning_status = wtypes.wsattr(wtypes.StringType()) address = wtypes.wsattr(types.IPAddressType()) protocol_port = wtypes.wsattr(wtypes.IntegerType()) @classmethod def from_data_model(cls, data_model, children=False): member = super(MemberStatusResponse, cls).from_data_model(data_model, children=children) if not member.name: member.name = "" return member
class LoadBalancerResponse(BaseLoadBalancerType): """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()) tenant_id = wtypes.wsattr(wtypes.StringType()) created_at = wtypes.wsattr(wtypes.datetime.datetime) updated_at = wtypes.wsattr(wtypes.datetime.datetime) vip_address = wtypes.wsattr(types.IPAddressType()) vip_port_id = wtypes.wsattr(wtypes.UuidType()) vip_subnet_id = wtypes.wsattr(wtypes.UuidType()) vip_network_id = wtypes.wsattr(wtypes.UuidType()) listeners = wtypes.wsattr([MinimalListener]) # TODO(ankur-gupta-f): add pools once that has been merged @classmethod def from_data_model(cls, data_model, children=False): result = super(BaseLoadBalancerType, cls).from_data_model(data_model, children=children) if data_model.vip: result.vip_subnet_id = data_model.vip.subnet_id result.vip_port_id = data_model.vip.port_id result.vip_address = data_model.vip.ip_address result.vip_network_id = data_model.vip.network_id result.listeners = [ MinimalListener.from_data_model(i) for i in data_model.listeners ] result.tenant_id = data_model.project_id if not result.description: result.description = "" if not result.name: result.name = "" return result
class VIP(base.BaseType): """Defines the response and acceptable POST request attributes.""" ip_address = wtypes.wsattr(base.IPAddressType()) port_id = wtypes.wsattr(wtypes.UuidType()) subnet_id = wtypes.wsattr(wtypes.UuidType()) network_id = wtypes.wsattr(wtypes.UuidType())
class SessionPersistenceResponse(types.BaseType): """Defines which attributes are to be shown on any response.""" type = wtypes.wsattr(wtypes.text) cookie_name = wtypes.wsattr(wtypes.text) persistence_timeout = wtypes.wsattr(wtypes.IntegerType()) persistence_granularity = wtypes.wsattr(types.IPAddressType())