VPC Endpoint (VPCEP)¶
VPC Endpoint (VPCEP) is a cloud service that provides secure and private channels to connect your VPCs to VPC endpoint services, including cloud services or your private services. It allows you to plan networks flexibly without having to use EIPs. There are two types of resources: VPC endpoint services and VPC endpoints.
VPC Endpoint Service¶
VPC endpoint services are cloud services or private services that you manually configure in VPCEP. You can access these endpoint services using VPC endpoints.
List Services¶
This interface is used to query an VPCEP services list and to filter
the output with query parameters.
Service
.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
endpoints = conn.vpcep.endpoints()
print(list(endpoints))
Create Service¶
This interface is used to create a VPCEP service with
parameters.
Service
.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
attrs = {
'port_id': 'port-id',
'vpc_id': 'router-id',
'service_name': 'test-service',
'approval_enabled': False,
'service_type': 'interface',
'server_type': 'VM',
'ports': [{'client_port': 8080, 'server_port': 90, 'protocol': 'TCP'}],
}
endpoint_service = conn.vpcep.create_service(**attrs)
print(endpoint_service)
Get Service¶
This interface is used to get a VPCEP service by ID
or an instance of class.
Service
.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
endpoint_service = 'endpoint-service-uuid'
endpoint_service = conn.vpcep.get_service(endpoint_service)
print(endpoint_service)
Find Service¶
This interface is used to find a VPCEP service by ID
or name.
Service
.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
name_or_id = 'xyz'
endpoint_service = conn.vpcep.find_service(name_or_id, ignore_missing=False)
print(endpoint_service)
Delete Service¶
This interface is used to delete a VPCEP service by ID
or an instance of class
Service
.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
endpoint_service_id = 'endpoint-service-uuid'
conn.vpcep.delete_service(endpoint_service_id, ignore_missing=False)
List Service Whitelist¶
This interface is used to query an VPCEP service whitelist and to filter
the output with query parameters.
Whitelist
.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
name_or_id = 'xyz'
endpoint_service = conn.vpcep.find_service(name_or_id)
whitelist = conn.vpcep.service_whitelist(endpoint_service)
print(list(whitelist))
Manage Service Whitelist¶
This interface is used to manage a VPCEP service whitelist.
Whitelist
.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
name_or_id = 'xyz'
action = 'add'
domains = ['domain1-id', 'domain2-id']
endpoint_service = conn.vpcep.find_service(name_or_id)
whitelist = conn.vpcep.service_whitelist(
endpoint_service, action, domains
)
print(list(whitelist))
List Service Connections¶
This interface is used to query an VPCEP service connections and to filter
the output with query parameters.
Connection
.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
name_or_id = 'xyz'
endpoint_service = conn.vpcep.find_service(name_or_id)
connections = conn.vpcep.service_connections(endpoint_service)
Manage Service Connections¶
This interface is used to manage a VPCEP service connections.
Connection
.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
name_or_id = 'xyz'
action = 'accept'
endpoints = ['endpoint1-id', 'endpoint2-id']
endpoint_service = conn.vpcep.find_service(name_or_id)
connections = conn.vpcep.service_connections(
endpoint_service, action, endpoints
)
print(list(connections))
VPC Endpoint¶
VPC endpoints are secure and private channels for connecting VPCs to VPC endpoint services.
List Endpoints¶
This interface is used to query an VPC endpoint list and to filter
the output with query parameters.
Endpoint
.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
endpoints = conn.vpcep.endpoints()
print(list(endpoints))
Create Endpoint¶
This interface is used to create a VPC endpoint with
parameters.
Endpoint
.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
attrs = {
'network_id': 'network-uuid',
'router_id': 'router-uuid',
'tags': [{'key': 'test1', 'value': 'test1'}],
'endpoint_service_id': 'endpoint-service-uuid',
'enable_dns': True,
}
endpoint = conn.vpcep.create_endpoint(**attrs)
print(endpoint)
Get Endpoint¶
This interface is used to get a VPC endpoint by ID
or an instance of class
Endpoint
.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
endpoint_id = 'endpoint-uuid'
endpoint = conn.vpcep.get_endpoint(endpoint_id)
print(endpoint)
Delete Endpoint¶
This interface is used to delete a VPC endpoint by ID
or an instance of class
Endpoint
.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
endpoint_id = 'endpoint-uuid'
conn.vpcep.delete_endpoint(endpoint_id, ignore_missing=False)
VPCEP Quota¶
List Resource Quota¶
This interface is used to query quota of vpc endpoint and endpoint_service
on a specific tenant.
Quota
.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
quota = conn.vpcep.resource_quota()
print(list(quota))