Querying VPC Endpoint Services
Function
This API is used to query VPC endpoint services.
Calling Method
For details, see Calling APIs.
URI
GET /v1/{project_id}/vpc-endpoint-services
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
endpoint_service_name |
No |
String |
Specifies the name of the VPC endpoint service. The name can contain letters and supports fuzzy match. |
id |
No |
String |
Specifies the unique ID of the VPC endpoint service. |
status |
No |
String |
Specifies the status of the VPC endpoint service.
|
sort_key |
No |
String |
Specifies by what the VPC endpoint services are listed.
|
sort_dir |
No |
String |
Specifies how VPC endpoint services are sorted.
|
limit |
No |
Integer |
Specifies the maximum number of VPC endpoint services displayed on each page. The value ranges from 0 to 1000 and is generally 10, 20, or 50. The default number is 10. |
offset |
No |
Integer |
Specifies the offset. All VPC endpoint services after this offset will be queried. The offset must be an integer greater than 0 but less than the number of VPC endpoint services. |
public_border_group |
No |
String |
Specifies the VPC endpoint service that matches the edge attribute in the filtering result. |
net_type |
No |
String |
Specifies the type of the network to which the IPv4 address of the VPC endpoint belongs. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
Specifies the user token. It can be obtained by calling the IAM API. The value of X-Subject-Token in the response header is the user token. |
Content-Type |
No |
String |
Specifies the MIME type of the request body. Default value application/json is recommended. For APIs used to upload objects or images, the MIME type varies depending on the flow type. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
endpoint_services |
Array of ServiceList objects |
Specifies VPC endpoint services. |
total_count |
Integer |
Specifies the total number of VPC endpoint services that meet the search criteria. The number is not affected by limit or offset. |
Parameter |
Type |
Description |
---|---|---|
id |
String |
Specifies the unique ID of the VPC endpoint service. |
port_id |
String |
Specifies the ID that identifies the backend resource of the VPC endpoint service. The ID is in UUID format. The value can be:
|
service_name |
String |
Specifies the name of the VPC endpoint service. |
server_type |
String |
Specifies the resource type.
|
vpc_id |
String |
Specifies the ID of the VPC where the backend resource of the VPC endpoint service is located. |
approval_enabled |
Boolean |
Specifies whether connection approval is required.
|
status |
String |
Specifies the status of the VPC endpoint service.
|
service_type |
String |
Specifies the type of the VPC endpoint service. There are two types of VPC endpoint services: interface and gateway.
|
created_at |
String |
Specifies when the VPC endpoint service was created. The UTC time format YYYY-MM-DDTHH:MM:SSZ is used. |
updated_at |
String |
Specifies when the VPC endpoint service was updated. The UTC time format YYYY-MM-DDTHH:MM:SSZ is used. |
project_id |
String |
Project ID. For details about how to obtain the project ID, see Obtaining a Project ID. |
domain_id |
String |
Domain ID |
ports |
Array of PortList objects |
Specifies the port mappings opened by the VPC endpoint service. Duplicate port mappings are not allowed in the same VPC endpoint service. If multiple VPC endpoint services share one port ID,the combinations of server ports and protocols for all port mappings between VPC endpoint services must be unique. |
ip |
String |
Specifies the IPv4 address or domain name of the interface VPC endpoint in VLAN scenarios. |
tags |
Array of TagList objects |
Resource tag list |
connection_count |
Integer |
Specifies the number of VPC endpoints that are in the Creating or Accepted status. |
tcp_proxy |
String |
Specifies whether to transfer client information, such as source IP addresses, source port numbers, and marker IDs, to the server. The information can be sent to the server in the following ways:
|
error |
Array of Error objects |
Specifies the error message returned when a task submission exception occurs. |
description |
String |
Specifies the description field. The value can contain characters such as letters and digits, but cannot contain angle brackets (< or >). |
supported_editions |
Array of strings |
Specifies the type of the VPC endpoint service. The value can be profession or basic. |
public_border_group |
String |
Specifies the information about Public Border Group of the pool corresponding to the VPC endpoint service. |
enable_policy |
Boolean |
Specifies whether the VPC endpoint policy can be customized.
|
Parameter |
Type |
Description |
---|---|---|
client_port |
Integer |
Specifies the port to be accessed by a VPC endpoint. This port is provided by the VPC endpoint, allowing you to access the VPC endpoint service. Supported range: 1 to 65535. |
server_port |
Integer |
Specifies the port for accessing the VPC endpoint service. This port is associated with backend resources to provide VPC endpoint services. Supported range: 1 to 65535 |
protocol |
String |
Port mapping protocol. TCP is supported. |
Parameter |
Type |
Description |
---|---|---|
key |
String |
Specifies the tag key. key cannot be left blank. A key can contain 1 to 128 characters. A key can contain UTF-8 letters, digits, spaces, and the following special characters _ . : = + - @ Keys cannot start with _sys_ because it indicates a system tag. A key cannot start or end with a space. |
value |
String |
Specifies the tag value. A value can contain 0 to 255 characters. A value can contain UTF-8 letters, digits, spaces, and the following special characters _ . : / = + - @ A value can be an empty string. |
Example Requests
Querying VPC endpoint services
GET https://{endpoint}/v1/{project_id}/vpc-endpoint-services?endpoint_service_name={endpoint_service_name}&id={id}&sort_key={sort_key}&sort_dir={sort_dir}&limit={limit}&offset={offset}&status={status}
Example Responses
Status code: 200
The server has successfully processed the request.
{ "endpoint_services" : [ { "id" : "4189d3c2-8882-4871-a3c2-d380272eed83", "port_id" : "4189d3c2-8882-4871-a3c2-d380272eed88", "vpc_id" : "4189d3c2-8882-4871-a3c2-d380272eed80", "status" : "available", "approval_enabled" : false, "service_name" : "test123", "server_type" : "VM", "service_type" : "interface", "ports" : [ { "client_port" : "8080", "server_port" : "80", "protocol" : "TCP" }, { "client_port" : "8081", "server_port" : "80", "protocol" : "TCP" } ], "project_id" : "6e9dfd51d1124e8d8498dce894923a0d", "created_at" : "2022-04-14T09:35:47Z", "updated_at" : "2022-04-14T09:36:47Z", "public_border_group" : "br-abc-aaa1", "supported_editions" : [ "basic", "profession" ] } ], "total_count" : 1 }
SDK Sample Code
The SDK sample code is as follows.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
package com.huaweicloud.sdk.test; import com.huaweicloud.sdk.core.auth.ICredential; import com.huaweicloud.sdk.core.auth.BasicCredentials; import com.huaweicloud.sdk.core.exception.ConnectionException; import com.huaweicloud.sdk.core.exception.RequestTimeoutException; import com.huaweicloud.sdk.core.exception.ServiceResponseException; import com.huaweicloud.sdk.vpcep.v1.region.VpcepRegion; import com.huaweicloud.sdk.vpcep.v1.*; import com.huaweicloud.sdk.vpcep.v1.model.*; public class ListEndpointServiceSolution { public static void main(String[] args) { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment String ak = System.getenv("CLOUD_SDK_AK"); String sk = System.getenv("CLOUD_SDK_SK"); String projectId = "{project_id}"; ICredential auth = new BasicCredentials() .withProjectId(projectId) .withAk(ak) .withSk(sk); VpcepClient client = VpcepClient.newBuilder() .withCredential(auth) .withRegion(VpcepRegion.valueOf("<YOUR REGION>")) .build(); ListEndpointServiceRequest request = new ListEndpointServiceRequest(); try { ListEndpointServiceResponse response = client.listEndpointService(request); System.out.println(response.toString()); } catch (ConnectionException e) { e.printStackTrace(); } catch (RequestTimeoutException e) { e.printStackTrace(); } catch (ServiceResponseException e) { e.printStackTrace(); System.out.println(e.getHttpStatusCode()); System.out.println(e.getRequestId()); System.out.println(e.getErrorCode()); System.out.println(e.getErrorMsg()); } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# coding: utf-8 import os from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkvpcep.v1.region.vpcep_region import VpcepRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkvpcep.v1 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = os.environ["CLOUD_SDK_AK"] sk = os.environ["CLOUD_SDK_SK"] projectId = "{project_id}" credentials = BasicCredentials(ak, sk, projectId) client = VpcepClient.new_builder() \ .with_credentials(credentials) \ .with_region(VpcepRegion.value_of("<YOUR REGION>")) \ .build() try: request = ListEndpointServiceRequest() response = client.list_endpoint_service(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" vpcep "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/vpcep/v1" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/vpcep/v1/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/vpcep/v1/region" ) func main() { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") projectId := "{project_id}" auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). WithProjectId(projectId). Build() client := vpcep.NewVpcepClient( vpcep.VpcepClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.ListEndpointServiceRequest{} response, err := client.ListEndpointService(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } } |
For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.
Status Codes
Status Code |
Description |
---|---|
200 |
The server has successfully processed the request. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot