-
Notifications
You must be signed in to change notification settings - Fork 368
feat: align topics level policies admin apis to java restful apis #1398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: align topics level policies admin apis to java restful apis #1398
Conversation
…te, max consumers, message size, subscriptions, schema validation, deduplication, replicator dispatch rate, offload policies, auto subscription creation, and schema compatibility strategy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds comprehensive topic-level policy management APIs to the Pulsar Go admin client to align with the Java REST APIs. The implementation provides feature parity for managing topic policies programmatically through Go applications.
Key changes include:
- Addition of 9 new topic policy API categories with get/set/remove operations
- New data structures for offload policies and auto subscription creation configuration
- Enhanced delayed delivery data structure with optional maximum delay limits
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pulsaradmin/pkg/utils/offload_policies.go | Defines OffloadPolicies struct with S3 and general offload configuration fields |
| pulsaradmin/pkg/utils/data.go | Enhances DelayedDeliveryData with optional MaxDelayInMillis field and helper functions |
| pulsaradmin/pkg/utils/auto_subscription_creation.go | Defines AutoSubscriptionCreationOverride struct for managing auto subscription settings |
| pulsaradmin/pkg/admin/topic.go | Implements 27 new topic policy management methods across 9 API categories |
Comments suppressed due to low confidence (1)
pulsaradmin/pkg/utils/offload_policies.go:30
- Inconsistent field naming: The struct field is named 'S3ManagedLedgerOffloadCredentialID' but the JSON tag uses 'Id' instead of 'ID'. This creates inconsistency between Go naming conventions and the JSON representation.
S3ManagedLedgerOffloadCredentialID string `json:"s3ManagedLedgerOffloadCredentialId,omitempty"`
|
Could you please add the relevant unit tests? |
addressed with latest commits |
…te, max consumers, message size, subscriptions, schema validation, deduplication, replicator dispatch rate, offload policies, auto subscription creation, and schema compatibility strategy
(If this PR fixes a github issue, please add
Fixes #<xyz>.)Fixes #
(or if this PR is one task of a github issue, please add
Master Issue: #<xyz>to link to the master issue.)Master Issue: #
Motivation
The Pulsar Go client's admin APIs for topic-level policies were incomplete and not aligned with the Java client's RESTful APIs. This inconsistency made it difficult for users who work with both Java and Go clients to have a unified experience when managing topic-level policies programmatically.
Currently, many essential topic-level policy management features available in the Java admin client are missing in the Go client, limiting the ability to fully manage Pulsar topics through Go applications. This includes policies for:
By aligning these APIs with the Java implementation, we ensure feature parity and provide Go developers with the same administrative capabilities.
Modifications
This PR adds comprehensive topic-level policy management APIs to align with the Java admin client. The following APIs have been implemented:
New Topic Policy APIs Added:
Max Consumers Policy
GetMaxConsumers(topic string) (int, error)SetMaxConsumers(topic string, maxConsumers int) errorRemoveMaxConsumers(topic string) errorMax Message Size Policy
GetMaxMessageSize(topic string) (int, error)SetMaxMessageSize(topic string, maxMessageSize int) errorRemoveMaxMessageSize(topic string) errorSubscription Management
GetSubscriptionDispatchRate(topic string) (*DispatchRate, error)SetSubscriptionDispatchRate(topic string, dispatchRate DispatchRate) errorRemoveSubscriptionDispatchRate(topic string) errorSchema Validation Policy
GetSchemaValidationEnforced(topic string) (bool, error)SetSchemaValidationEnforced(topic string, enforced bool) errorDeduplication Policy
GetDeduplicationStatus(topic string) (bool, error)SetDeduplicationStatus(topic string, enabled bool) errorRemoveDeduplicationStatus(topic string) errorReplicator Dispatch Rate
GetReplicatorDispatchRate(topic string) (*DispatchRate, error)SetReplicatorDispatchRate(topic string, dispatchRate DispatchRate) errorRemoveReplicatorDispatchRate(topic string) errorOffload Policies
GetOffloadPolicies(topic string) (*OffloadPolicies, error)SetOffloadPolicies(topic string, policies OffloadPolicies) errorRemoveOffloadPolicies(topic string) errorAuto Subscription Creation
GetAutoSubscriptionCreation(topic string) (*AutoSubscriptionCreationOverride, error)SetAutoSubscriptionCreation(topic string, config AutoSubscriptionCreationOverride) errorRemoveAutoSubscriptionCreation(topic string) errorSchema Compatibility Strategy
GetSchemaCompatibilityStrategy(topic string) (SchemaCompatibilityStrategy, error)SetSchemaCompatibilityStrategy(topic string, strategy SchemaCompatibilityStrategy) errorRemoveSchemaCompatibilityStrategy(topic string) errorVerifying this change
(Please pick either of the following options)
This change is a trivial rework / code cleanup without any test coverage.
(or)
This change is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:
(example:)
Does this pull request potentially affect one of the following parts:
If
yeswas chosen, please highlight the changesDocumentation