Creating a Connection
Function
This API is used to create a connection.
URI
POST /v1/{project_id}/connections
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Tenant resource space ID. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
User token. The token can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
Yes |
String |
Name of the connection. The value must be unique under a tenant. Only letters, digits, periods (.), underscores (_), and hyphens (-) are allowed. It must start with a letter or digit and cannot be default. |
description |
No |
String |
Description of the connection. |
vpc_id |
Yes |
String |
ID of the VPC to be connected. |
subnet_id |
Yes |
String |
ID of the subnet to be connected. |
type |
No |
String |
Connection type, which can be webhook (HTTP connection) or kafka (Huawei Cloud Kafka instance). |
kafka_detail |
No |
KafkaConnectionDetail object |
Kafka connection parameters. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
instance_id |
Yes |
String |
Kafka instance ID. |
addr |
Yes |
String |
Kafka connection address. |
security_protocol |
No |
String |
Security protocol. |
enable_sasl_ssl |
Yes |
Boolean |
Whether SASL_SSL is enabled for the Kafka instance. |
user_name |
No |
String |
Username of the Kafka instance. This parameter is mandatory when SASL_SSL is enabled for the instance. |
password |
No |
String |
Password of the Kafka instance. This parameter is mandatory when SASL_SSL is enabled for the instance. |
acks |
No |
String |
Number of acknowledgments that the producer requires the server to return before considering a request complete. This controls the durability of records that are sent. Supported options: 0: The producer will not wait for any acknowledgment from the server at all. The record will be immediately added to the socket buffer and considered sent. No guarantee can be made that the server has received the record, and the retries configuration will not take effect (as the client generally does not know of any failures). The offset given back for each record will always be set to -1. 1: The leader will write the record to its local log but will respond without waiting until receiving full acknowledgement from all followers. If the leader fails immediately after acknowledging the record but before the followers have replicated it, the record will be lost. all: The leader will wait for the full set of replicas to acknowledge the record. This is the strongest available guarantee because the record will not be lost even if there is just one replica that works. min.insync.replicas specifies the minimum number of replicas that must acknowledge a write for the write to be considered successful. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
X-Request-Id |
String |
This field is the request ID number for task tracking. Format is request_uuid-timestamp-hostname. |
Parameter |
Type |
Description |
---|---|---|
id |
String |
ID of the event source. |
name |
String |
Name of the connection. The value must be unique under a tenant. Only lowercase letters, digits, periods (.), underscores (_), and hyphens (-) are allowed. It must start with a letter or digit and cannot be default. |
description |
String |
Description of the connection. |
status |
String |
Status of the connection. |
error_info |
ErrorInfo object |
Error message. |
vpc_id |
String |
ID of the VPC to be connected. |
subnet_id |
String |
ID of the subnet to be connected. |
agency |
String |
Name of the user agency used by the target private network connection. |
flavor |
flavor object |
Flavor. |
type |
String |
Connection type, which can be webhook (HTTP connection) or kafka (Huawei Cloud Kafka instance). |
kafka_detail |
KafkaConnectionDetail object |
Kafka connection parameters. |
created_time |
String |
UTC time when the connection is created. |
updated_time |
String |
UTC time when the connection is updated. |
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_detail |
String |
Error details. |
error_msg |
String |
Error message. |
Parameter |
Type |
Description |
---|---|---|
name |
String |
Flavor name. |
concurrency_type |
String |
Concurrent flavor type. |
concurrency |
Integer |
Number of concurrent requests. |
bandwidth_type |
String |
Bandwidth type. |
Parameter |
Type |
Description |
---|---|---|
instance_id |
String |
Kafka instance ID. |
addr |
String |
Kafka connection address. |
security_protocol |
String |
Security protocol. |
enable_sasl_ssl |
Boolean |
Whether SASL_SSL is enabled for the Kafka instance. |
user_name |
String |
Username of the Kafka instance. This parameter is mandatory when SASL_SSL is enabled for the instance. |
password |
String |
Password of the Kafka instance. This parameter is mandatory when SASL_SSL is enabled for the instance. |
acks |
String |
Number of acknowledgments that the producer requires the server to return before considering a request complete. This controls the durability of records that are sent. Supported options: 0: The producer will not wait for any acknowledgment from the server at all. The record will be immediately added to the socket buffer and considered sent. No guarantee can be made that the server has received the record, and the retries configuration will not take effect (as the client generally does not know of any failures). The offset given back for each record will always be set to -1. 1: The leader will write the record to its local log but will respond without waiting until receiving full acknowledgement from all followers. If the leader fails immediately after acknowledging the record but before the followers have replicated it, the record will be lost. all: The leader will wait for the full set of replicas to acknowledge the record. This is the strongest available guarantee because the record will not be lost even if there is just one replica that works. min.insync.replicas specifies the minimum number of replicas that must acknowledge a write for the write to be considered successful. |
Example Requests
Create a connection.
POST https://{endpoint}/v1/{project_id}/connections
{
"name" : "private-link",
"description" : "",
"vpc_id" : "ac14144e-8fec-53d6-bdfd-8f09b52c09iu",
"subnet_id" : "bf14153e-5fec-67d6-b89d-5409b52c0op8",
"type" : { }
}
Example Responses
Status code: 200
Demo Information
{
"id" : "90e0b962-c6c1-438c-ba8a-3024fe592bda",
"name" : "private-link",
"description" : "",
"status" : "CREATING",
"error_info" : { },
"vpc_id" : "ac14144e-8fec-53d6-bdfd-8f09b52c09iu",
"subnet_id" : "bf14153e-5fec-67d6-b89d-5409b52c0op8",
"agency" : "EG_TRUST",
"flavor" : {
"name" : "default",
"concurrency_type" : "exclusive",
"concurrency" : 500,
"bandwidth_type" : "exclusive"
},
"type" : { },
"kafka_detail" : { },
"created_time" : "2021-12-09 09:00:00",
"updated_time" : "2021-12-09 09:00:00"
}
Status Codes
Status Code |
Description |
---|---|
200 |
Demo Information |
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