Skip to content

feat(fleet_status): update path placeholders to match conventions #2153

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 1416
configured_endpoints: 1417
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-cc1685d89cdcb1a8b9f5eada60808601470876a497be8898010890736c20e77f.yml
12 changes: 12 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4812,6 +4812,18 @@ Methods:
- <code title="delete /accounts/{account_id}/devices/networks/{network_id}">client.zero_trust.devices.networks.<a href="./src/cloudflare/resources/zero_trust/devices/networks.py">delete</a>(network_id, \*, account_id) -> <a href="./src/cloudflare/types/zero_trust/devices/network_delete_response.py">Optional</a></code>
- <code title="get /accounts/{account_id}/devices/networks/{network_id}">client.zero_trust.devices.networks.<a href="./src/cloudflare/resources/zero_trust/devices/networks.py">get</a>(network_id, \*, account_id) -> <a href="./src/cloudflare/types/zero_trust/devices/device_network.py">Optional</a></code>

### FleetStatus

Types:

```python
from cloudflare.types.zero_trust.devices import FleetStatusGetResponse
```

Methods:

- <code title="get /accounts/{account_id}/devices/{device_id}/fleet-status/live">client.zero_trust.devices.fleet_status.<a href="./src/cloudflare/resources/zero_trust/devices/fleet_status.py">get</a>(device_id, \*, account_id, \*\*<a href="src/cloudflare/types/zero_trust/devices/fleet_status_get_params.py">params</a>) -> <a href="./src/cloudflare/types/zero_trust/devices/fleet_status_get_response.py">FleetStatusGetResponse</a></code>

### Policies

