Skip to content
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: 1547
configured_endpoints: 1548
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-cc9be7885f16989f56e5e015644178eb17b82304fc31f62ed14b7e9a93cab891.yml
14 changes: 14 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -3951,6 +3951,20 @@ Methods:

# MagicNetworkMonitoring

## VpcFlows

### Tokens

Types:

```python
from cloudflare.types.magic_network_monitoring.vpc_flows import TokenCreateResponse
```

Methods:

- <code title="post /accounts/{account_id}/mnm/vpc-flows/token">client.magic_network_monitoring.vpc_flows.tokens.<a href="./src/cloudflare/resources/magic_network_monitoring/vpc_flows/tokens.py">create</a>(\*, account_id) -> <a href="./src/cloudflare/types/magic_network_monitoring/vpc_flows/token_create_response.py">str</a></code>

## Configs

Types:
Expand Down
14 changes: 14 additions & 0 deletions src/cloudflare/resources/magic_network_monitoring/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@
ConfigsResourceWithStreamingResponse,
AsyncConfigsResourceWithStreamingResponse,
)
from .vpc_flows import (
VpcFlowsResource,
AsyncVpcFlowsResource,
VpcFlowsResourceWithRawResponse,
AsyncVpcFlowsResourceWithRawResponse,
VpcFlowsResourceWithStreamingResponse,
AsyncVpcFlowsResourceWithStreamingResponse,
)
from .magic_network_monitoring import (
MagicNetworkMonitoringResource,
AsyncMagicNetworkMonitoringResource,
Expand All @@ -26,6 +34,12 @@
)

__all__ = [
"VpcFlowsResource",
"AsyncVpcFlowsResource",
"VpcFlowsResourceWithRawResponse",
"AsyncVpcFlowsResourceWithRawResponse",
"VpcFlowsResourceWithStreamingResponse",
"AsyncVpcFlowsResourceWithStreamingResponse",
"ConfigsResource",
"AsyncConfigsResource",
"ConfigsResourceWithRawResponse",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,23 @@
ConfigsResourceWithStreamingResponse,
AsyncConfigsResourceWithStreamingResponse,
)
from .vpc_flows.vpc_flows import (
VpcFlowsResource,
AsyncVpcFlowsResource,
VpcFlowsResourceWithRawResponse,
AsyncVpcFlowsResourceWithRawResponse,
VpcFlowsResourceWithStreamingResponse,
AsyncVpcFlowsResourceWithStreamingResponse,
)

__all__ = ["MagicNetworkMonitoringResource", "AsyncMagicNetworkMonitoringResource"]


class MagicNetworkMonitoringResource(SyncAPIResource):
@cached_property
def vpc_flows(self) -> VpcFlowsResource:
return VpcFlowsResource(self._client)

@cached_property
def configs(self) -> ConfigsResource:
return ConfigsResource(self._client)
Expand Down Expand Up @@ -54,6 +66,10 @@ def with_streaming_response(self) -> MagicNetworkMonitoringResourceWithStreaming


class AsyncMagicNetworkMonitoringResource(AsyncAPIResource):
@cached_property
def vpc_flows(self) -> AsyncVpcFlowsResource:
return AsyncVpcFlowsResource(self._client)

@cached_property
def configs(self) -> AsyncConfigsResource:
return AsyncConfigsResource(self._client)
Expand Down Expand Up @@ -86,6 +102,10 @@ class MagicNetworkMonitoringResourceWithRawResponse:
def __init__(self, magic_network_monitoring: MagicNetworkMonitoringResource) -> None:
self._magic_network_monitoring = magic_network_monitoring

@cached_property
def vpc_flows(self) -> VpcFlowsResourceWithRawResponse:
return VpcFlowsResourceWithRawResponse(self._magic_network_monitoring.vpc_flows)

@cached_property
def configs(self) -> ConfigsResourceWithRawResponse:
return ConfigsResourceWithRawResponse(self._magic_network_monitoring.configs)
Expand All @@ -99,6 +119,10 @@ class AsyncMagicNetworkMonitoringResourceWithRawResponse:
def __init__(self, magic_network_monitoring: AsyncMagicNetworkMonitoringResource) -> None:
self._magic_network_monitoring = magic_network_monitoring

@cached_property
def vpc_flows(self) -> AsyncVpcFlowsResourceWithRawResponse:
return AsyncVpcFlowsResourceWithRawResponse(self._magic_network_monitoring.vpc_flows)

@cached_property
def configs(self) -> AsyncConfigsResourceWithRawResponse:
return AsyncConfigsResourceWithRawResponse(self._magic_network_monitoring.configs)
Expand All @@ -112,6 +136,10 @@ class MagicNetworkMonitoringResourceWithStreamingResponse:
def __init__(self, magic_network_monitoring: MagicNetworkMonitoringResource) -> None:
self._magic_network_monitoring = magic_network_monitoring

