|
| 1 | +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. |
| 2 | + |
| 3 | +from __future__ import annotations |
| 4 | + |
| 5 | +import typing_extensions |
| 6 | + |
| 7 | +import httpx |
| 8 | + |
| 9 | +from ...._types import Body, Query, Headers, NotGiven, not_given |
| 10 | +from ...._compat import cached_property |
| 11 | +from ...._resource import SyncAPIResource, AsyncAPIResource |
| 12 | +from ...._response import ( |
| 13 | + to_raw_response_wrapper, |
| 14 | + to_streamed_response_wrapper, |
| 15 | + async_to_raw_response_wrapper, |
| 16 | + async_to_streamed_response_wrapper, |
| 17 | +) |
| 18 | +from ...._base_client import make_request_options |
| 19 | +from ....types.cloudforce_one.threat_events.indicator_type_list_response import IndicatorTypeListResponse |
| 20 | + |
| 21 | +__all__ = ["IndicatorTypesResource", "AsyncIndicatorTypesResource"] |
| 22 | + |
| 23 | + |
| 24 | +class IndicatorTypesResource(SyncAPIResource): |
| 25 | + @cached_property |
| 26 | + def with_raw_response(self) -> IndicatorTypesResourceWithRawResponse: |
| 27 | + """ |
| 28 | + This property can be used as a prefix for any HTTP method call to return |
| 29 | + the raw response object instead of the parsed content. |
| 30 | +
|
| 31 | + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers |
| 32 | + """ |
| 33 | + return IndicatorTypesResourceWithRawResponse(self) |
| 34 | + |
| 35 | + @cached_property |
| 36 | + def with_streaming_response(self) -> IndicatorTypesResourceWithStreamingResponse: |
| 37 | + """ |
| 38 | + An alternative to `.with_raw_response` that doesn't eagerly read the response body. |
| 39 | +
|
| 40 | + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response |
| 41 | + """ |
| 42 | + return IndicatorTypesResourceWithStreamingResponse(self) |
| 43 | + |
| 44 | + @typing_extensions.deprecated("deprecated") |
| 45 | + def list( |
| 46 | + self, |
| 47 | + *, |
| 48 | + account_id: str, |
| 49 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 50 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 51 | + extra_headers: Headers | None = None, |
| 52 | + extra_query: Query | None = None, |
| 53 | + extra_body: Body | None = None, |
| 54 | + timeout: float | httpx.Timeout | None | NotGiven = not_given, |
| 55 | + ) -> IndicatorTypeListResponse: |
| 56 | + """This Method is deprecated. |
| 57 | +
|
| 58 | + Please use /events/dataset/:dataset_id/indicatorTypes |
| 59 | + instead. |
| 60 | +
|
| 61 | + Args: |
| 62 | + account_id: Account ID. |
| 63 | +
|
| 64 | + extra_headers: Send extra headers |
| 65 | +
|
| 66 | + extra_query: Add additional query parameters to the request |
| 67 | +
|
| 68 | + extra_body: Add additional JSON properties to the request |
| 69 | +
|
| 70 | + timeout: Override the client-level default timeout for this request, in seconds |
| 71 | + """ |
| 72 | + if not account_id: |
| 73 | + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") |
| 74 | + return self._get( |
| 75 | + f"/accounts/{account_id}/cloudforce-one/events/indicatorTypes", |
| 76 | + options=make_request_options( |
| 77 | + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
| 78 | + ), |
| 79 | + cast_to=IndicatorTypeListResponse, |
| 80 | + ) |
| 81 | + |
| 82 | + |
| 83 | +class AsyncIndicatorTypesResource(AsyncAPIResource): |
| 84 | + @cached_property |
| 85 | + def with_raw_response(self) -> AsyncIndicatorTypesResourceWithRawResponse: |
| 86 | + """ |
| 87 | + This property can be used as a prefix for any HTTP method call to return |
| 88 | + the raw response object instead of the parsed content. |
| 89 | +
|
| 90 | + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers |
| 91 | + """ |
| 92 | + return AsyncIndicatorTypesResourceWithRawResponse(self) |
| 93 | + |
| 94 | + @cached_property |
| 95 | + def with_streaming_response(self) -> AsyncIndicatorTypesResourceWithStreamingResponse: |
| 96 | + """ |
| 97 | + An alternative to `.with_raw_response` that doesn't eagerly read the response body. |
| 98 | +
|
| 99 | + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response |
| 100 | + """ |
| 101 | + return AsyncIndicatorTypesResourceWithStreamingResponse(self) |
| 102 | + |
| 103 | + @typing_extensions.deprecated("deprecated") |
| 104 | + async def list( |
| 105 | + self, |
| 106 | + *, |
| 107 | + account_id: str, |
| 108 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 109 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 110 | + extra_headers: Headers | None = None, |
| 111 | + extra_query: Query | None = None, |
| 112 | + extra_body: Body | None = None, |
| 113 | + timeout: float | httpx.Timeout | None | NotGiven = not_given, |
| 114 | + ) -> IndicatorTypeListResponse: |
| 115 | + """This Method is deprecated. |
| 116 | +
|
| 117 | + Please use /events/dataset/:dataset_id/indicatorTypes |
| 118 | + instead. |
| 119 | +
|
| 120 | + Args: |
| 121 | + account_id: Account ID. |
| 122 | +
|
| 123 | + extra_headers: Send extra headers |
| 124 | +
|
| 125 | + extra_query: Add additional query parameters to the request |
| 126 | +
|
| 127 | + extra_body: Add additional JSON properties to the request |
| 128 | +
|
| 129 | + timeout: Override the client-level default timeout for this request, in seconds |
| 130 | + """ |
| 131 | + if not account_id: |
| 132 | + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") |
| 133 | + return await self._get( |
| 134 | + f"/accounts/{account_id}/cloudforce-one/events/indicatorTypes", |
| 135 | + options=make_request_options( |
| 136 | + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
| 137 | + ), |
| 138 | + cast_to=IndicatorTypeListResponse, |
| 139 | + ) |
| 140 | + |
| 141 | + |
| 142 | +class IndicatorTypesResourceWithRawResponse: |
| 143 | + def __init__(self, indicator_types: IndicatorTypesResource) -> None: |
| 144 | + self._indicator_types = indicator_types |
| 145 | + |
| 146 | + self.list = ( # pyright: ignore[reportDeprecated] |
| 147 | + to_raw_response_wrapper( |
| 148 | + indicator_types.list, # pyright: ignore[reportDeprecated], |
| 149 | + ) |
| 150 | + ) |
| 151 | + |
| 152 | + |
| 153 | +class AsyncIndicatorTypesResourceWithRawResponse: |
| 154 | + def __init__(self, indicator_types: AsyncIndicatorTypesResource) -> None: |
| 155 | + self._indicator_types = indicator_types |
| 156 | + |
| 157 | + self.list = ( # pyright: ignore[reportDeprecated] |
| 158 | + async_to_raw_response_wrapper( |
| 159 | + indicator_types.list, # pyright: ignore[reportDeprecated], |
| 160 | + ) |
| 161 | + ) |
| 162 | + |
| 163 | + |
| 164 | +class IndicatorTypesResourceWithStreamingResponse: |
| 165 | + def __init__(self, indicator_types: IndicatorTypesResource) -> None: |
| 166 | + self._indicator_types = indicator_types |
| 167 | + |
| 168 | + self.list = ( # pyright: ignore[reportDeprecated] |
| 169 | + to_streamed_response_wrapper( |
| 170 | + indicator_types.list, # pyright: ignore[reportDeprecated], |
| 171 | + ) |
| 172 | + ) |
| 173 | + |
| 174 | + |
| 175 | +class AsyncIndicatorTypesResourceWithStreamingResponse: |
| 176 | + def __init__(self, indicator_types: AsyncIndicatorTypesResource) -> None: |
| 177 | + self._indicator_types = indicator_types |
| 178 | + |
| 179 | + self.list = ( # pyright: ignore[reportDeprecated] |
| 180 | + async_to_streamed_response_wrapper( |
| 181 | + indicator_types.list, # pyright: ignore[reportDeprecated], |
| 182 | + ) |
| 183 | + ) |
0 commit comments