@@ -181,6 +181,10 @@ def _make_futures(futmap_keys, class_check, make_result_fn):
181
181
182
182
return f , futmap
183
183
184
+ @staticmethod
185
+ def _has_duplicates (items ):
186
+ return len (set (items )) != len (items )
187
+
184
188
def create_topics (self , new_topics , ** kwargs ):
185
189
"""
186
190
Create one or more new topics.
@@ -365,7 +369,7 @@ def create_acls(self, acls, **kwargs):
365
369
"""
366
370
Create one or more ACL bindings.
367
371
368
- :param list(AclBinding) acls: A list of ACL binding specifications (:class:`.AclBinding`)
372
+ :param list(AclBinding) acls: A list of unique ACL binding specifications (:class:`.AclBinding`)
369
373
to create.
370
374
:param float request_timeout: The overall request timeout in seconds,
371
375
including broker lookup, request transmission, operation time
@@ -380,6 +384,8 @@ def create_acls(self, acls, **kwargs):
380
384
:raises TypeException: Invalid input.
381
385
:raises ValueException: Invalid input.
382
386
"""
387
+ if AdminClient ._has_duplicates (acls ):
388
+ raise ValueError ("duplicate ACL bindings not allowed" )
383
389
384
390
f , futmap = AdminClient ._make_futures (acls , AclBinding ,
385
391
AdminClient ._make_acls_result )
@@ -395,7 +401,7 @@ def describe_acls(self, acl_binding_filter, **kwargs):
395
401
:param AclBindingFilter acl_binding_filter: a filter with attributes that
396
402
must match.
397
403
String attributes match exact values or any string if set to None.
398
- Enums attributes match exact values or any value if ending with `_ANY `.
404
+ Enums attributes match exact values or any value if equal to `ANY `.
399
405
If :class:`ResourcePatternType` is set to :attr:`ResourcePatternType.MATCH` returns all
400
406
the ACL bindings with :attr:`ResourcePatternType.LITERAL`,
401
407
:attr:`ResourcePatternType.WILDCARD` or :attr:`ResourcePatternType.PREFIXED` pattern
@@ -423,10 +429,10 @@ def delete_acls(self, acl_binding_filters, **kwargs):
423
429
"""
424
430
Delete ACL bindings matching one or more ACL binding filters.
425
431
426
- :param list(AclBindingFilter) acl_binding_filters: a list of ACL binding filters
432
+ :param list(AclBindingFilter) acl_binding_filters: a list of unique ACL binding filters
427
433
to match ACLs to delete.
428
434
String attributes match exact values or any string if set to None.
429
- Enums attributes match exact values or any value if ending with `_ANY `.
435
+ Enums attributes match exact values or any value if equal to `ANY `.
430
436
If :class:`ResourcePatternType` is set to :attr:`ResourcePatternType.MATCH`
431
437
deletes all the ACL bindings with :attr:`ResourcePatternType.LITERAL`,
432
438
:attr:`ResourcePatternType.WILDCARD` or :attr:`ResourcePatternType.PREFIXED`
@@ -444,6 +450,8 @@ def delete_acls(self, acl_binding_filters, **kwargs):
444
450
:raises TypeException: Invalid input.
445
451
:raises ValueException: Invalid input.
446
452
"""
453
+ if AdminClient ._has_duplicates (acl_binding_filters ):
454
+ raise ValueError ("duplicate ACL binding filters not allowed" )
447
455
448
456
f , futmap = AdminClient ._make_futures (acl_binding_filters , AclBindingFilter ,
449
457
AdminClient ._make_acls_result )
0 commit comments