@cached_property
def vpc_flows(self) -> VpcFlowsResourceWithStreamingResponse:
return VpcFlowsResourceWithStreamingResponse(self._magic_network_monitoring.vpc_flows)

@cached_property
def configs(self) -> ConfigsResourceWithStreamingResponse:
return ConfigsResourceWithStreamingResponse(self._magic_network_monitoring.configs)
Expand All @@ -125,6 +153,10 @@ class AsyncMagicNetworkMonitoringResourceWithStreamingResponse:
def __init__(self, magic_network_monitoring: AsyncMagicNetworkMonitoringResource) -> None:
self._magic_network_monitoring = magic_network_monitoring

@cached_property
def vpc_flows(self) -> AsyncVpcFlowsResourceWithStreamingResponse:
return AsyncVpcFlowsResourceWithStreamingResponse(self._magic_network_monitoring.vpc_flows)

@cached_property
def configs(self) -> AsyncConfigsResourceWithStreamingResponse:
return AsyncConfigsResourceWithStreamingResponse(self._magic_network_monitoring.configs)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from .tokens import (
TokensResource,
AsyncTokensResource,
TokensResourceWithRawResponse,
AsyncTokensResourceWithRawResponse,
TokensResourceWithStreamingResponse,
AsyncTokensResourceWithStreamingResponse,
)
from .vpc_flows import (
VpcFlowsResource,
AsyncVpcFlowsResource,
VpcFlowsResourceWithRawResponse,
AsyncVpcFlowsResourceWithRawResponse,
VpcFlowsResourceWithStreamingResponse,
AsyncVpcFlowsResourceWithStreamingResponse,
)

__all__ = [
"TokensResource",
"AsyncTokensResource",
"TokensResourceWithRawResponse",
"AsyncTokensResourceWithRawResponse",
"TokensResourceWithStreamingResponse",
"AsyncTokensResourceWithStreamingResponse",
"VpcFlowsResource",
"AsyncVpcFlowsResource",
"VpcFlowsResourceWithRawResponse",
"AsyncVpcFlowsResourceWithRawResponse",
"VpcFlowsResourceWithStreamingResponse",
"AsyncVpcFlowsResourceWithStreamingResponse",
]
174 changes: 174 additions & 0 deletions src/cloudflare/resources/magic_network_monitoring/vpc_flows/tokens.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from typing import Type, cast

import httpx

from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
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 ...._wrappers import ResultWrapper
from ...._base_client import make_request_options
from ....types.magic_network_monitoring.vpc_flows.token_create_response import TokenCreateResponse

__all__ = ["TokensResource", "AsyncTokensResource"]


class TokensResource(SyncAPIResource):
@cached_property
def with_raw_response(self) -> TokensResourceWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return
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 TokensResourceWithRawResponse(self)

@cached_property
def with_streaming_response(self) -> TokensResourceWithStreamingResponse:
"""
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 TokensResourceWithStreamingResponse(self)

def create(
self,
*,
account_id: str,
# 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,
) -> str:
"""
Generate authentication token for VPC flow logs export.

Args:
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}")
return self._post(
f"/accounts/{account_id}/mnm/vpc-flows/token",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[TokenCreateResponse]._unwrapper,
),
cast_to=cast(Type[str], ResultWrapper[str]),
)


class AsyncTokensResource(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncTokensResourceWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return
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 AsyncTokensResourceWithRawResponse(self)

@cached_property
def with_streaming_response(self) -> AsyncTokensResourceWithStreamingResponse:
"""
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 AsyncTokensResourceWithStreamingResponse(self)

async def create(
self,
*,
account_id: str,
# 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,
) -> str:
"""
Generate authentication token for VPC flow logs export.

Args:
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}")
return await self._post(
f"/accounts/{account_id}/mnm/vpc-flows/token",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[TokenCreateResponse]._unwrapper,
),
cast_to=cast(Type[str], ResultWrapper[str]),
)


class TokensResourceWithRawResponse:
def __init__(self, tokens: TokensResource) -> None:
self._tokens = tokens

self.create = to_raw_response_wrapper(
tokens.create,
)


class AsyncTokensResourceWithRawResponse:
def __init__(self, tokens: AsyncTokensResource) -> None:
self._tokens = tokens

self.create = async_to_raw_response_wrapper(
tokens.create,
)


class TokensResourceWithStreamingResponse:
def __init__(self, tokens: TokensResource) -> None:
self._tokens = tokens

self.create = to_streamed_response_wrapper(
tokens.create,
)


class AsyncTokensResourceWithStreamingResponse:
def __init__(self, tokens: AsyncTokensResource) -> None:
self._tokens = tokens

self.create = async_to_streamed_response_wrapper(
tokens.create,
)
Loading