-
-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature(gateway): add route and chores for connector
- Loading branch information
1 parent
15c3394
commit 2c171aa
Showing
6 changed files
with
306 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package models | ||
|
||
type ConnectorStatus struct { | ||
// State of connection. | ||
State string `json:"state" bson:"state"` | ||
// Message contains a message what caused the current [State]. | ||
Message string `json:"message" bson:"message"` | ||
} | ||
|
||
type ConnectorTLS struct { | ||
// CA is the Certificate Authority used to generate the [Cert] for the server and the client. | ||
CA string `json:"ca" bson:"ca" validate:"required,certPEM"` | ||
// Cert is generated from [CA] certificate and used by the client to authorize the connection to the Container Engine. | ||
Cert string `json:"cert" bson:"cert" validate:"required,certPEM"` | ||
// Key is the private key for the certificate on [Cert] field. | ||
Key string `json:"key" bson:"key" validate:"required,privateKeyPEM"` | ||
} | ||
|
||
// ConnectorData contains the mutable data for each Connector. | ||
type ConnectorData struct { | ||
// Enable indicates if the Connection's connection is enable. | ||
Enable *bool `json:"enable" bson:"enable,omitempty"` | ||
// Secure indicates if the Connector use HTTPS for authentication. | ||
Secure *bool `json:"secure" bson:"secure,omitempty"` | ||
// Address is the address to the Container Engine. | ||
Address *string `json:"address" bson:"address,omitempty" validate:"required,hostname_rfc1123"` | ||
// Port is the port to Container Engine. | ||
Port *uint `json:"port" bson:"port,omitempty" validate:"required,min=1,max=65535"` | ||
// TLS stores the configuration for authenticate using TLS on the Container Engine. | ||
TLS *ConnectorTLS `json:"tls,omitempty" bson:"tls,omitempty" validate:"required_if=Secure true"` | ||
} | ||
|
||
type Connector struct { | ||
// UID is the unique identifier of Connector. | ||
UID string `json:"uid" bson:"uid"` | ||
// TenantID indicate which namespace this connector is related. | ||
TenantID string `json:"tenant_id" bson:"tenant_id"` | ||
// Status shows the connection status for the connector. | ||
Status ConnectorStatus `json:"status" bson:"-"` | ||
ConnectorData `bson:",inline"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters