Debian Codegraph @

src/auth0/management/log_streams/client.py

raw symbols SCIP
1 # This file was auto-generated by Fern from our API Definition.
2
3 import typing
4
5 from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
6 from ..core.request_options import RequestOptions
7 from ..types.create_log_stream_request_content import CreateLogStreamRequestContent
8 from ..types.create_log_stream_response_content import CreateLogStreamResponseContent
9 from ..types.get_log_stream_response_content import GetLogStreamResponseContent
10 from ..types.log_stream_filter import LogStreamFilter
11 from ..types.log_stream_pii_config import LogStreamPiiConfig
12 from ..types.log_stream_response_schema import LogStreamResponseSchema
13 from ..types.log_stream_sink_patch import LogStreamSinkPatch
14 from ..types.log_stream_status_enum import LogStreamStatusEnum
15 from ..types.update_log_stream_response_content import UpdateLogStreamResponseContent
16 from .raw_client import AsyncRawLogStreamsClient, RawLogStreamsClient
17
18 # this is used as the default value for optional parameters
19 OMIT = typing.cast(typing.Any, ...)
20
21
22 class LogStreamsClient:
23 def __init__(self, *, client_wrapper: SyncClientWrapper):
24 self._raw_client = RawLogStreamsClient(client_wrapper=client_wrapper)
25
26 @property
27 def with_raw_response(self) -> RawLogStreamsClient:
28 """
29 Retrieves a raw implementation of this client that returns raw responses.
30
31 Returns
32 -------
33 RawLogStreamsClient
34 """
35 return self._raw_client
36
37 def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.List[LogStreamResponseSchema]:
38 """
39 Retrieve details on [log streams](https://auth0.com/docs/logs/streams).
40
41 **Sample Response**
42
43 ```json
44 [{
45 "id": "string",
46 "name": "string",
47 "type": "eventbridge",
48 "status": "active|paused|suspended",
49 "sink": {
50 "awsAccountId": "string",
51 "awsRegion": "string",
52 "awsPartnerEventSource": "string"
53 }
54 }, {
55 "id": "string",
56 "name": "string",
57 "type": "http",
58 "status": "active|paused|suspended",
59 "sink": {
60 "httpContentFormat": "JSONLINES|JSONARRAY",
61 "httpContentType": "string",
62 "httpEndpoint": "string",
63 "httpAuthorization": "string"
64 }
65 },
66 {
67 "id": "string",
68 "name": "string",
69 "type": "eventgrid",
70 "status": "active|paused|suspended",
71 "sink": {
72 "azureSubscriptionId": "string",
73 "azureResourceGroup": "string",
74 "azureRegion": "string",
75 "azurePartnerTopic": "string"
76 }
77 },
78 {
79 "id": "string",
80 "name": "string",
81 "type": "splunk",
82 "status": "active|paused|suspended",
83 "sink": {
84 "splunkDomain": "string",
85 "splunkToken": "string",
86 "splunkPort": "string",
87 "splunkSecure": "boolean"
88 }
89 },
90 {
91 "id": "string",
92 "name": "string",
93 "type": "sumo",
94 "status": "active|paused|suspended",
95 "sink": {
96 "sumoSourceAddress": "string"
97 }
98 },
99 {
100 "id": "string",
101 "name": "string",
102 "type": "datadog",
103 "status": "active|paused|suspended",
104 "sink": {
105 "datadogRegion": "string",
106 "datadogApiKey": "string"
107 }
108 }]
109 ```
110
111 Parameters
112 ----------
113 request_options : typing.Optional[RequestOptions]
114 Request-specific configuration.
115
116 Returns
117 -------
118 typing.List[LogStreamResponseSchema]
119 Returning log streams
120
121 Examples
122 --------
123 from auth0 import Auth0
124
125 client = Auth0(
126 token="YOUR_TOKEN",
127 )
128 client.log_streams.list()
129 """
130 _response = self._raw_client.list(request_options=request_options)
131 return _response.data
132
133 def create(
134 self, *, request: CreateLogStreamRequestContent, request_options: typing.Optional[RequestOptions] = None
135 ) -> CreateLogStreamResponseContent:
136 """
137 Create a log stream.
138
139 **Log Stream Types**
140
141 The `type` of log stream being created determines the properties required in the `sink` payload.
142
143 **HTTP Stream**
144
145 For an `http` Stream, the `sink` properties are listed in the payload below.
146
147 **Request:**
148 ```json
149 {
150 "name": "string",
151 "type": "http",
152 "sink": {
153 "httpEndpoint": "string",
154 "httpContentType": "string",
155 "httpContentFormat": "JSONLINES|JSONARRAY",
156 "httpAuthorization": "string"
157 }
158 }
159 ```
160
161 **Response:**
162 ```json
163 {
164 "id": "string",
165 "name": "string",
166 "type": "http",
167 "status": "active",
168 "sink": {
169 "httpEndpoint": "string",
170 "httpContentType": "string",
171 "httpContentFormat": "JSONLINES|JSONARRAY",
172 "httpAuthorization": "string"
173 }
174 }
175 ```
176
177 **Amazon EventBridge Stream**
178
179 For an `eventbridge` Stream, the `sink` properties are listed in the payload below.
180
181 **Request:**
182 ```json
183 {
184 "name": "string",
185 "type": "eventbridge",
186 "sink": {
187 "awsRegion": "string",
188 "awsAccountId": "string"
189 }
190 }
191 ```
192
193 The response will include an additional field `awsPartnerEventSource` in the `sink`:
194
195 **Response:**
196 ```json
197 {
198 "id": "string",
199 "name": "string",
200 "type": "eventbridge",
201 "status": "active",
202 "sink": {
203 "awsAccountId": "string",
204 "awsRegion": "string",
205 "awsPartnerEventSource": "string"
206 }
207 }
208 ```
209
210 **Azure Event Grid Stream**
211
212 For an `Azure Event Grid` Stream, the `sink` properties are listed in the payload below.
213
214 **Request:**
215 ```json
216 {
217 "name": "string",
218 "type": "eventgrid",
219 "sink": {
220 "azureSubscriptionId": "string",
221 "azureResourceGroup": "string",
222 "azureRegion": "string"
223 }
224 }
225 ```
226
227 **Response:**
228 ```json
229 {
230 "id": "string",
231 "name": "string",
232 "type": "http",
233 "status": "active",
234 "sink": {
235 "azureSubscriptionId": "string",
236 "azureResourceGroup": "string",
237 "azureRegion": "string",
238 "azurePartnerTopic": "string"
239 }
240 }
241 ```
242
243 **Datadog Stream**
244
245 For a `Datadog` Stream, the `sink` properties are listed in the payload below.
246
247 **Request:**
248 ```json
249 {
250 "name": "string",
251 "type": "datadog",
252 "sink": {
253 "datadogRegion": "string",
254 "datadogApiKey": "string"
255 }
256 }
257 ```
258
259 **Response:**
260 ```json
261 {
262 "id": "string",
263 "name": "string",
264 "type": "datadog",
265 "status": "active",
266 "sink": {
267 "datadogRegion": "string",
268 "datadogApiKey": "string"
269 }
270 }
271 ```
272
273 **Splunk Stream**
274
275 For a `Splunk` Stream, the `sink` properties are listed in the payload below.
276
277 **Request:**
278 ```json
279 {
280 "name": "string",
281 "type": "splunk",
282 "sink": {
283 "splunkDomain": "string",
284 "splunkToken": "string",
285 "splunkPort": "string",
286 "splunkSecure": "boolean"
287 }
288 }
289 ```
290
291 **Response:**
292 ```json
293 {
294 "id": "string",
295 "name": "string",
296 "type": "splunk",
297 "status": "active",
298 "sink": {
299 "splunkDomain": "string",
300 "splunkToken": "string",
301 "splunkPort": "string",
302 "splunkSecure": "boolean"
303 }
304 }
305 ```
306
307 **Sumo Logic Stream**
308
309 For a `Sumo Logic` Stream, the `sink` properties are listed in the payload below.
310
311 **Request:**
312 ```json
313 {
314 "name": "string",
315 "type": "sumo",
316 "sink": {
317 "sumoSourceAddress": "string"
318 }
319 }
320 ```
321
322 **Response:**
323 ```json
324 {
325 "id": "string",
326 "name": "string",
327 "type": "sumo",
328 "status": "active",
329 "sink": {
330 "sumoSourceAddress": "string"
331 }
332 }
333 ```
334
335 Parameters
336 ----------
337 request : CreateLogStreamRequestContent
338
339 request_options : typing.Optional[RequestOptions]
340 Request-specific configuration.
341
342 Returns
343 -------
344 CreateLogStreamResponseContent
345 Log stream created
346
347 Examples
348 --------
349 from auth0 import Auth0, CreateLogStreamHttpRequestBody, LogStreamHttpSink
350
351 client = Auth0(
352 token="YOUR_TOKEN",
353 )
354 client.log_streams.create(
355 request=CreateLogStreamHttpRequestBody(
356 type="http",
357 sink=LogStreamHttpSink(
358 http_endpoint="httpEndpoint",
359 ),
360 ),
361 )
362 """
363 _response = self._raw_client.create(request=request, request_options=request_options)
364 return _response.data
365
366 def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> GetLogStreamResponseContent:
367 """
368 Retrieve a log stream configuration and status.
369
370 **Sample responses**
371
372 **Amazon EventBridge Log Stream**
373
374 ```json
375 {
376 "id": "string",
377 "name": "string",
378 "type": "eventbridge",
379 "status": "active|paused|suspended",
380 "sink": {
381 "awsAccountId": "string",
382 "awsRegion": "string",
383 "awsPartnerEventSource": "string"
384 }
385 }
386 ```
387
388 **HTTP Log Stream**
389
390 ```json
391 {
392 "id": "string",
393 "name": "string",
394 "type": "http",
395 "status": "active|paused|suspended",
396 "sink": {
397 "httpContentFormat": "JSONLINES|JSONARRAY",
398 "httpContentType": "string",
399 "httpEndpoint": "string",
400 "httpAuthorization": "string"
401 }
402 }
403 ```
404
405 **Datadog Log Stream**
406
407 ```json
408 {
409 "id": "string",
410 "name": "string",
411 "type": "datadog",
412 "status": "active|paused|suspended",
413 "sink": {
414 "datadogRegion": "string",
415 "datadogApiKey": "string"
416 }
417 }
418 ```
419
420 **Mixpanel**
421
422 **Request:**
423
424 ```json
425 {
426 "name": "string",
427 "type": "mixpanel",
428 "sink": {
429 "mixpanelRegion": "string",
430 "mixpanelProjectId": "string",
431 "mixpanelServiceAccountUsername": "string",
432 "mixpanelServiceAccountPassword": "string"
433 }
434 }
435 ```
436
437 **Response:**
438
439 ```json
440 {
441 "id": "string",
442 "name": "string",
443 "type": "mixpanel",
444 "status": "active",
445 "sink": {
446 "mixpanelRegion": "string",
447 "mixpanelProjectId": "string",
448 "mixpanelServiceAccountUsername": "string",
449 "mixpanelServiceAccountPassword": "string"
450 }
451 }
452 ```
453
454 **Segment**
455
456 **Request:**
457
458 ```json
459 {
460 "name": "string",
461 "type": "segment",
462 "sink": {
463 "segmentWriteKey": "string"
464 }
465 }
466 ```
467
468 **Response:**
469
470 ```json
471 {
472 "id": "string",
473 "name": "string",
474 "type": "segment",
475 "status": "active",
476 "sink": {
477 "segmentWriteKey": "string"
478 }
479 }
480 ```
481
482 **Splunk Log Stream**
483
484 ```json
485 {
486 "id": "string",
487 "name": "string",
488 "type": "splunk",
489 "status": "active|paused|suspended",
490 "sink": {
491 "splunkDomain": "string",
492 "splunkToken": "string",
493 "splunkPort": "string",
494 "splunkSecure": "boolean"
495 }
496 }
497 ```
498
499 **Sumo Logic Log Stream**
500
501 ```json
502 {
503 "id": "string",
504 "name": "string",
505 "type": "sumo",
506 "status": "active|paused|suspended",
507 "sink": {
508 "sumoSourceAddress": "string"
509 }
510 }
511 ```
512
513 **Status**
514
515 The `status` of a log stream maybe any of the following:
516
517 1. `active` - Stream is currently enabled.
518 2. `paused` - Stream is currently user disabled and will not attempt log delivery.
519 3. `suspended` - Stream is currently disabled because of errors and will not attempt log delivery.
520
521 Parameters
522 ----------
523 id : str
524 The id of the log stream to get
525
526 request_options : typing.Optional[RequestOptions]
527 Request-specific configuration.
528
529 Returns
530 -------
531 GetLogStreamResponseContent
532 Returning log stream.
533
534 Examples
535 --------
536 from auth0 import Auth0
537
538 client = Auth0(
539 token="YOUR_TOKEN",
540 )
541 client.log_streams.get(
542 id="id",
543 )
544 """
545 _response = self._raw_client.get(id, request_options=request_options)
546 return _response.data
547
548 def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
549 """
550 Delete a log stream.
551
552 Parameters
553 ----------
554 id : str
555 The id of the log stream to delete
556
557 request_options : typing.Optional[RequestOptions]
558 Request-specific configuration.
559
560 Returns
561 -------
562 None
563
564 Examples
565 --------
566 from auth0 import Auth0
567
568 client = Auth0(
569 token="YOUR_TOKEN",
570 )
571 client.log_streams.delete(
572 id="id",
573 )
574 """
575 _response = self._raw_client.delete(id, request_options=request_options)
576 return _response.data
577
578 def update(
579 self,
580 id: str,
581 *,
582 name: typing.Optional[str] = OMIT,
583 status: typing.Optional[LogStreamStatusEnum] = OMIT,
584 is_priority: typing.Optional[bool] = OMIT,
585 filters: typing.Optional[typing.Sequence[LogStreamFilter]] = OMIT,
586 pii_config: typing.Optional[LogStreamPiiConfig] = OMIT,
587 sink: typing.Optional[LogStreamSinkPatch] = OMIT,
588 request_options: typing.Optional[RequestOptions] = None,
589 ) -> UpdateLogStreamResponseContent:
590 """
591 Update a log stream.
592
593 **Examples of how to use the PATCH endpoint.**
594
595 The following fields may be updated in a PATCH operation:
596
597 - name
598 - status
599 - sink
600
601 Note: For log streams of type `eventbridge` and `eventgrid`, updating the `sink` is not permitted.
602
603 **Update the status of a log stream**
604
605 ```json
606 {
607 "status": "active|paused"
608 }
609 ```
610
611 **Update the name of a log stream**
612
613 ```json
614 {
615 "name": "string"
616 }
617 ```
618
619 **Update the sink properties of a stream of type `http`**
620
621 ```json
622 {
623 "sink": {
624 "httpEndpoint": "string",
625 "httpContentType": "string",
626 "httpContentFormat": "JSONARRAY|JSONLINES",
627 "httpAuthorization": "string"
628 }
629 }
630 ```
631
632 **Update the sink properties of a stream of type `datadog`**
633
634 ```json
635 {
636 "sink": {
637 "datadogRegion": "string",
638 "datadogApiKey": "string"
639 }
640 }
641 ```
642
643 **Update the sink properties of a stream of type `splunk`**
644
645 ```json
646 {
647 "sink": {
648 "splunkDomain": "string",
649 "splunkToken": "string",
650 "splunkPort": "string",
651 "splunkSecure": "boolean"
652 }
653 }
654 ```
655
656 **Update the sink properties of a stream of type `sumo`**
657
658 ```json
659 {
660 "sink": {
661 "sumoSourceAddress": "string"
662 }
663 }
664 ```
665
666 Parameters
667 ----------
668 id : str
669 The id of the log stream to get
670
671 name : typing.Optional[str]
672 log stream name
673
674 status : typing.Optional[LogStreamStatusEnum]
675
676 is_priority : typing.Optional[bool]
677 True for priority log streams, false for non-priority
678
679 filters : typing.Optional[typing.Sequence[LogStreamFilter]]
680 Only logs events matching these filters will be delivered by the stream. If omitted or empty, all events will be delivered.
681
682 pii_config : typing.Optional[LogStreamPiiConfig]
683
684 sink : typing.Optional[LogStreamSinkPatch]
685
686 request_options : typing.Optional[RequestOptions]
687 Request-specific configuration.
688
689 Returns
690 -------
691 UpdateLogStreamResponseContent
692 Log stream updated
693
694 Examples
695 --------
696 from auth0 import Auth0
697
698 client = Auth0(
699 token="YOUR_TOKEN",
700 )
701 client.log_streams.update(
702 id="id",
703 )
704 """
705 _response = self._raw_client.update(
706 id,
707 name=name,
708 status=status,
709 is_priority=is_priority,
710 filters=filters,
711 pii_config=pii_config,
712 sink=sink,
713 request_options=request_options,
714 )
715 return _response.data
716
717
718 class AsyncLogStreamsClient:
719 def __init__(self, *, client_wrapper: AsyncClientWrapper):
720 self._raw_client = AsyncRawLogStreamsClient(client_wrapper=client_wrapper)
721
722 @property
723 def with_raw_response(self) -> AsyncRawLogStreamsClient:
724 """
725 Retrieves a raw implementation of this client that returns raw responses.
726
727 Returns
728 -------
729 AsyncRawLogStreamsClient
730 """
731 return self._raw_client
732
733 async def list(
734 self, *, request_options: typing.Optional[RequestOptions] = None
735 ) -> typing.List[LogStreamResponseSchema]:
736 """
737 Retrieve details on [log streams](https://auth0.com/docs/logs/streams).
738
739 **Sample Response**
740
741 ```json
742 [{
743 "id": "string",
744 "name": "string",
745 "type": "eventbridge",
746 "status": "active|paused|suspended",
747 "sink": {
748 "awsAccountId": "string",
749 "awsRegion": "string",
750 "awsPartnerEventSource": "string"
751 }
752 }, {
753 "id": "string",
754 "name": "string",
755 "type": "http",
756 "status": "active|paused|suspended",
757 "sink": {
758 "httpContentFormat": "JSONLINES|JSONARRAY",
759 "httpContentType": "string",
760 "httpEndpoint": "string",
761 "httpAuthorization": "string"
762 }
763 },
764 {
765 "id": "string",
766 "name": "string",
767 "type": "eventgrid",
768 "status": "active|paused|suspended",
769 "sink": {
770 "azureSubscriptionId": "string",
771 "azureResourceGroup": "string",
772 "azureRegion": "string",
773 "azurePartnerTopic": "string"
774 }
775 },
776 {
777 "id": "string",
778 "name": "string",
779 "type": "splunk",
780 "status": "active|paused|suspended",
781 "sink": {
782 "splunkDomain": "string",
783 "splunkToken": "string",
784 "splunkPort": "string",
785 "splunkSecure": "boolean"
786 }
787 },
788 {
789 "id": "string",
790 "name": "string",
791 "type": "sumo",
792 "status": "active|paused|suspended",
793 "sink": {
794 "sumoSourceAddress": "string"
795 }
796 },
797 {
798 "id": "string",
799 "name": "string",
800 "type": "datadog",
801 "status": "active|paused|suspended",
802 "sink": {
803 "datadogRegion": "string",
804 "datadogApiKey": "string"
805 }
806 }]
807 ```
808
809 Parameters
810 ----------
811 request_options : typing.Optional[RequestOptions]
812 Request-specific configuration.
813
814 Returns
815 -------
816 typing.List[LogStreamResponseSchema]
817 Returning log streams
818
819 Examples
820 --------
821 import asyncio
822
823 from auth0 import AsyncAuth0
824
825 client = AsyncAuth0(
826 token="YOUR_TOKEN",
827 )
828
829
830 async def main() -> None:
831 await client.log_streams.list()
832
833
834 asyncio.run(main())
835 """
836 _response = await self._raw_client.list(request_options=request_options)
837 return _response.data
838
839 async def create(
840 self, *, request: CreateLogStreamRequestContent, request_options: typing.Optional[RequestOptions] = None
841 ) -> CreateLogStreamResponseContent:
842 """
843 Create a log stream.
844
845 **Log Stream Types**
846
847 The `type` of log stream being created determines the properties required in the `sink` payload.
848
849 **HTTP Stream**
850
851 For an `http` Stream, the `sink` properties are listed in the payload below.
852
853 **Request:**
854 ```json
855 {
856 "name": "string",
857 "type": "http",
858 "sink": {
859 "httpEndpoint": "string",
860 "httpContentType": "string",
861 "httpContentFormat": "JSONLINES|JSONARRAY",
862 "httpAuthorization": "string"
863 }
864 }
865 ```
866
867 **Response:**
868 ```json
869 {
870 "id": "string",
871 "name": "string",
872 "type": "http",
873 "status": "active",
874 "sink": {
875 "httpEndpoint": "string",
876 "httpContentType": "string",
877 "httpContentFormat": "JSONLINES|JSONARRAY",
878 "httpAuthorization": "string"
879 }
880 }
881 ```
882
883 **Amazon EventBridge Stream**
884
885 For an `eventbridge` Stream, the `sink` properties are listed in the payload below.
886
887 **Request:**
888 ```json
889 {
890 "name": "string",
891 "type": "eventbridge",
892 "sink": {
893 "awsRegion": "string",
894 "awsAccountId": "string"
895 }
896 }
897 ```
898
899 The response will include an additional field `awsPartnerEventSource` in the `sink`:
900
901 **Response:**
902 ```json
903 {
904 "id": "string",
905 "name": "string",
906 "type": "eventbridge",
907 "status": "active",
908 "sink": {
909 "awsAccountId": "string",
910 "awsRegion": "string",
911 "awsPartnerEventSource": "string"
912 }
913 }
914 ```
915
916 **Azure Event Grid Stream**
917
918 For an `Azure Event Grid` Stream, the `sink` properties are listed in the payload below.
919
920 **Request:**
921 ```json
922 {
923 "name": "string",
924 "type": "eventgrid",
925 "sink": {
926 "azureSubscriptionId": "string",
927 "azureResourceGroup": "string",
928 "azureRegion": "string"
929 }
930 }
931 ```
932
933 **Response:**
934 ```json
935 {
936 "id": "string",
937 "name": "string",
938 "type": "http",
939 "status": "active",
940 "sink": {
941 "azureSubscriptionId": "string",
942 "azureResourceGroup": "string",
943 "azureRegion": "string",
944 "azurePartnerTopic": "string"
945 }
946 }
947 ```
948
949 **Datadog Stream**
950
951 For a `Datadog` Stream, the `sink` properties are listed in the payload below.
952
953 **Request:**
954 ```json
955 {
956 "name": "string",
957 "type": "datadog",
958 "sink": {
959 "datadogRegion": "string",
960 "datadogApiKey": "string"
961 }
962 }
963 ```
964
965 **Response:**
966 ```json
967 {
968 "id": "string",
969 "name": "string",
970 "type": "datadog",
971 "status": "active",
972 "sink": {
973 "datadogRegion": "string",
974 "datadogApiKey": "string"
975 }
976 }
977 ```
978
979 **Splunk Stream**
980
981 For a `Splunk` Stream, the `sink` properties are listed in the payload below.
982
983 **Request:**
984 ```json
985 {
986 "name": "string",
987 "type": "splunk",
988 "sink": {
989 "splunkDomain": "string",
990 "splunkToken": "string",
991 "splunkPort": "string",
992 "splunkSecure": "boolean"
993 }
994 }
995 ```
996
997 **Response:**
998 ```json
999 {
1000 "id": "string",
1001 "name": "string",
1002 "type": "splunk",
1003 "status": "active",
1004 "sink": {
1005 "splunkDomain": "string",
1006 "splunkToken": "string",
1007 "splunkPort": "string",
1008 "splunkSecure": "boolean"
1009 }
1010 }
1011 ```
1012
1013 **Sumo Logic Stream**
1014
1015 For a `Sumo Logic` Stream, the `sink` properties are listed in the payload below.
1016
1017 **Request:**
1018 ```json
1019 {
1020 "name": "string",
1021 "type": "sumo",
1022 "sink": {
1023 "sumoSourceAddress": "string"
1024 }
1025 }
1026 ```
1027
1028 **Response:**
1029 ```json
1030 {
1031 "id": "string",
1032 "name": "string",
1033 "type": "sumo",
1034 "status": "active",
1035 "sink": {
1036 "sumoSourceAddress": "string"
1037 }
1038 }
1039 ```
1040
1041 Parameters
1042 ----------
1043 request : CreateLogStreamRequestContent
1044
1045 request_options : typing.Optional[RequestOptions]
1046 Request-specific configuration.
1047
1048 Returns
1049 -------
1050 CreateLogStreamResponseContent
1051 Log stream created
1052
1053 Examples
1054 --------
1055 import asyncio
1056
1057 from auth0 import AsyncAuth0, CreateLogStreamHttpRequestBody, LogStreamHttpSink
1058
1059 client = AsyncAuth0(
1060 token="YOUR_TOKEN",
1061 )
1062
1063
1064 async def main() -> None:
1065 await client.log_streams.create(
1066 request=CreateLogStreamHttpRequestBody(
1067 type="http",
1068 sink=LogStreamHttpSink(
1069 http_endpoint="httpEndpoint",
1070 ),
1071 ),
1072 )
1073
1074
1075 asyncio.run(main())
1076 """
1077 _response = await self._raw_client.create(request=request, request_options=request_options)
1078 return _response.data
1079
1080 async def get(
1081 self, id: str, *, request_options: typing.Optional[RequestOptions] = None
1082 ) -> GetLogStreamResponseContent:
1083 """
1084 Retrieve a log stream configuration and status.
1085
1086 **Sample responses**
1087
1088 **Amazon EventBridge Log Stream**
1089
1090 ```json
1091 {
1092 "id": "string",
1093 "name": "string",
1094 "type": "eventbridge",
1095 "status": "active|paused|suspended",
1096 "sink": {
1097 "awsAccountId": "string",
1098 "awsRegion": "string",
1099 "awsPartnerEventSource": "string"
1100 }
1101 }
1102 ```
1103
1104 **HTTP Log Stream**
1105
1106 ```json
1107 {
1108 "id": "string",
1109 "name": "string",
1110 "type": "http",
1111 "status": "active|paused|suspended",
1112 "sink": {
1113 "httpContentFormat": "JSONLINES|JSONARRAY",
1114 "httpContentType": "string",
1115 "httpEndpoint": "string",
1116 "httpAuthorization": "string"
1117 }
1118 }
1119 ```
1120
1121 **Datadog Log Stream**
1122
1123 ```json
1124 {
1125 "id": "string",
1126 "name": "string",
1127 "type": "datadog",
1128 "status": "active|paused|suspended",
1129 "sink": {
1130 "datadogRegion": "string",
1131 "datadogApiKey": "string"
1132 }
1133 }
1134 ```
1135
1136 **Mixpanel**
1137
1138 **Request:**
1139
1140 ```json
1141 {
1142 "name": "string",
1143 "type": "mixpanel",
1144 "sink": {
1145 "mixpanelRegion": "string",
1146 "mixpanelProjectId": "string",
1147 "mixpanelServiceAccountUsername": "string",
1148 "mixpanelServiceAccountPassword": "string"
1149 }
1150 }
1151 ```
1152
1153 **Response:**
1154
1155 ```json
1156 {
1157 "id": "string",
1158 "name": "string",
1159 "type": "mixpanel",
1160 "status": "active",
1161 "sink": {
1162 "mixpanelRegion": "string",
1163 "mixpanelProjectId": "string",
1164 "mixpanelServiceAccountUsername": "string",
1165 "mixpanelServiceAccountPassword": "string"
1166 }
1167 }
1168 ```
1169
1170 **Segment**
1171
1172 **Request:**
1173
1174 ```json
1175 {
1176 "name": "string",
1177 "type": "segment",
1178 "sink": {
1179 "segmentWriteKey": "string"
1180 }
1181 }
1182 ```
1183
1184 **Response:**
1185
1186 ```json
1187 {
1188 "id": "string",
1189 "name": "string",
1190 "type": "segment",
1191 "status": "active",
1192 "sink": {
1193 "segmentWriteKey": "string"
1194 }
1195 }
1196 ```
1197
1198 **Splunk Log Stream**
1199
1200 ```json
1201 {
1202 "id": "string",
1203 "name": "string",
1204 "type": "splunk",
1205 "status": "active|paused|suspended",
1206 "sink": {
1207 "splunkDomain": "string",
1208 "splunkToken": "string",
1209 "splunkPort": "string",
1210 "splunkSecure": "boolean"
1211 }
1212 }
1213 ```
1214
1215 **Sumo Logic Log Stream**
1216
1217 ```json
1218 {
1219 "id": "string",
1220 "name": "string",
1221 "type": "sumo",
1222 "status": "active|paused|suspended",
1223 "sink": {
1224 "sumoSourceAddress": "string"
1225 }
1226 }
1227 ```
1228
1229 **Status**
1230
1231 The `status` of a log stream maybe any of the following:
1232
1233 1. `active` - Stream is currently enabled.
1234 2. `paused` - Stream is currently user disabled and will not attempt log delivery.
1235 3. `suspended` - Stream is currently disabled because of errors and will not attempt log delivery.
1236
1237 Parameters
1238 ----------
1239 id : str
1240 The id of the log stream to get
1241
1242 request_options : typing.Optional[RequestOptions]
1243 Request-specific configuration.
1244
1245 Returns
1246 -------
1247 GetLogStreamResponseContent
1248 Returning log stream.
1249
1250 Examples
1251 --------
1252 import asyncio
1253
1254 from auth0 import AsyncAuth0
1255
1256 client = AsyncAuth0(
1257 token="YOUR_TOKEN",
1258 )
1259
1260
1261 async def main() -> None:
1262 await client.log_streams.get(
1263 id="id",
1264 )
1265
1266
1267 asyncio.run(main())
1268 """
1269 _response = await self._raw_client.get(id, request_options=request_options)
1270 return _response.data
1271
1272 async def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
1273 """
1274 Delete a log stream.
1275
1276 Parameters
1277 ----------
1278 id : str
1279 The id of the log stream to delete
1280
1281 request_options : typing.Optional[RequestOptions]
1282 Request-specific configuration.
1283
1284 Returns
1285 -------
1286 None
1287
1288 Examples
1289 --------
1290 import asyncio
1291
1292 from auth0 import AsyncAuth0
1293
1294 client = AsyncAuth0(
1295 token="YOUR_TOKEN",
1296 )
1297
1298
1299 async def main() -> None:
1300 await client.log_streams.delete(
1301 id="id",
1302 )
1303
1304
1305 asyncio.run(main())
1306 """
1307 _response = await self._raw_client.delete(id, request_options=request_options)
1308 return _response.data
1309
1310 async def update(
1311 self,
1312 id: str,
1313 *,
1314 name: typing.Optional[str] = OMIT,
1315 status: typing.Optional[LogStreamStatusEnum] = OMIT,
1316 is_priority: typing.Optional[bool] = OMIT,
1317 filters: typing.Optional[typing.Sequence[LogStreamFilter]] = OMIT,
1318 pii_config: typing.Optional[LogStreamPiiConfig] = OMIT,
1319 sink: typing.Optional[LogStreamSinkPatch] = OMIT,
1320 request_options: typing.Optional[RequestOptions] = None,
1321 ) -> UpdateLogStreamResponseContent:
1322 """
1323 Update a log stream.
1324
1325 **Examples of how to use the PATCH endpoint.**
1326
1327 The following fields may be updated in a PATCH operation:
1328
1329 - name
1330 - status
1331 - sink
1332
1333 Note: For log streams of type `eventbridge` and `eventgrid`, updating the `sink` is not permitted.
1334
1335 **Update the status of a log stream**
1336
1337 ```json
1338 {
1339 "status": "active|paused"
1340 }
1341 ```
1342
1343 **Update the name of a log stream**
1344
1345 ```json
1346 {
1347 "name": "string"
1348 }
1349 ```
1350
1351 **Update the sink properties of a stream of type `http`**
1352
1353 ```json
1354 {
1355 "sink": {
1356 "httpEndpoint": "string",
1357 "httpContentType": "string",
1358 "httpContentFormat": "JSONARRAY|JSONLINES",
1359 "httpAuthorization": "string"
1360 }
1361 }
1362 ```
1363
1364 **Update the sink properties of a stream of type `datadog`**
1365
1366 ```json
1367 {
1368 "sink": {
1369 "datadogRegion": "string",
1370 "datadogApiKey": "string"
1371 }
1372 }
1373 ```
1374
1375 **Update the sink properties of a stream of type `splunk`**
1376
1377 ```json
1378 {
1379 "sink": {
1380 "splunkDomain": "string",
1381 "splunkToken": "string",
1382 "splunkPort": "string",
1383 "splunkSecure": "boolean"
1384 }
1385 }
1386 ```
1387
1388 **Update the sink properties of a stream of type `sumo`**
1389
1390 ```json
1391 {
1392 "sink": {
1393 "sumoSourceAddress": "string"
1394 }
1395 }
1396 ```
1397
1398 Parameters
1399 ----------
1400 id : str
1401 The id of the log stream to get
1402
1403 name : typing.Optional[str]
1404 log stream name
1405
1406 status : typing.Optional[LogStreamStatusEnum]
1407
1408 is_priority : typing.Optional[bool]
1409 True for priority log streams, false for non-priority
1410
1411 filters : typing.Optional[typing.Sequence[LogStreamFilter]]
1412 Only logs events matching these filters will be delivered by the stream. If omitted or empty, all events will be delivered.
1413
1414 pii_config : typing.Optional[LogStreamPiiConfig]
1415
1416 sink : typing.Optional[LogStreamSinkPatch]
1417
1418 request_options : typing.Optional[RequestOptions]
1419 Request-specific configuration.
1420
1421 Returns
1422 -------
1423 UpdateLogStreamResponseContent
1424 Log stream updated
1425
1426 Examples
1427 --------
1428 import asyncio
1429
1430 from auth0 import AsyncAuth0
1431
1432 client = AsyncAuth0(
1433 token="YOUR_TOKEN",
1434 )
1435
1436
1437 async def main() -> None:
1438 await client.log_streams.update(
1439 id="id",
1440 )
1441
1442
1443 asyncio.run(main())
1444 """
1445 _response = await self._raw_client.update(
1446 id,
1447 name=name,
1448 status=status,
1449 is_priority=is_priority,
1450 filters=filters,
1451 pii_config=pii_config,
1452 sink=sink,
1453 request_options=request_options,
1454 )
1455 return _response.data