Ejemplo n.º 1
0
class HealthCheck(resource.Resource):
    base_path = '/elbaas/healthcheck'
    service = lb_service.LoadBalancerService()

    # capabilities
    allow_create = True
    allow_delete = True
    allow_update = True
    allow_get = True

    #: Properties
    #: The health check name
    name = resource.Body('name')
    #: The Load balancer listener to be checked
    listener_id = resource.Body('listener_id')
    #: The health check protocol, valid values include: ``TCP``, ``HTTP``
    healthcheck_protocol = resource.Body('healthcheck_protocol')
    #: The health check connect port (1-65535)
    healthcheck_connect_port = resource.Body('healthcheck_connect_port')
    #: The health check URI, effects when protocol is HTTP
    healthcheck_uri = resource.Body('healthcheck_uri')
    #: The max interval between two health check, (1-5) seconds
    healthcheck_interval = resource.Body('healthcheck_interval')
    #: The health check request timeout (1-50) seconds
    healthcheck_timeout = resource.Body('healthcheck_timeout')
    #: The threshold of success checking for turning fail to success
    healthy_threshold = resource.Body('healthy_threshold')
    #: The threshold of failed checking for turning success to fail
    unhealthy_threshold = resource.Body('unhealthy_threshold')
    #: UTC date and time of health check been created
    create_time = resource.Body('create_time')
    #: UTC date and time of health check been updated
    update_time = resource.Body('update_time')
Ejemplo n.º 2
0
class Member(resource.Resource):
    base_path = '/elbaas/listeners/%(listener_id)s/members'
    service = lb_service.LoadBalancerService()

    # capabilities
    allow_create = True
    allow_delete = True
    allow_list = True

    #: Properties
    #: Load balancer listener reference of this member
    listener_id = resource.URI("listener_id")
    #: EIP address of the member server
    address = resource.Body('address')
    #: internal IP address of the member server
    server_address = resource.Body('server_address')
    #: member server ID
    server_id = resource.Body('server_id')
    #: member server name
    server_name = resource.Body('server_name')
    #: member server status, valid value includes: ``ACTIVE``, ``PENDING``,
    #: ``ERROR``
    status = resource.Body('status')
    #: Health check status, valid value includes: ``NORMAL``, ``ABNORMAL``,
    #: ``UNAVAILABLE``
    health_status = resource.Body('health_status')
    #: List of listeners associated with this member.
    #: *Type: list of dicts which contain the listener IDs*
    listeners = resource.Body('listeners', type=list)
    #: UTC date and time of the member created time
    create_time = resource.Body("create_time")
    #: UTC date and time of the member updated time
    update_time = resource.Body("update_time")
Ejemplo n.º 3
0
class LoadBalancer(resource.Resource):
    resource_key = 'loadbalancer'
    resources_key = 'loadbalancers'
    base_path = '/v2.0/lbaas/loadbalancers'
    service = lb_service.LoadBalancerService()

    # capabilities
    allow_create = True
    allow_get = True
    allow_update = True
    allow_delete = True
    allow_list = True

    _query_mapping = resource.QueryParameters(
        'description',
        'flavor',
        'name',
        'project_id',
        'provider',
        'vip_address',
        'vip_network_id',
        'vip_port_id',
        'vip_subnet_id',
        'provisioning_status',
        'operating_status',
        is_admin_state_up='admin_state_up')

    #: Properties
    #: The administrative state of the load balancer *Type: bool*
    is_admin_state_up = resource.Body('admin_state_up', type=bool)
    #: Timestamp when the load balancer was created
    created_at = resource.Body('created_at')
    #: The load balancer description
    description = resource.Body('description')
    #: The load balancer flavor
    flavor = resource.Body('flavor')
    #: List of listeners associated with this load balancer
    listeners = resource.Body('listeners', type=list)
    #: The load balancer name
    name = resource.Body('name')
    #: Operating status of the load balancer
    operating_status = resource.Body('operating_status')
    #: List of pools associated with this load balancer
    pools = resource.Body('pools', type=list)
    #: The ID of the project this load balancer is associated with.
    project_id = resource.Body('project_id')
    #: Provider name for the load balancer.
    provider = resource.Body('provider')
    #: The provisioning status of this load balancer
    provisioning_status = resource.Body('provisioning_status')
    #: Timestamp when the load balancer was last updated
    updated_at = resource.Body('updated_at')
    #: VIP address of load balancer
    vip_address = resource.Body('vip_address')
    #: VIP netowrk ID
    vip_network_id = resource.Body('vip_network_id')
    #: VIP port ID
    vip_port_id = resource.Body('vip_port_id')
    #: VIP subnet ID
    vip_subnet_id = resource.Body('vip_subnet_id')
Ejemplo n.º 4
0
    def __init__(self, plugins=None):
        """User preference for each service.

        :param plugins: List of entry point namespaces to load.

        Create a new :class:`~openstack.profile.Profile`
        object with no preferences defined, but knowledge of the services.
        Services are identified by their service type, e.g.: 'identity',
        'compute', etc.
        """
        self._services = {}

        self._add_service(baremetal_service.BaremetalService(version="v1"))
        self._add_service(
            block_storage_service.BlockStorageService(version="v2"))
        self._add_service(clustering_service.ClusteringService(version="v1"))
        self._add_service(compute_service.ComputeService(version="v2"))
        self._add_service(database_service.DatabaseService(version="v1"))
        self._add_service(identity_service.IdentityService(version="v3"))
        self._add_service(image_service.ImageService(version="v2"))
        self._add_service(key_manager_service.KeyManagerService(version="v1"))
        self._add_service(lb_service.LoadBalancerService(version="v2"))
        self._add_service(message_service.MessageService(version="v1"))
        self._add_service(network_service.NetworkService(version="v2"))
        self._add_service(
            object_store_service.ObjectStoreService(version="v1"))
        self._add_service(
            orchestration_service.OrchestrationService(version="v1"))
        self._add_service(workflow_service.WorkflowService(version="v2"))

        self.service_keys = sorted(self._services.keys())
Ejemplo n.º 5
0
    def __init__(self, plugins=None):
        """User preference for each service.

        :param plugins: List of entry point namespaces to load.

        Create a new :class:`~openstack.profile.Profile`
        object with no preferences defined, but knowledge of the services.
        Services are identified by their service type, e.g.: 'identity',
        'compute', etc.
        """
        self._services = {}

        self._add_service(anti_ddos_service.AntiDDosService(version="v1"))
        self._add_service(block_store_service.BlockStoreService(version="v2"))
        self._add_service(compute_service.ComputeService(version="v2"))
        self._add_service(cts_service.CTSService(version="v1"))
        self._add_service(dms_service.DMSService(version="v1"))
        self._add_service(identity_service.IdentityService(version="v3"))
        self._add_service(image_service.ImageService(version="v2"))
        self._add_service(kms_service.KMSService(version="v1"))
        self._add_service(maas_service.MaaSService(version="v1"))
        self._add_service(network_service.NetworkService(version="v2.0"))
        self._add_service(
            orchestration_service.OrchestrationService(version="v1"))
        self._add_service(smn_service.SMNService(version="v2"))
        # QianBiao.NG HuaWei Services
        self._add_service(dns_service.DNSService(version="v2"))
        self._add_service(cloud_eye_service.CloudEyeService(version="v1"))
        ass = auto_scaling_service.AutoScalingService(version="v1")
        self._add_service(ass)
        vbs_v2 = volume_backup_service.VolumeBackupService(version="v2")
        self._add_service(vbs_v2)
        self._add_service(map_reduce_service.MapReduceService(version="v1"))
        self._add_service(evs_service.EvsServiceV2_1(version='v2.1'))
        self._add_service(evs_service.EvsService(version='v2'))
        self._add_service(ecs_service.EcsService(version='v1'))
        self._add_service(ecs_service.EcsServiceV1_1(version='v1.1'))
        self._add_service(vpc_service.VpcService(version='v2.0'))
        self._add_service(bms_service.BmsService(version='v1'))
        self._add_service(lb_service.LoadBalancerService(version='v1'))
        # not support below service
        # self._add_service(message_service.MessageService(version="v1"))
        # self._add_service(cluster_service.ClusterService(version="v1"))
        # self._add_service(database_service.DatabaseService(version="v1"))
        # self._add_service(alarm_service.AlarmService(version="v2"))
        # self._add_service(bare_metal_service.BareMetalService(version="v1"))
        # self._add_service(key_manager_service.KeyManagerService(version="v1"))
        # self._add_service(
        # object_store_service.ObjectStoreService(version="v1"))

        self._add_service(rds_service.RDSService(version="v1"))
        self._add_service(cdn_service.CDNService(version='v1'))

        # self._add_service(rds_os_service.RDSService(version="v1"))
        # self._add_service(telemetry_service.TelemetryService(version="v2"))
        # self._add_service(workflow_service.WorkflowService(version="v2"))
        if plugins:
            for plugin in plugins:
                self._load_plugin(plugin)
        self.service_keys = sorted(self._services.keys())
Ejemplo n.º 6
0
class HealthMonitor(resource.Resource):
    resource_key = 'healthmonitor'
    resources_key = 'healthmonitors'
    base_path = '/v2.0/lbaas/healthmonitors'
    service = lb_service.LoadBalancerService()

    # capabilities
    allow_create = True
    allow_list = True
    allow_get = True
    allow_delete = True
    allow_update = True

    _query_mapping = resource.QueryParameters(
        'name', 'created_at', 'updated_at', 'delay', 'expected_codes',
        'http_method', 'max_retries', 'max_retries_down', 'pool_id',
        'provisioning_status', 'operating_status', 'timeout',
        'project_id', 'type', 'url_path', is_admin_state_up='admin_state_up',
    )

    #: Properties
    #: Timestamp when the health monitor was created.
    created_at = resource.Body('created_at')
    #: The time, in seconds, between sending probes to members.
    delay = resource.Body('delay', type=int)
    #: The expected http status codes to get from a successful health check
    expected_codes = resource.Body('expected_codes')
    #: The HTTP method that the monitor uses for requests
    http_method = resource.Body('http_method')
    #: The administrative state of the health monitor *Type: bool*
    is_admin_state_up = resource.Body('admin_state_up', type=bool)
    #: The number of successful checks before changing the operating status
    #: of the member to ONLINE.
    max_retries = resource.Body('max_retries', type=int)
    #: The number of allowed check failures before changing the operating
    #: status of the member to ERROR.
    max_retries_down = resource.Body('max_retries_down', type=int)
    #: The health monitor name
    name = resource.Body('name')
    #: Operating status of the member.
    operating_status = resource.Body('operating_status')
    #: List of associated pools.
    #: *Type: list of dicts which contain the pool IDs*
    pools = resource.Body('pools', type=list)
    #: The ID of the associated Pool
    pool_id = resource.Body('pool_id')
    #: The ID of the project
    project_id = resource.Body('project_id')
    #: The provisioning status of this member.
    provisioning_status = resource.Body('provisioning_status')
    #: The time, in seconds, after which a health check times out
    timeout = resource.Body('timeout', type=int)
    #: The type of health monitor
    type = resource.Body('type')
    #: Timestamp when the member was last updated.
    updated_at = resource.Body('updated_at')
    #: The HTTP path of the request to test the health of a member
    url_path = resource.Body('url_path')
Ejemplo n.º 7
0
class Member(resource.Resource):
    resource_key = 'member'
    resources_key = 'members'
    base_path = '/v2.0/lbaas/pools/%(pool_id)s/members'
    service = lb_service.LoadBalancerService()

    # capabilities
    allow_create = True
    allow_get = True
    allow_update = True
    allow_delete = True
    allow_list = True

    _query_mapping = resource.QueryParameters(
        'address', 'name', 'protocol_port', 'subnet_id', 'weight',
        'created_at', 'updated_at', 'provisioning_status', 'operating_status',
        'project_id', 'monitor_address', 'monitor_port', 'backup',
        is_admin_state_up='admin_state_up',
    )

    # Properties
    #: The IP address of the member.
    address = resource.Body('address')
    #: Timestamp when the member was created.
    created_at = resource.Body('created_at')
    #: The administrative state of the member, which is up ``True`` or
    #: down ``False``. *Type: bool*
    is_admin_state_up = resource.Body('admin_state_up', type=bool)
    #: IP address used to monitor this member
    monitor_address = resource.Body('monitor_address')
    #: Port used to monitor this member
    monitor_port = resource.Body('monitor_port', type=int)
    #: Name of the member.
    name = resource.Body('name')
    #: Operating status of the member.
    operating_status = resource.Body('operating_status')
    #: The ID of the owning pool.
    pool_id = resource.URI('pool_id')
    #: The provisioning status of this member.
    provisioning_status = resource.Body('provisioning_status')
    #: The ID of the project this member is associated with.
    project_id = resource.Body('project_id')
    #: The port on which the application is hosted.
    protocol_port = resource.Body('protocol_port', type=int)
    #: Subnet ID in which to access this member.
    subnet_id = resource.Body('subnet_id')
    #: Timestamp when the member was last updated.
    updated_at = resource.Body('updated_at')
    #: A positive integer value that indicates the relative portion of traffic
    #: that this member should receive from the pool. For example, a member
    #: with a weight of 10 receives five times as much traffic as a member
    #: with weight of 2.
    weight = resource.Body('weight', type=int)
    #: A bool value that indicates whether the member is a backup or not.
    #: Backup members only receive traffic when all non-backup members
    #: are down.
    backup = resource.Body('backup', type=bool)
Ejemplo n.º 8
0
 def test_service(self):
     sot = lb_service.LoadBalancerService()
     self.assertEqual('load_balancer', sot.service_type)
     self.assertEqual('public', sot.interface)
     self.assertIsNone(sot.region)
     self.assertIsNone(sot.service_name)
     self.assertEqual(1, len(sot.valid_versions))
     self.assertEqual('v2', sot.valid_versions[0].module)
     self.assertEqual('v2', sot.valid_versions[0].path)
Ejemplo n.º 9
0
class Pool(resource.Resource):
    resource_key = 'pool'
    resources_key = 'pools'
    base_path = '/v2.0/lbaas/pools'
    service = lb_service.LoadBalancerService()

    # capabilities
    allow_create = True
    allow_list = True
    allow_get = True
    allow_delete = True
    allow_update = True

    _query_mapping = resource.QueryParameters(
        'health_monitor_id', 'lb_algorithm', 'listener_id', 'loadbalancer_id',
        'description', 'name', 'project_id', 'protocol',
        'created_at', 'updated_at', 'provisioning_status', 'operating_status',
        is_admin_state_up='admin_state_up'
    )

    #: Properties
    #: Timestamp when the pool was created
    created_at = resource.Body('created_at')
    #: Description for the pool.
    description = resource.Body('description')
    #: Health Monitor ID
    health_monitor_id = resource.Body('healthmonitor_id')
    #: The administrative state of the pool *Type: bool*
    is_admin_state_up = resource.Body('admin_state_up', type=bool)
    #: The loadbalancing algorithm used in the pool
    lb_algorithm = resource.Body('lb_algorithm')
    #: ID of listener associated with this pool
    listener_id = resource.Body('listener_id')
    #: List of listeners associated with this pool
    listeners = resource.Body('listeners', type=list)
    #: ID of load balancer associated with this pool
    loadbalancer_id = resource.Body('loadbalancer_id')
    #: List of loadbalancers associated with this pool
    loadbalancers = resource.Body('loadbalancers', type=list)
    #: Members associated with this pool
    members = resource.Body('members', type=list)
    #: The pool name
    name = resource.Body('name')
    #: Operating status of the pool
    operating_status = resource.Body('operating_status')
    #: The ID of the project
    project_id = resource.Body('project_id')
    #: The protocol of the pool
    protocol = resource.Body('protocol')
    #: Provisioning status of the pool
    provisioning_status = resource.Body('provisioning_status')
    #: A JSON object specifying the session persistence for the pool.
    session_persistence = resource.Body('session_persistence', type=dict)
    #: Timestamp when the pool was updated
    updated_at = resource.Body('updated_at')
Ejemplo n.º 10
0
class L7Policy(resource.Resource):
    resource_key = 'l7policy'
    resources_key = 'l7policies'
    base_path = '/v2.0/lbaas/l7policies'
    service = lb_service.LoadBalancerService()

    # capabilities
    allow_create = True
    allow_list = True
    allow_get = True
    allow_update = True
    allow_delete = True

    _query_mapping = resource.QueryParameters(
        'action',
        'description',
        'listener_id',
        'name',
        'position',
        'redirect_pool_id',
        'redirect_url',
        'provisioning_status',
        'operating_status',
        is_admin_state_up='admin_state_up',
    )

    #: Properties
    #: The action to be taken l7policy is matched
    action = resource.Body('action')
    #: Timestamp when the L7 policy was created.
    created_at = resource.Body('created_at')
    #: The l7policy description
    description = resource.Body('description')
    #: The administrative state of the l7policy *Type: bool*
    is_admin_state_up = resource.Body('admin_state_up', type=bool)
    #: The ID of the listener associated with this l7policy
    listener_id = resource.Body('listener_id')
    #: The l7policy name
    name = resource.Body('name')
    #: Operating status of the member.
    operating_status = resource.Body('operating_status')
    #: Sequence number of this l7policy
    position = resource.Body('position', type=int)
    #: The ID of the project this l7policy is associated with.
    project_id = resource.Body('project_id')
    #: The provisioning status of this l7policy
    provisioning_status = resource.Body('provisioning_status')
    #: The ID of the pool to which the requests will be redirected
    redirect_pool_id = resource.Body('redirect_pool_id')
    #: The URL to which the requests should be redirected
    redirect_url = resource.Body('redirect_url')
    #: The list of L7Rules associated with the l7policy
    rules = resource.Body('rules', type=list)
    #: Timestamp when the member was last updated.
    updated_at = resource.Body('updated_at')
Ejemplo n.º 11
0
class L7Rule(resource.Resource):
    resource_key = 'rule'
    resources_key = 'rules'
    base_path = '/v2.0/lbaas/l7policies/%(l7policy_id)s/rules'
    service = lb_service.LoadBalancerService()

    # capabilities
    allow_create = True
    allow_list = True
    allow_get = True
    allow_update = True
    allow_delete = True

    _query_mapping = resource.QueryParameters(
        'compare_type',
        'created_at',
        'invert',
        'key',
        'project_id',
        'provisioning_status',
        'type',
        'updated_at',
        'rule_value',
        'operating_status',
        is_admin_state_up='admin_state_up',
        l7_policy_id='l7policy_id',
    )

    #: Properties
    #: The administrative state of the l7policy *Type: bool*
    is_admin_state_up = resource.Body('admin_state_up', type=bool)
    #: comparison type to be used with the value in this L7 rule.
    compare_type = resource.Body('compare_type')
    #: Timestamp when the L7 rule was created.
    created_at = resource.Body('created_at')
    #: inverts the logic of the rule if True
    #  (ie. perform a logical NOT on the rule)
    invert = resource.Body('invert', type=bool)
    #: The key to use for the comparison.
    key = resource.Body('key')
    #: The ID of the associated l7 policy
    l7_policy_id = resource.URI('l7policy_id')
    #: The operating status of this l7rule
    operating_status = resource.Body('operating_status')
    #: The ID of the project this l7policy is associated with.
    project_id = resource.Body('project_id')
    #: The provisioning status of this l7policy
    provisioning_status = resource.Body('provisioning_status')
    #: The type of L7 rule
    type = resource.Body('type')
    #: Timestamp when the L7 rule was updated.
    updated_at = resource.Body('updated_at')
    #: value to be compared with
    rule_value = resource.Body('value')
