125
125
import awscrt .mqtt
126
126
import urllib .parse
127
127
128
+ # TYPE_CHECKING is used to exclusively execute code by static analysers. Never at runtime.
129
+ from typing import TYPE_CHECKING
130
+ if TYPE_CHECKING :
131
+ # Static analysers will always attempt to import deprecated from typing_extensions and
132
+ # fall back to known interpretation of `deprecated` if it fails and appropriately handle
133
+ # the `@deprecated` tags.
134
+ from typing_extensions import deprecated
135
+ else :
136
+ try :
137
+ # preferred import of deprecated
138
+ from typing_extensions import deprecated
139
+ except ModuleNotFoundError :
140
+ try :
141
+ # Python 3.12+
142
+ from typing import deprecated
143
+ except ImportError :
144
+ # shim if both are unavailable that turn `deprecated` into a no-op
145
+ def deprecated (msg = None , * , since = None ):
146
+ def wrapper (obj ): return obj
147
+ return wrapper
148
+
128
149
129
150
def _check_required_kwargs (** kwargs ):
130
151
for required in ['endpoint' , 'client_id' ]:
@@ -258,6 +279,14 @@ def _builder(
258
279
)
259
280
260
281
282
+ @deprecated (
283
+ """
284
+ Deprecated tag: Please use MQTT5 Client for new code. There are no current plans to
285
+ fully deprecate the MQTT 3.1.1 client but it is highly recommended customers migrate
286
+ to the MQTT5 Client to have access to a more robust feature set, clearer error handling, and lifetime
287
+ management. More details can be found here: <URL>
288
+ """ ,
289
+ since = "9.9.9" )
261
290
def mtls_from_path (cert_filepath , pri_key_filepath , ** kwargs ) -> awscrt .mqtt .Connection :
262
291
"""
263
292
This builder creates an :class:`awscrt.mqtt.Connection`, configured for an mTLS MQTT connection to AWS IoT.
@@ -276,6 +305,14 @@ def mtls_from_path(cert_filepath, pri_key_filepath, **kwargs) -> awscrt.mqtt.Con
276
305
return _builder (tls_ctx_options , ** kwargs )
277
306
278
307
308
+ @deprecated (
309
+ """
310
+ Deprecated tag: Please use MQTT5 Client for new code. There are no current plans to
311
+ fully deprecate the MQTT 3.1.1 client but it is highly recommended customers migrate
312
+ to the MQTT5 Client to have access to a more robust feature set, clearer error handling, and lifetime
313
+ management. More details can be found here: <URL>
314
+ """ ,
315
+ since = "9.9.9" )
279
316
def mtls_from_bytes (cert_bytes , pri_key_bytes , ** kwargs ) -> awscrt .mqtt .Connection :
280
317
"""
281
318
This builder creates an :class:`awscrt.mqtt.Connection`, configured for an mTLS MQTT connection to AWS IoT.
@@ -294,6 +331,14 @@ def mtls_from_bytes(cert_bytes, pri_key_bytes, **kwargs) -> awscrt.mqtt.Connecti
294
331
return _builder (tls_ctx_options , ** kwargs )
295
332
296
333
334
+ @deprecated (
335
+ """
336
+ Deprecated tag: Please use MQTT5 Client for new code. There are no current plans to
337
+ fully deprecate the MQTT 3.1.1 client but it is highly recommended customers migrate
338
+ to the MQTT5 Client to have access to a more robust feature set, clearer error handling, and lifetime
339
+ management. More details can be found here: <URL>
340
+ """ ,
341
+ since = "9.9.9" )
297
342
def mtls_with_pkcs11 (* ,
298
343
pkcs11_lib : awscrt .io .Pkcs11Lib ,
299
344
user_pin : str ,
@@ -350,6 +395,15 @@ def mtls_with_pkcs11(*,
350
395
351
396
return _builder (tls_ctx_options , ** kwargs )
352
397
398
+
399
+ @deprecated (
400
+ """
401
+ Deprecated tag: Please use MQTT5 Client for new code. There are no current plans to
402
+ fully deprecate the MQTT 3.1.1 client but it is highly recommended customers migrate
403
+ to the MQTT5 Client to have access to a more robust feature set, clearer error handling, and lifetime
404
+ management. More details can be found here: <URL>
405
+ """ ,
406
+ since = "9.9.9" )
353
407
def mtls_with_pkcs12 (* ,
354
408
pkcs12_filepath : str ,
355
409
pkcs12_password : str ,
@@ -376,6 +430,14 @@ def mtls_with_pkcs12(*,
376
430
return _builder (tls_ctx_options , ** kwargs )
377
431
378
432
433
+ @deprecated (
434
+ """
435
+ Deprecated tag: Please use MQTT5 Client for new code. There are no current plans to
436
+ fully deprecate the MQTT 3.1.1 client but it is highly recommended customers migrate
437
+ to the MQTT5 Client to have access to a more robust feature set, clearer error handling, and lifetime
438
+ management. More details can be found here: <URL>
439
+ """ ,
440
+ since = "9.9.9" )
379
441
def mtls_with_windows_cert_store_path (* ,
380
442
cert_store_path : str ,
381
443
** kwargs ) -> awscrt .mqtt .Connection :
@@ -400,6 +462,14 @@ def mtls_with_windows_cert_store_path(*,
400
462
return _builder (tls_ctx_options , ** kwargs )
401
463
402
464
465
+ @deprecated (
466
+ """
467
+ Deprecated tag: Please use MQTT5 Client for new code. There are no current plans to
468
+ fully deprecate the MQTT 3.1.1 client but it is highly recommended customers migrate
469
+ to the MQTT5 Client to have access to a more robust feature set, clearer error handling, and lifetime
470
+ management. More details can be found here: <URL>
471
+ """ ,
472
+ since = "9.9.9" )
403
473
def websockets_with_default_aws_signing (
404
474
region ,
405
475
credentials_provider ,
@@ -444,6 +514,14 @@ def _sign_websocket_handshake_request(transform_args, **kwargs):
444
514
return websockets_with_custom_handshake (_sign_websocket_handshake_request , websocket_proxy_options , ** kwargs )
445
515
446
516
517
+ @deprecated (
518
+ """
519
+ Deprecated tag: Please use MQTT5 Client for new code. There are no current plans to
520
+ fully deprecate the MQTT 3.1.1 client but it is highly recommended customers migrate
521
+ to the MQTT5 Client to have access to a more robust feature set, clearer error handling, and lifetime
522
+ management. More details can be found here: <URL>
523
+ """ ,
524
+ since = "9.9.9" )
447
525
def websockets_with_custom_handshake (
448
526
websocket_handshake_transform ,
449
527
websocket_proxy_options = None ,
@@ -498,6 +576,14 @@ def _add_to_username_parameter(input_string, parameter_value, parameter_pretext)
498
576
return return_string + parameter_pretext + parameter_value
499
577
500
578
579
+ @deprecated (
580
+ """
581
+ Deprecated tag: Please use MQTT5 Client for new code. There are no current plans to
582
+ fully deprecate the MQTT 3.1.1 client but it is highly recommended customers migrate
583
+ to the MQTT5 Client to have access to a more robust feature set, clearer error handling, and lifetime
584
+ management. More details can be found here: <URL>
585
+ """ ,
586
+ since = "9.9.9" )
501
587
def direct_with_custom_authorizer (
502
588
auth_username = None ,
503
589
auth_authorizer_name = None ,
@@ -552,6 +638,15 @@ def direct_with_custom_authorizer(
552
638
use_websockets = False ,
553
639
** kwargs )
554
640
641
+
642
+ @deprecated (
643
+ """
644
+ Deprecated tag: Please use MQTT5 Client for new code. There are no current plans to
645
+ fully deprecate the MQTT 3.1.1 client but it is highly recommended customers migrate
646
+ to the MQTT5 Client to have access to a more robust feature set, clearer error handling, and lifetime
647
+ management. More details can be found here: <URL>
648
+ """ ,
649
+ since = "9.9.9" )
555
650
def websockets_with_custom_authorizer (
556
651
region = None ,
557
652
credentials_provider = None ,
@@ -615,6 +710,14 @@ def websockets_with_custom_authorizer(
615
710
** kwargs )
616
711
617
712
713
+ @deprecated (
714
+ """
715
+ Deprecated tag: Please use MQTT5 Client for new code. There are no current plans to
716
+ fully deprecate the MQTT 3.1.1 client but it is highly recommended customers migrate
717
+ to the MQTT5 Client to have access to a more robust feature set, clearer error handling, and lifetime
718
+ management. More details can be found here: <URL>
719
+ """ ,
720
+ since = "9.9.9" )
618
721
def _with_custom_authorizer (auth_username = None ,
619
722
auth_authorizer_name = None ,
620
723
auth_authorizer_signature = None ,
@@ -675,6 +778,14 @@ def _sign_websocket_handshake_request(transform_args, **kwargs):
675
778
** kwargs )
676
779
677
780
781
+ @deprecated (
782
+ """
783
+ Deprecated tag: Please use MQTT5 Client for new code. There are no current plans to
784
+ fully deprecate the MQTT 3.1.1 client but it is highly recommended customers migrate
785
+ to the MQTT5 Client to have access to a more robust feature set, clearer error handling, and lifetime
786
+ management. More details can be found here: <URL>
787
+ """ ,
788
+ since = "9.9.9" )
678
789
def new_default_builder (** kwargs ) -> awscrt .mqtt .Connection :
679
790
"""
680
791
This builder creates an :class:`awscrt.mqtt.Connection`, without any configuration besides the default TLS context options.
0 commit comments