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
1func (c *Client) CreateEndpoint(args *CreateEndpointArgs) (*CreateEndpointResult, error)
Parameter Meaning
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.go
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
1func (c *Client) ListEndpoints(args *ListEndpointArgs) (*ListEndpointResult, error)
Parameter Meaning
Refer to OpenAPI documentation Query Service Network Interface Card List
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.go
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
1func (c *Client) GetEndpointDetail(endpointId string) (*Endpoint, error)
Parameter Meaning
Refer to OpenAPI documentation Query Service Network Interface Card Details
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_detail.go
Delete service network interface card
Remove the service network interface card.
Delete service network interface card using the following codes
Function declaration
1func (c *Client) DeleteEndpoint(endpointId string, clientToken string) error
Parameter Meaning
Refer to the OpenAPI documentation: Delete 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_delete_endpoint.go
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
1func (c *Client) UpdateEndpoint(endpointId string, args *UpdateEndpointArgs) error
Parameter meaning
Refer to the OpenAPI documentation: Update the 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.go
Query mountable public services
Fetch a list of mountable public services.
Use the following code to query mountable public services
Function declaration
1func (c *Client) GetServices() (*ListServiceResult, error)
Parameter Meaning
Refer to the OpenAPI documentation: Query mountable public services
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_get_services.go
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
1func (c *Client) UpdateEndpointNormalSecurityGroup(endpointId string, args *UpdateEndpointNSGArgs) error
Parameter meaning
Refer to the OpenAPI documentation: Update regular security group for 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_normal_security_group.go
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
1func (c *Client) UpdateEndpointEnterpriseSecurityGroup(endpointId string, args *UpdateEndpointESGArgs) error
Parameter meaning
Refer to the OpenAPI documentation: Update service network interface card with enterprise 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_enterprise_security_group.go