Ejemplo n.º 12
0
class Version(resource.Resource):
    resource_key = 'version'
    resources_key = 'versions'
    base_path = '/'
    service = lb_service.LoadBalancerService(
        version=lb_service.LoadBalancerService.UNVERSIONED)

    # capabilities
    allow_list = True

    # Properties
    links = resource.Body('links')
    status = resource.Body('status')
Ejemplo n.º 13
0
class Job(resource.Resource):
    """Job Resource"""
    base_path = "/jobs"
    service = lb_service.LoadBalancerService()

    # capabilities
    allow_get = True

    #: Properties
    id = resource.Body("job_id")
    type = resource.Body("job_type")
    begin_time = resource.Body("begin_time")
    end_time = resource.Body("end_time")
    entities = resource.Body("entities")
    status = resource.Body("status")
    error_code = resource.Body("error_code")
    fail_reason = resource.Body("fail_reason")
Ejemplo n.º 14
0
class Quota(resource.Resource):
    """Elastic Load Balancer Quota Resource"""
    resource_key = "quotas.resources"
    resources_key = "quotas.resources"
    base_path = "/elbaas/quotas"
    service = lb_service.LoadBalancerService()

    # capabilities
    allow_list = True

    #: Properties
    #: Quota of type, current only ``alarm`` is valid
    type = resource.Body("type")
    #: Quota amount has been used
    used = resource.Body("used")
    #: Quota max amount
    max = resource.Body("max")
    #: Quota min amount
    min = resource.Body("min")
    #: Quota amount
    quota = resource.Body("quota")
Ejemplo n.º 15
0
class Certificate(resource.Resource):
    resources_key = 'certificates'
    base_path = '/elbaas/certificate'
    service = lb_service.LoadBalancerService()

    # capabilities
    allow_create = True
    allow_list = True
    allow_delete = True
    allow_update = True

    #: Properties
    #: The certificate name
    name = resource.Body('name')
    #: The certificate description
    description = resource.Body('description')
    #: The certificate content (PEM format)
    certificate = resource.Body('certificate')
    #: The certificate private key (PEM format)
    private_key = resource.Body('private_key')
    #: Create time
    create_time = resource.Body('create_time')
    #: Latest Update time
    update_time = resource.Body('update_time')
Ejemplo n.º 16
0
class Listener(resource.Resource):
    base_path = "/elbaas/listeners"
    service = lb_service.LoadBalancerService()

    # capabilities
    allow_create = True
    allow_list = True
    allow_get = True
    allow_delete = True
    allow_update = True

    _query_mapping = resource.QueryParameters(
        "id", "name", "loadbalancer_id", "description", "status",
        "healthcheck_id", "certificate_id", "port", "protocol", "backend_port",
        "backend_protocol", "sticky_session_type", "lb_algorithm",
        "cookie_timeout", "tcp_timeout", "udp_timeout", "ssl_protocols",
        "ssl_ciphers")

    #: Properties
    #: The listener name
    name = resource.Body("name")
    #: The listener description
    description = resource.Body("description")
    #: The listener status
    #: Valid values include ``ACTIVE``, ``PENDING_CREATE``, ``ERROR``
    status = resource.Body("status")
    #: The admin state of listener, *Type: bool*
    is_admin_state_up = resource.Body("admin_state_up", type=bool)
    #: The server amount of the listener
    member_number = resource.Body("member_number")
    #: The health check reference of the listener
    healthcheck_id = resource.Body("healthcheck_id")
    #: The load balancer reference of the listener
    loadbalancer_id = resource.Body("loadbalancer_id")
    #: The port to be monitored (1-65535)
    port = resource.Body("port", type=int)
    #: The protocol to be monitored, if load balancer type is Internal,
    #: UDP protocol is not allowed.
    #: Valid values include ``HTTP``, ``HTTPS``, ``TCP``, ``UDP``
    protocol = resource.Body("protocol")
    #: The port of backend server to be monitored (1-65535)
    backend_port = resource.Body("backend_port", type=int)
    #: The backend protocol to be monitored, if protocol is UDP,
    #: only UDP is allowed for backend protocol.
    #: Valid values include ``HTTP``, ``TCP``, ``UDP``
    backend_protocol = resource.Body("backend_protocol")
    #: Load balance algorithm of the listener.
    #: Valid values include ``roundrobin``, ``leastconn``, ``source``
    lb_algorithm = resource.Body("lb_algorithm")
    #: Should stick session,  *Type: bool*
    is_session_sticky = resource.Body("session_sticky", type=bool)
    #: HTTP session sticky type, value should be `insert`. (by default)
    #  only effect when protocol is `HTTP` and is_session_sticky is true.
    sticky_session_type = resource.Body("sticky_session_type")
    #: HTTP cookie timeout, (1-1440) minute
    cookie_timeout = resource.Body("cookie_timeout", type=int)
    #: TCP session timeout, (1-5) minute
    tcp_timeout = resource.Body("tcp_timeout", type=int)
    #: Should TCP keeping connection when server is deleted, *Type: bool*
    is_tcp_draining = resource.Body("tcp_draining", type=bool)
    #: TCP draining timeout, (0-60) minute
    tcp_draining_timeout = resource.Body("tcp_draining_timeout", type=int)
    #: SSL certificate id, required when protocol is HTTPS
    certificate_id = resource.Body("certificate_id")
    #: UDP timeout, (1-1440) minute
    udp_timeout = resource.Body("udp_timeout", type=int)
    #: SSL protocol, TLSv1.2 by default, only effects when protocol is HTTPS
    #: Valid values include ``TLSv1.2``, ``TLSv1.1``, ``TLSv1``
    ssl_protocols = resource.Body("ssl_protocols")
    #: SSL protocol, TLSv1.2 by default, only effects when protocol is HTTPS
    #: Valid values include ``Default``, ``Extended``, ``Strict``
    ssl_ciphers = resource.Body("ssl_ciphers")
    #: Timestamp when the listener was created
    create_time = resource.Body("create_time")
    #: Timestamp when the listener was last updated
    update_time = resource.Body("update_time")

    def add_members(self, session, members):
        """Add backend members

        :param session: openstack session
        :param members: list of dicts which contain the server_id and address.
            server_id is ECS service id, address is ECS server internal IP.
            [{"server_id": "dbecb618-2259-405f-ab17-9b68c4f541b0",
              "address": "172.16.0.31"}] for example.
        :return: a sync OperateMemberJob
        :rtype: :class:`~openstack.load_balancer.v1.member.OperateMemberJob`
        """
        url = utils.urljoin(self.base_path, self.id, "members")
        endpoint_override = self.service.get_endpoint_override()
        response = session.post(url,
                                endpoint_filter=self.service,
                                endpoint_override=endpoint_override,
                                json=members,
                                headers={})

        job = OperateMemberJob()
        job._translate_response(response)
        return job

    def remove_members(self, session, members):
        """Add backend members

        :param session: openstack session
        :param members: member list to be removed from listener,
            list of members (ECS server id) belongs to the listener
            ["dbecb618-2259-405f-ab17-9b68c4f541b0"] for example.
        :return: a sync OperateMemberJob
        :rtype: :class:`~openstack.load_balancer.v1.member.OperateMemberJob`
        """
        url = utils.urljoin(self.base_path, self.id, "members/action")
        endpoint_override = self.service.get_endpoint_override()
        json_body = {"removeMember": [dict(id=mid) for mid in members]}
        response = session.post(url,
                                endpoint_filter=self.service,
                                endpoint_override=endpoint_override,
                                json=json_body,
                                headers={})
        job = OperateMemberJob()
        job._translate_response(response)
        return job