Types:
Expand Down
14 changes: 14 additions & 0 deletions src/cloudflare/resources/zero_trust/devices/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@
DEXTestsResourceWithStreamingResponse,
AsyncDEXTestsResourceWithStreamingResponse,
)
from .fleet_status import (
FleetStatusResource,
AsyncFleetStatusResource,
FleetStatusResourceWithRawResponse,
AsyncFleetStatusResourceWithRawResponse,
FleetStatusResourceWithStreamingResponse,
AsyncFleetStatusResourceWithStreamingResponse,
)
from .override_codes import (
OverrideCodesResource,
AsyncOverrideCodesResource,
Expand All @@ -86,6 +94,12 @@
"AsyncNetworksResourceWithRawResponse",
"NetworksResourceWithStreamingResponse",
"AsyncNetworksResourceWithStreamingResponse",
"FleetStatusResource",
"AsyncFleetStatusResource",
"FleetStatusResourceWithRawResponse",
"AsyncFleetStatusResourceWithRawResponse",
"FleetStatusResourceWithStreamingResponse",
"AsyncFleetStatusResourceWithStreamingResponse",
"PoliciesResource",
"AsyncPoliciesResource",
"PoliciesResourceWithRawResponse",
Expand Down
32 changes: 32 additions & 0 deletions src/cloudflare/resources/zero_trust/devices/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@
async_to_streamed_response_wrapper,
)
from ...._wrappers import ResultWrapper
from .fleet_status import (
FleetStatusResource,
AsyncFleetStatusResource,
FleetStatusResourceWithRawResponse,
AsyncFleetStatusResourceWithRawResponse,
FleetStatusResourceWithStreamingResponse,
AsyncFleetStatusResourceWithStreamingResponse,
)
from ....pagination import SyncSinglePage, AsyncSinglePage
from .override_codes import (
OverrideCodesResource,
Expand Down Expand Up @@ -99,6 +107,10 @@ def dex_tests(self) -> DEXTestsResource:
def networks(self) -> NetworksResource:
return NetworksResource(self._client)

@cached_property
def fleet_status(self) -> FleetStatusResource:
return FleetStatusResource(self._client)

@cached_property
def policies(self) -> PoliciesResource:
return PoliciesResource(self._client)
Expand Down Expand Up @@ -233,6 +245,10 @@ def dex_tests(self) -> AsyncDEXTestsResource:
def networks(self) -> AsyncNetworksResource:
return AsyncNetworksResource(self._client)

@cached_property
def fleet_status(self) -> AsyncFleetStatusResource:
return AsyncFleetStatusResource(self._client)

@cached_property
def policies(self) -> AsyncPoliciesResource:
return AsyncPoliciesResource(self._client)
Expand Down Expand Up @@ -377,6 +393,10 @@ def dex_tests(self) -> DEXTestsResourceWithRawResponse:
def networks(self) -> NetworksResourceWithRawResponse:
return NetworksResourceWithRawResponse(self._devices.networks)

@cached_property
def fleet_status(self) -> FleetStatusResourceWithRawResponse:
return FleetStatusResourceWithRawResponse(self._devices.fleet_status)

@cached_property
def policies(self) -> PoliciesResourceWithRawResponse:
return PoliciesResourceWithRawResponse(self._devices.policies)
Expand Down Expand Up @@ -421,6 +441,10 @@ def dex_tests(self) -> AsyncDEXTestsResourceWithRawResponse:
def networks(self) -> AsyncNetworksResourceWithRawResponse:
return AsyncNetworksResourceWithRawResponse(self._devices.networks)

@cached_property
def fleet_status(self) -> AsyncFleetStatusResourceWithRawResponse:
return AsyncFleetStatusResourceWithRawResponse(self._devices.fleet_status)

@cached_property
def policies(self) -> AsyncPoliciesResourceWithRawResponse:
return AsyncPoliciesResourceWithRawResponse(self._devices.policies)
Expand Down Expand Up @@ -465,6 +489,10 @@ def dex_tests(self) -> DEXTestsResourceWithStreamingResponse:
def networks(self) -> NetworksResourceWithStreamingResponse:
return NetworksResourceWithStreamingResponse(self._devices.networks)

@cached_property
def fleet_status(self) -> FleetStatusResourceWithStreamingResponse:
return FleetStatusResourceWithStreamingResponse(self._devices.fleet_status)

@cached_property
def policies(self) -> PoliciesResourceWithStreamingResponse:
return PoliciesResourceWithStreamingResponse(self._devices.policies)
Expand Down Expand Up @@ -509,6 +537,10 @@ def dex_tests(self) -> AsyncDEXTestsResourceWithStreamingResponse:
def networks(self) -> AsyncNetworksResourceWithStreamingResponse:
return AsyncNetworksResourceWithStreamingResponse(self._devices.networks)

@cached_property
def fleet_status(self) -> AsyncFleetStatusResourceWithStreamingResponse:
return AsyncFleetStatusResourceWithStreamingResponse(self._devices.fleet_status)

@cached_property
def policies(self) -> AsyncPoliciesResourceWithStreamingResponse:
return AsyncPoliciesResourceWithStreamingResponse(self._devices.policies)
Expand Down
220 changes: 220 additions & 0 deletions src/cloudflare/resources/zero_trust/devices/fleet_status.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,220 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

import httpx

from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from ...._utils import (
maybe_transform,
async_maybe_transform,
)
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
from ...._response import (
to_raw_response_wrapper,
to_streamed_response_wrapper,
async_to_raw_response_wrapper,
async_to_streamed_response_wrapper,
)
from ...._base_client import make_request_options
from ....types.zero_trust.devices import fleet_status_get_params
from ....types.zero_trust.devices.fleet_status_get_response import FleetStatusGetResponse

__all__ = ["FleetStatusResource", "AsyncFleetStatusResource"]


class FleetStatusResource(SyncAPIResource):
@cached_property
def with_raw_response(self) -> FleetStatusResourceWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return the
the raw response object instead of the parsed content.

For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
"""
return FleetStatusResourceWithRawResponse(self)

@cached_property
def with_streaming_response(self) -> FleetStatusResourceWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
"""
return FleetStatusResourceWithStreamingResponse(self)

def get(
self,
device_id: str,
*,
account_id: str,
since_minutes: float,
colo: str | NotGiven = NOT_GIVEN,
time_now: str | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> FleetStatusGetResponse:
"""
Get the live status of a latest device given device_id from the device_state
table

Args:
device_id: Device-specific ID, given as UUID v4

since_minutes: Number of minutes before current time

colo: List of data centers to filter results

time_now: Number of minutes before current time

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not device_id:
raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}")
return self._get(
f"/accounts/{account_id}/devices/{device_id}/fleet-status/live",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
query=maybe_transform(
{
"since_minutes": since_minutes,
"colo": colo,
"time_now": time_now,
},
fleet_status_get_params.FleetStatusGetParams,
),
),
cast_to=FleetStatusGetResponse,
)


class AsyncFleetStatusResource(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncFleetStatusResourceWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return the
the raw response object instead of the parsed content.

For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
"""
return AsyncFleetStatusResourceWithRawResponse(self)

@cached_property
def with_streaming_response(self) -> AsyncFleetStatusResourceWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
"""
return AsyncFleetStatusResourceWithStreamingResponse(self)

async def get(
self,
device_id: str,
*,
account_id: str,
since_minutes: float,
colo: str | NotGiven = NOT_GIVEN,
time_now: str | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> FleetStatusGetResponse:
"""
Get the live status of a latest device given device_id from the device_state
table

Args:
device_id: Device-specific ID, given as UUID v4

since_minutes: Number of minutes before current time

colo: List of data centers to filter results

time_now: Number of minutes before current time

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not device_id:
raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}")
return await self._get(
f"/accounts/{account_id}/devices/{device_id}/fleet-status/live",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
query=await async_maybe_transform(
{
"since_minutes": since_minutes,
"colo": colo,
"time_now": time_now,
},
fleet_status_get_params.FleetStatusGetParams,
),
),
cast_to=FleetStatusGetResponse,
)


