Skip to content

Commit 4ab1efa

Browse files
authored
Add auth parameter to cluster management (streamnative#986)
* feat: add parameters authenticationPlugin and authenticationParameters for cluster management * feat: add new api SetReplicationClusters and GetReplicationClusters for topic
1 parent 5e3be64 commit 4ab1efa

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

pkg/pulsar/topic.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,12 @@ type Topics interface {
224224

225225
// SetInactiveTopicPolicies sets the inactive topic policies on a topic
226226
SetInactiveTopicPolicies(topic utils.TopicName, data utils.InactiveTopicPolicies) error
227+
228+
// GetReplicationClusters get the replication clusters of a topic
229+
GetReplicationClusters(topic utils.TopicName) ([]string, error)
230+
231+
// SetReplicationClusters sets the replication clusters on a topic
232+
SetReplicationClusters(topic utils.TopicName, data []string) error
227233
}
228234

229235
type topics struct {
@@ -696,3 +702,15 @@ func (t *topics) SetInactiveTopicPolicies(topic utils.TopicName, data utils.Inac
696702
endpoint := t.pulsar.endpoint(t.basePath, topic.GetRestPath(), "inactiveTopicPolicies")
697703
return t.pulsar.Client.Post(endpoint, data)
698704
}
705+
706+
func (t *topics) SetReplicationClusters(topic utils.TopicName, data []string) error {
707+
endpoint := t.pulsar.endpoint(t.basePath, topic.GetRestPath(), "replication")
708+
return t.pulsar.Client.Post(endpoint, data)
709+
}
710+
711+
func (t *topics) GetReplicationClusters(topic utils.TopicName) ([]string, error) {
712+
var data []string
713+
endpoint := t.pulsar.endpoint(t.basePath, topic.GetRestPath(), "replication")
714+
err := t.pulsar.Client.Get(endpoint, &data)
715+
return data, err
716+
}

pkg/pulsar/utils/data.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@ package utils
1919

2020
// ClusterData information on a cluster
2121
type ClusterData struct {
22-
Name string `json:"-"`
23-
ServiceURL string `json:"serviceUrl"`
24-
ServiceURLTls string `json:"serviceUrlTls"`
25-
BrokerServiceURL string `json:"brokerServiceUrl"`
26-
BrokerServiceURLTls string `json:"brokerServiceUrlTls"`
27-
PeerClusterNames []string `json:"peerClusterNames"`
22+
Name string `json:"-"`
23+
ServiceURL string `json:"serviceUrl"`
24+
ServiceURLTls string `json:"serviceUrlTls"`
25+
BrokerServiceURL string `json:"brokerServiceUrl"`
26+
BrokerServiceURLTls string `json:"brokerServiceUrlTls"`
27+
PeerClusterNames []string `json:"peerClusterNames"`
28+
AuthenticationPlugin string `json:"authenticationPlugin"`
29+
AuthenticationParameters string `json:"authenticationParameters"`
2830
}
2931

3032
// FunctionData information for a Pulsar Function

0 commit comments

Comments
 (0)