Ejemplo n.º 17
0
class LoadBalancer(resource.Resource):
    resource_key = 'loadbalancer'
    resources_key = 'loadbalancers'
    base_path = '/v2.0/lbaas/loadbalancers'
    service = lb_service.LoadBalancerService()

    # capabilities
    allow_create = True
    allow_get = True
    allow_update = True
    allow_delete = True
    allow_list = True

    _query_mapping = resource.QueryParameters(
        'description', 'flavor', 'name', 'project_id', 'provider',
        'vip_address', 'vip_network_id', 'vip_port_id', 'vip_subnet_id',
        'vip_qos_policy_id', 'provisioning_status', 'operating_status',
        is_admin_state_up='admin_state_up'
    )

    #: Properties
    #: The administrative state of the load balancer *Type: bool*
    is_admin_state_up = resource.Body('admin_state_up', type=bool)
    #: Timestamp when the load balancer was created
    created_at = resource.Body('created_at')
    #: The load balancer description
    description = resource.Body('description')
    #: The load balancer flavor
    flavor = resource.Body('flavor')
    #: List of listeners associated with this load balancer
    listeners = resource.Body('listeners', type=list)
    #: The load balancer name
    name = resource.Body('name')
    #: Operating status of the load balancer
    operating_status = resource.Body('operating_status')
    #: List of pools associated with this load balancer
    pools = resource.Body('pools', type=list)
    #: The ID of the project this load balancer is associated with.
    project_id = resource.Body('project_id')
    #: Provider name for the load balancer.
    provider = resource.Body('provider')
    #: The provisioning status of this load balancer
    provisioning_status = resource.Body('provisioning_status')
    #: Timestamp when the load balancer was last updated
    updated_at = resource.Body('updated_at')
    #: VIP address of load balancer
    vip_address = resource.Body('vip_address')
    #: VIP netowrk ID
    vip_network_id = resource.Body('vip_network_id')
    #: VIP port ID
    vip_port_id = resource.Body('vip_port_id')
    #: VIP subnet ID
    vip_subnet_id = resource.Body('vip_subnet_id')
    # VIP qos policy id
    vip_qos_policy_id = resource.Body('vip_qos_policy_id')

    def delete(self, session, error_message=None):
        request = self._prepare_request()
        headers = {
            "Accept": ""
        }

        request.headers.update(headers)
        params = {}
        if (hasattr(self, 'cascade') and isinstance(self.cascade, bool)
                and self.cascade):
            params['cascade'] = True
        response = session.delete(request.url,
                                  headers=headers,
                                  params=params)

        self._translate_response(response, has_body=False,
                                 error_message=error_message)
        return self
