Copilot commented on code in PR #1425:
URL: https://github.com/apache/pulsar-client-go/pull/1425#discussion_r2418452380


##########
pulsaradmin/pkg/admin/brokers.go:
##########
@@ -79,93 +123,144 @@ func (c *pulsarClient) Brokers() Brokers {
 }
 
 func (b *broker) GetActiveBrokers(cluster string) ([]string, error) {
+       return b.GetActiveBrokersWithContext(context.Background(), cluster)
+}
+
+func (b *broker) GetActiveBrokersWithContext(ctx context.Context, cluster 
string) ([]string, error) {
        endpoint := b.pulsar.endpoint(b.basePath, cluster)
        var res []string
-       err := b.pulsar.Client.Get(endpoint, &res)
+       err := b.pulsar.Client.GetWithContext(ctx, endpoint, &res)
        if err != nil {
                return nil, err
        }
        return res, nil
 }
 
 func (b *broker) GetListActiveBrokers() ([]string, error) {
+       return b.GetListActiveBrokersWithContext(context.Background())
+}
+
+func (b *broker) GetListActiveBrokersWithContext(ctx context.Context) 
([]string, error) {
        endpoint := b.pulsar.endpoint(b.basePath)
        var res []string
-       err := b.pulsar.Client.Get(endpoint, &res)
+       err := b.pulsar.Client.GetWithContext(ctx, endpoint, &res)
        if err != nil {
                return nil, err
        }
        return res, nil
 }
 
 func (b *broker) GetDynamicConfigurationNames() ([]string, error) {
+       return b.GetDynamicConfigurationNamesWithContext(context.Background())
+}
+
+func (b *broker) GetDynamicConfigurationNamesWithContext(ctx context.Context) 
([]string, error) {
        endpoint := b.pulsar.endpoint(b.basePath, "/configuration/")
        var res []string
-       err := b.pulsar.Client.Get(endpoint, &res)
+       err := b.pulsar.Client.GetWithContext(ctx, endpoint, &res)
        if err != nil {
                return nil, err
        }
        return res, nil
 }
 
 func (b *broker) GetOwnedNamespaces(cluster, brokerURL string) 
(map[string]utils.NamespaceOwnershipStatus, error) {
+       return b.GetOwnedNamespacesWithContext(context.TODO(), cluster, 
brokerURL)

Review Comment:
   Use `context.Background()` instead of `context.TODO()` for consistency with 
other methods in this PR. `context.TODO()` should only be used when it's 
unclear which context to use.
   ```suggestion
        return b.GetOwnedNamespacesWithContext(context.Background(), cluster, 
brokerURL)
   ```



##########
pulsaradmin/pkg/admin/sinks.go:
##########
@@ -36,53 +37,123 @@ type Sinks interface {
        // ListSinks returns the list of all the Pulsar Sinks.
        ListSinks(tenant, namespace string) ([]string, error)
 
+       // ListSinksWithContext returns the list of all the Pulsar Sinks.
+       ListSinksWithContext(ctx context.Context, tenant, namespace string) 
([]string, error)
+
        // GetSink returns the configuration for the specified sink
        GetSink(tenant, namespace, Sink string) (utils.SinkConfig, error)
 
+       // GetSinkWithContext returns the configuration for the specified sink
+       GetSinkWithContext(ctx context.Context, tenant, namespace, Sink string) 
(utils.SinkConfig, error)
+
        // CreateSink creates a new sink
        CreateSink(config *utils.SinkConfig, fileName string) error
 
+       // CreateSinkWithContext creates a new sink
+       CreateSinkWithContext(ctx context.Context, config *utils.SinkConfig, 
fileName string) error
+
        // CreateSinkWithURL creates a new sink by providing url from which 
fun-pkg can be downloaded. supported url: http/file
        CreateSinkWithURL(config *utils.SinkConfig, pkgURL string) error
 
+       // CreateSinkWithURLWithContext creates a new sink by providing url 
from which fun-pkg can be downloaded.
+       // supported url: http/file
+       CreateSinkWithURLWithContext(ctx context.Context, config 
*utils.SinkConfig, pkgURL string) error
+
        // UpdateSink updates the configuration for a sink.
        UpdateSink(config *utils.SinkConfig, fileName string, options 
*utils.UpdateOptions) error
 
-       // UpdateSinkWithURL updates a sink by providing url from which fun-pkg 
can be downloaded. supported url: http/file
+       // UpdateSinkWithContext updates the configuration for a sink.
+       UpdateSinkWithContext(
+               ctx context.Context,
+               config *utils.SinkConfig,
+               fileName string,
+               options *utils.UpdateOptions,
+       ) error
+
+       // UpdateSinkWithURL updates a sink by providing url from which fun-pkg 
can be downloaded.
+       // supported url: http/file

Review Comment:
   Comment formatting is inconsistent. The second line should start with 
uppercase 'Supported' to match the style of other comments in the codebase.
   ```suggestion
        // Supported url: http/file
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to