@@ -589,6 +589,125 @@ async def sync_job_cancel(
589
589
path_parts = __path_parts ,
590
590
)
591
591
592
+ @_rewrite_parameters ()
593
+ @_stability_warning (Stability .EXPERIMENTAL )
594
+ async def sync_job_check_in (
595
+ self ,
596
+ * ,
597
+ connector_sync_job_id : str ,
598
+ error_trace : t .Optional [bool ] = None ,
599
+ filter_path : t .Optional [t .Union [str , t .Sequence [str ]]] = None ,
600
+ human : t .Optional [bool ] = None ,
601
+ pretty : t .Optional [bool ] = None ,
602
+ ) -> ObjectApiResponse [t .Any ]:
603
+ """
604
+ Check in a connector sync job. Check in a connector sync job and set the `last_seen`
605
+ field to the current time before updating it in the internal index. To sync data
606
+ using self-managed connectors, you need to deploy the Elastic connector service
607
+ on your own infrastructure. This service runs automatically on Elastic Cloud
608
+ for Elastic managed connectors.
609
+
610
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/check-in-connector-sync-job-api.html>`_
611
+
612
+ :param connector_sync_job_id: The unique identifier of the connector sync job
613
+ to be checked in.
614
+ """
615
+ if connector_sync_job_id in SKIP_IN_PATH :
616
+ raise ValueError ("Empty value passed for parameter 'connector_sync_job_id'" )
617
+ __path_parts : t .Dict [str , str ] = {
618
+ "connector_sync_job_id" : _quote (connector_sync_job_id )
619
+ }
620
+ __path = (
621
+ f'/_connector/_sync_job/{ __path_parts ["connector_sync_job_id" ]} /_check_in'
622
+ )
623
+ __query : t .Dict [str , t .Any ] = {}
624
+ if error_trace is not None :
625
+ __query ["error_trace" ] = error_trace
626
+ if filter_path is not None :
627
+ __query ["filter_path" ] = filter_path
628
+ if human is not None :
629
+ __query ["human" ] = human
630
+ if pretty is not None :
631
+ __query ["pretty" ] = pretty
632
+ __headers = {"accept" : "application/json" }
633
+ return await self .perform_request ( # type: ignore[return-value]
634
+ "PUT" ,
635
+ __path ,
636
+ params = __query ,
637
+ headers = __headers ,
638
+ endpoint_id = "connector.sync_job_check_in" ,
639
+ path_parts = __path_parts ,
640
+ )
641
+
642
+ @_rewrite_parameters (
643
+ body_fields = ("worker_hostname" , "sync_cursor" ),
644
+ )
645
+ @_stability_warning (Stability .EXPERIMENTAL )
646
+ async def sync_job_claim (
647
+ self ,
648
+ * ,
649
+ connector_sync_job_id : str ,
650
+ worker_hostname : t .Optional [str ] = None ,
651
+ error_trace : t .Optional [bool ] = None ,
652
+ filter_path : t .Optional [t .Union [str , t .Sequence [str ]]] = None ,
653
+ human : t .Optional [bool ] = None ,
654
+ pretty : t .Optional [bool ] = None ,
655
+ sync_cursor : t .Optional [t .Any ] = None ,
656
+ body : t .Optional [t .Dict [str , t .Any ]] = None ,
657
+ ) -> ObjectApiResponse [t .Any ]:
658
+ """
659
+ Claim a connector sync job. This action updates the job status to `in_progress`
660
+ and sets the `last_seen` and `started_at` timestamps to the current time. Additionally,
661
+ it can set the `sync_cursor` property for the sync job. This API is not intended
662
+ for direct connector management by users. It supports the implementation of services
663
+ that utilize the connector protocol to communicate with Elasticsearch. To sync
664
+ data using self-managed connectors, you need to deploy the Elastic connector
665
+ service on your own infrastructure. This service runs automatically on Elastic
666
+ Cloud for Elastic managed connectors.
667
+
668
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/claim-connector-sync-job-api.html>`_
669
+
670
+ :param connector_sync_job_id: The unique identifier of the connector sync job.
671
+ :param worker_hostname: The host name of the current system that will run the
672
+ job.
673
+ :param sync_cursor: The cursor object from the last incremental sync job. This
674
+ should reference the `sync_cursor` field in the connector state for which
675
+ the job runs.
676
+ """
677
+ if connector_sync_job_id in SKIP_IN_PATH :
678
+ raise ValueError ("Empty value passed for parameter 'connector_sync_job_id'" )
679
+ if worker_hostname is None and body is None :
680
+ raise ValueError ("Empty value passed for parameter 'worker_hostname'" )
681
+ __path_parts : t .Dict [str , str ] = {
682
+ "connector_sync_job_id" : _quote (connector_sync_job_id )
683
+ }
684
+ __path = f'/_connector/_sync_job/{ __path_parts ["connector_sync_job_id" ]} /_claim'
685
+ __query : t .Dict [str , t .Any ] = {}
686
+ __body : t .Dict [str , t .Any ] = body if body is not None else {}
687
+ if error_trace is not None :
688
+ __query ["error_trace" ] = error_trace
689
+ if filter_path is not None :
690
+ __query ["filter_path" ] = filter_path
691
+ if human is not None :
692
+ __query ["human" ] = human
693
+ if pretty is not None :
694
+ __query ["pretty" ] = pretty
695
+ if not __body :
696
+ if worker_hostname is not None :
697
+ __body ["worker_hostname" ] = worker_hostname
698
+ if sync_cursor is not None :
699
+ __body ["sync_cursor" ] = sync_cursor
700
+ __headers = {"accept" : "application/json" , "content-type" : "application/json" }
701
+ return await self .perform_request ( # type: ignore[return-value]
702
+ "PUT" ,
703
+ __path ,
704
+ params = __query ,
705
+ headers = __headers ,
706
+ body = __body ,
707
+ endpoint_id = "connector.sync_job_claim" ,
708
+ path_parts = __path_parts ,
709
+ )
710
+
592
711
@_rewrite_parameters ()
593
712
@_stability_warning (Stability .BETA )
594
713
async def sync_job_delete (
@@ -634,6 +753,64 @@ async def sync_job_delete(
634
753
path_parts = __path_parts ,
635
754
)
636
755
756
+ @_rewrite_parameters (
757
+ body_fields = ("error" ,),
758
+ )
759
+ @_stability_warning (Stability .EXPERIMENTAL )
760
+ async def sync_job_error (
761
+ self ,
762
+ * ,
763
+ connector_sync_job_id : str ,
764
+ error : t .Optional [str ] = None ,
765
+ error_trace : t .Optional [bool ] = None ,
766
+ filter_path : t .Optional [t .Union [str , t .Sequence [str ]]] = None ,
767
+ human : t .Optional [bool ] = None ,
768
+ pretty : t .Optional [bool ] = None ,
769
+ body : t .Optional [t .Dict [str , t .Any ]] = None ,
770
+ ) -> ObjectApiResponse [t .Any ]:
771
+ """
772
+ Set a connector sync job error. Set the `error` field for a connector sync job
773
+ and set its `status` to `error`. To sync data using self-managed connectors,
774
+ you need to deploy the Elastic connector service on your own infrastructure.
775
+ This service runs automatically on Elastic Cloud for Elastic managed connectors.
776
+
777
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/set-connector-sync-job-error-api.html>`_
778
+
779
+ :param connector_sync_job_id: The unique identifier for the connector sync job.
780
+ :param error: The error for the connector sync job error field.
781
+ """
782
+ if connector_sync_job_id in SKIP_IN_PATH :
783
+ raise ValueError ("Empty value passed for parameter 'connector_sync_job_id'" )
784
+ if error is None and body is None :
785
+ raise ValueError ("Empty value passed for parameter 'error'" )
786
+ __path_parts : t .Dict [str , str ] = {
787
+ "connector_sync_job_id" : _quote (connector_sync_job_id )
788
+ }
789
+ __path = f'/_connector/_sync_job/{ __path_parts ["connector_sync_job_id" ]} /_error'
790
+ __query : t .Dict [str , t .Any ] = {}
791
+ __body : t .Dict [str , t .Any ] = body if body is not None else {}
792
+ if error_trace is not None :
793
+ __query ["error_trace" ] = error_trace
794
+ if filter_path is not None :
795
+ __query ["filter_path" ] = filter_path
796
+ if human is not None :
797
+ __query ["human" ] = human
798
+ if pretty is not None :
799
+ __query ["pretty" ] = pretty
800
+ if not __body :
801
+ if error is not None :
802
+ __body ["error" ] = error
803
+ __headers = {"accept" : "application/json" , "content-type" : "application/json" }
804
+ return await self .perform_request ( # type: ignore[return-value]
805
+ "PUT" ,
806
+ __path ,
807
+ params = __query ,
808
+ headers = __headers ,
809
+ body = __body ,
810
+ endpoint_id = "connector.sync_job_error" ,
811
+ path_parts = __path_parts ,
812
+ )
813
+
637
814
@_rewrite_parameters ()
638
815
@_stability_warning (Stability .BETA )
639
816
async def sync_job_get (
@@ -1032,6 +1209,66 @@ async def update_error(
1032
1209
path_parts = __path_parts ,
1033
1210
)
1034
1211
1212
+ @_rewrite_parameters (
1213
+ body_fields = ("features" ,),
1214
+ )
1215
+ @_stability_warning (Stability .EXPERIMENTAL )
1216
+ async def update_features (
1217
+ self ,
1218
+ * ,
1219
+ connector_id : str ,
1220
+ features : t .Optional [t .Mapping [str , t .Any ]] = None ,
1221
+ error_trace : t .Optional [bool ] = None ,
1222
+ filter_path : t .Optional [t .Union [str , t .Sequence [str ]]] = None ,
1223
+ human : t .Optional [bool ] = None ,
1224
+ pretty : t .Optional [bool ] = None ,
1225
+ body : t .Optional [t .Dict [str , t .Any ]] = None ,
1226
+ ) -> ObjectApiResponse [t .Any ]:
1227
+ """
1228
+ Update the connector features. Update the connector features in the connector
1229
+ document. This API can be used to control the following aspects of a connector:
1230
+ * document-level security * incremental syncs * advanced sync rules * basic sync
1231
+ rules Normally, the running connector service automatically manages these features.
1232
+ However, you can use this API to override the default behavior. To sync data
1233
+ using self-managed connectors, you need to deploy the Elastic connector service
1234
+ on your own infrastructure. This service runs automatically on Elastic Cloud
1235
+ for Elastic managed connectors.
1236
+
1237
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/update-connector-features-api.html>`_
1238
+
1239
+ :param connector_id: The unique identifier of the connector to be updated.
1240
+ :param features:
1241
+ """
1242
+ if connector_id in SKIP_IN_PATH :
1243
+ raise ValueError ("Empty value passed for parameter 'connector_id'" )
1244
+ if features is None and body is None :
1245
+ raise ValueError ("Empty value passed for parameter 'features'" )
1246
+ __path_parts : t .Dict [str , str ] = {"connector_id" : _quote (connector_id )}
1247
+ __path = f'/_connector/{ __path_parts ["connector_id" ]} /_features'
1248
+ __query : t .Dict [str , t .Any ] = {}
1249
+ __body : t .Dict [str , t .Any ] = body if body is not None else {}
1250
+ if error_trace is not None :
1251
+ __query ["error_trace" ] = error_trace
1252
+ if filter_path is not None :
1253
+ __query ["filter_path" ] = filter_path
1254
+ if human is not None :
1255
+ __query ["human" ] = human
1256
+ if pretty is not None :
1257
+ __query ["pretty" ] = pretty
1258
+ if not __body :
1259
+ if features is not None :
1260
+ __body ["features" ] = features
1261
+ __headers = {"accept" : "application/json" , "content-type" : "application/json" }
1262
+ return await self .perform_request ( # type: ignore[return-value]
1263
+ "PUT" ,
1264
+ __path ,
1265
+ params = __query ,
1266
+ headers = __headers ,
1267
+ body = __body ,
1268
+ endpoint_id = "connector.update_features" ,
1269
+ path_parts = __path_parts ,
1270
+ )
1271
+
1035
1272
@_rewrite_parameters (
1036
1273
body_fields = ("advanced_snippet" , "filtering" , "rules" ),
1037
1274
)
0 commit comments