Ejemplo n.º 18
0
class Listener(resource.Resource):
    resource_key = 'listener'
    resources_key = 'listeners'
    base_path = '/v2.0/lbaas/listeners'
    service = lb_service.LoadBalancerService()

    # capabilities
    allow_create = True
    allow_get = True
    allow_update = True
    allow_delete = True
    allow_list = True

    _query_mapping = resource.QueryParameters(
        'connection_limit',
        'default_pool_id',
        'default_tls_container_ref',
        'description',
        'name',
        'project_id',
        'protocol',
        'protocol_port',
        'created_at',
        'updated_at',
        'provisioning_status',
        'operating_status',
        'sni_container_refs',
        'insert_headers',
        'load_balancer_id',
        'timeout_client_data',
        'timeout_member_connect',
        'timeout_member_data',
        'timeout_tcp_inspect',
        is_admin_state_up='admin_state_up',
    )

    # Properties
    #: The maximum number of connections permitted for this load balancer.
    #: Default is infinite.
    connection_limit = resource.Body('connection_limit')
    #: Timestamp when the listener was created.
    created_at = resource.Body('created_at')
    #: Default pool to which the requests will be routed.
    default_pool = resource.Body('default_pool')
    #: ID of default pool. Must have compatible protocol with listener.
    default_pool_id = resource.Body('default_pool_id')
    #: A reference to a container of TLS secrets.
    default_tls_container_ref = resource.Body('default_tls_container_ref')
    #: Description for the listener.
    description = resource.Body('description')
    #: Dictionary of additional headers insertion into HTTP header.
    insert_headers = resource.Body('insert_headers', type=dict)
    #: The administrative state of the listener, which is up
    #: ``True`` or down ``False``. *Type: bool*
    is_admin_state_up = resource.Body('admin_state_up', type=bool)
    #: List of l7policies associated with this listener.
    l7_policies = resource.Body('l7policies', type=list)
    #: The ID of the parent load balancer.
    load_balancer_id = resource.Body('loadbalancer_id')
    #: List of load balancers associated with this listener.
    #: *Type: list of dicts which contain the load balancer IDs*
    load_balancers = resource.Body('loadbalancers', type=list)
    #: Name of the listener
    name = resource.Body('name')
    #: Operating status of the listener.
    operating_status = resource.Body('operating_status')
    #: The ID of the project this listener is associated with.
    project_id = resource.Body('project_id')
    #: The protocol of the listener, which is TCP, HTTP, HTTPS
    #: or TERMINATED_HTTPS.
    protocol = resource.Body('protocol')
    #: Port the listener will listen to, e.g. 80.
    protocol_port = resource.Body('protocol_port', type=int)
    #: The provisioning status of this listener.
    provisioning_status = resource.Body('provisioning_status')
    #: A list of references to TLS secrets.
    #: *Type: list*
    sni_container_refs = resource.Body('sni_container_refs')
    #: Timestamp when the listener was last updated.
    updated_at = resource.Body('updated_at')
    #: Frontend client inactivity timeout in milliseconds.
    timeout_client_data = resource.Body('timeout_client_data', type=int)
    #: Backend member connection timeout in milliseconds.
    timeout_member_connect = resource.Body('timeout_member_connect', type=int)
    #: Backend member inactivity timeout in milliseconds.
    timeout_member_data = resource.Body('timeout_member_data', type=int)
    #: Time, in milliseconds, to wait for additional TCP packets for content
    #: inspection.
    timeout_tcp_inspect = resource.Body('timeout_tcp_inspect', type=int)
Ejemplo n.º 19
0
class LoadBalancer(resource.Resource):
    resource_key = "loadbalancer"
    resources_key = "loadbalancers"
    base_path = "/elbaas/loadbalancers"
    service = lb_service.LoadBalancerService()

    # capabilities
    allow_create = True
    allow_list = True
    allow_get = True
    allow_delete = True
    allow_update = True

    _query_mapping = resource.QueryParameters(
        "id",
        "name",
        "status",
        "type",
        "bandwidth",
        "vpc_id",
        "vip_subnet_id",
        "vip_address",
        "security_group_id",
        "description",
        is_admin_state_up="admin_state_up")

    #: Properties
    #: The load balancer name
    name = resource.Body("name")
    #: The load balancer description
    description = resource.Body("description")
    #: The load balancer status
    status = resource.Body("status")
    #: The load balancer type.
    #: Valid values include ``Internal``, ``External``
    type = resource.Body("type")
    #: The operator"s tenant id, required when load balancer type is Internal,
    tenant_id = resource.Body("tenantId")
    #: The availability zone. Required when type is Internal, No meaning when
    #: type is External
    availability_zone = resource.Body("az")
    #: The load balancer charge mode.
    #: Valid values include ``bandwidth``, ``traffic``, bandwidth by default
    charge_mode = resource.Body("charge_mode")
    #: The load balancer eip type
    #: Valid values include ``5_telcom``, ``5_union``, ``5_bgp``.
    eip_type = resource.Body("eip_type")
    #: The load balancer bandwidth
    bandwidth = resource.Body("bandwidth")
    #: The administrative state of the load balancer
    is_admin_state_up = resource.Body("admin_state_up", type=bool)
    #: VPC of load balancer
    vpc_id = resource.Body("vpc_id")
    #: VIP subnet of load balancer, Required when type is Internal,
    #: No meaning when type is External
    vip_subnet_id = resource.Body("vip_subnet_id")
    #: VIP address of load balancer, when load balancer type is Internal, VIP
    #: address should be internal IP, when type is External, VIP address should
    #: be floating IP address and bandwidth, charge_mode, eip_type will be
    #: ignored
    vip_address = resource.Body("vip_address")
    #: Security Group of load balancer, required when load balancer
    #: type is Internal
    security_group_id = resource.Body("security_group_id")
    #: UTC Timestamp when the load balancer was created
    create_time = resource.Body("create_time")
    #: UTC Timestamp when the load balancer was last updated
    update_time = resource.Body("update_time")
