|
27 | 27 | record_create_params, |
28 | 28 | record_import_params, |
29 | 29 | record_update_params, |
| 30 | + record_scan_review_params, |
30 | 31 | ) |
31 | | -from ...pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray |
| 32 | +from ...pagination import SyncSinglePage, AsyncSinglePage, SyncV4PagePaginationArray, AsyncV4PagePaginationArray |
32 | 33 | from ..._base_client import AsyncPaginator, make_request_options |
33 | 34 | from ...types.dns.ttl_param import TTLParam |
34 | 35 | from ...types.dns.record_tags import RecordTags |
|
40 | 41 | from ...types.dns.record_batch_response import RecordBatchResponse |
41 | 42 | from ...types.dns.record_delete_response import RecordDeleteResponse |
42 | 43 | from ...types.dns.record_import_response import RecordImportResponse |
| 44 | +from ...types.dns.record_scan_review_response import RecordScanReviewResponse |
| 45 | +from ...types.dns.record_scan_trigger_response import RecordScanTriggerResponse |
43 | 46 |
|
44 | 47 | __all__ = ["RecordsResource", "AsyncRecordsResource"] |
45 | 48 |
|
@@ -4973,6 +4976,135 @@ def scan( |
4973 | 4976 | cast_to=cast(Type[Optional[RecordScanResponse]], ResultWrapper[RecordScanResponse]), |
4974 | 4977 | ) |
4975 | 4978 |
|
| 4979 | + def scan_list( |
| 4980 | + self, |
| 4981 | + *, |
| 4982 | + zone_id: str, |
| 4983 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 4984 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 4985 | + extra_headers: Headers | None = None, |
| 4986 | + extra_query: Query | None = None, |
| 4987 | + extra_body: Body | None = None, |
| 4988 | + timeout: float | httpx.Timeout | None | NotGiven = not_given, |
| 4989 | + ) -> SyncSinglePage[RecordResponse]: |
| 4990 | + """ |
| 4991 | + Retrieves the list of DNS records discovered up to this point by the |
| 4992 | + asynchronous scan. These records are temporary until explicitly accepted or |
| 4993 | + rejected via `POST /scan/review`. Additional records may be discovered by the |
| 4994 | + scan later. |
| 4995 | +
|
| 4996 | + Args: |
| 4997 | + zone_id: Identifier. |
| 4998 | +
|
| 4999 | + extra_headers: Send extra headers |
| 5000 | +
|
| 5001 | + extra_query: Add additional query parameters to the request |
| 5002 | +
|
| 5003 | + extra_body: Add additional JSON properties to the request |
| 5004 | +
|
| 5005 | + timeout: Override the client-level default timeout for this request, in seconds |
| 5006 | + """ |
| 5007 | + if not zone_id: |
| 5008 | + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") |
| 5009 | + return self._get_api_list( |
| 5010 | + f"/zones/{zone_id}/dns_records/scan/review", |
| 5011 | + page=SyncSinglePage[RecordResponse], |
| 5012 | + options=make_request_options( |
| 5013 | + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
| 5014 | + ), |
| 5015 | + model=cast(Any, RecordResponse), # Union types cannot be passed in as arguments in the type system |
| 5016 | + ) |
| 5017 | + |
| 5018 | + def scan_review( |
| 5019 | + self, |
| 5020 | + *, |
| 5021 | + zone_id: str, |
| 5022 | + accepts: Iterable[record_scan_review_params.Accept] | Omit = omit, |
| 5023 | + rejects: Iterable[record_scan_review_params.Reject] | Omit = omit, |
| 5024 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 5025 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 5026 | + extra_headers: Headers | None = None, |
| 5027 | + extra_query: Query | None = None, |
| 5028 | + extra_body: Body | None = None, |
| 5029 | + timeout: float | httpx.Timeout | None | NotGiven = not_given, |
| 5030 | + ) -> Optional[RecordScanReviewResponse]: |
| 5031 | + """Accept or reject DNS records found by the DNS records scan. |
| 5032 | +
|
| 5033 | + Accepted records |
| 5034 | + will be permanently added to the zone, while rejected records will be |
| 5035 | + permanently deleted. |
| 5036 | +
|
| 5037 | + Args: |
| 5038 | + zone_id: Identifier. |
| 5039 | +
|
| 5040 | + extra_headers: Send extra headers |
| 5041 | +
|
| 5042 | + extra_query: Add additional query parameters to the request |
| 5043 | +
|
| 5044 | + extra_body: Add additional JSON properties to the request |
| 5045 | +
|
| 5046 | + timeout: Override the client-level default timeout for this request, in seconds |
| 5047 | + """ |
| 5048 | + if not zone_id: |
| 5049 | + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") |
| 5050 | + return self._post( |
| 5051 | + f"/zones/{zone_id}/dns_records/scan/review", |
| 5052 | + body=maybe_transform( |
| 5053 | + { |
| 5054 | + "accepts": accepts, |
| 5055 | + "rejects": rejects, |
| 5056 | + }, |
| 5057 | + record_scan_review_params.RecordScanReviewParams, |
| 5058 | + ), |
| 5059 | + options=make_request_options( |
| 5060 | + extra_headers=extra_headers, |
| 5061 | + extra_query=extra_query, |
| 5062 | + extra_body=extra_body, |
| 5063 | + timeout=timeout, |
| 5064 | + post_parser=ResultWrapper[Optional[RecordScanReviewResponse]]._unwrapper, |
| 5065 | + ), |
| 5066 | + cast_to=cast(Type[Optional[RecordScanReviewResponse]], ResultWrapper[RecordScanReviewResponse]), |
| 5067 | + ) |
| 5068 | + |
| 5069 | + def scan_trigger( |
| 5070 | + self, |
| 5071 | + *, |
| 5072 | + zone_id: str, |
| 5073 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 5074 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 5075 | + extra_headers: Headers | None = None, |
| 5076 | + extra_query: Query | None = None, |
| 5077 | + extra_body: Body | None = None, |
| 5078 | + timeout: float | httpx.Timeout | None | NotGiven = not_given, |
| 5079 | + ) -> RecordScanTriggerResponse: |
| 5080 | + """Initiates an asynchronous scan for common DNS records on your domain. |
| 5081 | +
|
| 5082 | + Note that |
| 5083 | + this **does not** automatically add records to your zone. The scan runs in the |
| 5084 | + background, and results can be reviewed later using the `/scan/review` |
| 5085 | + endpoints. Useful if you haven't updated your nameservers yet. |
| 5086 | +
|
| 5087 | + Args: |
| 5088 | + zone_id: Identifier. |
| 5089 | +
|
| 5090 | + extra_headers: Send extra headers |
| 5091 | +
|
| 5092 | + extra_query: Add additional query parameters to the request |
| 5093 | +
|
| 5094 | + extra_body: Add additional JSON properties to the request |
| 5095 | +
|
| 5096 | + timeout: Override the client-level default timeout for this request, in seconds |
| 5097 | + """ |
| 5098 | + if not zone_id: |
| 5099 | + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") |
| 5100 | + return self._post( |
| 5101 | + f"/zones/{zone_id}/dns_records/scan/trigger", |
| 5102 | + options=make_request_options( |
| 5103 | + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
| 5104 | + ), |
| 5105 | + cast_to=RecordScanTriggerResponse, |
| 5106 | + ) |
| 5107 | + |
4976 | 5108 |
|
4977 | 5109 | class AsyncRecordsResource(AsyncAPIResource): |
4978 | 5110 | @cached_property |
@@ -9903,6 +10035,135 @@ async def scan( |
9903 | 10035 | cast_to=cast(Type[Optional[RecordScanResponse]], ResultWrapper[RecordScanResponse]), |
9904 | 10036 | ) |
9905 | 10037 |
|
| 10038 | + def scan_list( |
| 10039 | + self, |
| 10040 | + *, |
| 10041 | + zone_id: str, |
| 10042 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 10043 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 10044 | + extra_headers: Headers | None = None, |
| 10045 | + extra_query: Query | None = None, |
| 10046 | + extra_body: Body | None = None, |
| 10047 | + timeout: float | httpx.Timeout | None | NotGiven = not_given, |
| 10048 | + ) -> AsyncPaginator[RecordResponse, AsyncSinglePage[RecordResponse]]: |
| 10049 | + """ |
| 10050 | + Retrieves the list of DNS records discovered up to this point by the |
| 10051 | + asynchronous scan. These records are temporary until explicitly accepted or |
| 10052 | + rejected via `POST /scan/review`. Additional records may be discovered by the |
| 10053 | + scan later. |
| 10054 | +
|
| 10055 | + Args: |
| 10056 | + zone_id: Identifier. |
| 10057 | +
|
| 10058 | + extra_headers: Send extra headers |
| 10059 | +
|
| 10060 | + extra_query: Add additional query parameters to the request |
| 10061 | +
|
| 10062 | + extra_body: Add additional JSON properties to the request |
| 10063 | +
|
| 10064 | + timeout: Override the client-level default timeout for this request, in seconds |
| 10065 | + """ |
| 10066 | + if not zone_id: |
| 10067 | + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") |
| 10068 | + return self._get_api_list( |
| 10069 | + f"/zones/{zone_id}/dns_records/scan/review", |
| 10070 | + page=AsyncSinglePage[RecordResponse], |
| 10071 | + options=make_request_options( |
| 10072 | + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
| 10073 | + ), |
| 10074 | + model=cast(Any, RecordResponse), # Union types cannot be passed in as arguments in the type system |
| 10075 | + ) |
| 10076 | + |
| 10077 | + async def scan_review( |
| 10078 | + self, |
| 10079 | + *, |
| 10080 | + zone_id: str, |
| 10081 | + accepts: Iterable[record_scan_review_params.Accept] | Omit = omit, |
| 10082 | + rejects: Iterable[record_scan_review_params.Reject] | Omit = omit, |
| 10083 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 10084 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 10085 | + extra_headers: Headers | None = None, |
| 10086 | + extra_query: Query | None = None, |
| 10087 | + extra_body: Body | None = None, |
| 10088 | + timeout: float | httpx.Timeout | None | NotGiven = not_given, |
| 10089 | + ) -> Optional[RecordScanReviewResponse]: |
| 10090 | + """Accept or reject DNS records found by the DNS records scan. |
| 10091 | +
|
| 10092 | + Accepted records |
| 10093 | + will be permanently added to the zone, while rejected records will be |
| 10094 | + permanently deleted. |
| 10095 | +
|
| 10096 | + Args: |
| 10097 | + zone_id: Identifier. |
| 10098 | +
|
| 10099 | + extra_headers: Send extra headers |
| 10100 | +
|
| 10101 | + extra_query: Add additional query parameters to the request |
| 10102 | +
|
| 10103 | + extra_body: Add additional JSON properties to the request |
| 10104 | +
|
| 10105 | + timeout: Override the client-level default timeout for this request, in seconds |
| 10106 | + """ |
| 10107 | + if not zone_id: |
| 10108 | + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") |
| 10109 | + return await self._post( |
| 10110 | + f"/zones/{zone_id}/dns_records/scan/review", |
| 10111 | + body=await async_maybe_transform( |
| 10112 | + { |
| 10113 | + "accepts": accepts, |
| 10114 | + "rejects": rejects, |
| 10115 | + }, |
| 10116 | + record_scan_review_params.RecordScanReviewParams, |
| 10117 | + ), |
| 10118 | + options=make_request_options( |
| 10119 | + extra_headers=extra_headers, |
| 10120 | + extra_query=extra_query, |
| 10121 | + extra_body=extra_body, |
| 10122 | + timeout=timeout, |
| 10123 | + post_parser=ResultWrapper[Optional[RecordScanReviewResponse]]._unwrapper, |
| 10124 | + ), |
| 10125 | + cast_to=cast(Type[Optional[RecordScanReviewResponse]], ResultWrapper[RecordScanReviewResponse]), |
| 10126 | + ) |
| 10127 | + |
| 10128 | + async def scan_trigger( |
| 10129 | + self, |
| 10130 | + *, |
| 10131 | + zone_id: str, |
| 10132 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 10133 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 10134 | + extra_headers: Headers | None = None, |
| 10135 | + extra_query: Query | None = None, |
| 10136 | + extra_body: Body | None = None, |
| 10137 | + timeout: float | httpx.Timeout | None | NotGiven = not_given, |
| 10138 | + ) -> RecordScanTriggerResponse: |
| 10139 | + """Initiates an asynchronous scan for common DNS records on your domain. |
| 10140 | +
|
| 10141 | + Note that |
| 10142 | + this **does not** automatically add records to your zone. The scan runs in the |
| 10143 | + background, and results can be reviewed later using the `/scan/review` |
| 10144 | + endpoints. Useful if you haven't updated your nameservers yet. |
| 10145 | +
|
| 10146 | + Args: |
| 10147 | + zone_id: Identifier. |
| 10148 | +
|
| 10149 | + extra_headers: Send extra headers |
| 10150 | +
|
| 10151 | + extra_query: Add additional query parameters to the request |
| 10152 | +
|
| 10153 | + extra_body: Add additional JSON properties to the request |
| 10154 | +
|
| 10155 | + timeout: Override the client-level default timeout for this request, in seconds |
| 10156 | + """ |
| 10157 | + if not zone_id: |
| 10158 | + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") |
| 10159 | + return await self._post( |
| 10160 | + f"/zones/{zone_id}/dns_records/scan/trigger", |
| 10161 | + options=make_request_options( |
| 10162 | + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
| 10163 | + ), |
| 10164 | + cast_to=RecordScanTriggerResponse, |
| 10165 | + ) |
| 10166 | + |
9906 | 10167 |
|
9907 | 10168 | class RecordsResourceWithRawResponse: |
9908 | 10169 | def __init__(self, records: RecordsResource) -> None: |
@@ -9940,6 +10201,15 @@ def __init__(self, records: RecordsResource) -> None: |
9940 | 10201 | records.scan, # pyright: ignore[reportDeprecated], |
9941 | 10202 | ) |
9942 | 10203 | ) |
| 10204 | + self.scan_list = to_raw_response_wrapper( |
| 10205 | + records.scan_list, |
| 10206 | + ) |
| 10207 | + self.scan_review = to_raw_response_wrapper( |
| 10208 | + records.scan_review, |
| 10209 | + ) |
| 10210 | + self.scan_trigger = to_raw_response_wrapper( |
| 10211 | + records.scan_trigger, |
| 10212 | + ) |
9943 | 10213 |
|
9944 | 10214 |
|
9945 | 10215 | class AsyncRecordsResourceWithRawResponse: |
@@ -9978,6 +10248,15 @@ def __init__(self, records: AsyncRecordsResource) -> None: |
9978 | 10248 | records.scan, # pyright: ignore[reportDeprecated], |
9979 | 10249 | ) |
9980 | 10250 | ) |
| 10251 | + self.scan_list = async_to_raw_response_wrapper( |
| 10252 | + records.scan_list, |
| 10253 | + ) |
| 10254 | + self.scan_review = async_to_raw_response_wrapper( |
| 10255 | + records.scan_review, |
| 10256 | + ) |
| 10257 | + self.scan_trigger = async_to_raw_response_wrapper( |
| 10258 | + records.scan_trigger, |
| 10259 | + ) |
9981 | 10260 |
|
9982 | 10261 |
|
9983 | 10262 | class RecordsResourceWithStreamingResponse: |
@@ -10016,6 +10295,15 @@ def __init__(self, records: RecordsResource) -> None: |
10016 | 10295 | records.scan, # pyright: ignore[reportDeprecated], |
10017 | 10296 | ) |
10018 | 10297 | ) |
| 10298 | + self.scan_list = to_streamed_response_wrapper( |
| 10299 | + records.scan_list, |
| 10300 | + ) |
| 10301 | + self.scan_review = to_streamed_response_wrapper( |
| 10302 | + records.scan_review, |
| 10303 | + ) |
| 10304 | + self.scan_trigger = to_streamed_response_wrapper( |
| 10305 | + records.scan_trigger, |
| 10306 | + ) |
10019 | 10307 |
|
10020 | 10308 |
|
10021 | 10309 | class AsyncRecordsResourceWithStreamingResponse: |
@@ -10054,3 +10342,12 @@ def __init__(self, records: AsyncRecordsResource) -> None: |
10054 | 10342 | records.scan, # pyright: ignore[reportDeprecated], |
10055 | 10343 | ) |
10056 | 10344 | ) |
| 10345 | + self.scan_list = async_to_streamed_response_wrapper( |
| 10346 | + records.scan_list, |
| 10347 | + ) |
| 10348 | + self.scan_review = async_to_streamed_response_wrapper( |
| 10349 | + records.scan_review, |
| 10350 | + ) |
| 10351 | + self.scan_trigger = async_to_streamed_response_wrapper( |
| 10352 | + records.scan_trigger, |
| 10353 | + ) |
0 commit comments