@@ -33,6 +33,8 @@ type DeploymentReplication interface {
3333 Name () string
3434 Namespace () string
3535 StateColor () StateColor
36+ Source () Endpoint
37+ Destination () Endpoint
3638}
3739
3840// DeploymentReplicationOperator is the API implemented by the deployment operator.
@@ -45,17 +47,53 @@ type DeploymentReplicationOperator interface {
4547
4648// DeploymentReplicationInfo is the information returned per deployment replication.
4749type DeploymentReplicationInfo struct {
48- Name string `json:"name"`
49- Namespace string `json:"namespace"`
50- StateColor StateColor `json:"state_color"`
50+ Name string `json:"name"`
51+ Namespace string `json:"namespace"`
52+ StateColor StateColor `json:"state_color"`
53+ Source EndpointInfo `json:"source"`
54+ Destination EndpointInfo `json:"destination"`
5155}
5256
5357// newDeploymentReplicationInfo initializes a DeploymentReplicationInfo for the given deployment replication.
5458func newDeploymentReplicationInfo (dr DeploymentReplication ) DeploymentReplicationInfo {
5559 return DeploymentReplicationInfo {
56- Name : dr .Name (),
57- Namespace : dr .Namespace (),
58- StateColor : dr .StateColor (),
60+ Name : dr .Name (),
61+ Namespace : dr .Namespace (),
62+ StateColor : dr .StateColor (),
63+ Source : newEndpointInfo (dr .Source ()),
64+ Destination : newEndpointInfo (dr .Destination ()),
65+ }
66+ }
67+
68+ // Endpoint is the API implemented by source&destination of the replication
69+ type Endpoint interface {
70+ DeploymentName () string
71+ MasterEndpoint () []string
72+ AuthKeyfileSecretName () string
73+ AuthUserSecretName () string
74+ TLSCACert () string
75+ TLSCACertSecretName () string
76+ }
77+
78+ // EndpointInfo is the information returned per source/destination endpoint of the replication.
79+ type EndpointInfo struct {
80+ DeploymentName string `json:"deployment_name"`
81+ MasterEndpoint []string `json:"master_endpoint"`
82+ AuthKeyfileSecretName string `json:"auth_keyfile_secret_name"`
83+ AuthUserSecretName string `json:"auth_user_secret_name"`
84+ TLSCACert string `json:"tls_ca_cert"`
85+ TLSCACertSecretName string `json:"tls_ca_cert_secret_name"`
86+ }
87+
88+ // newEndpointInfo initializes an EndpointInfo for the given Endpoint.
89+ func newEndpointInfo (ep Endpoint ) EndpointInfo {
90+ return EndpointInfo {
91+ DeploymentName : ep .DeploymentName (),
92+ MasterEndpoint : ep .MasterEndpoint (),
93+ AuthKeyfileSecretName : ep .AuthKeyfileSecretName (),
94+ AuthUserSecretName : ep .AuthUserSecretName (),
95+ TLSCACert : ep .TLSCACert (),
96+ TLSCACertSecretName : ep .TLSCACertSecretName (),
5997 }
6098}
6199
0 commit comments