Ejemplo n.º 20
0
class ServicesMixin(object):

    identity = identity_service.IdentityService(service_type='identity')

    compute = compute_service.ComputeService(service_type='compute')

    image = image_service.ImageService(service_type='image')

    load_balancer = load_balancer_service.LoadBalancerService(
        service_type='load-balancer')

    object_store = object_store_service.ObjectStoreService(
        service_type='object-store')

    clustering = clustering_service.ClusteringService(
        service_type='clustering')
    resource_cluster = clustering
    cluster = clustering

    data_processing = service_description.ServiceDescription(
        service_type='data-processing')

    baremetal = baremetal_service.BaremetalService(service_type='baremetal')
    bare_metal = baremetal

    baremetal_introspection = baremetal_introspection_service.BaremetalIntrospectionService(
        service_type='baremetal-introspection')

    key_manager = key_manager_service.KeyManagerService(
        service_type='key-manager')

    resource_optimization = service_description.ServiceDescription(
        service_type='resource-optimization')
    infra_optim = resource_optimization

    message = message_service.MessageService(service_type='message')
    messaging = message

    application_catalog = service_description.ServiceDescription(
        service_type='application-catalog')

    container_infrastructure_management = service_description.ServiceDescription(
        service_type='container-infrastructure-management')
    container_infrastructure = container_infrastructure_management
    container_infra = container_infrastructure_management

    search = service_description.ServiceDescription(service_type='search')

    dns = dns_service.DnsService(service_type='dns')

    workflow = workflow_service.WorkflowService(service_type='workflow')

    rating = service_description.ServiceDescription(service_type='rating')

    operator_policy = service_description.ServiceDescription(
        service_type='operator-policy')
    policy = operator_policy

    shared_file_system = service_description.ServiceDescription(
        service_type='shared-file-system')
    share = shared_file_system

    data_protection_orchestration = service_description.ServiceDescription(
        service_type='data-protection-orchestration')

    orchestration = orchestration_service.OrchestrationService(
        service_type='orchestration')

    block_storage = block_storage_service.BlockStorageService(
        service_type='block-storage')
    block_store = block_storage
    volume = block_storage

    alarm = service_description.ServiceDescription(service_type='alarm')
    alarming = alarm

    meter = service_description.ServiceDescription(service_type='meter')
    metering = meter
    telemetry = meter

    event = service_description.ServiceDescription(service_type='event')
    events = event

    application_deployment = service_description.ServiceDescription(
        service_type='application-deployment')
    application_deployment = application_deployment

    multi_region_network_automation = service_description.ServiceDescription(
        service_type='multi-region-network-automation')
    tricircle = multi_region_network_automation

    database = database_service.DatabaseService(service_type='database')

    application_container = service_description.ServiceDescription(
        service_type='application-container')
    container = application_container

    root_cause_analysis = service_description.ServiceDescription(
        service_type='root-cause-analysis')
    rca = root_cause_analysis

    nfv_orchestration = service_description.ServiceDescription(
        service_type='nfv-orchestration')

    network = network_service.NetworkService(service_type='network')

    backup = service_description.ServiceDescription(service_type='backup')

    monitoring_logging = service_description.ServiceDescription(
        service_type='monitoring-logging')
    monitoring_log_api = monitoring_logging

    monitoring = service_description.ServiceDescription(
        service_type='monitoring')

    monitoring_events = service_description.ServiceDescription(
        service_type='monitoring-events')

    placement = service_description.ServiceDescription(
        service_type='placement')

    instance_ha = instance_ha_service.InstanceHaService(
        service_type='instance-ha')
    ha = instance_ha

    reservation = service_description.ServiceDescription(
        service_type='reservation')

    function_engine = service_description.ServiceDescription(
        service_type='function-engine')

    accelerator = accelerator_service.AcceleratorService(
        service_type='accelerator')

    admin_logic = service_description.ServiceDescription(
        service_type='admin-logic')
    registration = admin_logic