VPC API¶
The Virtual Private Cloud Class¶
The nat high-level interface is available through the vpc
member of a Connection
object. The
vpc
member will only be added if the
otcextensions.sdk.register_otc_extensions(conn)
method is called.
VPC Bandwidth Operations¶
-
class
otcextensions.sdk.vpc.v1._proxy.
Proxy
(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs) -
assign_bandwidth
(**attrs) Assign bandwidth
- Parameters
attrs (dict) – Keyword arguments which will be used to assign a
Bandwidth
-
find_bandwidth
(name_or_id, ignore_missing=False) Find a single bandwidth
- Parameters
name_or_id – The name or ID of a bandwidth
ignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the vpc peering does not exist. When set toTrue
, no exception will be set when attempting to delete a nonexistent peering.
- Returns
One
Bandwidth
-
update_bandwidth
(bandwidth, **attrs) Update a vpc peering
-
add_eip_to_bandwidth
(bandwidth, publicip_info: List[otcextensions.sdk.vpc.v1._proxy.PublicInfo]) Add an EIP to a shared bandwidth.
- Parameters
bandwidth – The value can be the ID of a bandwidth or a
Bandwidth
instance.publicip_info – List of dictionaries in the format {‘publicip_id’: id, ‘publicip_type’: type}
-
remove_eip_from_bandwidth
(bandwidth, **attrs) Add an EIP to a shared bandwidth.
- Parameters
bandwidth – The value can be the ID of a bandwidth or a
Bandwidth
instance.attrs – Keyword arguments to remove eip: charge_mode, size, publicip_info - array of eip in the format {‘publicip_id’: id}
-
delete_bandwidth
(bandwidth, ignore_missing=True) Delete a bandwidth
- Parameters
bandwidth – key id or an instance of
Bandwidth
ignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the vpc peering does not exist. When set toTrue
, no exception will be set when attempting to delete a nonexistent peering.
- Returns
None
-
VPC Peering Operations¶
-
class
otcextensions.sdk.vpc.v1._proxy.
Proxy
(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs) -
create_peering
(**attrs) Create a new vpc peering from attributes
- Parameters
attrs (dict) – Keyword arguments which will be used to create a
Peering
-
delete_peering
(peering, ignore_missing=True) Delete a vpc peering
- Parameters
peering – key id or an instance of
Peering
ignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the vpc peering does not exist. When set toTrue
, no exception will be set when attempting to delete a nonexistent peering.
- Returns
None
-
peerings
(**query) Return a generator of vpc peerings
- Parameters
query (dict) – Optional query parameters to be sent to limit the resources being returned.
- Returns
A generator of vpc peering objects
- Return type
-
find_peering
(name_or_id, ignore_missing=False) Find a single vpc peering
- Parameters
name_or_id – The name or ID of a zone
ignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the vpc peering does not exist. When set toTrue
, no exception will be set when attempting to delete a nonexistent peering.
- Returns
One
Peering
-
update_peering
(peering, **attrs) Update a vpc peering
-
VPC Route Operations¶
-
class
otcextensions.sdk.vpc.v1._proxy.
Proxy
(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs) -
add_route
(**attrs) Add vpc route
- Parameters
attrs (dict) – Keyword arguments which will be used to create a
Route
-
delete_route
(route, ignore_missing=True) Delete a vpc route
- Parameters
route – route id or an instance of
Route
ignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the vpc route does not exist. When set toTrue
, no exception will be set when attempting to delete a nonexistent route.
- Returns
None
-
routes
(**query) Return a generator of vpc routes
- Parameters
query (dict) – Optional query parameters to be sent to limit the resources being returned.
- Returns
A generator of vpc route objects
- Return type
-
VPC Operations¶
-
class
otcextensions.sdk.vpc.v1._proxy.
Proxy
(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs) -
vpcs
(**query) Return a generator of vpcs
- Parameters
query (dict) – Optional query parameters to be sent to limit the resources being returned.
- Returns
A generator of vpc objects
- Return type
-
create_vpc
(**attrs) Create a new vpc from attributes
- Parameters
attrs (dict) – Keyword arguments which will be used to create a
Vpc
-
delete_vpc
(vpc, ignore_missing=True) Delete a vpc
- Parameters
vpc – vpc id or an instance of
Vpc
ignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the vpc route does not exist. When set toTrue
, no exception will be set when attempting to delete a nonexistent route.
- Returns
none
-
find_vpc
(name_or_id, ignore_missing=False) Find a single vpc
- Parameters
name_or_id – The name or ID of a vpc
ignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the vpc does not exist. When set toTrue
, no exception will be set when attempting to delete a nonexistent peering.
- Returns
One
Vpc
-
update_vpc
(vpc, **attrs) Update vpc
- Parameters
vpc – vpc id or an instance of
Vpc
attrs (dict) – The attributes to update on the vpc represented by
vpcd
.
-
VPC Subnet Operations¶
-
class
otcextensions.sdk.vpc.v1._proxy.
Proxy
(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs) -
subnets
(**query) Return a generator of subnets
- Parameters
query (dict) – Optional query parameters to be sent to limit the resources being returned.
- Returns
A generator of subnet objects
- Return type
-
create_subnet
(**attrs) Create a new subnet from attributes
- Parameters
attrs (dict) – Keyword arguments which will be used to create a
Subnet
-
get_subnet
(subnet) Get a subnet by id
-
find_subnet
(name_or_id, ignore_missing=False) Find a single subnet
- Parameters
name_or_id – The name or ID of a subnet
ignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the subnet does not exist. When set toTrue
, no exception will be set when attempting to delete a nonexistent peering.
- Returns
One
Subnet
-
update_subnet
(subnet, **attrs) Update subnet
- Parameters
subnet – subnet id or an instance of
Subnet
attrs (dict) – The attributes to update on the subnet represented by
subnet
.
-
delete_subnet
(subnet, vpc_id=None, ignore_missing=True) Delete a subnet
- Parameters
subnet – subnet id or an instance of
Subnet
vpc_id – VPC id. By default, taken from
subnet
, if provided.ignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the subnet route does not exist. When set toTrue
, no exception will be set when attempting to delete a nonexistent route.
- Returns
none
-