class FleetStatusResourceWithRawResponse:
def __init__(self, fleet_status: FleetStatusResource) -> None:
self._fleet_status = fleet_status

self.get = to_raw_response_wrapper(
fleet_status.get,
)


class AsyncFleetStatusResourceWithRawResponse:
def __init__(self, fleet_status: AsyncFleetStatusResource) -> None:
self._fleet_status = fleet_status

self.get = async_to_raw_response_wrapper(
fleet_status.get,
)


class FleetStatusResourceWithStreamingResponse:
def __init__(self, fleet_status: FleetStatusResource) -> None:
self._fleet_status = fleet_status

self.get = to_streamed_response_wrapper(
fleet_status.get,
)


class AsyncFleetStatusResourceWithStreamingResponse:
def __init__(self, fleet_status: AsyncFleetStatusResource) -> None:
self._fleet_status = fleet_status

self.get = async_to_streamed_response_wrapper(
fleet_status.get,
)
2 changes: 2 additions & 0 deletions src/cloudflare/types/zero_trust/devices/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,15 @@
from .unique_client_id_input import UniqueClientIDInput as UniqueClientIDInput
from .unrevoke_create_params import UnrevokeCreateParams as UnrevokeCreateParams
from .crowdstrike_input_param import CrowdstrikeInputParam as CrowdstrikeInputParam
from .fleet_status_get_params import FleetStatusGetParams as FleetStatusGetParams
from .network_delete_response import NetworkDeleteResponse as NetworkDeleteResponse
from .posture_delete_response import PostureDeleteResponse as PostureDeleteResponse
from .sentinelone_input_param import SentineloneInputParam as SentineloneInputParam
from .client_certificate_input import ClientCertificateInput as ClientCertificateInput
from .dex_test_delete_response import DEXTestDeleteResponse as DEXTestDeleteResponse
from .unrevoke_create_response import UnrevokeCreateResponse as UnrevokeCreateResponse
from .domain_joined_input_param import DomainJoinedInputParam as DomainJoinedInputParam
from .fleet_status_get_response import FleetStatusGetResponse as FleetStatusGetResponse
from .workspace_one_input_param import WorkspaceOneInputParam as WorkspaceOneInputParam
from .split_tunnel_exclude_param import SplitTunnelExcludeParam as SplitTunnelExcludeParam
from .split_tunnel_include_param import SplitTunnelIncludeParam as SplitTunnelIncludeParam
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from typing_extensions import Required, TypedDict

__all__ = ["FleetStatusGetParams"]


class FleetStatusGetParams(TypedDict, total=False):
account_id: Required[str]

since_minutes: Required[float]
"""Number of minutes before current time"""

colo: str
"""List of data centers to filter results"""

time_now: str
"""Number of minutes before current time"""
Loading