Load Balancer v2 API¶
The LoadBalancer Class¶
The load_balancer high-level interface is available through the
load_balancer
member of a Connection
object.
The load_balancer
member will only be added if the service is detected.
Load Balancer Operations¶
- class openstack.load_balancer.v2._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
- create_load_balancer(**attrs)
Create a new load balancer from attributes
- Parameters
attrs (dict) – Keyword arguments which will be used to create a
LoadBalancer
, comprised of the properties on the LoadBalancer class.- Returns
The results of load balancer creation
- Return type
- get_load_balancer(*attrs)
Get a load balancer
- Parameters
load_balancer – The value can be the ID of a load balancer or
LoadBalancer
instance.- Returns
One
LoadBalancer
- get_load_balancer_statistics(load_balancer)
Get the load balancer statistics
- Parameters
load_balancer – The value can be the ID of a load balancer or
LoadBalancer
instance.- Returns
- load_balancers(**query)
Retrieve a generator of load balancers
- Returns
A generator of load balancer instances
- delete_load_balancer(load_balancer, ignore_missing=True, cascade=False)
Delete a load balancer
- Parameters
load_balancer – The load_balancer can be either the ID or a
LoadBalancer
instanceignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the load balancer does not exist. When set toTrue
, no exception will be set when attempting to delete a nonexistent load balancer.cascade (bool) – If true will delete all child objects of the load balancer.
- Returns
None
- find_load_balancer(name_or_id, ignore_missing=True)
Find a single load balancer
- Parameters
name_or_id – The name or ID of a load balancer
ignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the load balancer does not exist. When set toTrue
, no exception will be set when attempting to delete a nonexistent load balancer.
- Returns
None
- update_load_balancer(load_balancer, **attrs)
Update a load balancer
- Parameters
load_balancer – The load_balancer can be either the ID or a
LoadBalancer
instanceattrs (dict) – The attributes to update on the load balancer represented by
load_balancer
.
- Returns
The updated load_balancer
- Return type
- failover_load_balancer(load_balancer, **attrs)
Failover a load balancer
- Parameters
load_balancer – The value can be the ID of a load balancer or
LoadBalancer
instance.- Returns
None
Listener Operations¶
- class openstack.load_balancer.v2._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
- create_listener(**attrs)
Create a new listener from attributes
- delete_listener(listener, ignore_missing=True)
Delete a listener
- Parameters
listener – The value can be either the ID of a listener or a
Listener
instance.ignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the listner does not exist. When set toTrue
, no exception will be set when attempting to delete a nonexistent listener.
- Returns
None
- find_listener(name_or_id, ignore_missing=True)
Find a single listener
- Parameters
name_or_id – The name or ID of a listener.
ignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the resource does not exist. When set toTrue
, None will be returned when attempting to find a nonexistent resource.
- Returns
One
Listener
or None
- get_listener(listener)
Get a single listener
- get_listener_statistics(listener)
Get the listener statistics
- Parameters
listener – The value can be the ID of a listener or a
Listener
instance.- Returns
One
ListenerStats
- Raises
ResourceNotFound
when no resource can be found.
- listeners(**query)
Return a generator of listeners
- Parameters
query (dict) – Optional query parameters to be sent to limit the resources being returned. Valid parameters are:
- Returns
A generator of listener objects
- Return type
Pool Operations¶
- class openstack.load_balancer.v2._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
- create_pool(**attrs)
Create a new pool from attributes
- get_pool(*attrs)
Get a pool
- pools(**query)
Retrieve a generator of pools
- Returns
A generator of Pool instances
- delete_pool(pool, ignore_missing=True)
Delete a pool
- Parameters
pool – The pool is either a pool ID or a
Pool
instanceignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the pool does not exist. When set toTrue
, no exception will be set when attempting to delete a nonexistent pool.
- Returns
None
- find_pool(name_or_id, ignore_missing=True)
Find a single pool
- Parameters
name_or_id – The name or ID of a pool
ignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the pool does not exist. When set toTrue
, no exception will be set when attempting to delete a nonexistent pool.
- Returns
None
Member Operations¶
- class openstack.load_balancer.v2._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
- create_member(pool, **attrs)
Create a new member from attributes
- delete_member(member, pool, ignore_missing=True)
Delete a member
- Parameters
member – The member can be either the ID of a member or a
Member
instance.pool – The pool can be either the ID of a pool or a
Pool
instance that the member belongs to.ignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the member does not exist. When set toTrue
, no exception will be set when attempting to delete a nonexistent member.
- Returns
None
- find_member(name_or_id, pool, ignore_missing=True)
Find a single member
- Parameters
name_or_id (str) – The name or ID of a member.
pool – The pool can be either the ID of a pool or a
Pool
instance that the member belongs to.ignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the resource does not exist. When set toTrue
, None will be returned when attempting to find a nonexistent resource.
- Returns
One
Member
or None
- get_member(member, pool)
Get a single member
- members(pool, **query)
Return a generator of members
- update_member(member, pool, **attrs)
Update a member
Health Monitor Operations¶
- class openstack.load_balancer.v2._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
- find_health_monitor(name_or_id, ignore_missing=True)
Find a single health monitor
- Parameters
name_or_id – The name or ID of a health monitor
ignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the health monitor does not exist. When set toTrue
, no exception will be set when attempting to find a nonexistent health monitor.
- Returns
The
openstack.load_balancer.v2.healthmonitor.HealthMonitor
object matching the given name or id or None if nothing matches.- Raises
openstack.exceptions.DuplicateResource
if more than one resource is found for this request.- Raises
openstack.exceptions.ResourceNotFound
if nothing is found and ignore_missing isFalse
.
- create_health_monitor(**attrs)
Create a new health monitor from attributes
- Parameters
attrs (dict) – Keyword arguments which will be used to create a
HealthMonitor
, comprised of the properties on the HealthMonitor class.- Returns
The results of HealthMonitor creation
- Return type
HealthMonitor
- get_health_monitor(healthmonitor)
Get a health monitor
- Parameters
healthmonitor – The value can be the ID of a health monitor or
HealthMonitor
instance.- Returns
One health monitor
- Return type
HealthMonitor
- health_monitors(**query)
Retrieve a generator of health monitors
- Parameters
query (dict) – Optional query parameters to be sent to limit the resources being returned. Valid parameters are: ‘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’.
- Returns
A generator of health monitor instances
- delete_health_monitor(healthmonitor, ignore_missing=True)
Delete a health monitor
- Parameters
healthmonitor – The healthmonitor can be either the ID of the health monitor or a
HealthMonitor
instanceignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the healthmonitor does not exist. When set toTrue
, no exception will be set when attempting to delete a nonexistent healthmonitor.
- Returns
None
- update_health_monitor(healthmonitor, **attrs)
Update a health monitor
- Parameters
healthmonitor – The healthmonitor can be either the ID of the health monitor or a
HealthMonitor
instanceattrs (dict) – The attributes to update on the health monitor represented by
healthmonitor
.
- Returns
The updated health monitor
- Return type
HealthMonitor
L7 Policy Operations¶
- class openstack.load_balancer.v2._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
- create_l7_policy(**attrs)
Create a new l7policy from attributes
- delete_l7_policy(l7_policy, ignore_missing=True)
Delete a l7policy
- Parameters
l7_policy – The value can be either the ID of a l7policy or a
L7Policy
instance.ignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the l7policy does not exist. When set toTrue
, no exception will be set when attempting to delete a nonexistent l7policy.
- Returns
None
- find_l7_policy(name_or_id, ignore_missing=True)
Find a single l7policy
- Parameters
name_or_id – The name or ID of a l7policy.
ignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the resource does not exist. When set toTrue
, None will be returned when attempting to find a nonexistent resource.
- Returns
One
L7Policy
or None
- get_l7_policy(l7_policy)
Get a single l7policy
- l7_policies(**query)
Return a generator of l7policies
- Parameters
query (dict) – Optional query parameters to be sent to limit the resources being returned. Valid parameters are:
- Returns
A generator of l7policy objects
- Return type
L7 Rule Operations¶
- class openstack.load_balancer.v2._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
- create_l7_rule(l7_policy, **attrs)
Create a new l7rule from attributes
- Parameters
- Returns
The results of l7rule creation
- Return type
- delete_l7_rule(l7rule, l7_policy, ignore_missing=True)
Delete a l7rule
- Parameters
l7rule – The l7rule can be either the ID of a l7rule or a
L7Rule
instance.l7_policy – The l7_policy can be either the ID of a l7policy or
L7Policy
instance that the l7rule belongs to.ignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the l7rule does not exist. When set toTrue
, no exception will be set when attempting to delete a nonexistent l7rule.
- Returns
None
- find_l7_rule(name_or_id, l7_policy, ignore_missing=True)
Find a single l7rule
- Parameters
name_or_id (str) – The name or ID of a l7rule.
l7_policy – The l7_policy can be either the ID of a l7policy or
L7Policy
instance that the l7rule belongs to.ignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the resource does not exist. When set toTrue
, None will be returned when attempting to find a nonexistent resource.
- Returns
One
L7Rule
or None
- get_l7_rule(l7rule, l7_policy)
Get a single l7rule
- l7_rules(l7_policy, **query)
Return a generator of l7rules
- update_l7_rule(l7rule, l7_policy, **attrs)
Update a l7rule
- Parameters
- Returns
The updated l7rule
- Return type
Provider Operations¶
- class openstack.load_balancer.v2._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
- providers(**query)
Retrieve a generator of providers
- Returns
A generator of providers instances
- provider_flavor_capabilities(provider, **query)
Retrieve a generator of provider flavor capabilities
- Returns
A generator of provider flavor capabilities instances
Flavor Profile Operations¶
- class openstack.load_balancer.v2._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
- create_flavor_profile(**attrs)
Create a new flavor profile from attributes
- Parameters
attrs (dict) – Keyword arguments which will be used to create a
FlavorProfile
, comprised of the properties on the FlavorProfile class.- Returns
The results of profile creation creation
- Return type
- get_flavor_profile(*attrs)
Get a flavor profile
- Parameters
flavor_profile – The value can be the name of a flavor profile or
FlavorProfile
instance.- Returns
One
FlavorProfile
- flavor_profiles(**query)
Retrieve a generator of flavor profiles
- Returns
A generator of flavor profiles instances
- delete_flavor_profile(flavor_profile, ignore_missing=True)
Delete a flavor profile
- Parameters
flavor_profile – The flavor_profile can be either the ID or a
FlavorProfile
instanceignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the flavor profile does not exist. When set toTrue
, no exception will be set when attempting to delete a nonexistent flavor profile.
- Returns
None
- find_flavor_profile(name_or_id, ignore_missing=True)
Find a single flavor profile
- Parameters
name_or_id – The name or ID of a flavor profile
ignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the flavor profile does not exist. When set toTrue
, no exception will be set when attempting to delete a nonexistent flavor profile.
- Returns
None
- update_flavor_profile(flavor_profile, **attrs)
Update a flavor profile
- Parameters
flavor_profile – The flavor_profile can be either the ID or a
FlavorProfile
instanceattrs (dict) – The attributes to update on the flavor profile represented by
flavor_profile
.
- Returns
The updated flavor profile
- Return type
Flavor Operations¶
- class openstack.load_balancer.v2._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
- create_flavor(**attrs)
Create a new flavor from attributes
- get_flavor(*attrs)
Get a flavor
- flavors(**query)
Retrieve a generator of flavors
- Returns
A generator of flavor instances
- delete_flavor(flavor, ignore_missing=True)
Delete a flavor
- Parameters
flavor – The flavorcan be either the ID or a
Flavor
instanceignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the flavor does not exist. When set toTrue
, no exception will be set when attempting to delete a nonexistent flavor.
- Returns
None
- find_flavor(name_or_id, ignore_missing=True)
Find a single flavor
- Parameters
name_or_id – The name or ID of a flavor
ignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the flavor does not exist. When set toTrue
, no exception will be set when attempting to delete a nonexistent flavor.
- Returns
None
Quota Operations¶
- class openstack.load_balancer.v2._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
- quotas(**query)
Return a generator of quotas
- Parameters
query (dict) – Optional query parameters to be sent to limit the resources being returned. Currently no query parameter is supported.
- Returns
A generator of quota objects
- Return type
- get_quota(quota)
Get a quota
- update_quota(quota, **attrs)
Update a quota
- get_quota_default()
Get a default quota
- Returns
One
QuotaDefault
- delete_quota(quota, ignore_missing=True)
Delete a quota (i.e. reset to the default quota)
- Parameters
quota – The value can be either the ID of a quota or a
Quota
instance. The ID of a quota is the same as the project ID for the quota.ignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when quota does not exist. When set toTrue
, no exception will be set when attempting to delete a nonexistent quota.
- Returns
None
Amphora Operations¶
- class openstack.load_balancer.v2._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
- amphorae(**query)
Retrieve a generator of amphorae
- Returns
A generator of amphora instances
- get_amphora(*attrs)
Get a amphora
- find_amphora(amphora_id, ignore_missing=True)
Find a single amphora
- Parameters
amphora_id – The ID of a amphora
ignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the amphora does not exist. When set toTrue
, no exception will be set when attempting to find a nonexistent amphora.
- Returns
None
- configure_amphora(amphora_id, **attrs)
Update the configuration of an amphora agent
- Parameters
amphora_id – The ID of an amphora
- Returns
None
- failover_amphora(amphora_id, **attrs)
Failover an amphora
- Parameters
amphora_id – The ID of an amphora
- Returns
None
Availability Zone Profile Operations¶
- class openstack.load_balancer.v2._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
- create_availability_zone_profile(**attrs)
Create a new availability zone profile from attributes
- Parameters
attrs (dict) – Keyword arguments which will be used to create a
AvailabilityZoneProfile
comprised of the properties on the AvailabilityZoneProfile class.- Returns
The results of profile creation
- Return type
- get_availability_zone_profile(*attrs)
Get an availability zone profile
- Parameters
availability_zone_profile – The value can be the ID of an availability_zone profile or
AvailabilityZoneProfile
instance.- Returns
- availability_zone_profiles(**query)
Retrieve a generator of availability zone profiles
- Returns
A generator of availability zone profiles instances
- delete_availability_zone_profile(availability_zone_profile, ignore_missing=True)
Delete an availability zone profile
- Parameters
availability_zone_profile – The availability_zone_profile can be either the ID or a
AvailabilityZoneProfile
instanceignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the availability zone profile does not exist. When set toTrue
, no exception will be set when attempting to delete a nonexistent availability zone profile.
- Returns
None
- find_availability_zone_profile(name_or_id, ignore_missing=True)
Find a single availability zone profile
- Parameters
name_or_id – The name or ID of a availability zone profile
ignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the availability zone profile does not exist. When set toTrue
, no exception will be set when attempting to delete a nonexistent availability zone profile.
- Returns
None
- update_availability_zone_profile(availability_zone_profile, **attrs)
Update an availability zone profile
- Parameters
availability_zone_profile – The availability_zone_profile can be either the ID or a
AvailabilityZoneProfile
instanceattrs (dict) – The attributes to update on the availability_zone profile represented by
availability_zone_profile
.
- Returns
The updated availability zone profile
- Return type
Availability Zone Operations¶
- class openstack.load_balancer.v2._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
- create_availability_zone(**attrs)
Create a new availability zone from attributes
- Parameters
attrs (dict) – Keyword arguments which will be used to create a
AvailabilityZone
comprised of the properties on the AvailabilityZoneclass.- Returns
The results of availability_zone creation creation
- Return type
- get_availability_zone(*attrs)
Get an availability zone
- Parameters
availability_zone – The value can be the ID of a availability_zone or
AvailabilityZone
instance.- Returns
One
AvailabilityZone
- availability_zones(**query)
Retrieve a generator of availability zones
- Returns
A generator of availability zone instances
- delete_availability_zone(availability_zone, ignore_missing=True)
Delete an availability_zone
- Parameters
availability_zone – The availability_zone can be either the ID or a
AvailabilityZone
instanceignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the availability zone does not exist. When set toTrue
, no exception will be set when attempting to delete a nonexistent availability zone.
- Returns
None
- find_availability_zone(name_or_id, ignore_missing=True)
Find a single availability zone
- Parameters
name_or_id – The name or ID of a availability zone
ignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the availability zone does not exist. When set toTrue
, no exception will be set when attempting to delete a nonexistent availability zone.
- Returns
None
- update_availability_zone(availability_zone, **attrs)
Update an availability zone
- Parameters
availability_zone – The availability_zone can be either the ID or a
AvailabilityZone
instanceattrs (dict) – The attributes to update on the availability_zone represented by
availability_zone
.
- Returns
The updated availability_zone
- Return type