Service network interface card
Create service network interface card
Create a service network interface card, and return with the corresponding service address and instance ID.
Users can create service network interface instances with the following code.
Function declaration
1def create_endpoint(self, vpc_id, subnet_id, name, service, billing, description=None, ip_address=None, client_token=None, config=None)
Parameter Meaning
Please refer to the OpenAPI documentation: Create Service Network Interface Card
Response Value
Operation succeeded:
1{
2 "id": "endpoint-11b09ce6",
3 "ipAddress": "192.168.0.1"
4}
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to example_create_endpoint.py
Update the service network interface card
Update service network interface card. The name and description shall not be empty at the same time
Use the following code to update the service network interface card
Function declaration
1def update_endpoint(self, endpoint_id, name=None, description=None, client_token=None, config=None)
Parameter Meaning
Please refer to OpenAPI documentation Update Service Network Interface Card via UpdateEndpoint
Response Value
Operation succeeded:
Respond with 200
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to example_update_endpoint.py
Query service network interface card list
Fetch the list of service network interface cards.
Query service network interface card list using the following codes
Function declaration
1def list_endpoints(self, vpc_id, name=None, ip_address=None, status=None, subnet_id=None, service=None, marker=None, max_Keys=None, config=None)
Parameter Meaning
Please refer to the OpenAPI documentation: [Query Service Network Interface Card Details via ListEndpoints
Response Value
Operation succeeded:
1{
2 "nextMarker": "endpoint-11a09ce9",
3 "marker": "endpoint-11a09ce9",
4 "maxKeys": 1,
5 "isTruncated": true,
6 "result": [
7 {
8 "endpointId': "endpoint-11a09ce9",
9 "name": "name",
10 "ipAddress": "192.168.0.5",
11 "status": "available",
12 "service": "www.test.com",
13 "subnetId": "sbn-crqu2vxzj049",
14 "createTime": "2019-03-07T02:35:31Z",
15 "description": "",
16 "productType": "postpay",
17 "vpcId": "vpc-q1hcnhf7nmve"
18 }
19 ]
20}
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to example_list_endpoints.py
Query service network interface card details
Retrieve the details of the service network interface card.
Query service network interface card details using the following codes
Function declaration
1def get_endpoint(self, endpoint_id, config=None)
Parameter Meaning
Please refer to the OpenAPI documentation Query Service Network Interface Card Details via GetEndpointDetail
Response Value
Operation succeeded:
1{
2 "endpointId': "endpoint-11a09ce9",
3 "name": "name",
4 "ipAddress": "192.168.0.5",
5 "status": "available",
6 "service": "www.test.com",
7 "subnetId": "sbn-crqu2vxzj049",
8 "createTime": "2019-03-07T02:35:31Z",
9 "description": "",
10 "productType": "postpay",
11 "vpcId": "vpc-q1hcnhf7nmve"
12}
Operation failed:
Throw an exception. For the exception list, refer to Exception List
Code example
For specific code examples, refer to example_get_endpoint.py
Delete service network interface card
Remove the service network interface card.
Delete service network interface card using the following codes
Function declaration
1def delete_endpoint(self, endpoint_id, client_token=None, config=None)
Parameter meaning
Please refer to OpenAPI documentation: Update Service Network Interface Card via DeleteEndpoint
Response value
Operation succeeded:
Respond with 200
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to example_delete_endpoint.py
Query mountable public services
Fetch a list of mountable public services.
Use the following code to query mountable public services
Function declaration
1def list_services(self, config=None)
Parameter Meaning
Please refer to the OpenAPI documentation: Query Mountable Public Services via GetServices
Response Value
Operation succeeded:
1{
2 "services": [
3 "www.test.com",
4 "www.test2.com"
5 ]
6 }
Operation failed: Throw an exception. For the exception list, refer to Exception List
Code example
For specific code examples, refer to example_list_services.py
Update regular security group for service network interface card
Update the associated regular security group of the service network interface card. The service network interface card must have at least one security group. This operation will add the new security group while removing any existing groups.
Use the following code to update the regular security group of the service network interface card
Function declaration
1def update_endpoint_sg(self, endpoint_id, security_group_list, action=b'bindSg', client_token=None, config=None)
Parameter meaning
Please refer to the OpenAPI documentation UpdateEndpointNormalSecurityGroup service network interface card update normal security group
Response value
Operation succeeded:
Respond with 200
Operation failed:
Throw an exception. For the exception list, refer to: Exception List
Code example
For specific code examples, refer to example_update_endpoint_sg.py
Update service network interface card with enterprise security group
Update the enterprise security group linked to the service network interface card. The service network interface card must be associated with at least one security group (regular or enterprise). This operation will bind the specified enterprise security group and remove any currently set groups (regular or enterprise). Currently, each service network interface card is limited to connecting with one enterprise security group.
Use the following code to update the enterprise security group of the service network interface card
Function declaration
1def update_endpoint_enterprise_sg(self, endpoint_id, enterprise_sg_list, action=b'bindEsg', client_token=None, config=None)
Parameter meaning
Please refer to the OpenAPI documentation: Update Enterprise Security Group of Service Network Interface Card
Response value
Operation succeeded:
Respond with 200
Operation failed:
Throw an exception. For the exception list, refer to Exception List
Code example
For specific code examples, refer to example_update_endpoint_enterprise_sg.py
